@regardio/react 0.5.7 → 0.6.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.
Files changed (180) hide show
  1. package/dist/background-slideshow/index.d.mts +36 -0
  2. package/dist/background-slideshow/index.mjs +110 -0
  3. package/dist/blurry-gradient/index.d.mts +17 -0
  4. package/dist/blurry-gradient/index.mjs +93 -0
  5. package/dist/button/index.d.mts +2 -0
  6. package/dist/button/index.mjs +3 -0
  7. package/dist/button-BiSQpBbc.mjs +129 -0
  8. package/dist/carousel/index.d.mts +40 -0
  9. package/dist/carousel/index.mjs +141 -0
  10. package/dist/checkbox/index.d.mts +37 -0
  11. package/dist/checkbox/index.mjs +70 -0
  12. package/dist/checkbox-group/index.d.mts +17 -0
  13. package/dist/checkbox-group/index.mjs +29 -0
  14. package/dist/chunk-BTpB_u-K.mjs +18 -0
  15. package/dist/countdown/index.d.mts +6 -0
  16. package/dist/countdown/index.mjs +58 -0
  17. package/dist/field/index.d.mts +66 -0
  18. package/dist/field/index.mjs +115 -0
  19. package/dist/fieldset/index.d.mts +33 -0
  20. package/dist/fieldset/index.mjs +61 -0
  21. package/dist/form/index.d.mts +22 -0
  22. package/dist/form/index.mjs +31 -0
  23. package/dist/generic-error/{index.d.ts → index.d.mts} +22 -18
  24. package/dist/generic-error/index.mjs +57 -0
  25. package/dist/grid/index.d.mts +1197 -0
  26. package/dist/grid/index.mjs +221 -0
  27. package/dist/heading/index.d.mts +31 -0
  28. package/dist/heading/index.mjs +29 -0
  29. package/dist/highlight/index.d.mts +18 -0
  30. package/dist/highlight/index.mjs +35 -0
  31. package/dist/hooks/{use-current-route-data.d.ts → use-current-route-data.d.mts} +3 -2
  32. package/dist/hooks/use-current-route-data.mjs +20 -0
  33. package/dist/hooks/{use-focus-search.d.ts → use-focus-search.d.mts} +4 -3
  34. package/dist/hooks/use-focus-search.mjs +21 -0
  35. package/dist/hooks/{use-matches-data.d.ts → use-matches-data.d.mts} +3 -2
  36. package/dist/hooks/use-matches-data.mjs +21 -0
  37. package/dist/hooks/{use-media-query.d.ts → use-media-query.d.mts} +3 -2
  38. package/dist/hooks/use-media-query.mjs +26 -0
  39. package/dist/hooks/use-mobile.d.mts +4 -0
  40. package/dist/hooks/use-mobile.mjs +20 -0
  41. package/dist/hooks/use-nonce.d.mts +8 -0
  42. package/dist/hooks/use-nonce.mjs +13 -0
  43. package/dist/hooks/{use-orientation.d.ts → use-orientation.d.mts} +3 -2
  44. package/dist/hooks/use-orientation.mjs +30 -0
  45. package/dist/hooks/use-user.d.mts +55 -0
  46. package/dist/hooks/use-user.mjs +39 -0
  47. package/dist/icon-button/index.d.mts +29 -0
  48. package/dist/icon-button/index.mjs +36 -0
  49. package/dist/if/index.d.mts +15 -0
  50. package/dist/if/index.mjs +21 -0
  51. package/dist/iframe/index.d.mts +11 -0
  52. package/dist/iframe/index.mjs +15 -0
  53. package/dist/index-Bm-tWhsb.d.mts +30 -0
  54. package/dist/index-YT2CkvL6.d.mts +36 -0
  55. package/dist/input/index.d.mts +2 -0
  56. package/dist/input/index.mjs +3 -0
  57. package/dist/input-CtR6aRVi.mjs +73 -0
  58. package/dist/link/index.d.mts +73 -0
  59. package/dist/link/index.mjs +129 -0
  60. package/dist/list/index.d.mts +71 -0
  61. package/dist/list/index.mjs +54 -0
  62. package/dist/markdown-container/index.d.mts +23 -0
  63. package/dist/markdown-container/index.mjs +71 -0
  64. package/dist/password-input/index.d.mts +24 -0
  65. package/dist/password-input/index.mjs +92 -0
  66. package/dist/picture/{index.d.ts → index.d.mts} +21 -20
  67. package/dist/picture/index.mjs +3 -0
  68. package/dist/picture-DkX3W5zl.mjs +69 -0
  69. package/dist/protected-email/{index.d.ts → index.d.mts} +14 -8
  70. package/dist/protected-email/index.mjs +37 -0
  71. package/dist/radio/index.d.mts +37 -0
  72. package/dist/radio/index.mjs +72 -0
  73. package/dist/radio-group/index.d.mts +17 -0
  74. package/dist/radio-group/index.mjs +29 -0
  75. package/dist/slider/index.d.mts +85 -0
  76. package/dist/slider/index.mjs +133 -0
  77. package/dist/switch/index.d.mts +38 -0
  78. package/dist/switch/index.mjs +87 -0
  79. package/dist/text/index.d.mts +26 -0
  80. package/dist/text/index.mjs +32 -0
  81. package/dist/text-CPlUND-Z.mjs +58 -0
  82. package/dist/toggle/index.d.mts +59 -0
  83. package/dist/toggle/index.mjs +82 -0
  84. package/dist/utils/author/index.d.mts +4 -0
  85. package/dist/utils/author/index.mjs +26 -0
  86. package/dist/utils/text/{index.d.ts → index.d.mts} +4 -3
  87. package/dist/utils/text/index.mjs +3 -0
  88. package/package.json +5 -117
  89. package/src/button/button.stories.tsx +161 -0
  90. package/src/button/button.test.tsx +73 -0
  91. package/src/button/button.tsx +112 -0
  92. package/src/button/index.ts +2 -0
  93. package/src/carousel/carousel-next.tsx +2 -2
  94. package/src/carousel/carousel-previous.tsx +2 -2
  95. package/src/checkbox/checkbox.stories.tsx +118 -0
  96. package/src/checkbox/checkbox.tsx +91 -0
  97. package/src/checkbox/index.ts +2 -0
  98. package/src/checkbox-group/checkbox-group.tsx +40 -0
  99. package/src/checkbox-group/index.ts +2 -0
  100. package/src/field/field.stories.tsx +105 -0
  101. package/src/field/field.test.tsx +61 -0
  102. package/src/field/field.tsx +165 -0
  103. package/src/field/index.ts +12 -0
  104. package/src/fieldset/fieldset.stories.tsx +204 -0
  105. package/src/fieldset/fieldset.test.tsx +63 -0
  106. package/src/fieldset/fieldset.tsx +75 -0
  107. package/src/fieldset/index.ts +7 -0
  108. package/src/form/form.stories.tsx +230 -0
  109. package/src/form/form.test.tsx +68 -0
  110. package/src/form/form.tsx +38 -0
  111. package/src/form/index.ts +2 -0
  112. package/src/icon-button/icon-button.stories.tsx +128 -7
  113. package/src/icon-button/icon-button.test.tsx +152 -0
  114. package/src/icon-button/icon-button.tsx +43 -9
  115. package/src/input/index.ts +2 -0
  116. package/src/input/input.stories.tsx +151 -0
  117. package/src/input/input.test.tsx +65 -0
  118. package/src/input/input.tsx +113 -0
  119. package/src/password-input/index.ts +1 -1
  120. package/src/password-input/password-input.tsx +104 -27
  121. package/src/radio/index.ts +2 -0
  122. package/src/radio/radio.tsx +92 -0
  123. package/src/radio-group/index.ts +2 -0
  124. package/src/radio-group/radio-group.tsx +36 -0
  125. package/src/slider/index.ts +18 -0
  126. package/src/slider/slider.tsx +179 -0
  127. package/src/switch/index.ts +2 -0
  128. package/src/switch/switch.stories.tsx +118 -0
  129. package/src/switch/switch.tsx +101 -0
  130. package/src/toggle/index.ts +2 -0
  131. package/src/toggle/toggle.stories.tsx +232 -0
  132. package/src/toggle/toggle.test.tsx +149 -0
  133. package/src/toggle/toggle.tsx +88 -0
  134. package/dist/background-slideshow/index.d.ts +0 -24
  135. package/dist/background-slideshow/index.js +0 -165
  136. package/dist/blurry-gradient/index.d.ts +0 -16
  137. package/dist/blurry-gradient/index.js +0 -128
  138. package/dist/carousel/index.d.ts +0 -36
  139. package/dist/carousel/index.js +0 -171
  140. package/dist/countdown/index.d.ts +0 -5
  141. package/dist/countdown/index.js +0 -73
  142. package/dist/generic-error/index.js +0 -47
  143. package/dist/grid/index.d.ts +0 -1196
  144. package/dist/grid/index.js +0 -239
  145. package/dist/heading/index.d.ts +0 -24
  146. package/dist/heading/index.js +0 -99
  147. package/dist/highlight/index.d.ts +0 -13
  148. package/dist/highlight/index.js +0 -59
  149. package/dist/hooks/use-current-route-data.js +0 -16
  150. package/dist/hooks/use-focus-search.js +0 -19
  151. package/dist/hooks/use-matches-data.js +0 -15
  152. package/dist/hooks/use-media-query.js +0 -20
  153. package/dist/hooks/use-mobile.d.ts +0 -3
  154. package/dist/hooks/use-mobile.js +0 -19
  155. package/dist/hooks/use-nonce.d.ts +0 -7
  156. package/dist/hooks/use-nonce.js +0 -8
  157. package/dist/hooks/use-orientation.js +0 -29
  158. package/dist/hooks/use-user.d.ts +0 -50
  159. package/dist/hooks/use-user.js +0 -25
  160. package/dist/icon-button/index.d.ts +0 -9
  161. package/dist/icon-button/index.js +0 -17
  162. package/dist/if/index.d.ts +0 -10
  163. package/dist/if/index.js +0 -24
  164. package/dist/iframe/index.d.ts +0 -10
  165. package/dist/iframe/index.js +0 -17
  166. package/dist/link/index.d.ts +0 -55
  167. package/dist/link/index.js +0 -195
  168. package/dist/list/index.d.ts +0 -69
  169. package/dist/list/index.js +0 -65
  170. package/dist/markdown-container/index.d.ts +0 -22
  171. package/dist/markdown-container/index.js +0 -128
  172. package/dist/password-input/index.d.ts +0 -11
  173. package/dist/password-input/index.js +0 -46
  174. package/dist/picture/index.js +0 -68
  175. package/dist/protected-email/index.js +0 -30
  176. package/dist/text/index.d.ts +0 -20
  177. package/dist/text/index.js +0 -38
  178. package/dist/utils/author/index.d.ts +0 -3
  179. package/dist/utils/author/index.js +0 -33
  180. package/dist/utils/text/index.js +0 -73
@@ -1,128 +0,0 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
-
3
- // src/blurry-gradient/blurry-gradient.tsx
4
- var BlurryGradient = (props) => {
5
- const {
6
- description = "Decorative blurry gradient",
7
- neutralColor,
8
- primaryColor,
9
- secondaryColor,
10
- ...svgProps
11
- } = props;
12
- const titleId = "blurryGradientTitle";
13
- return /* @__PURE__ */ jsxs(
14
- "svg",
15
- {
16
- "aria-labelledby": titleId,
17
- preserveAspectRatio: "none",
18
- role: "img",
19
- viewBox: "0 0 1000 1000",
20
- ...svgProps,
21
- children: [
22
- /* @__PURE__ */ jsx("title", { id: titleId, children: description }),
23
- /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs(
24
- "filter",
25
- {
26
- colorInterpolationFilters: "sRGB",
27
- filterUnits: "userSpaceOnUse",
28
- height: "120%",
29
- width: "120%",
30
- x: "-10%",
31
- y: "-10%",
32
- children: [
33
- /* @__PURE__ */ jsx(
34
- "feFlood",
35
- {
36
- floodOpacity: "0",
37
- result: "BackgroundImageFix"
38
- }
39
- ),
40
- /* @__PURE__ */ jsx(
41
- "feBlend",
42
- {
43
- in: "SourceGraphic",
44
- in2: "BackgroundImageFix",
45
- mode: "normal",
46
- result: "shape"
47
- }
48
- ),
49
- /* @__PURE__ */ jsx(
50
- "feGaussianBlur",
51
- {
52
- result: "effect1_foregroundBlur",
53
- stdDeviation: "161"
54
- }
55
- )
56
- ]
57
- }
58
- ) }),
59
- /* @__PURE__ */ jsx(
60
- "rect",
61
- {
62
- fill: primaryColor,
63
- height: "1000",
64
- width: "1000"
65
- }
66
- ),
67
- /* @__PURE__ */ jsxs("g", { filter: "url(#blurryGradient)", children: [
68
- /* @__PURE__ */ jsx(
69
- "circle",
70
- {
71
- cx: "730",
72
- cy: "559",
73
- fill: secondaryColor,
74
- r: "357"
75
- }
76
- ),
77
- /* @__PURE__ */ jsx(
78
- "circle",
79
- {
80
- cx: "316",
81
- cy: "248",
82
- fill: primaryColor,
83
- r: "357"
84
- }
85
- ),
86
- /* @__PURE__ */ jsx(
87
- "circle",
88
- {
89
- cx: "509",
90
- cy: "410",
91
- fill: neutralColor,
92
- r: "357"
93
- }
94
- ),
95
- /* @__PURE__ */ jsx(
96
- "circle",
97
- {
98
- cx: "633",
99
- cy: "232",
100
- fill: secondaryColor,
101
- r: "357"
102
- }
103
- ),
104
- /* @__PURE__ */ jsx(
105
- "circle",
106
- {
107
- cx: "156",
108
- cy: "82",
109
- fill: primaryColor,
110
- r: "357"
111
- }
112
- ),
113
- /* @__PURE__ */ jsx(
114
- "circle",
115
- {
116
- cx: "150",
117
- cy: "389",
118
- fill: neutralColor,
119
- r: "357"
120
- }
121
- )
122
- ] })
123
- ]
124
- }
125
- );
126
- };
127
-
128
- export { BlurryGradient };
@@ -1,36 +0,0 @@
1
- import * as react from 'react';
2
- import { HTMLAttributes } from 'react';
3
- import { EmblaCarouselType, EmblaOptionsType } from 'embla-carousel';
4
-
5
- interface CarouselItemProps extends HTMLAttributes<HTMLDivElement> {
6
- 'aria-label'?: string;
7
- }
8
- declare const CarouselItem: react.ForwardRefExoticComponent<CarouselItemProps & react.RefAttributes<HTMLDivElement>>;
9
-
10
- type CarouselApi = EmblaCarouselType;
11
- interface CarouselContextValue {
12
- api: CarouselApi | undefined;
13
- scrollPrev: () => void;
14
- scrollNext: () => void;
15
- canScrollPrev: boolean;
16
- canScrollNext: boolean;
17
- }
18
- declare function useCarousel(): CarouselContextValue;
19
- interface CarouselRootProps extends HTMLAttributes<HTMLDivElement> {
20
- opts?: EmblaOptionsType;
21
- setApi?: (api: CarouselApi) => void;
22
- orientation?: 'horizontal' | 'vertical';
23
- }
24
- declare const CarouselRoot: react.ForwardRefExoticComponent<CarouselRootProps & react.RefAttributes<HTMLDivElement>>;
25
-
26
- declare const CarouselContent: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & react.RefAttributes<HTMLDivElement>>;
27
-
28
- declare const CarouselNext: react.ForwardRefExoticComponent<HTMLAttributes<HTMLButtonElement> & react.RefAttributes<HTMLButtonElement>>;
29
-
30
- declare const CarouselPrevious: react.ForwardRefExoticComponent<HTMLAttributes<HTMLButtonElement> & react.RefAttributes<HTMLButtonElement>>;
31
-
32
- declare namespace index_parts {
33
- export { CarouselContent as Content, CarouselItem as Item, CarouselNext as Next, CarouselPrevious as Previous, CarouselRoot as Root };
34
- }
35
-
36
- export { index_parts as Carousel, type CarouselApi, type CarouselItemProps, type CarouselRootProps, useCarousel };
@@ -1,171 +0,0 @@
1
- import useEmblaCarousel from 'embla-carousel-react';
2
- import { createContext, forwardRef, useState, useCallback, useEffect, 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 CarouselContext = createContext(null);
11
- function useCarousel() {
12
- const context = useContext(CarouselContext);
13
- if (!context) {
14
- throw new Error("useCarousel must be used within a <Carousel.Root />");
15
- }
16
- return context;
17
- }
18
- var CarouselRoot = forwardRef(
19
- ({ children, className, opts, orientation = "horizontal", setApi, ...props }, ref) => {
20
- const [emblaRef, emblaApi] = useEmblaCarousel({
21
- ...opts,
22
- axis: orientation === "horizontal" ? "x" : "y"
23
- });
24
- const [canScrollPrev, setCanScrollPrev] = useState(false);
25
- const [canScrollNext, setCanScrollNext] = useState(false);
26
- const onSelect = useCallback((api) => {
27
- if (!api) {
28
- return;
29
- }
30
- setCanScrollPrev(api.canScrollPrev());
31
- setCanScrollNext(api.canScrollNext());
32
- }, []);
33
- const scrollPrev = useCallback(() => {
34
- emblaApi?.scrollPrev();
35
- }, [emblaApi]);
36
- const scrollNext = useCallback(() => {
37
- emblaApi?.scrollNext();
38
- }, [emblaApi]);
39
- const handleKeyDown = useCallback(
40
- (event) => {
41
- if (event.key === "ArrowLeft") {
42
- event.preventDefault();
43
- scrollPrev();
44
- } else if (event.key === "ArrowRight") {
45
- event.preventDefault();
46
- scrollNext();
47
- }
48
- },
49
- [scrollPrev, scrollNext]
50
- );
51
- useEffect(() => {
52
- if (!emblaApi || !setApi) {
53
- return;
54
- }
55
- setApi(emblaApi);
56
- }, [emblaApi, setApi]);
57
- useEffect(() => {
58
- if (!emblaApi) {
59
- return;
60
- }
61
- onSelect(emblaApi);
62
- emblaApi.on("reInit", onSelect);
63
- emblaApi.on("select", onSelect);
64
- return () => {
65
- emblaApi?.off("select", onSelect);
66
- };
67
- }, [emblaApi, onSelect]);
68
- return /* @__PURE__ */ jsx(
69
- CarouselContext.Provider,
70
- {
71
- value: {
72
- api: emblaApi,
73
- canScrollNext,
74
- canScrollPrev,
75
- scrollNext,
76
- scrollPrev
77
- },
78
- children: /* @__PURE__ */ jsx(
79
- "section",
80
- {
81
- "aria-label": "Carousel",
82
- "aria-roledescription": "carousel",
83
- className,
84
- onKeyDownCapture: handleKeyDown,
85
- ref,
86
- ...props,
87
- children: /* @__PURE__ */ jsx("div", { ref: emblaRef, children: /* @__PURE__ */ jsx("div", { children }) })
88
- }
89
- )
90
- }
91
- );
92
- }
93
- );
94
- CarouselRoot.displayName = "CarouselRoot";
95
-
96
- // src/carousel/index.parts.ts
97
- var index_parts_exports = {};
98
- __export(index_parts_exports, {
99
- Content: () => CarouselContent,
100
- Item: () => CarouselItem,
101
- Next: () => CarouselNext,
102
- Previous: () => CarouselPrevious,
103
- Root: () => CarouselRoot
104
- });
105
- var CarouselContent = forwardRef(
106
- ({ className, ...props }, ref) => {
107
- return /* @__PURE__ */ jsx(
108
- "div",
109
- {
110
- className,
111
- ref,
112
- ...props
113
- }
114
- );
115
- }
116
- );
117
- CarouselContent.displayName = "CarouselContent";
118
- var CarouselItem = forwardRef(
119
- ({ className, ...props }, ref) => {
120
- return (
121
- // biome-ignore lint/a11y/useSemanticElements: False positive
122
- /* @__PURE__ */ jsx(
123
- "div",
124
- {
125
- "aria-roledescription": "slide",
126
- className,
127
- ref,
128
- role: "group",
129
- ...props
130
- }
131
- )
132
- );
133
- }
134
- );
135
- CarouselItem.displayName = "CarouselItem";
136
- var CarouselNext = forwardRef(
137
- ({ className, ...props }, ref) => {
138
- const { canScrollNext, scrollNext } = useCarousel();
139
- return /* @__PURE__ */ jsx(
140
- "button",
141
- {
142
- className,
143
- disabled: !canScrollNext,
144
- onClick: scrollNext,
145
- ref,
146
- type: "button",
147
- ...props
148
- }
149
- );
150
- }
151
- );
152
- CarouselNext.displayName = "CarouselNext";
153
- var CarouselPrevious = forwardRef(
154
- ({ className, ...props }, ref) => {
155
- const { canScrollPrev, scrollPrev } = useCarousel();
156
- return /* @__PURE__ */ jsx(
157
- "button",
158
- {
159
- className,
160
- disabled: !canScrollPrev,
161
- onClick: scrollPrev,
162
- ref,
163
- type: "button",
164
- ...props
165
- }
166
- );
167
- }
168
- );
169
- CarouselPrevious.displayName = "CarouselPrevious";
170
-
171
- export { index_parts_exports as Carousel, useCarousel };
@@ -1,5 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
-
3
- declare function Countdown(): react_jsx_runtime.JSX.Element;
4
-
5
- export { Countdown };
@@ -1,73 +0,0 @@
1
- import { cn } from '@regardio/tailwind/utils';
2
- import { useState, useEffect } from 'react';
3
- import { jsx } from 'react/jsx-runtime';
4
-
5
- // src/countdown/countdown.tsx
6
- function Countdown() {
7
- const [timerValue, setTimerValue] = useState(0);
8
- const [isMounted, setIsMounted] = useState(false);
9
- useEffect(() => {
10
- setIsMounted(true);
11
- const intervalId = setInterval(() => {
12
- setTimerValue((prevValue) => {
13
- return prevValue + 1;
14
- });
15
- }, 1e3);
16
- return () => {
17
- return clearInterval(intervalId);
18
- };
19
- }, []);
20
- return /* @__PURE__ */ jsx(
21
- "div",
22
- {
23
- className: cn(
24
- "before:absolute",
25
- "before:bg-white",
26
- 'before:content-[""]',
27
- "before:h-[180px]",
28
- "before:rounded-full",
29
- "before:w-[180px]",
30
- "flex",
31
- "h-[240px]",
32
- "items-center",
33
- "justify-center",
34
- "relative",
35
- "rounded-full",
36
- "w-[240px]"
37
- ),
38
- style: {
39
- background: `conic-gradient(
40
- transparent ${6 * (isMounted ? timerValue : 0)}deg,
41
- hsl(var(--red-500)) 0deg,
42
- hsl(var(--red-500)) 15deg,
43
- hsl(var(--coral-500)) 15deg,
44
- hsl(var(--coral-500)) 45deg,
45
- hsl(var(--orange-500)) 45deg,
46
- hsl(var(--orange-500)) 75deg,
47
- hsl(var(--yellow-500)) 75deg,
48
- hsl(var(--yellow-500)) 105deg,
49
- hsl(var(--olive-500)) 105deg,
50
- hsl(var(--olive-500)) 135deg,
51
- hsl(var(--lime-500)) 135deg,
52
- hsl(var(--lime-500)) 165deg,
53
- hsl(var(--green-500)) 165deg,
54
- hsl(var(--green-500)) 195deg,
55
- hsl(var(--teal-500)) 195deg,
56
- hsl(var(--teal-500)) 225deg,
57
- hsl(var(--cyan-500)) 225deg,
58
- hsl(var(--cyan-500)) 255deg,
59
- hsl(var(--blue-500)) 255deg,
60
- hsl(var(--blue-500)) 285deg,
61
- hsl(var(--purple-500)) 285deg,
62
- hsl(var(--purple-500)) 315deg,
63
- hsl(var(--pink-500)) 315deg,
64
- hsl(var(--pink-500)) 345deg,
65
- hsl(var(--red-500)) 345deg
66
- )`
67
- },
68
- children: /* @__PURE__ */ jsx("span", { className: cn("text-foreground", "relative", "text-3xl", "font-bold"), children: isMounted ? timerValue < 10 ? `0${timerValue}` : timerValue : 0 })
69
- }
70
- );
71
- }
72
-
73
- export { Countdown };
@@ -1,47 +0,0 @@
1
- import { isRouteErrorResponse, useRouteError } from 'react-router';
2
- import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
3
-
4
- // src/generic-error/generic-error.tsx
5
- function getErrorDescriptor(error) {
6
- if (isRouteErrorResponse(error)) {
7
- const status = error.status;
8
- const statusText = error.statusText || "Error";
9
- return {
10
- defaultId: status === 404 ? "errors.404" : "errors.http",
11
- defaultMessage: status === 404 ? "Not found" : `Error ${status}`,
12
- status,
13
- statusText,
14
- type: "http"
15
- };
16
- }
17
- if (error instanceof Error) {
18
- return {
19
- defaultId: "errors.runtime",
20
- defaultMessage: "An unexpected error occurred.",
21
- message: error.message,
22
- type: "error",
23
- ...error.stack ? { stack: error.stack } : {}
24
- };
25
- }
26
- return {
27
- defaultId: "errors.unknown",
28
- defaultMessage: "An unexpected error occurred.",
29
- type: "unknown"
30
- };
31
- }
32
- function GenericError({
33
- renderMessage
34
- } = {}) {
35
- const error = useRouteError();
36
- const descriptor = getErrorDescriptor(error);
37
- const title = descriptor.type === "http" ? `Error ${descriptor.status}` : "Error";
38
- return /* @__PURE__ */ jsxs("main", { className: "pt-2xl p-sm container mx-auto", children: [
39
- /* @__PURE__ */ jsx("h1", { children: title }),
40
- renderMessage ? renderMessage(descriptor) : /* @__PURE__ */ jsxs(Fragment, { children: [
41
- /* @__PURE__ */ jsx("p", { children: descriptor.type === "http" ? descriptor.defaultMessage : descriptor.type === "error" ? descriptor.message || descriptor.defaultMessage : descriptor.defaultMessage }),
42
- import.meta.env.DEV && descriptor.type === "error" && descriptor.stack && /* @__PURE__ */ jsx("pre", { className: "w-full p-sm overflow-x-auto", children: /* @__PURE__ */ jsx("code", { children: descriptor.stack }) })
43
- ] })
44
- ] });
45
- }
46
-
47
- export { GenericError, getErrorDescriptor };