@udixio/ui-react 0.4.2 → 1.0.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/.eslintrc.mjs +22 -0
- package/.storybook/main.ts +20 -0
- package/.storybook/preview.ts +1 -0
- package/CHANGELOG.md +63 -0
- package/dist/index.cjs +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2811 -0
- package/dist/lib/components/Button.d.ts +9 -0
- package/dist/lib/components/Button.d.ts.map +1 -0
- package/{src → dist}/lib/components/Card.d.ts +5 -0
- package/dist/lib/components/Card.d.ts.map +1 -0
- package/{src → dist}/lib/components/Carousel.d.ts +6 -0
- package/dist/lib/components/Carousel.d.ts.map +1 -0
- package/{src → dist}/lib/components/CarouselItem.d.ts +4 -0
- package/dist/lib/components/CarouselItem.d.ts.map +1 -0
- package/dist/lib/components/Divider.d.ts +9 -0
- package/dist/lib/components/Divider.d.ts.map +1 -0
- package/dist/lib/components/Fab.d.ts +9 -0
- package/dist/lib/components/Fab.d.ts.map +1 -0
- package/dist/lib/components/IconButton.d.ts +10 -0
- package/dist/lib/components/IconButton.d.ts.map +1 -0
- package/{src → dist}/lib/components/NavigationRail.d.ts +5 -0
- package/dist/lib/components/NavigationRail.d.ts.map +1 -0
- package/{src → dist}/lib/components/NavigationRailItem.d.ts +9 -1
- package/dist/lib/components/NavigationRailItem.d.ts.map +1 -0
- package/dist/lib/components/ProgressIndicator.d.ts +8 -0
- package/dist/lib/components/ProgressIndicator.d.ts.map +1 -0
- package/{src → dist}/lib/components/Slider.d.ts +5 -0
- package/dist/lib/components/Slider.d.ts.map +1 -0
- package/dist/lib/components/Snackbar.d.ts +9 -0
- package/dist/lib/components/Snackbar.d.ts.map +1 -0
- package/{src → dist}/lib/components/Switch.d.ts +5 -0
- package/dist/lib/components/Switch.d.ts.map +1 -0
- package/{src → dist}/lib/components/Tab.d.ts +4 -0
- package/dist/lib/components/Tab.d.ts.map +1 -0
- package/{src → dist}/lib/components/Tabs.d.ts +5 -0
- package/dist/lib/components/Tabs.d.ts.map +1 -0
- package/{src → dist}/lib/components/TextField.d.ts +5 -0
- package/dist/lib/components/TextField.d.ts.map +1 -0
- package/{src → dist}/lib/components/ToolTip.d.ts +5 -0
- package/dist/lib/components/ToolTip.d.ts.map +1 -0
- package/{src → dist}/lib/components/index.d.ts +1 -1
- package/dist/lib/components/index.d.ts.map +1 -0
- package/dist/lib/effects/SyncedFixedWrapper.d.ts.map +1 -0
- package/dist/lib/effects/custom-scroll/custom-scroll.effect.d.ts.map +1 -0
- package/dist/lib/effects/custom-scroll/custom-scroll.interface.d.ts.map +1 -0
- package/dist/lib/effects/custom-scroll/custom-scroll.style.d.ts.map +1 -0
- package/dist/lib/effects/custom-scroll/index.d.ts.map +1 -0
- package/dist/lib/effects/index.d.ts.map +1 -0
- package/dist/lib/effects/ripple/RippleEffect.d.ts.map +1 -0
- package/dist/lib/effects/ripple/index.d.ts.map +1 -0
- package/dist/lib/effects/smooth-scroll.effect.d.ts.map +1 -0
- package/dist/lib/icon/icon.d.ts.map +1 -0
- package/dist/lib/icon/index.d.ts.map +1 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/{src → dist}/lib/interfaces/button.interface.d.ts +9 -3
- package/dist/lib/interfaces/button.interface.d.ts.map +1 -0
- package/{src → dist}/lib/interfaces/card.interface.d.ts +2 -0
- package/dist/lib/interfaces/card.interface.d.ts.map +1 -0
- package/dist/lib/interfaces/carousel-item.interface.d.ts.map +1 -0
- package/{src → dist}/lib/interfaces/carousel.interface.d.ts +3 -2
- package/dist/lib/interfaces/carousel.interface.d.ts.map +1 -0
- package/dist/lib/interfaces/divider.interface.d.ts.map +1 -0
- package/{src → dist}/lib/interfaces/fab.interface.d.ts +2 -1
- package/dist/lib/interfaces/fab.interface.d.ts.map +1 -0
- package/{src → dist}/lib/interfaces/icon-button.interface.d.ts +3 -2
- package/dist/lib/interfaces/icon-button.interface.d.ts.map +1 -0
- package/dist/lib/interfaces/index.d.ts.map +1 -0
- package/{src → dist}/lib/interfaces/navigation-rail-item.interface.d.ts +1 -0
- package/dist/lib/interfaces/navigation-rail-item.interface.d.ts.map +1 -0
- package/dist/lib/interfaces/navigation-rail.interface.d.ts.map +1 -0
- package/dist/lib/interfaces/progress-indicator.interface.d.ts.map +1 -0
- package/dist/lib/interfaces/slider.interface.d.ts.map +1 -0
- package/{src → dist}/lib/interfaces/snackbar.interface.d.ts +1 -1
- package/dist/lib/interfaces/snackbar.interface.d.ts.map +1 -0
- package/dist/lib/interfaces/switch.interface.d.ts.map +1 -0
- package/dist/lib/interfaces/tab.interface.d.ts.map +1 -0
- package/{src → dist}/lib/interfaces/tabs.interface.d.ts +1 -1
- package/dist/lib/interfaces/tabs.interface.d.ts.map +1 -0
- package/dist/lib/interfaces/text-field.interface.d.ts.map +1 -0
- package/dist/lib/interfaces/tooltip.interface.d.ts.map +1 -0
- package/{src → dist}/lib/styles/button.style.d.ts +22 -8
- package/dist/lib/styles/button.style.d.ts.map +1 -0
- package/{src → dist}/lib/styles/card.style.d.ts +2 -0
- package/dist/lib/styles/card.style.d.ts.map +1 -0
- package/dist/lib/styles/carousel-item.style.d.ts.map +1 -0
- package/{src → dist}/lib/styles/carousel.style.d.ts +1 -1
- package/dist/lib/styles/carousel.style.d.ts.map +1 -0
- package/dist/lib/styles/divider.style.d.ts.map +1 -0
- package/{src → dist}/lib/styles/fab.style.d.ts +6 -2
- package/dist/lib/styles/fab.style.d.ts.map +1 -0
- package/{src → dist}/lib/styles/icon-button.style.d.ts +9 -5
- package/dist/lib/styles/icon-button.style.d.ts.map +1 -0
- package/dist/lib/styles/index.d.ts.map +1 -0
- package/{src → dist}/lib/styles/navigation-rail-item.style.d.ts +2 -0
- package/dist/lib/styles/navigation-rail-item.style.d.ts.map +1 -0
- package/dist/lib/styles/navigation-rail.style.d.ts.map +1 -0
- package/dist/lib/styles/progress-indicator.style.d.ts.map +1 -0
- package/dist/lib/styles/slider.style.d.ts.map +1 -0
- package/{src → dist}/lib/styles/snackbar.style.d.ts +2 -2
- package/dist/lib/styles/snackbar.style.d.ts.map +1 -0
- package/dist/lib/styles/switch.style.d.ts.map +1 -0
- package/{src → dist}/lib/styles/tab.style.d.ts +1 -1
- package/dist/lib/styles/tab.style.d.ts.map +1 -0
- package/{src → dist}/lib/styles/tabs.style.d.ts +1 -1
- package/dist/lib/styles/tabs.style.d.ts.map +1 -0
- package/dist/lib/styles/text-field.style.d.ts.map +1 -0
- package/dist/lib/styles/tooltip.style.d.ts.map +1 -0
- package/dist/lib/utils/component-helper.d.ts.map +1 -0
- package/{src → dist}/lib/utils/component.d.ts +1 -1
- package/dist/lib/utils/component.d.ts.map +1 -0
- package/dist/lib/utils/index.d.ts.map +1 -0
- package/dist/lib/utils/string.d.ts.map +1 -0
- package/dist/lib/utils/styles/classnames.d.ts.map +1 -0
- package/dist/lib/utils/styles/get-classname.d.ts.map +1 -0
- package/dist/lib/utils/styles/index.d.ts.map +1 -0
- package/package.json +31 -8
- package/postcss.config.mjs +5 -0
- package/src/index.css +4 -0
- package/src/index.ts +1 -0
- package/src/lib/components/Button.tsx +174 -0
- package/src/lib/components/Card.tsx +36 -0
- package/src/lib/components/Carousel.tsx +196 -0
- package/src/lib/components/CarouselItem.tsx +58 -0
- package/src/lib/components/Divider.tsx +18 -0
- package/src/lib/components/Fab.tsx +122 -0
- package/src/lib/components/IconButton.tsx +155 -0
- package/src/lib/components/NavigationRail.tsx +177 -0
- package/src/lib/components/NavigationRailItem.tsx +211 -0
- package/src/lib/components/ProgressIndicator.tsx +154 -0
- package/src/lib/components/Slider.tsx +366 -0
- package/src/lib/components/Snackbar.tsx +71 -0
- package/src/lib/components/Switch.tsx +99 -0
- package/src/lib/components/Tab.tsx +114 -0
- package/src/lib/components/Tabs.tsx +90 -0
- package/src/lib/components/TextField.tsx +274 -0
- package/src/lib/components/ToolTip.tsx +232 -0
- package/src/lib/components/index.ts +19 -0
- package/src/lib/effects/SyncedFixedWrapper.tsx +62 -0
- package/src/lib/effects/custom-scroll/custom-scroll.effect.tsx +287 -0
- package/src/lib/effects/custom-scroll/custom-scroll.interface.ts +25 -0
- package/src/lib/effects/custom-scroll/custom-scroll.style.ts +32 -0
- package/src/lib/effects/custom-scroll/index.ts +3 -0
- package/src/lib/effects/index.ts +4 -0
- package/src/lib/effects/ripple/RippleEffect.tsx +103 -0
- package/src/lib/effects/ripple/index.tsx +1 -0
- package/src/lib/effects/smooth-scroll.effect.tsx +91 -0
- package/src/lib/icon/icon.tsx +47 -0
- package/src/lib/icon/index.ts +1 -0
- package/src/lib/index.ts +6 -0
- package/src/lib/interfaces/button.interface.ts +54 -0
- package/src/lib/interfaces/card.interface.ts +11 -0
- package/src/lib/interfaces/carousel-item.interface.ts +11 -0
- package/src/lib/interfaces/carousel.interface.ts +22 -0
- package/src/lib/interfaces/divider.interface.ts +7 -0
- package/src/lib/interfaces/fab.interface.ts +20 -0
- package/src/lib/interfaces/icon-button.interface.ts +36 -0
- package/src/lib/interfaces/index.ts +16 -0
- package/src/lib/interfaces/navigation-rail-item.interface.ts +39 -0
- package/src/lib/interfaces/navigation-rail.interface.ts +39 -0
- package/src/lib/interfaces/progress-indicator.interface.ts +35 -0
- package/src/lib/interfaces/slider.interface.ts +27 -0
- package/src/lib/interfaces/snackbar.interface.ts +13 -0
- package/src/lib/interfaces/switch.interface.ts +14 -0
- package/src/lib/interfaces/tab.interface.ts +30 -0
- package/src/lib/interfaces/tabs.interface.ts +22 -0
- package/src/lib/interfaces/text-field.interface.ts +48 -0
- package/src/lib/interfaces/tooltip.interface.ts +35 -0
- package/src/lib/styles/button.style.ts +142 -0
- package/src/lib/styles/card.style.ts +21 -0
- package/src/lib/styles/carousel-item.style.ts +11 -0
- package/src/lib/styles/carousel.style.ts +12 -0
- package/src/lib/styles/divider.style.ts +17 -0
- package/src/lib/styles/fab.style.ts +55 -0
- package/src/lib/styles/icon-button.style.ts +167 -0
- package/src/lib/styles/index.ts +15 -0
- package/src/lib/styles/navigation-rail-item.style.ts +44 -0
- package/src/lib/styles/navigation-rail.style.ts +20 -0
- package/src/lib/styles/progress-indicator.style.ts +43 -0
- package/src/lib/styles/slider.style.ts +27 -0
- package/src/lib/styles/snackbar.style.ts +14 -0
- package/src/lib/styles/switch.style.ts +51 -0
- package/src/lib/styles/tab.style.ts +68 -0
- package/src/lib/styles/tabs.style.ts +13 -0
- package/src/lib/styles/text-field.style.ts +104 -0
- package/src/lib/styles/tooltip.style.ts +37 -0
- package/src/lib/utils/component-helper.ts +134 -0
- package/src/lib/utils/component.ts +34 -0
- package/src/lib/utils/index.ts +7 -0
- package/src/lib/utils/string.ts +9 -0
- package/src/lib/utils/styles/classnames.ts +49 -0
- package/src/lib/utils/styles/get-classname.ts +73 -0
- package/src/lib/utils/styles/index.ts +3 -0
- package/src/stories/action/button.stories.tsx +86 -0
- package/src/stories/action/fab.stories.tsx +54 -0
- package/src/stories/action/icon-button.stories.tsx +134 -0
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +5 -0
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +15 -0
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +3 -0
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +12 -0
- package/src/stories/assets/youtube.svg +4 -0
- package/src/stories/communication/ProgressIndicator.stories.tsx +57 -0
- package/src/stories/communication/SnackBar.stories.tsx +32 -0
- package/src/stories/communication/tool-tip.stories.tsx +133 -0
- package/src/stories/containment/card.stories.tsx +42 -0
- package/src/stories/containment/carousel.stories.tsx +65 -0
- package/src/stories/containment/divider.stories.tsx +35 -0
- package/src/stories/effect/smooth-scroll.stories.tsx +45 -0
- package/src/stories/navigation/navigation-rail/navigation-rail-item.stories.tsx +65 -0
- package/src/stories/navigation/navigation-rail/navigation-rail.stories.tsx +122 -0
- package/src/stories/navigation/tabs/tab.stories.tsx +57 -0
- package/src/stories/navigation/tabs/tabs.stories.tsx +102 -0
- package/src/stories/selection/slider.stories.tsx +85 -0
- package/src/stories/selection/switch.stories.tsx +46 -0
- package/src/stories/text-inputs/text-field.stories.tsx +135 -0
- package/src/tests/Button.spec.tsx +67 -0
- package/src/udixio.css +120 -0
- package/theme.config.ts +7 -0
- package/tsconfig.json +22 -0
- package/tsconfig.lib.json +51 -0
- package/tsconfig.spec.json +37 -0
- package/tsconfig.storybook.json +38 -0
- package/vite.config.ts +77 -0
- package/index.js +0 -5
- package/index.mjs +0 -2823
- package/src/index.d.ts.map +0 -1
- package/src/lib/components/Button.d.ts +0 -7
- package/src/lib/components/Button.d.ts.map +0 -1
- package/src/lib/components/Card.d.ts.map +0 -1
- package/src/lib/components/Carousel.d.ts.map +0 -1
- package/src/lib/components/CarouselItem.d.ts.map +0 -1
- package/src/lib/components/Divided.d.ts +0 -4
- package/src/lib/components/Divided.d.ts.map +0 -1
- package/src/lib/components/Fab.d.ts +0 -4
- package/src/lib/components/Fab.d.ts.map +0 -1
- package/src/lib/components/IconButton.d.ts +0 -5
- package/src/lib/components/IconButton.d.ts.map +0 -1
- package/src/lib/components/NavigationRail.d.ts.map +0 -1
- package/src/lib/components/NavigationRailItem.d.ts.map +0 -1
- package/src/lib/components/ProgressIndicator.d.ts +0 -4
- package/src/lib/components/ProgressIndicator.d.ts.map +0 -1
- package/src/lib/components/Slider.d.ts.map +0 -1
- package/src/lib/components/Snackbar.d.ts +0 -4
- package/src/lib/components/Snackbar.d.ts.map +0 -1
- package/src/lib/components/Switch.d.ts.map +0 -1
- package/src/lib/components/Tab.d.ts.map +0 -1
- package/src/lib/components/Tabs.d.ts.map +0 -1
- package/src/lib/components/TextField.d.ts.map +0 -1
- package/src/lib/components/ToolTip.d.ts.map +0 -1
- package/src/lib/components/index.d.ts.map +0 -1
- package/src/lib/effects/SyncedFixedWrapper.d.ts.map +0 -1
- package/src/lib/effects/custom-scroll/custom-scroll.effect.d.ts.map +0 -1
- package/src/lib/effects/custom-scroll/custom-scroll.interface.d.ts.map +0 -1
- package/src/lib/effects/custom-scroll/custom-scroll.style.d.ts.map +0 -1
- package/src/lib/effects/custom-scroll/index.d.ts.map +0 -1
- package/src/lib/effects/index.d.ts.map +0 -1
- package/src/lib/effects/ripple/RippleEffect.d.ts.map +0 -1
- package/src/lib/effects/ripple/index.d.ts.map +0 -1
- package/src/lib/effects/smooth-scroll.effect.d.ts.map +0 -1
- package/src/lib/icon/icon.d.ts.map +0 -1
- package/src/lib/icon/index.d.ts.map +0 -1
- package/src/lib/index.d.ts.map +0 -1
- package/src/lib/interfaces/button.interface.d.ts.map +0 -1
- package/src/lib/interfaces/card.interface.d.ts.map +0 -1
- package/src/lib/interfaces/carousel-item.interface.d.ts.map +0 -1
- package/src/lib/interfaces/carousel.interface.d.ts.map +0 -1
- package/src/lib/interfaces/divider.interface.d.ts.map +0 -1
- package/src/lib/interfaces/fab.interface.d.ts.map +0 -1
- package/src/lib/interfaces/icon-button.interface.d.ts.map +0 -1
- package/src/lib/interfaces/index.d.ts.map +0 -1
- package/src/lib/interfaces/navigation-rail-item.interface.d.ts.map +0 -1
- package/src/lib/interfaces/navigation-rail.interface.d.ts.map +0 -1
- package/src/lib/interfaces/progress-indicator.interface.d.ts.map +0 -1
- package/src/lib/interfaces/slider.interface.d.ts.map +0 -1
- package/src/lib/interfaces/snackbar.interface.d.ts.map +0 -1
- package/src/lib/interfaces/switch.interface.d.ts.map +0 -1
- package/src/lib/interfaces/tab.interface.d.ts.map +0 -1
- package/src/lib/interfaces/tabs.interface.d.ts.map +0 -1
- package/src/lib/interfaces/text-field.interface.d.ts.map +0 -1
- package/src/lib/interfaces/tooltip.interface.d.ts.map +0 -1
- package/src/lib/styles/button.style.d.ts.map +0 -1
- package/src/lib/styles/card.style.d.ts.map +0 -1
- package/src/lib/styles/carousel-item.style.d.ts.map +0 -1
- package/src/lib/styles/carousel.style.d.ts.map +0 -1
- package/src/lib/styles/divider.style.d.ts.map +0 -1
- package/src/lib/styles/fab.style.d.ts.map +0 -1
- package/src/lib/styles/icon-button.style.d.ts.map +0 -1
- package/src/lib/styles/index.d.ts.map +0 -1
- package/src/lib/styles/navigation-rail-item.style.d.ts.map +0 -1
- package/src/lib/styles/navigation-rail.style.d.ts.map +0 -1
- package/src/lib/styles/progress-indicator.style.d.ts.map +0 -1
- package/src/lib/styles/slider.style.d.ts.map +0 -1
- package/src/lib/styles/snackbar.style.d.ts.map +0 -1
- package/src/lib/styles/switch.style.d.ts.map +0 -1
- package/src/lib/styles/tab.style.d.ts.map +0 -1
- package/src/lib/styles/tabs.style.d.ts.map +0 -1
- package/src/lib/styles/text-field.style.d.ts.map +0 -1
- package/src/lib/styles/tooltip.style.d.ts.map +0 -1
- package/src/lib/utils/component-helper.d.ts.map +0 -1
- package/src/lib/utils/component.d.ts.map +0 -1
- package/src/lib/utils/index.d.ts.map +0 -1
- package/src/lib/utils/string.d.ts.map +0 -1
- package/src/lib/utils/styles/classnames.d.ts.map +0 -1
- package/src/lib/utils/styles/get-classname.d.ts.map +0 -1
- package/src/lib/utils/styles/index.d.ts.map +0 -1
- /package/{LICENSE → dist/LICENSE} +0 -0
- /package/{src → dist}/index.d.ts +0 -0
- /package/{src → dist}/lib/effects/SyncedFixedWrapper.d.ts +0 -0
- /package/{src → dist}/lib/effects/custom-scroll/custom-scroll.effect.d.ts +0 -0
- /package/{src → dist}/lib/effects/custom-scroll/custom-scroll.interface.d.ts +0 -0
- /package/{src → dist}/lib/effects/custom-scroll/custom-scroll.style.d.ts +0 -0
- /package/{src → dist}/lib/effects/custom-scroll/index.d.ts +0 -0
- /package/{src → dist}/lib/effects/index.d.ts +0 -0
- /package/{src → dist}/lib/effects/ripple/RippleEffect.d.ts +0 -0
- /package/{src → dist}/lib/effects/ripple/index.d.ts +0 -0
- /package/{src → dist}/lib/effects/smooth-scroll.effect.d.ts +0 -0
- /package/{src → dist}/lib/icon/icon.d.ts +0 -0
- /package/{src → dist}/lib/icon/index.d.ts +0 -0
- /package/{src → dist}/lib/index.d.ts +0 -0
- /package/{src → dist}/lib/interfaces/carousel-item.interface.d.ts +0 -0
- /package/{src → dist}/lib/interfaces/divider.interface.d.ts +0 -0
- /package/{src → dist}/lib/interfaces/index.d.ts +0 -0
- /package/{src → dist}/lib/interfaces/navigation-rail.interface.d.ts +0 -0
- /package/{src → dist}/lib/interfaces/progress-indicator.interface.d.ts +0 -0
- /package/{src → dist}/lib/interfaces/slider.interface.d.ts +0 -0
- /package/{src → dist}/lib/interfaces/switch.interface.d.ts +0 -0
- /package/{src → dist}/lib/interfaces/tab.interface.d.ts +0 -0
- /package/{src → dist}/lib/interfaces/text-field.interface.d.ts +0 -0
- /package/{src → dist}/lib/interfaces/tooltip.interface.d.ts +0 -0
- /package/{src → dist}/lib/styles/carousel-item.style.d.ts +0 -0
- /package/{src → dist}/lib/styles/divider.style.d.ts +0 -0
- /package/{src → dist}/lib/styles/index.d.ts +0 -0
- /package/{src → dist}/lib/styles/navigation-rail.style.d.ts +0 -0
- /package/{src → dist}/lib/styles/progress-indicator.style.d.ts +0 -0
- /package/{src → dist}/lib/styles/slider.style.d.ts +0 -0
- /package/{src → dist}/lib/styles/switch.style.d.ts +0 -0
- /package/{src → dist}/lib/styles/text-field.style.d.ts +0 -0
- /package/{src → dist}/lib/styles/tooltip.style.d.ts +0 -0
- /package/{src → dist}/lib/utils/component-helper.d.ts +0 -0
- /package/{src → dist}/lib/utils/index.d.ts +0 -0
- /package/{src → dist}/lib/utils/string.d.ts +0 -0
- /package/{src → dist}/lib/utils/styles/classnames.d.ts +0 -0
- /package/{src → dist}/lib/utils/styles/get-classname.d.ts +0 -0
- /package/{src → dist}/lib/utils/styles/index.d.ts +0 -0
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import React, { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
2
|
+
import { CarouselInterface, CarouselItemInterface } from '../interfaces';
|
|
3
|
+
|
|
4
|
+
import { motion, motionValue, useTransform } from 'motion/react';
|
|
5
|
+
|
|
6
|
+
import { carouselStyle } from '../styles';
|
|
7
|
+
import { CustomScroll } from '../effects';
|
|
8
|
+
import { ReactProps } from '../utils';
|
|
9
|
+
import { CarouselItem, normalize } from './CarouselItem';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Carousels show a collection of items that can be scrolled on and off the screen
|
|
13
|
+
* Resources
|
|
14
|
+
* @status beta
|
|
15
|
+
* @category Layout
|
|
16
|
+
*/
|
|
17
|
+
export const Carousel = ({
|
|
18
|
+
variant = 'hero',
|
|
19
|
+
className,
|
|
20
|
+
children,
|
|
21
|
+
ref: optionalRef,
|
|
22
|
+
marginPourcent = 0,
|
|
23
|
+
inputRange = [0.21, 0.65],
|
|
24
|
+
outputRange = [42, 300],
|
|
25
|
+
gap = 8,
|
|
26
|
+
onChange,
|
|
27
|
+
scrollSensitivity = 1.25,
|
|
28
|
+
...restProps
|
|
29
|
+
}: ReactProps<CarouselInterface>) => {
|
|
30
|
+
const defaultRef = useRef(null);
|
|
31
|
+
const ref = optionalRef || defaultRef;
|
|
32
|
+
|
|
33
|
+
const styles = carouselStyle({
|
|
34
|
+
className,
|
|
35
|
+
children,
|
|
36
|
+
variant,
|
|
37
|
+
inputRange,
|
|
38
|
+
outputRange,
|
|
39
|
+
marginPourcent,
|
|
40
|
+
onChange,
|
|
41
|
+
gap,
|
|
42
|
+
scrollSensitivity,
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const items = React.Children.toArray(children).filter(
|
|
46
|
+
(child) => React.isValidElement(child) && child.type === CarouselItem,
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
const trackRef = useRef<HTMLDivElement>(null);
|
|
50
|
+
const [itemsWidth, setItemsWidth] = useState<number[]>([]);
|
|
51
|
+
const [scroll, setScroll] = useState<{
|
|
52
|
+
scrollProgress: number;
|
|
53
|
+
scrollTotal: number;
|
|
54
|
+
scrollVisible: number;
|
|
55
|
+
scroll: number;
|
|
56
|
+
} | null>(null);
|
|
57
|
+
const calculatePercentages = () => {
|
|
58
|
+
if (!trackRef.current || !ref.current || !scroll) return [];
|
|
59
|
+
|
|
60
|
+
const { scrollVisible, scrollProgress } = scroll;
|
|
61
|
+
|
|
62
|
+
function assignRelativeIndexes(
|
|
63
|
+
values: number[],
|
|
64
|
+
progressScroll: number,
|
|
65
|
+
): number[] {
|
|
66
|
+
return values.map(
|
|
67
|
+
(value) => (value - progressScroll) / Math.abs(values[1] - values[0]),
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
let itemValues = items.map((_, index) => {
|
|
72
|
+
const itemRef = itemRefs[index];
|
|
73
|
+
|
|
74
|
+
if (!itemRef.current || !trackRef.current) return 0;
|
|
75
|
+
|
|
76
|
+
let itemScrollXCenter = index / (items.length - 1);
|
|
77
|
+
|
|
78
|
+
if (itemScrollXCenter > 1) itemScrollXCenter = 1;
|
|
79
|
+
if (itemScrollXCenter < 0) itemScrollXCenter = 0;
|
|
80
|
+
|
|
81
|
+
return itemScrollXCenter;
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
itemValues = assignRelativeIndexes(itemValues, scrollProgress);
|
|
85
|
+
|
|
86
|
+
let visible =
|
|
87
|
+
((ref.current?.clientWidth ?? scrollVisible) - (outputRange[0] + gap)) /
|
|
88
|
+
(outputRange[1] + gap);
|
|
89
|
+
|
|
90
|
+
itemValues
|
|
91
|
+
.map((value, index) => ({ value: Math.abs(value), originalIndex: index })) // Associer chaque élément à son index
|
|
92
|
+
.sort((a, b) => a.value - b.value)
|
|
93
|
+
.forEach((item, index) => {
|
|
94
|
+
if (index === 0) setSelectedItem(item.originalIndex);
|
|
95
|
+
let result = normalize(visible, [0, 1], [0, outputRange[1]]);
|
|
96
|
+
if (result < outputRange[0]) result = outputRange[0];
|
|
97
|
+
visible--;
|
|
98
|
+
itemValues[item.originalIndex] = result;
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
return itemValues;
|
|
102
|
+
};
|
|
103
|
+
const itemRefs = useRef<React.RefObject<HTMLDivElement | null>[]>([]).current;
|
|
104
|
+
const [selectedItem, setSelectedItem] = useState(0);
|
|
105
|
+
|
|
106
|
+
useEffect(() => {
|
|
107
|
+
if (onChange) onChange(selectedItem);
|
|
108
|
+
}, [selectedItem]);
|
|
109
|
+
|
|
110
|
+
if (itemRefs.length !== items.length) {
|
|
111
|
+
items.forEach((_, i) => {
|
|
112
|
+
if (!itemRefs[i]) {
|
|
113
|
+
itemRefs[i] = React.createRef<HTMLDivElement>(); // Crée une nouvelle ref si manquante
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const renderItems = items.map((child, index) => {
|
|
119
|
+
return React.cloneElement(
|
|
120
|
+
child as React.ReactElement<ReactProps<CarouselItemInterface>>,
|
|
121
|
+
{
|
|
122
|
+
width: itemsWidth[index],
|
|
123
|
+
ref: itemRefs[index],
|
|
124
|
+
key: index,
|
|
125
|
+
index,
|
|
126
|
+
},
|
|
127
|
+
);
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
const scrollProgress = motionValue(scroll?.scrollProgress ?? 0);
|
|
131
|
+
|
|
132
|
+
const transform = useTransform(
|
|
133
|
+
scrollProgress,
|
|
134
|
+
[0, 1],
|
|
135
|
+
[
|
|
136
|
+
0,
|
|
137
|
+
1 -
|
|
138
|
+
(ref.current?.clientWidth ?? 0) / (trackRef?.current?.clientWidth ?? 0),
|
|
139
|
+
],
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
const percentTransform = useTransform(
|
|
143
|
+
transform,
|
|
144
|
+
(value) => `${-value * 100}%`,
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
const handleScroll = (args: {
|
|
148
|
+
scrollProgress: number;
|
|
149
|
+
scrollTotal: number;
|
|
150
|
+
scrollVisible: number;
|
|
151
|
+
scroll: number;
|
|
152
|
+
}) => {
|
|
153
|
+
if (args.scrollTotal > 0) {
|
|
154
|
+
setScroll(args);
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
useEffect(() => {
|
|
159
|
+
const updatedPercentages = calculatePercentages();
|
|
160
|
+
setItemsWidth(updatedPercentages);
|
|
161
|
+
}, [scroll]);
|
|
162
|
+
|
|
163
|
+
const [scrollSize, setScrollSize] = useState(0);
|
|
164
|
+
useLayoutEffect(() => {
|
|
165
|
+
let maxWidth = outputRange[1];
|
|
166
|
+
if (scroll && maxWidth > scroll.scrollVisible) {
|
|
167
|
+
maxWidth = scroll.scrollVisible;
|
|
168
|
+
}
|
|
169
|
+
const result = ((maxWidth + gap) * renderItems.length) / scrollSensitivity;
|
|
170
|
+
setScrollSize(result);
|
|
171
|
+
}, [ref, itemRefs, scroll]);
|
|
172
|
+
|
|
173
|
+
return (
|
|
174
|
+
<div className={styles.carousel} ref={ref} {...restProps}>
|
|
175
|
+
<CustomScroll
|
|
176
|
+
draggable
|
|
177
|
+
orientation={'horizontal'}
|
|
178
|
+
onScroll={handleScroll}
|
|
179
|
+
scrollSize={scrollSize}
|
|
180
|
+
>
|
|
181
|
+
<motion.div
|
|
182
|
+
className={styles.track}
|
|
183
|
+
ref={trackRef}
|
|
184
|
+
style={{
|
|
185
|
+
transitionDuration: '0.5s',
|
|
186
|
+
transitionTimingFunction: 'ease-out',
|
|
187
|
+
gap: `${gap}px`,
|
|
188
|
+
x: percentTransform,
|
|
189
|
+
}}
|
|
190
|
+
>
|
|
191
|
+
{renderItems}
|
|
192
|
+
</motion.div>
|
|
193
|
+
</CustomScroll>
|
|
194
|
+
</div>
|
|
195
|
+
);
|
|
196
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
|
+
import { CarouselItemInterface } from '../interfaces';
|
|
3
|
+
import { motion } from 'motion/react';
|
|
4
|
+
import { carouselItemStyle } from '../styles';
|
|
5
|
+
import { MotionProps } from '../utils';
|
|
6
|
+
|
|
7
|
+
export const normalize = (
|
|
8
|
+
value: number,
|
|
9
|
+
inputRange: [number, number],
|
|
10
|
+
outputRange: [number, number] = [0, 1],
|
|
11
|
+
): number => {
|
|
12
|
+
const [inputMin, inputMax] = inputRange;
|
|
13
|
+
const [outputMin, outputMax] = outputRange;
|
|
14
|
+
|
|
15
|
+
const clampedValue = Math.max(inputMin, Math.min(value, inputMax));
|
|
16
|
+
|
|
17
|
+
const normalizedValue = (clampedValue - inputMin) / (inputMax - inputMin);
|
|
18
|
+
|
|
19
|
+
return outputMin + normalizedValue * (outputMax - outputMin);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @status beta
|
|
24
|
+
* @parent Carousel
|
|
25
|
+
*/
|
|
26
|
+
export const CarouselItem = ({
|
|
27
|
+
className,
|
|
28
|
+
children,
|
|
29
|
+
width = 1,
|
|
30
|
+
index = 0,
|
|
31
|
+
ref: optionalRef,
|
|
32
|
+
...restProps
|
|
33
|
+
}: MotionProps<CarouselItemInterface>) => {
|
|
34
|
+
const defaultRef = useRef(null);
|
|
35
|
+
const ref: React.RefObject<null | HTMLDivElement> = optionalRef || defaultRef;
|
|
36
|
+
|
|
37
|
+
const styles = carouselItemStyle({
|
|
38
|
+
className,
|
|
39
|
+
index,
|
|
40
|
+
width: width,
|
|
41
|
+
children,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<motion.div
|
|
46
|
+
ref={ref}
|
|
47
|
+
animate={{ width: width + 'px' }}
|
|
48
|
+
transition={{
|
|
49
|
+
duration: 0.5,
|
|
50
|
+
ease: 'linear',
|
|
51
|
+
}}
|
|
52
|
+
className={styles.carouselItem}
|
|
53
|
+
{...restProps}
|
|
54
|
+
>
|
|
55
|
+
{children}
|
|
56
|
+
</motion.div>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { dividerStyle } from '../styles';
|
|
2
|
+
import { DividerInterface } from '../interfaces';
|
|
3
|
+
import { ReactProps } from '../utils';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Dividers are thin lines that group content in lists or other containers
|
|
7
|
+
* @status beta
|
|
8
|
+
* @category Layout
|
|
9
|
+
*/
|
|
10
|
+
export const Divider = ({
|
|
11
|
+
orientation = 'horizontal',
|
|
12
|
+
className,
|
|
13
|
+
...restProps
|
|
14
|
+
}: ReactProps<DividerInterface>) => {
|
|
15
|
+
const styles = dividerStyle({ orientation, className });
|
|
16
|
+
|
|
17
|
+
return <hr className={styles.divider} {...restProps} />;
|
|
18
|
+
};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { useRef } from 'react';
|
|
2
|
+
import { Icon } from '../icon';
|
|
3
|
+
|
|
4
|
+
import { RippleEffect } from '../effects/ripple';
|
|
5
|
+
import { AnimatePresence, motion } from 'motion/react';
|
|
6
|
+
import { FabInterface } from '../interfaces/fab.interface';
|
|
7
|
+
import { fabStyle } from '../styles/fab.style';
|
|
8
|
+
import { classNames } from '../utils';
|
|
9
|
+
import { ReactProps } from '../utils/component';
|
|
10
|
+
import { ToolTip } from './ToolTip';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Floating action buttons (FABs) help people take primary actions
|
|
14
|
+
* @status beta
|
|
15
|
+
* @category Action
|
|
16
|
+
*/
|
|
17
|
+
export const Fab = ({
|
|
18
|
+
className,
|
|
19
|
+
label,
|
|
20
|
+
variant = 'primary',
|
|
21
|
+
size = 'medium',
|
|
22
|
+
href,
|
|
23
|
+
type,
|
|
24
|
+
icon,
|
|
25
|
+
isExtended = false,
|
|
26
|
+
ref,
|
|
27
|
+
transition,
|
|
28
|
+
children,
|
|
29
|
+
...restProps
|
|
30
|
+
}: ReactProps<FabInterface>) => {
|
|
31
|
+
if (children) label = children;
|
|
32
|
+
if (!label) {
|
|
33
|
+
throw new Error(
|
|
34
|
+
'FAB component requires either a label prop or children content',
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
const ElementType = href ? 'a' : 'button';
|
|
38
|
+
|
|
39
|
+
const styles = fabStyle({
|
|
40
|
+
href,
|
|
41
|
+
icon,
|
|
42
|
+
isExtended,
|
|
43
|
+
label,
|
|
44
|
+
size,
|
|
45
|
+
variant,
|
|
46
|
+
className,
|
|
47
|
+
transition,
|
|
48
|
+
children: label,
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
transition = { duration: 0.3, ...transition };
|
|
52
|
+
|
|
53
|
+
const defaultRef = useRef(null);
|
|
54
|
+
const resolvedRef = ref || defaultRef;
|
|
55
|
+
|
|
56
|
+
const labelVariants = {
|
|
57
|
+
visible: {
|
|
58
|
+
width: 'auto',
|
|
59
|
+
marginLeft: 12,
|
|
60
|
+
opacity: 1,
|
|
61
|
+
transition: {
|
|
62
|
+
...transition,
|
|
63
|
+
opacity: {
|
|
64
|
+
duration: transition.duration! / 2,
|
|
65
|
+
delay: transition.duration! - transition.duration! / 2,
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
hidden: {
|
|
70
|
+
width: 0,
|
|
71
|
+
marginLeft: 0,
|
|
72
|
+
opacity: 0,
|
|
73
|
+
transition: {
|
|
74
|
+
...transition,
|
|
75
|
+
marginLeft: {
|
|
76
|
+
duration: transition.duration! / 2,
|
|
77
|
+
delay: transition.duration! - transition.duration! / 2,
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
return (
|
|
83
|
+
<ElementType
|
|
84
|
+
{...(restProps as any)}
|
|
85
|
+
ref={resolvedRef}
|
|
86
|
+
href={href}
|
|
87
|
+
aria-label={isExtended ? undefined : label}
|
|
88
|
+
className={styles.fab}
|
|
89
|
+
>
|
|
90
|
+
<ToolTip
|
|
91
|
+
trigger={isExtended ? null : undefined}
|
|
92
|
+
text={label}
|
|
93
|
+
targetRef={resolvedRef}
|
|
94
|
+
/>
|
|
95
|
+
<span className={styles.stateLayer}>
|
|
96
|
+
<RippleEffect
|
|
97
|
+
colorName={classNames({
|
|
98
|
+
primary: variant == 'surface',
|
|
99
|
+
'on-primary-container': variant == 'primary',
|
|
100
|
+
'on-secondary-container': variant == 'secondary',
|
|
101
|
+
'on-tertiary-container': variant == 'tertiary',
|
|
102
|
+
})}
|
|
103
|
+
triggerRef={resolvedRef}
|
|
104
|
+
/>
|
|
105
|
+
</span>
|
|
106
|
+
<Icon icon={icon} className={styles.icon} />
|
|
107
|
+
<AnimatePresence>
|
|
108
|
+
{isExtended && (
|
|
109
|
+
<motion.span
|
|
110
|
+
variants={labelVariants}
|
|
111
|
+
initial="hidden"
|
|
112
|
+
animate="visible"
|
|
113
|
+
exit="hidden"
|
|
114
|
+
className={styles.label}
|
|
115
|
+
>
|
|
116
|
+
{label}
|
|
117
|
+
</motion.span>
|
|
118
|
+
)}
|
|
119
|
+
</AnimatePresence>
|
|
120
|
+
</ElementType>
|
|
121
|
+
);
|
|
122
|
+
};
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
|
+
|
|
3
|
+
import { Icon } from '../icon/icon';
|
|
4
|
+
import { IconButtonInterface } from '../interfaces/icon-button.interface';
|
|
5
|
+
import { iconButtonStyle } from '../styles/icon-button.style';
|
|
6
|
+
import { ReactProps } from '../utils/component';
|
|
7
|
+
import { RippleEffect } from '../effects';
|
|
8
|
+
import { classNames } from '../utils';
|
|
9
|
+
import { ToolTip } from './ToolTip';
|
|
10
|
+
|
|
11
|
+
export type IconButtonVariant = 'standard' | 'filled' | 'tonal' | 'outlined';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Icon buttons help people take minor actions with one tap
|
|
15
|
+
* @status beta
|
|
16
|
+
* @category Action
|
|
17
|
+
*/
|
|
18
|
+
export const IconButton = ({
|
|
19
|
+
variant = 'standard',
|
|
20
|
+
href,
|
|
21
|
+
disabled = false,
|
|
22
|
+
type = 'button',
|
|
23
|
+
title,
|
|
24
|
+
label,
|
|
25
|
+
onToggle,
|
|
26
|
+
activated = false,
|
|
27
|
+
onClick,
|
|
28
|
+
icon,
|
|
29
|
+
size = 'medium',
|
|
30
|
+
iconSelected,
|
|
31
|
+
className,
|
|
32
|
+
ref,
|
|
33
|
+
width = 'default',
|
|
34
|
+
shape = 'rounded',
|
|
35
|
+
allowShapeTransformation = true,
|
|
36
|
+
transition,
|
|
37
|
+
children,
|
|
38
|
+
...restProps
|
|
39
|
+
}: ReactProps<IconButtonInterface>) => {
|
|
40
|
+
if (children) label = children;
|
|
41
|
+
if (!label) {
|
|
42
|
+
throw new Error(
|
|
43
|
+
'IconButton component requires either a label prop or children content to provide an accessible aria-label',
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
if (!title) {
|
|
47
|
+
title = label;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const [isActive, setIsActive] = React.useState(activated);
|
|
51
|
+
|
|
52
|
+
let handleClick;
|
|
53
|
+
if (!onToggle) {
|
|
54
|
+
handleClick = (e: React.MouseEvent<any, MouseEvent>) => {
|
|
55
|
+
if (disabled) {
|
|
56
|
+
e.preventDefault();
|
|
57
|
+
}
|
|
58
|
+
if (onClick) {
|
|
59
|
+
onClick(e);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
} else if (onToggle) {
|
|
63
|
+
handleClick = (e: React.MouseEvent<any, MouseEvent>) => {
|
|
64
|
+
if (disabled) {
|
|
65
|
+
e.preventDefault();
|
|
66
|
+
}
|
|
67
|
+
setIsActive(!isActive);
|
|
68
|
+
onToggle(Boolean(isActive));
|
|
69
|
+
};
|
|
70
|
+
icon = isActive ? (iconSelected ? iconSelected : icon) : icon;
|
|
71
|
+
}
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
setIsActive(activated);
|
|
74
|
+
}, [activated]);
|
|
75
|
+
|
|
76
|
+
// Détermine le type de l'élément à rendre : un bouton ou un lien
|
|
77
|
+
const ElementType = href ? 'a' : 'button';
|
|
78
|
+
|
|
79
|
+
const styles = iconButtonStyle({
|
|
80
|
+
transition,
|
|
81
|
+
shape,
|
|
82
|
+
allowShapeTransformation,
|
|
83
|
+
width,
|
|
84
|
+
href,
|
|
85
|
+
activated: isActive,
|
|
86
|
+
label,
|
|
87
|
+
iconSelected,
|
|
88
|
+
isActive,
|
|
89
|
+
onToggle,
|
|
90
|
+
disabled,
|
|
91
|
+
icon,
|
|
92
|
+
variant,
|
|
93
|
+
className,
|
|
94
|
+
size,
|
|
95
|
+
children: label,
|
|
96
|
+
...restProps,
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
const defaultRef = useRef<HTMLDivElement>(null);
|
|
100
|
+
const resolvedRef = ref || defaultRef;
|
|
101
|
+
|
|
102
|
+
transition = { duration: 0.3, ...transition };
|
|
103
|
+
|
|
104
|
+
return (
|
|
105
|
+
<ElementType
|
|
106
|
+
disabled={disabled}
|
|
107
|
+
href={href}
|
|
108
|
+
style={{ transition: transition.duration + 's' }}
|
|
109
|
+
className={styles.iconButton}
|
|
110
|
+
aria-label={label}
|
|
111
|
+
{...(restProps as any)}
|
|
112
|
+
title={undefined}
|
|
113
|
+
onClick={handleClick}
|
|
114
|
+
ref={resolvedRef}
|
|
115
|
+
>
|
|
116
|
+
<ToolTip
|
|
117
|
+
targetRef={resolvedRef}
|
|
118
|
+
trigger={disabled ? null : undefined}
|
|
119
|
+
text={title}
|
|
120
|
+
></ToolTip>
|
|
121
|
+
|
|
122
|
+
<div className={styles.touchTarget} />
|
|
123
|
+
<div
|
|
124
|
+
className={styles.stateLayer}
|
|
125
|
+
style={{ transition: transition.duration + 's' }}
|
|
126
|
+
>
|
|
127
|
+
{!disabled && (
|
|
128
|
+
<RippleEffect
|
|
129
|
+
colorName={classNames(
|
|
130
|
+
variant === 'standard' && {
|
|
131
|
+
'on-surface-variant': !isActive,
|
|
132
|
+
primary: isActive,
|
|
133
|
+
},
|
|
134
|
+
variant === 'filled' && {
|
|
135
|
+
primary: !isActive && Boolean(onToggle),
|
|
136
|
+
'inverse-on-surface': isActive || !onToggle,
|
|
137
|
+
},
|
|
138
|
+
variant === 'tonal' && {
|
|
139
|
+
'on-surface-variant': !isActive && Boolean(onToggle),
|
|
140
|
+
'on-secondary-container': isActive || !onToggle,
|
|
141
|
+
},
|
|
142
|
+
variant === 'outlined' && {
|
|
143
|
+
'on-surface-variant': !isActive,
|
|
144
|
+
'on-primary': isActive,
|
|
145
|
+
},
|
|
146
|
+
)}
|
|
147
|
+
triggerRef={resolvedRef}
|
|
148
|
+
/>
|
|
149
|
+
)}
|
|
150
|
+
</div>
|
|
151
|
+
|
|
152
|
+
{icon && <Icon icon={icon} className={styles.icon} />}
|
|
153
|
+
</ElementType>
|
|
154
|
+
);
|
|
155
|
+
};
|