@epilot/spark-ui 0.31.1 → 0.32.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/dist/button-B_RNHEc7.d.ts +52 -0
- package/dist/button-DBcEcIMk.d.cts +52 -0
- package/dist/cn-DzRH6EW_.d.cts +4 -0
- package/dist/cn-DzRH6EW_.d.ts +4 -0
- package/dist/components/accordion.cjs +1 -1
- package/dist/components/accordion.js +1 -1
- package/dist/components/alert-dialog.cjs +1 -1
- package/dist/components/alert-dialog.d.cts +1 -1
- package/dist/components/alert-dialog.d.ts +1 -1
- package/dist/components/alert-dialog.js +1 -1
- package/dist/components/attachment.cjs +2 -2
- package/dist/components/attachment.d.cts +3 -3
- package/dist/components/attachment.d.ts +3 -3
- package/dist/components/attachment.js +2 -2
- package/dist/components/autocomplete.cjs +9 -7
- package/dist/components/autocomplete.cjs.map +1 -1
- package/dist/components/autocomplete.d.cts +4 -10
- package/dist/components/autocomplete.d.ts +4 -10
- package/dist/components/autocomplete.js +9 -7
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/avatar.js +1 -1
- package/dist/components/badge.cjs +1 -1
- package/dist/components/badge.js +2 -2
- package/dist/components/banner.cjs +1 -1
- package/dist/components/banner.js +1 -1
- package/dist/components/bar-chart.cjs +1 -1
- package/dist/components/bar-chart.js +2 -2
- package/dist/components/box.cjs +2 -2
- package/dist/components/box.cjs.map +1 -1
- package/dist/components/box.js +3 -3
- package/dist/components/box.js.map +1 -1
- package/dist/components/breadcrumbs.cjs +1 -1
- package/dist/components/breadcrumbs.js +1 -1
- package/dist/components/bubble.cjs +2 -2
- package/dist/components/bubble.d.cts +2 -2
- package/dist/components/bubble.d.ts +2 -2
- package/dist/components/bubble.js +2 -2
- package/dist/components/button-group.cjs +1 -1
- package/dist/components/button-group.js +2 -2
- package/dist/components/button.cjs +13 -30
- package/dist/components/button.cjs.map +1 -1
- package/dist/components/button.d.cts +3 -36
- package/dist/components/button.d.ts +3 -36
- package/dist/components/button.js +14 -31
- package/dist/components/button.js.map +1 -1
- package/dist/components/calendar.cjs +32 -4
- package/dist/components/calendar.cjs.map +1 -1
- package/dist/components/calendar.d.cts +2 -2
- package/dist/components/calendar.d.ts +2 -2
- package/dist/components/calendar.js +34 -6
- package/dist/components/calendar.js.map +1 -1
- package/dist/components/callout.cjs +1 -1
- package/dist/components/callout.d.cts +1 -1
- package/dist/components/callout.d.ts +1 -1
- package/dist/components/callout.js +1 -1
- package/dist/components/card.cjs +6 -5
- package/dist/components/card.cjs.map +1 -1
- package/dist/components/card.d.cts +9 -8
- package/dist/components/card.d.ts +9 -8
- package/dist/components/card.js +7 -6
- package/dist/components/card.js.map +1 -1
- package/dist/components/checkbox-card.cjs +157 -65
- package/dist/components/checkbox-card.cjs.map +1 -1
- package/dist/components/checkbox-card.d.cts +38 -18
- package/dist/components/checkbox-card.d.ts +38 -18
- package/dist/components/checkbox-card.js +155 -66
- package/dist/components/checkbox-card.js.map +1 -1
- package/dist/components/checkbox-group.cjs +1 -1
- package/dist/components/checkbox-group.js +2 -2
- package/dist/components/checkbox.cjs +5 -18
- package/dist/components/checkbox.cjs.map +1 -1
- package/dist/components/checkbox.js +7 -20
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/combobox.cjs +2 -1
- package/dist/components/combobox.cjs.map +1 -1
- package/dist/components/combobox.js +2 -1
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/dialog.cjs +1 -1
- package/dist/components/dialog.js +1 -1
- package/dist/components/drawer.cjs +1 -1
- package/dist/components/drawer.js +1 -1
- package/dist/components/dropdown-menu.cjs +1 -1
- package/dist/components/dropdown-menu.js +1 -1
- package/dist/components/dropzone.cjs +224 -0
- package/dist/components/dropzone.cjs.map +1 -0
- package/dist/components/dropzone.d.cts +66 -0
- package/dist/components/dropzone.d.ts +66 -0
- package/dist/components/dropzone.js +215 -0
- package/dist/components/dropzone.js.map +1 -0
- package/dist/components/empty-state.cjs +1 -1
- package/dist/components/empty-state.d.cts +1 -1
- package/dist/components/empty-state.d.ts +1 -1
- package/dist/components/empty-state.js +1 -1
- package/dist/components/entity-card.cjs +1 -1
- package/dist/components/entity-card.js +1 -1
- package/dist/components/field.cjs +69 -11
- package/dist/components/field.cjs.map +1 -1
- package/dist/components/field.d.cts +16 -3
- package/dist/components/field.d.ts +16 -3
- package/dist/components/field.js +68 -11
- package/dist/components/field.js.map +1 -1
- package/dist/components/hero-metric.cjs +1 -1
- package/dist/components/hero-metric.js +1 -1
- package/dist/components/icon.js +1 -1
- package/dist/components/image-carousel.cjs +183 -0
- package/dist/components/image-carousel.cjs.map +1 -0
- package/dist/components/image-carousel.d.cts +54 -0
- package/dist/components/image-carousel.d.ts +54 -0
- package/dist/components/image-carousel.js +174 -0
- package/dist/components/image-carousel.js.map +1 -0
- package/dist/components/info-block.cjs +1 -1
- package/dist/components/info-block.d.cts +1 -1
- package/dist/components/info-block.d.ts +1 -1
- package/dist/components/info-block.js +1 -1
- package/dist/components/input-date-time.cjs +16 -202
- package/dist/components/input-date-time.cjs.map +1 -1
- package/dist/components/input-date-time.d.cts +14 -31
- package/dist/components/input-date-time.d.ts +14 -31
- package/dist/components/input-date-time.js +15 -202
- package/dist/components/input-date-time.js.map +1 -1
- package/dist/components/input-date.cjs +14 -146
- package/dist/components/input-date.cjs.map +1 -1
- package/dist/components/input-date.d.cts +11 -19
- package/dist/components/input-date.d.ts +11 -19
- package/dist/components/input-date.js +13 -146
- package/dist/components/input-date.js.map +1 -1
- package/dist/components/input-group.cjs +4 -3
- package/dist/components/input-group.cjs.map +1 -1
- package/dist/components/input-group.d.cts +2 -30
- package/dist/components/input-group.d.ts +2 -30
- package/dist/components/input-group.js +3 -2
- package/dist/components/input-group.js.map +1 -1
- package/dist/components/input-otp.cjs +3 -3
- package/dist/components/input-otp.cjs.map +1 -1
- package/dist/components/input-otp.js +3 -3
- package/dist/components/input-otp.js.map +1 -1
- package/dist/components/input.cjs +4 -2
- package/dist/components/input.cjs.map +1 -1
- package/dist/components/input.d.cts +2 -12
- package/dist/components/input.d.ts +2 -12
- package/dist/components/input.js +4 -2
- package/dist/components/input.js.map +1 -1
- package/dist/components/line-chart.cjs +2 -2
- package/dist/components/line-chart.js +3 -3
- package/dist/components/list.cjs +2 -2
- package/dist/components/list.js +2 -2
- package/dist/components/marker.cjs +2 -2
- package/dist/components/marker.d.cts +1 -1
- package/dist/components/marker.d.ts +1 -1
- package/dist/components/marker.js +2 -2
- package/dist/components/message-scroller.cjs +1 -1
- package/dist/components/message-scroller.d.cts +1 -1
- package/dist/components/message-scroller.d.ts +1 -1
- package/dist/components/message-scroller.js +2 -2
- package/dist/components/page-header.cjs +1 -1
- package/dist/components/page-header.d.cts +2 -2
- package/dist/components/page-header.d.ts +2 -2
- package/dist/components/page-header.js +1 -1
- package/dist/components/pagination.cjs +124 -0
- package/dist/components/pagination.cjs.map +1 -0
- package/dist/components/pagination.d.cts +42 -0
- package/dist/components/pagination.d.ts +42 -0
- package/dist/components/pagination.js +115 -0
- package/dist/components/pagination.js.map +1 -0
- package/dist/components/period-tabs.cjs +1 -1
- package/dist/components/period-tabs.d.cts +1 -1
- package/dist/components/period-tabs.d.ts +1 -1
- package/dist/components/period-tabs.js +1 -1
- package/dist/components/pill.cjs +43 -24
- package/dist/components/pill.cjs.map +1 -1
- package/dist/components/pill.d.cts +13 -3
- package/dist/components/pill.d.ts +13 -3
- package/dist/components/pill.js +44 -26
- package/dist/components/pill.js.map +1 -1
- package/dist/components/popover.cjs +1 -1
- package/dist/components/popover.d.cts +2 -29
- package/dist/components/popover.d.ts +2 -29
- package/dist/components/popover.js +1 -1
- package/dist/components/power-history-chart.cjs +2 -2
- package/dist/components/power-history-chart.js +3 -3
- package/dist/components/power-network.cjs +1 -1
- package/dist/components/power-network.js +2 -2
- package/dist/components/progress.cjs +126 -13
- package/dist/components/progress.cjs.map +1 -1
- package/dist/components/progress.d.cts +19 -10
- package/dist/components/progress.d.ts +19 -10
- package/dist/components/progress.js +126 -15
- package/dist/components/progress.js.map +1 -1
- package/dist/components/radio-card-group.cjs +137 -70
- package/dist/components/radio-card-group.cjs.map +1 -1
- package/dist/components/radio-card-group.d.cts +37 -15
- package/dist/components/radio-card-group.d.ts +37 -15
- package/dist/components/radio-card-group.js +135 -71
- package/dist/components/radio-card-group.js.map +1 -1
- package/dist/components/radio.cjs +1 -1
- package/dist/components/radio.js +2 -2
- package/dist/components/schedule-list.cjs +1 -1
- package/dist/components/schedule-list.js +1 -1
- package/dist/components/select.cjs +11 -4
- package/dist/components/select.cjs.map +1 -1
- package/dist/components/select.d.cts +1 -0
- package/dist/components/select.d.ts +1 -0
- package/dist/components/select.js +11 -4
- package/dist/components/select.js.map +1 -1
- package/dist/components/separator.cjs +1 -1
- package/dist/components/separator.js +1 -1
- package/dist/components/sheet.cjs +1 -1
- package/dist/components/sheet.js +1 -1
- package/dist/components/skeleton.cjs +1 -1
- package/dist/components/skeleton.js +1 -1
- package/dist/components/solar-forecast-chart.js +1 -1
- package/dist/components/spark-home.js +1 -1
- package/dist/components/step-indicator.cjs +128 -0
- package/dist/components/step-indicator.cjs.map +1 -0
- package/dist/components/step-indicator.d.cts +25 -0
- package/dist/components/step-indicator.d.ts +25 -0
- package/dist/components/step-indicator.js +124 -0
- package/dist/components/step-indicator.js.map +1 -0
- package/dist/components/stepper.cjs +3 -2
- package/dist/components/stepper.cjs.map +1 -1
- package/dist/components/stepper.d.cts +1 -2
- package/dist/components/stepper.d.ts +1 -2
- package/dist/components/stepper.js +3 -2
- package/dist/components/stepper.js.map +1 -1
- package/dist/components/switch-group.cjs +1 -1
- package/dist/components/switch-group.js +2 -2
- package/dist/components/switch.js +1 -1
- package/dist/components/table.cjs +1 -1
- package/dist/components/table.js +1 -1
- package/dist/components/tabs.cjs +3 -3
- package/dist/components/tabs.cjs.map +1 -1
- package/dist/components/tabs.js +2 -2
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/textarea.cjs +8 -2
- package/dist/components/textarea.cjs.map +1 -1
- package/dist/components/textarea.js +8 -2
- package/dist/components/textarea.js.map +1 -1
- package/dist/components/theme.cjs +1 -1
- package/dist/components/theme.js +2 -2
- package/dist/components/time-picker.cjs +3 -38
- package/dist/components/time-picker.cjs.map +1 -1
- package/dist/components/time-picker.js +1 -36
- package/dist/components/time-picker.js.map +1 -1
- package/dist/components/toast.cjs +1 -1
- package/dist/components/toast.js +1 -1
- package/dist/components/toggle-group.js +1 -1
- package/dist/components/toggle.d.cts +1 -1
- package/dist/components/toggle.d.ts +1 -1
- package/dist/components/toggle.js +1 -1
- package/dist/components/tooltip.cjs +3 -2
- package/dist/components/tooltip.cjs.map +1 -1
- package/dist/components/tooltip.d.cts +3 -2
- package/dist/components/tooltip.d.ts +3 -2
- package/dist/components/tooltip.js +3 -2
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/trace.cjs +1 -1
- package/dist/components/trace.js +1 -1
- package/dist/hooks/use-isomorphic-layout-effect.cjs +9 -0
- package/dist/hooks/use-isomorphic-layout-effect.cjs.map +1 -0
- package/dist/hooks/use-isomorphic-layout-effect.d.cts +9 -0
- package/dist/hooks/use-isomorphic-layout-effect.d.ts +9 -0
- package/dist/hooks/use-isomorphic-layout-effect.js +8 -0
- package/dist/hooks/use-isomorphic-layout-effect.js.map +1 -0
- package/dist/input-BZFPU-j4.d.cts +14 -0
- package/dist/input-group-5lh67qyY.d.cts +32 -0
- package/dist/input-group-Bc9_sPPN.d.ts +32 -0
- package/dist/input-zB3zmz9J.d.ts +14 -0
- package/dist/lib/accent-theme.cjs +46 -22
- package/dist/lib/accent-theme.cjs.map +1 -1
- package/dist/lib/accent-theme.js +26 -1
- package/dist/lib/accent-theme.js.map +1 -1
- package/dist/lib/calendar-field.cjs +11 -0
- package/dist/lib/calendar-field.cjs.map +1 -0
- package/dist/lib/calendar-field.d.cts +18 -0
- package/dist/lib/calendar-field.d.ts +18 -0
- package/dist/lib/calendar-field.js +8 -0
- package/dist/lib/calendar-field.js.map +1 -0
- package/dist/lib/calendar-lists.cjs +86 -97
- package/dist/lib/calendar-lists.cjs.map +1 -1
- package/dist/lib/calendar-lists.d.cts +30 -2
- package/dist/lib/calendar-lists.d.ts +30 -2
- package/dist/lib/calendar-lists.js +85 -97
- package/dist/lib/calendar-lists.js.map +1 -1
- package/dist/lib/card-control.cjs +18 -0
- package/dist/lib/card-control.cjs.map +1 -0
- package/dist/lib/card-control.d.cts +10 -0
- package/dist/lib/card-control.d.ts +10 -0
- package/dist/lib/card-control.js +17 -0
- package/dist/lib/card-control.js.map +1 -0
- package/dist/lib/checkbox-box.cjs +30 -0
- package/dist/lib/checkbox-box.cjs.map +1 -0
- package/dist/lib/checkbox-box.d.cts +13 -0
- package/dist/lib/checkbox-box.d.ts +13 -0
- package/dist/lib/checkbox-box.js +27 -0
- package/dist/lib/checkbox-box.js.map +1 -0
- package/dist/lib/container-chrome.cjs +8 -1
- package/dist/lib/container-chrome.cjs.map +1 -1
- package/dist/lib/container-chrome.d.cts +4 -2
- package/dist/lib/container-chrome.d.ts +4 -2
- package/dist/lib/container-chrome.js +8 -2
- package/dist/lib/container-chrome.js.map +1 -1
- package/dist/lib/date-field-input.cjs +121 -0
- package/dist/lib/date-field-input.cjs.map +1 -0
- package/dist/lib/date-field-input.d.cts +14 -0
- package/dist/lib/date-field-input.d.ts +14 -0
- package/dist/lib/date-field-input.js +118 -0
- package/dist/lib/date-field-input.js.map +1 -0
- package/dist/lib/date-field-time-list.cjs +81 -0
- package/dist/lib/date-field-time-list.cjs.map +1 -0
- package/dist/lib/date-field-time-list.d.cts +18 -0
- package/dist/lib/date-field-time-list.d.ts +18 -0
- package/dist/lib/date-field-time-list.js +77 -0
- package/dist/lib/date-field-time-list.js.map +1 -0
- package/dist/lib/date-field.cjs +183 -0
- package/dist/lib/date-field.cjs.map +1 -0
- package/dist/lib/date-field.d.cts +76 -0
- package/dist/lib/date-field.d.ts +76 -0
- package/dist/lib/date-field.js +177 -0
- package/dist/lib/date-field.js.map +1 -0
- package/dist/lib/date-time-mask.cjs +148 -102
- package/dist/lib/date-time-mask.cjs.map +1 -1
- package/dist/lib/date-time-mask.d.cts +21 -3
- package/dist/lib/date-time-mask.d.ts +21 -3
- package/dist/lib/date-time-mask.js +142 -103
- package/dist/lib/date-time-mask.js.map +1 -1
- package/dist/lib/generate-radix-colors.cjs +64 -5
- package/dist/lib/generate-radix-colors.cjs.map +1 -1
- package/dist/lib/generate-radix-colors.js +61 -1
- package/dist/lib/generate-radix-colors.js.map +1 -1
- package/dist/lib/input-box-variants.cjs +3 -3
- package/dist/lib/input-box-variants.cjs.map +1 -1
- package/dist/lib/input-box-variants.d.cts +1 -1
- package/dist/lib/input-box-variants.d.ts +1 -1
- package/dist/lib/input-box-variants.js +3 -3
- package/dist/lib/input-box-variants.js.map +1 -1
- package/dist/lib/mask-hint.cjs +15 -0
- package/dist/lib/mask-hint.cjs.map +1 -0
- package/dist/lib/mask-hint.d.cts +10 -0
- package/dist/lib/mask-hint.d.ts +10 -0
- package/dist/lib/mask-hint.js +14 -0
- package/dist/lib/mask-hint.js.map +1 -0
- package/dist/lib/option-list.cjs +71 -0
- package/dist/lib/option-list.cjs.map +1 -0
- package/dist/lib/option-list.d.cts +4 -0
- package/dist/lib/option-list.d.ts +4 -0
- package/dist/lib/option-list.js +67 -0
- package/dist/lib/option-list.js.map +1 -0
- package/dist/lib/time-grid.cjs +34 -0
- package/dist/lib/time-grid.cjs.map +1 -0
- package/dist/lib/time-grid.d.cts +9 -0
- package/dist/lib/time-grid.d.ts +9 -0
- package/dist/lib/time-grid.js +31 -0
- package/dist/lib/time-grid.js.map +1 -0
- package/dist/lib/toggle-group-context.d.cts +1 -1
- package/dist/lib/toggle-group-context.d.ts +1 -1
- package/dist/option-list-CxhR_DGq.d.cts +34 -0
- package/dist/option-list-CxhR_DGq.d.ts +34 -0
- package/dist/popover-DmcqNOkO.d.cts +31 -0
- package/dist/popover-DmcqNOkO.d.ts +31 -0
- package/dist/styles/spark-default.css +21 -0
- package/dist/styles/theme.css +2 -1
- package/dist/utils/cn.d.cts +1 -1
- package/dist/utils/cn.d.ts +1 -1
- package/package.json +3 -3
- package/dist/calendar-lists-CTby2kR5.d.cts +0 -27
- package/dist/calendar-lists-DoloqsCN.d.ts +0 -27
- package/dist/lib/calendar-day-button.cjs +0 -23
- package/dist/lib/calendar-day-button.cjs.map +0 -1
- package/dist/lib/calendar-day-button.d.cts +0 -14
- package/dist/lib/calendar-day-button.d.ts +0 -14
- package/dist/lib/calendar-day-button.js +0 -20
- package/dist/lib/calendar-day-button.js.map +0 -1
- package/dist/lib/input-date-parts.cjs +0 -155
- package/dist/lib/input-date-parts.cjs.map +0 -1
- package/dist/lib/input-date-parts.d.cts +0 -53
- package/dist/lib/input-date-parts.d.ts +0 -53
- package/dist/lib/input-date-parts.js +0 -148
- package/dist/lib/input-date-parts.js.map +0 -1
- package/dist/lib/scroll-within.cjs +0 -27
- package/dist/lib/scroll-within.cjs.map +0 -1
- package/dist/lib/scroll-within.d.cts +0 -14
- package/dist/lib/scroll-within.d.ts +0 -14
- package/dist/lib/scroll-within.js +0 -25
- package/dist/lib/scroll-within.js.map +0 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
//#region src/lib/time-grid.ts
|
|
4
|
+
const MINUTES_PER_DAY = 1440;
|
|
5
|
+
const toMinutes = (value) => {
|
|
6
|
+
const match = /^(\d{1,2}):(\d{2})/.exec(value);
|
|
7
|
+
return match ? Number(match[1]) * 60 + Number(match[2]) : void 0;
|
|
8
|
+
};
|
|
9
|
+
const toTime = (minutes) => `${String(Math.floor(minutes / 60)).padStart(2, "0")}:${String(minutes % 60).padStart(2, "0")}`;
|
|
10
|
+
const lastOnGrid = (stepMinutes) => Math.floor((MINUTES_PER_DAY - 1) / stepMinutes) * stepMinutes;
|
|
11
|
+
function stepGridValue(value, step, direction) {
|
|
12
|
+
const stepMinutes = Math.floor(step / 60);
|
|
13
|
+
if (stepMinutes <= 1) return value;
|
|
14
|
+
const base = toMinutes(value) ?? 0;
|
|
15
|
+
const next = direction === 1 ? Math.floor(base / stepMinutes) * stepMinutes + stepMinutes : Math.ceil(base / stepMinutes) * stepMinutes - stepMinutes;
|
|
16
|
+
return toTime(Math.max(0, Math.min(next, lastOnGrid(stepMinutes))));
|
|
17
|
+
}
|
|
18
|
+
function snapToNearestStep(value, step) {
|
|
19
|
+
const stepMinutes = Math.floor(step / 60);
|
|
20
|
+
if (stepMinutes <= 1) return value;
|
|
21
|
+
const total = toMinutes(value);
|
|
22
|
+
if (total === void 0 || total % stepMinutes === 0) return value;
|
|
23
|
+
return toTime(Math.min(Math.round(total / stepMinutes) * stepMinutes, lastOnGrid(stepMinutes)));
|
|
24
|
+
}
|
|
25
|
+
function timesOnGrid(step) {
|
|
26
|
+
const stepMinutes = Math.max(1, Math.floor(step / 60));
|
|
27
|
+
return Array.from({ length: Math.floor((MINUTES_PER_DAY - 1) / stepMinutes) + 1 }, (_, index) => toTime(index * stepMinutes));
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
exports.snapToNearestStep = snapToNearestStep;
|
|
31
|
+
exports.stepGridValue = stepGridValue;
|
|
32
|
+
exports.timesOnGrid = timesOnGrid;
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=time-grid.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time-grid.cjs","names":[],"sources":["../../src/lib/time-grid.ts"],"sourcesContent":["const MINUTES_PER_DAY = 24 * 60\n\nconst toMinutes = (value: string) => {\n const match = /^(\\d{1,2}):(\\d{2})/.exec(value)\n return match ? Number(match[1]) * 60 + Number(match[2]) : undefined\n}\n\nconst toTime = (minutes: number) =>\n `${String(Math.floor(minutes / 60)).padStart(2, '0')}:${String(minutes % 60).padStart(2, '0')}`\n\nconst lastOnGrid = (stepMinutes: number) =>\n Math.floor((MINUTES_PER_DAY - 1) / stepMinutes) * stepMinutes\n\nexport function stepGridValue(\n value: string,\n step: number,\n direction: 1 | -1,\n): string {\n const stepMinutes = Math.floor(step / 60)\n if (stepMinutes <= 1) return value\n const base = toMinutes(value) ?? 0\n const next =\n direction === 1\n ? Math.floor(base / stepMinutes) * stepMinutes + stepMinutes\n : Math.ceil(base / stepMinutes) * stepMinutes - stepMinutes\n return toTime(Math.max(0, Math.min(next, lastOnGrid(stepMinutes))))\n}\n\nexport function snapToNearestStep(value: string, step: number): string {\n const stepMinutes = Math.floor(step / 60)\n if (stepMinutes <= 1) return value\n const total = toMinutes(value)\n if (total === undefined || total % stepMinutes === 0) return value\n return toTime(\n Math.min(\n Math.round(total / stepMinutes) * stepMinutes,\n lastOnGrid(stepMinutes),\n ),\n )\n}\n\nexport function timesOnGrid(step: number): string[] {\n const stepMinutes = Math.max(1, Math.floor(step / 60))\n return Array.from(\n { length: Math.floor((MINUTES_PER_DAY - 1) / stepMinutes) + 1 },\n (_, index) => toTime(index * stepMinutes),\n )\n}\n"],"mappings":";;;AAAA,MAAM,kBAAkB;AAExB,MAAM,aAAa,UAAkB;CACnC,MAAM,QAAQ,qBAAqB,KAAK,KAAK;CAC7C,OAAO,QAAQ,OAAO,MAAM,EAAE,IAAI,KAAK,OAAO,MAAM,EAAE,IAAI,KAAA;AAC5D;AAEA,MAAM,UAAU,YACd,GAAG,OAAO,KAAK,MAAM,UAAU,EAAE,CAAC,EAAE,SAAS,GAAG,GAAG,EAAE,GAAG,OAAO,UAAU,EAAE,EAAE,SAAS,GAAG,GAAG;AAE9F,MAAM,cAAc,gBAClB,KAAK,OAAO,kBAAkB,KAAK,WAAW,IAAI;AAEpD,SAAgB,cACd,OACA,MACA,WACQ;CACR,MAAM,cAAc,KAAK,MAAM,OAAO,EAAE;CACxC,IAAI,eAAe,GAAG,OAAO;CAC7B,MAAM,OAAO,UAAU,KAAK,KAAK;CACjC,MAAM,OACJ,cAAc,IACV,KAAK,MAAM,OAAO,WAAW,IAAI,cAAc,cAC/C,KAAK,KAAK,OAAO,WAAW,IAAI,cAAc;CACpD,OAAO,OAAO,KAAK,IAAI,GAAG,KAAK,IAAI,MAAM,WAAW,WAAW,CAAC,CAAC,CAAC;AACpE;AAEA,SAAgB,kBAAkB,OAAe,MAAsB;CACrE,MAAM,cAAc,KAAK,MAAM,OAAO,EAAE;CACxC,IAAI,eAAe,GAAG,OAAO;CAC7B,MAAM,QAAQ,UAAU,KAAK;CAC7B,IAAI,UAAU,KAAA,KAAa,QAAQ,gBAAgB,GAAG,OAAO;CAC7D,OAAO,OACL,KAAK,IACH,KAAK,MAAM,QAAQ,WAAW,IAAI,aAClC,WAAW,WAAW,CACxB,CACF;AACF;AAEA,SAAgB,YAAY,MAAwB;CAClD,MAAM,cAAc,KAAK,IAAI,GAAG,KAAK,MAAM,OAAO,EAAE,CAAC;CACrD,OAAO,MAAM,KACX,EAAE,QAAQ,KAAK,OAAO,kBAAkB,KAAK,WAAW,IAAI,EAAE,IAC7D,GAAG,UAAU,OAAO,QAAQ,WAAW,CAC1C;AACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
//#region src/lib/time-grid.d.ts
|
|
4
|
+
declare function stepGridValue(value: string, step: number, direction: 1 | -1): string;
|
|
5
|
+
declare function snapToNearestStep(value: string, step: number): string;
|
|
6
|
+
declare function timesOnGrid(step: number): string[];
|
|
7
|
+
//#endregion
|
|
8
|
+
export { snapToNearestStep, stepGridValue, timesOnGrid };
|
|
9
|
+
//# sourceMappingURL=time-grid.d.cts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
//#region src/lib/time-grid.d.ts
|
|
4
|
+
declare function stepGridValue(value: string, step: number, direction: 1 | -1): string;
|
|
5
|
+
declare function snapToNearestStep(value: string, step: number): string;
|
|
6
|
+
declare function timesOnGrid(step: number): string[];
|
|
7
|
+
//#endregion
|
|
8
|
+
export { snapToNearestStep, stepGridValue, timesOnGrid };
|
|
9
|
+
//# sourceMappingURL=time-grid.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
//#region src/lib/time-grid.ts
|
|
3
|
+
const MINUTES_PER_DAY = 1440;
|
|
4
|
+
const toMinutes = (value) => {
|
|
5
|
+
const match = /^(\d{1,2}):(\d{2})/.exec(value);
|
|
6
|
+
return match ? Number(match[1]) * 60 + Number(match[2]) : void 0;
|
|
7
|
+
};
|
|
8
|
+
const toTime = (minutes) => `${String(Math.floor(minutes / 60)).padStart(2, "0")}:${String(minutes % 60).padStart(2, "0")}`;
|
|
9
|
+
const lastOnGrid = (stepMinutes) => Math.floor((MINUTES_PER_DAY - 1) / stepMinutes) * stepMinutes;
|
|
10
|
+
function stepGridValue(value, step, direction) {
|
|
11
|
+
const stepMinutes = Math.floor(step / 60);
|
|
12
|
+
if (stepMinutes <= 1) return value;
|
|
13
|
+
const base = toMinutes(value) ?? 0;
|
|
14
|
+
const next = direction === 1 ? Math.floor(base / stepMinutes) * stepMinutes + stepMinutes : Math.ceil(base / stepMinutes) * stepMinutes - stepMinutes;
|
|
15
|
+
return toTime(Math.max(0, Math.min(next, lastOnGrid(stepMinutes))));
|
|
16
|
+
}
|
|
17
|
+
function snapToNearestStep(value, step) {
|
|
18
|
+
const stepMinutes = Math.floor(step / 60);
|
|
19
|
+
if (stepMinutes <= 1) return value;
|
|
20
|
+
const total = toMinutes(value);
|
|
21
|
+
if (total === void 0 || total % stepMinutes === 0) return value;
|
|
22
|
+
return toTime(Math.min(Math.round(total / stepMinutes) * stepMinutes, lastOnGrid(stepMinutes)));
|
|
23
|
+
}
|
|
24
|
+
function timesOnGrid(step) {
|
|
25
|
+
const stepMinutes = Math.max(1, Math.floor(step / 60));
|
|
26
|
+
return Array.from({ length: Math.floor((MINUTES_PER_DAY - 1) / stepMinutes) + 1 }, (_, index) => toTime(index * stepMinutes));
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { snapToNearestStep, stepGridValue, timesOnGrid };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=time-grid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time-grid.js","names":[],"sources":["../../src/lib/time-grid.ts"],"sourcesContent":["const MINUTES_PER_DAY = 24 * 60\n\nconst toMinutes = (value: string) => {\n const match = /^(\\d{1,2}):(\\d{2})/.exec(value)\n return match ? Number(match[1]) * 60 + Number(match[2]) : undefined\n}\n\nconst toTime = (minutes: number) =>\n `${String(Math.floor(minutes / 60)).padStart(2, '0')}:${String(minutes % 60).padStart(2, '0')}`\n\nconst lastOnGrid = (stepMinutes: number) =>\n Math.floor((MINUTES_PER_DAY - 1) / stepMinutes) * stepMinutes\n\nexport function stepGridValue(\n value: string,\n step: number,\n direction: 1 | -1,\n): string {\n const stepMinutes = Math.floor(step / 60)\n if (stepMinutes <= 1) return value\n const base = toMinutes(value) ?? 0\n const next =\n direction === 1\n ? Math.floor(base / stepMinutes) * stepMinutes + stepMinutes\n : Math.ceil(base / stepMinutes) * stepMinutes - stepMinutes\n return toTime(Math.max(0, Math.min(next, lastOnGrid(stepMinutes))))\n}\n\nexport function snapToNearestStep(value: string, step: number): string {\n const stepMinutes = Math.floor(step / 60)\n if (stepMinutes <= 1) return value\n const total = toMinutes(value)\n if (total === undefined || total % stepMinutes === 0) return value\n return toTime(\n Math.min(\n Math.round(total / stepMinutes) * stepMinutes,\n lastOnGrid(stepMinutes),\n ),\n )\n}\n\nexport function timesOnGrid(step: number): string[] {\n const stepMinutes = Math.max(1, Math.floor(step / 60))\n return Array.from(\n { length: Math.floor((MINUTES_PER_DAY - 1) / stepMinutes) + 1 },\n (_, index) => toTime(index * stepMinutes),\n )\n}\n"],"mappings":";;AAAA,MAAM,kBAAkB;AAExB,MAAM,aAAa,UAAkB;CACnC,MAAM,QAAQ,qBAAqB,KAAK,KAAK;CAC7C,OAAO,QAAQ,OAAO,MAAM,EAAE,IAAI,KAAK,OAAO,MAAM,EAAE,IAAI,KAAA;AAC5D;AAEA,MAAM,UAAU,YACd,GAAG,OAAO,KAAK,MAAM,UAAU,EAAE,CAAC,EAAE,SAAS,GAAG,GAAG,EAAE,GAAG,OAAO,UAAU,EAAE,EAAE,SAAS,GAAG,GAAG;AAE9F,MAAM,cAAc,gBAClB,KAAK,OAAO,kBAAkB,KAAK,WAAW,IAAI;AAEpD,SAAgB,cACd,OACA,MACA,WACQ;CACR,MAAM,cAAc,KAAK,MAAM,OAAO,EAAE;CACxC,IAAI,eAAe,GAAG,OAAO;CAC7B,MAAM,OAAO,UAAU,KAAK,KAAK;CACjC,MAAM,OACJ,cAAc,IACV,KAAK,MAAM,OAAO,WAAW,IAAI,cAAc,cAC/C,KAAK,KAAK,OAAO,WAAW,IAAI,cAAc;CACpD,OAAO,OAAO,KAAK,IAAI,GAAG,KAAK,IAAI,MAAM,WAAW,WAAW,CAAC,CAAC,CAAC;AACpE;AAEA,SAAgB,kBAAkB,OAAe,MAAsB;CACrE,MAAM,cAAc,KAAK,MAAM,OAAO,EAAE;CACxC,IAAI,eAAe,GAAG,OAAO;CAC7B,MAAM,QAAQ,UAAU,KAAK;CAC7B,IAAI,UAAU,KAAA,KAAa,QAAQ,gBAAgB,GAAG,OAAO;CAC7D,OAAO,OACL,KAAK,IACH,KAAK,MAAM,QAAQ,WAAW,IAAI,aAClC,WAAW,WAAW,CACxB,CACF;AACF;AAEA,SAAgB,YAAY,MAAwB;CAClD,MAAM,cAAc,KAAK,IAAI,GAAG,KAAK,MAAM,OAAO,EAAE,CAAC;CACrD,OAAO,MAAM,KACX,EAAE,QAAQ,KAAK,OAAO,kBAAkB,KAAK,WAAW,IAAI,EAAE,IAC7D,GAAG,UAAU,OAAO,QAAQ,WAAW,CAC1C;AACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { n as SparkButtonColor } from "../theme-types-CHl-L2F-.cjs";
|
|
4
|
-
import { ButtonProps } from "../
|
|
4
|
+
import { r as ButtonProps } from "../button-DBcEcIMk.cjs";
|
|
5
5
|
import { ToggleStyle } from "../components/toggle.cjs";
|
|
6
6
|
import * as React$1 from "react";
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { n as SparkButtonColor } from "../theme-types-CHl-L2F-.js";
|
|
4
|
-
import { ButtonProps } from "../
|
|
4
|
+
import { r as ButtonProps } from "../button-B_RNHEc7.js";
|
|
5
5
|
import { ToggleStyle } from "../components/toggle.js";
|
|
6
6
|
import * as React$1 from "react";
|
|
7
7
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React$1 from "react";
|
|
4
|
+
import { Toggle } from "@base-ui/react/toggle";
|
|
5
|
+
|
|
6
|
+
//#region src/lib/option-list.d.ts
|
|
7
|
+
type OptionListProps = Omit<React$1.ComponentProps<'div'>, 'defaultValue' | 'onChange'> & {
|
|
8
|
+
autoFocus?: boolean;
|
|
9
|
+
'data-slot'?: string;
|
|
10
|
+
fallbackValue?: string;
|
|
11
|
+
onPick: (value: string) => void;
|
|
12
|
+
value: string | undefined;
|
|
13
|
+
};
|
|
14
|
+
declare function OptionList({
|
|
15
|
+
autoFocus,
|
|
16
|
+
children,
|
|
17
|
+
className,
|
|
18
|
+
'data-slot': slot,
|
|
19
|
+
fallbackValue,
|
|
20
|
+
onPick,
|
|
21
|
+
value,
|
|
22
|
+
...props
|
|
23
|
+
}: OptionListProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
declare function Option({
|
|
25
|
+
className,
|
|
26
|
+
children,
|
|
27
|
+
value,
|
|
28
|
+
...props
|
|
29
|
+
}: Omit<React$1.ComponentProps<typeof Toggle>, 'value'> & {
|
|
30
|
+
value: string;
|
|
31
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { OptionList as n, OptionListProps as r, Option as t };
|
|
34
|
+
//# sourceMappingURL=option-list-CxhR_DGq.d.cts.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React$1 from "react";
|
|
4
|
+
import { Toggle } from "@base-ui/react/toggle";
|
|
5
|
+
|
|
6
|
+
//#region src/lib/option-list.d.ts
|
|
7
|
+
type OptionListProps = Omit<React$1.ComponentProps<'div'>, 'defaultValue' | 'onChange'> & {
|
|
8
|
+
autoFocus?: boolean;
|
|
9
|
+
'data-slot'?: string;
|
|
10
|
+
fallbackValue?: string;
|
|
11
|
+
onPick: (value: string) => void;
|
|
12
|
+
value: string | undefined;
|
|
13
|
+
};
|
|
14
|
+
declare function OptionList({
|
|
15
|
+
autoFocus,
|
|
16
|
+
children,
|
|
17
|
+
className,
|
|
18
|
+
'data-slot': slot,
|
|
19
|
+
fallbackValue,
|
|
20
|
+
onPick,
|
|
21
|
+
value,
|
|
22
|
+
...props
|
|
23
|
+
}: OptionListProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
declare function Option({
|
|
25
|
+
className,
|
|
26
|
+
children,
|
|
27
|
+
value,
|
|
28
|
+
...props
|
|
29
|
+
}: Omit<React$1.ComponentProps<typeof Toggle>, 'value'> & {
|
|
30
|
+
value: string;
|
|
31
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { OptionList as n, OptionListProps as r, Option as t };
|
|
34
|
+
//# sourceMappingURL=option-list-CxhR_DGq.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React$1 from "react";
|
|
4
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
5
|
+
import { Popover } from "@base-ui/react/popover";
|
|
6
|
+
|
|
7
|
+
//#region src/components/popover.d.ts
|
|
8
|
+
declare function Popover$1(props: React$1.ComponentProps<typeof Popover.Root>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare function PopoverTrigger(props: React$1.ComponentProps<typeof Popover.Trigger>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
declare function PopoverClose(props: React$1.ComponentProps<typeof Popover.Close>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
/** Anchors the popover to this element instead of the trigger. Pass `render` to
|
|
12
|
+
* wrap an existing element (was radix `asChild`). */
|
|
13
|
+
declare function PopoverAnchor({
|
|
14
|
+
render,
|
|
15
|
+
...props
|
|
16
|
+
}: useRender.ComponentProps<'div'>): React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>>;
|
|
17
|
+
type PopoverContentProps = React$1.ComponentProps<typeof Popover.Popup> & Pick<Popover.Positioner.Props, 'align' | 'alignOffset' | 'side' | 'sideOffset' | 'anchor' | 'collisionAvoidance'> & Pick<Popover.Portal.Props, 'container'>;
|
|
18
|
+
declare function PopoverContent({
|
|
19
|
+
className,
|
|
20
|
+
align,
|
|
21
|
+
sideOffset,
|
|
22
|
+
side,
|
|
23
|
+
alignOffset,
|
|
24
|
+
anchor,
|
|
25
|
+
collisionAvoidance,
|
|
26
|
+
container,
|
|
27
|
+
...props
|
|
28
|
+
}: PopoverContentProps): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
//#endregion
|
|
30
|
+
export { PopoverTrigger as a, PopoverContent as i, PopoverAnchor as n, PopoverClose as r, Popover$1 as t };
|
|
31
|
+
//# sourceMappingURL=popover-DmcqNOkO.d.cts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React$1 from "react";
|
|
4
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
5
|
+
import { Popover } from "@base-ui/react/popover";
|
|
6
|
+
|
|
7
|
+
//#region src/components/popover.d.ts
|
|
8
|
+
declare function Popover$1(props: React$1.ComponentProps<typeof Popover.Root>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare function PopoverTrigger(props: React$1.ComponentProps<typeof Popover.Trigger>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
declare function PopoverClose(props: React$1.ComponentProps<typeof Popover.Close>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
/** Anchors the popover to this element instead of the trigger. Pass `render` to
|
|
12
|
+
* wrap an existing element (was radix `asChild`). */
|
|
13
|
+
declare function PopoverAnchor({
|
|
14
|
+
render,
|
|
15
|
+
...props
|
|
16
|
+
}: useRender.ComponentProps<'div'>): React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>>;
|
|
17
|
+
type PopoverContentProps = React$1.ComponentProps<typeof Popover.Popup> & Pick<Popover.Positioner.Props, 'align' | 'alignOffset' | 'side' | 'sideOffset' | 'anchor' | 'collisionAvoidance'> & Pick<Popover.Portal.Props, 'container'>;
|
|
18
|
+
declare function PopoverContent({
|
|
19
|
+
className,
|
|
20
|
+
align,
|
|
21
|
+
sideOffset,
|
|
22
|
+
side,
|
|
23
|
+
alignOffset,
|
|
24
|
+
anchor,
|
|
25
|
+
collisionAvoidance,
|
|
26
|
+
container,
|
|
27
|
+
...props
|
|
28
|
+
}: PopoverContentProps): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
//#endregion
|
|
30
|
+
export { PopoverTrigger as a, PopoverContent as i, PopoverAnchor as n, PopoverClose as r, Popover$1 as t };
|
|
31
|
+
//# sourceMappingURL=popover-DmcqNOkO.d.ts.map
|
|
@@ -1319,6 +1319,27 @@
|
|
|
1319
1319
|
--spark-card-c-contrast: var(--spark-contrast);
|
|
1320
1320
|
}
|
|
1321
1321
|
|
|
1322
|
+
/* Feedback card colours (Card `color` only, not a Theme knob): the same six slots on the green and orange scales. */
|
|
1323
|
+
[data-card-color='success'],
|
|
1324
|
+
:where([data-card-color='success'] .spark-theme) {
|
|
1325
|
+
--spark-card-c-soft: var(--green-a3);
|
|
1326
|
+
--spark-card-c-soft-hover: var(--green-a4);
|
|
1327
|
+
--spark-card-c-surface: var(--green-2);
|
|
1328
|
+
--spark-card-c-border: var(--green-a6);
|
|
1329
|
+
--spark-card-c-solid: var(--green-9);
|
|
1330
|
+
--spark-card-c-contrast: var(--green-contrast, #fff);
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1333
|
+
[data-card-color='warning'],
|
|
1334
|
+
:where([data-card-color='warning'] .spark-theme) {
|
|
1335
|
+
--spark-card-c-soft: var(--orange-a3);
|
|
1336
|
+
--spark-card-c-soft-hover: var(--orange-a4);
|
|
1337
|
+
--spark-card-c-surface: var(--orange-2);
|
|
1338
|
+
--spark-card-c-border: var(--orange-a6);
|
|
1339
|
+
--spark-card-c-solid: var(--orange-9);
|
|
1340
|
+
--spark-card-c-contrast: var(--orange-contrast, #fff);
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1322
1343
|
/* An explicit neutral card opts out of an inherited accent card colour: initial drops each slot to its neutral fallback. */
|
|
1323
1344
|
[data-card-color='neutral'],
|
|
1324
1345
|
:where([data-card-color='neutral'] .spark-theme) {
|
package/dist/styles/theme.css
CHANGED
|
@@ -543,6 +543,7 @@
|
|
|
543
543
|
--color-input-active: var(--spark-a8);
|
|
544
544
|
--color-input-valid: var(--green-a7);
|
|
545
545
|
--color-input-invalid: var(--red-a7);
|
|
546
|
+
--color-input-warning: var(--orange-a8);
|
|
546
547
|
--color-input-disabled: var(--neutral-a8);
|
|
547
548
|
}
|
|
548
549
|
|
|
@@ -762,5 +763,5 @@
|
|
|
762
763
|
'bg-{input-base,input-base-hover,dropdown-base,dropdown-item-hover}'
|
|
763
764
|
);
|
|
764
765
|
@source inline(
|
|
765
|
-
'border-{input,input-active,input-valid,input-invalid,input-disabled}'
|
|
766
|
+
'border-{input,input-active,input-valid,input-invalid,input-warning,input-disabled}'
|
|
766
767
|
);
|
package/dist/utils/cn.d.cts
CHANGED
package/dist/utils/cn.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epilot/spark-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.0",
|
|
4
4
|
"description": "React UI component library from Spark SDK",
|
|
5
5
|
"homepage": "https://spark-ui.epilot.io/docs/ui",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -81,9 +81,9 @@
|
|
|
81
81
|
"class-variance-authority": "^0.7.1",
|
|
82
82
|
"cn": "^0.4.0",
|
|
83
83
|
"colorjs.io": "^0.5.2",
|
|
84
|
-
"ictus": "^1.
|
|
84
|
+
"ictus": "^1.2.0",
|
|
85
85
|
"vaul": "^1.1.2",
|
|
86
|
-
"@epilot/spark-icons": "^0.0
|
|
86
|
+
"@epilot/spark-icons": "^0.1.0"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
89
|
"@stryker-mutator/core": "^10.0.0",
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import * as React$1 from "react";
|
|
4
|
-
import { MonthCaptionProps, MonthGridProps } from "@daypicker/react";
|
|
5
|
-
|
|
6
|
-
//#region src/lib/calendar-lists.d.ts
|
|
7
|
-
type CalendarListLabels = {
|
|
8
|
-
nextYear: string;
|
|
9
|
-
previousYear: string;
|
|
10
|
-
};
|
|
11
|
-
declare function MonthCaption({
|
|
12
|
-
calendarMonth,
|
|
13
|
-
className,
|
|
14
|
-
displayIndex: _,
|
|
15
|
-
...props
|
|
16
|
-
}: MonthCaptionProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
-
declare function MonthGrid(props: MonthGridProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
-
declare function CalendarListsProvider({
|
|
19
|
-
children,
|
|
20
|
-
labels
|
|
21
|
-
}: {
|
|
22
|
-
children: React$1.ReactNode;
|
|
23
|
-
labels: CalendarListLabels;
|
|
24
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
25
|
-
//#endregion
|
|
26
|
-
export { MonthGrid as i, CalendarListsProvider as n, MonthCaption as r, CalendarListLabels as t };
|
|
27
|
-
//# sourceMappingURL=calendar-lists-CTby2kR5.d.cts.map
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import * as React$1 from "react";
|
|
4
|
-
import { MonthCaptionProps, MonthGridProps } from "@daypicker/react";
|
|
5
|
-
|
|
6
|
-
//#region src/lib/calendar-lists.d.ts
|
|
7
|
-
type CalendarListLabels = {
|
|
8
|
-
nextYear: string;
|
|
9
|
-
previousYear: string;
|
|
10
|
-
};
|
|
11
|
-
declare function MonthCaption({
|
|
12
|
-
calendarMonth,
|
|
13
|
-
className,
|
|
14
|
-
displayIndex: _,
|
|
15
|
-
...props
|
|
16
|
-
}: MonthCaptionProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
-
declare function MonthGrid$1(props: MonthGridProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
-
declare function CalendarListsProvider({
|
|
19
|
-
children,
|
|
20
|
-
labels
|
|
21
|
-
}: {
|
|
22
|
-
children: React$1.ReactNode;
|
|
23
|
-
labels: CalendarListLabels;
|
|
24
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
25
|
-
//#endregion
|
|
26
|
-
export { MonthGrid$1 as i, CalendarListsProvider as n, MonthCaption as r, CalendarListLabels as t };
|
|
27
|
-
//# sourceMappingURL=calendar-lists-DoloqsCN.d.ts.map
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use client";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const require_chunk = require("../chunk-DY84GLCh.cjs");
|
|
5
|
-
let react = require("react");
|
|
6
|
-
react = require_chunk.__toESM(react);
|
|
7
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
-
//#region src/lib/calendar-day-button.tsx
|
|
9
|
-
/** DayPicker's day button, minus the page scroll when it takes focus. */
|
|
10
|
-
function ScrollFreeDayButton({ day: _day, modifiers, ...props }) {
|
|
11
|
-
const ref = react.useRef(null);
|
|
12
|
-
react.useEffect(() => {
|
|
13
|
-
if (modifiers.focused) ref.current?.focus({ preventScroll: true });
|
|
14
|
-
}, [modifiers.focused]);
|
|
15
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
16
|
-
ref,
|
|
17
|
-
...props
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
//#endregion
|
|
21
|
-
exports.ScrollFreeDayButton = ScrollFreeDayButton;
|
|
22
|
-
|
|
23
|
-
//# sourceMappingURL=calendar-day-button.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"calendar-day-button.cjs","names":["React"],"sources":["../../src/lib/calendar-day-button.tsx"],"sourcesContent":["'use client'\n\nimport type { DayButtonProps } from '@daypicker/react'\nimport * as React from 'react'\n\n/** DayPicker's day button, minus the page scroll when it takes focus. */\nexport function ScrollFreeDayButton({\n day: _day,\n modifiers,\n ...props\n}: DayButtonProps) {\n const ref = React.useRef<HTMLButtonElement>(null)\n React.useEffect(() => {\n if (modifiers.focused) ref.current?.focus({ preventScroll: true })\n }, [modifiers.focused])\n return <button ref={ref} {...props} />\n}\n"],"mappings":";;;;;;;;;AAMA,SAAgB,oBAAoB,EAClC,KAAK,MACL,WACA,GAAG,SACc;CACjB,MAAM,MAAMA,MAAM,OAA0B,IAAI;CAChD,MAAM,gBAAgB;EACpB,IAAI,UAAU,SAAS,IAAI,SAAS,MAAM,EAAE,eAAe,KAAK,CAAC;CACnE,GAAG,CAAC,UAAU,OAAO,CAAC;CACtB,OAAO,iBAAA,GAAA,kBAAA,KAAC,UAAD;EAAa;EAAK,GAAI;CAAQ,CAAA;AACvC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { DayButtonProps } from "@daypicker/react";
|
|
4
|
-
|
|
5
|
-
//#region src/lib/calendar-day-button.d.ts
|
|
6
|
-
/** DayPicker's day button, minus the page scroll when it takes focus. */
|
|
7
|
-
declare function ScrollFreeDayButton({
|
|
8
|
-
day: _day,
|
|
9
|
-
modifiers,
|
|
10
|
-
...props
|
|
11
|
-
}: DayButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
//#endregion
|
|
13
|
-
export { ScrollFreeDayButton };
|
|
14
|
-
//# sourceMappingURL=calendar-day-button.d.cts.map
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { DayButtonProps } from "@daypicker/react";
|
|
4
|
-
|
|
5
|
-
//#region src/lib/calendar-day-button.d.ts
|
|
6
|
-
/** DayPicker's day button, minus the page scroll when it takes focus. */
|
|
7
|
-
declare function ScrollFreeDayButton({
|
|
8
|
-
day: _day,
|
|
9
|
-
modifiers,
|
|
10
|
-
...props
|
|
11
|
-
}: DayButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
//#endregion
|
|
13
|
-
export { ScrollFreeDayButton };
|
|
14
|
-
//# sourceMappingURL=calendar-day-button.d.ts.map
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use client";
|
|
3
|
-
import * as React$1 from "react";
|
|
4
|
-
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
//#region src/lib/calendar-day-button.tsx
|
|
6
|
-
/** DayPicker's day button, minus the page scroll when it takes focus. */
|
|
7
|
-
function ScrollFreeDayButton({ day: _day, modifiers, ...props }) {
|
|
8
|
-
const ref = React$1.useRef(null);
|
|
9
|
-
React$1.useEffect(() => {
|
|
10
|
-
if (modifiers.focused) ref.current?.focus({ preventScroll: true });
|
|
11
|
-
}, [modifiers.focused]);
|
|
12
|
-
return /* @__PURE__ */ jsx("button", {
|
|
13
|
-
ref,
|
|
14
|
-
...props
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
//#endregion
|
|
18
|
-
export { ScrollFreeDayButton };
|
|
19
|
-
|
|
20
|
-
//# sourceMappingURL=calendar-day-button.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"calendar-day-button.js","names":["React"],"sources":["../../src/lib/calendar-day-button.tsx"],"sourcesContent":["'use client'\n\nimport type { DayButtonProps } from '@daypicker/react'\nimport * as React from 'react'\n\n/** DayPicker's day button, minus the page scroll when it takes focus. */\nexport function ScrollFreeDayButton({\n day: _day,\n modifiers,\n ...props\n}: DayButtonProps) {\n const ref = React.useRef<HTMLButtonElement>(null)\n React.useEffect(() => {\n if (modifiers.focused) ref.current?.focus({ preventScroll: true })\n }, [modifiers.focused])\n return <button ref={ref} {...props} />\n}\n"],"mappings":";;;;;;AAMA,SAAgB,oBAAoB,EAClC,KAAK,MACL,WACA,GAAG,SACc;CACjB,MAAM,MAAMA,QAAM,OAA0B,IAAI;CAChD,QAAM,gBAAgB;EACpB,IAAI,UAAU,SAAS,IAAI,SAAS,MAAM,EAAE,eAAe,KAAK,CAAC;CACnE,GAAG,CAAC,UAAU,OAAO,CAAC;CACtB,OAAO,oBAAC,UAAD;EAAa;EAAK,GAAI;CAAQ,CAAA;AACvC"}
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use client";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const require_chunk = require("../chunk-DY84GLCh.cjs");
|
|
5
|
-
const require_lib_scroll_within = require("./scroll-within.cjs");
|
|
6
|
-
const require_lib_date_time_mask = require("./date-time-mask.cjs");
|
|
7
|
-
let react = require("react");
|
|
8
|
-
react = require_chunk.__toESM(react);
|
|
9
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
|
-
let ictus_time = require("ictus/time");
|
|
11
|
-
let cn = require("cn");
|
|
12
|
-
//#region src/lib/input-date-parts.tsx
|
|
13
|
-
const MINUTES_PER_DAY = 1440;
|
|
14
|
-
const MIN_STEP = 5;
|
|
15
|
-
/** `HH:MM` every `step` minutes (5 at least), plus `extra` when it is off that grid. */
|
|
16
|
-
function timesOf(step, extra) {
|
|
17
|
-
const times = [];
|
|
18
|
-
for (let minutes = 0; minutes < MINUTES_PER_DAY; minutes += Math.max(MIN_STEP, step)) times.push((0, ictus_time.formatTime)({
|
|
19
|
-
hours: Math.floor(minutes / 60),
|
|
20
|
-
minutes: minutes % 60,
|
|
21
|
-
seconds: 0
|
|
22
|
-
}));
|
|
23
|
-
if (extra && !times.includes(extra)) {
|
|
24
|
-
const after = times.findIndex((time) => time > extra);
|
|
25
|
-
times.splice(after === -1 ? times.length : after, 0, extra);
|
|
26
|
-
}
|
|
27
|
-
return times;
|
|
28
|
-
}
|
|
29
|
-
function TimeList({ defaultTime, label, onPick, open, selectedTime, times }) {
|
|
30
|
-
const listRef = react.useRef(null);
|
|
31
|
-
react.useEffect(() => {
|
|
32
|
-
if (!open) return;
|
|
33
|
-
const frame = requestAnimationFrame(() => {
|
|
34
|
-
require_lib_scroll_within.scrollWithin(listRef.current, listRef.current?.querySelector("[aria-selected=\"true\"]") ?? null, "center");
|
|
35
|
-
});
|
|
36
|
-
return () => cancelAnimationFrame(frame);
|
|
37
|
-
}, [open]);
|
|
38
|
-
const moveFocus = (event) => {
|
|
39
|
-
const options = Array.from(listRef.current?.querySelectorAll("[role=\"option\"]") ?? []);
|
|
40
|
-
const index = options.indexOf(document.activeElement);
|
|
41
|
-
const target = {
|
|
42
|
-
ArrowDown: index + 1,
|
|
43
|
-
ArrowUp: index - 1,
|
|
44
|
-
End: options.length - 1,
|
|
45
|
-
Home: 0
|
|
46
|
-
}[event.key];
|
|
47
|
-
if (target === void 0) return;
|
|
48
|
-
event.preventDefault();
|
|
49
|
-
require_lib_scroll_within.focusWithin(listRef.current, options[Math.max(0, Math.min(options.length - 1, target))] ?? null);
|
|
50
|
-
};
|
|
51
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
52
|
-
className: "relative border-gray-a4 max-sm:h-40 max-sm:border-t sm:w-24 sm:border-l",
|
|
53
|
-
"data-slot": "input-date-times",
|
|
54
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
55
|
-
"aria-label": label,
|
|
56
|
-
className: "absolute inset-0 flex flex-col gap-0.5 overflow-y-auto p-2",
|
|
57
|
-
onKeyDown: moveFocus,
|
|
58
|
-
ref: listRef,
|
|
59
|
-
role: "listbox",
|
|
60
|
-
tabIndex: -1,
|
|
61
|
-
children: times.map((time) => {
|
|
62
|
-
const isSelected = time === selectedTime;
|
|
63
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
64
|
-
"aria-selected": isSelected,
|
|
65
|
-
className: (0, cn.cn)("shrink-0 cursor-pointer rounded-md px-3 py-1.5 text-center text-sm text-gray hover:bg-gray-a3 focus-visible:focus-outline", isSelected && "bg-(--spark-style-bg,var(--color-primary)) text-(--spark-style-fg,var(--color-primary-foreground)) hover:bg-(--spark-style-bg-hover,var(--color-primary-hover))"),
|
|
66
|
-
onClick: () => onPick(time),
|
|
67
|
-
role: "option",
|
|
68
|
-
tabIndex: isSelected || !selectedTime && time === defaultTime ? 0 : -1,
|
|
69
|
-
type: "button",
|
|
70
|
-
children: time
|
|
71
|
-
}, time);
|
|
72
|
-
})
|
|
73
|
-
})
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
/** Keystrokes and pastes through the date (and time) mask. */
|
|
77
|
-
function useMaskHandlers({ commit, inputRef, onKeyDown, onOpen, onPaste, onRejectedKey, pickerOnly, separator, withTime }) {
|
|
78
|
-
const placeCaret = (caret) => {
|
|
79
|
-
const input = inputRef.current;
|
|
80
|
-
requestAnimationFrame(() => {
|
|
81
|
-
input?.setSelectionRange(caret, caret);
|
|
82
|
-
});
|
|
83
|
-
};
|
|
84
|
-
const handleKeyDown = (event) => {
|
|
85
|
-
onKeyDown?.(event);
|
|
86
|
-
if (event.defaultPrevented) return;
|
|
87
|
-
if (event.key === "ArrowDown") {
|
|
88
|
-
event.preventDefault();
|
|
89
|
-
onOpen();
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
if (pickerOnly || event.ctrlKey || event.metaKey || event.altKey) return;
|
|
93
|
-
if (!require_lib_date_time_mask.isDateTimeMaskKey(event.key, withTime)) {
|
|
94
|
-
if (event.key.length === 1) {
|
|
95
|
-
event.preventDefault();
|
|
96
|
-
onRejectedKey();
|
|
97
|
-
}
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
event.preventDefault();
|
|
101
|
-
const next = require_lib_date_time_mask.applyDateTimeMask({
|
|
102
|
-
caret: event.currentTarget.selectionStart ?? 0,
|
|
103
|
-
key: event.key,
|
|
104
|
-
selectionEnd: event.currentTarget.selectionEnd ?? void 0,
|
|
105
|
-
separator,
|
|
106
|
-
value: event.currentTarget.value,
|
|
107
|
-
withTime
|
|
108
|
-
});
|
|
109
|
-
commit(next.value);
|
|
110
|
-
placeCaret(next.caret);
|
|
111
|
-
};
|
|
112
|
-
const handlePaste = (event) => {
|
|
113
|
-
onPaste?.(event);
|
|
114
|
-
if (event.defaultPrevented || pickerOnly) return;
|
|
115
|
-
event.preventDefault();
|
|
116
|
-
const next = require_lib_date_time_mask.applyDateTimePaste({
|
|
117
|
-
caret: event.currentTarget.selectionStart ?? 0,
|
|
118
|
-
pasted: event.clipboardData.getData("text"),
|
|
119
|
-
selectionEnd: event.currentTarget.selectionEnd ?? void 0,
|
|
120
|
-
separator,
|
|
121
|
-
value: event.currentTarget.value,
|
|
122
|
-
withTime
|
|
123
|
-
});
|
|
124
|
-
commit(next.value);
|
|
125
|
-
placeCaret(next.caret);
|
|
126
|
-
};
|
|
127
|
-
return {
|
|
128
|
-
onKeyDown: handleKeyDown,
|
|
129
|
-
onPaste: handlePaste
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
/** A polite message that is read again when it repeats. */
|
|
133
|
-
function useAnnouncement() {
|
|
134
|
-
const [message, setMessage] = react.useState({
|
|
135
|
-
text: "",
|
|
136
|
-
count: 0
|
|
137
|
-
});
|
|
138
|
-
const announce = react.useCallback((text) => setMessage((current) => ({
|
|
139
|
-
text,
|
|
140
|
-
count: current.count + 1
|
|
141
|
-
})), []);
|
|
142
|
-
return [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
143
|
-
"aria-live": "polite",
|
|
144
|
-
className: "sr-only",
|
|
145
|
-
"data-slot": "input-date-status",
|
|
146
|
-
children: [message.text, message.count % 2 ? "\xA0" : ""]
|
|
147
|
-
}), announce];
|
|
148
|
-
}
|
|
149
|
-
//#endregion
|
|
150
|
-
exports.TimeList = TimeList;
|
|
151
|
-
exports.timesOf = timesOf;
|
|
152
|
-
exports.useAnnouncement = useAnnouncement;
|
|
153
|
-
exports.useMaskHandlers = useMaskHandlers;
|
|
154
|
-
|
|
155
|
-
//# sourceMappingURL=input-date-parts.cjs.map
|