@editora/ui-core 0.1.25 → 0.2.1
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 +132 -0
- package/dist/accordion.cjs.js +13 -12
- package/dist/accordion.esm.js +13 -12
- package/dist/alert-dialog.cjs.js +92 -53
- package/dist/alert-dialog.esm.js +211 -159
- package/dist/alert.cjs.js +42 -33
- package/dist/alert.esm.js +80 -71
- 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 +9 -9
- package/dist/animated-text.esm.js +9 -9
- package/dist/app-header.cjs.js +17 -12
- package/dist/app-header.esm.js +18 -13
- package/dist/aspect-ratio.cjs.js +10 -12
- package/dist/aspect-ratio.esm.js +11 -13
- package/dist/avatar.cjs.js +16 -20
- package/dist/avatar.esm.js +16 -20
- 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-D-mXMgqc.js → calendar-CzpWDxLc.js} +56 -46
- package/dist/{calendar-B3PUKHQm.mjs → calendar-DkSDFg33.mjs} +127 -117
- 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 +58 -52
- package/dist/chart.esm.js +101 -95
- package/dist/checkbox.cjs.js +19 -15
- package/dist/checkbox.esm.js +19 -15
- package/dist/collapsible.cjs.js +9 -13
- package/dist/collapsible.esm.js +9 -13
- package/dist/color-picker.cjs.js +38 -19
- package/dist/color-picker.esm.js +134 -115
- package/dist/combobox.cjs.js +60 -57
- package/dist/combobox.esm.js +96 -92
- 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-app-header.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-chart.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-gantt.d.ts.map +1 -1
- package/dist/components/ui-hover-card.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-sidebar.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 +21 -18
- package/dist/data-table.esm.js +210 -190
- package/dist/date-field.cjs.js +9 -9
- package/dist/date-field.esm.js +19 -19
- package/dist/date-picker.cjs.js +29 -20
- package/dist/date-picker.esm.js +59 -50
- package/dist/date-range-picker.cjs.js +24 -19
- package/dist/date-range-picker.esm.js +86 -81
- package/dist/date-range-time-picker.cjs.js +27 -20
- package/dist/date-range-time-picker.esm.js +24 -17
- package/dist/date-time-picker.cjs.js +24 -17
- package/dist/date-time-picker.esm.js +89 -82
- package/dist/date-time-utils-C-4eHTyy.js +1 -0
- package/dist/{date-time-utils-BTlxnz5j.mjs → date-time-utils-zAx4ghvC.mjs} +75 -68
- package/dist/description.cjs.js +4 -4
- package/dist/description.esm.js +4 -4
- package/dist/dialog.cjs.js +59 -43
- package/dist/dialog.esm.js +86 -53
- package/dist/direction-provider.cjs.js +1 -1
- package/dist/direction-provider.esm.js +1 -1
- 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-error.cjs.js +1 -1
- package/dist/field-error.esm.js +7 -7
- package/dist/field.cjs.js +23 -14
- package/dist/field.esm.js +30 -21
- package/dist/fieldset.cjs.js +16 -9
- package/dist/fieldset.esm.js +19 -12
- package/dist/file-upload.cjs.js +79 -37
- package/dist/file-upload.esm.js +154 -112
- package/dist/flex.cjs.js +2 -2
- package/dist/flex.esm.js +8 -8
- package/dist/floating-toolbar.cjs.js +6 -7
- package/dist/floating-toolbar.esm.js +8 -9
- package/dist/form.cjs.js +24 -27
- package/dist/form.esm.js +24 -27
- package/dist/gantt.cjs.js +13 -11
- package/dist/gantt.esm.js +13 -11
- package/dist/grid.cjs.js +1 -1
- package/dist/grid.esm.js +1 -1
- package/dist/hover-card.cjs.js +8 -8
- package/dist/hover-card.esm.js +18 -15
- 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 +50 -22
- package/dist/inline-edit.esm.js +77 -49
- package/dist/input.cjs.js +45 -38
- package/dist/input.esm.js +60 -53
- package/dist/label.cjs.js +6 -6
- package/dist/label.esm.js +6 -6
- 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/masonry-grid.cjs.js +2 -2
- package/dist/masonry-grid.esm.js +11 -11
- package/dist/{menu-item-styles-IGSFLAHu.mjs → menu-item-styles-CdqxPUuw.mjs} +15 -15
- package/dist/{menu-item-styles-B4onAr4C.js → menu-item-styles-DUdyjQ7i.js} +10 -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 +53 -40
- package/dist/multi-select.esm.js +87 -73
- package/dist/navigation-menu.cjs.js +10 -10
- package/dist/navigation-menu.esm.js +33 -33
- package/dist/number-field.cjs.js +28 -17
- package/dist/number-field.esm.js +37 -26
- package/dist/number-ticker.cjs.js +4 -4
- package/dist/number-ticker.esm.js +10 -10
- package/dist/odometer.cjs.js +9 -9
- package/dist/odometer.esm.js +17 -17
- 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 +39 -34
- package/dist/password-field.esm.js +63 -58
- package/dist/pin-input.cjs.js +18 -14
- package/dist/pin-input.esm.js +24 -20
- package/dist/placement-grid.cjs.js +1 -1
- package/dist/placement-grid.esm.js +1 -1
- 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.cjs.js +1 -1
- package/dist/portal.d.ts +3 -1
- package/dist/portal.d.ts.map +1 -1
- package/dist/portal.esm.js +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/presence.cjs.js +1 -1
- package/dist/presence.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 +14 -14
- package/dist/quick-actions.esm.js +12 -12
- package/dist/radio-group.cjs.js +50 -26
- package/dist/radio-group.esm.js +53 -29
- package/dist/radio.cjs.js +16 -13
- package/dist/radio.esm.js +16 -13
- package/dist/rating.cjs.js +11 -15
- package/dist/rating.esm.js +48 -50
- package/dist/{runtime-CFnK53iC.mjs → runtime-BRT7E4A8.mjs} +563 -531
- package/dist/runtime-CXw4SGV9.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 +42 -75
- package/dist/select.esm.js +57 -89
- 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/separator.cjs.js +6 -6
- package/dist/separator.esm.js +7 -7
- package/dist/sidebar.cjs.js +29 -28
- package/dist/sidebar.esm.js +32 -31
- 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/slot.cjs.js +1 -1
- package/dist/slot.esm.js +1 -1
- package/dist/sortable.cjs.js +10 -11
- package/dist/sortable.esm.js +10 -11
- package/dist/spinning-text.cjs.js +4 -13
- package/dist/spinning-text.esm.js +4 -13
- package/dist/split-button.cjs.js +7 -7
- package/dist/split-button.esm.js +17 -16
- 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 +101 -26
- package/dist/tabs.esm.js +187 -112
- package/dist/tags-input.cjs.js +43 -17
- package/dist/tags-input.esm.js +75 -49
- package/dist/textarea.cjs.js +34 -35
- package/dist/textarea.esm.js +50 -51
- package/dist/theme.d.ts +25 -1
- package/dist/theme.d.ts.map +1 -1
- package/dist/time-field.cjs.js +8 -8
- package/dist/time-field.esm.js +29 -29
- package/dist/time-picker.cjs.js +17 -14
- package/dist/time-picker.esm.js +28 -25
- package/dist/timeline.cjs.js +10 -10
- package/dist/timeline.esm.js +7 -7
- package/dist/toast.cjs.js +2 -2
- package/dist/toast.esm.js +2 -2
- 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 +37 -38
- package/dist/transfer-list.esm.js +32 -33
- 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 +51 -39
- package/dist/wizard.esm.js +51 -39
- 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/dropdown.esm.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { E as _ } from "./ElementBase-BeZT54Hj.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { O as x, s as y } from "./overlay-motion-BX3dPLay.mjs";
|
|
3
|
+
import { r as k } from "./trigger-BjnxLCeQ.mjs";
|
|
4
|
+
import { c as A } from "./menu-item-styles-CdqxPUuw.mjs";
|
|
4
5
|
const l = [
|
|
5
6
|
'[role="menuitem"]',
|
|
6
7
|
'[role="menuitemcheckbox"]',
|
|
7
8
|
'[role="menuitemradio"]',
|
|
8
9
|
".item",
|
|
9
10
|
"[data-menu-item]"
|
|
10
|
-
].join(", "),
|
|
11
|
+
].join(", "), S = `
|
|
12
|
+
${x}
|
|
13
|
+
|
|
11
14
|
:host {
|
|
12
15
|
--ui-dropdown-bg: var(
|
|
13
16
|
--ui-dropdown-menu-bg,
|
|
@@ -21,7 +24,7 @@ const l = [
|
|
|
21
24
|
);
|
|
22
25
|
--ui-dropdown-border: var(--ui-dropdown-menu-border, var(--base-dropdown-border, 1px solid var(--ui-dropdown-border-color)));
|
|
23
26
|
--ui-dropdown-shadow: var(--ui-dropdown-menu-shadow, var(--base-dropdown-shadow, 0 10px 24px rgba(15, 23, 42, 0.14)));
|
|
24
|
-
--ui-dropdown-radius: var(--ui-dropdown-menu-radius, var(--base-dropdown-radius, var(--ui-radius,
|
|
27
|
+
--ui-dropdown-radius: var(--ui-dropdown-menu-radius, var(--base-dropdown-radius, var(--ui-radius, 6px)));
|
|
25
28
|
--ui-dropdown-padding: var(--ui-dropdown-menu-padding, var(--base-dropdown-content-padding, 0px));
|
|
26
29
|
--ui-dropdown-min-width: var(--ui-dropdown-menu-min-width, var(--base-dropdown-min-width, 224px));
|
|
27
30
|
--ui-dropdown-gap: 8px;
|
|
@@ -276,7 +279,7 @@ const l = [
|
|
|
276
279
|
--ui-dropdown-item-checked-bg: color-mix(in srgb, var(--ui-color-warning, #b45309) 17%, transparent);
|
|
277
280
|
}
|
|
278
281
|
|
|
279
|
-
${
|
|
282
|
+
${A({
|
|
280
283
|
scopes: [".menu"],
|
|
281
284
|
prefix: "--ui-dropdown",
|
|
282
285
|
shortcutSelectors: [".shortcut", ".meta"],
|
|
@@ -509,14 +512,14 @@ const l = [
|
|
|
509
512
|
}
|
|
510
513
|
}
|
|
511
514
|
`;
|
|
512
|
-
function
|
|
515
|
+
function C(i) {
|
|
513
516
|
return i === "top" || i === "left" || i === "right" ? i : "bottom";
|
|
514
517
|
}
|
|
515
|
-
function
|
|
518
|
+
function E(i) {
|
|
516
519
|
const e = (i || "").trim().toLowerCase();
|
|
517
520
|
return e === "sm" || e === "1" || e === "compact" ? "sm" : e === "lg" || e === "3" || e === "comfortable" ? "lg" : "md";
|
|
518
521
|
}
|
|
519
|
-
function
|
|
522
|
+
function I(i) {
|
|
520
523
|
const e = (i || "").trim().toLowerCase();
|
|
521
524
|
return !e || e === "default" ? null : e === "none" ? "0px" : e === "sm" ? "8px" : e === "md" ? "12px" : e === "lg" || e === "large" ? "16px" : e === "full" || e === "pill" ? "999px" : e === "square" ? "6px" : e === "soft" || e === "rounded" ? "14px" : /^\d+(\.\d+)?$/.test(e) ? `${e}px` : /^\d+(\.\d+)?(px|rem|em|%)$/.test(e) ? e : i;
|
|
522
525
|
}
|
|
@@ -534,7 +537,7 @@ function h() {
|
|
|
534
537
|
function b(i) {
|
|
535
538
|
return i.hasAttribute("disabled") || i.getAttribute("aria-disabled") === "true" || i.disabled === !0;
|
|
536
539
|
}
|
|
537
|
-
function
|
|
540
|
+
function T(i) {
|
|
538
541
|
return (i.getAttribute("aria-label") || i.textContent || "").trim();
|
|
539
542
|
}
|
|
540
543
|
function g(i) {
|
|
@@ -545,7 +548,7 @@ function g(i) {
|
|
|
545
548
|
i.focus();
|
|
546
549
|
}
|
|
547
550
|
}
|
|
548
|
-
function
|
|
551
|
+
function M(i, e) {
|
|
549
552
|
const t = i.offsetTop, r = t + i.offsetHeight, o = e.scrollTop, a = o + e.clientHeight;
|
|
550
553
|
if (t < o) {
|
|
551
554
|
e.scrollTop = t;
|
|
@@ -553,7 +556,7 @@ function I(i, e) {
|
|
|
553
556
|
}
|
|
554
557
|
r > a && (e.scrollTop = Math.max(0, r - e.clientHeight));
|
|
555
558
|
}
|
|
556
|
-
function
|
|
559
|
+
function O(i) {
|
|
557
560
|
return w(i);
|
|
558
561
|
}
|
|
559
562
|
function w(i) {
|
|
@@ -568,23 +571,23 @@ function w(i) {
|
|
|
568
571
|
t.appendChild(w(r));
|
|
569
572
|
}), t;
|
|
570
573
|
}
|
|
571
|
-
function
|
|
574
|
+
function P(i, e, t) {
|
|
572
575
|
for (let r = e + t; r >= 0 && r < i.length; r += t)
|
|
573
576
|
if (!b(i[r])) return r;
|
|
574
577
|
return -1;
|
|
575
578
|
}
|
|
576
|
-
function
|
|
579
|
+
function F(i, e, t) {
|
|
577
580
|
if (!e) return null;
|
|
578
581
|
const r = i.filter((a) => !b(a));
|
|
579
582
|
if (!r.length) return null;
|
|
580
583
|
const o = t ? r.indexOf(t) : -1;
|
|
581
584
|
for (let a = 1; a <= r.length; a += 1) {
|
|
582
585
|
const n = r[(o + a + r.length) % r.length];
|
|
583
|
-
if (
|
|
586
|
+
if (T(n).toLowerCase().startsWith(e)) return n;
|
|
584
587
|
}
|
|
585
588
|
return null;
|
|
586
589
|
}
|
|
587
|
-
const
|
|
590
|
+
const D = /* @__PURE__ */ new Set(["variant", "density", "shape", "elevation", "tone", "size", "radius"]), L = /* @__PURE__ */ new Set(["aria-label", "aria-labelledby", "aria-describedby"]), z = [
|
|
588
591
|
"--ui-dropdown-bg",
|
|
589
592
|
"--ui-dropdown-color",
|
|
590
593
|
"--ui-dropdown-muted",
|
|
@@ -606,7 +609,7 @@ const P = /* @__PURE__ */ new Set(["variant", "density", "shape", "elevation", "
|
|
|
606
609
|
"--ui-dropdown-duration",
|
|
607
610
|
"--ui-dropdown-easing"
|
|
608
611
|
];
|
|
609
|
-
class
|
|
612
|
+
class H extends _ {
|
|
610
613
|
constructor() {
|
|
611
614
|
super(), this._isOpen = !1, this._panelEl = null, this._portalEl = null, this._restoreFocusEl = null, this._typeaheadBuffer = "", this._typeaheadTimer = null, this._placement = "bottom", this._openListenersBound = !1, this._openFrame = 0, this._checkboxState = /* @__PURE__ */ new Map(), this._radioState = /* @__PURE__ */ new Map(), this._menuId = `ui-dropdown-menu-${Math.random().toString(36).slice(2, 10)}`, this._triggerId = `ui-dropdown-trigger-${Math.random().toString(36).slice(2, 10)}`, this._onHostClick = this._onHostClick.bind(this), this._onHostKeyDown = this._onHostKeyDown.bind(this), this._onDocumentPointerDown = this._onDocumentPointerDown.bind(this), this._onSlotChange = this._onSlotChange.bind(this);
|
|
612
615
|
}
|
|
@@ -647,11 +650,11 @@ class L extends _ {
|
|
|
647
650
|
this.hasAttribute("disabled") && this._isOpen && this.close("disabled"), this._syncTriggerA11y();
|
|
648
651
|
return;
|
|
649
652
|
}
|
|
650
|
-
if (this._isOpen && (e === "placement" ||
|
|
653
|
+
if (this._isOpen && (e === "placement" || D.has(e))) {
|
|
651
654
|
this._syncMenuPresentation(), this._schedulePanelSync();
|
|
652
655
|
return;
|
|
653
656
|
}
|
|
654
|
-
this._isOpen &&
|
|
657
|
+
this._isOpen && L.has(e) && this._syncMenuA11y();
|
|
655
658
|
}
|
|
656
659
|
}
|
|
657
660
|
}
|
|
@@ -783,7 +786,7 @@ class L extends _ {
|
|
|
783
786
|
_syncTriggerA11y() {
|
|
784
787
|
const e = this._getTrigger();
|
|
785
788
|
if (!e) return;
|
|
786
|
-
const t =
|
|
789
|
+
const t = k(e);
|
|
787
790
|
if (t.id || (t.id = this._triggerId), t.setAttribute("aria-haspopup", "menu"), t.setAttribute("aria-expanded", this._isOpen ? "true" : "false"), this._isOpen ? t.setAttribute("aria-controls", this._menuId) : t.removeAttribute("aria-controls"), this.hasAttribute("disabled")) {
|
|
788
791
|
t.setAttribute("aria-disabled", "true"), t.setAttribute("tabindex", "-1");
|
|
789
792
|
return;
|
|
@@ -795,7 +798,7 @@ class L extends _ {
|
|
|
795
798
|
if (!e) return;
|
|
796
799
|
e.replaceChildren();
|
|
797
800
|
const t = this._getContentSource();
|
|
798
|
-
if (t && e.appendChild(
|
|
801
|
+
if (t && e.appendChild(O(t)), !e.querySelector(l)) {
|
|
799
802
|
const r = document.createElement("div");
|
|
800
803
|
r.className = "empty-state", r.textContent = "No items", e.appendChild(r);
|
|
801
804
|
}
|
|
@@ -830,11 +833,11 @@ class L extends _ {
|
|
|
830
833
|
const e = this._getMenu();
|
|
831
834
|
if (!e) return;
|
|
832
835
|
const t = h() ? window.getComputedStyle(this) : null;
|
|
833
|
-
t &&
|
|
836
|
+
t && z.forEach((c) => {
|
|
834
837
|
const m = t.getPropertyValue(c).trim();
|
|
835
838
|
m ? e.style.setProperty(c, m) : e.style.removeProperty(c);
|
|
836
839
|
});
|
|
837
|
-
const r = p(this, "variant"), o =
|
|
840
|
+
const r = p(this, "variant"), o = E(this.getAttribute("size") || this.getAttribute("density")), a = p(this, "density"), n = p(this, "shape"), u = p(this, "elevation"), s = p(this, "tone"), d = I(this.getAttribute("radius") || n || null);
|
|
838
841
|
if (r && r !== "default" ? e.setAttribute("data-variant", r) : e.removeAttribute("data-variant"), o !== "md" ? e.setAttribute("data-size", o) : e.removeAttribute("data-size"), a && a !== "default" ? e.setAttribute("data-density", a) : e.removeAttribute("data-density"), n && n !== "default" ? e.setAttribute("data-shape", n) : e.removeAttribute("data-shape"), u && u !== "default" ? e.setAttribute("data-elevation", u) : e.removeAttribute("data-elevation"), s && s !== "default" && s !== "brand" ? e.setAttribute("data-tone", s) : e.removeAttribute("data-tone"), d) {
|
|
839
842
|
e.style.setProperty("--ui-dropdown-radius", d), e.style.setProperty("--ui-dropdown-item-radius", d === "999px" ? "999px" : `max(0px, calc(${d} - 2px))`);
|
|
840
843
|
return;
|
|
@@ -849,7 +852,7 @@ class L extends _ {
|
|
|
849
852
|
}
|
|
850
853
|
_syncControlState() {
|
|
851
854
|
const e = this._panelEl, t = this._getMenu();
|
|
852
|
-
!e || !t || (e.
|
|
855
|
+
!e || !t || (e.setAttribute("data-placement", this._placement), y(e, this._isOpen, String(this._placement).split("-")[0]));
|
|
853
856
|
}
|
|
854
857
|
_schedulePanelSync(e) {
|
|
855
858
|
this._openFrame && cancelAnimationFrame(this._openFrame), this._openFrame = requestAnimationFrame(() => {
|
|
@@ -873,7 +876,7 @@ class L extends _ {
|
|
|
873
876
|
return e === "top" ? r.top - 12 : o - r.bottom - 12;
|
|
874
877
|
}
|
|
875
878
|
_resolvePlacement() {
|
|
876
|
-
const e =
|
|
879
|
+
const e = C(this.getAttribute("placement")), t = this._getTrigger(), r = this._getMenu();
|
|
877
880
|
if (!t || !r || !h()) return e;
|
|
878
881
|
const o = t.getBoundingClientRect(), a = window.innerWidth || document.documentElement.clientWidth || 0, n = window.innerHeight || document.documentElement.clientHeight || 0, u = Math.max(0, n - o.bottom - 12), s = Math.max(0, o.top - 12), d = Math.max(0, a - o.right - 12), c = Math.max(0, o.left - 12), m = Math.min(Math.max(r.scrollHeight, r.offsetHeight) + 4, 320), v = Math.min(Math.max(r.scrollWidth, r.offsetWidth) + 4, 360);
|
|
879
882
|
return e === "top" ? s >= m || s > u ? "top" : "bottom" : e === "left" ? c >= v || c > d ? "left" : "right" : e === "right" ? d >= v || d >= c ? "right" : "left" : u >= m || u >= s ? "bottom" : "top";
|
|
@@ -884,7 +887,7 @@ class L extends _ {
|
|
|
884
887
|
_setActiveItem(e, t = {}) {
|
|
885
888
|
if (this._clearActiveItem(), !!e && (e.setAttribute("data-active", "true"), t.focus && g(e), t.scroll)) {
|
|
886
889
|
const r = this._getMenu();
|
|
887
|
-
r &&
|
|
890
|
+
r && M(e, r);
|
|
888
891
|
}
|
|
889
892
|
}
|
|
890
893
|
_focusFirstItem() {
|
|
@@ -898,7 +901,7 @@ class L extends _ {
|
|
|
898
901
|
_moveFocus(e) {
|
|
899
902
|
const t = this._queryItems(!0);
|
|
900
903
|
if (!t.length) return;
|
|
901
|
-
const r = this._currentFocusedItem() || this._queryItems(!0).find((n) => n.getAttribute("data-active") === "true") || null, o = r ? t.indexOf(r) : e > 0 ? -1 : t.length, a =
|
|
904
|
+
const r = this._currentFocusedItem() || this._queryItems(!0).find((n) => n.getAttribute("data-active") === "true") || null, o = r ? t.indexOf(r) : e > 0 ? -1 : t.length, a = P(t, o, e);
|
|
902
905
|
if (a >= 0) {
|
|
903
906
|
this._setActiveItem(t[a], { focus: !0, scroll: !0 });
|
|
904
907
|
return;
|
|
@@ -915,7 +918,7 @@ class L extends _ {
|
|
|
915
918
|
if (!this.typeahead || !this._isTypeaheadKey(e)) return !1;
|
|
916
919
|
const t = e.key.toLowerCase();
|
|
917
920
|
this._typeaheadBuffer = `${this._typeaheadBuffer}${t}`.slice(0, 24), this._typeaheadTimer != null && window.clearTimeout(this._typeaheadTimer), this._typeaheadTimer = window.setTimeout(() => this._resetTypeahead(), 460);
|
|
918
|
-
const r =
|
|
921
|
+
const r = F(this._queryItems(!0), this._typeaheadBuffer, this._currentFocusedItem());
|
|
919
922
|
return r ? (this._setActiveItem(r, { focus: !0, scroll: !0 }), e.preventDefault(), !0) : !1;
|
|
920
923
|
}
|
|
921
924
|
_querySourceItems() {
|
|
@@ -1024,7 +1027,7 @@ class L extends _ {
|
|
|
1024
1027
|
}
|
|
1025
1028
|
render() {
|
|
1026
1029
|
this.setContent(`
|
|
1027
|
-
<style>${
|
|
1030
|
+
<style>${S}</style>
|
|
1028
1031
|
<div class="root" part="root">
|
|
1029
1032
|
<div class="trigger" part="trigger">
|
|
1030
1033
|
<slot name="trigger"></slot>
|
|
@@ -1049,7 +1052,7 @@ class L extends _ {
|
|
|
1049
1052
|
return !1;
|
|
1050
1053
|
}
|
|
1051
1054
|
}
|
|
1052
|
-
typeof customElements < "u" && !customElements.get("ui-dropdown") && customElements.define("ui-dropdown",
|
|
1055
|
+
typeof customElements < "u" && !customElements.get("ui-dropdown") && customElements.define("ui-dropdown", H);
|
|
1053
1056
|
export {
|
|
1054
|
-
|
|
1057
|
+
H as UIDropdown
|
|
1055
1058
|
};
|
package/dist/empty-state.cjs.js
CHANGED
|
@@ -2,18 +2,19 @@
|
|
|
2
2
|
:host {
|
|
3
3
|
display: block;
|
|
4
4
|
--ui-empty-bg: linear-gradient(180deg, var(--ui-color-surface, #ffffff), var(--ui-color-surface-alt, #f8fafc));
|
|
5
|
-
--ui-empty-border: 1px dashed color-mix(in srgb, var(--ui-color-border, rgba(51, 65, 85, 0.28)) 88%, transparent);
|
|
6
|
-
--ui-empty-radius:
|
|
5
|
+
--ui-empty-border: 1px dashed var(--ui-color-line, color-mix(in srgb, var(--ui-color-border, rgba(51, 65, 85, 0.28)) 88%, transparent));
|
|
6
|
+
--ui-empty-radius: calc(var(--ui-radius, 6px) + 4px);
|
|
7
7
|
--ui-empty-padding: 28px;
|
|
8
8
|
--ui-empty-title: var(--ui-color-text, #0f172a);
|
|
9
|
-
--ui-empty-description: var(--ui-color-muted, #526175);
|
|
9
|
+
--ui-empty-description: var(--ui-color-text-secondary, var(--ui-color-muted, #526175));
|
|
10
10
|
--ui-empty-icon-bg: color-mix(in srgb, var(--ui-color-muted, #526175) 18%, transparent);
|
|
11
11
|
--ui-empty-icon-color: color-mix(in srgb, var(--ui-color-text, #334155) 82%, transparent);
|
|
12
12
|
--ui-empty-shadow: none;
|
|
13
|
-
|
|
14
|
-
--ui-empty-action-
|
|
15
|
-
--ui-empty-action-
|
|
16
|
-
--ui-empty-action-
|
|
13
|
+
/* The default action is a primary button: a solid fill with the theme's text colour on it. */
|
|
14
|
+
--ui-empty-action-bg: var(--ui-color-primary, #2563eb);
|
|
15
|
+
--ui-empty-action-border: transparent;
|
|
16
|
+
--ui-empty-action-color: var(--ui-color-foreground-on-primary, #ffffff);
|
|
17
|
+
--ui-empty-action-bg-hover: color-mix(in srgb, var(--ui-color-primary, #2563eb) 88%, var(--ui-color-text-strong, #0f172a));
|
|
17
18
|
color-scheme: light dark;
|
|
18
19
|
}
|
|
19
20
|
|
|
@@ -71,10 +72,11 @@
|
|
|
71
72
|
border: 1px solid var(--ui-empty-action-border);
|
|
72
73
|
background: var(--ui-empty-action-bg);
|
|
73
74
|
color: var(--ui-empty-action-color);
|
|
74
|
-
border-radius:
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
font-
|
|
75
|
+
border-radius: var(--ui-control-radius-2, var(--ui-radius, 6px));
|
|
76
|
+
min-height: var(--ui-control-height-2, 32px);
|
|
77
|
+
padding: 0 12px;
|
|
78
|
+
font-size: var(--ui-control-font-size-2, 14px);
|
|
79
|
+
font-weight: 500;
|
|
78
80
|
cursor: pointer;
|
|
79
81
|
}
|
|
80
82
|
|
|
@@ -149,21 +151,21 @@
|
|
|
149
151
|
border-color: Highlight;
|
|
150
152
|
}
|
|
151
153
|
}
|
|
152
|
-
`;function e
|
|
154
|
+
`;function i(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}class n extends a.ElementBase{constructor(){super(),this._actionBtn=null,this._onActionClick=this._onActionClick.bind(this)}static get observedAttributes(){return["title","description","action-label","tone","compact","headless"]}disconnectedCallback(){this._actionBtn&&(this._actionBtn.removeEventListener("click",this._onActionClick),this._actionBtn=null),super.disconnectedCallback()}_onActionClick(){this.dispatchEvent(new CustomEvent("action",{bubbles:!0}))}render(){this._actionBtn&&(this._actionBtn.removeEventListener("click",this._onActionClick),this._actionBtn=null);const o=this.getAttribute("title")||"No results found",r=this.getAttribute("description")||"Try adjusting your filters or creating a new record.",t=this.getAttribute("action-label")||"";this.setContent(`
|
|
153
155
|
<style>${c}</style>
|
|
154
156
|
<section class="card" role="status" aria-live="polite">
|
|
155
157
|
<div class="icon" part="icon" aria-hidden="true">
|
|
156
158
|
<slot name="icon">i</slot>
|
|
157
159
|
</div>
|
|
158
160
|
<h3 class="title" part="title">
|
|
159
|
-
<slot name="title">${
|
|
161
|
+
<slot name="title">${i(o)}</slot>
|
|
160
162
|
</h3>
|
|
161
163
|
<p class="description" part="description">
|
|
162
|
-
<slot name="description">${
|
|
164
|
+
<slot name="description">${i(r)}</slot>
|
|
163
165
|
</p>
|
|
164
166
|
<div class="actions" part="actions">
|
|
165
167
|
<slot name="actions"></slot>
|
|
166
|
-
${t?`<button type="button" class="default-action">${
|
|
168
|
+
${t?`<button type="button" class="default-action">${i(t)}</button>`:""}
|
|
167
169
|
</div>
|
|
168
170
|
</section>
|
|
169
171
|
`),this._actionBtn=this.root.querySelector(".default-action"),this._actionBtn&&this._actionBtn.addEventListener("click",this._onActionClick)}shouldRenderOnAttributeChange(o,r,t){return!0}}typeof customElements<"u"&&!customElements.get("ui-empty-state")&&customElements.define("ui-empty-state",n);exports.UIEmptyState=n;
|
package/dist/empty-state.esm.js
CHANGED
|
@@ -3,18 +3,19 @@ const a = `
|
|
|
3
3
|
:host {
|
|
4
4
|
display: block;
|
|
5
5
|
--ui-empty-bg: linear-gradient(180deg, var(--ui-color-surface, #ffffff), var(--ui-color-surface-alt, #f8fafc));
|
|
6
|
-
--ui-empty-border: 1px dashed color-mix(in srgb, var(--ui-color-border, rgba(51, 65, 85, 0.28)) 88%, transparent);
|
|
7
|
-
--ui-empty-radius:
|
|
6
|
+
--ui-empty-border: 1px dashed var(--ui-color-line, color-mix(in srgb, var(--ui-color-border, rgba(51, 65, 85, 0.28)) 88%, transparent));
|
|
7
|
+
--ui-empty-radius: calc(var(--ui-radius, 6px) + 4px);
|
|
8
8
|
--ui-empty-padding: 28px;
|
|
9
9
|
--ui-empty-title: var(--ui-color-text, #0f172a);
|
|
10
|
-
--ui-empty-description: var(--ui-color-muted, #526175);
|
|
10
|
+
--ui-empty-description: var(--ui-color-text-secondary, var(--ui-color-muted, #526175));
|
|
11
11
|
--ui-empty-icon-bg: color-mix(in srgb, var(--ui-color-muted, #526175) 18%, transparent);
|
|
12
12
|
--ui-empty-icon-color: color-mix(in srgb, var(--ui-color-text, #334155) 82%, transparent);
|
|
13
13
|
--ui-empty-shadow: none;
|
|
14
|
-
|
|
15
|
-
--ui-empty-action-
|
|
16
|
-
--ui-empty-action-
|
|
17
|
-
--ui-empty-action-
|
|
14
|
+
/* The default action is a primary button: a solid fill with the theme's text colour on it. */
|
|
15
|
+
--ui-empty-action-bg: var(--ui-color-primary, #2563eb);
|
|
16
|
+
--ui-empty-action-border: transparent;
|
|
17
|
+
--ui-empty-action-color: var(--ui-color-foreground-on-primary, #ffffff);
|
|
18
|
+
--ui-empty-action-bg-hover: color-mix(in srgb, var(--ui-color-primary, #2563eb) 88%, var(--ui-color-text-strong, #0f172a));
|
|
18
19
|
color-scheme: light dark;
|
|
19
20
|
}
|
|
20
21
|
|
|
@@ -72,10 +73,11 @@ const a = `
|
|
|
72
73
|
border: 1px solid var(--ui-empty-action-border);
|
|
73
74
|
background: var(--ui-empty-action-bg);
|
|
74
75
|
color: var(--ui-empty-action-color);
|
|
75
|
-
border-radius:
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
font-
|
|
76
|
+
border-radius: var(--ui-control-radius-2, var(--ui-radius, 6px));
|
|
77
|
+
min-height: var(--ui-control-height-2, 32px);
|
|
78
|
+
padding: 0 12px;
|
|
79
|
+
font-size: var(--ui-control-font-size-2, 14px);
|
|
80
|
+
font-weight: 500;
|
|
79
81
|
cursor: pointer;
|
|
80
82
|
}
|
|
81
83
|
|
package/dist/field-error.cjs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("./ElementBase-DxbvhLJs.js"),u=`
|
|
2
2
|
:host {
|
|
3
|
-
--ui-field-error-color: var(--ui-color-danger, var(--ui-error, #c81e1e));
|
|
3
|
+
--ui-field-error-color: var(--ui-color-danger-text, var(--ui-color-danger, var(--ui-error, #c81e1e)));
|
|
4
4
|
--ui-field-error-size: 12px;
|
|
5
5
|
--ui-field-error-weight: 600;
|
|
6
6
|
--ui-field-error-line-height: 1.45;
|
package/dist/field-error.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { E as d } from "./ElementBase-BeZT54Hj.mjs";
|
|
2
2
|
const l = `
|
|
3
3
|
:host {
|
|
4
|
-
--ui-field-error-color: var(--ui-color-danger, var(--ui-error, #c81e1e));
|
|
4
|
+
--ui-field-error-color: var(--ui-color-danger-text, var(--ui-color-danger, var(--ui-error, #c81e1e)));
|
|
5
5
|
--ui-field-error-size: 12px;
|
|
6
6
|
--ui-field-error-weight: 600;
|
|
7
7
|
--ui-field-error-line-height: 1.45;
|
|
@@ -76,8 +76,8 @@ function u(e, r) {
|
|
|
76
76
|
function c(e) {
|
|
77
77
|
return Array.from(new Set(e.filter(Boolean)));
|
|
78
78
|
}
|
|
79
|
-
function a(e, r,
|
|
80
|
-
const o = (e.getAttribute(r) || "").split(/\s+/).filter(Boolean), s =
|
|
79
|
+
function a(e, r, t, i) {
|
|
80
|
+
const o = (e.getAttribute(r) || "").split(/\s+/).filter(Boolean), s = i ? c([...o, t]) : o.filter((n) => n !== t);
|
|
81
81
|
s.length ? e.setAttribute(r, s.join(" ")) : e.removeAttribute(r);
|
|
82
82
|
}
|
|
83
83
|
class f extends d {
|
|
@@ -93,8 +93,8 @@ class f extends d {
|
|
|
93
93
|
disconnectedCallback() {
|
|
94
94
|
this._clearAssociation(), super.disconnectedCallback();
|
|
95
95
|
}
|
|
96
|
-
attributeChangedCallback(r,
|
|
97
|
-
|
|
96
|
+
attributeChangedCallback(r, t, i) {
|
|
97
|
+
t !== i && (r === "for" || r === "active" || r === "hidden") && this._syncAssociation();
|
|
98
98
|
}
|
|
99
99
|
render() {
|
|
100
100
|
this.setContent(`
|
|
@@ -105,8 +105,8 @@ class f extends d {
|
|
|
105
105
|
_resolveTarget() {
|
|
106
106
|
const r = this.getAttribute("for");
|
|
107
107
|
if (!r) return null;
|
|
108
|
-
const
|
|
109
|
-
return
|
|
108
|
+
const t = this.getRootNode();
|
|
109
|
+
return t instanceof Document || t instanceof ShadowRoot ? t.getElementById(r) : document.getElementById(r);
|
|
110
110
|
}
|
|
111
111
|
_clearAssociation() {
|
|
112
112
|
this._target && this._errorId && (a(this._target, "aria-describedby", this._errorId, !1), this._target.getAttribute("aria-errormessage") === this._errorId && this._target.removeAttribute("aria-errormessage"), this._target.getAttribute("aria-invalid") === "true" && !this._target.hasAttribute("data-ui-invalid-persist") && this._target.removeAttribute("aria-invalid")), this._target = null;
|
package/dist/field.cjs.js
CHANGED
|
@@ -2,14 +2,16 @@
|
|
|
2
2
|
:host {
|
|
3
3
|
--ui-field-gap: 8px;
|
|
4
4
|
--ui-field-label-width: 192px;
|
|
5
|
-
--ui-field-radius:
|
|
6
|
-
--ui-field-bg:
|
|
5
|
+
--ui-field-radius: calc(var(--ui-radius, 6px) + 4px);
|
|
6
|
+
--ui-field-bg: transparent;
|
|
7
|
+
--ui-field-frame-padding: 0px;
|
|
8
|
+
--ui-field-density: 1;
|
|
7
9
|
--ui-field-color: var(--ui-color-text, var(--ui-text, #0f172a));
|
|
8
10
|
--ui-field-label-color: var(--ui-color-text, var(--ui-text, #0f172a));
|
|
9
11
|
--ui-field-description-color: var(--ui-color-muted, var(--ui-muted, #526175));
|
|
10
|
-
--ui-field-error-color: var(--ui-color-danger, var(--ui-error, #c81e1e));
|
|
12
|
+
--ui-field-error-color: var(--ui-color-danger-text, var(--ui-color-danger, var(--ui-error, #c81e1e)));
|
|
11
13
|
--ui-field-border-color: color-mix(in srgb, var(--ui-color-border, #cbd5e1) 72%, transparent);
|
|
12
|
-
--ui-field-border:
|
|
14
|
+
--ui-field-border: 0;
|
|
13
15
|
--ui-field-shadow:
|
|
14
16
|
none;
|
|
15
17
|
--ui-field-focus-ring: var(--ui-color-focus-ring, var(--ui-focus-ring, #2563eb));
|
|
@@ -38,7 +40,7 @@
|
|
|
38
40
|
border: var(--ui-field-border);
|
|
39
41
|
border-radius: var(--ui-field-radius);
|
|
40
42
|
box-shadow: var(--ui-field-shadow);
|
|
41
|
-
padding:
|
|
43
|
+
padding: calc(var(--ui-field-frame-padding) * var(--ui-field-density));
|
|
42
44
|
box-sizing: border-box;
|
|
43
45
|
transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
|
|
44
46
|
}
|
|
@@ -156,6 +158,16 @@
|
|
|
156
158
|
--ui-field-shell-border-color: color-mix(in srgb, var(--ui-field-error-color) 56%, transparent);
|
|
157
159
|
}
|
|
158
160
|
|
|
161
|
+
/* A plain field is flat: label, control and message with no box around them. These variants draw the box. */
|
|
162
|
+
:host([variant="surface"]),
|
|
163
|
+
:host([variant="outline"]),
|
|
164
|
+
:host([variant="soft"]),
|
|
165
|
+
:host([variant="contrast"]),
|
|
166
|
+
:host([variant="elevated"]) {
|
|
167
|
+
--ui-field-border: 1px solid var(--ui-field-border-color);
|
|
168
|
+
--ui-field-frame-padding: 12px;
|
|
169
|
+
}
|
|
170
|
+
|
|
159
171
|
:host([variant="surface"]) {
|
|
160
172
|
--ui-field-bg: var(--ui-color-surface, var(--ui-surface, #ffffff));
|
|
161
173
|
--ui-field-shadow:
|
|
@@ -193,10 +205,7 @@
|
|
|
193
205
|
--ui-field-bg: transparent;
|
|
194
206
|
--ui-field-border: 0;
|
|
195
207
|
--ui-field-shadow: none;
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
:host([variant="minimal"]) .frame {
|
|
199
|
-
padding: 0;
|
|
208
|
+
--ui-field-frame-padding: 0px;
|
|
200
209
|
}
|
|
201
210
|
|
|
202
211
|
:host([variant="elevated"]) {
|
|
@@ -223,8 +232,8 @@
|
|
|
223
232
|
--ui-field-gap: 6px;
|
|
224
233
|
}
|
|
225
234
|
|
|
226
|
-
:host([density="compact"])
|
|
227
|
-
|
|
235
|
+
:host([density="compact"]) {
|
|
236
|
+
--ui-field-density: 0.75;
|
|
228
237
|
}
|
|
229
238
|
|
|
230
239
|
:host([density="compact"]) .label {
|
|
@@ -240,8 +249,8 @@
|
|
|
240
249
|
--ui-field-gap: 10px;
|
|
241
250
|
}
|
|
242
251
|
|
|
243
|
-
:host([density="comfortable"])
|
|
244
|
-
|
|
252
|
+
:host([density="comfortable"]) {
|
|
253
|
+
--ui-field-density: 1.25;
|
|
245
254
|
}
|
|
246
255
|
|
|
247
256
|
:host([density="comfortable"]) .label {
|
|
@@ -370,7 +379,7 @@
|
|
|
370
379
|
box-shadow: none;
|
|
371
380
|
}
|
|
372
381
|
}
|
|
373
|
-
`;function C(r){return r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function A(r){if(!r)return!1;const t=r.assignedNodes({flatten:!0});return t.length?t.some(i=>i.nodeType===Node.TEXT_NODE?!!i.textContent?.trim():i.nodeType===Node.ELEMENT_NODE):!1}function x(r){if(r.hasAttribute("disabled")||r.getAttribute("aria-disabled")==="true"||r.getAttribute("tabindex")==="-1")return!1;const t=window.getComputedStyle(r);return!(t.display==="none"||t.visibility==="hidden")}function D(r){return!!r.closest('button, a, input, select, textarea, summary, [contenteditable=""], [contenteditable="true"], [role="button"]')}function k(r){return Array.from(new Set(r.filter(Boolean)))}const _="data-ui-field-label",S="data-ui-field-description",I='ui-input, ui-textarea, ui-select, ui-combobox, input, textarea, select, button, [tabindex]:not([tabindex="-1"])';class L extends M.ElementBase{constructor(){super(),this._uid=Math.random().toString(36).slice(2,9),this._controlCache=null,this._stateSyncQueued=!1,this._onRootClick=this._onRootClick.bind(this),this._onSlotChange=this._onSlotChange.bind(this)}static get observedAttributes(){return["label","description","error","for","required","invalid","orientation","headless","variant","tone","density","shape","shell","label-width"]}connectedCallback(){super.connectedCallback(),this.root.addEventListener("click",this._onRootClick),this.root.addEventListener("slotchange",this._onSlotChange),this._scheduleDerivedStateSync()}disconnectedCallback(){this.root.removeEventListener("click",this._onRootClick),this.root.removeEventListener("slotchange",this._onSlotChange),super.disconnectedCallback()}attributeChangedCallback(t,i,l){if(i!==l){if(t==="for"&&this._invalidateControlCache(),t==="label-width"){const o=this.getAttribute("label-width");o?this.style.setProperty("--ui-field-label-width",o):this.style.removeProperty("--ui-field-label-width")}if(t==="label"||t==="description"||t==="error"||t==="required"||t==="for"){this.isConnected&&this.requestRender();return}t==="invalid"&&this._scheduleDerivedStateSync()}}_onSlotChange(){this._invalidateControlCache(),this._scheduleDerivedStateSync()}_onRootClick(t){const i=t.target;i&&i.closest(".label")&&(D(i)||this._focusControl())}_invalidateControlCache(){this._controlCache=null}_scheduleDerivedStateSync(){this._stateSyncQueued||(this._stateSyncQueued=!0,queueMicrotask(()=>{this._stateSyncQueued=!1,this.isConnected&&this._syncDerivedState()}))}_focusControl(){const t=this._resolveControlElement();if(t)try{t.focus({preventScroll:!0})}catch{t.focus()}}_resolveControlElement(){if(this._controlCache&&this._controlCache.isConnected&&x(this._controlCache))return this._controlCache;const t=this.getAttribute("for");if(t){const e=document.getElementById(t);if(e instanceof HTMLElement&&x(e))return this._controlCache=e,e}const l=this.root.querySelector("slot:not([name])")?.assignedElements({flatten:!0})||[];for(const e of l){if(!(e instanceof HTMLElement))continue;if(x(e))return this._controlCache=e,e;const a=e.querySelector(I);if(a&&x(a))return this._controlCache=a,a}const o=this.querySelector(I);return o&&x(o)?(this._controlCache=o,o):null}_syncDerivedState(){const t=this.root.querySelector('slot[name="label"]'),i=this.root.querySelector('slot[name="actions"]'),l=this.root.querySelector('slot[name="description"]'),o=this.root.querySelector('slot[name="error"]'),e=(this.getAttribute("label")||"").trim(),a=(this.getAttribute("description")||"").trim(),y=(this.getAttribute("error")||"").trim(),n=!!e||A(t),d=A(i),h=!!a||A(l),b=!!y||A(o),w=n||d||h,E=n||d,c=this.root.querySelector(".meta"),p=this.root.querySelector(".label-row"),g=this.root.querySelector(".label"),
|
|
382
|
+
`;function C(r){return r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function A(r){if(!r)return!1;const t=r.assignedNodes({flatten:!0});return t.length?t.some(i=>i.nodeType===Node.TEXT_NODE?!!i.textContent?.trim():i.nodeType===Node.ELEMENT_NODE):!1}function x(r){if(r.hasAttribute("disabled")||r.getAttribute("aria-disabled")==="true"||r.getAttribute("tabindex")==="-1")return!1;const t=window.getComputedStyle(r);return!(t.display==="none"||t.visibility==="hidden")}function D(r){return!!r.closest('button, a, input, select, textarea, summary, [contenteditable=""], [contenteditable="true"], [role="button"]')}function k(r){return Array.from(new Set(r.filter(Boolean)))}const _="data-ui-field-label",S="data-ui-field-description",I='ui-input, ui-textarea, ui-select, ui-combobox, input, textarea, select, button, [tabindex]:not([tabindex="-1"])';class L extends M.ElementBase{constructor(){super(),this._uid=Math.random().toString(36).slice(2,9),this._controlCache=null,this._stateSyncQueued=!1,this._onRootClick=this._onRootClick.bind(this),this._onSlotChange=this._onSlotChange.bind(this)}static get observedAttributes(){return["label","description","error","for","required","invalid","orientation","headless","variant","tone","density","shape","shell","label-width"]}connectedCallback(){super.connectedCallback(),this.root.addEventListener("click",this._onRootClick),this.root.addEventListener("slotchange",this._onSlotChange),this._scheduleDerivedStateSync()}disconnectedCallback(){this.root.removeEventListener("click",this._onRootClick),this.root.removeEventListener("slotchange",this._onSlotChange),super.disconnectedCallback()}attributeChangedCallback(t,i,l){if(i!==l){if(t==="for"&&this._invalidateControlCache(),t==="label-width"){const o=this.getAttribute("label-width");o?this.style.setProperty("--ui-field-label-width",o):this.style.removeProperty("--ui-field-label-width")}if(t==="label"||t==="description"||t==="error"||t==="required"||t==="for"){this.isConnected&&this.requestRender();return}t==="invalid"&&this._scheduleDerivedStateSync()}}_onSlotChange(){this._invalidateControlCache(),this._scheduleDerivedStateSync()}_onRootClick(t){const i=t.target;i&&i.closest(".label")&&(D(i)||this._focusControl())}_invalidateControlCache(){this._controlCache=null}_scheduleDerivedStateSync(){this._stateSyncQueued||(this._stateSyncQueued=!0,queueMicrotask(()=>{this._stateSyncQueued=!1,this.isConnected&&this._syncDerivedState()}))}_focusControl(){const t=this._resolveControlElement();if(t)try{t.focus({preventScroll:!0})}catch{t.focus()}}_resolveControlElement(){if(this._controlCache&&this._controlCache.isConnected&&x(this._controlCache))return this._controlCache;const t=this.getAttribute("for");if(t){const e=document.getElementById(t);if(e instanceof HTMLElement&&x(e))return this._controlCache=e,e}const l=this.root.querySelector("slot:not([name])")?.assignedElements({flatten:!0})||[];for(const e of l){if(!(e instanceof HTMLElement))continue;if(x(e))return this._controlCache=e,e;const a=e.querySelector(I);if(a&&x(a))return this._controlCache=a,a}const o=this.querySelector(I);return o&&x(o)?(this._controlCache=o,o):null}_syncDerivedState(){const t=this.root.querySelector('slot[name="label"]'),i=this.root.querySelector('slot[name="actions"]'),l=this.root.querySelector('slot[name="description"]'),o=this.root.querySelector('slot[name="error"]'),e=(this.getAttribute("label")||"").trim(),a=(this.getAttribute("description")||"").trim(),y=(this.getAttribute("error")||"").trim(),n=!!e||A(t),d=A(i),h=!!a||A(l),b=!!y||A(o),w=n||d||h,E=n||d,c=this.root.querySelector(".meta"),p=this.root.querySelector(".label-row"),g=this.root.querySelector(".label"),v=this.root.querySelector(".actions"),u=this.root.querySelector(".description"),m=this.root.querySelector(".error");c&&(w?c.removeAttribute("hidden"):c.setAttribute("hidden","")),p&&(E?p.removeAttribute("hidden"):p.setAttribute("hidden","")),g&&(n?g.removeAttribute("hidden"):g.setAttribute("hidden","")),v&&(d?v.removeAttribute("hidden"):v.setAttribute("hidden","")),u&&(h?u.removeAttribute("hidden"):u.setAttribute("hidden","")),m&&(b?m.removeAttribute("hidden"):m.setAttribute("hidden",""));const T=t?t.assignedNodes({flatten:!0}).map(f=>f.textContent||"").join(" "):"",s=f=>f.replace(/\s+/g," ").trim(),q=f=>f?f.assignedNodes({flatten:!0}).map($=>$.textContent||"").join(" "):"",B=h?s(a||q(l)):"",R=b?s(y||q(o)):"";this._syncControlA11y(n,s(e||T),[B,R].filter(Boolean).join(" "),b)}_syncControlA11y(t,i,l,o){const e=this._resolveControlElement();if(!e)return;const a=`${this._uid}-label`,y=`${this._uid}-description`,n=`${this._uid}-error`,d=(e.getAttribute("aria-labelledby")||"").split(/\s+/).filter(s=>s&&s!==a),h=e.getRootNode(),b=d.some(s=>!!h.getElementById?.(s)),w=k(d);w.length?e.setAttribute("aria-labelledby",w.join(" ")):e.removeAttribute("aria-labelledby");const E=e.hasAttribute("aria-label")&&!e.hasAttribute(_),c=e.labels,p=(e.getAttribute("label")||"").trim().length>0,g=(e.textContent||"").trim().length>0,v=b||E||p||g||!!(c&&c.length>0);t&&i&&!v?(e.setAttribute("aria-label",i),e.setAttribute(_,"")):e.hasAttribute(_)&&(e.removeAttribute("aria-label"),e.removeAttribute(_));const u=k((e.getAttribute("aria-describedby")||"").split(/\s+/).filter(s=>s&&s!==y&&s!==n));u.length?e.setAttribute("aria-describedby",u.join(" ")):e.removeAttribute("aria-describedby");const m=e.hasAttribute("aria-description")&&!e.hasAttribute(S);l&&!m?(e.setAttribute("aria-description",l),e.setAttribute(S,"")):e.hasAttribute(S)&&(e.removeAttribute("aria-description"),e.removeAttribute(S)),this.hasAttribute("invalid")||o?e.setAttribute("aria-invalid","true"):e.removeAttribute("aria-invalid"),this.hasAttribute("required")?e.setAttribute("aria-required","true"):e.removeAttribute("aria-required")}render(){const t=this.getAttribute("label")||"",i=this.getAttribute("description")||"",l=this.getAttribute("error")||"",o=this.hasAttribute("required"),e=this.getAttribute("for")||"";this.setContent(`
|
|
374
383
|
<style>${N}</style>
|
|
375
384
|
<div class="frame" part="field">
|
|
376
385
|
<div class="meta" part="meta">
|
package/dist/field.esm.js
CHANGED
|
@@ -3,14 +3,16 @@ const N = `
|
|
|
3
3
|
:host {
|
|
4
4
|
--ui-field-gap: 8px;
|
|
5
5
|
--ui-field-label-width: 192px;
|
|
6
|
-
--ui-field-radius:
|
|
7
|
-
--ui-field-bg:
|
|
6
|
+
--ui-field-radius: calc(var(--ui-radius, 6px) + 4px);
|
|
7
|
+
--ui-field-bg: transparent;
|
|
8
|
+
--ui-field-frame-padding: 0px;
|
|
9
|
+
--ui-field-density: 1;
|
|
8
10
|
--ui-field-color: var(--ui-color-text, var(--ui-text, #0f172a));
|
|
9
11
|
--ui-field-label-color: var(--ui-color-text, var(--ui-text, #0f172a));
|
|
10
12
|
--ui-field-description-color: var(--ui-color-muted, var(--ui-muted, #526175));
|
|
11
|
-
--ui-field-error-color: var(--ui-color-danger, var(--ui-error, #c81e1e));
|
|
13
|
+
--ui-field-error-color: var(--ui-color-danger-text, var(--ui-color-danger, var(--ui-error, #c81e1e)));
|
|
12
14
|
--ui-field-border-color: color-mix(in srgb, var(--ui-color-border, #cbd5e1) 72%, transparent);
|
|
13
|
-
--ui-field-border:
|
|
15
|
+
--ui-field-border: 0;
|
|
14
16
|
--ui-field-shadow:
|
|
15
17
|
none;
|
|
16
18
|
--ui-field-focus-ring: var(--ui-color-focus-ring, var(--ui-focus-ring, #2563eb));
|
|
@@ -39,7 +41,7 @@ const N = `
|
|
|
39
41
|
border: var(--ui-field-border);
|
|
40
42
|
border-radius: var(--ui-field-radius);
|
|
41
43
|
box-shadow: var(--ui-field-shadow);
|
|
42
|
-
padding:
|
|
44
|
+
padding: calc(var(--ui-field-frame-padding) * var(--ui-field-density));
|
|
43
45
|
box-sizing: border-box;
|
|
44
46
|
transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
|
|
45
47
|
}
|
|
@@ -157,6 +159,16 @@ const N = `
|
|
|
157
159
|
--ui-field-shell-border-color: color-mix(in srgb, var(--ui-field-error-color) 56%, transparent);
|
|
158
160
|
}
|
|
159
161
|
|
|
162
|
+
/* A plain field is flat: label, control and message with no box around them. These variants draw the box. */
|
|
163
|
+
:host([variant="surface"]),
|
|
164
|
+
:host([variant="outline"]),
|
|
165
|
+
:host([variant="soft"]),
|
|
166
|
+
:host([variant="contrast"]),
|
|
167
|
+
:host([variant="elevated"]) {
|
|
168
|
+
--ui-field-border: 1px solid var(--ui-field-border-color);
|
|
169
|
+
--ui-field-frame-padding: 12px;
|
|
170
|
+
}
|
|
171
|
+
|
|
160
172
|
:host([variant="surface"]) {
|
|
161
173
|
--ui-field-bg: var(--ui-color-surface, var(--ui-surface, #ffffff));
|
|
162
174
|
--ui-field-shadow:
|
|
@@ -194,10 +206,7 @@ const N = `
|
|
|
194
206
|
--ui-field-bg: transparent;
|
|
195
207
|
--ui-field-border: 0;
|
|
196
208
|
--ui-field-shadow: none;
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
:host([variant="minimal"]) .frame {
|
|
200
|
-
padding: 0;
|
|
209
|
+
--ui-field-frame-padding: 0px;
|
|
201
210
|
}
|
|
202
211
|
|
|
203
212
|
:host([variant="elevated"]) {
|
|
@@ -224,8 +233,8 @@ const N = `
|
|
|
224
233
|
--ui-field-gap: 6px;
|
|
225
234
|
}
|
|
226
235
|
|
|
227
|
-
:host([density="compact"])
|
|
228
|
-
|
|
236
|
+
:host([density="compact"]) {
|
|
237
|
+
--ui-field-density: 0.75;
|
|
229
238
|
}
|
|
230
239
|
|
|
231
240
|
:host([density="compact"]) .label {
|
|
@@ -241,8 +250,8 @@ const N = `
|
|
|
241
250
|
--ui-field-gap: 10px;
|
|
242
251
|
}
|
|
243
252
|
|
|
244
|
-
:host([density="comfortable"])
|
|
245
|
-
|
|
253
|
+
:host([density="comfortable"]) {
|
|
254
|
+
--ui-field-density: 1.25;
|
|
246
255
|
}
|
|
247
256
|
|
|
248
257
|
:host([density="comfortable"]) .label {
|
|
@@ -481,12 +490,12 @@ class M extends $ {
|
|
|
481
490
|
return o && x(o) ? (this._controlCache = o, o) : null;
|
|
482
491
|
}
|
|
483
492
|
_syncDerivedState() {
|
|
484
|
-
const t = this.root.querySelector('slot[name="label"]'), i = this.root.querySelector('slot[name="actions"]'), l = this.root.querySelector('slot[name="description"]'), o = this.root.querySelector('slot[name="error"]'), e = (this.getAttribute("label") || "").trim(), a = (this.getAttribute("description") || "").trim(), y = (this.getAttribute("error") || "").trim(), n = !!e || A(t), d = A(i), h = !!a || A(l), b = !!y || A(o), w = n || d || h, E = n || d, c = this.root.querySelector(".meta"), p = this.root.querySelector(".label-row"), g = this.root.querySelector(".label"),
|
|
485
|
-
c && (w ? c.removeAttribute("hidden") : c.setAttribute("hidden", "")), p && (E ? p.removeAttribute("hidden") : p.setAttribute("hidden", "")), g && (n ? g.removeAttribute("hidden") : g.setAttribute("hidden", "")),
|
|
486
|
-
const
|
|
493
|
+
const t = this.root.querySelector('slot[name="label"]'), i = this.root.querySelector('slot[name="actions"]'), l = this.root.querySelector('slot[name="description"]'), o = this.root.querySelector('slot[name="error"]'), e = (this.getAttribute("label") || "").trim(), a = (this.getAttribute("description") || "").trim(), y = (this.getAttribute("error") || "").trim(), n = !!e || A(t), d = A(i), h = !!a || A(l), b = !!y || A(o), w = n || d || h, E = n || d, c = this.root.querySelector(".meta"), p = this.root.querySelector(".label-row"), g = this.root.querySelector(".label"), v = this.root.querySelector(".actions"), u = this.root.querySelector(".description"), m = this.root.querySelector(".error");
|
|
494
|
+
c && (w ? c.removeAttribute("hidden") : c.setAttribute("hidden", "")), p && (E ? p.removeAttribute("hidden") : p.setAttribute("hidden", "")), g && (n ? g.removeAttribute("hidden") : g.setAttribute("hidden", "")), v && (d ? v.removeAttribute("hidden") : v.setAttribute("hidden", "")), u && (h ? u.removeAttribute("hidden") : u.setAttribute("hidden", "")), m && (b ? m.removeAttribute("hidden") : m.setAttribute("hidden", ""));
|
|
495
|
+
const T = t ? t.assignedNodes({ flatten: !0 }).map((f) => f.textContent || "").join(" ") : "", s = (f) => f.replace(/\s+/g, " ").trim(), q = (f) => f ? f.assignedNodes({ flatten: !0 }).map((B) => B.textContent || "").join(" ") : "", I = h ? s(a || q(l)) : "", R = b ? s(y || q(o)) : "";
|
|
487
496
|
this._syncControlA11y(
|
|
488
497
|
n,
|
|
489
|
-
s(e ||
|
|
498
|
+
s(e || T),
|
|
490
499
|
[I, R].filter(Boolean).join(" "),
|
|
491
500
|
b
|
|
492
501
|
);
|
|
@@ -496,14 +505,14 @@ class M extends $ {
|
|
|
496
505
|
if (!e) return;
|
|
497
506
|
const a = `${this._uid}-label`, y = `${this._uid}-description`, n = `${this._uid}-error`, d = (e.getAttribute("aria-labelledby") || "").split(/\s+/).filter((s) => s && s !== a), h = e.getRootNode(), b = d.some((s) => !!h.getElementById?.(s)), w = k(d);
|
|
498
507
|
w.length ? e.setAttribute("aria-labelledby", w.join(" ")) : e.removeAttribute("aria-labelledby");
|
|
499
|
-
const E = e.hasAttribute("aria-label") && !e.hasAttribute(_), c = e.labels, p = (e.getAttribute("label") || "").trim().length > 0, g = (e.textContent || "").trim().length > 0,
|
|
500
|
-
t && i && !
|
|
508
|
+
const E = e.hasAttribute("aria-label") && !e.hasAttribute(_), c = e.labels, p = (e.getAttribute("label") || "").trim().length > 0, g = (e.textContent || "").trim().length > 0, v = b || E || p || g || !!(c && c.length > 0);
|
|
509
|
+
t && i && !v ? (e.setAttribute("aria-label", i), e.setAttribute(_, "")) : e.hasAttribute(_) && (e.removeAttribute("aria-label"), e.removeAttribute(_));
|
|
501
510
|
const u = k(
|
|
502
511
|
(e.getAttribute("aria-describedby") || "").split(/\s+/).filter((s) => s && s !== y && s !== n)
|
|
503
512
|
);
|
|
504
513
|
u.length ? e.setAttribute("aria-describedby", u.join(" ")) : e.removeAttribute("aria-describedby");
|
|
505
|
-
const
|
|
506
|
-
l && !
|
|
514
|
+
const m = e.hasAttribute("aria-description") && !e.hasAttribute(S);
|
|
515
|
+
l && !m ? (e.setAttribute("aria-description", l), e.setAttribute(S, "")) : e.hasAttribute(S) && (e.removeAttribute("aria-description"), e.removeAttribute(S)), this.hasAttribute("invalid") || o ? e.setAttribute("aria-invalid", "true") : e.removeAttribute("aria-invalid"), this.hasAttribute("required") ? e.setAttribute("aria-required", "true") : e.removeAttribute("aria-required");
|
|
507
516
|
}
|
|
508
517
|
render() {
|
|
509
518
|
const t = this.getAttribute("label") || "", i = this.getAttribute("description") || "", l = this.getAttribute("error") || "", o = this.hasAttribute("required"), e = this.getAttribute("for") || "";
|