@chicken-ui/react 0.1.0
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/components/Box/Box.d.mts +4 -0
- package/dist/components/Box/Box.d.ts +4 -0
- package/dist/components/Box/Box.js +74 -0
- package/dist/components/Box/Box.js.map +1 -0
- package/dist/components/Box/Box.mjs +56 -0
- package/dist/components/Box/Box.mjs.map +1 -0
- package/dist/components/Box/index.d.mts +11 -0
- package/dist/components/Box/index.d.ts +11 -0
- package/dist/components/Box/index.js +39 -0
- package/dist/components/Box/index.js.map +1 -0
- package/dist/components/Box/index.mjs +5 -0
- package/dist/components/Box/index.mjs.map +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.d.mts +12 -0
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +12 -0
- package/dist/components/Breadcrumb/Breadcrumb.js +75 -0
- package/dist/components/Breadcrumb/Breadcrumb.js.map +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.mjs +57 -0
- package/dist/components/Breadcrumb/Breadcrumb.mjs.map +1 -0
- package/dist/components/Breadcrumb/BreadcrumbItem.d.mts +16 -0
- package/dist/components/Breadcrumb/BreadcrumbItem.d.ts +16 -0
- package/dist/components/Breadcrumb/BreadcrumbItem.js +82 -0
- package/dist/components/Breadcrumb/BreadcrumbItem.js.map +1 -0
- package/dist/components/Breadcrumb/BreadcrumbItem.mjs +64 -0
- package/dist/components/Breadcrumb/BreadcrumbItem.mjs.map +1 -0
- package/dist/components/Breadcrumb/BreadcrumbPresets.d.mts +16 -0
- package/dist/components/Breadcrumb/BreadcrumbPresets.d.ts +16 -0
- package/dist/components/Breadcrumb/BreadcrumbPresets.js +74 -0
- package/dist/components/Breadcrumb/BreadcrumbPresets.js.map +1 -0
- package/dist/components/Breadcrumb/BreadcrumbPresets.mjs +46 -0
- package/dist/components/Breadcrumb/BreadcrumbPresets.mjs.map +1 -0
- package/dist/components/Breadcrumb/index.d.mts +6 -0
- package/dist/components/Breadcrumb/index.d.ts +6 -0
- package/dist/components/Breadcrumb/index.js +45 -0
- package/dist/components/Breadcrumb/index.js.map +1 -0
- package/dist/components/Breadcrumb/index.mjs +9 -0
- package/dist/components/Breadcrumb/index.mjs.map +1 -0
- package/dist/components/Button/Button.d.mts +15 -0
- package/dist/components/Button/Button.d.ts +15 -0
- package/dist/components/Button/Button.js +102 -0
- package/dist/components/Button/Button.js.map +1 -0
- package/dist/components/Button/Button.mjs +84 -0
- package/dist/components/Button/Button.mjs.map +1 -0
- package/dist/components/Button/index.d.mts +4 -0
- package/dist/components/Button/index.d.ts +4 -0
- package/dist/components/Button/index.js +39 -0
- package/dist/components/Button/index.js.map +1 -0
- package/dist/components/Button/index.mjs +5 -0
- package/dist/components/Button/index.mjs.map +1 -0
- package/dist/components/Card/Card.d.mts +13 -0
- package/dist/components/Card/Card.d.ts +13 -0
- package/dist/components/Card/Card.js +90 -0
- package/dist/components/Card/Card.js.map +1 -0
- package/dist/components/Card/Card.mjs +72 -0
- package/dist/components/Card/Card.mjs.map +1 -0
- package/dist/components/Card/CardAction.d.mts +9 -0
- package/dist/components/Card/CardAction.d.ts +9 -0
- package/dist/components/Card/CardAction.js +69 -0
- package/dist/components/Card/CardAction.js.map +1 -0
- package/dist/components/Card/CardAction.mjs +51 -0
- package/dist/components/Card/CardAction.mjs.map +1 -0
- package/dist/components/Card/CardContent.d.mts +9 -0
- package/dist/components/Card/CardContent.d.ts +9 -0
- package/dist/components/Card/CardContent.js +69 -0
- package/dist/components/Card/CardContent.js.map +1 -0
- package/dist/components/Card/CardContent.mjs +51 -0
- package/dist/components/Card/CardContent.mjs.map +1 -0
- package/dist/components/Card/CardHeader.d.mts +9 -0
- package/dist/components/Card/CardHeader.d.ts +9 -0
- package/dist/components/Card/CardHeader.js +69 -0
- package/dist/components/Card/CardHeader.js.map +1 -0
- package/dist/components/Card/CardHeader.mjs +51 -0
- package/dist/components/Card/CardHeader.mjs.map +1 -0
- package/dist/components/Card/CardIcon.d.mts +11 -0
- package/dist/components/Card/CardIcon.d.ts +11 -0
- package/dist/components/Card/CardIcon.js +74 -0
- package/dist/components/Card/CardIcon.js.map +1 -0
- package/dist/components/Card/CardIcon.mjs +56 -0
- package/dist/components/Card/CardIcon.mjs.map +1 -0
- package/dist/components/Card/CardText.d.mts +9 -0
- package/dist/components/Card/CardText.d.ts +9 -0
- package/dist/components/Card/CardText.js +69 -0
- package/dist/components/Card/CardText.js.map +1 -0
- package/dist/components/Card/CardText.mjs +51 -0
- package/dist/components/Card/CardText.mjs.map +1 -0
- package/dist/components/Card/CardTitle.d.mts +15 -0
- package/dist/components/Card/CardTitle.d.ts +15 -0
- package/dist/components/Card/CardTitle.js +72 -0
- package/dist/components/Card/CardTitle.js.map +1 -0
- package/dist/components/Card/CardTitle.mjs +54 -0
- package/dist/components/Card/CardTitle.mjs.map +1 -0
- package/dist/components/Card/index.d.mts +11 -0
- package/dist/components/Card/index.d.ts +11 -0
- package/dist/components/Card/index.js +57 -0
- package/dist/components/Card/index.js.map +1 -0
- package/dist/components/Card/index.mjs +17 -0
- package/dist/components/Card/index.mjs.map +1 -0
- package/dist/components/Container/Container.d.mts +12 -0
- package/dist/components/Container/Container.d.ts +12 -0
- package/dist/components/Container/Container.js +94 -0
- package/dist/components/Container/Container.js.map +1 -0
- package/dist/components/Container/Container.mjs +76 -0
- package/dist/components/Container/Container.mjs.map +1 -0
- package/dist/components/Container/index.d.mts +4 -0
- package/dist/components/Container/index.d.ts +4 -0
- package/dist/components/Container/index.js +39 -0
- package/dist/components/Container/index.js.map +1 -0
- package/dist/components/Container/index.mjs +5 -0
- package/dist/components/Container/index.mjs.map +1 -0
- package/dist/components/Grid/Grid.d.mts +14 -0
- package/dist/components/Grid/Grid.d.ts +14 -0
- package/dist/components/Grid/Grid.js +110 -0
- package/dist/components/Grid/Grid.js.map +1 -0
- package/dist/components/Grid/Grid.mjs +96 -0
- package/dist/components/Grid/Grid.mjs.map +1 -0
- package/dist/components/Grid/index.d.mts +4 -0
- package/dist/components/Grid/index.d.ts +4 -0
- package/dist/components/Grid/index.js +39 -0
- package/dist/components/Grid/index.js.map +1 -0
- package/dist/components/Grid/index.mjs +5 -0
- package/dist/components/Grid/index.mjs.map +1 -0
- package/dist/components/HStack/HStack.d.mts +14 -0
- package/dist/components/HStack/HStack.d.ts +14 -0
- package/dist/components/HStack/HStack.js +111 -0
- package/dist/components/HStack/HStack.js.map +1 -0
- package/dist/components/HStack/HStack.mjs +97 -0
- package/dist/components/HStack/HStack.mjs.map +1 -0
- package/dist/components/HStack/index.d.mts +4 -0
- package/dist/components/HStack/index.d.ts +4 -0
- package/dist/components/HStack/index.js +39 -0
- package/dist/components/HStack/index.js.map +1 -0
- package/dist/components/HStack/index.mjs +5 -0
- package/dist/components/HStack/index.mjs.map +1 -0
- package/dist/components/NavBar/NavBar.context.d.mts +8 -0
- package/dist/components/NavBar/NavBar.context.d.ts +8 -0
- package/dist/components/NavBar/NavBar.context.js +44 -0
- package/dist/components/NavBar/NavBar.context.js.map +1 -0
- package/dist/components/NavBar/NavBar.context.mjs +17 -0
- package/dist/components/NavBar/NavBar.context.mjs.map +1 -0
- package/dist/components/NavBar/NavBar.d.mts +11 -0
- package/dist/components/NavBar/NavBar.d.ts +11 -0
- package/dist/components/NavBar/NavBar.js +81 -0
- package/dist/components/NavBar/NavBar.js.map +1 -0
- package/dist/components/NavBar/NavBar.mjs +63 -0
- package/dist/components/NavBar/NavBar.mjs.map +1 -0
- package/dist/components/NavBar/NavBarBrand.d.mts +9 -0
- package/dist/components/NavBar/NavBarBrand.d.ts +9 -0
- package/dist/components/NavBar/NavBarBrand.js +81 -0
- package/dist/components/NavBar/NavBarBrand.js.map +1 -0
- package/dist/components/NavBar/NavBarBrand.mjs +63 -0
- package/dist/components/NavBar/NavBarBrand.mjs.map +1 -0
- package/dist/components/NavBar/NavBarDropdown.d.mts +13 -0
- package/dist/components/NavBar/NavBarDropdown.d.ts +13 -0
- package/dist/components/NavBar/NavBarDropdown.js +102 -0
- package/dist/components/NavBar/NavBarDropdown.js.map +1 -0
- package/dist/components/NavBar/NavBarDropdown.mjs +87 -0
- package/dist/components/NavBar/NavBarDropdown.mjs.map +1 -0
- package/dist/components/NavBar/NavBarItem.d.mts +16 -0
- package/dist/components/NavBar/NavBarItem.d.ts +16 -0
- package/dist/components/NavBar/NavBarItem.js +93 -0
- package/dist/components/NavBar/NavBarItem.js.map +1 -0
- package/dist/components/NavBar/NavBarItem.mjs +75 -0
- package/dist/components/NavBar/NavBarItem.mjs.map +1 -0
- package/dist/components/NavBar/NavBarList.d.mts +11 -0
- package/dist/components/NavBar/NavBarList.d.ts +11 -0
- package/dist/components/NavBar/NavBarList.js +84 -0
- package/dist/components/NavBar/NavBarList.js.map +1 -0
- package/dist/components/NavBar/NavBarList.mjs +70 -0
- package/dist/components/NavBar/NavBarList.mjs.map +1 -0
- package/dist/components/NavBar/NavBarPreset.d.mts +26 -0
- package/dist/components/NavBar/NavBarPreset.d.ts +26 -0
- package/dist/components/NavBar/NavBarPreset.js +113 -0
- package/dist/components/NavBar/NavBarPreset.js.map +1 -0
- package/dist/components/NavBar/NavBarPreset.mjs +85 -0
- package/dist/components/NavBar/NavBarPreset.mjs.map +1 -0
- package/dist/components/NavBar/NavBarToggle.d.mts +13 -0
- package/dist/components/NavBar/NavBarToggle.d.ts +13 -0
- package/dist/components/NavBar/NavBarToggle.js +62 -0
- package/dist/components/NavBar/NavBarToggle.js.map +1 -0
- package/dist/components/NavBar/NavBarToggle.mjs +42 -0
- package/dist/components/NavBar/NavBarToggle.mjs.map +1 -0
- package/dist/components/NavBar/index.d.mts +10 -0
- package/dist/components/NavBar/index.d.ts +10 -0
- package/dist/components/NavBar/index.js +57 -0
- package/dist/components/NavBar/index.js.map +1 -0
- package/dist/components/NavBar/index.mjs +17 -0
- package/dist/components/NavBar/index.mjs.map +1 -0
- package/dist/components/Pill/Pill.d.mts +19 -0
- package/dist/components/Pill/Pill.d.ts +19 -0
- package/dist/components/Pill/Pill.js +117 -0
- package/dist/components/Pill/Pill.js.map +1 -0
- package/dist/components/Pill/Pill.mjs +99 -0
- package/dist/components/Pill/Pill.mjs.map +1 -0
- package/dist/components/Pill/index.d.mts +4 -0
- package/dist/components/Pill/index.d.ts +4 -0
- package/dist/components/Pill/index.js +39 -0
- package/dist/components/Pill/index.js.map +1 -0
- package/dist/components/Pill/index.mjs +5 -0
- package/dist/components/Pill/index.mjs.map +1 -0
- package/dist/components/SegmentedControl/SegmentedControl.d.mts +24 -0
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +24 -0
- package/dist/components/SegmentedControl/SegmentedControl.js +118 -0
- package/dist/components/SegmentedControl/SegmentedControl.js.map +1 -0
- package/dist/components/SegmentedControl/SegmentedControl.mjs +106 -0
- package/dist/components/SegmentedControl/SegmentedControl.mjs.map +1 -0
- package/dist/components/SegmentedControl/SegmentedControlContext.d.mts +12 -0
- package/dist/components/SegmentedControl/SegmentedControlContext.d.ts +12 -0
- package/dist/components/SegmentedControl/SegmentedControlContext.js +36 -0
- package/dist/components/SegmentedControl/SegmentedControlContext.js.map +1 -0
- package/dist/components/SegmentedControl/SegmentedControlContext.mjs +11 -0
- package/dist/components/SegmentedControl/SegmentedControlContext.mjs.map +1 -0
- package/dist/components/SegmentedControl/SegmentedControlItem.d.mts +14 -0
- package/dist/components/SegmentedControl/SegmentedControlItem.d.ts +14 -0
- package/dist/components/SegmentedControl/SegmentedControlItem.js +111 -0
- package/dist/components/SegmentedControl/SegmentedControlItem.js.map +1 -0
- package/dist/components/SegmentedControl/SegmentedControlItem.mjs +93 -0
- package/dist/components/SegmentedControl/SegmentedControlItem.mjs.map +1 -0
- package/dist/components/SegmentedControl/index.d.mts +5 -0
- package/dist/components/SegmentedControl/index.d.ts +5 -0
- package/dist/components/SegmentedControl/index.js +42 -0
- package/dist/components/SegmentedControl/index.js.map +1 -0
- package/dist/components/SegmentedControl/index.mjs +7 -0
- package/dist/components/SegmentedControl/index.mjs.map +1 -0
- package/dist/components/TabBar/TabBar.d.mts +11 -0
- package/dist/components/TabBar/TabBar.d.ts +11 -0
- package/dist/components/TabBar/TabBar.js +85 -0
- package/dist/components/TabBar/TabBar.js.map +1 -0
- package/dist/components/TabBar/TabBar.mjs +67 -0
- package/dist/components/TabBar/TabBar.mjs.map +1 -0
- package/dist/components/TabBar/TabBarItem.d.mts +15 -0
- package/dist/components/TabBar/TabBarItem.d.ts +15 -0
- package/dist/components/TabBar/TabBarItem.js +89 -0
- package/dist/components/TabBar/TabBarItem.js.map +1 -0
- package/dist/components/TabBar/TabBarItem.mjs +71 -0
- package/dist/components/TabBar/TabBarItem.mjs.map +1 -0
- package/dist/components/TabBar/TabBarItemIcon.d.mts +9 -0
- package/dist/components/TabBar/TabBarItemIcon.d.ts +9 -0
- package/dist/components/TabBar/TabBarItemIcon.js +80 -0
- package/dist/components/TabBar/TabBarItemIcon.js.map +1 -0
- package/dist/components/TabBar/TabBarItemIcon.mjs +62 -0
- package/dist/components/TabBar/TabBarItemIcon.mjs.map +1 -0
- package/dist/components/TabBar/TabBarItemLabel.d.mts +9 -0
- package/dist/components/TabBar/TabBarItemLabel.d.ts +9 -0
- package/dist/components/TabBar/TabBarItemLabel.js +80 -0
- package/dist/components/TabBar/TabBarItemLabel.js.map +1 -0
- package/dist/components/TabBar/TabBarItemLabel.mjs +62 -0
- package/dist/components/TabBar/TabBarItemLabel.mjs.map +1 -0
- package/dist/components/TabBar/TabBarPreset.d.mts +21 -0
- package/dist/components/TabBar/TabBarPreset.d.ts +21 -0
- package/dist/components/TabBar/TabBarPreset.js +80 -0
- package/dist/components/TabBar/TabBarPreset.js.map +1 -0
- package/dist/components/TabBar/TabBarPreset.mjs +52 -0
- package/dist/components/TabBar/TabBarPreset.mjs.map +1 -0
- package/dist/components/TabBar/index.d.mts +8 -0
- package/dist/components/TabBar/index.d.ts +8 -0
- package/dist/components/TabBar/index.js +51 -0
- package/dist/components/TabBar/index.js.map +1 -0
- package/dist/components/TabBar/index.mjs +13 -0
- package/dist/components/TabBar/index.mjs.map +1 -0
- package/dist/components/VStack/VStack.d.mts +12 -0
- package/dist/components/VStack/VStack.d.ts +12 -0
- package/dist/components/VStack/VStack.js +95 -0
- package/dist/components/VStack/VStack.js.map +1 -0
- package/dist/components/VStack/VStack.mjs +81 -0
- package/dist/components/VStack/VStack.mjs.map +1 -0
- package/dist/components/VStack/index.d.mts +4 -0
- package/dist/components/VStack/index.d.ts +4 -0
- package/dist/components/VStack/index.js +39 -0
- package/dist/components/VStack/index.js.map +1 -0
- package/dist/components/VStack/index.mjs +5 -0
- package/dist/components/VStack/index.mjs.map +1 -0
- package/dist/components/index.d.mts +34 -0
- package/dist/components/index.d.ts +34 -0
- package/dist/components/index.js +45 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/index.mjs +13 -0
- package/dist/components/index.mjs.map +1 -0
- package/dist/core/Base/Base.d.mts +28 -0
- package/dist/core/Base/Base.d.ts +28 -0
- package/dist/core/Base/Base.js +127 -0
- package/dist/core/Base/Base.js.map +1 -0
- package/dist/core/Base/Base.mjs +112 -0
- package/dist/core/Base/Base.mjs.map +1 -0
- package/dist/core/Base/index.d.mts +3 -0
- package/dist/core/Base/index.d.ts +3 -0
- package/dist/core/Base/index.js +39 -0
- package/dist/core/Base/index.js.map +1 -0
- package/dist/core/Base/index.mjs +5 -0
- package/dist/core/Base/index.mjs.map +1 -0
- package/dist/core/Breakpoint/BreakpointType.d.mts +12 -0
- package/dist/core/Breakpoint/BreakpointType.d.ts +12 -0
- package/dist/core/Breakpoint/BreakpointType.js +17 -0
- package/dist/core/Breakpoint/BreakpointType.js.map +1 -0
- package/dist/core/Breakpoint/BreakpointType.mjs +1 -0
- package/dist/core/Breakpoint/BreakpointType.mjs.map +1 -0
- package/dist/core/Breakpoint/index.d.mts +2 -0
- package/dist/core/Breakpoint/index.d.ts +2 -0
- package/dist/core/Breakpoint/index.js +23 -0
- package/dist/core/Breakpoint/index.js.map +1 -0
- package/dist/core/Breakpoint/index.mjs +2 -0
- package/dist/core/Breakpoint/index.mjs.map +1 -0
- package/dist/core/Breakpoint/resolveResponsiveVars.d.mts +8 -0
- package/dist/core/Breakpoint/resolveResponsiveVars.d.ts +8 -0
- package/dist/core/Breakpoint/resolveResponsiveVars.js +81 -0
- package/dist/core/Breakpoint/resolveResponsiveVars.js.map +1 -0
- package/dist/core/Breakpoint/resolveResponsiveVars.mjs +57 -0
- package/dist/core/Breakpoint/resolveResponsiveVars.mjs.map +1 -0
- package/dist/core/Show/ShowAbove.d.mts +13 -0
- package/dist/core/Show/ShowAbove.d.ts +13 -0
- package/dist/core/Show/ShowAbove.js +33 -0
- package/dist/core/Show/ShowAbove.js.map +1 -0
- package/dist/core/Show/ShowAbove.mjs +13 -0
- package/dist/core/Show/ShowAbove.mjs.map +1 -0
- package/dist/core/Show/ShowBelow.d.mts +13 -0
- package/dist/core/Show/ShowBelow.d.ts +13 -0
- package/dist/core/Show/ShowBelow.js +33 -0
- package/dist/core/Show/ShowBelow.js.map +1 -0
- package/dist/core/Show/ShowBelow.mjs +13 -0
- package/dist/core/Show/ShowBelow.mjs.map +1 -0
- package/dist/core/Show/index.d.mts +4 -0
- package/dist/core/Show/index.d.ts +4 -0
- package/dist/core/Show/index.js +42 -0
- package/dist/core/Show/index.js.map +1 -0
- package/dist/core/Show/index.mjs +7 -0
- package/dist/core/Show/index.mjs.map +1 -0
- package/dist/core/Show/visibility.d.mts +9 -0
- package/dist/core/Show/visibility.d.ts +9 -0
- package/dist/core/Show/visibility.js +86 -0
- package/dist/core/Show/visibility.js.map +1 -0
- package/dist/core/Show/visibility.mjs +67 -0
- package/dist/core/Show/visibility.mjs.map +1 -0
- package/dist/core/SrOnly/SrOnly.d.mts +25 -0
- package/dist/core/SrOnly/SrOnly.d.ts +25 -0
- package/dist/core/SrOnly/SrOnly.js +91 -0
- package/dist/core/SrOnly/SrOnly.js.map +1 -0
- package/dist/core/SrOnly/SrOnly.mjs +71 -0
- package/dist/core/SrOnly/SrOnly.mjs.map +1 -0
- package/dist/core/SrOnly/index.d.mts +3 -0
- package/dist/core/SrOnly/index.d.ts +3 -0
- package/dist/core/SrOnly/index.js +33 -0
- package/dist/core/SrOnly/index.js.map +1 -0
- package/dist/core/SrOnly/index.mjs +7 -0
- package/dist/core/SrOnly/index.mjs.map +1 -0
- package/dist/core/Typography/Heading.d.mts +13 -0
- package/dist/core/Typography/Heading.d.ts +13 -0
- package/dist/core/Typography/Heading.js +79 -0
- package/dist/core/Typography/Heading.js.map +1 -0
- package/dist/core/Typography/Heading.mjs +61 -0
- package/dist/core/Typography/Heading.mjs.map +1 -0
- package/dist/core/Typography/Text.d.mts +14 -0
- package/dist/core/Typography/Text.d.ts +14 -0
- package/dist/core/Typography/Text.js +73 -0
- package/dist/core/Typography/Text.js.map +1 -0
- package/dist/core/Typography/Text.mjs +55 -0
- package/dist/core/Typography/Text.mjs.map +1 -0
- package/dist/core/Typography/index.d.mts +5 -0
- package/dist/core/Typography/index.d.ts +5 -0
- package/dist/core/Typography/index.js +42 -0
- package/dist/core/Typography/index.js.map +1 -0
- package/dist/core/Typography/index.mjs +7 -0
- package/dist/core/Typography/index.mjs.map +1 -0
- package/dist/core/index.d.mts +10 -0
- package/dist/core/index.d.ts +10 -0
- package/dist/core/index.js +31 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/index.mjs +6 -0
- package/dist/core/index.mjs.map +1 -0
- package/dist/index.d.mts +43 -0
- package/dist/index.d.ts +43 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +5 -0
- package/dist/index.mjs.map +1 -0
- package/dist/styles.css +2680 -0
- package/dist/types/LightDark.types.d.mts +6 -0
- package/dist/types/LightDark.types.d.ts +6 -0
- package/dist/types/LightDark.types.js +17 -0
- package/dist/types/LightDark.types.js.map +1 -0
- package/dist/types/LightDark.types.mjs +1 -0
- package/dist/types/LightDark.types.mjs.map +1 -0
- package/dist/types/index.d.mts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +17 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/index.mjs +1 -0
- package/dist/types/index.mjs.map +1 -0
- package/dist/utils/PropToValue.d.mts +3 -0
- package/dist/utils/PropToValue.d.ts +3 -0
- package/dist/utils/PropToValue.js +36 -0
- package/dist/utils/PropToValue.js.map +1 -0
- package/dist/utils/PropToValue.mjs +12 -0
- package/dist/utils/PropToValue.mjs.map +1 -0
- package/dist/utils/index.d.mts +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +23 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/index.mjs +2 -0
- package/dist/utils/index.mjs.map +1 -0
- package/package.json +52 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __spreadValues = (a, b) => {
|
|
12
|
+
for (var prop in b || (b = {}))
|
|
13
|
+
if (__hasOwnProp.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
if (__getOwnPropSymbols)
|
|
16
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
+
if (__propIsEnum.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
}
|
|
20
|
+
return a;
|
|
21
|
+
};
|
|
22
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
|
+
var __objRest = (source, exclude) => {
|
|
24
|
+
var target = {};
|
|
25
|
+
for (var prop in source)
|
|
26
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
27
|
+
target[prop] = source[prop];
|
|
28
|
+
if (source != null && __getOwnPropSymbols)
|
|
29
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
30
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
31
|
+
target[prop] = source[prop];
|
|
32
|
+
}
|
|
33
|
+
return target;
|
|
34
|
+
};
|
|
35
|
+
var __export = (target, all) => {
|
|
36
|
+
for (var name in all)
|
|
37
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
38
|
+
};
|
|
39
|
+
var __copyProps = (to, from, except, desc) => {
|
|
40
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
41
|
+
for (let key of __getOwnPropNames(from))
|
|
42
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
43
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
44
|
+
}
|
|
45
|
+
return to;
|
|
46
|
+
};
|
|
47
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
48
|
+
var Pill_exports = {};
|
|
49
|
+
__export(Pill_exports, {
|
|
50
|
+
default: () => Pill
|
|
51
|
+
});
|
|
52
|
+
module.exports = __toCommonJS(Pill_exports);
|
|
53
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
54
|
+
var import__ = require("../../index");
|
|
55
|
+
function DismissIcon() {
|
|
56
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { viewBox: "0 0 12 12", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
57
|
+
"path",
|
|
58
|
+
{
|
|
59
|
+
d: "M2 2l8 8M10 2l-8 8",
|
|
60
|
+
stroke: "currentColor",
|
|
61
|
+
strokeWidth: "1.5",
|
|
62
|
+
strokeLinecap: "round"
|
|
63
|
+
}
|
|
64
|
+
) });
|
|
65
|
+
}
|
|
66
|
+
function Pill(_a) {
|
|
67
|
+
var _b = _a, {
|
|
68
|
+
color = "neutral",
|
|
69
|
+
variant = "soft",
|
|
70
|
+
size = "md",
|
|
71
|
+
icon,
|
|
72
|
+
onDismiss,
|
|
73
|
+
dismissLabel,
|
|
74
|
+
children,
|
|
75
|
+
className,
|
|
76
|
+
style
|
|
77
|
+
} = _b, props = __objRest(_b, [
|
|
78
|
+
"color",
|
|
79
|
+
"variant",
|
|
80
|
+
"size",
|
|
81
|
+
"icon",
|
|
82
|
+
"onDismiss",
|
|
83
|
+
"dismissLabel",
|
|
84
|
+
"children",
|
|
85
|
+
"className",
|
|
86
|
+
"style"
|
|
87
|
+
]);
|
|
88
|
+
let pillClassName = `ck-pill ck-pill--${size} ck-pill--${color} ck-pill--${variant}`;
|
|
89
|
+
if (className) {
|
|
90
|
+
pillClassName += ` ${className}`;
|
|
91
|
+
}
|
|
92
|
+
const styles = __spreadValues({}, style);
|
|
93
|
+
const resolvedDismissLabel = dismissLabel != null ? dismissLabel : typeof children === "string" ? `Retirer ${children}` : "Retirer";
|
|
94
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
95
|
+
import__.Base,
|
|
96
|
+
__spreadProps(__spreadValues({}, props), {
|
|
97
|
+
as: "span",
|
|
98
|
+
className: pillClassName,
|
|
99
|
+
style: styles,
|
|
100
|
+
children: [
|
|
101
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "ck-pill__icon", "aria-hidden": "true", children: icon }),
|
|
102
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "ck-pill__label", children }),
|
|
103
|
+
onDismiss && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
104
|
+
"button",
|
|
105
|
+
{
|
|
106
|
+
type: "button",
|
|
107
|
+
className: "ck-pill__dismiss",
|
|
108
|
+
onClick: onDismiss,
|
|
109
|
+
"aria-label": resolvedDismissLabel,
|
|
110
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DismissIcon, {})
|
|
111
|
+
}
|
|
112
|
+
)
|
|
113
|
+
]
|
|
114
|
+
})
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=Pill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../lib/components/Pill/Pill.tsx"],"sourcesContent":["import { CSSProperties, ElementType, ReactNode } from \"react\";\nimport { Base, BaseProps } from \"../../index\";\n\nexport type PillColor =\n | \"primary\"\n | \"secondary\"\n | \"neutral\"\n | \"success\"\n | \"warning\"\n | \"danger\"\n | \"info\";\nexport type PillVariant = \"solid\" | \"soft\" | \"outline\" | \"subtle\";\nexport type PillSize = \"sm\" | \"md\" | \"lg\";\n\nexport type PillProps<T extends ElementType = \"div\"> = BaseProps<T> & {\n color?: PillColor;\n variant?: PillVariant;\n size?: PillSize;\n icon?: ReactNode;\n onDismiss?: () => void;\n dismissLabel?: string;\n};\n\nfunction DismissIcon() {\n return (\n <svg viewBox=\"0 0 12 12\" fill=\"none\" aria-hidden=\"true\">\n <path\n d=\"M2 2l8 8M10 2l-8 8\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n />\n </svg>\n );\n}\n\nexport default function Pill<T extends ElementType = \"div\">({\n color = \"neutral\",\n variant = \"soft\",\n size = \"md\",\n icon,\n onDismiss,\n dismissLabel,\n children,\n className,\n style,\n ...props\n}: PillProps<T>) {\n let pillClassName = `ck-pill ck-pill--${size} ck-pill--${color} ck-pill--${variant}`;\n if (className) {\n pillClassName += ` ${className}`;\n }\n\n const styles = { ...style } as CSSProperties;\n const resolvedDismissLabel =\n dismissLabel ??\n (typeof children === \"string\" ? `Retirer ${children}` : \"Retirer\");\n\n return (\n <Base\n {...(props as BaseProps<T>)}\n as=\"span\"\n className={pillClassName}\n style={styles}\n >\n {icon && (\n <span className=\"ck-pill__icon\" aria-hidden=\"true\">\n {icon}\n </span>\n )}\n <span className=\"ck-pill__label\">{children}</span>\n {onDismiss && (\n <button\n type=\"button\"\n className=\"ck-pill__dismiss\"\n onClick={onDismiss}\n aria-label={resolvedDismissLabel}\n >\n <DismissIcon />\n </button>\n )}\n </Base>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA0BM;AAzBN,eAAgC;AAsBhC,SAAS,cAAc;AACrB,SACE,4CAAC,SAAI,SAAQ,aAAY,MAAK,QAAO,eAAY,QAC/C;AAAA,IAAC;AAAA;AAAA,MACC,GAAE;AAAA,MACF,QAAO;AAAA,MACP,aAAY;AAAA,MACZ,eAAc;AAAA;AAAA,EAChB,GACF;AAEJ;AAEe,SAAR,KAAqD,IAW3C;AAX2C,eAC1D;AAAA,YAAQ;AAAA,IACR,UAAU;AAAA,IACV,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EA7CF,IAoC4D,IAUvD,kBAVuD,IAUvD;AAAA,IATH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAGA,MAAI,gBAAgB,oBAAoB,IAAI,aAAa,KAAK,aAAa,OAAO;AAClF,MAAI,WAAW;AACb,qBAAiB,IAAI,SAAS;AAAA,EAChC;AAEA,QAAM,SAAS,mBAAK;AACpB,QAAM,uBACJ,sCACC,OAAO,aAAa,WAAW,WAAW,QAAQ,KAAK;AAE1D,SACE;AAAA,IAAC;AAAA,qCACM,QADN;AAAA,MAEC,IAAG;AAAA,MACH,WAAW;AAAA,MACX,OAAO;AAAA,MAEN;AAAA,gBACC,4CAAC,UAAK,WAAU,iBAAgB,eAAY,QACzC,gBACH;AAAA,QAEF,4CAAC,UAAK,WAAU,kBAAkB,UAAS;AAAA,QAC1C,aACC;AAAA,UAAC;AAAA;AAAA,YACC,MAAK;AAAA,YACL,WAAU;AAAA,YACV,SAAS;AAAA,YACT,cAAY;AAAA,YAEZ,sDAAC,eAAY;AAAA;AAAA,QACf;AAAA;AAAA;AAAA,EAEJ;AAEJ;","names":[]}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
33
|
+
import { Base } from "../../index";
|
|
34
|
+
function DismissIcon() {
|
|
35
|
+
return /* @__PURE__ */ jsx("svg", { viewBox: "0 0 12 12", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx(
|
|
36
|
+
"path",
|
|
37
|
+
{
|
|
38
|
+
d: "M2 2l8 8M10 2l-8 8",
|
|
39
|
+
stroke: "currentColor",
|
|
40
|
+
strokeWidth: "1.5",
|
|
41
|
+
strokeLinecap: "round"
|
|
42
|
+
}
|
|
43
|
+
) });
|
|
44
|
+
}
|
|
45
|
+
function Pill(_a) {
|
|
46
|
+
var _b = _a, {
|
|
47
|
+
color = "neutral",
|
|
48
|
+
variant = "soft",
|
|
49
|
+
size = "md",
|
|
50
|
+
icon,
|
|
51
|
+
onDismiss,
|
|
52
|
+
dismissLabel,
|
|
53
|
+
children,
|
|
54
|
+
className,
|
|
55
|
+
style
|
|
56
|
+
} = _b, props = __objRest(_b, [
|
|
57
|
+
"color",
|
|
58
|
+
"variant",
|
|
59
|
+
"size",
|
|
60
|
+
"icon",
|
|
61
|
+
"onDismiss",
|
|
62
|
+
"dismissLabel",
|
|
63
|
+
"children",
|
|
64
|
+
"className",
|
|
65
|
+
"style"
|
|
66
|
+
]);
|
|
67
|
+
let pillClassName = `ck-pill ck-pill--${size} ck-pill--${color} ck-pill--${variant}`;
|
|
68
|
+
if (className) {
|
|
69
|
+
pillClassName += ` ${className}`;
|
|
70
|
+
}
|
|
71
|
+
const styles = __spreadValues({}, style);
|
|
72
|
+
const resolvedDismissLabel = dismissLabel != null ? dismissLabel : typeof children === "string" ? `Retirer ${children}` : "Retirer";
|
|
73
|
+
return /* @__PURE__ */ jsxs(
|
|
74
|
+
Base,
|
|
75
|
+
__spreadProps(__spreadValues({}, props), {
|
|
76
|
+
as: "span",
|
|
77
|
+
className: pillClassName,
|
|
78
|
+
style: styles,
|
|
79
|
+
children: [
|
|
80
|
+
icon && /* @__PURE__ */ jsx("span", { className: "ck-pill__icon", "aria-hidden": "true", children: icon }),
|
|
81
|
+
/* @__PURE__ */ jsx("span", { className: "ck-pill__label", children }),
|
|
82
|
+
onDismiss && /* @__PURE__ */ jsx(
|
|
83
|
+
"button",
|
|
84
|
+
{
|
|
85
|
+
type: "button",
|
|
86
|
+
className: "ck-pill__dismiss",
|
|
87
|
+
onClick: onDismiss,
|
|
88
|
+
"aria-label": resolvedDismissLabel,
|
|
89
|
+
children: /* @__PURE__ */ jsx(DismissIcon, {})
|
|
90
|
+
}
|
|
91
|
+
)
|
|
92
|
+
]
|
|
93
|
+
})
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
export {
|
|
97
|
+
Pill as default
|
|
98
|
+
};
|
|
99
|
+
//# sourceMappingURL=Pill.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../lib/components/Pill/Pill.tsx"],"sourcesContent":["import { CSSProperties, ElementType, ReactNode } from \"react\";\nimport { Base, BaseProps } from \"../../index\";\n\nexport type PillColor =\n | \"primary\"\n | \"secondary\"\n | \"neutral\"\n | \"success\"\n | \"warning\"\n | \"danger\"\n | \"info\";\nexport type PillVariant = \"solid\" | \"soft\" | \"outline\" | \"subtle\";\nexport type PillSize = \"sm\" | \"md\" | \"lg\";\n\nexport type PillProps<T extends ElementType = \"div\"> = BaseProps<T> & {\n color?: PillColor;\n variant?: PillVariant;\n size?: PillSize;\n icon?: ReactNode;\n onDismiss?: () => void;\n dismissLabel?: string;\n};\n\nfunction DismissIcon() {\n return (\n <svg viewBox=\"0 0 12 12\" fill=\"none\" aria-hidden=\"true\">\n <path\n d=\"M2 2l8 8M10 2l-8 8\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n />\n </svg>\n );\n}\n\nexport default function Pill<T extends ElementType = \"div\">({\n color = \"neutral\",\n variant = \"soft\",\n size = \"md\",\n icon,\n onDismiss,\n dismissLabel,\n children,\n className,\n style,\n ...props\n}: PillProps<T>) {\n let pillClassName = `ck-pill ck-pill--${size} ck-pill--${color} ck-pill--${variant}`;\n if (className) {\n pillClassName += ` ${className}`;\n }\n\n const styles = { ...style } as CSSProperties;\n const resolvedDismissLabel =\n dismissLabel ??\n (typeof children === \"string\" ? `Retirer ${children}` : \"Retirer\");\n\n return (\n <Base\n {...(props as BaseProps<T>)}\n as=\"span\"\n className={pillClassName}\n style={styles}\n >\n {icon && (\n <span className=\"ck-pill__icon\" aria-hidden=\"true\">\n {icon}\n </span>\n )}\n <span className=\"ck-pill__label\">{children}</span>\n {onDismiss && (\n <button\n type=\"button\"\n className=\"ck-pill__dismiss\"\n onClick={onDismiss}\n aria-label={resolvedDismissLabel}\n >\n <DismissIcon />\n </button>\n )}\n </Base>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BM,cAiCF,YAjCE;AAzBN,SAAS,YAAuB;AAsBhC,SAAS,cAAc;AACrB,SACE,oBAAC,SAAI,SAAQ,aAAY,MAAK,QAAO,eAAY,QAC/C;AAAA,IAAC;AAAA;AAAA,MACC,GAAE;AAAA,MACF,QAAO;AAAA,MACP,aAAY;AAAA,MACZ,eAAc;AAAA;AAAA,EAChB,GACF;AAEJ;AAEe,SAAR,KAAqD,IAW3C;AAX2C,eAC1D;AAAA,YAAQ;AAAA,IACR,UAAU;AAAA,IACV,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EA7CF,IAoC4D,IAUvD,kBAVuD,IAUvD;AAAA,IATH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAGA,MAAI,gBAAgB,oBAAoB,IAAI,aAAa,KAAK,aAAa,OAAO;AAClF,MAAI,WAAW;AACb,qBAAiB,IAAI,SAAS;AAAA,EAChC;AAEA,QAAM,SAAS,mBAAK;AACpB,QAAM,uBACJ,sCACC,OAAO,aAAa,WAAW,WAAW,QAAQ,KAAK;AAE1D,SACE;AAAA,IAAC;AAAA,qCACM,QADN;AAAA,MAEC,IAAG;AAAA,MACH,WAAW;AAAA,MACX,OAAO;AAAA,MAEN;AAAA,gBACC,oBAAC,UAAK,WAAU,iBAAgB,eAAY,QACzC,gBACH;AAAA,QAEF,oBAAC,UAAK,WAAU,kBAAkB,UAAS;AAAA,QAC1C,aACC;AAAA,UAAC;AAAA;AAAA,YACC,MAAK;AAAA,YACL,WAAU;AAAA,YACV,SAAS;AAAA,YACT,cAAY;AAAA,YAEZ,8BAAC,eAAY;AAAA;AAAA,QACf;AAAA;AAAA;AAAA,EAEJ;AAEJ;","names":[]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var Pill_exports = {};
|
|
30
|
+
__export(Pill_exports, {
|
|
31
|
+
Pill: () => import_Pill.default
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(Pill_exports);
|
|
34
|
+
var import_Pill = __toESM(require("./Pill"));
|
|
35
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
+
0 && (module.exports = {
|
|
37
|
+
Pill
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../lib/components/Pill/index.ts"],"sourcesContent":["export { default as Pill } from \"./Pill\";\nexport type { PillProps, PillColor, PillVariant, PillSize } from \"./Pill\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAgC;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../lib/components/Pill/index.ts"],"sourcesContent":["export { default as Pill } from \"./Pill\";\nexport type { PillProps, PillColor, PillVariant, PillSize } from \"./Pill\";\n"],"mappings":"AAAA,SAAoB,WAAXA,gBAAuB;","names":["default"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ElementType, ReactNode } from 'react';
|
|
3
|
+
import { BaseProps } from '../../core/Base/Base.mjs';
|
|
4
|
+
import '../../core/Breakpoint/BreakpointType.mjs';
|
|
5
|
+
|
|
6
|
+
type SingleProps = {
|
|
7
|
+
type?: "single";
|
|
8
|
+
value?: string;
|
|
9
|
+
defaultValue?: string;
|
|
10
|
+
onValueChange?: (value: string) => void;
|
|
11
|
+
};
|
|
12
|
+
type MultipleProps = {
|
|
13
|
+
type: "multiple";
|
|
14
|
+
value?: string[];
|
|
15
|
+
defaultValue?: string[];
|
|
16
|
+
onValueChange?: (value: string[]) => void;
|
|
17
|
+
};
|
|
18
|
+
type SegmentedControlProps<T extends ElementType = "div"> = BaseProps<T> & {
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
children?: ReactNode;
|
|
21
|
+
} & (SingleProps | MultipleProps);
|
|
22
|
+
declare function SegmentedControl<T extends ElementType = "div">({ type, value, defaultValue, onValueChange, disabled, children, className, ...props }: SegmentedControlProps<T>): react.JSX.Element;
|
|
23
|
+
|
|
24
|
+
export { type SegmentedControlProps, SegmentedControl as default };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ElementType, ReactNode } from 'react';
|
|
3
|
+
import { BaseProps } from '../../core/Base/Base.js';
|
|
4
|
+
import '../../core/Breakpoint/BreakpointType.js';
|
|
5
|
+
|
|
6
|
+
type SingleProps = {
|
|
7
|
+
type?: "single";
|
|
8
|
+
value?: string;
|
|
9
|
+
defaultValue?: string;
|
|
10
|
+
onValueChange?: (value: string) => void;
|
|
11
|
+
};
|
|
12
|
+
type MultipleProps = {
|
|
13
|
+
type: "multiple";
|
|
14
|
+
value?: string[];
|
|
15
|
+
defaultValue?: string[];
|
|
16
|
+
onValueChange?: (value: string[]) => void;
|
|
17
|
+
};
|
|
18
|
+
type SegmentedControlProps<T extends ElementType = "div"> = BaseProps<T> & {
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
children?: ReactNode;
|
|
21
|
+
} & (SingleProps | MultipleProps);
|
|
22
|
+
declare function SegmentedControl<T extends ElementType = "div">({ type, value, defaultValue, onValueChange, disabled, children, className, ...props }: SegmentedControlProps<T>): react.JSX.Element;
|
|
23
|
+
|
|
24
|
+
export { type SegmentedControlProps, SegmentedControl as default };
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __defProps = Object.defineProperties;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __objRest = (source, exclude) => {
|
|
25
|
+
var target = {};
|
|
26
|
+
for (var prop in source)
|
|
27
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
if (source != null && __getOwnPropSymbols)
|
|
30
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
31
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
32
|
+
target[prop] = source[prop];
|
|
33
|
+
}
|
|
34
|
+
return target;
|
|
35
|
+
};
|
|
36
|
+
var __export = (target, all) => {
|
|
37
|
+
for (var name in all)
|
|
38
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
39
|
+
};
|
|
40
|
+
var __copyProps = (to, from, except, desc) => {
|
|
41
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
42
|
+
for (let key of __getOwnPropNames(from))
|
|
43
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
44
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
45
|
+
}
|
|
46
|
+
return to;
|
|
47
|
+
};
|
|
48
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
49
|
+
var SegmentedControl_exports = {};
|
|
50
|
+
__export(SegmentedControl_exports, {
|
|
51
|
+
default: () => SegmentedControl
|
|
52
|
+
});
|
|
53
|
+
module.exports = __toCommonJS(SegmentedControl_exports);
|
|
54
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
55
|
+
var import_react = require("react");
|
|
56
|
+
var import_Base = require("../../core/Base");
|
|
57
|
+
var import_SegmentedControlContext = require("./SegmentedControlContext");
|
|
58
|
+
const BaseAny = import_Base.Base;
|
|
59
|
+
function SegmentedControl(_a) {
|
|
60
|
+
var _b = _a, {
|
|
61
|
+
type = "single",
|
|
62
|
+
value,
|
|
63
|
+
defaultValue,
|
|
64
|
+
onValueChange,
|
|
65
|
+
disabled = false,
|
|
66
|
+
children,
|
|
67
|
+
className
|
|
68
|
+
} = _b, props = __objRest(_b, [
|
|
69
|
+
"type",
|
|
70
|
+
"value",
|
|
71
|
+
"defaultValue",
|
|
72
|
+
"onValueChange",
|
|
73
|
+
"disabled",
|
|
74
|
+
"children",
|
|
75
|
+
"className"
|
|
76
|
+
]);
|
|
77
|
+
const isControlled = value !== void 0;
|
|
78
|
+
const [internalValue, setInternalValue] = (0, import_react.useState)(() => {
|
|
79
|
+
if (defaultValue === void 0) return [];
|
|
80
|
+
return Array.isArray(defaultValue) ? defaultValue : [defaultValue];
|
|
81
|
+
});
|
|
82
|
+
const normalizedValue = (0, import_react.useMemo)(() => {
|
|
83
|
+
const current = isControlled ? value : internalValue;
|
|
84
|
+
if (current === void 0) return [];
|
|
85
|
+
return Array.isArray(current) ? current : [current];
|
|
86
|
+
}, [isControlled, value, internalValue]);
|
|
87
|
+
const handleToggle = (0, import_react.useCallback)(
|
|
88
|
+
(itemValue) => {
|
|
89
|
+
var _a2;
|
|
90
|
+
const next = type === "multiple" ? normalizedValue.includes(itemValue) ? normalizedValue.filter((v) => v !== itemValue) : [...normalizedValue, itemValue] : normalizedValue.includes(itemValue) ? [] : [itemValue];
|
|
91
|
+
if (!isControlled) {
|
|
92
|
+
setInternalValue(next);
|
|
93
|
+
}
|
|
94
|
+
if (type === "multiple") {
|
|
95
|
+
onValueChange == null ? void 0 : onValueChange(next);
|
|
96
|
+
} else {
|
|
97
|
+
onValueChange == null ? void 0 : onValueChange(
|
|
98
|
+
(_a2 = next[0]) != null ? _a2 : ""
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
[isControlled, normalizedValue, onValueChange, type]
|
|
103
|
+
);
|
|
104
|
+
const contextValue = (0, import_react.useMemo)(
|
|
105
|
+
() => ({ type, value: normalizedValue, onToggle: handleToggle, disabled }),
|
|
106
|
+
[type, normalizedValue, handleToggle, disabled]
|
|
107
|
+
);
|
|
108
|
+
const groupClassName = className ? `ck-segmented-control ${className}` : "ck-segmented-control";
|
|
109
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_SegmentedControlContext.SegmentedControlContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
110
|
+
BaseAny,
|
|
111
|
+
__spreadProps(__spreadValues({}, props), {
|
|
112
|
+
role: type === "multiple" ? "group" : "radiogroup",
|
|
113
|
+
className: groupClassName,
|
|
114
|
+
children
|
|
115
|
+
})
|
|
116
|
+
) });
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=SegmentedControl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../lib/components/SegmentedControl/SegmentedControl.tsx"],"sourcesContent":["\"use client\";\nimport {\n ComponentType,\n ElementType,\n ReactNode,\n useCallback,\n useMemo,\n useState,\n} from \"react\";\nimport { Base, BaseProps } from \"../../core/Base\";\nimport {\n SegmentedControlContext,\n SegmentedControlContextValue,\n} from \"./SegmentedControlContext\";\n\ntype SingleProps = {\n type?: \"single\";\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n};\n\ntype MultipleProps = {\n type: \"multiple\";\n value?: string[];\n defaultValue?: string[];\n onValueChange?: (value: string[]) => void;\n};\n\nexport type SegmentedControlProps<T extends ElementType = \"div\"> =\n BaseProps<T> & {\n disabled?: boolean;\n children?: ReactNode;\n } & (SingleProps | MultipleProps);\n\nconst BaseAny = Base as unknown as ComponentType<Record<string, unknown>>;\n\nexport default function SegmentedControl<T extends ElementType = \"div\">({\n type = \"single\",\n value,\n defaultValue,\n onValueChange,\n disabled = false,\n children,\n className,\n ...props\n}: SegmentedControlProps<T>) {\n const isControlled = value !== undefined;\n\n const [internalValue, setInternalValue] = useState<string[]>(() => {\n if (defaultValue === undefined) return [];\n return Array.isArray(defaultValue) ? defaultValue : [defaultValue];\n });\n\n const normalizedValue = useMemo<string[]>(() => {\n const current = isControlled ? value : internalValue;\n if (current === undefined) return [];\n return Array.isArray(current) ? current : [current];\n }, [isControlled, value, internalValue]);\n\n const handleToggle = useCallback(\n (itemValue: string) => {\n const next =\n type === \"multiple\"\n ? normalizedValue.includes(itemValue)\n ? normalizedValue.filter((v) => v !== itemValue)\n : [...normalizedValue, itemValue]\n : normalizedValue.includes(itemValue)\n ? []\n : [itemValue];\n\n if (!isControlled) {\n setInternalValue(next);\n }\n\n if (type === \"multiple\") {\n (onValueChange as ((value: string[]) => void) | undefined)?.(next);\n } else {\n (onValueChange as ((value: string) => void) | undefined)?.(\n next[0] ?? \"\",\n );\n }\n },\n [isControlled, normalizedValue, onValueChange, type],\n );\n\n const contextValue: SegmentedControlContextValue = useMemo(\n () => ({ type, value: normalizedValue, onToggle: handleToggle, disabled }),\n [type, normalizedValue, handleToggle, disabled],\n );\n\n const groupClassName = className\n ? `ck-segmented-control ${className}`\n : \"ck-segmented-control\";\n\n return (\n <SegmentedControlContext.Provider value={contextValue}>\n <BaseAny\n {...props}\n role={type === \"multiple\" ? \"group\" : \"radiogroup\"}\n className={groupClassName}\n >\n {children}\n </BaseAny>\n </SegmentedControlContext.Provider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAiGM;AAhGN,mBAOO;AACP,kBAAgC;AAChC,qCAGO;AAsBP,MAAM,UAAU;AAED,SAAR,iBAAiE,IAS3C;AAT2C,eACtE;AAAA,WAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX;AAAA,IACA;AAAA,EA5CF,IAqCwE,IAQnE,kBARmE,IAQnE;AAAA,IAPH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAGA,QAAM,eAAe,UAAU;AAE/B,QAAM,CAAC,eAAe,gBAAgB,QAAI,uBAAmB,MAAM;AACjE,QAAI,iBAAiB,OAAW,QAAO,CAAC;AACxC,WAAO,MAAM,QAAQ,YAAY,IAAI,eAAe,CAAC,YAAY;AAAA,EACnE,CAAC;AAED,QAAM,sBAAkB,sBAAkB,MAAM;AAC9C,UAAM,UAAU,eAAe,QAAQ;AACvC,QAAI,YAAY,OAAW,QAAO,CAAC;AACnC,WAAO,MAAM,QAAQ,OAAO,IAAI,UAAU,CAAC,OAAO;AAAA,EACpD,GAAG,CAAC,cAAc,OAAO,aAAa,CAAC;AAEvC,QAAM,mBAAe;AAAA,IACnB,CAAC,cAAsB;AA7D3B,UAAAA;AA8DM,YAAM,OACJ,SAAS,aACL,gBAAgB,SAAS,SAAS,IAChC,gBAAgB,OAAO,CAAC,MAAM,MAAM,SAAS,IAC7C,CAAC,GAAG,iBAAiB,SAAS,IAChC,gBAAgB,SAAS,SAAS,IAChC,CAAC,IACD,CAAC,SAAS;AAElB,UAAI,CAAC,cAAc;AACjB,yBAAiB,IAAI;AAAA,MACvB;AAEA,UAAI,SAAS,YAAY;AACvB,QAAC,+CAA4D;AAAA,MAC/D,OAAO;AACL,QAAC;AAAA,WACCA,MAAA,KAAK,CAAC,MAAN,OAAAA,MAAW;AAAA;AAAA,MAEf;AAAA,IACF;AAAA,IACA,CAAC,cAAc,iBAAiB,eAAe,IAAI;AAAA,EACrD;AAEA,QAAM,mBAA6C;AAAA,IACjD,OAAO,EAAE,MAAM,OAAO,iBAAiB,UAAU,cAAc,SAAS;AAAA,IACxE,CAAC,MAAM,iBAAiB,cAAc,QAAQ;AAAA,EAChD;AAEA,QAAM,iBAAiB,YACnB,wBAAwB,SAAS,KACjC;AAEJ,SACE,4CAAC,uDAAwB,UAAxB,EAAiC,OAAO,cACvC;AAAA,IAAC;AAAA,qCACK,QADL;AAAA,MAEC,MAAM,SAAS,aAAa,UAAU;AAAA,MACtC,WAAW;AAAA,MAEV;AAAA;AAAA,EACH,GACF;AAEJ;","names":["_a"]}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
+
var __spreadValues = (a, b) => {
|
|
10
|
+
for (var prop in b || (b = {}))
|
|
11
|
+
if (__hasOwnProp.call(b, prop))
|
|
12
|
+
__defNormalProp(a, prop, b[prop]);
|
|
13
|
+
if (__getOwnPropSymbols)
|
|
14
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
+
if (__propIsEnum.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
}
|
|
18
|
+
return a;
|
|
19
|
+
};
|
|
20
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
|
+
var __objRest = (source, exclude) => {
|
|
22
|
+
var target = {};
|
|
23
|
+
for (var prop in source)
|
|
24
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
25
|
+
target[prop] = source[prop];
|
|
26
|
+
if (source != null && __getOwnPropSymbols)
|
|
27
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
28
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
}
|
|
31
|
+
return target;
|
|
32
|
+
};
|
|
33
|
+
import { jsx } from "react/jsx-runtime";
|
|
34
|
+
import {
|
|
35
|
+
useCallback,
|
|
36
|
+
useMemo,
|
|
37
|
+
useState
|
|
38
|
+
} from "react";
|
|
39
|
+
import { Base } from "../../core/Base";
|
|
40
|
+
import {
|
|
41
|
+
SegmentedControlContext
|
|
42
|
+
} from "./SegmentedControlContext";
|
|
43
|
+
const BaseAny = Base;
|
|
44
|
+
function SegmentedControl(_a) {
|
|
45
|
+
var _b = _a, {
|
|
46
|
+
type = "single",
|
|
47
|
+
value,
|
|
48
|
+
defaultValue,
|
|
49
|
+
onValueChange,
|
|
50
|
+
disabled = false,
|
|
51
|
+
children,
|
|
52
|
+
className
|
|
53
|
+
} = _b, props = __objRest(_b, [
|
|
54
|
+
"type",
|
|
55
|
+
"value",
|
|
56
|
+
"defaultValue",
|
|
57
|
+
"onValueChange",
|
|
58
|
+
"disabled",
|
|
59
|
+
"children",
|
|
60
|
+
"className"
|
|
61
|
+
]);
|
|
62
|
+
const isControlled = value !== void 0;
|
|
63
|
+
const [internalValue, setInternalValue] = useState(() => {
|
|
64
|
+
if (defaultValue === void 0) return [];
|
|
65
|
+
return Array.isArray(defaultValue) ? defaultValue : [defaultValue];
|
|
66
|
+
});
|
|
67
|
+
const normalizedValue = useMemo(() => {
|
|
68
|
+
const current = isControlled ? value : internalValue;
|
|
69
|
+
if (current === void 0) return [];
|
|
70
|
+
return Array.isArray(current) ? current : [current];
|
|
71
|
+
}, [isControlled, value, internalValue]);
|
|
72
|
+
const handleToggle = useCallback(
|
|
73
|
+
(itemValue) => {
|
|
74
|
+
var _a2;
|
|
75
|
+
const next = type === "multiple" ? normalizedValue.includes(itemValue) ? normalizedValue.filter((v) => v !== itemValue) : [...normalizedValue, itemValue] : normalizedValue.includes(itemValue) ? [] : [itemValue];
|
|
76
|
+
if (!isControlled) {
|
|
77
|
+
setInternalValue(next);
|
|
78
|
+
}
|
|
79
|
+
if (type === "multiple") {
|
|
80
|
+
onValueChange == null ? void 0 : onValueChange(next);
|
|
81
|
+
} else {
|
|
82
|
+
onValueChange == null ? void 0 : onValueChange(
|
|
83
|
+
(_a2 = next[0]) != null ? _a2 : ""
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
[isControlled, normalizedValue, onValueChange, type]
|
|
88
|
+
);
|
|
89
|
+
const contextValue = useMemo(
|
|
90
|
+
() => ({ type, value: normalizedValue, onToggle: handleToggle, disabled }),
|
|
91
|
+
[type, normalizedValue, handleToggle, disabled]
|
|
92
|
+
);
|
|
93
|
+
const groupClassName = className ? `ck-segmented-control ${className}` : "ck-segmented-control";
|
|
94
|
+
return /* @__PURE__ */ jsx(SegmentedControlContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(
|
|
95
|
+
BaseAny,
|
|
96
|
+
__spreadProps(__spreadValues({}, props), {
|
|
97
|
+
role: type === "multiple" ? "group" : "radiogroup",
|
|
98
|
+
className: groupClassName,
|
|
99
|
+
children
|
|
100
|
+
})
|
|
101
|
+
) });
|
|
102
|
+
}
|
|
103
|
+
export {
|
|
104
|
+
SegmentedControl as default
|
|
105
|
+
};
|
|
106
|
+
//# sourceMappingURL=SegmentedControl.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../lib/components/SegmentedControl/SegmentedControl.tsx"],"sourcesContent":["\"use client\";\nimport {\n ComponentType,\n ElementType,\n ReactNode,\n useCallback,\n useMemo,\n useState,\n} from \"react\";\nimport { Base, BaseProps } from \"../../core/Base\";\nimport {\n SegmentedControlContext,\n SegmentedControlContextValue,\n} from \"./SegmentedControlContext\";\n\ntype SingleProps = {\n type?: \"single\";\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n};\n\ntype MultipleProps = {\n type: \"multiple\";\n value?: string[];\n defaultValue?: string[];\n onValueChange?: (value: string[]) => void;\n};\n\nexport type SegmentedControlProps<T extends ElementType = \"div\"> =\n BaseProps<T> & {\n disabled?: boolean;\n children?: ReactNode;\n } & (SingleProps | MultipleProps);\n\nconst BaseAny = Base as unknown as ComponentType<Record<string, unknown>>;\n\nexport default function SegmentedControl<T extends ElementType = \"div\">({\n type = \"single\",\n value,\n defaultValue,\n onValueChange,\n disabled = false,\n children,\n className,\n ...props\n}: SegmentedControlProps<T>) {\n const isControlled = value !== undefined;\n\n const [internalValue, setInternalValue] = useState<string[]>(() => {\n if (defaultValue === undefined) return [];\n return Array.isArray(defaultValue) ? defaultValue : [defaultValue];\n });\n\n const normalizedValue = useMemo<string[]>(() => {\n const current = isControlled ? value : internalValue;\n if (current === undefined) return [];\n return Array.isArray(current) ? current : [current];\n }, [isControlled, value, internalValue]);\n\n const handleToggle = useCallback(\n (itemValue: string) => {\n const next =\n type === \"multiple\"\n ? normalizedValue.includes(itemValue)\n ? normalizedValue.filter((v) => v !== itemValue)\n : [...normalizedValue, itemValue]\n : normalizedValue.includes(itemValue)\n ? []\n : [itemValue];\n\n if (!isControlled) {\n setInternalValue(next);\n }\n\n if (type === \"multiple\") {\n (onValueChange as ((value: string[]) => void) | undefined)?.(next);\n } else {\n (onValueChange as ((value: string) => void) | undefined)?.(\n next[0] ?? \"\",\n );\n }\n },\n [isControlled, normalizedValue, onValueChange, type],\n );\n\n const contextValue: SegmentedControlContextValue = useMemo(\n () => ({ type, value: normalizedValue, onToggle: handleToggle, disabled }),\n [type, normalizedValue, handleToggle, disabled],\n );\n\n const groupClassName = className\n ? `ck-segmented-control ${className}`\n : \"ck-segmented-control\";\n\n return (\n <SegmentedControlContext.Provider value={contextValue}>\n <BaseAny\n {...props}\n role={type === \"multiple\" ? \"group\" : \"radiogroup\"}\n className={groupClassName}\n >\n {children}\n </BaseAny>\n </SegmentedControlContext.Provider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiGM;AAhGN;AAAA,EAIE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,YAAuB;AAChC;AAAA,EACE;AAAA,OAEK;AAsBP,MAAM,UAAU;AAED,SAAR,iBAAiE,IAS3C;AAT2C,eACtE;AAAA,WAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX;AAAA,IACA;AAAA,EA5CF,IAqCwE,IAQnE,kBARmE,IAQnE;AAAA,IAPH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAGA,QAAM,eAAe,UAAU;AAE/B,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAAmB,MAAM;AACjE,QAAI,iBAAiB,OAAW,QAAO,CAAC;AACxC,WAAO,MAAM,QAAQ,YAAY,IAAI,eAAe,CAAC,YAAY;AAAA,EACnE,CAAC;AAED,QAAM,kBAAkB,QAAkB,MAAM;AAC9C,UAAM,UAAU,eAAe,QAAQ;AACvC,QAAI,YAAY,OAAW,QAAO,CAAC;AACnC,WAAO,MAAM,QAAQ,OAAO,IAAI,UAAU,CAAC,OAAO;AAAA,EACpD,GAAG,CAAC,cAAc,OAAO,aAAa,CAAC;AAEvC,QAAM,eAAe;AAAA,IACnB,CAAC,cAAsB;AA7D3B,UAAAA;AA8DM,YAAM,OACJ,SAAS,aACL,gBAAgB,SAAS,SAAS,IAChC,gBAAgB,OAAO,CAAC,MAAM,MAAM,SAAS,IAC7C,CAAC,GAAG,iBAAiB,SAAS,IAChC,gBAAgB,SAAS,SAAS,IAChC,CAAC,IACD,CAAC,SAAS;AAElB,UAAI,CAAC,cAAc;AACjB,yBAAiB,IAAI;AAAA,MACvB;AAEA,UAAI,SAAS,YAAY;AACvB,QAAC,+CAA4D;AAAA,MAC/D,OAAO;AACL,QAAC;AAAA,WACCA,MAAA,KAAK,CAAC,MAAN,OAAAA,MAAW;AAAA;AAAA,MAEf;AAAA,IACF;AAAA,IACA,CAAC,cAAc,iBAAiB,eAAe,IAAI;AAAA,EACrD;AAEA,QAAM,eAA6C;AAAA,IACjD,OAAO,EAAE,MAAM,OAAO,iBAAiB,UAAU,cAAc,SAAS;AAAA,IACxE,CAAC,MAAM,iBAAiB,cAAc,QAAQ;AAAA,EAChD;AAEA,QAAM,iBAAiB,YACnB,wBAAwB,SAAS,KACjC;AAEJ,SACE,oBAAC,wBAAwB,UAAxB,EAAiC,OAAO,cACvC;AAAA,IAAC;AAAA,qCACK,QADL;AAAA,MAEC,MAAM,SAAS,aAAa,UAAU;AAAA,MACtC,WAAW;AAAA,MAEV;AAAA;AAAA,EACH,GACF;AAEJ;","names":["_a"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
|
|
3
|
+
type SegmentedControlContextValue = {
|
|
4
|
+
type: "single" | "multiple";
|
|
5
|
+
value: string[];
|
|
6
|
+
onToggle: (value: string) => void;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare const SegmentedControlContext: react.Context<SegmentedControlContextValue | null>;
|
|
10
|
+
declare function useSegmentedControlContext(): SegmentedControlContextValue | null;
|
|
11
|
+
|
|
12
|
+
export { SegmentedControlContext, type SegmentedControlContextValue, useSegmentedControlContext };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
|
|
3
|
+
type SegmentedControlContextValue = {
|
|
4
|
+
type: "single" | "multiple";
|
|
5
|
+
value: string[];
|
|
6
|
+
onToggle: (value: string) => void;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare const SegmentedControlContext: react.Context<SegmentedControlContextValue | null>;
|
|
10
|
+
declare function useSegmentedControlContext(): SegmentedControlContextValue | null;
|
|
11
|
+
|
|
12
|
+
export { SegmentedControlContext, type SegmentedControlContextValue, useSegmentedControlContext };
|