@editora/ui-core 0.1.24 → 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 +339 -5
- 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/gantt-schedule.d.ts +79 -0
- package/dist/components/gantt-schedule.d.ts.map +1 -0
- 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-gantt.d.ts +186 -2
- package/dist/components/ui-gantt.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 +525 -110
- package/dist/gantt.esm.js +1882 -377
- 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/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
13
|
--ui-field-error-color: 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 {
|
|
@@ -377,13 +386,13 @@ function C(r) {
|
|
|
377
386
|
}
|
|
378
387
|
function A(r) {
|
|
379
388
|
if (!r) return !1;
|
|
380
|
-
const
|
|
381
|
-
return
|
|
389
|
+
const i = r.assignedNodes({ flatten: !0 });
|
|
390
|
+
return i.length ? i.some((t) => t.nodeType === Node.TEXT_NODE ? !!t.textContent?.trim() : t.nodeType === Node.ELEMENT_NODE) : !1;
|
|
382
391
|
}
|
|
383
392
|
function x(r) {
|
|
384
393
|
if (r.hasAttribute("disabled") || r.getAttribute("aria-disabled") === "true" || r.getAttribute("tabindex") === "-1") return !1;
|
|
385
|
-
const
|
|
386
|
-
return !(
|
|
394
|
+
const i = window.getComputedStyle(r);
|
|
395
|
+
return !(i.display === "none" || i.visibility === "hidden");
|
|
387
396
|
}
|
|
388
397
|
function D(r) {
|
|
389
398
|
return !!r.closest(
|
|
@@ -422,25 +431,25 @@ class M extends $ {
|
|
|
422
431
|
disconnectedCallback() {
|
|
423
432
|
this.root.removeEventListener("click", this._onRootClick), this.root.removeEventListener("slotchange", this._onSlotChange), super.disconnectedCallback();
|
|
424
433
|
}
|
|
425
|
-
attributeChangedCallback(
|
|
426
|
-
if (
|
|
427
|
-
if (
|
|
434
|
+
attributeChangedCallback(i, t, l) {
|
|
435
|
+
if (t !== l) {
|
|
436
|
+
if (i === "for" && this._invalidateControlCache(), i === "label-width") {
|
|
428
437
|
const o = this.getAttribute("label-width");
|
|
429
438
|
o ? this.style.setProperty("--ui-field-label-width", o) : this.style.removeProperty("--ui-field-label-width");
|
|
430
439
|
}
|
|
431
|
-
if (
|
|
440
|
+
if (i === "label" || i === "description" || i === "error" || i === "required" || i === "for") {
|
|
432
441
|
this.isConnected && this.requestRender();
|
|
433
442
|
return;
|
|
434
443
|
}
|
|
435
|
-
|
|
444
|
+
i === "invalid" && this._scheduleDerivedStateSync();
|
|
436
445
|
}
|
|
437
446
|
}
|
|
438
447
|
_onSlotChange() {
|
|
439
448
|
this._invalidateControlCache(), this._scheduleDerivedStateSync();
|
|
440
449
|
}
|
|
441
|
-
_onRootClick(
|
|
442
|
-
const
|
|
443
|
-
|
|
450
|
+
_onRootClick(i) {
|
|
451
|
+
const t = i.target;
|
|
452
|
+
t && t.closest(".label") && (D(t) || this._focusControl());
|
|
444
453
|
}
|
|
445
454
|
_invalidateControlCache() {
|
|
446
455
|
this._controlCache = null;
|
|
@@ -451,20 +460,20 @@ class M extends $ {
|
|
|
451
460
|
}));
|
|
452
461
|
}
|
|
453
462
|
_focusControl() {
|
|
454
|
-
const
|
|
455
|
-
if (
|
|
463
|
+
const i = this._resolveControlElement();
|
|
464
|
+
if (i)
|
|
456
465
|
try {
|
|
457
|
-
|
|
466
|
+
i.focus({ preventScroll: !0 });
|
|
458
467
|
} catch {
|
|
459
|
-
|
|
468
|
+
i.focus();
|
|
460
469
|
}
|
|
461
470
|
}
|
|
462
471
|
_resolveControlElement() {
|
|
463
472
|
if (this._controlCache && this._controlCache.isConnected && x(this._controlCache))
|
|
464
473
|
return this._controlCache;
|
|
465
|
-
const
|
|
466
|
-
if (
|
|
467
|
-
const e = document.getElementById(
|
|
474
|
+
const i = this.getAttribute("for");
|
|
475
|
+
if (i) {
|
|
476
|
+
const e = document.getElementById(i);
|
|
468
477
|
if (e instanceof HTMLElement && x(e))
|
|
469
478
|
return this._controlCache = e, e;
|
|
470
479
|
}
|
|
@@ -481,45 +490,45 @@ class M extends $ {
|
|
|
481
490
|
return o && x(o) ? (this._controlCache = o, o) : null;
|
|
482
491
|
}
|
|
483
492
|
_syncDerivedState() {
|
|
484
|
-
const
|
|
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 i = this.root.querySelector('slot[name="label"]'), t = 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(i), d = A(t), 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 = i ? i.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
|
);
|
|
493
502
|
}
|
|
494
|
-
_syncControlA11y(
|
|
503
|
+
_syncControlA11y(i, t, l, o) {
|
|
495
504
|
const e = this._resolveControlElement();
|
|
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
|
-
|
|
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
|
+
i && t && !v ? (e.setAttribute("aria-label", t), 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
|
-
const
|
|
518
|
+
const i = this.getAttribute("label") || "", t = this.getAttribute("description") || "", l = this.getAttribute("error") || "", o = this.hasAttribute("required"), e = this.getAttribute("for") || "";
|
|
510
519
|
this.setContent(`
|
|
511
520
|
<style>${N}</style>
|
|
512
521
|
<div class="frame" part="field">
|
|
513
522
|
<div class="meta" part="meta">
|
|
514
523
|
<div class="label-row" part="top">
|
|
515
524
|
<label class="label" id="${this._uid}-label" ${e ? `for="${C(e)}"` : ""}>
|
|
516
|
-
<slot name="label">${C(
|
|
525
|
+
<slot name="label">${C(i)}</slot>
|
|
517
526
|
${o ? '<span class="required" aria-hidden="true">*</span>' : ""}
|
|
518
527
|
</label>
|
|
519
528
|
<div class="actions" part="actions"><slot name="actions"></slot></div>
|
|
520
529
|
</div>
|
|
521
530
|
<p class="description" id="${this._uid}-description" part="description">
|
|
522
|
-
<slot name="description">${C(
|
|
531
|
+
<slot name="description">${C(t)}</slot>
|
|
523
532
|
</p>
|
|
524
533
|
</div>
|
|
525
534
|
|
|
@@ -534,8 +543,8 @@ class M extends $ {
|
|
|
534
543
|
</div>
|
|
535
544
|
`), this._invalidateControlCache(), this._scheduleDerivedStateSync();
|
|
536
545
|
}
|
|
537
|
-
shouldRenderOnAttributeChange(
|
|
538
|
-
return
|
|
546
|
+
shouldRenderOnAttributeChange(i, t, l) {
|
|
547
|
+
return i === "label" || i === "description" || i === "error" || i === "required" || i === "for";
|
|
539
548
|
}
|
|
540
549
|
}
|
|
541
550
|
typeof customElements < "u" && !customElements.get("ui-field") && customElements.define("ui-field", M);
|
package/dist/fieldset.cjs.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const S=require("./ElementBase-DxbvhLJs.js"),A=`
|
|
2
2
|
:host {
|
|
3
3
|
--ui-fieldset-gap: 10px;
|
|
4
|
-
--ui-fieldset-radius:
|
|
5
|
-
--ui-fieldset-bg:
|
|
4
|
+
--ui-fieldset-radius: calc(var(--ui-radius, 6px) + 4px);
|
|
5
|
+
--ui-fieldset-bg: transparent;
|
|
6
6
|
--ui-fieldset-color: var(--ui-color-text, var(--ui-text, #0f172a));
|
|
7
7
|
--ui-fieldset-muted: var(--ui-color-muted, var(--ui-muted, #526175));
|
|
8
8
|
--ui-fieldset-error: var(--ui-color-danger, var(--ui-error, #c81e1e));
|
|
9
|
-
--ui-fieldset-border-color: color-mix(in srgb, var(--ui-color-border, #cbd5e1) 68%, transparent);
|
|
10
|
-
--ui-fieldset-border:
|
|
9
|
+
--ui-fieldset-border-color: var(--ui-color-line-subtle, color-mix(in srgb, var(--ui-color-border, #cbd5e1) 68%, transparent));
|
|
10
|
+
--ui-fieldset-border: 0;
|
|
11
11
|
--ui-fieldset-shadow: none;
|
|
12
|
-
--ui-fieldset-padding:
|
|
12
|
+
--ui-fieldset-padding: 0px;
|
|
13
13
|
color-scheme: light dark;
|
|
14
14
|
display: block;
|
|
15
15
|
min-width: 0;
|
|
@@ -108,10 +108,17 @@
|
|
|
108
108
|
align-items: start;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
+
/* A plain fieldset is flat; these variants draw the box. */
|
|
112
|
+
:host([variant="surface"]),
|
|
113
|
+
:host([variant="outline"]),
|
|
114
|
+
:host([variant="soft"]),
|
|
115
|
+
:host([variant="contrast"]) {
|
|
116
|
+
--ui-fieldset-border: 1px solid var(--ui-fieldset-border-color);
|
|
117
|
+
--ui-fieldset-padding: 14px;
|
|
118
|
+
}
|
|
119
|
+
|
|
111
120
|
:host([variant="surface"]) {
|
|
112
|
-
--ui-fieldset-shadow:
|
|
113
|
-
0 1px 3px rgba(2, 6, 23, 0.05),
|
|
114
|
-
0 12px 26px rgba(2, 6, 23, 0.08);
|
|
121
|
+
--ui-fieldset-shadow: var(--shadow-3, 0 4px 12px rgba(2, 6, 23, 0.1));
|
|
115
122
|
}
|
|
116
123
|
|
|
117
124
|
:host([variant="outline"]) {
|
|
@@ -186,7 +193,7 @@
|
|
|
186
193
|
box-shadow: none;
|
|
187
194
|
}
|
|
188
195
|
}
|
|
189
|
-
`;function a(
|
|
196
|
+
`;function a(i){return i.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function s(i){if(!i)return!1;const e=i.assignedNodes({flatten:!0});return e.length?e.some(t=>t.nodeType===Node.TEXT_NODE?!!t.textContent?.trim():t.nodeType===Node.ELEMENT_NODE):!1}function d(i,e){return i.id||(i.id=`ui-fieldset-${e}-${Math.random().toString(36).slice(2,9)}`),i.id}function q(i){return Array.from(new Set(i.filter(Boolean)))}class m extends S.ElementBase{constructor(){super(...arguments),this._stateSyncQueued=!1,this._onSlotChange=()=>{this._updateVisibility(),this._scheduleStateSync()}}static get observedAttributes(){return["legend","description","error","required","invalid","orientation","variant","tone","density","shape","headless"]}connectedCallback(){super.connectedCallback(),this.root.addEventListener("slotchange",this._onSlotChange),this._scheduleStateSync()}disconnectedCallback(){this.root.removeEventListener("slotchange",this._onSlotChange),super.disconnectedCallback()}attributeChangedCallback(e,t,r){if(t!==r){if(e==="legend"||e==="description"||e==="error"||e==="required"){this.isConnected&&this.requestRender();return}e==="invalid"&&this._scheduleStateSync()}}render(){const e=this.getAttribute("legend")||"",t=this.getAttribute("description")||"",r=this.getAttribute("error")||"",o=this.hasAttribute("required");this.setContent(`
|
|
190
197
|
<style>${A}</style>
|
|
191
198
|
<fieldset class="frame" part="frame">
|
|
192
199
|
<div class="legend-row">
|
|
@@ -205,10 +212,10 @@
|
|
|
205
212
|
<slot></slot>
|
|
206
213
|
</div>
|
|
207
214
|
<p class="error" part="error">
|
|
208
|
-
<slot name="error">${
|
|
215
|
+
<slot name="error">${r?a(r):""}</slot>
|
|
209
216
|
</p>
|
|
210
217
|
<div class="footer" part="footer">
|
|
211
218
|
<slot name="footer"></slot>
|
|
212
219
|
</div>
|
|
213
220
|
</fieldset>
|
|
214
|
-
`),this._updateVisibility(),this._syncAria()}_scheduleStateSync(){this._stateSyncQueued||(this._stateSyncQueued=!0,queueMicrotask(()=>{this._stateSyncQueued=!1,this.isConnected&&this._syncAria()}))}_updateVisibility(){const e=this.root.querySelector('slot[name="legend"]'),t=this.root.querySelector('slot[name="description"]'),
|
|
221
|
+
`),this._updateVisibility(),this._syncAria()}_scheduleStateSync(){this._stateSyncQueued||(this._stateSyncQueued=!0,queueMicrotask(()=>{this._stateSyncQueued=!1,this.isConnected&&this._syncAria()}))}_updateVisibility(){const e=this.root.querySelector('slot[name="legend"]'),t=this.root.querySelector('slot[name="description"]'),r=this.root.querySelector('slot[name="actions"]'),o=this.root.querySelector('slot[name="error"]'),n=this.root.querySelector('slot[name="footer"]'),l=!!this.getAttribute("legend")||s(e),v=!!this.getAttribute("description")||s(t),c=s(r),y=!!this.getAttribute("error")||s(o),x=s(n),u=this.root.querySelector(".legend-row"),f=this.root.querySelector(".legend"),h=this.root.querySelector(".actions"),g=this.root.querySelector(".description"),p=this.root.querySelector(".error"),b=this.root.querySelector(".footer");u&&u.toggleAttribute("hidden",!l&&!c),f&&f.toggleAttribute("hidden",!l),h&&h.toggleAttribute("hidden",!c),g&&g.toggleAttribute("hidden",!v),p&&p.toggleAttribute("hidden",!y),b&&b.toggleAttribute("hidden",!x)}_syncAria(){const e=this.root.querySelector(".frame"),t=this.root.querySelector(".legend"),r=this.root.querySelector(".description"),o=this.root.querySelector(".error");if(!e)return;t&&!t.hasAttribute("hidden")?e.setAttribute("aria-labelledby",d(t,"legend")):e.removeAttribute("aria-labelledby");const n=q([r&&!r.hasAttribute("hidden")?d(r,"description"):"",o&&!o.hasAttribute("hidden")?d(o,"error"):""]);n.length?e.setAttribute("aria-describedby",n.join(" ")):e.removeAttribute("aria-describedby"),this.hasAttribute("invalid")||o&&!o.hasAttribute("hidden")?e.setAttribute("aria-invalid","true"):e.removeAttribute("aria-invalid")}}typeof customElements<"u"&&!customElements.get("ui-fieldset")&&customElements.define("ui-fieldset",m);exports.UIFieldset=m;
|
package/dist/fieldset.esm.js
CHANGED
|
@@ -2,15 +2,15 @@ import { E as x } from "./ElementBase-BeZT54Hj.mjs";
|
|
|
2
2
|
const S = `
|
|
3
3
|
:host {
|
|
4
4
|
--ui-fieldset-gap: 10px;
|
|
5
|
-
--ui-fieldset-radius:
|
|
6
|
-
--ui-fieldset-bg:
|
|
5
|
+
--ui-fieldset-radius: calc(var(--ui-radius, 6px) + 4px);
|
|
6
|
+
--ui-fieldset-bg: transparent;
|
|
7
7
|
--ui-fieldset-color: var(--ui-color-text, var(--ui-text, #0f172a));
|
|
8
8
|
--ui-fieldset-muted: var(--ui-color-muted, var(--ui-muted, #526175));
|
|
9
9
|
--ui-fieldset-error: var(--ui-color-danger, var(--ui-error, #c81e1e));
|
|
10
|
-
--ui-fieldset-border-color: color-mix(in srgb, var(--ui-color-border, #cbd5e1) 68%, transparent);
|
|
11
|
-
--ui-fieldset-border:
|
|
10
|
+
--ui-fieldset-border-color: var(--ui-color-line-subtle, color-mix(in srgb, var(--ui-color-border, #cbd5e1) 68%, transparent));
|
|
11
|
+
--ui-fieldset-border: 0;
|
|
12
12
|
--ui-fieldset-shadow: none;
|
|
13
|
-
--ui-fieldset-padding:
|
|
13
|
+
--ui-fieldset-padding: 0px;
|
|
14
14
|
color-scheme: light dark;
|
|
15
15
|
display: block;
|
|
16
16
|
min-width: 0;
|
|
@@ -109,10 +109,17 @@ const S = `
|
|
|
109
109
|
align-items: start;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
+
/* A plain fieldset is flat; these variants draw the box. */
|
|
113
|
+
:host([variant="surface"]),
|
|
114
|
+
:host([variant="outline"]),
|
|
115
|
+
:host([variant="soft"]),
|
|
116
|
+
:host([variant="contrast"]) {
|
|
117
|
+
--ui-fieldset-border: 1px solid var(--ui-fieldset-border-color);
|
|
118
|
+
--ui-fieldset-padding: 14px;
|
|
119
|
+
}
|
|
120
|
+
|
|
112
121
|
:host([variant="surface"]) {
|
|
113
|
-
--ui-fieldset-shadow:
|
|
114
|
-
0 1px 3px rgba(2, 6, 23, 0.05),
|
|
115
|
-
0 12px 26px rgba(2, 6, 23, 0.08);
|
|
122
|
+
--ui-fieldset-shadow: var(--shadow-3, 0 4px 12px rgba(2, 6, 23, 0.1));
|
|
116
123
|
}
|
|
117
124
|
|
|
118
125
|
:host([variant="outline"]) {
|
|
@@ -202,7 +209,7 @@ function d(r, e) {
|
|
|
202
209
|
function A(r) {
|
|
203
210
|
return Array.from(new Set(r.filter(Boolean)));
|
|
204
211
|
}
|
|
205
|
-
class
|
|
212
|
+
class w extends x {
|
|
206
213
|
constructor() {
|
|
207
214
|
super(...arguments), this._stateSyncQueued = !1, this._onSlotChange = () => {
|
|
208
215
|
this._updateVisibility(), this._scheduleStateSync();
|
|
@@ -273,8 +280,8 @@ class q extends x {
|
|
|
273
280
|
}));
|
|
274
281
|
}
|
|
275
282
|
_updateVisibility() {
|
|
276
|
-
const e = this.root.querySelector('slot[name="legend"]'), t = this.root.querySelector('slot[name="description"]'), i = this.root.querySelector('slot[name="actions"]'), o = this.root.querySelector('slot[name="error"]'), n = this.root.querySelector('slot[name="footer"]'), l = !!this.getAttribute("legend") || s(e), m = !!this.getAttribute("description") || s(t), c = s(i), v = !!this.getAttribute("error") || s(o), y = s(n), u = this.root.querySelector(".legend-row"), f = this.root.querySelector(".legend"), h = this.root.querySelector(".actions"),
|
|
277
|
-
u && u.toggleAttribute("hidden", !l && !c), f && f.toggleAttribute("hidden", !l), h && h.toggleAttribute("hidden", !c),
|
|
283
|
+
const e = this.root.querySelector('slot[name="legend"]'), t = this.root.querySelector('slot[name="description"]'), i = this.root.querySelector('slot[name="actions"]'), o = this.root.querySelector('slot[name="error"]'), n = this.root.querySelector('slot[name="footer"]'), l = !!this.getAttribute("legend") || s(e), m = !!this.getAttribute("description") || s(t), c = s(i), v = !!this.getAttribute("error") || s(o), y = s(n), u = this.root.querySelector(".legend-row"), f = this.root.querySelector(".legend"), h = this.root.querySelector(".actions"), p = this.root.querySelector(".description"), g = this.root.querySelector(".error"), b = this.root.querySelector(".footer");
|
|
284
|
+
u && u.toggleAttribute("hidden", !l && !c), f && f.toggleAttribute("hidden", !l), h && h.toggleAttribute("hidden", !c), p && p.toggleAttribute("hidden", !m), g && g.toggleAttribute("hidden", !v), b && b.toggleAttribute("hidden", !y);
|
|
278
285
|
}
|
|
279
286
|
_syncAria() {
|
|
280
287
|
const e = this.root.querySelector(".frame"), t = this.root.querySelector(".legend"), i = this.root.querySelector(".description"), o = this.root.querySelector(".error");
|
|
@@ -287,7 +294,7 @@ class q extends x {
|
|
|
287
294
|
n.length ? e.setAttribute("aria-describedby", n.join(" ")) : e.removeAttribute("aria-describedby"), this.hasAttribute("invalid") || o && !o.hasAttribute("hidden") ? e.setAttribute("aria-invalid", "true") : e.removeAttribute("aria-invalid");
|
|
288
295
|
}
|
|
289
296
|
}
|
|
290
|
-
typeof customElements < "u" && !customElements.get("ui-fieldset") && customElements.define("ui-fieldset",
|
|
297
|
+
typeof customElements < "u" && !customElements.get("ui-fieldset") && customElements.define("ui-fieldset", w);
|
|
291
298
|
export {
|
|
292
|
-
|
|
299
|
+
w as UIFieldset
|
|
293
300
|
};
|