@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/radio.cjs.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("./ElementBase-DxbvhLJs.js"),u=`
|
|
2
2
|
:host {
|
|
3
|
-
--ui-radio-size:
|
|
3
|
+
--ui-radio-size: 16px;
|
|
4
4
|
--ui-radio-hit-area: 24px;
|
|
5
|
-
--ui-radio-dot-size:
|
|
6
|
-
--ui-radio-border:
|
|
7
|
-
--ui-radio-background: var(--ui-bg, var(--ui-color-surface, #ffffff));
|
|
5
|
+
--ui-radio-dot-size: 6px;
|
|
6
|
+
--ui-radio-border: 1px solid var(--ui-color-line-strong, var(--ui-color-border, #cbd5e1));
|
|
7
|
+
--ui-radio-background: var(--ui-bg, var(--color-panel-solid, var(--ui-color-surface, #ffffff)));
|
|
8
8
|
--ui-radio-accent: var(--ui-primary, var(--ui-color-primary, #2563eb));
|
|
9
|
-
--ui-radio-dot-color: var(--ui-
|
|
10
|
-
--ui-radio-focus: 0 0 0
|
|
9
|
+
--ui-radio-dot-color: var(--ui-color-foreground-on-primary, #ffffff);
|
|
10
|
+
--ui-radio-focus: 0 0 0 2px var(--ui-color-background, #ffffff), 0 0 0 4px var(--ui-ring-color, var(--ui-color-focus-ring, #2563eb));
|
|
11
11
|
--ui-radio-invalid: var(--ui-color-danger, #dc2626);
|
|
12
|
-
--ui-radio-invalid-focus: 0 0 0
|
|
12
|
+
--ui-radio-invalid-focus: 0 0 0 2px var(--ui-color-background, #ffffff), 0 0 0 4px var(--ui-radio-invalid);
|
|
13
13
|
--ui-radio-disabled-bg: color-mix(in srgb, var(--ui-color-surface-alt, #f1f5f9) 88%, #ffffff 12%);
|
|
14
|
-
--ui-radio-disabled-border:
|
|
14
|
+
--ui-radio-disabled-border: 1px solid var(--ui-color-line, var(--ui-color-border, #cbd5e1));
|
|
15
15
|
--ui-radio-label-color: var(--ui-color-text, var(--ui-text, #0f172a));
|
|
16
16
|
--ui-radio-muted: var(--ui-color-muted, #526175);
|
|
17
17
|
--ui-radio-duration: 170ms;
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
|
|
131
131
|
:host([checked]) .control {
|
|
132
132
|
border-color: var(--ui-radio-accent);
|
|
133
|
-
background:
|
|
133
|
+
background: var(--ui-radio-accent);
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
:host([checked]) .control::before {
|
|
@@ -146,9 +146,12 @@
|
|
|
146
146
|
box-shadow: var(--ui-radio-focus);
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
:host(:not([disabled]):not([loading]):hover) .control {
|
|
150
|
-
|
|
151
|
-
|
|
149
|
+
:host(:not([disabled]):not([loading]):not([checked]):hover) .control {
|
|
150
|
+
border-color: var(--ui-color-text-secondary, #64748b);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
:host(:not([disabled]):not([loading])[checked]:hover) .control {
|
|
154
|
+
background: color-mix(in srgb, var(--ui-radio-accent) 88%, var(--ui-color-text-strong, #0f172a));
|
|
152
155
|
}
|
|
153
156
|
|
|
154
157
|
:host(:not([disabled]):not([loading]):active) .control {
|
package/dist/radio.esm.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { E as l } from "./ElementBase-BeZT54Hj.mjs";
|
|
2
2
|
const u = `
|
|
3
3
|
:host {
|
|
4
|
-
--ui-radio-size:
|
|
4
|
+
--ui-radio-size: 16px;
|
|
5
5
|
--ui-radio-hit-area: 24px;
|
|
6
|
-
--ui-radio-dot-size:
|
|
7
|
-
--ui-radio-border:
|
|
8
|
-
--ui-radio-background: var(--ui-bg, var(--ui-color-surface, #ffffff));
|
|
6
|
+
--ui-radio-dot-size: 6px;
|
|
7
|
+
--ui-radio-border: 1px solid var(--ui-color-line-strong, var(--ui-color-border, #cbd5e1));
|
|
8
|
+
--ui-radio-background: var(--ui-bg, var(--color-panel-solid, var(--ui-color-surface, #ffffff)));
|
|
9
9
|
--ui-radio-accent: var(--ui-primary, var(--ui-color-primary, #2563eb));
|
|
10
|
-
--ui-radio-dot-color: var(--ui-
|
|
11
|
-
--ui-radio-focus: 0 0 0
|
|
10
|
+
--ui-radio-dot-color: var(--ui-color-foreground-on-primary, #ffffff);
|
|
11
|
+
--ui-radio-focus: 0 0 0 2px var(--ui-color-background, #ffffff), 0 0 0 4px var(--ui-ring-color, var(--ui-color-focus-ring, #2563eb));
|
|
12
12
|
--ui-radio-invalid: var(--ui-color-danger, #dc2626);
|
|
13
|
-
--ui-radio-invalid-focus: 0 0 0
|
|
13
|
+
--ui-radio-invalid-focus: 0 0 0 2px var(--ui-color-background, #ffffff), 0 0 0 4px var(--ui-radio-invalid);
|
|
14
14
|
--ui-radio-disabled-bg: color-mix(in srgb, var(--ui-color-surface-alt, #f1f5f9) 88%, #ffffff 12%);
|
|
15
|
-
--ui-radio-disabled-border:
|
|
15
|
+
--ui-radio-disabled-border: 1px solid var(--ui-color-line, var(--ui-color-border, #cbd5e1));
|
|
16
16
|
--ui-radio-label-color: var(--ui-color-text, var(--ui-text, #0f172a));
|
|
17
17
|
--ui-radio-muted: var(--ui-color-muted, #526175);
|
|
18
18
|
--ui-radio-duration: 170ms;
|
|
@@ -131,7 +131,7 @@ const u = `
|
|
|
131
131
|
|
|
132
132
|
:host([checked]) .control {
|
|
133
133
|
border-color: var(--ui-radio-accent);
|
|
134
|
-
background:
|
|
134
|
+
background: var(--ui-radio-accent);
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
:host([checked]) .control::before {
|
|
@@ -147,9 +147,12 @@ const u = `
|
|
|
147
147
|
box-shadow: var(--ui-radio-focus);
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
:host(:not([disabled]):not([loading]):hover) .control {
|
|
151
|
-
|
|
152
|
-
|
|
150
|
+
:host(:not([disabled]):not([loading]):not([checked]):hover) .control {
|
|
151
|
+
border-color: var(--ui-color-text-secondary, #64748b);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
:host(:not([disabled]):not([loading])[checked]:hover) .control {
|
|
155
|
+
background: color-mix(in srgb, var(--ui-radio-accent) 88%, var(--ui-color-text-strong, #0f172a));
|
|
153
156
|
}
|
|
154
157
|
|
|
155
158
|
:host(:not([disabled]):not([loading]):active) .control {
|
package/dist/rating.cjs.js
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
--ui-rating-size: var(--ui-control-size, var(--ui-font-size-lg, 20px));
|
|
4
4
|
--ui-rating-gap: var(--ui-control-gap, 6px);
|
|
5
5
|
--ui-rating-color: var(--ui-color-warning, #f59e0b);
|
|
6
|
-
--ui-rating-color-empty: var(--ui-color-
|
|
6
|
+
--ui-rating-color-empty: var(--ui-color-line-strong, #cbd5e1);
|
|
7
7
|
--ui-rating-color-hover: color-mix(in srgb, var(--ui-rating-color) 86%, #ffffff);
|
|
8
8
|
--ui-rating-color-active: color-mix(in srgb, var(--ui-rating-color) 92%, #ffffff);
|
|
9
|
-
--ui-rating-color-disabled: color-mix(in srgb, var(--ui-color-
|
|
10
|
-
--ui-rating-shadow:
|
|
9
|
+
--ui-rating-color-disabled: color-mix(in srgb, var(--ui-color-line-strong, #cbd5e1) 70%, transparent);
|
|
10
|
+
--ui-rating-shadow: none;
|
|
11
11
|
--ui-rating-duration: var(--ui-motion-base, 160ms);
|
|
12
12
|
--ui-rating-easing: var(--ui-motion-easing, cubic-bezier(0.2, 0.8, 0.2, 1));
|
|
13
|
-
--ui-rating-radius: var(--ui-control-radius, var(--ui-radius,
|
|
13
|
+
--ui-rating-radius: var(--ui-control-radius, var(--ui-radius, 6px));
|
|
14
14
|
display: inline-flex;
|
|
15
15
|
flex-wrap: wrap;
|
|
16
16
|
max-inline-size: 100%;
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
:host([variant="minimal"]) {
|
|
79
79
|
--ui-rating-shadow: none;
|
|
80
80
|
--ui-rating-color: color-mix(in srgb, var(--ui-rating-color) 70%, #ffffff);
|
|
81
|
-
--ui-rating-color-empty: color-mix(in srgb, var(--ui-color-
|
|
81
|
+
--ui-rating-color-empty: color-mix(in srgb, var(--ui-color-line-strong, #cbd5e1) 60%, transparent);
|
|
82
82
|
--ui-rating-color-hover: color-mix(in srgb, var(--ui-rating-color) 80%, #ffffff);
|
|
83
83
|
--ui-rating-color-active: color-mix(in srgb, var(--ui-rating-color) 85%, #ffffff);
|
|
84
84
|
}
|
|
@@ -244,12 +244,8 @@
|
|
|
244
244
|
transition: opacity 140ms var(--ui-rating-easing);
|
|
245
245
|
}
|
|
246
246
|
|
|
247
|
-
.star:hover::after {
|
|
248
|
-
opacity: 0.08;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
247
|
.star:active::after {
|
|
252
|
-
opacity: 0.
|
|
248
|
+
opacity: 0.08;
|
|
253
249
|
}
|
|
254
250
|
|
|
255
251
|
.label {
|
|
@@ -317,11 +313,11 @@
|
|
|
317
313
|
forced-color-adjust: auto;
|
|
318
314
|
}
|
|
319
315
|
}
|
|
320
|
-
`;function x(i){return i!==null&&i.toLowerCase()!=="false"&&i!=="0"}function $(i){return i==="soft"||i==="glass"||i==="contrast"||i==="minimal"?i:"default"}function N(i){return i==="sm"||i==="lg"?i:"md"}function T(i){return i==="square"||i==="pill"?i:"rounded"}function I(i){return i==="neutral"||i==="info"||i==="success"||i==="warning"||i==="danger"?i:null}function q(i){return i==="hover"||i==="focus"||i==="disabled"?i:"idle"}function y(i){return i==="scale"||i==="pulse"||i==="none"?i:null}function
|
|
316
|
+
`;function x(i){return i!==null&&i.toLowerCase()!=="false"&&i!=="0"}function $(i){return i==="soft"||i==="glass"||i==="contrast"||i==="minimal"?i:"default"}function N(i){return i==="sm"||i==="lg"?i:"md"}function T(i){return i==="square"||i==="pill"?i:"rounded"}function I(i){return i==="neutral"||i==="info"||i==="success"||i==="warning"||i==="danger"?i:null}function q(i){return i==="hover"||i==="focus"||i==="disabled"?i:"idle"}function y(i){return i==="scale"||i==="pulse"||i==="none"?i:null}function D(i){if(!i)return null;const t=i.trim();return t?t==="full"?"999px":/^-?\\d+(\\.\\d+)?$/.test(t)?`${t}px`:t:null}function A(i){const t=Number(i);return!Number.isFinite(t)||t<=0?1:t===.5?.5:1}function l(i,t,e){return Math.min(e,Math.max(t,i))}function h(i,t){const e=Math.round(i/t)*t;return Number(e.toFixed(2))}function a(i,t){const e=i.getAttribute(t);if(e!=null)return e;const r=i[t];return typeof r=="string"&&r.length>0?r:null}function g(i,t){const e=i.getAttribute(t);if(e!=null)return x(e);const r=i[t];return typeof r=="boolean"?r:typeof r=="string"?x(r):!1}function w(i){return i.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function z(i){return`
|
|
321
317
|
<svg viewBox="0 0 24 24" aria-hidden="true"${i?` class="${i}"`:""}>
|
|
322
318
|
<path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"></path>
|
|
323
319
|
</svg>
|
|
324
|
-
`}class k extends V.ElementBase{constructor(){super(),this._autoAriaLabel=!1,this._stars=[],this._value=0,this._max=5,this._precision=1,this._disabled=!1,this._readonly=!1,this._hoverValue=0,this._onRootClick=this._onRootClick.bind(this),this._onRootMouseMove=this._onRootMouseMove.bind(this),this._onRootMouseLeave=this._onRootMouseLeave.bind(this),this._onRootFocusIn=this._onRootFocusIn.bind(this),this._onRootFocusOut=this._onRootFocusOut.bind(this),this._onRootKeyDown=this._onRootKeyDown.bind(this)}static get observedAttributes(){return["value","max","precision","disabled","readonly","variant","size","headless","theme","tone","state","animation","shape","radius","aria-label","aria-labelledby","aria-describedby","label","show-value"]}connectedCallback(){super.connectedCallback(),this.root.addEventListener("click",this._onRootClick,!0),this.root.addEventListener("mousemove",this._onRootMouseMove,!0),this.root.addEventListener("mouseleave",this._onRootMouseLeave,!0),this.root.addEventListener("focusin",this._onRootFocusIn,!0),this.root.addEventListener("focusout",this._onRootFocusOut,!0),this.root.addEventListener("keydown",this._onRootKeyDown,!0)}disconnectedCallback(){this.root.removeEventListener("click",this._onRootClick,!0),this.root.removeEventListener("mousemove",this._onRootMouseMove,!0),this.root.removeEventListener("mouseleave",this._onRootMouseLeave,!0),this.root.removeEventListener("focusin",this._onRootFocusIn,!0),this.root.removeEventListener("focusout",this._onRootFocusOut,!0),this.root.removeEventListener("keydown",this._onRootKeyDown,!0),super.disconnectedCallback()}attributeChangedCallback(t,e,r){if(e!==r){if(t==="value"){const s=Number(r);Number.isFinite(s)&&(this._value=
|
|
320
|
+
`}class k extends V.ElementBase{constructor(){super(),this._autoAriaLabel=!1,this._stars=[],this._value=0,this._max=5,this._precision=1,this._disabled=!1,this._readonly=!1,this._hoverValue=0,this._onHostKeyDown=t=>{t.composedPath()[0]===this&&this._onRootKeyDown(t,!0)},this._onRootClick=this._onRootClick.bind(this),this._onRootMouseMove=this._onRootMouseMove.bind(this),this._onRootMouseLeave=this._onRootMouseLeave.bind(this),this._onRootFocusIn=this._onRootFocusIn.bind(this),this._onRootFocusOut=this._onRootFocusOut.bind(this),this._onRootKeyDown=this._onRootKeyDown.bind(this)}static get observedAttributes(){return["value","max","precision","disabled","readonly","variant","size","headless","theme","tone","state","animation","shape","radius","aria-label","aria-labelledby","aria-describedby","label","show-value"]}connectedCallback(){super.connectedCallback(),this.root.addEventListener("click",this._onRootClick,!0),this.root.addEventListener("mousemove",this._onRootMouseMove,!0),this.root.addEventListener("mouseleave",this._onRootMouseLeave,!0),this.root.addEventListener("focusin",this._onRootFocusIn,!0),this.root.addEventListener("focusout",this._onRootFocusOut,!0),this.root.addEventListener("keydown",this._onRootKeyDown,!0),this.addEventListener("keydown",this._onHostKeyDown)}disconnectedCallback(){this.root.removeEventListener("click",this._onRootClick,!0),this.root.removeEventListener("mousemove",this._onRootMouseMove,!0),this.root.removeEventListener("mouseleave",this._onRootMouseLeave,!0),this.root.removeEventListener("focusin",this._onRootFocusIn,!0),this.root.removeEventListener("focusout",this._onRootFocusOut,!0),this.root.removeEventListener("keydown",this._onRootKeyDown,!0),this.removeEventListener("keydown",this._onHostKeyDown),super.disconnectedCallback()}attributeChangedCallback(t,e,r){if(e!==r){if(t==="value"){const s=Number(r);Number.isFinite(s)&&(this._value=l(h(s,this._precision),0,this._max),this._syncStars(),this._syncAria())}if(t==="max"){const s=Number(r);Number.isFinite(s)&&s>0&&(this._max=Math.max(1,s),this._value>this._max&&(this._value=this._max),this._syncStars(),this._syncAria())}if(t==="precision"&&(this._precision=A(r),this._value=l(h(this._value,this._precision),0,this._max),this._hoverValue=this._hoverValue>0?l(h(this._hoverValue,this._precision),0,this._max):0,this._syncStars(),this._syncAria()),t==="disabled"&&(this._disabled=r!==null),t==="readonly"&&(this._readonly=r!==null),t==="animation"){const s=y(r);s?this.setAttribute("data-animation",s):this.removeAttribute("data-animation")}this.isConnected&&this.requestRender()}}get value(){return this._value}set value(t){const e=Number(t);if(!Number.isFinite(e))return;const r=l(h(e,this._precision),0,this._max);this._value!==r&&(this._value=r,this.setAttribute("value",String(this._value)),this._syncStars(),this._syncAria(),this._emit("change"),this._emit("input"))}get max(){return this._max}set max(t){const e=Number(t);Number.isFinite(e)&&(this._max=Math.max(1,e),this.setAttribute("max",String(this._max)),this._value>this._max&&(this._value=this._max,this.setAttribute("value",String(this._value))),this.requestRender())}get precision(){return this._precision}set precision(t){this._precision=t===.5?.5:1,this.setAttribute("precision",String(this._precision)),this._value=l(h(this._value,this._precision),0,this._max),this.requestRender()}get disabled(){return this._disabled}set disabled(t){this._disabled=!!t,this._disabled?this.setAttribute("disabled",""):this.removeAttribute("disabled"),this.requestRender()}get readonly(){return this._readonly}set readonly(t){this._readonly=!!t,this._readonly?this.setAttribute("readonly",""):this.removeAttribute("readonly"),this.requestRender()}_getStarFromEventTarget(t){return t instanceof Element?t.closest(".star"):null}_getStarIndex(t){if(!t)return-1;const e=Number(t.dataset.index);return Number.isFinite(e)?e:-1}_getValueFromPointer(t,e){const r=this._getStarIndex(e);if(r===-1)return this._value;if(this._precision!==.5)return r+1;const s=e.getBoundingClientRect(),n=t.clientX-s.left<=s.width/2?.5:1;return r+n}_formatValue(t){return Number.isInteger(t)?String(t):t.toFixed(1)}_getAriaValueText(t){return`${this._formatValue(t)} out of ${this._max}`}_onRootClick(t){if(this._disabled||this._readonly)return;const e=t,r=this._getStarFromEventTarget(e.target);r&&(this.value=this._getValueFromPointer(e,r))}_onRootMouseMove(t){if(this._disabled||this._readonly)return;const e=t,r=this._getStarFromEventTarget(e.target);r&&(this._hoverValue=this._getValueFromPointer(e,r),this.setAttribute("state","hover"),this._syncStars())}_onRootMouseLeave(){this._disabled||this._readonly||(this._hoverValue=0,this.removeAttribute("state"),this._syncStars())}_onRootFocusIn(t){if(this._disabled||this._readonly)return;const e=this._getStarFromEventTarget(t.target),r=this._getStarIndex(e);r!==-1&&(this._hoverValue=r+1,this.setAttribute("state","focus"),this._syncStars())}_onRootFocusOut(){this._disabled||this._readonly||(this._hoverValue=0,this.removeAttribute("state"),this._syncStars())}_onRootKeyDown(t,e=!1){if(this._disabled||this._readonly)return;const r=t,s=this._getStarFromEventTarget(r.target),o=e?Math.max(0,Math.ceil(this._value)-1):this._getStarIndex(s);if(o===-1)return;let n=this._value;const u=this._precision;switch(r.key){case"ArrowRight":case"ArrowUp":case"+":n=l(this._value+u,0,this._max);break;case"ArrowLeft":case"ArrowDown":case"-":n=l(this._value-u,0,this._max);break;case"Home":n=0;break;case"End":n=this._max;break;case" ":case"Enter":n=o+1;break;default:return}r.preventDefault(),this.value=n}_getFillPercent(t,e){const r=e-(t-1);return r>=1?100:r<=0?0:r*100}_syncStars(){const t=this._hoverValue>0?this._hoverValue:this._value;this._stars.forEach((e,r)=>{const s=r+1,o=this._getFillPercent(s,t);if(e.style.setProperty("--fill-percent",`${o}%`),this._disabled){e.setAttribute("data-state","disabled"),e.setAttribute("aria-disabled","true");return}if(e.removeAttribute("aria-disabled"),this._hoverValue>0){o>0?e.setAttribute("data-state","hover"):e.removeAttribute("data-state");return}o>0?e.setAttribute("data-state","active"):e.removeAttribute("data-state")}),this._syncAria()}_syncAria(){const t=this._getAriaValueText(this._value);this.setAttribute("role","slider"),this.setAttribute("tabindex",this._disabled||this._readonly?"-1":"0"),this.setAttribute("aria-valuemin","0"),this.setAttribute("aria-valuemax",String(this._max)),this.setAttribute("aria-valuenow",String(this._value)),this.setAttribute("aria-valuetext",t),this.setAttribute("aria-orientation","horizontal"),this.setAttribute("aria-disabled",this._disabled?"true":"false"),this.setAttribute("aria-readonly",this._readonly?"true":"false"),this._stars.forEach((e,r)=>{const s=r+1,o=this._getFillPercent(s,this._hoverValue>0?this._hoverValue:this._value);e.setAttribute("aria-hidden","true"),e.setAttribute("data-fill",String(o)),e.setAttribute("data-star-value",String(s))})}_emit(t){this.dispatchEvent(new CustomEvent(t,{detail:{value:this._value,max:this._max,precision:this._precision,disabled:this._disabled,readonly:this._readonly},bubbles:!0,composed:!0}))}render(){const t=g(this,"disabled"),e=g(this,"readonly"),r=$(a(this,"variant")),s=N(a(this,"size")),o=a(this,"theme"),n=I(a(this,"tone")),u=q(a(this,"state")),m=y(a(this,"animation")),d=T(a(this,"shape")),v=D(a(this,"radius")),R=A(a(this,"precision")),_=this._autoAriaLabel?null:a(this,"aria-label"),f=a(this,"aria-labelledby"),p=a(this,"aria-describedby"),c=a(this,"label"),b=g(this,"show-value"),S=a(this,"value"),E=a(this,"max");this._max=Math.max(1,Number(E)||5),this._precision=R,this._value=l(h(Number(S)||0,this._precision),0,this._max),this._disabled=t,this._readonly=e,m?this.setAttribute("data-animation",m):this.removeAttribute("data-animation"),o==="dark"||o==="brand"?this.setAttribute("theme",o):this.removeAttribute("theme"),n?this.setAttribute("tone",n):this.removeAttribute("tone"),u==="disabled"?this.setAttribute("state","disabled"):u!=="idle"?this.setAttribute("state",u):this.removeAttribute("state"),d==="square"||d==="pill"?this.setAttribute("shape",d):this.removeAttribute("shape"),r==="default"?this.removeAttribute("variant"):this.setAttribute("variant",r),s==="md"?this.removeAttribute("size"):this.setAttribute("size",s),v?this.style.setProperty("--ui-rating-radius",v):this.style.removeProperty("--ui-rating-radius"),this.setAttribute("precision",String(this._precision));const F=Array.from({length:this._max},(P,M)=>`
|
|
325
321
|
<span
|
|
326
322
|
class="star"
|
|
327
323
|
aria-hidden="true"
|
|
@@ -347,10 +343,10 @@
|
|
|
347
343
|
>
|
|
348
344
|
${F}
|
|
349
345
|
</div>
|
|
350
|
-
${
|
|
346
|
+
${c||b?`
|
|
351
347
|
<div class="label" part="label">
|
|
352
|
-
${
|
|
348
|
+
${c?`<span class="label-text">${w(c)}</span>`:""}
|
|
353
349
|
${b?`<span class="value">${w(L)}</span>`:""}
|
|
354
350
|
</div>
|
|
355
351
|
`:""}
|
|
356
|
-
`),queueMicrotask(()=>{this._stars=Array.from(this.root.querySelectorAll(".star")),this._syncStars()}),this._autoAriaLabel=!1,
|
|
352
|
+
`),queueMicrotask(()=>{this._stars=Array.from(this.root.querySelectorAll(".star")),this._syncStars()}),this._autoAriaLabel=!1,_?this.setAttribute("aria-label",_):f?this.removeAttribute("aria-label"):(this.setAttribute("aria-label",(c||"").trim()||"Rating"),this._autoAriaLabel=!0),f?this.setAttribute("aria-labelledby",f):this.removeAttribute("aria-labelledby"),p?this.setAttribute("aria-describedby",p):this.removeAttribute("aria-describedby"),this._disabled?this.setAttribute("disabled",""):this.removeAttribute("disabled"),this._readonly?this.setAttribute("readonly",""):this.removeAttribute("readonly"),this._syncAria()}}typeof customElements<"u"&&!customElements.get("ui-rating")&&customElements.define("ui-rating",k);exports.UIRating=k;
|
package/dist/rating.esm.js
CHANGED
|
@@ -4,14 +4,14 @@ const V = `
|
|
|
4
4
|
--ui-rating-size: var(--ui-control-size, var(--ui-font-size-lg, 20px));
|
|
5
5
|
--ui-rating-gap: var(--ui-control-gap, 6px);
|
|
6
6
|
--ui-rating-color: var(--ui-color-warning, #f59e0b);
|
|
7
|
-
--ui-rating-color-empty: var(--ui-color-
|
|
7
|
+
--ui-rating-color-empty: var(--ui-color-line-strong, #cbd5e1);
|
|
8
8
|
--ui-rating-color-hover: color-mix(in srgb, var(--ui-rating-color) 86%, #ffffff);
|
|
9
9
|
--ui-rating-color-active: color-mix(in srgb, var(--ui-rating-color) 92%, #ffffff);
|
|
10
|
-
--ui-rating-color-disabled: color-mix(in srgb, var(--ui-color-
|
|
11
|
-
--ui-rating-shadow:
|
|
10
|
+
--ui-rating-color-disabled: color-mix(in srgb, var(--ui-color-line-strong, #cbd5e1) 70%, transparent);
|
|
11
|
+
--ui-rating-shadow: none;
|
|
12
12
|
--ui-rating-duration: var(--ui-motion-base, 160ms);
|
|
13
13
|
--ui-rating-easing: var(--ui-motion-easing, cubic-bezier(0.2, 0.8, 0.2, 1));
|
|
14
|
-
--ui-rating-radius: var(--ui-control-radius, var(--ui-radius,
|
|
14
|
+
--ui-rating-radius: var(--ui-control-radius, var(--ui-radius, 6px));
|
|
15
15
|
display: inline-flex;
|
|
16
16
|
flex-wrap: wrap;
|
|
17
17
|
max-inline-size: 100%;
|
|
@@ -79,7 +79,7 @@ const V = `
|
|
|
79
79
|
:host([variant="minimal"]) {
|
|
80
80
|
--ui-rating-shadow: none;
|
|
81
81
|
--ui-rating-color: color-mix(in srgb, var(--ui-rating-color) 70%, #ffffff);
|
|
82
|
-
--ui-rating-color-empty: color-mix(in srgb, var(--ui-color-
|
|
82
|
+
--ui-rating-color-empty: color-mix(in srgb, var(--ui-color-line-strong, #cbd5e1) 60%, transparent);
|
|
83
83
|
--ui-rating-color-hover: color-mix(in srgb, var(--ui-rating-color) 80%, #ffffff);
|
|
84
84
|
--ui-rating-color-active: color-mix(in srgb, var(--ui-rating-color) 85%, #ffffff);
|
|
85
85
|
}
|
|
@@ -245,12 +245,8 @@ const V = `
|
|
|
245
245
|
transition: opacity 140ms var(--ui-rating-easing);
|
|
246
246
|
}
|
|
247
247
|
|
|
248
|
-
.star:hover::after {
|
|
249
|
-
opacity: 0.08;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
248
|
.star:active::after {
|
|
253
|
-
opacity: 0.
|
|
249
|
+
opacity: 0.08;
|
|
254
250
|
}
|
|
255
251
|
|
|
256
252
|
.label {
|
|
@@ -340,7 +336,7 @@ function I(i) {
|
|
|
340
336
|
function y(i) {
|
|
341
337
|
return i === "scale" || i === "pulse" || i === "none" ? i : null;
|
|
342
338
|
}
|
|
343
|
-
function
|
|
339
|
+
function D(i) {
|
|
344
340
|
if (!i) return null;
|
|
345
341
|
const t = i.trim();
|
|
346
342
|
return t ? t === "full" ? "999px" : /^-?\\d+(\\.\\d+)?$/.test(t) ? `${t}px` : t : null;
|
|
@@ -349,14 +345,14 @@ function A(i) {
|
|
|
349
345
|
const t = Number(i);
|
|
350
346
|
return !Number.isFinite(t) || t <= 0 ? 1 : t === 0.5 ? 0.5 : 1;
|
|
351
347
|
}
|
|
352
|
-
function
|
|
348
|
+
function l(i, t, e) {
|
|
353
349
|
return Math.min(e, Math.max(t, i));
|
|
354
350
|
}
|
|
355
|
-
function
|
|
351
|
+
function h(i, t) {
|
|
356
352
|
const e = Math.round(i / t) * t;
|
|
357
353
|
return Number(e.toFixed(2));
|
|
358
354
|
}
|
|
359
|
-
function
|
|
355
|
+
function a(i, t) {
|
|
360
356
|
const e = i.getAttribute(t);
|
|
361
357
|
if (e != null) return e;
|
|
362
358
|
const r = i[t];
|
|
@@ -378,9 +374,11 @@ function z(i) {
|
|
|
378
374
|
</svg>
|
|
379
375
|
`;
|
|
380
376
|
}
|
|
381
|
-
class
|
|
377
|
+
class q extends M {
|
|
382
378
|
constructor() {
|
|
383
|
-
super(), this._autoAriaLabel = !1, this._stars = [], this._value = 0, this._max = 5, this._precision = 1, this._disabled = !1, this._readonly = !1, this._hoverValue = 0, this.
|
|
379
|
+
super(), this._autoAriaLabel = !1, this._stars = [], this._value = 0, this._max = 5, this._precision = 1, this._disabled = !1, this._readonly = !1, this._hoverValue = 0, this._onHostKeyDown = (t) => {
|
|
380
|
+
t.composedPath()[0] === this && this._onRootKeyDown(t, !0);
|
|
381
|
+
}, this._onRootClick = this._onRootClick.bind(this), this._onRootMouseMove = this._onRootMouseMove.bind(this), this._onRootMouseLeave = this._onRootMouseLeave.bind(this), this._onRootFocusIn = this._onRootFocusIn.bind(this), this._onRootFocusOut = this._onRootFocusOut.bind(this), this._onRootKeyDown = this._onRootKeyDown.bind(this);
|
|
384
382
|
}
|
|
385
383
|
static get observedAttributes() {
|
|
386
384
|
return [
|
|
@@ -406,22 +404,22 @@ class B extends M {
|
|
|
406
404
|
];
|
|
407
405
|
}
|
|
408
406
|
connectedCallback() {
|
|
409
|
-
super.connectedCallback(), this.root.addEventListener("click", this._onRootClick, !0), this.root.addEventListener("mousemove", this._onRootMouseMove, !0), this.root.addEventListener("mouseleave", this._onRootMouseLeave, !0), this.root.addEventListener("focusin", this._onRootFocusIn, !0), this.root.addEventListener("focusout", this._onRootFocusOut, !0), this.root.addEventListener("keydown", this._onRootKeyDown, !0);
|
|
407
|
+
super.connectedCallback(), this.root.addEventListener("click", this._onRootClick, !0), this.root.addEventListener("mousemove", this._onRootMouseMove, !0), this.root.addEventListener("mouseleave", this._onRootMouseLeave, !0), this.root.addEventListener("focusin", this._onRootFocusIn, !0), this.root.addEventListener("focusout", this._onRootFocusOut, !0), this.root.addEventListener("keydown", this._onRootKeyDown, !0), this.addEventListener("keydown", this._onHostKeyDown);
|
|
410
408
|
}
|
|
411
409
|
disconnectedCallback() {
|
|
412
|
-
this.root.removeEventListener("click", this._onRootClick, !0), this.root.removeEventListener("mousemove", this._onRootMouseMove, !0), this.root.removeEventListener("mouseleave", this._onRootMouseLeave, !0), this.root.removeEventListener("focusin", this._onRootFocusIn, !0), this.root.removeEventListener("focusout", this._onRootFocusOut, !0), this.root.removeEventListener("keydown", this._onRootKeyDown, !0), super.disconnectedCallback();
|
|
410
|
+
this.root.removeEventListener("click", this._onRootClick, !0), this.root.removeEventListener("mousemove", this._onRootMouseMove, !0), this.root.removeEventListener("mouseleave", this._onRootMouseLeave, !0), this.root.removeEventListener("focusin", this._onRootFocusIn, !0), this.root.removeEventListener("focusout", this._onRootFocusOut, !0), this.root.removeEventListener("keydown", this._onRootKeyDown, !0), this.removeEventListener("keydown", this._onHostKeyDown), super.disconnectedCallback();
|
|
413
411
|
}
|
|
414
412
|
attributeChangedCallback(t, e, r) {
|
|
415
413
|
if (e !== r) {
|
|
416
414
|
if (t === "value") {
|
|
417
415
|
const s = Number(r);
|
|
418
|
-
Number.isFinite(s) && (this._value =
|
|
416
|
+
Number.isFinite(s) && (this._value = l(h(s, this._precision), 0, this._max), this._syncStars(), this._syncAria());
|
|
419
417
|
}
|
|
420
418
|
if (t === "max") {
|
|
421
419
|
const s = Number(r);
|
|
422
420
|
Number.isFinite(s) && s > 0 && (this._max = Math.max(1, s), this._value > this._max && (this._value = this._max), this._syncStars(), this._syncAria());
|
|
423
421
|
}
|
|
424
|
-
if (t === "precision" && (this._precision = A(r), this._value =
|
|
422
|
+
if (t === "precision" && (this._precision = A(r), this._value = l(h(this._value, this._precision), 0, this._max), this._hoverValue = this._hoverValue > 0 ? l(h(this._hoverValue, this._precision), 0, this._max) : 0, this._syncStars(), this._syncAria()), t === "disabled" && (this._disabled = r !== null), t === "readonly" && (this._readonly = r !== null), t === "animation") {
|
|
425
423
|
const s = y(r);
|
|
426
424
|
s ? this.setAttribute("data-animation", s) : this.removeAttribute("data-animation");
|
|
427
425
|
}
|
|
@@ -434,7 +432,7 @@ class B extends M {
|
|
|
434
432
|
set value(t) {
|
|
435
433
|
const e = Number(t);
|
|
436
434
|
if (!Number.isFinite(e)) return;
|
|
437
|
-
const r =
|
|
435
|
+
const r = l(h(e, this._precision), 0, this._max);
|
|
438
436
|
this._value !== r && (this._value = r, this.setAttribute("value", String(this._value)), this._syncStars(), this._syncAria(), this._emit("change"), this._emit("input"));
|
|
439
437
|
}
|
|
440
438
|
get max() {
|
|
@@ -448,7 +446,7 @@ class B extends M {
|
|
|
448
446
|
return this._precision;
|
|
449
447
|
}
|
|
450
448
|
set precision(t) {
|
|
451
|
-
this._precision = t === 0.5 ? 0.5 : 1, this.setAttribute("precision", String(this._precision)), this._value =
|
|
449
|
+
this._precision = t === 0.5 ? 0.5 : 1, this.setAttribute("precision", String(this._precision)), this._value = l(h(this._value, this._precision), 0, this._max), this.requestRender();
|
|
452
450
|
}
|
|
453
451
|
get disabled() {
|
|
454
452
|
return this._disabled;
|
|
@@ -475,8 +473,8 @@ class B extends M {
|
|
|
475
473
|
if (r === -1) return this._value;
|
|
476
474
|
if (this._precision !== 0.5)
|
|
477
475
|
return r + 1;
|
|
478
|
-
const s = e.getBoundingClientRect(),
|
|
479
|
-
return r +
|
|
476
|
+
const s = e.getBoundingClientRect(), n = t.clientX - s.left <= s.width / 2 ? 0.5 : 1;
|
|
477
|
+
return r + n;
|
|
480
478
|
}
|
|
481
479
|
_formatValue(t) {
|
|
482
480
|
return Number.isInteger(t) ? String(t) : t.toFixed(1);
|
|
@@ -505,37 +503,37 @@ class B extends M {
|
|
|
505
503
|
_onRootFocusOut() {
|
|
506
504
|
this._disabled || this._readonly || (this._hoverValue = 0, this.removeAttribute("state"), this._syncStars());
|
|
507
505
|
}
|
|
508
|
-
_onRootKeyDown(t) {
|
|
506
|
+
_onRootKeyDown(t, e = !1) {
|
|
509
507
|
if (this._disabled || this._readonly) return;
|
|
510
|
-
const
|
|
511
|
-
if (
|
|
512
|
-
let
|
|
513
|
-
const
|
|
514
|
-
switch (
|
|
508
|
+
const r = t, s = this._getStarFromEventTarget(r.target), o = e ? Math.max(0, Math.ceil(this._value) - 1) : this._getStarIndex(s);
|
|
509
|
+
if (o === -1) return;
|
|
510
|
+
let n = this._value;
|
|
511
|
+
const u = this._precision;
|
|
512
|
+
switch (r.key) {
|
|
515
513
|
case "ArrowRight":
|
|
516
514
|
case "ArrowUp":
|
|
517
515
|
case "+":
|
|
518
|
-
|
|
516
|
+
n = l(this._value + u, 0, this._max);
|
|
519
517
|
break;
|
|
520
518
|
case "ArrowLeft":
|
|
521
519
|
case "ArrowDown":
|
|
522
520
|
case "-":
|
|
523
|
-
|
|
521
|
+
n = l(this._value - u, 0, this._max);
|
|
524
522
|
break;
|
|
525
523
|
case "Home":
|
|
526
|
-
|
|
524
|
+
n = 0;
|
|
527
525
|
break;
|
|
528
526
|
case "End":
|
|
529
|
-
|
|
527
|
+
n = this._max;
|
|
530
528
|
break;
|
|
531
529
|
case " ":
|
|
532
530
|
case "Enter":
|
|
533
|
-
|
|
531
|
+
n = o + 1;
|
|
534
532
|
break;
|
|
535
533
|
default:
|
|
536
534
|
return;
|
|
537
535
|
}
|
|
538
|
-
|
|
536
|
+
r.preventDefault(), this.value = n;
|
|
539
537
|
}
|
|
540
538
|
_getFillPercent(t, e) {
|
|
541
539
|
const r = e - (t - 1);
|
|
@@ -544,23 +542,23 @@ class B extends M {
|
|
|
544
542
|
_syncStars() {
|
|
545
543
|
const t = this._hoverValue > 0 ? this._hoverValue : this._value;
|
|
546
544
|
this._stars.forEach((e, r) => {
|
|
547
|
-
const s = r + 1,
|
|
548
|
-
if (e.style.setProperty("--fill-percent", `${
|
|
545
|
+
const s = r + 1, o = this._getFillPercent(s, t);
|
|
546
|
+
if (e.style.setProperty("--fill-percent", `${o}%`), this._disabled) {
|
|
549
547
|
e.setAttribute("data-state", "disabled"), e.setAttribute("aria-disabled", "true");
|
|
550
548
|
return;
|
|
551
549
|
}
|
|
552
550
|
if (e.removeAttribute("aria-disabled"), this._hoverValue > 0) {
|
|
553
|
-
|
|
551
|
+
o > 0 ? e.setAttribute("data-state", "hover") : e.removeAttribute("data-state");
|
|
554
552
|
return;
|
|
555
553
|
}
|
|
556
|
-
|
|
554
|
+
o > 0 ? e.setAttribute("data-state", "active") : e.removeAttribute("data-state");
|
|
557
555
|
}), this._syncAria();
|
|
558
556
|
}
|
|
559
557
|
_syncAria() {
|
|
560
558
|
const t = this._getAriaValueText(this._value);
|
|
561
559
|
this.setAttribute("role", "slider"), this.setAttribute("tabindex", this._disabled || this._readonly ? "-1" : "0"), this.setAttribute("aria-valuemin", "0"), this.setAttribute("aria-valuemax", String(this._max)), this.setAttribute("aria-valuenow", String(this._value)), this.setAttribute("aria-valuetext", t), this.setAttribute("aria-orientation", "horizontal"), this.setAttribute("aria-disabled", this._disabled ? "true" : "false"), this.setAttribute("aria-readonly", this._readonly ? "true" : "false"), this._stars.forEach((e, r) => {
|
|
562
|
-
const s = r + 1,
|
|
563
|
-
e.setAttribute("aria-hidden", "true"), e.setAttribute("data-fill", String(
|
|
560
|
+
const s = r + 1, o = this._getFillPercent(s, this._hoverValue > 0 ? this._hoverValue : this._value);
|
|
561
|
+
e.setAttribute("aria-hidden", "true"), e.setAttribute("data-fill", String(o)), e.setAttribute("data-star-value", String(s));
|
|
564
562
|
});
|
|
565
563
|
}
|
|
566
564
|
_emit(t) {
|
|
@@ -579,9 +577,9 @@ class B extends M {
|
|
|
579
577
|
);
|
|
580
578
|
}
|
|
581
579
|
render() {
|
|
582
|
-
const t = g(this, "disabled"), e = g(this, "readonly"), r = C(
|
|
583
|
-
this._max = Math.max(1, Number(S) || 5), this._precision = k, this._value =
|
|
584
|
-
const E = Array.from({ length: this._max }, (
|
|
580
|
+
const t = g(this, "disabled"), e = g(this, "readonly"), r = C(a(this, "variant")), s = $(a(this, "size")), o = a(this, "theme"), n = T(a(this, "tone")), u = I(a(this, "state")), m = y(a(this, "animation")), d = N(a(this, "shape")), v = D(a(this, "radius")), k = A(a(this, "precision")), _ = this._autoAriaLabel ? null : a(this, "aria-label"), f = a(this, "aria-labelledby"), p = a(this, "aria-describedby"), c = a(this, "label"), b = g(this, "show-value"), R = a(this, "value"), S = a(this, "max");
|
|
581
|
+
this._max = Math.max(1, Number(S) || 5), this._precision = k, this._value = l(h(Number(R) || 0, this._precision), 0, this._max), this._disabled = t, this._readonly = e, m ? this.setAttribute("data-animation", m) : this.removeAttribute("data-animation"), o === "dark" || o === "brand" ? this.setAttribute("theme", o) : this.removeAttribute("theme"), n ? this.setAttribute("tone", n) : this.removeAttribute("tone"), u === "disabled" ? this.setAttribute("state", "disabled") : u !== "idle" ? this.setAttribute("state", u) : this.removeAttribute("state"), d === "square" || d === "pill" ? this.setAttribute("shape", d) : this.removeAttribute("shape"), r === "default" ? this.removeAttribute("variant") : this.setAttribute("variant", r), s === "md" ? this.removeAttribute("size") : this.setAttribute("size", s), v ? this.style.setProperty("--ui-rating-radius", v) : this.style.removeProperty("--ui-rating-radius"), this.setAttribute("precision", String(this._precision));
|
|
582
|
+
const E = Array.from({ length: this._max }, (H, L) => `
|
|
585
583
|
<span
|
|
586
584
|
class="star"
|
|
587
585
|
aria-hidden="true"
|
|
@@ -608,18 +606,18 @@ class B extends M {
|
|
|
608
606
|
>
|
|
609
607
|
${E}
|
|
610
608
|
</div>
|
|
611
|
-
${
|
|
609
|
+
${c || b ? `
|
|
612
610
|
<div class="label" part="label">
|
|
613
|
-
${
|
|
611
|
+
${c ? `<span class="label-text">${w(c)}</span>` : ""}
|
|
614
612
|
${b ? `<span class="value">${w(F)}</span>` : ""}
|
|
615
613
|
</div>
|
|
616
614
|
` : ""}
|
|
617
615
|
`), queueMicrotask(() => {
|
|
618
616
|
this._stars = Array.from(this.root.querySelectorAll(".star")), this._syncStars();
|
|
619
|
-
}), this._autoAriaLabel = !1,
|
|
617
|
+
}), this._autoAriaLabel = !1, _ ? this.setAttribute("aria-label", _) : f ? this.removeAttribute("aria-label") : (this.setAttribute("aria-label", (c || "").trim() || "Rating"), this._autoAriaLabel = !0), f ? this.setAttribute("aria-labelledby", f) : this.removeAttribute("aria-labelledby"), p ? this.setAttribute("aria-describedby", p) : this.removeAttribute("aria-describedby"), this._disabled ? this.setAttribute("disabled", "") : this.removeAttribute("disabled"), this._readonly ? this.setAttribute("readonly", "") : this.removeAttribute("readonly"), this._syncAria();
|
|
620
618
|
}
|
|
621
619
|
}
|
|
622
|
-
typeof customElements < "u" && !customElements.get("ui-rating") && customElements.define("ui-rating",
|
|
620
|
+
typeof customElements < "u" && !customElements.get("ui-rating") && customElements.define("ui-rating", q);
|
|
623
621
|
export {
|
|
624
|
-
|
|
622
|
+
q as UIRating
|
|
625
623
|
};
|