@zayne-labs/ui-react 0.9.8 → 0.9.12
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/esm/await-parts-BJ6C-y1f.d.ts +36 -0
- package/dist/esm/chunk-CLGH26AQ.js +337 -0
- package/dist/esm/chunk-CLGH26AQ.js.map +1 -0
- package/dist/esm/chunk-CWUEUCR5.js +3 -0
- package/dist/esm/chunk-CWUEUCR5.js.map +1 -0
- package/dist/esm/chunk-EYWTW54R.js +42 -0
- package/dist/esm/chunk-EYWTW54R.js.map +1 -0
- package/dist/esm/chunk-G5BNZM66.js +32 -0
- package/dist/esm/chunk-G5BNZM66.js.map +1 -0
- package/dist/esm/{chunk-IREUBYDK.js → chunk-JC52CA2O.js} +26 -23
- package/dist/esm/chunk-JC52CA2O.js.map +1 -0
- package/dist/esm/chunk-KLEJZWKY.js +45 -0
- package/dist/esm/chunk-KLEJZWKY.js.map +1 -0
- package/dist/esm/{chunk-V5DSTESN.js → chunk-M7YXNGT6.js} +3 -3
- package/dist/esm/{chunk-V5DSTESN.js.map → chunk-M7YXNGT6.js.map} +1 -1
- package/dist/esm/chunk-MT2MQDK2.js +13 -0
- package/dist/esm/chunk-MT2MQDK2.js.map +1 -0
- package/dist/esm/chunk-MY5NL5PB.js +627 -0
- package/dist/esm/chunk-MY5NL5PB.js.map +1 -0
- package/dist/esm/{chunk-XZRSR3EM.js → chunk-N4274N5K.js} +6 -2
- package/dist/esm/chunk-N4274N5K.js.map +1 -0
- package/dist/esm/chunk-V5ZPMMIH.js +121 -0
- package/dist/esm/chunk-V5ZPMMIH.js.map +1 -0
- package/dist/esm/{chunk-2P3P5AXH.js → chunk-Y5VBSXZS.js} +14 -7
- package/dist/esm/chunk-Y5VBSXZS.js.map +1 -0
- package/dist/esm/{chunk-IUEPHHGO.js → chunk-YO5LJ7ZJ.js} +2 -2
- package/dist/esm/{chunk-IUEPHHGO.js.map → chunk-YO5LJ7ZJ.js.map} +1 -1
- package/dist/esm/chunk-Z6JJE4G6.js +68 -0
- package/dist/esm/chunk-Z6JJE4G6.js.map +1 -0
- package/dist/esm/chunk-ZSDYJOYB.js +274 -0
- package/dist/esm/chunk-ZSDYJOYB.js.map +1 -0
- package/dist/esm/components/common/await/index.d.ts +10 -12
- package/dist/esm/components/common/await/index.js +5 -24
- package/dist/esm/components/common/await/index.js.map +1 -1
- package/dist/esm/components/common/error-boundary/index.d.ts +6 -30
- package/dist/esm/components/common/error-boundary/index.js +1 -2
- package/dist/esm/components/common/for/index.d.ts +6 -20
- package/dist/esm/components/common/index.d.ts +13 -0
- package/dist/esm/components/common/index.js +14 -0
- package/dist/esm/components/common/show/index.js +2 -2
- package/dist/esm/components/common/slot/index.d.ts +7 -3
- package/dist/esm/components/common/slot/index.js +1 -1
- package/dist/esm/components/common/suspense-with-boundary/index.d.ts +3 -3
- package/dist/esm/components/common/suspense-with-boundary/index.js +2 -12
- package/dist/esm/components/common/suspense-with-boundary/index.js.map +1 -1
- package/dist/esm/components/common/switch/index.js +3 -40
- package/dist/esm/components/common/switch/index.js.map +1 -1
- package/dist/esm/components/common/teleport/index.js +1 -29
- package/dist/esm/components/common/teleport/index.js.map +1 -1
- package/dist/esm/components/ui/card/index.js +4 -43
- package/dist/esm/components/ui/card/index.js.map +1 -1
- package/dist/esm/components/ui/carousel/index.js +14 -273
- package/dist/esm/components/ui/carousel/index.js.map +1 -1
- package/dist/esm/components/ui/drag-scroll/index.js +2 -119
- package/dist/esm/components/ui/drag-scroll/index.js.map +1 -1
- package/dist/esm/components/ui/drop-zone/index.d.ts +8 -181
- package/dist/esm/components/ui/drop-zone/index.js +15 -327
- package/dist/esm/components/ui/drop-zone/index.js.map +1 -1
- package/dist/esm/components/ui/form/index.js +7 -625
- package/dist/esm/components/ui/form/index.js.map +1 -1
- package/dist/esm/components/ui/index.d.ts +11 -0
- package/dist/esm/components/ui/index.js +21 -0
- package/dist/esm/drop-zone-parts-CvseSoXA.d.ts +186 -0
- package/dist/esm/error-boundary-BD0X61Sg.d.ts +28 -0
- package/dist/esm/for-8C6fFbN6.d.ts +21 -0
- package/dist/esm/{lib/utils/getSlotMap/index.d.ts → getSlotMap-DTkxtGhd.d.ts} +10 -8
- package/dist/esm/lib/utils/{getSlot/index.d.ts → index.d.ts} +1 -0
- package/dist/esm/lib/utils/index.js +5 -0
- package/dist/esm/lib/utils/index.js.map +1 -0
- package/dist/esm/{types-CeWumkhm.d.ts → types-mdfDDNrr.d.ts} +9 -6
- package/dist/style.css +1 -1
- package/package.json +17 -16
- package/dist/esm/chunk-2P3P5AXH.js.map +0 -1
- package/dist/esm/chunk-IREUBYDK.js.map +0 -1
- package/dist/esm/chunk-XZRSR3EM.js.map +0 -1
- package/dist/esm/lib/utils/getSlot/index.js +0 -4
- package/dist/esm/lib/utils/getSlotMap/index.js +0 -4
- /package/dist/esm/{lib/utils/getSlot → components/common}/index.js.map +0 -0
- /package/dist/esm/{lib/utils/getSlotMap → components/ui}/index.js.map +0 -0
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { cnMerge } from './chunk-OHG7GB7O.js';
|
|
2
|
+
import { getElementList } from './chunk-ZNL6YLIM.js';
|
|
3
|
+
import { show_parts_exports } from './chunk-M7YXNGT6.js';
|
|
4
|
+
import { __export } from './chunk-PZ5AY32C.js';
|
|
5
|
+
import * as React3 from 'react';
|
|
6
|
+
import { useEffect, useState } from 'react';
|
|
7
|
+
import { useConstant, useAnimationInterval, useCallbackRef } from '@zayne-labs/toolkit-react';
|
|
8
|
+
import { createZustandContext } from '@zayne-labs/toolkit-react/zustand';
|
|
9
|
+
import { create } from 'zustand';
|
|
10
|
+
|
|
11
|
+
var [Provider, useCarouselStoreContext] = createZustandContext({
|
|
12
|
+
hookName: "useCarouselStore",
|
|
13
|
+
name: "CarouselStoreContext",
|
|
14
|
+
providerName: "CarouselContextProvider"
|
|
15
|
+
});
|
|
16
|
+
var createCarouselStore = (storeValues) => {
|
|
17
|
+
const { images, onSlideBtnClick } = storeValues;
|
|
18
|
+
const useInitCarouselStore = create()((set, get) => ({
|
|
19
|
+
currentSlide: 0,
|
|
20
|
+
images,
|
|
21
|
+
maxSlide: images.length - 1,
|
|
22
|
+
/* eslint-disable perfectionist/sort-objects -- actions should be last */
|
|
23
|
+
actions: {
|
|
24
|
+
/* eslint-enable perfectionist/sort-objects -- actions should be last */
|
|
25
|
+
goToNextSlide: () => {
|
|
26
|
+
const { currentSlide, maxSlide } = get();
|
|
27
|
+
const { goToSlide } = get().actions;
|
|
28
|
+
if (currentSlide === maxSlide) {
|
|
29
|
+
goToSlide(0);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
goToSlide(currentSlide + 1);
|
|
33
|
+
},
|
|
34
|
+
goToPreviousSlide: () => {
|
|
35
|
+
const { currentSlide, maxSlide } = get();
|
|
36
|
+
const { goToSlide } = get().actions;
|
|
37
|
+
if (currentSlide === 0) {
|
|
38
|
+
goToSlide(maxSlide);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
goToSlide(currentSlide - 1);
|
|
42
|
+
},
|
|
43
|
+
goToSlide: (newValue) => {
|
|
44
|
+
onSlideBtnClick?.();
|
|
45
|
+
set({ currentSlide: newValue });
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}));
|
|
49
|
+
return useInitCarouselStore;
|
|
50
|
+
};
|
|
51
|
+
var useCarousel = (props) => {
|
|
52
|
+
const { images, onSlideBtnClick } = props;
|
|
53
|
+
const useInitCarouselStore = useConstant(() => createCarouselStore({ images, onSlideBtnClick }));
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
useInitCarouselStore.setState({ images });
|
|
56
|
+
}, [images]);
|
|
57
|
+
return useInitCarouselStore;
|
|
58
|
+
};
|
|
59
|
+
function CarouselContextProvider(props) {
|
|
60
|
+
const { children, images, onSlideBtnClick } = props;
|
|
61
|
+
const useInitCarouselStore = useCarousel({ images, onSlideBtnClick });
|
|
62
|
+
return /* @__PURE__ */ React3.createElement(Provider, { value: useInitCarouselStore }, children);
|
|
63
|
+
}
|
|
64
|
+
var ChevronLeftIcon = (props) => /* @__PURE__ */ React3.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24", ...props }, /* @__PURE__ */ React3.createElement("g", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2" }, /* @__PURE__ */ React3.createElement("circle", { cx: "12", cy: "12", r: "10" }), /* @__PURE__ */ React3.createElement("path", { d: "m14 16l-4-4l4-4" })));
|
|
65
|
+
var useCarouselOptions = (options = {}) => {
|
|
66
|
+
const { autoSlideInterval = 5e3, hasAutoSlide = false, shouldPauseOnHover = false } = options;
|
|
67
|
+
const { goToNextSlide } = useCarouselStoreContext((state) => state.actions);
|
|
68
|
+
const [isPaused, setIsPaused] = useState(false);
|
|
69
|
+
const shouldAutoSlide = hasAutoSlide && !isPaused;
|
|
70
|
+
useAnimationInterval({
|
|
71
|
+
intervalDuration: shouldAutoSlide ? autoSlideInterval : null,
|
|
72
|
+
onAnimation: goToNextSlide
|
|
73
|
+
});
|
|
74
|
+
const pauseAutoSlide = useCallbackRef(() => shouldPauseOnHover && setIsPaused(true));
|
|
75
|
+
const resumeAutoSlide = useCallbackRef(() => shouldPauseOnHover && setIsPaused(false));
|
|
76
|
+
return { pauseAutoSlide, resumeAutoSlide };
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
// src/components/ui/carousel/carousel.tsx
|
|
80
|
+
function CarouselContent(props) {
|
|
81
|
+
const {
|
|
82
|
+
as: HtmlElement = "article",
|
|
83
|
+
autoSlideInterval,
|
|
84
|
+
children,
|
|
85
|
+
classNames,
|
|
86
|
+
hasAutoSlide,
|
|
87
|
+
shouldPauseOnHover
|
|
88
|
+
} = props;
|
|
89
|
+
const { pauseAutoSlide, resumeAutoSlide } = useCarouselOptions({
|
|
90
|
+
autoSlideInterval,
|
|
91
|
+
hasAutoSlide,
|
|
92
|
+
shouldPauseOnHover
|
|
93
|
+
});
|
|
94
|
+
return /* @__PURE__ */ React3.createElement(
|
|
95
|
+
HtmlElement,
|
|
96
|
+
{
|
|
97
|
+
"data-id": "Carousel",
|
|
98
|
+
className: cnMerge("relative select-none", classNames?.base),
|
|
99
|
+
onMouseEnter: pauseAutoSlide,
|
|
100
|
+
onMouseLeave: resumeAutoSlide
|
|
101
|
+
},
|
|
102
|
+
/* @__PURE__ */ React3.createElement(
|
|
103
|
+
"div",
|
|
104
|
+
{
|
|
105
|
+
"data-id": "Scroll Container",
|
|
106
|
+
className: cnMerge(
|
|
107
|
+
"flex size-full overflow-x-scroll [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
108
|
+
classNames?.scrollContainer
|
|
109
|
+
)
|
|
110
|
+
},
|
|
111
|
+
children
|
|
112
|
+
)
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
function CarouselButton(props) {
|
|
116
|
+
const { classNames, icon, variant } = props;
|
|
117
|
+
const { goToNextSlide, goToPreviousSlide } = useCarouselStoreContext((state) => state.actions);
|
|
118
|
+
return /* @__PURE__ */ React3.createElement(
|
|
119
|
+
"button",
|
|
120
|
+
{
|
|
121
|
+
type: "button",
|
|
122
|
+
className: cnMerge(
|
|
123
|
+
"z-30 flex h-full w-fit items-center",
|
|
124
|
+
variant === "prev" ? "justify-start" : "justify-end",
|
|
125
|
+
classNames?.base
|
|
126
|
+
),
|
|
127
|
+
onClick: variant === "prev" ? goToPreviousSlide : goToNextSlide
|
|
128
|
+
},
|
|
129
|
+
/* @__PURE__ */ React3.createElement("span", { className: cnMerge("transition-transform active:scale-[1.06]", classNames?.iconContainer) }, icon ?? /* @__PURE__ */ React3.createElement(
|
|
130
|
+
ChevronLeftIcon,
|
|
131
|
+
{
|
|
132
|
+
className: cnMerge(variant === "next" && "rotate-180", classNames?.defaultIcon)
|
|
133
|
+
}
|
|
134
|
+
))
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
function CarouselControls(props) {
|
|
138
|
+
const { classNames, icon } = props;
|
|
139
|
+
return /* @__PURE__ */ React3.createElement("div", { className: cnMerge("absolute inset-0 flex justify-between", classNames?.base) }, /* @__PURE__ */ React3.createElement(show_parts_exports.Root, { when: icon?.iconType }, /* @__PURE__ */ React3.createElement(
|
|
140
|
+
CarouselButton,
|
|
141
|
+
{
|
|
142
|
+
variant: "prev",
|
|
143
|
+
classNames: {
|
|
144
|
+
defaultIcon: classNames?.defaultIcon,
|
|
145
|
+
iconContainer: cnMerge(
|
|
146
|
+
icon?.iconType === "nextIcon" && "rotate-180",
|
|
147
|
+
classNames?.iconContainer
|
|
148
|
+
)
|
|
149
|
+
},
|
|
150
|
+
icon: icon?.icon
|
|
151
|
+
}
|
|
152
|
+
), /* @__PURE__ */ React3.createElement(
|
|
153
|
+
CarouselButton,
|
|
154
|
+
{
|
|
155
|
+
variant: "next",
|
|
156
|
+
classNames: {
|
|
157
|
+
defaultIcon: classNames?.defaultIcon,
|
|
158
|
+
iconContainer: cnMerge(
|
|
159
|
+
icon?.iconType === "prevIcon" && "rotate-180",
|
|
160
|
+
classNames?.iconContainer
|
|
161
|
+
)
|
|
162
|
+
},
|
|
163
|
+
icon: icon?.icon
|
|
164
|
+
}
|
|
165
|
+
), /* @__PURE__ */ React3.createElement(show_parts_exports.Otherwise, null, /* @__PURE__ */ React3.createElement(
|
|
166
|
+
CarouselButton,
|
|
167
|
+
{
|
|
168
|
+
variant: "prev",
|
|
169
|
+
classNames: {
|
|
170
|
+
defaultIcon: classNames?.defaultIcon,
|
|
171
|
+
iconContainer: classNames?.iconContainer
|
|
172
|
+
},
|
|
173
|
+
icon: icon?.prev
|
|
174
|
+
}
|
|
175
|
+
), /* @__PURE__ */ React3.createElement(
|
|
176
|
+
CarouselButton,
|
|
177
|
+
{
|
|
178
|
+
variant: "next",
|
|
179
|
+
classNames: {
|
|
180
|
+
defaultIcon: classNames?.defaultIcon,
|
|
181
|
+
iconContainer: classNames?.iconContainer
|
|
182
|
+
},
|
|
183
|
+
icon: icon?.next
|
|
184
|
+
}
|
|
185
|
+
))));
|
|
186
|
+
}
|
|
187
|
+
function CarouselItemGroup(props) {
|
|
188
|
+
const { children, className, each, render } = props;
|
|
189
|
+
const [ItemList] = getElementList("base");
|
|
190
|
+
const currentSlide = useCarouselStoreContext((state) => state.currentSlide);
|
|
191
|
+
const images = useCarouselStoreContext((state) => each ?? state.images);
|
|
192
|
+
return /* @__PURE__ */ React3.createElement(
|
|
193
|
+
"ul",
|
|
194
|
+
{
|
|
195
|
+
"data-id": "Carousel Image Wrapper",
|
|
196
|
+
className: cnMerge(
|
|
197
|
+
`flex w-full shrink-0 snap-center [transform:translate3d(var(--translate-distance),0,0)]
|
|
198
|
+
[transition:transform_800ms_ease]`,
|
|
199
|
+
className
|
|
200
|
+
),
|
|
201
|
+
style: {
|
|
202
|
+
"--translate-distance": `-${currentSlide * 100}%`
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
typeof render === "function" ? /* @__PURE__ */ React3.createElement(ItemList, { each: images, render }) : /* @__PURE__ */ React3.createElement(ItemList, { each: images }, children)
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
function CarouselItem({ children, className, ...restOfProps }) {
|
|
209
|
+
return /* @__PURE__ */ React3.createElement(
|
|
210
|
+
"li",
|
|
211
|
+
{
|
|
212
|
+
className: cnMerge("flex w-full shrink-0 snap-center justify-center", className),
|
|
213
|
+
...restOfProps
|
|
214
|
+
},
|
|
215
|
+
children
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
function CarouselCaption(props) {
|
|
219
|
+
const { as: HtmlElement = "div", children, className } = props;
|
|
220
|
+
return /* @__PURE__ */ React3.createElement(HtmlElement, { "data-id": "Carousel Caption", className: cnMerge("absolute z-10", className) }, children);
|
|
221
|
+
}
|
|
222
|
+
function CarouselIndicatorGroup(props) {
|
|
223
|
+
const { children, className, each, render } = props;
|
|
224
|
+
const images = useCarouselStoreContext((state) => each ?? state.images);
|
|
225
|
+
const [IndicatorList] = getElementList("base");
|
|
226
|
+
return /* @__PURE__ */ React3.createElement(
|
|
227
|
+
"ul",
|
|
228
|
+
{
|
|
229
|
+
"data-id": "Carousel Indicators",
|
|
230
|
+
className: cnMerge(
|
|
231
|
+
"absolute bottom-[25px] z-[2] flex w-full items-center justify-center gap-[15px]",
|
|
232
|
+
className
|
|
233
|
+
)
|
|
234
|
+
},
|
|
235
|
+
typeof render === "function" ? /* @__PURE__ */ React3.createElement(IndicatorList, { each: images, render }) : /* @__PURE__ */ React3.createElement(IndicatorList, { each: images }, children)
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
function CarouselIndicator(props) {
|
|
239
|
+
const { classNames, currentIndex } = props;
|
|
240
|
+
const {
|
|
241
|
+
actions: { goToSlide },
|
|
242
|
+
currentSlide
|
|
243
|
+
} = useCarouselStoreContext((state) => state);
|
|
244
|
+
return /* @__PURE__ */ React3.createElement("li", { className: cnMerge("inline-flex", classNames?.base) }, /* @__PURE__ */ React3.createElement(
|
|
245
|
+
"button",
|
|
246
|
+
{
|
|
247
|
+
type: "button",
|
|
248
|
+
onClick: () => goToSlide(currentIndex),
|
|
249
|
+
className: cnMerge(
|
|
250
|
+
"size-[6px] rounded-[50%]",
|
|
251
|
+
classNames?.base,
|
|
252
|
+
currentIndex === currentSlide && ["w-[35px] rounded-[5px]", classNames?.isActive]
|
|
253
|
+
)
|
|
254
|
+
}
|
|
255
|
+
));
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// src/components/ui/carousel/carousel-parts.ts
|
|
259
|
+
var carousel_parts_exports = {};
|
|
260
|
+
__export(carousel_parts_exports, {
|
|
261
|
+
Button: () => CarouselButton,
|
|
262
|
+
Caption: () => CarouselCaption,
|
|
263
|
+
Content: () => CarouselContent,
|
|
264
|
+
Controls: () => CarouselControls,
|
|
265
|
+
Indicator: () => CarouselIndicator,
|
|
266
|
+
IndicatorGroup: () => CarouselIndicatorGroup,
|
|
267
|
+
Item: () => CarouselItem,
|
|
268
|
+
ItemGroup: () => CarouselItemGroup,
|
|
269
|
+
Root: () => CarouselContextProvider
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
export { CarouselButton, CarouselCaption, CarouselContent, CarouselControls, CarouselIndicator, CarouselIndicatorGroup, CarouselItem, CarouselItemGroup, carousel_parts_exports };
|
|
273
|
+
//# sourceMappingURL=chunk-ZSDYJOYB.js.map
|
|
274
|
+
//# sourceMappingURL=chunk-ZSDYJOYB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/ui/carousel/carousel-store-context.tsx","../../src/components/ui/carousel/icons.tsx","../../src/components/ui/carousel/useCarouselOptions.ts","../../src/components/ui/carousel/carousel.tsx","../../src/components/ui/carousel/carousel-parts.ts"],"names":["React","React2"],"mappings":";;;;;;;;;;AASA,IAAM,CAAC,QAAA,EAAU,uBAAuB,CAAA,GAAI,oBAAoC,CAAA;AAAA,EAC/E,QAAU,EAAA,kBAAA;AAAA,EACV,IAAM,EAAA,sBAAA;AAAA,EACN,YAAc,EAAA;AACf,CAAC,CAAA;AAGD,IAAM,mBAAA,GAAsB,CAC3B,WACI,KAAA;AACJ,EAAM,MAAA,EAAE,MAAQ,EAAA,eAAA,EAAoB,GAAA,WAAA;AAEpC,EAAA,MAAM,oBAAuB,GAAA,MAAA,EAAiC,CAAA,CAAC,KAAK,GAAS,MAAA;AAAA,IAC5E,YAAc,EAAA,CAAA;AAAA,IACd,MAAA;AAAA,IACA,QAAA,EAAU,OAAO,MAAS,GAAA,CAAA;AAAA;AAAA,IAG1B,OAAS,EAAA;AAAA;AAAA,MAGR,eAAe,MAAM;AACpB,QAAA,MAAM,EAAE,YAAA,EAAc,QAAS,EAAA,GAAI,GAAI,EAAA;AACvC,QAAA,MAAM,EAAE,SAAA,EAAc,GAAA,GAAA,EAAM,CAAA,OAAA;AAE5B,QAAA,IAAI,iBAAiB,QAAU,EAAA;AAC9B,UAAA,SAAA,CAAU,CAAC,CAAA;AACX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A,CAAA","file":"chunk-ZSDYJOYB.js","sourcesContent":["import * as React from \"react\";\n\nimport { useConstant } from \"@zayne-labs/toolkit-react\";\nimport { createZustandContext } from \"@zayne-labs/toolkit-react/zustand\";\nimport type { PrettyOmit } from \"@zayne-labs/toolkit-type-helpers\";\nimport { useEffect } from \"react\";\nimport { create } from \"zustand\";\nimport type { CarouselProviderProps, CarouselStore, ImagesType } from \"./types\";\n\nconst [Provider, useCarouselStoreContext] = createZustandContext<CarouselStore>({\n\thookName: \"useCarouselStore\",\n\tname: \"CarouselStoreContext\",\n\tproviderName: \"CarouselContextProvider\",\n});\n\n// CarouselStore Creation\nconst createCarouselStore = <TImages extends ImagesType>(\n\tstoreValues: PrettyOmit<CarouselProviderProps<TImages>, \"children\">\n) => {\n\tconst { images, onSlideBtnClick } = storeValues;\n\n\tconst useInitCarouselStore = create<CarouselStore<TImages>>()((set, get) => ({\n\t\tcurrentSlide: 0,\n\t\timages,\n\t\tmaxSlide: images.length - 1,\n\n\t\t/* eslint-disable perfectionist/sort-objects -- actions should be last */\n\t\tactions: {\n\t\t\t/* eslint-enable perfectionist/sort-objects -- actions should be last */\n\n\t\t\tgoToNextSlide: () => {\n\t\t\t\tconst { currentSlide, maxSlide } = get();\n\t\t\t\tconst { goToSlide } = get().actions;\n\n\t\t\t\tif (currentSlide === maxSlide) {\n\t\t\t\t\tgoToSlide(0);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tgoToSlide(currentSlide + 1);\n\t\t\t},\n\n\t\t\tgoToPreviousSlide: () => {\n\t\t\t\tconst { currentSlide, maxSlide } = get();\n\t\t\t\tconst { goToSlide } = get().actions;\n\n\t\t\t\tif (currentSlide === 0) {\n\t\t\t\t\tgoToSlide(maxSlide);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tgoToSlide(currentSlide - 1);\n\t\t\t},\n\n\t\t\tgoToSlide: (newValue) => {\n\t\t\t\tonSlideBtnClick?.();\n\n\t\t\t\tset({ currentSlide: newValue });\n\t\t\t},\n\t\t},\n\t}));\n\n\treturn useInitCarouselStore;\n};\n\nconst useCarousel = <TImages extends ImagesType>(\n\tprops: Omit<CarouselProviderProps<TImages>, \"children\">\n) => {\n\tconst { images, onSlideBtnClick } = props;\n\n\tconst useInitCarouselStore = useConstant(() => createCarouselStore({ images, onSlideBtnClick }));\n\n\t// == To set images again when a page is mounted, preventing stale images from previous page\n\tuseEffect(() => {\n\t\tuseInitCarouselStore.setState({ images });\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps -- useInitCarouselStore is stable\n\t}, [images]);\n\n\treturn useInitCarouselStore;\n};\n\n// == Provider Component\nfunction CarouselContextProvider<TImages extends ImagesType>(props: CarouselProviderProps<TImages>) {\n\tconst { children, images, onSlideBtnClick } = props;\n\n\tconst useInitCarouselStore = useCarousel({ images, onSlideBtnClick });\n\n\treturn <Provider value={useInitCarouselStore}>{children}</Provider>;\n}\n\n// eslint-disable-next-line react-refresh/only-export-components -- It's fine\nexport { useCarouselStoreContext, CarouselContextProvider };\n","import * as React from \"react\";\n\nexport const ChevronLeftIcon = (props: React.SVGProps<SVGSVGElement>) => (\n\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\" {...props}>\n\t\t<g fill=\"none\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"2\">\n\t\t\t<circle cx=\"12\" cy=\"12\" r=\"10\" />\n\t\t\t<path d=\"m14 16l-4-4l4-4\" />\n\t\t</g>\n\t</svg>\n);\n","import { useAnimationInterval, useCallbackRef } from \"@zayne-labs/toolkit-react\";\nimport { useState } from \"react\";\nimport { useCarouselStoreContext } from \"./carousel-store-context\";\n\ntype CarouselOptions = {\n\tautoSlideInterval?: number;\n\thasAutoSlide?: boolean;\n\tshouldPauseOnHover?: boolean;\n};\n\nconst useCarouselOptions = (options: CarouselOptions = {}) => {\n\tconst { autoSlideInterval = 5000, hasAutoSlide = false, shouldPauseOnHover = false } = options;\n\n\tconst { goToNextSlide } = useCarouselStoreContext((state) => state.actions);\n\n\tconst [isPaused, setIsPaused] = useState(false);\n\n\tconst shouldAutoSlide = hasAutoSlide && !isPaused;\n\n\tuseAnimationInterval({\n\t\tintervalDuration: shouldAutoSlide ? autoSlideInterval : null,\n\t\tonAnimation: goToNextSlide,\n\t});\n\n\tconst pauseAutoSlide = useCallbackRef(() => shouldPauseOnHover && setIsPaused(true));\n\n\tconst resumeAutoSlide = useCallbackRef(() => shouldPauseOnHover && setIsPaused(false));\n\n\treturn { pauseAutoSlide, resumeAutoSlide };\n};\n\nexport { useCarouselOptions };\n","\"use client\";\n\nimport * as React from \"react\";\n\nimport { Show } from \"@/components/common\";\nimport { getElementList } from \"@/components/common/for\";\nimport { cnMerge } from \"@/lib/utils/cn\";\nimport type { CssWithCustomProperties, PolymorphicProps } from \"@zayne-labs/toolkit-react/utils\";\nimport { useCarouselStoreContext } from \"./carousel-store-context\";\nimport { ChevronLeftIcon } from \"./icons\";\nimport type {\n\tCarouselButtonsProps,\n\tCarouselContentProps,\n\tCarouselControlProps,\n\tCarouselIndicatorProps,\n\tCarouselWrapperProps,\n\tOtherCarouselProps,\n} from \"./types\";\nimport { useCarouselOptions } from \"./useCarouselOptions\";\n\n// TODO - Add dragging and swiping support\nexport function CarouselContent<TElement extends React.ElementType = \"article\">(\n\tprops: PolymorphicProps<TElement, CarouselContentProps>\n) {\n\tconst {\n\t\tas: HtmlElement = \"article\",\n\t\tautoSlideInterval,\n\t\tchildren,\n\t\tclassNames,\n\t\thasAutoSlide,\n\t\tshouldPauseOnHover,\n\t} = props;\n\n\tconst { pauseAutoSlide, resumeAutoSlide } = useCarouselOptions({\n\t\tautoSlideInterval,\n\t\thasAutoSlide,\n\t\tshouldPauseOnHover,\n\t});\n\n\t// FIXME - Prevent touch swipe on mobile using a cover element or allow swipe but it must update the state appropriately\n\treturn (\n\t\t<HtmlElement\n\t\t\tdata-id=\"Carousel\"\n\t\t\tclassName={cnMerge(\"relative select-none\", classNames?.base)}\n\t\t\tonMouseEnter={pauseAutoSlide}\n\t\t\tonMouseLeave={resumeAutoSlide}\n\t\t>\n\t\t\t<div\n\t\t\t\tdata-id=\"Scroll Container\"\n\t\t\t\tclassName={cnMerge(\n\t\t\t\t\t\"flex size-full overflow-x-scroll [scrollbar-width:none] [&::-webkit-scrollbar]:hidden\",\n\t\t\t\t\tclassNames?.scrollContainer\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t</HtmlElement>\n\t);\n}\n\nexport function CarouselButton(props: CarouselButtonsProps) {\n\tconst { classNames, icon, variant } = props;\n\n\tconst { goToNextSlide, goToPreviousSlide } = useCarouselStoreContext((state) => state.actions);\n\n\treturn (\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tclassName={cnMerge(\n\t\t\t\t\"z-30 flex h-full w-fit items-center\",\n\t\t\t\tvariant === \"prev\" ? \"justify-start\" : \"justify-end\",\n\t\t\t\tclassNames?.base\n\t\t\t)}\n\t\t\tonClick={variant === \"prev\" ? goToPreviousSlide : goToNextSlide}\n\t\t>\n\t\t\t<span className={cnMerge(\"transition-transform active:scale-[1.06]\", classNames?.iconContainer)}>\n\t\t\t\t{icon ?? (\n\t\t\t\t\t<ChevronLeftIcon\n\t\t\t\t\t\tclassName={cnMerge(variant === \"next\" && \"rotate-180\", classNames?.defaultIcon)}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</span>\n\t\t</button>\n\t);\n}\n\nexport function CarouselControls(props: CarouselControlProps) {\n\tconst { classNames, icon } = props;\n\n\treturn (\n\t\t<div className={cnMerge(\"absolute inset-0 flex justify-between\", classNames?.base)}>\n\t\t\t<Show.Root when={icon?.iconType}>\n\t\t\t\t<CarouselButton\n\t\t\t\t\tvariant=\"prev\"\n\t\t\t\t\tclassNames={{\n\t\t\t\t\t\tdefaultIcon: classNames?.defaultIcon,\n\t\t\t\t\t\ticonContainer: cnMerge(\n\t\t\t\t\t\t\ticon?.iconType === \"nextIcon\" && \"rotate-180\",\n\t\t\t\t\t\t\tclassNames?.iconContainer\n\t\t\t\t\t\t),\n\t\t\t\t\t}}\n\t\t\t\t\ticon={icon?.icon}\n\t\t\t\t/>\n\n\t\t\t\t<CarouselButton\n\t\t\t\t\tvariant=\"next\"\n\t\t\t\t\tclassNames={{\n\t\t\t\t\t\tdefaultIcon: classNames?.defaultIcon,\n\t\t\t\t\t\ticonContainer: cnMerge(\n\t\t\t\t\t\t\ticon?.iconType === \"prevIcon\" && \"rotate-180\",\n\t\t\t\t\t\t\tclassNames?.iconContainer\n\t\t\t\t\t\t),\n\t\t\t\t\t}}\n\t\t\t\t\ticon={icon?.icon}\n\t\t\t\t/>\n\n\t\t\t\t<Show.Otherwise>\n\t\t\t\t\t<CarouselButton\n\t\t\t\t\t\tvariant=\"prev\"\n\t\t\t\t\t\tclassNames={{\n\t\t\t\t\t\t\tdefaultIcon: classNames?.defaultIcon,\n\t\t\t\t\t\t\ticonContainer: classNames?.iconContainer,\n\t\t\t\t\t\t}}\n\t\t\t\t\t\ticon={icon?.prev}\n\t\t\t\t\t/>\n\n\t\t\t\t\t<CarouselButton\n\t\t\t\t\t\tvariant=\"next\"\n\t\t\t\t\t\tclassNames={{\n\t\t\t\t\t\t\tdefaultIcon: classNames?.defaultIcon,\n\t\t\t\t\t\t\ticonContainer: classNames?.iconContainer,\n\t\t\t\t\t\t}}\n\t\t\t\t\t\ticon={icon?.next}\n\t\t\t\t\t/>\n\t\t\t\t</Show.Otherwise>\n\t\t\t</Show.Root>\n\t\t</div>\n\t);\n}\n\nexport function CarouselItemGroup<TArrayItem>(props: CarouselWrapperProps<TArrayItem>) {\n\tconst { children, className, each, render } = props;\n\n\tconst [ItemList] = getElementList(\"base\");\n\tconst currentSlide = useCarouselStoreContext((state) => state.currentSlide);\n\tconst images = useCarouselStoreContext((state) => each ?? (state.images as TArrayItem[]));\n\n\treturn (\n\t\t<ul\n\t\t\tdata-id=\"Carousel Image Wrapper\"\n\t\t\tclassName={cnMerge(\n\t\t\t\t`flex w-full shrink-0 snap-center [transform:translate3d(var(--translate-distance),0,0)]\n\t\t\t\t[transition:transform_800ms_ease]`,\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\tstyle={\n\t\t\t\t{\n\t\t\t\t\t\"--translate-distance\": `-${currentSlide * 100}%`,\n\t\t\t\t} satisfies CssWithCustomProperties as CssWithCustomProperties\n\t\t\t}\n\t\t>\n\t\t\t{typeof render === \"function\" ? (\n\t\t\t\t<ItemList each={images} render={render} />\n\t\t\t) : (\n\t\t\t\t<ItemList each={images}>{children}</ItemList>\n\t\t\t)}\n\t\t</ul>\n\t);\n}\n\nexport function CarouselItem({ children, className, ...restOfProps }: OtherCarouselProps) {\n\treturn (\n\t\t<li\n\t\t\tclassName={cnMerge(\"flex w-full shrink-0 snap-center justify-center\", className)}\n\t\t\t{...restOfProps}\n\t\t>\n\t\t\t{children}\n\t\t</li>\n\t);\n}\n\nexport function CarouselCaption<TElement extends React.ElementType = \"div\">(\n\tprops: PolymorphicProps<TElement, OtherCarouselProps>\n) {\n\tconst { as: HtmlElement = \"div\", children, className } = props;\n\n\treturn (\n\t\t<HtmlElement data-id=\"Carousel Caption\" className={cnMerge(\"absolute z-10\", className)}>\n\t\t\t{children}\n\t\t</HtmlElement>\n\t);\n}\n\nexport function CarouselIndicatorGroup<TArrayItem>(props: CarouselWrapperProps<TArrayItem>) {\n\tconst { children, className, each, render } = props;\n\n\tconst images = useCarouselStoreContext((state) => each ?? (state.images as TArrayItem[]));\n\tconst [IndicatorList] = getElementList(\"base\");\n\n\treturn (\n\t\t<ul\n\t\t\tdata-id=\"Carousel Indicators\"\n\t\t\tclassName={cnMerge(\n\t\t\t\t\"absolute bottom-[25px] z-[2] flex w-full items-center justify-center gap-[15px]\",\n\t\t\t\tclassName\n\t\t\t)}\n\t\t>\n\t\t\t{typeof render === \"function\" ? (\n\t\t\t\t<IndicatorList each={images} render={render} />\n\t\t\t) : (\n\t\t\t\t<IndicatorList each={images}>{children}</IndicatorList>\n\t\t\t)}\n\t\t</ul>\n\t);\n}\n\nexport function CarouselIndicator(props: CarouselIndicatorProps) {\n\tconst { classNames, currentIndex } = props;\n\n\tconst {\n\t\tactions: { goToSlide },\n\t\tcurrentSlide,\n\t} = useCarouselStoreContext((state) => state);\n\n\treturn (\n\t\t<li className={cnMerge(\"inline-flex\", classNames?.base)}>\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tonClick={() => goToSlide(currentIndex)}\n\t\t\t\tclassName={cnMerge(\n\t\t\t\t\t\"size-[6px] rounded-[50%]\",\n\t\t\t\t\tclassNames?.base,\n\t\t\t\t\tcurrentIndex === currentSlide && [\"w-[35px] rounded-[5px]\", classNames?.isActive]\n\t\t\t\t)}\n\t\t\t/>\n\t\t</li>\n\t);\n}\n","export { CarouselContextProvider as Root } from \"./carousel-store-context\";\nexport {\n\tCarouselContent as Content,\n\tCarouselControls as Controls,\n\tCarouselButton as Button,\n\tCarouselItem as Item,\n\tCarouselItemGroup as ItemGroup,\n\tCarouselCaption as Caption,\n\tCarouselIndicator as Indicator,\n\tCarouselIndicatorGroup as IndicatorGroup,\n} from \"./carousel\";\n"]}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import '
|
|
1
|
+
export { a as Await, d as AwaitError, c as AwaitPending, A as AwaitRoot, b as AwaitSuccess } from '../../../await-parts-BJ6C-y1f.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import '../../../getSlotMap-DTkxtGhd.js';
|
|
4
|
+
import '@zayne-labs/toolkit-type-helpers';
|
|
5
|
+
import '../../../types-mdfDDNrr.js';
|
|
6
|
+
import '../suspense-with-boundary/index.js';
|
|
5
7
|
|
|
6
|
-
type
|
|
7
|
-
type AwaitProps<TValue> = AwaitInnerProps<TValue> & Pick<SuspenseWithBoundaryProps, "errorFallback" | "fallback"> & {
|
|
8
|
-
withErrorBoundary?: boolean;
|
|
9
|
-
};
|
|
10
|
-
declare function Await<TValue>(props: AwaitProps<TValue>): React.JSX.Element;
|
|
11
|
-
type AwaitInnerProps<TValue> = DiscriminatedRenderProps<React.ReactNode | RenderPropFn<TValue>> & {
|
|
12
|
-
asChild?: boolean;
|
|
8
|
+
type AwaitContextType<TValue = unknown> = {
|
|
13
9
|
promise: Promise<TValue>;
|
|
10
|
+
result: TValue;
|
|
14
11
|
};
|
|
12
|
+
declare const useAwaitContext: <TValue>() => AwaitContextType<TValue>;
|
|
15
13
|
|
|
16
|
-
export {
|
|
14
|
+
export { useAwaitContext };
|
|
@@ -1,27 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import '../../../chunk-
|
|
1
|
+
export { await_parts_exports as Await, AwaitError, AwaitPending, AwaitRoot, AwaitSuccess, useAwaitContext } from '../../../chunk-Z6JJE4G6.js';
|
|
2
|
+
import '../../../chunk-N4274N5K.js';
|
|
3
|
+
import '../../../chunk-JC52CA2O.js';
|
|
4
|
+
import '../../../chunk-YO5LJ7ZJ.js';
|
|
5
|
+
import '../../../chunk-Y5VBSXZS.js';
|
|
4
6
|
import '../../../chunk-PZ5AY32C.js';
|
|
5
|
-
import * as React from 'react';
|
|
6
|
-
import { Fragment, Suspense, use } from 'react';
|
|
7
|
-
import { isFunction } from '@zayne-labs/toolkit-type-helpers';
|
|
8
|
-
|
|
9
|
-
function Await(props) {
|
|
10
|
-
const { errorFallback, fallback, withErrorBoundary = true, ...restOfProps } = props;
|
|
11
|
-
const WithErrorBoundary = withErrorBoundary ? ErrorBoundary : Fragment;
|
|
12
|
-
const errorBoundaryProps = Boolean(errorFallback) && { fallback: errorFallback };
|
|
13
|
-
return /* @__PURE__ */ React.createElement(WithErrorBoundary, { ...errorBoundaryProps }, /* @__PURE__ */ React.createElement(Suspense, { fallback }, /* @__PURE__ */ React.createElement(AwaitInner, { ...restOfProps })));
|
|
14
|
-
}
|
|
15
|
-
function AwaitInner(props) {
|
|
16
|
-
const { asChild, children, promise, render } = props;
|
|
17
|
-
const result = use(promise);
|
|
18
|
-
const Component = asChild ? Slot : Fragment;
|
|
19
|
-
const slotProps = asChild && { promise, result };
|
|
20
|
-
const selectedChildren = children ?? render;
|
|
21
|
-
const resolvedChildren = isFunction(selectedChildren) ? selectedChildren(result) : selectedChildren;
|
|
22
|
-
return /* @__PURE__ */ React.createElement(Component, { ...slotProps }, resolvedChildren);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export { Await };
|
|
26
7
|
//# sourceMappingURL=index.js.map
|
|
27
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -1,41 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
import
|
|
4
|
-
import { Component } from 'react';
|
|
1
|
+
export { E as ErrorBoundaryProps, F as FallbackProps } from '../../../types-mdfDDNrr.js';
|
|
2
|
+
export { E as ErrorBoundary } from '../../../error-boundary-BD0X61Sg.js';
|
|
3
|
+
import 'react';
|
|
5
4
|
|
|
6
|
-
type
|
|
5
|
+
type ErrorBoundaryContextType = {
|
|
7
6
|
error: unknown;
|
|
8
7
|
hasError: boolean;
|
|
9
8
|
resetErrorBoundary: (...args: unknown[]) => void;
|
|
10
9
|
};
|
|
11
|
-
declare const useErrorBoundaryContext: () =>
|
|
10
|
+
declare const useErrorBoundaryContext: () => ErrorBoundaryContextType;
|
|
12
11
|
|
|
13
12
|
declare const useErrorBoundary: <TError extends Error>() => {
|
|
14
13
|
resetBoundary: () => void;
|
|
15
14
|
showBoundary: (error: TError) => void;
|
|
16
15
|
};
|
|
17
16
|
|
|
18
|
-
type
|
|
19
|
-
error: Error;
|
|
20
|
-
hasError: true;
|
|
21
|
-
} | {
|
|
22
|
-
error: null;
|
|
23
|
-
hasError: false;
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* Copied from react-error-boundary package
|
|
27
|
-
* @see https://github.com/bvaughn/react-error-boundary
|
|
28
|
-
*/
|
|
29
|
-
declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
30
|
-
#private;
|
|
31
|
-
constructor(props: ErrorBoundaryProps);
|
|
32
|
-
static getDerivedStateFromError(error: Error): {
|
|
33
|
-
error: Error;
|
|
34
|
-
hasError: boolean;
|
|
35
|
-
};
|
|
36
|
-
componentDidCatch(error: Error, info: React.ErrorInfo): void;
|
|
37
|
-
componentDidUpdate(prevProps: ErrorBoundaryProps, prevState: ErrorBoundaryState): void;
|
|
38
|
-
render(): React.JSX.Element;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export { ErrorBoundary, type ErrorBoundaryContext, ErrorBoundaryProps, useErrorBoundary, useErrorBoundaryContext };
|
|
17
|
+
export { type ErrorBoundaryContextType, useErrorBoundary, useErrorBoundaryContext };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export { ErrorBoundary, useErrorBoundary, useErrorBoundaryContext } from '../../../chunk-
|
|
2
|
-
import '../../../chunk-IUEPHHGO.js';
|
|
1
|
+
export { ErrorBoundary, useErrorBoundary, useErrorBoundaryContext } from '../../../chunk-JC52CA2O.js';
|
|
3
2
|
import '../../../chunk-PZ5AY32C.js';
|
|
4
3
|
//# sourceMappingURL=index.js.map
|
|
5
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,24 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
type
|
|
6
|
-
type ForRenderProps<TArrayItem> = DiscriminatedRenderProps<RenderPropFn<TArrayItem>>;
|
|
7
|
-
type ForProps<TArrayItem> = Prettify<{
|
|
8
|
-
each: TArrayItem[];
|
|
9
|
-
fallback?: React.ReactNode;
|
|
10
|
-
} & ForRenderProps<TArrayItem>>;
|
|
11
|
-
type ForPropsWithNumber<TNumber> = Prettify<{
|
|
12
|
-
each: TNumber;
|
|
13
|
-
fallback?: React.ReactNode;
|
|
14
|
-
} & ForRenderProps<TNumber>>;
|
|
15
|
-
declare function For<TArrayItem>(props: ForProps<TArrayItem> | ForPropsWithNumber<TArrayItem>): React.ReactNode;
|
|
16
|
-
type ForListProps<TArrayItem> = {
|
|
17
|
-
className?: string;
|
|
18
|
-
} & (ForProps<TArrayItem> | ForPropsWithNumber<TArrayItem>);
|
|
19
|
-
declare function ForWithWrapper<TArrayItem, TElement extends React.ElementType = "ul">(props: PolymorphicProps<TElement, ForListProps<TArrayItem>>): React.JSX.Element;
|
|
1
|
+
import { F as For, a as ForWithWrapper } from '../../../for-8C6fFbN6.js';
|
|
2
|
+
export { b as ForRenderProps } from '../../../for-8C6fFbN6.js';
|
|
3
|
+
import 'react';
|
|
4
|
+
import '@zayne-labs/toolkit-react/utils';
|
|
5
|
+
import '@zayne-labs/toolkit-type-helpers';
|
|
20
6
|
|
|
21
7
|
type GetElementListResult<TVariant extends "base" | "withWrapper"> = TVariant extends "base" ? [typeof For] : [typeof ForWithWrapper];
|
|
22
8
|
declare const getElementList: <TVariant extends "base" | "withWrapper" = "withWrapper">(variant?: TVariant) => GetElementListResult<TVariant>;
|
|
23
9
|
|
|
24
|
-
export { For,
|
|
10
|
+
export { For, ForWithWrapper, getElementList };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { E as ErrorBoundary } from '../../error-boundary-BD0X61Sg.js';
|
|
2
|
+
export { SuspenseWithBoundary } from './suspense-with-boundary/index.js';
|
|
3
|
+
export { a as Await } from '../../await-parts-BJ6C-y1f.js';
|
|
4
|
+
export { F as For, a as ForWithWrapper } from '../../for-8C6fFbN6.js';
|
|
5
|
+
export { Show } from './show/index.js';
|
|
6
|
+
export { Slot } from './slot/index.js';
|
|
7
|
+
export { Switch } from './switch/index.js';
|
|
8
|
+
export { Teleport } from './teleport/index.js';
|
|
9
|
+
import 'react';
|
|
10
|
+
import '../../types-mdfDDNrr.js';
|
|
11
|
+
import '../../getSlotMap-DTkxtGhd.js';
|
|
12
|
+
import '@zayne-labs/toolkit-type-helpers';
|
|
13
|
+
import '@zayne-labs/toolkit-react/utils';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import '../../chunk-CWUEUCR5.js';
|
|
2
|
+
export { SuspenseWithBoundary } from '../../chunk-MT2MQDK2.js';
|
|
3
|
+
export { switch_parts_exports as Switch } from '../../chunk-EYWTW54R.js';
|
|
4
|
+
export { Teleport } from '../../chunk-G5BNZM66.js';
|
|
5
|
+
export { await_parts_exports as Await } from '../../chunk-Z6JJE4G6.js';
|
|
6
|
+
import '../../chunk-N4274N5K.js';
|
|
7
|
+
export { ErrorBoundary } from '../../chunk-JC52CA2O.js';
|
|
8
|
+
export { For, ForWithWrapper } from '../../chunk-ZNL6YLIM.js';
|
|
9
|
+
export { show_parts_exports as Show } from '../../chunk-M7YXNGT6.js';
|
|
10
|
+
import '../../chunk-YO5LJ7ZJ.js';
|
|
11
|
+
export { slot_parts_exports as Slot } from '../../chunk-Y5VBSXZS.js';
|
|
12
|
+
import '../../chunk-PZ5AY32C.js';
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { show_parts_exports as Show, ShowContent, ShowFallback, ShowRoot } from '../../../chunk-
|
|
2
|
-
import '../../../chunk-
|
|
1
|
+
export { show_parts_exports as Show, ShowContent, ShowFallback, ShowRoot } from '../../../chunk-M7YXNGT6.js';
|
|
2
|
+
import '../../../chunk-YO5LJ7ZJ.js';
|
|
3
3
|
import '../../../chunk-PZ5AY32C.js';
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -2,7 +2,11 @@ import * as React from 'react';
|
|
|
2
2
|
import { InferProps } from '@zayne-labs/toolkit-react/utils';
|
|
3
3
|
|
|
4
4
|
type SlotProps = InferProps<HTMLElement>;
|
|
5
|
-
declare function
|
|
6
|
-
declare function
|
|
5
|
+
declare function SlotSlottable({ children }: Pick<SlotProps, "children">): React.ReactNode;
|
|
6
|
+
declare function SlotRoot(props: SlotProps): React.JSX.Element | null;
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
declare namespace slotParts {
|
|
9
|
+
export { SlotRoot as Root, SlotSlottable as Slottable };
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { slotParts as Slot, SlotRoot, SlotSlottable };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Slot,
|
|
1
|
+
export { slot_parts_exports as Slot, SlotRoot, SlotSlottable } from '../../../chunk-Y5VBSXZS.js';
|
|
2
2
|
import '../../../chunk-PZ5AY32C.js';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
|
-
import { E as ErrorBoundaryProps } from '../../../types-
|
|
2
|
+
import { E as ErrorBoundaryProps } from '../../../types-mdfDDNrr.js';
|
|
3
3
|
|
|
4
4
|
type SuspenseWithBoundaryProps = {
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
errorFallback?: ErrorBoundaryProps["fallback"];
|
|
7
7
|
fallback?: React.ReactNode;
|
|
8
8
|
};
|
|
9
|
-
declare function
|
|
9
|
+
declare function SuspenseWithBoundary(props: SuspenseWithBoundaryProps): React$1.JSX.Element;
|
|
10
10
|
|
|
11
|
-
export { type SuspenseWithBoundaryProps
|
|
11
|
+
export { SuspenseWithBoundary, type SuspenseWithBoundaryProps };
|
|
@@ -1,15 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import '../../../chunk-
|
|
1
|
+
export { SuspenseWithBoundary } from '../../../chunk-MT2MQDK2.js';
|
|
2
|
+
import '../../../chunk-JC52CA2O.js';
|
|
3
3
|
import '../../../chunk-PZ5AY32C.js';
|
|
4
|
-
import { Suspense } from 'react';
|
|
5
|
-
|
|
6
|
-
function SuspenseWithBoundaryRoot(props) {
|
|
7
|
-
const { children, errorFallback, fallback } = props;
|
|
8
|
-
const errorBoundaryProps = Boolean(errorFallback) && { fallback: errorFallback };
|
|
9
|
-
const suspenseProps = Boolean(fallback) && { fallback };
|
|
10
|
-
return /* @__PURE__ */ React.createElement(ErrorBoundary, { ...errorBoundaryProps }, /* @__PURE__ */ React.createElement(Suspense, { ...suspenseProps }, children));
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export { SuspenseWithBoundaryRoot };
|
|
14
4
|
//# sourceMappingURL=index.js.map
|
|
15
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -1,42 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import '
|
|
4
|
-
import { isFunction } from '@zayne-labs/toolkit-type-helpers';
|
|
5
|
-
|
|
6
|
-
var defaultValueSymbol = Symbol("default-value");
|
|
7
|
-
function SwitchRoot(props) {
|
|
8
|
-
const { children, value = defaultValueSymbol } = props;
|
|
9
|
-
const defaultCase = getSingleSlot(children, SwitchDefault, {
|
|
10
|
-
errorMessage: "Only one <Switch.Default> component is allowed",
|
|
11
|
-
throwOnMultipleSlotMatch: true
|
|
12
|
-
});
|
|
13
|
-
const childrenCasesArray = getRegularChildren(children, SwitchDefault);
|
|
14
|
-
const matchedCase = childrenCasesArray.find((child) => {
|
|
15
|
-
if (value === defaultValueSymbol) {
|
|
16
|
-
return Boolean(child.props.when);
|
|
17
|
-
}
|
|
18
|
-
return child.props.when === value;
|
|
19
|
-
});
|
|
20
|
-
return matchedCase ?? defaultCase;
|
|
21
|
-
}
|
|
22
|
-
function SwitchMatch(props) {
|
|
23
|
-
const { children, when } = props;
|
|
24
|
-
const resolvedChildren = isFunction(children) ? children(when) : children;
|
|
25
|
-
return resolvedChildren;
|
|
26
|
-
}
|
|
27
|
-
function SwitchDefault({ children }) {
|
|
28
|
-
return children;
|
|
29
|
-
}
|
|
30
|
-
SwitchDefault.slotSymbol = Symbol("switch-default");
|
|
31
|
-
|
|
32
|
-
// src/components/common/switch/switch-parts.ts
|
|
33
|
-
var switch_parts_exports = {};
|
|
34
|
-
__export(switch_parts_exports, {
|
|
35
|
-
Default: () => SwitchDefault,
|
|
36
|
-
Match: () => SwitchMatch,
|
|
37
|
-
Root: () => SwitchRoot
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
export { switch_parts_exports as Switch, SwitchDefault, SwitchMatch, SwitchRoot };
|
|
1
|
+
export { switch_parts_exports as Switch, SwitchDefault, SwitchMatch, SwitchRoot } from '../../../chunk-EYWTW54R.js';
|
|
2
|
+
import '../../../chunk-YO5LJ7ZJ.js';
|
|
3
|
+
import '../../../chunk-PZ5AY32C.js';
|
|
41
4
|
//# sourceMappingURL=index.js.map
|
|
42
5
|
//# sourceMappingURL=index.js.map
|