@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/tags-input.esm.js
CHANGED
|
@@ -3,9 +3,9 @@ import { s as A, a as S } from "./control-name-Bpj7F34X.mjs";
|
|
|
3
3
|
const k = `
|
|
4
4
|
:host {
|
|
5
5
|
--ui-tags-input-padding: 10px 12px;
|
|
6
|
-
--ui-tags-input-border-color: color-
|
|
6
|
+
--ui-tags-input-border-color: var(--ui-color-line, var(--ui-color-border, #cbd5e1));
|
|
7
7
|
--ui-tags-input-border: 1px solid var(--ui-tags-input-border-color);
|
|
8
|
-
--ui-tags-input-radius: var(--ui-radius,
|
|
8
|
+
--ui-tags-input-radius: var(--ui-control-radius-2, var(--ui-radius, 6px));
|
|
9
9
|
--ui-tags-input-bg: var(--ui-color-surface, #ffffff);
|
|
10
10
|
--ui-tags-input-text: var(--ui-color-text, #0f172a);
|
|
11
11
|
--ui-tags-input-muted: var(--ui-color-muted, #526175);
|
|
@@ -14,7 +14,8 @@ const k = `
|
|
|
14
14
|
--ui-tags-input-chip-bg: color-mix(in srgb, var(--ui-color-primary, #2563eb) 10%, transparent);
|
|
15
15
|
--ui-tags-input-chip-text: color-mix(in srgb, var(--ui-color-primary, #2563eb) 82%, #0f172a 18%);
|
|
16
16
|
--ui-tags-input-chip-remove-bg: color-mix(in srgb, currentColor 8%, transparent);
|
|
17
|
-
--ui-tags-input-min-height:
|
|
17
|
+
--ui-tags-input-min-height: var(--ui-control-height-2, 32px);
|
|
18
|
+
--ui-tags-input-font-size: var(--ui-control-font-size-2, 14px);
|
|
18
19
|
display: block;
|
|
19
20
|
inline-size: 100%;
|
|
20
21
|
max-inline-size: 100%;
|
|
@@ -24,6 +25,26 @@ const k = `
|
|
|
24
25
|
color-scheme: light dark;
|
|
25
26
|
}
|
|
26
27
|
|
|
28
|
+
:host([size="sm"]),
|
|
29
|
+
:host([size="1"]) {
|
|
30
|
+
--ui-tags-input-min-height: var(--ui-control-height-1, 24px);
|
|
31
|
+
--ui-tags-input-font-size: var(--ui-control-font-size-1, 12px);
|
|
32
|
+
--ui-tags-input-radius: var(--ui-control-radius-1, var(--ui-radius, 6px));
|
|
33
|
+
--ui-tags-input-pad-y: 0px;
|
|
34
|
+
--ui-tags-input-pad-x: calc(var(--ui-control-padding-inline-1, 8px) - 1px);
|
|
35
|
+
--ui-tags-input-chip-pad-y: 0px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
:host([size="lg"]),
|
|
39
|
+
:host([size="3"]) {
|
|
40
|
+
--ui-tags-input-min-height: var(--ui-control-height-3, 40px);
|
|
41
|
+
--ui-tags-input-font-size: var(--ui-control-font-size-3, 16px);
|
|
42
|
+
--ui-tags-input-radius: var(--ui-control-radius-3, var(--ui-radius, 6px));
|
|
43
|
+
--ui-tags-input-pad-y: 5px;
|
|
44
|
+
--ui-tags-input-pad-x: calc(var(--ui-control-padding-inline-3, 16px) - 1px);
|
|
45
|
+
--ui-tags-input-chip-pad-y: 4px;
|
|
46
|
+
}
|
|
47
|
+
|
|
27
48
|
.root {
|
|
28
49
|
display: grid;
|
|
29
50
|
gap: 8px;
|
|
@@ -77,7 +98,7 @@ const k = `
|
|
|
77
98
|
gap: 8px;
|
|
78
99
|
min-block-size: var(--ui-tags-input-min-height);
|
|
79
100
|
box-sizing: border-box;
|
|
80
|
-
padding:
|
|
101
|
+
padding: var(--ui-tags-input-pad-y, 3px) var(--ui-tags-input-pad-x, calc(var(--ui-control-padding-inline-2, 12px) - 1px));
|
|
81
102
|
border: var(--ui-tags-input-border);
|
|
82
103
|
border-radius: var(--ui-tags-input-radius);
|
|
83
104
|
background: var(--ui-tags-input-bg);
|
|
@@ -85,13 +106,18 @@ const k = `
|
|
|
85
106
|
}
|
|
86
107
|
|
|
87
108
|
.shell[data-focused="true"] {
|
|
88
|
-
border-color:
|
|
89
|
-
|
|
109
|
+
border-color: var(--ui-ring-color, var(--ui-tags-input-focus));
|
|
110
|
+
outline: var(--ui-ring-width, 2px) solid var(--ui-ring-color, var(--ui-tags-input-focus));
|
|
111
|
+
outline-offset: -1px;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.shell:hover:not([data-focused="true"]) {
|
|
115
|
+
border-color: var(--ui-color-line-strong, var(--ui-tags-input-border-color));
|
|
90
116
|
}
|
|
91
117
|
|
|
92
118
|
.shell[data-invalid="true"] {
|
|
93
119
|
border-color: color-mix(in srgb, var(--ui-tags-input-danger) 62%, transparent);
|
|
94
|
-
box-shadow: 0 0 0
|
|
120
|
+
box-shadow: 0 0 0 1px var(--ui-tags-input-danger);
|
|
95
121
|
}
|
|
96
122
|
|
|
97
123
|
.chips {
|
|
@@ -104,7 +130,7 @@ const k = `
|
|
|
104
130
|
gap: 6px;
|
|
105
131
|
min-inline-size: 0;
|
|
106
132
|
max-inline-size: 100%;
|
|
107
|
-
padding:
|
|
133
|
+
padding: var(--ui-tags-input-chip-pad-y, 2px) 4px var(--ui-tags-input-chip-pad-y, 2px) 10px;
|
|
108
134
|
border-radius: 999px;
|
|
109
135
|
background: var(--ui-tags-input-chip-bg);
|
|
110
136
|
color: var(--ui-tags-input-chip-text);
|
|
@@ -144,13 +170,13 @@ const k = `
|
|
|
144
170
|
background: transparent;
|
|
145
171
|
color: inherit;
|
|
146
172
|
outline: none;
|
|
147
|
-
font: 500
|
|
148
|
-
padding:
|
|
173
|
+
font: 500 var(--ui-tags-input-font-size)/1.4 "Inter", "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
174
|
+
padding: 2px 2px;
|
|
149
175
|
margin: 0;
|
|
150
176
|
}
|
|
151
177
|
|
|
152
178
|
.input::placeholder {
|
|
153
|
-
color: color-mix(in srgb, var(--ui-tags-input-text)
|
|
179
|
+
color: var(--ui-color-placeholder, color-mix(in srgb, var(--ui-tags-input-text) 62%, transparent));
|
|
154
180
|
}
|
|
155
181
|
|
|
156
182
|
.assist {
|
|
@@ -184,7 +210,7 @@ const k = `
|
|
|
184
210
|
pointer-events: none;
|
|
185
211
|
}
|
|
186
212
|
`;
|
|
187
|
-
function
|
|
213
|
+
function m(r, t) {
|
|
188
214
|
return r.length === t.length && r.every((i, e) => i === t[e]);
|
|
189
215
|
}
|
|
190
216
|
function d(r) {
|
|
@@ -200,17 +226,17 @@ function d(r) {
|
|
|
200
226
|
}
|
|
201
227
|
return t.split(",").map((i) => i.trim()).filter(Boolean);
|
|
202
228
|
}
|
|
203
|
-
function
|
|
229
|
+
function z(r) {
|
|
204
230
|
return r.length ? r.some((t) => t.includes(",") || t.includes(`
|
|
205
231
|
`)) ? JSON.stringify(r) : r.join(", ") : "";
|
|
206
232
|
}
|
|
207
|
-
function
|
|
233
|
+
function p(r) {
|
|
208
234
|
return r.replace(/\s+/g, " ").trim();
|
|
209
235
|
}
|
|
210
|
-
let
|
|
211
|
-
class
|
|
236
|
+
let C = 0;
|
|
237
|
+
class T extends E {
|
|
212
238
|
constructor() {
|
|
213
|
-
super(), this._tags = [], this._draft = "", this._suppressValueAttr = !1, this._formUnregister = null, this._rootEl = null, this._shellEl = null, this._chipsEl = null, this._inputEl = null, this._uid = `ui-tags-input-${++
|
|
239
|
+
super(), this._tags = [], this._draft = "", this._suppressValueAttr = !1, this._formUnregister = null, this._rootEl = null, this._shellEl = null, this._chipsEl = null, this._inputEl = null, this._uid = `ui-tags-input-${++C}`, this._labelEl = null, this._descriptionEl = null, this._errorEl = null, this._assistEl = null, this._counterEl = null, this._focused = !1, this._onInput = this._onInput.bind(this), this._onKeyDown = this._onKeyDown.bind(this), this._onFocusIn = this._onFocusIn.bind(this), this._onFocusOut = this._onFocusOut.bind(this), this._onPaste = this._onPaste.bind(this), this._onShellClick = this._onShellClick.bind(this), this._onChipClick = this._onChipClick.bind(this);
|
|
214
240
|
}
|
|
215
241
|
static get observedAttributes() {
|
|
216
242
|
return [
|
|
@@ -234,7 +260,7 @@ class U extends E {
|
|
|
234
260
|
return [...this._tags];
|
|
235
261
|
}
|
|
236
262
|
set value(t) {
|
|
237
|
-
const i = Array.isArray(t) ? t.map((e) =>
|
|
263
|
+
const i = Array.isArray(t) ? t.map((e) => p(String(e))).filter(Boolean) : d(String(t ?? ""));
|
|
238
264
|
this._applyTags(i, "api");
|
|
239
265
|
}
|
|
240
266
|
addTag(t) {
|
|
@@ -265,7 +291,7 @@ class U extends E {
|
|
|
265
291
|
if (i !== e) {
|
|
266
292
|
if (t === "name" && this.isConnected && this._registerWithForm(), t === "value" && !this._suppressValueAttr) {
|
|
267
293
|
const s = d(e);
|
|
268
|
-
|
|
294
|
+
m(s, this._tags) || (this._tags = s);
|
|
269
295
|
}
|
|
270
296
|
this._rootEl && this._syncUi();
|
|
271
297
|
}
|
|
@@ -312,7 +338,7 @@ class U extends E {
|
|
|
312
338
|
this.dispatchEvent(new CustomEvent(t, { detail: i, bubbles: !0, composed: !0 }));
|
|
313
339
|
}
|
|
314
340
|
_setValueAttr(t) {
|
|
315
|
-
const i =
|
|
341
|
+
const i = z(t);
|
|
316
342
|
this._suppressValueAttr = !0;
|
|
317
343
|
try {
|
|
318
344
|
i ? this.getAttribute("value") !== i && this.setAttribute("value", i) : this.removeAttribute("value");
|
|
@@ -321,29 +347,29 @@ class U extends E {
|
|
|
321
347
|
}
|
|
322
348
|
}
|
|
323
349
|
_applyTags(t, i) {
|
|
324
|
-
const e = t.map((l) =>
|
|
325
|
-
if (
|
|
350
|
+
const e = t.map((l) => p(l)).filter(Boolean), s = this._allowDuplicates() ? e : e.filter((l, o) => e.indexOf(l) === o), a = this._maxTags() != null ? s.slice(0, this._maxTags()) : s;
|
|
351
|
+
if (m(a, this._tags))
|
|
326
352
|
return this._syncUi(), !1;
|
|
327
|
-
const
|
|
328
|
-
return this._tags = [...
|
|
353
|
+
const n = [...this._tags];
|
|
354
|
+
return this._tags = [...a], this._setValueAttr(this._tags), this._syncUi(), this._emit("change", { value: [...this._tags], previousValue: n, source: i }), !0;
|
|
329
355
|
}
|
|
330
356
|
_addTag(t, i) {
|
|
331
357
|
if (this._disabled() || this._readOnly()) return !1;
|
|
332
|
-
const e =
|
|
358
|
+
const e = p(t);
|
|
333
359
|
if (!e) return !1;
|
|
334
360
|
if (!this._allowDuplicates() && this._tags.includes(e))
|
|
335
361
|
return this._syncUi("Duplicate tag"), !1;
|
|
336
362
|
const s = this._maxTags();
|
|
337
363
|
if (s != null && this._tags.length >= s)
|
|
338
364
|
return this._syncUi(`Maximum ${s} tags`), !1;
|
|
339
|
-
const
|
|
340
|
-
return
|
|
365
|
+
const a = this._applyTags([...this._tags, e], i);
|
|
366
|
+
return a && this._emit("tag-add", { tag: e, value: [...this._tags], source: i }), a;
|
|
341
367
|
}
|
|
342
368
|
_removeTagAt(t, i) {
|
|
343
369
|
if (this._disabled() || this._readOnly()) return;
|
|
344
370
|
const e = this._tags[t];
|
|
345
371
|
if (!e) return;
|
|
346
|
-
const s = this._tags.filter((
|
|
372
|
+
const s = this._tags.filter((n, l) => l !== t);
|
|
347
373
|
this._applyTags(s, i) && this._emit("tag-remove", { tag: e, index: t, value: [...this._tags], source: i });
|
|
348
374
|
}
|
|
349
375
|
_commitDraft(t) {
|
|
@@ -352,35 +378,35 @@ class U extends E {
|
|
|
352
378
|
}
|
|
353
379
|
_syncUi(t) {
|
|
354
380
|
if (!this._shellEl || !this._chipsEl || !this._inputEl || !this._labelEl || !this._descriptionEl || !this._errorEl || !this._assistEl || !this._counterEl) return;
|
|
355
|
-
const i = (this.getAttribute("label") || "").trim(), e = (this.getAttribute("description") || "").trim(), s = (this.getAttribute("data-error") || "").trim(),
|
|
356
|
-
this._labelEl.hidden = !i, this._labelEl.querySelector(".label-text").textContent = i, this._labelEl.querySelector(".required").hidden = !
|
|
357
|
-
const y =
|
|
358
|
-
this._inputEl.setAttribute("aria-disabled", y ? "true" : "false"), this._chipsEl.replaceChildren(...this._tags.map((
|
|
381
|
+
const i = (this.getAttribute("label") || "").trim(), e = (this.getAttribute("description") || "").trim(), s = (this.getAttribute("data-error") || "").trim(), a = this.hasAttribute("required"), n = this._disabled(), l = this._readOnly(), o = this._maxTags(), b = this.hasAttribute("counter") || o != null, v = !!s || !!t || a && this._tags.length === 0 && this.hasAttribute("invalid");
|
|
382
|
+
this._labelEl.hidden = !i, this._labelEl.querySelector(".label-text").textContent = i, this._labelEl.querySelector(".required").hidden = !a, this._descriptionEl.hidden = !e, this._descriptionEl.textContent = e, this.root.querySelector(".meta").hidden = !i && !e, A(this._inputEl, this, i ? `${this._uid}-label` : null), this._shellEl.setAttribute("data-focused", this._focused ? "true" : "false"), this._shellEl.setAttribute("data-invalid", v ? "true" : "false"), this._inputEl.disabled = n, this._inputEl.readOnly = l, this._inputEl.placeholder = this._tags.length === 0 ? this.getAttribute("placeholder") || "Add tags" : "", this._inputEl.value = this._draft;
|
|
383
|
+
const y = n || o != null && this._tags.length >= o;
|
|
384
|
+
this._inputEl.setAttribute("aria-disabled", y ? "true" : "false"), this._chipsEl.replaceChildren(...this._tags.map((f, x) => {
|
|
359
385
|
const h = document.createElement("span");
|
|
360
386
|
h.className = "chip", h.setAttribute("part", "chip");
|
|
361
387
|
const _ = document.createElement("span");
|
|
362
|
-
_.className = "chip-label", _.textContent =
|
|
388
|
+
_.className = "chip-label", _.textContent = f;
|
|
363
389
|
const u = document.createElement("button");
|
|
364
|
-
return u.type = "button", u.className = "chip-remove", u.setAttribute("data-index", String(x)), u.setAttribute("aria-label", `Remove ${
|
|
390
|
+
return u.type = "button", u.className = "chip-remove", u.setAttribute("data-index", String(x)), u.setAttribute("aria-label", `Remove ${f}`), u.textContent = "×", u.disabled = n || l, h.append(_, u), h;
|
|
365
391
|
}));
|
|
366
|
-
const
|
|
367
|
-
this._errorEl.hidden = !
|
|
392
|
+
const c = t || s;
|
|
393
|
+
this._errorEl.hidden = !c, this._errorEl.textContent = c;
|
|
368
394
|
const g = [];
|
|
369
|
-
e && g.push(`${this._uid}-description`),
|
|
395
|
+
e && g.push(`${this._uid}-description`), c && g.push(`${this._uid}-error`), S(this._inputEl, this, this._uid, g), this._assistEl.hidden = !b, this._counterEl.textContent = o != null ? `${this._tags.length}/${o}` : String(this._tags.length);
|
|
370
396
|
}
|
|
371
397
|
_registerWithForm() {
|
|
372
398
|
this._formUnregister && (this._formUnregister(), this._formUnregister = null);
|
|
373
399
|
try {
|
|
374
|
-
const s = this.getRootNode().host?.closest?.("ui-form") || null || this.closest("ui-form"),
|
|
375
|
-
s && typeof s.registerField == "function" &&
|
|
376
|
-
name:
|
|
400
|
+
const s = this.getRootNode().host?.closest?.("ui-form") || null || this.closest("ui-form"), a = this.getAttribute("name");
|
|
401
|
+
s && typeof s.registerField == "function" && a && (this._formUnregister = s.registerField(a, {
|
|
402
|
+
name: a,
|
|
377
403
|
getValue: () => [...this._tags],
|
|
378
|
-
setValue: (
|
|
379
|
-
Array.isArray(
|
|
404
|
+
setValue: (n) => {
|
|
405
|
+
Array.isArray(n) ? this._applyTags(n.map((l) => String(l)), "form") : this._applyTags(d(String(n ?? "")), "form");
|
|
380
406
|
},
|
|
381
407
|
validate: async () => this.hasAttribute("required") && this._tags.length === 0 ? { valid: !1, message: "At least one tag is required" } : { valid: !0 },
|
|
382
|
-
setError: (
|
|
383
|
-
|
|
408
|
+
setError: (n) => {
|
|
409
|
+
n ? this.setAttribute("data-error", n) : this.removeAttribute("data-error"), this._syncUi();
|
|
384
410
|
}
|
|
385
411
|
}));
|
|
386
412
|
} catch {
|
|
@@ -401,7 +427,7 @@ class U extends E {
|
|
|
401
427
|
const i = t.clipboardData?.getData("text") || "";
|
|
402
428
|
if (!/[,\n]/.test(i)) return;
|
|
403
429
|
t.preventDefault();
|
|
404
|
-
const e = i.split(/[,\n]+/).map(
|
|
430
|
+
const e = i.split(/[,\n]+/).map(p).filter(Boolean);
|
|
405
431
|
e.length && (this._draft = "", this._inputEl && (this._inputEl.value = ""), this._applyTags([...this._tags, ...e], "paste"));
|
|
406
432
|
}
|
|
407
433
|
_onFocusIn() {
|
|
@@ -420,7 +446,7 @@ class U extends E {
|
|
|
420
446
|
Number.isFinite(s) && this._removeTagAt(s, "remove-button");
|
|
421
447
|
}
|
|
422
448
|
}
|
|
423
|
-
typeof customElements < "u" && !customElements.get("ui-tags-input") && customElements.define("ui-tags-input",
|
|
449
|
+
typeof customElements < "u" && !customElements.get("ui-tags-input") && customElements.define("ui-tags-input", T);
|
|
424
450
|
export {
|
|
425
|
-
|
|
451
|
+
T as UITagsInput
|
|
426
452
|
};
|
package/dist/textarea.cjs.js
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const A=require("./ElementBase-DxbvhLJs.js"),g=require("./control-name-BmoI1m3a.js"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const A=require("./ElementBase-DxbvhLJs.js"),g=require("./control-name-BmoI1m3a.js"),w=`
|
|
2
2
|
<svg viewBox="0 0 20 20" aria-hidden="true" focusable="false">
|
|
3
3
|
<path d="m6 6 8 8M14 6l-8 8" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>
|
|
4
4
|
</svg>
|
|
5
|
-
`,
|
|
5
|
+
`,z=`
|
|
6
6
|
:host {
|
|
7
|
-
--ui-textarea-bg: var(--ui-color-surface, #ffffff);
|
|
7
|
+
--ui-textarea-bg: var(--base-input-bg, var(--color-panel-solid, var(--ui-color-surface, #ffffff)));
|
|
8
8
|
--ui-textarea-text: var(--ui-color-text, #0f172a);
|
|
9
9
|
--ui-textarea-muted: var(--ui-color-muted, #526175);
|
|
10
|
-
--ui-textarea-border: color-
|
|
10
|
+
--ui-textarea-border: var(--ui-color-line, var(--ui-color-border, #cbd5e1));
|
|
11
11
|
--ui-textarea-focus: var(--ui-color-focus-ring, #2563eb);
|
|
12
12
|
--ui-textarea-accent: var(--ui-color-primary, #2563eb);
|
|
13
13
|
--ui-textarea-danger: var(--ui-color-danger, #dc2626);
|
|
14
14
|
--ui-textarea-success: var(--ui-color-success, #15803d);
|
|
15
|
-
--ui-textarea-radius:
|
|
16
|
-
--ui-textarea-padding-x: 12px;
|
|
17
|
-
--ui-textarea-padding-y:
|
|
15
|
+
--ui-textarea-radius: var(--ui-control-radius-2, var(--ui-radius, 6px));
|
|
16
|
+
--ui-textarea-padding-x: calc(var(--ui-control-padding-inline-2, 12px) - 1px);
|
|
17
|
+
--ui-textarea-padding-y: 6px;
|
|
18
|
+
--ui-textarea-font-size: var(--ui-control-font-size-2, 14px);
|
|
18
19
|
--ui-textarea-min-height: 110px;
|
|
19
20
|
--ui-textarea-shadow: none;
|
|
20
21
|
|
|
@@ -69,10 +70,14 @@
|
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
.field:focus-within {
|
|
72
|
-
border-color: color
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
border-color: var(--ui-ring-color, var(--ui-textarea-focus));
|
|
74
|
+
outline: var(--ui-ring-width, 2px) solid var(--ui-ring-color, var(--ui-textarea-focus));
|
|
75
|
+
outline-offset: -1px;
|
|
76
|
+
box-shadow: var(--ui-textarea-shadow);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.field:hover:not(:focus-within) {
|
|
80
|
+
border-color: var(--ui-color-line-strong, var(--ui-textarea-border));
|
|
76
81
|
}
|
|
77
82
|
|
|
78
83
|
textarea {
|
|
@@ -85,13 +90,13 @@
|
|
|
85
90
|
color: var(--ui-textarea-text);
|
|
86
91
|
resize: vertical;
|
|
87
92
|
outline: none;
|
|
88
|
-
font: 500
|
|
93
|
+
font: 500 var(--ui-textarea-font-size)/1.45 "Inter", "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
89
94
|
padding: var(--ui-textarea-padding-y) var(--ui-textarea-padding-x);
|
|
90
95
|
border-radius: inherit;
|
|
91
96
|
}
|
|
92
97
|
|
|
93
98
|
textarea::placeholder {
|
|
94
|
-
color: color-mix(in srgb, var(--ui-textarea-muted)
|
|
99
|
+
color: var(--ui-color-placeholder, color-mix(in srgb, var(--ui-textarea-muted) 90%, transparent));
|
|
95
100
|
}
|
|
96
101
|
|
|
97
102
|
textarea[readonly] {
|
|
@@ -168,26 +173,20 @@
|
|
|
168
173
|
|
|
169
174
|
:host([size="sm"]),
|
|
170
175
|
:host([size="1"]) {
|
|
171
|
-
--ui-textarea-padding-x:
|
|
172
|
-
--ui-textarea-padding-y:
|
|
176
|
+
--ui-textarea-padding-x: calc(var(--ui-control-padding-inline-1, 8px) - 1px);
|
|
177
|
+
--ui-textarea-padding-y: 4px;
|
|
173
178
|
--ui-textarea-min-height: 84px;
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
:host([size="sm"]) textarea,
|
|
177
|
-
:host([size="1"]) textarea {
|
|
178
|
-
font-size: 13px;
|
|
179
|
+
--ui-textarea-font-size: var(--ui-control-font-size-1, 12px);
|
|
180
|
+
--ui-textarea-radius: var(--ui-control-radius-1, var(--ui-radius, 6px));
|
|
179
181
|
}
|
|
180
182
|
|
|
181
183
|
:host([size="lg"]),
|
|
182
184
|
:host([size="3"]) {
|
|
183
|
-
--ui-textarea-padding-x:
|
|
184
|
-
--ui-textarea-padding-y:
|
|
185
|
+
--ui-textarea-padding-x: calc(var(--ui-control-padding-inline-3, 16px) - 1px);
|
|
186
|
+
--ui-textarea-padding-y: 8px;
|
|
185
187
|
--ui-textarea-min-height: 140px;
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
:host([size="lg"]) textarea,
|
|
189
|
-
:host([size="3"]) textarea {
|
|
190
|
-
font-size: 15px;
|
|
188
|
+
--ui-textarea-font-size: var(--ui-control-font-size-3, 16px);
|
|
189
|
+
--ui-textarea-radius: var(--ui-control-radius-3, var(--ui-radius, 6px));
|
|
191
190
|
}
|
|
192
191
|
|
|
193
192
|
:host([density="compact"]) {
|
|
@@ -242,7 +241,7 @@
|
|
|
242
241
|
|
|
243
242
|
:host([validation="error"]) .field {
|
|
244
243
|
border-color: color-mix(in srgb, var(--ui-textarea-danger) 74%, transparent);
|
|
245
|
-
box-shadow: 0 0 0
|
|
244
|
+
box-shadow: 0 0 0 1px var(--ui-textarea-danger);
|
|
246
245
|
}
|
|
247
246
|
|
|
248
247
|
:host([validation="success"]) .field {
|
|
@@ -308,17 +307,17 @@
|
|
|
308
307
|
color: CanvasText;
|
|
309
308
|
}
|
|
310
309
|
}
|
|
311
|
-
`;function x(
|
|
312
|
-
<style>${
|
|
310
|
+
`;function x(a){return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function b(a,t){const e=Number(a);return Number.isFinite(e)?e:t}const C=2147483647;function d(a){if(!a)return null;const t=Number(a);return!Number.isFinite(t)||t<0||t>C?null:Math.trunc(t)}class v extends A.ElementBase{constructor(){super(),this._uid=`ui-textarea-${Math.random().toString(36).slice(2,9)}`,this._textarea=null,this._clearBtn=null,this._countEl=null,this._debounceTimer=null,this._formUnregister=null,this._onInput=this._onInput.bind(this),this._onChange=this._onChange.bind(this),this._onClear=this._onClear.bind(this)}static get observedAttributes(){return["value","placeholder","disabled","clearable","size","validation","debounce","maxlength","minlength","rows","readonly","autofocus","resize","name","required","variant","color","radius","label","aria-label","aria-description","aria-describedby","description","autosize","max-rows","show-count","density","tone","headless","data-error"]}connectedCallback(){super.connectedCallback(),this._tryRegisterWithForm()}disconnectedCallback(){this._detachListeners(),this._debounceTimer&&(clearTimeout(this._debounceTimer),this._debounceTimer=null),this._formUnregister&&(this._formUnregister(),this._formUnregister=null),super.disconnectedCallback()}attributeChangedCallback(t,e,i){if(e===i)return;if(t==="name"&&this._tryRegisterWithForm(),t==="value"&&this._textarea){const r=i||"";this._textarea.value!==r&&(this._textarea.value=r),this._syncDynamicUi(),this._applyAutosize();return}if(new Set(["placeholder","disabled","maxlength","minlength","rows","readonly","required","resize","name","validation","show-count","clearable","autosize","max-rows","variant","size","density","tone","headless","color","radius","autofocus","aria-label","aria-description","aria-describedby"]).has(t)){this._syncControlAttrs(),this._syncDynamicUi(),this._applyAutosize(),t==="autofocus"&&this.hasAttribute("autofocus")&&queueMicrotask(()=>{this._textarea?.focus()});return}this.isConnected&&this.requestRender()}get value(){return this.getAttribute("value")||""}set value(t){this.setAttribute("value",t||"")}_tryRegisterWithForm(){try{const t=this.closest?.("ui-form"),e=this.getAttribute("name");if(!t||typeof t.registerField!="function"||!e)return;this._formUnregister=t.registerField(e,{name:e,getValue:()=>this.value,setValue:i=>{this.value=i},validate:async()=>this._textarea?{valid:this._textarea.checkValidity(),message:this._textarea.validationMessage||void 0}:{valid:!0},setError:i=>{i?(this.setAttribute("validation","error"),this.setAttribute("data-error",i)):(this.removeAttribute("validation"),this.removeAttribute("data-error"))}})}catch{}}_detachListeners(){this._textarea&&(this._textarea.removeEventListener("input",this._onInput),this._textarea.removeEventListener("change",this._onChange)),this._clearBtn&&this._clearBtn.removeEventListener("click",this._onClear),this._clearBtn=null}_syncControlAttrs(){if(!this._textarea)return;const t=this.getAttribute("placeholder")||"",e=d(this.getAttribute("maxlength")),i=d(this.getAttribute("minlength")),s=b(this.getAttribute("rows"),4),r=this.hasAttribute("disabled"),l=this.hasAttribute("readonly"),o=this.hasAttribute("required"),h=this.getAttribute("name")||"",u=this.getAttribute("resize")||"vertical",f=this.getAttribute("validation"),p=this.getAttribute("color"),n=this.getAttribute("radius");this._textarea.placeholder=t,this._textarea.disabled=r,this._textarea.readOnly=l,this._textarea.required=o,this._textarea.rows=Math.max(1,s),this._textarea.name=h,this._textarea.style.resize=u,e!==null?this._textarea.maxLength=e:this._textarea.removeAttribute("maxlength"),i!==null?this._textarea.minLength=i:this._textarea.removeAttribute("minlength"),f==="error"?this._textarea.setAttribute("aria-invalid","true"):this._textarea.removeAttribute("aria-invalid"),p?this.style.setProperty("--ui-textarea-accent",p):this.style.removeProperty("--ui-textarea-accent"),n&&n!=="none"&&n!=="large"&&n!=="full"?this.style.setProperty("--ui-textarea-radius",n):this.style.removeProperty("--ui-textarea-radius");const c=[],m=!!(this.getAttribute("description")||this.querySelector('[slot="description"]')),_=!!(this.getAttribute("data-error")||this.querySelector('[slot="error"]'));m&&c.push(`${this._uid}-description`),_&&c.push(`${this._uid}-error`),(this.hasAttribute("show-count")||d(this.getAttribute("maxlength"))!==null)&&c.push(`${this._uid}-count`);const y=!!(this.getAttribute("label")||this.querySelector('[slot="label"]'));g.syncControlName(this._textarea,this,y?`${this._uid}-label`:null),g.syncControlDescription(this._textarea,this,this._uid,c)}_syncDynamicUi(){const t=this._textarea?.value||this.getAttribute("value")||"",e=d(this.getAttribute("maxlength")),i=this.hasAttribute("clearable");this._clearBtn&&(i&&t&&!this.hasAttribute("disabled")&&!this.hasAttribute("readonly")?this._clearBtn.removeAttribute("hidden"):this._clearBtn.setAttribute("hidden","")),this._countEl&&(this.hasAttribute("show-count")||e!==null?(this._countEl.removeAttribute("hidden"),e!==null?this._countEl.textContent=`${t.length} / ${e}`:this._countEl.textContent=`${t.length}`):this._countEl.setAttribute("hidden",""))}_applyAutosize(){if(!this._textarea)return;if(!this.hasAttribute("autosize")){this._textarea.style.height="",this._textarea.style.overflowY="";return}this._textarea.style.height="auto";const t=this._textarea.scrollHeight,e=b(this.getAttribute("max-rows"),0);if(e>0){const i=getComputedStyle(this._textarea),s=parseFloat(i.lineHeight||"20")||20,r=parseFloat(i.borderTopWidth||"0")||0,l=parseFloat(i.borderBottomWidth||"0")||0,o=parseFloat(i.paddingTop||"0")||0,h=parseFloat(i.paddingBottom||"0")||0,u=s*e+r+l+o+h;this._textarea.style.height=`${Math.min(t,u)}px`,this._textarea.style.overflowY=t>u?"auto":"hidden";return}this._textarea.style.height=`${t}px`,this._textarea.style.overflowY="hidden"}_emit(t,e){this.dispatchEvent(new CustomEvent(t,{detail:{value:e,length:e.length,name:this.getAttribute("name")||""},bubbles:!0,composed:!0}))}_onInput(t){const e=t.target.value;this.getAttribute("value")!==e&&this.setAttribute("value",e),this._syncDynamicUi(),this._applyAutosize(),this._emit("input",e);const i=b(this.getAttribute("debounce"),0);i>0?(this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>{this._emit("debounced-input",e),this._debounceTimer=null},i)):this._emit("debounced-input",e)}_onChange(t){const e=t.target.value;this._emit("change",e)}_onClear(t){t.preventDefault(),!(this.hasAttribute("disabled")||this.hasAttribute("readonly"))&&(this.value="",this._textarea&&(this._textarea.value="",this._textarea.focus()),this._syncDynamicUi(),this._applyAutosize(),this._emit("input",""),this._emit("change",""),this.dispatchEvent(new CustomEvent("clear",{bubbles:!0,composed:!0})))}render(){const t=this.getAttribute("value")||"",e=this.getAttribute("label")||"",i=this.getAttribute("description")||"",s=this.getAttribute("data-error")||"",r=!!(e||i||this.querySelector('[slot="label"]')||this.querySelector('[slot="description"]')),o=this.hasAttribute("clearable")&&!!t&&!this.hasAttribute("disabled")&&!this.hasAttribute("readonly");this.setContent(`
|
|
311
|
+
<style>${z}</style>
|
|
313
312
|
<div class="shell" part="shell">
|
|
314
|
-
<div class="meta" part="meta" ${
|
|
313
|
+
<div class="meta" part="meta" ${r?"":"hidden"}>
|
|
315
314
|
<label id="${this._uid}-label" class="label" part="label"><slot name="label">${x(e)}</slot></label>
|
|
316
315
|
<div id="${this._uid}-description" class="description" part="description"><slot name="description">${x(i)}</slot></div>
|
|
317
316
|
</div>
|
|
318
317
|
|
|
319
318
|
<div class="field" part="field">
|
|
320
319
|
<textarea part="textarea"></textarea>
|
|
321
|
-
<button type="button" part="clear" class="clear-btn" aria-label="Clear text" ${o?"":"hidden"}>${
|
|
320
|
+
<button type="button" part="clear" class="clear-btn" aria-label="Clear text" ${o?"":"hidden"}>${w}</button>
|
|
322
321
|
</div>
|
|
323
322
|
|
|
324
323
|
<div class="footer" part="footer">
|
|
@@ -326,4 +325,4 @@
|
|
|
326
325
|
<div id="${this._uid}-count" class="count" part="count" hidden></div>
|
|
327
326
|
</div>
|
|
328
327
|
</div>
|
|
329
|
-
`),this._detachListeners(),this._textarea=this.root.querySelector("textarea"),this._clearBtn=this.root.querySelector(".clear-btn"),this._countEl=this.root.querySelector(".count"),this._textarea&&(this._textarea.value=t,this._syncControlAttrs(),this._syncDynamicUi(),this._applyAutosize(),this._textarea.addEventListener("input",this._onInput),this._textarea.addEventListener("change",this._onChange),this._clearBtn?.addEventListener("click",this._onClear),this.hasAttribute("autofocus")&&queueMicrotask(()=>{this._textarea?.focus()}))}shouldRenderOnAttributeChange(t,e,i){return t==="label"||t==="description"||t==="data-error"}}typeof customElements<"u"&&!customElements.get("ui-textarea")&&customElements.define("ui-textarea",
|
|
328
|
+
`),this._detachListeners(),this._textarea=this.root.querySelector("textarea"),this._clearBtn=this.root.querySelector(".clear-btn"),this._countEl=this.root.querySelector(".count"),this._textarea&&(this._textarea.value=t,this._syncControlAttrs(),this._syncDynamicUi(),this._applyAutosize(),this._textarea.addEventListener("input",this._onInput),this._textarea.addEventListener("change",this._onChange),this._clearBtn?.addEventListener("click",this._onClear),this.hasAttribute("autofocus")&&queueMicrotask(()=>{this._textarea?.focus()}))}shouldRenderOnAttributeChange(t,e,i){return t==="label"||t==="description"||t==="data-error"}}typeof customElements<"u"&&!customElements.get("ui-textarea")&&customElements.define("ui-textarea",v);exports.UITextarea=v;
|
package/dist/textarea.esm.js
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import { E as _ } from "./ElementBase-BeZT54Hj.mjs";
|
|
2
2
|
import { s as y, a as A } from "./control-name-Bpj7F34X.mjs";
|
|
3
|
-
const
|
|
3
|
+
const w = `
|
|
4
4
|
<svg viewBox="0 0 20 20" aria-hidden="true" focusable="false">
|
|
5
5
|
<path d="m6 6 8 8M14 6l-8 8" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>
|
|
6
6
|
</svg>
|
|
7
|
-
`,
|
|
7
|
+
`, z = `
|
|
8
8
|
:host {
|
|
9
|
-
--ui-textarea-bg: var(--ui-color-surface, #ffffff);
|
|
9
|
+
--ui-textarea-bg: var(--base-input-bg, var(--color-panel-solid, var(--ui-color-surface, #ffffff)));
|
|
10
10
|
--ui-textarea-text: var(--ui-color-text, #0f172a);
|
|
11
11
|
--ui-textarea-muted: var(--ui-color-muted, #526175);
|
|
12
|
-
--ui-textarea-border: color-
|
|
12
|
+
--ui-textarea-border: var(--ui-color-line, var(--ui-color-border, #cbd5e1));
|
|
13
13
|
--ui-textarea-focus: var(--ui-color-focus-ring, #2563eb);
|
|
14
14
|
--ui-textarea-accent: var(--ui-color-primary, #2563eb);
|
|
15
15
|
--ui-textarea-danger: var(--ui-color-danger, #dc2626);
|
|
16
16
|
--ui-textarea-success: var(--ui-color-success, #15803d);
|
|
17
|
-
--ui-textarea-radius:
|
|
18
|
-
--ui-textarea-padding-x: 12px;
|
|
19
|
-
--ui-textarea-padding-y:
|
|
17
|
+
--ui-textarea-radius: var(--ui-control-radius-2, var(--ui-radius, 6px));
|
|
18
|
+
--ui-textarea-padding-x: calc(var(--ui-control-padding-inline-2, 12px) - 1px);
|
|
19
|
+
--ui-textarea-padding-y: 6px;
|
|
20
|
+
--ui-textarea-font-size: var(--ui-control-font-size-2, 14px);
|
|
20
21
|
--ui-textarea-min-height: 110px;
|
|
21
22
|
--ui-textarea-shadow: none;
|
|
22
23
|
|
|
@@ -71,10 +72,14 @@ const z = `
|
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
.field:focus-within {
|
|
74
|
-
border-color: color
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
border-color: var(--ui-ring-color, var(--ui-textarea-focus));
|
|
76
|
+
outline: var(--ui-ring-width, 2px) solid var(--ui-ring-color, var(--ui-textarea-focus));
|
|
77
|
+
outline-offset: -1px;
|
|
78
|
+
box-shadow: var(--ui-textarea-shadow);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.field:hover:not(:focus-within) {
|
|
82
|
+
border-color: var(--ui-color-line-strong, var(--ui-textarea-border));
|
|
78
83
|
}
|
|
79
84
|
|
|
80
85
|
textarea {
|
|
@@ -87,13 +92,13 @@ const z = `
|
|
|
87
92
|
color: var(--ui-textarea-text);
|
|
88
93
|
resize: vertical;
|
|
89
94
|
outline: none;
|
|
90
|
-
font: 500
|
|
95
|
+
font: 500 var(--ui-textarea-font-size)/1.45 "Inter", "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
91
96
|
padding: var(--ui-textarea-padding-y) var(--ui-textarea-padding-x);
|
|
92
97
|
border-radius: inherit;
|
|
93
98
|
}
|
|
94
99
|
|
|
95
100
|
textarea::placeholder {
|
|
96
|
-
color: color-mix(in srgb, var(--ui-textarea-muted)
|
|
101
|
+
color: var(--ui-color-placeholder, color-mix(in srgb, var(--ui-textarea-muted) 90%, transparent));
|
|
97
102
|
}
|
|
98
103
|
|
|
99
104
|
textarea[readonly] {
|
|
@@ -170,26 +175,20 @@ const z = `
|
|
|
170
175
|
|
|
171
176
|
:host([size="sm"]),
|
|
172
177
|
:host([size="1"]) {
|
|
173
|
-
--ui-textarea-padding-x:
|
|
174
|
-
--ui-textarea-padding-y:
|
|
178
|
+
--ui-textarea-padding-x: calc(var(--ui-control-padding-inline-1, 8px) - 1px);
|
|
179
|
+
--ui-textarea-padding-y: 4px;
|
|
175
180
|
--ui-textarea-min-height: 84px;
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
:host([size="sm"]) textarea,
|
|
179
|
-
:host([size="1"]) textarea {
|
|
180
|
-
font-size: 13px;
|
|
181
|
+
--ui-textarea-font-size: var(--ui-control-font-size-1, 12px);
|
|
182
|
+
--ui-textarea-radius: var(--ui-control-radius-1, var(--ui-radius, 6px));
|
|
181
183
|
}
|
|
182
184
|
|
|
183
185
|
:host([size="lg"]),
|
|
184
186
|
:host([size="3"]) {
|
|
185
|
-
--ui-textarea-padding-x:
|
|
186
|
-
--ui-textarea-padding-y:
|
|
187
|
+
--ui-textarea-padding-x: calc(var(--ui-control-padding-inline-3, 16px) - 1px);
|
|
188
|
+
--ui-textarea-padding-y: 8px;
|
|
187
189
|
--ui-textarea-min-height: 140px;
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
:host([size="lg"]) textarea,
|
|
191
|
-
:host([size="3"]) textarea {
|
|
192
|
-
font-size: 15px;
|
|
190
|
+
--ui-textarea-font-size: var(--ui-control-font-size-3, 16px);
|
|
191
|
+
--ui-textarea-radius: var(--ui-control-radius-3, var(--ui-radius, 6px));
|
|
193
192
|
}
|
|
194
193
|
|
|
195
194
|
:host([density="compact"]) {
|
|
@@ -244,7 +243,7 @@ const z = `
|
|
|
244
243
|
|
|
245
244
|
:host([validation="error"]) .field {
|
|
246
245
|
border-color: color-mix(in srgb, var(--ui-textarea-danger) 74%, transparent);
|
|
247
|
-
box-shadow: 0 0 0
|
|
246
|
+
box-shadow: 0 0 0 1px var(--ui-textarea-danger);
|
|
248
247
|
}
|
|
249
248
|
|
|
250
249
|
:host([validation="success"]) .field {
|
|
@@ -319,7 +318,7 @@ function b(r, t) {
|
|
|
319
318
|
return Number.isFinite(e) ? e : t;
|
|
320
319
|
}
|
|
321
320
|
const C = 2147483647;
|
|
322
|
-
function
|
|
321
|
+
function d(r) {
|
|
323
322
|
if (!r) return null;
|
|
324
323
|
const t = Number(r);
|
|
325
324
|
return !Number.isFinite(t) || t < 0 || t > C ? null : Math.trunc(t);
|
|
@@ -438,15 +437,15 @@ class k extends _ {
|
|
|
438
437
|
}
|
|
439
438
|
_syncControlAttrs() {
|
|
440
439
|
if (!this._textarea) return;
|
|
441
|
-
const t = this.getAttribute("placeholder") || "", e =
|
|
442
|
-
this._textarea.placeholder = t, this._textarea.disabled = a, this._textarea.readOnly = l, this._textarea.required = o, this._textarea.rows = Math.max(1, s), this._textarea.name =
|
|
443
|
-
const
|
|
444
|
-
|
|
445
|
-
const
|
|
446
|
-
y(this._textarea, this,
|
|
440
|
+
const t = this.getAttribute("placeholder") || "", e = d(this.getAttribute("maxlength")), i = d(this.getAttribute("minlength")), s = b(this.getAttribute("rows"), 4), a = this.hasAttribute("disabled"), l = this.hasAttribute("readonly"), o = this.hasAttribute("required"), h = this.getAttribute("name") || "", u = this.getAttribute("resize") || "vertical", g = this.getAttribute("validation"), p = this.getAttribute("color"), n = this.getAttribute("radius");
|
|
441
|
+
this._textarea.placeholder = t, this._textarea.disabled = a, this._textarea.readOnly = l, this._textarea.required = o, this._textarea.rows = Math.max(1, s), this._textarea.name = h, this._textarea.style.resize = u, e !== null ? this._textarea.maxLength = e : this._textarea.removeAttribute("maxlength"), i !== null ? this._textarea.minLength = i : this._textarea.removeAttribute("minlength"), g === "error" ? this._textarea.setAttribute("aria-invalid", "true") : this._textarea.removeAttribute("aria-invalid"), p ? this.style.setProperty("--ui-textarea-accent", p) : this.style.removeProperty("--ui-textarea-accent"), n && n !== "none" && n !== "large" && n !== "full" ? this.style.setProperty("--ui-textarea-radius", n) : this.style.removeProperty("--ui-textarea-radius");
|
|
442
|
+
const c = [], v = !!(this.getAttribute("description") || this.querySelector('[slot="description"]')), f = !!(this.getAttribute("data-error") || this.querySelector('[slot="error"]'));
|
|
443
|
+
v && c.push(`${this._uid}-description`), f && c.push(`${this._uid}-error`), (this.hasAttribute("show-count") || d(this.getAttribute("maxlength")) !== null) && c.push(`${this._uid}-count`);
|
|
444
|
+
const m = !!(this.getAttribute("label") || this.querySelector('[slot="label"]'));
|
|
445
|
+
y(this._textarea, this, m ? `${this._uid}-label` : null), A(this._textarea, this, this._uid, c);
|
|
447
446
|
}
|
|
448
447
|
_syncDynamicUi() {
|
|
449
|
-
const t = this._textarea?.value || this.getAttribute("value") || "", e =
|
|
448
|
+
const t = this._textarea?.value || this.getAttribute("value") || "", e = d(this.getAttribute("maxlength")), i = this.hasAttribute("clearable");
|
|
450
449
|
this._clearBtn && (i && t && !this.hasAttribute("disabled") && !this.hasAttribute("readonly") ? this._clearBtn.removeAttribute("hidden") : this._clearBtn.setAttribute("hidden", "")), this._countEl && (this.hasAttribute("show-count") || e !== null ? (this._countEl.removeAttribute("hidden"), e !== null ? this._countEl.textContent = `${t.length} / ${e}` : this._countEl.textContent = `${t.length}`) : this._countEl.setAttribute("hidden", ""));
|
|
451
450
|
}
|
|
452
451
|
_applyAutosize() {
|
|
@@ -458,7 +457,7 @@ class k extends _ {
|
|
|
458
457
|
this._textarea.style.height = "auto";
|
|
459
458
|
const t = this._textarea.scrollHeight, e = b(this.getAttribute("max-rows"), 0);
|
|
460
459
|
if (e > 0) {
|
|
461
|
-
const i = getComputedStyle(this._textarea), s = parseFloat(i.lineHeight || "20") || 20, a = parseFloat(i.borderTopWidth || "0") || 0, l = parseFloat(i.borderBottomWidth || "0") || 0, o = parseFloat(i.paddingTop || "0") || 0,
|
|
460
|
+
const i = getComputedStyle(this._textarea), s = parseFloat(i.lineHeight || "20") || 20, a = parseFloat(i.borderTopWidth || "0") || 0, l = parseFloat(i.borderBottomWidth || "0") || 0, o = parseFloat(i.paddingTop || "0") || 0, h = parseFloat(i.paddingBottom || "0") || 0, u = s * e + a + l + o + h;
|
|
462
461
|
this._textarea.style.height = `${Math.min(t, u)}px`, this._textarea.style.overflowY = t > u ? "auto" : "hidden";
|
|
463
462
|
return;
|
|
464
463
|
}
|
|
@@ -495,7 +494,7 @@ class k extends _ {
|
|
|
495
494
|
render() {
|
|
496
495
|
const t = this.getAttribute("value") || "", e = this.getAttribute("label") || "", i = this.getAttribute("description") || "", s = this.getAttribute("data-error") || "", a = !!(e || i || this.querySelector('[slot="label"]') || this.querySelector('[slot="description"]')), o = this.hasAttribute("clearable") && !!t && !this.hasAttribute("disabled") && !this.hasAttribute("readonly");
|
|
497
496
|
this.setContent(`
|
|
498
|
-
<style>${
|
|
497
|
+
<style>${z}</style>
|
|
499
498
|
<div class="shell" part="shell">
|
|
500
499
|
<div class="meta" part="meta" ${a ? "" : "hidden"}>
|
|
501
500
|
<label id="${this._uid}-label" class="label" part="label"><slot name="label">${x(e)}</slot></label>
|
|
@@ -504,7 +503,7 @@ class k extends _ {
|
|
|
504
503
|
|
|
505
504
|
<div class="field" part="field">
|
|
506
505
|
<textarea part="textarea"></textarea>
|
|
507
|
-
<button type="button" part="clear" class="clear-btn" aria-label="Clear text" ${o ? "" : "hidden"}>${
|
|
506
|
+
<button type="button" part="clear" class="clear-btn" aria-label="Clear text" ${o ? "" : "hidden"}>${w}</button>
|
|
508
507
|
</div>
|
|
509
508
|
|
|
510
509
|
<div class="footer" part="footer">
|