@charcoal-ui/react 6.0.0-rc.7 → 6.0.0-rc.9
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/_lib/createDivComponent.cjs +20 -0
- package/dist/_lib/createDivComponent.cjs.map +1 -0
- package/dist/_lib/createDivComponent.js +19 -0
- package/dist/_lib/createDivComponent.js.map +1 -0
- package/dist/_lib/index.cjs +22 -0
- package/dist/_lib/index.cjs.map +1 -0
- package/dist/_lib/index.js +20 -0
- package/dist/_lib/index.js.map +1 -0
- package/dist/_lib/useClassNames.cjs +15 -0
- package/dist/_lib/useClassNames.cjs.map +1 -0
- package/dist/_lib/useClassNames.js +14 -0
- package/dist/_lib/useClassNames.js.map +1 -0
- package/dist/_lib/useForwardedRef.cjs +19 -0
- package/dist/_lib/useForwardedRef.cjs.map +1 -0
- package/dist/_lib/useForwardedRef.js +17 -0
- package/dist/_lib/useForwardedRef.js.map +1 -0
- package/dist/_lib/useIsomorphicLayoutEffect.cjs +13 -0
- package/dist/_lib/useIsomorphicLayoutEffect.cjs.map +1 -0
- package/dist/_lib/useIsomorphicLayoutEffect.js +12 -0
- package/dist/_lib/useIsomorphicLayoutEffect.js.map +1 -0
- package/dist/_virtual/_rolldown/runtime.cjs +30 -0
- package/dist/components/Button/index2.cjs +26 -0
- package/dist/components/Button/index2.cjs.map +1 -0
- package/dist/components/Button/index2.js +24 -0
- package/dist/components/Button/index2.js.map +1 -0
- package/dist/components/Carousel/CarouselItem.cjs +46 -0
- package/dist/components/Carousel/CarouselItem.cjs.map +1 -0
- package/dist/components/Carousel/CarouselItem.js +45 -0
- package/dist/components/Carousel/CarouselItem.js.map +1 -0
- package/dist/components/Carousel/carouselStore.cjs +38 -0
- package/dist/components/Carousel/carouselStore.cjs.map +1 -0
- package/dist/components/Carousel/carouselStore.js +37 -0
- package/dist/components/Carousel/carouselStore.js.map +1 -0
- package/dist/components/Carousel/index2.cjs +145 -0
- package/dist/components/Carousel/index2.cjs.map +1 -0
- package/dist/components/Carousel/index2.js +144 -0
- package/dist/components/Carousel/index2.js.map +1 -0
- package/dist/components/Carousel/intersectionObserver.cjs +46 -0
- package/dist/components/Carousel/intersectionObserver.cjs.map +1 -0
- package/dist/components/Carousel/intersectionObserver.js +45 -0
- package/dist/components/Carousel/intersectionObserver.js.map +1 -0
- package/dist/components/Carousel/resizeObserver.cjs +34 -0
- package/dist/components/Carousel/resizeObserver.cjs.map +1 -0
- package/dist/components/Carousel/resizeObserver.js +33 -0
- package/dist/components/Carousel/resizeObserver.js.map +1 -0
- package/dist/components/Carousel/store.cjs +24 -0
- package/dist/components/Carousel/store.cjs.map +1 -0
- package/dist/components/Carousel/store.js +23 -0
- package/dist/components/Carousel/store.js.map +1 -0
- package/dist/components/Carousel/useCarouselScroller.cjs +149 -0
- package/dist/components/Carousel/useCarouselScroller.cjs.map +1 -0
- package/dist/components/Carousel/useCarouselScroller.js +148 -0
- package/dist/components/Carousel/useCarouselScroller.js.map +1 -0
- package/dist/components/Checkbox/CheckboxInput/index2.cjs +29 -0
- package/dist/components/Checkbox/CheckboxInput/index2.cjs.map +1 -0
- package/dist/components/Checkbox/CheckboxInput/index2.js +28 -0
- package/dist/components/Checkbox/CheckboxInput/index2.js.map +1 -0
- package/dist/components/Checkbox/CheckboxWithLabel.cjs +23 -0
- package/dist/components/Checkbox/CheckboxWithLabel.cjs.map +1 -0
- package/dist/components/Checkbox/CheckboxWithLabel.js +21 -0
- package/dist/components/Checkbox/CheckboxWithLabel.js.map +1 -0
- package/dist/components/Checkbox/index2.cjs +34 -0
- package/dist/components/Checkbox/index2.cjs.map +1 -0
- package/dist/components/Checkbox/index2.js +33 -0
- package/dist/components/Checkbox/index2.js.map +1 -0
- package/dist/components/Clickable/index2.cjs +21 -0
- package/dist/components/Clickable/index2.cjs.map +1 -0
- package/dist/components/Clickable/index2.js +19 -0
- package/dist/components/Clickable/index2.js.map +1 -0
- package/dist/components/DropdownSelector/DropdownMenuItem/index2.cjs +44 -0
- package/dist/components/DropdownSelector/DropdownMenuItem/index2.cjs.map +1 -0
- package/dist/components/DropdownSelector/DropdownMenuItem/index2.js +43 -0
- package/dist/components/DropdownSelector/DropdownMenuItem/index2.js.map +1 -0
- package/dist/components/DropdownSelector/DropdownPopover.cjs +41 -0
- package/dist/components/DropdownSelector/DropdownPopover.cjs.map +1 -0
- package/dist/components/DropdownSelector/DropdownPopover.js +40 -0
- package/dist/components/DropdownSelector/DropdownPopover.js.map +1 -0
- package/dist/components/DropdownSelector/ListItem/index2.cjs +19 -0
- package/dist/components/DropdownSelector/ListItem/index2.cjs.map +1 -0
- package/dist/components/DropdownSelector/ListItem/index2.js +18 -0
- package/dist/components/DropdownSelector/ListItem/index2.js.map +1 -0
- package/dist/components/DropdownSelector/MenuItem/index.cjs +30 -0
- package/dist/components/DropdownSelector/MenuItem/index.cjs.map +1 -0
- package/dist/components/DropdownSelector/MenuItem/index.js +29 -0
- package/dist/components/DropdownSelector/MenuItem/index.js.map +1 -0
- package/dist/components/DropdownSelector/MenuItem/internals/handleFocusByKeyBoard.cjs +30 -0
- package/dist/components/DropdownSelector/MenuItem/internals/handleFocusByKeyBoard.cjs.map +1 -0
- package/dist/components/DropdownSelector/MenuItem/internals/handleFocusByKeyBoard.js +29 -0
- package/dist/components/DropdownSelector/MenuItem/internals/handleFocusByKeyBoard.js.map +1 -0
- package/dist/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.cjs +53 -0
- package/dist/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.cjs.map +1 -0
- package/dist/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.js +52 -0
- package/dist/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.js.map +1 -0
- package/dist/components/DropdownSelector/MenuItemGroup/index2.cjs +20 -0
- package/dist/components/DropdownSelector/MenuItemGroup/index2.cjs.map +1 -0
- package/dist/components/DropdownSelector/MenuItemGroup/index2.js +19 -0
- package/dist/components/DropdownSelector/MenuItemGroup/index2.js.map +1 -0
- package/dist/components/DropdownSelector/MenuList/MenuListContext.cjs +15 -0
- package/dist/components/DropdownSelector/MenuList/MenuListContext.cjs.map +1 -0
- package/dist/components/DropdownSelector/MenuList/MenuListContext.js +14 -0
- package/dist/components/DropdownSelector/MenuList/MenuListContext.js.map +1 -0
- package/dist/components/DropdownSelector/MenuList/index2.cjs +32 -0
- package/dist/components/DropdownSelector/MenuList/index2.cjs.map +1 -0
- package/dist/components/DropdownSelector/MenuList/index2.js +31 -0
- package/dist/components/DropdownSelector/MenuList/index2.js.map +1 -0
- package/dist/components/DropdownSelector/MenuList/internals/getValuesRecursive.cjs +34 -0
- package/dist/components/DropdownSelector/MenuList/internals/getValuesRecursive.cjs.map +1 -0
- package/dist/components/DropdownSelector/MenuList/internals/getValuesRecursive.js +32 -0
- package/dist/components/DropdownSelector/MenuList/internals/getValuesRecursive.js.map +1 -0
- package/dist/components/DropdownSelector/Popover/index2.cjs +71 -0
- package/dist/components/DropdownSelector/Popover/index2.cjs.map +1 -0
- package/dist/components/DropdownSelector/Popover/index2.js +70 -0
- package/dist/components/DropdownSelector/Popover/index2.js.map +1 -0
- package/dist/components/DropdownSelector/Popover/usePreventScroll.cjs +27 -0
- package/dist/components/DropdownSelector/Popover/usePreventScroll.cjs.map +1 -0
- package/dist/components/DropdownSelector/Popover/usePreventScroll.js +26 -0
- package/dist/components/DropdownSelector/Popover/usePreventScroll.js.map +1 -0
- package/dist/components/DropdownSelector/index2.cjs +113 -0
- package/dist/components/DropdownSelector/index2.cjs.map +1 -0
- package/dist/components/DropdownSelector/index2.js +111 -0
- package/dist/components/DropdownSelector/index2.js.map +1 -0
- package/dist/components/DropdownSelector/utils/findPreviewRecursive.cjs +34 -0
- package/dist/components/DropdownSelector/utils/findPreviewRecursive.cjs.map +1 -0
- package/dist/components/DropdownSelector/utils/findPreviewRecursive.js +32 -0
- package/dist/components/DropdownSelector/utils/findPreviewRecursive.js.map +1 -0
- package/dist/components/FieldLabel/index2.cjs +35 -0
- package/dist/components/FieldLabel/index2.cjs.map +1 -0
- package/dist/components/FieldLabel/index2.js +33 -0
- package/dist/components/FieldLabel/index2.js.map +1 -0
- package/dist/components/HintText/index2.cjs +25 -0
- package/dist/components/HintText/index2.cjs.map +1 -0
- package/dist/components/HintText/index2.js +24 -0
- package/dist/components/HintText/index2.js.map +1 -0
- package/dist/components/Icon/index.cjs +39 -0
- package/dist/components/Icon/index.cjs.map +1 -0
- package/dist/components/Icon/index.js +37 -0
- package/dist/components/Icon/index.js.map +1 -0
- package/dist/components/IconButton/index2.cjs +46 -0
- package/dist/components/IconButton/index2.cjs.map +1 -0
- package/dist/components/IconButton/index2.js +44 -0
- package/dist/components/IconButton/index2.js.map +1 -0
- package/dist/components/LoadingSpinner/index2.cjs +43 -0
- package/dist/components/LoadingSpinner/index2.cjs.map +1 -0
- package/dist/components/LoadingSpinner/index2.js +41 -0
- package/dist/components/LoadingSpinner/index2.js.map +1 -0
- package/dist/components/Modal/Dialog/index2.cjs +30 -0
- package/dist/components/Modal/Dialog/index2.cjs.map +1 -0
- package/dist/components/Modal/Dialog/index2.js +28 -0
- package/dist/components/Modal/Dialog/index2.js.map +1 -0
- package/dist/components/Modal/ModalBackgroundContext.cjs +14 -0
- package/dist/components/Modal/ModalBackgroundContext.cjs.map +1 -0
- package/dist/components/Modal/ModalBackgroundContext.js +12 -0
- package/dist/components/Modal/ModalBackgroundContext.js.map +1 -0
- package/dist/components/Modal/ModalPlumbing2.cjs +30 -0
- package/dist/components/Modal/ModalPlumbing2.cjs.map +1 -0
- package/dist/components/Modal/ModalPlumbing2.js +26 -0
- package/dist/components/Modal/ModalPlumbing2.js.map +1 -0
- package/dist/components/Modal/index2.cjs +121 -0
- package/dist/components/Modal/index2.cjs.map +1 -0
- package/dist/components/Modal/index2.js +118 -0
- package/dist/components/Modal/index2.js.map +1 -0
- package/dist/components/Modal/useCustomModalOverlay.cjs +48 -0
- package/dist/components/Modal/useCustomModalOverlay.cjs.map +1 -0
- package/dist/components/Modal/useCustomModalOverlay.js +45 -0
- package/dist/components/Modal/useCustomModalOverlay.js.map +1 -0
- package/dist/components/Modal/useTransitionPresence.cjs +57 -0
- package/dist/components/Modal/useTransitionPresence.cjs.map +1 -0
- package/dist/components/Modal/useTransitionPresence.js +56 -0
- package/dist/components/Modal/useTransitionPresence.js.map +1 -0
- package/dist/components/MultiSelect/context.cjs +19 -0
- package/dist/components/MultiSelect/context.cjs.map +1 -0
- package/dist/components/MultiSelect/context.js +18 -0
- package/dist/components/MultiSelect/context.js.map +1 -0
- package/dist/components/MultiSelect/index2.cjs +97 -0
- package/dist/components/MultiSelect/index2.cjs.map +1 -0
- package/dist/components/MultiSelect/index2.js +93 -0
- package/dist/components/MultiSelect/index2.js.map +1 -0
- package/dist/components/Pagination/PaginationContext.cjs +16 -0
- package/dist/components/Pagination/PaginationContext.cjs.map +1 -0
- package/dist/components/Pagination/PaginationContext.js +14 -0
- package/dist/components/Pagination/PaginationContext.js.map +1 -0
- package/dist/components/Pagination/helper.cjs +63 -0
- package/dist/components/Pagination/helper.cjs.map +1 -0
- package/dist/components/Pagination/helper.js +61 -0
- package/dist/components/Pagination/helper.js.map +1 -0
- package/dist/components/Pagination/index2.cjs +301 -0
- package/dist/components/Pagination/index2.cjs.map +1 -0
- package/dist/components/Pagination/index2.js +288 -0
- package/dist/components/Pagination/index2.js.map +1 -0
- package/dist/components/Radio/RadioGroup/index2.cjs +49 -0
- package/dist/components/Radio/RadioGroup/index2.cjs.map +1 -0
- package/dist/components/Radio/RadioGroup/index2.js +47 -0
- package/dist/components/Radio/RadioGroup/index2.js.map +1 -0
- package/dist/components/Radio/RadioGroupContext.cjs +20 -0
- package/dist/components/Radio/RadioGroupContext.cjs.map +1 -0
- package/dist/components/Radio/RadioGroupContext.js +18 -0
- package/dist/components/Radio/RadioGroupContext.js.map +1 -0
- package/dist/components/Radio/RadioInput/index2.cjs +27 -0
- package/dist/components/Radio/RadioInput/index2.cjs.map +1 -0
- package/dist/components/Radio/RadioInput/index2.js +26 -0
- package/dist/components/Radio/RadioInput/index2.js.map +1 -0
- package/dist/components/Radio/index2.cjs +42 -0
- package/dist/components/Radio/index2.cjs.map +1 -0
- package/dist/components/Radio/index2.js +39 -0
- package/dist/components/Radio/index2.js.map +1 -0
- package/dist/components/SegmentedControl/RadioGroupContext.cjs +24 -0
- package/dist/components/SegmentedControl/RadioGroupContext.cjs.map +1 -0
- package/dist/components/SegmentedControl/RadioGroupContext.js +21 -0
- package/dist/components/SegmentedControl/RadioGroupContext.js.map +1 -0
- package/dist/components/SegmentedControl/index2.cjs +72 -0
- package/dist/components/SegmentedControl/index2.cjs.map +1 -0
- package/dist/components/SegmentedControl/index2.js +70 -0
- package/dist/components/SegmentedControl/index2.js.map +1 -0
- package/dist/components/Switch/SwitchInput/index2.cjs +25 -0
- package/dist/components/Switch/SwitchInput/index2.cjs.map +1 -0
- package/dist/components/Switch/SwitchInput/index2.js +24 -0
- package/dist/components/Switch/SwitchInput/index2.js.map +1 -0
- package/dist/components/Switch/SwitchWithLabel.cjs +23 -0
- package/dist/components/Switch/SwitchWithLabel.cjs.map +1 -0
- package/dist/components/Switch/SwitchWithLabel.js +21 -0
- package/dist/components/Switch/SwitchWithLabel.js.map +1 -0
- package/dist/components/Switch/index2.cjs +37 -0
- package/dist/components/Switch/index2.cjs.map +1 -0
- package/dist/components/Switch/index2.js +36 -0
- package/dist/components/Switch/index2.js.map +1 -0
- package/dist/components/TagItem/index2.cjs +57 -0
- package/dist/components/TagItem/index2.cjs.map +1 -0
- package/dist/components/TagItem/index2.js +55 -0
- package/dist/components/TagItem/index2.js.map +1 -0
- package/dist/components/TextArea/index2.cjs +134 -0
- package/dist/components/TextArea/index2.cjs.map +1 -0
- package/dist/components/TextArea/index2.js +133 -0
- package/dist/components/TextArea/index2.js.map +1 -0
- package/dist/components/TextEllipsis/helper.cjs +31 -0
- package/dist/components/TextEllipsis/helper.cjs.map +1 -0
- package/dist/components/TextEllipsis/helper.js +30 -0
- package/dist/components/TextEllipsis/helper.js.map +1 -0
- package/dist/components/TextEllipsis/index2.cjs +119 -0
- package/dist/components/TextEllipsis/index2.cjs.map +1 -0
- package/dist/components/TextEllipsis/index2.js +114 -0
- package/dist/components/TextEllipsis/index2.js.map +1 -0
- package/dist/components/TextField/AssistiveText/index2.cjs +10 -0
- package/dist/components/TextField/AssistiveText/index2.cjs.map +1 -0
- package/dist/components/TextField/AssistiveText/index2.js +10 -0
- package/dist/components/TextField/AssistiveText/index2.js.map +1 -0
- package/dist/components/TextField/index2.cjs +101 -0
- package/dist/components/TextField/index2.cjs.map +1 -0
- package/dist/components/TextField/index2.js +100 -0
- package/dist/components/TextField/index2.js.map +1 -0
- package/dist/components/TextField/useFocusWithClick.cjs +23 -0
- package/dist/components/TextField/useFocusWithClick.cjs.map +1 -0
- package/dist/components/TextField/useFocusWithClick.js +22 -0
- package/dist/components/TextField/useFocusWithClick.js.map +1 -0
- package/dist/core/CharcoalProvider.cjs +16 -0
- package/dist/core/CharcoalProvider.cjs.map +1 -0
- package/dist/core/CharcoalProvider.js +14 -0
- package/dist/core/CharcoalProvider.js.map +1 -0
- package/dist/core/OverlayProvider.js +4 -0
- package/dist/core/SSRProvider.cjs +15 -0
- package/dist/core/SSRProvider.cjs.map +1 -0
- package/dist/core/SSRProvider.js +14 -0
- package/dist/core/SSRProvider.js.map +1 -0
- package/dist/core/SetThemeScript.cjs +45 -0
- package/dist/core/SetThemeScript.cjs.map +1 -0
- package/dist/core/SetThemeScript.js +43 -0
- package/dist/core/SetThemeScript.js.map +1 -0
- package/dist/core/themeHelper.cjs +154 -0
- package/dist/core/themeHelper.cjs.map +1 -0
- package/dist/core/themeHelper.js +143 -0
- package/dist/core/themeHelper.js.map +1 -0
- package/dist/index.cjs +81 -12
- package/dist/index.css +1536 -1530
- package/dist/index.js +31 -12
- package/dist/layered.css +1508 -1502
- package/dist/layered.css.map +1 -1
- package/package.json +5 -5
- package/src/__tests__/css-shorthand-safety.test.ts +150 -0
- package/src/components/Button/__snapshots__/index.css.snap +8 -3
- package/src/components/Button/index.css +8 -3
- package/src/components/LoadingSpinner/__snapshots__/index.css.snap +1 -2
- package/src/components/LoadingSpinner/index.css +1 -2
- package/src/components/Pagination/__snapshots__/index.css.snap +3 -1
- package/src/components/Pagination/index.css +3 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
const require_useClassNames = require('./useClassNames.cjs');
|
|
4
|
+
let react = require("react");
|
|
5
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
|
+
|
|
7
|
+
//#region src/_lib/createDivComponent.tsx
|
|
8
|
+
function createDivComponent(mainClassName) {
|
|
9
|
+
return (0, react.forwardRef)(function DivComponent({ className, ...props }, ref) {
|
|
10
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
11
|
+
className: require_useClassNames.useClassNames(mainClassName, className),
|
|
12
|
+
ref,
|
|
13
|
+
...props
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
exports.createDivComponent = createDivComponent;
|
|
20
|
+
//# sourceMappingURL=createDivComponent.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createDivComponent.cjs","names":["forwardRef","useClassNames","createDivComponent","mainClassName","HTMLDivElement","React","ComponentPropsWithRef","DivComponent","className","props","ref","classNames"],"sources":["../../src/_lib/createDivComponent.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { useClassNames } from './useClassNames'\n\nexport function createDivComponent(mainClassName: string) {\n return forwardRef<HTMLDivElement, React.ComponentPropsWithRef<'div'>>(\n function DivComponent({ className, ...props }, ref) {\n const classNames = useClassNames(mainClassName, className)\n return <div className={classNames} ref={ref} {...props} />\n },\n )\n}\n"],"mappings":";;;;;;;AAGA,SAAgBE,mBAAmBC,eAAuB;CACxD,6BACE,SAASI,aAAa,EAAEC,WAAW,GAAGC,SAASC,KAAK;EAElD,OAAO,2CAAC,OAAD;GAAK,WADOT,oCAAcE,eAAeK,UACf;GAAOE;GAAK,GAAID;GAAS;GAE7D"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useClassNames } from "./useClassNames.js";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region src/_lib/createDivComponent.tsx
|
|
7
|
+
function createDivComponent(mainClassName) {
|
|
8
|
+
return forwardRef(function DivComponent({ className, ...props }, ref) {
|
|
9
|
+
return /* @__PURE__ */ jsx("div", {
|
|
10
|
+
className: useClassNames(mainClassName, className),
|
|
11
|
+
ref,
|
|
12
|
+
...props
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { createDivComponent };
|
|
19
|
+
//# sourceMappingURL=createDivComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createDivComponent.js","names":["forwardRef","useClassNames","createDivComponent","mainClassName","HTMLDivElement","React","ComponentPropsWithRef","DivComponent","className","props","ref","classNames"],"sources":["../../src/_lib/createDivComponent.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { useClassNames } from './useClassNames'\n\nexport function createDivComponent(mainClassName: string) {\n return forwardRef<HTMLDivElement, React.ComponentPropsWithRef<'div'>>(\n function DivComponent({ className, ...props }, ref) {\n const classNames = useClassNames(mainClassName, className)\n return <div className={classNames} ref={ref} {...props} />\n },\n )\n}\n"],"mappings":";;;;;;AAGA,SAAgBE,mBAAmBC,eAAuB;CACxD,OAAOH,WACL,SAASO,aAAa,EAAEC,WAAW,GAAGC,SAASC,KAAK;EAElD,OAAO,oBAAC,OAAD;GAAK,WADOT,cAAcE,eAAeK,UACf;GAAOE;GAAK,GAAID;GAAS;GAE7D"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
//#region src/_lib/index.ts
|
|
4
|
+
/**
|
|
5
|
+
* 複数のrefをマージする。
|
|
6
|
+
*
|
|
7
|
+
* forwardRefで受け取ったrefと、コンポーネント内で定義したrefを同じ要素につけたいケースなどで使う
|
|
8
|
+
*/
|
|
9
|
+
function mergeRefs(...refs) {
|
|
10
|
+
return (value) => {
|
|
11
|
+
for (const ref of refs) if (typeof ref === "function") ref(value);
|
|
12
|
+
else if (ref !== null) ref.current = value;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function countCodePointsInString(string) {
|
|
16
|
+
return Array.from(string).length;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
exports.countCodePointsInString = countCodePointsInString;
|
|
21
|
+
exports.mergeRefs = mergeRefs;
|
|
22
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["unreachable","value","Error","arguments","length","JSON","stringify","mergeRefs","refs","React","Ref","T","RefCallback","ref","MutableRefObject","current","countCodePointsInString","string","Array","from"],"sources":["../../src/_lib/index.ts"],"sourcesContent":["/**\n * 今後ポートされる予定の汎用的な関数群\n */\n\n/**\n * Function used to assert a given code path is unreachable\n */\nexport function unreachable(): never\n/**\n * Function used to assert a given code path is unreachable.\n * Very useful for ensuring switches are exhaustive:\n *\n * ```ts\n * switch (a.type) {\n * case Types.A:\n * case Types.B:\n * break\n * default:\n * unreachable(a) // will cause a build error if there was\n * // a Types.C that was not checked\n * }\n * ```\n *\n * @param value Value to be asserted as unreachable\n */\n// NOTE: Uses separate overloads, _not_ `value?: never`, to not allow `undefined` to be passed\n\nexport function unreachable(value: never): never\nexport function unreachable(value?: never): never {\n throw new Error(\n arguments.length === 0\n ? 'unreachable'\n : `unreachable (${JSON.stringify(value)})`,\n )\n}\n\n/**\n * 複数のrefをマージする。\n *\n * forwardRefで受け取ったrefと、コンポーネント内で定義したrefを同じ要素につけたいケースなどで使う\n */\nexport function mergeRefs<T>(...refs: React.Ref<T>[]): React.RefCallback<T> {\n return (value) => {\n for (const ref of refs) {\n if (typeof ref === 'function') {\n ref(value)\n } else if (ref !== null) {\n // TODO: use RefObject\n // https://react.dev/blog/2024/04/25/react-19-upgrade-guide#:~:text=%3D%201%3B-,MutableRef,-is%20now%20deprecated\n ;(ref as React.MutableRefObject<T | null>).current = value\n }\n }\n }\n}\n\nexport function countCodePointsInString(string: string) {\n // [...string] とするとproduction buildで動かなくなる\n // cf. https://twitter.com/f_subal/status/1497214727511891972\n return Array.from(string).length\n}\n"],"mappings":";;;;;;;;AAyCA,SAAgBO,UAAa,GAAGC,MAA4C;CAC1E,QAAQP,UAAU;EAChB,KAAK,MAAMY,OAAOL,MAChB,IAAI,OAAOK,QAAQ,YACjBA,IAAIZ,MAAM;OACL,IAAIY,QAAQ,MAGhB,AAACA,IAAyCE,UAAUd;;;AAM7D,SAAgBe,wBAAwBC,QAAgB;CAGtD,OAAOC,MAAMC,KAAKF,OAAO,CAACb"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
//#region src/_lib/index.ts
|
|
3
|
+
/**
|
|
4
|
+
* 複数のrefをマージする。
|
|
5
|
+
*
|
|
6
|
+
* forwardRefで受け取ったrefと、コンポーネント内で定義したrefを同じ要素につけたいケースなどで使う
|
|
7
|
+
*/
|
|
8
|
+
function mergeRefs(...refs) {
|
|
9
|
+
return (value) => {
|
|
10
|
+
for (const ref of refs) if (typeof ref === "function") ref(value);
|
|
11
|
+
else if (ref !== null) ref.current = value;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function countCodePointsInString(string) {
|
|
15
|
+
return Array.from(string).length;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { countCodePointsInString, mergeRefs };
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["unreachable","value","Error","arguments","length","JSON","stringify","mergeRefs","refs","React","Ref","T","RefCallback","ref","MutableRefObject","current","countCodePointsInString","string","Array","from"],"sources":["../../src/_lib/index.ts"],"sourcesContent":["/**\n * 今後ポートされる予定の汎用的な関数群\n */\n\n/**\n * Function used to assert a given code path is unreachable\n */\nexport function unreachable(): never\n/**\n * Function used to assert a given code path is unreachable.\n * Very useful for ensuring switches are exhaustive:\n *\n * ```ts\n * switch (a.type) {\n * case Types.A:\n * case Types.B:\n * break\n * default:\n * unreachable(a) // will cause a build error if there was\n * // a Types.C that was not checked\n * }\n * ```\n *\n * @param value Value to be asserted as unreachable\n */\n// NOTE: Uses separate overloads, _not_ `value?: never`, to not allow `undefined` to be passed\n\nexport function unreachable(value: never): never\nexport function unreachable(value?: never): never {\n throw new Error(\n arguments.length === 0\n ? 'unreachable'\n : `unreachable (${JSON.stringify(value)})`,\n )\n}\n\n/**\n * 複数のrefをマージする。\n *\n * forwardRefで受け取ったrefと、コンポーネント内で定義したrefを同じ要素につけたいケースなどで使う\n */\nexport function mergeRefs<T>(...refs: React.Ref<T>[]): React.RefCallback<T> {\n return (value) => {\n for (const ref of refs) {\n if (typeof ref === 'function') {\n ref(value)\n } else if (ref !== null) {\n // TODO: use RefObject\n // https://react.dev/blog/2024/04/25/react-19-upgrade-guide#:~:text=%3D%201%3B-,MutableRef,-is%20now%20deprecated\n ;(ref as React.MutableRefObject<T | null>).current = value\n }\n }\n }\n}\n\nexport function countCodePointsInString(string: string) {\n // [...string] とするとproduction buildで動かなくなる\n // cf. https://twitter.com/f_subal/status/1497214727511891972\n return Array.from(string).length\n}\n"],"mappings":";;;;;;;AAyCA,SAAgBO,UAAa,GAAGC,MAA4C;CAC1E,QAAQP,UAAU;EAChB,KAAK,MAAMY,OAAOL,MAChB,IAAI,OAAOK,QAAQ,YACjBA,IAAIZ,MAAM;OACL,IAAIY,QAAQ,MAGhB,AAACA,IAAyCE,UAAUd;;;AAM7D,SAAgBe,wBAAwBC,QAAgB;CAGtD,OAAOC,MAAMC,KAAKF,OAAO,CAACb"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
let react = require("react");
|
|
4
|
+
|
|
5
|
+
//#region src/_lib/useClassNames.ts
|
|
6
|
+
/**
|
|
7
|
+
* Join some class names if propsClassName is defined.
|
|
8
|
+
*/
|
|
9
|
+
function useClassNames(...classNames) {
|
|
10
|
+
return (0, react.useMemo)(() => classNames.filter((v) => v).join(" "), [classNames]);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
exports.useClassNames = useClassNames;
|
|
15
|
+
//# sourceMappingURL=useClassNames.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useClassNames.cjs","names":["useMemo","useClassNames","classNames","filter","v","join"],"sources":["../../src/_lib/useClassNames.ts"],"sourcesContent":["import { useMemo } from 'react'\n\n/**\n * Join some class names if propsClassName is defined.\n */\nexport function useClassNames(...classNames: (string | undefined)[]) {\n return useMemo(() => classNames.filter((v) => v).join(' '), [classNames])\n}\n"],"mappings":";;;;;;;;AAKA,SAAgBC,cAAc,GAAGC,YAAoC;CACnE,gCAAqBA,WAAWC,QAAQC,MAAMA,EAAE,CAACC,KAAK,IAAI,EAAE,CAACH,WAAW,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/_lib/useClassNames.ts
|
|
5
|
+
/**
|
|
6
|
+
* Join some class names if propsClassName is defined.
|
|
7
|
+
*/
|
|
8
|
+
function useClassNames(...classNames) {
|
|
9
|
+
return useMemo(() => classNames.filter((v) => v).join(" "), [classNames]);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { useClassNames };
|
|
14
|
+
//# sourceMappingURL=useClassNames.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useClassNames.js","names":["useMemo","useClassNames","classNames","filter","v","join"],"sources":["../../src/_lib/useClassNames.ts"],"sourcesContent":["import { useMemo } from 'react'\n\n/**\n * Join some class names if propsClassName is defined.\n */\nexport function useClassNames(...classNames: (string | undefined)[]) {\n return useMemo(() => classNames.filter((v) => v).join(' '), [classNames])\n}\n"],"mappings":";;;;;;;AAKA,SAAgBC,cAAc,GAAGC,YAAoC;CACnE,OAAOF,cAAcE,WAAWC,QAAQC,MAAMA,EAAE,CAACC,KAAK,IAAI,EAAE,CAACH,WAAW,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
let react = require("react");
|
|
4
|
+
react = require_runtime.__toESM(react);
|
|
5
|
+
|
|
6
|
+
//#region src/_lib/useForwardedRef.tsx
|
|
7
|
+
function useForwardedRef(ref) {
|
|
8
|
+
const innerRef = react.useRef(null);
|
|
9
|
+
react.useEffect(() => {
|
|
10
|
+
if (!ref) return;
|
|
11
|
+
if (typeof ref === "function") ref(innerRef.current);
|
|
12
|
+
else ref.current = innerRef.current;
|
|
13
|
+
});
|
|
14
|
+
return innerRef;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
exports.useForwardedRef = useForwardedRef;
|
|
19
|
+
//# sourceMappingURL=useForwardedRef.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useForwardedRef.cjs","names":["React","useForwardedRef","ref","ForwardedRef","T","innerRef","useRef","useEffect","current"],"sources":["../../src/_lib/useForwardedRef.tsx"],"sourcesContent":["import * as React from 'react'\n\nexport function useForwardedRef<T>(ref: React.ForwardedRef<T>) {\n const innerRef = React.useRef<T>(null)\n\n React.useEffect(() => {\n if (!ref) return\n if (typeof ref === 'function') {\n ref(innerRef.current)\n } else {\n // eslint-disable-next-line react-compiler/react-compiler\n ref.current = innerRef.current\n }\n })\n\n return innerRef\n}\n"],"mappings":";;;;;;AAEA,SAAgBC,gBAAmBC,KAA4B;CAC7D,MAAMG,WAAWL,MAAMM,OAAU,KAAK;CAEtCN,MAAMO,gBAAgB;EACpB,IAAI,CAACL,KAAK;EACV,IAAI,OAAOA,QAAQ,YACjBA,IAAIG,SAASG,QAAQ;OAGrBN,IAAIM,UAAUH,SAASG;GAEzB;CAEF,OAAOH"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/_lib/useForwardedRef.tsx
|
|
5
|
+
function useForwardedRef(ref) {
|
|
6
|
+
const innerRef = React$1.useRef(null);
|
|
7
|
+
React$1.useEffect(() => {
|
|
8
|
+
if (!ref) return;
|
|
9
|
+
if (typeof ref === "function") ref(innerRef.current);
|
|
10
|
+
else ref.current = innerRef.current;
|
|
11
|
+
});
|
|
12
|
+
return innerRef;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { useForwardedRef };
|
|
17
|
+
//# sourceMappingURL=useForwardedRef.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useForwardedRef.js","names":["React","useForwardedRef","ref","ForwardedRef","T","innerRef","useRef","useEffect","current"],"sources":["../../src/_lib/useForwardedRef.tsx"],"sourcesContent":["import * as React from 'react'\n\nexport function useForwardedRef<T>(ref: React.ForwardedRef<T>) {\n const innerRef = React.useRef<T>(null)\n\n React.useEffect(() => {\n if (!ref) return\n if (typeof ref === 'function') {\n ref(innerRef.current)\n } else {\n // eslint-disable-next-line react-compiler/react-compiler\n ref.current = innerRef.current\n }\n })\n\n return innerRef\n}\n"],"mappings":";;;;AAEA,SAAgBC,gBAAmBC,KAA4B;CAC7D,MAAMG,WAAWL,QAAMM,OAAU,KAAK;CAEtCN,QAAMO,gBAAgB;EACpB,IAAI,CAACL,KAAK;EACV,IAAI,OAAOA,QAAQ,YACjBA,IAAIG,SAASG,QAAQ;OAGrBN,IAAIM,UAAUH,SAASG;GAEzB;CAEF,OAAOH"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
let react = require("react");
|
|
4
|
+
|
|
5
|
+
//#region src/_lib/useIsomorphicLayoutEffect.ts
|
|
6
|
+
/**
|
|
7
|
+
* SSR では useLayoutEffect が警告を出すため、サーバーでは useEffect にフォールバックする
|
|
8
|
+
*/
|
|
9
|
+
const useIsomorphicLayoutEffect = typeof window !== "undefined" ? react.useLayoutEffect : react.useEffect;
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
exports.useIsomorphicLayoutEffect = useIsomorphicLayoutEffect;
|
|
13
|
+
//# sourceMappingURL=useIsomorphicLayoutEffect.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIsomorphicLayoutEffect.cjs","names":["useEffect","useLayoutEffect","useIsomorphicLayoutEffect","window"],"sources":["../../src/_lib/useIsomorphicLayoutEffect.ts"],"sourcesContent":["import { useEffect, useLayoutEffect } from 'react'\n\n/**\n * SSR では useLayoutEffect が警告を出すため、サーバーでは useEffect にフォールバックする\n */\nexport const useIsomorphicLayoutEffect =\n typeof window !== 'undefined' ? useLayoutEffect : useEffect\n"],"mappings":";;;;;;;;AAKA,MAAaE,4BACX,OAAOC,WAAW,cAAcF,wBAAkBD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useLayoutEffect } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/_lib/useIsomorphicLayoutEffect.ts
|
|
5
|
+
/**
|
|
6
|
+
* SSR では useLayoutEffect が警告を出すため、サーバーでは useEffect にフォールバックする
|
|
7
|
+
*/
|
|
8
|
+
const useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
export { useIsomorphicLayoutEffect };
|
|
12
|
+
//# sourceMappingURL=useIsomorphicLayoutEffect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIsomorphicLayoutEffect.js","names":["useEffect","useLayoutEffect","useIsomorphicLayoutEffect","window"],"sources":["../../src/_lib/useIsomorphicLayoutEffect.ts"],"sourcesContent":["import { useEffect, useLayoutEffect } from 'react'\n\n/**\n * SSR では useLayoutEffect が警告を出すため、サーバーでは useEffect にフォールバックする\n */\nexport const useIsomorphicLayoutEffect =\n typeof window !== 'undefined' ? useLayoutEffect : useEffect\n"],"mappings":";;;;;;;AAKA,MAAaE,4BACX,OAAOC,WAAW,cAAcF,kBAAkBD"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
12
|
+
key = keys[i];
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
14
|
+
__defProp(to, key, {
|
|
15
|
+
get: ((k) => from[k]).bind(null, key),
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
24
|
+
value: mod,
|
|
25
|
+
enumerable: true
|
|
26
|
+
}) : target, mod));
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
|
|
30
|
+
exports.__toESM = __toESM;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
require('./index.cjs');
|
|
4
|
+
const require_useClassNames = require('../../_lib/useClassNames.cjs');
|
|
5
|
+
let react = require("react");
|
|
6
|
+
react = require_runtime.__toESM(react);
|
|
7
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
+
|
|
9
|
+
//#region src/components/Button/index.tsx
|
|
10
|
+
const Button = (0, react.forwardRef)(function Button({ variant, fullWidth, size, className, component, isActive, ...props }, ref) {
|
|
11
|
+
const Component = (0, react.useMemo)(() => component ?? "button", [component]);
|
|
12
|
+
const classNames = require_useClassNames.useClassNames("charcoal-button", className);
|
|
13
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, {
|
|
14
|
+
...props,
|
|
15
|
+
className: classNames,
|
|
16
|
+
"data-variant": variant,
|
|
17
|
+
"data-size": size,
|
|
18
|
+
"data-full-width": fullWidth,
|
|
19
|
+
"data-active": isActive,
|
|
20
|
+
ref
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
exports.default = Button;
|
|
26
|
+
//# sourceMappingURL=index2.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index2.cjs","names":["React","ForwardedRef","ReactNode","forwardRef","useMemo","JSX","useClassNames","Variant","Size","ButtonProps","ElementType","children","variant","size","fullWidth","isActive","component","T","Omit","ComponentPropsWithRef","Button","className","props","ref","HTMLButtonElement","Component","classNames","p","Element"],"sources":["../../../src/components/Button/index.tsx"],"sourcesContent":["import './index.css'\n\nimport React, {\n ForwardedRef,\n ReactNode,\n forwardRef,\n useMemo,\n type JSX,\n} from 'react'\n\nimport { useClassNames } from '../../_lib/useClassNames'\n\ntype Variant = 'Primary' | 'Default' | 'Overlay' | 'Danger' | 'Navigation'\n\ntype Size = 'S' | 'M'\n\nexport type ButtonProps<T extends React.ElementType = 'button'> = {\n children?: ReactNode\n variant?: Variant\n size?: Size\n fullWidth?: boolean\n isActive?: boolean\n /**\n * The component used for root element.\n * @type T extends React.ElementType = 'button'\n */\n component?: T\n} & Omit<React.ComponentPropsWithRef<T>, 'children'>\n\nconst Button = forwardRef(function Button<T extends React.ElementType>(\n {\n variant,\n fullWidth,\n size,\n className,\n component,\n isActive,\n ...props\n }: ButtonProps<T>,\n ref: ForwardedRef<HTMLButtonElement>,\n) {\n const Component = useMemo(() => component ?? 'button', [component])\n const classNames = useClassNames('charcoal-button', className)\n return (\n <Component\n {...props}\n className={classNames}\n data-variant={variant}\n data-size={size}\n data-full-width={fullWidth}\n data-active={isActive}\n ref={ref}\n />\n )\n}) as <T extends React.ElementType = 'button'>(\n p: 'button' extends T\n ? ButtonProps<'button'>\n : ButtonProps<T> & {\n component: T // required\n },\n) => JSX.Element\nexport default Button\n"],"mappings":";;;;;;;;;AA6BA,MAAMoB,+BAAoB,SAASA,OACjC,EACER,SACAE,WACAD,MACAQ,WACAL,WACAD,UACA,GAAGO,SAELC,KACA;CACA,MAAME,qCAA0BT,aAAa,UAAU,CAACA,UAAU,CAAC;CACnE,MAAMU,aAAapB,oCAAc,mBAAmBe,UAAU;CAC9D,OACE,2CAAC,WAAD;EACE,GAAIC;EACJ,WAAWI;EACX,gBAAcd;EACd,aAAWC;EACX,mBAAiBC;EACjB,eAAaC;EACRQ;EACL;EAEJ"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import { useClassNames } from "../../_lib/useClassNames.js";
|
|
4
|
+
import React, { forwardRef, useMemo } from "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/components/Button/index.tsx
|
|
8
|
+
const Button = forwardRef(function Button({ variant, fullWidth, size, className, component, isActive, ...props }, ref) {
|
|
9
|
+
const Component = useMemo(() => component ?? "button", [component]);
|
|
10
|
+
const classNames = useClassNames("charcoal-button", className);
|
|
11
|
+
return /* @__PURE__ */ jsx(Component, {
|
|
12
|
+
...props,
|
|
13
|
+
className: classNames,
|
|
14
|
+
"data-variant": variant,
|
|
15
|
+
"data-size": size,
|
|
16
|
+
"data-full-width": fullWidth,
|
|
17
|
+
"data-active": isActive,
|
|
18
|
+
ref
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { Button as default };
|
|
24
|
+
//# sourceMappingURL=index2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index2.js","names":["React","ForwardedRef","ReactNode","forwardRef","useMemo","JSX","useClassNames","Variant","Size","ButtonProps","ElementType","children","variant","size","fullWidth","isActive","component","T","Omit","ComponentPropsWithRef","Button","className","props","ref","HTMLButtonElement","Component","classNames","p","Element"],"sources":["../../../src/components/Button/index.tsx"],"sourcesContent":["import './index.css'\n\nimport React, {\n ForwardedRef,\n ReactNode,\n forwardRef,\n useMemo,\n type JSX,\n} from 'react'\n\nimport { useClassNames } from '../../_lib/useClassNames'\n\ntype Variant = 'Primary' | 'Default' | 'Overlay' | 'Danger' | 'Navigation'\n\ntype Size = 'S' | 'M'\n\nexport type ButtonProps<T extends React.ElementType = 'button'> = {\n children?: ReactNode\n variant?: Variant\n size?: Size\n fullWidth?: boolean\n isActive?: boolean\n /**\n * The component used for root element.\n * @type T extends React.ElementType = 'button'\n */\n component?: T\n} & Omit<React.ComponentPropsWithRef<T>, 'children'>\n\nconst Button = forwardRef(function Button<T extends React.ElementType>(\n {\n variant,\n fullWidth,\n size,\n className,\n component,\n isActive,\n ...props\n }: ButtonProps<T>,\n ref: ForwardedRef<HTMLButtonElement>,\n) {\n const Component = useMemo(() => component ?? 'button', [component])\n const classNames = useClassNames('charcoal-button', className)\n return (\n <Component\n {...props}\n className={classNames}\n data-variant={variant}\n data-size={size}\n data-full-width={fullWidth}\n data-active={isActive}\n ref={ref}\n />\n )\n}) as <T extends React.ElementType = 'button'>(\n p: 'button' extends T\n ? ButtonProps<'button'>\n : ButtonProps<T> & {\n component: T // required\n },\n) => JSX.Element\nexport default Button\n"],"mappings":";;;;;;;AA6BA,MAAMoB,SAASjB,WAAW,SAASiB,OACjC,EACER,SACAE,WACAD,MACAQ,WACAL,WACAD,UACA,GAAGO,SAELC,KACA;CACA,MAAME,YAAYrB,cAAcY,aAAa,UAAU,CAACA,UAAU,CAAC;CACnE,MAAMU,aAAapB,cAAc,mBAAmBe,UAAU;CAC9D,OACE,oBAAC,WAAD;EACE,GAAIC;EACJ,WAAWI;EACX,gBAAcd;EACd,aAAWC;EACX,mBAAiBC;EACjB,eAAaC;EACRQ;EACL;EAEJ"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
const require_intersectionObserver = require('./intersectionObserver.cjs');
|
|
4
|
+
const require_resizeObserver = require('./resizeObserver.cjs');
|
|
5
|
+
let react = require("react");
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
|
|
8
|
+
//#region src/components/Carousel/CarouselItem.tsx
|
|
9
|
+
const CarouselItem = ({ index, store, onResize, children }) => {
|
|
10
|
+
const ref = (0, react.useRef)(null);
|
|
11
|
+
(0, react.useEffect)(() => {
|
|
12
|
+
const el = ref.current;
|
|
13
|
+
if (!el) return;
|
|
14
|
+
return require_intersectionObserver.observeCenter(el, () => store.dispatch({
|
|
15
|
+
type: "setActive",
|
|
16
|
+
index
|
|
17
|
+
}));
|
|
18
|
+
}, [index, store]);
|
|
19
|
+
(0, react.useEffect)(() => {
|
|
20
|
+
let lastNonce = store.getSnapshot().scroll?.nonce ?? 0;
|
|
21
|
+
return store.subscribe(() => {
|
|
22
|
+
const scroll = store.getSnapshot().scroll;
|
|
23
|
+
if (!scroll || scroll.index !== index || scroll.nonce === lastNonce) return;
|
|
24
|
+
lastNonce = scroll.nonce;
|
|
25
|
+
ref.current?.scrollIntoView({
|
|
26
|
+
behavior: "smooth",
|
|
27
|
+
inline: "center",
|
|
28
|
+
block: "nearest"
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
}, [index, store]);
|
|
32
|
+
(0, react.useEffect)(() => {
|
|
33
|
+
const el = ref.current;
|
|
34
|
+
if (!el) return;
|
|
35
|
+
return require_resizeObserver.observeResize(el, onResize);
|
|
36
|
+
}, [onResize]);
|
|
37
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
38
|
+
ref,
|
|
39
|
+
className: "charcoal-carousel__item",
|
|
40
|
+
children
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
//#endregion
|
|
45
|
+
exports.CarouselItem = CarouselItem;
|
|
46
|
+
//# sourceMappingURL=CarouselItem.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CarouselItem.cjs","names":["useEffect","useRef","ReactNode","CarouselStore","observeCenter","observeResize","CarouselItemProps","Readonly","index","store","onResize","children","CarouselItem","ref","HTMLDivElement","el","current","dispatch","type","lastNonce","getSnapshot","scroll","nonce","subscribe","scrollIntoView","behavior","inline","block"],"sources":["../../../src/components/Carousel/CarouselItem.tsx"],"sourcesContent":["import { useEffect, useRef, type ReactNode } from 'react'\nimport type { CarouselStore } from './carouselStore'\nimport { observeCenter } from './intersectionObserver'\nimport { observeResize } from './resizeObserver'\n\nexport type CarouselItemProps = Readonly<{\n index: number\n store: CarouselStore\n onResize: () => void\n children: ReactNode\n}>\n\nexport const CarouselItem = ({\n index,\n store,\n onResize,\n children,\n}: CarouselItemProps) => {\n const ref = useRef<HTMLDivElement>(null)\n\n // activeIndex: 自分が中央に来たら store に報告する(root は親=scroller から導出)。\n useEffect(() => {\n const el = ref.current\n if (!el) return\n return observeCenter(el, () => store.dispatch({ type: 'setActive', index }))\n }, [index, store])\n\n // scrollToItem: 自分宛ての命令でだけ自己スクロールする(再レンダーしない)。\n useEffect(() => {\n let lastNonce = store.getSnapshot().scroll?.nonce ?? 0\n return store.subscribe(() => {\n const scroll = store.getSnapshot().scroll\n if (!scroll || scroll.index !== index || scroll.nonce === lastNonce)\n return\n lastNonce = scroll.nonce\n ref.current?.scrollIntoView({\n behavior: 'smooth',\n inline: 'center',\n block: 'nearest',\n })\n })\n }, [index, store])\n\n // 遅延コンテンツ: 自分のサイズ変化を onResize で通知する。\n useEffect(() => {\n const el = ref.current\n if (!el) return\n return observeResize(el, onResize)\n }, [onResize])\n\n return (\n <div ref={ref} className=\"charcoal-carousel__item\">\n {children}\n </div>\n )\n}\n"],"mappings":";;;;;;;;AAYA,MAAaY,gBAAgB,EAC3BJ,OACAC,OACAC,UACAC,eACuB;CACvB,MAAME,wBAA6B,KAAK;CAGxCb,2BAAgB;EACd,MAAMe,KAAKF,IAAIG;EACf,IAAI,CAACD,IAAI;EACT,OAAOX,2CAAcW,UAAUN,MAAMQ,SAAS;GAAEC,MAAM;GAAaV;GAAO,CAAC,CAAC;IAC3E,CAACA,OAAOC,MAAM,CAAC;CAGlBT,2BAAgB;EACd,IAAImB,YAAYV,MAAMW,aAAa,CAACC,QAAQC,SAAS;EACrD,OAAOb,MAAMc,gBAAgB;GAC3B,MAAMF,SAASZ,MAAMW,aAAa,CAACC;GACnC,IAAI,CAACA,UAAUA,OAAOb,UAAUA,SAASa,OAAOC,UAAUH,WACxD;GACFA,YAAYE,OAAOC;GACnBT,IAAIG,SAASQ,eAAe;IAC1BC,UAAU;IACVC,QAAQ;IACRC,OAAO;IACR,CAAC;IACF;IACD,CAACnB,OAAOC,MAAM,CAAC;CAGlBT,2BAAgB;EACd,MAAMe,KAAKF,IAAIG;EACf,IAAI,CAACD,IAAI;EACT,OAAOV,qCAAcU,IAAIL,SAAS;IACjC,CAACA,SAAS,CAAC;CAEd,OACE,2CAAC,OAAD;EAAUG;EAAK,WAAU;EACtBF;EACG"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { observeCenter } from "./intersectionObserver.js";
|
|
3
|
+
import { observeResize } from "./resizeObserver.js";
|
|
4
|
+
import { useEffect, useRef } from "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/components/Carousel/CarouselItem.tsx
|
|
8
|
+
const CarouselItem = ({ index, store, onResize, children }) => {
|
|
9
|
+
const ref = useRef(null);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
const el = ref.current;
|
|
12
|
+
if (!el) return;
|
|
13
|
+
return observeCenter(el, () => store.dispatch({
|
|
14
|
+
type: "setActive",
|
|
15
|
+
index
|
|
16
|
+
}));
|
|
17
|
+
}, [index, store]);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
let lastNonce = store.getSnapshot().scroll?.nonce ?? 0;
|
|
20
|
+
return store.subscribe(() => {
|
|
21
|
+
const scroll = store.getSnapshot().scroll;
|
|
22
|
+
if (!scroll || scroll.index !== index || scroll.nonce === lastNonce) return;
|
|
23
|
+
lastNonce = scroll.nonce;
|
|
24
|
+
ref.current?.scrollIntoView({
|
|
25
|
+
behavior: "smooth",
|
|
26
|
+
inline: "center",
|
|
27
|
+
block: "nearest"
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
}, [index, store]);
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
const el = ref.current;
|
|
33
|
+
if (!el) return;
|
|
34
|
+
return observeResize(el, onResize);
|
|
35
|
+
}, [onResize]);
|
|
36
|
+
return /* @__PURE__ */ jsx("div", {
|
|
37
|
+
ref,
|
|
38
|
+
className: "charcoal-carousel__item",
|
|
39
|
+
children
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
export { CarouselItem };
|
|
45
|
+
//# sourceMappingURL=CarouselItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CarouselItem.js","names":["useEffect","useRef","ReactNode","CarouselStore","observeCenter","observeResize","CarouselItemProps","Readonly","index","store","onResize","children","CarouselItem","ref","HTMLDivElement","el","current","dispatch","type","lastNonce","getSnapshot","scroll","nonce","subscribe","scrollIntoView","behavior","inline","block"],"sources":["../../../src/components/Carousel/CarouselItem.tsx"],"sourcesContent":["import { useEffect, useRef, type ReactNode } from 'react'\nimport type { CarouselStore } from './carouselStore'\nimport { observeCenter } from './intersectionObserver'\nimport { observeResize } from './resizeObserver'\n\nexport type CarouselItemProps = Readonly<{\n index: number\n store: CarouselStore\n onResize: () => void\n children: ReactNode\n}>\n\nexport const CarouselItem = ({\n index,\n store,\n onResize,\n children,\n}: CarouselItemProps) => {\n const ref = useRef<HTMLDivElement>(null)\n\n // activeIndex: 自分が中央に来たら store に報告する(root は親=scroller から導出)。\n useEffect(() => {\n const el = ref.current\n if (!el) return\n return observeCenter(el, () => store.dispatch({ type: 'setActive', index }))\n }, [index, store])\n\n // scrollToItem: 自分宛ての命令でだけ自己スクロールする(再レンダーしない)。\n useEffect(() => {\n let lastNonce = store.getSnapshot().scroll?.nonce ?? 0\n return store.subscribe(() => {\n const scroll = store.getSnapshot().scroll\n if (!scroll || scroll.index !== index || scroll.nonce === lastNonce)\n return\n lastNonce = scroll.nonce\n ref.current?.scrollIntoView({\n behavior: 'smooth',\n inline: 'center',\n block: 'nearest',\n })\n })\n }, [index, store])\n\n // 遅延コンテンツ: 自分のサイズ変化を onResize で通知する。\n useEffect(() => {\n const el = ref.current\n if (!el) return\n return observeResize(el, onResize)\n }, [onResize])\n\n return (\n <div ref={ref} className=\"charcoal-carousel__item\">\n {children}\n </div>\n )\n}\n"],"mappings":";;;;;;;AAYA,MAAaY,gBAAgB,EAC3BJ,OACAC,OACAC,UACAC,eACuB;CACvB,MAAME,MAAMZ,OAAuB,KAAK;CAGxCD,gBAAgB;EACd,MAAMe,KAAKF,IAAIG;EACf,IAAI,CAACD,IAAI;EACT,OAAOX,cAAcW,UAAUN,MAAMQ,SAAS;GAAEC,MAAM;GAAaV;GAAO,CAAC,CAAC;IAC3E,CAACA,OAAOC,MAAM,CAAC;CAGlBT,gBAAgB;EACd,IAAImB,YAAYV,MAAMW,aAAa,CAACC,QAAQC,SAAS;EACrD,OAAOb,MAAMc,gBAAgB;GAC3B,MAAMF,SAASZ,MAAMW,aAAa,CAACC;GACnC,IAAI,CAACA,UAAUA,OAAOb,UAAUA,SAASa,OAAOC,UAAUH,WACxD;GACFA,YAAYE,OAAOC;GACnBT,IAAIG,SAASQ,eAAe;IAC1BC,UAAU;IACVC,QAAQ;IACRC,OAAO;IACR,CAAC;IACF;IACD,CAACnB,OAAOC,MAAM,CAAC;CAGlBT,gBAAgB;EACd,MAAMe,KAAKF,IAAIG;EACf,IAAI,CAACD,IAAI;EACT,OAAOV,cAAcU,IAAIL,SAAS;IACjC,CAACA,SAAS,CAAC;CAEd,OACE,oBAAC,OAAD;EAAUG;EAAK,WAAU;EACtBF;EACG"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const require_store = require('./store.cjs');
|
|
3
|
+
|
|
4
|
+
//#region src/components/Carousel/carouselStore.ts
|
|
5
|
+
const INITIAL_CAROUSEL_STATE = {
|
|
6
|
+
activeIndex: 0,
|
|
7
|
+
canPrev: false,
|
|
8
|
+
canNext: false,
|
|
9
|
+
scroll: null
|
|
10
|
+
};
|
|
11
|
+
const reducer = (state, action) => {
|
|
12
|
+
switch (action.type) {
|
|
13
|
+
case "setActive": return state.activeIndex === action.index ? state : {
|
|
14
|
+
...state,
|
|
15
|
+
activeIndex: action.index
|
|
16
|
+
};
|
|
17
|
+
case "setScrollState": return state.canPrev === action.canPrev && state.canNext === action.canNext ? state : {
|
|
18
|
+
...state,
|
|
19
|
+
canPrev: action.canPrev,
|
|
20
|
+
canNext: action.canNext
|
|
21
|
+
};
|
|
22
|
+
case "requestScroll": return {
|
|
23
|
+
...state,
|
|
24
|
+
scroll: {
|
|
25
|
+
index: action.index,
|
|
26
|
+
nonce: (state.scroll?.nonce ?? 0) + 1
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
function createCarouselStore() {
|
|
32
|
+
return require_store.createStore(reducer, INITIAL_CAROUSEL_STATE);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
exports.INITIAL_CAROUSEL_STATE = INITIAL_CAROUSEL_STATE;
|
|
37
|
+
exports.createCarouselStore = createCarouselStore;
|
|
38
|
+
//# sourceMappingURL=carouselStore.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carouselStore.cjs","names":["createStore","Store","CarouselState","Readonly","activeIndex","canPrev","canNext","scroll","index","nonce","CarouselAction","type","CarouselStore","INITIAL_CAROUSEL_STATE","reducer","state","action","createCarouselStore"],"sources":["../../../src/components/Carousel/carouselStore.ts"],"sourcesContent":["import { createStore, type Store } from './store'\n\nexport type CarouselState = Readonly<{\n activeIndex: number\n canPrev: boolean\n canNext: boolean\n scroll: { index: number; nonce: number } | null\n}>\n\nexport type CarouselAction =\n | { type: 'setActive'; index: number }\n | { type: 'setScrollState'; canPrev: boolean; canNext: boolean }\n | { type: 'requestScroll'; index: number }\n\nexport type CarouselStore = Store<CarouselState, CarouselAction>\n\nexport const INITIAL_CAROUSEL_STATE: CarouselState = {\n activeIndex: 0,\n canPrev: false,\n canNext: false,\n scroll: null,\n}\n\nconst reducer = (\n state: CarouselState,\n action: CarouselAction,\n): CarouselState => {\n switch (action.type) {\n case 'setActive':\n return state.activeIndex === action.index\n ? state\n : { ...state, activeIndex: action.index }\n case 'setScrollState':\n return state.canPrev === action.canPrev &&\n state.canNext === action.canNext\n ? state\n : { ...state, canPrev: action.canPrev, canNext: action.canNext }\n case 'requestScroll':\n return {\n ...state,\n scroll: { index: action.index, nonce: (state.scroll?.nonce ?? 0) + 1 },\n }\n }\n}\n\nexport function createCarouselStore(): CarouselStore {\n return createStore(reducer, INITIAL_CAROUSEL_STATE)\n}\n"],"mappings":";;;;AAgBA,MAAaa,yBAAwC;CACnDT,aAAa;CACbC,SAAS;CACTC,SAAS;CACTC,QAAQ;CACT;AAED,MAAMO,WACJC,OACAC,WACkB;CAClB,QAAQA,OAAOL,MAAf;EACE,KAAK,aACH,OAAOI,MAAMX,gBAAgBY,OAAOR,QAChCO,QACA;GAAE,GAAGA;GAAOX,aAAaY,OAAOR;GAAO;EAC7C,KAAK,kBACH,OAAOO,MAAMV,YAAYW,OAAOX,WAC9BU,MAAMT,YAAYU,OAAOV,UACvBS,QACA;GAAE,GAAGA;GAAOV,SAASW,OAAOX;GAASC,SAASU,OAAOV;GAAS;EACpE,KAAK,iBACH,OAAO;GACL,GAAGS;GACHR,QAAQ;IAAEC,OAAOQ,OAAOR;IAAOC,QAAQM,MAAMR,QAAQE,SAAS,KAAK;IAAE;GACtE;;;AAIP,SAAgBQ,sBAAqC;CACnD,OAAOjB,0BAAYc,SAASD,uBAAuB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createStore } from "./store.js";
|
|
3
|
+
|
|
4
|
+
//#region src/components/Carousel/carouselStore.ts
|
|
5
|
+
const INITIAL_CAROUSEL_STATE = {
|
|
6
|
+
activeIndex: 0,
|
|
7
|
+
canPrev: false,
|
|
8
|
+
canNext: false,
|
|
9
|
+
scroll: null
|
|
10
|
+
};
|
|
11
|
+
const reducer = (state, action) => {
|
|
12
|
+
switch (action.type) {
|
|
13
|
+
case "setActive": return state.activeIndex === action.index ? state : {
|
|
14
|
+
...state,
|
|
15
|
+
activeIndex: action.index
|
|
16
|
+
};
|
|
17
|
+
case "setScrollState": return state.canPrev === action.canPrev && state.canNext === action.canNext ? state : {
|
|
18
|
+
...state,
|
|
19
|
+
canPrev: action.canPrev,
|
|
20
|
+
canNext: action.canNext
|
|
21
|
+
};
|
|
22
|
+
case "requestScroll": return {
|
|
23
|
+
...state,
|
|
24
|
+
scroll: {
|
|
25
|
+
index: action.index,
|
|
26
|
+
nonce: (state.scroll?.nonce ?? 0) + 1
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
function createCarouselStore() {
|
|
32
|
+
return createStore(reducer, INITIAL_CAROUSEL_STATE);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
export { INITIAL_CAROUSEL_STATE, createCarouselStore };
|
|
37
|
+
//# sourceMappingURL=carouselStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carouselStore.js","names":["createStore","Store","CarouselState","Readonly","activeIndex","canPrev","canNext","scroll","index","nonce","CarouselAction","type","CarouselStore","INITIAL_CAROUSEL_STATE","reducer","state","action","createCarouselStore"],"sources":["../../../src/components/Carousel/carouselStore.ts"],"sourcesContent":["import { createStore, type Store } from './store'\n\nexport type CarouselState = Readonly<{\n activeIndex: number\n canPrev: boolean\n canNext: boolean\n scroll: { index: number; nonce: number } | null\n}>\n\nexport type CarouselAction =\n | { type: 'setActive'; index: number }\n | { type: 'setScrollState'; canPrev: boolean; canNext: boolean }\n | { type: 'requestScroll'; index: number }\n\nexport type CarouselStore = Store<CarouselState, CarouselAction>\n\nexport const INITIAL_CAROUSEL_STATE: CarouselState = {\n activeIndex: 0,\n canPrev: false,\n canNext: false,\n scroll: null,\n}\n\nconst reducer = (\n state: CarouselState,\n action: CarouselAction,\n): CarouselState => {\n switch (action.type) {\n case 'setActive':\n return state.activeIndex === action.index\n ? state\n : { ...state, activeIndex: action.index }\n case 'setScrollState':\n return state.canPrev === action.canPrev &&\n state.canNext === action.canNext\n ? state\n : { ...state, canPrev: action.canPrev, canNext: action.canNext }\n case 'requestScroll':\n return {\n ...state,\n scroll: { index: action.index, nonce: (state.scroll?.nonce ?? 0) + 1 },\n }\n }\n}\n\nexport function createCarouselStore(): CarouselStore {\n return createStore(reducer, INITIAL_CAROUSEL_STATE)\n}\n"],"mappings":";;;;AAgBA,MAAaa,yBAAwC;CACnDT,aAAa;CACbC,SAAS;CACTC,SAAS;CACTC,QAAQ;CACT;AAED,MAAMO,WACJC,OACAC,WACkB;CAClB,QAAQA,OAAOL,MAAf;EACE,KAAK,aACH,OAAOI,MAAMX,gBAAgBY,OAAOR,QAChCO,QACA;GAAE,GAAGA;GAAOX,aAAaY,OAAOR;GAAO;EAC7C,KAAK,kBACH,OAAOO,MAAMV,YAAYW,OAAOX,WAC9BU,MAAMT,YAAYU,OAAOV,UACvBS,QACA;GAAE,GAAGA;GAAOV,SAASW,OAAOX;GAASC,SAASU,OAAOV;GAAS;EACpE,KAAK,iBACH,OAAO;GACL,GAAGS;GACHR,QAAQ;IAAEC,OAAOQ,OAAOR;IAAOC,QAAQM,MAAMR,QAAQE,SAAS,KAAK;IAAE;GACtE;;;AAIP,SAAgBQ,sBAAqC;CACnD,OAAOjB,YAAYc,SAASD,uBAAuB"}
|