@stamcat/craftsman 0.0.27-alpha.9 → 0.0.28
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 +21 -403
- package/Components.esm.js +62 -11
- package/README.md +63 -12
- package/Styles.esm.js +7 -7
- package/Utilities.esm.js +2 -2
- package/_virtual/_rolldown/runtime.esm.js +18 -6
- package/package.json +51 -3
- package/src/components/Button/AGENTS.md +65 -0
- package/src/components/Button/Button.d.ts +1 -1
- package/src/components/Button/Button.esm.js +11 -17
- package/src/components/Carousel/AGENTS.md +41 -0
- package/src/components/Carousel/Carousel.css +1 -0
- package/src/components/Carousel/Carousel.d.ts +11 -0
- package/src/components/Carousel/Carousel.scss +34 -0
- package/src/components/Carousel/Carousel2.esm.js +75 -0
- package/src/components/Checkbox/AGENTS.md +34 -0
- package/src/components/Checkbox/Checkbox.d.ts +8 -0
- package/src/components/Checkbox/Checkbox.esm.js +18 -0
- package/src/components/DatePicker/AGENTS.md +36 -0
- package/src/components/DatePicker/DatePicker.css +1 -0
- package/src/components/DatePicker/DatePicker.d.ts +8 -0
- package/src/components/DatePicker/DatePicker.scss +61 -0
- package/src/components/DatePicker/DatePicker2.esm.js +29 -0
- package/src/components/DatePicker/ReactCalendar.css +1 -0
- package/src/components/DatePicker/ReactCalendar.scss +158 -0
- package/src/components/DatePicker/_DatePicker.scss +73 -0
- package/src/components/DateRangePicker/AGENTS.md +38 -0
- package/src/components/DateRangePicker/DateRangePicker.css +1 -0
- package/src/components/DateRangePicker/DateRangePicker.d.ts +8 -0
- package/src/components/DateRangePicker/DateRangePicker.scss +62 -0
- package/src/components/DateRangePicker/DateRangePicker2.esm.js +29 -0
- package/src/components/DateTimePicker/AGENTS.md +41 -0
- package/src/components/DateTimePicker/DateTimePicker.css +1 -0
- package/src/components/DateTimePicker/DateTimePicker.d.ts +13 -0
- package/src/components/DateTimePicker/DateTimePicker.scss +86 -0
- package/src/components/DateTimePicker/DateTimePicker2.esm.js +82 -0
- package/src/components/Icons/IconAmazonPay.d.ts +2 -0
- package/src/components/Icons/IconAmazonPay.esm.js +76 -0
- package/src/components/Icons/IconAmex.d.ts +2 -0
- package/src/components/Icons/IconAmex.esm.js +87 -0
- package/src/components/Icons/IconApplePay.d.ts +2 -0
- package/src/components/Icons/IconApplePay.esm.js +26 -0
- package/src/components/Icons/IconDiscover.d.ts +2 -0
- package/src/components/Icons/IconDiscover.esm.js +129 -0
- package/src/components/Icons/IconGooglePay.d.ts +2 -0
- package/src/components/Icons/IconGooglePay.esm.js +64 -0
- package/src/components/Icons/IconMaestro.d.ts +2 -0
- package/src/components/Icons/IconMaestro.esm.js +38 -0
- package/src/components/Icons/IconMastercard.d.ts +2 -0
- package/src/components/Icons/IconMastercard.esm.js +27 -0
- package/src/components/Icons/IconPayPal.d.ts +2 -0
- package/src/components/Icons/IconPayPal.esm.js +52 -0
- package/src/components/Icons/IconSepa.d.ts +2 -0
- package/src/components/Icons/IconSepa.esm.js +272 -0
- package/src/components/Icons/IconShopPay.d.ts +2 -0
- package/src/components/Icons/IconShopPay.esm.js +35 -0
- package/src/components/Icons/IconSquare.d.ts +2 -0
- package/src/components/Icons/IconSquare.esm.js +11 -0
- package/src/components/Icons/IconStripe.d.ts +2 -0
- package/src/components/Icons/IconStripe.esm.js +57 -0
- package/src/components/Icons/IconUnionPay.d.ts +2 -0
- package/src/components/Icons/IconUnionPay.esm.js +28 -0
- package/src/components/Icons/IconVenmo.d.ts +2 -0
- package/src/components/Icons/IconVenmo.esm.js +21 -0
- package/src/components/Icons/IconVisa.d.ts +2 -0
- package/src/components/Icons/IconVisa.esm.js +14 -0
- package/src/components/Icons/index.d.ts +15 -0
- package/src/components/Icons/index.esm.js +16 -0
- package/src/components/Icons/types.d.ts +4 -0
- package/src/components/Input/AGENTS.md +30 -0
- package/src/components/Input/Input.css +1 -1
- package/src/components/Input/Input.scss +108 -95
- package/src/components/Input/Input2.esm.js +27 -18
- package/src/components/Input/InputWrapper.d.ts +1 -0
- package/src/components/InputNumber/AGENTS.md +37 -0
- package/src/components/InputNumber/InputNumber.css +1 -0
- package/src/components/InputNumber/InputNumber.d.ts +10 -0
- package/src/components/InputNumber/InputNumber.scss +29 -0
- package/src/components/InputNumber/InputNumber2.esm.js +36 -0
- package/src/components/InputPassword/AGENTS.md +29 -0
- package/src/components/{Input → InputPassword}/InputPassword.d.ts +1 -1
- package/src/components/InputPassword/InputPassword.esm.js +30 -0
- package/src/components/InputPhone/AGENTS.md +35 -0
- package/src/components/InputPhone/InputPhone.css +1 -0
- package/src/components/{Input → InputPhone}/InputPhone.d.ts +1 -1
- package/src/components/InputPhone/InputPhone.scss +266 -0
- package/src/components/{Input/InputPhone.esm.js → InputPhone/InputPhone2.esm.js} +4 -4
- package/src/components/Loader/AGENTS.md +31 -0
- package/src/components/Loader/Loader.esm.js +1 -1
- package/src/components/Loader/types.d.ts +1 -1
- package/src/components/Modal/AGENTS.md +47 -0
- package/src/components/Modal/Modal.css +1 -0
- package/src/components/Modal/Modal.scss +150 -0
- package/src/components/Modal/Modal2.esm.js +53 -0
- package/src/components/Notice/AGENTS.md +42 -0
- package/src/components/Notice/Notice.css +1 -0
- package/src/components/Notice/Notice.d.ts +13 -0
- package/src/components/Notice/Notice.scss +76 -0
- package/src/components/Notice/Notice2.esm.js +56 -0
- package/src/components/Pagination/AGENTS.md +38 -0
- package/src/components/Pagination/Pagination.css +1 -0
- package/src/components/Pagination/Pagination.d.ts +10 -0
- package/src/components/Pagination/Pagination.scss +22 -0
- package/src/components/Pagination/Pagination2.esm.js +64 -0
- package/src/components/RadioButton/AGENTS.md +44 -0
- package/src/components/RadioButton/RadioButton.d.ts +9 -0
- package/src/components/RadioButton/RadioButton.esm.js +18 -0
- package/src/components/Select/AGENTS.md +36 -0
- package/src/components/SortableList/AGENTS.md +45 -0
- package/src/components/SortableList/ListItem.d.ts +10 -0
- package/src/components/SortableList/ListItem.esm.js +67 -0
- package/src/components/SortableList/SortableList.css +1 -0
- package/src/components/SortableList/SortableList.d.ts +23 -0
- package/src/components/SortableList/SortableList.scss +41 -0
- package/src/components/SortableList/SortableList2.esm.js +54 -0
- package/src/components/SortableList/utilities.d.ts +7 -0
- package/src/components/SortableList/utilities.esm.js +4 -0
- package/src/components/Text/AGENTS.md +32 -0
- package/src/components/Text/Text.css +1 -1
- package/src/components/Text/Text.scss +2 -2
- package/src/components/Textarea/AGENTS.md +32 -0
- package/src/components/{Input → Textarea}/Textarea.d.ts +1 -1
- package/src/components/Textarea/Textarea.esm.js +23 -0
- package/src/components/TimePicker/AGENTS.md +42 -0
- package/src/components/TimePicker/TimePicker.css +1 -0
- package/src/components/TimePicker/TimePicker.d.ts +13 -0
- package/src/components/TimePicker/TimePicker.scss +226 -0
- package/src/components/TimePicker/TimePicker2.esm.js +98 -0
- package/src/components/TimePicker/TimePickerDisplay.d.ts +16 -0
- package/src/components/TimePicker/TimePickerDisplay.esm.js +54 -0
- package/src/components/TimePicker/TimePickerWheel.d.ts +13 -0
- package/src/components/TimePicker/TimePickerWheel.esm.js +61 -0
- package/src/components/TimePicker/constants.d.ts +7 -0
- package/src/components/TimePicker/constants.esm.js +3 -0
- package/src/components/TimePicker/utilities.d.ts +15 -0
- package/src/components/TimePicker/utilities.esm.js +20 -0
- package/src/components/Toggle/AGENTS.md +33 -0
- package/src/components/Toggle/Toggle.css +1 -0
- package/src/components/Toggle/Toggle.d.ts +5 -0
- package/src/components/Toggle/Toggle.scss +64 -0
- package/src/components/Toggle/Toggle2.esm.js +19 -0
- package/src/components/Tooltip/AGENTS.md +41 -0
- package/src/components/Tooltip/Tooltip.css +1 -0
- package/src/components/Tooltip/Tooltip.d.ts +12 -0
- package/src/components/Tooltip/Tooltip.scss +29 -0
- package/src/components/Tooltip/Tooltip2.esm.js +65 -0
- package/src/components/index.d.ts +17 -6
- package/src/styles/global/components/_button.scss +24 -21
- package/src/styles/global/components/_checkbox.scss +5 -4
- package/src/styles/global/components/_input.scss +1 -1
- package/src/styles/global/components/_radioButton.scss +5 -4
- package/src/styles/global/components/_typography.scss +6 -1
- package/src/styles/global/globalStyles.scss +9 -5
- package/src/styles/theme/components.esm.js +5 -6
- package/src/styles/utilities/_functions.scss +2 -2
- package/src/styles/utilities/_placeholders.scss +6 -0
- package/src/styles/utilities/layout.esm.js +3 -3
- package/src/utilities/types.d.ts +28 -3
- package/src/utilities/types.esm.js +11 -5
- package/src/utilities/validations.d.ts +5 -0
- package/src/utilities/validations.esm.js +19 -1
- package/src/components/Input/Checkbox.d.ts +0 -7
- package/src/components/Input/Checkbox.esm.js +0 -11
- package/src/components/Input/DatePicker.d.ts +0 -8
- package/src/components/Input/DatePicker.esm.js +0 -24
- package/src/components/Input/InputPassword.esm.js +0 -28
- package/src/components/Input/RadioButton.d.ts +0 -7
- package/src/components/Input/RadioButton.esm.js +0 -11
- package/src/components/Input/Textarea.esm.js +0 -24
- package/src/components/Modal/Modal.esm.js +0 -53
- package/src/components/Modal/Modal.module.css +0 -1
- package/src/components/Modal/Modal.module.esm.js +0 -16
- package/src/components/Modal/Modal.module.scss +0 -147
- package/src/styles/global/components/_reactCalendar.css +0 -1
- package/src/styles/global/components/_reactCalendar.scss +0 -237
- package/src/styles/global/components/_reactDatePicker.css +0 -1
- package/src/styles/global/components/_reactDatePicker.scss +0 -152
- package/src/styles/global/components/_reactPhone.css +0 -1
- package/src/styles/global/components/_reactPhone.scss +0 -265
- /package/src/components/{Progress.d.ts → Progress/Progress.d.ts} +0 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Text — Agent Usage Notes
|
|
2
|
+
|
|
3
|
+
Import:
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import { Text } from "@stamcat/craftsman/Text";
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Props:
|
|
10
|
+
|
|
11
|
+
- Inherits all native HTML element props.
|
|
12
|
+
- `as?: TextTags` — HTML tag to render (default: `"div"`)
|
|
13
|
+
- `richText?: boolean` — when `true`, renders sanitized HTML from a string `children` value (always renders as `<div>`)
|
|
14
|
+
- `type?: TextType` — overrides base type styling (e.g. `"display"`, `"heading"`)
|
|
15
|
+
- `size?: TextSize` — overrides base size styling
|
|
16
|
+
- `alignment?: "center" | "left" | "right"` — legacy text-align shorthand
|
|
17
|
+
|
|
18
|
+
Behavior notes:
|
|
19
|
+
|
|
20
|
+
- Uses global HTML5 tag declarations by default; `type` and `size` override base styling.
|
|
21
|
+
- `richText` mode sanitizes HTML via DOMPurify. Always pass a string as `children` in this mode.
|
|
22
|
+
- Prefer semantic HTML5 tags via `as` over using `type`/`size` overrides.
|
|
23
|
+
|
|
24
|
+
Example:
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
// Semantic heading
|
|
28
|
+
<Text as="h2">Section Title</Text>
|
|
29
|
+
|
|
30
|
+
// Sanitized rich text from a CMS
|
|
31
|
+
<Text richText>{'<p><strong>Hello</strong> world</p>'}</Text>
|
|
32
|
+
```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer craftsman-base{h1{font-size:calc(var(--w-text) * 3.125);line-height:1.2}h2{font-size:calc(var(--w-text) * 2.625);font-weight:625;line-height:1.1}h3{font-size:calc(var(--w-text) * 1.625);line-height:1.1}h4{font-size:calc(var(--w-text) * 1.25);margin:calc(var(--w-gutter) * .5) 0;line-height:1.1}h5{font-size:var(--w-text);line-height:1.2}h6{font-size:calc(var(--w-text) * .875);font-weight:600;line-height:1.2}p{font-style:normal;font-size:var(--w-text);margin:0;line-height:1.5}small{font-size:calc(var(--w-text) * .75)}@media (width<=660px){h4{font-size:var(--w-text,14px)}p{font-size:calc(var(--w-text,14px) * .875)}}.text.display{font-size:calc(var(--w-text) * 1.625);line-height:1.1}.text.display.xlarge{font-size:calc(var(--w-text) * 3.125);line-height:1.2}.text.display.large{font-size:calc(var(--w-text) * 2.625);font-weight:625;line-height:1.1}.text.display.small{font-size:calc(var(--w-text) * 1.25);margin:calc(var(--w-gutter) * .5) 0;line-height:1.1}.text.heading{font-size:calc(var(--w-text) * 1.625);line-height:1.1}.text.heading.xlarge{font-size:calc(var(--w-text) * 3.125);line-height:1.2}.text.heading.large,.text.xlarge{font-size:calc(var(--w-text) * 2.625);font-weight:625;line-height:1.1}.text.heading.medium{font-size:calc(var(--w-text) * 1.625);line-height:1.1}.text.heading.small{font-size:calc(var(--w-text) * 1.25);margin:calc(var(--w-gutter) * .5) 0;line-height:1.1}.text.heading.xsmall{font-size:var(--w-text);line-height:1.2}.text.paragraph{font-style:normal;font-size:var(--w-text);margin:0;line-height:1.5}.text.paragraph.xlarge,.text.large{font-size:calc(var(--w-text) * 1.625);line-height:1.1}.text.paragraph.large{font-size:calc(var(--w-text) * 1.25);margin:calc(var(--w-gutter) * .5) 0;line-height:1.1}.text.paragraph.medium,.text.medium{font-style:normal;font-size:var(--w-text);margin:0;line-height:1.5}.text.paragraph.small,.text.small{font-size:calc(var(--w-text) * .75)}.text.paragraph.xsmall,.text.xsmall{font-size:calc(var(--w-text) * .5)}.text.caption{font-size:calc(var(--w-text) * .75)}.text.center{text-align:center}.text.left{text-align:left}.text.right{text-align:right}}
|
|
1
|
+
@layer craftsman-base{h1{font-size:calc(var(--w-text) * 3.125);margin:0 0 var(--w-gutter) 0;line-height:1.2}h2{font-size:calc(var(--w-text) * 2.625);margin:0 0 var(--w-gutter) 0;font-weight:625;line-height:1.1}h3{font-size:calc(var(--w-text) * 1.625);margin:0 0 calc(var(--w-gutter) * .75) 0;line-height:1.1}h4{font-size:calc(var(--w-text) * 1.25);margin:0 0 calc(var(--w-gutter) * .5) 0;line-height:1.1}h5{font-size:var(--w-text);margin:0 0 calc(var(--w-gutter) * .5) 0;line-height:1.2}h6{font-size:calc(var(--w-text) * .875);margin:0;font-weight:600;line-height:1.2}p{font-style:normal;font-size:var(--w-text);margin:0;line-height:1.5}small{font-size:calc(var(--w-text) * .75)}@media (width<=660px){h4{font-size:var(--w-text,14px)}p{font-size:calc(var(--w-text,14px) * .875)}}}@layer craftsman-component{.text.display{font-size:calc(var(--w-text) * 1.625);margin:0 0 calc(var(--w-gutter) * .75) 0;line-height:1.1}.text.display.xlarge{font-size:calc(var(--w-text) * 3.125);margin:0 0 var(--w-gutter) 0;line-height:1.2}.text.display.large{font-size:calc(var(--w-text) * 2.625);margin:0 0 var(--w-gutter) 0;font-weight:625;line-height:1.1}.text.display.small{font-size:calc(var(--w-text) * 1.25);margin:0 0 calc(var(--w-gutter) * .5) 0;line-height:1.1}.text.heading{font-size:calc(var(--w-text) * 1.625);margin:0 0 calc(var(--w-gutter) * .75) 0;line-height:1.1}.text.heading.xlarge{font-size:calc(var(--w-text) * 3.125);margin:0 0 var(--w-gutter) 0;line-height:1.2}.text.heading.large,.text.xlarge{font-size:calc(var(--w-text) * 2.625);margin:0 0 var(--w-gutter) 0;font-weight:625;line-height:1.1}.text.heading.medium{font-size:calc(var(--w-text) * 1.625);margin:0 0 calc(var(--w-gutter) * .75) 0;line-height:1.1}.text.heading.small{font-size:calc(var(--w-text) * 1.25);margin:0 0 calc(var(--w-gutter) * .5) 0;line-height:1.1}.text.heading.xsmall{font-size:var(--w-text);margin:0 0 calc(var(--w-gutter) * .5) 0;line-height:1.2}.text.paragraph{font-style:normal;font-size:var(--w-text);margin:0;line-height:1.5}.text.paragraph.xlarge,.text.large{font-size:calc(var(--w-text) * 1.625);margin:0 0 calc(var(--w-gutter) * .75) 0;line-height:1.1}.text.paragraph.large{font-size:calc(var(--w-text) * 1.25);margin:0 0 calc(var(--w-gutter) * .5) 0;line-height:1.1}.text.paragraph.medium,.text.medium{font-style:normal;font-size:var(--w-text);margin:0;line-height:1.5}.text.paragraph.small,.text.small{font-size:calc(var(--w-text) * .75)}.text.paragraph.xsmall,.text.xsmall{font-size:calc(var(--w-text) * .5)}.text.caption{font-size:calc(var(--w-text) * .75)}.text.center{text-align:center}.text.left{text-align:left}.text.right{text-align:right}}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Textarea — Agent Usage Notes
|
|
2
|
+
|
|
3
|
+
Import:
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import { Textarea } from "@stamcat/craftsman/Textarea";
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Props:
|
|
10
|
+
|
|
11
|
+
- Inherits all native `<textarea>` props.
|
|
12
|
+
- `label?: string | ReactNode`
|
|
13
|
+
- `labelPosition?: "top" | "left" | "bottom" | "right" | "inside" | "hidden"` (default: `"top"`)
|
|
14
|
+
- `error?: string | boolean | ReactNode`
|
|
15
|
+
- `required?: boolean`
|
|
16
|
+
- `rows?: number`
|
|
17
|
+
|
|
18
|
+
Behavior notes:
|
|
19
|
+
|
|
20
|
+
- Shares the same `InputWrapper` as `Input` — label, error, and required behavior is identical.
|
|
21
|
+
- `id` is auto-generated via `useId` if not provided.
|
|
22
|
+
|
|
23
|
+
Example:
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
<Textarea
|
|
27
|
+
label="Your Message"
|
|
28
|
+
placeholder="Type here"
|
|
29
|
+
rows={4}
|
|
30
|
+
required
|
|
31
|
+
/>
|
|
32
|
+
```
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { InputWrapper as e } from "../Input/InputWrapper.esm.js";
|
|
3
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
4
|
+
import { useId as n } from "react";
|
|
5
|
+
//#region src/components/Textarea/Textarea.tsx
|
|
6
|
+
var r = ({ labelPosition: r = "top", id: i, label: a, error: o, required: s, className: c, style: l, ...u }) => {
|
|
7
|
+
let d = n();
|
|
8
|
+
return /* @__PURE__ */ t(e, {
|
|
9
|
+
label: a,
|
|
10
|
+
className: c,
|
|
11
|
+
labelPosition: r,
|
|
12
|
+
error: o,
|
|
13
|
+
required: s,
|
|
14
|
+
style: l,
|
|
15
|
+
children: /* @__PURE__ */ t("textarea", {
|
|
16
|
+
id: i || d,
|
|
17
|
+
className: "input",
|
|
18
|
+
...u
|
|
19
|
+
})
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
//#endregion
|
|
23
|
+
export { r as Textarea };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# TimePicker — Agent Usage Notes
|
|
2
|
+
|
|
3
|
+
Import:
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import { TimePicker } from "@stamcat/craftsman/TimePicker";
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Props:
|
|
10
|
+
|
|
11
|
+
- Extends `TimePickerProps` from `react-time-picker`, excluding its `locale` and `format` props.
|
|
12
|
+
- `label?: string | ReactNode`
|
|
13
|
+
- `labelPosition?: "top" | "left" | "bottom" | "right" | "inside" | "hidden"` (default: `"top"`)
|
|
14
|
+
- `error?: string | boolean | ReactNode`
|
|
15
|
+
- `required?: boolean`
|
|
16
|
+
- `locale?: Intl.LocalesArgument`
|
|
17
|
+
- `format?: 24 | 12`
|
|
18
|
+
- `labels?: { hour?: string; minute?: string }`
|
|
19
|
+
|
|
20
|
+
Behavior notes:
|
|
21
|
+
|
|
22
|
+
- The component uses a custom wheel UI instead of the stock `react-time-picker` clock popup.
|
|
23
|
+
- `value` is typically a time string such as `"09:30"`; pair it with `onChange` for interactive controlled usage.
|
|
24
|
+
- If a `value` is provided without `onChange`, treat the picker as effectively read-only.
|
|
25
|
+
- Focusing the input opens the wheel, and the trailing toggle button shows or hides it explicitly.
|
|
26
|
+
- The trailing toggle button mirrors the field's `disabled` prop — when `disabled` is set, the toggle is disabled too.
|
|
27
|
+
- Clicking outside the field and wheel closes the wheel.
|
|
28
|
+
- `locale` defaults to the browser locale when omitted and affects time formatting and wheel labels.
|
|
29
|
+
- When `name` is provided, the component renders a hidden input so forms can submit the selected string value.
|
|
30
|
+
|
|
31
|
+
Example:
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
const [time, setTime] = useState("09:30");
|
|
35
|
+
|
|
36
|
+
<TimePicker
|
|
37
|
+
label="Appointment Time"
|
|
38
|
+
value={time}
|
|
39
|
+
onChange={(value) => setTime(value ?? "")}
|
|
40
|
+
format={24}
|
|
41
|
+
/>
|
|
42
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer craftsman-base{.react-time-picker__wrapper:focus{box-shadow:none;outline:0}.react-time-picker__wrapper{color:var(--text);border:1px solid var(--gray400);padding:calc(var(--w-gutter) * .5);background-color:var(--white);border-radius:6px}[type=number].react-time-picker__wrapper::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}[type=number].react-time-picker__wrapper::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}[type=number].react-time-picker__wrapper{appearance:textfield}.react-time-picker__wrapper:disabled,.disabled.react-time-picker__wrapper{border-color:var(--gray200);background-color:var(--gray100)}}.react-time-picker,.react-time-picker *,.react-time-picker :before,.react-time-picker :after{box-sizing:border-box}@layer craftsman-component{.react-time-picker{display:inline-flex;position:relative}.react-time-picker--disabled{color:#6d6d6d;background-color:#f0f0f0}.react-time-picker__wrapper{flex-grow:1;flex-shrink:0;padding:6px 8px;display:flex}.react-time-picker__inputGroup{box-sizing:content-box;flex-grow:1;padding:0 2px}.react-time-picker__inputGroup__divider{white-space:pre;padding:1px 0}.react-time-picker__inputGroup__divider,.react-time-picker__inputGroup__leadingZero{font:inherit;display:inline-block}.react-time-picker__inputGroup__input{text-align:center;color:currentColor;min-width:calc(2ch + 1px);height:calc(100% - 2px);font:inherit;box-sizing:content-box;appearance:textfield;background:0 0;border:0;padding:1px;position:relative}[name=year].react-time-picker__inputGroup__input{min-width:calc(4ch + 2px)}.react-time-picker__inputGroup__input:disabled{background-color:unset}.react-time-picker__inputGroup__input::-webkit-outer-spin-button{appearance:none;margin:0}.react-time-picker__inputGroup__input::-webkit-inner-spin-button{appearance:none;margin:0}.react-time-picker__inputGroup__input--hasLeadingZero{margin-left:-.54em;padding-left:calc(1px + .54em)}.react-time-picker__button{border:0;padding:4px 4px 4px 7px}.react-time-picker__button:hover{background:0 0}.react-time-picker__wrapper{padding:6px 24px 6px 8px}.react-time-picker__inputGroup__input:invalid{background:#ff00001a}.react-time-picker__inputGroup__amPm{font:inherit;appearance:menulist}.react-time-picker__button:enabled{cursor:pointer}.react-time-picker__button:enabled:hover .react-time-picker__button__icon,.react-time-picker__button:enabled:focus .react-time-picker__button__icon{stroke:#0078d7}.react-time-picker__button:disabled .react-time-picker__button__icon{stroke:#6d6d6d}.react-time-picker__button svg{display:inherit}.react-time-picker__clock{z-index:1;background-color:#fff;border:thin solid #a0a096;width:200px;max-width:100vw;height:200px;padding:25px}.react-time-picker__clock--closed,.timePicker .react-time-picker__clock{display:none}.timePicker .timePicker__field{position:relative}.timePicker .timePicker__field .input-view-toggle{padding:4px;line-height:1;position:absolute;top:50%;right:4px;transform:translateY(-50%)}.timePicker__display{background-color:var(--white);border:1px solid var(--gray400);z-index:1;border-radius:8px;height:160px;display:inline-flex;position:relative}.timePicker__display:before,.timePicker__display:after{content:"";z-index:1;pointer-events:none;height:calc(50% - 16px);display:block;position:absolute;left:0;right:0}.timePicker__display:before{border-bottom:.5px solid rgba(var(--text-high-contrast-rgb-value), .3);background:linear-gradient(to top, rgba(var(--background-site-rgb-value), .65) 0%, rgba(var(--background-site-rgb-value), 1) 100%);top:-.5px}.timePicker__display:after{border-top:.5px solid rgba(var(--text-high-contrast-rgb-value), .3);background:linear-gradient(to bottom, rgba(var(--background-site-rgb-value), .65) 0%, rgba(var(--background-site-rgb-value), 1) 100%);bottom:-.5px}.timePicker__display .ios-picker{flex-direction:row;align-items:center;gap:6px;height:100%;padding:0 12px;font-size:16px;line-height:1;display:flex}.timePicker__display .ios-picker--disabled{pointer-events:none;opacity:.5}.timePicker__display .ios-picker__scene{touch-action:pan-x;align-items:center;min-width:30px;height:100%;display:flex;overflow:hidden}.timePicker__display .ios-picker__viewport{perspective:1000px;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;-khtml-user-select:none;-webkit-tap-highlight-color:transparent;width:100%;height:32px}.timePicker__display .ios-picker__viewport--perspective-left{perspective-origin:calc(50% + 130px);transform:translate(27px)}.timePicker__display .ios-picker__viewport--perspective-right{perspective-origin:calc(50% - 130px);transform:translate(-27px)}.timePicker__display .ios-picker__viewport--perspective-center{perspective-origin:50%}.timePicker__display .ios-picker__container{width:100%;height:100%;transform-style:preserve-3d;will-change:transform}.timePicker__display .ios-picker__slide{text-align:center;backface-visibility:hidden;opacity:0;justify-content:center;align-items:center;width:100%;height:100%;display:flex}.timePicker__display .ios-picker__label{white-space:nowrap;pointer-events:none;font-weight:700}}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { TimePickerProps as ReactTimePickerProps } from 'react-time-picker';
|
|
3
|
+
import { LabeledInput } from '../Input/InputWrapper';
|
|
4
|
+
type TimePickerProps = Omit<ReactTimePickerProps, "locale" | "format"> & LabeledInput & {
|
|
5
|
+
locale?: Intl.LocalesArgument;
|
|
6
|
+
format?: 24 | 12;
|
|
7
|
+
labels?: {
|
|
8
|
+
hour?: string;
|
|
9
|
+
minute?: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export declare const TimePicker: React.FC<TimePickerProps>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
@use "../../styles/utilities/_functions" as u;
|
|
2
|
+
@use "../../styles/global/components/input";
|
|
3
|
+
@use "../../styles/utilities/_placeholders";
|
|
4
|
+
@use "../DatePicker/_DatePicker";
|
|
5
|
+
|
|
6
|
+
@layer craftsman-component {
|
|
7
|
+
.react-time-picker,
|
|
8
|
+
.react-time-picker *,
|
|
9
|
+
.react-time-picker *:before,
|
|
10
|
+
.react-time-picker *:after {
|
|
11
|
+
@extend %border-box;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.react-time-picker {
|
|
15
|
+
@extend %date-picker-styles;
|
|
16
|
+
&--disabled {
|
|
17
|
+
@extend %date-picker-disabled;
|
|
18
|
+
}
|
|
19
|
+
&__wrapper {
|
|
20
|
+
@extend %date-picker-wrapper;
|
|
21
|
+
padding: 6px 24px 6px 8px;
|
|
22
|
+
}
|
|
23
|
+
&__inputGroup {
|
|
24
|
+
@extend %date-picker-input-group;
|
|
25
|
+
}
|
|
26
|
+
&__inputGroup__divider {
|
|
27
|
+
@extend %date-picker-divider;
|
|
28
|
+
}
|
|
29
|
+
&__inputGroup__divider,
|
|
30
|
+
&__inputGroup__leadingZero {
|
|
31
|
+
@extend %date-picker-leading-zero-divider;
|
|
32
|
+
}
|
|
33
|
+
&__inputGroup__input {
|
|
34
|
+
@extend %date-picker-group-input;
|
|
35
|
+
}
|
|
36
|
+
&__inputGroup__input::-webkit-outer-spin-button,
|
|
37
|
+
&__inputGroup__input::-webkit-inner-spin-button {
|
|
38
|
+
@extend %date-picker-input-spinner;
|
|
39
|
+
}
|
|
40
|
+
&__inputGroup__input--hasLeadingZero {
|
|
41
|
+
@extend %date-picker-input-leading-zero;
|
|
42
|
+
}
|
|
43
|
+
&__button {
|
|
44
|
+
@extend %date-picker-button;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.react-time-picker__inputGroup__input:invalid {
|
|
49
|
+
background: rgba(255, 0, 0, 0.1);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.react-time-picker__inputGroup__amPm {
|
|
53
|
+
font: inherit;
|
|
54
|
+
-webkit-appearance: menulist;
|
|
55
|
+
-moz-appearance: menulist;
|
|
56
|
+
appearance: menulist;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.react-time-picker__button:enabled {
|
|
60
|
+
cursor: pointer;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.react-time-picker__button:enabled:hover .react-time-picker__button__icon,
|
|
64
|
+
.react-time-picker__button:enabled:focus .react-time-picker__button__icon {
|
|
65
|
+
stroke: #0078d7;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.react-time-picker__button:disabled .react-time-picker__button__icon {
|
|
69
|
+
stroke: #6d6d6d;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.react-time-picker__button svg {
|
|
73
|
+
display: inherit;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.react-time-picker__clock {
|
|
77
|
+
width: 200px;
|
|
78
|
+
height: 200px;
|
|
79
|
+
max-width: 100vw;
|
|
80
|
+
padding: 25px;
|
|
81
|
+
background-color: white;
|
|
82
|
+
border: thin solid #a0a096;
|
|
83
|
+
z-index: 1;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.react-time-picker__clock--closed {
|
|
87
|
+
display: none;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.timePicker {
|
|
91
|
+
// suppress the built-in clock popup — our custom wheel renders instead
|
|
92
|
+
.react-time-picker__clock {
|
|
93
|
+
display: none;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.timePicker__field {
|
|
97
|
+
position: relative;
|
|
98
|
+
|
|
99
|
+
.input-view-toggle {
|
|
100
|
+
position: absolute;
|
|
101
|
+
right: 4px;
|
|
102
|
+
top: 50%;
|
|
103
|
+
transform: translateY(-50%);
|
|
104
|
+
padding: 4px;
|
|
105
|
+
line-height: 1;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
&__display {
|
|
110
|
+
position: relative;
|
|
111
|
+
display: inline-flex;
|
|
112
|
+
height: 160px;
|
|
113
|
+
background-color: #{u.color("white")};
|
|
114
|
+
border: 1px solid #{u.color("gray400")};
|
|
115
|
+
border-radius: 8px;
|
|
116
|
+
z-index: 1;
|
|
117
|
+
&:before,
|
|
118
|
+
&:after {
|
|
119
|
+
position: absolute;
|
|
120
|
+
left: 0;
|
|
121
|
+
right: 0;
|
|
122
|
+
content: "";
|
|
123
|
+
display: block;
|
|
124
|
+
height: calc(50% - 32px / 2);
|
|
125
|
+
z-index: 1;
|
|
126
|
+
pointer-events: none;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
&:before {
|
|
130
|
+
top: -0.5px;
|
|
131
|
+
border-bottom: 0.5px solid rgba(var(--text-high-contrast-rgb-value), 0.3);
|
|
132
|
+
background: linear-gradient(
|
|
133
|
+
to top,
|
|
134
|
+
rgba(var(--background-site-rgb-value), 0.65) 0%,
|
|
135
|
+
rgba(var(--background-site-rgb-value), 1) 100%
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
&:after {
|
|
140
|
+
bottom: -0.5px;
|
|
141
|
+
border-top: 0.5px solid rgba(var(--text-high-contrast-rgb-value), 0.3);
|
|
142
|
+
background: linear-gradient(
|
|
143
|
+
to bottom,
|
|
144
|
+
rgba(var(--background-site-rgb-value), 0.65) 0%,
|
|
145
|
+
rgba(var(--background-site-rgb-value), 1) 100%
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.ios-picker {
|
|
150
|
+
height: 100%;
|
|
151
|
+
display: flex;
|
|
152
|
+
flex-direction: row;
|
|
153
|
+
align-items: center;
|
|
154
|
+
gap: 6px;
|
|
155
|
+
padding: 0 12px;
|
|
156
|
+
line-height: 1;
|
|
157
|
+
font-size: 16px;
|
|
158
|
+
|
|
159
|
+
&--disabled {
|
|
160
|
+
pointer-events: none;
|
|
161
|
+
opacity: 0.5;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.ios-picker__scene {
|
|
166
|
+
min-width: 30px;
|
|
167
|
+
height: 100%;
|
|
168
|
+
overflow: hidden;
|
|
169
|
+
display: flex;
|
|
170
|
+
align-items: center;
|
|
171
|
+
touch-action: pan-x;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.ios-picker__viewport {
|
|
175
|
+
height: 32px;
|
|
176
|
+
width: 100%;
|
|
177
|
+
perspective: 1000px;
|
|
178
|
+
-webkit-user-select: none;
|
|
179
|
+
-moz-user-select: none;
|
|
180
|
+
-ms-user-select: none;
|
|
181
|
+
user-select: none;
|
|
182
|
+
-webkit-touch-callout: none;
|
|
183
|
+
-khtml-user-select: none;
|
|
184
|
+
-webkit-tap-highlight-color: transparent;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.ios-picker__viewport--perspective-left {
|
|
188
|
+
perspective-origin: calc(50% + 130px) 50%;
|
|
189
|
+
transform: translateX(27px);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.ios-picker__viewport--perspective-right {
|
|
193
|
+
perspective-origin: calc(50% - 130px) 50%;
|
|
194
|
+
transform: translateX(-27px);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.ios-picker__viewport--perspective-center {
|
|
198
|
+
perspective-origin: 50% 50%;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.ios-picker__container {
|
|
202
|
+
height: 100%;
|
|
203
|
+
width: 100%;
|
|
204
|
+
transform-style: preserve-3d;
|
|
205
|
+
will-change: transform;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.ios-picker__slide {
|
|
209
|
+
width: 100%;
|
|
210
|
+
height: 100%;
|
|
211
|
+
text-align: center;
|
|
212
|
+
display: flex;
|
|
213
|
+
align-items: center;
|
|
214
|
+
justify-content: center;
|
|
215
|
+
backface-visibility: hidden;
|
|
216
|
+
opacity: 0;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.ios-picker__label {
|
|
220
|
+
font-weight: 700;
|
|
221
|
+
white-space: nowrap;
|
|
222
|
+
pointer-events: none;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Button as e } from "../Button/Button.esm.js";
|
|
3
|
+
import { InputWrapper as t } from "../Input/InputWrapper.esm.js";
|
|
4
|
+
import './TimePicker.css';/* empty css */
|
|
5
|
+
import { resolveLocale as n } from "./utilities.esm.js";
|
|
6
|
+
import { TimePickerDisplay as r } from "./TimePickerDisplay.esm.js";
|
|
7
|
+
import { require_lib as i } from "../../../node_modules/react-device-detect/dist/lib.esm.js";
|
|
8
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
9
|
+
import { useEffect as s, useState as c } from "react";
|
|
10
|
+
import { FaClock as l, FaRegClock as u, FaX as d } from "react-icons/fa6";
|
|
11
|
+
import { autoUpdate as f, flip as p, offset as m, shift as h, useFloating as g } from "@floating-ui/react-dom";
|
|
12
|
+
import { TimePicker as _ } from "react-time-picker";
|
|
13
|
+
//#region src/components/TimePicker/TimePicker.tsx
|
|
14
|
+
var v = i(), y = (i) => {
|
|
15
|
+
let { labels: y, locale: b, format: x, value: S, onChange: C, label: w, labelPosition: T, error: E, required: D, name: O, ...k } = i, [A, j] = c(null), [M, N] = c(null), { floatingStyles: P } = g({
|
|
16
|
+
placement: "bottom-start",
|
|
17
|
+
strategy: "absolute",
|
|
18
|
+
whileElementsMounted: f,
|
|
19
|
+
middleware: [
|
|
20
|
+
m(4),
|
|
21
|
+
p(),
|
|
22
|
+
h()
|
|
23
|
+
],
|
|
24
|
+
elements: {
|
|
25
|
+
reference: A,
|
|
26
|
+
floating: M
|
|
27
|
+
}
|
|
28
|
+
}), [F, I] = c(!1), L = n(b);
|
|
29
|
+
return s(() => {
|
|
30
|
+
if (!F) return;
|
|
31
|
+
let e = (e) => {
|
|
32
|
+
A?.contains(e.target) || M?.contains(e.target) || I(!1);
|
|
33
|
+
};
|
|
34
|
+
return document.addEventListener("pointerdown", e), () => {
|
|
35
|
+
document.removeEventListener("pointerdown", e);
|
|
36
|
+
};
|
|
37
|
+
}, [
|
|
38
|
+
F,
|
|
39
|
+
A,
|
|
40
|
+
M
|
|
41
|
+
]), /* @__PURE__ */ o("div", {
|
|
42
|
+
className: "timePicker",
|
|
43
|
+
ref: j,
|
|
44
|
+
onFocus: (e) => {
|
|
45
|
+
v.isMobile || e.target instanceof HTMLInputElement && I(!0);
|
|
46
|
+
},
|
|
47
|
+
onKeyDown: (e) => {
|
|
48
|
+
e.key === "Enter" && I(!1);
|
|
49
|
+
},
|
|
50
|
+
children: [
|
|
51
|
+
O && /* @__PURE__ */ a("input", {
|
|
52
|
+
type: "hidden",
|
|
53
|
+
name: O,
|
|
54
|
+
value: typeof S == "string" ? S : "",
|
|
55
|
+
readOnly: !0
|
|
56
|
+
}),
|
|
57
|
+
/* @__PURE__ */ a(t, {
|
|
58
|
+
label: w,
|
|
59
|
+
labelPosition: T,
|
|
60
|
+
error: E,
|
|
61
|
+
required: D,
|
|
62
|
+
children: /* @__PURE__ */ o("div", {
|
|
63
|
+
className: "timePicker__field",
|
|
64
|
+
children: [/* @__PURE__ */ a(_, {
|
|
65
|
+
...k,
|
|
66
|
+
value: S,
|
|
67
|
+
onChange: C,
|
|
68
|
+
locale: L,
|
|
69
|
+
required: D,
|
|
70
|
+
disableClock: !0,
|
|
71
|
+
clearIcon: /* @__PURE__ */ a(d, { size: 14 })
|
|
72
|
+
}), !v.isMobile && /* @__PURE__ */ a(e, {
|
|
73
|
+
type: "button",
|
|
74
|
+
variant: "text",
|
|
75
|
+
onClick: () => I((e) => !e),
|
|
76
|
+
"aria-label": F ? "Hide time picker" : "Show time picker",
|
|
77
|
+
"aria-pressed": F,
|
|
78
|
+
disabled: i.disabled,
|
|
79
|
+
className: "input-view-toggle",
|
|
80
|
+
children: a(F ? l : u, { size: 16 })
|
|
81
|
+
})]
|
|
82
|
+
})
|
|
83
|
+
}),
|
|
84
|
+
!v.isMobile && /* @__PURE__ */ a(r, {
|
|
85
|
+
value: S,
|
|
86
|
+
onChange: (e) => C?.(e),
|
|
87
|
+
locale: L,
|
|
88
|
+
labels: y,
|
|
89
|
+
format: x,
|
|
90
|
+
visible: F,
|
|
91
|
+
floatingRef: N,
|
|
92
|
+
style: P
|
|
93
|
+
})
|
|
94
|
+
]
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
//#endregion
|
|
98
|
+
export { y as TimePicker };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
type TimePickerDisplayProps = {
|
|
3
|
+
value?: unknown;
|
|
4
|
+
onChange?: (val: string) => void;
|
|
5
|
+
locale?: Intl.LocalesArgument;
|
|
6
|
+
format?: 24 | 12;
|
|
7
|
+
labels?: {
|
|
8
|
+
hour?: string;
|
|
9
|
+
minute?: string;
|
|
10
|
+
};
|
|
11
|
+
visible?: boolean;
|
|
12
|
+
floatingRef?: (node: HTMLElement | null) => void;
|
|
13
|
+
style?: React.CSSProperties;
|
|
14
|
+
};
|
|
15
|
+
export declare const TimePickerDisplay: React.FC<TimePickerDisplayProps>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { getAmPmLabels as e, getUnitLabel as t, is24HourFormat as n, isEmpty as r } from "../../utilities/validations.esm.js";
|
|
2
|
+
import { padTime as i, parseTimeString as a, resolveLocale as o, resolveTimeFormat as s, to24Hour as c } from "./utilities.esm.js";
|
|
3
|
+
import { IosPickerItem as l } from "./TimePickerWheel.esm.js";
|
|
4
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
5
|
+
import "react";
|
|
6
|
+
//#region src/components/TimePicker/TimePickerDisplay.tsx
|
|
7
|
+
var f = (e, t) => e ? t : void 0, p = (p) => {
|
|
8
|
+
let { value: m, onChange: h, locale: g, format: _, labels: v, visible: y = !1, floatingRef: b, style: x } = p, S = o(g), [C, w] = a(m), T = !r(m), E = s(_, n(S)), D = +(E === 12), O = E === 12 ? e(S) : null, k = +(C >= 12), A = E === 12 ? (C % 12 + 11) % 12 : C;
|
|
9
|
+
return y ? /* @__PURE__ */ d("div", {
|
|
10
|
+
className: "timePicker__display",
|
|
11
|
+
ref: b,
|
|
12
|
+
style: x,
|
|
13
|
+
children: [
|
|
14
|
+
/* @__PURE__ */ u(l, {
|
|
15
|
+
slideCount: E,
|
|
16
|
+
perspective: "left",
|
|
17
|
+
loop: !0,
|
|
18
|
+
offset: D,
|
|
19
|
+
selectedIndex: f(T, A),
|
|
20
|
+
onSelect: (e) => {
|
|
21
|
+
let t = c(e + D, C >= 12, E === 12);
|
|
22
|
+
h?.(`${i(t)}:${i(w)}`);
|
|
23
|
+
},
|
|
24
|
+
label: t(S, "hour", v?.hour)
|
|
25
|
+
}),
|
|
26
|
+
/* @__PURE__ */ u(l, {
|
|
27
|
+
slideCount: 60,
|
|
28
|
+
perspective: "right",
|
|
29
|
+
loop: !0,
|
|
30
|
+
selectedIndex: f(T, w),
|
|
31
|
+
onSelect: (e) => {
|
|
32
|
+
h?.(`${i(C)}:${i(e)}`);
|
|
33
|
+
},
|
|
34
|
+
label: t(S, "minute", v?.minute)
|
|
35
|
+
}),
|
|
36
|
+
E === 12 && O && /* @__PURE__ */ u(l, {
|
|
37
|
+
slideCount: 2,
|
|
38
|
+
perspective: "center",
|
|
39
|
+
loop: !1,
|
|
40
|
+
slides: O,
|
|
41
|
+
selectedIndex: f(T, k),
|
|
42
|
+
onSelect: (e) => {
|
|
43
|
+
let t = e === 1;
|
|
44
|
+
if (t === C >= 12) return;
|
|
45
|
+
let n = t ? C + 12 : C - 12;
|
|
46
|
+
h?.(`${i(n)}:${i(w)}`);
|
|
47
|
+
},
|
|
48
|
+
label: ""
|
|
49
|
+
})
|
|
50
|
+
]
|
|
51
|
+
}) : null;
|
|
52
|
+
};
|
|
53
|
+
//#endregion
|
|
54
|
+
export { p as TimePickerDisplay };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export type IosPickerItemProps = {
|
|
3
|
+
loop?: boolean;
|
|
4
|
+
label: string;
|
|
5
|
+
slideCount: number;
|
|
6
|
+
perspective: "left" | "right" | "center";
|
|
7
|
+
offset?: number;
|
|
8
|
+
slides?: React.ReactNode[];
|
|
9
|
+
selectedIndex?: number;
|
|
10
|
+
onSelect?: (index: number) => void;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare const IosPickerItem: (props: IosPickerItemProps) => React.JSX.Element;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "./constants.esm.js";
|
|
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
|
+
//#region src/components/TimePicker/TimePickerWheel.tsx
|
|
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] = d({
|
|
11
|
+
loop: g,
|
|
12
|
+
axis: "y",
|
|
13
|
+
dragFree: !0,
|
|
14
|
+
containScroll: !1
|
|
15
|
+
}), w = u(null), T = u(b);
|
|
16
|
+
l(() => {
|
|
17
|
+
T.current = b;
|
|
18
|
+
});
|
|
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
|
+
});
|
|
23
|
+
}, [
|
|
24
|
+
g,
|
|
25
|
+
p,
|
|
26
|
+
D,
|
|
27
|
+
E
|
|
28
|
+
]);
|
|
29
|
+
return c(() => {
|
|
30
|
+
if (!C) return () => {};
|
|
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
|
+
};
|
|
35
|
+
}, [C, O]), c(() => {
|
|
36
|
+
!C || y === void 0 || C.selectedScrollSnap() !== y && C.scrollTo(y);
|
|
37
|
+
}, [C, y]), /* @__PURE__ */ o("div", {
|
|
38
|
+
className: i("ios-picker", { "ios-picker--disabled": x }),
|
|
39
|
+
"aria-disabled": x,
|
|
40
|
+
children: [/* @__PURE__ */ a("div", {
|
|
41
|
+
className: "ios-picker__scene",
|
|
42
|
+
ref: w,
|
|
43
|
+
children: /* @__PURE__ */ a("div", {
|
|
44
|
+
className: `ios-picker__viewport ios-picker__viewport--perspective-${m}`,
|
|
45
|
+
ref: S,
|
|
46
|
+
children: /* @__PURE__ */ a("div", {
|
|
47
|
+
className: "ios-picker__container",
|
|
48
|
+
children: Array.from({ length: p }, (e, t) => /* @__PURE__ */ a("div", {
|
|
49
|
+
className: "ios-picker__slide",
|
|
50
|
+
children: v ? v[t] : t + _
|
|
51
|
+
}, t))
|
|
52
|
+
})
|
|
53
|
+
})
|
|
54
|
+
}), /* @__PURE__ */ a("div", {
|
|
55
|
+
className: "ios-picker__label",
|
|
56
|
+
children: h
|
|
57
|
+
})]
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
//#endregion
|
|
61
|
+
export { f as IosPickerItem };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const CIRCLE_DEGREES = 360;
|
|
2
|
+
export declare const WHEEL_ITEM_SIZE = 32;
|
|
3
|
+
export declare const WHEEL_ITEM_COUNT = 18;
|
|
4
|
+
export declare const WHEEL_ITEMS_IN_VIEW = 4;
|
|
5
|
+
export declare const WHEEL_ITEM_RADIUS: number;
|
|
6
|
+
export declare const IN_VIEW_DEGREES: number;
|
|
7
|
+
export declare const WHEEL_RADIUS: number;
|