@wello-dev/core 0.0.0-stage → 1.0.4
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/LICENSE +47 -0
- package/README.md +425 -3
- package/dist/chunk-2A6MTZBO.js +51 -0
- package/dist/chunk-2A6MTZBO.js.map +1 -0
- package/dist/chunk-2GM6477D.js +51 -0
- package/dist/chunk-2GM6477D.js.map +1 -0
- package/dist/chunk-2WIGWLPL.js +64 -0
- package/dist/chunk-2WIGWLPL.js.map +1 -0
- package/dist/chunk-2XGMU4QA.js +605 -0
- package/dist/chunk-2XGMU4QA.js.map +1 -0
- package/dist/chunk-3E3X5RLN.js +56 -0
- package/dist/chunk-3E3X5RLN.js.map +1 -0
- package/dist/chunk-3NXEX2BT.js +125 -0
- package/dist/chunk-3NXEX2BT.js.map +1 -0
- package/dist/chunk-3Z5OAUG3.js +54 -0
- package/dist/chunk-3Z5OAUG3.js.map +1 -0
- package/dist/chunk-4L4RMGVI.js +83 -0
- package/dist/chunk-4L4RMGVI.js.map +1 -0
- package/dist/chunk-4QBFXTYH.js +92 -0
- package/dist/chunk-4QBFXTYH.js.map +1 -0
- package/dist/chunk-52P4CIAK.js +61 -0
- package/dist/chunk-52P4CIAK.js.map +1 -0
- package/dist/chunk-57ZKN6G3.js +73 -0
- package/dist/chunk-57ZKN6G3.js.map +1 -0
- package/dist/chunk-5BD5JJVJ.js +71 -0
- package/dist/chunk-5BD5JJVJ.js.map +1 -0
- package/dist/chunk-5N3F6CKC.js +84 -0
- package/dist/chunk-5N3F6CKC.js.map +1 -0
- package/dist/chunk-5SQC5LKY.js +46 -0
- package/dist/chunk-5SQC5LKY.js.map +1 -0
- package/dist/chunk-62UUESHU.js +51 -0
- package/dist/chunk-62UUESHU.js.map +1 -0
- package/dist/chunk-63PSLIW5.js +61 -0
- package/dist/chunk-63PSLIW5.js.map +1 -0
- package/dist/chunk-6U4Y3AUT.js +203 -0
- package/dist/chunk-6U4Y3AUT.js.map +1 -0
- package/dist/chunk-7GLDYLJ6.js +74 -0
- package/dist/chunk-7GLDYLJ6.js.map +1 -0
- package/dist/chunk-7JGIQGZP.js +80 -0
- package/dist/chunk-7JGIQGZP.js.map +1 -0
- package/dist/chunk-7KIXQ2XG.js +209 -0
- package/dist/chunk-7KIXQ2XG.js.map +1 -0
- package/dist/chunk-7PTDAI65.js +255 -0
- package/dist/chunk-7PTDAI65.js.map +1 -0
- package/dist/chunk-APTAGITO.js +301 -0
- package/dist/chunk-APTAGITO.js.map +1 -0
- package/dist/chunk-AZ4WBNXD.js +122 -0
- package/dist/chunk-AZ4WBNXD.js.map +1 -0
- package/dist/chunk-B3KTN3DO.js +102 -0
- package/dist/chunk-B3KTN3DO.js.map +1 -0
- package/dist/chunk-B3LVDQJU.js +33 -0
- package/dist/chunk-B3LVDQJU.js.map +1 -0
- package/dist/chunk-BMKZFNPD.js +82 -0
- package/dist/chunk-BMKZFNPD.js.map +1 -0
- package/dist/chunk-BZ222ZYD.js +46 -0
- package/dist/chunk-BZ222ZYD.js.map +1 -0
- package/dist/chunk-CGR72YL6.js +336 -0
- package/dist/chunk-CGR72YL6.js.map +1 -0
- package/dist/chunk-CJ7I6UM7.js +30 -0
- package/dist/chunk-CJ7I6UM7.js.map +1 -0
- package/dist/chunk-CTBTEAD6.js +21 -0
- package/dist/chunk-CTBTEAD6.js.map +1 -0
- package/dist/chunk-CVIHRO4Q.js +241 -0
- package/dist/chunk-CVIHRO4Q.js.map +1 -0
- package/dist/chunk-DCC7EE67.js +170 -0
- package/dist/chunk-DCC7EE67.js.map +1 -0
- package/dist/chunk-DHAMBKCR.js +38 -0
- package/dist/chunk-DHAMBKCR.js.map +1 -0
- package/dist/chunk-DJR6BSCZ.js +37 -0
- package/dist/chunk-DJR6BSCZ.js.map +1 -0
- package/dist/chunk-E2765LHX.js +301 -0
- package/dist/chunk-E2765LHX.js.map +1 -0
- package/dist/chunk-E74HEMFS.js +41 -0
- package/dist/chunk-E74HEMFS.js.map +1 -0
- package/dist/chunk-ECFQDEFL.js +326 -0
- package/dist/chunk-ECFQDEFL.js.map +1 -0
- package/dist/chunk-EJ7ZXISQ.js +83 -0
- package/dist/chunk-EJ7ZXISQ.js.map +1 -0
- package/dist/chunk-F2FJLMJF.js +268 -0
- package/dist/chunk-F2FJLMJF.js.map +1 -0
- package/dist/chunk-F4OMXH3E.js +151 -0
- package/dist/chunk-F4OMXH3E.js.map +1 -0
- package/dist/chunk-FIAJMBSD.js +67 -0
- package/dist/chunk-FIAJMBSD.js.map +1 -0
- package/dist/chunk-FR7TZXY3.js +50 -0
- package/dist/chunk-FR7TZXY3.js.map +1 -0
- package/dist/chunk-G7EIISMY.js +2 -0
- package/dist/chunk-G7EIISMY.js.map +1 -0
- package/dist/chunk-GD5URO3H.js +276 -0
- package/dist/chunk-GD5URO3H.js.map +1 -0
- package/dist/chunk-GGRLDV5L.js +40 -0
- package/dist/chunk-GGRLDV5L.js.map +1 -0
- package/dist/chunk-GKBBDYNB.js +59 -0
- package/dist/chunk-GKBBDYNB.js.map +1 -0
- package/dist/chunk-GSLJSEUI.js +236 -0
- package/dist/chunk-GSLJSEUI.js.map +1 -0
- package/dist/chunk-H4D7LXZL.js +194 -0
- package/dist/chunk-H4D7LXZL.js.map +1 -0
- package/dist/chunk-HESG7OWV.js +81 -0
- package/dist/chunk-HESG7OWV.js.map +1 -0
- package/dist/chunk-HGYIOR5F.js +212 -0
- package/dist/chunk-HGYIOR5F.js.map +1 -0
- package/dist/chunk-HSJ27BGL.js +57 -0
- package/dist/chunk-HSJ27BGL.js.map +1 -0
- package/dist/chunk-IK562BNJ.js +1527 -0
- package/dist/chunk-IK562BNJ.js.map +1 -0
- package/dist/chunk-JJXJXOZ7.js +286 -0
- package/dist/chunk-JJXJXOZ7.js.map +1 -0
- package/dist/chunk-JZJ5R7XW.js +115 -0
- package/dist/chunk-JZJ5R7XW.js.map +1 -0
- package/dist/chunk-K2Q5Q6WQ.js +255 -0
- package/dist/chunk-K2Q5Q6WQ.js.map +1 -0
- package/dist/chunk-KEYIOWAG.js +42 -0
- package/dist/chunk-KEYIOWAG.js.map +1 -0
- package/dist/chunk-KPWAEDRU.js +86 -0
- package/dist/chunk-KPWAEDRU.js.map +1 -0
- package/dist/chunk-L2V4OD4Q.js +45 -0
- package/dist/chunk-L2V4OD4Q.js.map +1 -0
- package/dist/chunk-L5MO7VKZ.js +58 -0
- package/dist/chunk-L5MO7VKZ.js.map +1 -0
- package/dist/chunk-MO6GW5AX.js +85 -0
- package/dist/chunk-MO6GW5AX.js.map +1 -0
- package/dist/chunk-MWYGXAJQ.js +65 -0
- package/dist/chunk-MWYGXAJQ.js.map +1 -0
- package/dist/chunk-MYHAWRIV.js +43 -0
- package/dist/chunk-MYHAWRIV.js.map +1 -0
- package/dist/chunk-NOYSHU5U.js +74 -0
- package/dist/chunk-NOYSHU5U.js.map +1 -0
- package/dist/chunk-NVAE2R5E.js +143 -0
- package/dist/chunk-NVAE2R5E.js.map +1 -0
- package/dist/chunk-NZQI4WL5.js +57 -0
- package/dist/chunk-NZQI4WL5.js.map +1 -0
- package/dist/chunk-O4MQLZEH.js +200 -0
- package/dist/chunk-O4MQLZEH.js.map +1 -0
- package/dist/chunk-ORHFHJKL.js +89 -0
- package/dist/chunk-ORHFHJKL.js.map +1 -0
- package/dist/chunk-PPKKOBHB.js +219 -0
- package/dist/chunk-PPKKOBHB.js.map +1 -0
- package/dist/chunk-QFN4MBT2.js +44 -0
- package/dist/chunk-QFN4MBT2.js.map +1 -0
- package/dist/chunk-QHJMXGDE.js +457 -0
- package/dist/chunk-QHJMXGDE.js.map +1 -0
- package/dist/chunk-QIS6W7Q6.js +47 -0
- package/dist/chunk-QIS6W7Q6.js.map +1 -0
- package/dist/chunk-QZFPW75D.js +482 -0
- package/dist/chunk-QZFPW75D.js.map +1 -0
- package/dist/chunk-R3H3IYNM.js +20 -0
- package/dist/chunk-R3H3IYNM.js.map +1 -0
- package/dist/chunk-RJK6AQEW.js +35 -0
- package/dist/chunk-RJK6AQEW.js.map +1 -0
- package/dist/chunk-SIZ7G2KD.js +25 -0
- package/dist/chunk-SIZ7G2KD.js.map +1 -0
- package/dist/chunk-TIZEUZHC.js +51 -0
- package/dist/chunk-TIZEUZHC.js.map +1 -0
- package/dist/chunk-TJUOXXLK.js +344 -0
- package/dist/chunk-TJUOXXLK.js.map +1 -0
- package/dist/chunk-TVOR2RGE.js +46 -0
- package/dist/chunk-TVOR2RGE.js.map +1 -0
- package/dist/chunk-TWM6DSH4.js +242 -0
- package/dist/chunk-TWM6DSH4.js.map +1 -0
- package/dist/chunk-UAEHGDZX.js +61 -0
- package/dist/chunk-UAEHGDZX.js.map +1 -0
- package/dist/chunk-UYKK6PVB.js +124 -0
- package/dist/chunk-UYKK6PVB.js.map +1 -0
- package/dist/chunk-VIO22OUP.js +483 -0
- package/dist/chunk-VIO22OUP.js.map +1 -0
- package/dist/chunk-VNM5TVQZ.js +125 -0
- package/dist/chunk-VNM5TVQZ.js.map +1 -0
- package/dist/chunk-XAHR3DK7.js +79 -0
- package/dist/chunk-XAHR3DK7.js.map +1 -0
- package/dist/chunk-YFBYWNYF.js +142 -0
- package/dist/chunk-YFBYWNYF.js.map +1 -0
- package/dist/chunk-YHPHWOAE.js +192 -0
- package/dist/chunk-YHPHWOAE.js.map +1 -0
- package/dist/chunk-YOL5PMHU.js +354 -0
- package/dist/chunk-YOL5PMHU.js.map +1 -0
- package/dist/chunk-YQOS23WP.js +67 -0
- package/dist/chunk-YQOS23WP.js.map +1 -0
- package/dist/chunk-YTH2T5E4.js +196 -0
- package/dist/chunk-YTH2T5E4.js.map +1 -0
- package/dist/chunk-YTI5AZL4.js +72 -0
- package/dist/chunk-YTI5AZL4.js.map +1 -0
- package/dist/chunk-ZJZUNSCO.js +62 -0
- package/dist/chunk-ZJZUNSCO.js.map +1 -0
- package/dist/chunk-ZMR3K4MX.js +76 -0
- package/dist/chunk-ZMR3K4MX.js.map +1 -0
- package/dist/chunk-ZTOAB4HM.js +462 -0
- package/dist/chunk-ZTOAB4HM.js.map +1 -0
- package/dist/chunk-ZVXCVBC4.js +49 -0
- package/dist/chunk-ZVXCVBC4.js.map +1 -0
- package/dist/components/Accordion/Accordion.js +17 -0
- package/dist/components/Accordion/Accordion.js.map +1 -0
- package/dist/components/ActionIcon/ActionIcon.js +19 -0
- package/dist/components/ActionIcon/ActionIcon.js.map +1 -0
- package/dist/components/Alert/Alert.js +17 -0
- package/dist/components/Alert/Alert.js.map +1 -0
- package/dist/components/Anchor/Anchor.js +14 -0
- package/dist/components/Anchor/Anchor.js.map +1 -0
- package/dist/components/Avatar/Avatar.js +17 -0
- package/dist/components/Avatar/Avatar.js.map +1 -0
- package/dist/components/Badge/Badge.js +14 -0
- package/dist/components/Badge/Badge.js.map +1 -0
- package/dist/components/Blockquote/Blockquote.js +13 -0
- package/dist/components/Blockquote/Blockquote.js.map +1 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.js +28 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.js.map +1 -0
- package/dist/components/Burger/Burger.js +14 -0
- package/dist/components/Burger/Burger.js.map +1 -0
- package/dist/components/Button/Button.js +22 -0
- package/dist/components/Button/Button.js.map +1 -0
- package/dist/components/Card/Card.js +15 -0
- package/dist/components/Card/Card.js.map +1 -0
- package/dist/components/Carousel/Carousel.js +14 -0
- package/dist/components/Carousel/Carousel.js.map +1 -0
- package/dist/components/Center/Center.js +17 -0
- package/dist/components/Center/Center.js.map +1 -0
- package/dist/components/Checkbox/Checkbox.js +32 -0
- package/dist/components/Checkbox/Checkbox.js.map +1 -0
- package/dist/components/Chip/Chip.js +19 -0
- package/dist/components/Chip/Chip.js.map +1 -0
- package/dist/components/CloseButton/CloseButton.js +18 -0
- package/dist/components/CloseButton/CloseButton.js.map +1 -0
- package/dist/components/Code/Code.js +21 -0
- package/dist/components/Code/Code.js.map +1 -0
- package/dist/components/Collapse/Collapse.js +13 -0
- package/dist/components/Collapse/Collapse.js.map +1 -0
- package/dist/components/ColorPicker/ColorInput.js +26 -0
- package/dist/components/ColorPicker/ColorInput.js.map +1 -0
- package/dist/components/ColorPicker/ColorPicker.js +28 -0
- package/dist/components/ColorPicker/ColorPicker.js.map +1 -0
- package/dist/components/Combobox/Combobox.js +51 -0
- package/dist/components/Combobox/Combobox.js.map +1 -0
- package/dist/components/Combobox/Pill.js +24 -0
- package/dist/components/Combobox/Pill.js.map +1 -0
- package/dist/components/Combobox/Select.js +27 -0
- package/dist/components/Combobox/Select.js.map +1 -0
- package/dist/components/Combobox/TagsInput.js +27 -0
- package/dist/components/Combobox/TagsInput.js.map +1 -0
- package/dist/components/Container/Container.js +13 -0
- package/dist/components/Container/Container.js.map +1 -0
- package/dist/components/CopyButton/CopyButton.js +11 -0
- package/dist/components/CopyButton/CopyButton.js.map +1 -0
- package/dist/components/Dialog/Dialog.js +20 -0
- package/dist/components/Dialog/Dialog.js.map +1 -0
- package/dist/components/Divider/Divider.js +13 -0
- package/dist/components/Divider/Divider.js.map +1 -0
- package/dist/components/Dropzone/Dropzone.js +28 -0
- package/dist/components/Dropzone/Dropzone.js.map +1 -0
- package/dist/components/EmptyState/EmptyState.js +13 -0
- package/dist/components/EmptyState/EmptyState.js.map +1 -0
- package/dist/components/Field/Field.js +58 -0
- package/dist/components/Field/Field.js.map +1 -0
- package/dist/components/FileButton/FileButton.js +11 -0
- package/dist/components/FileButton/FileButton.js.map +1 -0
- package/dist/components/Flex/Flex.js +13 -0
- package/dist/components/Flex/Flex.js.map +1 -0
- package/dist/components/Grid/Grid.js +15 -0
- package/dist/components/Grid/Grid.js.map +1 -0
- package/dist/components/Group/Group.js +13 -0
- package/dist/components/Group/Group.js.map +1 -0
- package/dist/components/Image/Image.js +15 -0
- package/dist/components/Image/Image.js.map +1 -0
- package/dist/components/Indicator/Indicator.js +13 -0
- package/dist/components/Indicator/Indicator.js.map +1 -0
- package/dist/components/Input/Input.js +37 -0
- package/dist/components/Input/Input.js.map +1 -0
- package/dist/components/List/List.js +15 -0
- package/dist/components/List/List.js.map +1 -0
- package/dist/components/Loader/Loader.js +13 -0
- package/dist/components/Loader/Loader.js.map +1 -0
- package/dist/components/Menu/Menu.js +30 -0
- package/dist/components/Menu/Menu.js.map +1 -0
- package/dist/components/Modal/Drawer.js +25 -0
- package/dist/components/Modal/Drawer.js.map +1 -0
- package/dist/components/Modal/Modal.js +25 -0
- package/dist/components/Modal/Modal.js.map +1 -0
- package/dist/components/Modal/ModalBase.js +48 -0
- package/dist/components/Modal/ModalBase.js.map +1 -0
- package/dist/components/NavLink/NavLink.js +15 -0
- package/dist/components/NavLink/NavLink.js.map +1 -0
- package/dist/components/Notification/Notification.js +17 -0
- package/dist/components/Notification/Notification.js.map +1 -0
- package/dist/components/NumberFormatter/NumberFormatter.js +13 -0
- package/dist/components/NumberFormatter/NumberFormatter.js.map +1 -0
- package/dist/components/Overlay/Overlay.js +18 -0
- package/dist/components/Overlay/Overlay.js.map +1 -0
- package/dist/components/Pagination/Pagination.js +20 -0
- package/dist/components/Pagination/Pagination.js.map +1 -0
- package/dist/components/Paper/Paper.js +13 -0
- package/dist/components/Paper/Paper.js.map +1 -0
- package/dist/components/PhoneInput/PhoneInput.js +37 -0
- package/dist/components/PhoneInput/PhoneInput.js.map +1 -0
- package/dist/components/PinInput/PinInput.js +27 -0
- package/dist/components/PinInput/PinInput.js.map +1 -0
- package/dist/components/Popover/Popover.js +24 -0
- package/dist/components/Popover/Popover.js.map +1 -0
- package/dist/components/Portal/Portal.js +13 -0
- package/dist/components/Portal/Portal.js.map +1 -0
- package/dist/components/Progress/Progress.js +13 -0
- package/dist/components/Progress/Progress.js.map +1 -0
- package/dist/components/RingProgress/RingProgress.js +15 -0
- package/dist/components/RingProgress/RingProgress.js.map +1 -0
- package/dist/components/ScrollArea/ScrollArea.js +15 -0
- package/dist/components/ScrollArea/ScrollArea.js.map +1 -0
- package/dist/components/SimpleGrid/SimpleGrid.js +13 -0
- package/dist/components/SimpleGrid/SimpleGrid.js.map +1 -0
- package/dist/components/Skeleton/Skeleton.js +13 -0
- package/dist/components/Skeleton/Skeleton.js.map +1 -0
- package/dist/components/Slider/Slider.js +15 -0
- package/dist/components/Slider/Slider.js.map +1 -0
- package/dist/components/Spoiler/Spoiler.js +15 -0
- package/dist/components/Spoiler/Spoiler.js.map +1 -0
- package/dist/components/Stack/Stack.js +13 -0
- package/dist/components/Stack/Stack.js.map +1 -0
- package/dist/components/Stepper/Stepper.js +19 -0
- package/dist/components/Stepper/Stepper.js.map +1 -0
- package/dist/components/Table/Table.js +29 -0
- package/dist/components/Table/Table.js.map +1 -0
- package/dist/components/Tabs/Tabs.js +30 -0
- package/dist/components/Tabs/Tabs.js.map +1 -0
- package/dist/components/Text/Text.js +13 -0
- package/dist/components/Text/Text.js.map +1 -0
- package/dist/components/TextInput/TextInput.js +27 -0
- package/dist/components/TextInput/TextInput.js.map +1 -0
- package/dist/components/ThemeIcon/ThemeIcon.js +15 -0
- package/dist/components/ThemeIcon/ThemeIcon.js.map +1 -0
- package/dist/components/ThemeToggle/ThemeToggle.js +20 -0
- package/dist/components/ThemeToggle/ThemeToggle.js.map +1 -0
- package/dist/components/Timeline/Timeline.js +15 -0
- package/dist/components/Timeline/Timeline.js.map +1 -0
- package/dist/components/Title/Title.js +13 -0
- package/dist/components/Title/Title.js.map +1 -0
- package/dist/components/Toggle/Toggle.js +14 -0
- package/dist/components/Toggle/Toggle.js.map +1 -0
- package/dist/components/Tooltip/Tooltip.js +18 -0
- package/dist/components/Tooltip/Tooltip.js.map +1 -0
- package/dist/components/Transition/Transition.js +18 -0
- package/dist/components/Transition/Transition.js.map +1 -0
- package/dist/components/Typography/Typography.js +13 -0
- package/dist/components/Typography/Typography.js.map +1 -0
- package/dist/components/UnstyledButton/UnstyledButton.js +13 -0
- package/dist/components/UnstyledButton/UnstyledButton.js.map +1 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.js +12 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.js.map +1 -0
- package/dist/core/index.js +171 -0
- package/dist/core/index.js.map +1 -0
- package/dist/index.cjs +20775 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +6384 -0
- package/dist/index.d.ts +6384 -0
- package/dist/index.js +963 -0
- package/dist/index.js.map +1 -0
- package/dist/shadcn/Command.js +45 -0
- package/dist/shadcn/Command.js.map +1 -0
- package/dist/shadcn/Dialog.js +80 -0
- package/dist/shadcn/Dialog.js.map +1 -0
- package/dist/shadcn/Floating.js +74 -0
- package/dist/shadcn/Floating.js.map +1 -0
- package/dist/shadcn/Parts.js +53 -0
- package/dist/shadcn/Parts.js.map +1 -0
- package/dist/shadcn/shared.js +20 -0
- package/dist/shadcn/shared.js.map +1 -0
- package/dist/styles.css +8615 -0
- package/package.json +78 -6
package/LICENSE
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 wello-dev
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
--------------------------------------------------------------------------------
|
|
24
|
+
|
|
25
|
+
Portions of this package are derived from software under this licence:
|
|
26
|
+
|
|
27
|
+
MIT License
|
|
28
|
+
|
|
29
|
+
Copyright (c) 2021 Vitaly Rtishchev
|
|
30
|
+
|
|
31
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
32
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
33
|
+
in the Software without restriction, including without limitation the rights
|
|
34
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
35
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
36
|
+
furnished to do so, subject to the following conditions:
|
|
37
|
+
|
|
38
|
+
The above copyright notice and this permission notice shall be included in all
|
|
39
|
+
copies or substantial portions of the Software.
|
|
40
|
+
|
|
41
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
42
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
43
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
44
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
45
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
46
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
47
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,425 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# @wello-dev/core
|
|
2
|
+
|
|
3
|
+
React components with a theme, a Styles API, style props, dark mode and RTL built in. It is the base that the other `@wello-dev` packages (dates, charts, editor, map, notifications) build on.
|
|
4
|
+
|
|
5
|
+
- **110 components**: layout, buttons, inputs, navigation, feedback, overlays, data display and typography.
|
|
6
|
+
- **Themed**: one primary color, shades worked out for you, a color per color scheme.
|
|
7
|
+
- **Styles API**: restyle any part of any component with `classNames`, `styles` or CSS variables.
|
|
8
|
+
- **Style props**: `mt`, `w`, `c`, `bg`… on every component, responsive too.
|
|
9
|
+
- **Dark mode and RTL** need no extra setup. Every built-in text can be translated.
|
|
10
|
+
- **Accessible**: roles, labels, focus handling and keyboard support are part of the components.
|
|
11
|
+
- **Tree-shakable**: the JavaScript is split per component, so your bundler keeps only what you import.
|
|
12
|
+
- **shadcn-style API too**: `Button`, `Dialog`, `Sheet`, `Popover`, `Tooltip`, `DropdownMenu`, `Command`, `Tabs`… accept the shadcn/ui props and parts as well as the extended ones.
|
|
13
|
+
|
|
14
|
+
**On this page:** [Install](#install) · [Setup](#setup) · [Components](#components) · [Styling](#styling) · [Theme](#theme) · [Dark mode and RTL](#dark-mode-and-rtl) · [Theme toggle](#theme-toggle) · [Translating the texts](#translating-the-built-in-texts) · [Dropzone](#dropzone) · [Your API](#your-api) · [Build your own components](#build-your-own-components) · [Utilities](#utilities) · [Scrollbars](#scrollbars) · [Carousel arrows](#carousel-arrows)
|
|
15
|
+
|
|
16
|
+
## Install
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pnpm add @wello-dev/core
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Needs React 18 or newer.
|
|
23
|
+
|
|
24
|
+
## Setup
|
|
25
|
+
|
|
26
|
+
Both are required, once, at the root of your app. `WelloProvider` is needed even with no props: components throw without it.
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
import "@wello-dev/core/styles.css";
|
|
30
|
+
import { WelloProvider } from "@wello-dev/core";
|
|
31
|
+
|
|
32
|
+
<WelloProvider>
|
|
33
|
+
<App />
|
|
34
|
+
</WelloProvider>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Then use any component:
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
import { Button, Group, TextInput } from "@wello-dev/core";
|
|
41
|
+
|
|
42
|
+
<Group>
|
|
43
|
+
<TextInput label="Email" placeholder="you@example.com" />
|
|
44
|
+
<Button variant="outline" color="teal">Save</Button>
|
|
45
|
+
</Group>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
`WelloProvider` takes:
|
|
49
|
+
|
|
50
|
+
| Prop | What it does |
|
|
51
|
+
| --- | --- |
|
|
52
|
+
| `theme` | Your `createWelloConfig({ … })`, merged over the default theme |
|
|
53
|
+
| `defaultColorScheme` | `"light"` (default), `"dark"` or `"auto"` |
|
|
54
|
+
| `forceColorScheme` | Always `"light"` or `"dark"` |
|
|
55
|
+
| `colorSchemeManager` | Where the choice is saved. Default: `localStorage`; `null` to not save |
|
|
56
|
+
| `cssVariablesSelector` | Where the theme variables are written. Default: `:root` |
|
|
57
|
+
| `withCssVariables` | Write the theme variables. Default: `true` |
|
|
58
|
+
| `labels` | Translated built-in texts (see below) |
|
|
59
|
+
|
|
60
|
+
Where your API is (`api` in the theme) is under [Your API](#your-api).
|
|
61
|
+
|
|
62
|
+
## Components
|
|
63
|
+
|
|
64
|
+
### Layout
|
|
65
|
+
|
|
66
|
+
| Component | What it is |
|
|
67
|
+
| --- | --- |
|
|
68
|
+
| `AspectRatio` | Keeps a box (image, video, map) at a width / height ratio |
|
|
69
|
+
| `Center` | Centers its children both ways |
|
|
70
|
+
| `Container` | Centers content with a max width and side padding |
|
|
71
|
+
| `Flex` | Flexbox with every option responsive |
|
|
72
|
+
| `Grid` | Column grid |
|
|
73
|
+
| `Group` | Children in a row with even gaps |
|
|
74
|
+
| `Paper` | Surface with background, radius, optional border and shadow |
|
|
75
|
+
| `SimpleGrid` | Equal-width columns |
|
|
76
|
+
| `Space` | Empty space: `<Space h="md" />` or `<Space w="xl" />` |
|
|
77
|
+
| `Stack` | Children in a column with even gaps |
|
|
78
|
+
|
|
79
|
+
### Buttons
|
|
80
|
+
|
|
81
|
+
| Component | What it is |
|
|
82
|
+
| --- | --- |
|
|
83
|
+
| `Button` | Button with `variant`, `size`, `color`, `leftSection`, `loading`, `asChild` |
|
|
84
|
+
| `ActionIcon` | Icon button. Give it an `aria-label` |
|
|
85
|
+
| `Burger` | Menu button that turns into a × |
|
|
86
|
+
| `CloseButton` | The × button of dialogs, alerts and inputs |
|
|
87
|
+
| `CopyButton` | Copies text to the clipboard; you render the button |
|
|
88
|
+
| `ThemeToggle`, `ThemeToggleButton` | Light / dark switch with an animation: [`ThemeToggle`](#theme-toggle) changes the scheme itself, `ThemeToggleButton` only draws and animates |
|
|
89
|
+
| `UnstyledButton` | A button with no styles but the focus ring; the base of the clickable components |
|
|
90
|
+
|
|
91
|
+
### Inputs
|
|
92
|
+
|
|
93
|
+
| Component | What it is |
|
|
94
|
+
| --- | --- |
|
|
95
|
+
| `TextInput`, `Textarea` | Text fields with label, description and error. `Textarea` can `autosize` |
|
|
96
|
+
| `PasswordInput` | Password field with a show / hide button |
|
|
97
|
+
| `NumberInput` | Min / max / step, decimals, separators, prefix / suffix, ▲▼ controls |
|
|
98
|
+
| `PhoneInput` | Phone number with a dial code; digits only, limited per country. With no `countries`, `loadCountries` or `endpoint` it lists every country, starting on Egypt |
|
|
99
|
+
| `PinInput` | Code cells: auto-advance, backspace back, paste fills all |
|
|
100
|
+
| `Select`, `TagsInput` | One option from a list (any shape of option), and free-form tags |
|
|
101
|
+
| `Checkbox`, `Radio`, `Switch`, `Toggle` | Choices. `Checkbox` and `Switch` take `onChange` or `onCheckedChange` |
|
|
102
|
+
| `Chip`, `SegmentedControl` | Selectable pills, and tabs-like single choice with a sliding indicator |
|
|
103
|
+
| `Slider`, `RangeSlider`, `Rating` | Sliders with marks and keyboard support (RTL aware), and star rating |
|
|
104
|
+
| `ColorInput`, `ColorPicker`, `AlphaSlider`, `HueSlider` | Color fields and panels |
|
|
105
|
+
| `FileInput`, `FileButton`, [`Dropzone`](#dropzone) | Pick or drop files |
|
|
106
|
+
| `Field`, `Fieldset`, `Label`, `Input` | One form row, a group with a legend, a label, and the styled field that every input is built on |
|
|
107
|
+
| `Pill`, `PillsInput` | Small removable values, and an input that holds them |
|
|
108
|
+
|
|
109
|
+
### Navigation
|
|
110
|
+
|
|
111
|
+
| Component | What it is |
|
|
112
|
+
| --- | --- |
|
|
113
|
+
| `Accordion` | Expandable sections, single or multiple open |
|
|
114
|
+
| `Anchor` | Link styled as text. Use `component` for router links |
|
|
115
|
+
| `Breadcrumbs`, `Breadcrumb` | Path of links with separators |
|
|
116
|
+
| `NavLink` | Sidebar link, with nested links that expand |
|
|
117
|
+
| `Pagination` | Page buttons with dots and edges (RTL aware) |
|
|
118
|
+
| `Stepper` | Multi-step flow |
|
|
119
|
+
| `Tabs`, `TabCount` | Tabs, and a count bubble for a tab |
|
|
120
|
+
|
|
121
|
+
### Feedback
|
|
122
|
+
|
|
123
|
+
| Component | What it is |
|
|
124
|
+
| --- | --- |
|
|
125
|
+
| `Alert` | Message box with color, icon, title and close button |
|
|
126
|
+
| `EmptyState` | "Nothing here yet" for empty lists, searches and pages |
|
|
127
|
+
| `Loader` | Spinner: `oval`, `bars` or `dots` |
|
|
128
|
+
| `Notification` | Static notification card (for toasts see `@wello-dev/notifications`) |
|
|
129
|
+
| `Progress`, `RingProgress`, `SemiCircleProgress` | Bar, circle and half-circle progress |
|
|
130
|
+
| `Skeleton` | Loading placeholder that wraps the real content |
|
|
131
|
+
|
|
132
|
+
### Overlays
|
|
133
|
+
|
|
134
|
+
| Component | What it is |
|
|
135
|
+
| --- | --- |
|
|
136
|
+
| `Modal` | Dialog window: overlay, focus trap, scroll lock, Escape and outside click |
|
|
137
|
+
| `Drawer` | Panel sliding in from an edge |
|
|
138
|
+
| `Dialog`, `Sheet`, `AlertDialog` | shadcn-style dialog, side sheet and confirmation dialog, with their parts (`DialogContent`, `SheetHeader`, …) |
|
|
139
|
+
| `CornerDialog` | Small non-modal window fixed to a corner (cookie notice, quick feedback) |
|
|
140
|
+
| `Popover`, `Tooltip` | shadcn parts (`PopoverTrigger` / `PopoverContent`, `TooltipTrigger` / `TooltipContent`) or `Popover.Target` and a `label` prop |
|
|
141
|
+
| `Menu`, `DropdownMenu` | Dropdown menus with keyboard navigation |
|
|
142
|
+
| `Command` | Searchable list of actions, on top of cmdk |
|
|
143
|
+
| `Overlay`, `LoadingOverlay` | Dim layer, and one that covers its parent with a loader |
|
|
144
|
+
|
|
145
|
+
### Data display
|
|
146
|
+
|
|
147
|
+
| Component | What it is |
|
|
148
|
+
| --- | --- |
|
|
149
|
+
| `Avatar`, `Badge`, `ThemeIcon`, `Indicator`, `ColorSwatch` | Small visuals |
|
|
150
|
+
| `Card` | `Paper` with padding and edge-to-edge sections (`CardHeader`, `CardContent`, …) |
|
|
151
|
+
| `Table` | Built from parts (`TableRow`, `TableCell`, …) or from `data` |
|
|
152
|
+
| `Carousel` | Touch, arrows, dots, autoplay, effects and thumbnails, on top of Swiper |
|
|
153
|
+
| `Image`, `BackgroundImage` | Image with radius, fit and fallback, and a box with a cover image |
|
|
154
|
+
| `Timeline` | Vertical list of events |
|
|
155
|
+
| `Spoiler`, `Collapsible` | Long content cut to a height, and show / hide with a trigger |
|
|
156
|
+
| `Separator` | A line between items |
|
|
157
|
+
|
|
158
|
+
### Typography
|
|
159
|
+
|
|
160
|
+
| Component | What it is |
|
|
161
|
+
| --- | --- |
|
|
162
|
+
| `Text`, `Title` | Text with theme sizes, colors, clamping; `h1`–`h6` |
|
|
163
|
+
| `Blockquote`, `Code`, `Kbd`, `Mark`, `Highlight`, `List` | Quotes, code, keys, marked text, matches marked in a string, lists |
|
|
164
|
+
| `NumberFormatter` | Prints a formatted number |
|
|
165
|
+
| `Typography` | Styles raw HTML (CMS content, markdown output): headings, lists, tables, quotes, code, images |
|
|
166
|
+
|
|
167
|
+
### Miscellaneous
|
|
168
|
+
|
|
169
|
+
| Component | What it is |
|
|
170
|
+
| --- | --- |
|
|
171
|
+
| `Collapse`, `Transition` | Animated show / hide, and mount / unmount with an animation |
|
|
172
|
+
| `Divider` | Line between content, optionally with a label |
|
|
173
|
+
| `Portal`, `OptionalPortal` | Render children elsewhere in the DOM |
|
|
174
|
+
| `ScrollArea` | Scrollable box with custom scrollbars; scrolling stays native |
|
|
175
|
+
| `VisuallyHidden` | Hidden on screen, read by screen readers |
|
|
176
|
+
|
|
177
|
+
### Base
|
|
178
|
+
|
|
179
|
+
| Component | What it is |
|
|
180
|
+
| --- | --- |
|
|
181
|
+
| `WelloProvider`, `DirectionProvider` | Theme, color scheme, texts and text direction |
|
|
182
|
+
| `Box` | The base of every component: `component`, style props, `mod`, `renderRoot` |
|
|
183
|
+
| `Slot` | Renders its only child with props merged in (what `asChild` uses) |
|
|
184
|
+
|
|
185
|
+
## Styling
|
|
186
|
+
|
|
187
|
+
Every component takes style props (responsive too) and exposes its parts by name:
|
|
188
|
+
|
|
189
|
+
```tsx
|
|
190
|
+
<Button mt="md" w={{ base: "100%", sm: "auto" }}>Pay</Button>
|
|
191
|
+
|
|
192
|
+
<Modal
|
|
193
|
+
opened={opened}
|
|
194
|
+
onClose={close}
|
|
195
|
+
classNames={{ title: "my-title", body: "my-body" }}
|
|
196
|
+
styles={{ content: { borderRadius: 24 } }}
|
|
197
|
+
/>
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
- **`classNames`, `styles`**: one class or style per part. `unstyled` removes the component's own styles.
|
|
201
|
+
- **`vars`**: change the CSS variables a component sets, e.g. `vars={() => ({ root: { "--button-height": "3rem" } })}`.
|
|
202
|
+
- **`component`**: render another element or your router's link: `<Button component="a" href="/">`.
|
|
203
|
+
- **Variants**: `variant="outline"` and friends are `data-variant` attributes, so you can also style them from CSS.
|
|
204
|
+
- **Order of styles**: the package's CSS is in `@layer components`, so your own unlayered CSS and Tailwind utilities win without `!important`.
|
|
205
|
+
|
|
206
|
+
Every component's parts are documented on its page in the docs, under *Styles API*.
|
|
207
|
+
|
|
208
|
+
## Theme
|
|
209
|
+
|
|
210
|
+
### Colors
|
|
211
|
+
|
|
212
|
+
```tsx
|
|
213
|
+
import { createWelloConfig, WelloProvider } from "@wello-dev/core";
|
|
214
|
+
|
|
215
|
+
const theme = createWelloConfig({
|
|
216
|
+
primaryColor: "#7c3aed", // or "rgb(124, 58, 237)", "rgba(124, 58, 237, 0.8)" or a color name
|
|
217
|
+
colors: {
|
|
218
|
+
brand: "#7c3aed", // one color: the shades are worked out from it
|
|
219
|
+
ocean: ["#f0f9ff", "..."], // or your own shades, 50 to 950
|
|
220
|
+
"blue.0": "#e0f2ff", // or change one shade of a color; "blue-50" works too
|
|
221
|
+
},
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
<WelloProvider theme={theme}>
|
|
225
|
+
<App />
|
|
226
|
+
</WelloProvider>
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### A color per color scheme
|
|
230
|
+
|
|
231
|
+
```tsx
|
|
232
|
+
const theme = createWelloConfig({
|
|
233
|
+
primaryColor: "primary",
|
|
234
|
+
colors: { primary: virtualColor({ name: "primary", light: "teal", dark: "pink" }) },
|
|
235
|
+
});
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Checking a color
|
|
239
|
+
|
|
240
|
+
A `color` that doesn't exist warns in the console once, says why, and falls back to the primary color. To check one yourself, for example a color typed by a user:
|
|
241
|
+
|
|
242
|
+
```tsx
|
|
243
|
+
const theme = useWelloTheme();
|
|
244
|
+
isValidColor("teal.6", theme); // true
|
|
245
|
+
isValidColor("bleu", theme); // false
|
|
246
|
+
checkColor("bleu", theme); // { valid: false, reason: '"bleu" isn't a theme color… Did you mean "blue"?', suggestion: "blue" }
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### Sizes, radius and spacing
|
|
250
|
+
|
|
251
|
+
`xs` to `xl` work for `radius`, `shadow`, `size` and spacing props (`mt="md"`). Change them in `createWelloConfig({ radius, spacing, … })`, or read them in your own code with `getRadius`, `getSpacing`, `getSize`, `getFontSize`, `rem`, `px`, `em`.
|
|
252
|
+
|
|
253
|
+
## Theme toggle
|
|
254
|
+
|
|
255
|
+
`ThemeToggle` switches light and dark with the View Transitions API: the new scheme grows over the old one from a corner, a circle, a diamond…
|
|
256
|
+
|
|
257
|
+
```tsx
|
|
258
|
+
<ThemeToggle variant="circle-blur" start="top-right" duration={800} />
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
- `variant`: `circle`, `circle-blur`, `polygon`, `diamond`, `wipe`, `fade` or `blur`. `start`: `center` or a corner.
|
|
262
|
+
- It reads and sets the scheme of `WelloProvider`. If your app keeps its own theme state, use `ThemeToggleButton` and change it in `onClick`: `<ThemeToggleButton theme={theme} onClick={toggle} />`.
|
|
263
|
+
- For the same animation on anything else, `runViewTransition(() => update(), { variant, start })`, or `useViewTransition()`. The update must change the page synchronously.
|
|
264
|
+
- Browsers without the API, and people who ask for less motion, get the change with no animation.
|
|
265
|
+
|
|
266
|
+
## Dark mode and RTL
|
|
267
|
+
|
|
268
|
+
```tsx
|
|
269
|
+
const { colorScheme, setColorScheme, toggleColorScheme } = useWelloColorScheme();
|
|
270
|
+
const scheme = useComputedColorScheme(); // "light" or "dark": what is shown, with "auto" resolved
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
The choice is saved in `localStorage` (`colorSchemeManager={null}` to not save it, or pass your own with `localStorageColorSchemeManager` as a model).
|
|
274
|
+
|
|
275
|
+
For right-to-left languages set `dir="rtl"` on `<html>`. Components that need the direction in JavaScript, like sliders, pagination and carousels, follow it through `DirectionProvider`, and `useDirection()` gives you the same value.
|
|
276
|
+
|
|
277
|
+
## Translating the built-in texts
|
|
278
|
+
|
|
279
|
+
Pass `labels` to `WelloProvider`. Any text you leave out stays in English, and a prop on a component still wins:
|
|
280
|
+
|
|
281
|
+
```tsx
|
|
282
|
+
<WelloProvider
|
|
283
|
+
labels={{
|
|
284
|
+
close: t("close"),
|
|
285
|
+
search: t("search"),
|
|
286
|
+
noResults: t("noResults"),
|
|
287
|
+
previousPage: t("previous"),
|
|
288
|
+
nextPage: t("next"),
|
|
289
|
+
phoneDigits: (count) => t("digits", { count }),
|
|
290
|
+
}}
|
|
291
|
+
>
|
|
292
|
+
<App />
|
|
293
|
+
</WelloProvider>
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
All the keys, with their English texts, are in `DEFAULT_LABELS`. In your own components, `useWelloLabels()` reads them.
|
|
297
|
+
|
|
298
|
+
## Dropzone
|
|
299
|
+
|
|
300
|
+
A drop zone with attached-file cards: previews, upload progress, retry, remove (with a confirmation), and checks for type, size and count. It never talks to a server by itself: pass `upload` to send each file.
|
|
301
|
+
|
|
302
|
+
```tsx
|
|
303
|
+
import { Dropzone, type DropzoneFile } from "@wello-dev/core";
|
|
304
|
+
|
|
305
|
+
const [files, setFiles] = useState<DropzoneFile[]>([]);
|
|
306
|
+
|
|
307
|
+
<Dropzone
|
|
308
|
+
label="Photos"
|
|
309
|
+
fileType="image" // the icon
|
|
310
|
+
accept="image/*" // as for <input accept>: image/*,.pdf
|
|
311
|
+
maxFiles={3}
|
|
312
|
+
maxSize={5} // MB
|
|
313
|
+
value={files}
|
|
314
|
+
onChange={setFiles}
|
|
315
|
+
upload={(file, { onProgress, signal }) => send(file, onProgress, signal)} // resolve = done, reject = shows Retry
|
|
316
|
+
onRemove={(file) => deleteOnServer(file)} // return false to keep the file
|
|
317
|
+
onReject={(rejections) => toast(rejections[0].message)}
|
|
318
|
+
/>
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
- `fileType`, `accept`, `maxFiles` and `maxSize` are required: there is no default list of types or size, so every field says what it takes.
|
|
322
|
+
- Without `upload`, picked files stay in the list as completed, with the `File` in `file.file`, to submit with your form.
|
|
323
|
+
- With `maxFiles={1}` the file shows inside the drop zone and replaces the previous one.
|
|
324
|
+
- `confirmRemove={false}` removes without asking. `defaultValue` takes files you already have on the server, and `value` makes the list controlled.
|
|
325
|
+
- Its texts are the `labels` that start with `dropzone` (`dropzoneDrop`, `dropzoneSupported`, `dropzoneConfirmText`, …): translate them in `WelloProvider`.
|
|
326
|
+
|
|
327
|
+
## Your API
|
|
328
|
+
|
|
329
|
+
Say once where your API is, in the theme. After that, `Select` takes only an `endpoint`, and `useFetch` and `useApi` need nothing else:
|
|
330
|
+
|
|
331
|
+
```tsx
|
|
332
|
+
const theme = createWelloConfig({
|
|
333
|
+
api: {
|
|
334
|
+
baseURL: "/api",
|
|
335
|
+
generalBaseURL: "/api/general", // for requests that say `general`
|
|
336
|
+
getHeaders: () => ({ Authorization: `Bearer ${getAccessToken()}` }), // called at every request
|
|
337
|
+
onError: ({ status, message }) => { if (status === 401) goToLogin(); },
|
|
338
|
+
},
|
|
339
|
+
});
|
|
340
|
+
|
|
341
|
+
<WelloProvider theme={theme}>…</WelloProvider>
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
```tsx
|
|
345
|
+
<Select endpoint="cities" params={{ country_id: 5 }} /> {/* pages on scroll, search, the current value from cities/{id} */}
|
|
346
|
+
<Select endpoint="countries" general select={(res) => res.items} /> {/* another address; your own shape of answer */}
|
|
347
|
+
<PhoneInput endpoint="countries" params={{ paginate: false }} {...field} /> {/* the dial codes, flags and limits from your API */}
|
|
348
|
+
|
|
349
|
+
const { data, isLoading, refetch } = useFetch<{ data: User[] }>("users", { params: { page: 1 } });
|
|
350
|
+
const api = useApi();
|
|
351
|
+
await api.post("users", { name: "Sara" });
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
- `useFetch(endpoint, { params, enabled, general, select, staleTime, onSuccess, onError })` keeps the answer for `staleTime` (60 s) and shares it between components that ask the same thing. `clearFetchCache()` forgets it, for example after a save.
|
|
355
|
+
- `Select` reads `{ data: [...] }`, `{ data: { data: [...] } }`, `{ items: [...] }` or a plain array, and the total from `meta.total` or `pagination.total`. If yours differs, pass `select`. The query names default to `page`, `per_page` and `search`: change them with `api.listParams`.
|
|
356
|
+
- With `multiple`, the options of the current values are not fetched one by one. With `hasShow={false}`, or a `showEndpoint` that returns `null`, they are not fetched either.
|
|
357
|
+
- `params={{ paginate: false }}` means the server sends everything at once, so no page or `per_page` is sent and the list is not asked for more.
|
|
358
|
+
- `createApiClient(theme.api)` gives the axios instance if you need more than `useApi`.
|
|
359
|
+
|
|
360
|
+
## Build your own components
|
|
361
|
+
|
|
362
|
+
The pieces the components are made of are exported, so yours can behave the same:
|
|
363
|
+
|
|
364
|
+
```tsx
|
|
365
|
+
import { factory, useProps, useComponentStyles, Box, type BoxProps, type StylesApiProps } from "@wello-dev/core";
|
|
366
|
+
|
|
367
|
+
type CardStylesNames = "root" | "title";
|
|
368
|
+
interface MyCardProps extends BoxProps, StylesApiProps<CardStylesNames, MyCardProps> {
|
|
369
|
+
title: string;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
export const MyCard = factory<{ props: MyCardProps; ref: HTMLDivElement; stylesNames: CardStylesNames }>((_props, ref) => {
|
|
373
|
+
const props = useProps("MyCard", {}, _props);
|
|
374
|
+
const [getStyles, { title, children, ...others }] = useComponentStyles("MyCard", props);
|
|
375
|
+
return (
|
|
376
|
+
<Box ref={ref} {...getStyles("root")} {...others}>
|
|
377
|
+
<h3 {...getStyles("title")}>{title}</h3>
|
|
378
|
+
{children}
|
|
379
|
+
</Box>
|
|
380
|
+
);
|
|
381
|
+
});
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
Yours then take `classNames`, `styles`, `unstyled`, style props and theme defaults (`createWelloConfig({ components: { MyCard: { … } } })`) like the built-in ones. `polymorphicFactory` does the same for components with `component`.
|
|
385
|
+
|
|
386
|
+
## Utilities
|
|
387
|
+
|
|
388
|
+
| Group | Exports |
|
|
389
|
+
| --- | --- |
|
|
390
|
+
| Theme | `createWelloConfig`, `mergeTheme`, `DEFAULT_THEME`, `PALETTE`, `SHADES` |
|
|
391
|
+
| Colors | `virtualColor`, `isValidColor`, `checkColor`, `isCssColor`, `generateColors`, `colorsTuple`, `alpha`, `lighten`, `darken`, `rgba`, `toRgba`, `luminance`, `isLightColor`, `getContrastColor`, `getThemeColor`, `parseThemeColor`, `getGradient` |
|
|
392
|
+
| Units | `rem`, `px`, `em`, `getSize`, `getSpacing`, `getRadius`, `getShadow`, `getFontSize`, `getLineHeight` |
|
|
393
|
+
| Hooks | `useWelloTheme`, `useWelloColorScheme`, `useComputedColorScheme`, `useDirection`, `useWelloLabels`, `useId`, `useFetch`, `useApi` |
|
|
394
|
+
| API | `createApiClient`, `clearFetchCache`, `readListResponse` |
|
|
395
|
+
| Helpers | `cx`, `clamp`, `mergeRefs`, `mergeStyles`, `callAll`, `mapResponsive`, `createSafeContext`, `createOptionalContext` |
|
|
396
|
+
| Building blocks | `factory`, `polymorphicFactory`, `useProps`, `useStyles`, `useComponentStyles`, `staticClasses`, `Box`, `Slot` |
|
|
397
|
+
|
|
398
|
+
Hooks for state, events and the browser (`useDisclosure`, `useDebouncedValue`, …) are in `@wello-dev/hooks`.
|
|
399
|
+
|
|
400
|
+
## Scrollbars
|
|
401
|
+
|
|
402
|
+
Scrollbars use the primary color: `ScrollArea`, and through `scrollbar-color` on `html`, the page and everything else that scrolls. To change them:
|
|
403
|
+
|
|
404
|
+
```css
|
|
405
|
+
:root { --wello-scrollbar-color: #94a3b8; } /* another color */
|
|
406
|
+
html { scrollbar-color: auto; } /* the browser's own, outside ScrollArea */
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
## Carousel arrows
|
|
410
|
+
|
|
411
|
+
Round glass buttons by default. For only the chevrons, use `controlsVariant="plain"`. To restyle them:
|
|
412
|
+
|
|
413
|
+
```css
|
|
414
|
+
.my-carousel {
|
|
415
|
+
--carousel-control-bg: #0f172a;
|
|
416
|
+
--carousel-control-color: #fff;
|
|
417
|
+
--carousel-control-border: transparent;
|
|
418
|
+
}
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
Your own unlayered CSS, like `.swiper-button-next { … }`, always wins.
|
|
422
|
+
|
|
423
|
+
## License
|
|
424
|
+
|
|
425
|
+
MIT
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
factory
|
|
4
|
+
} from "./chunk-CJ7I6UM7.js";
|
|
5
|
+
import {
|
|
6
|
+
Box,
|
|
7
|
+
mapResponsive
|
|
8
|
+
} from "./chunk-TWM6DSH4.js";
|
|
9
|
+
import {
|
|
10
|
+
useComponentStyles,
|
|
11
|
+
useProps
|
|
12
|
+
} from "./chunk-4QBFXTYH.js";
|
|
13
|
+
import {
|
|
14
|
+
getSpacing
|
|
15
|
+
} from "./chunk-IK562BNJ.js";
|
|
16
|
+
|
|
17
|
+
// src/components/Group/Group.tsx
|
|
18
|
+
import { Children } from "react";
|
|
19
|
+
import { jsx } from "react/jsx-runtime";
|
|
20
|
+
var Group = factory((_props, ref) => {
|
|
21
|
+
const props = useProps(
|
|
22
|
+
"Group",
|
|
23
|
+
{ gap: "md", justify: "flex-start", align: "center", wrap: "wrap", preventGrowOverflow: true },
|
|
24
|
+
_props
|
|
25
|
+
);
|
|
26
|
+
const [getStyles, { gap, justify, align, wrap, grow, preventGrowOverflow, children, ...others }] = useComponentStyles("Group", props);
|
|
27
|
+
const count = Children.toArray(children).filter(Boolean).length;
|
|
28
|
+
return /* @__PURE__ */ jsx(
|
|
29
|
+
Box,
|
|
30
|
+
{
|
|
31
|
+
ref,
|
|
32
|
+
...getStyles("root"),
|
|
33
|
+
mod: { grow },
|
|
34
|
+
__css: {
|
|
35
|
+
"--group-gap": mapResponsive(gap, getSpacing),
|
|
36
|
+
"--group-justify": justify,
|
|
37
|
+
"--group-align": align,
|
|
38
|
+
"--group-wrap": wrap,
|
|
39
|
+
"--group-child-width": grow && preventGrowOverflow ? `calc(${100 / Math.max(1, count)}% - (var(--group-gap) - var(--group-gap) / ${Math.max(1, count)}))` : void 0
|
|
40
|
+
},
|
|
41
|
+
...others,
|
|
42
|
+
children
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
});
|
|
46
|
+
Group.displayName = "Group";
|
|
47
|
+
|
|
48
|
+
export {
|
|
49
|
+
Group
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=chunk-2A6MTZBO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Group/Group.tsx"],"sourcesContent":["import { Children, type CSSProperties, type ReactNode } from \"react\";\nimport { Box, type BoxProps } from \"../../core/Box/Box\";\nimport { mapResponsive, type StyleProp } from \"../../core/Box/style-props\";\nimport { factory } from \"../../core/factory/factory\";\nimport { useComponentStyles, useProps, type StylesApiProps } from \"../../core/styles-api/styles-api\";\nimport type { WelloSpacing } from \"../../core/theme/types\";\nimport { getSpacing } from \"../../core/theme/units\";\n\nexport interface GroupProps extends BoxProps, StylesApiProps<\"root\", GroupProps> {\n /** Space between children; responsive. Default: 'md' */\n gap?: StyleProp<WelloSpacing>;\n /** `justify-content`. Default: 'flex-start' */\n justify?: StyleProp<CSSProperties[\"justifyContent\"]>;\n /** `align-items`. Default: 'center' */\n align?: StyleProp<CSSProperties[\"alignItems\"]>;\n /** `flex-wrap`. Default: 'wrap' */\n wrap?: StyleProp<CSSProperties[\"flexWrap\"]>;\n /** Children share the width equally */\n grow?: boolean;\n /** With `grow`, children can't be wider than their share. Default: true */\n preventGrowOverflow?: boolean;\n children?: ReactNode;\n}\n\n/**\n * Children in a row with even gaps.\n *\n * @example\n * <Group justify=\"space-between\"><Title order={3}>Orders</Title><Button>New</Button></Group>\n */\nexport const Group = factory<{ props: GroupProps; ref: HTMLDivElement; stylesNames: \"root\" }>((_props, ref) => {\n const props = useProps(\n \"Group\",\n { gap: \"md\", justify: \"flex-start\", align: \"center\", wrap: \"wrap\", preventGrowOverflow: true },\n _props,\n );\n const [getStyles, { gap, justify, align, wrap, grow, preventGrowOverflow, children, ...others }] =\n useComponentStyles(\"Group\", props);\n const count = Children.toArray(children).filter(Boolean).length;\n return (\n <Box\n ref={ref}\n {...getStyles(\"root\")}\n mod={{ grow }}\n __css={{\n \"--group-gap\": mapResponsive(gap, getSpacing),\n \"--group-justify\": justify,\n \"--group-align\": align,\n \"--group-wrap\": wrap,\n \"--group-child-width\":\n grow && preventGrowOverflow\n ? `calc(${100 / Math.max(1, count)}% - (var(--group-gap) - var(--group-gap) / ${Math.max(1, count)}))`\n : undefined,\n }}\n {...others}\n >\n {children}\n </Box>\n );\n});\nGroup.displayName = \"Group\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,SAAS,gBAAoD;AAwCzD;AAVG,IAAM,QAAQ,QAAyE,CAAC,QAAQ,QAAQ;AAC7G,QAAM,QAAQ;AAAA,IACZ;AAAA,IACA,EAAE,KAAK,MAAM,SAAS,cAAc,OAAO,UAAU,MAAM,QAAQ,qBAAqB,KAAK;AAAA,IAC7F;AAAA,EACF;AACA,QAAM,CAAC,WAAW,EAAE,KAAK,SAAS,OAAO,MAAM,MAAM,qBAAqB,UAAU,GAAG,OAAO,CAAC,IAC7F,mBAAmB,SAAS,KAAK;AACnC,QAAM,QAAQ,SAAS,QAAQ,QAAQ,EAAE,OAAO,OAAO,EAAE;AACzD,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACC,GAAG,UAAU,MAAM;AAAA,MACpB,KAAK,EAAE,KAAK;AAAA,MACZ,OAAO;AAAA,QACL,eAAe,cAAc,KAAK,UAAU;AAAA,QAC5C,mBAAmB;AAAA,QACnB,iBAAiB;AAAA,QACjB,gBAAgB;AAAA,QAChB,uBACE,QAAQ,sBACJ,QAAQ,MAAM,KAAK,IAAI,GAAG,KAAK,CAAC,8CAA8C,KAAK,IAAI,GAAG,KAAK,CAAC,OAChG;AAAA,MACR;AAAA,MACC,GAAG;AAAA,MAEH;AAAA;AAAA,EACH;AAEJ,CAAC;AACD,MAAM,cAAc;","names":[]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
factory
|
|
4
|
+
} from "./chunk-CJ7I6UM7.js";
|
|
5
|
+
import {
|
|
6
|
+
Box
|
|
7
|
+
} from "./chunk-TWM6DSH4.js";
|
|
8
|
+
import {
|
|
9
|
+
useComponentStyles,
|
|
10
|
+
useProps
|
|
11
|
+
} from "./chunk-4QBFXTYH.js";
|
|
12
|
+
import {
|
|
13
|
+
getColorVars,
|
|
14
|
+
getRadius,
|
|
15
|
+
rem
|
|
16
|
+
} from "./chunk-IK562BNJ.js";
|
|
17
|
+
|
|
18
|
+
// src/components/Indicator/Indicator.tsx
|
|
19
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
20
|
+
var Indicator = factory((_props, ref) => {
|
|
21
|
+
const props = useProps("Indicator", { position: "top-end", offset: 0, size: 10, zIndex: 200 }, _props);
|
|
22
|
+
const [getStyles, { position, offset, label, size, color, radius, withBorder, disabled, processing, inline, zIndex, autoContrast, children, ...others }] = useComponentStyles("Indicator", props, {
|
|
23
|
+
varsResolver: (theme, p) => ({
|
|
24
|
+
indicator: {
|
|
25
|
+
...getColorVars(p.color, theme, { autoContrast: p.autoContrast }),
|
|
26
|
+
"--indicator-size": rem(p.size),
|
|
27
|
+
"--indicator-radius": p.radius === void 0 ? void 0 : getRadius(p.radius),
|
|
28
|
+
"--indicator-z-index": String(p.zIndex),
|
|
29
|
+
"--indicator-offset": rem(p.offset)
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
});
|
|
33
|
+
const [vertical, horizontal] = (position ?? "top-end").split("-");
|
|
34
|
+
return /* @__PURE__ */ jsxs(Box, { ref, ...getStyles("root"), mod: { inline }, ...others, children: [
|
|
35
|
+
!disabled && /* @__PURE__ */ jsx(
|
|
36
|
+
Box,
|
|
37
|
+
{
|
|
38
|
+
...getStyles("indicator"),
|
|
39
|
+
mod: { y: vertical, x: horizontal, "with-label": label !== void 0 && label !== null, "with-border": withBorder, processing },
|
|
40
|
+
children: label
|
|
41
|
+
}
|
|
42
|
+
),
|
|
43
|
+
children
|
|
44
|
+
] });
|
|
45
|
+
});
|
|
46
|
+
Indicator.displayName = "Indicator";
|
|
47
|
+
|
|
48
|
+
export {
|
|
49
|
+
Indicator
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=chunk-2GM6477D.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Indicator/Indicator.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { Box, type BoxProps } from \"../../core/Box/Box\";\nimport { factory } from \"../../core/factory/factory\";\nimport { useComponentStyles, useProps, type StylesApiProps } from \"../../core/styles-api/styles-api\";\nimport { getColorVars } from \"../../core/theme/color-functions\";\nimport type { WelloColor, WelloRadius } from \"../../core/theme/types\";\nimport { getRadius, rem } from \"../../core/theme/units\";\n\nexport type IndicatorPosition =\n | \"top-start\"\n | \"top-center\"\n | \"top-end\"\n | \"middle-start\"\n | \"middle-center\"\n | \"middle-end\"\n | \"bottom-start\"\n | \"bottom-center\"\n | \"bottom-end\";\n\nexport interface IndicatorProps extends BoxProps, StylesApiProps<\"root\" | \"indicator\", IndicatorProps> {\n /** Default: 'top-end' */\n position?: IndicatorPosition;\n /** Distance from the corner. Default: 0 */\n offset?: number;\n /** Text inside (count, \"new\") */\n label?: ReactNode;\n /** Dot size without a label. Default: 10 */\n size?: number | string;\n color?: WelloColor;\n radius?: WelloRadius;\n /** Ring around it in the background color */\n withBorder?: boolean;\n /** Hide it */\n disabled?: boolean;\n /** Ping animation */\n processing?: boolean;\n /** `display: inline-block` root, for inline elements */\n inline?: boolean;\n /** Default: 200 */\n zIndex?: number | string;\n autoContrast?: boolean;\n children?: ReactNode;\n}\n\n/**\n * Dot or count on the corner of an element (avatar, icon, button).\n *\n * @example\n * <Indicator label={3} size={16}><Avatar /></Indicator>\n * <Indicator color=\"teal\" processing withBorder><Avatar /></Indicator>\n */\nexport const Indicator = factory<{ props: IndicatorProps; ref: HTMLDivElement; stylesNames: \"root\" | \"indicator\" }>((_props, ref) => {\n const props = useProps(\"Indicator\", { position: \"top-end\", offset: 0, size: 10, zIndex: 200 }, _props);\n const [getStyles, { position, offset, label, size, color, radius, withBorder, disabled, processing, inline, zIndex, autoContrast, children, ...others }] =\n useComponentStyles(\"Indicator\", props, {\n varsResolver: (theme, p) => ({\n indicator: {\n ...getColorVars(p.color, theme, { autoContrast: p.autoContrast }),\n \"--indicator-size\": rem(p.size),\n \"--indicator-radius\": p.radius === undefined ? undefined : getRadius(p.radius),\n \"--indicator-z-index\": String(p.zIndex),\n \"--indicator-offset\": rem(p.offset),\n },\n }),\n });\n const [vertical, horizontal] = (position ?? \"top-end\").split(\"-\");\n return (\n <Box ref={ref} {...getStyles(\"root\")} mod={{ inline }} {...others}>\n {!disabled && (\n <Box\n {...getStyles(\"indicator\")}\n mod={{ y: vertical, x: horizontal, \"with-label\": label !== undefined && label !== null, \"with-border\": withBorder, processing }}\n >\n {label}\n </Box>\n )}\n {children}\n </Box>\n );\n});\nIndicator.displayName = \"Indicator\";\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmEI,SAEI,KAFJ;AAhBG,IAAM,YAAY,QAA2F,CAAC,QAAQ,QAAQ;AACnI,QAAM,QAAQ,SAAS,aAAa,EAAE,UAAU,WAAW,QAAQ,GAAG,MAAM,IAAI,QAAQ,IAAI,GAAG,MAAM;AACrG,QAAM,CAAC,WAAW,EAAE,UAAU,QAAQ,OAAO,MAAM,OAAO,QAAQ,YAAY,UAAU,YAAY,QAAQ,QAAQ,cAAc,UAAU,GAAG,OAAO,CAAC,IACrJ,mBAAmB,aAAa,OAAO;AAAA,IACrC,cAAc,CAAC,OAAO,OAAO;AAAA,MAC3B,WAAW;AAAA,QACT,GAAG,aAAa,EAAE,OAAO,OAAO,EAAE,cAAc,EAAE,aAAa,CAAC;AAAA,QAChE,oBAAoB,IAAI,EAAE,IAAI;AAAA,QAC9B,sBAAsB,EAAE,WAAW,SAAY,SAAY,UAAU,EAAE,MAAM;AAAA,QAC7E,uBAAuB,OAAO,EAAE,MAAM;AAAA,QACtC,sBAAsB,IAAI,EAAE,MAAM;AAAA,MACpC;AAAA,IACF;AAAA,EACF,CAAC;AACH,QAAM,CAAC,UAAU,UAAU,KAAK,YAAY,WAAW,MAAM,GAAG;AAChE,SACE,qBAAC,OAAI,KAAW,GAAG,UAAU,MAAM,GAAG,KAAK,EAAE,OAAO,GAAI,GAAG,QACxD;AAAA,KAAC,YACA;AAAA,MAAC;AAAA;AAAA,QACE,GAAG,UAAU,WAAW;AAAA,QACzB,KAAK,EAAE,GAAG,UAAU,GAAG,YAAY,cAAc,UAAU,UAAa,UAAU,MAAM,eAAe,YAAY,WAAW;AAAA,QAE7H;AAAA;AAAA,IACH;AAAA,IAED;AAAA,KACH;AAEJ,CAAC;AACD,UAAU,cAAc;","names":[]}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
UnstyledButton
|
|
4
|
+
} from "./chunk-5SQC5LKY.js";
|
|
5
|
+
import {
|
|
6
|
+
polymorphicFactory
|
|
7
|
+
} from "./chunk-CJ7I6UM7.js";
|
|
8
|
+
import {
|
|
9
|
+
useComponentStyles,
|
|
10
|
+
useProps
|
|
11
|
+
} from "./chunk-4QBFXTYH.js";
|
|
12
|
+
import {
|
|
13
|
+
getColorVars,
|
|
14
|
+
getRadius
|
|
15
|
+
} from "./chunk-IK562BNJ.js";
|
|
16
|
+
|
|
17
|
+
// src/components/Toggle/Toggle.tsx
|
|
18
|
+
import { useState } from "react";
|
|
19
|
+
import { jsx } from "react/jsx-runtime";
|
|
20
|
+
var Toggle = polymorphicFactory((_props, ref) => {
|
|
21
|
+
const props = useProps("Toggle", { size: "sm", variant: "filled" }, _props);
|
|
22
|
+
const [getStyles, { active: controlled, defaultActive, onActiveChange, disabled, size, radius, autoWidth, color, variant, autoContrast, onClick, ...others }] = useComponentStyles("Toggle", props, {
|
|
23
|
+
varsResolver: (theme, p) => {
|
|
24
|
+
const v = getColorVars(p.color, theme, { variant: p.variant, autoContrast: p.autoContrast });
|
|
25
|
+
return {
|
|
26
|
+
root: {
|
|
27
|
+
"--toggle-radius": p.radius === void 0 ? void 0 : getRadius(p.radius),
|
|
28
|
+
"--toggle-active-bg": v["--wello-v-bg"],
|
|
29
|
+
"--toggle-active-hover": v["--wello-v-hover"],
|
|
30
|
+
"--toggle-active-color": v["--wello-v-color"],
|
|
31
|
+
"--toggle-active-bd": v["--wello-v-bd"]
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
const [internal, setInternal] = useState(!!defaultActive);
|
|
37
|
+
const active = controlled ?? internal;
|
|
38
|
+
return /* @__PURE__ */ jsx(
|
|
39
|
+
UnstyledButton,
|
|
40
|
+
{
|
|
41
|
+
ref,
|
|
42
|
+
...getStyles("root", { focusable: true }),
|
|
43
|
+
size,
|
|
44
|
+
disabled,
|
|
45
|
+
"aria-pressed": active,
|
|
46
|
+
"data-active": active || void 0,
|
|
47
|
+
"data-disabled": disabled || void 0,
|
|
48
|
+
"data-auto-width": autoWidth || void 0,
|
|
49
|
+
onClick: (event) => {
|
|
50
|
+
onClick?.(event);
|
|
51
|
+
if (event.defaultPrevented) return;
|
|
52
|
+
if (controlled === void 0) setInternal(!active);
|
|
53
|
+
onActiveChange?.(!active);
|
|
54
|
+
},
|
|
55
|
+
...others
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
});
|
|
59
|
+
Toggle.displayName = "Toggle";
|
|
60
|
+
|
|
61
|
+
export {
|
|
62
|
+
Toggle
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=chunk-2WIGWLPL.js.map
|