@stamcat/craftsman 0.0.56 → 0.0.59
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/Utilities.esm.js +2 -2
- package/package.json +1 -1
- package/src/components/Text/Text.d.ts +1 -2
- package/src/components/Text/Text.esm.js +8 -2
- package/src/styles/utilities/layout.esm.js +21 -23
- package/src/utilities/types.d.ts +17 -17
- package/src/utilities/validations.d.ts +2 -0
- package/src/utilities/validations.esm.js +7 -2
package/Utilities.esm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { formatTime as e, getAmPmLabels as t, getUnitLabel as n, is24HourFormat as r, isEmpty as i,
|
|
2
|
-
export { e as formatTime, t as getAmPmLabels, n as getUnitLabel, r as is24HourFormat, i as isEmpty, a as validateEmail };
|
|
1
|
+
import { formatTime as e, getAmPmLabels as t, getUnitLabel as n, is24HourFormat as r, isEmpty as i, toCssString as a, validateEmail as o } from "./src/utilities/validations.esm.js";
|
|
2
|
+
export { e as formatTime, t as getAmPmLabels, n as getUnitLabel, r as is24HourFormat, i as isEmpty, a as toCssString, o as validateEmail };
|
package/package.json
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { TextSize } from '
|
|
2
|
-
import { TextTags, TextType } from '../../utilities/types';
|
|
1
|
+
import { TextSize, TextTags, TextType } from '../../utilities/types';
|
|
3
2
|
export type TextProps = React.HTMLAttributes<HTMLElement> & {
|
|
4
3
|
as?: TextTags;
|
|
5
4
|
richText?: boolean;
|
|
@@ -6,11 +6,17 @@ import n from "dompurify";
|
|
|
6
6
|
var r = ({ as: r = "div", children: i, type: a, size: o, className: s, alignment: c, richText: l, ...u }) => {
|
|
7
7
|
let d = e(a && a, o && o, c && c, "text", s);
|
|
8
8
|
if (l) {
|
|
9
|
-
let e =
|
|
9
|
+
let e = { ADD_ATTR: ["target"] };
|
|
10
|
+
if (typeof i != "string") return /* @__PURE__ */ t("div", {
|
|
11
|
+
...u,
|
|
12
|
+
className: d,
|
|
13
|
+
children: i
|
|
14
|
+
});
|
|
15
|
+
let r = n.sanitize(i, e);
|
|
10
16
|
return /* @__PURE__ */ t("div", {
|
|
11
17
|
...u,
|
|
12
18
|
className: d,
|
|
13
|
-
dangerouslySetInnerHTML: { __html:
|
|
19
|
+
dangerouslySetInnerHTML: { __html: r || "" }
|
|
14
20
|
});
|
|
15
21
|
}
|
|
16
22
|
return /* @__PURE__ */ t(r, {
|
|
@@ -1,50 +1,48 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { toCssString as e } from "../../utilities/validations.esm.js";
|
|
2
|
+
import { LayoutWidthsSchema as t } from "../../utilities/types.esm.js";
|
|
3
|
+
import { defaultWidths as n } from "./constants.esm.js";
|
|
3
4
|
//#region src/styles/utilities/layout.ts
|
|
4
|
-
var
|
|
5
|
+
var r = Object.fromEntries(t.options.map((e) => [e, `var(--w-${e}, ${n[e]}px)`])), i = {
|
|
5
6
|
get mobile() {
|
|
6
7
|
return "(min-width: 0px)";
|
|
7
8
|
},
|
|
8
9
|
get mobileMax() {
|
|
9
|
-
return `(max-width: ${
|
|
10
|
+
return `(max-width: ${n.mobileMax}px)`;
|
|
10
11
|
},
|
|
11
12
|
get tablet() {
|
|
12
|
-
return `(min-width: ${
|
|
13
|
+
return `(min-width: ${n.tablet}px)`;
|
|
13
14
|
},
|
|
14
15
|
get tabletMax() {
|
|
15
|
-
return `(max-width: ${
|
|
16
|
+
return `(max-width: ${n.tabletMax}px)`;
|
|
16
17
|
},
|
|
17
18
|
get desktop() {
|
|
18
|
-
return `(min-width: ${
|
|
19
|
+
return `(min-width: ${n.desktop}px)`;
|
|
19
20
|
},
|
|
20
21
|
get desktopMax() {
|
|
21
|
-
return `(max-width: ${
|
|
22
|
+
return `(max-width: ${n.desktopMax}px)`;
|
|
22
23
|
},
|
|
23
24
|
get extDesktop() {
|
|
24
|
-
return `(min-width: ${
|
|
25
|
+
return `(min-width: ${n.extDesktop}px)`;
|
|
25
26
|
},
|
|
26
27
|
get mobileOnly() {
|
|
27
|
-
return `(min-width: 0px) and (max-width: ${
|
|
28
|
+
return `(min-width: 0px) and (max-width: ${n.mobileMax}px)`;
|
|
28
29
|
},
|
|
29
30
|
get tabletOnly() {
|
|
30
|
-
return `(min-width: ${
|
|
31
|
+
return `(min-width: ${n.tablet}px) and (max-width: ${n.tabletMax}px)`;
|
|
31
32
|
},
|
|
32
33
|
get mobileTablet() {
|
|
33
|
-
return `(min-width: 0px) and (max-width: ${
|
|
34
|
+
return `(min-width: 0px) and (max-width: ${n.tabletMax}px)`;
|
|
34
35
|
},
|
|
35
36
|
get desktopOnly() {
|
|
36
|
-
return `(min-width: ${
|
|
37
|
+
return `(min-width: ${n.desktop}px) and (max-width: ${n.desktopMax}px)`;
|
|
37
38
|
}
|
|
38
|
-
},
|
|
39
|
-
let i =
|
|
39
|
+
}, a = (e, t = 1, n = !0) => {
|
|
40
|
+
let i = r[e];
|
|
40
41
|
if (e === "column") {
|
|
41
|
-
let e = t - 1, a = `calc((${i} * ${t}) + (${
|
|
42
|
-
return
|
|
42
|
+
let e = t - 1, a = `calc((${i} * ${t}) + (${r.gutter} * ${e}))`;
|
|
43
|
+
return n ? a : `calc(((${i} / 1px) * ${t}) + ((${r.gutter} / 1px) * ${e}))`;
|
|
43
44
|
}
|
|
44
|
-
return
|
|
45
|
-
},
|
|
46
|
-
let n = String(t);
|
|
47
|
-
return `@media ${r[e]} { ${typeof t == "string" ? n : t} }`;
|
|
48
|
-
};
|
|
45
|
+
return n ? t === 1 ? i : `calc(${i} * ${t})` : t === 1 ? `calc(${i} / 1px)` : `calc((${i} / 1px) * ${t})`;
|
|
46
|
+
}, o = (t, n) => `@media ${i[t]} { ${e(n)} }`;
|
|
49
47
|
//#endregion
|
|
50
|
-
export {
|
|
48
|
+
export { o as breakpoint, i as media, a as width, r as widths };
|
package/src/utilities/types.d.ts
CHANGED
|
@@ -26,7 +26,6 @@ export declare const BreakpointSchema: z.ZodEnum<{
|
|
|
26
26
|
desktopOnly: "desktopOnly";
|
|
27
27
|
}>;
|
|
28
28
|
export declare const LayoutWidthsSchema: z.ZodEnum<{
|
|
29
|
-
text: "text";
|
|
30
29
|
gutter: "gutter";
|
|
31
30
|
column: "column";
|
|
32
31
|
tablet: "tablet";
|
|
@@ -35,6 +34,7 @@ export declare const LayoutWidthsSchema: z.ZodEnum<{
|
|
|
35
34
|
mobileMax: "mobileMax";
|
|
36
35
|
tabletMax: "tabletMax";
|
|
37
36
|
desktopMax: "desktopMax";
|
|
37
|
+
text: "text";
|
|
38
38
|
}>;
|
|
39
39
|
export type BaseWidth = z.infer<typeof BaseWidthSchema>;
|
|
40
40
|
export type ScreenWidth = z.infer<typeof ScreenWidthSchema>;
|
|
@@ -57,25 +57,25 @@ export type TextInputExclusions = z.infer<typeof zTextInputExclusions>;
|
|
|
57
57
|
export declare const zTextInputTypes: readonly ["color", "date", "datetime-local", "email", "file", "hidden", "image", "month", "number", "password", "range", "reset", "search", "submit", "tel", "text", "time", "url", "week", "radio", "checkbox"];
|
|
58
58
|
export declare const zTextInputType: z.ZodEnum<{
|
|
59
59
|
number: "number";
|
|
60
|
-
search: "search";
|
|
61
|
-
month: "month";
|
|
62
|
-
time: "time";
|
|
63
|
-
image: "image";
|
|
64
60
|
text: "text";
|
|
65
|
-
hidden: "hidden";
|
|
66
|
-
color: "color";
|
|
67
61
|
checkbox: "checkbox";
|
|
68
62
|
radio: "radio";
|
|
69
|
-
|
|
70
|
-
url: "url";
|
|
71
|
-
email: "email";
|
|
63
|
+
color: "color";
|
|
72
64
|
date: "date";
|
|
73
|
-
submit: "submit";
|
|
74
|
-
reset: "reset";
|
|
75
65
|
"datetime-local": "datetime-local";
|
|
66
|
+
email: "email";
|
|
76
67
|
file: "file";
|
|
68
|
+
hidden: "hidden";
|
|
69
|
+
image: "image";
|
|
70
|
+
month: "month";
|
|
77
71
|
password: "password";
|
|
78
72
|
range: "range";
|
|
73
|
+
reset: "reset";
|
|
74
|
+
search: "search";
|
|
75
|
+
submit: "submit";
|
|
76
|
+
tel: "tel";
|
|
77
|
+
time: "time";
|
|
78
|
+
url: "url";
|
|
79
79
|
week: "week";
|
|
80
80
|
}>;
|
|
81
81
|
export type TextInputType = z.infer<typeof zTextInputType>;
|
|
@@ -116,7 +116,6 @@ export declare const ButtonType: z.ZodEnum<{
|
|
|
116
116
|
}>;
|
|
117
117
|
export type ButtonType = z.infer<typeof ButtonType>;
|
|
118
118
|
export declare const TextTags: z.ZodEnum<{
|
|
119
|
-
div: "div";
|
|
120
119
|
h1: "h1";
|
|
121
120
|
h2: "h2";
|
|
122
121
|
h3: "h3";
|
|
@@ -124,21 +123,22 @@ export declare const TextTags: z.ZodEnum<{
|
|
|
124
123
|
h5: "h5";
|
|
125
124
|
p: "p";
|
|
126
125
|
span: "span";
|
|
126
|
+
div: "div";
|
|
127
127
|
}>;
|
|
128
128
|
export type TextTags = z.infer<typeof TextTags>;
|
|
129
129
|
export declare const TextType: z.ZodEnum<{
|
|
130
|
-
caption: "caption";
|
|
131
|
-
heading: "heading";
|
|
132
130
|
display: "display";
|
|
131
|
+
heading: "heading";
|
|
133
132
|
paragraph: "paragraph";
|
|
133
|
+
caption: "caption";
|
|
134
134
|
"small-title": "small-title";
|
|
135
135
|
}>;
|
|
136
136
|
export type TextType = z.infer<typeof TextType>;
|
|
137
137
|
export declare const TextSize: z.ZodEnum<{
|
|
138
|
-
small: "small";
|
|
139
138
|
xlarge: "xlarge";
|
|
140
139
|
large: "large";
|
|
141
140
|
medium: "medium";
|
|
141
|
+
small: "small";
|
|
142
142
|
xsmall: "xsmall";
|
|
143
143
|
}>;
|
|
144
144
|
export type TextSize = z.infer<typeof TextSize>;
|
|
@@ -148,10 +148,10 @@ export declare const CarouselPageType: z.ZodEnum<{
|
|
|
148
148
|
}>;
|
|
149
149
|
export type CarouselPageType = z.infer<typeof CarouselPageType>;
|
|
150
150
|
export declare const NoticeType: z.ZodEnum<{
|
|
151
|
-
none: "none";
|
|
152
151
|
help: "help";
|
|
153
152
|
info: "info";
|
|
154
153
|
success: "success";
|
|
155
154
|
error: "error";
|
|
155
|
+
none: "none";
|
|
156
156
|
}>;
|
|
157
157
|
export type NoticeType = z.infer<typeof NoticeType>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { DateTimePickerProps } from 'react-datetime-picker';
|
|
2
|
+
import { SerializedStyles } from './types';
|
|
2
3
|
export declare function isEmpty(value: unknown): boolean;
|
|
3
4
|
export declare function validateEmail(value: string): boolean;
|
|
4
5
|
export declare const getUnitLabel: (locale: Intl.LocalesArgument, unit: Intl.NumberFormatOptions["unit"], override?: string) => string;
|
|
5
6
|
export declare const is24HourFormat: (locale: Intl.LocalesArgument) => boolean;
|
|
6
7
|
export declare const getAmPmLabels: (locale: Intl.LocalesArgument) => [string, string];
|
|
7
8
|
export declare const formatTime: (value: DateTimePickerProps["value"], locale: Intl.LocalesArgument) => string;
|
|
9
|
+
export declare const toCssString: (styles: string | SerializedStyles) => string;
|
|
@@ -22,6 +22,11 @@ var n = (e, t, n) => n ?? new Intl.NumberFormat(e, {
|
|
|
22
22
|
hour: "2-digit",
|
|
23
23
|
minute: "2-digit",
|
|
24
24
|
hour12: !1
|
|
25
|
-
}).format(e) : "--:--"
|
|
25
|
+
}).format(e) : "--:--", o = (e) => {
|
|
26
|
+
if (typeof e == "string") return String(e);
|
|
27
|
+
let t = "", n = e;
|
|
28
|
+
for (; n;) t = n.styles + t, n = n.next;
|
|
29
|
+
return t;
|
|
30
|
+
};
|
|
26
31
|
//#endregion
|
|
27
|
-
export { a as formatTime, i as getAmPmLabels, n as getUnitLabel, r as is24HourFormat, e as isEmpty, t as validateEmail };
|
|
32
|
+
export { a as formatTime, i as getAmPmLabels, n as getUnitLabel, r as is24HourFormat, e as isEmpty, o as toCssString, t as validateEmail };
|