@stamcat/craftsman 0.0.27 → 0.0.29
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/AGENTS.md +2 -0
- package/README.md +63 -12
- package/_virtual/_rolldown/runtime.esm.js +6 -18
- package/package.json +5 -4
- package/src/components/Carousel/Carousel2.esm.js +22 -22
- package/src/components/DateRangePicker/DateRangePicker2.esm.js +11 -11
- package/src/components/DateTimePicker/DateTimePicker2.esm.js +20 -20
- package/src/components/SortableList/ListItem.esm.js +17 -17
- package/src/components/SortableList/SortableList2.esm.js +23 -23
- package/src/components/TimePicker/TimePicker2.esm.js +26 -26
- package/src/components/TimePicker/TimePickerWheel.esm.js +23 -23
package/AGENTS.md
CHANGED
|
@@ -30,7 +30,9 @@ import { Select } from "@stamcat/craftsman/Select";
|
|
|
30
30
|
import { Text } from "@stamcat/craftsman/Text";
|
|
31
31
|
import { Textarea } from "@stamcat/craftsman/Textarea";
|
|
32
32
|
import { TimePicker } from "@stamcat/craftsman/TimePicker";
|
|
33
|
+
import { DateTimePicker } from "@stamcat/craftsman/DateTimePicker";
|
|
33
34
|
import { Toggle } from "@stamcat/craftsman/Toggle";
|
|
35
|
+
import { Tooltip } from "@stamcat/craftsman/Tooltip";
|
|
34
36
|
import { Notice } from "@stamcat/craftsman/Notice";
|
|
35
37
|
import { SortableList } from "@stamcat/craftsman/SortableList";
|
|
36
38
|
```
|
package/README.md
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
# @stamcat/craftsman
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A lightweight, themeable React component library and design-system toolkit. Craftsman ships accessible, ready-to-style form controls, overlays, and layout primitives — plus a small set of theming and styling utilities — so you can build a consistent UI without pulling in a heavyweight framework.
|
|
4
|
+
|
|
5
|
+
- **Themeable by design** — override look and feel with a single `ThemeProvider` and CSS custom properties, no CSS-in-JS runtime required.
|
|
6
|
+
- **Tree-shakeable component entry points** — import only what you use (`@stamcat/craftsman/Button`, `@stamcat/craftsman/Input`, etc.).
|
|
7
|
+
- **React Server Component friendly** — works with Next.js App Router and other RSC setups.
|
|
8
|
+
|
|
9
|
+
📖 Full component documentation and live examples: [stamcat.github.io/craftsman](https://stamcat.github.io/craftsman)
|
|
4
10
|
|
|
5
11
|
## Installation
|
|
6
12
|
|
|
@@ -8,12 +14,37 @@ Craftsman design system components and styling utilities.
|
|
|
8
14
|
npm install @stamcat/craftsman
|
|
9
15
|
```
|
|
10
16
|
|
|
11
|
-
##
|
|
17
|
+
## Getting started
|
|
18
|
+
|
|
19
|
+
1. Import the package's global styles once at the root of your app.
|
|
20
|
+
2. Wrap your app in `ThemeProvider`, optionally passing a theme object to customize CSS variables.
|
|
21
|
+
3. Import components from their individual entry points and use them like any other React component.
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import { ThemeProvider } from "@stamcat/craftsman/styles";
|
|
25
|
+
import { Button } from "@stamcat/craftsman/Button";
|
|
26
|
+
import { Input } from "@stamcat/craftsman/Input";
|
|
27
|
+
import "@stamcat/craftsman/styles/globalStyles";
|
|
28
|
+
|
|
29
|
+
const appTheme = {
|
|
30
|
+
root: {
|
|
31
|
+
"--w-gutter": "16px",
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default function App() {
|
|
36
|
+
return (
|
|
37
|
+
<ThemeProvider theme={appTheme}>
|
|
38
|
+
<Input label="Name" placeholder="Jane Doe" />
|
|
39
|
+
<Button>Submit</Button>
|
|
40
|
+
</ThemeProvider>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
```
|
|
12
44
|
|
|
13
|
-
|
|
45
|
+
### RSC-safe setup
|
|
14
46
|
|
|
15
|
-
|
|
16
|
-
2. Render `ThemeProvider` at the root with your theme object.
|
|
47
|
+
Use this pattern in React Server Component architectures (for example Next.js App Router). Render `ThemeProvider` at the root with your theme object, and import global styles once at the application root.
|
|
17
48
|
|
|
18
49
|
```tsx
|
|
19
50
|
import { ThemeProvider } from "@stamcat/craftsman/styles";
|
|
@@ -36,15 +67,35 @@ export default function RootLayout({ children }: { children: React.ReactNode })
|
|
|
36
67
|
}
|
|
37
68
|
```
|
|
38
69
|
|
|
39
|
-
##
|
|
70
|
+
## Available components
|
|
40
71
|
|
|
41
|
-
|
|
72
|
+
Each component has its own package entry point, e.g. `@stamcat/craftsman/Button`.
|
|
42
73
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
74
|
+
| Component | Entry point |
|
|
75
|
+
| --- | --- |
|
|
76
|
+
| Button | `@stamcat/craftsman/Button` |
|
|
77
|
+
| Carousel | `@stamcat/craftsman/Carousel` |
|
|
78
|
+
| Checkbox | `@stamcat/craftsman/Checkbox` |
|
|
79
|
+
| DatePicker | `@stamcat/craftsman/DatePicker` |
|
|
80
|
+
| DateRangePicker | `@stamcat/craftsman/DateRangePicker` |
|
|
81
|
+
| DateTimePicker | `@stamcat/craftsman/DateTimePicker` |
|
|
82
|
+
| Input | `@stamcat/craftsman/Input` |
|
|
83
|
+
| InputNumber | `@stamcat/craftsman/InputNumber` |
|
|
84
|
+
| InputPassword | `@stamcat/craftsman/InputPassword` |
|
|
85
|
+
| InputPhone | `@stamcat/craftsman/InputPhone` |
|
|
86
|
+
| Loader | `@stamcat/craftsman/Loader` |
|
|
87
|
+
| Modal | `@stamcat/craftsman/Modal` |
|
|
88
|
+
| Notice | `@stamcat/craftsman/Notice` |
|
|
89
|
+
| Pagination | `@stamcat/craftsman/Pagination` |
|
|
90
|
+
| Progress | `@stamcat/craftsman/Progress` |
|
|
91
|
+
| RadioButton | `@stamcat/craftsman/RadioButton` |
|
|
92
|
+
| Select | `@stamcat/craftsman/Select` |
|
|
93
|
+
| SortableList | `@stamcat/craftsman/SortableList` |
|
|
94
|
+
| Text | `@stamcat/craftsman/Text` |
|
|
95
|
+
| Textarea | `@stamcat/craftsman/Textarea` |
|
|
96
|
+
| TimePicker | `@stamcat/craftsman/TimePicker` |
|
|
97
|
+
| Toggle | `@stamcat/craftsman/Toggle` |
|
|
98
|
+
| Tooltip | `@stamcat/craftsman/Tooltip` |
|
|
48
99
|
|
|
49
100
|
## Styling notes
|
|
50
101
|
|
|
@@ -1,23 +1,11 @@
|
|
|
1
1
|
//#region \0rolldown/runtime.js
|
|
2
|
-
var e = Object.
|
|
2
|
+
var e = Object.defineProperty, t = (t, n) => {
|
|
3
3
|
let r = {};
|
|
4
|
-
for (var i in
|
|
5
|
-
get:
|
|
4
|
+
for (var i in t) e(r, i, {
|
|
5
|
+
get: t[i],
|
|
6
6
|
enumerable: !0
|
|
7
7
|
});
|
|
8
|
-
return n ||
|
|
9
|
-
}
|
|
10
|
-
if (i && typeof i == "object" || typeof i == "function") for (var c = r(i), l = 0, u = c.length, d; l < u; l++) d = c[l], !a.call(e, d) && d !== o && t(e, d, {
|
|
11
|
-
get: ((e) => i[e]).bind(null, d),
|
|
12
|
-
enumerable: !(s = n(i, d)) || s.enumerable
|
|
13
|
-
});
|
|
14
|
-
return e;
|
|
15
|
-
}, l = (n, r, a) => (a = n == null ? {} : e(i(n)), c(r || !n || !n.__esModule ? t(a, "default", {
|
|
16
|
-
value: n,
|
|
17
|
-
enumerable: !0
|
|
18
|
-
}) : a, n)), u = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
|
|
19
|
-
if (typeof require < "u") return require.apply(this, arguments);
|
|
20
|
-
throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
21
|
-
});
|
|
8
|
+
return n || e(r, Symbol.toStringTag, { value: "Module" }), r;
|
|
9
|
+
};
|
|
22
10
|
//#endregion
|
|
23
|
-
export {
|
|
11
|
+
export { t as __exportAll };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stamcat/craftsman",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.29",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A powerful, lightweight framework for design systems",
|
|
6
6
|
"repository": {
|
|
@@ -30,12 +30,9 @@
|
|
|
30
30
|
"country-flag-icons": "1.6.20",
|
|
31
31
|
"dompurify": "3.4.13",
|
|
32
32
|
"embla-carousel-react": "8.6.0",
|
|
33
|
-
"pure-react-carousel": "1.35.0",
|
|
34
|
-
"react": "19.2.7",
|
|
35
33
|
"react-date-picker": "12.0.2",
|
|
36
34
|
"react-datetime-picker": "7.0.2",
|
|
37
35
|
"react-device-detect": "2.2.3",
|
|
38
|
-
"react-dom": "19.2.7",
|
|
39
36
|
"react-icons": "5.7.0",
|
|
40
37
|
"react-international-phone": "4.8.0",
|
|
41
38
|
"react-intl": "10.1.20",
|
|
@@ -45,6 +42,10 @@
|
|
|
45
42
|
"typescript-plugin-css-modules": "5.2.0",
|
|
46
43
|
"zod": "4.4.3"
|
|
47
44
|
},
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"react": "19.2.7",
|
|
47
|
+
"react-dom": "19.2.7"
|
|
48
|
+
},
|
|
48
49
|
"devDependencies": {},
|
|
49
50
|
"overrides": {
|
|
50
51
|
"postcss": "8.5.23",
|
|
@@ -1,68 +1,68 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Button as e } from "../Button/Button.esm.js";
|
|
3
3
|
import { Pagination as t } from "../Pagination/Pagination2.esm.js";
|
|
4
|
-
import n from "../../../node_modules/embla-carousel-react/esm/embla-carousel-react.esm.esm.js";
|
|
5
4
|
import './Carousel.css';/* empty css */
|
|
6
|
-
import
|
|
7
|
-
import { jsx as
|
|
8
|
-
import { useCallback as
|
|
9
|
-
import { FaAngleLeft as
|
|
5
|
+
import n from "clsx";
|
|
6
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
7
|
+
import { useCallback as a, useSyncExternalStore as o } from "react";
|
|
8
|
+
import { FaAngleLeft as s, FaAngleRight as c, FaCircle as l, FaRegCircle as u } from "react-icons/fa6";
|
|
9
|
+
import d from "embla-carousel-react";
|
|
10
10
|
//#region src/components/Carousel/Carousel.tsx
|
|
11
11
|
var f = (f) => {
|
|
12
|
-
let { slides: p = [], className: m, style: h, buttons: g = !0, pagination: _ = "dots", ...v } = f, [y, b] =
|
|
12
|
+
let { slides: p = [], className: m, style: h, buttons: g = !0, pagination: _ = "dots", ...v } = f, [y, b] = d(v), x = a((e) => b ? (b.on("select", e).on("reInit", e), () => {
|
|
13
13
|
b.off("select", e), b.off("reInit", e);
|
|
14
|
-
}) : () => {}, [b]), S =
|
|
14
|
+
}) : () => {}, [b]), S = o(x, () => !!b?.canScrollPrev(), () => !1), C = o(x, () => !!b?.canScrollNext(), () => !1), w = o(x, () => b?.selectedScrollSnap() ?? 0, () => 0), T = () => b?.scrollPrev(), E = () => b?.scrollNext(), D = (e) => {
|
|
15
15
|
let t = parseInt(e.currentTarget.value, 10) || 0;
|
|
16
16
|
b?.scrollTo(t);
|
|
17
17
|
};
|
|
18
|
-
return /* @__PURE__ */
|
|
19
|
-
className:
|
|
18
|
+
return /* @__PURE__ */ i("div", {
|
|
19
|
+
className: n("carousel", m),
|
|
20
20
|
style: h,
|
|
21
|
-
children: [/* @__PURE__ */
|
|
21
|
+
children: [/* @__PURE__ */ r("div", {
|
|
22
22
|
className: "carousel__viewport",
|
|
23
23
|
ref: y,
|
|
24
|
-
children: /* @__PURE__ */
|
|
24
|
+
children: /* @__PURE__ */ r("div", {
|
|
25
25
|
className: "carousel__container",
|
|
26
|
-
children: p.map((e, t) => /* @__PURE__ */
|
|
26
|
+
children: p.map((e, t) => /* @__PURE__ */ r("div", {
|
|
27
27
|
className: "carousel__slide",
|
|
28
28
|
children: e
|
|
29
29
|
}, `slide-${t}`))
|
|
30
30
|
})
|
|
31
|
-
}), /* @__PURE__ */
|
|
31
|
+
}), /* @__PURE__ */ i("div", {
|
|
32
32
|
className: "carousel__controls",
|
|
33
33
|
children: [
|
|
34
|
-
g && /* @__PURE__ */
|
|
34
|
+
g && /* @__PURE__ */ i("div", {
|
|
35
35
|
className: "carousel__buttons",
|
|
36
|
-
children: [/* @__PURE__ */
|
|
36
|
+
children: [/* @__PURE__ */ r(e, {
|
|
37
37
|
variant: "text",
|
|
38
38
|
onClick: T,
|
|
39
39
|
disabled: !S,
|
|
40
40
|
name: "prev",
|
|
41
|
-
children: /* @__PURE__ */
|
|
41
|
+
children: /* @__PURE__ */ r(s, {
|
|
42
42
|
size: 24,
|
|
43
43
|
"aria-label": "prev"
|
|
44
44
|
})
|
|
45
|
-
}), /* @__PURE__ */
|
|
45
|
+
}), /* @__PURE__ */ r(e, {
|
|
46
46
|
variant: "text",
|
|
47
47
|
onClick: E,
|
|
48
48
|
disabled: !C,
|
|
49
49
|
name: "next",
|
|
50
|
-
children: /* @__PURE__ */
|
|
50
|
+
children: /* @__PURE__ */ r(c, {
|
|
51
51
|
size: 24,
|
|
52
52
|
"aria-label": "next"
|
|
53
53
|
})
|
|
54
54
|
})]
|
|
55
55
|
}),
|
|
56
|
-
_ === "dots" && /* @__PURE__ */
|
|
56
|
+
_ === "dots" && /* @__PURE__ */ r("div", {
|
|
57
57
|
className: "carousel__dots",
|
|
58
|
-
children: p.map((t, n) => /* @__PURE__ */
|
|
58
|
+
children: p.map((t, n) => /* @__PURE__ */ r(e, {
|
|
59
59
|
variant: "text",
|
|
60
60
|
value: n,
|
|
61
61
|
onClick: D,
|
|
62
|
-
children:
|
|
62
|
+
children: r(w === n ? l : u, { size: 16 })
|
|
63
63
|
}, `dot-${n}`))
|
|
64
64
|
}),
|
|
65
|
-
_ === "numbers" && /* @__PURE__ */
|
|
65
|
+
_ === "numbers" && /* @__PURE__ */ r(t, {
|
|
66
66
|
total: p.length,
|
|
67
67
|
current: w,
|
|
68
68
|
onChange: D
|
|
@@ -2,25 +2,25 @@
|
|
|
2
2
|
import { InputWrapper as e } from "../Input/InputWrapper.esm.js";
|
|
3
3
|
import './DateRangePicker.css';import '../DatePicker/ReactCalendar.css';/* empty css */
|
|
4
4
|
/* empty css */
|
|
5
|
-
import t from "
|
|
6
|
-
import n from "
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
5
|
+
import t from "clsx";
|
|
6
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
7
|
+
import { useId as r } from "react";
|
|
8
|
+
import { FaRegCalendar as i, FaX as a } from "react-icons/fa6";
|
|
9
|
+
import { DateRangePicker as o } from "@wojtekmaj/react-daterange-picker";
|
|
10
10
|
//#region src/components/DateRangePicker/DateRangePicker.tsx
|
|
11
11
|
var s = ({ label: s, id: c, labelPosition: l = "top", required: u = !1, error: d, style: f, className: p, ...m }) => {
|
|
12
|
-
let h =
|
|
13
|
-
return /* @__PURE__ */
|
|
12
|
+
let h = r();
|
|
13
|
+
return /* @__PURE__ */ n(e, {
|
|
14
14
|
id: c || h,
|
|
15
|
-
className:
|
|
15
|
+
className: t("dateRangePicker", p),
|
|
16
16
|
label: s,
|
|
17
17
|
labelPosition: l,
|
|
18
18
|
error: d,
|
|
19
19
|
required: u,
|
|
20
20
|
style: f,
|
|
21
|
-
children: /* @__PURE__ */
|
|
22
|
-
calendarIcon: /* @__PURE__ */
|
|
23
|
-
clearIcon: /* @__PURE__ */
|
|
21
|
+
children: /* @__PURE__ */ n(o, {
|
|
22
|
+
calendarIcon: /* @__PURE__ */ n(i, { size: 16 }),
|
|
23
|
+
clearIcon: /* @__PURE__ */ n(a, { size: 14 }),
|
|
24
24
|
...m
|
|
25
25
|
})
|
|
26
26
|
});
|
|
@@ -4,17 +4,17 @@ import { InputWrapper as t } from "../Input/InputWrapper.esm.js";
|
|
|
4
4
|
import './DateTimePicker.css';import '../DatePicker/ReactCalendar.css';/* empty css */
|
|
5
5
|
import { resolveLocale as n } from "../TimePicker/utilities.esm.js";
|
|
6
6
|
import { TimePickerDisplay as r } from "../TimePicker/TimePickerDisplay.esm.js";
|
|
7
|
-
import { require_lib as i } from "../../../node_modules/react-device-detect/dist/lib.esm.js";
|
|
8
7
|
/* empty css */
|
|
9
|
-
import
|
|
10
|
-
import { jsx as
|
|
11
|
-
import { useEffect as
|
|
12
|
-
import { FaRegCalendar as
|
|
8
|
+
import i from "clsx";
|
|
9
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
10
|
+
import { useEffect as s, useId as c, useRef as l, useState as u } from "react";
|
|
11
|
+
import { FaRegCalendar as d, FaX as f } from "react-icons/fa6";
|
|
12
|
+
import { isMobile as p } from "react-device-detect";
|
|
13
13
|
import { DateTimePicker as m } from "react-datetime-picker";
|
|
14
14
|
//#region src/components/DateTimePicker/DateTimePicker.tsx
|
|
15
|
-
var h =
|
|
16
|
-
let O =
|
|
17
|
-
|
|
15
|
+
var h = ({ label: h, id: g, labelPosition: _ = "top", required: v = !1, error: y, style: b, className: x, locale: S, labels: C, format: w, value: T, onChange: E, ...D }) => {
|
|
16
|
+
let O = c(), k = g || O, A = l(null), [j, M] = u(!1), N = n(S);
|
|
17
|
+
s(() => {
|
|
18
18
|
if (!j) return;
|
|
19
19
|
let e = (e) => {
|
|
20
20
|
let t = e.target;
|
|
@@ -25,7 +25,7 @@ var h = i(), g = ({ label: i, id: g, labelPosition: _ = "top", required: v = !1,
|
|
|
25
25
|
};
|
|
26
26
|
}, [j]);
|
|
27
27
|
let P = () => {
|
|
28
|
-
if (!
|
|
28
|
+
if (!p && T instanceof Date) {
|
|
29
29
|
M(!0);
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
@@ -33,40 +33,40 @@ var h = i(), g = ({ label: i, id: g, labelPosition: _ = "top", required: v = !1,
|
|
|
33
33
|
}, F = (e) => {
|
|
34
34
|
e.target instanceof HTMLInputElement && P();
|
|
35
35
|
}, I = (e) => {
|
|
36
|
-
|
|
36
|
+
p && e.key === "Enter" && M(!1);
|
|
37
37
|
}, L = (e) => {
|
|
38
38
|
let [t, n] = e.split(":"), r = Number(t), i = Number(n);
|
|
39
39
|
if (Number.isNaN(r) || Number.isNaN(i)) return;
|
|
40
40
|
let a = T instanceof Date ? new Date(T) : /* @__PURE__ */ new Date();
|
|
41
41
|
a.setHours(r, i, 0, 0), E?.(a);
|
|
42
42
|
};
|
|
43
|
-
return /* @__PURE__ */
|
|
43
|
+
return /* @__PURE__ */ a("div", {
|
|
44
44
|
ref: A,
|
|
45
45
|
className: "dateTimePicker",
|
|
46
46
|
onKeyDown: I,
|
|
47
|
-
children: /* @__PURE__ */
|
|
47
|
+
children: /* @__PURE__ */ o(t, {
|
|
48
48
|
id: k,
|
|
49
49
|
onFocus: F,
|
|
50
|
-
className:
|
|
51
|
-
label:
|
|
50
|
+
className: i(x, "dateTimePicker_wrapper"),
|
|
51
|
+
label: h,
|
|
52
52
|
labelPosition: _,
|
|
53
53
|
error: y,
|
|
54
54
|
required: v,
|
|
55
55
|
style: b,
|
|
56
56
|
value: T instanceof Date ? T.toISOString() : void 0,
|
|
57
|
-
children: [/* @__PURE__ */
|
|
57
|
+
children: [/* @__PURE__ */ a(m, {
|
|
58
58
|
isClockOpen: !1,
|
|
59
59
|
onClockOpen: P,
|
|
60
60
|
onClockClose: () => {},
|
|
61
61
|
onCalendarOpen: () => M(!1),
|
|
62
|
-
calendarIcon: /* @__PURE__ */
|
|
63
|
-
clearIcon: /* @__PURE__ */
|
|
62
|
+
calendarIcon: /* @__PURE__ */ a(d, { size: 16 }),
|
|
63
|
+
clearIcon: /* @__PURE__ */ a(f, { size: 14 }),
|
|
64
64
|
value: T,
|
|
65
65
|
onChange: E,
|
|
66
66
|
...D
|
|
67
|
-
}), j && /* @__PURE__ */
|
|
67
|
+
}), j && /* @__PURE__ */ a("div", {
|
|
68
68
|
className: "dateTimePicker__time-display",
|
|
69
|
-
children: /* @__PURE__ */
|
|
69
|
+
children: /* @__PURE__ */ a(r, {
|
|
70
70
|
value: e(T, S),
|
|
71
71
|
onChange: L,
|
|
72
72
|
locale: N,
|
|
@@ -79,4 +79,4 @@ var h = i(), g = ({ label: i, id: g, labelPosition: _ = "top", required: v = !1,
|
|
|
79
79
|
});
|
|
80
80
|
};
|
|
81
81
|
//#endregion
|
|
82
|
-
export {
|
|
82
|
+
export { h as DateTimePicker };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import i from "
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
2
|
+
import { isItemData as e } from "./utilities.esm.js";
|
|
3
|
+
import t from "clsx";
|
|
4
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
5
|
+
import { useEffect as r, useLayoutEffect as i, useRef as a, useState as o } from "react";
|
|
6
|
+
import { draggable as s, dropTargetForElements as c } from "@atlaskit/pragmatic-drag-and-drop/adapter/element-adapter";
|
|
7
|
+
import { combine as l } from "@atlaskit/pragmatic-drag-and-drop/utils/combine";
|
|
8
8
|
//#region src/components/SortableList/ListItem.tsx
|
|
9
9
|
function u({ item: u, index: d, getKey: f, renderItem: p, disabled: m, listId: h }) {
|
|
10
|
-
let [g, _] =
|
|
11
|
-
return
|
|
10
|
+
let [g, _] = o(null), [v, y] = o(null), [b, x] = o(!1), [S, C] = o(null), w = a(null), T = a(null), E = f(u, d);
|
|
11
|
+
return i(() => {
|
|
12
12
|
w.current = g;
|
|
13
13
|
let e = w.current;
|
|
14
14
|
if (!e) return;
|
|
@@ -18,24 +18,24 @@ function u({ item: u, index: d, getKey: f, renderItem: p, disabled: m, listId: h
|
|
|
18
18
|
!r || window.matchMedia("(prefers-reduced-motion: reduce)").matches || (e.style.transition = "none", e.style.transform = `translateY(${r}px)`, requestAnimationFrame(() => {
|
|
19
19
|
e.style.transition = "", e.style.transform = "";
|
|
20
20
|
}));
|
|
21
|
-
}, [g, d]),
|
|
21
|
+
}, [g, d]), r(() => {
|
|
22
22
|
if (!g || m) return;
|
|
23
|
-
let
|
|
23
|
+
let t = {
|
|
24
24
|
key: E,
|
|
25
25
|
index: d,
|
|
26
26
|
listId: h,
|
|
27
27
|
item: u
|
|
28
28
|
};
|
|
29
|
-
return
|
|
29
|
+
return l(s({
|
|
30
30
|
element: g,
|
|
31
31
|
dragHandle: v ?? void 0,
|
|
32
|
-
getInitialData: () =>
|
|
32
|
+
getInitialData: () => t,
|
|
33
33
|
onDragStart: () => x(!0),
|
|
34
34
|
onDrop: () => x(!1)
|
|
35
|
-
}),
|
|
35
|
+
}), c({
|
|
36
36
|
element: g,
|
|
37
|
-
getData: () =>
|
|
38
|
-
canDrop: ({ source:
|
|
37
|
+
getData: () => t,
|
|
38
|
+
canDrop: ({ source: t }) => e(t.data) && t.data.key !== E,
|
|
39
39
|
onDrag: ({ location: e }) => {
|
|
40
40
|
let t = g.getBoundingClientRect(), n = e.current.input.clientY > t.top + t.height / 2;
|
|
41
41
|
C(n ? "bottom" : "top");
|
|
@@ -51,9 +51,9 @@ function u({ item: u, index: d, getKey: f, renderItem: p, disabled: m, listId: h
|
|
|
51
51
|
m,
|
|
52
52
|
h,
|
|
53
53
|
u
|
|
54
|
-
]), /* @__PURE__ */
|
|
54
|
+
]), /* @__PURE__ */ n("li", {
|
|
55
55
|
ref: _,
|
|
56
|
-
className:
|
|
56
|
+
className: t("sortable-list-item", b && "dragging", S && `drop-${S}`),
|
|
57
57
|
children: p({
|
|
58
58
|
item: u,
|
|
59
59
|
index: d,
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { monitorForElements as e } from "../../../node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/adapter/element-adapter.esm.js";
|
|
3
|
-
import { reorder as t } from "../../../node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/public-utils/reorder.esm.js";
|
|
4
2
|
import './SortableList.css';/* empty css */
|
|
5
|
-
import { isItemData as
|
|
6
|
-
import { SortableListItem as
|
|
7
|
-
import
|
|
8
|
-
import { jsx as
|
|
9
|
-
import { useEffect as
|
|
3
|
+
import { isItemData as e } from "./utilities.esm.js";
|
|
4
|
+
import { SortableListItem as t } from "./ListItem.esm.js";
|
|
5
|
+
import n from "clsx";
|
|
6
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
7
|
+
import { useEffect as i, useId as a } from "react";
|
|
8
|
+
import { monitorForElements as o } from "@atlaskit/pragmatic-drag-and-drop/adapter/element-adapter";
|
|
9
|
+
import { reorder as s } from "@atlaskit/pragmatic-drag-and-drop/utils/reorder";
|
|
10
10
|
//#region src/components/SortableList/SortableList.tsx
|
|
11
11
|
var c = ({ items: c, getKey: l, renderItem: u, onReorder: d, disabled: f, className: p, style: m, listId: h, onReceive: g }) => {
|
|
12
|
-
let _ =
|
|
13
|
-
let
|
|
14
|
-
|
|
12
|
+
let _ = a(), v = h ?? _, y = (e, t) => {
|
|
13
|
+
let n = c.findIndex((t, n) => l(t, n) === e), r = c.findIndex((e, n) => l(e, n) === t);
|
|
14
|
+
n === -1 || r === -1 || n === r || d(s({
|
|
15
15
|
list: c,
|
|
16
|
-
startIndex:
|
|
17
|
-
finishIndex:
|
|
16
|
+
startIndex: n,
|
|
17
|
+
finishIndex: r
|
|
18
18
|
}));
|
|
19
19
|
}, b = (e) => {
|
|
20
20
|
let t = c.findIndex((t, n) => l(t, n) === e);
|
|
@@ -23,12 +23,12 @@ var c = ({ items: c, getKey: l, renderItem: u, onReorder: d, disabled: f, classN
|
|
|
23
23
|
let n = c.findIndex((e, n) => l(e, n) === t);
|
|
24
24
|
g?.(e, n === -1 ? c.length : n);
|
|
25
25
|
};
|
|
26
|
-
return
|
|
27
|
-
if (!f) return
|
|
28
|
-
let r =
|
|
29
|
-
if (!r || !
|
|
30
|
-
let i =
|
|
31
|
-
o && s ? y(
|
|
26
|
+
return i(() => {
|
|
27
|
+
if (!f) return o({ onDrop: ({ source: t, location: n }) => {
|
|
28
|
+
let r = n.current.dropTargets[0];
|
|
29
|
+
if (!r || !e(t.data) || !e(r.data)) return;
|
|
30
|
+
let i = t.data.listId, a = r.data.listId, o = i === v, s = a === v;
|
|
31
|
+
o && s ? y(t.data.key, r.data.key) : o ? b(t.data.key) : s && g && x(t.data.item, r.data.key);
|
|
32
32
|
} });
|
|
33
33
|
}, [
|
|
34
34
|
c,
|
|
@@ -37,17 +37,17 @@ var c = ({ items: c, getKey: l, renderItem: u, onReorder: d, disabled: f, classN
|
|
|
37
37
|
f,
|
|
38
38
|
v,
|
|
39
39
|
g
|
|
40
|
-
]), /* @__PURE__ */
|
|
41
|
-
className:
|
|
40
|
+
]), /* @__PURE__ */ r("ul", {
|
|
41
|
+
className: n("sortable-list", p),
|
|
42
42
|
style: m,
|
|
43
|
-
children: c.map((e,
|
|
43
|
+
children: c.map((e, n) => /* @__PURE__ */ r(t, {
|
|
44
44
|
item: e,
|
|
45
|
-
index:
|
|
45
|
+
index: n,
|
|
46
46
|
getKey: l,
|
|
47
47
|
renderItem: u,
|
|
48
48
|
disabled: f,
|
|
49
49
|
listId: v
|
|
50
|
-
}, l(e,
|
|
50
|
+
}, l(e, n)))
|
|
51
51
|
});
|
|
52
52
|
};
|
|
53
53
|
//#endregion
|
|
@@ -4,29 +4,29 @@ import { InputWrapper as t } from "../Input/InputWrapper.esm.js";
|
|
|
4
4
|
import './TimePicker.css';/* empty css */
|
|
5
5
|
import { resolveLocale as n } from "./utilities.esm.js";
|
|
6
6
|
import { TimePickerDisplay as r } from "./TimePickerDisplay.esm.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
7
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
8
|
+
import { useEffect as o, useState as s } from "react";
|
|
9
|
+
import { FaClock as c, FaRegClock as l, FaX as u } from "react-icons/fa6";
|
|
10
|
+
import { autoUpdate as d, flip as f, offset as p, shift as m, useFloating as h } from "@floating-ui/react-dom";
|
|
11
|
+
import { TimePicker as g } from "react-time-picker";
|
|
12
|
+
import { isMobile as _ } from "react-device-detect";
|
|
13
13
|
//#region src/components/TimePicker/TimePicker.tsx
|
|
14
|
-
var v =
|
|
15
|
-
let { labels: y, locale: b, format: x, value: S, onChange: C, label: w, labelPosition: T, error: E, required: D, name: O, ...k } =
|
|
14
|
+
var v = (v) => {
|
|
15
|
+
let { labels: y, locale: b, format: x, value: S, onChange: C, label: w, labelPosition: T, error: E, required: D, name: O, ...k } = v, [A, j] = s(null), [M, N] = s(null), { floatingStyles: P } = h({
|
|
16
16
|
placement: "bottom-start",
|
|
17
17
|
strategy: "absolute",
|
|
18
|
-
whileElementsMounted:
|
|
18
|
+
whileElementsMounted: d,
|
|
19
19
|
middleware: [
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
p(4),
|
|
21
|
+
f(),
|
|
22
|
+
m()
|
|
23
23
|
],
|
|
24
24
|
elements: {
|
|
25
25
|
reference: A,
|
|
26
26
|
floating: M
|
|
27
27
|
}
|
|
28
|
-
}), [F, I] =
|
|
29
|
-
return
|
|
28
|
+
}), [F, I] = s(!1), L = n(b);
|
|
29
|
+
return o(() => {
|
|
30
30
|
if (!F) return;
|
|
31
31
|
let e = (e) => {
|
|
32
32
|
A?.contains(e.target) || M?.contains(e.target) || I(!1);
|
|
@@ -38,50 +38,50 @@ var v = i(), y = (i) => {
|
|
|
38
38
|
F,
|
|
39
39
|
A,
|
|
40
40
|
M
|
|
41
|
-
]), /* @__PURE__ */
|
|
41
|
+
]), /* @__PURE__ */ a("div", {
|
|
42
42
|
className: "timePicker",
|
|
43
43
|
ref: j,
|
|
44
44
|
onFocus: (e) => {
|
|
45
|
-
|
|
45
|
+
_ || e.target instanceof HTMLInputElement && I(!0);
|
|
46
46
|
},
|
|
47
47
|
onKeyDown: (e) => {
|
|
48
48
|
e.key === "Enter" && I(!1);
|
|
49
49
|
},
|
|
50
50
|
children: [
|
|
51
|
-
O && /* @__PURE__ */
|
|
51
|
+
O && /* @__PURE__ */ i("input", {
|
|
52
52
|
type: "hidden",
|
|
53
53
|
name: O,
|
|
54
54
|
value: typeof S == "string" ? S : "",
|
|
55
55
|
readOnly: !0
|
|
56
56
|
}),
|
|
57
|
-
/* @__PURE__ */
|
|
57
|
+
/* @__PURE__ */ i(t, {
|
|
58
58
|
label: w,
|
|
59
59
|
labelPosition: T,
|
|
60
60
|
error: E,
|
|
61
61
|
required: D,
|
|
62
|
-
children: /* @__PURE__ */
|
|
62
|
+
children: /* @__PURE__ */ a("div", {
|
|
63
63
|
className: "timePicker__field",
|
|
64
|
-
children: [/* @__PURE__ */
|
|
64
|
+
children: [/* @__PURE__ */ i(g, {
|
|
65
65
|
...k,
|
|
66
66
|
value: S,
|
|
67
67
|
onChange: C,
|
|
68
68
|
locale: L,
|
|
69
69
|
required: D,
|
|
70
70
|
disableClock: !0,
|
|
71
|
-
clearIcon: /* @__PURE__ */
|
|
72
|
-
}), !
|
|
71
|
+
clearIcon: /* @__PURE__ */ i(u, { size: 14 })
|
|
72
|
+
}), !_ && /* @__PURE__ */ i(e, {
|
|
73
73
|
type: "button",
|
|
74
74
|
variant: "text",
|
|
75
75
|
onClick: () => I((e) => !e),
|
|
76
76
|
"aria-label": F ? "Hide time picker" : "Show time picker",
|
|
77
77
|
"aria-pressed": F,
|
|
78
|
-
disabled:
|
|
78
|
+
disabled: v.disabled,
|
|
79
79
|
className: "input-view-toggle",
|
|
80
|
-
children:
|
|
80
|
+
children: i(F ? c : l, { size: 16 })
|
|
81
81
|
})]
|
|
82
82
|
})
|
|
83
83
|
}),
|
|
84
|
-
!
|
|
84
|
+
!_ && /* @__PURE__ */ i(r, {
|
|
85
85
|
value: S,
|
|
86
86
|
onChange: (e) => C?.(e),
|
|
87
87
|
locale: L,
|
|
@@ -95,4 +95,4 @@ var v = i(), y = (i) => {
|
|
|
95
95
|
});
|
|
96
96
|
};
|
|
97
97
|
//#endregion
|
|
98
|
-
export {
|
|
98
|
+
export { v as TimePicker };
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import e from "../../../node_modules/embla-carousel-react/esm/embla-carousel-react.esm.esm.js";
|
|
3
2
|
import "./constants.esm.js";
|
|
4
|
-
import { inactivateEmblaTransform as
|
|
5
|
-
import
|
|
6
|
-
import { jsx as
|
|
7
|
-
import { useCallback as
|
|
3
|
+
import { inactivateEmblaTransform as e, setContainerStyles as t, setSlideStyles as n, snapOnPointerUp as r } from "./utilities.esm.js";
|
|
4
|
+
import i from "clsx";
|
|
5
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
6
|
+
import { useCallback as s, useEffect as c, useLayoutEffect as l, useRef as u } from "react";
|
|
7
|
+
import d from "embla-carousel-react";
|
|
8
8
|
//#region src/components/TimePicker/TimePickerWheel.tsx
|
|
9
9
|
var f = (f) => {
|
|
10
|
-
let { slideCount: p, perspective: m, label: h, loop: g = !1, offset: _ = 0, slides: v, selectedIndex: y, onSelect: b, disabled: x } = f, [S, C] =
|
|
10
|
+
let { slideCount: p, perspective: m, label: h, loop: g = !1, offset: _ = 0, slides: v, selectedIndex: y, onSelect: b, disabled: x } = f, [S, C] = d({
|
|
11
11
|
loop: g,
|
|
12
12
|
axis: "y",
|
|
13
13
|
dragFree: !0,
|
|
14
14
|
containScroll: !1
|
|
15
|
-
}), w =
|
|
16
|
-
|
|
15
|
+
}), w = u(null), T = u(b);
|
|
16
|
+
l(() => {
|
|
17
17
|
T.current = b;
|
|
18
18
|
});
|
|
19
|
-
let E = p * 20, D = g ? 0 : 20, O =
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
let E = p * 20, D = g ? 0 : 20, O = s((e) => {
|
|
20
|
+
t(e, (p * 20 - D) * e.scrollProgress()), e.slideNodes().forEach((t, r) => {
|
|
21
|
+
n(e, r, g, p, E);
|
|
22
22
|
});
|
|
23
23
|
}, [
|
|
24
24
|
g,
|
|
@@ -26,32 +26,32 @@ var f = (f) => {
|
|
|
26
26
|
D,
|
|
27
27
|
E
|
|
28
28
|
]);
|
|
29
|
-
return
|
|
29
|
+
return c(() => {
|
|
30
30
|
if (!C) return () => {};
|
|
31
|
-
let
|
|
32
|
-
return C.on("pointerUp",
|
|
33
|
-
C.off("pointerUp",
|
|
31
|
+
let t = (e) => T.current?.(e.selectedScrollSnap());
|
|
32
|
+
return C.on("pointerUp", r), C.on("scroll", O), C.on("reInit", e), C.on("reInit", O), C.on("select", t), e(C), O(C), () => {
|
|
33
|
+
C.off("pointerUp", r), C.off("scroll", O), C.off("reInit", e), C.off("reInit", O), C.off("select", t);
|
|
34
34
|
};
|
|
35
|
-
}, [C, O]),
|
|
35
|
+
}, [C, O]), c(() => {
|
|
36
36
|
!C || y === void 0 || C.selectedScrollSnap() !== y && C.scrollTo(y);
|
|
37
|
-
}, [C, y]), /* @__PURE__ */
|
|
38
|
-
className:
|
|
37
|
+
}, [C, y]), /* @__PURE__ */ o("div", {
|
|
38
|
+
className: i("ios-picker", { "ios-picker--disabled": x }),
|
|
39
39
|
"aria-disabled": x,
|
|
40
|
-
children: [/* @__PURE__ */
|
|
40
|
+
children: [/* @__PURE__ */ a("div", {
|
|
41
41
|
className: "ios-picker__scene",
|
|
42
42
|
ref: w,
|
|
43
|
-
children: /* @__PURE__ */
|
|
43
|
+
children: /* @__PURE__ */ a("div", {
|
|
44
44
|
className: `ios-picker__viewport ios-picker__viewport--perspective-${m}`,
|
|
45
45
|
ref: S,
|
|
46
|
-
children: /* @__PURE__ */
|
|
46
|
+
children: /* @__PURE__ */ a("div", {
|
|
47
47
|
className: "ios-picker__container",
|
|
48
|
-
children: Array.from({ length: p }, (e, t) => /* @__PURE__ */
|
|
48
|
+
children: Array.from({ length: p }, (e, t) => /* @__PURE__ */ a("div", {
|
|
49
49
|
className: "ios-picker__slide",
|
|
50
50
|
children: v ? v[t] : t + _
|
|
51
51
|
}, t))
|
|
52
52
|
})
|
|
53
53
|
})
|
|
54
|
-
}), /* @__PURE__ */
|
|
54
|
+
}), /* @__PURE__ */ a("div", {
|
|
55
55
|
className: "ios-picker__label",
|
|
56
56
|
children: h
|
|
57
57
|
})]
|