@stamcat/craftsman 0.0.27-alpha.12 → 0.0.27-alpha.14
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 +1 -1
- package/Utilities.esm.js +2 -2
- package/package.json +2 -1
- package/src/components/TimePicker/TimePicker.d.ts +4 -0
- package/src/components/TimePicker/TimePicker.scss +27 -21
- package/src/components/TimePicker/TimePickerDisplay.d.ts +6 -1
- package/src/components/TimePicker/utilities.d.ts +1 -0
- package/src/utilities/validations.d.ts +2 -1
- package/src/utilities/validations.esm.js +7 -4
package/AGENTS.md
CHANGED
|
@@ -750,7 +750,7 @@ Sass usage (framework source):
|
|
|
750
750
|
1. Hook calls (`useSomething`)
|
|
751
751
|
2. State (`useState`)
|
|
752
752
|
3. Derived state / variables (values computed from state or props)
|
|
753
|
-
4. Action handlers (`const handle*`, `const dispatch
|
|
753
|
+
4. Action handlers (`const handle*`, `const dispatch*`, `useEffect`)
|
|
754
754
|
|
|
755
755
|
## Known Limitations (Current Package State)
|
|
756
756
|
|
package/Utilities.esm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { getAmPmLabels as e, getUnitLabel as t, is24HourFormat as n, isEmpty as r,
|
|
2
|
-
export { e as getAmPmLabels, t as getUnitLabel, n as is24HourFormat, r as isEmpty, i as validateEmail };
|
|
1
|
+
import { getAmPmLabels as e, getUnitLabel as t, is24HourFormat as n, isEmpty as r, isTouchDevice as i, validateEmail as a } from "./src/utilities/validations.esm.js";
|
|
2
|
+
export { e as getAmPmLabels, t as getUnitLabel, n as is24HourFormat, r as isEmpty, i as isTouchDevice, a as validateEmail };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stamcat/craftsman",
|
|
3
|
-
"version": "0.0.27-alpha.
|
|
3
|
+
"version": "0.0.27-alpha.14",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A powerful, lightweight framework for design systems",
|
|
6
6
|
"repository": {
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"prepublishOnly": "node ./scripts/prepublishCheck.js"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
+
"@floating-ui/react-dom": "2.1.9",
|
|
26
27
|
"clsx": "2.1.1",
|
|
27
28
|
"dompurify": "3.4.13",
|
|
28
29
|
"embla-carousel-react": "8.6.0",
|
|
@@ -3,6 +3,10 @@ import { LabeledInput } from '../Input/InputWrapper';
|
|
|
3
3
|
type PropType = Omit<React.ComponentProps<"input">, "type"> & LabeledInput & {
|
|
4
4
|
locale?: Intl.LocalesArgument;
|
|
5
5
|
format?: 24 | 12;
|
|
6
|
+
labels?: {
|
|
7
|
+
hour?: "string";
|
|
8
|
+
minute?: "string";
|
|
9
|
+
};
|
|
6
10
|
};
|
|
7
11
|
export declare const TimePicker: (props: PropType) => React.JSX.Element;
|
|
8
12
|
export {};
|
|
@@ -1,32 +1,15 @@
|
|
|
1
1
|
@use "../../styles/utilities/functions" as u;
|
|
2
2
|
|
|
3
3
|
@layer craftsman-base {
|
|
4
|
-
.timePicker__display {
|
|
5
|
-
display: inline-flex;
|
|
6
|
-
align-items: center;
|
|
7
|
-
gap: 2px;
|
|
8
|
-
border: 1px solid #{u.color("gray400")};
|
|
9
|
-
border-radius: 4px;
|
|
10
|
-
padding: #{u.width("gutter", 0.25)} 30px #{u.width("gutter", 0.25)} #{u.width("gutter", 0.5)};
|
|
11
|
-
position: relative;
|
|
12
|
-
input, select {
|
|
13
|
-
border: none;
|
|
14
|
-
padding: #{u.width("gutter", 0.25)};
|
|
15
|
-
}
|
|
16
|
-
select::picker-icon {
|
|
17
|
-
display: none;
|
|
18
|
-
}
|
|
19
|
-
.input-view-toggle {
|
|
20
|
-
position: absolute;
|
|
21
|
-
right: #{u.width("gutter", 0.5)};
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
4
|
|
|
25
5
|
.timePicker {
|
|
26
6
|
position: relative;
|
|
27
7
|
display: inline-flex;
|
|
28
8
|
height: 160px;
|
|
29
|
-
|
|
9
|
+
background-color: #{u.color("white")};
|
|
10
|
+
border: 1px solid #{u.color("gray400")};
|
|
11
|
+
border-radius: 8px;
|
|
12
|
+
z-index: 1;
|
|
30
13
|
&:before,
|
|
31
14
|
&:after {
|
|
32
15
|
position: absolute;
|
|
@@ -58,6 +41,28 @@
|
|
|
58
41
|
rgba(var(--background-site-rgb-value), 1) 100%
|
|
59
42
|
);
|
|
60
43
|
}
|
|
44
|
+
&__display {
|
|
45
|
+
display: inline-flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
gap: 2px;
|
|
48
|
+
background-color: white;
|
|
49
|
+
border: 1px solid #{u.color("gray400")};
|
|
50
|
+
border-radius: 4px;
|
|
51
|
+
padding: #{u.width("gutter", 0.25)} 30px #{u.width("gutter", 0.25)} #{u.width("gutter", 0.5)};
|
|
52
|
+
position: relative;
|
|
53
|
+
z-index: 1;
|
|
54
|
+
input, select {
|
|
55
|
+
border: none;
|
|
56
|
+
padding: #{u.width("gutter", 0.25)};
|
|
57
|
+
}
|
|
58
|
+
select::picker-icon {
|
|
59
|
+
display: none;
|
|
60
|
+
}
|
|
61
|
+
.input-view-toggle {
|
|
62
|
+
position: absolute;
|
|
63
|
+
right: #{u.width("gutter", 0.5)};
|
|
64
|
+
}
|
|
65
|
+
}
|
|
61
66
|
|
|
62
67
|
.ios-picker {
|
|
63
68
|
height: 100%;
|
|
@@ -135,4 +140,5 @@
|
|
|
135
140
|
pointer-events: none;
|
|
136
141
|
}
|
|
137
142
|
}
|
|
143
|
+
|
|
138
144
|
}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
type TimePickerDisplayProps = {
|
|
2
2
|
hours: number;
|
|
3
3
|
minutes: number;
|
|
4
|
-
|
|
4
|
+
hourHasValue: boolean;
|
|
5
|
+
minuteHasValue: boolean;
|
|
5
6
|
isReadOnly: boolean;
|
|
6
7
|
timeFormat: 12 | 24;
|
|
7
8
|
amPmLabels: string[] | null;
|
|
8
9
|
visible: boolean;
|
|
9
10
|
onToggleVisible: () => void;
|
|
11
|
+
onClear: {
|
|
12
|
+
hour: () => void;
|
|
13
|
+
minute: () => void;
|
|
14
|
+
};
|
|
10
15
|
onChange: {
|
|
11
16
|
hour: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
12
17
|
minute: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
@@ -4,6 +4,7 @@ export declare const padTime: (n: number) => string;
|
|
|
4
4
|
export declare const toDisplayHour: (hours: number, is12h: boolean) => number;
|
|
5
5
|
export declare const to24Hour: (display: number, isPM: boolean, is12h: boolean) => number;
|
|
6
6
|
export declare const resolveLocale: (locale?: Intl.LocalesArgument) => string;
|
|
7
|
+
export declare const resolveTimeFormat: (format: 24 | 12 | undefined, is24h: boolean) => 24 | 12;
|
|
7
8
|
export declare const isInView: (wheelLocation: number, slidePosition: number) => boolean;
|
|
8
9
|
export declare const setSlideStyles: (emblaApi: EmblaCarouselType, index: number, loop: boolean, slideCount: number, totalRadius: number) => void;
|
|
9
10
|
export declare const setContainerStyles: (emblaApi: EmblaCarouselType, wheelRotation: number) => void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare function isEmpty(value: unknown): boolean;
|
|
2
2
|
export declare function validateEmail(value: string): boolean;
|
|
3
|
-
export declare
|
|
3
|
+
export declare function isTouchDevice(): boolean;
|
|
4
|
+
export declare const getUnitLabel: (locale: Intl.LocalesArgument, unit: Intl.NumberFormatOptions["unit"], override?: string) => string;
|
|
4
5
|
export declare const is24HourFormat: (locale: Intl.LocalesArgument) => boolean;
|
|
5
6
|
export declare const getAmPmLabels: (locale: Intl.LocalesArgument) => [string, string];
|
|
@@ -5,14 +5,17 @@ function e(e) {
|
|
|
5
5
|
function t(e) {
|
|
6
6
|
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e);
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
function n() {
|
|
9
|
+
return typeof window < "u" && window.matchMedia("(pointer: coarse)").matches;
|
|
10
|
+
}
|
|
11
|
+
var r = (e, t, n) => n ?? new Intl.NumberFormat(e, {
|
|
9
12
|
style: "unit",
|
|
10
13
|
unit: t,
|
|
11
14
|
unitDisplay: "long"
|
|
12
|
-
}).formatToParts(1).find((e) => e.type === "unit")?.value ?? String(t),
|
|
15
|
+
}).formatToParts(1).find((e) => e.type === "unit")?.value ?? String(t), i = (e) => {
|
|
13
16
|
let t = new Intl.DateTimeFormat(e, { hour: "numeric" }).resolvedOptions();
|
|
14
17
|
return t.hourCycle === "h23" || t.hourCycle === "h24";
|
|
15
|
-
},
|
|
18
|
+
}, a = (e) => {
|
|
16
19
|
let t = new Intl.DateTimeFormat(e, {
|
|
17
20
|
hour: "numeric",
|
|
18
21
|
hour12: !0
|
|
@@ -20,4 +23,4 @@ var n = (e, t) => new Intl.NumberFormat(e, {
|
|
|
20
23
|
return [t.formatToParts(new Date(2e3, 0, 1, 9)).find((e) => e.type === "dayPeriod")?.value ?? "AM", t.formatToParts(new Date(2e3, 0, 1, 21)).find((e) => e.type === "dayPeriod")?.value ?? "PM"];
|
|
21
24
|
};
|
|
22
25
|
//#endregion
|
|
23
|
-
export {
|
|
26
|
+
export { a as getAmPmLabels, r as getUnitLabel, i as is24HourFormat, e as isEmpty, n as isTouchDevice, t as validateEmail };
|