From 5241478a5c7e64a1fc8694d86f8c80ce0046085e Mon Sep 17 00:00:00 2001 From: John McLear Date: Tue, 2 Jun 2026 18:57:50 +0100 Subject: [PATCH] feat: add form select matching Etherpad nice-select MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The library had no native-s): - nice-select DOM/visuals: .nice-select box + rotating chevron, .list popup with the colibris palette (bg-soft box, bg-color option hover/selected, bold selected, greyed disabled). - API: options[{value,label,disabled?}], value (reflected), placeholder, disabled, name; fires ep-select:change {value,label}. - Keyboard: Enter/Space toggle+select, Arrow up/down (skips disabled), Escape; closes on outside click. Built test-first; 6 Storybook play-function tests cover render, open, select+event, preselected value, disabled box, disabled option. Suite is now 88 tests across 16 files. Carries the dlx→exec Playwright CI fix. Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/ci.yml | 2 +- package.json | 1 + src/EpSelect.ts | 249 ++++++++++++++++++++++++++++++++++++ src/index.ts | 2 + stories/EpSelect.stories.ts | 112 ++++++++++++++++ 5 files changed, 365 insertions(+), 1 deletion(-) create mode 100644 src/EpSelect.ts create mode 100644 stories/EpSelect.stories.ts diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8d1a59e..30847a1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,7 +67,7 @@ jobs: - run: pnpm install --frozen-lockfile - name: Install Playwright browsers - run: pnpm dlx playwright install --with-deps chromium + run: pnpm exec playwright install --with-deps chromium - name: Run tests run: pnpm test diff --git a/package.json b/package.json index e764e9a..0fb7498 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "./EpNotification.js": "./dist/EpNotification.js", "./EpToast.js": "./dist/EpToast.js", "./EpToolbarSelect.js": "./dist/EpToolbarSelect.js", + "./EpSelect.js": "./dist/EpSelect.js", "./EpUserBadge.js": "./dist/EpUserBadge.js", "./EpTheme.js": "./dist/EpTheme.js", "./EpEditor.js": "./dist/EpEditor.js", diff --git a/src/EpSelect.ts b/src/EpSelect.ts new file mode 100644 index 0000000..5c6b6bd --- /dev/null +++ b/src/EpSelect.ts @@ -0,0 +1,249 @@ +import { LitElement, html, css } from 'lit'; +import { customElement, property, state } from 'lit/decorators.js'; +import { classMap } from 'lit/directives/class-map.js'; + +export interface EpSelectOption { + value: string; + label: string; + disabled?: boolean; +} + +/** + * `` — a styled form select, matching Etherpad colibris's + * nice-select look (the plugin Etherpad uses to skin native `