@regardio/react 0.4.7 → 0.5.5
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/LICENSE +1 -1
- package/README.md +6 -8
- package/dist/{components/background-slideshow.js → background-slideshow/index.js} +2 -11
- package/dist/{components/blurry-gradient.js → blurry-gradient/index.js} +15 -9
- package/dist/{components/carousel.d.ts → carousel/index.d.ts} +17 -9
- package/dist/{components/carousel.js → carousel/index.js} +34 -30
- package/dist/{components/countdown.js → countdown/index.js} +2 -11
- package/dist/{components/generic-error.js → generic-error/index.js} +1 -1
- package/dist/grid/index.d.ts +1196 -0
- package/dist/grid/index.js +239 -0
- package/dist/heading/index.d.ts +24 -0
- package/dist/{components/heading.js → heading/index.js} +15 -34
- package/dist/highlight/index.d.ts +13 -0
- package/dist/{components/highlight.js → highlight/index.js} +9 -17
- package/dist/hooks/use-nonce.d.ts +1 -6
- package/dist/hooks/use-nonce.js +1 -6
- package/dist/{components/icon-button.js → icon-button/index.js} +1 -1
- package/dist/{components/if.js → if/index.js} +1 -1
- package/dist/{components/iframe.js → iframe/index.js} +2 -11
- package/dist/{components/link.d.ts → link/index.d.ts} +19 -13
- package/dist/{components/link.js → link/index.js} +31 -36
- package/dist/list/index.d.ts +69 -0
- package/dist/list/index.js +65 -0
- package/dist/{components/markdown-container.js → markdown-container/index.js} +3 -67
- package/dist/{components/password-input.js → password-input/index.js} +2 -11
- package/dist/{components/picture.js → picture/index.js} +2 -11
- package/dist/{components/protected-email.d.ts → protected-email/index.d.ts} +1 -1
- package/dist/{components/protected-email.js → protected-email/index.js} +1 -1
- package/dist/text/index.d.ts +20 -0
- package/dist/text/index.js +38 -0
- package/dist/utils/author/index.d.ts +3 -0
- package/dist/utils/author/index.js +33 -0
- package/dist/utils/text/index.d.ts +15 -0
- package/dist/utils/text/index.js +73 -0
- package/package.json +170 -187
- package/src/background-slideshow/background-slideshow.stories.tsx +137 -0
- package/src/{components → background-slideshow}/background-slideshow.tsx +3 -1
- package/src/background-slideshow/index.ts +2 -0
- package/src/{stories/BlurryGradient.stories.tsx → blurry-gradient/blurry-gradient.stories.tsx} +1 -1
- package/src/{components → blurry-gradient}/blurry-gradient.tsx +14 -8
- package/src/blurry-gradient/index.ts +2 -0
- package/src/carousel/carousel-content.tsx +16 -0
- package/src/carousel/carousel-item.tsx +23 -0
- package/src/carousel/carousel-next.tsx +22 -0
- package/src/carousel/carousel-previous.tsx +22 -0
- package/src/{components/carousel.tsx → carousel/carousel-root.tsx} +8 -78
- package/src/carousel/carousel.stories.tsx +135 -0
- package/src/carousel/index.parts.ts +5 -0
- package/src/carousel/index.ts +4 -0
- package/src/{stories/Countdown.stories.tsx → countdown/countdown.stories.tsx} +1 -1
- package/src/{components → countdown}/countdown.tsx +3 -7
- package/src/countdown/index.ts +1 -0
- package/src/{stories/GenericError.stories.tsx → generic-error/generic-error.stories.tsx} +1 -1
- package/src/{components → generic-error}/generic-error.tsx +2 -0
- package/src/generic-error/index.ts +2 -0
- package/src/grid/grid-item.tsx +188 -0
- package/src/grid/grid-root.tsx +72 -0
- package/src/grid/grid.stories.tsx +236 -0
- package/src/grid/index.parts.ts +2 -0
- package/src/grid/index.ts +5 -0
- package/src/{stories/Heading.stories.tsx → heading/heading.stories.tsx} +1 -1
- package/src/{components → heading}/heading.tsx +17 -25
- package/src/heading/index.ts +2 -0
- package/src/{stories/Highlight.stories.tsx → highlight/highlight.stories.tsx} +1 -1
- package/src/{components → highlight}/highlight.tsx +13 -9
- package/src/highlight/index.ts +2 -0
- package/src/hooks/use-nonce.ts +0 -10
- package/src/{stories/IconButton.stories.tsx → icon-button/icon-button.stories.tsx} +1 -1
- package/src/icon-button/index.ts +2 -0
- package/src/{stories/If.stories.tsx → if/if.stories.tsx} +1 -1
- package/src/if/index.ts +1 -0
- package/src/{stories/Iframe.stories.tsx → iframe/iframe.stories.tsx} +1 -1
- package/src/{components → iframe}/iframe.tsx +1 -1
- package/src/iframe/index.ts +2 -0
- package/src/link/index.ts +2 -0
- package/src/{stories/Link.stories.tsx → link/link.stories.tsx} +52 -1
- package/src/{components → link}/link.tsx +39 -28
- package/src/list/index.parts.ts +2 -0
- package/src/list/index.ts +4 -0
- package/src/list/list-item.tsx +63 -0
- package/src/list/list-root-context.ts +21 -0
- package/src/list/list-root.tsx +81 -0
- package/src/list/list.css +32 -0
- package/src/list/list.stories.tsx +119 -0
- package/src/list/list.test.tsx +168 -0
- package/src/markdown-container/index.ts +2 -0
- package/src/{stories/MarkdownContainer.stories.tsx → markdown-container/markdown-container.stories.tsx} +56 -1
- package/src/{components → markdown-container}/markdown-container.tsx +3 -1
- package/src/password-input/index.ts +2 -0
- package/src/{stories/PasswordInput.stories.tsx → password-input/password-input.stories.tsx} +1 -1
- package/src/{components → password-input}/password-input.tsx +4 -4
- package/src/picture/index.ts +2 -0
- package/src/{stories/Picture.stories.tsx → picture/picture.stories.tsx} +1 -1
- package/src/{components → picture}/picture.tsx +2 -4
- package/src/protected-email/index.ts +2 -0
- package/src/{stories/ProtectedEmail.stories.tsx → protected-email/protected-email.stories.tsx} +1 -1
- package/src/{components → protected-email}/protected-email.tsx +3 -1
- package/src/tailwind.css +10 -0
- package/src/text/index.ts +2 -0
- package/src/{stories/Text.stories.tsx → text/text.stories.tsx} +1 -1
- package/src/text/text.tsx +46 -0
- package/src/utils/author/author.tsx +36 -0
- package/src/utils/author/index.ts +1 -0
- package/src/utils/text/index.ts +1 -0
- package/src/utils/text/text.tsx +103 -0
- package/dist/components/box.d.ts +0 -20
- package/dist/components/box.js +0 -50
- package/dist/components/definition-list.d.ts +0 -43
- package/dist/components/definition-list.js +0 -89
- package/dist/components/heading.d.ts +0 -27
- package/dist/components/highlight.d.ts +0 -19
- package/dist/components/item.d.ts +0 -70
- package/dist/components/item.js +0 -512
- package/dist/components/leaflet-map.d.ts +0 -34
- package/dist/components/leaflet-map.js +0 -201
- package/dist/components/list-item.d.ts +0 -19
- package/dist/components/list-item.js +0 -37
- package/dist/components/maptiler-map.d.ts +0 -27
- package/dist/components/maptiler-map.js +0 -129
- package/dist/components/text.d.ts +0 -20
- package/dist/components/text.js +0 -45
- package/dist/components/unordered-list.d.ts +0 -19
- package/dist/components/unordered-list.js +0 -39
- package/dist/utils/author.d.ts +0 -9
- package/dist/utils/author.js +0 -55
- package/dist/utils/cn.d.ts +0 -9
- package/dist/utils/cn.js +0 -14
- package/dist/utils/is-route-active.d.ts +0 -19
- package/dist/utils/is-route-active.js +0 -56
- package/dist/utils/text.d.ts +0 -24
- package/dist/utils/text.js +0 -127
- package/src/components/box.tsx +0 -45
- package/src/components/definition-list.tsx +0 -90
- package/src/components/item.tsx +0 -340
- package/src/components/leaflet-map.tsx +0 -294
- package/src/components/link.test.tsx +0 -387
- package/src/components/list-item.tsx +0 -30
- package/src/components/maptiler-map.tsx +0 -181
- package/src/components/text.tsx +0 -38
- package/src/components/unordered-list.tsx +0 -32
- package/src/hooks/use-nonce.test.ts +0 -35
- package/src/stories/BackgroundSlideshow.stories.tsx +0 -68
- package/src/stories/Box.stories.tsx +0 -83
- package/src/stories/Carousel.stories.tsx +0 -95
- package/src/stories/DefinitionList.stories.tsx +0 -51
- package/src/stories/Item.stories.tsx +0 -79
- package/src/stories/ListItem.stories.tsx +0 -38
- package/src/stories/UnorderedList.stories.tsx +0 -73
- package/src/styles/tailwind.css +0 -7
- package/src/test-setup.ts +0 -1
- package/src/utils/author.test.ts +0 -54
- package/src/utils/author.tsx +0 -73
- package/src/utils/cn.test.ts +0 -48
- package/src/utils/cn.ts +0 -14
- package/src/utils/is-route-active.test.ts +0 -80
- package/src/utils/is-route-active.ts +0 -100
- package/src/utils/text.test.ts +0 -152
- package/src/utils/text.tsx +0 -209
- package/src/vite-env.d.ts +0 -1
- /package/dist/{components/background-slideshow.d.ts → background-slideshow/index.d.ts} +0 -0
- /package/dist/{components/blurry-gradient.d.ts → blurry-gradient/index.d.ts} +0 -0
- /package/dist/{components/countdown.d.ts → countdown/index.d.ts} +0 -0
- /package/dist/{components/generic-error.d.ts → generic-error/index.d.ts} +0 -0
- /package/dist/{components/icon-button.d.ts → icon-button/index.d.ts} +0 -0
- /package/dist/{components/if.d.ts → if/index.d.ts} +0 -0
- /package/dist/{components/iframe.d.ts → iframe/index.d.ts} +0 -0
- /package/dist/{components/markdown-container.d.ts → markdown-container/index.d.ts} +0 -0
- /package/dist/{components/password-input.d.ts → password-input/index.d.ts} +0 -0
- /package/dist/{components/picture.d.ts → picture/index.d.ts} +0 -0
- /package/src/{components → icon-button}/icon-button.tsx +0 -0
- /package/src/{components → if}/if.tsx +0 -0
- /package/src/{styles/storybook.css → storybook.css} +0 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { tv } from '@regardio/tailwind/utils';
|
|
2
|
+
import { forwardRef, createContext, useContext } from 'react';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var gridItem = tv({
|
|
11
|
+
defaultVariants: {
|
|
12
|
+
span: 12
|
|
13
|
+
},
|
|
14
|
+
slots: {
|
|
15
|
+
root: ["relative"]
|
|
16
|
+
},
|
|
17
|
+
variants: {
|
|
18
|
+
end: {
|
|
19
|
+
1: { root: "col-end-1" },
|
|
20
|
+
2: { root: "col-end-2" },
|
|
21
|
+
3: { root: "col-end-3" },
|
|
22
|
+
4: { root: "col-end-4" },
|
|
23
|
+
5: { root: "col-end-5" },
|
|
24
|
+
6: { root: "col-end-6" },
|
|
25
|
+
7: { root: "col-end-7" },
|
|
26
|
+
8: { root: "col-end-8" },
|
|
27
|
+
9: { root: "col-end-9" },
|
|
28
|
+
10: { root: "col-end-10" },
|
|
29
|
+
11: { root: "col-end-11" },
|
|
30
|
+
12: { root: "col-end-12" },
|
|
31
|
+
13: { root: "col-end-13" },
|
|
32
|
+
auto: { root: "col-end-auto" }
|
|
33
|
+
},
|
|
34
|
+
rowSpan: {
|
|
35
|
+
1: { root: "row-span-1" },
|
|
36
|
+
2: { root: "row-span-2" },
|
|
37
|
+
3: { root: "row-span-3" },
|
|
38
|
+
4: { root: "row-span-4" },
|
|
39
|
+
5: { root: "row-span-5" },
|
|
40
|
+
6: { root: "row-span-6" },
|
|
41
|
+
full: { root: "row-span-full" }
|
|
42
|
+
},
|
|
43
|
+
span: {
|
|
44
|
+
1: { root: "col-span-1" },
|
|
45
|
+
2: { root: "col-span-2" },
|
|
46
|
+
3: { root: "col-span-3" },
|
|
47
|
+
4: { root: "col-span-4" },
|
|
48
|
+
5: { root: "col-span-5" },
|
|
49
|
+
6: { root: "col-span-6" },
|
|
50
|
+
7: { root: "col-span-7" },
|
|
51
|
+
8: { root: "col-span-8" },
|
|
52
|
+
9: { root: "col-span-9" },
|
|
53
|
+
10: { root: "col-span-10" },
|
|
54
|
+
11: { root: "col-span-11" },
|
|
55
|
+
12: { root: "col-span-12" },
|
|
56
|
+
full: { root: "col-span-full" }
|
|
57
|
+
},
|
|
58
|
+
spanLg: {
|
|
59
|
+
1: { root: "@lg:col-span-1" },
|
|
60
|
+
2: { root: "@lg:col-span-2" },
|
|
61
|
+
3: { root: "@lg:col-span-3" },
|
|
62
|
+
4: { root: "@lg:col-span-4" },
|
|
63
|
+
5: { root: "@lg:col-span-5" },
|
|
64
|
+
6: { root: "@lg:col-span-6" },
|
|
65
|
+
7: { root: "@lg:col-span-7" },
|
|
66
|
+
8: { root: "@lg:col-span-8" },
|
|
67
|
+
9: { root: "@lg:col-span-9" },
|
|
68
|
+
10: { root: "@lg:col-span-10" },
|
|
69
|
+
11: { root: "@lg:col-span-11" },
|
|
70
|
+
12: { root: "@lg:col-span-12" },
|
|
71
|
+
full: { root: "@lg:col-span-full" }
|
|
72
|
+
},
|
|
73
|
+
spanMd: {
|
|
74
|
+
1: { root: "@md:col-span-1" },
|
|
75
|
+
2: { root: "@md:col-span-2" },
|
|
76
|
+
3: { root: "@md:col-span-3" },
|
|
77
|
+
4: { root: "@md:col-span-4" },
|
|
78
|
+
5: { root: "@md:col-span-5" },
|
|
79
|
+
6: { root: "@md:col-span-6" },
|
|
80
|
+
7: { root: "@md:col-span-7" },
|
|
81
|
+
8: { root: "@md:col-span-8" },
|
|
82
|
+
9: { root: "@md:col-span-9" },
|
|
83
|
+
10: { root: "@md:col-span-10" },
|
|
84
|
+
11: { root: "@md:col-span-11" },
|
|
85
|
+
12: { root: "@md:col-span-12" },
|
|
86
|
+
full: { root: "@md:col-span-full" }
|
|
87
|
+
},
|
|
88
|
+
spanSm: {
|
|
89
|
+
1: { root: "@sm:col-span-1" },
|
|
90
|
+
2: { root: "@sm:col-span-2" },
|
|
91
|
+
3: { root: "@sm:col-span-3" },
|
|
92
|
+
4: { root: "@sm:col-span-4" },
|
|
93
|
+
5: { root: "@sm:col-span-5" },
|
|
94
|
+
6: { root: "@sm:col-span-6" },
|
|
95
|
+
7: { root: "@sm:col-span-7" },
|
|
96
|
+
8: { root: "@sm:col-span-8" },
|
|
97
|
+
9: { root: "@sm:col-span-9" },
|
|
98
|
+
10: { root: "@sm:col-span-10" },
|
|
99
|
+
11: { root: "@sm:col-span-11" },
|
|
100
|
+
12: { root: "@sm:col-span-12" },
|
|
101
|
+
full: { root: "@sm:col-span-full" }
|
|
102
|
+
},
|
|
103
|
+
spanXl: {
|
|
104
|
+
1: { root: "@xl:col-span-1" },
|
|
105
|
+
2: { root: "@xl:col-span-2" },
|
|
106
|
+
3: { root: "@xl:col-span-3" },
|
|
107
|
+
4: { root: "@xl:col-span-4" },
|
|
108
|
+
5: { root: "@xl:col-span-5" },
|
|
109
|
+
6: { root: "@xl:col-span-6" },
|
|
110
|
+
7: { root: "@xl:col-span-7" },
|
|
111
|
+
8: { root: "@xl:col-span-8" },
|
|
112
|
+
9: { root: "@xl:col-span-9" },
|
|
113
|
+
10: { root: "@xl:col-span-10" },
|
|
114
|
+
11: { root: "@xl:col-span-11" },
|
|
115
|
+
12: { root: "@xl:col-span-12" },
|
|
116
|
+
full: { root: "@xl:col-span-full" }
|
|
117
|
+
},
|
|
118
|
+
spanXs: {
|
|
119
|
+
1: { root: "@xs:col-span-1" },
|
|
120
|
+
2: { root: "@xs:col-span-2" },
|
|
121
|
+
3: { root: "@xs:col-span-3" },
|
|
122
|
+
4: { root: "@xs:col-span-4" },
|
|
123
|
+
5: { root: "@xs:col-span-5" },
|
|
124
|
+
6: { root: "@xs:col-span-6" },
|
|
125
|
+
7: { root: "@xs:col-span-7" },
|
|
126
|
+
8: { root: "@xs:col-span-8" },
|
|
127
|
+
9: { root: "@xs:col-span-9" },
|
|
128
|
+
10: { root: "@xs:col-span-10" },
|
|
129
|
+
11: { root: "@xs:col-span-11" },
|
|
130
|
+
12: { root: "@xs:col-span-12" },
|
|
131
|
+
full: { root: "@xs:col-span-full" }
|
|
132
|
+
},
|
|
133
|
+
start: {
|
|
134
|
+
1: { root: "col-start-1" },
|
|
135
|
+
2: { root: "col-start-2" },
|
|
136
|
+
3: { root: "col-start-3" },
|
|
137
|
+
4: { root: "col-start-4" },
|
|
138
|
+
5: { root: "col-start-5" },
|
|
139
|
+
6: { root: "col-start-6" },
|
|
140
|
+
7: { root: "col-start-7" },
|
|
141
|
+
8: { root: "col-start-8" },
|
|
142
|
+
9: { root: "col-start-9" },
|
|
143
|
+
10: { root: "col-start-10" },
|
|
144
|
+
11: { root: "col-start-11" },
|
|
145
|
+
12: { root: "col-start-12" },
|
|
146
|
+
13: { root: "col-start-13" },
|
|
147
|
+
auto: { root: "col-start-auto" }
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
var GridItem = forwardRef(
|
|
152
|
+
({
|
|
153
|
+
children,
|
|
154
|
+
className,
|
|
155
|
+
classNames,
|
|
156
|
+
span,
|
|
157
|
+
spanXs,
|
|
158
|
+
spanSm,
|
|
159
|
+
spanMd,
|
|
160
|
+
spanLg,
|
|
161
|
+
spanXl,
|
|
162
|
+
start,
|
|
163
|
+
end,
|
|
164
|
+
rowSpan,
|
|
165
|
+
...props
|
|
166
|
+
}, ref) => {
|
|
167
|
+
const styles = gridItem({ end, rowSpan, span, spanLg, spanMd, spanSm, spanXl, spanXs, start });
|
|
168
|
+
return /* @__PURE__ */ jsx(
|
|
169
|
+
"div",
|
|
170
|
+
{
|
|
171
|
+
className: styles.root({ className: classNames?.root ?? className }),
|
|
172
|
+
ref,
|
|
173
|
+
...props,
|
|
174
|
+
children
|
|
175
|
+
}
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
);
|
|
179
|
+
GridItem.displayName = "GridItem";
|
|
180
|
+
var grid = tv({
|
|
181
|
+
defaultVariants: {
|
|
182
|
+
flow: "dense"
|
|
183
|
+
},
|
|
184
|
+
slots: {
|
|
185
|
+
root: [
|
|
186
|
+
"u-grid",
|
|
187
|
+
"grid",
|
|
188
|
+
"grid-cols-12",
|
|
189
|
+
"gap-[var(--spacing-grid-gutter)]",
|
|
190
|
+
"w-full",
|
|
191
|
+
"container-[grid]/inline-size"
|
|
192
|
+
]
|
|
193
|
+
},
|
|
194
|
+
variants: {
|
|
195
|
+
align: {
|
|
196
|
+
center: { root: "content-center" },
|
|
197
|
+
end: { root: "content-end" },
|
|
198
|
+
start: { root: "content-start" },
|
|
199
|
+
stretch: { root: "content-stretch" }
|
|
200
|
+
},
|
|
201
|
+
flow: {
|
|
202
|
+
column: { root: "grid-auto-flow-col" },
|
|
203
|
+
dense: { root: "grid-auto-flow-dense" },
|
|
204
|
+
row: { root: "grid-auto-flow-row" }
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
var GridContext = createContext(null);
|
|
209
|
+
function useGrid() {
|
|
210
|
+
const context = useContext(GridContext);
|
|
211
|
+
if (!context) {
|
|
212
|
+
throw new Error("useGrid must be used within a <Grid.Root />");
|
|
213
|
+
}
|
|
214
|
+
return context;
|
|
215
|
+
}
|
|
216
|
+
var GridRoot = forwardRef(
|
|
217
|
+
({ children, className, classNames, flow, align, ...props }, ref) => {
|
|
218
|
+
const styles = grid({ align, flow });
|
|
219
|
+
return /* @__PURE__ */ jsx(GridContext.Provider, { value: { styles }, children: /* @__PURE__ */ jsx(
|
|
220
|
+
"div",
|
|
221
|
+
{
|
|
222
|
+
className: styles.root({ className: classNames?.root ?? className }),
|
|
223
|
+
ref,
|
|
224
|
+
...props,
|
|
225
|
+
children
|
|
226
|
+
}
|
|
227
|
+
) });
|
|
228
|
+
}
|
|
229
|
+
);
|
|
230
|
+
GridRoot.displayName = "GridRoot";
|
|
231
|
+
|
|
232
|
+
// src/grid/index.parts.ts
|
|
233
|
+
var index_parts_exports = {};
|
|
234
|
+
__export(index_parts_exports, {
|
|
235
|
+
Item: () => GridItem,
|
|
236
|
+
Root: () => GridRoot
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
export { index_parts_exports as Grid, gridItem, useGrid };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { HTMLAttributes, ElementType } from 'react';
|
|
3
|
+
|
|
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, children, className, level, ...props }: HeadingProps): react_jsx_runtime.JSX.Element;
|
|
21
|
+
displayName: string;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { Heading, type HeadingLevel, type HeadingProps };
|
|
@@ -1,17 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { tv, cn } from '@regardio/tailwind/utils';
|
|
2
|
+
import { replaceShyInString } from '@regardio/js/text';
|
|
3
3
|
import React, { isValidElement, cloneElement } from 'react';
|
|
4
4
|
import { jsx } from 'react/jsx-runtime';
|
|
5
5
|
|
|
6
|
-
// src/
|
|
7
|
-
var { cva, compose } = defineConfig({
|
|
8
|
-
hooks: {
|
|
9
|
-
onComplete: (className) => {
|
|
10
|
-
return twMerge(className);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
var cn = (...inputs) => twMerge(cx(inputs));
|
|
6
|
+
// src/heading/heading.tsx
|
|
15
7
|
var lowerCaseSzett = (text, _returnType) => {
|
|
16
8
|
const processString = (str) => {
|
|
17
9
|
const parts = str.split(/(ß)/g);
|
|
@@ -42,9 +34,6 @@ var lowerCaseSzett = (text, _returnType) => {
|
|
|
42
34
|
}
|
|
43
35
|
return text;
|
|
44
36
|
};
|
|
45
|
-
function replaceShyInString(input) {
|
|
46
|
-
return input.replace(/­/g, "\xAD");
|
|
47
|
-
}
|
|
48
37
|
function replaceShyInReactNode(node) {
|
|
49
38
|
if (typeof node === "string") {
|
|
50
39
|
return node.replace(/\u00AD/g, "");
|
|
@@ -71,31 +60,24 @@ function shy(input) {
|
|
|
71
60
|
}
|
|
72
61
|
return replaceShyInReactNode(input);
|
|
73
62
|
}
|
|
74
|
-
var
|
|
63
|
+
var levelVariants = {
|
|
64
|
+
1: ["text-2xl"],
|
|
65
|
+
2: ["text-xl"],
|
|
66
|
+
3: ["text-lg"],
|
|
67
|
+
4: ["text-md"],
|
|
68
|
+
5: ["text-sm"],
|
|
69
|
+
6: ["text-xs"]
|
|
70
|
+
};
|
|
71
|
+
var heading = tv({
|
|
75
72
|
base: [],
|
|
76
73
|
defaultVariants: {
|
|
77
74
|
level: 3
|
|
78
75
|
},
|
|
79
76
|
variants: {
|
|
80
|
-
level:
|
|
81
|
-
1: ["text-2xl"],
|
|
82
|
-
2: ["text-xl"],
|
|
83
|
-
3: ["text-lg"],
|
|
84
|
-
4: ["text-md"],
|
|
85
|
-
5: ["text-sm"],
|
|
86
|
-
6: ["text-xs"]
|
|
87
|
-
},
|
|
88
|
-
variant: {}
|
|
77
|
+
level: levelVariants
|
|
89
78
|
}
|
|
90
79
|
});
|
|
91
|
-
var Heading = ({
|
|
92
|
-
as,
|
|
93
|
-
children,
|
|
94
|
-
className,
|
|
95
|
-
level = 2,
|
|
96
|
-
variant,
|
|
97
|
-
...props
|
|
98
|
-
}) => {
|
|
80
|
+
var Heading = ({ as, children, className, level = 2, ...props }) => {
|
|
99
81
|
const word = lowerCaseSzett(shy(children));
|
|
100
82
|
const Component = as || `h${level}`;
|
|
101
83
|
return /* @__PURE__ */ jsx(
|
|
@@ -103,8 +85,7 @@ var Heading = ({
|
|
|
103
85
|
{
|
|
104
86
|
className: cn(
|
|
105
87
|
heading({
|
|
106
|
-
level
|
|
107
|
-
variant
|
|
88
|
+
level
|
|
108
89
|
}),
|
|
109
90
|
className
|
|
110
91
|
),
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ComponentProps } from 'react';
|
|
3
|
+
|
|
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: ({ children, className, variant }: HighlightProps) => react_jsx_runtime.JSX.Element;
|
|
12
|
+
|
|
13
|
+
export { Highlight, type HighlightProps };
|
|
@@ -1,31 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { twMerge } from 'fluid-tailwindcss/tailwind-merge';
|
|
1
|
+
import { tv } from '@regardio/tailwind/utils';
|
|
3
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
3
|
|
|
5
|
-
// src/
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
var li = cva({
|
|
4
|
+
// src/highlight/highlight.tsx
|
|
5
|
+
var highlightVariants = {
|
|
6
|
+
primary: ["highlight"]
|
|
7
|
+
};
|
|
8
|
+
var highlight = tv({
|
|
14
9
|
defaultVariants: {
|
|
15
10
|
variant: "primary"
|
|
16
11
|
},
|
|
17
12
|
variants: {
|
|
18
|
-
variant:
|
|
19
|
-
primary: ["highlight"]
|
|
20
|
-
}
|
|
13
|
+
variant: highlightVariants
|
|
21
14
|
}
|
|
22
15
|
});
|
|
23
|
-
var Highlight = (
|
|
24
|
-
const { children, className, variant } = props;
|
|
16
|
+
var Highlight = ({ children, className, variant }) => {
|
|
25
17
|
return /* @__PURE__ */ jsxs(
|
|
26
18
|
"mark",
|
|
27
19
|
{
|
|
28
|
-
className:
|
|
20
|
+
className: highlight({
|
|
29
21
|
className,
|
|
30
22
|
variant
|
|
31
23
|
}),
|
|
@@ -3,10 +3,5 @@ import * as react from 'react';
|
|
|
3
3
|
declare const NonceContext: react.Context<string>;
|
|
4
4
|
declare const NonceProvider: react.Provider<string>;
|
|
5
5
|
declare const useNonce: () => string;
|
|
6
|
-
/**
|
|
7
|
-
* Generate a cryptographically secure nonce for CSP.
|
|
8
|
-
* @returns A base64-encoded random nonce
|
|
9
|
-
*/
|
|
10
|
-
declare function generateNonce(): string;
|
|
11
6
|
|
|
12
|
-
export { NonceContext, NonceProvider,
|
|
7
|
+
export { NonceContext, NonceProvider, useNonce };
|
package/dist/hooks/use-nonce.js
CHANGED
|
@@ -4,10 +4,5 @@ import { createContext, useContext } from 'react';
|
|
|
4
4
|
var NonceContext = createContext("");
|
|
5
5
|
var NonceProvider = NonceContext.Provider;
|
|
6
6
|
var useNonce = () => useContext(NonceContext);
|
|
7
|
-
function generateNonce() {
|
|
8
|
-
const array = new Uint8Array(16);
|
|
9
|
-
crypto.getRandomValues(array);
|
|
10
|
-
return btoa(String.fromCharCode(...array));
|
|
11
|
-
}
|
|
12
7
|
|
|
13
|
-
export { NonceContext, NonceProvider,
|
|
8
|
+
export { NonceContext, NonceProvider, useNonce };
|
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { twMerge } from 'fluid-tailwindcss/tailwind-merge';
|
|
1
|
+
import { cn } from '@regardio/tailwind/utils';
|
|
3
2
|
import { jsx } from 'react/jsx-runtime';
|
|
4
3
|
|
|
5
|
-
// src/
|
|
6
|
-
var { cva, compose } = defineConfig({
|
|
7
|
-
hooks: {
|
|
8
|
-
onComplete: (className) => {
|
|
9
|
-
return twMerge(className);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
var cn = (...inputs) => twMerge(cx(inputs));
|
|
4
|
+
// src/iframe/iframe.tsx
|
|
14
5
|
var Iframe = ({ src, title, className }) => /* @__PURE__ */ jsx(
|
|
15
6
|
"iframe",
|
|
16
7
|
{
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import * as cva from 'cva';
|
|
2
|
-
import { VariantProps } from 'cva';
|
|
3
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
2
|
import * as react from 'react';
|
|
5
3
|
import { NavLinkProps } from 'react-router';
|
|
@@ -21,23 +19,31 @@ interface LinkBaseProps extends Omit<NavLinkProps, 'to'> {
|
|
|
21
19
|
viewTransition?: boolean;
|
|
22
20
|
}
|
|
23
21
|
declare const LinkBase: ({ className, to, routeKey, children, onClick, viewTransition, ...props }: LinkBaseProps) => react_jsx_runtime.JSX.Element;
|
|
24
|
-
declare const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
22
|
+
declare const arrowVariants: {
|
|
23
|
+
readonly darr: "darr";
|
|
24
|
+
readonly larr: "larr";
|
|
25
|
+
readonly rarr: "rarr";
|
|
26
|
+
readonly uarr: "uarr";
|
|
27
|
+
};
|
|
28
|
+
declare const linkVariants: {
|
|
29
|
+
readonly button: readonly ["block", "button", "mt-s", "relative", "rarr", "text-right", "text-sm", "tracking-wider", "uppercase"];
|
|
30
|
+
readonly code: readonly ["font-monospace"];
|
|
31
|
+
readonly link: readonly ["rarr", "!bg-transparent", "uppercase", "!tracking-wider"];
|
|
32
|
+
readonly navtitle: readonly ["block", "uppercase", "tracking-wider"];
|
|
33
|
+
readonly primary: readonly [];
|
|
34
|
+
readonly subtitle: readonly ["text-lg"];
|
|
35
|
+
};
|
|
36
|
+
type LinkArrow = keyof typeof arrowVariants;
|
|
37
|
+
type LinkVariant = keyof typeof linkVariants;
|
|
38
|
+
interface LinkProps extends Omit<NavLinkProps, 'to'> {
|
|
39
|
+
arrow?: LinkArrow;
|
|
35
40
|
to?: string | Partial<{
|
|
36
41
|
pathname?: string;
|
|
37
42
|
search?: string;
|
|
38
43
|
hash?: string;
|
|
39
44
|
}>;
|
|
40
45
|
routeKey?: string;
|
|
46
|
+
variant?: LinkVariant;
|
|
41
47
|
viewTransition?: boolean;
|
|
42
48
|
}
|
|
43
49
|
declare const Link: ({ arrow, children, className, routeKey, to, variant, viewTransition, ...props }: LinkProps) => react_jsx_runtime.JSX.Element;
|
|
@@ -1,17 +1,10 @@
|
|
|
1
|
+
import { tv } from '@regardio/tailwind/utils';
|
|
1
2
|
import React, { createContext, useContext, useCallback, isValidElement, cloneElement } from 'react';
|
|
2
3
|
import { NavLink } from 'react-router';
|
|
3
|
-
import
|
|
4
|
-
import { twMerge } from 'fluid-tailwindcss/tailwind-merge';
|
|
4
|
+
import '@regardio/js/text';
|
|
5
5
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
6
6
|
|
|
7
|
-
// src/
|
|
8
|
-
var { cva, compose } = defineConfig({
|
|
9
|
-
hooks: {
|
|
10
|
-
onComplete: (className) => {
|
|
11
|
-
return twMerge(className);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
});
|
|
7
|
+
// src/link/link.tsx
|
|
15
8
|
var lowerCaseSzett = (text, _returnType) => {
|
|
16
9
|
const processString = (str) => {
|
|
17
10
|
const parts = str.split(/(ß)/g);
|
|
@@ -125,36 +118,38 @@ var LinkBase = ({
|
|
|
125
118
|
}
|
|
126
119
|
);
|
|
127
120
|
};
|
|
128
|
-
var
|
|
121
|
+
var arrowVariants = {
|
|
122
|
+
darr: "darr",
|
|
123
|
+
larr: "larr",
|
|
124
|
+
rarr: "rarr",
|
|
125
|
+
uarr: "uarr"
|
|
126
|
+
};
|
|
127
|
+
var linkVariants = {
|
|
128
|
+
button: [
|
|
129
|
+
"block",
|
|
130
|
+
"button",
|
|
131
|
+
"mt-s",
|
|
132
|
+
"relative",
|
|
133
|
+
"rarr",
|
|
134
|
+
"text-right",
|
|
135
|
+
"text-sm",
|
|
136
|
+
"tracking-wider",
|
|
137
|
+
"uppercase"
|
|
138
|
+
],
|
|
139
|
+
code: ["font-monospace"],
|
|
140
|
+
link: ["rarr", "!bg-transparent", "uppercase", "!tracking-wider"],
|
|
141
|
+
navtitle: ["block", "uppercase", "tracking-wider"],
|
|
142
|
+
primary: [],
|
|
143
|
+
subtitle: ["text-lg"]
|
|
144
|
+
};
|
|
145
|
+
var link = tv({
|
|
129
146
|
base: [],
|
|
130
147
|
defaultVariants: {
|
|
131
148
|
variant: "primary"
|
|
132
149
|
},
|
|
133
150
|
variants: {
|
|
134
|
-
arrow:
|
|
135
|
-
|
|
136
|
-
larr: "larr",
|
|
137
|
-
rarr: "rarr",
|
|
138
|
-
uarr: "uarr"
|
|
139
|
-
},
|
|
140
|
-
variant: {
|
|
141
|
-
button: [
|
|
142
|
-
"block",
|
|
143
|
-
"button",
|
|
144
|
-
"mt-s",
|
|
145
|
-
"relative",
|
|
146
|
-
"rarr",
|
|
147
|
-
"text-right",
|
|
148
|
-
"text-sm",
|
|
149
|
-
"tracking-wider",
|
|
150
|
-
"uppercase"
|
|
151
|
-
],
|
|
152
|
-
code: ["font-monospace"],
|
|
153
|
-
link: ["rarr", "!bg-transparent", "uppercase", "!tracking-wider"],
|
|
154
|
-
navtitle: ["block", "uppercase", "tracking-wider"],
|
|
155
|
-
primary: [],
|
|
156
|
-
subtitle: ["text-lg"]
|
|
157
|
-
}
|
|
151
|
+
arrow: arrowVariants,
|
|
152
|
+
variant: linkVariants
|
|
158
153
|
}
|
|
159
154
|
});
|
|
160
155
|
var Link = ({
|
|
@@ -173,7 +168,7 @@ var Link = ({
|
|
|
173
168
|
...props,
|
|
174
169
|
className: link({
|
|
175
170
|
arrow,
|
|
176
|
-
className,
|
|
171
|
+
className: typeof className === "string" ? className : void 0,
|
|
177
172
|
variant
|
|
178
173
|
}),
|
|
179
174
|
routeKey,
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ComponentPropsWithoutRef, ReactNode, ForwardedRef } from 'react';
|
|
3
|
+
|
|
4
|
+
type ListItemElement = 'li' | 'dd' | 'dt' | 'div' | 'span';
|
|
5
|
+
type ListItemProps<T extends ListItemElement = 'li'> = Omit<ComponentPropsWithoutRef<T>, 'children'> & {
|
|
6
|
+
/**
|
|
7
|
+
* The element type to render.
|
|
8
|
+
* Falls back to the defaultItemElement from ListRoot context, or 'li'.
|
|
9
|
+
*/
|
|
10
|
+
render?: T;
|
|
11
|
+
/**
|
|
12
|
+
* The content of the list item.
|
|
13
|
+
*/
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
};
|
|
16
|
+
declare function ListItemImpl<T extends ListItemElement = 'li'>(props: ListItemProps<T>, ref: ForwardedRef<HTMLElement>): react_jsx_runtime.JSX.Element;
|
|
17
|
+
declare const ListItem: <T extends ListItemElement = "li">(props: ListItemProps<T> & {
|
|
18
|
+
ref?: ForwardedRef<HTMLElement>;
|
|
19
|
+
}) => ReturnType<typeof ListItemImpl>;
|
|
20
|
+
declare namespace ListItem {
|
|
21
|
+
type Props<T extends ListItemElement = 'li'> = ListItemProps<T>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface ListRootContextValue {
|
|
25
|
+
/**
|
|
26
|
+
* Default element type for list items.
|
|
27
|
+
* @default 'li'
|
|
28
|
+
*/
|
|
29
|
+
defaultItemElement: 'li' | 'dd' | 'dt' | 'div' | 'span';
|
|
30
|
+
/**
|
|
31
|
+
* Default className to apply to all list items.
|
|
32
|
+
*/
|
|
33
|
+
defaultItemClassName?: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
type ListRootElement = 'ul' | 'ol' | 'dl' | 'div' | 'menu' | 'nav';
|
|
37
|
+
type ListRootProps<T extends ListRootElement = 'ul'> = Omit<ComponentPropsWithoutRef<T>, 'children'> & {
|
|
38
|
+
/**
|
|
39
|
+
* The element type to render.
|
|
40
|
+
* @default 'ul'
|
|
41
|
+
*/
|
|
42
|
+
render?: T;
|
|
43
|
+
/**
|
|
44
|
+
* The content of the list.
|
|
45
|
+
*/
|
|
46
|
+
children?: ReactNode;
|
|
47
|
+
/**
|
|
48
|
+
* Default element type for list items.
|
|
49
|
+
* When render is 'dl', defaults to 'dd'. Otherwise defaults to 'li'.
|
|
50
|
+
*/
|
|
51
|
+
defaultItemElement?: ListRootContextValue['defaultItemElement'];
|
|
52
|
+
/**
|
|
53
|
+
* Default className to apply to all list items.
|
|
54
|
+
*/
|
|
55
|
+
defaultItemClassName?: string;
|
|
56
|
+
};
|
|
57
|
+
declare function ListRootImpl<T extends ListRootElement = 'ul'>(props: ListRootProps<T>, ref: ForwardedRef<HTMLElement>): react_jsx_runtime.JSX.Element;
|
|
58
|
+
declare const ListRoot: <T extends ListRootElement = "ul">(props: ListRootProps<T> & {
|
|
59
|
+
ref?: ForwardedRef<HTMLElement>;
|
|
60
|
+
}) => ReturnType<typeof ListRootImpl>;
|
|
61
|
+
declare namespace ListRoot {
|
|
62
|
+
type Props<T extends ListRootElement = 'ul'> = ListRootProps<T>;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
declare namespace index_parts {
|
|
66
|
+
export { ListItem as Item, ListRoot as Root };
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export { index_parts as List, type ListItemProps, type ListRootContextValue, type ListRootProps };
|