@editora/ui-core 0.1.25 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +124 -0
- package/dist/accordion.cjs.js +13 -12
- package/dist/accordion.esm.js +13 -12
- package/dist/alert-dialog.cjs.js +76 -45
- package/dist/alert-dialog.esm.js +179 -135
- package/dist/alert.cjs.js +41 -32
- package/dist/alert.esm.js +79 -70
- package/dist/animated-beam.cjs.js +42 -50
- package/dist/animated-beam.esm.js +47 -55
- package/dist/animated-list.cjs.js +11 -27
- package/dist/animated-list.esm.js +12 -28
- package/dist/animated-text.cjs.js +4 -4
- package/dist/animated-text.esm.js +4 -4
- package/dist/app-header.cjs.js +5 -5
- package/dist/app-header.esm.js +6 -6
- package/dist/aspect-ratio.cjs.js +10 -12
- package/dist/aspect-ratio.esm.js +11 -13
- package/dist/avatar.cjs.js +13 -17
- package/dist/avatar.esm.js +13 -17
- package/dist/badge.cjs.js +27 -22
- package/dist/badge.esm.js +32 -27
- package/dist/block-controls.cjs.js +11 -12
- package/dist/block-controls.esm.js +8 -9
- package/dist/box.cjs.js +2 -3
- package/dist/box.esm.js +2 -3
- package/dist/breadcrumb.cjs.js +12 -18
- package/dist/breadcrumb.esm.js +11 -17
- package/dist/button.cjs.js +1 -1
- package/dist/button.esm.js +1 -1
- package/dist/{calendar-B3PUKHQm.mjs → calendar-DmxiZrR7.mjs} +126 -117
- package/dist/{calendar-D-mXMgqc.js → calendar-o273O28D.js} +53 -44
- package/dist/calendar.cjs.js +1 -1
- package/dist/calendar.esm.js +1 -1
- package/dist/card.cjs.js +6 -7
- package/dist/card.esm.js +5 -6
- package/dist/chart.cjs.js +52 -52
- package/dist/chart.esm.js +95 -95
- package/dist/checkbox.cjs.js +19 -15
- package/dist/checkbox.esm.js +19 -15
- package/dist/collapsible.cjs.js +7 -11
- package/dist/collapsible.esm.js +7 -11
- package/dist/color-picker.cjs.js +36 -17
- package/dist/color-picker.esm.js +132 -113
- package/dist/combobox.cjs.js +57 -54
- package/dist/combobox.esm.js +62 -58
- package/dist/command-palette.cjs.js +1 -0
- package/dist/command-palette.esm.js +1 -0
- package/dist/command.cjs.js +32 -14
- package/dist/command.esm.js +46 -28
- package/dist/components/date-time-utils.d.ts.map +1 -1
- package/dist/components/ui-accordion.d.ts.map +1 -1
- package/dist/components/ui-alert-dialog.d.ts +2 -0
- package/dist/components/ui-alert-dialog.d.ts.map +1 -1
- package/dist/components/ui-alert.d.ts.map +1 -1
- package/dist/components/ui-animated-beam.d.ts.map +1 -1
- package/dist/components/ui-animated-list.d.ts.map +1 -1
- package/dist/components/ui-aspect-ratio.d.ts.map +1 -1
- package/dist/components/ui-avatar.d.ts.map +1 -1
- package/dist/components/ui-badge.d.ts.map +1 -1
- package/dist/components/ui-block-controls.d.ts.map +1 -1
- package/dist/components/ui-box.d.ts.map +1 -1
- package/dist/components/ui-breadcrumb.d.ts.map +1 -1
- package/dist/components/ui-button.d.ts.map +1 -1
- package/dist/components/ui-calendar.d.ts.map +1 -1
- package/dist/components/ui-card.d.ts.map +1 -1
- package/dist/components/ui-checkbox.d.ts.map +1 -1
- package/dist/components/ui-collapsible.d.ts.map +1 -1
- package/dist/components/ui-color-picker.d.ts.map +1 -1
- package/dist/components/ui-combobox.d.ts.map +1 -1
- package/dist/components/ui-command-palette.d.ts.map +1 -1
- package/dist/components/ui-command.d.ts.map +1 -1
- package/dist/components/ui-container.d.ts.map +1 -1
- package/dist/components/ui-context-menu.d.ts.map +1 -1
- package/dist/components/ui-data-table.d.ts +7 -0
- package/dist/components/ui-data-table.d.ts.map +1 -1
- package/dist/components/ui-date-picker.d.ts.map +1 -1
- package/dist/components/ui-date-range-picker.d.ts.map +1 -1
- package/dist/components/ui-date-range-time-picker.d.ts.map +1 -1
- package/dist/components/ui-date-time-picker.d.ts.map +1 -1
- package/dist/components/ui-dialog.d.ts +2 -0
- package/dist/components/ui-dialog.d.ts.map +1 -1
- package/dist/components/ui-dock.d.ts.map +1 -1
- package/dist/components/ui-drawer.d.ts.map +1 -1
- package/dist/components/ui-dropdown.d.ts.map +1 -1
- package/dist/components/ui-empty-state.d.ts.map +1 -1
- package/dist/components/ui-field.d.ts.map +1 -1
- package/dist/components/ui-fieldset.d.ts.map +1 -1
- package/dist/components/ui-file-upload.d.ts.map +1 -1
- package/dist/components/ui-floating-toolbar.d.ts.map +1 -1
- package/dist/components/ui-form.d.ts.map +1 -1
- package/dist/components/ui-icon-cloud.d.ts.map +1 -1
- package/dist/components/ui-inline-edit.d.ts.map +1 -1
- package/dist/components/ui-input.d.ts.map +1 -1
- package/dist/components/ui-marquee.d.ts.map +1 -1
- package/dist/components/ui-menu.d.ts.map +1 -1
- package/dist/components/ui-menubar.d.ts.map +1 -1
- package/dist/components/ui-meter.d.ts.map +1 -1
- package/dist/components/ui-multi-select.d.ts.map +1 -1
- package/dist/components/ui-number-field.d.ts.map +1 -1
- package/dist/components/ui-orbiter.d.ts.map +1 -1
- package/dist/components/ui-pagination.d.ts.map +1 -1
- package/dist/components/ui-password-field.d.ts.map +1 -1
- package/dist/components/ui-pin-input.d.ts.map +1 -1
- package/dist/components/ui-popover.d.ts.map +1 -1
- package/dist/components/ui-progress.d.ts.map +1 -1
- package/dist/components/ui-radio-group.d.ts.map +1 -1
- package/dist/components/ui-radio.d.ts.map +1 -1
- package/dist/components/ui-rating.d.ts +1 -0
- package/dist/components/ui-rating.d.ts.map +1 -1
- package/dist/components/ui-scroll-area.d.ts.map +1 -1
- package/dist/components/ui-section.d.ts.map +1 -1
- package/dist/components/ui-select.d.ts.map +1 -1
- package/dist/components/ui-selection-popup.d.ts.map +1 -1
- package/dist/components/ui-slider.d.ts.map +1 -1
- package/dist/components/ui-sortable.d.ts.map +1 -1
- package/dist/components/ui-spinning-text.d.ts.map +1 -1
- package/dist/components/ui-split-button.d.ts.map +1 -1
- package/dist/components/ui-splitter.d.ts.map +1 -1
- package/dist/components/ui-stepper.d.ts.map +1 -1
- package/dist/components/ui-switch.d.ts.map +1 -1
- package/dist/components/ui-tabs.d.ts.map +1 -1
- package/dist/components/ui-tags-input.d.ts.map +1 -1
- package/dist/components/ui-textarea.d.ts.map +1 -1
- package/dist/components/ui-time-picker.d.ts.map +1 -1
- package/dist/components/ui-toggle-group.d.ts +2 -0
- package/dist/components/ui-toggle-group.d.ts.map +1 -1
- package/dist/components/ui-toggle.d.ts.map +1 -1
- package/dist/components/ui-toolbar.d.ts +2 -0
- package/dist/components/ui-toolbar.d.ts.map +1 -1
- package/dist/components/ui-tooltip.d.ts.map +1 -1
- package/dist/components/ui-transfer-list.d.ts.map +1 -1
- package/dist/components/ui-tree-item.d.ts.map +1 -1
- package/dist/components/ui-tree.d.ts.map +1 -1
- package/dist/components/ui-wizard.d.ts.map +1 -1
- package/dist/container.cjs.js +6 -12
- package/dist/container.esm.js +8 -14
- package/dist/context-menu.cjs.js +8 -8
- package/dist/context-menu.esm.js +42 -41
- package/dist/data-table.cjs.js +18 -15
- package/dist/data-table.esm.js +207 -187
- package/dist/date-field.cjs.js +8 -8
- package/dist/date-field.esm.js +7 -7
- package/dist/date-picker.cjs.js +27 -18
- package/dist/date-picker.esm.js +57 -48
- package/dist/date-range-picker.cjs.js +22 -17
- package/dist/date-range-picker.esm.js +31 -26
- package/dist/date-range-time-picker.cjs.js +26 -19
- package/dist/date-range-time-picker.esm.js +23 -16
- package/dist/date-time-picker.cjs.js +23 -16
- package/dist/date-time-picker.esm.js +88 -81
- package/dist/{date-time-utils-BTlxnz5j.mjs → date-time-utils-B4hAkt36.mjs} +75 -68
- package/dist/date-time-utils-DdigV4hs.js +1 -0
- package/dist/dialog.cjs.js +57 -41
- package/dist/dialog.esm.js +84 -51
- package/dist/dock.cjs.js +16 -30
- package/dist/dock.esm.js +26 -40
- package/dist/drawer.cjs.js +8 -12
- package/dist/drawer.esm.js +6 -10
- package/dist/dropdown.cjs.js +8 -6
- package/dist/dropdown.esm.js +33 -30
- package/dist/empty-state.cjs.js +17 -15
- package/dist/empty-state.esm.js +13 -11
- package/dist/field.cjs.js +22 -13
- package/dist/field.esm.js +54 -45
- package/dist/fieldset.cjs.js +18 -11
- package/dist/fieldset.esm.js +20 -13
- package/dist/file-upload.cjs.js +77 -35
- package/dist/file-upload.esm.js +152 -110
- package/dist/floating-toolbar.cjs.js +6 -7
- package/dist/floating-toolbar.esm.js +8 -9
- package/dist/form.cjs.js +20 -23
- package/dist/form.esm.js +20 -23
- package/dist/gantt.cjs.js +6 -6
- package/dist/gantt.esm.js +6 -6
- package/dist/hover-card.cjs.js +7 -7
- package/dist/hover-card.esm.js +7 -7
- package/dist/icon-cloud.cjs.js +19 -36
- package/dist/icon-cloud.esm.js +41 -58
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +108 -104
- package/dist/inline-edit.cjs.js +47 -19
- package/dist/inline-edit.esm.js +66 -38
- package/dist/input.cjs.js +44 -37
- package/dist/input.esm.js +59 -52
- package/dist/layout.cjs.js +3 -3
- package/dist/layout.esm.js +3 -3
- package/dist/marquee.cjs.js +7 -10
- package/dist/marquee.esm.js +7 -10
- package/dist/menu.cjs.js +8 -24
- package/dist/menu.esm.js +52 -72
- package/dist/menubar.cjs.js +9 -31
- package/dist/menubar.esm.js +127 -153
- package/dist/meter.cjs.js +4 -9
- package/dist/meter.esm.js +6 -11
- package/dist/multi-select.cjs.js +48 -35
- package/dist/multi-select.esm.js +67 -53
- package/dist/navigation-menu.cjs.js +10 -10
- package/dist/navigation-menu.esm.js +33 -33
- package/dist/number-field.cjs.js +27 -16
- package/dist/number-field.esm.js +36 -25
- package/dist/odometer.cjs.js +5 -5
- package/dist/odometer.esm.js +3 -3
- package/dist/orbiter.cjs.js +11 -28
- package/dist/orbiter.esm.js +28 -45
- package/dist/overlay-motion-B56x1GoY.js +49 -0
- package/dist/overlay-motion-BX3dPLay.mjs +120 -0
- package/dist/pagination.cjs.js +28 -25
- package/dist/pagination.esm.js +54 -51
- package/dist/password-field.cjs.js +38 -33
- package/dist/password-field.esm.js +62 -57
- package/dist/pin-input.cjs.js +17 -13
- package/dist/pin-input.esm.js +23 -19
- package/dist/plugin-panel.cjs.js +1 -1
- package/dist/plugin-panel.esm.js +1 -1
- package/dist/popover.cjs.js +16 -28
- package/dist/popover.esm.js +29 -45
- package/dist/portal-DeaM1tYY.mjs +121 -0
- package/dist/portal-XbYR3m_q.js +1 -0
- package/dist/portal.d.ts +3 -1
- package/dist/portal.d.ts.map +1 -1
- package/dist/{positioner-D0VGxtYU.mjs → positioner-BE8Nbho2.mjs} +5 -3
- package/dist/{positioner-D_fqyx_j.js → positioner-DZ1FW6A9.js} +1 -1
- package/dist/positioner.cjs.js +1 -1
- package/dist/positioner.esm.js +1 -1
- package/dist/primitives/overlay-motion.d.ts +47 -0
- package/dist/primitives/overlay-motion.d.ts.map +1 -0
- package/dist/primitives/positioner.d.ts.map +1 -1
- package/dist/progress.cjs.js +11 -16
- package/dist/progress.esm.js +37 -42
- package/dist/quick-actions.cjs.js +13 -13
- package/dist/quick-actions.esm.js +11 -11
- package/dist/radio-group.cjs.js +50 -26
- package/dist/radio-group.esm.js +53 -29
- package/dist/radio.cjs.js +15 -12
- package/dist/radio.esm.js +15 -12
- package/dist/rating.cjs.js +11 -15
- package/dist/rating.esm.js +48 -50
- package/dist/{runtime-CFnK53iC.mjs → runtime-CQM6wZOc.mjs} +498 -514
- package/dist/runtime-DxCl0A5q.js +5 -0
- package/dist/runtime.cjs.js +1 -1
- package/dist/runtime.d.ts +3 -2
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.esm.js +36 -32
- package/dist/scroll-area.cjs.js +3 -4
- package/dist/scroll-area.esm.js +3 -4
- package/dist/section.cjs.js +2 -4
- package/dist/section.esm.js +2 -4
- package/dist/select.cjs.js +40 -73
- package/dist/select.esm.js +55 -87
- package/dist/selection-popup.cjs.js +3 -4
- package/dist/selection-popup.esm.js +3 -4
- package/dist/semantic-tokens.d.ts +17 -0
- package/dist/semantic-tokens.d.ts.map +1 -0
- package/dist/sidebar.cjs.js +22 -22
- package/dist/sidebar.esm.js +25 -25
- package/dist/skeleton.cjs.js +2 -2
- package/dist/skeleton.esm.js +2 -2
- package/dist/slider.cjs.js +22 -26
- package/dist/slider.esm.js +25 -29
- package/dist/sortable.cjs.js +4 -5
- package/dist/sortable.esm.js +4 -5
- package/dist/spinning-text.cjs.js +4 -13
- package/dist/spinning-text.esm.js +4 -13
- package/dist/split-button.cjs.js +5 -5
- package/dist/split-button.esm.js +15 -14
- package/dist/splitter.cjs.js +52 -10
- package/dist/splitter.esm.js +55 -13
- package/dist/stepper.cjs.js +31 -65
- package/dist/stepper.esm.js +32 -66
- package/dist/switch.cjs.js +20 -22
- package/dist/switch.esm.js +20 -22
- package/dist/table.cjs.js +5 -5
- package/dist/table.esm.js +20 -20
- package/dist/tabs.cjs.js +91 -21
- package/dist/tabs.esm.js +182 -112
- package/dist/tags-input.cjs.js +41 -15
- package/dist/tags-input.esm.js +73 -47
- package/dist/textarea.cjs.js +32 -33
- package/dist/textarea.esm.js +38 -39
- package/dist/theme.d.ts +25 -1
- package/dist/theme.d.ts.map +1 -1
- package/dist/time-field.cjs.js +7 -7
- package/dist/time-field.esm.js +6 -6
- package/dist/time-picker.cjs.js +16 -13
- package/dist/time-picker.esm.js +27 -24
- package/dist/timeline.cjs.js +10 -10
- package/dist/timeline.esm.js +7 -7
- package/dist/toggle-group.cjs.js +13 -13
- package/dist/toggle-group.esm.js +66 -61
- package/dist/toggle.cjs.js +52 -34
- package/dist/toggle.esm.js +80 -62
- package/dist/toolbar.cjs.js +14 -14
- package/dist/toolbar.esm.js +41 -33
- package/dist/tooltip.cjs.js +3 -3
- package/dist/tooltip.esm.js +39 -33
- package/dist/transfer-list.cjs.js +28 -29
- package/dist/transfer-list.esm.js +28 -29
- package/dist/{tree-B_oQput6.mjs → tree-33fVNnaf.mjs} +6 -5
- package/dist/{tree-SivHxcAy.js → tree-Dc02MChE.js} +6 -5
- package/dist/tree-item.cjs.js +9 -8
- package/dist/tree-item.esm.js +13 -12
- package/dist/tree.cjs.js +1 -1
- package/dist/tree.esm.js +1 -1
- package/dist/{ui-button-Co8Sid6t.mjs → ui-button-C3OmI7Sn.mjs} +152 -154
- package/dist/{ui-button-BPrzJScZ.js → ui-button-CnLwXBnx.js} +107 -109
- package/dist/wizard.cjs.js +39 -36
- package/dist/wizard.esm.js +39 -36
- package/package.json +1 -1
- package/dist/date-time-utils-y3AvNvGe.js +0 -1
- package/dist/portal-DgpQ3Jo1.js +0 -1
- package/dist/portal-bR42gHvG.mjs +0 -118
- package/dist/runtime-DwE-tizc.js +0 -1
package/dist/tabs.esm.js
CHANGED
|
@@ -108,7 +108,7 @@ const k = `
|
|
|
108
108
|
|
|
109
109
|
.tab:focus-visible {
|
|
110
110
|
outline: none;
|
|
111
|
-
box-shadow: 0 0 0
|
|
111
|
+
box-shadow: 0 0 0 2px var(--ui-ring-color, var(--ui-tabs-focus));
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
.tab:active {
|
|
@@ -214,6 +214,23 @@ const k = `
|
|
|
214
214
|
flex: 1;
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
+
:host(:not([variant])),
|
|
218
|
+
:host([variant="default"]),
|
|
219
|
+
:host([variant="underline"]),
|
|
220
|
+
:host([variant="line"]) {
|
|
221
|
+
--ui-tabs-shell-gap: 4px;
|
|
222
|
+
--ui-tabs-nav-padding: 0px;
|
|
223
|
+
--ui-tabs-nav-gap: 4px;
|
|
224
|
+
--ui-tabs-tab-radius: var(--ui-radius, 6px);
|
|
225
|
+
--ui-tabs-tab-min-h: 36px;
|
|
226
|
+
--ui-tabs-tab-pad-x: 12px;
|
|
227
|
+
--ui-tabs-tab-font-size: 14px;
|
|
228
|
+
--ui-tabs-panel-padding: 12px;
|
|
229
|
+
--ui-tabs-muted: var(--ui-color-text-secondary, var(--ui-color-muted, #526175));
|
|
230
|
+
--ui-tabs-active-text: var(--ui-color-text-strong, var(--ui-color-text, #0f172a));
|
|
231
|
+
--ui-tabs-line: var(--ui-color-accent-solid, var(--ui-tabs-accent));
|
|
232
|
+
}
|
|
233
|
+
|
|
217
234
|
:host([size="sm"]) {
|
|
218
235
|
--ui-tabs-nav-padding: 6px;
|
|
219
236
|
--ui-tabs-nav-gap: 6px;
|
|
@@ -344,30 +361,83 @@ const k = `
|
|
|
344
361
|
backdrop-filter: blur(10px);
|
|
345
362
|
}
|
|
346
363
|
|
|
364
|
+
/* The default look is a line: a hairline under the tabs and a 2px accent line under the selected one. */
|
|
365
|
+
:host(:not([variant])) .nav,
|
|
366
|
+
:host([variant="default"]) .nav,
|
|
347
367
|
:host([variant="underline"]) .nav,
|
|
348
368
|
:host([variant="line"]) .nav {
|
|
369
|
+
border: 0;
|
|
349
370
|
border-radius: 0;
|
|
350
|
-
|
|
351
|
-
border-left: 0;
|
|
352
|
-
border-right: 0;
|
|
353
|
-
box-shadow: none;
|
|
354
|
-
padding-inline: 0;
|
|
371
|
+
padding: 0;
|
|
355
372
|
background: transparent;
|
|
373
|
+
box-shadow: inset 0 -1px 0 var(--ui-color-line-subtle, var(--ui-tabs-border));
|
|
356
374
|
}
|
|
357
375
|
|
|
376
|
+
:host(:not([variant])) .tab,
|
|
377
|
+
:host([variant="default"]) .tab,
|
|
358
378
|
:host([variant="underline"]) .tab,
|
|
359
379
|
:host([variant="line"]) .tab {
|
|
360
|
-
border
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
border-right: 0;
|
|
364
|
-
border-bottom: 2px solid transparent;
|
|
380
|
+
border: 0;
|
|
381
|
+
gap: 6px;
|
|
382
|
+
font-weight: 500;
|
|
365
383
|
}
|
|
366
384
|
|
|
385
|
+
:host(:not([variant])) .tab::after,
|
|
386
|
+
:host([variant="default"]) .tab::after,
|
|
387
|
+
:host([variant="underline"]) .tab::after,
|
|
388
|
+
:host([variant="line"]) .tab::after {
|
|
389
|
+
content: '';
|
|
390
|
+
position: absolute;
|
|
391
|
+
inset-inline: 0;
|
|
392
|
+
inset-block-end: 0;
|
|
393
|
+
block-size: 2px;
|
|
394
|
+
border-radius: 1px;
|
|
395
|
+
background: transparent;
|
|
396
|
+
transition: background-color var(--ui-tabs-transition);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
:host(:not([variant])) .tab:hover,
|
|
400
|
+
:host([variant="default"]) .tab:hover,
|
|
401
|
+
:host([variant="underline"]) .tab:hover,
|
|
402
|
+
:host([variant="line"]) .tab:hover {
|
|
403
|
+
background: var(--ui-color-fill, color-mix(in srgb, var(--ui-tabs-accent) 10%, transparent));
|
|
404
|
+
color: var(--ui-color-text-strong, var(--ui-tabs-active-text));
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
:host(:not([variant])) .tab[aria-selected="true"],
|
|
408
|
+
:host([variant="default"]) .tab[aria-selected="true"],
|
|
367
409
|
:host([variant="underline"]) .tab[aria-selected="true"],
|
|
368
410
|
:host([variant="line"]) .tab[aria-selected="true"] {
|
|
369
411
|
background: transparent;
|
|
370
|
-
border
|
|
412
|
+
border: 0;
|
|
413
|
+
color: var(--ui-tabs-active-text);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
:host(:not([variant])) .tab[aria-selected="true"]::after,
|
|
417
|
+
:host([variant="default"]) .tab[aria-selected="true"]::after,
|
|
418
|
+
:host([variant="underline"]) .tab[aria-selected="true"]::after,
|
|
419
|
+
:host([variant="line"]) .tab[aria-selected="true"]::after {
|
|
420
|
+
background: var(--ui-tabs-line);
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
:host(:not([variant])) .tab:focus-visible,
|
|
424
|
+
:host([variant="default"]) .tab:focus-visible,
|
|
425
|
+
:host([variant="underline"]) .tab:focus-visible,
|
|
426
|
+
:host([variant="line"]) .tab:focus-visible {
|
|
427
|
+
outline: var(--ui-ring-width, 2px) solid var(--ui-ring-color, var(--ui-tabs-focus));
|
|
428
|
+
outline-offset: -2px;
|
|
429
|
+
box-shadow: none;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
:host(:not([variant])) .panel-wrap,
|
|
433
|
+
:host([variant="default"]) .panel-wrap,
|
|
434
|
+
:host([variant="underline"]) .panel-wrap,
|
|
435
|
+
:host([variant="line"]) .panel-wrap {
|
|
436
|
+
border: 0;
|
|
437
|
+
border-radius: 0;
|
|
438
|
+
background: transparent;
|
|
439
|
+
box-shadow: none;
|
|
440
|
+
padding-inline: 2px;
|
|
371
441
|
}
|
|
372
442
|
|
|
373
443
|
:host([variant="segmented"]) .nav {
|
|
@@ -486,7 +556,7 @@ const k = `
|
|
|
486
556
|
}
|
|
487
557
|
}
|
|
488
558
|
`, g = "data-ui-tabs-auto-label";
|
|
489
|
-
function
|
|
559
|
+
function h(d) {
|
|
490
560
|
return String(d).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
491
561
|
}
|
|
492
562
|
function x(d) {
|
|
@@ -547,8 +617,8 @@ class I extends y {
|
|
|
547
617
|
disconnectedCallback() {
|
|
548
618
|
this.root.removeEventListener("click", this._onClick), this.root.removeEventListener("keydown", this._onKeyDown), this._observer && (this._observer.disconnect(), this._observer = null), this._resizeObserver ? (this._resizeObserver.disconnect(), this._resizeObserver = null) : window.removeEventListener("resize", this._onWindowResize), super.disconnectedCallback();
|
|
549
619
|
}
|
|
550
|
-
attributeChangedCallback(t,
|
|
551
|
-
if (
|
|
620
|
+
attributeChangedCallback(t, a, r) {
|
|
621
|
+
if (a !== r) {
|
|
552
622
|
if (t === "selected" || t === "value") {
|
|
553
623
|
this._isSyncingSelectionAttributes || this._syncSelectionUi();
|
|
554
624
|
return;
|
|
@@ -560,8 +630,8 @@ class I extends y {
|
|
|
560
630
|
return this.getAttribute("selected") || "0";
|
|
561
631
|
}
|
|
562
632
|
set selected(t) {
|
|
563
|
-
const
|
|
564
|
-
|
|
633
|
+
const a = String(t);
|
|
634
|
+
a ? this.setAttribute("selected", a) : this.removeAttribute("selected");
|
|
565
635
|
}
|
|
566
636
|
_sourceTabs() {
|
|
567
637
|
return Array.from(this.querySelectorAll('[slot="tab"]'));
|
|
@@ -570,55 +640,55 @@ class I extends y {
|
|
|
570
640
|
return Array.from(this.querySelectorAll('[slot="panel"]'));
|
|
571
641
|
}
|
|
572
642
|
_tabsModel() {
|
|
573
|
-
return this._sourceTabs().map((t,
|
|
574
|
-
const r = t.getAttribute("data-value") || t.getAttribute("value") || String(
|
|
575
|
-
return { index:
|
|
643
|
+
return this._sourceTabs().map((t, a) => {
|
|
644
|
+
const r = t.getAttribute("data-value") || t.getAttribute("value") || String(a), e = t.getAttribute("data-label") || t.textContent?.trim() || `Tab ${a + 1}`, i = t.getAttribute("data-icon") || "", s = t.hasAttribute("disabled") || x(t.getAttribute("data-disabled")), l = `${this._uid}-tab-${a}`, b = `${this._uid}-panel-${a}`;
|
|
645
|
+
return { index: a, value: r, label: e, icon: i, disabled: s, tabId: l, panelId: b };
|
|
576
646
|
});
|
|
577
647
|
}
|
|
578
648
|
_resolveSelectedIndex(t) {
|
|
579
649
|
if (!t.length) return -1;
|
|
580
|
-
const
|
|
650
|
+
const a = this.getAttribute("selected"), r = this.getAttribute("value"), e = this._sourceTabs();
|
|
581
651
|
let i = -1;
|
|
582
|
-
if (
|
|
583
|
-
const s = Number(
|
|
584
|
-
Number.isFinite(s) ? i = Math.trunc(s) : i = t.findIndex((
|
|
652
|
+
if (a != null && a !== "") {
|
|
653
|
+
const s = Number(a);
|
|
654
|
+
Number.isFinite(s) ? i = Math.trunc(s) : i = t.findIndex((l) => l.value === a);
|
|
585
655
|
}
|
|
586
|
-
return i < 0 && r && (i = t.findIndex((s) => s.value === r)), i < 0 && (i = t.findIndex((s,
|
|
656
|
+
return i < 0 && r && (i = t.findIndex((s) => s.value === r)), i < 0 && (i = t.findIndex((s, l) => !!e[l]?.hasAttribute("data-active") && !s.disabled)), (i < 0 || !t[i] || t[i].disabled) && (i = t.findIndex((s) => !s.disabled)), i;
|
|
587
657
|
}
|
|
588
|
-
_syncSelectedAttributes(t,
|
|
589
|
-
const r = t[
|
|
658
|
+
_syncSelectedAttributes(t, a) {
|
|
659
|
+
const r = t[a];
|
|
590
660
|
this._isSyncingSelectionAttributes = !0;
|
|
591
661
|
try {
|
|
592
662
|
if (!r) {
|
|
593
663
|
this.removeAttribute("selected"), this.removeAttribute("value");
|
|
594
664
|
return;
|
|
595
665
|
}
|
|
596
|
-
this.getAttribute("selected") !== String(
|
|
666
|
+
this.getAttribute("selected") !== String(a) && this.setAttribute("selected", String(a)), this.getAttribute("value") !== r.value && this.setAttribute("value", r.value);
|
|
597
667
|
} finally {
|
|
598
668
|
this._isSyncingSelectionAttributes = !1;
|
|
599
669
|
}
|
|
600
670
|
}
|
|
601
|
-
_emit(t,
|
|
602
|
-
const
|
|
603
|
-
if (!
|
|
671
|
+
_emit(t, a, r) {
|
|
672
|
+
const e = a[r];
|
|
673
|
+
if (!e) return;
|
|
604
674
|
const i = {
|
|
605
675
|
selected: r,
|
|
606
676
|
index: r,
|
|
607
|
-
value:
|
|
608
|
-
label:
|
|
609
|
-
tabId:
|
|
610
|
-
panelId:
|
|
677
|
+
value: e.value,
|
|
678
|
+
label: e.label,
|
|
679
|
+
tabId: e.tabId,
|
|
680
|
+
panelId: e.panelId
|
|
611
681
|
};
|
|
612
682
|
this.dispatchEvent(new CustomEvent(t, { detail: i, bubbles: !0, composed: !0 }));
|
|
613
683
|
}
|
|
614
|
-
_setSelectedByIndex(t,
|
|
615
|
-
const
|
|
616
|
-
if (!
|
|
617
|
-
if (this._resolveSelectedIndex(t) ===
|
|
618
|
-
this._focusTab(
|
|
684
|
+
_setSelectedByIndex(t, a, r) {
|
|
685
|
+
const e = t[a];
|
|
686
|
+
if (!e || e.disabled) return;
|
|
687
|
+
if (this._resolveSelectedIndex(t) === a) {
|
|
688
|
+
this._focusTab(a);
|
|
619
689
|
return;
|
|
620
690
|
}
|
|
621
|
-
this._focusIndex =
|
|
691
|
+
this._focusIndex = a, this.setAttribute("selected", String(a)), this.setAttribute("value", e.value), r && (this._emit("change", t, a), this._emit("select", t, a));
|
|
622
692
|
}
|
|
623
693
|
_syncSelectionUi() {
|
|
624
694
|
if (!this.isConnected) return;
|
|
@@ -628,58 +698,58 @@ class I extends y {
|
|
|
628
698
|
}
|
|
629
699
|
const t = this._tabsModel();
|
|
630
700
|
if (!t.length) return;
|
|
631
|
-
const
|
|
632
|
-
this._syncSelectedAttributes(t,
|
|
633
|
-
const
|
|
634
|
-
|
|
635
|
-
const
|
|
636
|
-
if (!
|
|
637
|
-
const
|
|
638
|
-
s.setAttribute("aria-selected",
|
|
639
|
-
}), p(
|
|
640
|
-
const i = t[
|
|
641
|
-
this._syncIndicator(
|
|
701
|
+
const a = this._resolveSelectedIndex(t), r = this._resolveFocusIndex(t, a);
|
|
702
|
+
this._syncSelectedAttributes(t, a);
|
|
703
|
+
const e = Array.from(this.root.querySelectorAll(".tab"));
|
|
704
|
+
e.forEach((s, l) => {
|
|
705
|
+
const b = t[l];
|
|
706
|
+
if (!b) return;
|
|
707
|
+
const n = l === a;
|
|
708
|
+
s.setAttribute("aria-selected", n ? "true" : "false"), s.setAttribute("aria-disabled", b.disabled ? "true" : "false"), b.disabled ? s.setAttribute("disabled", "") : s.removeAttribute("disabled");
|
|
709
|
+
}), p(e, e[r] || null, { activeAttribute: null });
|
|
710
|
+
const i = t[a];
|
|
711
|
+
this._syncIndicator(a), this._clearCrossRootReferences(), i && this._scrollSelectedTabIntoView(a), this._syncPanels(t, a);
|
|
642
712
|
}
|
|
643
713
|
_syncIndicator(t) {
|
|
644
|
-
const
|
|
645
|
-
if (!
|
|
646
|
-
const r = this.getAttribute("variant") || "default",
|
|
647
|
-
if (!
|
|
648
|
-
|
|
714
|
+
const a = this.root.querySelector(".nav");
|
|
715
|
+
if (!a) return;
|
|
716
|
+
const r = this.getAttribute("variant") || "default", e = r === "indicator";
|
|
717
|
+
if (!e && !(r === "indicator-line")) {
|
|
718
|
+
a.removeAttribute("data-indicator-ready"), a.style.removeProperty("--ui-tabs-indicator-x"), a.style.removeProperty("--ui-tabs-indicator-y"), a.style.removeProperty("--ui-tabs-indicator-w"), a.style.removeProperty("--ui-tabs-indicator-h");
|
|
649
719
|
return;
|
|
650
720
|
}
|
|
651
721
|
const s = this.root.querySelector(`.tab[data-index="${t}"]`);
|
|
652
722
|
if (!s) {
|
|
653
|
-
|
|
723
|
+
a.removeAttribute("data-indicator-ready");
|
|
654
724
|
return;
|
|
655
725
|
}
|
|
656
|
-
const
|
|
657
|
-
let
|
|
658
|
-
|
|
726
|
+
const l = this.getAttribute("orientation") === "vertical" ? "vertical" : "horizontal", b = getComputedStyle(this).direction === "rtl";
|
|
727
|
+
let n = s.offsetLeft, u = s.offsetTop, o = s.offsetWidth, c = s.offsetHeight;
|
|
728
|
+
e ? (n += 2, u += 2, o = Math.max(0, o - 4), c = Math.max(0, c - 4)) : l === "vertical" ? (u += 5, c = Math.max(8, c - 10), o = 3, n += b ? s.offsetWidth - 3 - 2 : 2) : (n += 8, o = Math.max(12, o - 16), c = 2, u += s.offsetHeight - 2 - 2), a.style.setProperty("--ui-tabs-indicator-x", `${n}px`), a.style.setProperty("--ui-tabs-indicator-y", `${u}px`), a.style.setProperty("--ui-tabs-indicator-w", `${o}px`), a.style.setProperty("--ui-tabs-indicator-h", `${c}px`), a.setAttribute("data-indicator-ready", "true");
|
|
659
729
|
}
|
|
660
730
|
_clearCrossRootReferences() {
|
|
661
731
|
this.removeAttribute("aria-activedescendant"), this.removeAttribute("aria-controls");
|
|
662
732
|
}
|
|
663
|
-
_syncPanels(t,
|
|
664
|
-
const r = this._sourcePanels(),
|
|
665
|
-
|
|
733
|
+
_syncPanels(t, a) {
|
|
734
|
+
const r = this._sourcePanels(), e = this.root.querySelector(".panel-wrap");
|
|
735
|
+
e && (r.length ? e.removeAttribute("hidden") : e.setAttribute("hidden", "")), this._isSyncing = !0;
|
|
666
736
|
try {
|
|
667
737
|
r.forEach((i, s) => {
|
|
668
|
-
const
|
|
669
|
-
i.id =
|
|
738
|
+
const l = t[s], b = s === a;
|
|
739
|
+
i.id = l?.panelId || `${this._uid}-panel-${s}`, i.setAttribute("role", "tabpanel"), i.setAttribute("tabindex", b ? "0" : "-1"), i.setAttribute("aria-hidden", b ? "false" : "true"), l && (i.getAttribute("aria-labelledby") === l.tabId && i.removeAttribute("aria-labelledby"), i.hasAttribute("aria-labelledby") || i.hasAttribute("aria-label") && !i.hasAttribute(g) || (i.setAttribute("aria-label", l.label), i.setAttribute(g, ""))), b ? i.removeAttribute("hidden") : i.setAttribute("hidden", "");
|
|
670
740
|
});
|
|
671
741
|
} finally {
|
|
672
742
|
this._isSyncing = !1;
|
|
673
743
|
}
|
|
674
744
|
}
|
|
675
745
|
_enabledIndices(t) {
|
|
676
|
-
return t.filter((
|
|
746
|
+
return t.filter((a) => !a.disabled).map((a) => a.index);
|
|
677
747
|
}
|
|
678
|
-
_resolveFocusIndex(t,
|
|
748
|
+
_resolveFocusIndex(t, a) {
|
|
679
749
|
const r = _(t, {
|
|
680
750
|
activeIndex: this._focusIndex,
|
|
681
|
-
selectedIndex:
|
|
682
|
-
getDisabled: (
|
|
751
|
+
selectedIndex: a,
|
|
752
|
+
getDisabled: (e) => e.disabled
|
|
683
753
|
});
|
|
684
754
|
return this._focusIndex = r, r;
|
|
685
755
|
}
|
|
@@ -688,102 +758,102 @@ class I extends y {
|
|
|
688
758
|
}
|
|
689
759
|
_focusTab(t) {
|
|
690
760
|
this._focusIndex = t;
|
|
691
|
-
const
|
|
692
|
-
p(r,
|
|
761
|
+
const a = this.root.querySelector(`.tab[data-index="${t}"]`), r = Array.from(this.root.querySelectorAll(".tab"));
|
|
762
|
+
p(r, a, { activeAttribute: null }), w(a);
|
|
693
763
|
}
|
|
694
764
|
_scrollSelectedTabIntoView(t) {
|
|
695
|
-
const
|
|
696
|
-
if (!
|
|
697
|
-
const
|
|
765
|
+
const a = this.root.querySelector(".nav"), r = this.root.querySelector(`.tab[data-index="${t}"]`);
|
|
766
|
+
if (!a || !r) return;
|
|
767
|
+
const e = this.getAttribute("orientation") !== "vertical", i = typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
698
768
|
typeof r.scrollIntoView == "function" && r.scrollIntoView({
|
|
699
769
|
behavior: i ? "auto" : "smooth",
|
|
700
770
|
block: "nearest",
|
|
701
|
-
inline:
|
|
771
|
+
inline: e ? "center" : "nearest"
|
|
702
772
|
});
|
|
703
773
|
}
|
|
704
774
|
_onClick(t) {
|
|
705
775
|
const r = t.target?.closest(".tab");
|
|
706
776
|
if (!r || r.disabled) return;
|
|
707
|
-
const
|
|
708
|
-
if (!Number.isFinite(
|
|
777
|
+
const e = Number(r.getAttribute("data-index"));
|
|
778
|
+
if (!Number.isFinite(e)) return;
|
|
709
779
|
const i = this._tabsModel();
|
|
710
|
-
this._setSelectedByIndex(i,
|
|
780
|
+
this._setSelectedByIndex(i, e, !0);
|
|
711
781
|
}
|
|
712
782
|
_onKeyDown(t) {
|
|
713
783
|
const r = t.target?.closest(".tab");
|
|
714
784
|
if (!r) return;
|
|
715
|
-
const
|
|
716
|
-
if (!
|
|
717
|
-
const i = this.getAttribute("orientation") === "vertical" ? "vertical" : "horizontal", s = this.getAttribute("activation") === "manual" ? "manual" : "auto",
|
|
718
|
-
if (!Number.isFinite(
|
|
719
|
-
const u = (
|
|
720
|
-
const
|
|
721
|
-
wrap:
|
|
722
|
-
fallbackIndex: this._resolveFocusIndex(
|
|
723
|
-
getDisabled: (
|
|
785
|
+
const e = this._tabsModel();
|
|
786
|
+
if (!e.length) return;
|
|
787
|
+
const i = this.getAttribute("orientation") === "vertical" ? "vertical" : "horizontal", s = this.getAttribute("activation") === "manual" ? "manual" : "auto", l = !this.hasAttribute("loop") || x(this.getAttribute("loop")), b = getComputedStyle(this).direction === "rtl", n = Number(r.getAttribute("data-index"));
|
|
788
|
+
if (!Number.isFinite(n)) return;
|
|
789
|
+
const u = (o) => {
|
|
790
|
+
const c = A(e, n, o, {
|
|
791
|
+
wrap: l,
|
|
792
|
+
fallbackIndex: this._resolveFocusIndex(e, this._resolveSelectedIndex(e)),
|
|
793
|
+
getDisabled: (v) => v.disabled
|
|
724
794
|
});
|
|
725
|
-
|
|
795
|
+
c != null && (this._focusTab(c), s === "auto" ? this._setSelectedByIndex(e, c, !0) : this._emit("focus", e, c));
|
|
726
796
|
};
|
|
727
|
-
if (i === "horizontal" && (t.key === "ArrowRight" && !
|
|
797
|
+
if (i === "horizontal" && (t.key === "ArrowRight" && !b || t.key === "ArrowLeft" && b) || i === "vertical" && t.key === "ArrowDown") {
|
|
728
798
|
t.preventDefault(), u(1);
|
|
729
799
|
return;
|
|
730
800
|
}
|
|
731
|
-
if (i === "horizontal" && (t.key === "ArrowLeft" && !
|
|
801
|
+
if (i === "horizontal" && (t.key === "ArrowLeft" && !b || t.key === "ArrowRight" && b) || i === "vertical" && t.key === "ArrowUp") {
|
|
732
802
|
t.preventDefault(), u(-1);
|
|
733
803
|
return;
|
|
734
804
|
}
|
|
735
805
|
if (t.key === "Home") {
|
|
736
806
|
t.preventDefault();
|
|
737
|
-
const
|
|
738
|
-
if (
|
|
739
|
-
this._focusTab(
|
|
807
|
+
const o = f(e, "first", (c) => c.disabled);
|
|
808
|
+
if (o < 0) return;
|
|
809
|
+
this._focusTab(o), s === "auto" ? this._setSelectedByIndex(e, o, !0) : this._emit("focus", e, o);
|
|
740
810
|
return;
|
|
741
811
|
}
|
|
742
812
|
if (t.key === "End") {
|
|
743
813
|
t.preventDefault();
|
|
744
|
-
const
|
|
745
|
-
if (
|
|
746
|
-
this._focusTab(
|
|
814
|
+
const o = f(e, "last", (c) => c.disabled);
|
|
815
|
+
if (o < 0) return;
|
|
816
|
+
this._focusTab(o), s === "auto" ? this._setSelectedByIndex(e, o, !0) : this._emit("focus", e, o);
|
|
747
817
|
return;
|
|
748
818
|
}
|
|
749
|
-
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), this._setSelectedByIndex(
|
|
819
|
+
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), this._setSelectedByIndex(e, n, !0));
|
|
750
820
|
}
|
|
751
821
|
render() {
|
|
752
|
-
const t = this._tabsModel(),
|
|
753
|
-
this._syncSelectedAttributes(t,
|
|
754
|
-
const
|
|
755
|
-
const u =
|
|
822
|
+
const t = this._tabsModel(), a = this._resolveSelectedIndex(t), r = this._resolveFocusIndex(t, a);
|
|
823
|
+
this._syncSelectedAttributes(t, a);
|
|
824
|
+
const e = this.getAttribute("orientation") === "vertical" ? "vertical" : "horizontal", i = (this.getAttribute("aria-label") || "").trim(), s = (this.getAttribute("aria-labelledby") || "").trim(), l = (i ? ` aria-label="${h(i)}"` : "") + (s ? ` aria-labelledby="${h(s)}"` : ""), b = t.map((n) => {
|
|
825
|
+
const u = n.index === a, o = n.icon ? `<span class="tab-icon" aria-hidden="true">${h(n.icon)}</span>` : "";
|
|
756
826
|
return `
|
|
757
827
|
<button
|
|
758
828
|
type="button"
|
|
759
829
|
class="tab"
|
|
760
830
|
part="tab"
|
|
761
|
-
id="${
|
|
831
|
+
id="${n.tabId}"
|
|
762
832
|
role="tab"
|
|
763
|
-
data-index="${
|
|
833
|
+
data-index="${n.index}"
|
|
764
834
|
aria-selected="${u ? "true" : "false"}"
|
|
765
|
-
aria-disabled="${
|
|
766
|
-
tabindex="${
|
|
767
|
-
${
|
|
835
|
+
aria-disabled="${n.disabled ? "true" : "false"}"
|
|
836
|
+
tabindex="${n.index === r && !n.disabled ? "0" : "-1"}"
|
|
837
|
+
${n.disabled ? "disabled" : ""}
|
|
768
838
|
>
|
|
769
|
-
${
|
|
770
|
-
<span class="tab-label">${
|
|
839
|
+
${o}
|
|
840
|
+
<span class="tab-label">${h(n.label)}</span>
|
|
771
841
|
</button>
|
|
772
842
|
`;
|
|
773
843
|
}).join("");
|
|
774
844
|
this.setContent(`
|
|
775
845
|
<style>${k}</style>
|
|
776
846
|
<section class="shell" part="shell">
|
|
777
|
-
<div class="nav" role="tablist" aria-orientation="${
|
|
847
|
+
<div class="nav" role="tablist" aria-orientation="${e}"${l} part="nav">
|
|
778
848
|
<span class="indicator" part="indicator" aria-hidden="true"></span>
|
|
779
|
-
${
|
|
849
|
+
${b}
|
|
780
850
|
</div>
|
|
781
851
|
<div class="panel-wrap" part="panel-wrap" aria-live="polite">
|
|
782
852
|
<slot name="panel"></slot>
|
|
783
853
|
</div>
|
|
784
854
|
</section>
|
|
785
855
|
<slot class="source-tabs" name="tab"></slot>
|
|
786
|
-
`), this._clearCrossRootReferences(), this._syncIndicator(
|
|
856
|
+
`), this._clearCrossRootReferences(), this._syncIndicator(a), this._syncPanels(t, a);
|
|
787
857
|
}
|
|
788
858
|
}
|
|
789
859
|
typeof customElements < "u" && !customElements.get("ui-tabs") && customElements.define("ui-tabs", I);
|
package/dist/tags-input.cjs.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const S=require("./ElementBase-DxbvhLJs.js"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const S=require("./ElementBase-DxbvhLJs.js"),m=require("./control-name-BmoI1m3a.js"),k=`
|
|
2
2
|
:host {
|
|
3
3
|
--ui-tags-input-padding: 10px 12px;
|
|
4
|
-
--ui-tags-input-border-color: color-
|
|
4
|
+
--ui-tags-input-border-color: var(--ui-color-line, var(--ui-color-border, #cbd5e1));
|
|
5
5
|
--ui-tags-input-border: 1px solid var(--ui-tags-input-border-color);
|
|
6
|
-
--ui-tags-input-radius: var(--ui-radius,
|
|
6
|
+
--ui-tags-input-radius: var(--ui-control-radius-2, var(--ui-radius, 6px));
|
|
7
7
|
--ui-tags-input-bg: var(--ui-color-surface, #ffffff);
|
|
8
8
|
--ui-tags-input-text: var(--ui-color-text, #0f172a);
|
|
9
9
|
--ui-tags-input-muted: var(--ui-color-muted, #526175);
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
--ui-tags-input-chip-bg: color-mix(in srgb, var(--ui-color-primary, #2563eb) 10%, transparent);
|
|
13
13
|
--ui-tags-input-chip-text: color-mix(in srgb, var(--ui-color-primary, #2563eb) 82%, #0f172a 18%);
|
|
14
14
|
--ui-tags-input-chip-remove-bg: color-mix(in srgb, currentColor 8%, transparent);
|
|
15
|
-
--ui-tags-input-min-height:
|
|
15
|
+
--ui-tags-input-min-height: var(--ui-control-height-2, 32px);
|
|
16
|
+
--ui-tags-input-font-size: var(--ui-control-font-size-2, 14px);
|
|
16
17
|
display: block;
|
|
17
18
|
inline-size: 100%;
|
|
18
19
|
max-inline-size: 100%;
|
|
@@ -22,6 +23,26 @@
|
|
|
22
23
|
color-scheme: light dark;
|
|
23
24
|
}
|
|
24
25
|
|
|
26
|
+
:host([size="sm"]),
|
|
27
|
+
:host([size="1"]) {
|
|
28
|
+
--ui-tags-input-min-height: var(--ui-control-height-1, 24px);
|
|
29
|
+
--ui-tags-input-font-size: var(--ui-control-font-size-1, 12px);
|
|
30
|
+
--ui-tags-input-radius: var(--ui-control-radius-1, var(--ui-radius, 6px));
|
|
31
|
+
--ui-tags-input-pad-y: 0px;
|
|
32
|
+
--ui-tags-input-pad-x: calc(var(--ui-control-padding-inline-1, 8px) - 1px);
|
|
33
|
+
--ui-tags-input-chip-pad-y: 0px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
:host([size="lg"]),
|
|
37
|
+
:host([size="3"]) {
|
|
38
|
+
--ui-tags-input-min-height: var(--ui-control-height-3, 40px);
|
|
39
|
+
--ui-tags-input-font-size: var(--ui-control-font-size-3, 16px);
|
|
40
|
+
--ui-tags-input-radius: var(--ui-control-radius-3, var(--ui-radius, 6px));
|
|
41
|
+
--ui-tags-input-pad-y: 5px;
|
|
42
|
+
--ui-tags-input-pad-x: calc(var(--ui-control-padding-inline-3, 16px) - 1px);
|
|
43
|
+
--ui-tags-input-chip-pad-y: 4px;
|
|
44
|
+
}
|
|
45
|
+
|
|
25
46
|
.root {
|
|
26
47
|
display: grid;
|
|
27
48
|
gap: 8px;
|
|
@@ -75,7 +96,7 @@
|
|
|
75
96
|
gap: 8px;
|
|
76
97
|
min-block-size: var(--ui-tags-input-min-height);
|
|
77
98
|
box-sizing: border-box;
|
|
78
|
-
padding:
|
|
99
|
+
padding: var(--ui-tags-input-pad-y, 3px) var(--ui-tags-input-pad-x, calc(var(--ui-control-padding-inline-2, 12px) - 1px));
|
|
79
100
|
border: var(--ui-tags-input-border);
|
|
80
101
|
border-radius: var(--ui-tags-input-radius);
|
|
81
102
|
background: var(--ui-tags-input-bg);
|
|
@@ -83,13 +104,18 @@
|
|
|
83
104
|
}
|
|
84
105
|
|
|
85
106
|
.shell[data-focused="true"] {
|
|
86
|
-
border-color:
|
|
87
|
-
|
|
107
|
+
border-color: var(--ui-ring-color, var(--ui-tags-input-focus));
|
|
108
|
+
outline: var(--ui-ring-width, 2px) solid var(--ui-ring-color, var(--ui-tags-input-focus));
|
|
109
|
+
outline-offset: -1px;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.shell:hover:not([data-focused="true"]) {
|
|
113
|
+
border-color: var(--ui-color-line-strong, var(--ui-tags-input-border-color));
|
|
88
114
|
}
|
|
89
115
|
|
|
90
116
|
.shell[data-invalid="true"] {
|
|
91
117
|
border-color: color-mix(in srgb, var(--ui-tags-input-danger) 62%, transparent);
|
|
92
|
-
box-shadow: 0 0 0
|
|
118
|
+
box-shadow: 0 0 0 1px var(--ui-tags-input-danger);
|
|
93
119
|
}
|
|
94
120
|
|
|
95
121
|
.chips {
|
|
@@ -102,7 +128,7 @@
|
|
|
102
128
|
gap: 6px;
|
|
103
129
|
min-inline-size: 0;
|
|
104
130
|
max-inline-size: 100%;
|
|
105
|
-
padding:
|
|
131
|
+
padding: var(--ui-tags-input-chip-pad-y, 2px) 4px var(--ui-tags-input-chip-pad-y, 2px) 10px;
|
|
106
132
|
border-radius: 999px;
|
|
107
133
|
background: var(--ui-tags-input-chip-bg);
|
|
108
134
|
color: var(--ui-tags-input-chip-text);
|
|
@@ -142,13 +168,13 @@
|
|
|
142
168
|
background: transparent;
|
|
143
169
|
color: inherit;
|
|
144
170
|
outline: none;
|
|
145
|
-
font: 500
|
|
146
|
-
padding:
|
|
171
|
+
font: 500 var(--ui-tags-input-font-size)/1.4 "Inter", "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
172
|
+
padding: 2px 2px;
|
|
147
173
|
margin: 0;
|
|
148
174
|
}
|
|
149
175
|
|
|
150
176
|
.input::placeholder {
|
|
151
|
-
color: color-mix(in srgb, var(--ui-tags-input-text)
|
|
177
|
+
color: var(--ui-color-placeholder, color-mix(in srgb, var(--ui-tags-input-text) 62%, transparent));
|
|
152
178
|
}
|
|
153
179
|
|
|
154
180
|
.assist {
|
|
@@ -181,8 +207,8 @@
|
|
|
181
207
|
:host([readonly]) .chip-remove {
|
|
182
208
|
pointer-events: none;
|
|
183
209
|
}
|
|
184
|
-
`;function b(r,t){return r.length===t.length&&r.every((i,e)=>i===t[e])}function d(r){if(!r)return[];const t=r.trim();if(!t)return[];if(t.startsWith("["))try{const i=JSON.parse(t);if(Array.isArray(i))return i.map(e=>String(e).trim()).filter(Boolean)}catch{}return t.split(",").map(i=>i.trim()).filter(Boolean)}function
|
|
185
|
-
`))?JSON.stringify(r):r.join(", "):""}function
|
|
210
|
+
`;function b(r,t){return r.length===t.length&&r.every((i,e)=>i===t[e])}function d(r){if(!r)return[];const t=r.trim();if(!t)return[];if(t.startsWith("["))try{const i=JSON.parse(t);if(Array.isArray(i))return i.map(e=>String(e).trim()).filter(Boolean)}catch{}return t.split(",").map(i=>i.trim()).filter(Boolean)}function z(r){return r.length?r.some(t=>t.includes(",")||t.includes(`
|
|
211
|
+
`))?JSON.stringify(r):r.join(", "):""}function p(r){return r.replace(/\s+/g," ").trim()}let C=0;class v extends S.ElementBase{constructor(){super(),this._tags=[],this._draft="",this._suppressValueAttr=!1,this._formUnregister=null,this._rootEl=null,this._shellEl=null,this._chipsEl=null,this._inputEl=null,this._uid=`ui-tags-input-${++C}`,this._labelEl=null,this._descriptionEl=null,this._errorEl=null,this._assistEl=null,this._counterEl=null,this._focused=!1,this._onInput=this._onInput.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onFocusIn=this._onFocusIn.bind(this),this._onFocusOut=this._onFocusOut.bind(this),this._onPaste=this._onPaste.bind(this),this._onShellClick=this._onShellClick.bind(this),this._onChipClick=this._onChipClick.bind(this)}static get observedAttributes(){return["value","label","aria-label","aria-description","aria-describedby","description","placeholder","data-error","required","disabled","readonly","name","max-tags","counter"]}get value(){return[...this._tags]}set value(t){const i=Array.isArray(t)?t.map(e=>p(String(e))).filter(Boolean):d(String(t??""));this._applyTags(i,"api")}addTag(t){return this._addTag(t,"api")}removeTag(t){if(typeof t=="number"){if(t<0||t>=this._tags.length)return;this._removeTagAt(t,"api");return}const i=this._tags.indexOf(t);i>=0&&this._removeTagAt(i,"api")}clearTags(){this._applyTags([],"api")}focusInput(){this._inputEl?.focus()}connectedCallback(){super.connectedCallback(),this._registerWithForm()}disconnectedCallback(){this._formUnregister&&(this._formUnregister(),this._formUnregister=null),super.disconnectedCallback()}attributeChangedCallback(t,i,e){if(i!==e){if(t==="name"&&this.isConnected&&this._registerWithForm(),t==="value"&&!this._suppressValueAttr){const s=d(e);b(s,this._tags)||(this._tags=s)}this._rootEl&&this._syncUi()}}shouldRenderOnAttributeChange(){return!1}render(){this.setContent(`
|
|
186
212
|
<style>${k}</style>
|
|
187
213
|
<div class="root">
|
|
188
214
|
<div class="meta" hidden>
|
|
@@ -199,4 +225,4 @@
|
|
|
199
225
|
<div class="counter"></div>
|
|
200
226
|
</div>
|
|
201
227
|
</div>
|
|
202
|
-
`),this._rootEl=this.root.querySelector(".root"),this._shellEl=this.root.querySelector(".shell"),this._chipsEl=this.root.querySelector(".chips"),this._inputEl=this.root.querySelector(".input"),this._labelEl=this.root.querySelector(".label"),this._descriptionEl=this.root.querySelector(".description"),this._errorEl=this.root.querySelector(".error"),this._assistEl=this.root.querySelector(".assist"),this._counterEl=this.root.querySelector(".counter"),this._inputEl?.addEventListener("input",this._onInput),this._inputEl?.addEventListener("keydown",this._onKeyDown),this._inputEl?.addEventListener("focus",this._onFocusIn),this._inputEl?.addEventListener("blur",this._onFocusOut),this._inputEl?.addEventListener("paste",this._onPaste),this._shellEl?.addEventListener("click",this._onShellClick),this.root.addEventListener("click",this._onChipClick),this._tags=d(this.getAttribute("value")),this._syncUi()}_readOnly(){return this.hasAttribute("readonly")}_disabled(){return this.hasAttribute("disabled")&&this.getAttribute("disabled")!=="false"}_allowDuplicates(){return this.hasAttribute("allow-duplicates")}_maxTags(){const t=this.getAttribute("max-tags");if(!t)return null;const i=Number(t);return Number.isFinite(i)&&i>0?Math.floor(i):null}_emit(t,i){this.dispatchEvent(new CustomEvent(t,{detail:i,bubbles:!0,composed:!0}))}_setValueAttr(t){const i=
|
|
228
|
+
`),this._rootEl=this.root.querySelector(".root"),this._shellEl=this.root.querySelector(".shell"),this._chipsEl=this.root.querySelector(".chips"),this._inputEl=this.root.querySelector(".input"),this._labelEl=this.root.querySelector(".label"),this._descriptionEl=this.root.querySelector(".description"),this._errorEl=this.root.querySelector(".error"),this._assistEl=this.root.querySelector(".assist"),this._counterEl=this.root.querySelector(".counter"),this._inputEl?.addEventListener("input",this._onInput),this._inputEl?.addEventListener("keydown",this._onKeyDown),this._inputEl?.addEventListener("focus",this._onFocusIn),this._inputEl?.addEventListener("blur",this._onFocusOut),this._inputEl?.addEventListener("paste",this._onPaste),this._shellEl?.addEventListener("click",this._onShellClick),this.root.addEventListener("click",this._onChipClick),this._tags=d(this.getAttribute("value")),this._syncUi()}_readOnly(){return this.hasAttribute("readonly")}_disabled(){return this.hasAttribute("disabled")&&this.getAttribute("disabled")!=="false"}_allowDuplicates(){return this.hasAttribute("allow-duplicates")}_maxTags(){const t=this.getAttribute("max-tags");if(!t)return null;const i=Number(t);return Number.isFinite(i)&&i>0?Math.floor(i):null}_emit(t,i){this.dispatchEvent(new CustomEvent(t,{detail:i,bubbles:!0,composed:!0}))}_setValueAttr(t){const i=z(t);this._suppressValueAttr=!0;try{i?this.getAttribute("value")!==i&&this.setAttribute("value",i):this.removeAttribute("value")}finally{this._suppressValueAttr=!1}}_applyTags(t,i){const e=t.map(l=>p(l)).filter(Boolean),s=this._allowDuplicates()?e:e.filter((l,o)=>e.indexOf(l)===o),n=this._maxTags()!=null?s.slice(0,this._maxTags()):s;if(b(n,this._tags))return this._syncUi(),!1;const a=[...this._tags];return this._tags=[...n],this._setValueAttr(this._tags),this._syncUi(),this._emit("change",{value:[...this._tags],previousValue:a,source:i}),!0}_addTag(t,i){if(this._disabled()||this._readOnly())return!1;const e=p(t);if(!e)return!1;if(!this._allowDuplicates()&&this._tags.includes(e))return this._syncUi("Duplicate tag"),!1;const s=this._maxTags();if(s!=null&&this._tags.length>=s)return this._syncUi(`Maximum ${s} tags`),!1;const n=this._applyTags([...this._tags,e],i);return n&&this._emit("tag-add",{tag:e,value:[...this._tags],source:i}),n}_removeTagAt(t,i){if(this._disabled()||this._readOnly())return;const e=this._tags[t];if(!e)return;const s=this._tags.filter((a,l)=>l!==t);this._applyTags(s,i)&&this._emit("tag-remove",{tag:e,index:t,value:[...this._tags],source:i})}_commitDraft(t){const i=this._draft;this._draft="",this._inputEl&&(this._inputEl.value=""),this._addTag(i,t),this._syncUi()}_syncUi(t){if(!this._shellEl||!this._chipsEl||!this._inputEl||!this._labelEl||!this._descriptionEl||!this._errorEl||!this._assistEl||!this._counterEl)return;const i=(this.getAttribute("label")||"").trim(),e=(this.getAttribute("description")||"").trim(),s=(this.getAttribute("data-error")||"").trim(),n=this.hasAttribute("required"),a=this._disabled(),l=this._readOnly(),o=this._maxTags(),y=this.hasAttribute("counter")||o!=null,x=!!s||!!t||n&&this._tags.length===0&&this.hasAttribute("invalid");this._labelEl.hidden=!i,this._labelEl.querySelector(".label-text").textContent=i,this._labelEl.querySelector(".required").hidden=!n,this._descriptionEl.hidden=!e,this._descriptionEl.textContent=e,this.root.querySelector(".meta").hidden=!i&&!e,m.syncControlName(this._inputEl,this,i?`${this._uid}-label`:null),this._shellEl.setAttribute("data-focused",this._focused?"true":"false"),this._shellEl.setAttribute("data-invalid",x?"true":"false"),this._inputEl.disabled=a,this._inputEl.readOnly=l,this._inputEl.placeholder=this._tags.length===0?this.getAttribute("placeholder")||"Add tags":"",this._inputEl.value=this._draft;const E=a||o!=null&&this._tags.length>=o;this._inputEl.setAttribute("aria-disabled",E?"true":"false"),this._chipsEl.replaceChildren(...this._tags.map((f,A)=>{const h=document.createElement("span");h.className="chip",h.setAttribute("part","chip");const _=document.createElement("span");_.className="chip-label",_.textContent=f;const u=document.createElement("button");return u.type="button",u.className="chip-remove",u.setAttribute("data-index",String(A)),u.setAttribute("aria-label",`Remove ${f}`),u.textContent="×",u.disabled=a||l,h.append(_,u),h}));const c=t||s;this._errorEl.hidden=!c,this._errorEl.textContent=c;const g=[];e&&g.push(`${this._uid}-description`),c&&g.push(`${this._uid}-error`),m.syncControlDescription(this._inputEl,this,this._uid,g),this._assistEl.hidden=!y,this._counterEl.textContent=o!=null?`${this._tags.length}/${o}`:String(this._tags.length)}_registerWithForm(){this._formUnregister&&(this._formUnregister(),this._formUnregister=null);try{const s=this.getRootNode().host?.closest?.("ui-form")||null||this.closest("ui-form"),n=this.getAttribute("name");s&&typeof s.registerField=="function"&&n&&(this._formUnregister=s.registerField(n,{name:n,getValue:()=>[...this._tags],setValue:a=>{Array.isArray(a)?this._applyTags(a.map(l=>String(l)),"form"):this._applyTags(d(String(a??"")),"form")},validate:async()=>this.hasAttribute("required")&&this._tags.length===0?{valid:!1,message:"At least one tag is required"}:{valid:!0},setError:a=>{a?this.setAttribute("data-error",a):this.removeAttribute("data-error"),this._syncUi()}}))}catch{}}_onInput(t){const i=t.target;this._draft=i?.value||"",this._emit("input",{draft:this._draft,value:[...this._tags]}),this._syncUi()}_onKeyDown(t){if(t.key==="Enter"||t.key===","){t.preventDefault(),this._commitDraft("keyboard");return}t.key==="Backspace"&&!this._draft&&this._removeTagAt(this._tags.length-1,"keyboard")}_onPaste(t){const i=t.clipboardData?.getData("text")||"";if(!/[,\n]/.test(i))return;t.preventDefault();const e=i.split(/[,\n]+/).map(p).filter(Boolean);e.length&&(this._draft="",this._inputEl&&(this._inputEl.value=""),this._applyTags([...this._tags,...e],"paste"))}_onFocusIn(){this._focused=!0,this._syncUi()}_onFocusOut(){this._focused=!1,this.hasAttribute("add-on-blur")&&this._draft?this._commitDraft("blur"):this._syncUi()}_onShellClick(t){t.target?.closest(".chip-remove")||this._inputEl?.focus()}_onChipClick(t){const e=t.target?.closest(".chip-remove");if(!e)return;const s=Number(e.getAttribute("data-index"));Number.isFinite(s)&&this._removeTagAt(s,"remove-button")}}typeof customElements<"u"&&!customElements.get("ui-tags-input")&&customElements.define("ui-tags-input",v);exports.UITagsInput=v;
|