@zayne-labs/ui-react 0.1.5 → 0.2.1
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/chunk-CB2EZJYW.js +31 -0
- package/dist/esm/chunk-CB2EZJYW.js.map +1 -0
- package/dist/esm/chunk-E3UC4AGS.js +119 -0
- package/dist/esm/chunk-E3UC4AGS.js.map +1 -0
- package/dist/esm/chunk-HKPJTORQ.js +3 -0
- package/dist/esm/chunk-HKPJTORQ.js.map +1 -0
- package/dist/esm/chunk-JKLRBPJZ.js +40 -0
- package/dist/esm/chunk-JKLRBPJZ.js.map +1 -0
- package/dist/esm/chunk-NCS3WKFW.js +50 -0
- package/dist/esm/chunk-NCS3WKFW.js.map +1 -0
- package/dist/esm/chunk-PKN52DWQ.js +363 -0
- package/dist/esm/chunk-PKN52DWQ.js.map +1 -0
- package/dist/esm/chunk-PNYEIX7F.js +3 -0
- package/dist/esm/chunk-PNYEIX7F.js.map +1 -0
- package/dist/esm/chunk-PW4AIAWC.js +125 -0
- package/dist/esm/chunk-PW4AIAWC.js.map +1 -0
- package/dist/esm/chunk-PXYYL2LL.js +45 -0
- package/dist/esm/chunk-PXYYL2LL.js.map +1 -0
- package/dist/esm/{chunk-MPOYLILK.js → chunk-RJQIINNX.js} +11 -7
- package/dist/esm/chunk-RJQIINNX.js.map +1 -0
- package/dist/esm/chunk-VMJ2L3VC.js +274 -0
- package/dist/esm/chunk-VMJ2L3VC.js.map +1 -0
- package/dist/esm/common/for/index.d.ts +20 -5
- package/dist/esm/common/for/index.js +1 -1
- package/dist/esm/common/index.d.ts +8 -0
- package/dist/esm/common/index.js +9 -0
- package/dist/esm/common/index.js.map +1 -0
- package/dist/esm/common/show/index.d.ts +10 -6
- package/dist/esm/common/show/index.js +2 -41
- package/dist/esm/common/show/index.js.map +1 -1
- package/dist/esm/common/switch/index.d.ts +10 -6
- package/dist/esm/common/switch/index.js +2 -31
- package/dist/esm/common/switch/index.js.map +1 -1
- package/dist/esm/common/teleport/index.js +1 -28
- package/dist/esm/common/teleport/index.js.map +1 -1
- package/dist/esm/index.d.ts +16 -2
- package/dist/esm/index.js +14 -1
- package/dist/esm/ui/card/index.js +4 -43
- package/dist/esm/ui/card/index.js.map +1 -1
- package/dist/esm/ui/carousel/index.d.ts +5 -3
- package/dist/esm/ui/carousel/index.js +4 -272
- package/dist/esm/ui/carousel/index.js.map +1 -1
- package/dist/esm/ui/drag-scroll/index.js +2 -117
- package/dist/esm/ui/drag-scroll/index.js.map +1 -1
- package/dist/esm/ui/drop-zone/index.js +2 -123
- package/dist/esm/ui/drop-zone/index.js.map +1 -1
- package/dist/esm/ui/form/index.js +4 -361
- package/dist/esm/ui/form/index.js.map +1 -1
- package/dist/esm/ui/index.d.ts +11 -0
- package/dist/esm/ui/index.js +12 -0
- package/dist/esm/ui/index.js.map +1 -0
- package/package.json +6 -14
- package/dist/esm/chunk-MPOYLILK.js.map +0 -1
- package/dist/esm/for-C3T5FbXd.d.ts +0 -15
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/icons/ChevronLeftIcon.tsx","../../src/components/ui/carousel/carousel-store-context.tsx","../../src/components/ui/carousel/useCarouselOptions.ts","../../src/components/ui/carousel/carousel.tsx","../../src/components/ui/carousel/carousel-parts.ts"],"names":["React","React2"],"mappings":";;;;;;;;;AAEA,IAAM,kBAAkB,CAAC,KAAA,0CACvB,KAAI,EAAA,EAAA,KAAA,EAAM,8BAA6B,KAAM,EAAA,KAAA,EAAM,MAAO,EAAA,KAAA,EAAM,SAAQ,WAAa,EAAA,GAAG,yBACvFA,MAAA,CAAA,aAAA,CAAA,GAAA,EAAA,EAAE,MAAK,MAAO,EAAA,MAAA,EAAO,cAAe,EAAA,aAAA,EAAc,SAAQ,cAAe,EAAA,OAAA,EAAQ,aAAY,GAC7F,EAAA,kBAAAA,MAAA,CAAA,aAAA,CAAC,YAAO,EAAG,EAAA,IAAA,EAAK,IAAG,IAA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GAAA;AAAA,QAAA,CAAA,sBAAA,EAAA;AAAA,EAAA,MAAA,EAAA,MAAA,cAAA;AAAA,EAAA,OAAA,EAAA,MAAA,eAAA;AAAA,EAAA,OAAA,EAAA,MAAA,eAAA;AAAA,EAAA,QAAA,EAAA,MAAA,gBAAA;AAAA,EAAA,SAAA,EAAA,MAAA,iBAAA;AAAA,EAAA,gBAAA,EAAA,MAAA,wBAAA;AAAA,EAAA,IAAA,EAAA,MAAA,YAAA;AAAA,EAAA,WAAA,EAAA,MAAA,mBAAA;AAAA,EAAA,IAAA,EAAA,MAAA;AAAA,CAAA,CAAA","file":"chunk-VMJ2L3VC.js","sourcesContent":["import * as React from \"react\";\n\nconst 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\nexport { ChevronLeftIcon };\n","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 { 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 { getElementList } from \"@/components/common/for\";\nimport { ChevronLeftIcon } from \"@/components/icons\";\nimport { cnMerge } from \"@/lib/utils/cn\";\nimport type { MyCustomCss, PolymorphicProps } from \"@zayne-labs/toolkit-react/utils\";\nimport { useCarouselStoreContext } from \"./carousel-store-context\";\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 appriopriately\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-[15%] 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{icon?.iconType ? (\n\t\t\t\t<>\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: cnMerge(\n\t\t\t\t\t\t\t\ticon.iconType === \"nextIcon\" && \"rotate-180\",\n\t\t\t\t\t\t\t\tclassNames?.iconContainer\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}}\n\t\t\t\t\t\ticon={icon.icon}\n\t\t\t\t\t/>\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: cnMerge(\n\t\t\t\t\t\t\t\ticon.iconType === \"prevIcon\" && \"rotate-180\",\n\t\t\t\t\t\t\t\tclassNames?.iconContainer\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}}\n\t\t\t\t\t\ticon={icon.icon}\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) : (\n\t\t\t\t<>\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\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</>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n\nexport function CarouselItemWrapper<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 MyCustomCss as MyCustomCss\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 CarouselIndicatorWrapper<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-10 z-[2] flex w-full items-center justify-center gap-6\",\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\tdata-active={currentIndex === currentSlide}\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?.button,\n\t\t\t\t\tcurrentIndex === currentSlide && [\"w-14 rounded-lg\", classNames?.activeBtn]\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\tCarouselItemWrapper as ItemWrapper,\n\tCarouselCaption as Caption,\n\tCarouselIndicator as Indicator,\n\tCarouselIndicatorWrapper as IndicatorWrapper,\n} from \"./carousel\";\n"]}
|
|
@@ -1,9 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import '
|
|
4
|
-
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { DiscriminatedRenderProps, PolymorphicProps } from '@zayne-labs/toolkit-react/utils';
|
|
3
|
+
import { Prettify } from '@zayne-labs/toolkit-type-helpers';
|
|
4
|
+
|
|
5
|
+
type RenderPropFn<TArrayItem> = (item: TArrayItem, index: number, array: TArrayItem[]) => react.ReactNode;
|
|
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 ForBase<TArrayItem>(props: ForProps<TArrayItem>): react.ReactNode[];
|
|
16
|
+
declare function ForBase<TNumber>(props: ForPropsWithNumber<TNumber>): react.ReactNode[];
|
|
17
|
+
declare function ForList<TArrayItem, TElement extends react.ElementType = "ul">(props: PolymorphicProps<TElement, ForProps<TArrayItem> & {
|
|
18
|
+
className?: string;
|
|
19
|
+
}>): react.JSX.Element;
|
|
5
20
|
|
|
6
21
|
type GetElementListResult<TVariant extends "base" | "withWrapper"> = TVariant extends "base" ? [typeof ForBase] : [typeof ForList];
|
|
7
22
|
declare const getElementList: <TVariant extends "base" | "withWrapper" = "withWrapper">(variant?: TVariant) => GetElementListResult<TVariant>;
|
|
8
23
|
|
|
9
|
-
export { ForBase, ForList, getElementList };
|
|
24
|
+
export { ForBase, ForList, type ForRenderProps, getElementList };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { ForBase, ForList, ForRenderProps, getElementList } from './for/index.js';
|
|
2
|
+
export { Show, ShowContent, ShowFallback, ShowRoot } from './show/index.js';
|
|
3
|
+
export { Slot, Slottable } from './slot/index.js';
|
|
4
|
+
export { Switch, SwitchDefault, SwitchMatch, SwitchRoot } from './switch/index.js';
|
|
5
|
+
export { Teleport } from './teleport/index.js';
|
|
6
|
+
import 'react';
|
|
7
|
+
import '@zayne-labs/toolkit-react/utils';
|
|
8
|
+
import '@zayne-labs/toolkit-type-helpers';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import '../chunk-HKPJTORQ.js';
|
|
2
|
+
export { ForBase, ForList, getElementList } from '../chunk-RJQIINNX.js';
|
|
3
|
+
export { show_parts_exports as Show, ShowContent, ShowFallback, ShowRoot } from '../chunk-NCS3WKFW.js';
|
|
4
|
+
export { Slot, Slottable } from '../chunk-ENDWJXPF.js';
|
|
5
|
+
export { switch_parts_exports as Switch, SwitchDefault, SwitchMatch, SwitchRoot } from '../chunk-JKLRBPJZ.js';
|
|
6
|
+
export { Teleport } from '../chunk-CB2EZJYW.js';
|
|
7
|
+
import '../chunk-PZ5AY32C.js';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
|
|
3
|
-
type ShowProps = {
|
|
4
|
-
children: react.ReactNode;
|
|
3
|
+
type ShowProps<TWhen> = {
|
|
4
|
+
children: react.ReactNode | ((whenValue: TWhen) => react.ReactNode);
|
|
5
5
|
fallback?: react.ReactNode;
|
|
6
|
-
when:
|
|
6
|
+
when: false | TWhen | null | undefined;
|
|
7
7
|
};
|
|
8
|
-
declare function ShowRoot({ children, fallback, when }: ShowProps): react.ReactNode;
|
|
9
|
-
declare function ShowContent({ children }:
|
|
8
|
+
declare function ShowRoot<TWhen>({ children, fallback, when }: ShowProps<TWhen>): react.ReactNode;
|
|
9
|
+
declare function ShowContent({ children }: {
|
|
10
|
+
children: react.ReactNode;
|
|
11
|
+
}): react.ReactNode;
|
|
10
12
|
declare namespace ShowContent {
|
|
11
13
|
var slot: symbol;
|
|
12
14
|
}
|
|
13
|
-
declare function ShowFallback({ children }:
|
|
15
|
+
declare function ShowFallback({ children }: {
|
|
16
|
+
children: react.ReactNode;
|
|
17
|
+
}): react.ReactNode;
|
|
14
18
|
declare namespace ShowFallback {
|
|
15
19
|
var slot: symbol;
|
|
16
20
|
}
|
|
@@ -1,43 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import '
|
|
3
|
-
import { getSlotElement, getOtherChildren } from '@zayne-labs/toolkit-react/utils';
|
|
4
|
-
import { AssertionError } from '@zayne-labs/toolkit-type-helpers';
|
|
5
|
-
|
|
6
|
-
function ShowRoot({ children, fallback, when }) {
|
|
7
|
-
const fallBackSlot = getSlotElement(children, ShowFallback, {
|
|
8
|
-
errorMessage: "Only one <Show.Fallback> or <Show.OtherWise> component is allowed",
|
|
9
|
-
throwOnMultipleSlotMatch: true
|
|
10
|
-
});
|
|
11
|
-
const contentSlot = getSlotElement(children, ShowContent, {
|
|
12
|
-
errorMessage: "Only one <Show.Content> component is allowed",
|
|
13
|
-
throwOnMultipleSlotMatch: true
|
|
14
|
-
});
|
|
15
|
-
const otherChildren = getOtherChildren(children, [ShowFallback, ShowContent]);
|
|
16
|
-
if (fallBackSlot && fallback) {
|
|
17
|
-
throw new AssertionError(`
|
|
18
|
-
The fallback prop and <Show.Fallback>/<Show.OtherWise> cannot be used at the same time.
|
|
19
|
-
`);
|
|
20
|
-
}
|
|
21
|
-
return when ? contentSlot ?? otherChildren : fallBackSlot ?? fallback;
|
|
22
|
-
}
|
|
23
|
-
function ShowContent({ children }) {
|
|
24
|
-
return children;
|
|
25
|
-
}
|
|
26
|
-
ShowContent.slot = Symbol.for("content");
|
|
27
|
-
function ShowFallback({ children }) {
|
|
28
|
-
return children;
|
|
29
|
-
}
|
|
30
|
-
ShowFallback.slot = Symbol.for("show-fallback");
|
|
31
|
-
|
|
32
|
-
// src/components/common/show/show-parts.ts
|
|
33
|
-
var show_parts_exports = {};
|
|
34
|
-
__export(show_parts_exports, {
|
|
35
|
-
Content: () => ShowContent,
|
|
36
|
-
Fallback: () => ShowFallback,
|
|
37
|
-
OtherWise: () => ShowFallback,
|
|
38
|
-
Root: () => ShowRoot
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
export { show_parts_exports as Show, ShowContent, ShowFallback, ShowRoot };
|
|
1
|
+
export { show_parts_exports as Show, ShowContent, ShowFallback, ShowRoot } from '../../chunk-NCS3WKFW.js';
|
|
2
|
+
import '../../chunk-PZ5AY32C.js';
|
|
42
3
|
//# sourceMappingURL=index.js.map
|
|
43
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -5,13 +5,17 @@ type SwitchProps<TCondition> = {
|
|
|
5
5
|
children: ValidSwitchComponentType | ValidSwitchComponentType[];
|
|
6
6
|
condition?: TCondition;
|
|
7
7
|
};
|
|
8
|
-
type SwitchMatchProps<TWhen =
|
|
9
|
-
children: react.ReactNode;
|
|
10
|
-
when: TWhen;
|
|
8
|
+
type SwitchMatchProps<TWhen = unknown> = {
|
|
9
|
+
children: react.ReactNode | ((whenValue: TWhen) => react.ReactNode);
|
|
10
|
+
when: false | TWhen | null | undefined;
|
|
11
11
|
};
|
|
12
|
-
declare function SwitchRoot<TCondition = true>(props: SwitchProps<TCondition>):
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
declare function SwitchRoot<TCondition = true>(props: SwitchProps<TCondition>): ValidSwitchComponentType | react.ReactElement<{
|
|
13
|
+
children: react.ReactNode;
|
|
14
|
+
}, string | react.JSXElementConstructor<any>> | undefined;
|
|
15
|
+
declare function SwitchMatch<TWhen>({ children, when }: SwitchMatchProps<TWhen>): react.ReactNode;
|
|
16
|
+
declare function SwitchDefault({ children }: {
|
|
17
|
+
children: react.ReactNode;
|
|
18
|
+
}): react.ReactNode;
|
|
15
19
|
declare namespace SwitchDefault {
|
|
16
20
|
var slot: symbol;
|
|
17
21
|
}
|
|
@@ -1,33 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import '
|
|
3
|
-
import { getSlotElement, getOtherChildren } from '@zayne-labs/toolkit-react/utils';
|
|
4
|
-
|
|
5
|
-
function SwitchRoot(props) {
|
|
6
|
-
const { children, condition = true } = props;
|
|
7
|
-
const defaultCase = getSlotElement(children, SwitchDefault, {
|
|
8
|
-
errorMessage: "Only one <Switch.Default> component is allowed",
|
|
9
|
-
throwOnMultipleSlotMatch: true
|
|
10
|
-
});
|
|
11
|
-
const childrenCasesArray = getOtherChildren(children, SwitchDefault);
|
|
12
|
-
const matchedCase = childrenCasesArray.find((child) => child.props.when === condition);
|
|
13
|
-
return matchedCase ?? defaultCase;
|
|
14
|
-
}
|
|
15
|
-
function SwitchMatch({ children }) {
|
|
16
|
-
return children;
|
|
17
|
-
}
|
|
18
|
-
function SwitchDefault({ children }) {
|
|
19
|
-
return children;
|
|
20
|
-
}
|
|
21
|
-
SwitchDefault.slot = Symbol.for("switch-default");
|
|
22
|
-
|
|
23
|
-
// src/components/common/switch/switch-parts.ts
|
|
24
|
-
var switch_parts_exports = {};
|
|
25
|
-
__export(switch_parts_exports, {
|
|
26
|
-
Default: () => SwitchDefault,
|
|
27
|
-
Match: () => SwitchMatch,
|
|
28
|
-
Root: () => SwitchRoot
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
export { switch_parts_exports as Switch, SwitchDefault, SwitchMatch, SwitchRoot };
|
|
1
|
+
export { switch_parts_exports as Switch, SwitchDefault, SwitchMatch, SwitchRoot } from '../../chunk-JKLRBPJZ.js';
|
|
2
|
+
import '../../chunk-PZ5AY32C.js';
|
|
32
3
|
//# sourceMappingURL=index.js.map
|
|
33
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -1,31 +1,4 @@
|
|
|
1
|
+
export { Teleport } from '../../chunk-CB2EZJYW.js';
|
|
1
2
|
import '../../chunk-PZ5AY32C.js';
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import { useEffectOnce, useMountEffect } from '@zayne-labs/toolkit-react';
|
|
4
|
-
import { isString } from '@zayne-labs/toolkit-type-helpers';
|
|
5
|
-
import { createPortal } from 'react-dom';
|
|
6
|
-
|
|
7
|
-
function Teleport(props) {
|
|
8
|
-
const { children, insertPosition, to } = props;
|
|
9
|
-
const [reactPortal, setReactPortal] = useState(null);
|
|
10
|
-
useEffectOnce(() => {
|
|
11
|
-
if (!to || !insertPosition) return;
|
|
12
|
-
const destination = isString(to) ? document.querySelector(to) : to;
|
|
13
|
-
const tempWrapper = document.createElement("div");
|
|
14
|
-
tempWrapper.style.display = "contents";
|
|
15
|
-
destination?.insertAdjacentElement(insertPosition, tempWrapper);
|
|
16
|
-
setReactPortal(createPortal(children, tempWrapper));
|
|
17
|
-
return () => {
|
|
18
|
-
tempWrapper.remove();
|
|
19
|
-
};
|
|
20
|
-
});
|
|
21
|
-
useMountEffect(() => {
|
|
22
|
-
if (!to || insertPosition) return;
|
|
23
|
-
const destination = isString(to) ? document.querySelector(to) : to;
|
|
24
|
-
destination && setReactPortal(createPortal(children, destination));
|
|
25
|
-
});
|
|
26
|
-
return reactPortal;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export { Teleport };
|
|
30
3
|
//# sourceMappingURL=index.js.map
|
|
31
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,2 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
1
|
+
export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle } from './ui/card/index.js';
|
|
2
|
+
export { Carousel, CarouselButton, CarouselButtonsProps, CarouselCaption, CarouselContent, CarouselContentProps, CarouselControlProps, CarouselControls, CarouselIndicator, CarouselIndicatorProps, CarouselIndicatorWrapper, CarouselItem, CarouselItemWrapper, CarouselProviderProps, CarouselStore, CarouselStoreApi, CarouselWrapperProps, ImagesType, OtherCarouselProps } from './ui/carousel/index.js';
|
|
3
|
+
export { useDragScroll } from './ui/drag-scroll/index.js';
|
|
4
|
+
export { DropZone, InputProps, RootProps, UseDropZoneProps, useDropZone } from './ui/drop-zone/index.js';
|
|
5
|
+
export { Form, FormController, FormDescription, FormErrorMessage, FormErrorMessagePrimitive, FormInput, FormInputGroup, FormInputLeftItem, FormInputPrimitive, FormInputRightItem, FormItem, FormItemContext, FormLabel, FormRoot, FormTextArea, FormTextAreaPrimitive, useFormItemContext } from './ui/form/index.js';
|
|
6
|
+
export { ForBase, ForList, ForRenderProps, getElementList } from './common/for/index.js';
|
|
7
|
+
export { Show, ShowContent, ShowFallback, ShowRoot } from './common/show/index.js';
|
|
8
|
+
export { Slot, Slottable } from './common/slot/index.js';
|
|
9
|
+
export { Switch, SwitchDefault, SwitchMatch, SwitchRoot } from './common/switch/index.js';
|
|
10
|
+
export { Teleport } from './common/teleport/index.js';
|
|
11
|
+
import 'react';
|
|
12
|
+
import '@zayne-labs/toolkit-react/utils';
|
|
13
|
+
import '@zayne-labs/toolkit-type-helpers';
|
|
14
|
+
import 'zustand';
|
|
15
|
+
import '@zayne-labs/toolkit-core';
|
|
16
|
+
import 'react-hook-form';
|
package/dist/esm/index.js
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
import './chunk-HKPJTORQ.js';
|
|
2
|
+
import './chunk-PNYEIX7F.js';
|
|
3
|
+
export { card_parts_exports as Card, CardContent, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle } from './chunk-PXYYL2LL.js';
|
|
4
|
+
export { carousel_parts_exports as Carousel, CarouselButton, CarouselCaption, CarouselContent, CarouselControls, CarouselIndicator, CarouselIndicatorWrapper, CarouselItem, CarouselItemWrapper } from './chunk-VMJ2L3VC.js';
|
|
5
|
+
export { useDragScroll } from './chunk-E3UC4AGS.js';
|
|
6
|
+
export { DropZone, useDropZone } from './chunk-PW4AIAWC.js';
|
|
7
|
+
export { form_parts_exports as Form, FormController, FormDescription, FormErrorMessage, FormErrorMessagePrimitive, FormInput, FormInputGroup, FormInputLeftItem, FormInputPrimitive, FormInputRightItem, FormItem, FormItemContext, FormLabel, FormRoot, FormTextArea, FormTextAreaPrimitive, useStrictFormItemContext as useFormItemContext } from './chunk-PKN52DWQ.js';
|
|
8
|
+
import './chunk-OHG7GB7O.js';
|
|
9
|
+
export { ForBase, ForList, getElementList } from './chunk-RJQIINNX.js';
|
|
10
|
+
export { show_parts_exports as Show, ShowContent, ShowFallback, ShowRoot } from './chunk-NCS3WKFW.js';
|
|
11
|
+
export { Slot, Slottable } from './chunk-ENDWJXPF.js';
|
|
12
|
+
export { switch_parts_exports as Switch, SwitchDefault, SwitchMatch, SwitchRoot } from './chunk-JKLRBPJZ.js';
|
|
13
|
+
export { Teleport } from './chunk-CB2EZJYW.js';
|
|
14
|
+
import './chunk-PZ5AY32C.js';
|
|
2
15
|
//# sourceMappingURL=index.js.map
|
|
3
16
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,45 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
function CardRoot(props) {
|
|
7
|
-
const { as: Element = "article", ...restOfProps } = props;
|
|
8
|
-
return /* @__PURE__ */ React.createElement(Element, { ...restOfProps });
|
|
9
|
-
}
|
|
10
|
-
function CardHeader(props) {
|
|
11
|
-
const { as: Element = "header", ...restOfProps } = props;
|
|
12
|
-
return /* @__PURE__ */ React.createElement(Element, { ...restOfProps });
|
|
13
|
-
}
|
|
14
|
-
function CardTitle(props) {
|
|
15
|
-
const { as: Element = "h3", className, ...restOfProps } = props;
|
|
16
|
-
return /* @__PURE__ */ React.createElement(Element, { className: cnMerge("font-semibold", className), ...restOfProps });
|
|
17
|
-
}
|
|
18
|
-
function CardDescription(props) {
|
|
19
|
-
const { as: Element = "p", className, ...restOfProps } = props;
|
|
20
|
-
return /* @__PURE__ */ React.createElement(Element, { className: cnMerge("text-sm text-shadcn-muted-foreground", className), ...restOfProps });
|
|
21
|
-
}
|
|
22
|
-
function CardContent(props) {
|
|
23
|
-
const { as: Element = "div", ...restOfProps } = props;
|
|
24
|
-
return /* @__PURE__ */ React.createElement(Element, { ...restOfProps });
|
|
25
|
-
}
|
|
26
|
-
function CardFooter(props) {
|
|
27
|
-
const { as: Element = "footer", asChild, ...restOfProps } = props;
|
|
28
|
-
const Component = asChild ? Slot : Element;
|
|
29
|
-
return /* @__PURE__ */ React.createElement(Component, { ...restOfProps });
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// src/components/ui/card/card-parts.ts
|
|
33
|
-
var card_parts_exports = {};
|
|
34
|
-
__export(card_parts_exports, {
|
|
35
|
-
Content: () => CardContent,
|
|
36
|
-
Description: () => CardDescription,
|
|
37
|
-
Footer: () => CardFooter,
|
|
38
|
-
Header: () => CardHeader,
|
|
39
|
-
Root: () => CardRoot,
|
|
40
|
-
Title: () => CardTitle
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
export { card_parts_exports as Card, CardContent, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle };
|
|
1
|
+
export { card_parts_exports as Card, CardContent, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle } from '../../chunk-PXYYL2LL.js';
|
|
2
|
+
import '../../chunk-OHG7GB7O.js';
|
|
3
|
+
import '../../chunk-ENDWJXPF.js';
|
|
4
|
+
import '../../chunk-PZ5AY32C.js';
|
|
44
5
|
//# sourceMappingURL=index.js.map
|
|
45
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { PolymorphicProps } from '@zayne-labs/toolkit-react/utils';
|
|
3
|
-
import { b as ForRenderProps, E as EachProp } from '../../for-C3T5FbXd.js';
|
|
2
|
+
import { DiscriminatedRenderProps, PolymorphicProps } from '@zayne-labs/toolkit-react/utils';
|
|
4
3
|
import { Prettify } from '@zayne-labs/toolkit-type-helpers';
|
|
5
4
|
import { StoreApi } from 'zustand';
|
|
6
5
|
|
|
@@ -63,7 +62,10 @@ type CarouselIndicatorProps = {
|
|
|
63
62
|
};
|
|
64
63
|
currentIndex: number;
|
|
65
64
|
};
|
|
66
|
-
type
|
|
65
|
+
type RenderPropFn<TArrayItem> = (item: NoInfer<TArrayItem>, index: number, array: NoInfer<TArrayItem[]>) => React.ReactNode;
|
|
66
|
+
type BaseWrapperProps<TArrayItem> = Prettify<DiscriminatedRenderProps<RenderPropFn<TArrayItem>> & {
|
|
67
|
+
each?: TArrayItem[];
|
|
68
|
+
}>;
|
|
67
69
|
type CarouselWrapperProps<TArrayItem> = BaseWrapperProps<TArrayItem> & {
|
|
68
70
|
className?: string;
|
|
69
71
|
};
|