@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.
Files changed (172) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +6 -8
  3. package/dist/{components/background-slideshow.js → background-slideshow/index.js} +2 -11
  4. package/dist/{components/blurry-gradient.js → blurry-gradient/index.js} +15 -9
  5. package/dist/{components/carousel.d.ts → carousel/index.d.ts} +17 -9
  6. package/dist/{components/carousel.js → carousel/index.js} +34 -30
  7. package/dist/{components/countdown.js → countdown/index.js} +2 -11
  8. package/dist/{components/generic-error.js → generic-error/index.js} +1 -1
  9. package/dist/grid/index.d.ts +1196 -0
  10. package/dist/grid/index.js +239 -0
  11. package/dist/heading/index.d.ts +24 -0
  12. package/dist/{components/heading.js → heading/index.js} +15 -34
  13. package/dist/highlight/index.d.ts +13 -0
  14. package/dist/{components/highlight.js → highlight/index.js} +9 -17
  15. package/dist/hooks/use-nonce.d.ts +1 -6
  16. package/dist/hooks/use-nonce.js +1 -6
  17. package/dist/{components/icon-button.js → icon-button/index.js} +1 -1
  18. package/dist/{components/if.js → if/index.js} +1 -1
  19. package/dist/{components/iframe.js → iframe/index.js} +2 -11
  20. package/dist/{components/link.d.ts → link/index.d.ts} +19 -13
  21. package/dist/{components/link.js → link/index.js} +31 -36
  22. package/dist/list/index.d.ts +69 -0
  23. package/dist/list/index.js +65 -0
  24. package/dist/{components/markdown-container.js → markdown-container/index.js} +3 -67
  25. package/dist/{components/password-input.js → password-input/index.js} +2 -11
  26. package/dist/{components/picture.js → picture/index.js} +2 -11
  27. package/dist/{components/protected-email.d.ts → protected-email/index.d.ts} +1 -1
  28. package/dist/{components/protected-email.js → protected-email/index.js} +1 -1
  29. package/dist/text/index.d.ts +20 -0
  30. package/dist/text/index.js +38 -0
  31. package/dist/utils/author/index.d.ts +3 -0
  32. package/dist/utils/author/index.js +33 -0
  33. package/dist/utils/text/index.d.ts +15 -0
  34. package/dist/utils/text/index.js +73 -0
  35. package/package.json +170 -187
  36. package/src/background-slideshow/background-slideshow.stories.tsx +137 -0
  37. package/src/{components → background-slideshow}/background-slideshow.tsx +3 -1
  38. package/src/background-slideshow/index.ts +2 -0
  39. package/src/{stories/BlurryGradient.stories.tsx → blurry-gradient/blurry-gradient.stories.tsx} +1 -1
  40. package/src/{components → blurry-gradient}/blurry-gradient.tsx +14 -8
  41. package/src/blurry-gradient/index.ts +2 -0
  42. package/src/carousel/carousel-content.tsx +16 -0
  43. package/src/carousel/carousel-item.tsx +23 -0
  44. package/src/carousel/carousel-next.tsx +22 -0
  45. package/src/carousel/carousel-previous.tsx +22 -0
  46. package/src/{components/carousel.tsx → carousel/carousel-root.tsx} +8 -78
  47. package/src/carousel/carousel.stories.tsx +135 -0
  48. package/src/carousel/index.parts.ts +5 -0
  49. package/src/carousel/index.ts +4 -0
  50. package/src/{stories/Countdown.stories.tsx → countdown/countdown.stories.tsx} +1 -1
  51. package/src/{components → countdown}/countdown.tsx +3 -7
  52. package/src/countdown/index.ts +1 -0
  53. package/src/{stories/GenericError.stories.tsx → generic-error/generic-error.stories.tsx} +1 -1
  54. package/src/{components → generic-error}/generic-error.tsx +2 -0
  55. package/src/generic-error/index.ts +2 -0
  56. package/src/grid/grid-item.tsx +188 -0
  57. package/src/grid/grid-root.tsx +72 -0
  58. package/src/grid/grid.stories.tsx +236 -0
  59. package/src/grid/index.parts.ts +2 -0
  60. package/src/grid/index.ts +5 -0
  61. package/src/{stories/Heading.stories.tsx → heading/heading.stories.tsx} +1 -1
  62. package/src/{components → heading}/heading.tsx +17 -25
  63. package/src/heading/index.ts +2 -0
  64. package/src/{stories/Highlight.stories.tsx → highlight/highlight.stories.tsx} +1 -1
  65. package/src/{components → highlight}/highlight.tsx +13 -9
  66. package/src/highlight/index.ts +2 -0
  67. package/src/hooks/use-nonce.ts +0 -10
  68. package/src/{stories/IconButton.stories.tsx → icon-button/icon-button.stories.tsx} +1 -1
  69. package/src/icon-button/index.ts +2 -0
  70. package/src/{stories/If.stories.tsx → if/if.stories.tsx} +1 -1
  71. package/src/if/index.ts +1 -0
  72. package/src/{stories/Iframe.stories.tsx → iframe/iframe.stories.tsx} +1 -1
  73. package/src/{components → iframe}/iframe.tsx +1 -1
  74. package/src/iframe/index.ts +2 -0
  75. package/src/link/index.ts +2 -0
  76. package/src/{stories/Link.stories.tsx → link/link.stories.tsx} +52 -1
  77. package/src/{components → link}/link.tsx +39 -28
  78. package/src/list/index.parts.ts +2 -0
  79. package/src/list/index.ts +4 -0
  80. package/src/list/list-item.tsx +63 -0
  81. package/src/list/list-root-context.ts +21 -0
  82. package/src/list/list-root.tsx +81 -0
  83. package/src/list/list.css +32 -0
  84. package/src/list/list.stories.tsx +119 -0
  85. package/src/list/list.test.tsx +168 -0
  86. package/src/markdown-container/index.ts +2 -0
  87. package/src/{stories/MarkdownContainer.stories.tsx → markdown-container/markdown-container.stories.tsx} +56 -1
  88. package/src/{components → markdown-container}/markdown-container.tsx +3 -1
  89. package/src/password-input/index.ts +2 -0
  90. package/src/{stories/PasswordInput.stories.tsx → password-input/password-input.stories.tsx} +1 -1
  91. package/src/{components → password-input}/password-input.tsx +4 -4
  92. package/src/picture/index.ts +2 -0
  93. package/src/{stories/Picture.stories.tsx → picture/picture.stories.tsx} +1 -1
  94. package/src/{components → picture}/picture.tsx +2 -4
  95. package/src/protected-email/index.ts +2 -0
  96. package/src/{stories/ProtectedEmail.stories.tsx → protected-email/protected-email.stories.tsx} +1 -1
  97. package/src/{components → protected-email}/protected-email.tsx +3 -1
  98. package/src/tailwind.css +10 -0
  99. package/src/text/index.ts +2 -0
  100. package/src/{stories/Text.stories.tsx → text/text.stories.tsx} +1 -1
  101. package/src/text/text.tsx +46 -0
  102. package/src/utils/author/author.tsx +36 -0
  103. package/src/utils/author/index.ts +1 -0
  104. package/src/utils/text/index.ts +1 -0
  105. package/src/utils/text/text.tsx +103 -0
  106. package/dist/components/box.d.ts +0 -20
  107. package/dist/components/box.js +0 -50
  108. package/dist/components/definition-list.d.ts +0 -43
  109. package/dist/components/definition-list.js +0 -89
  110. package/dist/components/heading.d.ts +0 -27
  111. package/dist/components/highlight.d.ts +0 -19
  112. package/dist/components/item.d.ts +0 -70
  113. package/dist/components/item.js +0 -512
  114. package/dist/components/leaflet-map.d.ts +0 -34
  115. package/dist/components/leaflet-map.js +0 -201
  116. package/dist/components/list-item.d.ts +0 -19
  117. package/dist/components/list-item.js +0 -37
  118. package/dist/components/maptiler-map.d.ts +0 -27
  119. package/dist/components/maptiler-map.js +0 -129
  120. package/dist/components/text.d.ts +0 -20
  121. package/dist/components/text.js +0 -45
  122. package/dist/components/unordered-list.d.ts +0 -19
  123. package/dist/components/unordered-list.js +0 -39
  124. package/dist/utils/author.d.ts +0 -9
  125. package/dist/utils/author.js +0 -55
  126. package/dist/utils/cn.d.ts +0 -9
  127. package/dist/utils/cn.js +0 -14
  128. package/dist/utils/is-route-active.d.ts +0 -19
  129. package/dist/utils/is-route-active.js +0 -56
  130. package/dist/utils/text.d.ts +0 -24
  131. package/dist/utils/text.js +0 -127
  132. package/src/components/box.tsx +0 -45
  133. package/src/components/definition-list.tsx +0 -90
  134. package/src/components/item.tsx +0 -340
  135. package/src/components/leaflet-map.tsx +0 -294
  136. package/src/components/link.test.tsx +0 -387
  137. package/src/components/list-item.tsx +0 -30
  138. package/src/components/maptiler-map.tsx +0 -181
  139. package/src/components/text.tsx +0 -38
  140. package/src/components/unordered-list.tsx +0 -32
  141. package/src/hooks/use-nonce.test.ts +0 -35
  142. package/src/stories/BackgroundSlideshow.stories.tsx +0 -68
  143. package/src/stories/Box.stories.tsx +0 -83
  144. package/src/stories/Carousel.stories.tsx +0 -95
  145. package/src/stories/DefinitionList.stories.tsx +0 -51
  146. package/src/stories/Item.stories.tsx +0 -79
  147. package/src/stories/ListItem.stories.tsx +0 -38
  148. package/src/stories/UnorderedList.stories.tsx +0 -73
  149. package/src/styles/tailwind.css +0 -7
  150. package/src/test-setup.ts +0 -1
  151. package/src/utils/author.test.ts +0 -54
  152. package/src/utils/author.tsx +0 -73
  153. package/src/utils/cn.test.ts +0 -48
  154. package/src/utils/cn.ts +0 -14
  155. package/src/utils/is-route-active.test.ts +0 -80
  156. package/src/utils/is-route-active.ts +0 -100
  157. package/src/utils/text.test.ts +0 -152
  158. package/src/utils/text.tsx +0 -209
  159. package/src/vite-env.d.ts +0 -1
  160. /package/dist/{components/background-slideshow.d.ts → background-slideshow/index.d.ts} +0 -0
  161. /package/dist/{components/blurry-gradient.d.ts → blurry-gradient/index.d.ts} +0 -0
  162. /package/dist/{components/countdown.d.ts → countdown/index.d.ts} +0 -0
  163. /package/dist/{components/generic-error.d.ts → generic-error/index.d.ts} +0 -0
  164. /package/dist/{components/icon-button.d.ts → icon-button/index.d.ts} +0 -0
  165. /package/dist/{components/if.d.ts → if/index.d.ts} +0 -0
  166. /package/dist/{components/iframe.d.ts → iframe/index.d.ts} +0 -0
  167. /package/dist/{components/markdown-container.d.ts → markdown-container/index.d.ts} +0 -0
  168. /package/dist/{components/password-input.d.ts → password-input/index.d.ts} +0 -0
  169. /package/dist/{components/picture.d.ts → picture/index.d.ts} +0 -0
  170. /package/src/{components → icon-button}/icon-button.tsx +0 -0
  171. /package/src/{components → if}/if.tsx +0 -0
  172. /package/src/{styles/storybook.css → storybook.css} +0 -0
@@ -0,0 +1,16 @@
1
+ 'use client';
2
+
3
+ import { forwardRef, type HTMLAttributes } from 'react';
4
+
5
+ export const CarouselContent = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
6
+ ({ className, ...props }, ref) => {
7
+ return (
8
+ <div
9
+ className={className}
10
+ ref={ref}
11
+ {...props}
12
+ />
13
+ );
14
+ },
15
+ );
16
+ CarouselContent.displayName = 'CarouselContent';
@@ -0,0 +1,23 @@
1
+ 'use client';
2
+
3
+ import { forwardRef, type HTMLAttributes } from 'react';
4
+
5
+ export interface CarouselItemProps extends HTMLAttributes<HTMLDivElement> {
6
+ 'aria-label'?: string;
7
+ }
8
+
9
+ export const CarouselItem = forwardRef<HTMLDivElement, CarouselItemProps>(
10
+ ({ className, ...props }, ref) => {
11
+ return (
12
+ // biome-ignore lint/a11y/useSemanticElements: False positive
13
+ <div
14
+ aria-roledescription="slide"
15
+ className={className}
16
+ ref={ref}
17
+ role="group"
18
+ {...props}
19
+ />
20
+ );
21
+ },
22
+ );
23
+ CarouselItem.displayName = 'CarouselItem';
@@ -0,0 +1,22 @@
1
+ 'use client';
2
+
3
+ import { forwardRef, type HTMLAttributes } from 'react';
4
+ import { useCarousel } from './carousel-root';
5
+
6
+ export const CarouselNext = forwardRef<HTMLButtonElement, HTMLAttributes<HTMLButtonElement>>(
7
+ ({ className, ...props }, ref) => {
8
+ const { canScrollNext, scrollNext } = useCarousel();
9
+
10
+ return (
11
+ <button
12
+ className={className}
13
+ disabled={!canScrollNext}
14
+ onClick={scrollNext}
15
+ ref={ref}
16
+ type="button"
17
+ {...props}
18
+ />
19
+ );
20
+ },
21
+ );
22
+ CarouselNext.displayName = 'CarouselNext';
@@ -0,0 +1,22 @@
1
+ 'use client';
2
+
3
+ import { forwardRef, type HTMLAttributes } from 'react';
4
+ import { useCarousel } from './carousel-root';
5
+
6
+ export const CarouselPrevious = forwardRef<HTMLButtonElement, HTMLAttributes<HTMLButtonElement>>(
7
+ ({ className, ...props }, ref) => {
8
+ const { canScrollPrev, scrollPrev } = useCarousel();
9
+
10
+ return (
11
+ <button
12
+ className={className}
13
+ disabled={!canScrollPrev}
14
+ onClick={scrollPrev}
15
+ ref={ref}
16
+ type="button"
17
+ {...props}
18
+ />
19
+ );
20
+ },
21
+ );
22
+ CarouselPrevious.displayName = 'CarouselPrevious';
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import type { EmblaCarouselType, EmblaOptionsType } from 'embla-carousel';
2
4
  import useEmblaCarousel from 'embla-carousel-react';
3
5
  import {
@@ -10,7 +12,6 @@ import {
10
12
  useEffect,
11
13
  useState,
12
14
  } from 'react';
13
- import { cn } from '../utils/cn';
14
15
 
15
16
  export type CarouselApi = EmblaCarouselType;
16
17
 
@@ -24,21 +25,21 @@ interface CarouselContextValue {
24
25
 
25
26
  const CarouselContext = createContext<CarouselContextValue | null>(null);
26
27
 
27
- function useCarousel() {
28
+ export function useCarousel() {
28
29
  const context = useContext(CarouselContext);
29
30
  if (!context) {
30
- throw new Error('useCarousel must be used within a <Carousel />');
31
+ throw new Error('useCarousel must be used within a <Carousel.Root />');
31
32
  }
32
33
  return context;
33
34
  }
34
35
 
35
- interface CarouselProps extends HTMLAttributes<HTMLDivElement> {
36
+ export interface CarouselRootProps extends HTMLAttributes<HTMLDivElement> {
36
37
  opts?: EmblaOptionsType;
37
38
  setApi?: (api: CarouselApi) => void;
38
39
  orientation?: 'horizontal' | 'vertical';
39
40
  }
40
41
 
41
- const Carousel = forwardRef<HTMLDivElement, CarouselProps>(
42
+ export const CarouselRoot = forwardRef<HTMLDivElement, CarouselRootProps>(
42
43
  ({ children, className, opts, orientation = 'horizontal', setApi, ...props }, ref) => {
43
44
  const [emblaRef, emblaApi] = useEmblaCarousel({
44
45
  ...opts,
@@ -110,7 +111,7 @@ const Carousel = forwardRef<HTMLDivElement, CarouselProps>(
110
111
  <section
111
112
  aria-label="Carousel"
112
113
  aria-roledescription="carousel"
113
- className={cn('relative', className)}
114
+ className={className}
114
115
  onKeyDownCapture={handleKeyDown}
115
116
  ref={ref}
116
117
  {...props}
@@ -123,75 +124,4 @@ const Carousel = forwardRef<HTMLDivElement, CarouselProps>(
123
124
  );
124
125
  },
125
126
  );
126
- Carousel.displayName = 'Carousel';
127
-
128
- const CarouselContent = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
129
- ({ className, ...props }, ref) => {
130
- return (
131
- <div
132
- className={cn('flex', className)}
133
- ref={ref}
134
- {...props}
135
- />
136
- );
137
- },
138
- );
139
- CarouselContent.displayName = 'CarouselContent';
140
-
141
- interface CarouselItemProps extends HTMLAttributes<HTMLDivElement> {
142
- 'aria-label'?: string;
143
- }
144
-
145
- const CarouselItem = forwardRef<HTMLDivElement, CarouselItemProps>(
146
- ({ className, ...props }, ref) => {
147
- return (
148
- // biome-ignore lint/a11y/useSemanticElements: False positive
149
- <div
150
- aria-roledescription="slide"
151
- className={cn('min-w-0 shrink-0 grow-0', className)}
152
- ref={ref}
153
- role="group"
154
- {...props}
155
- />
156
- );
157
- },
158
- );
159
- CarouselItem.displayName = 'CarouselItem';
160
-
161
- const CarouselPrevious = forwardRef<HTMLButtonElement, HTMLAttributes<HTMLButtonElement>>(
162
- ({ className, ...props }, ref) => {
163
- const { canScrollPrev, scrollPrev } = useCarousel();
164
-
165
- return (
166
- <button
167
- className={cn('disabled:opacity-50', className)}
168
- disabled={!canScrollPrev}
169
- onClick={scrollPrev}
170
- ref={ref}
171
- type="button"
172
- {...props}
173
- />
174
- );
175
- },
176
- );
177
- CarouselPrevious.displayName = 'CarouselPrevious';
178
-
179
- const CarouselNext = forwardRef<HTMLButtonElement, HTMLAttributes<HTMLButtonElement>>(
180
- ({ className, ...props }, ref) => {
181
- const { canScrollNext, scrollNext } = useCarousel();
182
-
183
- return (
184
- <button
185
- className={cn('disabled:opacity-50', className)}
186
- disabled={!canScrollNext}
187
- onClick={scrollNext}
188
- ref={ref}
189
- type="button"
190
- {...props}
191
- />
192
- );
193
- },
194
- );
195
- CarouselNext.displayName = 'CarouselNext';
196
-
197
- export { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, useCarousel };
127
+ CarouselRoot.displayName = 'CarouselRoot';
@@ -0,0 +1,135 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { Carousel } from './index';
3
+
4
+ const meta: Meta<typeof Carousel.Root> = {
5
+ component: Carousel.Root,
6
+ parameters: {
7
+ layout: 'padded',
8
+ },
9
+ tags: ['autodocs'],
10
+ title: 'Components/Carousel',
11
+ };
12
+
13
+ export default meta;
14
+ type Story = StoryObj<typeof Carousel.Root>;
15
+
16
+ const SlideCard = ({ children }: { children: React.ReactNode }) => (
17
+ <div
18
+ style={{
19
+ alignItems: 'center',
20
+ background: '#f0f0f0',
21
+ border: '1px solid #ddd',
22
+ borderRadius: '8px',
23
+ display: 'flex',
24
+ height: '200px',
25
+ justifyContent: 'center',
26
+ width: '300px',
27
+ }}
28
+ >
29
+ {children}
30
+ </div>
31
+ );
32
+
33
+ export const Default: Story = {
34
+ render: () => (
35
+ <Carousel.Root className="w-full max-w-md">
36
+ <Carousel.Content className="gap-4">
37
+ <Carousel.Item>
38
+ <SlideCard>Slide 1</SlideCard>
39
+ </Carousel.Item>
40
+ <Carousel.Item>
41
+ <SlideCard>Slide 2</SlideCard>
42
+ </Carousel.Item>
43
+ <Carousel.Item>
44
+ <SlideCard>Slide 3</SlideCard>
45
+ </Carousel.Item>
46
+ </Carousel.Content>
47
+ </Carousel.Root>
48
+ ),
49
+ };
50
+
51
+ export const WithControls: Story = {
52
+ render: () => (
53
+ <Carousel.Root className="w-full max-w-md">
54
+ <Carousel.Content className="gap-4">
55
+ <Carousel.Item>
56
+ <SlideCard>Slide 1</SlideCard>
57
+ </Carousel.Item>
58
+ <Carousel.Item>
59
+ <SlideCard>Slide 2</SlideCard>
60
+ </Carousel.Item>
61
+ <Carousel.Item>
62
+ <SlideCard>Slide 3</SlideCard>
63
+ </Carousel.Item>
64
+ </Carousel.Content>
65
+ <div className="flex justify-center gap-4 mt-4">
66
+ <Carousel.Previous className="px-4 py-2 bg-gray-200 rounded">Previous</Carousel.Previous>
67
+ <Carousel.Next className="px-4 py-2 bg-gray-200 rounded">Next</Carousel.Next>
68
+ </div>
69
+ </Carousel.Root>
70
+ ),
71
+ };
72
+
73
+ export const ManySlides: Story = {
74
+ render: () => (
75
+ <Carousel.Root className="w-full max-w-md">
76
+ <Carousel.Content className="gap-4">
77
+ {[1, 2, 3, 4, 5, 6].map((i) => (
78
+ <Carousel.Item key={i}>
79
+ <SlideCard>Slide {i}</SlideCard>
80
+ </Carousel.Item>
81
+ ))}
82
+ </Carousel.Content>
83
+ <div className="flex justify-center gap-4 mt-4">
84
+ <Carousel.Previous className="px-4 py-2 bg-gray-200 rounded">←</Carousel.Previous>
85
+ <Carousel.Next className="px-4 py-2 bg-gray-200 rounded">→</Carousel.Next>
86
+ </div>
87
+ </Carousel.Root>
88
+ ),
89
+ };
90
+
91
+ export const VerticalOrientation: Story = {
92
+ render: () => (
93
+ <Carousel.Root
94
+ className="w-full max-w-md h-[400px]"
95
+ orientation="vertical"
96
+ >
97
+ <Carousel.Content className="flex-col gap-4">
98
+ <Carousel.Item>
99
+ <SlideCard>Vertical Slide 1</SlideCard>
100
+ </Carousel.Item>
101
+ <Carousel.Item>
102
+ <SlideCard>Vertical Slide 2</SlideCard>
103
+ </Carousel.Item>
104
+ <Carousel.Item>
105
+ <SlideCard>Vertical Slide 3</SlideCard>
106
+ </Carousel.Item>
107
+ </Carousel.Content>
108
+ </Carousel.Root>
109
+ ),
110
+ };
111
+
112
+ export const WithOptions: Story = {
113
+ render: () => (
114
+ <Carousel.Root
115
+ className="w-full max-w-md"
116
+ opts={{ align: 'start', loop: true }}
117
+ >
118
+ <Carousel.Content className="gap-4">
119
+ <Carousel.Item>
120
+ <SlideCard>Loop Slide 1</SlideCard>
121
+ </Carousel.Item>
122
+ <Carousel.Item>
123
+ <SlideCard>Loop Slide 2</SlideCard>
124
+ </Carousel.Item>
125
+ <Carousel.Item>
126
+ <SlideCard>Loop Slide 3</SlideCard>
127
+ </Carousel.Item>
128
+ </Carousel.Content>
129
+ <div className="flex justify-center gap-4 mt-4">
130
+ <Carousel.Previous className="px-4 py-2 bg-gray-200 rounded">←</Carousel.Previous>
131
+ <Carousel.Next className="px-4 py-2 bg-gray-200 rounded">→</Carousel.Next>
132
+ </div>
133
+ </Carousel.Root>
134
+ ),
135
+ };
@@ -0,0 +1,5 @@
1
+ export { CarouselContent as Content } from './carousel-content';
2
+ export { CarouselItem as Item } from './carousel-item';
3
+ export { CarouselNext as Next } from './carousel-next';
4
+ export { CarouselPrevious as Previous } from './carousel-previous';
5
+ export { CarouselRoot as Root } from './carousel-root';
@@ -0,0 +1,4 @@
1
+ export type { CarouselItemProps } from './carousel-item';
2
+ export type { CarouselApi, CarouselRootProps } from './carousel-root';
3
+ export { useCarousel } from './carousel-root';
4
+ export * as Carousel from './index.parts';
@@ -1,5 +1,5 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react-vite';
2
- import { Countdown } from '../components/countdown';
2
+ import { Countdown } from './countdown';
3
3
 
4
4
  const meta: Meta<typeof Countdown> = {
5
5
  component: Countdown,
@@ -1,5 +1,7 @@
1
+ 'use client';
2
+
3
+ import { cn } from '@regardio/tailwind/utils';
1
4
  import { useEffect, useState } from 'react';
2
- import { cn } from '../utils/cn';
3
5
 
4
6
  export function Countdown() {
5
7
  const [timerValue, setTimerValue] = useState(0);
@@ -20,12 +22,6 @@ export function Countdown() {
20
22
  };
21
23
  }, []);
22
24
 
23
- // const formattedDate = partyDate.toLocaleDateString(data.locale, {
24
- // day: '2-digit',
25
- // month: 'long',
26
- // year: 'numeric',
27
- // });
28
-
29
25
  return (
30
26
  <div
31
27
  className={cn(
@@ -0,0 +1 @@
1
+ export { Countdown } from './countdown';
@@ -1,6 +1,6 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import { createMemoryRouter, RouterProvider } from 'react-router';
3
- import { GenericError, getErrorDescriptor } from '../components/generic-error';
3
+ import { GenericError, getErrorDescriptor } from './generic-error';
4
4
 
5
5
  const meta: Meta<typeof GenericError> = {
6
6
  component: GenericError,
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import type { ReactElement } from 'react';
2
4
  import { isRouteErrorResponse, useRouteError } from 'react-router';
3
5
 
@@ -0,0 +1,2 @@
1
+ export type { ErrorDescriptor } from './generic-error';
2
+ export { GenericError, getErrorDescriptor } from './generic-error';
@@ -0,0 +1,188 @@
1
+ import { tv, type VariantProps } from '@regardio/tailwind/utils';
2
+ import { forwardRef, type HTMLAttributes } from 'react';
3
+
4
+ const gridItem = tv({
5
+ defaultVariants: {
6
+ span: 12,
7
+ },
8
+ slots: {
9
+ root: ['relative'],
10
+ },
11
+ variants: {
12
+ end: {
13
+ 1: { root: 'col-end-1' },
14
+ 2: { root: 'col-end-2' },
15
+ 3: { root: 'col-end-3' },
16
+ 4: { root: 'col-end-4' },
17
+ 5: { root: 'col-end-5' },
18
+ 6: { root: 'col-end-6' },
19
+ 7: { root: 'col-end-7' },
20
+ 8: { root: 'col-end-8' },
21
+ 9: { root: 'col-end-9' },
22
+ 10: { root: 'col-end-10' },
23
+ 11: { root: 'col-end-11' },
24
+ 12: { root: 'col-end-12' },
25
+ 13: { root: 'col-end-13' },
26
+ auto: { root: 'col-end-auto' },
27
+ },
28
+ rowSpan: {
29
+ 1: { root: 'row-span-1' },
30
+ 2: { root: 'row-span-2' },
31
+ 3: { root: 'row-span-3' },
32
+ 4: { root: 'row-span-4' },
33
+ 5: { root: 'row-span-5' },
34
+ 6: { root: 'row-span-6' },
35
+ full: { root: 'row-span-full' },
36
+ },
37
+ span: {
38
+ 1: { root: 'col-span-1' },
39
+ 2: { root: 'col-span-2' },
40
+ 3: { root: 'col-span-3' },
41
+ 4: { root: 'col-span-4' },
42
+ 5: { root: 'col-span-5' },
43
+ 6: { root: 'col-span-6' },
44
+ 7: { root: 'col-span-7' },
45
+ 8: { root: 'col-span-8' },
46
+ 9: { root: 'col-span-9' },
47
+ 10: { root: 'col-span-10' },
48
+ 11: { root: 'col-span-11' },
49
+ 12: { root: 'col-span-12' },
50
+ full: { root: 'col-span-full' },
51
+ },
52
+ spanLg: {
53
+ 1: { root: '@lg:col-span-1' },
54
+ 2: { root: '@lg:col-span-2' },
55
+ 3: { root: '@lg:col-span-3' },
56
+ 4: { root: '@lg:col-span-4' },
57
+ 5: { root: '@lg:col-span-5' },
58
+ 6: { root: '@lg:col-span-6' },
59
+ 7: { root: '@lg:col-span-7' },
60
+ 8: { root: '@lg:col-span-8' },
61
+ 9: { root: '@lg:col-span-9' },
62
+ 10: { root: '@lg:col-span-10' },
63
+ 11: { root: '@lg:col-span-11' },
64
+ 12: { root: '@lg:col-span-12' },
65
+ full: { root: '@lg:col-span-full' },
66
+ },
67
+ spanMd: {
68
+ 1: { root: '@md:col-span-1' },
69
+ 2: { root: '@md:col-span-2' },
70
+ 3: { root: '@md:col-span-3' },
71
+ 4: { root: '@md:col-span-4' },
72
+ 5: { root: '@md:col-span-5' },
73
+ 6: { root: '@md:col-span-6' },
74
+ 7: { root: '@md:col-span-7' },
75
+ 8: { root: '@md:col-span-8' },
76
+ 9: { root: '@md:col-span-9' },
77
+ 10: { root: '@md:col-span-10' },
78
+ 11: { root: '@md:col-span-11' },
79
+ 12: { root: '@md:col-span-12' },
80
+ full: { root: '@md:col-span-full' },
81
+ },
82
+ spanSm: {
83
+ 1: { root: '@sm:col-span-1' },
84
+ 2: { root: '@sm:col-span-2' },
85
+ 3: { root: '@sm:col-span-3' },
86
+ 4: { root: '@sm:col-span-4' },
87
+ 5: { root: '@sm:col-span-5' },
88
+ 6: { root: '@sm:col-span-6' },
89
+ 7: { root: '@sm:col-span-7' },
90
+ 8: { root: '@sm:col-span-8' },
91
+ 9: { root: '@sm:col-span-9' },
92
+ 10: { root: '@sm:col-span-10' },
93
+ 11: { root: '@sm:col-span-11' },
94
+ 12: { root: '@sm:col-span-12' },
95
+ full: { root: '@sm:col-span-full' },
96
+ },
97
+ spanXl: {
98
+ 1: { root: '@xl:col-span-1' },
99
+ 2: { root: '@xl:col-span-2' },
100
+ 3: { root: '@xl:col-span-3' },
101
+ 4: { root: '@xl:col-span-4' },
102
+ 5: { root: '@xl:col-span-5' },
103
+ 6: { root: '@xl:col-span-6' },
104
+ 7: { root: '@xl:col-span-7' },
105
+ 8: { root: '@xl:col-span-8' },
106
+ 9: { root: '@xl:col-span-9' },
107
+ 10: { root: '@xl:col-span-10' },
108
+ 11: { root: '@xl:col-span-11' },
109
+ 12: { root: '@xl:col-span-12' },
110
+ full: { root: '@xl:col-span-full' },
111
+ },
112
+ spanXs: {
113
+ 1: { root: '@xs:col-span-1' },
114
+ 2: { root: '@xs:col-span-2' },
115
+ 3: { root: '@xs:col-span-3' },
116
+ 4: { root: '@xs:col-span-4' },
117
+ 5: { root: '@xs:col-span-5' },
118
+ 6: { root: '@xs:col-span-6' },
119
+ 7: { root: '@xs:col-span-7' },
120
+ 8: { root: '@xs:col-span-8' },
121
+ 9: { root: '@xs:col-span-9' },
122
+ 10: { root: '@xs:col-span-10' },
123
+ 11: { root: '@xs:col-span-11' },
124
+ 12: { root: '@xs:col-span-12' },
125
+ full: { root: '@xs:col-span-full' },
126
+ },
127
+ start: {
128
+ 1: { root: 'col-start-1' },
129
+ 2: { root: 'col-start-2' },
130
+ 3: { root: 'col-start-3' },
131
+ 4: { root: 'col-start-4' },
132
+ 5: { root: 'col-start-5' },
133
+ 6: { root: 'col-start-6' },
134
+ 7: { root: 'col-start-7' },
135
+ 8: { root: 'col-start-8' },
136
+ 9: { root: 'col-start-9' },
137
+ 10: { root: 'col-start-10' },
138
+ 11: { root: 'col-start-11' },
139
+ 12: { root: 'col-start-12' },
140
+ 13: { root: 'col-start-13' },
141
+ auto: { root: 'col-start-auto' },
142
+ },
143
+ },
144
+ });
145
+
146
+ export type GridItemVariants = VariantProps<typeof gridItem>;
147
+
148
+ export interface GridItemProps extends HTMLAttributes<HTMLDivElement>, GridItemVariants {
149
+ classNames?: {
150
+ root?: string;
151
+ };
152
+ }
153
+
154
+ export const GridItem = forwardRef<HTMLDivElement, GridItemProps>(
155
+ (
156
+ {
157
+ children,
158
+ className,
159
+ classNames,
160
+ span,
161
+ spanXs,
162
+ spanSm,
163
+ spanMd,
164
+ spanLg,
165
+ spanXl,
166
+ start,
167
+ end,
168
+ rowSpan,
169
+ ...props
170
+ },
171
+ ref,
172
+ ) => {
173
+ const styles = gridItem({ end, rowSpan, span, spanLg, spanMd, spanSm, spanXl, spanXs, start });
174
+
175
+ return (
176
+ <div
177
+ className={styles.root({ className: classNames?.root ?? className })}
178
+ ref={ref}
179
+ {...props}
180
+ >
181
+ {children}
182
+ </div>
183
+ );
184
+ },
185
+ );
186
+ GridItem.displayName = 'GridItem';
187
+
188
+ export { gridItem };
@@ -0,0 +1,72 @@
1
+ import { tv, type VariantProps } from '@regardio/tailwind/utils';
2
+ import { createContext, forwardRef, type HTMLAttributes, useContext } from 'react';
3
+
4
+ const grid = tv({
5
+ defaultVariants: {
6
+ flow: 'dense',
7
+ },
8
+ slots: {
9
+ root: [
10
+ 'u-grid',
11
+ 'grid',
12
+ 'grid-cols-12',
13
+ 'gap-[var(--spacing-grid-gutter)]',
14
+ 'w-full',
15
+ 'container-[grid]/inline-size',
16
+ ],
17
+ },
18
+ variants: {
19
+ align: {
20
+ center: { root: 'content-center' },
21
+ end: { root: 'content-end' },
22
+ start: { root: 'content-start' },
23
+ stretch: { root: 'content-stretch' },
24
+ },
25
+ flow: {
26
+ column: { root: 'grid-auto-flow-col' },
27
+ dense: { root: 'grid-auto-flow-dense' },
28
+ row: { root: 'grid-auto-flow-row' },
29
+ },
30
+ },
31
+ });
32
+
33
+ type GridVariants = VariantProps<typeof grid>;
34
+
35
+ interface GridContextValue {
36
+ styles: ReturnType<typeof grid>;
37
+ }
38
+
39
+ const GridContext = createContext<GridContextValue | null>(null);
40
+
41
+ export function useGrid() {
42
+ const context = useContext(GridContext);
43
+ if (!context) {
44
+ throw new Error('useGrid must be used within a <Grid.Root />');
45
+ }
46
+ return context;
47
+ }
48
+
49
+ export interface GridRootProps extends HTMLAttributes<HTMLDivElement>, GridVariants {
50
+ classNames?: {
51
+ root?: string;
52
+ };
53
+ }
54
+
55
+ export const GridRoot = forwardRef<HTMLDivElement, GridRootProps>(
56
+ ({ children, className, classNames, flow, align, ...props }, ref) => {
57
+ const styles = grid({ align, flow });
58
+
59
+ return (
60
+ <GridContext.Provider value={{ styles }}>
61
+ <div
62
+ className={styles.root({ className: classNames?.root ?? className })}
63
+ ref={ref}
64
+ {...props}
65
+ >
66
+ {children}
67
+ </div>
68
+ </GridContext.Provider>
69
+ );
70
+ },
71
+ );
72
+ GridRoot.displayName = 'GridRoot';