@clickhouse/click-ui 0.0.3 → 0.0.5
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/{index.js → click-ui.es.js} +4553 -5052
- package/dist/click-ui.umd.js +442 -0
- package/package.json +14 -6
- package/.eslintrc.cjs +0 -33
- package/.github/workflows/deployment.yml +0 -34
- package/.prettierrc +0 -14
- package/.storybook/main.ts +0 -19
- package/.storybook/manager.ts +0 -11
- package/.storybook/preview-head.html +0 -2
- package/.storybook/preview.tsx +0 -76
- package/.storybook/theme.ts +0 -16
- package/build-tokens.js +0 -131
- package/dist/App.d.ts +0 -2
- package/dist/assets/RightArrow/RightArrow.d.ts +0 -1
- package/dist/assets/S3Logo/S3Logo.d.ts +0 -1
- package/dist/components/Accordion/Accordion.d.ts +0 -27
- package/dist/components/Accordion/Accordion.stories.d.ts +0 -21
- package/dist/components/Accordion/Accordion.test.d.ts +0 -1
- package/dist/components/Alert/Alert.d.ts +0 -16
- package/dist/components/Alert/Alert.stories.d.ts +0 -12
- package/dist/components/Alert/Alert.test.d.ts +0 -1
- package/dist/components/Avatar/Avatar.d.ts +0 -7
- package/dist/components/Avatar/Avatar.stories.d.ts +0 -11
- package/dist/components/Badge/Badge.d.ts +0 -16
- package/dist/components/Badge/Badge.stories.d.ts +0 -34
- package/dist/components/Badge/Badge.test.d.ts +0 -1
- package/dist/components/BigStat/BigStat.d.ts +0 -10
- package/dist/components/BigStat/BigStat.stories.d.ts +0 -20
- package/dist/components/Button/Button.d.ts +0 -23
- package/dist/components/Button/Button.stories.d.ts +0 -28
- package/dist/components/Button/Button.test.d.ts +0 -1
- package/dist/components/ButtonGroup/ButtonGroup.d.ts +0 -6
- package/dist/components/ButtonGroup/ButtonGroup.stories.d.ts +0 -12
- package/dist/components/Card/Card.d.ts +0 -10
- package/dist/components/Card/Card.stories.d.ts +0 -16
- package/dist/components/Checkbox/Checkbox.d.ts +0 -5
- package/dist/components/Checkbox/Checkbox.stories.d.ts +0 -29
- package/dist/components/Checkbox/Checkbox.test.d.ts +0 -1
- package/dist/components/ContextMenu/ContextMenu.d.ts +0 -38
- package/dist/components/ContextMenu/ContextMenu.stories.d.ts +0 -30
- package/dist/components/ContextMenu/ContextMenu.test.d.ts +0 -1
- package/dist/components/Dropdown/Dropdown.d.ts +0 -38
- package/dist/components/Dropdown/Dropdown.stories.d.ts +0 -36
- package/dist/components/Dropdown/Dropdown.test.d.ts +0 -1
- package/dist/components/FormField/Label.d.ts +0 -7
- package/dist/components/FormField/Label.stories.d.ts +0 -28
- package/dist/components/FormField/Select.d.ts +0 -43
- package/dist/components/FormField/Select.stories.d.ts +0 -54
- package/dist/components/FormField/Select.test.d.ts +0 -0
- package/dist/components/FormField/SelectContext.d.ts +0 -24
- package/dist/components/FormField/commonElement.d.ts +0 -1100
- package/dist/components/GenericMenu.d.ts +0 -764
- package/dist/components/HoverCard/HoverCard.d.ts +0 -20
- package/dist/components/HoverCard/HoverCard.stories.d.ts +0 -36
- package/dist/components/HoverCard/HoverCard.test.d.ts +0 -0
- package/dist/components/Icon/Icon.d.ts +0 -571
- package/dist/components/Icon/Icon.stories.d.ts +0 -495
- package/dist/components/Icon/types.d.ts +0 -8
- package/dist/components/IconButton/IconButton.d.ts +0 -15
- package/dist/components/IconButton/IconButton.stories.d.ts +0 -30
- package/dist/components/IconButton/IconButton.test.d.ts +0 -1
- package/dist/components/Panel/Panel.d.ts +0 -11
- package/dist/components/Panel/Panel.stories.d.ts +0 -23
- package/dist/components/Popover/Popover.d.ts +0 -23
- package/dist/components/Popover/Popover.stories.d.ts +0 -43
- package/dist/components/Popover/Popover.test.d.ts +0 -1
- package/dist/components/RadioGroup/RadioGroup.d.ts +0 -17
- package/dist/components/RadioGroup/RadioGroup.stories.d.ts +0 -39
- package/dist/components/RadioGroup/RadioGroup.test.d.ts +0 -1
- package/dist/components/Separator/Separator.d.ts +0 -6
- package/dist/components/SidebarNavigationItem/SidebarNavigationItem.d.ts +0 -17
- package/dist/components/SidebarNavigationItem/SidebarNavigationItem.stories.d.ts +0 -20
- package/dist/components/Spacer/Spacer.d.ts +0 -4
- package/dist/components/Spacer/Spacer.stories.d.ts +0 -19
- package/dist/components/Switch/Switch.d.ts +0 -7
- package/dist/components/Switch/Switch.stories.d.ts +0 -13
- package/dist/components/Table/Table.d.ts +0 -568
- package/dist/components/Table/Table.stories.d.ts +0 -575
- package/dist/components/Tabs/Tabs.d.ts +0 -848
- package/dist/components/Tabs/Tabs.stories.d.ts +0 -845
- package/dist/components/Tabs/Tabs.test.d.ts +0 -1
- package/dist/components/Tooltip/Tooltip.d.ts +0 -17
- package/dist/components/Tooltip/Tooltip.stories.d.ts +0 -45
- package/dist/components/Tooltip/Tooltip.test.d.ts +0 -1
- package/dist/components/Typography/Text/Text.d.ts +0 -12
- package/dist/components/Typography/Text/Text.stories.d.ts +0 -22
- package/dist/components/Typography/Text/Text.test.d.ts +0 -1
- package/dist/components/Typography/Title/Title.d.ts +0 -14
- package/dist/components/Typography/Title/Title.stories.d.ts +0 -35
- package/dist/components/Typography/Title/Title.test.d.ts +0 -1
- package/dist/components/icons/Activity.d.ts +0 -3
- package/dist/components/icons/ArrowDown.d.ts +0 -3
- package/dist/components/icons/ArrowRight.d.ts +0 -3
- package/dist/components/icons/ArrowTriangle.d.ts +0 -3
- package/dist/components/icons/ArrowUp.d.ts +0 -3
- package/dist/components/icons/Backups.d.ts +0 -3
- package/dist/components/icons/Blog.d.ts +0 -3
- package/dist/components/icons/Book.d.ts +0 -3
- package/dist/components/icons/Brackets.d.ts +0 -3
- package/dist/components/icons/Briefcase.d.ts +0 -3
- package/dist/components/icons/Building.d.ts +0 -3
- package/dist/components/icons/BurgerMenu.d.ts +0 -3
- package/dist/components/icons/Cards.d.ts +0 -3
- package/dist/components/icons/CellTower.d.ts +0 -3
- package/dist/components/icons/ChatIcon.d.ts +0 -3
- package/dist/components/icons/CheckIcon.d.ts +0 -3
- package/dist/components/icons/CheckInCircle.d.ts +0 -3
- package/dist/components/icons/ChevronDown.d.ts +0 -2
- package/dist/components/icons/ChevronLeft.d.ts +0 -3
- package/dist/components/icons/ChevronRight.d.ts +0 -2
- package/dist/components/icons/ChevronUp.d.ts +0 -3
- package/dist/components/icons/Clock.d.ts +0 -3
- package/dist/components/icons/Cloud.d.ts +0 -3
- package/dist/components/icons/Code.d.ts +0 -3
- package/dist/components/icons/CodeInSquare.d.ts +0 -3
- package/dist/components/icons/Connect.d.ts +0 -3
- package/dist/components/icons/ConnectAlt.d.ts +0 -3
- package/dist/components/icons/Console.d.ts +0 -3
- package/dist/components/icons/Copy.d.ts +0 -3
- package/dist/components/icons/CrossIcon.d.ts +0 -3
- package/dist/components/icons/Data.d.ts +0 -3
- package/dist/components/icons/DatabaseIcon.d.ts +0 -3
- package/dist/components/icons/Disk.d.ts +0 -3
- package/dist/components/icons/Display.d.ts +0 -3
- package/dist/components/icons/Document.d.ts +0 -3
- package/dist/components/icons/DotsHorizontal.d.ts +0 -3
- package/dist/components/icons/DotsVertical.d.ts +0 -3
- package/dist/components/icons/Email.d.ts +0 -3
- package/dist/components/icons/Empty.d.ts +0 -3
- package/dist/components/icons/FilterIcon.d.ts +0 -3
- package/dist/components/icons/Fire.d.ts +0 -3
- package/dist/components/icons/Flags/EuropeanUnion.d.ts +0 -3
- package/dist/components/icons/Flags/Germany.d.ts +0 -3
- package/dist/components/icons/Flags/India.d.ts +0 -3
- package/dist/components/icons/Flags/Ireland.d.ts +0 -3
- package/dist/components/icons/Flags/Netherlands.d.ts +0 -3
- package/dist/components/icons/Flags/Singapore.d.ts +0 -2
- package/dist/components/icons/Flags/UnitedKingdom.d.ts +0 -3
- package/dist/components/icons/Flags/UnitedStates.d.ts +0 -3
- package/dist/components/icons/Flags/index.d.ts +0 -6
- package/dist/components/icons/Folder.d.ts +0 -3
- package/dist/components/icons/Gift.d.ts +0 -3
- package/dist/components/icons/HistoryIcon.d.ts +0 -3
- package/dist/components/icons/Home.d.ts +0 -3
- package/dist/components/icons/Http.d.ts +0 -3
- package/dist/components/icons/InfoInCircleIcon.d.ts +0 -3
- package/dist/components/icons/InformationIcon.d.ts +0 -3
- package/dist/components/icons/InsertRowIcon.d.ts +0 -3
- package/dist/components/icons/Integrations.d.ts +0 -3
- package/dist/components/icons/LightBulb.d.ts +0 -3
- package/dist/components/icons/Lightening.d.ts +0 -3
- package/dist/components/icons/Loading.d.ts +0 -3
- package/dist/components/icons/Metrics.d.ts +0 -3
- package/dist/components/icons/MetricsAlt.d.ts +0 -3
- package/dist/components/icons/Payment.d.ts +0 -3
- package/dist/components/icons/Payments/Amex.d.ts +0 -3
- package/dist/components/icons/Payments/MasterCard.d.ts +0 -3
- package/dist/components/icons/Payments/Paypal.d.ts +0 -3
- package/dist/components/icons/Payments/Visa.d.ts +0 -3
- package/dist/components/icons/Payments/index.d.ts +0 -6
- package/dist/components/icons/Pencil.d.ts +0 -3
- package/dist/components/icons/PieChart.d.ts +0 -3
- package/dist/components/icons/Play.d.ts +0 -3
- package/dist/components/icons/Plus.d.ts +0 -3
- package/dist/components/icons/Popout.d.ts +0 -3
- package/dist/components/icons/PopoverArrow.d.ts +0 -3
- package/dist/components/icons/Question.d.ts +0 -3
- package/dist/components/icons/Refresh.d.ts +0 -3
- package/dist/components/icons/Search.d.ts +0 -3
- package/dist/components/icons/Secure.d.ts +0 -3
- package/dist/components/icons/Services.d.ts +0 -3
- package/dist/components/icons/Settings.d.ts +0 -3
- package/dist/components/icons/Share.d.ts +0 -3
- package/dist/components/icons/SlideIn.d.ts +0 -3
- package/dist/components/icons/SlideOut.d.ts +0 -3
- package/dist/components/icons/SortAltIcon.d.ts +0 -3
- package/dist/components/icons/SortIcon.d.ts +0 -3
- package/dist/components/icons/Sparkle.d.ts +0 -3
- package/dist/components/icons/Speaker.d.ts +0 -3
- package/dist/components/icons/Speed.d.ts +0 -3
- package/dist/components/icons/Star.d.ts +0 -3
- package/dist/components/icons/Support.d.ts +0 -3
- package/dist/components/icons/Table.d.ts +0 -3
- package/dist/components/icons/Taxi.d.ts +0 -3
- package/dist/components/icons/Trash.d.ts +0 -3
- package/dist/components/icons/Upload.d.ts +0 -3
- package/dist/components/icons/Url.d.ts +0 -3
- package/dist/components/icons/UserIcon.d.ts +0 -2
- package/dist/components/icons/UsersIcon.d.ts +0 -2
- package/dist/components/icons/WarningIcon.d.ts +0 -3
- package/dist/components/index.d.ts +0 -24
- package/dist/components/types.d.ts +0 -1
- package/dist/index.cjs +0 -442
- package/dist/index.d.ts +0 -2
- package/dist/main.d.ts +0 -0
- package/dist/styles/types.d.ts +0 -2087
- package/dist/styles/variables.classic.json.d.ts +0 -204
- package/dist/styles/variables.dark.json.d.ts +0 -896
- package/dist/styles/variables.json.d.ts +0 -2089
- package/dist/styles/variables.light.json.d.ts +0 -951
- package/dist/theme/index.d.ts +0 -10
- package/dist/theme/theme.d.ts +0 -6
- package/index.html +0 -17
- package/jest.config.ts +0 -11
- package/public/favicon.ico +0 -0
- package/public/logo.svg +0 -17
- package/public/vite.svg +0 -1
- package/src/App.css +0 -1
- package/src/App.module.css +0 -235
- package/src/App.tsx +0 -217
- package/src/assets/RightArrow/RightArrow.tsx +0 -17
- package/src/assets/S3Logo/S3Logo.tsx +0 -31
- package/src/assets/react.svg +0 -1
- package/src/components/Accordion/Accordion.stories.tsx +0 -28
- package/src/components/Accordion/Accordion.test.tsx +0 -46
- package/src/components/Accordion/Accordion.tsx +0 -119
- package/src/components/Alert/Alert.stories.tsx +0 -14
- package/src/components/Alert/Alert.test.tsx +0 -27
- package/src/components/Alert/Alert.tsx +0 -130
- package/src/components/Avatar/Avatar.stories.tsx +0 -13
- package/src/components/Avatar/Avatar.tsx +0 -64
- package/src/components/Badge/Badge.stories.ts +0 -30
- package/src/components/Badge/Badge.test.tsx +0 -16
- package/src/components/Badge/Badge.tsx +0 -78
- package/src/components/BigStat/BigStat.stories.ts +0 -20
- package/src/components/BigStat/BigStat.tsx +0 -49
- package/src/components/Button/Button.stories.ts +0 -26
- package/src/components/Button/Button.test.tsx +0 -32
- package/src/components/Button/Button.tsx +0 -115
- package/src/components/ButtonGroup/ButtonGroup.stories.ts +0 -14
- package/src/components/ButtonGroup/ButtonGroup.tsx +0 -78
- package/src/components/Card/Card.stories.ts +0 -19
- package/src/components/Card/Card.tsx +0 -107
- package/src/components/Checkbox/Checkbox.stories.tsx +0 -35
- package/src/components/Checkbox/Checkbox.test.tsx +0 -41
- package/src/components/Checkbox/Checkbox.tsx +0 -89
- package/src/components/ContextMenu/ContextMenu.stories.tsx +0 -73
- package/src/components/ContextMenu/ContextMenu.test.tsx +0 -152
- package/src/components/ContextMenu/ContextMenu.tsx +0 -155
- package/src/components/Dropdown/Dropdown.stories.tsx +0 -64
- package/src/components/Dropdown/Dropdown.test.tsx +0 -141
- package/src/components/Dropdown/Dropdown.tsx +0 -149
- package/src/components/FormField/Label.stories.tsx +0 -39
- package/src/components/FormField/Label.tsx +0 -47
- package/src/components/FormField/Select.stories.tsx +0 -48
- package/src/components/FormField/Select.test.tsx +0 -216
- package/src/components/FormField/Select.tsx +0 -574
- package/src/components/FormField/SelectContext.tsx +0 -101
- package/src/components/FormField/commonElement.tsx +0 -42
- package/src/components/GenericMenu.tsx +0 -114
- package/src/components/HoverCard/HoverCard.stories.tsx +0 -64
- package/src/components/HoverCard/HoverCard.test.tsx +0 -85
- package/src/components/HoverCard/HoverCard.tsx +0 -65
- package/src/components/Icon/Icon.stories.ts +0 -15
- package/src/components/Icon/Icon.tsx +0 -238
- package/src/components/Icon/types.ts +0 -95
- package/src/components/IconButton/IconButton.stories.ts +0 -34
- package/src/components/IconButton/IconButton.test.tsx +0 -32
- package/src/components/IconButton/IconButton.tsx +0 -83
- package/src/components/Panel/Panel.stories.tsx +0 -25
- package/src/components/Panel/Panel.tsx +0 -33
- package/src/components/Popover/Popover.stories.tsx +0 -67
- package/src/components/Popover/Popover.test.tsx +0 -46
- package/src/components/Popover/Popover.tsx +0 -115
- package/src/components/RadioGroup/RadioGroup.stories.tsx +0 -43
- package/src/components/RadioGroup/RadioGroup.test.tsx +0 -59
- package/src/components/RadioGroup/RadioGroup.tsx +0 -149
- package/src/components/Separator/Separator.stories.tsx +0 -24
- package/src/components/Separator/Separator.tsx +0 -29
- package/src/components/SidebarNavigationItem/SidebarNavigationItem.stories.tsx +0 -28
- package/src/components/SidebarNavigationItem/SidebarNavigationItem.tsx +0 -112
- package/src/components/Spacer/Spacer.stories.tsx +0 -20
- package/src/components/Spacer/Spacer.tsx +0 -15
- package/src/components/Switch/Switch.stories.ts +0 -14
- package/src/components/Switch/Switch.tsx +0 -107
- package/src/components/Table/Table.stories.tsx +0 -29
- package/src/components/Table/Table.tsx +0 -109
- package/src/components/Tabs/Tabs.stories.tsx +0 -36
- package/src/components/Tabs/Tabs.test.tsx +0 -86
- package/src/components/Tabs/Tabs.tsx +0 -82
- package/src/components/Tooltip/Tooltip.stories.tsx +0 -68
- package/src/components/Tooltip/Tooltip.test.tsx +0 -44
- package/src/components/Tooltip/Tooltip.tsx +0 -67
- package/src/components/Typography/Text/Text.stories.tsx +0 -22
- package/src/components/Typography/Text/Text.test.tsx +0 -16
- package/src/components/Typography/Text/Text.tsx +0 -30
- package/src/components/Typography/Title/Title.stories.tsx +0 -31
- package/src/components/Typography/Title/Title.test.tsx +0 -16
- package/src/components/Typography/Title/Title.tsx +0 -36
- package/src/components/icons/Activity.tsx +0 -30
- package/src/components/icons/ArrowDown.tsx +0 -22
- package/src/components/icons/ArrowRight.tsx +0 -22
- package/src/components/icons/ArrowTriangle.tsx +0 -36
- package/src/components/icons/ArrowUp.tsx +0 -22
- package/src/components/icons/Backups.tsx +0 -29
- package/src/components/icons/Blog.tsx +0 -38
- package/src/components/icons/Book.tsx +0 -30
- package/src/components/icons/Brackets.tsx +0 -22
- package/src/components/icons/Briefcase.tsx +0 -30
- package/src/components/icons/Building.tsx +0 -30
- package/src/components/icons/BurgerMenu.tsx +0 -22
- package/src/components/icons/Cards.tsx +0 -30
- package/src/components/icons/CellTower.tsx +0 -21
- package/src/components/icons/ChatIcon.tsx +0 -22
- package/src/components/icons/CheckIcon.tsx +0 -21
- package/src/components/icons/CheckInCircle.tsx +0 -39
- package/src/components/icons/ChevronDown.tsx +0 -20
- package/src/components/icons/ChevronLeft.tsx +0 -22
- package/src/components/icons/ChevronRight.tsx +0 -20
- package/src/components/icons/ChevronUp.tsx +0 -22
- package/src/components/icons/Clock.tsx +0 -37
- package/src/components/icons/Cloud.tsx +0 -23
- package/src/components/icons/Code.tsx +0 -22
- package/src/components/icons/CodeInSquare.tsx +0 -30
- package/src/components/icons/Connect.tsx +0 -22
- package/src/components/icons/ConnectAlt.tsx +0 -30
- package/src/components/icons/Console.tsx +0 -30
- package/src/components/icons/Copy.tsx +0 -33
- package/src/components/icons/CrossIcon.tsx +0 -29
- package/src/components/icons/Data.tsx +0 -36
- package/src/components/icons/DatabaseIcon.tsx +0 -31
- package/src/components/icons/Disk.tsx +0 -30
- package/src/components/icons/Display.tsx +0 -30
- package/src/components/icons/Document.tsx +0 -30
- package/src/components/icons/DotsHorizontal.tsx +0 -36
- package/src/components/icons/DotsVertical.tsx +0 -33
- package/src/components/icons/Email.tsx +0 -33
- package/src/components/icons/Empty.tsx +0 -14
- package/src/components/icons/FilterIcon.tsx +0 -37
- package/src/components/icons/Fire.tsx +0 -23
- package/src/components/icons/Flags/EuropeanUnion.tsx +0 -174
- package/src/components/icons/Flags/Germany.tsx +0 -25
- package/src/components/icons/Flags/India.tsx +0 -48
- package/src/components/icons/Flags/Ireland.tsx +0 -32
- package/src/components/icons/Flags/Netherlands.tsx +0 -29
- package/src/components/icons/Flags/Singapore.tsx +0 -43
- package/src/components/icons/Flags/UnitedKingdom.tsx +0 -32
- package/src/components/icons/Flags/UnitedStates.tsx +0 -26
- package/src/components/icons/Flags/index.tsx +0 -46
- package/src/components/icons/Folder.tsx +0 -20
- package/src/components/icons/Gift.tsx +0 -21
- package/src/components/icons/HistoryIcon.tsx +0 -28
- package/src/components/icons/Home.tsx +0 -29
- package/src/components/icons/Http.tsx +0 -22
- package/src/components/icons/Icons.mdx +0 -39
- package/src/components/icons/InfoInCircleIcon.tsx +0 -37
- package/src/components/icons/InformationIcon.tsx +0 -34
- package/src/components/icons/InsertRowIcon.tsx +0 -34
- package/src/components/icons/Integrations.tsx +0 -29
- package/src/components/icons/LightBulb.tsx +0 -40
- package/src/components/icons/Lightening.tsx +0 -30
- package/src/components/icons/Loading.tsx +0 -57
- package/src/components/icons/Metrics.tsx +0 -38
- package/src/components/icons/MetricsAlt.tsx +0 -30
- package/src/components/icons/Payment.tsx +0 -23
- package/src/components/icons/Payments/Amex.tsx +0 -44
- package/src/components/icons/Payments/MasterCard.tsx +0 -48
- package/src/components/icons/Payments/Paypal.tsx +0 -41
- package/src/components/icons/Payments/Visa.tsx +0 -36
- package/src/components/icons/Payments/index.tsx +0 -30
- package/src/components/icons/Pencil.tsx +0 -30
- package/src/components/icons/PieChart.tsx +0 -30
- package/src/components/icons/Play.tsx +0 -30
- package/src/components/icons/Plus.tsx +0 -22
- package/src/components/icons/Popout.tsx +0 -22
- package/src/components/icons/PopoverArrow.tsx +0 -22
- package/src/components/icons/Question.tsx +0 -30
- package/src/components/icons/Refresh.tsx +0 -29
- package/src/components/icons/Search.tsx +0 -22
- package/src/components/icons/Secure.tsx +0 -30
- package/src/components/icons/Services.tsx +0 -23
- package/src/components/icons/Settings.tsx +0 -22
- package/src/components/icons/Share.tsx +0 -29
- package/src/components/icons/SlideIn.tsx +0 -28
- package/src/components/icons/SlideOut.tsx +0 -28
- package/src/components/icons/SortAltIcon.tsx +0 -22
- package/src/components/icons/SortIcon.tsx +0 -24
- package/src/components/icons/Sparkle.tsx +0 -23
- package/src/components/icons/Speaker.tsx +0 -30
- package/src/components/icons/Speed.tsx +0 -29
- package/src/components/icons/Star.tsx +0 -23
- package/src/components/icons/Support.tsx +0 -37
- package/src/components/icons/Table.tsx +0 -30
- package/src/components/icons/Taxi.tsx +0 -120
- package/src/components/icons/Trash.tsx +0 -22
- package/src/components/icons/Upload.tsx +0 -29
- package/src/components/icons/Url.tsx +0 -22
- package/src/components/icons/UserIcon.tsx +0 -17
- package/src/components/icons/UsersIcon.tsx +0 -43
- package/src/components/icons/WarningIcon.tsx +0 -30
- package/src/components/index.ts +0 -35
- package/src/components/types.ts +0 -1
- package/src/index.css +0 -9
- package/src/index.ts +0 -2
- package/src/main.tsx +0 -11
- package/src/stories/assets/code-brackets.svg +0 -1
- package/src/stories/assets/colors.svg +0 -1
- package/src/stories/assets/comments.svg +0 -1
- package/src/stories/assets/direction.svg +0 -1
- package/src/stories/assets/flow.svg +0 -1
- package/src/stories/assets/plugin.svg +0 -1
- package/src/stories/assets/repo.svg +0 -1
- package/src/stories/assets/stackalt.svg +0 -1
- package/src/styles/Home.module.css +0 -235
- package/src/styles/globals.css +0 -111
- package/src/styles/types.ts +0 -2089
- package/src/styles/variables.classic.css +0 -16
- package/src/styles/variables.classic.json +0 -202
- package/src/styles/variables.css +0 -763
- package/src/styles/variables.dark.css +0 -135
- package/src/styles/variables.dark.json +0 -894
- package/src/styles/variables.json +0 -2087
- package/src/styles/variables.light.css +0 -203
- package/src/styles/variables.light.json +0 -949
- package/src/theme/index.ts +0 -22
- package/src/theme/theme.tsx +0 -28
- package/src/vite-env.d.ts +0 -1
- package/tokens/themes/$metadata.json +0 -9
- package/tokens/themes/$themes.json +0 -3657
- package/tokens/themes/classic.json +0 -550
- package/tokens/themes/component.json +0 -2252
- package/tokens/themes/dark.json +0 -2563
- package/tokens/themes/light.json +0 -2645
- package/tokens/themes/primitives.json +0 -947
- package/tsconfig.json +0 -27
- package/tsconfig.node.json +0 -10
- package/vite.config.ts +0 -40
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { IconButton } from "./IconButton";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
component: IconButton,
|
|
5
|
-
title: "Buttons/IconButton",
|
|
6
|
-
tags: ["icon-button","autodocs"],
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export const Playground = {
|
|
10
|
-
args: {
|
|
11
|
-
icon: "user",
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export const Disabled = {
|
|
16
|
-
args: {
|
|
17
|
-
disabled: true,
|
|
18
|
-
icon: "user",
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export const Empty = {
|
|
23
|
-
args: {
|
|
24
|
-
display: "empty",
|
|
25
|
-
icon: "user",
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export const Small = {
|
|
30
|
-
args: {
|
|
31
|
-
size: "small",
|
|
32
|
-
icon: "user",
|
|
33
|
-
},
|
|
34
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { ThemeProvider } from "styled-components";
|
|
2
|
-
import { IconButton, IconButtonProps } from "./IconButton";
|
|
3
|
-
import { themes } from "../../theme";
|
|
4
|
-
import { render, fireEvent } from "@testing-library/react";
|
|
5
|
-
|
|
6
|
-
describe("Button", () => {
|
|
7
|
-
const renderButton = (props: IconButtonProps) =>
|
|
8
|
-
render(
|
|
9
|
-
<ThemeProvider theme={themes.dark}>
|
|
10
|
-
<IconButton {...props} />
|
|
11
|
-
</ThemeProvider>
|
|
12
|
-
);
|
|
13
|
-
|
|
14
|
-
it("should render the button", () => {
|
|
15
|
-
const { getAllByRole } = renderButton({ icon: "user" });
|
|
16
|
-
expect(getAllByRole("button").length).toEqual(1);
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it("should execute action on click", () => {
|
|
20
|
-
let counter = 0;
|
|
21
|
-
const handleClick = () => (counter = 1);
|
|
22
|
-
const { getByRole } = renderButton({
|
|
23
|
-
onClick: handleClick,
|
|
24
|
-
icon: "user",
|
|
25
|
-
});
|
|
26
|
-
const button = getByRole("button");
|
|
27
|
-
button.focus();
|
|
28
|
-
fireEvent.click(button);
|
|
29
|
-
|
|
30
|
-
expect(counter).toEqual(1);
|
|
31
|
-
});
|
|
32
|
-
});
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { Icon } from "@/components";
|
|
2
|
-
import { IconName } from "@/components/Icon/types";
|
|
3
|
-
import { HTMLAttributes, forwardRef } from "react";
|
|
4
|
-
import styled from "styled-components";
|
|
5
|
-
|
|
6
|
-
export interface IconButtonProps extends HTMLAttributes<HTMLButtonElement> {
|
|
7
|
-
size?: "small" | "medium" | "large";
|
|
8
|
-
disabled?: boolean;
|
|
9
|
-
type?: "primary" | "secondary";
|
|
10
|
-
icon: IconName;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface StyledButtonProps {
|
|
14
|
-
size?: "small" | "medium" | "large";
|
|
15
|
-
disabled?: boolean;
|
|
16
|
-
styleType?: "primary" | "secondary";
|
|
17
|
-
icon: IconName;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(
|
|
21
|
-
({ type = "primary", icon, size = "medium", ...props }, ref) => {
|
|
22
|
-
return (
|
|
23
|
-
<Button
|
|
24
|
-
{...props}
|
|
25
|
-
styleType={type}
|
|
26
|
-
ref={ref}
|
|
27
|
-
>
|
|
28
|
-
<Icon
|
|
29
|
-
name={icon}
|
|
30
|
-
size={size}
|
|
31
|
-
/>
|
|
32
|
-
</Button>
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
IconButton.displayName = "IconButton";
|
|
38
|
-
|
|
39
|
-
const Button = styled.button<Partial<StyledButtonProps>>`
|
|
40
|
-
border-radius: ${props => props.theme.click.button.iconButton.radii.all};
|
|
41
|
-
border-color: ${props =>
|
|
42
|
-
props.theme.click.button.iconButton.color.primary.stroke.default};
|
|
43
|
-
padding: ${props =>
|
|
44
|
-
`${props.theme.click.button.iconButton.default.space.y} ${props.theme.click.button.iconButton.default.space.x}`};
|
|
45
|
-
|
|
46
|
-
background-color: ${props =>
|
|
47
|
-
props.styleType === "primary"
|
|
48
|
-
? props.theme.click.button.iconButton.color.primary.background.default
|
|
49
|
-
: props.theme.click.button.iconButton.color.secondary.background.default};
|
|
50
|
-
|
|
51
|
-
color: ${props =>
|
|
52
|
-
props.styleType === "primary"
|
|
53
|
-
? props.theme.click.button.iconButton.color.primary.text.default
|
|
54
|
-
: props.theme.click.button.iconButton.color.secondary.text.default};
|
|
55
|
-
|
|
56
|
-
&:hover {
|
|
57
|
-
background-color: ${props =>
|
|
58
|
-
props.styleType === "primary"
|
|
59
|
-
? props.theme.click.button.iconButton.color.primary.background.hover
|
|
60
|
-
: props.theme.click.button.iconButton.color.secondary.background.hover};
|
|
61
|
-
color: ${props =>
|
|
62
|
-
props.styleType === "primary"
|
|
63
|
-
? props.theme.click.button.iconButton.color.primary.text.hover
|
|
64
|
-
: props.theme.click.button.iconButton.color.secondary.text.hover};
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
&:active {
|
|
68
|
-
background-color: ${props =>
|
|
69
|
-
props.styleType === "primary"
|
|
70
|
-
? props.theme.click.button.iconButton.color.primary.background.active
|
|
71
|
-
: props.theme.click.button.iconButton.color.secondary.background.active};
|
|
72
|
-
color: ${props =>
|
|
73
|
-
props.styleType === "primary"
|
|
74
|
-
? props.theme.click.button.iconButton.color.primary.text.default
|
|
75
|
-
: props.theme.click.button.iconButton.color.secondary.text.default};
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
&[disabled] {
|
|
79
|
-
background-color: ${props =>
|
|
80
|
-
props.theme.click.button.iconButton.color.disabled.background.default};
|
|
81
|
-
color: ${props => props.theme.click.button.iconButton.color.disabled.text.default};
|
|
82
|
-
}
|
|
83
|
-
`;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Panel } from "./Panel";
|
|
2
|
-
import { Text } from "../Typography/Text/Text";
|
|
3
|
-
import { Title } from "../Typography/Title/Title";
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
component: Panel,
|
|
7
|
-
title: "Display/Panel",
|
|
8
|
-
tags: ["panel","autodocs"],
|
|
9
|
-
argTypes: {
|
|
10
|
-
padding: {
|
|
11
|
-
options: ["none", "xs", "sm", "md", "lg", "xl"],
|
|
12
|
-
control: { type: "select" },
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const Playground = {
|
|
18
|
-
args: {
|
|
19
|
-
color: "default",
|
|
20
|
-
padding: "md",
|
|
21
|
-
hasBorder: true,
|
|
22
|
-
hasShadow: true,
|
|
23
|
-
children: <div><Title type='h3'>Example panel title</Title><br /><Text size="md" color="default">Panel content</Text></div>
|
|
24
|
-
},
|
|
25
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
2
|
-
|
|
3
|
-
export type panelPadding = "none" | "xs" | "sm" | "md" | "lg" | "xl";
|
|
4
|
-
export type panelColor = "default" | "muted" | "transparent";
|
|
5
|
-
|
|
6
|
-
export interface panelProps {
|
|
7
|
-
hasBorder?: boolean;
|
|
8
|
-
hasShadow?: boolean;
|
|
9
|
-
color?: panelColor;
|
|
10
|
-
padding?: panelPadding;
|
|
11
|
-
children?: React.ReactNode;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const Panel = ({
|
|
15
|
-
hasBorder,
|
|
16
|
-
hasShadow,
|
|
17
|
-
color,
|
|
18
|
-
padding,
|
|
19
|
-
children
|
|
20
|
-
}: panelProps) => (
|
|
21
|
-
<Wrapper hasBorder={hasBorder} hasShadow={hasShadow} color={color} padding={padding}>
|
|
22
|
-
{children}
|
|
23
|
-
</Wrapper>
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
const Wrapper = styled.div<panelProps>`
|
|
27
|
-
background-color: ${({ color = "default", theme }) => theme.click.panel.color.background[color]};
|
|
28
|
-
border-radius: ${({ theme }) => theme.click.panel.radii.all};
|
|
29
|
-
padding: ${({ padding = "md", theme }) => theme.click.panel.space.y[padding]};
|
|
30
|
-
border: ${({ hasBorder, theme }) => hasBorder ? `1px solid ${theme.click.global.color.stroke.default}` : "none"};
|
|
31
|
-
box-shadow: ${({ hasShadow, theme }) => hasShadow ? theme.shadow[1] : "none"};
|
|
32
|
-
display: flex;
|
|
33
|
-
`;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { Checkbox } from "..";
|
|
2
|
-
import { GridCenter } from "../FormField/commonElement";
|
|
3
|
-
import { Text } from "../Typography/Text/Text";
|
|
4
|
-
import { Title } from "../Typography/Title/Title";
|
|
5
|
-
import { Popover } from "./Popover";
|
|
6
|
-
|
|
7
|
-
const PopoverComponent = ({
|
|
8
|
-
open,
|
|
9
|
-
modal,
|
|
10
|
-
showArrow,
|
|
11
|
-
showClose,
|
|
12
|
-
forceMount,
|
|
13
|
-
side,
|
|
14
|
-
}: {
|
|
15
|
-
open: "default" | "open" | "closed";
|
|
16
|
-
modal: boolean;
|
|
17
|
-
showArrow: boolean;
|
|
18
|
-
showClose: boolean;
|
|
19
|
-
forceMount?: boolean;
|
|
20
|
-
side: "top" | "right" | "left" | "bottom";
|
|
21
|
-
}) => (
|
|
22
|
-
<GridCenter>
|
|
23
|
-
<Popover
|
|
24
|
-
open={open === "default" ? undefined : open === "open"}
|
|
25
|
-
modal={modal}
|
|
26
|
-
>
|
|
27
|
-
<Popover.Trigger>
|
|
28
|
-
<div>Click Here</div>
|
|
29
|
-
</Popover.Trigger>
|
|
30
|
-
<Popover.Content
|
|
31
|
-
side={side}
|
|
32
|
-
showArrow={showArrow}
|
|
33
|
-
showClose={showClose}
|
|
34
|
-
forceMount={forceMount ? true : undefined}
|
|
35
|
-
>
|
|
36
|
-
<Title type="h2">Content popover</Title>
|
|
37
|
-
<br />
|
|
38
|
-
<Text>Click on the input element below.</Text>
|
|
39
|
-
<br />
|
|
40
|
-
<Checkbox label="This is a sample data to experiment the popover" />
|
|
41
|
-
</Popover.Content>
|
|
42
|
-
</Popover>
|
|
43
|
-
</GridCenter>
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
export default {
|
|
47
|
-
component: PopoverComponent,
|
|
48
|
-
title: "Display/Popover",
|
|
49
|
-
tags: ["autodocs", "form-field", "popover"],
|
|
50
|
-
argTypes: {
|
|
51
|
-
open: { control: "inline-radio", options: ["default", "open", "closed"] },
|
|
52
|
-
modal: { control: "boolean" },
|
|
53
|
-
showArrow: { control: "boolean" },
|
|
54
|
-
showClose: { control: "boolean" },
|
|
55
|
-
forceMount: { control: "boolean" },
|
|
56
|
-
side: { control: "select", options: ["top", "right", "left", "bottom"] },
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export const Default = {
|
|
61
|
-
args: {
|
|
62
|
-
open: "default",
|
|
63
|
-
showArrow: true,
|
|
64
|
-
showClose: true,
|
|
65
|
-
side: "bottom",
|
|
66
|
-
},
|
|
67
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { ThemeProvider } from "styled-components";
|
|
2
|
-
import { themes } from "../../theme";
|
|
3
|
-
import { PopoverProps } from "@radix-ui/react-popover";
|
|
4
|
-
import { Checkbox, Popover } from "@/components";
|
|
5
|
-
import { render, fireEvent } from "@testing-library/react";
|
|
6
|
-
|
|
7
|
-
describe("Popover", () => {
|
|
8
|
-
const renderPopover = (props: PopoverProps) =>
|
|
9
|
-
render(
|
|
10
|
-
<ThemeProvider theme={themes.dark}>
|
|
11
|
-
<Popover {...props}>
|
|
12
|
-
<Popover.Trigger>
|
|
13
|
-
<div>Click Here</div>
|
|
14
|
-
</Popover.Trigger>
|
|
15
|
-
<Popover.Content>
|
|
16
|
-
<div>
|
|
17
|
-
Click on the input element below
|
|
18
|
-
<Checkbox />
|
|
19
|
-
<div>This is a sample data to experiment the popover</div>
|
|
20
|
-
</div>
|
|
21
|
-
</Popover.Content>
|
|
22
|
-
</Popover>
|
|
23
|
-
</ThemeProvider>
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
it("should open popover on click", () => {
|
|
27
|
-
const { getByText } = renderPopover({});
|
|
28
|
-
const popoverTrigger = getByText("Click Here");
|
|
29
|
-
expect(popoverTrigger).not.toBeNull();
|
|
30
|
-
fireEvent.click(popoverTrigger);
|
|
31
|
-
|
|
32
|
-
expect(getByText("Click on the input element below")).not.toBeNull();
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it("should not close popover on clicking the checkbox", () => {
|
|
36
|
-
const { getByText, getByTestId } = renderPopover({});
|
|
37
|
-
const popoverTrigger = getByText("Click Here");
|
|
38
|
-
expect(popoverTrigger).not.toBeNull();
|
|
39
|
-
fireEvent.click(popoverTrigger);
|
|
40
|
-
|
|
41
|
-
expect(getByText("Click on the input element below")).not.toBeNull();
|
|
42
|
-
const checkbox = getByTestId("checkbox");
|
|
43
|
-
fireEvent.click(checkbox);
|
|
44
|
-
expect(getByText("Click on the input element below")).not.toBeNull();
|
|
45
|
-
});
|
|
46
|
-
});
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import * as RadixPopover from "@radix-ui/react-popover";
|
|
2
|
-
import { Arrow, GenericMenuPanel } from "../GenericMenu";
|
|
3
|
-
import styled from "styled-components";
|
|
4
|
-
import { ReactNode } from "react";
|
|
5
|
-
import { Icon } from "..";
|
|
6
|
-
import { EmptyButton } from "../FormField/commonElement";
|
|
7
|
-
import PopoverArrow from "../icons/PopoverArrow";
|
|
8
|
-
|
|
9
|
-
export const Popover = ({ children, ...props }: RadixPopover.PopoverProps) => {
|
|
10
|
-
return <RadixPopover.Root {...props}>{children}</RadixPopover.Root>;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const Trigger = styled(RadixPopover.Trigger)`
|
|
14
|
-
width: fit-content;
|
|
15
|
-
background: transparent;
|
|
16
|
-
border: none;
|
|
17
|
-
`;
|
|
18
|
-
|
|
19
|
-
interface TriggerProps extends RadixPopover.PopoverTriggerProps {
|
|
20
|
-
anchor?: ReactNode;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const PopoverTrigger = ({ children, anchor, ...props }: TriggerProps) => {
|
|
24
|
-
return (
|
|
25
|
-
<>
|
|
26
|
-
<Trigger
|
|
27
|
-
asChild
|
|
28
|
-
{...props}
|
|
29
|
-
>
|
|
30
|
-
{children}
|
|
31
|
-
</Trigger>
|
|
32
|
-
{anchor && <RadixPopover.Anchor asChild>{anchor}</RadixPopover.Anchor>}
|
|
33
|
-
</>
|
|
34
|
-
);
|
|
35
|
-
};
|
|
36
|
-
PopoverTrigger.displayName = "PopoverTrigger";
|
|
37
|
-
Popover.Trigger = PopoverTrigger;
|
|
38
|
-
|
|
39
|
-
interface PopoverContentProps extends RadixPopover.PopoverContentProps {
|
|
40
|
-
showArrow?: boolean;
|
|
41
|
-
showClose?: boolean;
|
|
42
|
-
forceMount?: true;
|
|
43
|
-
container?: HTMLElement | null;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const MenuPanel = styled(GenericMenuPanel)<{ showClose?: boolean }>`
|
|
47
|
-
display: block;
|
|
48
|
-
padding: ${({ theme }) => theme.click.popover.space.y}
|
|
49
|
-
${({ theme }) => theme.click.popover.space.x};
|
|
50
|
-
background-color: ${({ theme }) => theme.click.popover.color.panel.background.default};
|
|
51
|
-
border: 1px solid ${({ theme }) => theme.click.popover.color.panel.stroke.default};
|
|
52
|
-
border-radius: ${({ theme }) => theme.click.popover.radii.all};
|
|
53
|
-
box-shadow: ${({ theme }) => theme.click.popover.shadow.default};
|
|
54
|
-
|
|
55
|
-
${({ showClose }) =>
|
|
56
|
-
showClose
|
|
57
|
-
? `
|
|
58
|
-
padding-top: 1rem;
|
|
59
|
-
`
|
|
60
|
-
: ""};
|
|
61
|
-
`;
|
|
62
|
-
|
|
63
|
-
const CloseButton = styled(EmptyButton)`
|
|
64
|
-
position: absolute;
|
|
65
|
-
top: ${({ theme }) => theme.click.popover.space.y};
|
|
66
|
-
right: ${({ theme }) => theme.click.popover.space.x};
|
|
67
|
-
width: ${({ theme }) => theme.click.popover.icon.size.width};
|
|
68
|
-
height: ${({ theme }) => theme.click.popover.icon.size.height};
|
|
69
|
-
`;
|
|
70
|
-
|
|
71
|
-
const PopoverContent = ({
|
|
72
|
-
children,
|
|
73
|
-
showArrow,
|
|
74
|
-
showClose,
|
|
75
|
-
forceMount,
|
|
76
|
-
container,
|
|
77
|
-
...props
|
|
78
|
-
}: PopoverContentProps) => {
|
|
79
|
-
return (
|
|
80
|
-
<RadixPopover.Portal
|
|
81
|
-
forceMount={forceMount}
|
|
82
|
-
container={container}
|
|
83
|
-
>
|
|
84
|
-
<MenuPanel
|
|
85
|
-
as={RadixPopover.Content}
|
|
86
|
-
type="popover"
|
|
87
|
-
showClose={showClose}
|
|
88
|
-
$showArrow={showArrow}
|
|
89
|
-
{...props}
|
|
90
|
-
>
|
|
91
|
-
{showClose && (
|
|
92
|
-
<CloseButton
|
|
93
|
-
as={RadixPopover.Close}
|
|
94
|
-
asChild
|
|
95
|
-
>
|
|
96
|
-
<Icon name="cross" />
|
|
97
|
-
</CloseButton>
|
|
98
|
-
)}
|
|
99
|
-
{showArrow && (
|
|
100
|
-
<Arrow
|
|
101
|
-
asChild
|
|
102
|
-
as={RadixPopover.Arrow}
|
|
103
|
-
width={20}
|
|
104
|
-
height={10}
|
|
105
|
-
>
|
|
106
|
-
<PopoverArrow />
|
|
107
|
-
</Arrow>
|
|
108
|
-
)}
|
|
109
|
-
{children}
|
|
110
|
-
</MenuPanel>
|
|
111
|
-
</RadixPopover.Portal>
|
|
112
|
-
);
|
|
113
|
-
};
|
|
114
|
-
PopoverContent.displayName = "PopoverContent";
|
|
115
|
-
Popover.Content = PopoverContent;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { RadioGroup, RadioGroupProps } from "./RadioGroup";
|
|
2
|
-
|
|
3
|
-
const RadioGroupComponent = (props: RadioGroupProps) => {
|
|
4
|
-
return (
|
|
5
|
-
<RadioGroup {...props}>
|
|
6
|
-
<RadioGroup.Item
|
|
7
|
-
label="Radio Button1"
|
|
8
|
-
value="RadioButton1"
|
|
9
|
-
/>
|
|
10
|
-
<RadioGroup.Item
|
|
11
|
-
label="Radio Button2"
|
|
12
|
-
value="RadioButton2"
|
|
13
|
-
/>
|
|
14
|
-
<RadioGroup.Item
|
|
15
|
-
label="Radio Button3"
|
|
16
|
-
value="RadioButton3"
|
|
17
|
-
/>
|
|
18
|
-
</RadioGroup>
|
|
19
|
-
);
|
|
20
|
-
};
|
|
21
|
-
export default {
|
|
22
|
-
component: RadioGroupComponent,
|
|
23
|
-
title: "Forms/RadioGroup",
|
|
24
|
-
tags: ["radio", "autodocs"],
|
|
25
|
-
argTypes: {
|
|
26
|
-
disabled: { control: "boolean" },
|
|
27
|
-
required: { control: "boolean" },
|
|
28
|
-
inline: { control: "boolean" },
|
|
29
|
-
dir: { control: "inline-radio", options: ["ltr", "rtl"] },
|
|
30
|
-
orientation: { control: "inline-radio", options: ["horizontal", "vertical"] },
|
|
31
|
-
loop: { control: "inline-radio", options: [undefined, true, false] },
|
|
32
|
-
value: {
|
|
33
|
-
control: "select",
|
|
34
|
-
options: [undefined, "RadioButton1", "RadioButton2", "RadioButton3"],
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export const Default = {
|
|
40
|
-
args: {
|
|
41
|
-
disabled: false,
|
|
42
|
-
},
|
|
43
|
-
};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { ThemeProvider } from "styled-components";
|
|
2
|
-
import { themes } from "../../theme";
|
|
3
|
-
import { fireEvent, render } from "@testing-library/react";
|
|
4
|
-
import { RadioGroup } from "@/components";
|
|
5
|
-
import { RadioGroupProps } from "./RadioGroup";
|
|
6
|
-
|
|
7
|
-
describe("RadioGroup", () => {
|
|
8
|
-
const renderRadioGroup = (props: RadioGroupProps) =>
|
|
9
|
-
render(
|
|
10
|
-
<ThemeProvider theme={themes.dark}>
|
|
11
|
-
<RadioGroup
|
|
12
|
-
inline
|
|
13
|
-
{...props}
|
|
14
|
-
>
|
|
15
|
-
<RadioGroup.Item
|
|
16
|
-
id="RadioButton1"
|
|
17
|
-
label="Radio Button1"
|
|
18
|
-
value="RadioButton1"
|
|
19
|
-
/>
|
|
20
|
-
<RadioGroup.Item
|
|
21
|
-
label="Radio Button2"
|
|
22
|
-
value="RadioButton2"
|
|
23
|
-
id="RadioButton2"
|
|
24
|
-
/>
|
|
25
|
-
<RadioGroup.Item
|
|
26
|
-
label="Radio Button3"
|
|
27
|
-
value="RadioButton3"
|
|
28
|
-
id="RadioButton3"
|
|
29
|
-
/>
|
|
30
|
-
</RadioGroup>
|
|
31
|
-
</ThemeProvider>
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
it("should execute action on click", () => {
|
|
35
|
-
const handleClick = jest.fn();
|
|
36
|
-
const { getByLabelText } = renderRadioGroup({
|
|
37
|
-
onValueChange: handleClick,
|
|
38
|
-
});
|
|
39
|
-
const radio = getByLabelText("Radio Button1");
|
|
40
|
-
expect(radio.dataset.state).toBe("unchecked");
|
|
41
|
-
fireEvent.click(radio);
|
|
42
|
-
expect(radio.dataset.state).toBe("checked");
|
|
43
|
-
expect(handleClick).toBeCalledTimes(1);
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it("should not execute action on click if the radio is disabled", () => {
|
|
47
|
-
const handleClick = jest.fn();
|
|
48
|
-
const { getByLabelText } = renderRadioGroup({
|
|
49
|
-
onValueChange: handleClick,
|
|
50
|
-
disabled: true,
|
|
51
|
-
});
|
|
52
|
-
const radio = getByLabelText("Radio Button2");
|
|
53
|
-
expect(radio.dataset.state).toBe("unchecked");
|
|
54
|
-
expect(radio).not.toBeNull();
|
|
55
|
-
fireEvent.click(radio);
|
|
56
|
-
expect(radio.dataset.state).toBe("unchecked");
|
|
57
|
-
expect(handleClick).toBeCalledTimes(0);
|
|
58
|
-
});
|
|
59
|
-
});
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import * as RadixRadioGroup from "@radix-ui/react-radio-group";
|
|
2
|
-
import { HTMLAttributes, ReactNode, useId } from "react";
|
|
3
|
-
import styled from "styled-components";
|
|
4
|
-
|
|
5
|
-
export interface RadioGroupProps extends RadixRadioGroup.RadioGroupProps {
|
|
6
|
-
inline?: boolean;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const RadioGroupRoot = styled(RadixRadioGroup.Root)<{ inline: "true" | "false" }>`
|
|
10
|
-
display: flex;
|
|
11
|
-
flex-wrap: wrap;
|
|
12
|
-
gap: ${({ theme }) => theme.click.checkbox.space.gap};
|
|
13
|
-
flex-direction: ${({ inline }) => (inline === "true" ? "row" : "column")};
|
|
14
|
-
`;
|
|
15
|
-
|
|
16
|
-
export const RadioGroup = ({ children, inline, ...props }: RadioGroupProps) => {
|
|
17
|
-
return (
|
|
18
|
-
<RadioGroupRoot
|
|
19
|
-
inline={inline === true ? "true" : "false"}
|
|
20
|
-
{...props}
|
|
21
|
-
>
|
|
22
|
-
{children}
|
|
23
|
-
</RadioGroupRoot>
|
|
24
|
-
);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
interface RadioGroupInputProps extends RadixRadioGroup.RadioGroupItemProps {
|
|
28
|
-
label?: ReactNode;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export type RadioGroupItemProps = RadioGroupInputProps & HTMLAttributes<HTMLDivElement>;
|
|
32
|
-
|
|
33
|
-
const RadioGroupItem = ({
|
|
34
|
-
id,
|
|
35
|
-
label,
|
|
36
|
-
value,
|
|
37
|
-
disabled,
|
|
38
|
-
required,
|
|
39
|
-
...props
|
|
40
|
-
}: RadioGroupItemProps) => {
|
|
41
|
-
const defaultId = useId();
|
|
42
|
-
return (
|
|
43
|
-
<Wrapper {...props}>
|
|
44
|
-
<RadioInput
|
|
45
|
-
value={value}
|
|
46
|
-
id={id ?? defaultId}
|
|
47
|
-
disabled={disabled}
|
|
48
|
-
required={required}
|
|
49
|
-
>
|
|
50
|
-
<RadioGroupIndicator />
|
|
51
|
-
</RadioInput>
|
|
52
|
-
{label && (
|
|
53
|
-
<label
|
|
54
|
-
className="Label"
|
|
55
|
-
htmlFor={id ?? defaultId}
|
|
56
|
-
>
|
|
57
|
-
{label}
|
|
58
|
-
</label>
|
|
59
|
-
)}
|
|
60
|
-
</Wrapper>
|
|
61
|
-
);
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
RadioGroupItem.displayName = "RadioGroupItem";
|
|
65
|
-
RadioGroup.Item = RadioGroupItem;
|
|
66
|
-
|
|
67
|
-
const Wrapper = styled.div`
|
|
68
|
-
padding: ${({ theme }) => theme.click.checkbox.space.all};
|
|
69
|
-
|
|
70
|
-
display: flex;
|
|
71
|
-
align-items: center;
|
|
72
|
-
gap: ${({ theme }) => theme.click.checkbox.space.gap};
|
|
73
|
-
`;
|
|
74
|
-
|
|
75
|
-
const RadioInput = styled(RadixRadioGroup.Item)`
|
|
76
|
-
display: flex;
|
|
77
|
-
align-items: center;
|
|
78
|
-
justify-content: center;
|
|
79
|
-
outline: none;
|
|
80
|
-
cursor: pointer;
|
|
81
|
-
${({ theme }) => `
|
|
82
|
-
border-radius: ${theme.click.radio.radii.all};
|
|
83
|
-
width: 1rem;
|
|
84
|
-
height: 1rem;
|
|
85
|
-
background: ${theme.click.radio.color.background.default};
|
|
86
|
-
border: 1px solid ${theme.click.radio.color.stroke.default};
|
|
87
|
-
|
|
88
|
-
& ~ label {
|
|
89
|
-
color: ${theme.click.field.color.genericLabel.default};
|
|
90
|
-
font: ${theme.click.radio.typography.label.default};
|
|
91
|
-
cursor: pointer;
|
|
92
|
-
}
|
|
93
|
-
&:hover {
|
|
94
|
-
background: ${theme.click.radio.color.background.hover};
|
|
95
|
-
& ~ label {
|
|
96
|
-
color: ${theme.click.field.color.genericLabel.hover};
|
|
97
|
-
font: ${theme.click.radio.typography.label.hover};
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
&[data-state="checked"] {
|
|
101
|
-
border-color: ${theme.click.radio.color.stroke.active};
|
|
102
|
-
background: ${theme.click.radio.color.background.active};
|
|
103
|
-
& ~ label {
|
|
104
|
-
color: ${theme.click.field.color.genericLabel.active};
|
|
105
|
-
font: ${theme.click.radio.typography.label.active};
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
&[data-disabled] {
|
|
109
|
-
background: ${theme.click.radio.color.background.disabled};
|
|
110
|
-
border-color: ${theme.click.radio.color.stroke.disabled};
|
|
111
|
-
& ~ label {
|
|
112
|
-
color: ${theme.click.field.color.genericLabel.disabled};
|
|
113
|
-
font: ${theme.click.radio.typography.label.disabled};
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
`};
|
|
117
|
-
`;
|
|
118
|
-
|
|
119
|
-
const RadioGroupIndicator = styled(RadixRadioGroup.Indicator)`
|
|
120
|
-
${({ theme }) => `
|
|
121
|
-
background: ${theme.click.radio.color.background.default};
|
|
122
|
-
&::after {
|
|
123
|
-
content: '';
|
|
124
|
-
display: block;
|
|
125
|
-
width: 6px;
|
|
126
|
-
height: 6px;
|
|
127
|
-
border-radius: 50%;
|
|
128
|
-
background-color: ${theme.click.radio.color.indicator.default};
|
|
129
|
-
&:hover {
|
|
130
|
-
background: ${theme.click.radio.color.indicator.hover};
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
&[data-state="checked"] {
|
|
134
|
-
background: ${theme.click.radio.color.background.active};
|
|
135
|
-
&::after {
|
|
136
|
-
background: ${theme.click.radio.color.indicator.active};
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
&:hover {
|
|
140
|
-
background: ${theme.click.radio.color.background.hover};
|
|
141
|
-
}
|
|
142
|
-
&[data-disabled] {
|
|
143
|
-
background: ${theme.click.radio.color.background.disabled};
|
|
144
|
-
&::after {
|
|
145
|
-
background: ${theme.click.radio.color.indicator.disabled};
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
`}
|
|
149
|
-
`;
|