@bzync/rui 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/{autocomplete-CfbfpcO4.js → autocomplete-BgKbj6M4.js} +2 -2
- package/dist/{autocomplete-CaysJRpk.cjs → autocomplete-Bk4pRQ2R.cjs} +1 -1
- package/dist/{calendar-Bnld4G59.cjs → calendar-CUXpVrVE.cjs} +1 -1
- package/dist/{calendar-CdICOROs.js → calendar-j2_zvum1.js} +1 -1
- package/dist/{component-styles-Ce56hn9T.js → component-styles-Bgy44fc8.js} +2 -2
- package/dist/{component-styles-TkZ7v6Ef.cjs → component-styles-DOUctc8_.cjs} +1 -1
- package/dist/components/accordion.cjs +1 -1
- package/dist/components/accordion.js +1 -1
- package/dist/components/alert.cjs +1 -1
- package/dist/components/alert.js +1 -1
- package/dist/components/aspect-ratio.cjs +1 -0
- package/dist/components/aspect-ratio.d.ts +5 -0
- package/dist/components/aspect-ratio.js +20 -0
- package/dist/components/autocomplete.cjs +1 -1
- package/dist/components/autocomplete.js +1 -1
- package/dist/components/avatar-group.cjs +1 -0
- package/dist/components/avatar-group.d.ts +14 -0
- package/dist/components/avatar-group.js +35 -0
- package/dist/components/badge.cjs +1 -1
- package/dist/components/badge.js +1 -1
- package/dist/components/blockquote.cjs +1 -0
- package/dist/components/blockquote.d.ts +10 -0
- package/dist/components/blockquote.js +32 -0
- package/dist/components/breadcrumb.cjs +1 -1
- package/dist/components/breadcrumb.js +1 -1
- package/dist/components/button-group.cjs +1 -0
- package/dist/components/button-group.d.ts +7 -0
- package/dist/components/button-group.js +26 -0
- package/dist/components/button.cjs +1 -1
- package/dist/components/button.js +3 -3
- package/dist/components/calendar.cjs +1 -1
- package/dist/components/calendar.js +1 -1
- package/dist/components/card.cjs +1 -1
- package/dist/components/card.js +3 -3
- package/dist/components/checkbox.cjs +1 -1
- package/dist/components/checkbox.js +1 -1
- package/dist/components/code.cjs +1 -1
- package/dist/components/code.d.ts +4 -4
- package/dist/components/code.js +59 -57
- package/dist/components/command.cjs +1 -1
- package/dist/components/command.js +1 -1
- package/dist/components/copy-button.cjs +1 -1
- package/dist/components/copy-button.js +3 -3
- package/dist/components/currency.cjs +1 -0
- package/dist/components/currency.d.ts +18 -0
- package/dist/components/currency.js +62 -0
- package/dist/components/datatable.cjs +1 -1
- package/dist/components/datatable.js +1 -1
- package/dist/components/datepicker.cjs +1 -1
- package/dist/components/datepicker.js +2 -2
- package/dist/components/description-list.cjs +1 -0
- package/dist/components/description-list.d.ts +14 -0
- package/dist/components/description-list.js +38 -0
- package/dist/components/divider.cjs +1 -0
- package/dist/components/divider.d.ts +12 -0
- package/dist/components/divider.js +45 -0
- package/dist/components/drawer.cjs +1 -1
- package/dist/components/drawer.js +1 -1
- package/dist/components/file-upload.cjs +1 -1
- package/dist/components/file-upload.js +2 -2
- package/dist/components/form-field.cjs +1 -1
- package/dist/components/form-field.js +2 -2
- package/dist/components/input.cjs +1 -1
- package/dist/components/input.js +3 -3
- package/dist/components/label.cjs +1 -1
- package/dist/components/label.js +1 -1
- package/dist/components/modal.cjs +1 -1
- package/dist/components/modal.js +1 -1
- package/dist/components/navigation.cjs +1 -1
- package/dist/components/navigation.js +1 -1
- package/dist/components/number-input.cjs +1 -1
- package/dist/components/number-input.js +2 -2
- package/dist/components/pagination.cjs +1 -1
- package/dist/components/pagination.js +1 -1
- package/dist/components/radio.cjs +1 -1
- package/dist/components/radio.js +2 -2
- package/dist/components/rating.cjs +1 -0
- package/dist/components/rating.d.ts +15 -0
- package/dist/components/rating.js +75 -0
- package/dist/components/scroll-area.cjs +1 -0
- package/dist/components/scroll-area.d.ts +8 -0
- package/dist/components/scroll-area.js +19 -0
- package/dist/components/select.cjs +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/slider.cjs +1 -1
- package/dist/components/slider.js +2 -2
- package/dist/components/snackbar.cjs +1 -1
- package/dist/components/snackbar.js +1 -1
- package/dist/components/stat.cjs +1 -1
- package/dist/components/stat.js +8 -8
- package/dist/components/table.cjs +1 -1
- package/dist/components/table.js +2 -2
- package/dist/components/tabs.cjs +1 -1
- package/dist/components/tabs.js +1 -1
- package/dist/components/textarea.cjs +1 -1
- package/dist/components/textarea.js +2 -2
- package/dist/components/theme-toggle.cjs +1 -1
- package/dist/components/theme-toggle.js +1 -1
- package/dist/components/time-picker.cjs +1 -0
- package/dist/components/time-picker.d.ts +29 -0
- package/dist/components/time-picker.js +336 -0
- package/dist/components/toggle.cjs +1 -0
- package/dist/components/toggle.d.ts +42 -0
- package/dist/components/toggle.js +116 -0
- package/dist/components/typography.cjs +1 -0
- package/dist/components/typography.d.ts +51 -0
- package/dist/components/typography.js +189 -0
- package/dist/{datatable-BB3v__r5.cjs → datatable-rzDgQ3r6.cjs} +1 -1
- package/dist/{datatable-DlBhUhuO.js → datatable-yBN4M3UV.js} +3 -3
- package/dist/{drawer-Cbuh6qdL.cjs → drawer-CTeBsYrO.cjs} +1 -1
- package/dist/{drawer-CqkVZT9Y.js → drawer-ixuzyLVS.js} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +12 -0
- package/dist/index.js +102 -90
- package/dist/lib/component-styles.d.ts +1 -1
- package/dist/select-BFwx--uK.cjs +1 -0
- package/dist/{select-Ch5fp1GT.js → select-ClWrcj3R.js} +3 -3
- package/dist/styles.css +1 -1
- package/dist/{theme-toggle-CnoiorKV.js → theme-toggle-Bb0BYo51.js} +1 -1
- package/dist/{theme-toggle-Dp1-24zH.cjs → theme-toggle-Cld8tktJ.cjs} +1 -1
- package/package.json +1 -1
- package/dist/select-q0YCMhBP.cjs +0 -1
package/dist/components/stat.js
CHANGED
|
@@ -3,7 +3,7 @@ import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
|
3
3
|
//#region src/components/stat.tsx
|
|
4
4
|
var r = {
|
|
5
5
|
up: {
|
|
6
|
-
color: "text-emerald-400",
|
|
6
|
+
color: "text-emerald-700 dark:text-emerald-400",
|
|
7
7
|
icon: /* @__PURE__ */ t("svg", {
|
|
8
8
|
width: "12",
|
|
9
9
|
height: "12",
|
|
@@ -17,7 +17,7 @@ var r = {
|
|
|
17
17
|
})
|
|
18
18
|
},
|
|
19
19
|
down: {
|
|
20
|
-
color: "text-red-400",
|
|
20
|
+
color: "text-red-700 dark:text-red-400",
|
|
21
21
|
icon: /* @__PURE__ */ t("svg", {
|
|
22
22
|
width: "12",
|
|
23
23
|
height: "12",
|
|
@@ -31,7 +31,7 @@ var r = {
|
|
|
31
31
|
})
|
|
32
32
|
},
|
|
33
33
|
neutral: {
|
|
34
|
-
color: "text-
|
|
34
|
+
color: "text-muted-foreground",
|
|
35
35
|
icon: /* @__PURE__ */ t("svg", {
|
|
36
36
|
width: "12",
|
|
37
37
|
height: "12",
|
|
@@ -47,18 +47,18 @@ var r = {
|
|
|
47
47
|
};
|
|
48
48
|
function i({ label: i, value: a, unit: o, valueClassName: s, trend: c, trendValue: l, icon: u, description: d, action: f, className: p, ...m }) {
|
|
49
49
|
return /* @__PURE__ */ n("div", {
|
|
50
|
-
className: e("flex flex-col gap-1 rounded-xl border border-
|
|
50
|
+
className: e("flex flex-col gap-1 rounded-[var(--radius-xl)] border border-border bg-surface p-4 shadow-xs", p),
|
|
51
51
|
...m,
|
|
52
52
|
children: [
|
|
53
53
|
/* @__PURE__ */ n("div", {
|
|
54
54
|
className: "flex items-start justify-between gap-2",
|
|
55
55
|
children: [/* @__PURE__ */ t("p", {
|
|
56
|
-
className: "text-[11px] font-semibold text-
|
|
56
|
+
className: "text-[11px] font-semibold text-muted-foreground uppercase tracking-[0.06em]",
|
|
57
57
|
children: i
|
|
58
58
|
}), /* @__PURE__ */ n("span", {
|
|
59
59
|
className: "flex items-center gap-1.5 shrink-0",
|
|
60
60
|
children: [f, u && /* @__PURE__ */ t("span", {
|
|
61
|
-
className: "text-
|
|
61
|
+
className: "text-muted-foreground",
|
|
62
62
|
children: u
|
|
63
63
|
})]
|
|
64
64
|
})]
|
|
@@ -66,10 +66,10 @@ function i({ label: i, value: a, unit: o, valueClassName: s, trend: c, trendValu
|
|
|
66
66
|
/* @__PURE__ */ n("div", {
|
|
67
67
|
className: "flex items-baseline gap-1.5 mt-1.5",
|
|
68
68
|
children: [/* @__PURE__ */ t("span", {
|
|
69
|
-
className: e("text-[26px] font-semibold tabular-nums text-
|
|
69
|
+
className: e("text-[26px] font-semibold tabular-nums text-foreground leading-none tracking-tight", s),
|
|
70
70
|
children: a
|
|
71
71
|
}), o && /* @__PURE__ */ t("span", {
|
|
72
|
-
className: "text-sm text-
|
|
72
|
+
className: "text-sm text-muted-foreground",
|
|
73
73
|
children: o
|
|
74
74
|
})]
|
|
75
75
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../cn-BdjraxxU.cjs");let t=require("react/jsx-runtime");function n({className:n,containerClassName:r,scrollAreaClassName:i,density:a=`comfortable`,children:o,...s}){return(0,t.jsx)(`div`,{className:e.t(`w-full overflow-hidden rounded-[var(--radius-lg)] border border-border bg-surface`,r),children:(0,t.jsx)(`div`,{className:e.t(`w-full overflow-x-auto overscroll-x-contain scrollbar-thin`,i),children:(0,t.jsx)(`table`,{"data-density":a,className:e.t(`group/table w-full border-collapse text-sm`,n),...s,children:o})})})}function r({className:n,children:r,...i}){return(0,t.jsx)(`thead`,{className:e.t(`border-b border-border bg-surface-muted`,n),...i,children:r})}function i({className:n,children:r,...i}){return(0,t.jsx)(`tbody`,{className:e.t(`divide-y divide-border`,n),...i,children:r})}function a({className:n,children:r,...i}){return(0,t.jsx)(`tr`,{className:e.t(`transition-colors duration-100 hover:bg-surface-muted aria-selected:bg-accent-50/70 dark:aria-selected:bg-accent-500/10`,n),...i,children:r})}function o({className:n,children:r,...i}){return(0,t.jsx)(`th`,{className:e.t(`px-4 py-2.5 text-left text-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../cn-BdjraxxU.cjs");let t=require("react/jsx-runtime");function n({className:n,containerClassName:r,scrollAreaClassName:i,density:a=`comfortable`,children:o,...s}){return(0,t.jsx)(`div`,{className:e.t(`w-full overflow-hidden rounded-[var(--radius-lg)] border border-border bg-surface`,r),children:(0,t.jsx)(`div`,{className:e.t(`w-full overflow-x-auto overscroll-x-contain scrollbar-thin`,i),children:(0,t.jsx)(`table`,{"data-density":a,className:e.t(`group/table w-full border-collapse text-sm`,n),...s,children:o})})})}function r({className:n,children:r,...i}){return(0,t.jsx)(`thead`,{className:e.t(`border-b border-border bg-surface-muted`,n),...i,children:r})}function i({className:n,children:r,...i}){return(0,t.jsx)(`tbody`,{className:e.t(`divide-y divide-border`,n),...i,children:r})}function a({className:n,children:r,...i}){return(0,t.jsx)(`tr`,{className:e.t(`transition-colors duration-100 hover:bg-surface-muted aria-selected:bg-accent-50/70 dark:aria-selected:bg-accent-500/10`,n),...i,children:r})}function o({className:n,children:r,...i}){return(0,t.jsx)(`th`,{className:e.t(`px-4 py-2.5 text-left text-[11px] font-semibold text-muted-foreground whitespace-nowrap group-data-[density=compact]/table:px-3 group-data-[density=compact]/table:py-2`,n),...i,children:r})}function s({className:n,children:r,...i}){return(0,t.jsx)(`td`,{className:e.t(`px-4 py-3 text-sm tabular-nums text-foreground whitespace-nowrap group-data-[density=compact]/table:px-3 group-data-[density=compact]/table:py-2`,n),...i,children:r})}exports.Table=n,exports.TableBody=i,exports.TableCell=s,exports.TableHead=o,exports.TableHeader=r,exports.TableRow=a;
|
package/dist/components/table.js
CHANGED
|
@@ -38,14 +38,14 @@ function a({ className: n, children: r, ...i }) {
|
|
|
38
38
|
}
|
|
39
39
|
function o({ className: n, children: r, ...i }) {
|
|
40
40
|
return /* @__PURE__ */ t("th", {
|
|
41
|
-
className: e("px-4 py-2.5 text-left text-
|
|
41
|
+
className: e("px-4 py-2.5 text-left text-[11px] font-semibold text-muted-foreground whitespace-nowrap group-data-[density=compact]/table:px-3 group-data-[density=compact]/table:py-2", n),
|
|
42
42
|
...i,
|
|
43
43
|
children: r
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
function s({ className: n, children: r, ...i }) {
|
|
47
47
|
return /* @__PURE__ */ t("td", {
|
|
48
|
-
className: e("px-4 py-3 text-sm text-foreground whitespace-nowrap group-data-[density=compact]/table:px-3 group-data-[density=compact]/table:py-2", n),
|
|
48
|
+
className: e("px-4 py-3 text-sm tabular-nums text-foreground whitespace-nowrap group-data-[density=compact]/table:px-3 group-data-[density=compact]/table:py-2", n),
|
|
49
49
|
...i,
|
|
50
50
|
children: r
|
|
51
51
|
});
|
package/dist/components/tabs.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../cn-BdjraxxU.cjs"),t=require("../component-styles-
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../cn-BdjraxxU.cjs"),t=require("../component-styles-DOUctc8_.cjs");let n=require("framer-motion"),r=require("react"),i=require("react/jsx-runtime");var a=(0,r.createContext)(null);function o(){let e=(0,r.useContext)(a);if(!e)throw Error(`Tabs subcomponents must be inside <Tabs>`);return e}function s({defaultValue:t,value:n,children:o,className:s,orientation:c=`horizontal`,onChange:l}){let[u,d]=(0,r.useState)(t),f=n??u,p=(0,r.useId)();return(0,i.jsx)(a.Provider,{value:{active:f,setActive:e=>{n===void 0&&d(e),l?.(e)},orientation:c,tabsId:p},children:(0,i.jsx)(`div`,{className:e.t(c===`vertical`?`flex flex-col gap-4 sm:flex-row`:`flex flex-col`,s),children:o})})}function c({className:t,children:n,...r}){let{orientation:a}=o();return(0,i.jsx)(`div`,{className:e.t(`rounded-[var(--radius-md)] border border-border bg-surface-muted p-1`,a===`vertical`?`flex flex-row sm:flex-col gap-0.5 w-full sm:w-36 sm:shrink-0 overflow-x-auto`:`flex items-center gap-0.5 overflow-x-auto max-w-full scrollbar-none`,t),role:`tablist`,...r,children:n})}function l({value:r,className:a,children:s,icon:c,onKeyDown:l,...u}){let{active:d,setActive:f,orientation:p,tabsId:m}=o(),h=d===r,g=encodeURIComponent(r),_=`${m}-tab-${g}`,v=`${m}-panel-${g}`;function y(e){if(l?.(e),e.defaultPrevented||!(p===`vertical`?[`ArrowUp`,`ArrowDown`]:[`ArrowLeft`,`ArrowRight`]).includes(e.key)&&e.key!==`Home`&&e.key!==`End`)return;let t=e.currentTarget.closest(`[role="tablist"]`),n=Array.from(t?.querySelectorAll(`[role="tab"]:not(:disabled)`)??[]),r=n.indexOf(e.currentTarget);if(r<0||n.length===0)return;e.preventDefault();let i=e.key===`Home`?0:e.key===`End`?n.length-1:(r+(e.key===`ArrowRight`||e.key===`ArrowDown`?1:-1)+n.length)%n.length;n[i]?.focus(),n[i]?.click()}return(0,i.jsxs)(`button`,{role:`tab`,type:`button`,id:_,"aria-controls":v,"aria-selected":h,tabIndex:h?0:-1,onClick:()=>f(r),onKeyDown:y,className:e.t(`relative text-sm font-medium cursor-pointer transition-colors`,p===`vertical`?`flex items-center gap-2 w-full px-3 py-2 rounded-md text-left`:`px-3 py-1.5 rounded-md`,t.s,h?`text-foreground`:`text-muted-foreground hover:text-foreground`,a),...u,children:[h&&(0,i.jsx)(n.motion.span,{layoutId:`tab-bg-${m}`,className:`absolute inset-0 rounded-md border border-border bg-surface shadow-xs`,transition:{type:`spring`,stiffness:450,damping:32}}),c&&(0,i.jsx)(`span`,{className:`relative z-10 shrink-0 opacity-70`,children:c}),(0,i.jsx)(`span`,{className:`relative z-10`,children:s})]})}function u({value:t,className:r,children:a,...s}){let{active:c,orientation:l,tabsId:u}=o(),d=encodeURIComponent(t);return(0,i.jsx)(n.AnimatePresence,{mode:`wait`,children:c===t&&(0,i.jsx)(n.motion.div,{initial:l===`vertical`?{opacity:0,x:6}:{opacity:0,y:4},animate:l===`vertical`?{opacity:1,x:0}:{opacity:1,y:0},exit:l===`vertical`?{opacity:0,x:-6}:{opacity:0,y:-4},transition:{duration:.15},role:`tabpanel`,id:`${u}-panel-${d}`,"aria-labelledby":`${u}-tab-${d}`,tabIndex:0,className:e.t(l===`vertical`?`flex-1 min-w-0`:`mt-4`,r),...s,children:a},t)})}exports.Tabs=s,exports.TabsContent=u,exports.TabsList=c,exports.TabsTrigger=l;
|
package/dist/components/tabs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { t as e } from "../cn-DpgY2leY.js";
|
|
3
|
-
import { s as t } from "../component-styles-
|
|
3
|
+
import { s as t } from "../component-styles-Bgy44fc8.js";
|
|
4
4
|
import { AnimatePresence as n, motion as r } from "framer-motion";
|
|
5
5
|
import { createContext as i, useContext as a, useId as o, useState as s } from "react";
|
|
6
6
|
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../cn-BdjraxxU.cjs"),t=require("../component-styles-
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../cn-BdjraxxU.cjs"),t=require("../component-styles-DOUctc8_.cjs");let n=require("react"),r=require("react/jsx-runtime");var i={sm:`min-h-[64px] px-2 py-1.5 text-xs`,md:`min-h-[88px] px-3 py-2.5 text-sm`,lg:`min-h-[120px] px-4 py-3 text-sm`},a=(0,n.forwardRef)(({className:a,wrapperClassName:o,labelClassName:s,messageClassName:c,label:l,hint:u,error:d,size:f=`md`,id:p,autoComplete:m=`on`,required:h,...g},_)=>{let v=(0,n.useId)(),y=p??v,b=`${y}-message`;return(0,r.jsxs)(`div`,{className:e.t(t.o,o),children:[l&&(0,r.jsxs)(`label`,{htmlFor:y,className:e.t(`text-xs font-semibold leading-5 text-foreground`,s),children:[l,h&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(`span`,{"aria-hidden":`true`,className:`ml-1 text-destructive`,children:`*`}),(0,r.jsx)(`span`,{className:`sr-only`,children:` (required)`})]})]}),(0,r.jsx)(`textarea`,{ref:_,id:y,required:h,"aria-invalid":d?!0:void 0,"aria-describedby":d||u?b:void 0,autoComplete:m,className:e.t(`w-full rounded-[var(--radius-md)] text-foreground placeholder:text-muted-foreground outline-none resize-y`,t.t,i[f],`focus:border-accent-500 focus:ring-2 focus:ring-focus-ring/20`,d&&`border-destructive/60 hover:border-destructive/70 focus-within:border-destructive focus-within:ring-destructive/20`,`disabled:cursor-not-allowed disabled:opacity-50`,a),...g}),d&&(0,r.jsx)(`p`,{id:b,"aria-live":`polite`,className:e.t(`text-xs leading-5 text-destructive`,c),children:d}),u&&!d&&(0,r.jsx)(`p`,{id:b,className:e.t(`text-xs leading-5 text-muted-foreground`,c),children:u})]})});a.displayName=`Textarea`,exports.Textarea=a;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { t as e } from "../cn-DpgY2leY.js";
|
|
3
|
-
import { o as t, t as n } from "../component-styles-
|
|
3
|
+
import { o as t, t as n } from "../component-styles-Bgy44fc8.js";
|
|
4
4
|
import { forwardRef as r, useId as i } from "react";
|
|
5
5
|
import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
6
6
|
//#region src/components/textarea.tsx
|
|
@@ -15,7 +15,7 @@ var c = {
|
|
|
15
15
|
children: [
|
|
16
16
|
f && /* @__PURE__ */ s("label", {
|
|
17
17
|
htmlFor: S,
|
|
18
|
-
className: e("text-
|
|
18
|
+
className: e("text-xs font-semibold leading-5 text-foreground", u),
|
|
19
19
|
children: [f, v && /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("span", {
|
|
20
20
|
"aria-hidden": "true",
|
|
21
21
|
className: "ml-1 text-destructive",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../theme-toggle-
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../theme-toggle-Cld8tktJ.cjs");require("./theme-provider.cjs"),exports.ThemeToggle=e.t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../cn-BdjraxxU.cjs"),t=require("../component-styles-DOUctc8_.cjs");let n=require("react"),r=require("react/jsx-runtime");var i={sm:`h-8 px-2.5 text-xs`,md:`h-9 px-3 text-sm`,lg:`h-10 px-3.5 text-sm`},a={bottom:`top-full mt-1.5`,top:`bottom-full mb-1.5`},o=e=>String(e).padStart(2,`0`);function s(e){if(!e)return null;let t=/^(?:([01]\d|2[0-3])):([0-5]\d)(?::([0-5]\d))?$/.exec(e);return t?{hour:Number(t[1]),minute:Number(t[2]),second:Number(t[3]??0)}:null}function c(e){return e.hour*3600+e.minute*60+e.second}function l(e,t){let n=`${o(e.hour)}:${o(e.minute)}`;return t?`${n}:${o(e.second)}`:n}function u(e,t,n){let r=s(e);if(!r)return``;let i=o(r.minute),a=n?`:${o(r.second)}`:``;if(t===`24`)return`${o(r.hour)}:${i}${a}`;let c=r.hour>=12?`PM`:`AM`;return`${r.hour%12||12}:${i}${a} ${c}`}function d(e){let t=new Date,n=Math.floor(59/e)*e;return{hour:t.getHours(),minute:Math.min(n,Math.round(t.getMinutes()/e)*e),second:t.getSeconds()}}function f({label:n,name:i,options:a,value:o,onSelect:s}){let c=`${i}-label`;function l(e,t){if(![`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key))return;e.preventDefault();let n=e.key===`Home`?0:e.key===`End`?a.length-1:(t+(e.key===`ArrowDown`?1:-1)+a.length)%a.length,r=a[n];r&&(s(r.value),e.currentTarget.closest(`[data-time-column]`)?.querySelectorAll(`[role="option"]`)[n]?.focus())}return(0,r.jsxs)(`div`,{className:`min-w-0`,children:[(0,r.jsx)(`p`,{id:c,className:`mb-1.5 truncate text-center text-[10px] font-semibold uppercase tracking-wider text-muted-foreground`,children:n}),(0,r.jsx)(`div`,{role:`listbox`,"aria-labelledby":c,"data-time-column":i,className:`max-h-44 min-w-0 overflow-y-auto overscroll-contain rounded-[var(--radius-md)] border border-border bg-surface p-1 scrollbar-thin`,children:a.map((n,i)=>{let a=n.value===o;return(0,r.jsx)(`button`,{type:`button`,role:`option`,"aria-selected":a,tabIndex:a?0:-1,onClick:()=>s(n.value),onKeyDown:e=>l(e,i),className:e.t(`flex h-9 w-full items-center justify-center rounded-[var(--radius-sm)] px-1 text-xs tabular-nums transition-colors`,t.s,a?`bg-primary font-semibold text-primary-foreground`:`text-muted-foreground hover:bg-muted hover:text-foreground`),children:n.label},n.value)})})]})}var p=(0,n.forwardRef)(({label:p,hint:m,error:h,value:g,defaultValue:ee=``,onValueChange:_,format:v=`12`,minuteStep:y=5,showSeconds:b=!1,min:te,max:ne,name:x,disabled:S=!1,required:C=!1,clearable:w=!0,placeholder:re=`Select time…`,size:ie=`md`,side:ae=`bottom`,triggerClassName:oe,panelClassName:se,labelClassName:T,messageClassName:E,className:ce,id:le,onBlur:D,...O},k)=>{let A=(0,n.useId)(),j=le??A,M=`${j}-panel`,N=`${j}-message`,P=(0,n.useRef)(null),F=(0,n.useRef)(null);(0,n.useImperativeHandle)(k,()=>F.current);let I=Number.isFinite(y)?Math.max(1,Math.min(30,Math.floor(y))):5,L=e=>{let t=s(e);return t?l(t,b):``},[R,z]=(0,n.useState)(()=>L(ee)),B=L(g??R),[V,H]=(0,n.useState)(!1),[U,W]=(0,n.useState)(()=>s(B)??d(I)),ue=Array.from({length:24},(e,t)=>({value:t,label:o(t)})),de=Array.from({length:12},(e,t)=>({value:t+1,label:o(t+1)})),fe=Array.from({length:Math.floor(59/I)+1},(e,t)=>{let n=t*I;return{value:n,label:o(n)}}),pe=Array.from({length:60},(e,t)=>({value:t,label:o(t)})),me=[{value:0,label:`AM`},{value:1,label:`PM`}],G=s(te),K=s(ne),q=c(U),J=G?q<c(G):!1,he=K?q>c(K):!1,Y=J||he,X=u(B,v,b);function Z(){S||(W(s(B)??d(I)),H(!0))}function Q(e=!1){H(!1),e&&F.current?.focus()}function $(e){g===void 0&&z(e),_?.(e),Q(!0)}return(0,n.useEffect)(()=>{if(!V)return;let e=e=>{P.current?.contains(e.target)||Q()};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[V]),(0,n.useEffect)(()=>{V&&requestAnimationFrame(()=>{P.current?.querySelector(`[data-time-column="hour"] [aria-selected="true"]`)?.focus()})},[V]),(0,r.jsxs)(`div`,{ref:P,className:e.t(`relative`,t.o,ce),onBlur:e=>{D?.(e),e.currentTarget.contains(e.relatedTarget)||Q()},onKeyDown:e=>{e.key===`Escape`&&V&&(e.preventDefault(),Q(!0))},...O,children:[p&&(0,r.jsxs)(`label`,{htmlFor:j,className:e.t(`text-xs font-semibold leading-5 text-foreground`,T),children:[p,C&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(`span`,{"aria-hidden":`true`,className:`ml-1 text-destructive`,children:`*`}),(0,r.jsx)(`span`,{className:`sr-only`,children:` (required)`})]})]}),(0,r.jsxs)(`button`,{ref:F,id:j,type:`button`,disabled:S,"aria-expanded":V,"aria-haspopup":`dialog`,"aria-controls":M,"aria-invalid":h?!0:void 0,"aria-required":C||void 0,"aria-describedby":h||m?N:void 0,onClick:()=>V?Q():Z(),onKeyDown:e=>{e.key===`ArrowDown`&&!V&&(e.preventDefault(),Z())},className:e.t(`flex w-full min-w-0 items-center gap-2 rounded-[var(--radius-md)] text-left`,t.t,t.s,h&&`border-destructive/60 hover:border-destructive/70 focus-within:border-destructive focus-within:ring-destructive/20`,i[ie],oe),children:[(0,r.jsxs)(`svg`,{"aria-hidden":`true`,width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`shrink-0 text-muted-foreground`,children:[(0,r.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,r.jsx)(`path`,{d:`M12 7v5l3 2`})]}),(0,r.jsx)(`span`,{className:e.t(`min-w-0 flex-1 truncate`,X?`text-foreground`:`text-muted-foreground`),children:X||re}),(0,r.jsx)(`svg`,{"aria-hidden":`true`,width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,className:e.t(`shrink-0 text-muted-foreground transition-transform`,V&&`rotate-180`),children:(0,r.jsx)(`path`,{d:`m6 9 6 6 6-6`})})]}),x&&(0,r.jsx)(`input`,{type:`hidden`,name:x,value:B,disabled:S}),V&&(0,r.jsxs)(`div`,{id:M,role:`dialog`,"aria-label":p?`Choose ${p.toLowerCase()}`:`Choose time`,className:e.t(`absolute left-0 z-50 w-[min(22rem,calc(100vw-2rem))] max-h-[min(30rem,calc(100dvh-2rem))] overflow-y-auto rounded-[var(--radius-lg)] border border-border bg-surface-raised p-3 shadow-floating`,a[ae],se),children:[(0,r.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,r.jsxs)(`div`,{className:`min-w-0`,children:[(0,r.jsx)(`p`,{className:`truncate text-sm font-semibold text-foreground`,children:`Choose time`}),(0,r.jsxs)(`p`,{className:`text-[11px] text-muted-foreground`,children:[v===`12`?`12-hour`:`24-hour`,` format`]})]}),(0,r.jsx)(`button`,{type:`button`,onClick:()=>W(d(I)),className:e.t(`h-8 rounded-md px-2.5 text-xs font-medium text-accent-700 hover:bg-muted dark:text-accent-300`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring/35 focus-visible:ring-offset-2 focus-visible:ring-offset-bg`),children:`Now`})]}),(0,r.jsxs)(`div`,{className:e.t(`grid gap-2`,v===`12`&&b?`grid-cols-4`:b||v===`12`?`grid-cols-3`:`grid-cols-2`),children:[(0,r.jsx)(f,{label:`Hour`,name:`hour`,options:v===`24`?ue:de,value:v===`24`?U.hour:U.hour%12||12,onSelect:e=>W(t=>({...t,hour:v===`24`?e:e%12+(t.hour>=12?12:0)}))}),(0,r.jsx)(f,{label:`Minute`,name:`minute`,options:fe,value:U.minute,onSelect:e=>W(t=>({...t,minute:e}))}),b&&(0,r.jsx)(f,{label:`Second`,name:`second`,options:pe,value:U.second,onSelect:e=>W(t=>({...t,second:e}))}),v===`12`&&(0,r.jsx)(f,{label:`Period`,name:`period`,options:me,value:+(U.hour>=12),onSelect:e=>W(t=>({...t,hour:t.hour%12+e*12}))})]}),Y&&(0,r.jsxs)(`p`,{role:`status`,className:`mt-2 text-xs text-destructive`,children:[`Choose a time `,J?`at or after ${u(l(G,b),v,b)}`:`at or before ${u(l(K,b),v,b)}`,`.`]}),(0,r.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-end gap-2 border-t border-border pt-3`,children:[w&&!C&&B&&(0,r.jsx)(`button`,{type:`button`,onClick:()=>$(``),className:e.t(`mr-auto h-8 rounded-md px-2.5 text-xs font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring/35 focus-visible:ring-offset-2 focus-visible:ring-offset-bg`),children:`Clear`}),(0,r.jsx)(`button`,{type:`button`,onClick:()=>Q(!0),className:e.t(`h-8 rounded-md px-3 text-xs font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring/35 focus-visible:ring-offset-2 focus-visible:ring-offset-bg`),children:`Cancel`}),(0,r.jsx)(`button`,{type:`button`,disabled:Y,onClick:()=>$(l(U,b)),className:e.t(`h-8 rounded-md bg-primary px-3 text-xs font-semibold text-primary-foreground hover:bg-primary-hover disabled:cursor-not-allowed disabled:opacity-40`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring/35 focus-visible:ring-offset-2 focus-visible:ring-offset-bg`),children:`Apply`})]})]}),h&&(0,r.jsx)(`p`,{id:N,"aria-live":`polite`,className:e.t(`text-xs leading-5 text-destructive`,E),children:h}),m&&!h&&(0,r.jsx)(`p`,{id:N,className:e.t(`text-xs leading-5 text-muted-foreground`,E),children:m})]})});p.displayName=`TimePicker`,exports.TimePicker=p;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
export type TimePickerSize = "sm" | "md" | "lg";
|
|
3
|
+
export type TimePickerFormat = "12" | "24";
|
|
4
|
+
export type TimePickerSide = "top" | "bottom";
|
|
5
|
+
export interface TimePickerProps extends Omit<HTMLAttributes<HTMLDivElement>, "defaultValue" | "onChange"> {
|
|
6
|
+
label?: string;
|
|
7
|
+
hint?: string;
|
|
8
|
+
error?: string;
|
|
9
|
+
value?: string;
|
|
10
|
+
defaultValue?: string;
|
|
11
|
+
onValueChange?: (value: string) => void;
|
|
12
|
+
format?: TimePickerFormat;
|
|
13
|
+
minuteStep?: number;
|
|
14
|
+
showSeconds?: boolean;
|
|
15
|
+
min?: string;
|
|
16
|
+
max?: string;
|
|
17
|
+
name?: string;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
required?: boolean;
|
|
20
|
+
clearable?: boolean;
|
|
21
|
+
placeholder?: string;
|
|
22
|
+
size?: TimePickerSize;
|
|
23
|
+
side?: TimePickerSide;
|
|
24
|
+
triggerClassName?: string;
|
|
25
|
+
panelClassName?: string;
|
|
26
|
+
labelClassName?: string;
|
|
27
|
+
messageClassName?: string;
|
|
28
|
+
}
|
|
29
|
+
export declare const TimePicker: import('react').ForwardRefExoticComponent<TimePickerProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as e } from "../cn-DpgY2leY.js";
|
|
3
|
+
import { o as t, s as n, t as r } from "../component-styles-Bgy44fc8.js";
|
|
4
|
+
import { forwardRef as i, useEffect as a, useId as o, useImperativeHandle as s, useRef as c, useState as l } from "react";
|
|
5
|
+
import { Fragment as ee, jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/time-picker.tsx
|
|
7
|
+
var te = {
|
|
8
|
+
sm: "h-8 px-2.5 text-xs",
|
|
9
|
+
md: "h-9 px-3 text-sm",
|
|
10
|
+
lg: "h-10 px-3.5 text-sm"
|
|
11
|
+
}, ne = {
|
|
12
|
+
bottom: "top-full mt-1.5",
|
|
13
|
+
top: "bottom-full mb-1.5"
|
|
14
|
+
}, f = (e) => String(e).padStart(2, "0");
|
|
15
|
+
function p(e) {
|
|
16
|
+
if (!e) return null;
|
|
17
|
+
let t = /^(?:([01]\d|2[0-3])):([0-5]\d)(?::([0-5]\d))?$/.exec(e);
|
|
18
|
+
return t ? {
|
|
19
|
+
hour: Number(t[1]),
|
|
20
|
+
minute: Number(t[2]),
|
|
21
|
+
second: Number(t[3] ?? 0)
|
|
22
|
+
} : null;
|
|
23
|
+
}
|
|
24
|
+
function m(e) {
|
|
25
|
+
return e.hour * 3600 + e.minute * 60 + e.second;
|
|
26
|
+
}
|
|
27
|
+
function h(e, t) {
|
|
28
|
+
let n = `${f(e.hour)}:${f(e.minute)}`;
|
|
29
|
+
return t ? `${n}:${f(e.second)}` : n;
|
|
30
|
+
}
|
|
31
|
+
function g(e, t, n) {
|
|
32
|
+
let r = p(e);
|
|
33
|
+
if (!r) return "";
|
|
34
|
+
let i = f(r.minute), a = n ? `:${f(r.second)}` : "";
|
|
35
|
+
if (t === "24") return `${f(r.hour)}:${i}${a}`;
|
|
36
|
+
let o = r.hour >= 12 ? "PM" : "AM";
|
|
37
|
+
return `${r.hour % 12 || 12}:${i}${a} ${o}`;
|
|
38
|
+
}
|
|
39
|
+
function _(e) {
|
|
40
|
+
let t = /* @__PURE__ */ new Date(), n = Math.floor(59 / e) * e;
|
|
41
|
+
return {
|
|
42
|
+
hour: t.getHours(),
|
|
43
|
+
minute: Math.min(n, Math.round(t.getMinutes() / e) * e),
|
|
44
|
+
second: t.getSeconds()
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function v({ label: t, name: r, options: i, value: a, onSelect: o }) {
|
|
48
|
+
let s = `${r}-label`;
|
|
49
|
+
function c(e, t) {
|
|
50
|
+
if (![
|
|
51
|
+
"ArrowUp",
|
|
52
|
+
"ArrowDown",
|
|
53
|
+
"Home",
|
|
54
|
+
"End"
|
|
55
|
+
].includes(e.key)) return;
|
|
56
|
+
e.preventDefault();
|
|
57
|
+
let n = e.key === "Home" ? 0 : e.key === "End" ? i.length - 1 : (t + (e.key === "ArrowDown" ? 1 : -1) + i.length) % i.length, r = i[n];
|
|
58
|
+
r && (o(r.value), e.currentTarget.closest("[data-time-column]")?.querySelectorAll("[role=\"option\"]")[n]?.focus());
|
|
59
|
+
}
|
|
60
|
+
return /* @__PURE__ */ d("div", {
|
|
61
|
+
className: "min-w-0",
|
|
62
|
+
children: [/* @__PURE__ */ u("p", {
|
|
63
|
+
id: s,
|
|
64
|
+
className: "mb-1.5 truncate text-center text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",
|
|
65
|
+
children: t
|
|
66
|
+
}), /* @__PURE__ */ u("div", {
|
|
67
|
+
role: "listbox",
|
|
68
|
+
"aria-labelledby": s,
|
|
69
|
+
"data-time-column": r,
|
|
70
|
+
className: "max-h-44 min-w-0 overflow-y-auto overscroll-contain rounded-[var(--radius-md)] border border-border bg-surface p-1 scrollbar-thin",
|
|
71
|
+
children: i.map((t, r) => {
|
|
72
|
+
let i = t.value === a;
|
|
73
|
+
return /* @__PURE__ */ u("button", {
|
|
74
|
+
type: "button",
|
|
75
|
+
role: "option",
|
|
76
|
+
"aria-selected": i,
|
|
77
|
+
tabIndex: i ? 0 : -1,
|
|
78
|
+
onClick: () => o(t.value),
|
|
79
|
+
onKeyDown: (e) => c(e, r),
|
|
80
|
+
className: e("flex h-9 w-full items-center justify-center rounded-[var(--radius-sm)] px-1 text-xs tabular-nums transition-colors", n, i ? "bg-primary font-semibold text-primary-foreground" : "text-muted-foreground hover:bg-muted hover:text-foreground"),
|
|
81
|
+
children: t.label
|
|
82
|
+
}, t.value);
|
|
83
|
+
})
|
|
84
|
+
})]
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
var y = i(({ label: i, hint: y, error: b, value: x, defaultValue: S = "", onValueChange: C, format: w = "12", minuteStep: T = 5, showSeconds: E = !1, min: re, max: D, name: O, disabled: k = !1, required: A = !1, clearable: ie = !0, placeholder: ae = "Select time…", size: oe = "md", side: se = "bottom", triggerClassName: ce, panelClassName: le, labelClassName: ue, messageClassName: j, className: de, id: fe, onBlur: pe, ...me }, he) => {
|
|
88
|
+
let ge = o(), M = fe ?? ge, N = `${M}-panel`, P = `${M}-message`, F = c(null), I = c(null);
|
|
89
|
+
s(he, () => I.current);
|
|
90
|
+
let L = Number.isFinite(T) ? Math.max(1, Math.min(30, Math.floor(T))) : 5, R = (e) => {
|
|
91
|
+
let t = p(e);
|
|
92
|
+
return t ? h(t, E) : "";
|
|
93
|
+
}, [_e, ve] = l(() => R(S)), z = R(x ?? _e), [B, V] = l(!1), [H, U] = l(() => p(z) ?? _(L)), ye = Array.from({ length: 24 }, (e, t) => ({
|
|
94
|
+
value: t,
|
|
95
|
+
label: f(t)
|
|
96
|
+
})), be = Array.from({ length: 12 }, (e, t) => ({
|
|
97
|
+
value: t + 1,
|
|
98
|
+
label: f(t + 1)
|
|
99
|
+
})), xe = Array.from({ length: Math.floor(59 / L) + 1 }, (e, t) => {
|
|
100
|
+
let n = t * L;
|
|
101
|
+
return {
|
|
102
|
+
value: n,
|
|
103
|
+
label: f(n)
|
|
104
|
+
};
|
|
105
|
+
}), Se = Array.from({ length: 60 }, (e, t) => ({
|
|
106
|
+
value: t,
|
|
107
|
+
label: f(t)
|
|
108
|
+
})), W = [{
|
|
109
|
+
value: 0,
|
|
110
|
+
label: "AM"
|
|
111
|
+
}, {
|
|
112
|
+
value: 1,
|
|
113
|
+
label: "PM"
|
|
114
|
+
}], G = p(re), K = p(D), q = m(H), J = G ? q < m(G) : !1, Ce = K ? q > m(K) : !1, Y = J || Ce, X = g(z, w, E);
|
|
115
|
+
function Z() {
|
|
116
|
+
k || (U(p(z) ?? _(L)), V(!0));
|
|
117
|
+
}
|
|
118
|
+
function Q(e = !1) {
|
|
119
|
+
V(!1), e && I.current?.focus();
|
|
120
|
+
}
|
|
121
|
+
function $(e) {
|
|
122
|
+
x === void 0 && ve(e), C?.(e), Q(!0);
|
|
123
|
+
}
|
|
124
|
+
return a(() => {
|
|
125
|
+
if (!B) return;
|
|
126
|
+
let e = (e) => {
|
|
127
|
+
F.current?.contains(e.target) || Q();
|
|
128
|
+
};
|
|
129
|
+
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
130
|
+
}, [B]), a(() => {
|
|
131
|
+
B && requestAnimationFrame(() => {
|
|
132
|
+
F.current?.querySelector("[data-time-column=\"hour\"] [aria-selected=\"true\"]")?.focus();
|
|
133
|
+
});
|
|
134
|
+
}, [B]), /* @__PURE__ */ d("div", {
|
|
135
|
+
ref: F,
|
|
136
|
+
className: e("relative", t, de),
|
|
137
|
+
onBlur: (e) => {
|
|
138
|
+
pe?.(e), e.currentTarget.contains(e.relatedTarget) || Q();
|
|
139
|
+
},
|
|
140
|
+
onKeyDown: (e) => {
|
|
141
|
+
e.key === "Escape" && B && (e.preventDefault(), Q(!0));
|
|
142
|
+
},
|
|
143
|
+
...me,
|
|
144
|
+
children: [
|
|
145
|
+
i && /* @__PURE__ */ d("label", {
|
|
146
|
+
htmlFor: M,
|
|
147
|
+
className: e("text-xs font-semibold leading-5 text-foreground", ue),
|
|
148
|
+
children: [i, A && /* @__PURE__ */ d(ee, { children: [/* @__PURE__ */ u("span", {
|
|
149
|
+
"aria-hidden": "true",
|
|
150
|
+
className: "ml-1 text-destructive",
|
|
151
|
+
children: "*"
|
|
152
|
+
}), /* @__PURE__ */ u("span", {
|
|
153
|
+
className: "sr-only",
|
|
154
|
+
children: " (required)"
|
|
155
|
+
})] })]
|
|
156
|
+
}),
|
|
157
|
+
/* @__PURE__ */ d("button", {
|
|
158
|
+
ref: I,
|
|
159
|
+
id: M,
|
|
160
|
+
type: "button",
|
|
161
|
+
disabled: k,
|
|
162
|
+
"aria-expanded": B,
|
|
163
|
+
"aria-haspopup": "dialog",
|
|
164
|
+
"aria-controls": N,
|
|
165
|
+
"aria-invalid": b ? !0 : void 0,
|
|
166
|
+
"aria-required": A || void 0,
|
|
167
|
+
"aria-describedby": b || y ? P : void 0,
|
|
168
|
+
onClick: () => B ? Q() : Z(),
|
|
169
|
+
onKeyDown: (e) => {
|
|
170
|
+
e.key === "ArrowDown" && !B && (e.preventDefault(), Z());
|
|
171
|
+
},
|
|
172
|
+
className: e("flex w-full min-w-0 items-center gap-2 rounded-[var(--radius-md)] text-left", r, n, b && "border-destructive/60 hover:border-destructive/70 focus-within:border-destructive focus-within:ring-destructive/20", te[oe], ce),
|
|
173
|
+
children: [
|
|
174
|
+
/* @__PURE__ */ d("svg", {
|
|
175
|
+
"aria-hidden": "true",
|
|
176
|
+
width: "15",
|
|
177
|
+
height: "15",
|
|
178
|
+
viewBox: "0 0 24 24",
|
|
179
|
+
fill: "none",
|
|
180
|
+
stroke: "currentColor",
|
|
181
|
+
strokeWidth: "2",
|
|
182
|
+
strokeLinecap: "round",
|
|
183
|
+
strokeLinejoin: "round",
|
|
184
|
+
className: "shrink-0 text-muted-foreground",
|
|
185
|
+
children: [/* @__PURE__ */ u("circle", {
|
|
186
|
+
cx: "12",
|
|
187
|
+
cy: "12",
|
|
188
|
+
r: "9"
|
|
189
|
+
}), /* @__PURE__ */ u("path", { d: "M12 7v5l3 2" })]
|
|
190
|
+
}),
|
|
191
|
+
/* @__PURE__ */ u("span", {
|
|
192
|
+
className: e("min-w-0 flex-1 truncate", X ? "text-foreground" : "text-muted-foreground"),
|
|
193
|
+
children: X || ae
|
|
194
|
+
}),
|
|
195
|
+
/* @__PURE__ */ u("svg", {
|
|
196
|
+
"aria-hidden": "true",
|
|
197
|
+
width: "13",
|
|
198
|
+
height: "13",
|
|
199
|
+
viewBox: "0 0 24 24",
|
|
200
|
+
fill: "none",
|
|
201
|
+
stroke: "currentColor",
|
|
202
|
+
strokeWidth: "2.5",
|
|
203
|
+
strokeLinecap: "round",
|
|
204
|
+
strokeLinejoin: "round",
|
|
205
|
+
className: e("shrink-0 text-muted-foreground transition-transform", B && "rotate-180"),
|
|
206
|
+
children: /* @__PURE__ */ u("path", { d: "m6 9 6 6 6-6" })
|
|
207
|
+
})
|
|
208
|
+
]
|
|
209
|
+
}),
|
|
210
|
+
O && /* @__PURE__ */ u("input", {
|
|
211
|
+
type: "hidden",
|
|
212
|
+
name: O,
|
|
213
|
+
value: z,
|
|
214
|
+
disabled: k
|
|
215
|
+
}),
|
|
216
|
+
B && /* @__PURE__ */ d("div", {
|
|
217
|
+
id: N,
|
|
218
|
+
role: "dialog",
|
|
219
|
+
"aria-label": i ? `Choose ${i.toLowerCase()}` : "Choose time",
|
|
220
|
+
className: e("absolute left-0 z-50 w-[min(22rem,calc(100vw-2rem))] max-h-[min(30rem,calc(100dvh-2rem))] overflow-y-auto rounded-[var(--radius-lg)] border border-border bg-surface-raised p-3 shadow-floating", ne[se], le),
|
|
221
|
+
children: [
|
|
222
|
+
/* @__PURE__ */ d("div", {
|
|
223
|
+
className: "mb-3 flex items-center justify-between gap-3",
|
|
224
|
+
children: [/* @__PURE__ */ d("div", {
|
|
225
|
+
className: "min-w-0",
|
|
226
|
+
children: [/* @__PURE__ */ u("p", {
|
|
227
|
+
className: "truncate text-sm font-semibold text-foreground",
|
|
228
|
+
children: "Choose time"
|
|
229
|
+
}), /* @__PURE__ */ d("p", {
|
|
230
|
+
className: "text-[11px] text-muted-foreground",
|
|
231
|
+
children: [w === "12" ? "12-hour" : "24-hour", " format"]
|
|
232
|
+
})]
|
|
233
|
+
}), /* @__PURE__ */ u("button", {
|
|
234
|
+
type: "button",
|
|
235
|
+
onClick: () => U(_(L)),
|
|
236
|
+
className: e("h-8 rounded-md px-2.5 text-xs font-medium text-accent-700 hover:bg-muted dark:text-accent-300", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring/35 focus-visible:ring-offset-2 focus-visible:ring-offset-bg"),
|
|
237
|
+
children: "Now"
|
|
238
|
+
})]
|
|
239
|
+
}),
|
|
240
|
+
/* @__PURE__ */ d("div", {
|
|
241
|
+
className: e("grid gap-2", w === "12" && E ? "grid-cols-4" : E || w === "12" ? "grid-cols-3" : "grid-cols-2"),
|
|
242
|
+
children: [
|
|
243
|
+
/* @__PURE__ */ u(v, {
|
|
244
|
+
label: "Hour",
|
|
245
|
+
name: "hour",
|
|
246
|
+
options: w === "24" ? ye : be,
|
|
247
|
+
value: w === "24" ? H.hour : H.hour % 12 || 12,
|
|
248
|
+
onSelect: (e) => U((t) => ({
|
|
249
|
+
...t,
|
|
250
|
+
hour: w === "24" ? e : e % 12 + (t.hour >= 12 ? 12 : 0)
|
|
251
|
+
}))
|
|
252
|
+
}),
|
|
253
|
+
/* @__PURE__ */ u(v, {
|
|
254
|
+
label: "Minute",
|
|
255
|
+
name: "minute",
|
|
256
|
+
options: xe,
|
|
257
|
+
value: H.minute,
|
|
258
|
+
onSelect: (e) => U((t) => ({
|
|
259
|
+
...t,
|
|
260
|
+
minute: e
|
|
261
|
+
}))
|
|
262
|
+
}),
|
|
263
|
+
E && /* @__PURE__ */ u(v, {
|
|
264
|
+
label: "Second",
|
|
265
|
+
name: "second",
|
|
266
|
+
options: Se,
|
|
267
|
+
value: H.second,
|
|
268
|
+
onSelect: (e) => U((t) => ({
|
|
269
|
+
...t,
|
|
270
|
+
second: e
|
|
271
|
+
}))
|
|
272
|
+
}),
|
|
273
|
+
w === "12" && /* @__PURE__ */ u(v, {
|
|
274
|
+
label: "Period",
|
|
275
|
+
name: "period",
|
|
276
|
+
options: W,
|
|
277
|
+
value: +(H.hour >= 12),
|
|
278
|
+
onSelect: (e) => U((t) => ({
|
|
279
|
+
...t,
|
|
280
|
+
hour: t.hour % 12 + e * 12
|
|
281
|
+
}))
|
|
282
|
+
})
|
|
283
|
+
]
|
|
284
|
+
}),
|
|
285
|
+
Y && /* @__PURE__ */ d("p", {
|
|
286
|
+
role: "status",
|
|
287
|
+
className: "mt-2 text-xs text-destructive",
|
|
288
|
+
children: [
|
|
289
|
+
"Choose a time ",
|
|
290
|
+
J ? `at or after ${g(h(G, E), w, E)}` : `at or before ${g(h(K, E), w, E)}`,
|
|
291
|
+
"."
|
|
292
|
+
]
|
|
293
|
+
}),
|
|
294
|
+
/* @__PURE__ */ d("div", {
|
|
295
|
+
className: "mt-3 flex flex-wrap items-center justify-end gap-2 border-t border-border pt-3",
|
|
296
|
+
children: [
|
|
297
|
+
ie && !A && z && /* @__PURE__ */ u("button", {
|
|
298
|
+
type: "button",
|
|
299
|
+
onClick: () => $(""),
|
|
300
|
+
className: e("mr-auto h-8 rounded-md px-2.5 text-xs font-medium text-muted-foreground hover:bg-muted hover:text-foreground", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring/35 focus-visible:ring-offset-2 focus-visible:ring-offset-bg"),
|
|
301
|
+
children: "Clear"
|
|
302
|
+
}),
|
|
303
|
+
/* @__PURE__ */ u("button", {
|
|
304
|
+
type: "button",
|
|
305
|
+
onClick: () => Q(!0),
|
|
306
|
+
className: e("h-8 rounded-md px-3 text-xs font-medium text-muted-foreground hover:bg-muted hover:text-foreground", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring/35 focus-visible:ring-offset-2 focus-visible:ring-offset-bg"),
|
|
307
|
+
children: "Cancel"
|
|
308
|
+
}),
|
|
309
|
+
/* @__PURE__ */ u("button", {
|
|
310
|
+
type: "button",
|
|
311
|
+
disabled: Y,
|
|
312
|
+
onClick: () => $(h(H, E)),
|
|
313
|
+
className: e("h-8 rounded-md bg-primary px-3 text-xs font-semibold text-primary-foreground hover:bg-primary-hover disabled:cursor-not-allowed disabled:opacity-40", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring/35 focus-visible:ring-offset-2 focus-visible:ring-offset-bg"),
|
|
314
|
+
children: "Apply"
|
|
315
|
+
})
|
|
316
|
+
]
|
|
317
|
+
})
|
|
318
|
+
]
|
|
319
|
+
}),
|
|
320
|
+
b && /* @__PURE__ */ u("p", {
|
|
321
|
+
id: P,
|
|
322
|
+
"aria-live": "polite",
|
|
323
|
+
className: e("text-xs leading-5 text-destructive", j),
|
|
324
|
+
children: b
|
|
325
|
+
}),
|
|
326
|
+
y && !b && /* @__PURE__ */ u("p", {
|
|
327
|
+
id: P,
|
|
328
|
+
className: e("text-xs leading-5 text-muted-foreground", j),
|
|
329
|
+
children: y
|
|
330
|
+
})
|
|
331
|
+
]
|
|
332
|
+
});
|
|
333
|
+
});
|
|
334
|
+
y.displayName = "TimePicker";
|
|
335
|
+
//#endregion
|
|
336
|
+
export { y as TimePicker };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../cn-BdjraxxU.cjs"),t=require("../component-styles-DOUctc8_.cjs");let n=require("react"),r=require("react/jsx-runtime");var i={default:[`border border-transparent bg-transparent text-muted-foreground`,`hover:bg-muted hover:text-foreground`,`data-[state=on]:bg-accent-100 data-[state=on]:text-accent-800`,`dark:data-[state=on]:bg-accent-900/45 dark:data-[state=on]:text-accent-200`].join(` `),outline:[`border border-border bg-surface text-muted-foreground shadow-xs`,`hover:border-border-strong hover:bg-surface-muted hover:text-foreground`,`data-[state=on]:border-accent-300 data-[state=on]:bg-accent-50 data-[state=on]:text-accent-800`,`dark:data-[state=on]:border-accent-700 dark:data-[state=on]:bg-accent-900/35 dark:data-[state=on]:text-accent-200`].join(` `)},a={sm:`h-8 rounded-[var(--radius-md)] px-2.5 text-xs gap-1.5`,md:`h-9 rounded-[var(--radius-md)] px-3 text-sm gap-2`,lg:`h-10 rounded-[var(--radius-lg)] px-4 text-sm gap-2`,icon:`size-9 rounded-[var(--radius-md)] p-0`},o=[`inline-flex shrink-0 cursor-pointer select-none items-center justify-center font-medium`,`transition-[color,background-color,border-color,box-shadow] duration-150`,`disabled:pointer-events-none disabled:opacity-40`,t.s].join(` `),s=(0,n.forwardRef)(({pressed:t,defaultPressed:s=!1,onPressedChange:c,variant:l=`default`,size:u=`md`,className:d,type:f=`button`,onClick:p,...m},h)=>{let[g,_]=(0,n.useState)(s),v=t??g;return(0,r.jsx)(`button`,{ref:h,type:f,"aria-pressed":v,"data-state":v?`on`:`off`,className:e.t(o,i[l],a[u],d),onClick:e=>{if(p?.(e),e.defaultPrevented)return;let n=!v;t===void 0&&_(n),c?.(n)},...m})});s.displayName=`Toggle`;var c=(0,n.createContext)(null);function l(){let e=(0,n.useContext)(c);if(!e)throw Error(`ToggleGroupItem must be inside <ToggleGroup>`);return e}var u=(0,n.forwardRef)(({type:t=`single`,value:i,defaultValue:a,onValueChange:o,orientation:s=`horizontal`,variant:l=`default`,size:u=`md`,disabled:d=!1,loop:f=!0,className:p,children:m,...h},g)=>{let[_,v]=(0,n.useState)(()=>a??(t===`multiple`?[]:``)),y=i??_,b=o;function x(e){return t===`multiple`?Array.isArray(y)&&y.includes(e):y===e}function S(e){let n=t===`multiple`?(()=>{let t=Array.isArray(y)?y:[];return t.includes(e)?t.filter(t=>t!==e):[...t,e]})():y===e?``:e;i===void 0&&v(n),b?.(n)}return(0,r.jsx)(c.Provider,{value:{disabled:d,isPressed:x,loop:f,orientation:s,select:S,size:u,variant:l},children:(0,r.jsx)(`div`,{ref:g,role:`group`,"data-rui-toggle-group":``,"data-orientation":s,className:e.t(`inline-flex w-fit rounded-[var(--radius-lg)]`,s===`horizontal`?`max-w-full flex-row items-center gap-1 overflow-x-auto overscroll-x-contain p-0.5 scrollbar-none [&>*]:shrink-0`:`max-w-full flex-col items-stretch gap-1`,p),...h,children:m})})});u.displayName=`ToggleGroup`;var d=(0,n.forwardRef)(({value:t,variant:n,size:s,className:c,disabled:u,type:d=`button`,onClick:f,onKeyDown:p,...m},h)=>{let g=l(),_=g.isPressed(t),v=g.disabled||u;function y(e){if(p?.(e),e.defaultPrevented)return;let t=g.orientation===`horizontal`?`ArrowLeft`:`ArrowUp`,n=g.orientation===`horizontal`?`ArrowRight`:`ArrowDown`;if(e.key!==t&&e.key!==n&&e.key!==`Home`&&e.key!==`End`)return;let r=e.currentTarget.closest(`[data-rui-toggle-group]`),i=Array.from(r?.querySelectorAll(`[data-rui-toggle-item]:not(:disabled)`)??[]).filter(e=>e.closest(`[data-rui-toggle-group]`)===r),a=i.indexOf(e.currentTarget);if(a<0||i.length===0)return;e.preventDefault();let o=e.key===`Home`?0:e.key===`End`?i.length-1:a+(e.key===n?1:-1);o=g.loop?(o+i.length)%i.length:Math.max(0,Math.min(i.length-1,o)),i[o]?.focus()}return(0,r.jsx)(`button`,{ref:h,type:d,"aria-pressed":_,"data-rui-toggle-item":``,"data-state":_?`on`:`off`,disabled:v,className:e.t(o,i[n??g.variant],a[s??g.size],c),onClick:e=>{f?.(e),e.defaultPrevented||g.select(t)},onKeyDown:y,...m})});d.displayName=`ToggleGroupItem`,exports.Toggle=s,exports.ToggleGroup=u,exports.ToggleGroupItem=d,exports.toggleSizes=a,exports.toggleVariants=i;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ButtonHTMLAttributes, HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export type ToggleVariant = "default" | "outline";
|
|
3
|
+
export type ToggleSize = "sm" | "md" | "lg" | "icon";
|
|
4
|
+
export declare const toggleVariants: Record<ToggleVariant, string>;
|
|
5
|
+
export declare const toggleSizes: Record<ToggleSize, string>;
|
|
6
|
+
export interface ToggleProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
7
|
+
pressed?: boolean;
|
|
8
|
+
defaultPressed?: boolean;
|
|
9
|
+
onPressedChange?: (pressed: boolean) => void;
|
|
10
|
+
variant?: ToggleVariant;
|
|
11
|
+
size?: ToggleSize;
|
|
12
|
+
}
|
|
13
|
+
export declare const Toggle: import('react').ForwardRefExoticComponent<ToggleProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
14
|
+
interface ToggleGroupBaseProps extends Omit<HTMLAttributes<HTMLDivElement>, "defaultValue"> {
|
|
15
|
+
orientation?: "horizontal" | "vertical";
|
|
16
|
+
variant?: ToggleVariant;
|
|
17
|
+
size?: ToggleSize;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
loop?: boolean;
|
|
20
|
+
children: ReactNode;
|
|
21
|
+
}
|
|
22
|
+
export interface ToggleGroupSingleProps extends ToggleGroupBaseProps {
|
|
23
|
+
type?: "single";
|
|
24
|
+
value?: string;
|
|
25
|
+
defaultValue?: string;
|
|
26
|
+
onValueChange?: (value: string) => void;
|
|
27
|
+
}
|
|
28
|
+
export interface ToggleGroupMultipleProps extends ToggleGroupBaseProps {
|
|
29
|
+
type: "multiple";
|
|
30
|
+
value?: string[];
|
|
31
|
+
defaultValue?: string[];
|
|
32
|
+
onValueChange?: (value: string[]) => void;
|
|
33
|
+
}
|
|
34
|
+
export type ToggleGroupProps = ToggleGroupSingleProps | ToggleGroupMultipleProps;
|
|
35
|
+
export declare const ToggleGroup: import('react').ForwardRefExoticComponent<ToggleGroupProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
36
|
+
export interface ToggleGroupItemProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "value"> {
|
|
37
|
+
value: string;
|
|
38
|
+
variant?: ToggleVariant;
|
|
39
|
+
size?: ToggleSize;
|
|
40
|
+
}
|
|
41
|
+
export declare const ToggleGroupItem: import('react').ForwardRefExoticComponent<ToggleGroupItemProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
42
|
+
export {};
|