@forgedevstack/bear 1.0.0 → 1.0.2
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/components/Alert/Alert.cjs +1 -1
- package/dist/components/Alert/Alert.js +38 -38
- package/dist/components/AppBar/AppBar.cjs +1 -1
- package/dist/components/AppBar/AppBar.js +15 -15
- package/dist/components/Badge/Badge.cjs +1 -1
- package/dist/components/Badge/Badge.constants.cjs +1 -0
- package/dist/components/Badge/Badge.constants.d.ts +6 -0
- package/dist/components/Badge/Badge.constants.js +34 -0
- package/dist/components/Badge/Badge.js +27 -52
- package/dist/components/Button/Button.cjs +1 -57
- package/dist/components/Button/Button.constants.cjs +57 -0
- package/dist/components/Button/Button.constants.d.ts +3 -0
- package/dist/components/Button/Button.constants.js +77 -0
- package/dist/components/Button/Button.js +55 -119
- package/dist/components/Button/Button.types.d.ts +6 -1
- package/dist/components/ButtonGroup/ButtonGroup.cjs +1 -1
- package/dist/components/ButtonGroup/ButtonGroup.js +17 -17
- package/dist/components/Calendar/Calendar.cjs +1 -0
- package/dist/components/Calendar/Calendar.d.ts +3 -0
- package/dist/components/Calendar/Calendar.js +203 -0
- package/dist/components/Calendar/Calendar.types.d.ts +124 -0
- package/dist/components/Calendar/index.d.ts +2 -0
- package/dist/components/Card/Card.cjs +1 -1
- package/dist/components/Card/Card.js +65 -65
- package/dist/components/Checkbox/Checkbox.cjs +1 -1
- package/dist/components/Checkbox/Checkbox.js +48 -48
- package/dist/components/Container/Container.cjs +1 -1
- package/dist/components/Container/Container.js +15 -15
- package/dist/components/DatePicker/DatePicker.cjs +1 -1
- package/dist/components/DatePicker/DatePicker.js +77 -85
- package/dist/components/DatePicker/DatePicker.types.d.ts +9 -0
- package/dist/components/DatePicker/DatePicker.utils.cjs +1 -0
- package/dist/components/DatePicker/DatePicker.utils.d.ts +1 -0
- package/dist/components/DatePicker/DatePicker.utils.js +9 -0
- package/dist/components/DateTimePicker/DateTimePicker.cjs +1 -0
- package/dist/components/DateTimePicker/DateTimePicker.d.ts +3 -0
- package/dist/components/DateTimePicker/DateTimePicker.js +178 -0
- package/dist/components/DateTimePicker/DateTimePicker.types.d.ts +26 -0
- package/dist/components/DateTimePicker/DateTimePicker.utils.cjs +1 -0
- package/dist/components/DateTimePicker/DateTimePicker.utils.d.ts +2 -0
- package/dist/components/DateTimePicker/DateTimePicker.utils.js +16 -0
- package/dist/components/DateTimePicker/index.d.ts +2 -0
- package/dist/components/Divider/Divider.cjs +1 -1
- package/dist/components/Divider/Divider.js +29 -29
- package/dist/components/Dropdown/Dropdown.cjs +1 -1
- package/dist/components/Dropdown/Dropdown.js +70 -70
- package/dist/components/Fab/Fab.cjs +1 -1
- package/dist/components/Fab/Fab.js +42 -42
- package/dist/components/FileUpload/FileUpload.cjs +1 -1
- package/dist/components/FileUpload/FileUpload.js +46 -49
- package/dist/components/FileUpload/FileUpload.utils.cjs +1 -0
- package/dist/components/FileUpload/FileUpload.utils.d.ts +1 -0
- package/dist/components/FileUpload/FileUpload.utils.js +9 -0
- package/dist/components/Flex/Flex.cjs +1 -1
- package/dist/components/Flex/Flex.js +58 -58
- package/dist/components/Grid/Grid.cjs +1 -1
- package/dist/components/Grid/Grid.js +60 -60
- package/dist/components/Link/Link.cjs +1 -1
- package/dist/components/Link/Link.js +47 -47
- package/dist/components/List/List.cjs +1 -1
- package/dist/components/List/List.js +117 -117
- package/dist/components/Menu/Menu.cjs +1 -1
- package/dist/components/Menu/Menu.js +58 -58
- package/dist/components/Paper/Paper.cjs +1 -1
- package/dist/components/Paper/Paper.js +36 -36
- package/dist/components/Radio/Radio.cjs +1 -1
- package/dist/components/Radio/Radio.js +79 -79
- package/dist/components/Rating/Rating.cjs +1 -1
- package/dist/components/Rating/Rating.js +37 -37
- package/dist/components/SpeedDial/SpeedDial.cjs +1 -1
- package/dist/components/SpeedDial/SpeedDial.js +40 -40
- package/dist/components/Spinner/Spinner.cjs +1 -1
- package/dist/components/Spinner/Spinner.js +24 -24
- package/dist/components/TimePicker/TimePicker.cjs +1 -1
- package/dist/components/TimePicker/TimePicker.constants.cjs +1 -0
- package/dist/components/TimePicker/TimePicker.constants.d.ts +5 -0
- package/dist/components/TimePicker/TimePicker.constants.js +16 -0
- package/dist/components/TimePicker/TimePicker.js +91 -70
- package/dist/components/TimePicker/TimePicker.types.d.ts +5 -2
- package/dist/components/TimePicker/TimePicker.utils.cjs +1 -0
- package/dist/components/TimePicker/TimePicker.utils.d.ts +1 -0
- package/dist/components/TimePicker/TimePicker.utils.js +7 -0
- package/dist/components/TransferList/TransferList.cjs +1 -1
- package/dist/components/TransferList/TransferList.js +74 -74
- package/dist/components/Typography/Typography.cjs +1 -1
- package/dist/components/Typography/Typography.js +52 -52
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.js +67 -63
- package/dist/context/BearProvider.cjs +1 -1
- package/dist/context/BearProvider.d.ts +6 -1
- package/dist/context/BearProvider.js +42 -38
- package/dist/context/index.cjs +1 -1
- package/dist/context/index.d.ts +1 -1
- package/dist/context/index.js +6 -5
- package/dist/hooks/bearStyled.cjs +1 -0
- package/dist/hooks/bearStyled.d.ts +17 -0
- package/dist/hooks/bearStyled.js +17 -0
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +14 -10
- package/dist/hooks/useBearStyles.cjs +1 -0
- package/dist/hooks/useBearStyles.d.ts +11 -0
- package/dist/hooks/useBearStyles.js +14 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +99 -90
- package/dist/styles.css +1 -0
- package/dist/types/bis.types.d.ts +9 -0
- package/dist/types/component.types.d.ts +3 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +2 -2
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { cn as
|
|
3
|
-
const
|
|
4
|
-
xs: "
|
|
5
|
-
sm: "
|
|
6
|
-
md: "
|
|
7
|
-
lg: "
|
|
8
|
-
xl: "
|
|
9
|
-
},
|
|
10
|
-
size:
|
|
1
|
+
import { jsxs as l, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { cn as t } from "../../utils/cn.js";
|
|
3
|
+
const o = {
|
|
4
|
+
xs: "bear-w-3 bear-h-3",
|
|
5
|
+
sm: "bear-w-4 bear-h-4",
|
|
6
|
+
md: "bear-w-6 bear-h-6",
|
|
7
|
+
lg: "bear-w-8 bear-h-8",
|
|
8
|
+
xl: "bear-w-10 bear-h-10"
|
|
9
|
+
}, n = ({
|
|
10
|
+
size: r = "md",
|
|
11
11
|
className: s,
|
|
12
|
-
color:
|
|
13
|
-
label:
|
|
14
|
-
}) => /* @__PURE__ */
|
|
12
|
+
color: a = "currentColor",
|
|
13
|
+
label: i = "Loading"
|
|
14
|
+
}) => /* @__PURE__ */ l(
|
|
15
15
|
"svg",
|
|
16
16
|
{
|
|
17
|
-
className:
|
|
18
|
-
"
|
|
19
|
-
|
|
17
|
+
className: t(
|
|
18
|
+
"bear-animate-spin",
|
|
19
|
+
o[r],
|
|
20
20
|
s
|
|
21
21
|
),
|
|
22
22
|
viewBox: "0 0 24 24",
|
|
23
23
|
fill: "none",
|
|
24
|
-
"aria-label":
|
|
24
|
+
"aria-label": i,
|
|
25
25
|
role: "status",
|
|
26
26
|
children: [
|
|
27
|
-
/* @__PURE__ */
|
|
27
|
+
/* @__PURE__ */ e(
|
|
28
28
|
"circle",
|
|
29
29
|
{
|
|
30
|
-
className: "
|
|
30
|
+
className: "bear-opacity-25",
|
|
31
31
|
cx: "12",
|
|
32
32
|
cy: "12",
|
|
33
33
|
r: "10",
|
|
34
|
-
stroke:
|
|
34
|
+
stroke: a,
|
|
35
35
|
strokeWidth: "4"
|
|
36
36
|
}
|
|
37
37
|
),
|
|
38
|
-
/* @__PURE__ */
|
|
38
|
+
/* @__PURE__ */ e(
|
|
39
39
|
"path",
|
|
40
40
|
{
|
|
41
|
-
className: "
|
|
42
|
-
fill:
|
|
41
|
+
className: "bear-opacity-75",
|
|
42
|
+
fill: a,
|
|
43
43
|
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
44
44
|
}
|
|
45
45
|
)
|
|
@@ -47,5 +47,5 @@ const t = {
|
|
|
47
47
|
}
|
|
48
48
|
);
|
|
49
49
|
export {
|
|
50
|
-
|
|
50
|
+
n as Spinner
|
|
51
51
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),b=require("react"),q=require("../DateTimePicker/DateTimePicker.cjs"),c=require("../../utils/cn.cjs"),A=require("./TimePicker.utils.cjs"),n=require("./TimePicker.constants.cjs"),D=({mode:_="time",value:x,onChange:a,disabled:l=!1,placeholder:p="Select time",label:m,error:i,helperText:u,format:o="12h",minuteStep:f=5,clearable:j=!0,className:v,size:k="md",variant:N="default",...g})=>{if(_==="datetime")return e.jsx(q.DateTimePicker,{value:x instanceof Date?x:null,onChange:r=>a==null?void 0:a(r),disabled:l,placeholder:p,label:m,error:i,helperText:u,timeFormat:o,minuteStep:f,clearable:j,className:v,size:k,variant:N,...g});const s=x,[w,d]=b.useState(!1),[z,y]=b.useState(12),[S,P]=b.useState(0),[M,E]=b.useState("AM"),h=b.useRef(null);b.useEffect(()=>{if(s&&typeof s=="string"){const[r,t]=s.split(" "),[H,O]=r.split(":").map(Number);y(H),P(O),t&&E(t)}},[s]),b.useEffect(()=>{const r=t=>{h.current&&!h.current.contains(t.target)&&d(!1)};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[]);const I=()=>{a==null||a(A.formatTime(z,S,M,o)),d(!1)},R=o==="12h"?Array.from({length:n.TIMEPICKER_HOURS_12H},(r,t)=>t+1):Array.from({length:n.TIMEPICKER_HOURS_24H},(r,t)=>t),T=Array.from({length:n.TIMEPICKER_MINUTES_DIVISOR/f},(r,t)=>t*f);return e.jsxs("div",{ref:h,className:c.cn("bear-relative",v),children:[m&&e.jsx("label",{className:"bear-block bear-text-sm bear-font-medium bear-text-zinc-300 bear-mb-1.5",children:m}),e.jsxs("button",{type:"button",onClick:()=>!l&&d(!w),disabled:l,className:c.cn("bear-w-full bear-flex bear-items-center bear-justify-between bear-rounded-lg bear-border bear-text-left bear-transition-colors",n.sizeClasses[k],n.variantClasses[N],i?"bear-border-red-500":"focus:bear-border-pink-500",l&&"bear-opacity-50 bear-cursor-not-allowed",s?"bear-text-white":"bear-text-zinc-500"),children:[e.jsx("span",{children:s||p}),e.jsx("svg",{className:"bear-w-5 bear-h-5 bear-text-zinc-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})})]}),i&&e.jsx("p",{className:"bear-mt-1 bear-text-xs bear-text-red-400",children:i}),u&&!i&&e.jsx("p",{className:"bear-mt-1 bear-text-xs bear-text-zinc-500",children:u}),w&&e.jsxs("div",{className:"bear-absolute bear-z-50 bear-mt-1 bear-bg-zinc-800 bear-border bear-border-zinc-700 bear-rounded-lg bear-shadow-xl bear-p-3 bear-w-64",children:[e.jsxs("div",{className:"bear-flex bear-gap-2 bear-mb-3",children:[e.jsxs("div",{className:"bear-flex-1",children:[e.jsx("div",{className:"bear-text-xs bear-text-zinc-500 bear-mb-1 bear-text-center",children:"Hour"}),e.jsx("div",{className:"bear-h-32 bear-overflow-y-auto bear-space-y-1 bear-scrollbar-thin",children:R.map(r=>e.jsx("button",{onClick:()=>y(r),className:c.cn("bear-w-full bear-py-1 bear-rounded bear-text-sm bear-transition-colors",z===r?"bear-bg-pink-500 bear-text-white":"bear-text-zinc-300 hover:bear-bg-zinc-700"),children:r.toString().padStart(2,"0")},r))})]}),e.jsxs("div",{className:"bear-flex-1",children:[e.jsx("div",{className:"bear-text-xs bear-text-zinc-500 bear-mb-1 bear-text-center",children:"Minute"}),e.jsx("div",{className:"bear-h-32 bear-overflow-y-auto bear-space-y-1 bear-scrollbar-thin",children:T.map(r=>e.jsx("button",{onClick:()=>P(r),className:c.cn("bear-w-full bear-py-1 bear-rounded bear-text-sm bear-transition-colors",S===r?"bear-bg-pink-500 bear-text-white":"bear-text-zinc-300 hover:bear-bg-zinc-700"),children:r.toString().padStart(2,"0")},r))})]}),o==="12h"&&e.jsxs("div",{className:"bear-flex-1",children:[e.jsx("div",{className:"bear-text-xs bear-text-zinc-500 bear-mb-1 bear-text-center",children:"Period"}),e.jsx("div",{className:"bear-space-y-1",children:["AM","PM"].map(r=>e.jsx("button",{onClick:()=>E(r),className:c.cn("bear-w-full bear-py-2 bear-rounded bear-text-sm bear-transition-colors",M===r?"bear-bg-pink-500 bear-text-white":"bear-text-zinc-300 hover:bear-bg-zinc-700"),children:r},r))})]})]}),e.jsxs("div",{className:"bear-flex bear-gap-2 bear-pt-2 bear-border-t bear-border-zinc-700",children:[j&&s&&e.jsx("button",{onClick:()=>{a==null||a(""),d(!1)},className:"bear-flex-1 bear-py-1.5 bear-text-sm bear-text-zinc-400 hover:bear-text-white bear-rounded bear-border bear-border-zinc-600",children:"Clear"}),e.jsx("button",{onClick:I,className:"bear-flex-1 bear-py-1.5 bear-text-sm bear-bg-pink-500 bear-text-white bear-rounded hover:bear-bg-pink-600",children:"Confirm"})]})]})]})};exports.TimePicker=D;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=12,r=24,a=60,s={sm:"bear-py-1.5 bear-px-3 bear-text-sm",md:"bear-py-2 bear-px-4",lg:"bear-py-2.5 bear-px-5 bear-text-lg"},t={default:"bear-bg-zinc-800 bear-border-zinc-600",filled:"bear-bg-zinc-700 bear-border-transparent",outline:"bear-bg-transparent bear-border-zinc-500"};exports.TIMEPICKER_HOURS_12H=e;exports.TIMEPICKER_HOURS_24H=r;exports.TIMEPICKER_MINUTES_DIVISOR=a;exports.sizeClasses=s;exports.variantClasses=t;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const TIMEPICKER_HOURS_12H = 12;
|
|
2
|
+
export declare const TIMEPICKER_HOURS_24H = 24;
|
|
3
|
+
export declare const TIMEPICKER_MINUTES_DIVISOR = 60;
|
|
4
|
+
export declare const sizeClasses: Record<'sm' | 'md' | 'lg', string>;
|
|
5
|
+
export declare const variantClasses: Record<'default' | 'filled' | 'outline', string>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const e = 12, r = 24, a = 60, b = {
|
|
2
|
+
sm: "bear-py-1.5 bear-px-3 bear-text-sm",
|
|
3
|
+
md: "bear-py-2 bear-px-4",
|
|
4
|
+
lg: "bear-py-2.5 bear-px-5 bear-text-lg"
|
|
5
|
+
}, t = {
|
|
6
|
+
default: "bear-bg-zinc-800 bear-border-zinc-600",
|
|
7
|
+
filled: "bear-bg-zinc-700 bear-border-transparent",
|
|
8
|
+
outline: "bear-bg-transparent bear-border-zinc-500"
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
e as TIMEPICKER_HOURS_12H,
|
|
12
|
+
r as TIMEPICKER_HOURS_24H,
|
|
13
|
+
a as TIMEPICKER_MINUTES_DIVISOR,
|
|
14
|
+
b as sizeClasses,
|
|
15
|
+
t as variantClasses
|
|
16
|
+
};
|
|
@@ -1,108 +1,129 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useState as
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import { jsx as r, jsxs as b } from "react/jsx-runtime";
|
|
2
|
+
import { useState as d, useRef as L, useEffect as g } from "react";
|
|
3
|
+
import { DateTimePicker as C } from "../DateTimePicker/DateTimePicker.js";
|
|
4
|
+
import { cn as c } from "../../utils/cn.js";
|
|
5
|
+
import { formatTime as D } from "./TimePicker.utils.js";
|
|
6
|
+
import { TIMEPICKER_HOURS_12H as K, TIMEPICKER_HOURS_24H as U, TIMEPICKER_MINUTES_DIVISOR as V, variantClasses as B, sizeClasses as F } from "./TimePicker.constants.js";
|
|
7
|
+
const Y = ({
|
|
8
|
+
mode: P = "time",
|
|
9
|
+
value: m,
|
|
10
|
+
onChange: a,
|
|
11
|
+
disabled: n = !1,
|
|
12
|
+
placeholder: h = "Select time",
|
|
13
|
+
label: u,
|
|
14
|
+
error: s,
|
|
15
|
+
helperText: x,
|
|
16
|
+
format: l = "12h",
|
|
17
|
+
minuteStep: f = 5,
|
|
18
|
+
clearable: v = !0,
|
|
19
|
+
className: N,
|
|
20
|
+
size: k = "md",
|
|
21
|
+
variant: w = "default",
|
|
22
|
+
...R
|
|
18
23
|
}) => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
if (P === "datetime")
|
|
25
|
+
return /* @__PURE__ */ r(
|
|
26
|
+
C,
|
|
27
|
+
{
|
|
28
|
+
value: m instanceof Date ? m : null,
|
|
29
|
+
onChange: (e) => a == null ? void 0 : a(e),
|
|
30
|
+
disabled: n,
|
|
31
|
+
placeholder: h,
|
|
32
|
+
label: u,
|
|
33
|
+
error: s,
|
|
34
|
+
helperText: x,
|
|
35
|
+
timeFormat: l,
|
|
36
|
+
minuteStep: f,
|
|
37
|
+
clearable: v,
|
|
38
|
+
className: N,
|
|
39
|
+
size: k,
|
|
40
|
+
variant: w,
|
|
41
|
+
...R
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
const i = m, [z, o] = d(!1), [y, M] = d(12), [E, I] = d(0), [S, _] = d("AM"), p = L(null);
|
|
45
|
+
g(() => {
|
|
46
|
+
if (i && typeof i == "string") {
|
|
47
|
+
const [e, t] = i.split(" "), [T, j] = e.split(":").map(Number);
|
|
48
|
+
M(T), I(j), t && _(t);
|
|
24
49
|
}
|
|
25
|
-
}, [
|
|
26
|
-
const e = (
|
|
27
|
-
|
|
50
|
+
}, [i]), g(() => {
|
|
51
|
+
const e = (t) => {
|
|
52
|
+
p.current && !p.current.contains(t.target) && o(!1);
|
|
28
53
|
};
|
|
29
54
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
30
55
|
}, []);
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
};
|
|
41
|
-
return /* @__PURE__ */ t("div", { ref: x, className: s("bear-relative", $), children: [
|
|
42
|
-
p && /* @__PURE__ */ r("label", { className: "bear-block bear-text-sm bear-font-medium bear-text-zinc-300 bear-mb-1.5", children: p }),
|
|
43
|
-
/* @__PURE__ */ t(
|
|
56
|
+
const H = () => {
|
|
57
|
+
a == null || a(D(y, E, S, l)), o(!1);
|
|
58
|
+
}, O = l === "12h" ? Array.from({ length: K }, (e, t) => t + 1) : Array.from({ length: U }, (e, t) => t), A = Array.from(
|
|
59
|
+
{ length: V / f },
|
|
60
|
+
(e, t) => t * f
|
|
61
|
+
);
|
|
62
|
+
return /* @__PURE__ */ b("div", { ref: p, className: c("bear-relative", N), children: [
|
|
63
|
+
u && /* @__PURE__ */ r("label", { className: "bear-block bear-text-sm bear-font-medium bear-text-zinc-300 bear-mb-1.5", children: u }),
|
|
64
|
+
/* @__PURE__ */ b(
|
|
44
65
|
"button",
|
|
45
66
|
{
|
|
46
67
|
type: "button",
|
|
47
|
-
onClick: () => !
|
|
48
|
-
disabled:
|
|
49
|
-
className:
|
|
68
|
+
onClick: () => !n && o(!z),
|
|
69
|
+
disabled: n,
|
|
70
|
+
className: c(
|
|
50
71
|
"bear-w-full bear-flex bear-items-center bear-justify-between bear-rounded-lg bear-border bear-text-left bear-transition-colors",
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
72
|
+
F[k],
|
|
73
|
+
B[w],
|
|
74
|
+
s ? "bear-border-red-500" : "focus:bear-border-pink-500",
|
|
75
|
+
n && "bear-opacity-50 bear-cursor-not-allowed",
|
|
76
|
+
i ? "bear-text-white" : "bear-text-zinc-500"
|
|
56
77
|
),
|
|
57
78
|
children: [
|
|
58
|
-
/* @__PURE__ */ r("span", { children:
|
|
79
|
+
/* @__PURE__ */ r("span", { children: i || h }),
|
|
59
80
|
/* @__PURE__ */ r("svg", { className: "bear-w-5 bear-h-5 bear-text-zinc-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ r("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" }) })
|
|
60
81
|
]
|
|
61
82
|
}
|
|
62
83
|
),
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
z && /* @__PURE__ */
|
|
66
|
-
/* @__PURE__ */
|
|
67
|
-
/* @__PURE__ */
|
|
84
|
+
s && /* @__PURE__ */ r("p", { className: "bear-mt-1 bear-text-xs bear-text-red-400", children: s }),
|
|
85
|
+
x && !s && /* @__PURE__ */ r("p", { className: "bear-mt-1 bear-text-xs bear-text-zinc-500", children: x }),
|
|
86
|
+
z && /* @__PURE__ */ b("div", { className: "bear-absolute bear-z-50 bear-mt-1 bear-bg-zinc-800 bear-border bear-border-zinc-700 bear-rounded-lg bear-shadow-xl bear-p-3 bear-w-64", children: [
|
|
87
|
+
/* @__PURE__ */ b("div", { className: "bear-flex bear-gap-2 bear-mb-3", children: [
|
|
88
|
+
/* @__PURE__ */ b("div", { className: "bear-flex-1", children: [
|
|
68
89
|
/* @__PURE__ */ r("div", { className: "bear-text-xs bear-text-zinc-500 bear-mb-1 bear-text-center", children: "Hour" }),
|
|
69
|
-
/* @__PURE__ */ r("div", { className: "bear-h-32 bear-overflow-y-auto bear-space-y-1 bear-scrollbar-thin", children:
|
|
90
|
+
/* @__PURE__ */ r("div", { className: "bear-h-32 bear-overflow-y-auto bear-space-y-1 bear-scrollbar-thin", children: O.map((e) => /* @__PURE__ */ r(
|
|
70
91
|
"button",
|
|
71
92
|
{
|
|
72
|
-
onClick: () =>
|
|
73
|
-
className:
|
|
93
|
+
onClick: () => M(e),
|
|
94
|
+
className: c(
|
|
74
95
|
"bear-w-full bear-py-1 bear-rounded bear-text-sm bear-transition-colors",
|
|
75
|
-
|
|
96
|
+
y === e ? "bear-bg-pink-500 bear-text-white" : "bear-text-zinc-300 hover:bear-bg-zinc-700"
|
|
76
97
|
),
|
|
77
98
|
children: e.toString().padStart(2, "0")
|
|
78
99
|
},
|
|
79
100
|
e
|
|
80
101
|
)) })
|
|
81
102
|
] }),
|
|
82
|
-
/* @__PURE__ */
|
|
103
|
+
/* @__PURE__ */ b("div", { className: "bear-flex-1", children: [
|
|
83
104
|
/* @__PURE__ */ r("div", { className: "bear-text-xs bear-text-zinc-500 bear-mb-1 bear-text-center", children: "Minute" }),
|
|
84
|
-
/* @__PURE__ */ r("div", { className: "bear-h-32 bear-overflow-y-auto bear-space-y-1 bear-scrollbar-thin", children:
|
|
105
|
+
/* @__PURE__ */ r("div", { className: "bear-h-32 bear-overflow-y-auto bear-space-y-1 bear-scrollbar-thin", children: A.map((e) => /* @__PURE__ */ r(
|
|
85
106
|
"button",
|
|
86
107
|
{
|
|
87
|
-
onClick: () =>
|
|
88
|
-
className:
|
|
108
|
+
onClick: () => I(e),
|
|
109
|
+
className: c(
|
|
89
110
|
"bear-w-full bear-py-1 bear-rounded bear-text-sm bear-transition-colors",
|
|
90
|
-
|
|
111
|
+
E === e ? "bear-bg-pink-500 bear-text-white" : "bear-text-zinc-300 hover:bear-bg-zinc-700"
|
|
91
112
|
),
|
|
92
113
|
children: e.toString().padStart(2, "0")
|
|
93
114
|
},
|
|
94
115
|
e
|
|
95
116
|
)) })
|
|
96
117
|
] }),
|
|
97
|
-
|
|
118
|
+
l === "12h" && /* @__PURE__ */ b("div", { className: "bear-flex-1", children: [
|
|
98
119
|
/* @__PURE__ */ r("div", { className: "bear-text-xs bear-text-zinc-500 bear-mb-1 bear-text-center", children: "Period" }),
|
|
99
120
|
/* @__PURE__ */ r("div", { className: "bear-space-y-1", children: ["AM", "PM"].map((e) => /* @__PURE__ */ r(
|
|
100
121
|
"button",
|
|
101
122
|
{
|
|
102
|
-
onClick: () =>
|
|
103
|
-
className:
|
|
123
|
+
onClick: () => _(e),
|
|
124
|
+
className: c(
|
|
104
125
|
"bear-w-full bear-py-2 bear-rounded bear-text-sm bear-transition-colors",
|
|
105
|
-
|
|
126
|
+
S === e ? "bear-bg-pink-500 bear-text-white" : "bear-text-zinc-300 hover:bear-bg-zinc-700"
|
|
106
127
|
),
|
|
107
128
|
children: e
|
|
108
129
|
},
|
|
@@ -110,15 +131,15 @@ const q = ({
|
|
|
110
131
|
)) })
|
|
111
132
|
] })
|
|
112
133
|
] }),
|
|
113
|
-
/* @__PURE__ */
|
|
114
|
-
|
|
115
|
-
|
|
134
|
+
/* @__PURE__ */ b("div", { className: "bear-flex bear-gap-2 bear-pt-2 bear-border-t bear-border-zinc-700", children: [
|
|
135
|
+
v && i && /* @__PURE__ */ r("button", { onClick: () => {
|
|
136
|
+
a == null || a(""), o(!1);
|
|
116
137
|
}, className: "bear-flex-1 bear-py-1.5 bear-text-sm bear-text-zinc-400 hover:bear-text-white bear-rounded bear-border bear-border-zinc-600", children: "Clear" }),
|
|
117
|
-
/* @__PURE__ */ r("button", { onClick:
|
|
138
|
+
/* @__PURE__ */ r("button", { onClick: H, className: "bear-flex-1 bear-py-1.5 bear-text-sm bear-bg-pink-500 bear-text-white bear-rounded hover:bear-bg-pink-600", children: "Confirm" })
|
|
118
139
|
] })
|
|
119
140
|
] })
|
|
120
141
|
] });
|
|
121
142
|
};
|
|
122
143
|
export {
|
|
123
|
-
|
|
144
|
+
Y as TimePicker
|
|
124
145
|
};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export interface TimePickerProps {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
/** Time-only (string) or date+time (Date). When 'datetime', uses Calendar + time. */
|
|
3
|
+
mode?: 'time' | 'datetime';
|
|
4
|
+
/** Time string (e.g. "02:30 PM") when mode='time'; Date when mode='datetime' */
|
|
5
|
+
value?: string | Date | null;
|
|
6
|
+
onChange?: (time: string | Date | null) => void;
|
|
4
7
|
disabled?: boolean;
|
|
5
8
|
placeholder?: string;
|
|
6
9
|
label?: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function i(t,o,n,e){const r=o.toString().padStart(2,"0");return e==="12h"?`${t.toString().padStart(2,"0")}:${r} ${n}`:`${t.toString().padStart(2,"0")}:${r}`}exports.formatTime=i;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function formatTime(h: number, m: number, p: 'AM' | 'PM', format: '12h' | '24h'): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),N=require("../../utils/cn.cjs"),y=require("../Button/Button.cjs"),F=require("../Input/Input.cjs"),M=require("../Checkbox/Checkbox.cjs"),I=()=>e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("polyline",{points:"9 18 15 12 9 6"})}),ee=()=>e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("polyline",{points:"15 18 9 12 15 6"})}),re=()=>e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("polyline",{points:"6 18 12 12 6 6"}),e.jsx("polyline",{points:"12 18 18 12 12 6"})]}),ae=()=>e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("polyline",{points:"18 18 12 12 18 6"}),e.jsx("polyline",{points:"12 18 6 12 12 6"})]}),se=({leftItems:c,rightItems:i,leftTitle:S="Available",rightTitle:m="Selected",searchable:g=!0,leftSearchPlaceholder:C="Search...",rightSearchPlaceholder:z="Search...",showCount:B=!0,showCheckboxes:L=!0,maxHeight:T=300,onChange:s,onMoveRight:d,onMoveLeft:x,disabled:o=!1,className:q,testId:R,...W})=>{const[u,j]=n.useState(new Set),[h,k]=n.useState(new Set),[p,A]=n.useState(""),[w,D]=n.useState(""),P=n.useMemo(()=>c.filter(r=>r.label.toLowerCase().includes(p.toLowerCase())),[c,p]),O=n.useMemo(()=>i.filter(r=>r.label.toLowerCase().includes(w.toLowerCase())),[i,w]),E=n.useCallback(r=>{j(l=>{const a=new Set(l);return a.has(r)?a.delete(r):a.add(r),a})},[]),G=n.useCallback(r=>{k(l=>{const a=new Set(l);return a.has(r)?a.delete(r):a.add(r),a})},[]),H=n.useCallback(()=>{const r=c.filter(b=>u.has(b.id)&&!b.disabled),l=c.filter(b=>!u.has(b.id)),a=[...i,...r];j(new Set),s==null||s(l,a),d==null||d(r)},[c,i,u,s,d]),J=n.useCallback(()=>{const r=c.filter(a=>!a.disabled),l=[...i,...r];j(new Set),s==null||s([],l),d==null||d(r)},[c,i,s,d]),K=n.useCallback(()=>{const r=i.filter(b=>h.has(b.id)&&!b.disabled),l=i.filter(b=>!h.has(b.id)),a=[...c,...r];k(new Set),s==null||s(a,l),x==null||x(r)},[c,i,h,s,x]),Q=n.useCallback(()=>{const r=i.filter(a=>!a.disabled),l=[...c,...r];k(new Set),s==null||s(l,[]),x==null||x(r)},[c,i,s,x]),f=(r,l,a,b,Z,v,_,$)=>e.jsxs("div",{className:"bear-flex-1 bear-min-w-0 bear-border bear-border-gray-200 dark:bear-border-gray-700 bear-rounded-lg bear-overflow-hidden",children:[e.jsxs("div",{className:"bear-px-4 bear-py-3 bear-bg-gray-50 dark:bear-bg-gray-800/50 bear-border-b bear-border-gray-200 dark:bear-border-gray-700",children:[e.jsxs("div",{className:"bear-flex bear-items-center bear-justify-between",children:[e.jsx("span",{className:"bear-font-medium bear-text-gray-900 dark:bear-text-gray-100",children:Z}),B&&e.jsxs("span",{className:"bear-text-sm bear-text-gray-500 dark:bear-text-gray-400",children:[a.size,"/",r.length]})]}),g&&e.jsx(F.Input,{value:v,onChange:t=>_(t.target.value),placeholder:$,size:"sm",className:"bear-mt-2",disabled:o})]}),e.jsx("div",{className:"bear-overflow-y-auto",style:{maxHeight:T},children:l.length===0?e.jsx("div",{className:"bear-px-4 bear-py-8 bear-text-center bear-text-gray-500 dark:bear-text-gray-400 bear-text-sm",children:v?"No items match your search":"No items"}):e.jsx("ul",{className:"bear-list-none bear-m-0 bear-p-0",children:l.map(t=>e.jsxs("li",{className:N.cn("bear-flex bear-items-center bear-gap-3 bear-px-4 bear-py-2","bear-border-b bear-border-gray-100 dark:bear-border-gray-800 last:bear-border-b-0",!t.disabled&&!o&&"hover:bear-bg-gray-50 dark:hover:bear-bg-gray-800/30 bear-cursor-pointer",t.disabled&&"bear-opacity-50 bear-cursor-not-allowed"),onClick:()=>!t.disabled&&!o&&b(t.id),children:[L&&e.jsx(M.Checkbox,{checked:a.has(t.id),onChange:()=>b(t.id),disabled:t.disabled||o,size:"sm"}),t.icon&&e.jsx("span",{className:"bear-flex-shrink-0 bear-text-gray-500",children:t.icon}),e.jsxs("div",{className:"bear-flex-1 bear-min-w-0",children:[e.jsx("div",{className:"bear-text-sm bear-text-gray-900 dark:bear-text-gray-100 bear-truncate",children:t.label}),t.secondary&&e.jsx("div",{className:"bear-text-xs bear-text-gray-500 dark:bear-text-gray-400 bear-truncate",children:t.secondary})]})]},t.id))})})]}),U=u.size>0,V=h.size>0,X=c.some(r=>!r.disabled),Y=i.some(r=>!r.disabled);return e.jsxs("div",{className:N.cn("bear-flex bear-items-stretch bear-gap-4",o&&"bear-opacity-60 bear-pointer-events-none",q),"data-testid":R,...W,children:[f(c,P,u,E,S,p,A,C),e.jsxs("div",{className:"bear-flex bear-flex-col bear-justify-center bear-gap-2",children:[e.jsx(y.Button,{variant:"outline",size:"sm",onClick:J,disabled:o||!X,"aria-label":"Move all to right",className:"bear-px-2",children:e.jsx(re,{})}),e.jsx(y.Button,{variant:"outline",size:"sm",onClick:H,disabled:o||!U,"aria-label":"Move selected to right",className:"bear-px-2",children:e.jsx(I,{})}),e.jsx(y.Button,{variant:"outline",size:"sm",onClick:K,disabled:o||!V,"aria-label":"Move selected to left",className:"bear-px-2",children:e.jsx(ee,{})}),e.jsx(y.Button,{variant:"outline",size:"sm",onClick:Q,disabled:o||!Y,"aria-label":"Move all to left",className:"bear-px-2",children:e.jsx(ae,{})})]}),f(i,O,h,G,m,w,D,z)]})};exports.TransferList=se;
|