taro-uno-ui 1.0.0 → 1.0.2
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/README.md +67 -30
- package/dist/js/{index-CDFsvu80.js → index-QpKiGsEQ.js} +39026 -28023
- package/dist/js/index-QpKiGsEQ.js.map +1 -0
- package/dist/js/{index-JffnTUrv.js → index-nnTHNhwl.js} +38743 -27720
- package/dist/js/index-nnTHNhwl.js.map +1 -0
- package/package.json +5 -5
- package/dist/app.config.d.ts +0 -38
- package/dist/app.d.ts +0 -6
- package/dist/components/basic/Button/Button.d.ts +0 -6
- package/dist/components/basic/Button/Button.styles.d.ts +0 -2
- package/dist/components/basic/Button/Button.types.d.ts +0 -74
- package/dist/components/basic/Button/index.d.ts +0 -4
- package/dist/components/basic/Divider/Divider.d.ts +0 -6
- package/dist/components/basic/Divider/Divider.styles.d.ts +0 -87
- package/dist/components/basic/Divider/Divider.types.d.ts +0 -242
- package/dist/components/basic/Divider/index.d.ts +0 -6
- package/dist/components/basic/Icon/Icon.d.ts +0 -5
- package/dist/components/basic/Icon/Icon.data.d.ts +0 -29
- package/dist/components/basic/Icon/Icon.styles.d.ts +0 -61
- package/dist/components/basic/Icon/Icon.types.d.ts +0 -199
- package/dist/components/basic/Icon/IconManager.d.ts +0 -120
- package/dist/components/basic/Icon/index.d.ts +0 -6
- package/dist/components/basic/Text/Text.d.ts +0 -7
- package/dist/components/basic/Text/Text.styles.d.ts +0 -67
- package/dist/components/basic/Text/Text.types.d.ts +0 -274
- package/dist/components/basic/Text/index.d.ts +0 -5
- package/dist/components/basic/Typography/Typography.d.ts +0 -8
- package/dist/components/basic/Typography/Typography.styles.d.ts +0 -83
- package/dist/components/basic/Typography/Typography.types.d.ts +0 -245
- package/dist/components/basic/Typography/index.d.ts +0 -3
- package/dist/components/basic/Video/Video.d.ts +0 -7
- package/dist/components/basic/Video/Video.styles.d.ts +0 -212
- package/dist/components/basic/Video/Video.types.d.ts +0 -447
- package/dist/components/basic/Video/index.d.ts +0 -10
- package/dist/components/basic/index.d.ts +0 -217
- package/dist/components/common/ErrorBoundary.d.ts +0 -19
- package/dist/components/common/LazyComponent.d.ts +0 -78
- package/dist/components/common/ResponsiveContainer.d.ts +0 -23
- package/dist/components/common/ResponsiveGrid.d.ts +0 -44
- package/dist/components/common/SecurityProvider.d.ts +0 -15
- package/dist/components/common/ThemeProvider.d.ts +0 -17
- package/dist/components/common/VirtualList.d.ts +0 -89
- package/dist/components/common/index.d.ts +0 -17
- package/dist/components/display/Avatar/Avatar.d.ts +0 -3
- package/dist/components/display/Avatar/Avatar.styles.d.ts +0 -2
- package/dist/components/display/Avatar/Avatar.types.d.ts +0 -37
- package/dist/components/display/Avatar/index.d.ts +0 -3
- package/dist/components/display/Badge/Badge.d.ts +0 -3
- package/dist/components/display/Badge/Badge.types.d.ts +0 -27
- package/dist/components/display/Badge/index.d.ts +0 -2
- package/dist/components/display/Calendar/Calendar.d.ts +0 -5
- package/dist/components/display/Calendar/Calendar.styles.d.ts +0 -2
- package/dist/components/display/Calendar/Calendar.types.d.ts +0 -87
- package/dist/components/display/Calendar/index.d.ts +0 -3
- package/dist/components/display/Card/Card.d.ts +0 -3
- package/dist/components/display/Card/Card.styles.d.ts +0 -1
- package/dist/components/display/Card/Card.types.d.ts +0 -52
- package/dist/components/display/Card/index.d.ts +0 -3
- package/dist/components/display/Carousel/Carousel.d.ts +0 -5
- package/dist/components/display/Carousel/Carousel.styles.d.ts +0 -2
- package/dist/components/display/Carousel/Carousel.types.d.ts +0 -55
- package/dist/components/display/Carousel/index.d.ts +0 -3
- package/dist/components/display/List/List.d.ts +0 -4
- package/dist/components/display/List/List.styles.d.ts +0 -1
- package/dist/components/display/List/List.types.d.ts +0 -64
- package/dist/components/display/List/index.d.ts +0 -3
- package/dist/components/display/Rate/Rate.d.ts +0 -6
- package/dist/components/display/Rate/Rate.styles.d.ts +0 -100
- package/dist/components/display/Rate/Rate.types.d.ts +0 -105
- package/dist/components/display/Rate/index.d.ts +0 -17
- package/dist/components/display/Table/Table.d.ts +0 -7
- package/dist/components/display/Table/Table.styles.d.ts +0 -84
- package/dist/components/display/Table/Table.types.d.ts +0 -251
- package/dist/components/display/Table/index.d.ts +0 -4
- package/dist/components/display/Tag/Tag.d.ts +0 -5
- package/dist/components/display/Tag/Tag.styles.d.ts +0 -2
- package/dist/components/display/Tag/Tag.types.d.ts +0 -47
- package/dist/components/display/Tag/index.d.ts +0 -3
- package/dist/components/display/Timeline/Timeline.d.ts +0 -16
- package/dist/components/display/Timeline/Timeline.styles.d.ts +0 -2
- package/dist/components/display/Timeline/Timeline.types.d.ts +0 -53
- package/dist/components/display/Timeline/index.d.ts +0 -3
- package/dist/components/display/index.d.ts +0 -67
- package/dist/components/feedback/Loading/Loading.d.ts +0 -4
- package/dist/components/feedback/Loading/Loading.styles.d.ts +0 -2
- package/dist/components/feedback/Loading/Loading.types.d.ts +0 -29
- package/dist/components/feedback/Loading/index.d.ts +0 -4
- package/dist/components/feedback/Message/Message.d.ts +0 -4
- package/dist/components/feedback/Message/Message.styles.d.ts +0 -34
- package/dist/components/feedback/Message/Message.types.d.ts +0 -33
- package/dist/components/feedback/Message/index.d.ts +0 -4
- package/dist/components/feedback/Modal/Modal.d.ts +0 -8
- package/dist/components/feedback/Modal/Modal.styles.d.ts +0 -18
- package/dist/components/feedback/Modal/Modal.types.d.ts +0 -143
- package/dist/components/feedback/Modal/index.d.ts +0 -3
- package/dist/components/feedback/Notification/Notification.d.ts +0 -4
- package/dist/components/feedback/Notification/Notification.styles.d.ts +0 -88
- package/dist/components/feedback/Notification/Notification.types.d.ts +0 -279
- package/dist/components/feedback/Notification/NotificationManager.d.ts +0 -4
- package/dist/components/feedback/Notification/index.d.ts +0 -25
- package/dist/components/feedback/Progress/Progress.d.ts +0 -4
- package/dist/components/feedback/Progress/Progress.styles.d.ts +0 -261
- package/dist/components/feedback/Progress/Progress.test.simple.d.ts +0 -2
- package/dist/components/feedback/Progress/Progress.types.d.ts +0 -147
- package/dist/components/feedback/Progress/index.d.ts +0 -3
- package/dist/components/feedback/Progress/utils/animation.d.ts +0 -55
- package/dist/components/feedback/Progress/utils/index.d.ts +0 -2
- package/dist/components/feedback/Progress/utils/progress-calculator.d.ts +0 -75
- package/dist/components/feedback/Result/Result.d.ts +0 -7
- package/dist/components/feedback/Result/Result.styles.d.ts +0 -2
- package/dist/components/feedback/Result/Result.types.d.ts +0 -66
- package/dist/components/feedback/Result/index.d.ts +0 -3
- package/dist/components/feedback/Toast/Toast.d.ts +0 -7
- package/dist/components/feedback/Toast/Toast.styles.d.ts +0 -14
- package/dist/components/feedback/Toast/Toast.types.d.ts +0 -81
- package/dist/components/feedback/Toast/index.d.ts +0 -3
- package/dist/components/feedback/Tooltip/Tooltip.d.ts +0 -4
- package/dist/components/feedback/Tooltip/Tooltip.examples.d.ts +0 -6
- package/dist/components/feedback/Tooltip/Tooltip.styles.d.ts +0 -78
- package/dist/components/feedback/Tooltip/Tooltip.types.d.ts +0 -130
- package/dist/components/feedback/Tooltip/index.d.ts +0 -3
- package/dist/components/feedback/index.d.ts +0 -71
- package/dist/components/form/Cascader/Cascader.d.ts +0 -7
- package/dist/components/form/Cascader/Cascader.styles.d.ts +0 -107
- package/dist/components/form/Cascader/Cascader.types.d.ts +0 -418
- package/dist/components/form/Cascader/hooks/index.d.ts +0 -3
- package/dist/components/form/Cascader/hooks/useCascaderFieldNames.d.ts +0 -12
- package/dist/components/form/Cascader/hooks/useCascaderOptions.d.ts +0 -15
- package/dist/components/form/Cascader/hooks/useCascaderState.d.ts +0 -23
- package/dist/components/form/Cascader/index.d.ts +0 -6
- package/dist/components/form/Cascader/utils/formatDisplayValue.d.ts +0 -9
- package/dist/components/form/Cascader/utils/index.d.ts +0 -1
- package/dist/components/form/Checkbox/Checkbox.d.ts +0 -6
- package/dist/components/form/Checkbox/Checkbox.styles.d.ts +0 -111
- package/dist/components/form/Checkbox/Checkbox.types.d.ts +0 -473
- package/dist/components/form/Checkbox/CheckboxGroup.d.ts +0 -6
- package/dist/components/form/Checkbox/index.d.ts +0 -8
- package/dist/components/form/DatePicker/DatePicker.d.ts +0 -6
- package/dist/components/form/DatePicker/DatePicker.styles.d.ts +0 -99
- package/dist/components/form/DatePicker/DatePicker.types.d.ts +0 -236
- package/dist/components/form/DatePicker/index.d.ts +0 -3
- package/dist/components/form/Form/Form.d.ts +0 -8
- package/dist/components/form/Form/Form.styles.d.ts +0 -84
- package/dist/components/form/Form/Form.types.d.ts +0 -416
- package/dist/components/form/Form/index.d.ts +0 -9
- package/dist/components/form/Form/useFormLogic.d.ts +0 -22
- package/dist/components/form/Input/Input.d.ts +0 -6
- package/dist/components/form/Input/Input.styles.d.ts +0 -61
- package/dist/components/form/Input/Input.types.d.ts +0 -294
- package/dist/components/form/Input/index.d.ts +0 -8
- package/dist/components/form/Input/useInputLogic.d.ts +0 -35
- package/dist/components/form/InputNumber/InputNumber.d.ts +0 -6
- package/dist/components/form/InputNumber/InputNumber.styles.d.ts +0 -120
- package/dist/components/form/InputNumber/InputNumber.types.d.ts +0 -303
- package/dist/components/form/InputNumber/components/InputNumberClearButton.d.ts +0 -10
- package/dist/components/form/InputNumber/components/InputNumberControls.d.ts +0 -11
- package/dist/components/form/InputNumber/components/index.d.ts +0 -2
- package/dist/components/form/InputNumber/hooks/index.d.ts +0 -4
- package/dist/components/form/InputNumber/hooks/useInputNumberState.d.ts +0 -38
- package/dist/components/form/InputNumber/hooks/useInputNumberValidation.d.ts +0 -12
- package/dist/components/form/InputNumber/index.d.ts +0 -5
- package/dist/components/form/Radio/Radio.d.ts +0 -6
- package/dist/components/form/Radio/Radio.styles.d.ts +0 -80
- package/dist/components/form/Radio/Radio.types.d.ts +0 -415
- package/dist/components/form/Radio/index.d.ts +0 -8
- package/dist/components/form/Select/Select.d.ts +0 -6
- package/dist/components/form/Select/Select.styles.d.ts +0 -71
- package/dist/components/form/Select/Select.types.d.ts +0 -418
- package/dist/components/form/Select/index.d.ts +0 -8
- package/dist/components/form/Slider/Slider.d.ts +0 -7
- package/dist/components/form/Slider/Slider.styles.d.ts +0 -2
- package/dist/components/form/Slider/Slider.types.d.ts +0 -85
- package/dist/components/form/Slider/index.d.ts +0 -3
- package/dist/components/form/Switch/Switch.d.ts +0 -10
- package/dist/components/form/Switch/Switch.styles.d.ts +0 -154
- package/dist/components/form/Switch/Switch.types.d.ts +0 -351
- package/dist/components/form/Switch/index.d.ts +0 -7
- package/dist/components/form/Textarea/Textarea.d.ts +0 -6
- package/dist/components/form/Textarea/Textarea.styles.d.ts +0 -66
- package/dist/components/form/Textarea/Textarea.types.d.ts +0 -348
- package/dist/components/form/Textarea/index.d.ts +0 -7
- package/dist/components/form/TimePicker/TimePicker.d.ts +0 -6
- package/dist/components/form/TimePicker/TimePicker.styles.d.ts +0 -104
- package/dist/components/form/TimePicker/TimePicker.types.d.ts +0 -385
- package/dist/components/form/TimePicker/index.d.ts +0 -4
- package/dist/components/form/Transfer/Transfer.d.ts +0 -7
- package/dist/components/form/Transfer/Transfer.styles.d.ts +0 -106
- package/dist/components/form/Transfer/Transfer.types.d.ts +0 -384
- package/dist/components/form/Transfer/components/TransferItem.d.ts +0 -23
- package/dist/components/form/Transfer/components/TransferList.d.ts +0 -55
- package/dist/components/form/Transfer/components/TransferOperations.d.ts +0 -21
- package/dist/components/form/Transfer/components/TransferPagination.d.ts +0 -19
- package/dist/components/form/Transfer/components/TransferSearch.d.ts +0 -21
- package/dist/components/form/Transfer/components/index.d.ts +0 -6
- package/dist/components/form/Transfer/hooks/index.d.ts +0 -3
- package/dist/components/form/Transfer/hooks/useTransferData.d.ts +0 -41
- package/dist/components/form/Transfer/hooks/useTransferState.d.ts +0 -21
- package/dist/components/form/Transfer/index.d.ts +0 -9
- package/dist/components/form/Upload/Upload.d.ts +0 -7
- package/dist/components/form/Upload/Upload.styles.d.ts +0 -2
- package/dist/components/form/Upload/Upload.types.d.ts +0 -143
- package/dist/components/form/Upload/index.d.ts +0 -3
- package/dist/components/form/index.d.ts +0 -126
- package/dist/components/index.d.ts +0 -122
- package/dist/components/layout/Affix/Affix.d.ts +0 -4
- package/dist/components/layout/Affix/Affix.styles.d.ts +0 -1669
- package/dist/components/layout/Affix/Affix.types.d.ts +0 -25
- package/dist/components/layout/Affix/index.d.ts +0 -3
- package/dist/components/layout/Col/Col.d.ts +0 -6
- package/dist/components/layout/Col/Col.styles.d.ts +0 -52
- package/dist/components/layout/Col/Col.types.d.ts +0 -54
- package/dist/components/layout/Col/index.d.ts +0 -3
- package/dist/components/layout/Container/Container.d.ts +0 -6
- package/dist/components/layout/Container/Container.styles.d.ts +0 -41
- package/dist/components/layout/Container/Container.types.d.ts +0 -59
- package/dist/components/layout/Container/index.d.ts +0 -3
- package/dist/components/layout/Grid/Grid.d.ts +0 -6
- package/dist/components/layout/Grid/Grid.styles.d.ts +0 -60
- package/dist/components/layout/Grid/Grid.types.d.ts +0 -68
- package/dist/components/layout/Grid/index.d.ts +0 -3
- package/dist/components/layout/Layout/Content.d.ts +0 -4
- package/dist/components/layout/Layout/Footer.d.ts +0 -4
- package/dist/components/layout/Layout/Header.d.ts +0 -4
- package/dist/components/layout/Layout/Layout.d.ts +0 -4
- package/dist/components/layout/Layout/Layout.styles.d.ts +0 -3366
- package/dist/components/layout/Layout/Layout.types.d.ts +0 -48
- package/dist/components/layout/Layout/Sider.d.ts +0 -4
- package/dist/components/layout/Layout/index.d.ts +0 -8
- package/dist/components/layout/Row/Row.d.ts +0 -6
- package/dist/components/layout/Row/Row.styles.d.ts +0 -55
- package/dist/components/layout/Row/Row.types.d.ts +0 -51
- package/dist/components/layout/Row/index.d.ts +0 -3
- package/dist/components/layout/Space/Space.d.ts +0 -6
- package/dist/components/layout/Space/Space.styles.d.ts +0 -69
- package/dist/components/layout/Space/Space.types.d.ts +0 -84
- package/dist/components/layout/Space/index.d.ts +0 -3
- package/dist/components/layout/index.d.ts +0 -39
- package/dist/components/navigation/Menu/Menu.constants.d.ts +0 -59
- package/dist/components/navigation/Menu/Menu.d.ts +0 -10
- package/dist/components/navigation/Menu/Menu.stories.d.ts +0 -157
- package/dist/components/navigation/Menu/Menu.styles.d.ts +0 -143
- package/dist/components/navigation/Menu/Menu.types.d.ts +0 -210
- package/dist/components/navigation/Menu/Menu.utils.d.ts +0 -54
- package/dist/components/navigation/Menu/MenuItem.d.ts +0 -32
- package/dist/components/navigation/Menu/SubMenu.d.ts +0 -41
- package/dist/components/navigation/Menu/index.d.ts +0 -54
- package/dist/components/navigation/NavBar/NavBar.d.ts +0 -7
- package/dist/components/navigation/NavBar/NavBar.styles.d.ts +0 -114
- package/dist/components/navigation/NavBar/NavBar.types.d.ts +0 -50
- package/dist/components/navigation/NavBar/index.d.ts +0 -3
- package/dist/components/navigation/Pagination/Pagination.d.ts +0 -6
- package/dist/components/navigation/Pagination/Pagination.styles.d.ts +0 -55
- package/dist/components/navigation/Pagination/Pagination.types.d.ts +0 -77
- package/dist/components/navigation/Pagination/index.d.ts +0 -15
- package/dist/components/navigation/Steps/Step.d.ts +0 -4
- package/dist/components/navigation/Steps/Steps.d.ts +0 -4
- package/dist/components/navigation/Steps/Steps.styles.d.ts +0 -6716
- package/dist/components/navigation/Steps/Steps.types.d.ts +0 -41
- package/dist/components/navigation/Steps/index.d.ts +0 -3
- package/dist/components/navigation/Tabs/Tabs.d.ts +0 -6
- package/dist/components/navigation/Tabs/Tabs.styles.d.ts +0 -60
- package/dist/components/navigation/Tabs/Tabs.types.d.ts +0 -107
- package/dist/components/navigation/Tabs/index.d.ts +0 -3
- package/dist/components/navigation/index.d.ts +0 -35
- package/dist/constants/index.d.ts +0 -624
- package/dist/hooks/index.d.ts +0 -28
- package/dist/hooks/types.d.ts +0 -7
- package/dist/hooks/useAsync.d.ts +0 -17
- package/dist/hooks/useClickOutside.d.ts +0 -19
- package/dist/hooks/useCounter.d.ts +0 -36
- package/dist/hooks/useDebounce.d.ts +0 -31
- package/dist/hooks/useDeepCompareEffect.d.ts +0 -22
- package/dist/hooks/useEventHandling.d.ts +0 -81
- package/dist/hooks/useEventListener.d.ts +0 -19
- package/dist/hooks/useLifecycle.d.ts +0 -66
- package/dist/hooks/useMediaQuery.d.ts +0 -22
- package/dist/hooks/useMutation.d.ts +0 -47
- package/dist/hooks/usePerformance.d.ts +0 -73
- package/dist/hooks/usePerformanceMonitor.d.ts +0 -66
- package/dist/hooks/usePlatform.d.ts +0 -20
- package/dist/hooks/usePrevious.d.ts +0 -14
- package/dist/hooks/useRequest.d.ts +0 -32
- package/dist/hooks/useStateManagement.d.ts +0 -62
- package/dist/hooks/useStorage.d.ts +0 -27
- package/dist/hooks/useStyle.d.ts +0 -127
- package/dist/hooks/useTheme.d.ts +0 -58
- package/dist/hooks/useToggle.d.ts +0 -28
- package/dist/hooks/useVirtualScroll.d.ts +0 -42
- package/dist/index.d.ts +0 -271
- package/dist/js/index-CDFsvu80.js.map +0 -1
- package/dist/js/index-DFdcksbe.js +0 -1165
- package/dist/js/index-DFdcksbe.js.map +0 -1
- package/dist/js/index-DXRIkWX1.js +0 -1148
- package/dist/js/index-DXRIkWX1.js.map +0 -1
- package/dist/js/index-JffnTUrv.js.map +0 -1
- package/dist/platform/index.d.ts +0 -172
- package/dist/providers/AppProvider.d.ts +0 -34
- package/dist/providers/index.d.ts +0 -1
- package/dist/theme/ThemeProvider.d.ts +0 -34
- package/dist/theme/ThemeProvider.types.d.ts +0 -21
- package/dist/theme/animations.d.ts +0 -96
- package/dist/theme/defaults.d.ts +0 -6
- package/dist/theme/design-system.d.ts +0 -400
- package/dist/theme/design-tokens.d.ts +0 -459
- package/dist/theme/index.d.ts +0 -187
- package/dist/theme/responsive.d.ts +0 -63
- package/dist/theme/styles.d.ts +0 -65
- package/dist/theme/tokens/colors.d.ts +0 -72
- package/dist/theme/tokens/effects.d.ts +0 -122
- package/dist/theme/tokens/index.d.ts +0 -94
- package/dist/theme/tokens/spacing.d.ts +0 -65
- package/dist/theme/tokens/typography.d.ts +0 -73
- package/dist/theme/types.d.ts +0 -153
- package/dist/theme/useThemeUtils.d.ts +0 -21
- package/dist/theme/utils.d.ts +0 -255
- package/dist/theme/variables.d.ts +0 -170
- package/dist/types/accessibility.d.ts +0 -46
- package/dist/types/button.d.ts +0 -285
- package/dist/types/component-props.d.ts +0 -109
- package/dist/types/index.d.ts +0 -343
- package/dist/types/standardized-components.d.ts +0 -263
- package/dist/types/utils.d.ts +0 -190
- package/dist/utils/abort-controller.d.ts +0 -19
- package/dist/utils/cache.d.ts +0 -28
- package/dist/utils/createNamespace.d.ts +0 -9
- package/dist/utils/environment.d.ts +0 -26
- package/dist/utils/error-handler.d.ts +0 -37
- package/dist/utils/errorLogger.d.ts +0 -72
- package/dist/utils/formatUtils.d.ts +0 -93
- package/dist/utils/http/error-codes.d.ts +0 -131
- package/dist/utils/http/http-client.d.ts +0 -53
- package/dist/utils/http/request-cache.d.ts +0 -65
- package/dist/utils/http/request.d.ts +0 -280
- package/dist/utils/http/taro-adapter.d.ts +0 -4
- package/dist/utils/http/types.d.ts +0 -351
- package/dist/utils/http/web-adapter.d.ts +0 -4
- package/dist/utils/index.d.ts +0 -46
- package/dist/utils/inputValidator.d.ts +0 -74
- package/dist/utils/performance/performance.d.ts +0 -167
- package/dist/utils/responsiveUtils.d.ts +0 -148
- package/dist/utils/rtl-support.d.ts +0 -78
- package/dist/utils/security/api-security.d.ts +0 -82
- package/dist/utils/security/xss-protection.d.ts +0 -20
- package/dist/utils/securityHeaders.d.ts +0 -74
- package/dist/utils/typeHelpers.d.ts +0 -1
- package/dist/utils/types/dataProcessing.d.ts +0 -111
- package/dist/utils/types/typeHelpers.d.ts +0 -50
- package/dist/utils/xssProtection.d.ts +0 -90
- package/src/app.config.ts +0 -55
- package/src/app.scss +0 -508
- package/src/app.tsx +0 -44
- package/src/components/basic/Button/Button.styles.ts +0 -130
- package/src/components/basic/Button/Button.test.tsx +0 -154
- package/src/components/basic/Button/Button.tsx +0 -133
- package/src/components/basic/Button/Button.types.ts +0 -81
- package/src/components/basic/Button/index.tsx +0 -6
- package/src/components/basic/Divider/Divider.styles.ts +0 -488
- package/src/components/basic/Divider/Divider.test.tsx +0 -551
- package/src/components/basic/Divider/Divider.tsx +0 -392
- package/src/components/basic/Divider/Divider.types.ts +0 -261
- package/src/components/basic/Divider/index.tsx +0 -25
- package/src/components/basic/Icon/Icon.data.ts +0 -474
- package/src/components/basic/Icon/Icon.styles.ts +0 -359
- package/src/components/basic/Icon/Icon.test.tsx +0 -357
- package/src/components/basic/Icon/Icon.tsx +0 -167
- package/src/components/basic/Icon/Icon.types.ts +0 -210
- package/src/components/basic/Icon/IconManager.ts +0 -229
- package/src/components/basic/Icon/index.tsx +0 -22
- package/src/components/basic/Text/Text.styles.ts +0 -500
- package/src/components/basic/Text/Text.test.tsx +0 -299
- package/src/components/basic/Text/Text.tsx +0 -340
- package/src/components/basic/Text/Text.types.ts +0 -329
- package/src/components/basic/Text/index.tsx +0 -27
- package/src/components/basic/Typography/Typography.styles.ts +0 -347
- package/src/components/basic/Typography/Typography.tsx +0 -207
- package/src/components/basic/Typography/Typography.types.ts +0 -296
- package/src/components/basic/Typography/index.tsx +0 -14
- package/src/components/basic/Video/Video.styles.ts +0 -777
- package/src/components/basic/Video/Video.test.tsx +0 -490
- package/src/components/basic/Video/Video.tsx +0 -1468
- package/src/components/basic/Video/Video.types.ts +0 -500
- package/src/components/basic/Video/index.tsx +0 -26
- package/src/components/basic/index.tsx +0 -300
- package/src/components/common/ErrorBoundary.tsx +0 -87
- package/src/components/common/LazyComponent.tsx +0 -247
- package/src/components/common/ResponsiveContainer.tsx +0 -93
- package/src/components/common/ResponsiveGrid.tsx +0 -183
- package/src/components/common/SecurityProvider.tsx +0 -98
- package/src/components/common/ThemeProvider.tsx +0 -115
- package/src/components/common/VirtualList.tsx +0 -350
- package/src/components/common/__tests__/ErrorBoundary.test.tsx +0 -249
- package/src/components/common/index.tsx +0 -32
- package/src/components/display/Avatar/Avatar.styles.ts +0 -62
- package/src/components/display/Avatar/Avatar.test.tsx +0 -390
- package/src/components/display/Avatar/Avatar.tsx +0 -66
- package/src/components/display/Avatar/Avatar.types.ts +0 -40
- package/src/components/display/Avatar/index.ts +0 -3
- package/src/components/display/Badge/Badge.tsx +0 -29
- package/src/components/display/Badge/Badge.types.ts +0 -29
- package/src/components/display/Badge/index.ts +0 -2
- package/src/components/display/Calendar/Calendar.styles.ts +0 -255
- package/src/components/display/Calendar/Calendar.test.tsx +0 -42
- package/src/components/display/Calendar/Calendar.tsx +0 -358
- package/src/components/display/Calendar/Calendar.types.ts +0 -91
- package/src/components/display/Calendar/index.ts +0 -3
- package/src/components/display/Card/Card.styles.ts +0 -89
- package/src/components/display/Card/Card.test.tsx +0 -182
- package/src/components/display/Card/Card.tsx +0 -135
- package/src/components/display/Card/Card.types.ts +0 -55
- package/src/components/display/Card/index.ts +0 -3
- package/src/components/display/Carousel/Carousel.styles.ts +0 -206
- package/src/components/display/Carousel/Carousel.tsx +0 -290
- package/src/components/display/Carousel/Carousel.types.ts +0 -57
- package/src/components/display/Carousel/index.ts +0 -3
- package/src/components/display/List/List.styles.ts +0 -79
- package/src/components/display/List/List.tsx +0 -114
- package/src/components/display/List/List.types.ts +0 -68
- package/src/components/display/List/index.ts +0 -3
- package/src/components/display/Rate/Rate.styles.ts +0 -254
- package/src/components/display/Rate/Rate.tsx +0 -324
- package/src/components/display/Rate/Rate.types.ts +0 -112
- package/src/components/display/Rate/index.ts +0 -20
- package/src/components/display/Table/Table.styles.ts +0 -269
- package/src/components/display/Table/Table.test.tsx +0 -345
- package/src/components/display/Table/Table.tsx +0 -426
- package/src/components/display/Table/Table.types.ts +0 -256
- package/src/components/display/Table/index.tsx +0 -16
- package/src/components/display/Tag/Tag.styles.ts +0 -197
- package/src/components/display/Tag/Tag.test.tsx +0 -541
- package/src/components/display/Tag/Tag.tsx +0 -139
- package/src/components/display/Tag/Tag.types.ts +0 -49
- package/src/components/display/Tag/index.ts +0 -3
- package/src/components/display/Timeline/Timeline.styles.ts +0 -211
- package/src/components/display/Timeline/Timeline.tsx +0 -220
- package/src/components/display/Timeline/Timeline.types.ts +0 -56
- package/src/components/display/Timeline/index.ts +0 -3
- package/src/components/display/index.tsx +0 -147
- package/src/components/feedback/Loading/Loading.styles.ts +0 -117
- package/src/components/feedback/Loading/Loading.test.tsx +0 -534
- package/src/components/feedback/Loading/Loading.tsx +0 -132
- package/src/components/feedback/Loading/Loading.types.ts +0 -33
- package/src/components/feedback/Loading/index.ts +0 -6
- package/src/components/feedback/Message/Message.styles.ts +0 -41
- package/src/components/feedback/Message/Message.test.tsx +0 -234
- package/src/components/feedback/Message/Message.tsx +0 -96
- package/src/components/feedback/Message/Message.types.ts +0 -37
- package/src/components/feedback/Message/index.ts +0 -6
- package/src/components/feedback/Modal/Modal.styles.ts +0 -21
- package/src/components/feedback/Modal/Modal.test.tsx +0 -11
- package/src/components/feedback/Modal/Modal.tsx +0 -269
- package/src/components/feedback/Modal/Modal.types.ts +0 -151
- package/src/components/feedback/Modal/index.tsx +0 -11
- package/src/components/feedback/Notification/Notification.styles.ts +0 -453
- package/src/components/feedback/Notification/Notification.test.tsx +0 -401
- package/src/components/feedback/Notification/Notification.tsx +0 -347
- package/src/components/feedback/Notification/Notification.types.ts +0 -339
- package/src/components/feedback/Notification/NotificationManager.tsx +0 -405
- package/src/components/feedback/Notification/index.ts +0 -40
- package/src/components/feedback/Notification/index.tsx +0 -154
- package/src/components/feedback/Progress/Progress.styles.ts +0 -469
- package/src/components/feedback/Progress/Progress.test.simple.tsx +0 -14
- package/src/components/feedback/Progress/Progress.test.tsx +0 -312
- package/src/components/feedback/Progress/Progress.tsx +0 -488
- package/src/components/feedback/Progress/Progress.types.ts +0 -163
- package/src/components/feedback/Progress/index.ts +0 -3
- package/src/components/feedback/Progress/index.tsx +0 -38
- package/src/components/feedback/Progress/utils/animation.ts +0 -193
- package/src/components/feedback/Progress/utils/index.ts +0 -26
- package/src/components/feedback/Progress/utils/progress-calculator.ts +0 -199
- package/src/components/feedback/Result/Result.styles.ts +0 -139
- package/src/components/feedback/Result/Result.tsx +0 -221
- package/src/components/feedback/Result/Result.types.ts +0 -128
- package/src/components/feedback/Result/index.tsx +0 -3
- package/src/components/feedback/Toast/Toast.styles.ts +0 -17
- package/src/components/feedback/Toast/Toast.test.tsx +0 -10
- package/src/components/feedback/Toast/Toast.tsx +0 -384
- package/src/components/feedback/Toast/Toast.types.ts +0 -86
- package/src/components/feedback/Toast/index.tsx +0 -3
- package/src/components/feedback/Tooltip/Tooltip.examples.tsx +0 -435
- package/src/components/feedback/Tooltip/Tooltip.styles.ts +0 -340
- package/src/components/feedback/Tooltip/Tooltip.test.tsx +0 -446
- package/src/components/feedback/Tooltip/Tooltip.tsx +0 -302
- package/src/components/feedback/Tooltip/Tooltip.types.ts +0 -166
- package/src/components/feedback/Tooltip/index.ts +0 -3
- package/src/components/feedback/Tooltip/index.tsx +0 -246
- package/src/components/feedback/index.tsx +0 -176
- package/src/components/form/Cascader/Cascader.styles.ts +0 -526
- package/src/components/form/Cascader/Cascader.test.tsx +0 -77
- package/src/components/form/Cascader/Cascader.tsx +0 -581
- package/src/components/form/Cascader/Cascader.types.ts +0 -581
- package/src/components/form/Cascader/hooks/index.ts +0 -3
- package/src/components/form/Cascader/hooks/useCascaderFieldNames.ts +0 -19
- package/src/components/form/Cascader/hooks/useCascaderOptions.ts +0 -127
- package/src/components/form/Cascader/hooks/useCascaderState.ts +0 -139
- package/src/components/form/Cascader/index.ts +0 -25
- package/src/components/form/Cascader/utils/formatDisplayValue.ts +0 -19
- package/src/components/form/Cascader/utils/index.ts +0 -1
- package/src/components/form/Checkbox/Checkbox.styles.ts +0 -607
- package/src/components/form/Checkbox/Checkbox.test.tsx +0 -1140
- package/src/components/form/Checkbox/Checkbox.tsx +0 -489
- package/src/components/form/Checkbox/Checkbox.types.ts +0 -472
- package/src/components/form/Checkbox/CheckboxGroup.tsx +0 -444
- package/src/components/form/Checkbox/index.tsx +0 -27
- package/src/components/form/DatePicker/DatePicker.styles.ts +0 -393
- package/src/components/form/DatePicker/DatePicker.test.tsx +0 -407
- package/src/components/form/DatePicker/DatePicker.tsx +0 -376
- package/src/components/form/DatePicker/DatePicker.types.ts +0 -250
- package/src/components/form/DatePicker/index.tsx +0 -15
- package/src/components/form/Form/Form.styles.ts +0 -357
- package/src/components/form/Form/Form.test.tsx +0 -122
- package/src/components/form/Form/Form.tsx +0 -257
- package/src/components/form/Form/Form.types.ts +0 -422
- package/src/components/form/Form/index.tsx +0 -31
- package/src/components/form/Form/useFormLogic.ts +0 -497
- package/src/components/form/Input/Input.styles.ts +0 -445
- package/src/components/form/Input/Input.test.tsx +0 -494
- package/src/components/form/Input/Input.tsx +0 -305
- package/src/components/form/Input/Input.types.ts +0 -297
- package/src/components/form/Input/index.tsx +0 -26
- package/src/components/form/Input/useInputLogic.test.ts +0 -82
- package/src/components/form/Input/useInputLogic.ts +0 -260
- package/src/components/form/InputNumber/InputNumber.styles.ts +0 -716
- package/src/components/form/InputNumber/InputNumber.tsx +0 -402
- package/src/components/form/InputNumber/InputNumber.types.ts +0 -336
- package/src/components/form/InputNumber/components/InputNumberClearButton.tsx +0 -24
- package/src/components/form/InputNumber/components/InputNumberControls.tsx +0 -33
- package/src/components/form/InputNumber/components/index.ts +0 -2
- package/src/components/form/InputNumber/hooks/index.ts +0 -4
- package/src/components/form/InputNumber/hooks/useInputNumberState.ts +0 -313
- package/src/components/form/InputNumber/hooks/useInputNumberValidation.ts +0 -148
- package/src/components/form/InputNumber/index.ts +0 -25
- package/src/components/form/Radio/Radio.styles.ts +0 -451
- package/src/components/form/Radio/Radio.test.tsx +0 -547
- package/src/components/form/Radio/Radio.tsx +0 -277
- package/src/components/form/Radio/Radio.types.ts +0 -414
- package/src/components/form/Radio/index.tsx +0 -21
- package/src/components/form/Select/Select.styles.ts +0 -518
- package/src/components/form/Select/Select.test.tsx +0 -648
- package/src/components/form/Select/Select.tsx +0 -474
- package/src/components/form/Select/Select.types.ts +0 -429
- package/src/components/form/Select/index.tsx +0 -30
- package/src/components/form/Slider/Slider.styles.ts +0 -139
- package/src/components/form/Slider/Slider.test.tsx +0 -553
- package/src/components/form/Slider/Slider.tsx +0 -312
- package/src/components/form/Slider/Slider.types.ts +0 -110
- package/src/components/form/Slider/index.tsx +0 -3
- package/src/components/form/Switch/Switch.styles.ts +0 -534
- package/src/components/form/Switch/Switch.test.tsx +0 -345
- package/src/components/form/Switch/Switch.tsx +0 -458
- package/src/components/form/Switch/Switch.types.ts +0 -386
- package/src/components/form/Switch/index.tsx +0 -26
- package/src/components/form/Textarea/Textarea.styles.ts +0 -592
- package/src/components/form/Textarea/Textarea.test.tsx +0 -1075
- package/src/components/form/Textarea/Textarea.tsx +0 -608
- package/src/components/form/Textarea/Textarea.types.ts +0 -374
- package/src/components/form/Textarea/index.tsx +0 -26
- package/src/components/form/TimePicker/TimePicker.styles.ts +0 -434
- package/src/components/form/TimePicker/TimePicker.test.tsx +0 -306
- package/src/components/form/TimePicker/TimePicker.tsx +0 -250
- package/src/components/form/TimePicker/TimePicker.types.ts +0 -385
- package/src/components/form/TimePicker/index.ts +0 -21
- package/src/components/form/Transfer/Transfer.styles.ts +0 -490
- package/src/components/form/Transfer/Transfer.test.tsx +0 -316
- package/src/components/form/Transfer/Transfer.tsx +0 -414
- package/src/components/form/Transfer/Transfer.types.ts +0 -565
- package/src/components/form/Transfer/components/TransferItem.tsx +0 -94
- package/src/components/form/Transfer/components/TransferList.tsx +0 -298
- package/src/components/form/Transfer/components/TransferOperations.tsx +0 -81
- package/src/components/form/Transfer/components/TransferPagination.tsx +0 -139
- package/src/components/form/Transfer/components/TransferSearch.tsx +0 -85
- package/src/components/form/Transfer/components/index.ts +0 -6
- package/src/components/form/Transfer/hooks/index.ts +0 -3
- package/src/components/form/Transfer/hooks/useTransferData.ts +0 -202
- package/src/components/form/Transfer/hooks/useTransferState.ts +0 -120
- package/src/components/form/Transfer/index.ts +0 -27
- package/src/components/form/Upload/Upload.styles.ts +0 -145
- package/src/components/form/Upload/Upload.test.tsx +0 -10
- package/src/components/form/Upload/Upload.tsx +0 -498
- package/src/components/form/Upload/Upload.types.ts +0 -200
- package/src/components/form/Upload/index.tsx +0 -12
- package/src/components/form/index.tsx +0 -152
- package/src/components/index.tsx +0 -145
- package/src/components/layout/Affix/Affix.styles.ts +0 -42
- package/src/components/layout/Affix/Affix.test.tsx +0 -10
- package/src/components/layout/Affix/Affix.tsx +0 -83
- package/src/components/layout/Affix/Affix.types.ts +0 -29
- package/src/components/layout/Affix/index.tsx +0 -3
- package/src/components/layout/Col/Col.styles.ts +0 -185
- package/src/components/layout/Col/Col.test.tsx +0 -537
- package/src/components/layout/Col/Col.tsx +0 -97
- package/src/components/layout/Col/Col.types.ts +0 -59
- package/src/components/layout/Col/index.tsx +0 -3
- package/src/components/layout/Container/Container.styles.ts +0 -163
- package/src/components/layout/Container/Container.test.tsx +0 -380
- package/src/components/layout/Container/Container.tsx +0 -123
- package/src/components/layout/Container/Container.types.ts +0 -63
- package/src/components/layout/Container/index.tsx +0 -3
- package/src/components/layout/Grid/Grid.styles.ts +0 -183
- package/src/components/layout/Grid/Grid.test.tsx +0 -637
- package/src/components/layout/Grid/Grid.tsx +0 -123
- package/src/components/layout/Grid/Grid.types.ts +0 -78
- package/src/components/layout/Grid/index.tsx +0 -3
- package/src/components/layout/Layout/Content.tsx +0 -30
- package/src/components/layout/Layout/Footer.tsx +0 -30
- package/src/components/layout/Layout/Header.tsx +0 -30
- package/src/components/layout/Layout/Layout.styles.ts +0 -84
- package/src/components/layout/Layout/Layout.test.tsx +0 -10
- package/src/components/layout/Layout/Layout.tsx +0 -28
- package/src/components/layout/Layout/Layout.types.ts +0 -58
- package/src/components/layout/Layout/Sider.tsx +0 -44
- package/src/components/layout/Layout/index.tsx +0 -22
- package/src/components/layout/Row/Row.styles.ts +0 -159
- package/src/components/layout/Row/Row.test.tsx +0 -467
- package/src/components/layout/Row/Row.tsx +0 -111
- package/src/components/layout/Row/Row.types.ts +0 -60
- package/src/components/layout/Row/index.tsx +0 -3
- package/src/components/layout/Space/Space.styles.ts +0 -255
- package/src/components/layout/Space/Space.test.tsx +0 -682
- package/src/components/layout/Space/Space.tsx +0 -203
- package/src/components/layout/Space/Space.types.ts +0 -92
- package/src/components/layout/Space/index.tsx +0 -12
- package/src/components/layout/index.tsx +0 -78
- package/src/components/navigation/Menu/Menu.constants.ts +0 -69
- package/src/components/navigation/Menu/Menu.stories.tsx +0 -107
- package/src/components/navigation/Menu/Menu.styles.ts +0 -767
- package/src/components/navigation/Menu/Menu.tsx +0 -352
- package/src/components/navigation/Menu/Menu.types.ts +0 -231
- package/src/components/navigation/Menu/Menu.utils.ts +0 -187
- package/src/components/navigation/Menu/MenuItem.tsx +0 -124
- package/src/components/navigation/Menu/SubMenu.tsx +0 -150
- package/src/components/navigation/Menu/index.tsx +0 -59
- package/src/components/navigation/NavBar/NavBar.styles.ts +0 -129
- package/src/components/navigation/NavBar/NavBar.test.tsx +0 -287
- package/src/components/navigation/NavBar/NavBar.tsx +0 -228
- package/src/components/navigation/NavBar/NavBar.types.ts +0 -54
- package/src/components/navigation/NavBar/index.tsx +0 -3
- package/src/components/navigation/Pagination/Pagination.styles.ts +0 -187
- package/src/components/navigation/Pagination/Pagination.test.tsx +0 -672
- package/src/components/navigation/Pagination/Pagination.tsx +0 -395
- package/src/components/navigation/Pagination/Pagination.types.ts +0 -87
- package/src/components/navigation/Pagination/index.ts +0 -24
- package/src/components/navigation/Pagination/index.tsx +0 -9
- package/src/components/navigation/Steps/Step.tsx +0 -36
- package/src/components/navigation/Steps/Steps.styles.ts +0 -169
- package/src/components/navigation/Steps/Steps.test.tsx +0 -14
- package/src/components/navigation/Steps/Steps.tsx +0 -112
- package/src/components/navigation/Steps/Steps.types.ts +0 -47
- package/src/components/navigation/Steps/index.tsx +0 -3
- package/src/components/navigation/Tabs/Tabs.styles.ts +0 -199
- package/src/components/navigation/Tabs/Tabs.test.tsx +0 -662
- package/src/components/navigation/Tabs/Tabs.tsx +0 -253
- package/src/components/navigation/Tabs/Tabs.types.ts +0 -115
- package/src/components/navigation/Tabs/index.tsx +0 -3
- package/src/components/navigation/index.tsx +0 -88
- package/src/constants/index.ts +0 -785
- package/src/hooks/index.ts +0 -60
- package/src/hooks/types.ts +0 -9
- package/src/hooks/useAsync.ts +0 -64
- package/src/hooks/useClickOutside.ts +0 -52
- package/src/hooks/useCounter.ts +0 -87
- package/src/hooks/useDebounce.ts +0 -150
- package/src/hooks/useDeepCompareEffect.ts +0 -88
- package/src/hooks/useEventHandling.ts +0 -444
- package/src/hooks/useEventListener.ts +0 -77
- package/src/hooks/useLifecycle.ts +0 -399
- package/src/hooks/useMediaQuery.ts +0 -75
- package/src/hooks/useMutation.ts +0 -233
- package/src/hooks/usePerformance.ts +0 -378
- package/src/hooks/usePerformanceMonitor.ts +0 -348
- package/src/hooks/usePlatform.ts +0 -64
- package/src/hooks/usePrevious.ts +0 -25
- package/src/hooks/useRequest.test.ts +0 -11
- package/src/hooks/useRequest.ts +0 -140
- package/src/hooks/useStateManagement.ts +0 -300
- package/src/hooks/useStorage.ts +0 -169
- package/src/hooks/useStyle.ts +0 -543
- package/src/hooks/useTheme.ts +0 -347
- package/src/hooks/useToggle.ts +0 -54
- package/src/hooks/useVirtualScroll.ts +0 -331
- package/src/index.ts +0 -323
- package/src/platform/index.ts +0 -1188
- package/src/providers/AppProvider.test.tsx +0 -63
- package/src/providers/AppProvider.tsx +0 -155
- package/src/providers/index.ts +0 -1
- package/src/theme/ThemeProvider.tsx +0 -279
- package/src/theme/ThemeProvider.types.ts +0 -26
- package/src/theme/animations.tsx +0 -660
- package/src/theme/defaults.ts +0 -188
- package/src/theme/design-system.ts +0 -562
- package/src/theme/design-tokens.ts +0 -1122
- package/src/theme/generated/dark-theme.scss +0 -120
- package/src/theme/generated/tokens.css +0 -441
- package/src/theme/generated/tokens.scss +0 -384
- package/src/theme/index.ts +0 -99
- package/src/theme/responsive.tsx +0 -195
- package/src/theme/styles/mixins.scss +0 -612
- package/src/theme/styles/variables.scss +0 -295
- package/src/theme/styles.ts +0 -403
- package/src/theme/tokens/colors.ts +0 -256
- package/src/theme/tokens/effects.ts +0 -260
- package/src/theme/tokens/index.ts +0 -217
- package/src/theme/tokens/spacing.ts +0 -137
- package/src/theme/tokens/typography.ts +0 -186
- package/src/theme/types.ts +0 -188
- package/src/theme/useThemeUtils.ts +0 -313
- package/src/theme/utils.ts +0 -501
- package/src/theme/variables.ts +0 -602
- package/src/types/accessibility.ts +0 -50
- package/src/types/button.ts +0 -560
- package/src/types/component-props.ts +0 -322
- package/src/types/env.d.ts +0 -20
- package/src/types/glob.d.ts +0 -4
- package/src/types/index.ts +0 -427
- package/src/types/modules.d.ts +0 -40
- package/src/types/standardized-components.ts +0 -550
- package/src/types/taro-adapter.d.ts +0 -174
- package/src/types/taro-components.d.ts +0 -73
- package/src/types/utils.ts +0 -400
- package/src/utils/__tests__/inputValidator.test.ts +0 -338
- package/src/utils/__tests__/responsiveUtils.test.ts +0 -311
- package/src/utils/__tests__/xssProtection.test.ts +0 -268
- package/src/utils/abort-controller.ts +0 -48
- package/src/utils/cache.ts +0 -79
- package/src/utils/createNamespace.ts +0 -24
- package/src/utils/environment.ts +0 -115
- package/src/utils/error-handler.ts +0 -88
- package/src/utils/errorLogger.ts +0 -193
- package/src/utils/formatUtils.ts +0 -412
- package/src/utils/http/error-codes.ts +0 -314
- package/src/utils/http/http-client.test.ts +0 -63
- package/src/utils/http/http-client.ts +0 -161
- package/src/utils/http/request-cache.ts +0 -127
- package/src/utils/http/request.ts +0 -954
- package/src/utils/http/taro-adapter.test.ts +0 -74
- package/src/utils/http/taro-adapter.ts +0 -24
- package/src/utils/http/types.ts +0 -414
- package/src/utils/http/web-adapter.ts +0 -33
- package/src/utils/index.ts +0 -112
- package/src/utils/inputValidator.ts +0 -264
- package/src/utils/performance/performance.ts +0 -839
- package/src/utils/responsiveUtils.ts +0 -348
- package/src/utils/rtl-support.ts +0 -354
- package/src/utils/security/api-security.ts +0 -394
- package/src/utils/security/xss-protection.ts +0 -69
- package/src/utils/securityHeaders.ts +0 -308
- package/src/utils/typeHelpers.ts +0 -16
- package/src/utils/types/dataProcessing.ts +0 -544
- package/src/utils/types/typeHelpers.ts +0 -197
- package/src/utils/xssProtection.ts +0 -468
|
@@ -1,1140 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { useRef } from 'react';
|
|
3
|
-
import { render, screen, fireEvent, waitFor, act } from '@testing-library/react';
|
|
4
|
-
import { vi } from 'vitest';
|
|
5
|
-
import { Checkbox } from './Checkbox';
|
|
6
|
-
import { CheckboxGroup } from './CheckboxGroup';
|
|
7
|
-
import type { CheckboxProps, CheckboxRef, CheckboxGroupProps, CheckboxGroupRef } from './Checkbox.types';
|
|
8
|
-
|
|
9
|
-
// Mock Taro components
|
|
10
|
-
vi.mock('@tarojs/components', () => ({
|
|
11
|
-
Checkbox: ({ checked, onChange, onClick, onNativeClick, children, ...props }: any) => {
|
|
12
|
-
const disabled = props.disabled || false;
|
|
13
|
-
const readonly = !!props.readonly;
|
|
14
|
-
React.useEffect(() => {
|
|
15
|
-
if (props.autoFocus) {
|
|
16
|
-
props.onFocus?.({ type: 'focus' });
|
|
17
|
-
}
|
|
18
|
-
}, [props.autoFocus]);
|
|
19
|
-
const handleClick = (e: any) => {
|
|
20
|
-
// Create a proper event object with the structure expected by tests
|
|
21
|
-
const inputElement = e.target || {
|
|
22
|
-
...props,
|
|
23
|
-
type: 'checkbox',
|
|
24
|
-
get checked() { return checked; },
|
|
25
|
-
get disabled() { return disabled; },
|
|
26
|
-
get readOnly() { return readonly; },
|
|
27
|
-
getAttribute: (name: string) => {
|
|
28
|
-
const attrs: Record<string, any> = {
|
|
29
|
-
'data-testid': props['data-testid'],
|
|
30
|
-
'aria-checked': checked ? 'true' : 'false',
|
|
31
|
-
'aria-disabled': disabled ? 'true' : 'false',
|
|
32
|
-
'aria-readonly': readonly ? 'true' : 'false',
|
|
33
|
-
'aria-busy': props.accessibilityState?.busy ? 'true' : undefined,
|
|
34
|
-
'aria-expanded': props.accessibilityState?.expanded ? 'true' : 'false',
|
|
35
|
-
'data-checked': checked ? 'true' : 'false',
|
|
36
|
-
'data-readonly': readonly ? 'true' : undefined,
|
|
37
|
-
'data-value': props.value,
|
|
38
|
-
'tabindex': props.tabIndex,
|
|
39
|
-
'aria-label': props.accessibilityLabel || props.label,
|
|
40
|
-
};
|
|
41
|
-
return attrs[name] ?? null;
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const eventObject = {
|
|
46
|
-
target: inputElement,
|
|
47
|
-
currentTarget: e.currentTarget || inputElement,
|
|
48
|
-
type: 'change',
|
|
49
|
-
...e
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
if (onClick) {
|
|
53
|
-
onClick({ ...eventObject, type: 'click' });
|
|
54
|
-
}
|
|
55
|
-
// Also trigger the change event on click (since checkbox is clicked)
|
|
56
|
-
if (onChange) {
|
|
57
|
-
onChange(!checked, eventObject);
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<div data-testid="checkbox-wrapper">
|
|
63
|
-
<input
|
|
64
|
-
ref={(el) => {
|
|
65
|
-
// Store the element reference for event handling
|
|
66
|
-
if (el) {
|
|
67
|
-
el.checked = checked;
|
|
68
|
-
el.disabled = disabled;
|
|
69
|
-
el.readOnly = readonly;
|
|
70
|
-
}
|
|
71
|
-
}}
|
|
72
|
-
type="checkbox"
|
|
73
|
-
checked={checked}
|
|
74
|
-
onClick={handleClick}
|
|
75
|
-
readOnly={readonly}
|
|
76
|
-
readonly={readonly}
|
|
77
|
-
data-readonly={readonly ? 'true' : undefined}
|
|
78
|
-
aria-label={props.accessibilityLabel || props.label}
|
|
79
|
-
aria-checked={checked ? 'true' : 'false'}
|
|
80
|
-
aria-disabled={disabled ? 'true' : 'false'}
|
|
81
|
-
aria-busy={props.accessibilityState?.busy ? 'true' : undefined}
|
|
82
|
-
aria-expanded={props.accessibilityState?.expanded?.toString()}
|
|
83
|
-
tabIndex={props.tabIndex}
|
|
84
|
-
data-value={props.value}
|
|
85
|
-
{...props}
|
|
86
|
-
/>
|
|
87
|
-
{children}
|
|
88
|
-
</div>
|
|
89
|
-
);
|
|
90
|
-
},
|
|
91
|
-
View: ({ children, ...props }: any) => <div {...props}>{children}</div>,
|
|
92
|
-
Text: ({ children, ...props }: any) => <span {...props}>{children}</span>,
|
|
93
|
-
}));
|
|
94
|
-
|
|
95
|
-
// Mock PlatformDetector
|
|
96
|
-
vi.mock('@/utils', () => ({
|
|
97
|
-
PlatformDetector: {
|
|
98
|
-
getPlatform: () => 'h5',
|
|
99
|
-
},
|
|
100
|
-
}));
|
|
101
|
-
|
|
102
|
-
describe('Checkbox Component', () => {
|
|
103
|
-
beforeEach(() => {
|
|
104
|
-
vi.clearAllMocks();
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
describe('Rendering', () => {
|
|
108
|
-
it('renders Checkbox component with default props', () => {
|
|
109
|
-
render(<Checkbox />);
|
|
110
|
-
expect(screen.getByTestId('checkbox')).toBeInTheDocument();
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
it('renders with label', () => {
|
|
114
|
-
render(<Checkbox label="Accept terms" />);
|
|
115
|
-
expect(screen.getByText('Accept terms')).toBeInTheDocument();
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
it('renders with helper text', () => {
|
|
119
|
-
render(<Checkbox helperText="Please accept the terms" />);
|
|
120
|
-
expect(screen.getByText('Please accept the terms')).toBeInTheDocument();
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
it('renders with error text', () => {
|
|
124
|
-
render(<Checkbox errorText="This field is required" status="error" />);
|
|
125
|
-
expect(screen.getByText('This field is required')).toBeInTheDocument();
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
it('renders unchecked by default', () => {
|
|
129
|
-
render(<Checkbox />);
|
|
130
|
-
const checkbox = screen.getByTestId('checkbox');
|
|
131
|
-
expect(checkbox).not.toBeChecked();
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
it('renders checked when controlled', () => {
|
|
135
|
-
render(<Checkbox checked={true} />);
|
|
136
|
-
const checkbox = screen.getByTestId('checkbox');
|
|
137
|
-
expect(checkbox).toBeChecked();
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
it('renders checked with defaultChecked', () => {
|
|
141
|
-
render(<Checkbox defaultChecked={true} />);
|
|
142
|
-
const checkbox = screen.getByTestId('checkbox');
|
|
143
|
-
expect(checkbox).toBeChecked();
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
it('renders with custom icon', () => {
|
|
147
|
-
render(<Checkbox checked={true} icon="★" />);
|
|
148
|
-
expect(screen.getByText('★')).toBeInTheDocument();
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
it('renders with label on left', () => {
|
|
152
|
-
render(<Checkbox label="Left label" labelPosition="left" />);
|
|
153
|
-
const label = screen.getByText('Left label');
|
|
154
|
-
expect(label).toBeInTheDocument();
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
it('renders disabled', () => {
|
|
158
|
-
render(<Checkbox disabled />);
|
|
159
|
-
const checkbox = screen.getByTestId('checkbox');
|
|
160
|
-
expect(checkbox).toBeDisabled();
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
it('renders readonly', () => {
|
|
164
|
-
render(<Checkbox readonly />);
|
|
165
|
-
const checkbox = screen.getByTestId('checkbox');
|
|
166
|
-
expect(checkbox).toHaveAttribute('data-readonly', 'true');
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
it('renders indeterminate', () => {
|
|
170
|
-
render(<Checkbox indeterminate={true} />);
|
|
171
|
-
const checkbox = screen.getByTestId('checkbox');
|
|
172
|
-
expect(checkbox).toHaveAttribute('data-indeterminate', 'true');
|
|
173
|
-
});
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
describe('Value Handling', () => {
|
|
177
|
-
it('handles controlled mode', () => {
|
|
178
|
-
const handleChange = vi.fn();
|
|
179
|
-
render(<Checkbox checked={true} onChange={handleChange} />);
|
|
180
|
-
|
|
181
|
-
const checkbox = screen.getByTestId('checkbox');
|
|
182
|
-
fireEvent.click(checkbox);
|
|
183
|
-
|
|
184
|
-
expect(handleChange).toHaveBeenCalledWith(false, expect.any(Object));
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
it('handles uncontrolled mode', () => {
|
|
188
|
-
const handleChange = vi.fn();
|
|
189
|
-
render(<Checkbox defaultChecked={false} onChange={handleChange} />);
|
|
190
|
-
|
|
191
|
-
const checkbox = screen.getByTestId('checkbox');
|
|
192
|
-
fireEvent.click(checkbox);
|
|
193
|
-
|
|
194
|
-
expect(handleChange).toHaveBeenCalledWith(true, expect.any(Object));
|
|
195
|
-
expect(checkbox).toBeChecked();
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
it('toggles checked state on click', () => {
|
|
199
|
-
const handleChange = vi.fn();
|
|
200
|
-
render(<Checkbox onChange={handleChange} />);
|
|
201
|
-
|
|
202
|
-
const checkbox = screen.getByTestId('checkbox');
|
|
203
|
-
|
|
204
|
-
// First click - check
|
|
205
|
-
fireEvent.click(checkbox);
|
|
206
|
-
expect(handleChange).toHaveBeenCalledWith(true, expect.any(Object));
|
|
207
|
-
|
|
208
|
-
// Second click - uncheck
|
|
209
|
-
fireEvent.click(checkbox);
|
|
210
|
-
expect(handleChange).toHaveBeenCalledWith(false, expect.any(Object));
|
|
211
|
-
});
|
|
212
|
-
});
|
|
213
|
-
|
|
214
|
-
describe('States', () => {
|
|
215
|
-
it('handles disabled state', () => {
|
|
216
|
-
const handleChange = vi.fn();
|
|
217
|
-
render(<Checkbox disabled onChange={handleChange} />);
|
|
218
|
-
|
|
219
|
-
const checkbox = screen.getByTestId('checkbox');
|
|
220
|
-
expect(checkbox).toBeDisabled();
|
|
221
|
-
|
|
222
|
-
fireEvent.click(checkbox);
|
|
223
|
-
expect(handleChange).not.toHaveBeenCalled();
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
it('handles readonly state', () => {
|
|
227
|
-
const handleChange = vi.fn();
|
|
228
|
-
render(<Checkbox readonly onChange={handleChange} />);
|
|
229
|
-
|
|
230
|
-
const checkbox = screen.getByTestId('checkbox');
|
|
231
|
-
fireEvent.click(checkbox);
|
|
232
|
-
|
|
233
|
-
// Readonly should still allow interaction but handle it differently
|
|
234
|
-
expect(handleChange).not.toHaveBeenCalled();
|
|
235
|
-
});
|
|
236
|
-
|
|
237
|
-
it('handles indeterminate state', () => {
|
|
238
|
-
render(<Checkbox indeterminate={true} />);
|
|
239
|
-
const checkbox = screen.getByTestId('checkbox');
|
|
240
|
-
expect(checkbox).toHaveAttribute('data-indeterminate', 'true');
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
it('handles error state', () => {
|
|
244
|
-
render(<Checkbox status="error" />);
|
|
245
|
-
const checkbox = screen.getByTestId('checkbox');
|
|
246
|
-
expect(checkbox).toHaveClass('checkbox-error');
|
|
247
|
-
});
|
|
248
|
-
|
|
249
|
-
it('handles warning state', () => {
|
|
250
|
-
render(<Checkbox status="warning" />);
|
|
251
|
-
const checkbox = screen.getByTestId('checkbox');
|
|
252
|
-
expect(checkbox).toHaveClass('checkbox-warning');
|
|
253
|
-
});
|
|
254
|
-
|
|
255
|
-
it('handles success state', () => {
|
|
256
|
-
render(<Checkbox status="success" />);
|
|
257
|
-
const checkbox = screen.getByTestId('checkbox');
|
|
258
|
-
expect(checkbox).toHaveClass('checkbox-success');
|
|
259
|
-
});
|
|
260
|
-
});
|
|
261
|
-
|
|
262
|
-
describe('Sizes and Variants', () => {
|
|
263
|
-
const sizes: Array<'xs' | 'sm' | 'md' | 'lg' | 'xl'> = ['xs', 'sm', 'md', 'lg', 'xl'];
|
|
264
|
-
const variants: Array<'default' | 'filled' | 'outlined'> = ['default', 'filled', 'outlined'];
|
|
265
|
-
const colors: Array<'primary' | 'secondary' | 'success' | 'warning' | 'error' | 'info'> =
|
|
266
|
-
['primary', 'secondary', 'success', 'warning', 'error', 'info'];
|
|
267
|
-
|
|
268
|
-
sizes.forEach((size) => {
|
|
269
|
-
it(`renders with size ${size}`, () => {
|
|
270
|
-
render(<Checkbox size={size} />);
|
|
271
|
-
const checkbox = screen.getByTestId('checkbox');
|
|
272
|
-
expect(checkbox).toHaveClass(`checkbox-${size}`);
|
|
273
|
-
});
|
|
274
|
-
});
|
|
275
|
-
|
|
276
|
-
variants.forEach((variant) => {
|
|
277
|
-
it(`renders with variant ${variant}`, () => {
|
|
278
|
-
render(<Checkbox variant={variant} />);
|
|
279
|
-
const checkbox = screen.getByTestId('checkbox');
|
|
280
|
-
expect(checkbox).toHaveClass(`checkbox-${variant}`);
|
|
281
|
-
});
|
|
282
|
-
});
|
|
283
|
-
|
|
284
|
-
colors.forEach((color) => {
|
|
285
|
-
it(`renders with color ${color}`, () => {
|
|
286
|
-
render(<Checkbox color={color} />);
|
|
287
|
-
const checkbox = screen.getByTestId('checkbox');
|
|
288
|
-
expect(checkbox).toHaveClass(`checkbox-${color}`);
|
|
289
|
-
});
|
|
290
|
-
});
|
|
291
|
-
});
|
|
292
|
-
|
|
293
|
-
describe('Events', () => {
|
|
294
|
-
it('calls onChange when clicked', () => {
|
|
295
|
-
const handleChange = vi.fn();
|
|
296
|
-
render(<Checkbox onChange={handleChange} />);
|
|
297
|
-
|
|
298
|
-
const checkbox = screen.getByTestId('checkbox');
|
|
299
|
-
fireEvent.click(checkbox);
|
|
300
|
-
|
|
301
|
-
expect(handleChange).toHaveBeenCalledWith(true, expect.any(Object));
|
|
302
|
-
});
|
|
303
|
-
|
|
304
|
-
it('calls onClick when clicked', () => {
|
|
305
|
-
const handleClick = vi.fn();
|
|
306
|
-
render(<Checkbox onClick={handleClick} />);
|
|
307
|
-
|
|
308
|
-
const checkbox = screen.getByTestId('checkbox');
|
|
309
|
-
fireEvent.click(checkbox);
|
|
310
|
-
|
|
311
|
-
expect(handleClick).toHaveBeenCalledWith(expect.any(Object));
|
|
312
|
-
});
|
|
313
|
-
|
|
314
|
-
it('passes correct event to onChange handler', () => {
|
|
315
|
-
const handleChange = vi.fn();
|
|
316
|
-
render(<Checkbox onChange={handleChange} />);
|
|
317
|
-
|
|
318
|
-
const checkbox = screen.getByTestId('checkbox');
|
|
319
|
-
|
|
320
|
-
fireEvent.click(checkbox);
|
|
321
|
-
|
|
322
|
-
// The target should be an object with checkbox-like properties
|
|
323
|
-
expect(handleChange).toHaveBeenCalledWith(true, expect.objectContaining({
|
|
324
|
-
target: expect.objectContaining({
|
|
325
|
-
getAttribute: expect.any(Function),
|
|
326
|
-
type: 'checkbox',
|
|
327
|
-
}),
|
|
328
|
-
type: 'change',
|
|
329
|
-
}));
|
|
330
|
-
});
|
|
331
|
-
|
|
332
|
-
it('does not call onChange when disabled', () => {
|
|
333
|
-
const handleChange = vi.fn();
|
|
334
|
-
render(<Checkbox disabled onChange={handleChange} />);
|
|
335
|
-
|
|
336
|
-
const checkbox = screen.getByTestId('checkbox');
|
|
337
|
-
fireEvent.click(checkbox);
|
|
338
|
-
|
|
339
|
-
expect(handleChange).not.toHaveBeenCalled();
|
|
340
|
-
});
|
|
341
|
-
|
|
342
|
-
it('does not call onChange when readonly', () => {
|
|
343
|
-
const handleChange = vi.fn();
|
|
344
|
-
render(<Checkbox readonly onChange={handleChange} />);
|
|
345
|
-
|
|
346
|
-
const checkbox = screen.getByTestId('checkbox');
|
|
347
|
-
fireEvent.click(checkbox);
|
|
348
|
-
|
|
349
|
-
expect(handleChange).not.toHaveBeenCalled();
|
|
350
|
-
});
|
|
351
|
-
});
|
|
352
|
-
|
|
353
|
-
describe('Validation', () => {
|
|
354
|
-
it('validates required rule', async () => {
|
|
355
|
-
const rules = [{ required: true, message: 'This field is required' }];
|
|
356
|
-
render(<Checkbox rules={rules} validateTrigger="onChange" />);
|
|
357
|
-
|
|
358
|
-
const checkbox = screen.getByTestId('checkbox');
|
|
359
|
-
fireEvent.click(checkbox);
|
|
360
|
-
|
|
361
|
-
await waitFor(() => {
|
|
362
|
-
// Check that validation result is stored
|
|
363
|
-
expect(checkbox).toHaveAttribute('data-checked', 'true');
|
|
364
|
-
});
|
|
365
|
-
});
|
|
366
|
-
|
|
367
|
-
it('validates custom validator', async () => {
|
|
368
|
-
const validator = vi.fn().mockReturnValue('Custom error message');
|
|
369
|
-
render(<Checkbox validator={validator} validateTrigger="onChange" />);
|
|
370
|
-
|
|
371
|
-
const checkbox = screen.getByTestId('checkbox');
|
|
372
|
-
fireEvent.click(checkbox);
|
|
373
|
-
|
|
374
|
-
await waitFor(() => {
|
|
375
|
-
expect(validator).toHaveBeenCalled();
|
|
376
|
-
});
|
|
377
|
-
});
|
|
378
|
-
|
|
379
|
-
it('shows validation error message', () => {
|
|
380
|
-
const rules = [{ required: true, message: 'Required field' }];
|
|
381
|
-
render(<Checkbox rules={rules} status="error" />);
|
|
382
|
-
|
|
383
|
-
const checkbox = screen.getByTestId('checkbox');
|
|
384
|
-
expect(checkbox).toBeInTheDocument();
|
|
385
|
-
});
|
|
386
|
-
});
|
|
387
|
-
|
|
388
|
-
describe('Ref Methods', () => {
|
|
389
|
-
it('provides ref methods', () => {
|
|
390
|
-
const ref = React.createRef<CheckboxRef>();
|
|
391
|
-
act(() => {
|
|
392
|
-
render(<Checkbox ref={ref} />);
|
|
393
|
-
});
|
|
394
|
-
|
|
395
|
-
expect(ref.current).toBeTruthy();
|
|
396
|
-
expect(typeof ref.current?.getChecked).toBe('function');
|
|
397
|
-
expect(typeof ref.current?.setChecked).toBe('function');
|
|
398
|
-
expect(typeof ref.current?.toggle).toBe('function');
|
|
399
|
-
expect(typeof ref.current?.setDisabled).toBe('function');
|
|
400
|
-
expect(typeof ref.current?.setReadonly).toBe('function');
|
|
401
|
-
expect(typeof ref.current?.setIndeterminate).toBe('function');
|
|
402
|
-
expect(typeof ref.current?.setStatus).toBe('function');
|
|
403
|
-
expect(typeof ref.current?.getStatus).toBe('function');
|
|
404
|
-
expect(typeof ref.current?.setSize).toBe('function');
|
|
405
|
-
expect(typeof ref.current?.setColor).toBe('function');
|
|
406
|
-
expect(typeof ref.current?.validate).toBe('function');
|
|
407
|
-
expect(typeof ref.current?.reset).toBe('function');
|
|
408
|
-
expect(typeof ref.current?.focus).toBe('function');
|
|
409
|
-
expect(typeof ref.current?.blur).toBe('function');
|
|
410
|
-
expect(typeof ref.current?.getData).toBe('function');
|
|
411
|
-
expect(typeof ref.current?.setData).toBe('function');
|
|
412
|
-
expect(typeof ref.current?.shake).toBe('function');
|
|
413
|
-
expect(typeof ref.current?.pulse).toBe('function');
|
|
414
|
-
});
|
|
415
|
-
|
|
416
|
-
it('gets checked state via ref', () => {
|
|
417
|
-
const ref = React.createRef<CheckboxRef>();
|
|
418
|
-
act(() => {
|
|
419
|
-
render(<Checkbox ref={ref} checked={true} />);
|
|
420
|
-
});
|
|
421
|
-
|
|
422
|
-
expect(ref.current?.getChecked()).toBe(true);
|
|
423
|
-
});
|
|
424
|
-
|
|
425
|
-
it('sets checked state via ref', () => {
|
|
426
|
-
const ref = React.createRef<CheckboxRef>();
|
|
427
|
-
act(() => {
|
|
428
|
-
render(<Checkbox ref={ref} defaultChecked={false} />);
|
|
429
|
-
});
|
|
430
|
-
|
|
431
|
-
act(() => {
|
|
432
|
-
ref.current?.setChecked(true);
|
|
433
|
-
});
|
|
434
|
-
|
|
435
|
-
expect(ref.current?.getChecked()).toBe(true);
|
|
436
|
-
});
|
|
437
|
-
|
|
438
|
-
it('toggles checked state via ref', () => {
|
|
439
|
-
const ref = React.createRef<CheckboxRef>();
|
|
440
|
-
act(() => {
|
|
441
|
-
render(<Checkbox ref={ref} defaultChecked={false} />);
|
|
442
|
-
});
|
|
443
|
-
|
|
444
|
-
act(() => {
|
|
445
|
-
ref.current?.toggle();
|
|
446
|
-
});
|
|
447
|
-
|
|
448
|
-
expect(ref.current?.getChecked()).toBe(true);
|
|
449
|
-
});
|
|
450
|
-
|
|
451
|
-
it('sets disabled state via ref', () => {
|
|
452
|
-
const ref = React.createRef<CheckboxRef>();
|
|
453
|
-
act(() => {
|
|
454
|
-
render(<Checkbox ref={ref} />);
|
|
455
|
-
});
|
|
456
|
-
|
|
457
|
-
act(() => {
|
|
458
|
-
ref.current?.setDisabled(true);
|
|
459
|
-
});
|
|
460
|
-
|
|
461
|
-
expect(ref.current?.getStatus()).toBe('disabled');
|
|
462
|
-
});
|
|
463
|
-
|
|
464
|
-
it('validates via ref', async () => {
|
|
465
|
-
const rules = [{ required: true, message: 'Required' }];
|
|
466
|
-
const ref = React.createRef<CheckboxRef>();
|
|
467
|
-
act(() => {
|
|
468
|
-
render(<Checkbox ref={ref} rules={rules} />);
|
|
469
|
-
});
|
|
470
|
-
|
|
471
|
-
const result = await ref.current?.validate();
|
|
472
|
-
|
|
473
|
-
expect(result?.valid).toBe(false);
|
|
474
|
-
expect(result?.message).toBe('Required');
|
|
475
|
-
});
|
|
476
|
-
|
|
477
|
-
it('resets via ref', () => {
|
|
478
|
-
const ref = React.createRef<CheckboxRef>();
|
|
479
|
-
act(() => {
|
|
480
|
-
render(<Checkbox ref={ref} defaultChecked={true} />);
|
|
481
|
-
});
|
|
482
|
-
|
|
483
|
-
act(() => {
|
|
484
|
-
ref.current?.reset();
|
|
485
|
-
});
|
|
486
|
-
|
|
487
|
-
expect(ref.current?.getChecked()).toBe(true);
|
|
488
|
-
});
|
|
489
|
-
|
|
490
|
-
it('gets and sets data via ref', () => {
|
|
491
|
-
const ref = React.createRef<CheckboxRef>();
|
|
492
|
-
const testData = { id: 'test', category: 'form' };
|
|
493
|
-
act(() => {
|
|
494
|
-
render(<Checkbox ref={ref} data={testData} />);
|
|
495
|
-
});
|
|
496
|
-
|
|
497
|
-
expect(ref.current?.getData()).toEqual(testData);
|
|
498
|
-
|
|
499
|
-
const newData = { id: 'updated', category: 'updated' };
|
|
500
|
-
act(() => {
|
|
501
|
-
ref.current?.setData(newData);
|
|
502
|
-
});
|
|
503
|
-
|
|
504
|
-
// Note: setData is a mock function that logs to console
|
|
505
|
-
expect(ref.current?.getData()).toEqual(testData); // Should remain unchanged
|
|
506
|
-
});
|
|
507
|
-
|
|
508
|
-
it('calls shake method via ref', () => {
|
|
509
|
-
const ref = React.createRef<CheckboxRef>();
|
|
510
|
-
act(() => {
|
|
511
|
-
render(<Checkbox ref={ref} />);
|
|
512
|
-
});
|
|
513
|
-
|
|
514
|
-
expect(() => {
|
|
515
|
-
act(() => {
|
|
516
|
-
ref.current?.shake();
|
|
517
|
-
});
|
|
518
|
-
}).not.toThrow();
|
|
519
|
-
});
|
|
520
|
-
|
|
521
|
-
it('calls pulse method via ref', () => {
|
|
522
|
-
const ref = React.createRef<CheckboxRef>();
|
|
523
|
-
act(() => {
|
|
524
|
-
render(<Checkbox ref={ref} />);
|
|
525
|
-
});
|
|
526
|
-
|
|
527
|
-
expect(() => {
|
|
528
|
-
act(() => {
|
|
529
|
-
ref.current?.pulse();
|
|
530
|
-
});
|
|
531
|
-
}).not.toThrow();
|
|
532
|
-
});
|
|
533
|
-
});
|
|
534
|
-
|
|
535
|
-
describe('Accessibility', () => {
|
|
536
|
-
it('has proper accessibility attributes', () => {
|
|
537
|
-
render(<Checkbox accessibilityLabel="Test checkbox" />);
|
|
538
|
-
const checkbox = screen.getByTestId('checkbox');
|
|
539
|
-
expect(checkbox).toHaveAttribute('aria-label', 'Test checkbox');
|
|
540
|
-
expect(checkbox).toHaveAttribute('role', 'checkbox');
|
|
541
|
-
});
|
|
542
|
-
|
|
543
|
-
it('has correct accessibility state', () => {
|
|
544
|
-
render(<Checkbox checked={true} disabled={true} />);
|
|
545
|
-
const checkbox = screen.getByTestId('checkbox');
|
|
546
|
-
expect(checkbox).toHaveAttribute('aria-checked', 'true');
|
|
547
|
-
expect(checkbox).toHaveAttribute('aria-disabled', 'true');
|
|
548
|
-
});
|
|
549
|
-
|
|
550
|
-
it('supports custom accessibility state', () => {
|
|
551
|
-
const customState = { busy: true, expanded: false };
|
|
552
|
-
render(<Checkbox accessibilityState={customState} />);
|
|
553
|
-
const checkbox = screen.getByTestId('checkbox');
|
|
554
|
-
expect(checkbox).toHaveAttribute('aria-busy', 'true');
|
|
555
|
-
expect(checkbox).toHaveAttribute('aria-expanded', 'false');
|
|
556
|
-
});
|
|
557
|
-
});
|
|
558
|
-
|
|
559
|
-
describe('Platform Compatibility', () => {
|
|
560
|
-
it('renders on H5 platform', () => {
|
|
561
|
-
render(<Checkbox />);
|
|
562
|
-
const checkbox = screen.getByTestId('checkbox');
|
|
563
|
-
expect(checkbox).toBeInTheDocument();
|
|
564
|
-
});
|
|
565
|
-
|
|
566
|
-
it('handles touch events', () => {
|
|
567
|
-
const handleChange = vi.fn();
|
|
568
|
-
render(<Checkbox onChange={handleChange} />);
|
|
569
|
-
|
|
570
|
-
const checkbox = screen.getByTestId('checkbox');
|
|
571
|
-
fireEvent.click(checkbox);
|
|
572
|
-
|
|
573
|
-
expect(handleChange).toHaveBeenCalled();
|
|
574
|
-
});
|
|
575
|
-
|
|
576
|
-
it('supports custom styling', () => {
|
|
577
|
-
const customStyle = { backgroundColor: 'red', color: 'white' };
|
|
578
|
-
render(<Checkbox style={customStyle} />);
|
|
579
|
-
|
|
580
|
-
const checkbox = screen.getByTestId('checkbox');
|
|
581
|
-
expect(checkbox).toHaveStyle('background-color: red');
|
|
582
|
-
expect(checkbox).toHaveStyle('color: white');
|
|
583
|
-
});
|
|
584
|
-
});
|
|
585
|
-
|
|
586
|
-
describe('Performance', () => {
|
|
587
|
-
it('handles rapid clicks without errors', () => {
|
|
588
|
-
const handleChange = vi.fn();
|
|
589
|
-
render(<Checkbox onChange={handleChange} />);
|
|
590
|
-
|
|
591
|
-
const checkbox = screen.getByTestId('checkbox');
|
|
592
|
-
|
|
593
|
-
// Rapid clicks
|
|
594
|
-
for (let i = 0; i < 10; i++) {
|
|
595
|
-
fireEvent.click(checkbox);
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
expect(handleChange).toHaveBeenCalledTimes(10);
|
|
599
|
-
});
|
|
600
|
-
|
|
601
|
-
it('does not re-render unnecessarily', () => {
|
|
602
|
-
const handleChange = vi.fn();
|
|
603
|
-
const { rerender } = render(<Checkbox onChange={handleChange} />);
|
|
604
|
-
|
|
605
|
-
const checkbox = screen.getByTestId('checkbox');
|
|
606
|
-
const initialRenderCount = handleChange.mock.calls.length;
|
|
607
|
-
|
|
608
|
-
rerender(<Checkbox onChange={handleChange} />);
|
|
609
|
-
|
|
610
|
-
expect(handleChange.mock.calls.length).toBe(initialRenderCount);
|
|
611
|
-
});
|
|
612
|
-
|
|
613
|
-
it('handles animation states correctly', () => {
|
|
614
|
-
const handleChange = vi.fn();
|
|
615
|
-
render(<Checkbox onChange={handleChange} animation={true} />);
|
|
616
|
-
|
|
617
|
-
const checkbox = screen.getByTestId('checkbox');
|
|
618
|
-
|
|
619
|
-
fireEvent.click(checkbox);
|
|
620
|
-
|
|
621
|
-
// Should handle animation without errors
|
|
622
|
-
expect(handleChange).toHaveBeenCalled();
|
|
623
|
-
});
|
|
624
|
-
|
|
625
|
-
it('handles ripple effects correctly', () => {
|
|
626
|
-
const handleChange = vi.fn();
|
|
627
|
-
render(<Checkbox onChange={handleChange} ripple={true} />);
|
|
628
|
-
|
|
629
|
-
const checkbox = screen.getByTestId('checkbox');
|
|
630
|
-
|
|
631
|
-
fireEvent.click(checkbox);
|
|
632
|
-
|
|
633
|
-
// Should handle ripple without errors
|
|
634
|
-
expect(handleChange).toHaveBeenCalled();
|
|
635
|
-
});
|
|
636
|
-
});
|
|
637
|
-
|
|
638
|
-
describe('Advanced Features', () => {
|
|
639
|
-
it('handles custom icons correctly', () => {
|
|
640
|
-
const checkedIcon = '✓';
|
|
641
|
-
const uncheckedIcon = '✗';
|
|
642
|
-
const indeterminateIcon = '−';
|
|
643
|
-
|
|
644
|
-
const { rerender } = render(
|
|
645
|
-
<Checkbox
|
|
646
|
-
checked={true}
|
|
647
|
-
checkedIcon={checkedIcon}
|
|
648
|
-
uncheckedIcon={uncheckedIcon}
|
|
649
|
-
indeterminateIcon={indeterminateIcon}
|
|
650
|
-
/>
|
|
651
|
-
);
|
|
652
|
-
|
|
653
|
-
expect(screen.getByText(checkedIcon)).toBeInTheDocument();
|
|
654
|
-
|
|
655
|
-
rerender(
|
|
656
|
-
<Checkbox
|
|
657
|
-
checked={false}
|
|
658
|
-
checkedIcon={checkedIcon}
|
|
659
|
-
uncheckedIcon={uncheckedIcon}
|
|
660
|
-
indeterminateIcon={indeterminateIcon}
|
|
661
|
-
/>
|
|
662
|
-
);
|
|
663
|
-
|
|
664
|
-
expect(screen.getByText(uncheckedIcon)).toBeInTheDocument();
|
|
665
|
-
|
|
666
|
-
rerender(
|
|
667
|
-
<Checkbox
|
|
668
|
-
indeterminate={true}
|
|
669
|
-
checkedIcon={checkedIcon}
|
|
670
|
-
uncheckedIcon={uncheckedIcon}
|
|
671
|
-
indeterminateIcon={indeterminateIcon}
|
|
672
|
-
/>
|
|
673
|
-
);
|
|
674
|
-
|
|
675
|
-
expect(screen.getByText(indeterminateIcon)).toBeInTheDocument();
|
|
676
|
-
});
|
|
677
|
-
|
|
678
|
-
it('handles auto focus correctly', async () => {
|
|
679
|
-
const handleFocus = vi.fn();
|
|
680
|
-
act(() => {
|
|
681
|
-
render(<Checkbox autoFocus={true} onFocus={handleFocus} />);
|
|
682
|
-
});
|
|
683
|
-
|
|
684
|
-
// Auto focus should trigger focus event
|
|
685
|
-
await waitFor(() => expect(handleFocus).toHaveBeenCalled());
|
|
686
|
-
});
|
|
687
|
-
|
|
688
|
-
it('handles custom tab index correctly', () => {
|
|
689
|
-
render(<Checkbox tabIndex={5} />);
|
|
690
|
-
|
|
691
|
-
const checkbox = screen.getByTestId('checkbox');
|
|
692
|
-
expect(checkbox).toHaveAttribute('tabindex', '5');
|
|
693
|
-
});
|
|
694
|
-
|
|
695
|
-
it('handles data attributes correctly', () => {
|
|
696
|
-
const testData = { id: 'test', category: 'form' };
|
|
697
|
-
render(<Checkbox value="test-value" />);
|
|
698
|
-
|
|
699
|
-
const checkbox = screen.getByTestId('checkbox');
|
|
700
|
-
expect(checkbox).toHaveAttribute('data-value', 'test-value');
|
|
701
|
-
expect(checkbox).toHaveAttribute('data-checked', 'false');
|
|
702
|
-
});
|
|
703
|
-
|
|
704
|
-
it('handles different label positions correctly', () => {
|
|
705
|
-
const { rerender } = render(<Checkbox label="Test Label" labelPosition="right" />);
|
|
706
|
-
|
|
707
|
-
expect(screen.getByText('Test Label')).toBeInTheDocument();
|
|
708
|
-
|
|
709
|
-
rerender(<Checkbox label="Test Label" labelPosition="left" />);
|
|
710
|
-
|
|
711
|
-
expect(screen.getByText('Test Label')).toBeInTheDocument();
|
|
712
|
-
});
|
|
713
|
-
|
|
714
|
-
it('handles bordered and rounded variations correctly', () => {
|
|
715
|
-
const { rerender } = render(<Checkbox bordered={true} rounded={true} />);
|
|
716
|
-
|
|
717
|
-
let checkbox = screen.getByTestId('checkbox');
|
|
718
|
-
expect(checkbox).toHaveClass('checkbox-bordered');
|
|
719
|
-
expect(checkbox).toHaveClass('checkbox-rounded');
|
|
720
|
-
|
|
721
|
-
rerender(<Checkbox bordered={false} rounded={false} />);
|
|
722
|
-
|
|
723
|
-
checkbox = screen.getByTestId('checkbox');
|
|
724
|
-
expect(checkbox).not.toHaveClass('checkbox-bordered');
|
|
725
|
-
expect(checkbox).not.toHaveClass('checkbox-rounded');
|
|
726
|
-
});
|
|
727
|
-
});
|
|
728
|
-
});
|
|
729
|
-
|
|
730
|
-
describe('CheckboxGroup Component', () => {
|
|
731
|
-
const mockOptions = [
|
|
732
|
-
{ label: 'Option 1', value: '1' },
|
|
733
|
-
{ label: 'Option 2', value: '2' },
|
|
734
|
-
{ label: 'Option 3', value: '3' },
|
|
735
|
-
];
|
|
736
|
-
|
|
737
|
-
beforeEach(() => {
|
|
738
|
-
vi.clearAllMocks();
|
|
739
|
-
});
|
|
740
|
-
|
|
741
|
-
describe('Rendering', () => {
|
|
742
|
-
it('renders CheckboxGroup with options', () => {
|
|
743
|
-
render(<CheckboxGroup options={mockOptions} />);
|
|
744
|
-
|
|
745
|
-
expect(screen.getByText('Option 1')).toBeInTheDocument();
|
|
746
|
-
expect(screen.getByText('Option 2')).toBeInTheDocument();
|
|
747
|
-
expect(screen.getByText('Option 3')).toBeInTheDocument();
|
|
748
|
-
});
|
|
749
|
-
|
|
750
|
-
it('renders with group title', () => {
|
|
751
|
-
render(<CheckboxGroup options={mockOptions} groupTitle="Select options" />);
|
|
752
|
-
|
|
753
|
-
expect(screen.getByText('Select options')).toBeInTheDocument();
|
|
754
|
-
});
|
|
755
|
-
|
|
756
|
-
it('renders with group description', () => {
|
|
757
|
-
render(<CheckboxGroup options={mockOptions} groupDescription="Please select your options" />);
|
|
758
|
-
|
|
759
|
-
expect(screen.getByText('Please select your options')).toBeInTheDocument();
|
|
760
|
-
});
|
|
761
|
-
|
|
762
|
-
it('renders with select all button', () => {
|
|
763
|
-
render(<CheckboxGroup options={mockOptions} showSelectAll={true} />);
|
|
764
|
-
|
|
765
|
-
expect(screen.getByText('全选')).toBeInTheDocument();
|
|
766
|
-
});
|
|
767
|
-
|
|
768
|
-
it('renders with count display', () => {
|
|
769
|
-
render(<CheckboxGroup options={mockOptions} showCount={true} />);
|
|
770
|
-
|
|
771
|
-
expect(screen.getByText(/已选择/)).toBeInTheDocument();
|
|
772
|
-
});
|
|
773
|
-
});
|
|
774
|
-
|
|
775
|
-
describe('Value Handling', () => {
|
|
776
|
-
it('handles controlled mode', () => {
|
|
777
|
-
const handleChange = vi.fn();
|
|
778
|
-
render(<CheckboxGroup options={mockOptions} value={['1']} onChange={handleChange} />);
|
|
779
|
-
|
|
780
|
-
const checkbox1 = screen.getByRole('checkbox', { name: /Option 1/ });
|
|
781
|
-
fireEvent.click(checkbox1);
|
|
782
|
-
|
|
783
|
-
expect(handleChange).toHaveBeenCalledWith([]);
|
|
784
|
-
});
|
|
785
|
-
|
|
786
|
-
it('handles uncontrolled mode', () => {
|
|
787
|
-
const handleChange = vi.fn();
|
|
788
|
-
render(<CheckboxGroup options={mockOptions} defaultValue={['1']} onChange={handleChange} />);
|
|
789
|
-
|
|
790
|
-
const checkbox2 = screen.getByRole('checkbox', { name: /Option 2/ });
|
|
791
|
-
fireEvent.click(checkbox2);
|
|
792
|
-
|
|
793
|
-
expect(handleChange).toHaveBeenCalledWith(['1', '2']);
|
|
794
|
-
});
|
|
795
|
-
|
|
796
|
-
it('respects max count limit', () => {
|
|
797
|
-
const handleChange = vi.fn();
|
|
798
|
-
render(<CheckboxGroup options={mockOptions} maxCount={2} onChange={handleChange} />);
|
|
799
|
-
|
|
800
|
-
const checkbox1 = screen.getByRole('checkbox', { name: /Option 1/ });
|
|
801
|
-
const checkbox2 = screen.getByRole('checkbox', { name: /Option 2/ });
|
|
802
|
-
const checkbox3 = screen.getByRole('checkbox', { name: /Option 3/ });
|
|
803
|
-
|
|
804
|
-
fireEvent.click(checkbox1);
|
|
805
|
-
fireEvent.click(checkbox2);
|
|
806
|
-
fireEvent.click(checkbox3);
|
|
807
|
-
|
|
808
|
-
expect(handleChange).toHaveBeenCalledTimes(2);
|
|
809
|
-
});
|
|
810
|
-
|
|
811
|
-
it('respects min count limit', () => {
|
|
812
|
-
const handleChange = vi.fn();
|
|
813
|
-
render(<CheckboxGroup options={mockOptions} defaultValue={['1', '2']} minCount={1} onChange={handleChange} />);
|
|
814
|
-
|
|
815
|
-
const checkbox1 = screen.getByRole('checkbox', { name: /Option 1/ });
|
|
816
|
-
const checkbox2 = screen.getByRole('checkbox', { name: /Option 2/ });
|
|
817
|
-
|
|
818
|
-
fireEvent.click(checkbox1);
|
|
819
|
-
fireEvent.click(checkbox2);
|
|
820
|
-
|
|
821
|
-
// Should not allow deselecting below min count
|
|
822
|
-
expect(handleChange).not.toHaveBeenCalledWith([]);
|
|
823
|
-
});
|
|
824
|
-
});
|
|
825
|
-
|
|
826
|
-
describe('Group Operations', () => {
|
|
827
|
-
it('handles select all functionality', () => {
|
|
828
|
-
const handleChange = vi.fn();
|
|
829
|
-
const handleAllChange = vi.fn();
|
|
830
|
-
render(
|
|
831
|
-
<CheckboxGroup
|
|
832
|
-
options={mockOptions}
|
|
833
|
-
showSelectAll={true}
|
|
834
|
-
onChange={handleChange}
|
|
835
|
-
onAllChange={handleAllChange}
|
|
836
|
-
/>
|
|
837
|
-
);
|
|
838
|
-
|
|
839
|
-
const selectAllButton = screen.getByText('全选');
|
|
840
|
-
fireEvent.click(selectAllButton);
|
|
841
|
-
|
|
842
|
-
expect(handleChange).toHaveBeenCalledWith(['1', '2', '3']);
|
|
843
|
-
expect(handleAllChange).toHaveBeenCalledWith(true);
|
|
844
|
-
});
|
|
845
|
-
|
|
846
|
-
it('handles deselect all functionality', () => {
|
|
847
|
-
const handleChange = vi.fn();
|
|
848
|
-
const handleAllChange = vi.fn();
|
|
849
|
-
render(
|
|
850
|
-
<CheckboxGroup
|
|
851
|
-
options={mockOptions}
|
|
852
|
-
value={['1', '2', '3']}
|
|
853
|
-
showSelectAll={true}
|
|
854
|
-
onChange={handleChange}
|
|
855
|
-
onAllChange={handleAllChange}
|
|
856
|
-
/>
|
|
857
|
-
);
|
|
858
|
-
|
|
859
|
-
const selectAllButton = screen.getByText('全选');
|
|
860
|
-
fireEvent.click(selectAllButton);
|
|
861
|
-
|
|
862
|
-
expect(handleChange).toHaveBeenCalledWith([]);
|
|
863
|
-
expect(handleAllChange).toHaveBeenCalledWith(false);
|
|
864
|
-
});
|
|
865
|
-
|
|
866
|
-
it('calculates group state correctly', () => {
|
|
867
|
-
const { rerender } = render(<CheckboxGroup options={mockOptions} value={['1']} showCount={true} />);
|
|
868
|
-
|
|
869
|
-
expect(screen.getByText(/已选择 1 项/)).toBeInTheDocument();
|
|
870
|
-
|
|
871
|
-
rerender(<CheckboxGroup options={mockOptions} value={['1', '2', '3']} showCount={true} />);
|
|
872
|
-
|
|
873
|
-
expect(screen.getByText(/已选择 3 项/)).toBeInTheDocument();
|
|
874
|
-
});
|
|
875
|
-
});
|
|
876
|
-
|
|
877
|
-
describe('Layout and Styling', () => {
|
|
878
|
-
it('renders in horizontal direction', () => {
|
|
879
|
-
render(<CheckboxGroup options={mockOptions} direction="horizontal" />);
|
|
880
|
-
|
|
881
|
-
const container = screen.getByRole('group');
|
|
882
|
-
expect(container).toHaveStyle({ flexDirection: 'row' });
|
|
883
|
-
});
|
|
884
|
-
|
|
885
|
-
it('renders in vertical direction', () => {
|
|
886
|
-
render(<CheckboxGroup options={mockOptions} direction="vertical" />);
|
|
887
|
-
|
|
888
|
-
const container = screen.getByRole('group');
|
|
889
|
-
expect(container).toHaveStyle({ flexDirection: 'column' });
|
|
890
|
-
});
|
|
891
|
-
|
|
892
|
-
it('applies compact layout', () => {
|
|
893
|
-
render(<CheckboxGroup options={mockOptions} compact={true} />);
|
|
894
|
-
|
|
895
|
-
const container = screen.getByRole('group');
|
|
896
|
-
expect(container).toHaveStyle({ gap: '4px' });
|
|
897
|
-
});
|
|
898
|
-
|
|
899
|
-
it('applies block layout', () => {
|
|
900
|
-
render(<CheckboxGroup options={mockOptions} block={true} />);
|
|
901
|
-
|
|
902
|
-
const container = screen.getByRole('group');
|
|
903
|
-
expect(container).toHaveStyle({ width: '100%' });
|
|
904
|
-
});
|
|
905
|
-
});
|
|
906
|
-
|
|
907
|
-
describe('Ref Methods', () => {
|
|
908
|
-
it('provides ref methods', () => {
|
|
909
|
-
const ref = React.createRef<CheckboxGroupRef>();
|
|
910
|
-
render(<CheckboxGroup ref={ref} options={mockOptions} />);
|
|
911
|
-
|
|
912
|
-
expect(ref.current).toBeTruthy();
|
|
913
|
-
expect(typeof ref.current?.getValue).toBe('function');
|
|
914
|
-
expect(typeof ref.current?.setValue).toBe('function');
|
|
915
|
-
expect(typeof ref.current?.selectAll).toBe('function');
|
|
916
|
-
expect(typeof ref.current?.unselectAll).toBe('function');
|
|
917
|
-
expect(typeof ref.current?.toggleAll).toBe('function');
|
|
918
|
-
expect(typeof ref.current?.getCheckedCount).toBe('function');
|
|
919
|
-
expect(typeof ref.current?.getTotalCount).toBe('function');
|
|
920
|
-
expect(typeof ref.current?.isAllSelected).toBe('function');
|
|
921
|
-
expect(typeof ref.current?.isIndeterminate).toBe('function');
|
|
922
|
-
});
|
|
923
|
-
|
|
924
|
-
it('gets and sets values via ref', () => {
|
|
925
|
-
const ref = React.createRef<CheckboxGroupRef>();
|
|
926
|
-
render(<CheckboxGroup ref={ref} options={mockOptions} />);
|
|
927
|
-
|
|
928
|
-
expect(ref.current?.getValue()).toEqual([]);
|
|
929
|
-
|
|
930
|
-
act(() => {
|
|
931
|
-
ref.current?.setValue(['1', '2']);
|
|
932
|
-
});
|
|
933
|
-
|
|
934
|
-
expect(ref.current?.getValue()).toEqual(['1', '2']);
|
|
935
|
-
});
|
|
936
|
-
|
|
937
|
-
it('selects all via ref', () => {
|
|
938
|
-
const ref = React.createRef<CheckboxGroupRef>();
|
|
939
|
-
render(<CheckboxGroup ref={ref} options={mockOptions} />);
|
|
940
|
-
|
|
941
|
-
act(() => {
|
|
942
|
-
ref.current?.selectAll();
|
|
943
|
-
});
|
|
944
|
-
|
|
945
|
-
expect(ref.current?.getValue()).toEqual(['1', '2', '3']);
|
|
946
|
-
});
|
|
947
|
-
|
|
948
|
-
it('unselects all via ref', () => {
|
|
949
|
-
const ref = React.createRef<CheckboxGroupRef>();
|
|
950
|
-
render(<CheckboxGroup ref={ref} options={mockOptions} defaultValue={['1', '2']} />);
|
|
951
|
-
|
|
952
|
-
act(() => {
|
|
953
|
-
ref.current?.unselectAll();
|
|
954
|
-
});
|
|
955
|
-
|
|
956
|
-
expect(ref.current?.getValue()).toEqual([]);
|
|
957
|
-
});
|
|
958
|
-
|
|
959
|
-
it('gets checked count via ref', () => {
|
|
960
|
-
const ref = React.createRef<CheckboxGroupRef>();
|
|
961
|
-
render(<CheckboxGroup ref={ref} options={mockOptions} defaultValue={['1', '2']} />);
|
|
962
|
-
|
|
963
|
-
expect(ref.current?.getCheckedCount()).toBe(2);
|
|
964
|
-
expect(ref.current?.getTotalCount()).toBe(3);
|
|
965
|
-
});
|
|
966
|
-
|
|
967
|
-
it('checks selection state via ref', () => {
|
|
968
|
-
const ref = React.createRef<CheckboxGroupRef>();
|
|
969
|
-
render(<CheckboxGroup ref={ref} options={mockOptions} defaultValue={['1']} />);
|
|
970
|
-
|
|
971
|
-
expect(ref.current?.isAllSelected()).toBe(false);
|
|
972
|
-
expect(ref.current?.isIndeterminate()).toBe(true);
|
|
973
|
-
});
|
|
974
|
-
|
|
975
|
-
it('validates via ref', async () => {
|
|
976
|
-
const ref = React.createRef<CheckboxGroupRef>();
|
|
977
|
-
render(<CheckboxGroup ref={ref} options={mockOptions} minCount={2} />);
|
|
978
|
-
|
|
979
|
-
const result = await ref.current?.validate();
|
|
980
|
-
|
|
981
|
-
expect(result?.valid).toBe(false);
|
|
982
|
-
expect(result?.message).toContain('最少需要选择 2 项');
|
|
983
|
-
});
|
|
984
|
-
});
|
|
985
|
-
|
|
986
|
-
describe('Accessibility', () => {
|
|
987
|
-
it('has proper accessibility attributes', () => {
|
|
988
|
-
render(<CheckboxGroup options={mockOptions} accessibilityLabel="Test group" />);
|
|
989
|
-
|
|
990
|
-
const group = screen.getByRole('group');
|
|
991
|
-
expect(group).toHaveAttribute('aria-label', 'Test group');
|
|
992
|
-
expect(group).toHaveAttribute('aria-role', 'group');
|
|
993
|
-
});
|
|
994
|
-
|
|
995
|
-
it('supports disabled state', () => {
|
|
996
|
-
render(<CheckboxGroup options={mockOptions} disabled={true} />);
|
|
997
|
-
|
|
998
|
-
const checkboxes = screen.getAllByRole('checkbox');
|
|
999
|
-
checkboxes.forEach(checkbox => {
|
|
1000
|
-
expect(checkbox).toBeDisabled();
|
|
1001
|
-
});
|
|
1002
|
-
});
|
|
1003
|
-
|
|
1004
|
-
it('supports readonly state', () => {
|
|
1005
|
-
render(<CheckboxGroup options={mockOptions} readonly={true} />);
|
|
1006
|
-
|
|
1007
|
-
const checkboxes = screen.getAllByRole('checkbox');
|
|
1008
|
-
checkboxes.forEach(checkbox => {
|
|
1009
|
-
expect(checkbox).toHaveAttribute('data-readonly', 'true');
|
|
1010
|
-
});
|
|
1011
|
-
});
|
|
1012
|
-
});
|
|
1013
|
-
|
|
1014
|
-
describe('Edge Cases', () => {
|
|
1015
|
-
it('handles empty options array', () => {
|
|
1016
|
-
render(<CheckboxGroup options={[]} />);
|
|
1017
|
-
|
|
1018
|
-
const group = screen.getByRole('group');
|
|
1019
|
-
expect(group).toBeEmptyDOMElement();
|
|
1020
|
-
});
|
|
1021
|
-
|
|
1022
|
-
it('handles disabled options', () => {
|
|
1023
|
-
const optionsWithDisabled = [
|
|
1024
|
-
...mockOptions,
|
|
1025
|
-
{ label: 'Disabled Option', value: '4', disabled: true },
|
|
1026
|
-
];
|
|
1027
|
-
|
|
1028
|
-
render(<CheckboxGroup options={optionsWithDisabled} />);
|
|
1029
|
-
|
|
1030
|
-
const disabledCheckbox = screen.getByRole('checkbox', { name: /Disabled Option/ });
|
|
1031
|
-
expect(disabledCheckbox).toBeDisabled();
|
|
1032
|
-
});
|
|
1033
|
-
|
|
1034
|
-
it('handles options with descriptions', () => {
|
|
1035
|
-
const optionsWithDescriptions = mockOptions.map(option => ({
|
|
1036
|
-
...option,
|
|
1037
|
-
description: `Description for ${option.label}`,
|
|
1038
|
-
}));
|
|
1039
|
-
|
|
1040
|
-
render(<CheckboxGroup options={optionsWithDescriptions} />);
|
|
1041
|
-
|
|
1042
|
-
expect(screen.getByText('Description for Option 1')).toBeInTheDocument();
|
|
1043
|
-
expect(screen.getByText('Description for Option 2')).toBeInTheDocument();
|
|
1044
|
-
expect(screen.getByText('Description for Option 3')).toBeInTheDocument();
|
|
1045
|
-
});
|
|
1046
|
-
|
|
1047
|
-
it('handles toggleAll functionality correctly', () => {
|
|
1048
|
-
const ref = React.createRef<CheckboxGroupRef>();
|
|
1049
|
-
const handleChange = vi.fn();
|
|
1050
|
-
render(<CheckboxGroup ref={ref} options={mockOptions} onChange={handleChange} />);
|
|
1051
|
-
|
|
1052
|
-
// Initially nothing selected
|
|
1053
|
-
expect(ref.current?.isAllSelected()).toBe(false);
|
|
1054
|
-
expect(ref.current?.isIndeterminate()).toBe(false);
|
|
1055
|
-
|
|
1056
|
-
// Toggle all should select everything
|
|
1057
|
-
act(() => {
|
|
1058
|
-
ref.current?.toggleAll();
|
|
1059
|
-
});
|
|
1060
|
-
|
|
1061
|
-
expect(ref.current?.isAllSelected()).toBe(true);
|
|
1062
|
-
expect(ref.current?.isIndeterminate()).toBe(false);
|
|
1063
|
-
expect(handleChange).toHaveBeenCalledWith(['1', '2', '3']);
|
|
1064
|
-
|
|
1065
|
-
// Toggle all again should deselect everything
|
|
1066
|
-
act(() => {
|
|
1067
|
-
ref.current?.toggleAll();
|
|
1068
|
-
});
|
|
1069
|
-
|
|
1070
|
-
expect(ref.current?.isAllSelected()).toBe(false);
|
|
1071
|
-
expect(ref.current?.isIndeterminate()).toBe(false);
|
|
1072
|
-
expect(handleChange).toHaveBeenCalledWith([]);
|
|
1073
|
-
});
|
|
1074
|
-
|
|
1075
|
-
it('handles custom count text correctly', () => {
|
|
1076
|
-
const customCountText = (selected: number, total: number) =>
|
|
1077
|
-
`Selected: ${selected} of ${total}`;
|
|
1078
|
-
|
|
1079
|
-
render(
|
|
1080
|
-
<CheckboxGroup
|
|
1081
|
-
options={mockOptions}
|
|
1082
|
-
value={['1', '2']}
|
|
1083
|
-
showCount={true}
|
|
1084
|
-
countText={customCountText}
|
|
1085
|
-
/>
|
|
1086
|
-
);
|
|
1087
|
-
|
|
1088
|
-
expect(screen.getByText('Selected: 2 of 3')).toBeInTheDocument();
|
|
1089
|
-
});
|
|
1090
|
-
|
|
1091
|
-
it('handles custom select all text correctly', () => {
|
|
1092
|
-
render(
|
|
1093
|
-
<CheckboxGroup
|
|
1094
|
-
options={mockOptions}
|
|
1095
|
-
showSelectAll={true}
|
|
1096
|
-
selectAllText="Select All Options"
|
|
1097
|
-
/>
|
|
1098
|
-
);
|
|
1099
|
-
|
|
1100
|
-
expect(screen.getByText('Select All Options')).toBeInTheDocument();
|
|
1101
|
-
});
|
|
1102
|
-
|
|
1103
|
-
it('handles allowDeselectAll functionality correctly', () => {
|
|
1104
|
-
const handleChange = vi.fn();
|
|
1105
|
-
const { rerender } = render(
|
|
1106
|
-
<CheckboxGroup
|
|
1107
|
-
options={mockOptions}
|
|
1108
|
-
value={['1', '2', '3']}
|
|
1109
|
-
showSelectAll={true}
|
|
1110
|
-
allowDeselectAll={true}
|
|
1111
|
-
onChange={handleChange}
|
|
1112
|
-
/>
|
|
1113
|
-
);
|
|
1114
|
-
|
|
1115
|
-
const selectAllButton = screen.getByText('全选');
|
|
1116
|
-
fireEvent.click(selectAllButton);
|
|
1117
|
-
|
|
1118
|
-
expect(handleChange).toHaveBeenCalledWith([]);
|
|
1119
|
-
});
|
|
1120
|
-
|
|
1121
|
-
it('prevents deselection when allowDeselectAll is false', () => {
|
|
1122
|
-
const handleChange = vi.fn();
|
|
1123
|
-
render(
|
|
1124
|
-
<CheckboxGroup
|
|
1125
|
-
options={mockOptions}
|
|
1126
|
-
value={['1', '2', '3']}
|
|
1127
|
-
showSelectAll={true}
|
|
1128
|
-
allowDeselectAll={false}
|
|
1129
|
-
onChange={handleChange}
|
|
1130
|
-
/>
|
|
1131
|
-
);
|
|
1132
|
-
|
|
1133
|
-
const selectAllButton = screen.getByText('全选');
|
|
1134
|
-
fireEvent.click(selectAllButton);
|
|
1135
|
-
|
|
1136
|
-
// Should not deselect when allowDeselectAll is false
|
|
1137
|
-
expect(handleChange).not.toHaveBeenCalled();
|
|
1138
|
-
});
|
|
1139
|
-
});
|
|
1140
|
-
});
|