@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/date-field.cjs.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const U=require("./ElementBase-DxbvhLJs.js"),C=require("./control-name-BmoI1m3a.js"),I=require("./calendar-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const U=require("./ElementBase-DxbvhLJs.js"),C=require("./control-name-BmoI1m3a.js"),I=require("./calendar-o273O28D.js"),u=require("./date-time-utils-DdigV4hs.js");let w=0;const B=`
|
|
2
2
|
:host {
|
|
3
3
|
--ui-date-field-border-color: color-mix(in srgb, var(--ui-color-border, #cbd5e1) 78%, transparent);
|
|
4
4
|
--ui-date-field-border: 1px solid var(--ui-date-field-border-color);
|
|
5
|
-
--ui-date-field-radius: var(--ui-radius,
|
|
6
|
-
--ui-date-field-bg: var(--ui-color-surface, #ffffff);
|
|
5
|
+
--ui-date-field-radius: var(--ui-control-radius-2, var(--ui-radius, 6px));
|
|
6
|
+
--ui-date-field-bg: var(--color-panel-solid, var(--ui-color-surface, #ffffff));
|
|
7
7
|
--ui-date-field-text: var(--ui-color-text, #0f172a);
|
|
8
8
|
--ui-date-field-muted: var(--ui-color-muted, #526175);
|
|
9
9
|
--ui-date-field-focus: var(--ui-color-focus-ring, #2563eb);
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
align-items: center;
|
|
64
64
|
flex-wrap: wrap;
|
|
65
65
|
gap: 4px;
|
|
66
|
-
min-block-size:
|
|
66
|
+
min-block-size: var(--ui-control-height-2, 32px);
|
|
67
67
|
padding: 0 10px;
|
|
68
68
|
border: var(--ui-date-field-border);
|
|
69
69
|
border-radius: var(--ui-date-field-radius);
|
|
@@ -74,12 +74,12 @@
|
|
|
74
74
|
|
|
75
75
|
.shell[data-focused="true"] {
|
|
76
76
|
border-color: color-mix(in srgb, var(--ui-date-field-focus) 58%, var(--ui-date-field-border-color));
|
|
77
|
-
box-shadow: 0 0 0
|
|
77
|
+
box-shadow: 0 0 0 2px var(--ui-ring-color, var(--ui-date-field-focus));
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
.shell[data-invalid="true"] {
|
|
81
81
|
border-color: color-mix(in srgb, var(--ui-date-field-danger) 62%, transparent);
|
|
82
|
-
box-shadow: 0 0 0
|
|
82
|
+
box-shadow: 0 0 0 2px color-mix(in srgb, var(--ui-date-field-danger) 45%, transparent);
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
.segment {
|
|
@@ -127,7 +127,7 @@
|
|
|
127
127
|
:host([readonly]) .segment {
|
|
128
128
|
cursor: default;
|
|
129
129
|
}
|
|
130
|
-
`;function V(r,e){return new Date(Date.UTC(r,e,0)).getUTCDate()}function q(r){return`${String(r.year).padStart(4,"0")}-${String(r.month).padStart(2,"0")}-${String(r.day).padStart(2,"0")}`}function g(r){if(!r)return null;const e=I.parseISO(r);return e?{year:e.y,month:e.m,day:e.d}:null}function
|
|
130
|
+
`;function V(r,e){return new Date(Date.UTC(r,e,0)).getUTCDate()}function q(r){return`${String(r.year).padStart(4,"0")}-${String(r.month).padStart(2,"0")}-${String(r.day).padStart(2,"0")}`}function g(r){if(!r)return null;const e=I.parseISO(r);return e?{year:e.y,month:e.m,day:e.d}:null}function _(r){return{...r,day:Math.min(r.day,V(r.year,r.month))}}function z(r,e,i){if(e==="day"){const t=new Date(Date.UTC(r.year,r.month-1,r.day));return t.setUTCDate(t.getUTCDate()+i),{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate()}}if(e==="month"){const t=r.month-1+i,s=new Date(Date.UTC(r.year,t,1));return _({year:s.getUTCFullYear(),month:s.getUTCMonth()+1,day:r.day})}return _({...r,year:Math.max(1,r.year+i)})}function D(r){try{return new Intl.DateTimeFormat(r,{year:"numeric",month:"2-digit",day:"2-digit",timeZone:"UTC"}).formatToParts(new Date(Date.UTC(2026,10,21))).map(i=>i.type==="month"||i.type==="day"||i.type==="year"?{type:"segment",segment:i.type}:i.type==="literal"?{type:"literal",value:i.value}:null).filter(Boolean)}catch{return[{type:"segment",segment:"month"},{type:"literal",value:"/"},{type:"segment",segment:"day"},{type:"literal",value:"/"},{type:"segment",segment:"year"}]}}function M(r){return r==="year"?"YYYY":r==="month"?"MM":"DD"}const b=class b extends U.ElementBase{constructor(){super(),this._value=null,this._activeSegment="month",this._segmentButtons=new Map,this._segmentsEl=null,this._shellEl=null,this._errorEl=null,this._formUnregister=null,this._bufferBySegment={month:"",day:"",year:""},this._bufferTimer=null,this._internals=null,this._uid=`ui-date-field-${++w}`,this._defaultValue=null;try{this._internals=typeof this.attachInternals=="function"?this.attachInternals():null}catch{this._internals=null}this._onSegmentKeyDown=this._onSegmentKeyDown.bind(this),this._onSegmentClick=this._onSegmentClick.bind(this),this._onFocusIn=this._onFocusIn.bind(this),this._onFocusOut=this._onFocusOut.bind(this)}static get observedAttributes(){return["aria-label","aria-description","aria-describedby","value","min","max","locale","label","description","data-error","required","disabled","readonly","name"]}get value(){return this._value||""}set value(e){this._setValue(e||null,"api")}clearValue(){this._setValue(null,"clear")}formResetCallback(){this._setValue(this._defaultValue,"form")}connectedCallback(){super.connectedCallback(),this._defaultValue==null&&(this._defaultValue=this.getAttribute("value")),this._registerWithForm()}disconnectedCallback(){this._formUnregister&&(this._formUnregister(),this._formUnregister=null),this._bufferTimer!=null&&(window.clearTimeout(this._bufferTimer),this._bufferTimer=null),super.disconnectedCallback()}attributeChangedCallback(e,i,t){i!==t&&(e==="value"&&(this._value=this._normalizeDateValue(t)),e==="name"&&this.isConnected&&this._registerWithForm(),this._shellEl&&this._syncUi())}shouldRenderOnAttributeChange(){return!1}render(){this.setContent(`
|
|
131
131
|
<style>${B}</style>
|
|
132
132
|
<div class="root">
|
|
133
133
|
<div class="meta" hidden>
|
|
@@ -139,4 +139,4 @@
|
|
|
139
139
|
</div>
|
|
140
140
|
<div class="error" part="error" hidden></div>
|
|
141
141
|
</div>
|
|
142
|
-
`),this._segmentsEl=this.root.querySelector(".segments"),this._shellEl=this.root.querySelector(".shell"),this._errorEl=this.root.querySelector(".error"),this._shellEl?.addEventListener("focusin",this._onFocusIn),this._shellEl?.addEventListener("focusout",this._onFocusOut),this._value=this._normalizeDateValue(this.getAttribute("value")),this._syncFormValue(),this._syncUi()}_normalizeDateValue(e){const i=u.normalizeDateIso(e);if(!i)return null;const t=u.normalizeDateIso(this.getAttribute("min")),s=u.normalizeDateIso(this.getAttribute("max"));return u.clampDateIso(i,t,s)}_partsOrFallback(){return g(this._value)||g(u.normalizeDateIso(this.getAttribute("min")))||{year:2026,month:1,day:1}}_segmentOrder(){return D(u.normalizeLocale(this.getAttribute("locale"))).filter(e=>e.type==="segment").map(e=>e.segment)}_moveSegmentFocus(e){const i=this._segmentOrder(),t=i.indexOf(this._activeSegment),s=i[(t+e+i.length)%i.length];this._focusSegment(s)}_focusSegment(e){this._activeSegment=e,this._syncUi(),this._segmentButtons.get(e)?.focus()}_applyParts(e,i){const t=this._normalizeDateValue(q(
|
|
142
|
+
`),this._segmentsEl=this.root.querySelector(".segments"),this._shellEl=this.root.querySelector(".shell"),this._errorEl=this.root.querySelector(".error"),this._shellEl?.addEventListener("focusin",this._onFocusIn),this._shellEl?.addEventListener("focusout",this._onFocusOut),this._value=this._normalizeDateValue(this.getAttribute("value")),this._syncFormValue(),this._syncUi()}_normalizeDateValue(e){const i=u.normalizeDateIso(e);if(!i)return null;const t=u.normalizeDateIso(this.getAttribute("min")),s=u.normalizeDateIso(this.getAttribute("max"));return u.clampDateIso(i,t,s)}_partsOrFallback(){return g(this._value)||g(u.normalizeDateIso(this.getAttribute("min")))||{year:2026,month:1,day:1}}_segmentOrder(){return D(u.normalizeLocale(this.getAttribute("locale"))).filter(e=>e.type==="segment").map(e=>e.segment)}_moveSegmentFocus(e){const i=this._segmentOrder(),t=i.indexOf(this._activeSegment),s=i[(t+e+i.length)%i.length];this._focusSegment(s)}_focusSegment(e){this._activeSegment=e,this._syncUi(),this._segmentButtons.get(e)?.focus()}_applyParts(e,i){const t=this._normalizeDateValue(q(_(e)));this._setValue(t,i)}_setValue(e,i){const t=this._normalizeDateValue(e);if(t===this._value){this._syncFormValue(),this._syncUi();return}const s=this._value;this._value=t,t?this.setAttribute("value",t):this.removeAttribute("value"),this._syncFormValue(),this._syncUi(),this.dispatchEvent(new CustomEvent("change",{detail:{value:t,previousValue:s,source:i},bubbles:!0,composed:!0}))}_syncFormValue(){try{this._internals?.setFormValue(this.value||"")}catch{}}_setBuffer(e,i){this._bufferBySegment[e]=i,this._bufferTimer!=null&&window.clearTimeout(this._bufferTimer),this._bufferTimer=window.setTimeout(()=>{this._bufferBySegment.month="",this._bufferBySegment.day="",this._bufferBySegment.year="",this._bufferTimer=null},900)}_applyNumericInput(e,i){const t=`${this._bufferBySegment[e]}${i}`.slice(e==="year"?-4:-2);this._setBuffer(e,t);const s=e==="year"?4:2;if(t.length<s)return;const l=this._partsOrFallback(),o=Number(t);Number.isFinite(o)&&(e==="month"&&(l.month=Math.min(Math.max(o,1),12)),e==="day"&&(l.day=Math.min(Math.max(o,1),31)),e==="year"&&(l.year=Math.min(Math.max(o,1),9999)),this._applyParts(l,"keyboard"),e!=="year"&&this._moveSegmentFocus(1))}_onSegmentClick(e){const t=e.currentTarget.getAttribute("data-segment");t&&this._focusSegment(t)}_onSegmentKeyDown(e){if(this.hasAttribute("disabled")||this.hasAttribute("readonly"))return;const i=e.currentTarget.getAttribute("data-segment");if(i){if(e.key==="ArrowLeft"){e.preventDefault(),this._moveSegmentFocus(-1);return}if(e.key==="ArrowRight"){e.preventDefault(),this._moveSegmentFocus(1);return}if(e.key==="ArrowUp"||e.key==="ArrowDown"){e.preventDefault();const t=z(this._partsOrFallback(),i,e.key==="ArrowUp"?1:-1);this._applyParts(t,"keyboard");return}if(e.key==="Backspace"||e.key==="Delete"){e.preventDefault(),this.clearValue();return}/^\d$/.test(e.key)&&(e.preventDefault(),this._applyNumericInput(i,e.key))}}_registerWithForm(){this._formUnregister&&(this._formUnregister(),this._formUnregister=null);try{const s=this.getRootNode().host?.closest?.("ui-form")||null||this.closest("ui-form"),l=this.getAttribute("name");s&&typeof s.registerField=="function"&&l&&(this._formUnregister=s.registerField(l,{name:l,getValue:()=>this.value,setValue:o=>this._setValue(o?String(o):null,"form"),validate:async()=>this.hasAttribute("required")&&!this.value?{valid:!1,message:"Date is required"}:{valid:!0},setError:o=>{o?this.setAttribute("data-error",o):this.removeAttribute("data-error"),this._syncUi()}}))}catch{}}_onFocusIn(){this._shellEl?.setAttribute("data-focused","true")}_onFocusOut(e){this._shellEl?.contains(e.relatedTarget)||this._shellEl?.setAttribute("data-focused","false")}_syncUi(){if(!this._segmentsEl||!this._shellEl||!this._errorEl)return;const e=this.root.activeElement,i=!!e&&this._segmentsEl.contains(e),t=(this.getAttribute("label")||"").trim(),s=(this.getAttribute("description")||"").trim(),l=(this.getAttribute("data-error")||"").trim(),o=this.root.querySelector(".meta"),y=this.root.querySelector(".label"),k=this.root.querySelector(".label-text"),F=this.root.querySelector(".required"),c=this.root.querySelector(".description"),p=`${this._uid}-label`,v=`${this._uid}-description`,x=`${this._uid}-error`;o.hidden=!t&&!s,y.hidden=!t,y.id=t?p:"",k.textContent=t,F.hidden=!this.hasAttribute("required"),c.hidden=!s,c.id=s?v:"",c.textContent=s,this._errorEl.hidden=!l,this._errorEl.id=l?x:"",this._errorEl.textContent=l,this._shellEl.setAttribute("data-invalid",l?"true":"false"),this._shellEl.setAttribute("role","group"),C.syncControlName(this._shellEl,this,t?p:null);const S=[s?v:null,l?x:null].filter(Boolean).join(" ");C.syncControlDescription(this._shellEl,this,this._uid,S?S.split(" "):[]),this._shellEl.setAttribute("aria-invalid",l?"true":"false"),this._shellEl.setAttribute("aria-required",this.hasAttribute("required")?"true":"false"),this._shellEl.setAttribute("aria-disabled",this.hasAttribute("disabled")?"true":"false"),this._shellEl.removeAttribute("aria-readonly");const d=g(this._value),E=D(u.normalizeLocale(this.getAttribute("locale"))),A=E.filter(n=>n.type==="segment").map(n=>n.segment);A.includes(this._activeSegment)||(this._activeSegment=A[0]||"month");const m=[];if(this._segmentButtons.clear(),E.forEach(n=>{if(n.type==="literal"){const f=document.createElement("span");f.className="literal",f.textContent=n.value,m.push(f);return}const a=document.createElement("button");a.type="button",a.className="segment",a.setAttribute("data-segment",n.segment),a.setAttribute("data-active",this._activeSegment===n.segment?"true":"false"),a.setAttribute("data-empty",d?"false":"true");const T=n.segment==="month"?"Month":n.segment==="day"?"Day":"Year";a.tabIndex=this._activeSegment===n.segment?0:-1,a.disabled=this.hasAttribute("disabled"),a.addEventListener("click",this._onSegmentClick),a.addEventListener("keydown",this._onSegmentKeyDown),d?n.segment==="year"?a.textContent=String(d.year).padStart(4,"0"):n.segment==="month"?a.textContent=String(d.month).padStart(2,"0"):a.textContent=String(d.day).padStart(2,"0"):a.textContent=M(n.segment),a.setAttribute("aria-label",`${T} ${a.textContent||""}`.trim()),this._segmentButtons.set(n.segment,a),m.push(a)}),this._segmentsEl.replaceChildren(...m),i){const n=this._segmentButtons.get(this._activeSegment);try{n?.focus({preventScroll:!0})}catch{n?.focus()}}}};b.formAssociated=!0;let h=b;typeof customElements<"u"&&!customElements.get("ui-date-field")&&customElements.define("ui-date-field",h);exports.UIDateField=h;
|
package/dist/date-field.esm.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { E as U } from "./ElementBase-BeZT54Hj.mjs";
|
|
2
2
|
import { s as w, a as I } from "./control-name-Bpj7F34X.mjs";
|
|
3
|
-
import { p as B } from "./calendar-
|
|
4
|
-
import { n as d, a as V, b as C } from "./date-time-utils-
|
|
3
|
+
import { p as B } from "./calendar-DmxiZrR7.mjs";
|
|
4
|
+
import { n as d, a as V, b as C } from "./date-time-utils-B4hAkt36.mjs";
|
|
5
5
|
let M = 0;
|
|
6
6
|
const q = `
|
|
7
7
|
:host {
|
|
8
8
|
--ui-date-field-border-color: color-mix(in srgb, var(--ui-color-border, #cbd5e1) 78%, transparent);
|
|
9
9
|
--ui-date-field-border: 1px solid var(--ui-date-field-border-color);
|
|
10
|
-
--ui-date-field-radius: var(--ui-radius,
|
|
11
|
-
--ui-date-field-bg: var(--ui-color-surface, #ffffff);
|
|
10
|
+
--ui-date-field-radius: var(--ui-control-radius-2, var(--ui-radius, 6px));
|
|
11
|
+
--ui-date-field-bg: var(--color-panel-solid, var(--ui-color-surface, #ffffff));
|
|
12
12
|
--ui-date-field-text: var(--ui-color-text, #0f172a);
|
|
13
13
|
--ui-date-field-muted: var(--ui-color-muted, #526175);
|
|
14
14
|
--ui-date-field-focus: var(--ui-color-focus-ring, #2563eb);
|
|
@@ -68,7 +68,7 @@ const q = `
|
|
|
68
68
|
align-items: center;
|
|
69
69
|
flex-wrap: wrap;
|
|
70
70
|
gap: 4px;
|
|
71
|
-
min-block-size:
|
|
71
|
+
min-block-size: var(--ui-control-height-2, 32px);
|
|
72
72
|
padding: 0 10px;
|
|
73
73
|
border: var(--ui-date-field-border);
|
|
74
74
|
border-radius: var(--ui-date-field-radius);
|
|
@@ -79,12 +79,12 @@ const q = `
|
|
|
79
79
|
|
|
80
80
|
.shell[data-focused="true"] {
|
|
81
81
|
border-color: color-mix(in srgb, var(--ui-date-field-focus) 58%, var(--ui-date-field-border-color));
|
|
82
|
-
box-shadow: 0 0 0
|
|
82
|
+
box-shadow: 0 0 0 2px var(--ui-ring-color, var(--ui-date-field-focus));
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
.shell[data-invalid="true"] {
|
|
86
86
|
border-color: color-mix(in srgb, var(--ui-date-field-danger) 62%, transparent);
|
|
87
|
-
box-shadow: 0 0 0
|
|
87
|
+
box-shadow: 0 0 0 2px color-mix(in srgb, var(--ui-date-field-danger) 45%, transparent);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
.segment {
|
package/dist/date-picker.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const L=require("./ElementBase-DxbvhLJs.js"),z=require("./control-name-BmoI1m3a.js"),q=require("./dismissable-layer-DNfrKA20.js"),A=require("./calendar-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const L=require("./ElementBase-DxbvhLJs.js"),z=require("./control-name-BmoI1m3a.js"),q=require("./dismissable-layer-DNfrKA20.js"),A=require("./calendar-o273O28D.js"),s=require("./date-time-utils-DdigV4hs.js");let M=0;const E=`
|
|
2
2
|
<svg viewBox="0 0 20 20" class="icon-svg" aria-hidden="true" focusable="false">
|
|
3
3
|
<path d="M6 2a1 1 0 0 1 1 1v1h6V3a1 1 0 1 1 2 0v1h.5A2.5 2.5 0 0 1 18 6.5v9A2.5 2.5 0 0 1 15.5 18h-11A2.5 2.5 0 0 1 2 15.5v-9A2.5 2.5 0 0 1 4.5 4H5V3a1 1 0 0 1 1-1Zm10 7H4v6.5c0 .276.224.5.5.5h11a.5.5 0 0 0 .5-.5V9ZM4.5 6a.5.5 0 0 0-.5.5V7h12v-.5a.5.5 0 0 0-.5-.5h-11Z" fill="currentColor"/>
|
|
4
4
|
</svg>
|
|
@@ -18,17 +18,17 @@
|
|
|
18
18
|
color-mix(in srgb, var(--ui-color-surface, #ffffff) 98%, transparent),
|
|
19
19
|
color-mix(in srgb, var(--ui-color-surface, #ffffff) 92%, var(--ui-color-surface-alt, #f8fafc))
|
|
20
20
|
);
|
|
21
|
-
--ui-dp-border: color-
|
|
21
|
+
--ui-dp-border: var(--ui-color-line, var(--ui-color-border, #cbd5e1));
|
|
22
22
|
--ui-dp-text: var(--ui-color-text, #0f172a);
|
|
23
23
|
--ui-dp-muted: var(--ui-color-muted, #526175);
|
|
24
24
|
--ui-dp-accent: var(--ui-color-primary, #2563eb);
|
|
25
25
|
--ui-dp-success: var(--ui-color-success, #15803d);
|
|
26
|
-
--ui-dp-radius:
|
|
26
|
+
--ui-dp-radius: var(--ui-control-radius-2, var(--ui-radius, 6px));
|
|
27
27
|
--ui-dp-panel-radius: calc(var(--ui-dp-radius) + 2px);
|
|
28
28
|
--ui-dp-shadow: none;
|
|
29
29
|
--ui-dp-z: 1600;
|
|
30
30
|
--ui-dp-gap: 12px;
|
|
31
|
-
--ui-dp-hit:
|
|
31
|
+
--ui-dp-hit: var(--ui-control-height-2, 32px);
|
|
32
32
|
--ui-dp-field-bg: var(--ui-dp-bg);
|
|
33
33
|
--ui-dp-field-border: var(--ui-dp-border);
|
|
34
34
|
--ui-dp-field-focus: color-mix(in srgb, var(--ui-dp-accent) 72%, transparent);
|
|
@@ -55,11 +55,14 @@
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
:host([size="sm"]) {
|
|
58
|
-
--ui-dp-
|
|
58
|
+
--ui-dp-action-size: 24px;
|
|
59
|
+
--ui-dp-action-bleed: -1px;
|
|
60
|
+
--ui-dp-hit: var(--ui-control-height-1, 24px);
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
:host([size="lg"]) {
|
|
62
|
-
--ui-dp-
|
|
64
|
+
--ui-dp-action-size: 28px;
|
|
65
|
+
--ui-dp-hit: var(--ui-control-height-3, 40px);
|
|
63
66
|
}
|
|
64
67
|
|
|
65
68
|
.root {
|
|
@@ -83,6 +86,7 @@
|
|
|
83
86
|
}
|
|
84
87
|
|
|
85
88
|
.field {
|
|
89
|
+
box-sizing: border-box;
|
|
86
90
|
display: grid;
|
|
87
91
|
grid-template-columns: auto minmax(0, 1fr) auto auto;
|
|
88
92
|
align-items: center;
|
|
@@ -97,23 +101,27 @@
|
|
|
97
101
|
}
|
|
98
102
|
|
|
99
103
|
.field[data-open="true"] {
|
|
100
|
-
border-color: var(--ui-dp-
|
|
101
|
-
|
|
104
|
+
border-color: var(--ui-ring-color, var(--ui-dp-accent));
|
|
105
|
+
outline: var(--ui-ring-width, 2px) solid var(--ui-ring-color, var(--ui-dp-accent));
|
|
106
|
+
outline-offset: -1px;
|
|
107
|
+
box-shadow: none;
|
|
102
108
|
}
|
|
103
109
|
|
|
104
110
|
.field:focus-within {
|
|
105
|
-
border-color: var(--ui-dp-
|
|
106
|
-
|
|
111
|
+
border-color: var(--ui-ring-color, var(--ui-dp-accent));
|
|
112
|
+
outline: var(--ui-ring-width, 2px) solid var(--ui-ring-color, var(--ui-dp-accent));
|
|
113
|
+
outline-offset: -1px;
|
|
114
|
+
box-shadow: none;
|
|
107
115
|
}
|
|
108
116
|
|
|
109
117
|
.field[data-invalid="true"] {
|
|
110
118
|
border-color: color-mix(in srgb, var(--ui-dp-field-error) 68%, transparent);
|
|
111
|
-
box-shadow: 0 0 0
|
|
119
|
+
box-shadow: 0 0 0 1px var(--ui-dp-field-error);
|
|
112
120
|
}
|
|
113
121
|
|
|
114
122
|
.field[data-state="success"]:not([data-invalid="true"]) {
|
|
115
123
|
border-color: color-mix(in srgb, var(--ui-dp-success) 56%, var(--ui-dp-border));
|
|
116
|
-
box-shadow: 0 0 0
|
|
124
|
+
box-shadow: 0 0 0 1px var(--ui-dp-success);
|
|
117
125
|
}
|
|
118
126
|
|
|
119
127
|
.field[data-state="loading"] {
|
|
@@ -141,22 +149,23 @@
|
|
|
141
149
|
border: 0;
|
|
142
150
|
background: transparent;
|
|
143
151
|
color: var(--ui-dp-text);
|
|
144
|
-
padding:
|
|
152
|
+
padding: 0;
|
|
145
153
|
outline: none;
|
|
146
154
|
font: 500 14px/1.4 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
147
155
|
letter-spacing: 0.005em;
|
|
148
156
|
}
|
|
149
157
|
|
|
150
158
|
.input::placeholder {
|
|
151
|
-
color: color-mix(in srgb, var(--ui-dp-text)
|
|
159
|
+
color: var(--ui-color-placeholder, color-mix(in srgb, var(--ui-dp-text) 62%, transparent));
|
|
152
160
|
}
|
|
153
161
|
|
|
154
162
|
.btn {
|
|
155
163
|
border: 0;
|
|
156
164
|
background: transparent;
|
|
157
165
|
color: color-mix(in srgb, var(--ui-dp-text) 74%, transparent);
|
|
158
|
-
inline-size:
|
|
159
|
-
block-size:
|
|
166
|
+
inline-size: var(--ui-dp-action-size, 24px);
|
|
167
|
+
block-size: var(--ui-dp-action-size, 24px);
|
|
168
|
+
margin-block: var(--ui-dp-action-bleed, 0px);
|
|
160
169
|
border-radius: 8px;
|
|
161
170
|
display: inline-grid;
|
|
162
171
|
place-items: center;
|
|
@@ -389,12 +398,12 @@
|
|
|
389
398
|
color-mix(in srgb, var(--ui-color-surface, #ffffff) 98%, transparent),
|
|
390
399
|
color-mix(in srgb, var(--ui-color-surface, #ffffff) 92%, var(--ui-color-surface-alt, #f8fafc))
|
|
391
400
|
);
|
|
392
|
-
--ui-dp-border: color-
|
|
401
|
+
--ui-dp-border: var(--ui-color-line, var(--ui-color-border, #cbd5e1));
|
|
393
402
|
--ui-dp-text: var(--ui-color-text, #0f172a);
|
|
394
403
|
--ui-dp-muted: var(--ui-color-muted, #526175);
|
|
395
404
|
--ui-dp-accent: var(--ui-color-primary, #2563eb);
|
|
396
405
|
--ui-dp-success: var(--ui-color-success, #15803d);
|
|
397
|
-
--ui-dp-radius:
|
|
406
|
+
--ui-dp-radius: var(--ui-control-radius-2, var(--ui-radius, 6px));
|
|
398
407
|
--ui-dp-panel-radius: calc(var(--ui-dp-radius) + 2px);
|
|
399
408
|
--ui-dp-field-error: var(--ui-color-danger, #dc2626);
|
|
400
409
|
--ui-dp-focus-ring: color-mix(in srgb, var(--ui-dp-accent) 26%, transparent);
|
package/dist/date-picker.esm.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { E as V } from "./ElementBase-BeZT54Hj.mjs";
|
|
2
2
|
import { s as q, a as M } from "./control-name-Bpj7F34X.mjs";
|
|
3
3
|
import { c as $ } from "./dismissable-layer-BmPIoK80.mjs";
|
|
4
|
-
import { r as R, c as S } from "./calendar-
|
|
5
|
-
import { r as F, e as T, n as g, i as y, s as H, b as U, p as L, a as O, f as Y, l as E, c as K, d as W } from "./date-time-utils-
|
|
4
|
+
import { r as R, c as S } from "./calendar-DmxiZrR7.mjs";
|
|
5
|
+
import { r as F, e as T, n as g, i as y, s as H, b as U, p as L, a as O, f as Y, l as E, c as K, d as W } from "./date-time-utils-B4hAkt36.mjs";
|
|
6
6
|
let N = 0;
|
|
7
7
|
const Z = `
|
|
8
8
|
<svg viewBox="0 0 20 20" class="icon-svg" aria-hidden="true" focusable="false">
|
|
@@ -24,17 +24,17 @@ const Z = `
|
|
|
24
24
|
color-mix(in srgb, var(--ui-color-surface, #ffffff) 98%, transparent),
|
|
25
25
|
color-mix(in srgb, var(--ui-color-surface, #ffffff) 92%, var(--ui-color-surface-alt, #f8fafc))
|
|
26
26
|
);
|
|
27
|
-
--ui-dp-border: color-
|
|
27
|
+
--ui-dp-border: var(--ui-color-line, var(--ui-color-border, #cbd5e1));
|
|
28
28
|
--ui-dp-text: var(--ui-color-text, #0f172a);
|
|
29
29
|
--ui-dp-muted: var(--ui-color-muted, #526175);
|
|
30
30
|
--ui-dp-accent: var(--ui-color-primary, #2563eb);
|
|
31
31
|
--ui-dp-success: var(--ui-color-success, #15803d);
|
|
32
|
-
--ui-dp-radius:
|
|
32
|
+
--ui-dp-radius: var(--ui-control-radius-2, var(--ui-radius, 6px));
|
|
33
33
|
--ui-dp-panel-radius: calc(var(--ui-dp-radius) + 2px);
|
|
34
34
|
--ui-dp-shadow: none;
|
|
35
35
|
--ui-dp-z: 1600;
|
|
36
36
|
--ui-dp-gap: 12px;
|
|
37
|
-
--ui-dp-hit:
|
|
37
|
+
--ui-dp-hit: var(--ui-control-height-2, 32px);
|
|
38
38
|
--ui-dp-field-bg: var(--ui-dp-bg);
|
|
39
39
|
--ui-dp-field-border: var(--ui-dp-border);
|
|
40
40
|
--ui-dp-field-focus: color-mix(in srgb, var(--ui-dp-accent) 72%, transparent);
|
|
@@ -61,11 +61,14 @@ const Z = `
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
:host([size="sm"]) {
|
|
64
|
-
--ui-dp-
|
|
64
|
+
--ui-dp-action-size: 24px;
|
|
65
|
+
--ui-dp-action-bleed: -1px;
|
|
66
|
+
--ui-dp-hit: var(--ui-control-height-1, 24px);
|
|
65
67
|
}
|
|
66
68
|
|
|
67
69
|
:host([size="lg"]) {
|
|
68
|
-
--ui-dp-
|
|
70
|
+
--ui-dp-action-size: 28px;
|
|
71
|
+
--ui-dp-hit: var(--ui-control-height-3, 40px);
|
|
69
72
|
}
|
|
70
73
|
|
|
71
74
|
.root {
|
|
@@ -89,6 +92,7 @@ const Z = `
|
|
|
89
92
|
}
|
|
90
93
|
|
|
91
94
|
.field {
|
|
95
|
+
box-sizing: border-box;
|
|
92
96
|
display: grid;
|
|
93
97
|
grid-template-columns: auto minmax(0, 1fr) auto auto;
|
|
94
98
|
align-items: center;
|
|
@@ -103,23 +107,27 @@ const Z = `
|
|
|
103
107
|
}
|
|
104
108
|
|
|
105
109
|
.field[data-open="true"] {
|
|
106
|
-
border-color: var(--ui-dp-
|
|
107
|
-
|
|
110
|
+
border-color: var(--ui-ring-color, var(--ui-dp-accent));
|
|
111
|
+
outline: var(--ui-ring-width, 2px) solid var(--ui-ring-color, var(--ui-dp-accent));
|
|
112
|
+
outline-offset: -1px;
|
|
113
|
+
box-shadow: none;
|
|
108
114
|
}
|
|
109
115
|
|
|
110
116
|
.field:focus-within {
|
|
111
|
-
border-color: var(--ui-dp-
|
|
112
|
-
|
|
117
|
+
border-color: var(--ui-ring-color, var(--ui-dp-accent));
|
|
118
|
+
outline: var(--ui-ring-width, 2px) solid var(--ui-ring-color, var(--ui-dp-accent));
|
|
119
|
+
outline-offset: -1px;
|
|
120
|
+
box-shadow: none;
|
|
113
121
|
}
|
|
114
122
|
|
|
115
123
|
.field[data-invalid="true"] {
|
|
116
124
|
border-color: color-mix(in srgb, var(--ui-dp-field-error) 68%, transparent);
|
|
117
|
-
box-shadow: 0 0 0
|
|
125
|
+
box-shadow: 0 0 0 1px var(--ui-dp-field-error);
|
|
118
126
|
}
|
|
119
127
|
|
|
120
128
|
.field[data-state="success"]:not([data-invalid="true"]) {
|
|
121
129
|
border-color: color-mix(in srgb, var(--ui-dp-success) 56%, var(--ui-dp-border));
|
|
122
|
-
box-shadow: 0 0 0
|
|
130
|
+
box-shadow: 0 0 0 1px var(--ui-dp-success);
|
|
123
131
|
}
|
|
124
132
|
|
|
125
133
|
.field[data-state="loading"] {
|
|
@@ -147,22 +155,23 @@ const Z = `
|
|
|
147
155
|
border: 0;
|
|
148
156
|
background: transparent;
|
|
149
157
|
color: var(--ui-dp-text);
|
|
150
|
-
padding:
|
|
158
|
+
padding: 0;
|
|
151
159
|
outline: none;
|
|
152
160
|
font: 500 14px/1.4 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
153
161
|
letter-spacing: 0.005em;
|
|
154
162
|
}
|
|
155
163
|
|
|
156
164
|
.input::placeholder {
|
|
157
|
-
color: color-mix(in srgb, var(--ui-dp-text)
|
|
165
|
+
color: var(--ui-color-placeholder, color-mix(in srgb, var(--ui-dp-text) 62%, transparent));
|
|
158
166
|
}
|
|
159
167
|
|
|
160
168
|
.btn {
|
|
161
169
|
border: 0;
|
|
162
170
|
background: transparent;
|
|
163
171
|
color: color-mix(in srgb, var(--ui-dp-text) 74%, transparent);
|
|
164
|
-
inline-size:
|
|
165
|
-
block-size:
|
|
172
|
+
inline-size: var(--ui-dp-action-size, 24px);
|
|
173
|
+
block-size: var(--ui-dp-action-size, 24px);
|
|
174
|
+
margin-block: var(--ui-dp-action-bleed, 0px);
|
|
166
175
|
border-radius: 8px;
|
|
167
176
|
display: inline-grid;
|
|
168
177
|
place-items: center;
|
|
@@ -395,12 +404,12 @@ const Z = `
|
|
|
395
404
|
color-mix(in srgb, var(--ui-color-surface, #ffffff) 98%, transparent),
|
|
396
405
|
color-mix(in srgb, var(--ui-color-surface, #ffffff) 92%, var(--ui-color-surface-alt, #f8fafc))
|
|
397
406
|
);
|
|
398
|
-
--ui-dp-border: color-
|
|
407
|
+
--ui-dp-border: var(--ui-color-line, var(--ui-color-border, #cbd5e1));
|
|
399
408
|
--ui-dp-text: var(--ui-color-text, #0f172a);
|
|
400
409
|
--ui-dp-muted: var(--ui-color-muted, #526175);
|
|
401
410
|
--ui-dp-accent: var(--ui-color-primary, #2563eb);
|
|
402
411
|
--ui-dp-success: var(--ui-color-success, #15803d);
|
|
403
|
-
--ui-dp-radius:
|
|
412
|
+
--ui-dp-radius: var(--ui-control-radius-2, var(--ui-radius, 6px));
|
|
404
413
|
--ui-dp-panel-radius: calc(var(--ui-dp-radius) + 2px);
|
|
405
414
|
--ui-dp-field-error: var(--ui-color-danger, #dc2626);
|
|
406
415
|
--ui-dp-focus-ring: color-mix(in srgb, var(--ui-dp-accent) 26%, transparent);
|
|
@@ -616,8 +625,8 @@ class X extends V {
|
|
|
616
625
|
attributeChangedCallback(e, t, i) {
|
|
617
626
|
if (t !== i) {
|
|
618
627
|
if (e === "value" && !this._syncing && (this._value = this._clampToBounds(g(i)), this._pendingValue = this._value, this._draftInput = this._formatDisplay(this._value), this._inlineError = "", this._syncValueAttribute(this._value)), e === "open" && !this._syncing && (this._open = this.hasAttribute("open"), this._syncOverlay(this._open ? "api" : "outside")), e === "mode" && this._syncOverlay("attribute"), e === "disabled" && this.hasAttribute("disabled") && this._setOpen(!1, "outside"), (e === "min" || e === "max") && !this._syncing) {
|
|
619
|
-
const r = this._clampToBounds(this._value),
|
|
620
|
-
this._value = r, this._pendingValue =
|
|
628
|
+
const r = this._clampToBounds(this._value), s = this._clampToBounds(this._pendingValue);
|
|
629
|
+
this._value = r, this._pendingValue = s, this._draftInput = this._formatDisplay(this._allowInput() ? s : r), this._syncValueAttribute(r);
|
|
621
630
|
}
|
|
622
631
|
if (e === "state" && this._state() === "loading" && this._setOpen(!1, "outside"), !!this.isConnected) {
|
|
623
632
|
if (!this._hasView) {
|
|
@@ -805,14 +814,14 @@ class X extends V {
|
|
|
805
814
|
if (!e || !t) return;
|
|
806
815
|
const i = e.getBoundingClientRect();
|
|
807
816
|
t.style.setProperty("--ui-dp-panel-width", `${Math.round(i.width)}px`);
|
|
808
|
-
const r = t.getBoundingClientRect(),
|
|
817
|
+
const r = t.getBoundingClientRect(), s = t.getAttribute("data-placement"), n = K(
|
|
809
818
|
i,
|
|
810
819
|
r,
|
|
811
820
|
8,
|
|
812
821
|
8,
|
|
813
|
-
|
|
822
|
+
s === "top" ? "top" : s === "bottom" ? "bottom" : null
|
|
814
823
|
);
|
|
815
|
-
t.style.position = "absolute", t.style.top = `${Math.round(
|
|
824
|
+
t.style.position = "absolute", t.style.top = `${Math.round(n.top)}px`, t.style.left = `${Math.round(n.left)}px`, t.setAttribute("data-placement", n.placement);
|
|
816
825
|
}
|
|
817
826
|
_parseAndValidate(e) {
|
|
818
827
|
return W(e, this._locale());
|
|
@@ -823,11 +832,11 @@ class X extends V {
|
|
|
823
832
|
this._value = i, this._pendingValue = i, this._draftInput = this._formatDisplay(i), this._inlineError = "", this._syncValueAttribute(i), this._emitInput(t), this._emitChange(t), this._updateHostState();
|
|
824
833
|
}
|
|
825
834
|
_renderPanelInner(e) {
|
|
826
|
-
const t = this._translations(), i = (this.getAttribute("label") || "").trim(), r = !!i || e,
|
|
835
|
+
const t = this._translations(), i = (this.getAttribute("label") || "").trim(), r = !!i || e, s = !this._closeOnSelect() || e, n = e ? "sheet" : "panel", o = e ? "true" : "false";
|
|
827
836
|
return `
|
|
828
837
|
<style>${Q}</style>
|
|
829
838
|
${e ? '<div class="sheet-backdrop" data-action="backdrop"></div>' : ""}
|
|
830
|
-
<section class="${
|
|
839
|
+
<section class="${n}" id="${this._panelId}" part="${e ? "sheet" : "popover"}" role="dialog" aria-modal="${o}" aria-labelledby="${this._panelTitleId}" aria-label="${v(t.datePickerPanel)}">
|
|
831
840
|
<header class="header" part="header" ${r ? "" : "hidden"}>
|
|
832
841
|
<p class="title" id="${this._panelTitleId}" ${i ? "" : "hidden"}>${v(i)}</p>
|
|
833
842
|
${e ? `<button type="button" class="action" data-action="cancel">${v(t.cancel)}</button>` : ""}
|
|
@@ -836,7 +845,7 @@ class X extends V {
|
|
|
836
845
|
<footer class="footer" part="footer">
|
|
837
846
|
<button type="button" class="action" data-action="today" part="presets">${v(t.today)}</button>
|
|
838
847
|
<button type="button" class="action" data-action="clear" part="clear">${v(t.clear)}</button>
|
|
839
|
-
${
|
|
848
|
+
${s ? `<button type="button" class="action" data-tone="primary" data-action="apply" part="apply">${v(t.apply)}</button>` : ""}
|
|
840
849
|
</footer>
|
|
841
850
|
</section>
|
|
842
851
|
`;
|
|
@@ -850,8 +859,8 @@ class X extends V {
|
|
|
850
859
|
e.getAttribute(a) !== u && e.setAttribute(a, u);
|
|
851
860
|
}, i = (a, u) => {
|
|
852
861
|
u ? e.hasAttribute(a) || e.setAttribute(a, "") : e.hasAttribute(a) && e.removeAttribute(a);
|
|
853
|
-
}, { min: r, max:
|
|
854
|
-
t("selection", "single"), t("value", this._pendingValue), t("min", r), t("max",
|
|
862
|
+
}, { min: r, max: s } = this._resolvedBounds();
|
|
863
|
+
t("selection", "single"), t("value", this._pendingValue), t("min", r), t("max", s), t("locale", this.getAttribute("locale")), t("translations", this.getAttribute("translations")), t("week-start", this.getAttribute("week-start"));
|
|
855
864
|
const o = this.getAttribute("size") || "sm";
|
|
856
865
|
t("size", o === "lg" ? "md" : "sm"), t("variant", this.getAttribute("variant")), t("outside-click", this.getAttribute("outside-click")), t("events", this.getAttribute("events")), t("events-max", this.getAttribute("events-max")), t("events-display", this.getAttribute("events-display"));
|
|
857
866
|
const d = e.classList.contains("inline-calendar");
|
|
@@ -869,19 +878,19 @@ class X extends V {
|
|
|
869
878
|
e && !this._releaseScrollLock ? this._releaseScrollLock = E() : !e && this._releaseScrollLock && (this._releaseScrollLock(), this._releaseScrollLock = null), this._ensureOverlayContent(e);
|
|
870
879
|
const t = this._overlay.querySelector(".title"), i = this._overlay.querySelector(".panel, .sheet");
|
|
871
880
|
this._syncDismissableLayer();
|
|
872
|
-
const r = this._overlay.querySelector(".header"),
|
|
873
|
-
if (i && (i.dataset.bare = this._isBare() ? "true" : "false"),
|
|
881
|
+
const r = this._overlay.querySelector(".header"), s = this._overlay.querySelector(".footer"), n = this._translations();
|
|
882
|
+
if (i && (i.dataset.bare = this._isBare() ? "true" : "false"), s && (s.hidden = !this._showFooter()), r && (r.hidden = !(this.getAttribute("label") || "").trim() && !e), t) {
|
|
874
883
|
const c = (this.getAttribute("label") || "").trim();
|
|
875
884
|
t.textContent = c, t.hidden = !c;
|
|
876
885
|
}
|
|
877
886
|
const o = this._overlay.querySelector('[data-action="today"]');
|
|
878
|
-
o && (o.textContent =
|
|
887
|
+
o && (o.textContent = n.today);
|
|
879
888
|
const d = this._overlay.querySelector('[data-action="clear"]');
|
|
880
|
-
d && (d.textContent =
|
|
889
|
+
d && (d.textContent = n.clear);
|
|
881
890
|
const a = this._overlay.querySelector('[data-action="cancel"]');
|
|
882
|
-
a && (a.textContent =
|
|
891
|
+
a && (a.textContent = n.cancel);
|
|
883
892
|
const u = this._overlay.querySelector('[data-action="apply"]');
|
|
884
|
-
u && (u.textContent =
|
|
893
|
+
u && (u.textContent = n.apply);
|
|
885
894
|
const m = this._overlay.querySelector('[data-action="apply"]');
|
|
886
895
|
m && (m.hidden = this._closeOnSelect() && !e);
|
|
887
896
|
const h = this._overlay.querySelectorAll(".action"), x = this._isInteractionBlocked();
|
|
@@ -948,9 +957,9 @@ class X extends V {
|
|
|
948
957
|
}
|
|
949
958
|
if (r === "today") {
|
|
950
959
|
e.preventDefault();
|
|
951
|
-
const
|
|
952
|
-
if (!
|
|
953
|
-
const { min: o, max: d } = this._resolvedBounds(), a = O(
|
|
960
|
+
const s = this._todayIso(), n = this._parseAndValidate(s);
|
|
961
|
+
if (!n) return;
|
|
962
|
+
const { min: o, max: d } = this._resolvedBounds(), a = O(n, o, d);
|
|
954
963
|
if (!a) return;
|
|
955
964
|
this._pendingValue = a, this._emitInput("today"), this._closeOnSelect() && !this._isInlineMode() ? (this._commit(a, "today"), this._setOpen(!1, "today")) : this._updateHostState();
|
|
956
965
|
return;
|
|
@@ -1011,9 +1020,9 @@ class X extends V {
|
|
|
1011
1020
|
return;
|
|
1012
1021
|
}
|
|
1013
1022
|
if (r === "today") {
|
|
1014
|
-
const
|
|
1015
|
-
if (!
|
|
1016
|
-
const { min:
|
|
1023
|
+
const s = this._parseAndValidate(this._todayIso());
|
|
1024
|
+
if (!s) return;
|
|
1025
|
+
const { min: n, max: o } = this._resolvedBounds(), d = O(s, n, o);
|
|
1017
1026
|
if (!d) return;
|
|
1018
1027
|
this._pendingValue = d, this._emitInput("today"), this._closeOnSelect() ? (this._commit(d, "today"), this._setOpen(!1, "today")) : this._renderOverlay();
|
|
1019
1028
|
return;
|
|
@@ -1037,21 +1046,21 @@ class X extends V {
|
|
|
1037
1046
|
if (t.type === "select")
|
|
1038
1047
|
r = g(t.detail?.value || null);
|
|
1039
1048
|
else if (t.type === "change") {
|
|
1040
|
-
const
|
|
1041
|
-
typeof
|
|
1049
|
+
const n = t.detail?.value;
|
|
1050
|
+
typeof n == "string" && (r = g(n));
|
|
1042
1051
|
}
|
|
1043
1052
|
if (!r) return;
|
|
1044
|
-
const
|
|
1045
|
-
|
|
1053
|
+
const s = this._clampToBounds(r);
|
|
1054
|
+
s && (this._pendingValue = s, this._emitInput("calendar"), this._closeOnSelect() ? (this._commit(s, "calendar"), this._isInlineMode() || this._setOpen(!1, "calendar")) : this._updateHostState());
|
|
1046
1055
|
}
|
|
1047
1056
|
_updateHostState() {
|
|
1048
1057
|
if (!this._hasView) return;
|
|
1049
|
-
const e = this.getAttribute("label") || "", t = this.getAttribute("hint") || "", i = this.getAttribute("error") || "", r = this._inlineError || i,
|
|
1050
|
-
if (h && (h.hidden = !e, h.id = this._labelId, h.setAttribute("for", this._inputId)), x && (x.textContent = e), f && (f.hidden = !this.hasAttribute("required")), c && (c.dataset.invalid = r ? "true" : "false", c.dataset.open = this._open && !a ? "true" : "false", c.dataset.state = u, c.setAttribute("aria-disabled", this._isInteractionBlocked() ? "true" : "false")), l && (l.value !== m && (l.value = m), l.id = this._inputId, l.placeholder =
|
|
1058
|
+
const e = this.getAttribute("label") || "", t = this.getAttribute("hint") || "", i = this.getAttribute("error") || "", r = this._inlineError || i, s = this._placeholder(), n = this._translations(), o = !!(this._value || this._pendingValue), d = this.getAttribute("name") || "", a = this._isInlineMode(), u = r ? "error" : this._state(), m = this._allowInput() ? this._draftInput : this._formatDisplay(this._pendingValue || this._value), h = this.root.querySelector(".label"), x = this.root.querySelector(".label-text"), f = this.root.querySelector(".required"), c = this.root.querySelector(".field"), l = this.root.querySelector(".input"), I = this.root.querySelector('.btn[data-action="clear"]'), _ = this.root.querySelector('.btn[data-action="toggle"]'), b = this.root.querySelector(".hint"), k = this.root.querySelector(".error"), w = this.root.querySelector(".hidden-input"), p = this.root.querySelector(".inline-panel"), B = this.root.querySelector('.inline-panel [data-action="today"]'), D = this.root.querySelector('.inline-panel [data-action="clear"]'), z = this.root.querySelector('.inline-panel [data-action="apply"]'), P = this.root.querySelector(".inline-panel .footer");
|
|
1059
|
+
if (h && (h.hidden = !e, h.id = this._labelId, h.setAttribute("for", this._inputId)), x && (x.textContent = e), f && (f.hidden = !this.hasAttribute("required")), c && (c.dataset.invalid = r ? "true" : "false", c.dataset.open = this._open && !a ? "true" : "false", c.dataset.state = u, c.setAttribute("aria-disabled", this._isInteractionBlocked() ? "true" : "false")), l && (l.value !== m && (l.value = m), l.id = this._inputId, l.placeholder = s, l.readOnly = !this._allowInput() || this._isReadonly(), l.disabled = this._isInteractionBlocked(), l.required = this.hasAttribute("required"), l.autocomplete = "off", l.setAttribute("role", "combobox"), l.setAttribute("aria-haspopup", "dialog"), l.setAttribute("aria-expanded", a ? "false" : String(this._open)), l.setAttribute("aria-controls", this._panelId), l.setAttribute("aria-invalid", r ? "true" : "false"), q(l, this, e ? this._labelId : null, s)), I && (I.hidden = !(this._clearable() && o), I.disabled = this._isInteractionBlocked(), I.setAttribute("aria-label", n.clearDate)), _ && (_.hidden = a, _.disabled = this._isInteractionBlocked(), _.setAttribute("aria-expanded", a ? "false" : String(this._open)), _.setAttribute("aria-controls", this._panelId), _.setAttribute("aria-label", n.toggleCalendar)), b && (b.id = this._hintId, b.hidden = !t, b.textContent = t), k && (k.id = this._errorId, k.hidden = !r, k.textContent = r), l) {
|
|
1051
1060
|
const A = [];
|
|
1052
1061
|
t && b && !b.hidden && A.push(this._hintId), r && A.push(this._errorId), M(l, this, this._uid, A);
|
|
1053
1062
|
}
|
|
1054
|
-
if (w && (w.disabled = !d, w.name = d, w.value = this._value || ""), p && (p.hidden = !a, p.id = this._panelId, p.dataset.bare = this._isBare() ? "true" : "false", p.setAttribute("role", "dialog"), p.setAttribute("aria-modal", "false"), p.setAttribute("aria-label", e ||
|
|
1063
|
+
if (w && (w.disabled = !d, w.name = d, w.value = this._value || ""), p && (p.hidden = !a, p.id = this._panelId, p.dataset.bare = this._isBare() ? "true" : "false", p.setAttribute("role", "dialog"), p.setAttribute("aria-modal", "false"), p.setAttribute("aria-label", e || n.selectDate)), P && (P.hidden = !this._showFooter()), B && (B.textContent = n.today), D && (D.textContent = n.clear), z && (z.textContent = n.apply), a) {
|
|
1055
1064
|
this._scheduleInlineCalendarSync(), this._destroyOverlay();
|
|
1056
1065
|
return;
|
|
1057
1066
|
}
|