@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 @@
|
|
|
1
|
+
{"version":3,"file":"index2.js","names":["forwardRef","useCallback","useClassNames","CharcoalSwitchProps","onChange","checked","InputProps","React","HTMLProps","HTMLInputElement","SwitchInputProps","Omit","SwitchInput","className","props","ref","handleChange","e","ChangeEvent","el","currentTarget","classNames"],"sources":["../../../../src/components/Switch/SwitchInput/index.tsx"],"sourcesContent":["import './index.css'\n\nimport { forwardRef, useCallback } from 'react'\nimport { useClassNames } from '../../../_lib/useClassNames'\n\nexport type CharcoalSwitchProps = {\n onChange?: (checked: boolean) => void\n}\n\ntype InputProps = React.HTMLProps<HTMLInputElement>\n\nexport type SwitchInputProps = CharcoalSwitchProps &\n Omit<InputProps, keyof CharcoalSwitchProps | 'ref'>\n\nconst SwitchInput = forwardRef<\n HTMLInputElement,\n Omit<SwitchInputProps, 'children'>\n>(function SwitchInput({ onChange, className, ...props }, ref) {\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n const el = e.currentTarget\n onChange?.(el.checked)\n },\n [onChange],\n )\n\n const classNames = useClassNames('charcoal-switch-input', className)\n return (\n <input\n ref={ref}\n className={classNames}\n type=\"checkbox\"\n onChange={handleChange}\n {...props}\n />\n )\n})\n\nexport default SwitchInput\n"],"mappings":";;;;;;;AAcA,MAAMY,cAAcZ,WAGlB,SAASY,YAAY,EAAER,UAAUS,WAAW,GAAGC,SAASC,KAAK;CAC7D,MAAMC,eAAef,aAClBgB,MAA2C;EAC1C,MAAME,KAAKF,EAAEG;EACbhB,WAAWe,GAAGd,QAAQ;IAExB,CAACD,SACH,CAAC;CAGD,OACE,oBAAC,SAAD;EACOW;EACL,WAJeb,cAAc,yBAAyBW,UAIjC;EACrB,MAAK;EACL,UAAUG;EACV,GAAIF;EACJ;EAEJ"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
const require_useClassNames = require('../../_lib/useClassNames.cjs');
|
|
4
|
+
let react = require("react");
|
|
5
|
+
react = require_runtime.__toESM(react);
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
|
|
8
|
+
//#region src/components/Switch/SwitchWithLabel.tsx
|
|
9
|
+
const SwitchWithLabel = react.memo(function SwitchWithLabel({ children, className, disabled, id, input }) {
|
|
10
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
11
|
+
htmlFor: id,
|
|
12
|
+
className: require_useClassNames.useClassNames("charcoal-switch__label", className),
|
|
13
|
+
"aria-disabled": disabled,
|
|
14
|
+
children: [input, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
15
|
+
className: "charcoal-switch__label_div",
|
|
16
|
+
children
|
|
17
|
+
})]
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
exports.SwitchWithLabel = SwitchWithLabel;
|
|
23
|
+
//# sourceMappingURL=SwitchWithLabel.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SwitchWithLabel.cjs","names":["React","useClassNames","SwitchWithLabel","memo","children","className","disabled","id","input","ReactNode","classNames"],"sources":["../../../src/components/Switch/SwitchWithLabel.tsx"],"sourcesContent":["import * as React from 'react'\nimport { useClassNames } from '../../_lib/useClassNames'\n\nexport const SwitchWithLabel = React.memo(function SwitchWithLabel({\n children,\n className,\n disabled,\n id,\n input,\n}: {\n children: React.ReactNode\n className?: string\n disabled?: boolean\n id?: string\n input: React.ReactNode\n}) {\n const classNames = useClassNames('charcoal-switch__label', className)\n return (\n <label htmlFor={id} className={classNames} aria-disabled={disabled}>\n {input}\n <div className=\"charcoal-switch__label_div\">{children}</div>\n </label>\n )\n})\n"],"mappings":";;;;;;;;AAGA,MAAaE,kBAAkBF,MAAMG,KAAK,SAASD,gBAAgB,EACjEE,UACAC,WACAC,UACAC,IACAC,SAOC;CAED,OACE,4CAAC,SAAD;EAAO,SAASD;EAAI,WAFHN,oCAAc,0BAA0BI,UAEhB;EAAE,iBAAeC;YAA1D,CACGE,OACD,2CAAC,OAAD;GAAK,WAAU;GAA8BJ;GAAc,EACrD;;EAEV"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useClassNames } from "../../_lib/useClassNames.js";
|
|
3
|
+
import * as React$1 from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region src/components/Switch/SwitchWithLabel.tsx
|
|
7
|
+
const SwitchWithLabel = React$1.memo(function SwitchWithLabel({ children, className, disabled, id, input }) {
|
|
8
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
9
|
+
htmlFor: id,
|
|
10
|
+
className: useClassNames("charcoal-switch__label", className),
|
|
11
|
+
"aria-disabled": disabled,
|
|
12
|
+
children: [input, /* @__PURE__ */ jsx("div", {
|
|
13
|
+
className: "charcoal-switch__label_div",
|
|
14
|
+
children
|
|
15
|
+
})]
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
export { SwitchWithLabel };
|
|
21
|
+
//# sourceMappingURL=SwitchWithLabel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SwitchWithLabel.js","names":["React","useClassNames","SwitchWithLabel","memo","children","className","disabled","id","input","ReactNode","classNames"],"sources":["../../../src/components/Switch/SwitchWithLabel.tsx"],"sourcesContent":["import * as React from 'react'\nimport { useClassNames } from '../../_lib/useClassNames'\n\nexport const SwitchWithLabel = React.memo(function SwitchWithLabel({\n children,\n className,\n disabled,\n id,\n input,\n}: {\n children: React.ReactNode\n className?: string\n disabled?: boolean\n id?: string\n input: React.ReactNode\n}) {\n const classNames = useClassNames('charcoal-switch__label', className)\n return (\n <label htmlFor={id} className={classNames} aria-disabled={disabled}>\n {input}\n <div className=\"charcoal-switch__label_div\">{children}</div>\n </label>\n )\n})\n"],"mappings":";;;;;;AAGA,MAAaE,kBAAkBF,QAAMG,KAAK,SAASD,gBAAgB,EACjEE,UACAC,WACAC,UACAC,IACAC,SAOC;CAED,OACE,qBAAC,SAAD;EAAO,SAASD;EAAI,WAFHN,cAAc,0BAA0BI,UAEhB;EAAE,iBAAeC;YAA1D,CACGE,OACD,oBAAC,OAAD;GAAK,WAAU;GAA8BJ;GAAc,EACrD;;EAEV"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
require('./index.cjs');
|
|
4
|
+
const require_index$1 = require('./SwitchInput/index2.cjs');
|
|
5
|
+
const require_SwitchWithLabel = require('./SwitchWithLabel.cjs');
|
|
6
|
+
let react = require("react");
|
|
7
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
+
let react_aria_useId = require("react-aria/useId");
|
|
9
|
+
|
|
10
|
+
//#region src/components/Switch/index.tsx
|
|
11
|
+
const Switch = (0, react.forwardRef)(function Switch({ children, onChange, disabled, className, id, ...props }, ref) {
|
|
12
|
+
const htmlId = (0, react_aria_useId.useId)(id);
|
|
13
|
+
const noChildren = children === void 0;
|
|
14
|
+
const input = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$1.default, {
|
|
15
|
+
...props,
|
|
16
|
+
disabled,
|
|
17
|
+
className: noChildren ? className : void 0,
|
|
18
|
+
id: htmlId,
|
|
19
|
+
onChange,
|
|
20
|
+
ref,
|
|
21
|
+
role: "switch",
|
|
22
|
+
type: "checkbox"
|
|
23
|
+
});
|
|
24
|
+
if (noChildren) return input;
|
|
25
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SwitchWithLabel.SwitchWithLabel, {
|
|
26
|
+
className,
|
|
27
|
+
disabled,
|
|
28
|
+
id: htmlId,
|
|
29
|
+
input,
|
|
30
|
+
children
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
var Switch_default = (0, react.memo)(Switch);
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
exports.default = Switch_default;
|
|
37
|
+
//# sourceMappingURL=index2.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index2.cjs","names":["memo","forwardRef","SwitchInput","SwitchInputProps","SwitchWithLabel","useId","SwitchProps","Switch","HTMLInputElement","children","onChange","disabled","className","id","props","ref","htmlId","noChildren","undefined","input"],"sources":["../../../src/components/Switch/index.tsx"],"sourcesContent":["import './index.css'\n\nimport { memo, forwardRef } from 'react'\nimport SwitchInput, { type SwitchInputProps } from './SwitchInput'\nimport { SwitchWithLabel } from './SwitchWithLabel'\nimport { useId } from 'react-aria/useId'\n\nexport type SwitchProps = SwitchInputProps\n\nconst Switch = forwardRef<HTMLInputElement, SwitchProps>(function Switch(\n { children, onChange, disabled, className, id, ...props },\n ref,\n) {\n const htmlId = useId(id)\n const noChildren = children === undefined\n const input = (\n <SwitchInput\n {...props}\n disabled={disabled}\n className={noChildren ? className : undefined}\n id={htmlId}\n onChange={onChange}\n ref={ref}\n role=\"switch\"\n type=\"checkbox\"\n />\n )\n\n if (noChildren) {\n return input\n }\n\n return (\n <SwitchWithLabel\n className={className}\n disabled={disabled}\n id={htmlId}\n input={input}\n >\n {children}\n </SwitchWithLabel>\n )\n})\n\nexport default memo(Switch)\n"],"mappings":";;;;;;;;;;AASA,MAAMO,+BAAmD,SAASA,OAChE,EAAEE,UAAUC,UAAUC,UAAUC,WAAWC,IAAI,GAAGC,SAClDC,KACA;CACA,MAAMC,qCAAeH,GAAG;CACxB,MAAMI,aAAaR,aAAaS;CAChC,MAAMC,QACJ,2CAAC,yBAAD;EACE,GAAIL;EACMH;EACV,WAAWM,aAAaL,YAAYM;EACpC,IAAIF;EACMN;EACLK;EACL,MAAK;EACL,MAAK;EAER;CAED,IAAIE,YACF,OAAOE;CAGT,OACE,2CAAC,yCAAD;EACaP;EACDD;EACV,IAAIK;EACGG;EAENV;EACe;EAEpB;AAEF,qCAAoBF,OAAO"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import SwitchInput from "./SwitchInput/index2.js";
|
|
4
|
+
import { SwitchWithLabel } from "./SwitchWithLabel.js";
|
|
5
|
+
import { forwardRef, memo } from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
import { useId } from "react-aria/useId";
|
|
8
|
+
|
|
9
|
+
//#region src/components/Switch/index.tsx
|
|
10
|
+
const Switch = forwardRef(function Switch({ children, onChange, disabled, className, id, ...props }, ref) {
|
|
11
|
+
const htmlId = useId(id);
|
|
12
|
+
const noChildren = children === void 0;
|
|
13
|
+
const input = /* @__PURE__ */ jsx(SwitchInput, {
|
|
14
|
+
...props,
|
|
15
|
+
disabled,
|
|
16
|
+
className: noChildren ? className : void 0,
|
|
17
|
+
id: htmlId,
|
|
18
|
+
onChange,
|
|
19
|
+
ref,
|
|
20
|
+
role: "switch",
|
|
21
|
+
type: "checkbox"
|
|
22
|
+
});
|
|
23
|
+
if (noChildren) return input;
|
|
24
|
+
return /* @__PURE__ */ jsx(SwitchWithLabel, {
|
|
25
|
+
className,
|
|
26
|
+
disabled,
|
|
27
|
+
id: htmlId,
|
|
28
|
+
input,
|
|
29
|
+
children
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
var Switch_default = memo(Switch);
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
export { Switch_default as default };
|
|
36
|
+
//# sourceMappingURL=index2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index2.js","names":["memo","forwardRef","SwitchInput","SwitchInputProps","SwitchWithLabel","useId","SwitchProps","Switch","HTMLInputElement","children","onChange","disabled","className","id","props","ref","htmlId","noChildren","undefined","input"],"sources":["../../../src/components/Switch/index.tsx"],"sourcesContent":["import './index.css'\n\nimport { memo, forwardRef } from 'react'\nimport SwitchInput, { type SwitchInputProps } from './SwitchInput'\nimport { SwitchWithLabel } from './SwitchWithLabel'\nimport { useId } from 'react-aria/useId'\n\nexport type SwitchProps = SwitchInputProps\n\nconst Switch = forwardRef<HTMLInputElement, SwitchProps>(function Switch(\n { children, onChange, disabled, className, id, ...props },\n ref,\n) {\n const htmlId = useId(id)\n const noChildren = children === undefined\n const input = (\n <SwitchInput\n {...props}\n disabled={disabled}\n className={noChildren ? className : undefined}\n id={htmlId}\n onChange={onChange}\n ref={ref}\n role=\"switch\"\n type=\"checkbox\"\n />\n )\n\n if (noChildren) {\n return input\n }\n\n return (\n <SwitchWithLabel\n className={className}\n disabled={disabled}\n id={htmlId}\n input={input}\n >\n {children}\n </SwitchWithLabel>\n )\n})\n\nexport default memo(Switch)\n"],"mappings":";;;;;;;;;AASA,MAAMO,SAASN,WAA0C,SAASM,OAChE,EAAEE,UAAUC,UAAUC,UAAUC,WAAWC,IAAI,GAAGC,SAClDC,KACA;CACA,MAAMC,SAASX,MAAMQ,GAAG;CACxB,MAAMI,aAAaR,aAAaS;CAChC,MAAMC,QACJ,oBAAC,aAAD;EACE,GAAIL;EACMH;EACV,WAAWM,aAAaL,YAAYM;EACpC,IAAIF;EACMN;EACLK;EACL,MAAK;EACL,MAAK;EAER;CAED,IAAIE,YACF,OAAOE;CAGT,OACE,oBAAC,iBAAD;EACaP;EACDD;EACV,IAAIK;EACGG;EAENV;EACe;EAEpB;AAEF,qBAAeT,KAAKO,OAAO"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
const require_useClassNames = require('../../_lib/useClassNames.cjs');
|
|
4
|
+
const require_index = require('../Icon/index.cjs');
|
|
5
|
+
require('./index.cjs');
|
|
6
|
+
let react = require("react");
|
|
7
|
+
react = require_runtime.__toESM(react);
|
|
8
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
|
+
let react_aria_useObjectRef = require("react-aria/useObjectRef");
|
|
10
|
+
let react_aria = require("react-aria");
|
|
11
|
+
|
|
12
|
+
//#region src/components/TagItem/index.tsx
|
|
13
|
+
const TagItem = (0, react.forwardRef)(function TagItemInner({ component, label, translatedLabel, bgColor = "#7ACCB1", bgImage, size = "M", status = "default", disabled, "aria-disabled": ariaDisabled, ...props }, _ref) {
|
|
14
|
+
const ref = (0, react_aria_useObjectRef.useObjectRef)(_ref);
|
|
15
|
+
const hasTranslatedLabel = translatedLabel !== void 0 && translatedLabel.length > 0;
|
|
16
|
+
const className = require_useClassNames.useClassNames("charcoal-tag-item", "charcoal-tag-item__bg", props.className);
|
|
17
|
+
const bgVariant = bgImage !== void 0 && bgImage.length > 0 ? "image" : "color";
|
|
18
|
+
const bg = bgVariant === "color" ? bgColor : `url(${bgImage ?? ""})`;
|
|
19
|
+
const Component = (0, react.useMemo)(() => component ?? "a", [component]);
|
|
20
|
+
const isButton = Component === "button";
|
|
21
|
+
const { linkProps } = (0, react_aria.useLink)({
|
|
22
|
+
...props,
|
|
23
|
+
isDisabled: disabled,
|
|
24
|
+
elementType: typeof Component === "string" ? Component : "a"
|
|
25
|
+
}, ref);
|
|
26
|
+
const disabledProps = isButton ? {
|
|
27
|
+
disabled,
|
|
28
|
+
"aria-disabled": ariaDisabled
|
|
29
|
+
} : linkProps;
|
|
30
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Component, {
|
|
31
|
+
...props,
|
|
32
|
+
...disabledProps,
|
|
33
|
+
ref,
|
|
34
|
+
className,
|
|
35
|
+
"data-state": status,
|
|
36
|
+
"data-bg-variant": bgVariant,
|
|
37
|
+
"data-size": hasTranslatedLabel ? "M" : size,
|
|
38
|
+
style: { "--charcoal-tag-item-bg": bg },
|
|
39
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
40
|
+
className: "charcoal-tag-item__label",
|
|
41
|
+
"data-has-translate": hasTranslatedLabel,
|
|
42
|
+
children: [hasTranslatedLabel && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
43
|
+
className: "charcoal-tag-item__label__translated",
|
|
44
|
+
children: translatedLabel
|
|
45
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
46
|
+
className: "charcoal-tag-item__label__text",
|
|
47
|
+
"data-has-translate": hasTranslatedLabel,
|
|
48
|
+
children: label
|
|
49
|
+
})]
|
|
50
|
+
}), status === "active" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index.default, { name: "16/Remove" })]
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
var TagItem_default = (0, react.memo)(TagItem);
|
|
54
|
+
|
|
55
|
+
//#endregion
|
|
56
|
+
exports.default = TagItem_default;
|
|
57
|
+
//# sourceMappingURL=index2.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index2.cjs","names":["React","forwardRef","memo","useMemo","ForwardedRef","JSX","Icon","useClassNames","useObjectRef","useLink","SizeMap","S","M","TagItemProps","ElementType","label","translatedLabel","bgColor","bgImage","status","size","disabled","component","T","Omit","ComponentPropsWithRef","TagItem","HTMLAnchorElement","TagItemInner","ariaDisabled","props","_ref","ref","hasTranslatedLabel","undefined","length","className","bgVariant","bg","Component","isButton","linkProps","isDisabled","elementType","disabledProps","p","Element"],"sources":["../../../src/components/TagItem/index.tsx"],"sourcesContent":["import React, { forwardRef, memo, useMemo, ForwardedRef, type JSX } from 'react'\nimport Icon from '../Icon'\nimport { useClassNames } from '../../_lib/useClassNames'\nimport './index.css'\n\nimport { useObjectRef } from 'react-aria/useObjectRef'\nimport { useLink } from 'react-aria'\n\ntype SizeMap = {\n S: 32\n M: 40\n}\n\nexport type TagItemProps<T extends React.ElementType = 'a'> = {\n label: string\n translatedLabel?: string\n bgColor?: string\n bgImage?: string\n status?: 'default' | 'active' | 'inactive'\n size?: keyof SizeMap\n disabled?: boolean\n /**\n * The component used for root element.\n * @type T extends React.ElementType = 'a'\n */\n component?: T\n} & Omit<React.ComponentPropsWithRef<T>, 'children' | 'disabled'>\n\nconst TagItem = forwardRef<HTMLAnchorElement, TagItemProps>(\n function TagItemInner<T extends React.ElementType>(\n {\n component,\n label,\n translatedLabel,\n bgColor = '#7ACCB1',\n bgImage,\n size = 'M',\n status = 'default',\n disabled,\n 'aria-disabled': ariaDisabled,\n ...props\n }: TagItemProps<T>,\n _ref: ForwardedRef<HTMLAnchorElement>,\n ) {\n const ref = useObjectRef(_ref)\n\n const hasTranslatedLabel =\n translatedLabel !== undefined && translatedLabel.length > 0\n const className = useClassNames(\n 'charcoal-tag-item',\n 'charcoal-tag-item__bg',\n props.className,\n )\n\n const bgVariant =\n bgImage !== undefined && bgImage.length > 0 ? 'image' : 'color'\n const bg = bgVariant === 'color' ? bgColor : `url(${bgImage ?? ''})`\n\n const Component = useMemo(() => component ?? 'a', [component])\n const isButton = Component === 'button'\n\n const { linkProps } = useLink(\n {\n ...props,\n isDisabled: disabled,\n elementType: typeof Component === 'string' ? Component : 'a',\n },\n ref,\n )\n\n const disabledProps = isButton\n ? { disabled, 'aria-disabled': ariaDisabled }\n : linkProps\n\n return (\n <Component\n {...props}\n {...disabledProps}\n ref={ref}\n className={className}\n data-state={status}\n data-bg-variant={bgVariant}\n data-size={hasTranslatedLabel ? 'M' : size}\n style={{ '--charcoal-tag-item-bg': bg }}\n >\n <div\n className=\"charcoal-tag-item__label\"\n data-has-translate={hasTranslatedLabel}\n >\n {hasTranslatedLabel && (\n <span className=\"charcoal-tag-item__label__translated\">\n {translatedLabel}\n </span>\n )}\n <span\n className=\"charcoal-tag-item__label__text\"\n data-has-translate={hasTranslatedLabel}\n >\n {label}\n </span>\n </div>\n {status === 'active' && <Icon name=\"16/Remove\" />}\n </Component>\n )\n },\n) as <T extends React.ElementType = 'a'>(p: TagItemProps<T>) => JSX.Element\n\nexport default memo(TagItem)\n"],"mappings":";;;;;;;;;;;;AA4BA,MAAM0B,gCACJ,SAASE,aACP,EACEN,WACAP,OACAC,iBACAC,UAAU,WACVC,SACAE,OAAO,KACPD,SAAS,WACTE,UACA,iBAAiBQ,cACjB,GAAGC,SAELC,MACA;CACA,MAAMC,gDAAmBD,KAAK;CAE9B,MAAME,qBACJjB,oBAAoBkB,UAAalB,gBAAgBmB,SAAS;CAC5D,MAAMC,YAAY7B,oCAChB,qBACA,yBACAuB,MAAMM,UACP;CAED,MAAMC,YACJnB,YAAYgB,UAAahB,QAAQiB,SAAS,IAAI,UAAU;CAC1D,MAAMG,KAAKD,cAAc,UAAUpB,UAAU,OAAOC,WAAW,GAAE;CAEjE,MAAMqB,qCAA0BjB,aAAa,KAAK,CAACA,UAAU,CAAC;CAC9D,MAAMkB,WAAWD,cAAc;CAE/B,MAAM,EAAEE,sCACN;EACE,GAAGX;EACHY,YAAYrB;EACZsB,aAAa,OAAOJ,cAAc,WAAWA,YAAY;EAC1D,EACDP,IACD;CAED,MAAMY,gBAAgBJ,WAClB;EAAEnB;EAAU,iBAAiBQ;EAAc,GAC3CY;CAEJ,OACE,4CAAC,WAAD;EACE,GAAIX;EACJ,GAAIc;EACCZ;EACMI;EACX,cAAYjB;EACZ,mBAAiBkB;EACjB,aAAWJ,qBAAqB,MAAMb;EACtC,OAAO,EAAE,0BAA0BkB,IAAI;YARzC,CAUE,4CAAC,OAAD;GACE,WAAU;GACV,sBAAoBL;aAFtB,CAIGA,sBACC,2CAAC,QAAD;IAAM,WAAU;cACbjB;IAEJ,GACD,2CAAC,QAAD;IACE,WAAU;IACV,sBAAoBiB;cAEnBlB;IACG,EACH;MACJI,WAAW,YAAY,2CAAC,uBAAD,EAAM,MAAK,aAAc,EACvC;;EAGjB;AAED,sCAAoBO,QAAQ"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useClassNames } from "../../_lib/useClassNames.js";
|
|
3
|
+
import Icon from "../Icon/index.js";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import React, { forwardRef, memo, useMemo } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { useObjectRef } from "react-aria/useObjectRef";
|
|
8
|
+
import { useLink } from "react-aria";
|
|
9
|
+
|
|
10
|
+
//#region src/components/TagItem/index.tsx
|
|
11
|
+
const TagItem = forwardRef(function TagItemInner({ component, label, translatedLabel, bgColor = "#7ACCB1", bgImage, size = "M", status = "default", disabled, "aria-disabled": ariaDisabled, ...props }, _ref) {
|
|
12
|
+
const ref = useObjectRef(_ref);
|
|
13
|
+
const hasTranslatedLabel = translatedLabel !== void 0 && translatedLabel.length > 0;
|
|
14
|
+
const className = useClassNames("charcoal-tag-item", "charcoal-tag-item__bg", props.className);
|
|
15
|
+
const bgVariant = bgImage !== void 0 && bgImage.length > 0 ? "image" : "color";
|
|
16
|
+
const bg = bgVariant === "color" ? bgColor : `url(${bgImage ?? ""})`;
|
|
17
|
+
const Component = useMemo(() => component ?? "a", [component]);
|
|
18
|
+
const isButton = Component === "button";
|
|
19
|
+
const { linkProps } = useLink({
|
|
20
|
+
...props,
|
|
21
|
+
isDisabled: disabled,
|
|
22
|
+
elementType: typeof Component === "string" ? Component : "a"
|
|
23
|
+
}, ref);
|
|
24
|
+
const disabledProps = isButton ? {
|
|
25
|
+
disabled,
|
|
26
|
+
"aria-disabled": ariaDisabled
|
|
27
|
+
} : linkProps;
|
|
28
|
+
return /* @__PURE__ */ jsxs(Component, {
|
|
29
|
+
...props,
|
|
30
|
+
...disabledProps,
|
|
31
|
+
ref,
|
|
32
|
+
className,
|
|
33
|
+
"data-state": status,
|
|
34
|
+
"data-bg-variant": bgVariant,
|
|
35
|
+
"data-size": hasTranslatedLabel ? "M" : size,
|
|
36
|
+
style: { "--charcoal-tag-item-bg": bg },
|
|
37
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
38
|
+
className: "charcoal-tag-item__label",
|
|
39
|
+
"data-has-translate": hasTranslatedLabel,
|
|
40
|
+
children: [hasTranslatedLabel && /* @__PURE__ */ jsx("span", {
|
|
41
|
+
className: "charcoal-tag-item__label__translated",
|
|
42
|
+
children: translatedLabel
|
|
43
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
44
|
+
className: "charcoal-tag-item__label__text",
|
|
45
|
+
"data-has-translate": hasTranslatedLabel,
|
|
46
|
+
children: label
|
|
47
|
+
})]
|
|
48
|
+
}), status === "active" && /* @__PURE__ */ jsx(Icon, { name: "16/Remove" })]
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
var TagItem_default = memo(TagItem);
|
|
52
|
+
|
|
53
|
+
//#endregion
|
|
54
|
+
export { TagItem_default as default };
|
|
55
|
+
//# sourceMappingURL=index2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index2.js","names":["React","forwardRef","memo","useMemo","ForwardedRef","JSX","Icon","useClassNames","useObjectRef","useLink","SizeMap","S","M","TagItemProps","ElementType","label","translatedLabel","bgColor","bgImage","status","size","disabled","component","T","Omit","ComponentPropsWithRef","TagItem","HTMLAnchorElement","TagItemInner","ariaDisabled","props","_ref","ref","hasTranslatedLabel","undefined","length","className","bgVariant","bg","Component","isButton","linkProps","isDisabled","elementType","disabledProps","p","Element"],"sources":["../../../src/components/TagItem/index.tsx"],"sourcesContent":["import React, { forwardRef, memo, useMemo, ForwardedRef, type JSX } from 'react'\nimport Icon from '../Icon'\nimport { useClassNames } from '../../_lib/useClassNames'\nimport './index.css'\n\nimport { useObjectRef } from 'react-aria/useObjectRef'\nimport { useLink } from 'react-aria'\n\ntype SizeMap = {\n S: 32\n M: 40\n}\n\nexport type TagItemProps<T extends React.ElementType = 'a'> = {\n label: string\n translatedLabel?: string\n bgColor?: string\n bgImage?: string\n status?: 'default' | 'active' | 'inactive'\n size?: keyof SizeMap\n disabled?: boolean\n /**\n * The component used for root element.\n * @type T extends React.ElementType = 'a'\n */\n component?: T\n} & Omit<React.ComponentPropsWithRef<T>, 'children' | 'disabled'>\n\nconst TagItem = forwardRef<HTMLAnchorElement, TagItemProps>(\n function TagItemInner<T extends React.ElementType>(\n {\n component,\n label,\n translatedLabel,\n bgColor = '#7ACCB1',\n bgImage,\n size = 'M',\n status = 'default',\n disabled,\n 'aria-disabled': ariaDisabled,\n ...props\n }: TagItemProps<T>,\n _ref: ForwardedRef<HTMLAnchorElement>,\n ) {\n const ref = useObjectRef(_ref)\n\n const hasTranslatedLabel =\n translatedLabel !== undefined && translatedLabel.length > 0\n const className = useClassNames(\n 'charcoal-tag-item',\n 'charcoal-tag-item__bg',\n props.className,\n )\n\n const bgVariant =\n bgImage !== undefined && bgImage.length > 0 ? 'image' : 'color'\n const bg = bgVariant === 'color' ? bgColor : `url(${bgImage ?? ''})`\n\n const Component = useMemo(() => component ?? 'a', [component])\n const isButton = Component === 'button'\n\n const { linkProps } = useLink(\n {\n ...props,\n isDisabled: disabled,\n elementType: typeof Component === 'string' ? Component : 'a',\n },\n ref,\n )\n\n const disabledProps = isButton\n ? { disabled, 'aria-disabled': ariaDisabled }\n : linkProps\n\n return (\n <Component\n {...props}\n {...disabledProps}\n ref={ref}\n className={className}\n data-state={status}\n data-bg-variant={bgVariant}\n data-size={hasTranslatedLabel ? 'M' : size}\n style={{ '--charcoal-tag-item-bg': bg }}\n >\n <div\n className=\"charcoal-tag-item__label\"\n data-has-translate={hasTranslatedLabel}\n >\n {hasTranslatedLabel && (\n <span className=\"charcoal-tag-item__label__translated\">\n {translatedLabel}\n </span>\n )}\n <span\n className=\"charcoal-tag-item__label__text\"\n data-has-translate={hasTranslatedLabel}\n >\n {label}\n </span>\n </div>\n {status === 'active' && <Icon name=\"16/Remove\" />}\n </Component>\n )\n },\n) as <T extends React.ElementType = 'a'>(p: TagItemProps<T>) => JSX.Element\n\nexport default memo(TagItem)\n"],"mappings":";;;;;;;;;;AA4BA,MAAM0B,UAAUzB,WACd,SAAS2B,aACP,EACEN,WACAP,OACAC,iBACAC,UAAU,WACVC,SACAE,OAAO,KACPD,SAAS,WACTE,UACA,iBAAiBQ,cACjB,GAAGC,SAELC,MACA;CACA,MAAMC,MAAMxB,aAAauB,KAAK;CAE9B,MAAME,qBACJjB,oBAAoBkB,UAAalB,gBAAgBmB,SAAS;CAC5D,MAAMC,YAAY7B,cAChB,qBACA,yBACAuB,MAAMM,UACP;CAED,MAAMC,YACJnB,YAAYgB,UAAahB,QAAQiB,SAAS,IAAI,UAAU;CAC1D,MAAMG,KAAKD,cAAc,UAAUpB,UAAU,OAAOC,WAAW,GAAE;CAEjE,MAAMqB,YAAYpC,cAAcmB,aAAa,KAAK,CAACA,UAAU,CAAC;CAC9D,MAAMkB,WAAWD,cAAc;CAE/B,MAAM,EAAEE,cAAchC,QACpB;EACE,GAAGqB;EACHY,YAAYrB;EACZsB,aAAa,OAAOJ,cAAc,WAAWA,YAAY;EAC1D,EACDP,IACD;CAED,MAAMY,gBAAgBJ,WAClB;EAAEnB;EAAU,iBAAiBQ;EAAc,GAC3CY;CAEJ,OACE,qBAAC,WAAD;EACE,GAAIX;EACJ,GAAIc;EACCZ;EACMI;EACX,cAAYjB;EACZ,mBAAiBkB;EACjB,aAAWJ,qBAAqB,MAAMb;EACtC,OAAO,EAAE,0BAA0BkB,IAAI;YARzC,CAUE,qBAAC,OAAD;GACE,WAAU;GACV,sBAAoBL;aAFtB,CAIGA,sBACC,oBAAC,QAAD;IAAM,WAAU;cACbjB;IAEJ,GACD,oBAAC,QAAD;IACE,WAAU;IACV,sBAAoBiB;cAEnBlB;IACG,EACH;MACJI,WAAW,YAAY,oBAAC,MAAD,EAAM,MAAK,aAAc,EACvC;;EAGjB;AAED,sBAAejB,KAAKwB,QAAQ"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
const require_useClassNames = require('../../_lib/useClassNames.cjs');
|
|
4
|
+
const require_index = require('../FieldLabel/index2.cjs');
|
|
5
|
+
const require_index$1 = require('../../_lib/index.cjs');
|
|
6
|
+
const require_useFocusWithClick = require('../TextField/useFocusWithClick.cjs');
|
|
7
|
+
const require_index$2 = require('../TextField/AssistiveText/index2.cjs');
|
|
8
|
+
require('./index.cjs');
|
|
9
|
+
let react = require("react");
|
|
10
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
|
+
let react_aria_useId = require("react-aria/useId");
|
|
12
|
+
let react_aria_VisuallyHidden = require("react-aria/VisuallyHidden");
|
|
13
|
+
|
|
14
|
+
//#region src/components/TextArea/index.tsx
|
|
15
|
+
const TextArea = (0, react.forwardRef)(function TextAreaInner({ onChange, className, value, showCount = false, showLabel = false, label = "", requiredText, subLabel, disabled = false, required, assistiveText, maxLength, autoHeight = false, rows: initialRows = 4, maxRows, invalid, getCount = require_index$1.countCodePointsInString, defaultValue, imperativeRef, ...props }, forwardRef) {
|
|
16
|
+
const isUncontrolled = value === void 0;
|
|
17
|
+
const countValue = value ?? defaultValue?.toString() ?? "";
|
|
18
|
+
const [rows, setRows] = (0, react.useState)(initialRows);
|
|
19
|
+
const [count, setCount] = (0, react.useState)(getCount(countValue));
|
|
20
|
+
const textareaRef = (0, react.useRef)(null);
|
|
21
|
+
const containerRef = (0, react.useRef)(null);
|
|
22
|
+
require_useFocusWithClick.useFocusWithClick(containerRef, textareaRef);
|
|
23
|
+
const { visuallyHiddenProps } = (0, react_aria_VisuallyHidden.useVisuallyHidden)();
|
|
24
|
+
const isEnableAutoHeight = (0, react.useMemo)(() => autoHeight || maxRows && maxRows >= 0, [autoHeight, maxRows]);
|
|
25
|
+
const classNames = require_useClassNames.useClassNames("charcoal-text-area-root", className);
|
|
26
|
+
const showAssistiveText = assistiveText != null && assistiveText.length !== 0;
|
|
27
|
+
const syncHeight = (0, react.useCallback)((textarea) => {
|
|
28
|
+
const currentRows = (`${textarea.value}\n`.match(/\n/gu)?.length ?? 0) || 1;
|
|
29
|
+
const hasValidMaxRows = maxRows !== void 0 && maxRows >= 1;
|
|
30
|
+
const nextRows = initialRows <= currentRows ? currentRows : initialRows;
|
|
31
|
+
if (!hasValidMaxRows) {
|
|
32
|
+
setRows(nextRows);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
setRows(Math.min(nextRows, maxRows));
|
|
36
|
+
}, [initialRows, maxRows]);
|
|
37
|
+
const syncTextAreaState = (0, react.useCallback)((textarea) => {
|
|
38
|
+
const count = getCount(textarea.value);
|
|
39
|
+
if (isUncontrolled) setCount(count);
|
|
40
|
+
if (isEnableAutoHeight) syncHeight(textarea);
|
|
41
|
+
return count;
|
|
42
|
+
}, [
|
|
43
|
+
getCount,
|
|
44
|
+
isEnableAutoHeight,
|
|
45
|
+
isUncontrolled,
|
|
46
|
+
syncHeight
|
|
47
|
+
]);
|
|
48
|
+
const handleChange = (0, react.useCallback)((e) => {
|
|
49
|
+
const value = e.currentTarget.value;
|
|
50
|
+
const count = getCount(value);
|
|
51
|
+
if (maxLength !== void 0 && count > maxLength) return;
|
|
52
|
+
syncTextAreaState(e.currentTarget);
|
|
53
|
+
onChange?.(value);
|
|
54
|
+
}, [
|
|
55
|
+
getCount,
|
|
56
|
+
maxLength,
|
|
57
|
+
onChange,
|
|
58
|
+
syncTextAreaState
|
|
59
|
+
]);
|
|
60
|
+
(0, react.useImperativeHandle)(imperativeRef, () => ({
|
|
61
|
+
setValue: (value) => {
|
|
62
|
+
if (textareaRef.current === null) return;
|
|
63
|
+
textareaRef.current.value = value;
|
|
64
|
+
syncTextAreaState(textareaRef.current);
|
|
65
|
+
},
|
|
66
|
+
sync: () => {
|
|
67
|
+
if (textareaRef.current !== null) syncTextAreaState(textareaRef.current);
|
|
68
|
+
}
|
|
69
|
+
}), [syncTextAreaState]);
|
|
70
|
+
const textAreaId = (0, react_aria_useId.useId)(props.id);
|
|
71
|
+
const describedbyId = (0, react_aria_useId.useId)();
|
|
72
|
+
const labelledbyId = (0, react_aria_useId.useId)();
|
|
73
|
+
(0, react.useEffect)(() => {
|
|
74
|
+
if (!isUncontrolled) setCount(getCount(countValue));
|
|
75
|
+
if (isEnableAutoHeight && textareaRef.current !== null) syncHeight(textareaRef.current);
|
|
76
|
+
}, [
|
|
77
|
+
isUncontrolled,
|
|
78
|
+
countValue,
|
|
79
|
+
getCount,
|
|
80
|
+
isEnableAutoHeight,
|
|
81
|
+
textareaRef,
|
|
82
|
+
syncHeight
|
|
83
|
+
]);
|
|
84
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
85
|
+
className: classNames,
|
|
86
|
+
"aria-disabled": disabled,
|
|
87
|
+
children: [
|
|
88
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index.default, {
|
|
89
|
+
htmlFor: textAreaId,
|
|
90
|
+
id: labelledbyId,
|
|
91
|
+
label,
|
|
92
|
+
required,
|
|
93
|
+
requiredText,
|
|
94
|
+
subLabel,
|
|
95
|
+
...!showLabel ? visuallyHiddenProps : {}
|
|
96
|
+
}),
|
|
97
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
98
|
+
className: "charcoal-text-area-container",
|
|
99
|
+
"aria-disabled": disabled === true ? "true" : void 0,
|
|
100
|
+
"aria-invalid": invalid === true,
|
|
101
|
+
ref: containerRef,
|
|
102
|
+
style: { "--charcoal-text-area-rows": rows },
|
|
103
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
|
|
104
|
+
className: "charcoal-text-area-textarea",
|
|
105
|
+
"aria-describedby": showAssistiveText ? describedbyId : void 0,
|
|
106
|
+
"aria-invalid": invalid,
|
|
107
|
+
"aria-labelledby": labelledbyId,
|
|
108
|
+
id: textAreaId,
|
|
109
|
+
maxLength,
|
|
110
|
+
"data-no-bottom-padding": showCount,
|
|
111
|
+
onChange: handleChange,
|
|
112
|
+
ref: require_index$1.mergeRefs(forwardRef, textareaRef),
|
|
113
|
+
rows,
|
|
114
|
+
value,
|
|
115
|
+
disabled,
|
|
116
|
+
defaultValue,
|
|
117
|
+
...props
|
|
118
|
+
}), showCount && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
119
|
+
className: "charcoal-text-area-counter",
|
|
120
|
+
children: maxLength !== void 0 ? `${count}/${maxLength}` : count
|
|
121
|
+
})]
|
|
122
|
+
}),
|
|
123
|
+
showAssistiveText && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$2.AssistiveText, {
|
|
124
|
+
"data-invalid": invalid === true,
|
|
125
|
+
id: describedbyId,
|
|
126
|
+
children: assistiveText
|
|
127
|
+
})
|
|
128
|
+
]
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
//#endregion
|
|
133
|
+
exports.default = TextArea;
|
|
134
|
+
//# sourceMappingURL=index2.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index2.cjs","names":["forwardRef","useCallback","useEffect","useImperativeHandle","useMemo","useRef","useState","FieldLabel","countCodePointsInString","mergeRefs","useFocusWithClick","AssistiveText","useClassNames","useVisuallyHidden","useId","TextAreaImperativeHandle","setValue","value","sync","TextAreaProps","onChange","imperativeRef","React","Ref","showCount","showLabel","assistiveText","invalid","label","requiredText","disabled","subLabel","ReactNode","autoHeight","maxRows","getCount","Omit","ComponentPropsWithoutRef","TextArea","HTMLTextAreaElement","TextAreaInner","className","required","maxLength","rows","initialRows","defaultValue","props","isUncontrolled","undefined","countValue","toString","setRows","count","setCount","textareaRef","containerRef","visuallyHiddenProps","isEnableAutoHeight","classNames","showAssistiveText","length","syncHeight","textarea","currentRows","match","hasValidMaxRows","nextRows","Math","min","syncTextAreaState","handleChange","e","ChangeEvent","currentTarget","current","textAreaId","id","describedbyId","labelledbyId"],"sources":["../../../src/components/TextArea/index.tsx"],"sourcesContent":["import './index.css'\n\nimport {\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react'\nimport FieldLabel from '../FieldLabel'\nimport { countCodePointsInString, mergeRefs } from '../../_lib'\nimport { useFocusWithClick } from '../TextField/useFocusWithClick'\nimport { AssistiveText } from '../TextField/AssistiveText'\nimport { useClassNames } from '../../_lib/useClassNames'\nimport { useVisuallyHidden } from 'react-aria/VisuallyHidden'\nimport { useId } from 'react-aria/useId'\n\n/**\n * `TextArea` を `imperativeRef` から操作するためのハンドル\n */\nexport type TextAreaImperativeHandle = {\n /**\n * textarea の値を更新し、文字数や高さなどの内部状態を同期する\n */\n setValue: (value: string) => void\n /**\n * textarea の現在の値をもとに、文字数や高さなどの内部状態を同期する\n */\n sync: () => void\n}\n\nexport type TextAreaProps = {\n value?: string\n onChange?: (value: string) => void\n imperativeRef?: React.Ref<TextAreaImperativeHandle>\n\n showCount?: boolean\n showLabel?: boolean\n assistiveText?: string\n invalid?: boolean\n\n label?: string\n requiredText?: string\n disabled?: boolean\n subLabel?: React.ReactNode\n autoHeight?: boolean\n\n maxRows?: number\n\n getCount?: (value: string) => number\n} & Omit<React.ComponentPropsWithoutRef<'textarea'>, 'onChange'>\n\nconst TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(\n function TextAreaInner(\n {\n onChange,\n className,\n value,\n showCount = false,\n showLabel = false,\n label = '',\n requiredText,\n subLabel,\n disabled = false,\n required,\n assistiveText,\n maxLength,\n autoHeight = false,\n rows: initialRows = 4,\n maxRows,\n invalid,\n getCount = countCodePointsInString,\n defaultValue,\n imperativeRef,\n ...props\n },\n forwardRef,\n ) {\n const isUncontrolled = value === undefined\n // `null` is invalid for TextAreaProps, but may arrive at runtime. Keep the\n // pre-f710d512 nullish fallback so getCount is never called with null.\n const countValue = value ?? defaultValue?.toString() ?? ''\n const [rows, setRows] = useState(initialRows)\n const [count, setCount] = useState(getCount(countValue))\n\n const textareaRef = useRef<HTMLTextAreaElement>(null)\n const containerRef = useRef(null)\n useFocusWithClick(containerRef, textareaRef)\n const { visuallyHiddenProps } = useVisuallyHidden()\n\n const isEnableAutoHeight = useMemo(\n () => autoHeight || (maxRows && maxRows >= 0),\n [autoHeight, maxRows],\n )\n const classNames = useClassNames('charcoal-text-area-root', className)\n const showAssistiveText =\n assistiveText != null && assistiveText.length !== 0\n\n const syncHeight = useCallback(\n (textarea: HTMLTextAreaElement) => {\n const currentRows =\n (`${textarea.value}\\n`.match(/\\n/gu)?.length ?? 0) || 1\n const hasValidMaxRows = maxRows !== undefined && maxRows >= 1\n const nextRows = initialRows <= currentRows ? currentRows : initialRows\n\n if (!hasValidMaxRows) {\n setRows(nextRows)\n return\n }\n\n setRows(Math.min(nextRows, maxRows))\n },\n [initialRows, maxRows],\n )\n\n const syncTextAreaState = useCallback(\n (textarea: HTMLTextAreaElement) => {\n const count = getCount(textarea.value)\n\n if (isUncontrolled) {\n setCount(count)\n }\n\n if (isEnableAutoHeight) {\n syncHeight(textarea)\n }\n\n return count\n },\n [getCount, isEnableAutoHeight, isUncontrolled, syncHeight],\n )\n\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n const value = e.currentTarget.value\n const count = getCount(value)\n if (maxLength !== undefined && count > maxLength) {\n return\n }\n\n syncTextAreaState(e.currentTarget)\n onChange?.(value)\n },\n [getCount, maxLength, onChange, syncTextAreaState],\n )\n\n useImperativeHandle(\n imperativeRef,\n () => ({\n setValue: (value: string) => {\n if (textareaRef.current === null) {\n return\n }\n\n textareaRef.current.value = value\n syncTextAreaState(textareaRef.current)\n },\n sync: () => {\n if (textareaRef.current !== null) {\n syncTextAreaState(textareaRef.current)\n }\n },\n }),\n [syncTextAreaState],\n )\n\n const textAreaId = useId(props.id)\n const describedbyId = useId()\n const labelledbyId = useId()\n\n useEffect(() => {\n // 制御コンポーネントの時の挙動\n if (!isUncontrolled) {\n setCount(getCount(countValue))\n }\n\n // autoHeight同期(valueが変更された時にsyncHeightしたい)\n if (isEnableAutoHeight && textareaRef.current !== null) {\n syncHeight(textareaRef.current)\n }\n }, [\n isUncontrolled,\n countValue,\n getCount,\n isEnableAutoHeight,\n textareaRef,\n syncHeight,\n ])\n\n return (\n <div className={classNames} aria-disabled={disabled}>\n <FieldLabel\n htmlFor={textAreaId}\n id={labelledbyId}\n label={label}\n required={required}\n requiredText={requiredText}\n subLabel={subLabel}\n {...(!showLabel ? visuallyHiddenProps : {})}\n />\n <div\n className=\"charcoal-text-area-container\"\n aria-disabled={disabled === true ? 'true' : undefined}\n aria-invalid={invalid === true}\n ref={containerRef}\n style={{\n '--charcoal-text-area-rows': rows,\n }}\n >\n <textarea\n className=\"charcoal-text-area-textarea\"\n aria-describedby={showAssistiveText ? describedbyId : undefined}\n aria-invalid={invalid}\n aria-labelledby={labelledbyId}\n id={textAreaId}\n maxLength={maxLength}\n data-no-bottom-padding={showCount}\n onChange={handleChange}\n ref={mergeRefs(forwardRef, textareaRef)}\n rows={rows}\n value={value}\n disabled={disabled}\n defaultValue={defaultValue}\n {...props}\n />\n {showCount && (\n <span className=\"charcoal-text-area-counter\">\n {maxLength !== undefined ? `${count}/${maxLength}` : count}\n </span>\n )}\n </div>\n {showAssistiveText && (\n <AssistiveText data-invalid={invalid === true} id={describedbyId}>\n {assistiveText}\n </AssistiveText>\n )}\n </div>\n )\n },\n)\n\nexport default TextArea\n"],"mappings":"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"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useClassNames } from "../../_lib/useClassNames.js";
|
|
3
|
+
import FieldLabel from "../FieldLabel/index2.js";
|
|
4
|
+
import { countCodePointsInString, mergeRefs } from "../../_lib/index.js";
|
|
5
|
+
import { useFocusWithClick } from "../TextField/useFocusWithClick.js";
|
|
6
|
+
import { AssistiveText } from "../TextField/AssistiveText/index2.js";
|
|
7
|
+
/* empty css */
|
|
8
|
+
import { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { useId } from "react-aria/useId";
|
|
11
|
+
import { useVisuallyHidden } from "react-aria/VisuallyHidden";
|
|
12
|
+
|
|
13
|
+
//#region src/components/TextArea/index.tsx
|
|
14
|
+
const TextArea = forwardRef(function TextAreaInner({ onChange, className, value, showCount = false, showLabel = false, label = "", requiredText, subLabel, disabled = false, required, assistiveText, maxLength, autoHeight = false, rows: initialRows = 4, maxRows, invalid, getCount = countCodePointsInString, defaultValue, imperativeRef, ...props }, forwardRef) {
|
|
15
|
+
const isUncontrolled = value === void 0;
|
|
16
|
+
const countValue = value ?? defaultValue?.toString() ?? "";
|
|
17
|
+
const [rows, setRows] = useState(initialRows);
|
|
18
|
+
const [count, setCount] = useState(getCount(countValue));
|
|
19
|
+
const textareaRef = useRef(null);
|
|
20
|
+
const containerRef = useRef(null);
|
|
21
|
+
useFocusWithClick(containerRef, textareaRef);
|
|
22
|
+
const { visuallyHiddenProps } = useVisuallyHidden();
|
|
23
|
+
const isEnableAutoHeight = useMemo(() => autoHeight || maxRows && maxRows >= 0, [autoHeight, maxRows]);
|
|
24
|
+
const classNames = useClassNames("charcoal-text-area-root", className);
|
|
25
|
+
const showAssistiveText = assistiveText != null && assistiveText.length !== 0;
|
|
26
|
+
const syncHeight = useCallback((textarea) => {
|
|
27
|
+
const currentRows = (`${textarea.value}\n`.match(/\n/gu)?.length ?? 0) || 1;
|
|
28
|
+
const hasValidMaxRows = maxRows !== void 0 && maxRows >= 1;
|
|
29
|
+
const nextRows = initialRows <= currentRows ? currentRows : initialRows;
|
|
30
|
+
if (!hasValidMaxRows) {
|
|
31
|
+
setRows(nextRows);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
setRows(Math.min(nextRows, maxRows));
|
|
35
|
+
}, [initialRows, maxRows]);
|
|
36
|
+
const syncTextAreaState = useCallback((textarea) => {
|
|
37
|
+
const count = getCount(textarea.value);
|
|
38
|
+
if (isUncontrolled) setCount(count);
|
|
39
|
+
if (isEnableAutoHeight) syncHeight(textarea);
|
|
40
|
+
return count;
|
|
41
|
+
}, [
|
|
42
|
+
getCount,
|
|
43
|
+
isEnableAutoHeight,
|
|
44
|
+
isUncontrolled,
|
|
45
|
+
syncHeight
|
|
46
|
+
]);
|
|
47
|
+
const handleChange = useCallback((e) => {
|
|
48
|
+
const value = e.currentTarget.value;
|
|
49
|
+
const count = getCount(value);
|
|
50
|
+
if (maxLength !== void 0 && count > maxLength) return;
|
|
51
|
+
syncTextAreaState(e.currentTarget);
|
|
52
|
+
onChange?.(value);
|
|
53
|
+
}, [
|
|
54
|
+
getCount,
|
|
55
|
+
maxLength,
|
|
56
|
+
onChange,
|
|
57
|
+
syncTextAreaState
|
|
58
|
+
]);
|
|
59
|
+
useImperativeHandle(imperativeRef, () => ({
|
|
60
|
+
setValue: (value) => {
|
|
61
|
+
if (textareaRef.current === null) return;
|
|
62
|
+
textareaRef.current.value = value;
|
|
63
|
+
syncTextAreaState(textareaRef.current);
|
|
64
|
+
},
|
|
65
|
+
sync: () => {
|
|
66
|
+
if (textareaRef.current !== null) syncTextAreaState(textareaRef.current);
|
|
67
|
+
}
|
|
68
|
+
}), [syncTextAreaState]);
|
|
69
|
+
const textAreaId = useId(props.id);
|
|
70
|
+
const describedbyId = useId();
|
|
71
|
+
const labelledbyId = useId();
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
if (!isUncontrolled) setCount(getCount(countValue));
|
|
74
|
+
if (isEnableAutoHeight && textareaRef.current !== null) syncHeight(textareaRef.current);
|
|
75
|
+
}, [
|
|
76
|
+
isUncontrolled,
|
|
77
|
+
countValue,
|
|
78
|
+
getCount,
|
|
79
|
+
isEnableAutoHeight,
|
|
80
|
+
textareaRef,
|
|
81
|
+
syncHeight
|
|
82
|
+
]);
|
|
83
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
84
|
+
className: classNames,
|
|
85
|
+
"aria-disabled": disabled,
|
|
86
|
+
children: [
|
|
87
|
+
/* @__PURE__ */ jsx(FieldLabel, {
|
|
88
|
+
htmlFor: textAreaId,
|
|
89
|
+
id: labelledbyId,
|
|
90
|
+
label,
|
|
91
|
+
required,
|
|
92
|
+
requiredText,
|
|
93
|
+
subLabel,
|
|
94
|
+
...!showLabel ? visuallyHiddenProps : {}
|
|
95
|
+
}),
|
|
96
|
+
/* @__PURE__ */ jsxs("div", {
|
|
97
|
+
className: "charcoal-text-area-container",
|
|
98
|
+
"aria-disabled": disabled === true ? "true" : void 0,
|
|
99
|
+
"aria-invalid": invalid === true,
|
|
100
|
+
ref: containerRef,
|
|
101
|
+
style: { "--charcoal-text-area-rows": rows },
|
|
102
|
+
children: [/* @__PURE__ */ jsx("textarea", {
|
|
103
|
+
className: "charcoal-text-area-textarea",
|
|
104
|
+
"aria-describedby": showAssistiveText ? describedbyId : void 0,
|
|
105
|
+
"aria-invalid": invalid,
|
|
106
|
+
"aria-labelledby": labelledbyId,
|
|
107
|
+
id: textAreaId,
|
|
108
|
+
maxLength,
|
|
109
|
+
"data-no-bottom-padding": showCount,
|
|
110
|
+
onChange: handleChange,
|
|
111
|
+
ref: mergeRefs(forwardRef, textareaRef),
|
|
112
|
+
rows,
|
|
113
|
+
value,
|
|
114
|
+
disabled,
|
|
115
|
+
defaultValue,
|
|
116
|
+
...props
|
|
117
|
+
}), showCount && /* @__PURE__ */ jsx("span", {
|
|
118
|
+
className: "charcoal-text-area-counter",
|
|
119
|
+
children: maxLength !== void 0 ? `${count}/${maxLength}` : count
|
|
120
|
+
})]
|
|
121
|
+
}),
|
|
122
|
+
showAssistiveText && /* @__PURE__ */ jsx(AssistiveText, {
|
|
123
|
+
"data-invalid": invalid === true,
|
|
124
|
+
id: describedbyId,
|
|
125
|
+
children: assistiveText
|
|
126
|
+
})
|
|
127
|
+
]
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
//#endregion
|
|
132
|
+
export { TextArea as default };
|
|
133
|
+
//# sourceMappingURL=index2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index2.js","names":["forwardRef","useCallback","useEffect","useImperativeHandle","useMemo","useRef","useState","FieldLabel","countCodePointsInString","mergeRefs","useFocusWithClick","AssistiveText","useClassNames","useVisuallyHidden","useId","TextAreaImperativeHandle","setValue","value","sync","TextAreaProps","onChange","imperativeRef","React","Ref","showCount","showLabel","assistiveText","invalid","label","requiredText","disabled","subLabel","ReactNode","autoHeight","maxRows","getCount","Omit","ComponentPropsWithoutRef","TextArea","HTMLTextAreaElement","TextAreaInner","className","required","maxLength","rows","initialRows","defaultValue","props","isUncontrolled","undefined","countValue","toString","setRows","count","setCount","textareaRef","containerRef","visuallyHiddenProps","isEnableAutoHeight","classNames","showAssistiveText","length","syncHeight","textarea","currentRows","match","hasValidMaxRows","nextRows","Math","min","syncTextAreaState","handleChange","e","ChangeEvent","currentTarget","current","textAreaId","id","describedbyId","labelledbyId"],"sources":["../../../src/components/TextArea/index.tsx"],"sourcesContent":["import './index.css'\n\nimport {\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react'\nimport FieldLabel from '../FieldLabel'\nimport { countCodePointsInString, mergeRefs } from '../../_lib'\nimport { useFocusWithClick } from '../TextField/useFocusWithClick'\nimport { AssistiveText } from '../TextField/AssistiveText'\nimport { useClassNames } from '../../_lib/useClassNames'\nimport { useVisuallyHidden } from 'react-aria/VisuallyHidden'\nimport { useId } from 'react-aria/useId'\n\n/**\n * `TextArea` を `imperativeRef` から操作するためのハンドル\n */\nexport type TextAreaImperativeHandle = {\n /**\n * textarea の値を更新し、文字数や高さなどの内部状態を同期する\n */\n setValue: (value: string) => void\n /**\n * textarea の現在の値をもとに、文字数や高さなどの内部状態を同期する\n */\n sync: () => void\n}\n\nexport type TextAreaProps = {\n value?: string\n onChange?: (value: string) => void\n imperativeRef?: React.Ref<TextAreaImperativeHandle>\n\n showCount?: boolean\n showLabel?: boolean\n assistiveText?: string\n invalid?: boolean\n\n label?: string\n requiredText?: string\n disabled?: boolean\n subLabel?: React.ReactNode\n autoHeight?: boolean\n\n maxRows?: number\n\n getCount?: (value: string) => number\n} & Omit<React.ComponentPropsWithoutRef<'textarea'>, 'onChange'>\n\nconst TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(\n function TextAreaInner(\n {\n onChange,\n className,\n value,\n showCount = false,\n showLabel = false,\n label = '',\n requiredText,\n subLabel,\n disabled = false,\n required,\n assistiveText,\n maxLength,\n autoHeight = false,\n rows: initialRows = 4,\n maxRows,\n invalid,\n getCount = countCodePointsInString,\n defaultValue,\n imperativeRef,\n ...props\n },\n forwardRef,\n ) {\n const isUncontrolled = value === undefined\n // `null` is invalid for TextAreaProps, but may arrive at runtime. Keep the\n // pre-f710d512 nullish fallback so getCount is never called with null.\n const countValue = value ?? defaultValue?.toString() ?? ''\n const [rows, setRows] = useState(initialRows)\n const [count, setCount] = useState(getCount(countValue))\n\n const textareaRef = useRef<HTMLTextAreaElement>(null)\n const containerRef = useRef(null)\n useFocusWithClick(containerRef, textareaRef)\n const { visuallyHiddenProps } = useVisuallyHidden()\n\n const isEnableAutoHeight = useMemo(\n () => autoHeight || (maxRows && maxRows >= 0),\n [autoHeight, maxRows],\n )\n const classNames = useClassNames('charcoal-text-area-root', className)\n const showAssistiveText =\n assistiveText != null && assistiveText.length !== 0\n\n const syncHeight = useCallback(\n (textarea: HTMLTextAreaElement) => {\n const currentRows =\n (`${textarea.value}\\n`.match(/\\n/gu)?.length ?? 0) || 1\n const hasValidMaxRows = maxRows !== undefined && maxRows >= 1\n const nextRows = initialRows <= currentRows ? currentRows : initialRows\n\n if (!hasValidMaxRows) {\n setRows(nextRows)\n return\n }\n\n setRows(Math.min(nextRows, maxRows))\n },\n [initialRows, maxRows],\n )\n\n const syncTextAreaState = useCallback(\n (textarea: HTMLTextAreaElement) => {\n const count = getCount(textarea.value)\n\n if (isUncontrolled) {\n setCount(count)\n }\n\n if (isEnableAutoHeight) {\n syncHeight(textarea)\n }\n\n return count\n },\n [getCount, isEnableAutoHeight, isUncontrolled, syncHeight],\n )\n\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n const value = e.currentTarget.value\n const count = getCount(value)\n if (maxLength !== undefined && count > maxLength) {\n return\n }\n\n syncTextAreaState(e.currentTarget)\n onChange?.(value)\n },\n [getCount, maxLength, onChange, syncTextAreaState],\n )\n\n useImperativeHandle(\n imperativeRef,\n () => ({\n setValue: (value: string) => {\n if (textareaRef.current === null) {\n return\n }\n\n textareaRef.current.value = value\n syncTextAreaState(textareaRef.current)\n },\n sync: () => {\n if (textareaRef.current !== null) {\n syncTextAreaState(textareaRef.current)\n }\n },\n }),\n [syncTextAreaState],\n )\n\n const textAreaId = useId(props.id)\n const describedbyId = useId()\n const labelledbyId = useId()\n\n useEffect(() => {\n // 制御コンポーネントの時の挙動\n if (!isUncontrolled) {\n setCount(getCount(countValue))\n }\n\n // autoHeight同期(valueが変更された時にsyncHeightしたい)\n if (isEnableAutoHeight && textareaRef.current !== null) {\n syncHeight(textareaRef.current)\n }\n }, [\n isUncontrolled,\n countValue,\n getCount,\n isEnableAutoHeight,\n textareaRef,\n syncHeight,\n ])\n\n return (\n <div className={classNames} aria-disabled={disabled}>\n <FieldLabel\n htmlFor={textAreaId}\n id={labelledbyId}\n label={label}\n required={required}\n requiredText={requiredText}\n subLabel={subLabel}\n {...(!showLabel ? visuallyHiddenProps : {})}\n />\n <div\n className=\"charcoal-text-area-container\"\n aria-disabled={disabled === true ? 'true' : undefined}\n aria-invalid={invalid === true}\n ref={containerRef}\n style={{\n '--charcoal-text-area-rows': rows,\n }}\n >\n <textarea\n className=\"charcoal-text-area-textarea\"\n aria-describedby={showAssistiveText ? describedbyId : undefined}\n aria-invalid={invalid}\n aria-labelledby={labelledbyId}\n id={textAreaId}\n maxLength={maxLength}\n data-no-bottom-padding={showCount}\n onChange={handleChange}\n ref={mergeRefs(forwardRef, textareaRef)}\n rows={rows}\n value={value}\n disabled={disabled}\n defaultValue={defaultValue}\n {...props}\n />\n {showCount && (\n <span className=\"charcoal-text-area-counter\">\n {maxLength !== undefined ? `${count}/${maxLength}` : count}\n </span>\n )}\n </div>\n {showAssistiveText && (\n <AssistiveText data-invalid={invalid === true} id={describedbyId}>\n {assistiveText}\n </AssistiveText>\n )}\n </div>\n )\n },\n)\n\nexport default TextArea\n"],"mappings":"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"}
|