@regardio/react 0.5.7 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/background-slideshow/index.d.mts +34 -0
- package/dist/background-slideshow/index.mjs +110 -0
- package/dist/blurry-gradient/index.d.mts +16 -0
- package/dist/blurry-gradient/index.mjs +93 -0
- package/dist/button/index.d.mts +2 -0
- package/dist/button/index.mjs +3 -0
- package/dist/button-BiSQpBbc.mjs +129 -0
- package/dist/carousel/index.d.mts +74 -0
- package/dist/carousel/index.mjs +136 -0
- package/dist/checkbox/index.d.mts +28 -0
- package/dist/checkbox/index.mjs +70 -0
- package/dist/checkbox-group/index.d.mts +16 -0
- package/dist/checkbox-group/index.mjs +29 -0
- package/dist/chunk-BTpB_u-K.mjs +18 -0
- package/dist/countdown/index.d.mts +4 -0
- package/dist/countdown/index.mjs +58 -0
- package/dist/field/index.d.mts +68 -0
- package/dist/field/index.mjs +115 -0
- package/dist/fieldset/index.d.mts +34 -0
- package/dist/fieldset/index.mjs +61 -0
- package/dist/form/index.d.mts +21 -0
- package/dist/form/index.mjs +31 -0
- package/dist/generic-error/index.d.mts +44 -0
- package/dist/generic-error/index.mjs +57 -0
- package/dist/grid/index.d.mts +101 -0
- package/dist/grid/index.mjs +219 -0
- package/dist/heading/index.d.mts +27 -0
- package/dist/heading/index.mjs +28 -0
- package/dist/highlight/index.d.mts +17 -0
- package/dist/highlight/index.mjs +35 -0
- package/dist/hooks/use-current-route-data.d.mts +8 -0
- package/dist/hooks/use-current-route-data.mjs +22 -0
- package/dist/hooks/{use-focus-search.d.ts → use-focus-search.d.mts} +4 -3
- package/dist/hooks/use-focus-search.mjs +23 -0
- package/dist/hooks/use-matches-data.d.mts +10 -0
- package/dist/hooks/use-matches-data.mjs +23 -0
- package/dist/hooks/use-media-query.d.mts +9 -0
- package/dist/hooks/use-media-query.mjs +28 -0
- package/dist/hooks/use-mobile.d.mts +4 -0
- package/dist/hooks/use-mobile.mjs +22 -0
- package/dist/hooks/use-nonce.d.mts +6 -0
- package/dist/hooks/use-nonce.mjs +13 -0
- package/dist/hooks/use-orientation.d.mts +12 -0
- package/dist/hooks/use-orientation.mjs +32 -0
- package/dist/hooks/use-user.d.mts +53 -0
- package/dist/hooks/use-user.mjs +39 -0
- package/dist/icon-button/index.d.mts +28 -0
- package/dist/icon-button/index.mjs +36 -0
- package/dist/if/index.d.mts +13 -0
- package/dist/if/index.mjs +21 -0
- package/dist/iframe/index.d.mts +11 -0
- package/dist/iframe/index.mjs +15 -0
- package/dist/index-Bj5_XfEC.d.mts +29 -0
- package/dist/index-C_evL5vG.d.mts +35 -0
- package/dist/input/index.d.mts +2 -0
- package/dist/input/index.mjs +3 -0
- package/dist/input-CtR6aRVi.mjs +73 -0
- package/dist/link/index.d.mts +71 -0
- package/dist/link/index.mjs +129 -0
- package/dist/list/index.d.mts +72 -0
- package/dist/list/index.mjs +54 -0
- package/dist/markdown-container/index.d.mts +23 -0
- package/dist/markdown-container/index.mjs +71 -0
- package/dist/password-input/index.d.mts +23 -0
- package/dist/password-input/index.mjs +92 -0
- package/dist/picture/index.d.mts +39 -0
- package/dist/picture/index.mjs +3 -0
- package/dist/picture-DkX3W5zl.mjs +69 -0
- package/dist/protected-email/index.d.mts +24 -0
- package/dist/protected-email/index.mjs +37 -0
- package/dist/radio/index.d.mts +28 -0
- package/dist/radio/index.mjs +72 -0
- package/dist/radio-group/index.d.mts +16 -0
- package/dist/radio-group/index.mjs +29 -0
- package/dist/slider/index.d.mts +63 -0
- package/dist/slider/index.mjs +133 -0
- package/dist/switch/index.d.mts +29 -0
- package/dist/switch/index.mjs +87 -0
- package/dist/text/index.d.mts +25 -0
- package/dist/text/index.mjs +32 -0
- package/dist/text-EQC4zJbE.mjs +52 -0
- package/dist/toggle/index.d.mts +25 -0
- package/dist/toggle/index.mjs +82 -0
- package/dist/utils/author/index.d.mts +4 -0
- package/dist/utils/author/index.mjs +26 -0
- package/dist/utils/text/{index.d.ts → index.d.mts} +9 -8
- package/dist/utils/text/index.mjs +3 -0
- package/package.json +131 -83
- package/src/background-slideshow/background-slideshow.tsx +1 -2
- package/src/blurry-gradient/blurry-gradient.tsx +1 -1
- package/src/button/button.stories.tsx +161 -0
- package/src/button/button.test.tsx +73 -0
- package/src/button/button.tsx +118 -0
- package/src/button/index.ts +2 -0
- package/src/carousel/carousel-content.tsx +17 -14
- package/src/carousel/carousel-item.tsx +18 -18
- package/src/carousel/carousel-next.tsx +22 -17
- package/src/carousel/carousel-previous.tsx +22 -17
- package/src/carousel/carousel-root.tsx +91 -86
- package/src/checkbox/checkbox.stories.tsx +118 -0
- package/src/checkbox/checkbox.tsx +102 -0
- package/src/checkbox/index.ts +2 -0
- package/src/checkbox-group/checkbox-group.tsx +40 -0
- package/src/checkbox-group/index.ts +2 -0
- package/src/countdown/countdown.tsx +1 -1
- package/src/field/field.stories.tsx +105 -0
- package/src/field/field.test.tsx +61 -0
- package/src/field/field.tsx +186 -0
- package/src/field/index.ts +12 -0
- package/src/fieldset/fieldset.stories.tsx +204 -0
- package/src/fieldset/fieldset.test.tsx +63 -0
- package/src/fieldset/fieldset.tsx +86 -0
- package/src/fieldset/index.ts +7 -0
- package/src/form/form.stories.tsx +230 -0
- package/src/form/form.test.tsx +68 -0
- package/src/form/form.tsx +38 -0
- package/src/form/index.ts +2 -0
- package/src/generic-error/generic-error.tsx +2 -3
- package/src/grid/grid-item.tsx +77 -36
- package/src/grid/grid-root.tsx +49 -22
- package/src/heading/heading.tsx +7 -3
- package/src/highlight/highlight.tsx +1 -1
- package/src/hooks/use-current-route-data.ts +4 -2
- package/src/hooks/use-focus-search.ts +3 -1
- package/src/hooks/use-matches-data.ts +2 -0
- package/src/hooks/use-media-query.ts +2 -0
- package/src/hooks/use-mobile.ts +3 -1
- package/src/hooks/use-nonce.ts +3 -3
- package/src/hooks/use-orientation.ts +2 -0
- package/src/hooks/use-user.tsx +3 -2
- package/src/icon-button/icon-button.stories.tsx +128 -7
- package/src/icon-button/icon-button.test.tsx +152 -0
- package/src/icon-button/icon-button.tsx +43 -9
- package/src/if/if.tsx +3 -1
- package/src/input/index.ts +2 -0
- package/src/input/input.stories.tsx +151 -0
- package/src/input/input.test.tsx +65 -0
- package/src/input/input.tsx +113 -0
- package/src/link/link.tsx +4 -3
- package/src/list/list-item.tsx +10 -13
- package/src/list/list-root-context.ts +3 -3
- package/src/list/list-root.tsx +10 -13
- package/src/password-input/index.ts +1 -1
- package/src/password-input/password-input.tsx +104 -27
- package/src/protected-email/protected-email.tsx +6 -1
- package/src/radio/index.ts +2 -0
- package/src/radio/radio.tsx +103 -0
- package/src/radio-group/index.ts +2 -0
- package/src/radio-group/radio-group.tsx +40 -0
- package/src/slider/index.ts +18 -0
- package/src/slider/slider.tsx +201 -0
- package/src/switch/index.ts +2 -0
- package/src/switch/switch.stories.tsx +118 -0
- package/src/switch/switch.tsx +112 -0
- package/src/text/text.tsx +6 -1
- package/src/toggle/index.ts +2 -0
- package/src/toggle/toggle.stories.tsx +232 -0
- package/src/toggle/toggle.test.tsx +149 -0
- package/src/toggle/toggle.tsx +88 -0
- package/src/utils/text/text.tsx +8 -16
- package/dist/background-slideshow/index.d.ts +0 -24
- package/dist/background-slideshow/index.js +0 -165
- package/dist/blurry-gradient/index.d.ts +0 -16
- package/dist/blurry-gradient/index.js +0 -128
- package/dist/carousel/index.d.ts +0 -36
- package/dist/carousel/index.js +0 -171
- package/dist/countdown/index.d.ts +0 -5
- package/dist/countdown/index.js +0 -73
- package/dist/generic-error/index.d.ts +0 -43
- package/dist/generic-error/index.js +0 -47
- package/dist/grid/index.d.ts +0 -1196
- package/dist/grid/index.js +0 -239
- package/dist/heading/index.d.ts +0 -24
- package/dist/heading/index.js +0 -99
- package/dist/highlight/index.d.ts +0 -13
- package/dist/highlight/index.js +0 -59
- package/dist/hooks/use-current-route-data.d.ts +0 -7
- package/dist/hooks/use-current-route-data.js +0 -16
- package/dist/hooks/use-focus-search.js +0 -19
- package/dist/hooks/use-matches-data.d.ts +0 -9
- package/dist/hooks/use-matches-data.js +0 -15
- package/dist/hooks/use-media-query.d.ts +0 -8
- package/dist/hooks/use-media-query.js +0 -20
- package/dist/hooks/use-mobile.d.ts +0 -3
- package/dist/hooks/use-mobile.js +0 -19
- package/dist/hooks/use-nonce.d.ts +0 -7
- package/dist/hooks/use-nonce.js +0 -8
- package/dist/hooks/use-orientation.d.ts +0 -11
- package/dist/hooks/use-orientation.js +0 -29
- package/dist/hooks/use-user.d.ts +0 -50
- package/dist/hooks/use-user.js +0 -25
- package/dist/icon-button/index.d.ts +0 -9
- package/dist/icon-button/index.js +0 -17
- package/dist/if/index.d.ts +0 -10
- package/dist/if/index.js +0 -24
- package/dist/iframe/index.d.ts +0 -10
- package/dist/iframe/index.js +0 -17
- package/dist/link/index.d.ts +0 -55
- package/dist/link/index.js +0 -195
- package/dist/list/index.d.ts +0 -69
- package/dist/list/index.js +0 -65
- package/dist/markdown-container/index.d.ts +0 -22
- package/dist/markdown-container/index.js +0 -128
- package/dist/password-input/index.d.ts +0 -11
- package/dist/password-input/index.js +0 -46
- package/dist/picture/index.d.ts +0 -38
- package/dist/picture/index.js +0 -68
- package/dist/protected-email/index.d.ts +0 -20
- package/dist/protected-email/index.js +0 -30
- package/dist/text/index.d.ts +0 -20
- package/dist/text/index.js +0 -38
- package/dist/utils/author/index.d.ts +0 -3
- package/dist/utils/author/index.js +0 -33
- package/dist/utils/text/index.js +0 -73
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { t as __exportAll } from "../chunk-BTpB_u-K.mjs";
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
import { tv } from "@regardio/tailwind/utils";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region src/grid/grid-item.tsx
|
|
7
|
+
const gridItem = tv({
|
|
8
|
+
defaultVariants: { span: 12 },
|
|
9
|
+
slots: { root: ["relative"] },
|
|
10
|
+
variants: {
|
|
11
|
+
end: {
|
|
12
|
+
1: { root: "col-end-1" },
|
|
13
|
+
2: { root: "col-end-2" },
|
|
14
|
+
3: { root: "col-end-3" },
|
|
15
|
+
4: { root: "col-end-4" },
|
|
16
|
+
5: { root: "col-end-5" },
|
|
17
|
+
6: { root: "col-end-6" },
|
|
18
|
+
7: { root: "col-end-7" },
|
|
19
|
+
8: { root: "col-end-8" },
|
|
20
|
+
9: { root: "col-end-9" },
|
|
21
|
+
10: { root: "col-end-10" },
|
|
22
|
+
11: { root: "col-end-11" },
|
|
23
|
+
12: { root: "col-end-12" },
|
|
24
|
+
13: { root: "col-end-13" },
|
|
25
|
+
auto: { root: "col-end-auto" }
|
|
26
|
+
},
|
|
27
|
+
rowSpan: {
|
|
28
|
+
1: { root: "row-span-1" },
|
|
29
|
+
2: { root: "row-span-2" },
|
|
30
|
+
3: { root: "row-span-3" },
|
|
31
|
+
4: { root: "row-span-4" },
|
|
32
|
+
5: { root: "row-span-5" },
|
|
33
|
+
6: { root: "row-span-6" },
|
|
34
|
+
full: { root: "row-span-full" }
|
|
35
|
+
},
|
|
36
|
+
span: {
|
|
37
|
+
1: { root: "col-span-1" },
|
|
38
|
+
2: { root: "col-span-2" },
|
|
39
|
+
3: { root: "col-span-3" },
|
|
40
|
+
4: { root: "col-span-4" },
|
|
41
|
+
5: { root: "col-span-5" },
|
|
42
|
+
6: { root: "col-span-6" },
|
|
43
|
+
7: { root: "col-span-7" },
|
|
44
|
+
8: { root: "col-span-8" },
|
|
45
|
+
9: { root: "col-span-9" },
|
|
46
|
+
10: { root: "col-span-10" },
|
|
47
|
+
11: { root: "col-span-11" },
|
|
48
|
+
12: { root: "col-span-12" },
|
|
49
|
+
full: { root: "col-span-full" }
|
|
50
|
+
},
|
|
51
|
+
spanLg: {
|
|
52
|
+
1: { root: "@lg:col-span-1" },
|
|
53
|
+
2: { root: "@lg:col-span-2" },
|
|
54
|
+
3: { root: "@lg:col-span-3" },
|
|
55
|
+
4: { root: "@lg:col-span-4" },
|
|
56
|
+
5: { root: "@lg:col-span-5" },
|
|
57
|
+
6: { root: "@lg:col-span-6" },
|
|
58
|
+
7: { root: "@lg:col-span-7" },
|
|
59
|
+
8: { root: "@lg:col-span-8" },
|
|
60
|
+
9: { root: "@lg:col-span-9" },
|
|
61
|
+
10: { root: "@lg:col-span-10" },
|
|
62
|
+
11: { root: "@lg:col-span-11" },
|
|
63
|
+
12: { root: "@lg:col-span-12" },
|
|
64
|
+
full: { root: "@lg:col-span-full" }
|
|
65
|
+
},
|
|
66
|
+
spanMd: {
|
|
67
|
+
1: { root: "@md:col-span-1" },
|
|
68
|
+
2: { root: "@md:col-span-2" },
|
|
69
|
+
3: { root: "@md:col-span-3" },
|
|
70
|
+
4: { root: "@md:col-span-4" },
|
|
71
|
+
5: { root: "@md:col-span-5" },
|
|
72
|
+
6: { root: "@md:col-span-6" },
|
|
73
|
+
7: { root: "@md:col-span-7" },
|
|
74
|
+
8: { root: "@md:col-span-8" },
|
|
75
|
+
9: { root: "@md:col-span-9" },
|
|
76
|
+
10: { root: "@md:col-span-10" },
|
|
77
|
+
11: { root: "@md:col-span-11" },
|
|
78
|
+
12: { root: "@md:col-span-12" },
|
|
79
|
+
full: { root: "@md:col-span-full" }
|
|
80
|
+
},
|
|
81
|
+
spanSm: {
|
|
82
|
+
1: { root: "@sm:col-span-1" },
|
|
83
|
+
2: { root: "@sm:col-span-2" },
|
|
84
|
+
3: { root: "@sm:col-span-3" },
|
|
85
|
+
4: { root: "@sm:col-span-4" },
|
|
86
|
+
5: { root: "@sm:col-span-5" },
|
|
87
|
+
6: { root: "@sm:col-span-6" },
|
|
88
|
+
7: { root: "@sm:col-span-7" },
|
|
89
|
+
8: { root: "@sm:col-span-8" },
|
|
90
|
+
9: { root: "@sm:col-span-9" },
|
|
91
|
+
10: { root: "@sm:col-span-10" },
|
|
92
|
+
11: { root: "@sm:col-span-11" },
|
|
93
|
+
12: { root: "@sm:col-span-12" },
|
|
94
|
+
full: { root: "@sm:col-span-full" }
|
|
95
|
+
},
|
|
96
|
+
spanXl: {
|
|
97
|
+
1: { root: "@xl:col-span-1" },
|
|
98
|
+
2: { root: "@xl:col-span-2" },
|
|
99
|
+
3: { root: "@xl:col-span-3" },
|
|
100
|
+
4: { root: "@xl:col-span-4" },
|
|
101
|
+
5: { root: "@xl:col-span-5" },
|
|
102
|
+
6: { root: "@xl:col-span-6" },
|
|
103
|
+
7: { root: "@xl:col-span-7" },
|
|
104
|
+
8: { root: "@xl:col-span-8" },
|
|
105
|
+
9: { root: "@xl:col-span-9" },
|
|
106
|
+
10: { root: "@xl:col-span-10" },
|
|
107
|
+
11: { root: "@xl:col-span-11" },
|
|
108
|
+
12: { root: "@xl:col-span-12" },
|
|
109
|
+
full: { root: "@xl:col-span-full" }
|
|
110
|
+
},
|
|
111
|
+
spanXs: {
|
|
112
|
+
1: { root: "@xs:col-span-1" },
|
|
113
|
+
2: { root: "@xs:col-span-2" },
|
|
114
|
+
3: { root: "@xs:col-span-3" },
|
|
115
|
+
4: { root: "@xs:col-span-4" },
|
|
116
|
+
5: { root: "@xs:col-span-5" },
|
|
117
|
+
6: { root: "@xs:col-span-6" },
|
|
118
|
+
7: { root: "@xs:col-span-7" },
|
|
119
|
+
8: { root: "@xs:col-span-8" },
|
|
120
|
+
9: { root: "@xs:col-span-9" },
|
|
121
|
+
10: { root: "@xs:col-span-10" },
|
|
122
|
+
11: { root: "@xs:col-span-11" },
|
|
123
|
+
12: { root: "@xs:col-span-12" },
|
|
124
|
+
full: { root: "@xs:col-span-full" }
|
|
125
|
+
},
|
|
126
|
+
start: {
|
|
127
|
+
1: { root: "col-start-1" },
|
|
128
|
+
2: { root: "col-start-2" },
|
|
129
|
+
3: { root: "col-start-3" },
|
|
130
|
+
4: { root: "col-start-4" },
|
|
131
|
+
5: { root: "col-start-5" },
|
|
132
|
+
6: { root: "col-start-6" },
|
|
133
|
+
7: { root: "col-start-7" },
|
|
134
|
+
8: { root: "col-start-8" },
|
|
135
|
+
9: { root: "col-start-9" },
|
|
136
|
+
10: { root: "col-start-10" },
|
|
137
|
+
11: { root: "col-start-11" },
|
|
138
|
+
12: { root: "col-start-12" },
|
|
139
|
+
13: { root: "col-start-13" },
|
|
140
|
+
auto: { root: "col-start-auto" }
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
const GridItem = function GridItem({ children, className, classNames, span, spanXs, spanSm, spanMd, spanLg, spanXl, start, end, rowSpan, ref, ...props }) {
|
|
145
|
+
return /* @__PURE__ */ jsx("div", {
|
|
146
|
+
className: gridItem({
|
|
147
|
+
end,
|
|
148
|
+
rowSpan,
|
|
149
|
+
span,
|
|
150
|
+
spanLg,
|
|
151
|
+
spanMd,
|
|
152
|
+
spanSm,
|
|
153
|
+
spanXl,
|
|
154
|
+
spanXs,
|
|
155
|
+
start
|
|
156
|
+
}).root({ className: classNames?.root ?? className }),
|
|
157
|
+
ref,
|
|
158
|
+
...props,
|
|
159
|
+
children
|
|
160
|
+
});
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
//#endregion
|
|
164
|
+
//#region src/grid/grid-root.tsx
|
|
165
|
+
const grid = tv({
|
|
166
|
+
defaultVariants: { flow: "dense" },
|
|
167
|
+
slots: { root: [
|
|
168
|
+
"u-grid",
|
|
169
|
+
"grid",
|
|
170
|
+
"grid-cols-12",
|
|
171
|
+
"gap-[var(--spacing-grid-gutter)]",
|
|
172
|
+
"w-full",
|
|
173
|
+
"container-[grid]/inline-size"
|
|
174
|
+
] },
|
|
175
|
+
variants: {
|
|
176
|
+
align: {
|
|
177
|
+
center: { root: "content-center" },
|
|
178
|
+
end: { root: "content-end" },
|
|
179
|
+
start: { root: "content-start" },
|
|
180
|
+
stretch: { root: "content-stretch" }
|
|
181
|
+
},
|
|
182
|
+
flow: {
|
|
183
|
+
column: { root: "grid-auto-flow-col" },
|
|
184
|
+
dense: { root: "grid-auto-flow-dense" },
|
|
185
|
+
row: { root: "grid-auto-flow-row" }
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
const GridContext = createContext(null);
|
|
190
|
+
function useGrid() {
|
|
191
|
+
const context = useContext(GridContext);
|
|
192
|
+
if (!context) throw new Error("useGrid must be used within a <Grid.Root />");
|
|
193
|
+
return context;
|
|
194
|
+
}
|
|
195
|
+
const GridRoot = function GridRoot({ children, className, classNames, flow, align, ref, ...props }) {
|
|
196
|
+
const styles = grid({
|
|
197
|
+
align,
|
|
198
|
+
flow
|
|
199
|
+
});
|
|
200
|
+
return /* @__PURE__ */ jsx(GridContext.Provider, {
|
|
201
|
+
value: { styles },
|
|
202
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
203
|
+
className: styles.root({ className: classNames?.root ?? className }),
|
|
204
|
+
ref,
|
|
205
|
+
...props,
|
|
206
|
+
children
|
|
207
|
+
})
|
|
208
|
+
});
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
//#endregion
|
|
212
|
+
//#region src/grid/index.parts.ts
|
|
213
|
+
var index_parts_exports = /* @__PURE__ */ __exportAll({
|
|
214
|
+
Item: () => GridItem,
|
|
215
|
+
Root: () => GridRoot
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
//#endregion
|
|
219
|
+
export { index_parts_exports as Grid, gridItem, useGrid };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ElementType, HTMLAttributes } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/heading/heading.d.ts
|
|
4
|
+
declare const levelVariants: {
|
|
5
|
+
readonly 1: readonly ["text-2xl"];
|
|
6
|
+
readonly 2: readonly ["text-xl"];
|
|
7
|
+
readonly 3: readonly ["text-lg"];
|
|
8
|
+
readonly 4: readonly ["text-md"];
|
|
9
|
+
readonly 5: readonly ["text-sm"];
|
|
10
|
+
readonly 6: readonly ["text-xs"];
|
|
11
|
+
};
|
|
12
|
+
type HeadingLevel = keyof typeof levelVariants;
|
|
13
|
+
interface HeadingProps extends HTMLAttributes<HTMLHeadingElement> {
|
|
14
|
+
as?: ElementType;
|
|
15
|
+
className?: string;
|
|
16
|
+
level?: HeadingLevel;
|
|
17
|
+
locale?: string;
|
|
18
|
+
}
|
|
19
|
+
declare const Heading: ({
|
|
20
|
+
as,
|
|
21
|
+
children,
|
|
22
|
+
className,
|
|
23
|
+
level,
|
|
24
|
+
...props
|
|
25
|
+
}: HeadingProps) => React.JSX.Element;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { Heading, type HeadingLevel, type HeadingProps };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { r as shy, t as lowerCaseSzett } from "../text-EQC4zJbE.mjs";
|
|
2
|
+
import { cn, tv } from "@regardio/tailwind/utils";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/heading/heading.tsx
|
|
6
|
+
const heading = tv({
|
|
7
|
+
base: [],
|
|
8
|
+
defaultVariants: { level: 3 },
|
|
9
|
+
variants: { level: {
|
|
10
|
+
1: ["text-2xl"],
|
|
11
|
+
2: ["text-xl"],
|
|
12
|
+
3: ["text-lg"],
|
|
13
|
+
4: ["text-md"],
|
|
14
|
+
5: ["text-sm"],
|
|
15
|
+
6: ["text-xs"]
|
|
16
|
+
} }
|
|
17
|
+
});
|
|
18
|
+
const Heading = function Heading({ as, children, className, level = 2, ...props }) {
|
|
19
|
+
const word = lowerCaseSzett(shy(children));
|
|
20
|
+
return /* @__PURE__ */ jsx(as || `h${level}`, {
|
|
21
|
+
className: cn(heading({ level }), className),
|
|
22
|
+
...props,
|
|
23
|
+
children: word
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
export { Heading };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/highlight/highlight.d.ts
|
|
4
|
+
declare const highlightVariants: {
|
|
5
|
+
readonly primary: readonly ["highlight"];
|
|
6
|
+
};
|
|
7
|
+
type HighlightVariant = keyof typeof highlightVariants;
|
|
8
|
+
interface HighlightProps extends ComponentProps<"mark"> {
|
|
9
|
+
variant?: HighlightVariant;
|
|
10
|
+
}
|
|
11
|
+
declare const Highlight: ({
|
|
12
|
+
children,
|
|
13
|
+
className,
|
|
14
|
+
variant
|
|
15
|
+
}: HighlightProps) => React.JSX.Element;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { Highlight, type HighlightProps };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { tv } from "@regardio/tailwind/utils";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/highlight/highlight.tsx
|
|
5
|
+
const highlight = tv({
|
|
6
|
+
defaultVariants: { variant: "primary" },
|
|
7
|
+
variants: { variant: { primary: ["highlight"] } }
|
|
8
|
+
});
|
|
9
|
+
const Highlight = ({ children, className, variant }) => {
|
|
10
|
+
return /* @__PURE__ */ jsxs("mark", {
|
|
11
|
+
className: highlight({
|
|
12
|
+
className,
|
|
13
|
+
variant
|
|
14
|
+
}),
|
|
15
|
+
children: [children, /* @__PURE__ */ jsx("svg", {
|
|
16
|
+
"aria-label": "!",
|
|
17
|
+
role: "img",
|
|
18
|
+
children: /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("filter", { children: [/* @__PURE__ */ jsx("feTurbulence", {
|
|
19
|
+
baseFrequency: "0 0.2",
|
|
20
|
+
numOctaves: "5",
|
|
21
|
+
result: "warp",
|
|
22
|
+
type: "fractalNoise"
|
|
23
|
+
}), /* @__PURE__ */ jsx("feDisplacementMap", {
|
|
24
|
+
in: "SourceGraphic",
|
|
25
|
+
in2: "warp",
|
|
26
|
+
scale: "30",
|
|
27
|
+
xChannelSelector: "R",
|
|
28
|
+
yChannelSelector: "G"
|
|
29
|
+
})] }) })
|
|
30
|
+
})]
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
export { Highlight };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/hooks/use-current-route-data.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* This base hook is used to access data related to the current route
|
|
4
|
+
* @returns {JSON|undefined} The router data or undefined if not found
|
|
5
|
+
*/
|
|
6
|
+
declare function useCurrentRouteData<HeaderData>(): HeaderData | undefined;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { useCurrentRouteData };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import { useLocation, useMatches } from "react-router";
|
|
5
|
+
|
|
6
|
+
//#region src/hooks/use-current-route-data.ts
|
|
7
|
+
/**
|
|
8
|
+
* This base hook is used to access data related to the current route
|
|
9
|
+
* @returns {JSON|undefined} The router data or undefined if not found
|
|
10
|
+
*/
|
|
11
|
+
function useCurrentRouteData() {
|
|
12
|
+
const location = useLocation();
|
|
13
|
+
const matchingRoutes = useMatches();
|
|
14
|
+
return useMemo(() => {
|
|
15
|
+
return matchingRoutes.find((route) => {
|
|
16
|
+
return route.pathname === location.pathname;
|
|
17
|
+
});
|
|
18
|
+
}, [matchingRoutes, location])?.loaderData || void 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { useCurrentRouteData };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { RefObject } from
|
|
1
|
+
import { RefObject } from "react";
|
|
2
2
|
|
|
3
|
+
//#region src/hooks/use-focus-search.d.ts
|
|
3
4
|
/** Focuses on the field when user clicks cmd + k or ctrl + k */
|
|
4
5
|
declare function useFocusSearch(ref: RefObject<HTMLInputElement>): void;
|
|
5
|
-
|
|
6
|
-
export { useFocusSearch };
|
|
6
|
+
//#endregion
|
|
7
|
+
export { useFocusSearch };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useEffect } from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/hooks/use-focus-search.ts
|
|
6
|
+
/** Focuses on the field when user clicks cmd + k or ctrl + k */
|
|
7
|
+
function useFocusSearch(ref) {
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
function handleKeyDown(event) {
|
|
10
|
+
if ((event.metaKey || event.ctrlKey) && event.key === "k") {
|
|
11
|
+
event.preventDefault();
|
|
12
|
+
ref?.current?.focus();
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
16
|
+
return () => {
|
|
17
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
18
|
+
};
|
|
19
|
+
}, [ref]);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { useFocusSearch };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/hooks/use-matches-data.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* This base hook is used in other hooks to quickly search for specific data
|
|
4
|
+
* across all loader data using useMatches.
|
|
5
|
+
* @param {string} id The route id
|
|
6
|
+
* @returns {JSON|undefined} The router data or undefined if not found
|
|
7
|
+
*/
|
|
8
|
+
declare function useMatchesData<T>(id: string): T | undefined;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { useMatchesData };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import { useMatches } from "react-router";
|
|
5
|
+
|
|
6
|
+
//#region src/hooks/use-matches-data.ts
|
|
7
|
+
/**
|
|
8
|
+
* This base hook is used in other hooks to quickly search for specific data
|
|
9
|
+
* across all loader data using useMatches.
|
|
10
|
+
* @param {string} id The route id
|
|
11
|
+
* @returns {JSON|undefined} The router data or undefined if not found
|
|
12
|
+
*/
|
|
13
|
+
function useMatchesData(id) {
|
|
14
|
+
const matchingRoutes = useMatches();
|
|
15
|
+
return useMemo(() => {
|
|
16
|
+
return matchingRoutes.find((route) => {
|
|
17
|
+
return route.id === id;
|
|
18
|
+
});
|
|
19
|
+
}, [matchingRoutes, id])?.data || void 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { useMatchesData };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/hooks/use-media-query.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* A hook that returns a boolean indicating whether the current viewport matches the provided media query
|
|
4
|
+
* @param query The media query to check against (e.g. '(min-width: 768px)')
|
|
5
|
+
* @returns A boolean indicating whether the media query matches
|
|
6
|
+
*/
|
|
7
|
+
declare function useMediaQuery(query: string): boolean;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { useMediaQuery };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/hooks/use-media-query.ts
|
|
6
|
+
/**
|
|
7
|
+
* A hook that returns a boolean indicating whether the current viewport matches the provided media query
|
|
8
|
+
* @param query The media query to check against (e.g. '(min-width: 768px)')
|
|
9
|
+
* @returns A boolean indicating whether the media query matches
|
|
10
|
+
*/
|
|
11
|
+
function useMediaQuery(query) {
|
|
12
|
+
const [matches, setMatches] = useState(false);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
const mediaQuery = window.matchMedia(query);
|
|
15
|
+
setMatches(mediaQuery.matches);
|
|
16
|
+
const handleChange = (event) => {
|
|
17
|
+
setMatches(event.matches);
|
|
18
|
+
};
|
|
19
|
+
mediaQuery.addEventListener("change", handleChange);
|
|
20
|
+
return () => {
|
|
21
|
+
mediaQuery.removeEventListener("change", handleChange);
|
|
22
|
+
};
|
|
23
|
+
}, [query]);
|
|
24
|
+
return matches;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
export { useMediaQuery };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/hooks/use-mobile.ts
|
|
6
|
+
const MOBILE_BREAKPOINT = 768;
|
|
7
|
+
function useIsMobile() {
|
|
8
|
+
const [isMobile, setIsMobile] = useState(void 0);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
11
|
+
const onChange = () => {
|
|
12
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
13
|
+
};
|
|
14
|
+
mql.addEventListener("change", onChange);
|
|
15
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
16
|
+
return () => mql.removeEventListener("change", onChange);
|
|
17
|
+
}, []);
|
|
18
|
+
return !!isMobile;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { useIsMobile };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/hooks/use-nonce.ts
|
|
4
|
+
/**
|
|
5
|
+
* Nonce Provider.
|
|
6
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/nonce
|
|
7
|
+
*/
|
|
8
|
+
const NonceContext = createContext("");
|
|
9
|
+
const NonceProvider = NonceContext.Provider;
|
|
10
|
+
const useNonce = () => useContext(NonceContext);
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { NonceContext, NonceProvider, useNonce };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/hooks/use-orientation.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Orientation type representing device orientation
|
|
4
|
+
*/
|
|
5
|
+
type Orientation = "portrait" | "landscape";
|
|
6
|
+
/**
|
|
7
|
+
* Hook that tracks the current device orientation
|
|
8
|
+
* @returns The current orientation ('portrait' or 'landscape')
|
|
9
|
+
*/
|
|
10
|
+
declare function useOrientation(): Orientation;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { Orientation, useOrientation };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/hooks/use-orientation.ts
|
|
6
|
+
/**
|
|
7
|
+
* Hook that tracks the current device orientation
|
|
8
|
+
* @returns The current orientation ('portrait' or 'landscape')
|
|
9
|
+
*/
|
|
10
|
+
function useOrientation() {
|
|
11
|
+
const [orientation, setOrientation] = useState(() => {
|
|
12
|
+
if (typeof window !== "undefined") return window.innerHeight > window.innerWidth ? "portrait" : "landscape";
|
|
13
|
+
return "portrait";
|
|
14
|
+
});
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (typeof window === "undefined") return;
|
|
17
|
+
const handleResize = () => {
|
|
18
|
+
setOrientation(window.innerHeight > window.innerWidth ? "portrait" : "landscape");
|
|
19
|
+
};
|
|
20
|
+
window.addEventListener("resize", handleResize);
|
|
21
|
+
window.addEventListener("orientationchange", handleResize);
|
|
22
|
+
handleResize();
|
|
23
|
+
return () => {
|
|
24
|
+
window.removeEventListener("resize", handleResize);
|
|
25
|
+
window.removeEventListener("orientationchange", handleResize);
|
|
26
|
+
};
|
|
27
|
+
}, []);
|
|
28
|
+
return orientation;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
export { useOrientation };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { User } from "@supabase/supabase-js";
|
|
3
|
+
|
|
4
|
+
//#region src/hooks/use-user.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Context for storing and accessing the current authenticated user
|
|
7
|
+
*/
|
|
8
|
+
interface UserContextType {
|
|
9
|
+
/**
|
|
10
|
+
* The current authenticated user, or null if not authenticated
|
|
11
|
+
*/
|
|
12
|
+
user: User | null;
|
|
13
|
+
/**
|
|
14
|
+
* Whether the user data is currently loading
|
|
15
|
+
*/
|
|
16
|
+
isLoading: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Context for storing and accessing the current authenticated user
|
|
20
|
+
*/
|
|
21
|
+
declare const UserContext: React.Context<UserContextType>;
|
|
22
|
+
/**
|
|
23
|
+
* Props for the UserContextProvider component
|
|
24
|
+
*/
|
|
25
|
+
interface UserContextProviderProps {
|
|
26
|
+
/**
|
|
27
|
+
* The current authenticated user, or null if not authenticated
|
|
28
|
+
*/
|
|
29
|
+
user: User | null;
|
|
30
|
+
/**
|
|
31
|
+
* Whether the user data is currently loading
|
|
32
|
+
*/
|
|
33
|
+
isLoading?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Child components that will have access to the user context
|
|
36
|
+
*/
|
|
37
|
+
children: ReactNode;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Provider component for the UserContext
|
|
41
|
+
*/
|
|
42
|
+
declare function UserContextProvider({
|
|
43
|
+
user,
|
|
44
|
+
isLoading,
|
|
45
|
+
children
|
|
46
|
+
}: UserContextProviderProps): React.JSX.Element;
|
|
47
|
+
/**
|
|
48
|
+
* Hook to access the current authenticated user from the UserContext
|
|
49
|
+
* @returns The current user context containing the user object and loading state
|
|
50
|
+
*/
|
|
51
|
+
declare function useUser(): UserContextType;
|
|
52
|
+
//#endregion
|
|
53
|
+
export { UserContext, UserContextProvider, UserContextProviderProps, UserContextType, useUser };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/hooks/use-user.tsx
|
|
5
|
+
/**
|
|
6
|
+
* Default context value when no provider is present
|
|
7
|
+
*/
|
|
8
|
+
const defaultContextValue = {
|
|
9
|
+
isLoading: false,
|
|
10
|
+
user: null
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Context for storing and accessing the current authenticated user
|
|
14
|
+
*/
|
|
15
|
+
const UserContext = createContext(defaultContextValue);
|
|
16
|
+
/**
|
|
17
|
+
* Provider component for the UserContext
|
|
18
|
+
*/
|
|
19
|
+
function UserContextProvider({ user, isLoading = false, children }) {
|
|
20
|
+
return /* @__PURE__ */ jsx(UserContext.Provider, {
|
|
21
|
+
value: {
|
|
22
|
+
isLoading,
|
|
23
|
+
user
|
|
24
|
+
},
|
|
25
|
+
children
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Hook to access the current authenticated user from the UserContext
|
|
30
|
+
* @returns The current user context containing the user object and loading state
|
|
31
|
+
*/
|
|
32
|
+
function useUser() {
|
|
33
|
+
const context = useContext(UserContext);
|
|
34
|
+
if (context === void 0) throw new Error("useUser must be used within a UserContextProvider");
|
|
35
|
+
return context;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
export { UserContext, UserContextProvider, useUser };
|