@epilot/spark-ui 0.32.1 → 0.32.3
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-i1Bgbw4p.d.ts → button-4QGaO78M.d.ts} +2 -2
- package/dist/{button-CT39v1M3.d.cts → button-C-KeUy2j.d.cts} +2 -2
- package/dist/components/accordion.cjs +2 -2
- package/dist/components/accordion.d.ts +1 -1
- package/dist/components/accordion.js +2 -2
- 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 +3 -3
- package/dist/components/attachment.cjs.map +1 -1
- package/dist/components/attachment.d.cts +3 -3
- package/dist/components/attachment.d.ts +3 -3
- package/dist/components/attachment.js +3 -3
- package/dist/components/attachment.js.map +1 -1
- package/dist/components/autocomplete.cjs +1 -1
- package/dist/components/autocomplete.js +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.js +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.cjs.map +1 -1
- package/dist/components/bubble.d.cts +1 -1
- package/dist/components/bubble.d.ts +1 -1
- package/dist/components/bubble.js +2 -2
- package/dist/components/bubble.js.map +1 -1
- package/dist/components/button-group.cjs +1 -1
- package/dist/components/button-group.js +2 -2
- package/dist/components/button.cjs +1 -1
- package/dist/components/button.d.cts +1 -1
- package/dist/components/button.d.ts +1 -1
- package/dist/components/button.js +2 -2
- package/dist/components/calendar.cjs +3 -3
- package/dist/components/calendar.js +3 -3
- package/dist/components/callout.cjs +2 -2
- package/dist/components/callout.d.cts +1 -1
- package/dist/components/callout.d.ts +2 -2
- package/dist/components/callout.js +2 -2
- package/dist/components/card.cjs +1 -1
- package/dist/components/card.js +1 -1
- package/dist/components/checkbox-group.js +1 -1
- package/dist/components/checkbox.js +1 -1
- package/dist/components/combobox.cjs +70 -25
- package/dist/components/combobox.cjs.map +1 -1
- package/dist/components/combobox.d.cts +2 -5
- package/dist/components/combobox.d.ts +2 -5
- package/dist/components/combobox.js +70 -25
- 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 +2 -2
- package/dist/components/dropdown-menu.cjs.map +1 -1
- package/dist/components/dropdown-menu.js +2 -2
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/dropzone.cjs +1 -1
- package/dist/components/dropzone.cjs.map +1 -1
- package/dist/components/dropzone.d.cts +1 -1
- package/dist/components/dropzone.d.ts +1 -1
- package/dist/components/dropzone.js +1 -1
- package/dist/components/dropzone.js.map +1 -1
- package/dist/components/empty-state.cjs +1 -1
- package/dist/components/empty-state.d.cts +1 -1
- package/dist/components/empty-state.d.ts +2 -2
- package/dist/components/empty-state.js +1 -1
- package/dist/components/entity-card.cjs +4 -4
- package/dist/components/entity-card.cjs.map +1 -1
- package/dist/components/entity-card.d.ts +1 -1
- package/dist/components/entity-card.js +4 -4
- package/dist/components/entity-card.js.map +1 -1
- package/dist/components/field.cjs +8 -8
- package/dist/components/field.cjs.map +1 -1
- package/dist/components/field.js +8 -8
- package/dist/components/field.js.map +1 -1
- package/dist/components/hero-metric.cjs +4 -4
- package/dist/components/hero-metric.cjs.map +1 -1
- package/dist/components/hero-metric.js +4 -4
- package/dist/components/hero-metric.js.map +1 -1
- package/dist/components/icon.js +1 -1
- package/dist/components/image-carousel.cjs +2 -2
- package/dist/components/image-carousel.d.cts +1 -1
- package/dist/components/image-carousel.d.ts +1 -1
- package/dist/components/image-carousel.js +3 -3
- package/dist/components/info-block.cjs +1 -1
- package/dist/components/info-block.js +1 -1
- package/dist/components/input-group.cjs +4 -4
- package/dist/components/input-group.cjs.map +1 -1
- package/dist/components/input-group.js +4 -4
- 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 +3 -3
- package/dist/components/input.cjs.map +1 -1
- package/dist/components/input.js +3 -3
- package/dist/components/input.js.map +1 -1
- package/dist/components/line-chart.cjs +1 -1
- package/dist/components/line-chart.js +2 -2
- package/dist/components/list.cjs +1 -1
- package/dist/components/list.js +1 -1
- package/dist/components/marker.cjs +1 -1
- package/dist/components/marker.d.cts +1 -1
- package/dist/components/marker.d.ts +1 -1
- package/dist/components/marker.js +1 -1
- package/dist/components/message-scroller.cjs +2 -2
- 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 +2 -2
- package/dist/components/page-header.d.cts +2 -2
- package/dist/components/page-header.d.ts +2 -2
- package/dist/components/page-header.js +2 -2
- package/dist/components/pagination.cjs +1 -1
- package/dist/components/pagination.d.cts +1 -1
- package/dist/components/pagination.d.ts +1 -1
- package/dist/components/pagination.js +1 -1
- package/dist/components/period-tabs.d.cts +1 -1
- package/dist/components/period-tabs.d.ts +1 -1
- package/dist/components/pill.cjs +1 -1
- package/dist/components/pill.d.cts +1 -1
- package/dist/components/pill.d.ts +1 -1
- package/dist/components/pill.js +2 -2
- package/dist/components/popover.cjs +1 -1
- package/dist/components/popover.js +1 -1
- package/dist/components/power-history-chart.cjs +1 -1
- package/dist/components/power-history-chart.js +2 -2
- package/dist/components/power-network.cjs +2 -2
- package/dist/components/power-network.js +2 -2
- package/dist/components/radio-card-group.cjs +2 -2
- package/dist/components/radio-card-group.cjs.map +1 -1
- package/dist/components/radio-card-group.js +2 -2
- package/dist/components/radio-card-group.js.map +1 -1
- package/dist/components/radio.js +1 -1
- package/dist/components/schedule-list.cjs +2 -2
- package/dist/components/schedule-list.cjs.map +1 -1
- package/dist/components/schedule-list.js +2 -2
- package/dist/components/schedule-list.js.map +1 -1
- package/dist/components/select.cjs +2 -2
- package/dist/components/select.js +2 -2
- 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.d.ts +1 -1
- package/dist/components/step-indicator.cjs +2 -2
- package/dist/components/step-indicator.js +2 -2
- package/dist/components/stepper.cjs +1 -1
- package/dist/components/stepper.js +1 -1
- package/dist/components/switch-group.js +1 -1
- 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 +22 -11
- package/dist/components/tabs.cjs.map +1 -1
- package/dist/components/tabs.d.cts +5 -1
- package/dist/components/tabs.d.ts +5 -1
- package/dist/components/tabs.js +23 -12
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/textarea.cjs +3 -3
- package/dist/components/textarea.cjs.map +1 -1
- package/dist/components/textarea.js +3 -3
- 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/toast.cjs +4 -4
- package/dist/components/toast.cjs.map +1 -1
- package/dist/components/toast.js +4 -4
- package/dist/components/toast.js.map +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 +1 -1
- package/dist/components/tooltip.js +1 -1
- package/dist/components/trace.cjs +3 -3
- package/dist/components/trace.cjs.map +1 -1
- package/dist/components/trace.js +3 -3
- package/dist/components/trace.js.map +1 -1
- package/dist/hooks/use-overflow-list.cjs +79 -0
- package/dist/hooks/use-overflow-list.cjs.map +1 -0
- package/dist/hooks/use-overflow-list.d.cts +48 -0
- package/dist/hooks/use-overflow-list.d.ts +48 -0
- package/dist/hooks/use-overflow-list.js +77 -0
- package/dist/hooks/use-overflow-list.js.map +1 -0
- package/dist/lib/calendar-lists.cjs +2 -2
- package/dist/lib/calendar-lists.js +2 -2
- package/dist/lib/date-field.cjs +8 -7
- package/dist/lib/date-field.cjs.map +1 -1
- package/dist/lib/date-field.d.cts +7 -1
- package/dist/lib/date-field.d.ts +7 -1
- package/dist/lib/date-field.js +8 -7
- package/dist/lib/date-field.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/toggle-group-context.d.cts +1 -1
- package/dist/lib/toggle-group-context.d.ts +1 -1
- package/dist/styles/theme.css +10 -5
- package/package.json +1 -1
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
3
|
+
//#region src/hooks/use-overflow-list.ts
|
|
4
|
+
const useIsomorphicLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
|
|
5
|
+
/**
|
|
6
|
+
* How many leading items fit in `containerWidth`. Either every item fits and no
|
|
7
|
+
* trigger is needed, or the `+N` trigger takes the last slot and must fit beside
|
|
8
|
+
* the items that remain.
|
|
9
|
+
*
|
|
10
|
+
* Pure so it can be tested: jsdom reports every width as `0`.
|
|
11
|
+
*/
|
|
12
|
+
function computeVisibleCount({ itemWidths, containerWidth, gap = 0, triggerWidth = 0 }) {
|
|
13
|
+
const total = itemWidths.length;
|
|
14
|
+
if (total === 0) return 0;
|
|
15
|
+
if (!(containerWidth > 0)) return total;
|
|
16
|
+
const widthOf = (count) => itemWidths.slice(0, count).reduce((sum, width) => sum + width, 0) + Math.max(0, count - 1) * gap;
|
|
17
|
+
if (widthOf(total) <= containerWidth) return total;
|
|
18
|
+
for (let count = total - 1; count > 0; count--) if (widthOf(count) + gap + triggerWidth <= containerWidth) return count;
|
|
19
|
+
return 0;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Width-driven visible count for a list that folds its remainder into a `+N`
|
|
23
|
+
* trigger. Measures a hidden layer, so items that are currently folded still have
|
|
24
|
+
* a real width.
|
|
25
|
+
*/
|
|
26
|
+
function useOverflowList({ itemCount, enabled = true }) {
|
|
27
|
+
const containerRef = useRef(null);
|
|
28
|
+
const measureRef = useRef(null);
|
|
29
|
+
const [visibleCount, setVisibleCount] = useState(itemCount);
|
|
30
|
+
const measure = useCallback(() => {
|
|
31
|
+
const container = containerRef.current;
|
|
32
|
+
const measureEl = measureRef.current;
|
|
33
|
+
if (!container || !measureEl) return;
|
|
34
|
+
const triggerEl = measureEl.querySelector("[data-slot=\"combobox-chips-measure-overflow\"]");
|
|
35
|
+
const triggerWidth = triggerEl ? Math.ceil(triggerEl.getBoundingClientRect().width) : 0;
|
|
36
|
+
const itemWidths = Array.from(measureEl.children).filter((child) => child !== triggerEl).map((child) => Math.ceil(child.getBoundingClientRect().width));
|
|
37
|
+
const style = window.getComputedStyle(container);
|
|
38
|
+
const gap = parseFloat(style.columnGap) || 0;
|
|
39
|
+
const padding = (parseFloat(style.paddingInlineStart) || 0) + (parseFloat(style.paddingInlineEnd) || 0);
|
|
40
|
+
setVisibleCount(computeVisibleCount({
|
|
41
|
+
itemWidths,
|
|
42
|
+
containerWidth: container.clientWidth - padding,
|
|
43
|
+
gap,
|
|
44
|
+
triggerWidth
|
|
45
|
+
}));
|
|
46
|
+
}, []);
|
|
47
|
+
useIsomorphicLayoutEffect(() => {
|
|
48
|
+
if (!enabled) {
|
|
49
|
+
setVisibleCount(itemCount);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
measure();
|
|
53
|
+
});
|
|
54
|
+
useIsomorphicLayoutEffect(() => {
|
|
55
|
+
if (!enabled) return;
|
|
56
|
+
const container = containerRef.current;
|
|
57
|
+
const measureEl = measureRef.current;
|
|
58
|
+
if (!container || !measureEl) return;
|
|
59
|
+
const observer = new ResizeObserver(() => {
|
|
60
|
+
measure();
|
|
61
|
+
});
|
|
62
|
+
observer.observe(container);
|
|
63
|
+
observer.observe(measureEl);
|
|
64
|
+
return () => {
|
|
65
|
+
observer.disconnect();
|
|
66
|
+
};
|
|
67
|
+
}, [enabled, measure]);
|
|
68
|
+
return {
|
|
69
|
+
containerRef,
|
|
70
|
+
measureRef,
|
|
71
|
+
visibleCount
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
//#endregion
|
|
75
|
+
export { computeVisibleCount, useOverflowList };
|
|
76
|
+
|
|
77
|
+
//# sourceMappingURL=use-overflow-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-overflow-list.js","names":[],"sources":["../../src/hooks/use-overflow-list.ts"],"sourcesContent":["import {\n useCallback,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n} from 'react'\n\n// `useLayoutEffect` warns during prerendering, and there is no layout to read on the server.\nconst useIsomorphicLayoutEffect =\n typeof window === 'undefined' ? useEffect : useLayoutEffect\n\nexport type ComputeVisibleCountOptions = {\n /** Natural width of every item, in source order, in pixels. */\n itemWidths: number[]\n /** Width available to lay the items out in, in pixels. */\n containerWidth: number\n /** Gap between two adjacent items, in pixels. Default: 0 */\n gap?: number\n /** Width of the `+N` trigger, which must fit whenever anything is hidden. Default: 0 */\n triggerWidth?: number\n}\n\n/**\n * How many leading items fit in `containerWidth`. Either every item fits and no\n * trigger is needed, or the `+N` trigger takes the last slot and must fit beside\n * the items that remain.\n *\n * Pure so it can be tested: jsdom reports every width as `0`.\n */\nexport function computeVisibleCount({\n itemWidths,\n containerWidth,\n gap = 0,\n triggerWidth = 0,\n}: ComputeVisibleCountOptions): number {\n const total = itemWidths.length\n if (total === 0) return 0\n\n // Unmeasured (first paint, detached or zero-width container): showing everything\n // also keeps server-rendered markup complete.\n if (!(containerWidth > 0)) return total\n\n const widthOf = (count: number) =>\n itemWidths.slice(0, count).reduce((sum, width) => sum + width, 0) +\n Math.max(0, count - 1) * gap\n\n if (widthOf(total) <= containerWidth) return total\n\n for (let count = total - 1; count > 0; count--) {\n if (widthOf(count) + gap + triggerWidth <= containerWidth) return count\n }\n\n return 0\n}\n\nexport type UseOverflowListOptions = {\n /** Number of items the list can show. */\n itemCount: number\n /** Measure the container. Pass `false` for a fixed visible count. Default: true */\n enabled?: boolean\n}\n\nexport type UseOverflowListReturn = {\n /** Ref for the element whose width constrains the list. */\n containerRef: React.RefObject<HTMLDivElement | null>\n /**\n * Ref for the hidden layer that renders every item at its natural width, one\n * wrapper element per item, followed by a `+N` trigger clone marked\n * `data-slot=\"combobox-chips-measure-overflow\"`.\n */\n measureRef: React.RefObject<HTMLDivElement | null>\n /** How many leading items currently fit. */\n visibleCount: number\n}\n\n/**\n * Width-driven visible count for a list that folds its remainder into a `+N`\n * trigger. Measures a hidden layer, so items that are currently folded still have\n * a real width.\n */\nexport function useOverflowList({\n itemCount,\n enabled = true,\n}: UseOverflowListOptions): UseOverflowListReturn {\n const containerRef = useRef<HTMLDivElement | null>(null)\n const measureRef = useRef<HTMLDivElement | null>(null)\n const [visibleCount, setVisibleCount] = useState(itemCount)\n\n const measure = useCallback(() => {\n const container = containerRef.current\n const measureEl = measureRef.current\n if (!container || !measureEl) return\n\n const triggerEl = measureEl.querySelector(\n '[data-slot=\"combobox-chips-measure-overflow\"]',\n )\n const triggerWidth = triggerEl\n ? Math.ceil(triggerEl.getBoundingClientRect().width)\n : 0\n const itemWidths = Array.from(measureEl.children)\n .filter((child) => child !== triggerEl)\n .map((child) => Math.ceil(child.getBoundingClientRect().width))\n\n const style = window.getComputedStyle(container)\n const gap = parseFloat(style.columnGap) || 0\n\n // `clientWidth` includes padding; a padded row would clip its last item otherwise.\n const padding =\n (parseFloat(style.paddingInlineStart) || 0) +\n (parseFloat(style.paddingInlineEnd) || 0)\n\n setVisibleCount(\n computeVisibleCount({\n itemWidths,\n containerWidth: container.clientWidth - padding,\n gap,\n triggerWidth,\n }),\n )\n }, [])\n\n // Every render: relabelled items keep the count but change the widths.\n useIsomorphicLayoutEffect(() => {\n if (!enabled) {\n setVisibleCount(itemCount)\n return\n }\n measure()\n })\n\n useIsomorphicLayoutEffect(() => {\n if (!enabled) return\n\n const container = containerRef.current\n const measureEl = measureRef.current\n if (!container || !measureEl) return\n\n const observer = new ResizeObserver(() => {\n measure()\n })\n observer.observe(container)\n // The measure layer is `w-max`, so it resizes with any item (late font, async label).\n observer.observe(measureEl)\n\n return () => {\n observer.disconnect()\n }\n }, [enabled, measure])\n\n return { containerRef, measureRef, visibleCount }\n}\n"],"mappings":";;;AASA,MAAM,4BACJ,OAAO,WAAW,cAAc,YAAY;;;;;;;;AAoB9C,SAAgB,oBAAoB,EAClC,YACA,gBACA,MAAM,GACN,eAAe,KACsB;CACrC,MAAM,QAAQ,WAAW;CACzB,IAAI,UAAU,GAAG,OAAO;CAIxB,IAAI,EAAE,iBAAiB,IAAI,OAAO;CAElC,MAAM,WAAW,UACf,WAAW,MAAM,GAAG,KAAK,EAAE,QAAQ,KAAK,UAAU,MAAM,OAAO,CAAC,IAChE,KAAK,IAAI,GAAG,QAAQ,CAAC,IAAI;CAE3B,IAAI,QAAQ,KAAK,KAAK,gBAAgB,OAAO;CAE7C,KAAK,IAAI,QAAQ,QAAQ,GAAG,QAAQ,GAAG,SACrC,IAAI,QAAQ,KAAK,IAAI,MAAM,gBAAgB,gBAAgB,OAAO;CAGpE,OAAO;AACT;;;;;;AA2BA,SAAgB,gBAAgB,EAC9B,WACA,UAAU,QACsC;CAChD,MAAM,eAAe,OAA8B,IAAI;CACvD,MAAM,aAAa,OAA8B,IAAI;CACrD,MAAM,CAAC,cAAc,mBAAmB,SAAS,SAAS;CAE1D,MAAM,UAAU,kBAAkB;EAChC,MAAM,YAAY,aAAa;EAC/B,MAAM,YAAY,WAAW;EAC7B,IAAI,CAAC,aAAa,CAAC,WAAW;EAE9B,MAAM,YAAY,UAAU,cAC1B,iDACF;EACA,MAAM,eAAe,YACjB,KAAK,KAAK,UAAU,sBAAsB,EAAE,KAAK,IACjD;EACJ,MAAM,aAAa,MAAM,KAAK,UAAU,QAAQ,EAC7C,QAAQ,UAAU,UAAU,SAAS,EACrC,KAAK,UAAU,KAAK,KAAK,MAAM,sBAAsB,EAAE,KAAK,CAAC;EAEhE,MAAM,QAAQ,OAAO,iBAAiB,SAAS;EAC/C,MAAM,MAAM,WAAW,MAAM,SAAS,KAAK;EAG3C,MAAM,WACH,WAAW,MAAM,kBAAkB,KAAK,MACxC,WAAW,MAAM,gBAAgB,KAAK;EAEzC,gBACE,oBAAoB;GAClB;GACA,gBAAgB,UAAU,cAAc;GACxC;GACA;EACF,CAAC,CACH;CACF,GAAG,CAAC,CAAC;CAGL,gCAAgC;EAC9B,IAAI,CAAC,SAAS;GACZ,gBAAgB,SAAS;GACzB;EACF;EACA,QAAQ;CACV,CAAC;CAED,gCAAgC;EAC9B,IAAI,CAAC,SAAS;EAEd,MAAM,YAAY,aAAa;EAC/B,MAAM,YAAY,WAAW;EAC7B,IAAI,CAAC,aAAa,CAAC,WAAW;EAE9B,MAAM,WAAW,IAAI,qBAAqB;GACxC,QAAQ;EACV,CAAC;EACD,SAAS,QAAQ,SAAS;EAE1B,SAAS,QAAQ,SAAS;EAE1B,aAAa;GACX,SAAS,WAAW;EACtB;CACF,GAAG,CAAC,SAAS,OAAO,CAAC;CAErB,OAAO;EAAE;EAAc;EAAY;CAAa;AAClD"}
|
|
@@ -4,11 +4,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
4
4
|
const require_chunk = require("../chunk-DY84GLCh.cjs");
|
|
5
5
|
const require_components_button = require("../components/button.cjs");
|
|
6
6
|
const require_lib_option_list = require("./option-list.cjs");
|
|
7
|
+
let _epilot_spark_icons = require("@epilot/spark-icons");
|
|
7
8
|
let react = require("react");
|
|
8
9
|
react = require_chunk.__toESM(react);
|
|
9
|
-
let _daypicker_react = require("@daypicker/react");
|
|
10
|
-
let _epilot_spark_icons = require("@epilot/spark-icons");
|
|
11
10
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
|
+
let _daypicker_react = require("@daypicker/react");
|
|
12
12
|
let cn = require("cn");
|
|
13
13
|
//#region src/lib/calendar-lists.tsx
|
|
14
14
|
const ListContext = react.createContext({
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import { cn } from "../utils/cn.js";
|
|
4
4
|
import { buttonVariants } from "../components/button.js";
|
|
5
5
|
import { Option, OptionList } from "./option-list.js";
|
|
6
|
-
import * as React$1 from "react";
|
|
7
|
-
import { MonthGrid as MonthGrid$1, useDayPicker } from "@daypicker/react";
|
|
8
6
|
import { ArrowDropDown, Check, ChevronLeft, ChevronRight } from "@epilot/spark-icons";
|
|
7
|
+
import * as React$1 from "react";
|
|
9
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { MonthGrid as MonthGrid$1, useDayPicker } from "@daypicker/react";
|
|
10
10
|
//#region src/lib/calendar-lists.tsx
|
|
11
11
|
const ListContext = React$1.createContext({
|
|
12
12
|
close: () => void 0,
|
package/dist/lib/date-field.cjs
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
4
|
const require_chunk = require("../chunk-DY84GLCh.cjs");
|
|
5
|
-
const require_lib_calendar_field = require("./calendar-field.cjs");
|
|
6
5
|
const require_components_button = require("../components/button.cjs");
|
|
7
6
|
const require_components_input_group = require("../components/input-group.cjs");
|
|
7
|
+
const require_lib_calendar_field = require("./calendar-field.cjs");
|
|
8
8
|
const require_components_popover = require("../components/popover.cjs");
|
|
9
9
|
const require_lib_date_time_mask = require("./date-time-mask.cjs");
|
|
10
|
+
let _epilot_spark_icons = require("@epilot/spark-icons");
|
|
10
11
|
let react = require("react");
|
|
11
12
|
react = require_chunk.__toESM(react);
|
|
12
|
-
let _epilot_spark_icons = require("@epilot/spark-icons");
|
|
13
13
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
14
14
|
let _base_ui_react_popover = require("@base-ui/react/popover");
|
|
15
15
|
let cn = require("cn");
|
|
@@ -31,7 +31,7 @@ function isOutOfRange(date, { max, min, withTime }) {
|
|
|
31
31
|
const to = max && (withTime ? max : startOfDay(max));
|
|
32
32
|
return from !== void 0 && at < from || to !== void 0 && at > to;
|
|
33
33
|
}
|
|
34
|
-
function DateFieldRoot({ children, className, defaultOpen, defaultValue = "", disabled = false, max, min, onOpenChange, onValueChange, open, separator = ".", slot, value, withTime }) {
|
|
34
|
+
function DateFieldRoot({ children, className, defaultDay: defaultDayProp, defaultOpen, defaultValue = "", disabled = false, max, min, onOpenChange, onValueChange, open, separator = ".", slot, value, withTime }) {
|
|
35
35
|
const [text, setText] = useControllableState({
|
|
36
36
|
defaultProp: defaultValue,
|
|
37
37
|
prop: value
|
|
@@ -61,10 +61,10 @@ function DateFieldRoot({ children, className, defaultOpen, defaultValue = "", di
|
|
|
61
61
|
});
|
|
62
62
|
},
|
|
63
63
|
defaultDay: () => {
|
|
64
|
-
const
|
|
65
|
-
if (min &&
|
|
66
|
-
if (max &&
|
|
67
|
-
return
|
|
64
|
+
const day = startOfDay(defaultDayProp?.() ?? /* @__PURE__ */ new Date());
|
|
65
|
+
if (min && day < startOfDay(min)) return startOfDay(min);
|
|
66
|
+
if (max && day > startOfDay(max)) return startOfDay(max);
|
|
67
|
+
return day;
|
|
68
68
|
},
|
|
69
69
|
disabled,
|
|
70
70
|
handle,
|
|
@@ -79,6 +79,7 @@ function DateFieldRoot({ children, className, defaultOpen, defaultValue = "", di
|
|
|
79
79
|
triggerId,
|
|
80
80
|
withTime
|
|
81
81
|
}), [
|
|
82
|
+
defaultDayProp,
|
|
82
83
|
disabled,
|
|
83
84
|
handle,
|
|
84
85
|
max,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-field.cjs","names":["React","PopoverPrimitive","parseDateTime","Popover","PopoverAnchor","InputGroup","InputGroupAddon","PopoverTrigger","Button","CalendarMonth","parseDatePart","withDay","PopoverContent","CalendarFieldContext"],"sources":["../../src/lib/date-field.tsx"],"sourcesContent":["'use client'\n\nimport { Popover as PopoverPrimitive } from '@base-ui/react/popover'\nimport { CalendarMonth } from '@epilot/spark-icons'\nimport * as React from 'react'\nimport { Button } from '../components/button'\nimport { InputGroup, InputGroupAddon } from '../components/input-group'\nimport {\n Popover,\n PopoverAnchor,\n PopoverContent,\n PopoverTrigger,\n} from '../components/popover'\nimport { cn } from '../utils/cn'\nimport { type CalendarField, CalendarFieldContext } from './calendar-field'\nimport { parseDatePart, parseDateTime, withDay } from './date-time-mask'\n\nexport type DateFieldDetails = {\n date: Date | undefined\n outOfRange: boolean\n}\n\ntype DateFieldContextValue = {\n commit: (next: string) => void\n defaultDay: () => Date\n disabled: boolean\n handle: PopoverPrimitive.Handle<unknown>\n inputRef: React.RefObject<HTMLInputElement | null>\n max: Date | undefined\n min: Date | undefined\n outOfRange: boolean\n separator: string\n slot: string\n text: string\n timeList: React.RefObject<{ defaultTime: string } | null>\n triggerId: string\n withTime: boolean\n}\n\nconst DateFieldContext = React.createContext<DateFieldContextValue | null>(null)\n\nexport function useDateField(part: string) {\n const context = React.useContext(DateFieldContext)\n if (!context)\n throw new Error(\n `${part} must be placed inside its InputDate or InputDateTime root.`,\n )\n return context\n}\n\nfunction useControllableState<T>({\n defaultProp,\n prop,\n}: {\n defaultProp: T\n prop?: T\n}) {\n const [uncontrolled, setUncontrolled] = React.useState(defaultProp)\n return [prop ?? uncontrolled, setUncontrolled] as const\n}\n\nconst startOfDay = (date: Date) =>\n new Date(date.getFullYear(), date.getMonth(), date.getDate())\n\nfunction isOutOfRange(\n date: Date,\n { max, min, withTime }: { max?: Date; min?: Date; withTime: boolean },\n) {\n const at = withTime ? date : startOfDay(date)\n const from = min && (withTime ? min : startOfDay(min))\n const to = max && (withTime ? max : startOfDay(max))\n return (from !== undefined && at < from) || (to !== undefined && at > to)\n}\n\nexport type DateFieldRootProps = Pick<\n React.ComponentProps<typeof Popover>,\n 'defaultOpen' | 'onOpenChange' | 'open'\n> & {\n children: React.ReactNode\n className?: string\n defaultValue?: string\n disabled?: boolean\n max?: Date\n min?: Date\n onValueChange?: (value: string, details: DateFieldDetails) => void\n separator?: string\n value?: string\n}\n\nexport function DateFieldRoot({\n children,\n className,\n defaultOpen,\n defaultValue = '',\n disabled = false,\n max,\n min,\n onOpenChange,\n onValueChange,\n open,\n separator = '.',\n slot,\n value,\n withTime,\n}: DateFieldRootProps & { slot: string; withTime: boolean }) {\n const [text, setText] = useControllableState({\n defaultProp: defaultValue,\n prop: value,\n })\n const [handle] = React.useState(() => PopoverPrimitive.createHandle())\n const inputRef = React.useRef<HTMLInputElement>(null)\n const timeList = React.useRef<{ defaultTime: string } | null>(null)\n const triggerId = React.useId()\n const date = parseDateTime(text, withTime)\n const outOfRange =\n date !== undefined && isOutOfRange(date, { max, min, withTime })\n\n const context = React.useMemo<DateFieldContextValue>(\n () => ({\n commit: (next) => {\n if (next === text) return\n setText(next)\n const nextDate = parseDateTime(next, withTime)\n onValueChange?.(next, {\n date: nextDate,\n outOfRange:\n nextDate !== undefined &&\n isOutOfRange(nextDate, { max, min, withTime }),\n })\n },\n defaultDay: () => {\n const today = startOfDay(new Date())\n if (min && today < startOfDay(min)) return startOfDay(min)\n if (max && today > startOfDay(max)) return startOfDay(max)\n return today\n },\n disabled,\n handle,\n inputRef,\n max,\n min,\n outOfRange,\n separator,\n slot,\n text,\n timeList,\n triggerId,\n withTime,\n }),\n [\n disabled,\n handle,\n max,\n min,\n onValueChange,\n outOfRange,\n separator,\n setText,\n slot,\n text,\n triggerId,\n withTime,\n ],\n )\n\n return (\n <DateFieldContext.Provider value={context}>\n <Popover\n defaultOpen={defaultOpen}\n handle={handle}\n onOpenChange={onOpenChange}\n open={open}\n >\n <PopoverAnchor render={<div className=\"min-w-0\" data-slot={slot} />}>\n <InputGroup className={className}>{children}</InputGroup>\n </PopoverAnchor>\n </Popover>\n </DateFieldContext.Provider>\n )\n}\n\nexport type DateFieldTriggerProps = Omit<\n React.ComponentProps<typeof Button>,\n 'aria-label'\n> & { 'aria-label': string }\n\nexport function DateFieldTrigger({\n children,\n ...props\n}: DateFieldTriggerProps) {\n const { disabled, slot, triggerId } = useDateField(\n 'InputDateTrigger / InputDateTimeTrigger',\n )\n return (\n <InputGroupAddon align=\"inline-end\">\n <PopoverTrigger\n id={triggerId}\n render={\n <Button\n color=\"neutral\"\n data-slot={`${slot}-trigger`}\n disabled={disabled}\n size=\"icon-small\"\n styleVariant=\"ghost\"\n {...props}\n >\n {children ?? <CalendarMonth />}\n </Button>\n }\n />\n </InputGroupAddon>\n )\n}\n\nexport function DateFieldContent({\n children,\n className,\n ...props\n}: React.ComponentProps<typeof PopoverContent>) {\n const field = useDateField('InputDateContent / InputDateTimeContent')\n const { commit, handle, max, min, separator, text, withTime } = field\n const selected = withTime ? parseDatePart(text) : parseDateTime(text)\n\n const calendar: CalendarField = {\n defaultMonth: selected ?? field.defaultDay(),\n disabled: [\n ...(min ? [{ before: min }] : []),\n ...(max ? [{ after: max }] : []),\n ],\n endMonth: max,\n onSelect: (day) => {\n if (!day) {\n if (withTime) return\n commit('')\n handle.close()\n return\n }\n const timeList = field.timeList.current\n commit(\n withDay(text, day, {\n separator,\n time: timeList?.defaultTime,\n withTime,\n }),\n )\n if (timeList) return\n handle.close()\n if (withTime) field.inputRef.current?.focus({ preventScroll: true })\n },\n selected,\n startMonth: min,\n }\n\n return (\n <PopoverContent\n align=\"start\"\n aria-labelledby={field.triggerId}\n collisionAvoidance={{ side: 'flip', fallbackAxisSide: 'none' }}\n data-slot={`${field.slot}-content`}\n {...props}\n className={cn(\n 'flex w-auto p-0 max-sm:flex-col has-[[data-slot=calendar-list]]:[&>[data-slot=input-date-time-time-list]]:hidden',\n className,\n )}\n >\n <CalendarFieldContext.Provider value={calendar}>\n {children}\n </CalendarFieldContext.Provider>\n </PopoverContent>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAuCA,MAAM,mBAAmBA,MAAM,cAA4C,IAAI;AAE/E,SAAgB,aAAa,MAAc;CACzC,MAAM,UAAUA,MAAM,WAAW,gBAAgB;CACjD,IAAI,CAAC,SACH,MAAM,IAAI,MACR,GAAG,KAAK,4DACV;CACF,OAAO;AACT;AAEA,SAAS,qBAAwB,EAC/B,aACA,QAIC;CACD,MAAM,CAAC,cAAc,mBAAmBA,MAAM,SAAS,WAAW;CAClE,OAAO,CAAC,QAAQ,cAAc,eAAe;AAC/C;AAEA,MAAM,cAAc,SAClB,IAAI,KAAK,KAAK,YAAY,GAAG,KAAK,SAAS,GAAG,KAAK,QAAQ,CAAC;AAE9D,SAAS,aACP,MACA,EAAE,KAAK,KAAK,YACZ;CACA,MAAM,KAAK,WAAW,OAAO,WAAW,IAAI;CAC5C,MAAM,OAAO,QAAQ,WAAW,MAAM,WAAW,GAAG;CACpD,MAAM,KAAK,QAAQ,WAAW,MAAM,WAAW,GAAG;CAClD,OAAQ,SAAS,KAAA,KAAa,KAAK,QAAU,OAAO,KAAA,KAAa,KAAK;AACxE;AAiBA,SAAgB,cAAc,EAC5B,UACA,WACA,aACA,eAAe,IACf,WAAW,OACX,KACA,KACA,cACA,eACA,MACA,YAAY,KACZ,MACA,OACA,YAC2D;CAC3D,MAAM,CAAC,MAAM,WAAW,qBAAqB;EAC3C,aAAa;EACb,MAAM;CACR,CAAC;CACD,MAAM,CAAC,UAAUA,MAAM,eAAeC,uBAAAA,QAAiB,aAAa,CAAC;CACrE,MAAM,WAAWD,MAAM,OAAyB,IAAI;CACpD,MAAM,WAAWA,MAAM,OAAuC,IAAI;CAClE,MAAM,YAAYA,MAAM,MAAM;CAC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;EACzB,GAAI;EACJ,YAAA,GAAA,GAAA,IACE,oHACA,SACF;YAEA,iBAAA,GAAA,kBAAA,KAACC,2BAAAA,qBAAqB,UAAtB;GAA+B,OAAO;GACnC;EAC4B,CAAA;CACjB,CAAA;AAEpB"}
|
|
1
|
+
{"version":3,"file":"date-field.cjs","names":["React","PopoverPrimitive","parseDateTime","Popover","PopoverAnchor","InputGroup","InputGroupAddon","PopoverTrigger","Button","CalendarMonth","parseDatePart","withDay","PopoverContent","CalendarFieldContext"],"sources":["../../src/lib/date-field.tsx"],"sourcesContent":["'use client'\n\nimport { Popover as PopoverPrimitive } from '@base-ui/react/popover'\nimport { CalendarMonth } from '@epilot/spark-icons'\nimport * as React from 'react'\nimport { Button } from '../components/button'\nimport { InputGroup, InputGroupAddon } from '../components/input-group'\nimport {\n Popover,\n PopoverAnchor,\n PopoverContent,\n PopoverTrigger,\n} from '../components/popover'\nimport { cn } from '../utils/cn'\nimport { type CalendarField, CalendarFieldContext } from './calendar-field'\nimport { parseDatePart, parseDateTime, withDay } from './date-time-mask'\n\nexport type DateFieldDetails = {\n date: Date | undefined\n outOfRange: boolean\n}\n\ntype DateFieldContextValue = {\n commit: (next: string) => void\n defaultDay: () => Date\n disabled: boolean\n handle: PopoverPrimitive.Handle<unknown>\n inputRef: React.RefObject<HTMLInputElement | null>\n max: Date | undefined\n min: Date | undefined\n outOfRange: boolean\n separator: string\n slot: string\n text: string\n timeList: React.RefObject<{ defaultTime: string } | null>\n triggerId: string\n withTime: boolean\n}\n\nconst DateFieldContext = React.createContext<DateFieldContextValue | null>(null)\n\nexport function useDateField(part: string) {\n const context = React.useContext(DateFieldContext)\n if (!context)\n throw new Error(\n `${part} must be placed inside its InputDate or InputDateTime root.`,\n )\n return context\n}\n\nfunction useControllableState<T>({\n defaultProp,\n prop,\n}: {\n defaultProp: T\n prop?: T\n}) {\n const [uncontrolled, setUncontrolled] = React.useState(defaultProp)\n return [prop ?? uncontrolled, setUncontrolled] as const\n}\n\nconst startOfDay = (date: Date) =>\n new Date(date.getFullYear(), date.getMonth(), date.getDate())\n\nfunction isOutOfRange(\n date: Date,\n { max, min, withTime }: { max?: Date; min?: Date; withTime: boolean },\n) {\n const at = withTime ? date : startOfDay(date)\n const from = min && (withTime ? min : startOfDay(min))\n const to = max && (withTime ? max : startOfDay(max))\n return (from !== undefined && at < from) || (to !== undefined && at > to)\n}\n\nexport type DateFieldRootProps = Pick<\n React.ComponentProps<typeof Popover>,\n 'defaultOpen' | 'onOpenChange' | 'open'\n> & {\n children: React.ReactNode\n className?: string\n /**\n * The day an empty field opens on, and the day a time picked before any date applies to;\n * today by default. Kept within `min` and `max`.\n */\n defaultDay?: () => Date\n defaultValue?: string\n disabled?: boolean\n max?: Date\n min?: Date\n onValueChange?: (value: string, details: DateFieldDetails) => void\n separator?: string\n value?: string\n}\n\nexport function DateFieldRoot({\n children,\n className,\n defaultDay: defaultDayProp,\n defaultOpen,\n defaultValue = '',\n disabled = false,\n max,\n min,\n onOpenChange,\n onValueChange,\n open,\n separator = '.',\n slot,\n value,\n withTime,\n}: DateFieldRootProps & { slot: string; withTime: boolean }) {\n const [text, setText] = useControllableState({\n defaultProp: defaultValue,\n prop: value,\n })\n const [handle] = React.useState(() => PopoverPrimitive.createHandle())\n const inputRef = React.useRef<HTMLInputElement>(null)\n const timeList = React.useRef<{ defaultTime: string } | null>(null)\n const triggerId = React.useId()\n const date = parseDateTime(text, withTime)\n const outOfRange =\n date !== undefined && isOutOfRange(date, { max, min, withTime })\n\n const context = React.useMemo<DateFieldContextValue>(\n () => ({\n commit: (next) => {\n if (next === text) return\n setText(next)\n const nextDate = parseDateTime(next, withTime)\n onValueChange?.(next, {\n date: nextDate,\n outOfRange:\n nextDate !== undefined &&\n isOutOfRange(nextDate, { max, min, withTime }),\n })\n },\n defaultDay: () => {\n const day = startOfDay(defaultDayProp?.() ?? new Date())\n if (min && day < startOfDay(min)) return startOfDay(min)\n if (max && day > startOfDay(max)) return startOfDay(max)\n return day\n },\n disabled,\n handle,\n inputRef,\n max,\n min,\n outOfRange,\n separator,\n slot,\n text,\n timeList,\n triggerId,\n withTime,\n }),\n [\n defaultDayProp,\n disabled,\n handle,\n max,\n min,\n onValueChange,\n outOfRange,\n separator,\n setText,\n slot,\n text,\n triggerId,\n withTime,\n ],\n )\n\n return (\n <DateFieldContext.Provider value={context}>\n <Popover\n defaultOpen={defaultOpen}\n handle={handle}\n onOpenChange={onOpenChange}\n open={open}\n >\n <PopoverAnchor render={<div className=\"min-w-0\" data-slot={slot} />}>\n <InputGroup className={className}>{children}</InputGroup>\n </PopoverAnchor>\n </Popover>\n </DateFieldContext.Provider>\n )\n}\n\nexport type DateFieldTriggerProps = Omit<\n React.ComponentProps<typeof Button>,\n 'aria-label'\n> & { 'aria-label': string }\n\nexport function DateFieldTrigger({\n children,\n ...props\n}: DateFieldTriggerProps) {\n const { disabled, slot, triggerId } = useDateField(\n 'InputDateTrigger / InputDateTimeTrigger',\n )\n return (\n <InputGroupAddon align=\"inline-end\">\n <PopoverTrigger\n id={triggerId}\n render={\n <Button\n color=\"neutral\"\n data-slot={`${slot}-trigger`}\n disabled={disabled}\n size=\"icon-small\"\n styleVariant=\"ghost\"\n {...props}\n >\n {children ?? <CalendarMonth />}\n </Button>\n }\n />\n </InputGroupAddon>\n )\n}\n\nexport function DateFieldContent({\n children,\n className,\n ...props\n}: React.ComponentProps<typeof PopoverContent>) {\n const field = useDateField('InputDateContent / InputDateTimeContent')\n const { commit, handle, max, min, separator, text, withTime } = field\n const selected = withTime ? parseDatePart(text) : parseDateTime(text)\n\n const calendar: CalendarField = {\n defaultMonth: selected ?? field.defaultDay(),\n disabled: [\n ...(min ? [{ before: min }] : []),\n ...(max ? [{ after: max }] : []),\n ],\n endMonth: max,\n onSelect: (day) => {\n if (!day) {\n if (withTime) return\n commit('')\n handle.close()\n return\n }\n const timeList = field.timeList.current\n commit(\n withDay(text, day, {\n separator,\n time: timeList?.defaultTime,\n withTime,\n }),\n )\n if (timeList) return\n handle.close()\n if (withTime) field.inputRef.current?.focus({ preventScroll: true })\n },\n selected,\n startMonth: min,\n }\n\n return (\n <PopoverContent\n align=\"start\"\n aria-labelledby={field.triggerId}\n collisionAvoidance={{ side: 'flip', fallbackAxisSide: 'none' }}\n data-slot={`${field.slot}-content`}\n {...props}\n className={cn(\n 'flex w-auto p-0 max-sm:flex-col has-[[data-slot=calendar-list]]:[&>[data-slot=input-date-time-time-list]]:hidden',\n className,\n )}\n >\n <CalendarFieldContext.Provider value={calendar}>\n {children}\n </CalendarFieldContext.Provider>\n </PopoverContent>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAuCA,MAAM,mBAAmBA,MAAM,cAA4C,IAAI;AAE/E,SAAgB,aAAa,MAAc;CACzC,MAAM,UAAUA,MAAM,WAAW,gBAAgB;CACjD,IAAI,CAAC,SACH,MAAM,IAAI,MACR,GAAG,KAAK,4DACV;CACF,OAAO;AACT;AAEA,SAAS,qBAAwB,EAC/B,aACA,QAIC;CACD,MAAM,CAAC,cAAc,mBAAmBA,MAAM,SAAS,WAAW;CAClE,OAAO,CAAC,QAAQ,cAAc,eAAe;AAC/C;AAEA,MAAM,cAAc,SAClB,IAAI,KAAK,KAAK,YAAY,GAAG,KAAK,SAAS,GAAG,KAAK,QAAQ,CAAC;AAE9D,SAAS,aACP,MACA,EAAE,KAAK,KAAK,YACZ;CACA,MAAM,KAAK,WAAW,OAAO,WAAW,IAAI;CAC5C,MAAM,OAAO,QAAQ,WAAW,MAAM,WAAW,GAAG;CACpD,MAAM,KAAK,QAAQ,WAAW,MAAM,WAAW,GAAG;CAClD,OAAQ,SAAS,KAAA,KAAa,KAAK,QAAU,OAAO,KAAA,KAAa,KAAK;AACxE;AAsBA,SAAgB,cAAc,EAC5B,UACA,WACA,YAAY,gBACZ,aACA,eAAe,IACf,WAAW,OACX,KACA,KACA,cACA,eACA,MACA,YAAY,KACZ,MACA,OACA,YAC2D;CAC3D,MAAM,CAAC,MAAM,WAAW,qBAAqB;EAC3C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AS,MAAM,EAAE,eAAe,KAAK,CAAC;EACrE;EACA;EACA,YAAY;CACd;CAEA,OACE,iBAAA,GAAA,kBAAA,KAACC,2BAAAA,gBAAD;EACE,OAAM;EACN,mBAAiB,MAAM;EACvB,oBAAoB;GAAE,MAAM;GAAQ,kBAAkB;EAAO;EAC7D,aAAW,GAAG,MAAM,KAAK;EACzB,GAAI;EACJ,YAAA,GAAA,GAAA,IACE,oHACA,SACF;YAEA,iBAAA,GAAA,kBAAA,KAACC,2BAAAA,qBAAqB,UAAtB;GAA+B,OAAO;GACnC;EAC4B,CAAA;CACjB,CAAA;AAEpB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { t as Button } from "../button-
|
|
3
|
+
import { t as Button } from "../button-C-KeUy2j.cjs";
|
|
4
4
|
import { i as PopoverContent, t as Popover$1 } from "../popover-DmcqNOkO.cjs";
|
|
5
5
|
import * as React$1 from "react";
|
|
6
6
|
import { Popover } from "@base-ui/react/popover";
|
|
@@ -32,6 +32,11 @@ declare function useDateField(part: string): DateFieldContextValue;
|
|
|
32
32
|
type DateFieldRootProps = Pick<React$1.ComponentProps<typeof Popover$1>, 'defaultOpen' | 'onOpenChange' | 'open'> & {
|
|
33
33
|
children: React$1.ReactNode;
|
|
34
34
|
className?: string;
|
|
35
|
+
/**
|
|
36
|
+
* The day an empty field opens on, and the day a time picked before any date applies to;
|
|
37
|
+
* today by default. Kept within `min` and `max`.
|
|
38
|
+
*/
|
|
39
|
+
defaultDay?: () => Date;
|
|
35
40
|
defaultValue?: string;
|
|
36
41
|
disabled?: boolean;
|
|
37
42
|
max?: Date;
|
|
@@ -43,6 +48,7 @@ type DateFieldRootProps = Pick<React$1.ComponentProps<typeof Popover$1>, 'defaul
|
|
|
43
48
|
declare function DateFieldRoot({
|
|
44
49
|
children,
|
|
45
50
|
className,
|
|
51
|
+
defaultDay: defaultDayProp,
|
|
46
52
|
defaultOpen,
|
|
47
53
|
defaultValue,
|
|
48
54
|
disabled,
|
package/dist/lib/date-field.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { t as Button } from "../button-
|
|
3
|
+
import { t as Button } from "../button-4QGaO78M.js";
|
|
4
4
|
import { i as PopoverContent, t as Popover$1 } from "../popover-DmcqNOkO.js";
|
|
5
5
|
import * as React$1 from "react";
|
|
6
6
|
import { Popover } from "@base-ui/react/popover";
|
|
@@ -32,6 +32,11 @@ declare function useDateField(part: string): DateFieldContextValue;
|
|
|
32
32
|
type DateFieldRootProps = Pick<React$1.ComponentProps<typeof Popover$1>, 'defaultOpen' | 'onOpenChange' | 'open'> & {
|
|
33
33
|
children: React$1.ReactNode;
|
|
34
34
|
className?: string;
|
|
35
|
+
/**
|
|
36
|
+
* The day an empty field opens on, and the day a time picked before any date applies to;
|
|
37
|
+
* today by default. Kept within `min` and `max`.
|
|
38
|
+
*/
|
|
39
|
+
defaultDay?: () => Date;
|
|
35
40
|
defaultValue?: string;
|
|
36
41
|
disabled?: boolean;
|
|
37
42
|
max?: Date;
|
|
@@ -43,6 +48,7 @@ type DateFieldRootProps = Pick<React$1.ComponentProps<typeof Popover$1>, 'defaul
|
|
|
43
48
|
declare function DateFieldRoot({
|
|
44
49
|
children,
|
|
45
50
|
className,
|
|
51
|
+
defaultDay: defaultDayProp,
|
|
46
52
|
defaultOpen,
|
|
47
53
|
defaultValue,
|
|
48
54
|
disabled,
|
package/dist/lib/date-field.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
|
-
import { CalendarFieldContext } from "./calendar-field.js";
|
|
4
3
|
import { cn } from "../utils/cn.js";
|
|
5
4
|
import { Button } from "../components/button.js";
|
|
6
5
|
import { InputGroup, InputGroupAddon } from "../components/input-group.js";
|
|
6
|
+
import { CalendarFieldContext } from "./calendar-field.js";
|
|
7
7
|
import { Popover as Popover$1, PopoverAnchor, PopoverContent, PopoverTrigger } from "../components/popover.js";
|
|
8
8
|
import { parseDatePart, parseDateTime, withDay } from "./date-time-mask.js";
|
|
9
|
-
import * as React$1 from "react";
|
|
10
9
|
import { CalendarMonth } from "@epilot/spark-icons";
|
|
10
|
+
import * as React$1 from "react";
|
|
11
11
|
import { jsx } from "react/jsx-runtime";
|
|
12
12
|
import { Popover } from "@base-ui/react/popover";
|
|
13
13
|
//#region src/lib/date-field.tsx
|
|
@@ -28,7 +28,7 @@ function isOutOfRange(date, { max, min, withTime }) {
|
|
|
28
28
|
const to = max && (withTime ? max : startOfDay(max));
|
|
29
29
|
return from !== void 0 && at < from || to !== void 0 && at > to;
|
|
30
30
|
}
|
|
31
|
-
function DateFieldRoot({ children, className, defaultOpen, defaultValue = "", disabled = false, max, min, onOpenChange, onValueChange, open, separator = ".", slot, value, withTime }) {
|
|
31
|
+
function DateFieldRoot({ children, className, defaultDay: defaultDayProp, defaultOpen, defaultValue = "", disabled = false, max, min, onOpenChange, onValueChange, open, separator = ".", slot, value, withTime }) {
|
|
32
32
|
const [text, setText] = useControllableState({
|
|
33
33
|
defaultProp: defaultValue,
|
|
34
34
|
prop: value
|
|
@@ -58,10 +58,10 @@ function DateFieldRoot({ children, className, defaultOpen, defaultValue = "", di
|
|
|
58
58
|
});
|
|
59
59
|
},
|
|
60
60
|
defaultDay: () => {
|
|
61
|
-
const
|
|
62
|
-
if (min &&
|
|
63
|
-
if (max &&
|
|
64
|
-
return
|
|
61
|
+
const day = startOfDay(defaultDayProp?.() ?? /* @__PURE__ */ new Date());
|
|
62
|
+
if (min && day < startOfDay(min)) return startOfDay(min);
|
|
63
|
+
if (max && day > startOfDay(max)) return startOfDay(max);
|
|
64
|
+
return day;
|
|
65
65
|
},
|
|
66
66
|
disabled,
|
|
67
67
|
handle,
|
|
@@ -76,6 +76,7 @@ function DateFieldRoot({ children, className, defaultOpen, defaultValue = "", di
|
|
|
76
76
|
triggerId,
|
|
77
77
|
withTime
|
|
78
78
|
}), [
|
|
79
|
+
defaultDayProp,
|
|
79
80
|
disabled,
|
|
80
81
|
handle,
|
|
81
82
|
max,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-field.js","names":["React","PopoverPrimitive","Popover"],"sources":["../../src/lib/date-field.tsx"],"sourcesContent":["'use client'\n\nimport { Popover as PopoverPrimitive } from '@base-ui/react/popover'\nimport { CalendarMonth } from '@epilot/spark-icons'\nimport * as React from 'react'\nimport { Button } from '../components/button'\nimport { InputGroup, InputGroupAddon } from '../components/input-group'\nimport {\n Popover,\n PopoverAnchor,\n PopoverContent,\n PopoverTrigger,\n} from '../components/popover'\nimport { cn } from '../utils/cn'\nimport { type CalendarField, CalendarFieldContext } from './calendar-field'\nimport { parseDatePart, parseDateTime, withDay } from './date-time-mask'\n\nexport type DateFieldDetails = {\n date: Date | undefined\n outOfRange: boolean\n}\n\ntype DateFieldContextValue = {\n commit: (next: string) => void\n defaultDay: () => Date\n disabled: boolean\n handle: PopoverPrimitive.Handle<unknown>\n inputRef: React.RefObject<HTMLInputElement | null>\n max: Date | undefined\n min: Date | undefined\n outOfRange: boolean\n separator: string\n slot: string\n text: string\n timeList: React.RefObject<{ defaultTime: string } | null>\n triggerId: string\n withTime: boolean\n}\n\nconst DateFieldContext = React.createContext<DateFieldContextValue | null>(null)\n\nexport function useDateField(part: string) {\n const context = React.useContext(DateFieldContext)\n if (!context)\n throw new Error(\n `${part} must be placed inside its InputDate or InputDateTime root.`,\n )\n return context\n}\n\nfunction useControllableState<T>({\n defaultProp,\n prop,\n}: {\n defaultProp: T\n prop?: T\n}) {\n const [uncontrolled, setUncontrolled] = React.useState(defaultProp)\n return [prop ?? uncontrolled, setUncontrolled] as const\n}\n\nconst startOfDay = (date: Date) =>\n new Date(date.getFullYear(), date.getMonth(), date.getDate())\n\nfunction isOutOfRange(\n date: Date,\n { max, min, withTime }: { max?: Date; min?: Date; withTime: boolean },\n) {\n const at = withTime ? date : startOfDay(date)\n const from = min && (withTime ? min : startOfDay(min))\n const to = max && (withTime ? max : startOfDay(max))\n return (from !== undefined && at < from) || (to !== undefined && at > to)\n}\n\nexport type DateFieldRootProps = Pick<\n React.ComponentProps<typeof Popover>,\n 'defaultOpen' | 'onOpenChange' | 'open'\n> & {\n children: React.ReactNode\n className?: string\n defaultValue?: string\n disabled?: boolean\n max?: Date\n min?: Date\n onValueChange?: (value: string, details: DateFieldDetails) => void\n separator?: string\n value?: string\n}\n\nexport function DateFieldRoot({\n children,\n className,\n defaultOpen,\n defaultValue = '',\n disabled = false,\n max,\n min,\n onOpenChange,\n onValueChange,\n open,\n separator = '.',\n slot,\n value,\n withTime,\n}: DateFieldRootProps & { slot: string; withTime: boolean }) {\n const [text, setText] = useControllableState({\n defaultProp: defaultValue,\n prop: value,\n })\n const [handle] = React.useState(() => PopoverPrimitive.createHandle())\n const inputRef = React.useRef<HTMLInputElement>(null)\n const timeList = React.useRef<{ defaultTime: string } | null>(null)\n const triggerId = React.useId()\n const date = parseDateTime(text, withTime)\n const outOfRange =\n date !== undefined && isOutOfRange(date, { max, min, withTime })\n\n const context = React.useMemo<DateFieldContextValue>(\n () => ({\n commit: (next) => {\n if (next === text) return\n setText(next)\n const nextDate = parseDateTime(next, withTime)\n onValueChange?.(next, {\n date: nextDate,\n outOfRange:\n nextDate !== undefined &&\n isOutOfRange(nextDate, { max, min, withTime }),\n })\n },\n defaultDay: () => {\n const today = startOfDay(new Date())\n if (min && today < startOfDay(min)) return startOfDay(min)\n if (max && today > startOfDay(max)) return startOfDay(max)\n return today\n },\n disabled,\n handle,\n inputRef,\n max,\n min,\n outOfRange,\n separator,\n slot,\n text,\n timeList,\n triggerId,\n withTime,\n }),\n [\n disabled,\n handle,\n max,\n min,\n onValueChange,\n outOfRange,\n separator,\n setText,\n slot,\n text,\n triggerId,\n withTime,\n ],\n )\n\n return (\n <DateFieldContext.Provider value={context}>\n <Popover\n defaultOpen={defaultOpen}\n handle={handle}\n onOpenChange={onOpenChange}\n open={open}\n >\n <PopoverAnchor render={<div className=\"min-w-0\" data-slot={slot} />}>\n <InputGroup className={className}>{children}</InputGroup>\n </PopoverAnchor>\n </Popover>\n </DateFieldContext.Provider>\n )\n}\n\nexport type DateFieldTriggerProps = Omit<\n React.ComponentProps<typeof Button>,\n 'aria-label'\n> & { 'aria-label': string }\n\nexport function DateFieldTrigger({\n children,\n ...props\n}: DateFieldTriggerProps) {\n const { disabled, slot, triggerId } = useDateField(\n 'InputDateTrigger / InputDateTimeTrigger',\n )\n return (\n <InputGroupAddon align=\"inline-end\">\n <PopoverTrigger\n id={triggerId}\n render={\n <Button\n color=\"neutral\"\n data-slot={`${slot}-trigger`}\n disabled={disabled}\n size=\"icon-small\"\n styleVariant=\"ghost\"\n {...props}\n >\n {children ?? <CalendarMonth />}\n </Button>\n }\n />\n </InputGroupAddon>\n )\n}\n\nexport function DateFieldContent({\n children,\n className,\n ...props\n}: React.ComponentProps<typeof PopoverContent>) {\n const field = useDateField('InputDateContent / InputDateTimeContent')\n const { commit, handle, max, min, separator, text, withTime } = field\n const selected = withTime ? parseDatePart(text) : parseDateTime(text)\n\n const calendar: CalendarField = {\n defaultMonth: selected ?? field.defaultDay(),\n disabled: [\n ...(min ? [{ before: min }] : []),\n ...(max ? [{ after: max }] : []),\n ],\n endMonth: max,\n onSelect: (day) => {\n if (!day) {\n if (withTime) return\n commit('')\n handle.close()\n return\n }\n const timeList = field.timeList.current\n commit(\n withDay(text, day, {\n separator,\n time: timeList?.defaultTime,\n withTime,\n }),\n )\n if (timeList) return\n handle.close()\n if (withTime) field.inputRef.current?.focus({ preventScroll: true })\n },\n selected,\n startMonth: min,\n }\n\n return (\n <PopoverContent\n align=\"start\"\n aria-labelledby={field.triggerId}\n collisionAvoidance={{ side: 'flip', fallbackAxisSide: 'none' }}\n data-slot={`${field.slot}-content`}\n {...props}\n className={cn(\n 'flex w-auto p-0 max-sm:flex-col has-[[data-slot=calendar-list]]:[&>[data-slot=input-date-time-time-list]]:hidden',\n className,\n )}\n >\n <C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9C,MAAM,QAAQ,aAAa,yCAAyC;CACpE,MAAM,EAAE,QAAQ,QAAQ,KAAK,KAAK,WAAW,MAAM,aAAa;CAChE,MAAM,WAAW,WAAW,cAAc,IAAI,IAAI,cAAc,IAAI;CAEpE,MAAM,WAA0B;EAC9B,cAAc,YAAY,MAAM,WAAW;EAC3C,UAAU,CACR,GAAI,MAAM,CAAC,EAAE,QAAQ,IAAI,CAAC,IAAI,CAAC,GAC/B,GAAI,MAAM,CAAC,EAAE,OAAO,IAAI,CAAC,IAAI,CAAC,CAChC;EACA,UAAU;EACV,WAAW,QAAQ;GACjB,IAAI,CAAC,KAAK;IACR,IAAI,UAAU;IACd,OAAO,EAAE;IACT,OAAO,MAAM;IACb;GACF;GACA,MAAM,WAAW,MAAM,SAAS;GAChC,OACE,QAAQ,MAAM,KAAK;IACjB;IACA,MAAM,UAAU;IAChB;GACF,CAAC,CACH;GACA,IAAI,UAAU;GACd,OAAO,MAAM;GACb,IAAI,UAAU,MAAM,SAAS,SAAS,MAAM,EAAE,eAAe,KAAK,CAAC;EACrE;EACA;EACA,YAAY;CACd;CAEA,OACE,oBAAC,gBAAD;EACE,OAAM;EACN,mBAAiB,MAAM;EACvB,oBAAoB;GAAE,MAAM;GAAQ,kBAAkB;EAAO;EAC7D,aAAW,GAAG,MAAM,KAAK;EACzB,GAAI;EACJ,WAAW,GACT,oHACA,SACF;YAEA,oBAAC,qBAAqB,UAAtB;GAA+B,OAAO;GACnC;EAC4B,CAAA;CACjB,CAAA;AAEpB"}
|
|
1
|
+
{"version":3,"file":"date-field.js","names":["React","PopoverPrimitive","Popover"],"sources":["../../src/lib/date-field.tsx"],"sourcesContent":["'use client'\n\nimport { Popover as PopoverPrimitive } from '@base-ui/react/popover'\nimport { CalendarMonth } from '@epilot/spark-icons'\nimport * as React from 'react'\nimport { Button } from '../components/button'\nimport { InputGroup, InputGroupAddon } from '../components/input-group'\nimport {\n Popover,\n PopoverAnchor,\n PopoverContent,\n PopoverTrigger,\n} from '../components/popover'\nimport { cn } from '../utils/cn'\nimport { type CalendarField, CalendarFieldContext } from './calendar-field'\nimport { parseDatePart, parseDateTime, withDay } from './date-time-mask'\n\nexport type DateFieldDetails = {\n date: Date | undefined\n outOfRange: boolean\n}\n\ntype DateFieldContextValue = {\n commit: (next: string) => void\n defaultDay: () => Date\n disabled: boolean\n handle: PopoverPrimitive.Handle<unknown>\n inputRef: React.RefObject<HTMLInputElement | null>\n max: Date | undefined\n min: Date | undefined\n outOfRange: boolean\n separator: string\n slot: string\n text: string\n timeList: React.RefObject<{ defaultTime: string } | null>\n triggerId: string\n withTime: boolean\n}\n\nconst DateFieldContext = React.createContext<DateFieldContextValue | null>(null)\n\nexport function useDateField(part: string) {\n const context = React.useContext(DateFieldContext)\n if (!context)\n throw new Error(\n `${part} must be placed inside its InputDate or InputDateTime root.`,\n )\n return context\n}\n\nfunction useControllableState<T>({\n defaultProp,\n prop,\n}: {\n defaultProp: T\n prop?: T\n}) {\n const [uncontrolled, setUncontrolled] = React.useState(defaultProp)\n return [prop ?? uncontrolled, setUncontrolled] as const\n}\n\nconst startOfDay = (date: Date) =>\n new Date(date.getFullYear(), date.getMonth(), date.getDate())\n\nfunction isOutOfRange(\n date: Date,\n { max, min, withTime }: { max?: Date; min?: Date; withTime: boolean },\n) {\n const at = withTime ? date : startOfDay(date)\n const from = min && (withTime ? min : startOfDay(min))\n const to = max && (withTime ? max : startOfDay(max))\n return (from !== undefined && at < from) || (to !== undefined && at > to)\n}\n\nexport type DateFieldRootProps = Pick<\n React.ComponentProps<typeof Popover>,\n 'defaultOpen' | 'onOpenChange' | 'open'\n> & {\n children: React.ReactNode\n className?: string\n /**\n * The day an empty field opens on, and the day a time picked before any date applies to;\n * today by default. Kept within `min` and `max`.\n */\n defaultDay?: () => Date\n defaultValue?: string\n disabled?: boolean\n max?: Date\n min?: Date\n onValueChange?: (value: string, details: DateFieldDetails) => void\n separator?: string\n value?: string\n}\n\nexport function DateFieldRoot({\n children,\n className,\n defaultDay: defaultDayProp,\n defaultOpen,\n defaultValue = '',\n disabled = false,\n max,\n min,\n onOpenChange,\n onValueChange,\n open,\n separator = '.',\n slot,\n value,\n withTime,\n}: DateFieldRootProps & { slot: string; withTime: boolean }) {\n const [text, setText] = useControllableState({\n defaultProp: defaultValue,\n prop: value,\n })\n const [handle] = React.useState(() => PopoverPrimitive.createHandle())\n const inputRef = React.useRef<HTMLInputElement>(null)\n const timeList = React.useRef<{ defaultTime: string } | null>(null)\n const triggerId = React.useId()\n const date = parseDateTime(text, withTime)\n const outOfRange =\n date !== undefined && isOutOfRange(date, { max, min, withTime })\n\n const context = React.useMemo<DateFieldContextValue>(\n () => ({\n commit: (next) => {\n if (next === text) return\n setText(next)\n const nextDate = parseDateTime(next, withTime)\n onValueChange?.(next, {\n date: nextDate,\n outOfRange:\n nextDate !== undefined &&\n isOutOfRange(nextDate, { max, min, withTime }),\n })\n },\n defaultDay: () => {\n const day = startOfDay(defaultDayProp?.() ?? new Date())\n if (min && day < startOfDay(min)) return startOfDay(min)\n if (max && day > startOfDay(max)) return startOfDay(max)\n return day\n },\n disabled,\n handle,\n inputRef,\n max,\n min,\n outOfRange,\n separator,\n slot,\n text,\n timeList,\n triggerId,\n withTime,\n }),\n [\n defaultDayProp,\n disabled,\n handle,\n max,\n min,\n onValueChange,\n outOfRange,\n separator,\n setText,\n slot,\n text,\n triggerId,\n withTime,\n ],\n )\n\n return (\n <DateFieldContext.Provider value={context}>\n <Popover\n defaultOpen={defaultOpen}\n handle={handle}\n onOpenChange={onOpenChange}\n open={open}\n >\n <PopoverAnchor render={<div className=\"min-w-0\" data-slot={slot} />}>\n <InputGroup className={className}>{children}</InputGroup>\n </PopoverAnchor>\n </Popover>\n </DateFieldContext.Provider>\n )\n}\n\nexport type DateFieldTriggerProps = Omit<\n React.ComponentProps<typeof Button>,\n 'aria-label'\n> & { 'aria-label': string }\n\nexport function DateFieldTrigger({\n children,\n ...props\n}: DateFieldTriggerProps) {\n const { disabled, slot, triggerId } = useDateField(\n 'InputDateTrigger / InputDateTimeTrigger',\n )\n return (\n <InputGroupAddon align=\"inline-end\">\n <PopoverTrigger\n id={triggerId}\n render={\n <Button\n color=\"neutral\"\n data-slot={`${slot}-trigger`}\n disabled={disabled}\n size=\"icon-small\"\n styleVariant=\"ghost\"\n {...props}\n >\n {children ?? <CalendarMonth />}\n </Button>\n }\n />\n </InputGroupAddon>\n )\n}\n\nexport function DateFieldContent({\n children,\n className,\n ...props\n}: React.ComponentProps<typeof PopoverContent>) {\n const field = useDateField('InputDateContent / InputDateTimeContent')\n const { commit, handle, max, min, separator, text, withTime } = field\n const selected = withTime ? parseDatePart(text) : parseDateTime(text)\n\n const calendar: CalendarField = {\n defaultMonth: selected ?? field.defaultDay(),\n disabled: [\n ...(min ? [{ before: min }] : []),\n ...(max ? [{ after: max }] : []),\n ],\n endMonth: max,\n onSelect: (day) => {\n if (!day) {\n if (withTime) return\n commit('')\n handle.close()\n return\n }\n const timeList = field.timeList.current\n commit(\n withDay(text, day, {\n separator,\n time: timeList?.defaultTime,\n withTime,\n }),\n )\n if (timeList) return\n handle.close()\n if (withTime) field.inputRef.current?.focus({ preventScroll: true })\n },\n selected,\n startMonth: min,\n }\n\n return (\n <PopoverContent\n align=\"start\"\n aria-labelledby={field.triggerId}\n collisionAvoidance={{ side: 'flip', fallbackAxisSide: 'none' }}\n data-slot={`${field.slot}-content`}\n {...props}\n className={cn(\n 'flex w-auto p-0 max-sm:flex-col has-[[data-slot=calendar-list]]:[&>[data-slot=input-date-time-time-list]]:hidden',\n className,\n )}\n >\n <CalendarFieldContext.Provider value={calendar}>\n {children}\n </CalendarFieldContext.Provider>\n </PopoverContent>\n )\n}\n"],"mappings":";;;;;;;;;;;;;AAuCA,MAAM,mBAAmBA,QAAM,cAA4C,IAAI;AAE/E,SAAgB,aAAa,MAAc;CACzC,MAAM,UAAUA,QAAM,WAAW,gBAAgB;CACjD,IAAI,CAAC,SACH,MAAM,IAAI,MACR,GAAG,KAAK,4DACV;CAC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,EAAE,QAAQ,IAAI,CAAC,IAAI,CAAC,GAC/B,GAAI,MAAM,CAAC,EAAE,OAAO,IAAI,CAAC,IAAI,CAAC,CAChC;EACA,UAAU;EACV,WAAW,QAAQ;GACjB,IAAI,CAAC,KAAK;IACR,IAAI,UAAU;IACd,OAAO,EAAE;IACT,OAAO,MAAM;IACb;GACF;GACA,MAAM,WAAW,MAAM,SAAS;GAChC,OACE,QAAQ,MAAM,KAAK;IACjB;IACA,MAAM,UAAU;IAChB;GACF,CAAC,CACH;GACA,IAAI,UAAU;GACd,OAAO,MAAM;GACb,IAAI,UAAU,MAAM,SAAS,SAAS,MAAM,EAAE,eAAe,KAAK,CAAC;EACrE;EACA;EACA,YAAY;CACd;CAEA,OACE,oBAAC,gBAAD;EACE,OAAM;EACN,mBAAiB,MAAM;EACvB,oBAAoB;GAAE,MAAM;GAAQ,kBAAkB;EAAO;EAC7D,aAAW,GAAG,MAAM,KAAK;EACzB,GAAI;EACJ,WAAW,GACT,oHACA,SACF;YAEA,oBAAC,qBAAqB,UAAtB;GAA+B,OAAO;GACnC;EAC4B,CAAA;CACjB,CAAA;AAEpB"}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
let cn = require("cn");
|
|
4
4
|
//#region src/lib/input-box-variants.ts
|
|
5
|
-
const GHOST_UNDERLINE = "group-data-[warning=true]/field:border-b-input-warning h-10 rounded-none border-0 border-b-2 px-0 py-2 text-base focus:border-b-input-active focus-visible:border-b-input-active user-valid:border-b-input-active user-invalid:border-b-input-invalid user-invalid:
|
|
5
|
+
const GHOST_UNDERLINE = "group-data-[warning=true]/field:border-b-input-warning h-10 rounded-none border-0 border-b-2 px-0 py-2 text-base focus:border-b-input-active focus-visible:border-b-input-active user-valid:border-b-input-active user-invalid:border-b-input-invalid user-invalid:focus:border-b-(--color-error-active)! user-invalid:focus-visible:border-b-(--color-error-active)! aria-invalid:border-b-input-invalid aria-invalid:focus:border-b-(--color-error-active)! aria-invalid:focus-visible:border-b-(--color-error-active)! group-data-[invalid=true]/field:border-b-input-invalid! group-data-[invalid=true]/field:focus:border-b-(--color-error-active)! group-data-[invalid=true]/field:focus-visible:border-b-(--color-error-active)! user-invalid:focus-visible:outline-(--color-error-active) aria-invalid:focus-visible:outline-(--color-error-active) group-data-[invalid=true]/field:focus-visible:outline-(--color-error-active) disabled:border-b-input-disabled";
|
|
6
6
|
const INSET_UNDERLINE = (0, cn.cn)(GHOST_UNDERLINE, "focus-visible:outline-hidden");
|
|
7
|
-
const SOFT_BASE = "group-data-[warning=true]/field:inset-ring group-data-[warning=true]/field:inset-ring-input-warning user-invalid:bg-base-error-soft user-invalid:
|
|
8
|
-
const BORDERED = "border group-data-[warning=true]/field:border-input-warning user-invalid:border-input-invalid user-invalid:
|
|
7
|
+
const SOFT_BASE = "group-data-[warning=true]/field:inset-ring group-data-[warning=true]/field:inset-ring-input-warning user-invalid:bg-base-error-soft user-invalid:not-disabled:hover:bg-red-a4 user-invalid:focus-visible:outline-(--color-error-active) disabled:bg-base-gray-soft disabled:opacity-50 aria-invalid:bg-base-error-soft aria-invalid:not-disabled:hover:bg-red-a4 aria-invalid:focus-visible:outline-(--color-error-active) group-data-[invalid=true]/field:bg-base-error-soft group-data-[invalid=true]/field:not-disabled:hover:bg-red-a4 group-data-[invalid=true]/field:focus-visible:outline-(--color-error-active)";
|
|
8
|
+
const BORDERED = "border group-data-[warning=true]/field:border-input-warning user-invalid:border-input-invalid user-invalid:focus-visible:border-input-invalid! user-invalid:focus-visible:outline-(--color-error-active) disabled:border-input-disabled disabled:opacity-50 aria-invalid:border-input-invalid aria-invalid:focus-visible:border-input-invalid! aria-invalid:focus-visible:outline-(--color-error-active) group-data-[invalid=true]/field:border-input-invalid group-data-[invalid=true]/field:focus-visible:border-input-invalid! group-data-[invalid=true]/field:focus-visible:outline-(--color-error-active)";
|
|
9
9
|
const boxChrome = {
|
|
10
10
|
soft: {
|
|
11
11
|
brand: (0, cn.cn)(SOFT_BASE, "bg-input-base not-disabled:hover:bg-input-base-hover"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-box-variants.cjs","names":[],"sources":["../../src/lib/input-box-variants.ts"],"sourcesContent":["import { cn } from '../utils/cn'\nimport type { SparkInputColor, SparkInputStyle } from './theme-types'\n\nexport const GHOST_UNDERLINE =\n 'group-data-[warning=true]/field:border-b-input-warning h-10 rounded-none border-0 border-b-2 px-0 py-2 text-base focus:border-b-input-active focus-visible:border-b-input-active user-valid:border-b-input-active user-invalid:border-b-input-invalid user-invalid:
|
|
1
|
+
{"version":3,"file":"input-box-variants.cjs","names":[],"sources":["../../src/lib/input-box-variants.ts"],"sourcesContent":["import { cn } from '../utils/cn'\nimport type { SparkInputColor, SparkInputStyle } from './theme-types'\n\nexport const GHOST_UNDERLINE =\n 'group-data-[warning=true]/field:border-b-input-warning h-10 rounded-none border-0 border-b-2 px-0 py-2 text-base focus:border-b-input-active focus-visible:border-b-input-active user-valid:border-b-input-active user-invalid:border-b-input-invalid user-invalid:focus:border-b-(--color-error-active)! user-invalid:focus-visible:border-b-(--color-error-active)! aria-invalid:border-b-input-invalid aria-invalid:focus:border-b-(--color-error-active)! aria-invalid:focus-visible:border-b-(--color-error-active)! group-data-[invalid=true]/field:border-b-input-invalid! group-data-[invalid=true]/field:focus:border-b-(--color-error-active)! group-data-[invalid=true]/field:focus-visible:border-b-(--color-error-active)! user-invalid:focus-visible:outline-(--color-error-active) aria-invalid:focus-visible:outline-(--color-error-active) group-data-[invalid=true]/field:focus-visible:outline-(--color-error-active) disabled:border-b-input-disabled'\n\n// inside an inset Field the shell draws the outline (field.tsx)\nexport const INSET_UNDERLINE = cn(\n GHOST_UNDERLINE,\n 'focus-visible:outline-hidden',\n)\n\nconst SOFT_BASE =\n 'group-data-[warning=true]/field:inset-ring group-data-[warning=true]/field:inset-ring-input-warning user-invalid:bg-base-error-soft user-invalid:not-disabled:hover:bg-red-a4 user-invalid:focus-visible:outline-(--color-error-active) disabled:bg-base-gray-soft disabled:opacity-50 aria-invalid:bg-base-error-soft aria-invalid:not-disabled:hover:bg-red-a4 aria-invalid:focus-visible:outline-(--color-error-active) group-data-[invalid=true]/field:bg-base-error-soft group-data-[invalid=true]/field:not-disabled:hover:bg-red-a4 group-data-[invalid=true]/field:focus-visible:outline-(--color-error-active)'\n\nconst BORDERED =\n 'border group-data-[warning=true]/field:border-input-warning user-invalid:border-input-invalid user-invalid:focus-visible:border-input-invalid! user-invalid:focus-visible:outline-(--color-error-active) disabled:border-input-disabled disabled:opacity-50 aria-invalid:border-input-invalid aria-invalid:focus-visible:border-input-invalid! aria-invalid:focus-visible:outline-(--color-error-active) group-data-[invalid=true]/field:border-input-invalid group-data-[invalid=true]/field:focus-visible:border-input-invalid! group-data-[invalid=true]/field:focus-visible:outline-(--color-error-active)'\nexport const boxChrome: Record<\n SparkInputStyle,\n Record<SparkInputColor, string>\n> = {\n soft: {\n brand: cn(\n SOFT_BASE,\n 'bg-input-base not-disabled:hover:bg-input-base-hover',\n ),\n gray: cn(SOFT_BASE, 'bg-base-gray-soft not-disabled:hover:bg-gray-a4'),\n },\n surface: {\n brand: cn(\n BORDERED,\n 'border-input bg-base-accent-surface focus-visible:border-input-active',\n ),\n gray: cn(\n BORDERED,\n 'border-input-gray bg-base-gray-surface focus-visible:border-gray-a8',\n ),\n },\n outlined: {\n brand: cn(BORDERED, 'border-input focus-visible:border-input-active'),\n gray: cn(BORDERED, 'border-input-gray focus-visible:border-gray-a8'),\n },\n ghost: {\n brand: cn(GHOST_UNDERLINE, 'border-b-input'),\n gray: cn(GHOST_UNDERLINE, 'border-b-input-gray'),\n },\n}\n\nexport const FLOATING_PLACEHOLDER = ' '\n\nexport const FLOATING_SURFACE_FOCUS = 'focus-visible:outline-offset-[-2px]!'\n\nexport const FLOATING_ADORNMENT_SHIFT =\n 'transition-[translate] duration-200 ease-[cubic-bezier(0,0,0.2,1)] field-floated:translate-y-2 motion-reduce:transition-none'\n\nexport const FLOATING_BUTTON_SHIFT =\n 'transition-[color,translate] duration-200 ease-[cubic-bezier(0,0,0.2,1)] field-floated:translate-y-2 motion-reduce:transition-none'\n\nexport function floatingChrome(inputStyle: SparkInputStyle) {\n if (inputStyle === 'outlined')\n return 'h-12 border-0! px-3 py-0 focus-visible:outline-hidden!'\n return cn(\n 'h-12 pt-5 pb-1 field-unlabeled:py-0',\n inputStyle === 'surface' && FLOATING_SURFACE_FOCUS,\n )\n}\n"],"mappings":";;;;AAGA,MAAa,kBACX;AAGF,MAAa,mBAAA,GAAA,GAAA,IACX,iBACA,8BACF;AAEA,MAAM,YACJ;AAEF,MAAM,WACJ;AACF,MAAa,YAGT;CACF,MAAM;EACJ,QAAA,GAAA,GAAA,IACE,WACA,sDACF;EACA,OAAA,GAAA,GAAA,IAAS,WAAW,iDAAiD;CACvE;CACA,SAAS;EACP,QAAA,GAAA,GAAA,IACE,UACA,uEACF;EACA,OAAA,GAAA,GAAA,IACE,UACA,qEACF;CACF;CACA,UAAU;EACR,QAAA,GAAA,GAAA,IAAU,UAAU,gDAAgD;EACpE,OAAA,GAAA,GAAA,IAAS,UAAU,gDAAgD;CACrE;CACA,OAAO;EACL,QAAA,GAAA,GAAA,IAAU,iBAAiB,gBAAgB;EAC3C,OAAA,GAAA,GAAA,IAAS,iBAAiB,qBAAqB;CACjD;AACF;AAEA,MAAa,uBAAuB;AAEpC,MAAa,yBAAyB;AAEtC,MAAa,2BACX;AAEF,MAAa,wBACX;AAEF,SAAgB,eAAe,YAA6B;CAC1D,IAAI,eAAe,YACjB,OAAO;CACT,QAAA,GAAA,GAAA,IACE,uCACA,eAAe,aAAA,sCACjB;AACF"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { d as SparkInputStyle, u as SparkInputColor } from "../theme-types-CHl-L2F-.cjs";
|
|
4
4
|
|
|
5
5
|
//#region src/lib/input-box-variants.d.ts
|
|
6
|
-
declare const GHOST_UNDERLINE = "group-data-[warning=true]/field:border-b-input-warning h-10 rounded-none border-0 border-b-2 px-0 py-2 text-base focus:border-b-input-active focus-visible:border-b-input-active user-valid:border-b-input-active user-invalid:border-b-input-invalid user-invalid:
|
|
6
|
+
declare const GHOST_UNDERLINE = "group-data-[warning=true]/field:border-b-input-warning h-10 rounded-none border-0 border-b-2 px-0 py-2 text-base focus:border-b-input-active focus-visible:border-b-input-active user-valid:border-b-input-active user-invalid:border-b-input-invalid user-invalid:focus:border-b-(--color-error-active)! user-invalid:focus-visible:border-b-(--color-error-active)! aria-invalid:border-b-input-invalid aria-invalid:focus:border-b-(--color-error-active)! aria-invalid:focus-visible:border-b-(--color-error-active)! group-data-[invalid=true]/field:border-b-input-invalid! group-data-[invalid=true]/field:focus:border-b-(--color-error-active)! group-data-[invalid=true]/field:focus-visible:border-b-(--color-error-active)! user-invalid:focus-visible:outline-(--color-error-active) aria-invalid:focus-visible:outline-(--color-error-active) group-data-[invalid=true]/field:focus-visible:outline-(--color-error-active) disabled:border-b-input-disabled";
|
|
7
7
|
declare const INSET_UNDERLINE: string;
|
|
8
8
|
declare const boxChrome: Record<SparkInputStyle, Record<SparkInputColor, string>>;
|
|
9
9
|
declare const FLOATING_PLACEHOLDER = " ";
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { d as SparkInputStyle, u as SparkInputColor } from "../theme-types-CHl-L2F-.js";
|
|
4
4
|
|
|
5
5
|
//#region src/lib/input-box-variants.d.ts
|
|
6
|
-
declare const GHOST_UNDERLINE = "group-data-[warning=true]/field:border-b-input-warning h-10 rounded-none border-0 border-b-2 px-0 py-2 text-base focus:border-b-input-active focus-visible:border-b-input-active user-valid:border-b-input-active user-invalid:border-b-input-invalid user-invalid:
|
|
6
|
+
declare const GHOST_UNDERLINE = "group-data-[warning=true]/field:border-b-input-warning h-10 rounded-none border-0 border-b-2 px-0 py-2 text-base focus:border-b-input-active focus-visible:border-b-input-active user-valid:border-b-input-active user-invalid:border-b-input-invalid user-invalid:focus:border-b-(--color-error-active)! user-invalid:focus-visible:border-b-(--color-error-active)! aria-invalid:border-b-input-invalid aria-invalid:focus:border-b-(--color-error-active)! aria-invalid:focus-visible:border-b-(--color-error-active)! group-data-[invalid=true]/field:border-b-input-invalid! group-data-[invalid=true]/field:focus:border-b-(--color-error-active)! group-data-[invalid=true]/field:focus-visible:border-b-(--color-error-active)! user-invalid:focus-visible:outline-(--color-error-active) aria-invalid:focus-visible:outline-(--color-error-active) group-data-[invalid=true]/field:focus-visible:outline-(--color-error-active) disabled:border-b-input-disabled";
|
|
7
7
|
declare const INSET_UNDERLINE: string;
|
|
8
8
|
declare const boxChrome: Record<SparkInputStyle, Record<SparkInputColor, string>>;
|
|
9
9
|
declare const FLOATING_PLACEHOLDER = " ";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../utils/cn.js";
|
|
3
3
|
//#region src/lib/input-box-variants.ts
|
|
4
|
-
const GHOST_UNDERLINE = "group-data-[warning=true]/field:border-b-input-warning h-10 rounded-none border-0 border-b-2 px-0 py-2 text-base focus:border-b-input-active focus-visible:border-b-input-active user-valid:border-b-input-active user-invalid:border-b-input-invalid user-invalid:
|
|
4
|
+
const GHOST_UNDERLINE = "group-data-[warning=true]/field:border-b-input-warning h-10 rounded-none border-0 border-b-2 px-0 py-2 text-base focus:border-b-input-active focus-visible:border-b-input-active user-valid:border-b-input-active user-invalid:border-b-input-invalid user-invalid:focus:border-b-(--color-error-active)! user-invalid:focus-visible:border-b-(--color-error-active)! aria-invalid:border-b-input-invalid aria-invalid:focus:border-b-(--color-error-active)! aria-invalid:focus-visible:border-b-(--color-error-active)! group-data-[invalid=true]/field:border-b-input-invalid! group-data-[invalid=true]/field:focus:border-b-(--color-error-active)! group-data-[invalid=true]/field:focus-visible:border-b-(--color-error-active)! user-invalid:focus-visible:outline-(--color-error-active) aria-invalid:focus-visible:outline-(--color-error-active) group-data-[invalid=true]/field:focus-visible:outline-(--color-error-active) disabled:border-b-input-disabled";
|
|
5
5
|
const INSET_UNDERLINE = cn(GHOST_UNDERLINE, "focus-visible:outline-hidden");
|
|
6
|
-
const SOFT_BASE = "group-data-[warning=true]/field:inset-ring group-data-[warning=true]/field:inset-ring-input-warning user-invalid:bg-base-error-soft user-invalid:
|
|
7
|
-
const BORDERED = "border group-data-[warning=true]/field:border-input-warning user-invalid:border-input-invalid user-invalid:
|
|
6
|
+
const SOFT_BASE = "group-data-[warning=true]/field:inset-ring group-data-[warning=true]/field:inset-ring-input-warning user-invalid:bg-base-error-soft user-invalid:not-disabled:hover:bg-red-a4 user-invalid:focus-visible:outline-(--color-error-active) disabled:bg-base-gray-soft disabled:opacity-50 aria-invalid:bg-base-error-soft aria-invalid:not-disabled:hover:bg-red-a4 aria-invalid:focus-visible:outline-(--color-error-active) group-data-[invalid=true]/field:bg-base-error-soft group-data-[invalid=true]/field:not-disabled:hover:bg-red-a4 group-data-[invalid=true]/field:focus-visible:outline-(--color-error-active)";
|
|
7
|
+
const BORDERED = "border group-data-[warning=true]/field:border-input-warning user-invalid:border-input-invalid user-invalid:focus-visible:border-input-invalid! user-invalid:focus-visible:outline-(--color-error-active) disabled:border-input-disabled disabled:opacity-50 aria-invalid:border-input-invalid aria-invalid:focus-visible:border-input-invalid! aria-invalid:focus-visible:outline-(--color-error-active) group-data-[invalid=true]/field:border-input-invalid group-data-[invalid=true]/field:focus-visible:border-input-invalid! group-data-[invalid=true]/field:focus-visible:outline-(--color-error-active)";
|
|
8
8
|
const boxChrome = {
|
|
9
9
|
soft: {
|
|
10
10
|
brand: cn(SOFT_BASE, "bg-input-base not-disabled:hover:bg-input-base-hover"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-box-variants.js","names":[],"sources":["../../src/lib/input-box-variants.ts"],"sourcesContent":["import { cn } from '../utils/cn'\nimport type { SparkInputColor, SparkInputStyle } from './theme-types'\n\nexport const GHOST_UNDERLINE =\n 'group-data-[warning=true]/field:border-b-input-warning h-10 rounded-none border-0 border-b-2 px-0 py-2 text-base focus:border-b-input-active focus-visible:border-b-input-active user-valid:border-b-input-active user-invalid:border-b-input-invalid user-invalid:
|
|
1
|
+
{"version":3,"file":"input-box-variants.js","names":[],"sources":["../../src/lib/input-box-variants.ts"],"sourcesContent":["import { cn } from '../utils/cn'\nimport type { SparkInputColor, SparkInputStyle } from './theme-types'\n\nexport const GHOST_UNDERLINE =\n 'group-data-[warning=true]/field:border-b-input-warning h-10 rounded-none border-0 border-b-2 px-0 py-2 text-base focus:border-b-input-active focus-visible:border-b-input-active user-valid:border-b-input-active user-invalid:border-b-input-invalid user-invalid:focus:border-b-(--color-error-active)! user-invalid:focus-visible:border-b-(--color-error-active)! aria-invalid:border-b-input-invalid aria-invalid:focus:border-b-(--color-error-active)! aria-invalid:focus-visible:border-b-(--color-error-active)! group-data-[invalid=true]/field:border-b-input-invalid! group-data-[invalid=true]/field:focus:border-b-(--color-error-active)! group-data-[invalid=true]/field:focus-visible:border-b-(--color-error-active)! user-invalid:focus-visible:outline-(--color-error-active) aria-invalid:focus-visible:outline-(--color-error-active) group-data-[invalid=true]/field:focus-visible:outline-(--color-error-active) disabled:border-b-input-disabled'\n\n// inside an inset Field the shell draws the outline (field.tsx)\nexport const INSET_UNDERLINE = cn(\n GHOST_UNDERLINE,\n 'focus-visible:outline-hidden',\n)\n\nconst SOFT_BASE =\n 'group-data-[warning=true]/field:inset-ring group-data-[warning=true]/field:inset-ring-input-warning user-invalid:bg-base-error-soft user-invalid:not-disabled:hover:bg-red-a4 user-invalid:focus-visible:outline-(--color-error-active) disabled:bg-base-gray-soft disabled:opacity-50 aria-invalid:bg-base-error-soft aria-invalid:not-disabled:hover:bg-red-a4 aria-invalid:focus-visible:outline-(--color-error-active) group-data-[invalid=true]/field:bg-base-error-soft group-data-[invalid=true]/field:not-disabled:hover:bg-red-a4 group-data-[invalid=true]/field:focus-visible:outline-(--color-error-active)'\n\nconst BORDERED =\n 'border group-data-[warning=true]/field:border-input-warning user-invalid:border-input-invalid user-invalid:focus-visible:border-input-invalid! user-invalid:focus-visible:outline-(--color-error-active) disabled:border-input-disabled disabled:opacity-50 aria-invalid:border-input-invalid aria-invalid:focus-visible:border-input-invalid! aria-invalid:focus-visible:outline-(--color-error-active) group-data-[invalid=true]/field:border-input-invalid group-data-[invalid=true]/field:focus-visible:border-input-invalid! group-data-[invalid=true]/field:focus-visible:outline-(--color-error-active)'\nexport const boxChrome: Record<\n SparkInputStyle,\n Record<SparkInputColor, string>\n> = {\n soft: {\n brand: cn(\n SOFT_BASE,\n 'bg-input-base not-disabled:hover:bg-input-base-hover',\n ),\n gray: cn(SOFT_BASE, 'bg-base-gray-soft not-disabled:hover:bg-gray-a4'),\n },\n surface: {\n brand: cn(\n BORDERED,\n 'border-input bg-base-accent-surface focus-visible:border-input-active',\n ),\n gray: cn(\n BORDERED,\n 'border-input-gray bg-base-gray-surface focus-visible:border-gray-a8',\n ),\n },\n outlined: {\n brand: cn(BORDERED, 'border-input focus-visible:border-input-active'),\n gray: cn(BORDERED, 'border-input-gray focus-visible:border-gray-a8'),\n },\n ghost: {\n brand: cn(GHOST_UNDERLINE, 'border-b-input'),\n gray: cn(GHOST_UNDERLINE, 'border-b-input-gray'),\n },\n}\n\nexport const FLOATING_PLACEHOLDER = ' '\n\nexport const FLOATING_SURFACE_FOCUS = 'focus-visible:outline-offset-[-2px]!'\n\nexport const FLOATING_ADORNMENT_SHIFT =\n 'transition-[translate] duration-200 ease-[cubic-bezier(0,0,0.2,1)] field-floated:translate-y-2 motion-reduce:transition-none'\n\nexport const FLOATING_BUTTON_SHIFT =\n 'transition-[color,translate] duration-200 ease-[cubic-bezier(0,0,0.2,1)] field-floated:translate-y-2 motion-reduce:transition-none'\n\nexport function floatingChrome(inputStyle: SparkInputStyle) {\n if (inputStyle === 'outlined')\n return 'h-12 border-0! px-3 py-0 focus-visible:outline-hidden!'\n return cn(\n 'h-12 pt-5 pb-1 field-unlabeled:py-0',\n inputStyle === 'surface' && FLOATING_SURFACE_FOCUS,\n )\n}\n"],"mappings":";;;AAGA,MAAa,kBACX;AAGF,MAAa,kBAAkB,GAC7B,iBACA,8BACF;AAEA,MAAM,YACJ;AAEF,MAAM,WACJ;AACF,MAAa,YAGT;CACF,MAAM;EACJ,OAAO,GACL,WACA,sDACF;EACA,MAAM,GAAG,WAAW,iDAAiD;CACvE;CACA,SAAS;EACP,OAAO,GACL,UACA,uEACF;EACA,MAAM,GACJ,UACA,qEACF;CACF;CACA,UAAU;EACR,OAAO,GAAG,UAAU,gDAAgD;EACpE,MAAM,GAAG,UAAU,gDAAgD;CACrE;CACA,OAAO;EACL,OAAO,GAAG,iBAAiB,gBAAgB;EAC3C,MAAM,GAAG,iBAAiB,qBAAqB;CACjD;AACF;AAEA,MAAa,uBAAuB;AAEpC,MAAa,yBAAyB;AAEtC,MAAa,2BACX;AAEF,MAAa,wBACX;AAEF,SAAgB,eAAe,YAA6B;CAC1D,IAAI,eAAe,YACjB,OAAO;CACT,OAAO,GACL,uCACA,eAAe,aAAA,sCACjB;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 { r as ButtonProps } from "../button-
|
|
4
|
+
import { r as ButtonProps } from "../button-C-KeUy2j.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 { r as ButtonProps } from "../button-
|
|
4
|
+
import { r as ButtonProps } from "../button-4QGaO78M.js";
|
|
5
5
|
import { ToggleStyle } from "../components/toggle.js";
|
|
6
6
|
import * as React$1 from "react";
|
|
7
7
|
|
package/dist/styles/theme.css
CHANGED
|
@@ -440,7 +440,6 @@
|
|
|
440
440
|
--color-error-light: var(--red-a11);
|
|
441
441
|
--color-error-contrast: #ffffff;
|
|
442
442
|
--color-error-active: var(--red-a11);
|
|
443
|
-
--color-error-hover: var(--red-a11);
|
|
444
443
|
--color-error-focus: var(--red-a11);
|
|
445
444
|
--color-error-disabled: var(--red-a8);
|
|
446
445
|
|
|
@@ -448,7 +447,6 @@
|
|
|
448
447
|
--color-success-light: var(--green-a11);
|
|
449
448
|
--color-success-contrast: #ffffff;
|
|
450
449
|
--color-success-active: var(--green-a11);
|
|
451
|
-
--color-success-hover: var(--green-a11);
|
|
452
450
|
--color-success-focus: var(--green-a11);
|
|
453
451
|
|
|
454
452
|
--color-info: var(--blue-a12);
|
|
@@ -462,13 +460,13 @@
|
|
|
462
460
|
--color-warning-light: var(--orange-a11);
|
|
463
461
|
--color-warning-contrast: #ffffff;
|
|
464
462
|
--color-warning-active: var(--orange-a11);
|
|
465
|
-
--color-warning-hover: var(--orange-a11);
|
|
466
463
|
--color-warning-focus: var(--orange-a11);
|
|
467
464
|
|
|
468
465
|
/*
|
|
469
466
|
* Frozen public roles (Phase C). Paint with these; ladder stays --spark-*.
|
|
470
|
-
* Bare error/success/warning
|
|
471
|
-
*
|
|
467
|
+
* Status text ink is *-soft-foreground. Bare error/success/warning (a12) and
|
|
468
|
+
* their -light/-active aliases stay for consumers; do not paint new text with
|
|
469
|
+
* them. Solid status fills use *-foreground pairs + base-*-solid.
|
|
472
470
|
*/
|
|
473
471
|
--color-primary: var(--spark-9);
|
|
474
472
|
--color-primary-foreground: var(--spark-contrast);
|
|
@@ -725,6 +723,13 @@
|
|
|
725
723
|
*/
|
|
726
724
|
--color-focus-root: var(--spark-11);
|
|
727
725
|
--color-primary-focus: var(--spark-11);
|
|
726
|
+
|
|
727
|
+
--color-primary: var(--spark-9);
|
|
728
|
+
--color-primary-foreground: var(--spark-contrast);
|
|
729
|
+
--color-primary-soft: var(--spark-a3);
|
|
730
|
+
--color-primary-soft-foreground: var(--spark-a11);
|
|
731
|
+
--color-primary-hover: var(--spark-10);
|
|
732
|
+
--color-primary-soft-hover: var(--spark-a4);
|
|
728
733
|
--color-selection-root: var(--spark-a5);
|
|
729
734
|
}
|
|
730
735
|
|