@idea-fragments/react-components-zendesk 0.1.1 → 0.1.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/dist/alert.js +2701 -3288
- package/dist/alert.js.map +1 -1
- package/dist/index.js +1002 -0
- package/dist/index.js.map +1 -0
- package/dist/types/components/forms/selectors/Dropdown/Item.d.ts +1 -1
- package/dist/types/components/tags/Chip.d.ts +1 -1
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/package.json +14 -3
- package/.node-version +0 -1
- package/.storybook/ThemeProvider.tsx +0 -15
- package/.storybook/main.js +0 -13
- package/.storybook/preview.js +0 -20
- package/dist/forms.js +0 -101816
- package/dist/forms.js.map +0 -1
- package/entries/alert.ts +0 -1
- package/entries/forms.ts +0 -46
- package/entries/hooks.ts +0 -3
- package/entries/icon.ts +0 -1
- package/entries/layouts.ts +0 -15
- package/entries/loaders.ts +0 -3
- package/entries/mobx.ts +0 -6
- package/entries/modal.ts +0 -1
- package/entries/navigation.ts +0 -3
- package/entries/notifications.ts +0 -2
- package/entries/styles.ts +0 -16
- package/entries/tables.ts +0 -4
- package/entries/tags.ts +0 -2
- package/entries/text.ts +0 -7
- package/entries/tooltips.ts +0 -2
- package/entries/types.ts +0 -3
- package/entries/utils.ts +0 -4
- package/react_components_zendesk.iml +0 -9
- package/rollup.config.js +0 -40
- package/src/GlobalStyle.js +0 -43
- package/src/calendarCss.js +0 -2
- package/src/components/Alert.tsx +0 -175
- package/src/components/Drawer.tsx +0 -244
- package/src/components/Icon.tsx +0 -43
- package/src/components/Modal.tsx +0 -206
- package/src/components/StyledComponentProps.type.ts +0 -3
- package/src/components/StyledProps.type.ts +0 -4
- package/src/components/calendars/Legendable.type.tsx +0 -4
- package/src/components/calendars/TinyCalendar.tsx +0 -185
- package/src/components/calendars/TinyMonthYearCalendar.tsx +0 -57
- package/src/components/calendars/blocks/Legend.tsx +0 -44
- package/src/components/calendars/blocks/MonthPicker.tsx +0 -54
- package/src/components/calendars/blocks/MonthYearPicker.tsx +0 -101
- package/src/components/calendars/blocks/YearPicker.tsx +0 -44
- package/src/components/forms/Button.tsx +0 -214
- package/src/components/forms/Checkbox.tsx +0 -99
- package/src/components/forms/CycleButton.stories.tsx +0 -23
- package/src/components/forms/CycleButton.tsx +0 -52
- package/src/components/forms/Form.tsx +0 -43
- package/src/components/forms/Hint.tsx +0 -12
- package/src/components/forms/IconButton.tsx +0 -29
- package/src/components/forms/Label.tsx +0 -9
- package/src/components/forms/TaggedToggle.stories.tsx +0 -18
- package/src/components/forms/TaggedToggle.tsx +0 -19
- package/src/components/forms/Toggle.stories.tsx +0 -30
- package/src/components/forms/Toggle.tsx +0 -62
- package/src/components/forms/ValidatedFormProps.type.ts +0 -3
- package/src/components/forms/Validation.type.ts +0 -10
- package/src/components/forms/buttonMixins.ts +0 -74
- package/src/components/forms/formField.types.ts +0 -26
- package/src/components/forms/selectors/BooleanSelector.tsx +0 -71
- package/src/components/forms/selectors/DatePickerSelector.tsx +0 -88
- package/src/components/forms/selectors/Dropdown/Item.tsx +0 -34
- package/src/components/forms/selectors/Dropdown.tsx +0 -410
- package/src/components/forms/selectors/MonthYearSelector.tsx +0 -54
- package/src/components/forms/selectors/MultiSelector.tsx +0 -58
- package/src/components/forms/selectors/SearchableSelector.tsx +0 -120
- package/src/components/forms/selectors/Selector.tsx +0 -55
- package/src/components/forms/selectors/SelectorEmptyState.tsx +0 -5
- package/src/components/forms/selectors/types.ts +0 -43
- package/src/components/forms/textfields/EmailTextField.tsx +0 -7
- package/src/components/forms/textfields/NumberTextField.tsx +0 -17
- package/src/components/forms/textfields/PasswordTextField.tsx +0 -12
- package/src/components/forms/textfields/TextArea.tsx +0 -25
- package/src/components/forms/textfields/TextField.tsx +0 -45
- package/src/components/forms/textfields/TextFieldWrapper.tsx +0 -120
- package/src/components/forms/validationStates.ts +0 -6
- package/src/components/layout/AppBar.tsx +0 -137
- package/src/components/layout/AppBarLayout.tsx +0 -55
- package/src/components/layout/Carousel.tsx +0 -44
- package/src/components/layout/Container.tsx +0 -43
- package/src/components/layout/FlexBlock.tsx +0 -122
- package/src/components/layout/FlexBox.tsx +0 -69
- package/src/components/layout/Grid.tsx +0 -23
- package/src/components/layout/Line.tsx +0 -13
- package/src/components/layout/OpacityTransition.tsx +0 -6
- package/src/components/layout/OverflowMenu.tsx +0 -45
- package/src/components/layout/Section.tsx +0 -41
- package/src/components/layout/Sidebar.tsx +0 -107
- package/src/components/layout/SidebarLayout.tsx +0 -32
- package/src/components/layout/Tabs.tsx +0 -39
- package/src/components/loaders/AsyncLoadable.tsx +0 -57
- package/src/components/loaders/Dots.tsx +0 -16
- package/src/components/loaders/Loadable.tsx +0 -99
- package/src/components/loaders/Loader.tsx +0 -52
- package/src/components/loaders/TranslucentLoader.tsx +0 -49
- package/src/components/mobx/Alert.tsx +0 -33
- package/src/components/mobx/Drawer.tsx +0 -13
- package/src/components/mobx/ErrorBoundary.tsx +0 -56
- package/src/components/mobx/Modal.tsx +0 -44
- package/src/components/navigation/Breadcrumbs.tsx +0 -49
- package/src/components/navigation/ButtonLink.tsx +0 -55
- package/src/components/navigation/InlineButtonLink.tsx +0 -9
- package/src/components/notification/InfoPanel.tsx +0 -70
- package/src/components/notification/Notification.tsx +0 -51
- package/src/components/tables/MobileTable/Row.tsx +0 -147
- package/src/components/tables/MobileTable.tsx +0 -67
- package/src/components/tables/NiceTable.tsx +0 -81
- package/src/components/tables/Row.tsx +0 -84
- package/src/components/tables/SimpleTable.tsx +0 -99
- package/src/components/tables/Table.tsx +0 -153
- package/src/components/tables/blocks/Header.tsx +0 -119
- package/src/components/tables/blocks/HelpText.tsx +0 -9
- package/src/components/tables/blocks/Pagination.tsx +0 -85
- package/src/components/tables/blocks/TableFilter.tsx +0 -56
- package/src/components/tables/blocks/Title.tsx +0 -6
- package/src/components/tables/index.tsx +0 -106
- package/src/components/tables/utils.ts +0 -1
- package/src/components/tags/Chip.tsx +0 -44
- package/src/components/tags/Tag.tsx +0 -23
- package/src/components/text/Header.js +0 -55
- package/src/components/text/Hint.js +0 -25
- package/src/components/text/Label.js +0 -18
- package/src/components/text/Paragraph.js +0 -35
- package/src/components/text/Text.tsx +0 -33
- package/src/components/tooltips/IconTooltip.stories.tsx +0 -20
- package/src/components/tooltips/IconTooltip.tsx +0 -25
- package/src/components/tooltips/Tooltip.tsx +0 -30
- package/src/global.d.ts +0 -29
- package/src/hooks/useIsMounted.ts +0 -11
- package/src/hooks/useLoader.tsx +0 -73
- package/src/hooks/useLoaderV2.tsx +0 -51
- package/src/index.css +0 -34
- package/src/index.js +0 -4
- package/src/stores/useStores.tsx +0 -11
- package/src/stories/Introduction.stories.mdx +0 -211
- 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/DeviceSizeWatcher.ts +0 -113
- package/src/styles/alignments.ts +0 -9
- package/src/styles/colors.ts +0 -51
- package/src/styles/deviceSizes.ts +0 -28
- package/src/styles/mediaQueries.ts +0 -83
- package/src/styles/mixins.ts +0 -23
- package/src/styles/spacings.ts +0 -16
- package/src/styles/theme/Theme.type.ts +0 -76
- package/src/styles/theme/base.ts +0 -47
- package/src/styles/theme/dark.ts +0 -36
- package/src/styles/theme/light.ts +0 -44
- package/src/styles/theme/light2.ts +0 -22
- package/src/styles/theme/useTheme.ts +0 -5
- package/src/styles/types.ts +0 -18
- package/src/styles/typography.ts +0 -67
- package/src/utils/NavBarScrollWatcher.ts +0 -59
- package/src/utils/arrayHelpers.ts +0 -56
- package/src/utils/dateTime/DateRange.type.ts +0 -6
- package/src/utils/dateTime/calendar.ts +0 -23
- package/src/utils/dateTimeHelpers.ts +0 -105
- package/src/utils/function.types.ts +0 -1
- package/src/utils/functionHelpers.ts +0 -23
- package/src/utils/idGenerator.ts +0 -8
- package/src/utils/logging/Logger.ts +0 -34
- package/src/utils/logging/Logger.type.ts +0 -7
- package/src/utils/logging/loggable.tsx +0 -17
- package/src/utils/logging/with_module_logging.ts +0 -8
- package/src/utils/numberHelpers.ts +0 -4
- package/src/utils/typeCheckers.ts +0 -6
- package/src/utils/types.d.ts +0 -1
- package/src/utils/validateFields.ts +0 -14
- package/src/zendeskGardenCss.js +0 -15
- package/tsconfig.json +0 -30
- package/type_defs/GlobalStyle.d.ts +0 -2
- package/type_defs/GlobalStyle.d.ts.map +0 -1
- package/type_defs/calendarCss.d.ts +0 -2
- package/type_defs/calendarCss.d.ts.map +0 -1
- package/type_defs/components/Alert.d.ts +0 -24
- package/type_defs/components/Alert.d.ts.map +0 -1
- package/type_defs/components/Drawer.d.ts +0 -18
- package/type_defs/components/Drawer.d.ts.map +0 -1
- package/type_defs/components/Icon.d.ts +0 -15
- package/type_defs/components/Icon.d.ts.map +0 -1
- package/type_defs/components/Modal.d.ts +0 -31
- package/type_defs/components/Modal.d.ts.map +0 -1
- package/type_defs/components/StyledComponentProps.type.d.ts +0 -4
- package/type_defs/components/StyledComponentProps.type.d.ts.map +0 -1
- package/type_defs/components/StyledProps.type.d.ts +0 -4
- package/type_defs/components/StyledProps.type.d.ts.map +0 -1
- package/type_defs/components/calendars/Legendable.type.d.ts +0 -5
- package/type_defs/components/calendars/Legendable.type.d.ts.map +0 -1
- package/type_defs/components/calendars/TinyCalendar.d.ts +0 -25
- package/type_defs/components/calendars/TinyCalendar.d.ts.map +0 -1
- package/type_defs/components/calendars/TinyMonthYearCalendar.d.ts +0 -11
- package/type_defs/components/calendars/TinyMonthYearCalendar.d.ts.map +0 -1
- package/type_defs/components/calendars/blocks/Legend.d.ts +0 -12
- package/type_defs/components/calendars/blocks/Legend.d.ts.map +0 -1
- package/type_defs/components/calendars/blocks/MonthPicker.d.ts +0 -8
- package/type_defs/components/calendars/blocks/MonthPicker.d.ts.map +0 -1
- package/type_defs/components/calendars/blocks/MonthYearPicker.d.ts +0 -16
- package/type_defs/components/calendars/blocks/MonthYearPicker.d.ts.map +0 -1
- package/type_defs/components/calendars/blocks/YearPicker.d.ts +0 -10
- package/type_defs/components/calendars/blocks/YearPicker.d.ts.map +0 -1
- package/type_defs/components/forms/Button.d.ts +0 -41
- package/type_defs/components/forms/Button.d.ts.map +0 -1
- package/type_defs/components/forms/Checkbox.d.ts +0 -10
- package/type_defs/components/forms/Checkbox.d.ts.map +0 -1
- package/type_defs/components/forms/CycleButton.d.ts +0 -14
- package/type_defs/components/forms/CycleButton.d.ts.map +0 -1
- package/type_defs/components/forms/CycleButton.stories.d.ts +0 -16
- package/type_defs/components/forms/CycleButton.stories.d.ts.map +0 -1
- package/type_defs/components/forms/Form.d.ts +0 -9
- package/type_defs/components/forms/Form.d.ts.map +0 -1
- package/type_defs/components/forms/Hint.d.ts +0 -2
- package/type_defs/components/forms/Hint.d.ts.map +0 -1
- package/type_defs/components/forms/IconButton.d.ts +0 -6
- package/type_defs/components/forms/IconButton.d.ts.map +0 -1
- package/type_defs/components/forms/Label.d.ts +0 -2
- package/type_defs/components/forms/Label.d.ts.map +0 -1
- package/type_defs/components/forms/TaggedToggle.d.ts +0 -8
- package/type_defs/components/forms/TaggedToggle.d.ts.map +0 -1
- package/type_defs/components/forms/TaggedToggle.stories.d.ts +0 -12
- package/type_defs/components/forms/TaggedToggle.stories.d.ts.map +0 -1
- package/type_defs/components/forms/Toggle.d.ts +0 -12
- package/type_defs/components/forms/Toggle.d.ts.map +0 -1
- package/type_defs/components/forms/Toggle.stories.d.ts +0 -18
- package/type_defs/components/forms/Toggle.stories.d.ts.map +0 -1
- package/type_defs/components/forms/ValidatedFormProps.type.d.ts +0 -6
- package/type_defs/components/forms/ValidatedFormProps.type.d.ts.map +0 -1
- package/type_defs/components/forms/Validation.type.d.ts +0 -9
- package/type_defs/components/forms/Validation.type.d.ts.map +0 -1
- package/type_defs/components/forms/buttonMixins.d.ts +0 -23
- package/type_defs/components/forms/buttonMixins.d.ts.map +0 -1
- package/type_defs/components/forms/formField.types.d.ts +0 -23
- package/type_defs/components/forms/formField.types.d.ts.map +0 -1
- package/type_defs/components/forms/selectors/BooleanSelector.d.ts +0 -11
- package/type_defs/components/forms/selectors/BooleanSelector.d.ts.map +0 -1
- package/type_defs/components/forms/selectors/DatePickerSelector.d.ts +0 -19
- package/type_defs/components/forms/selectors/DatePickerSelector.d.ts.map +0 -1
- package/type_defs/components/forms/selectors/Dropdown/Item.d.ts +0 -19
- package/type_defs/components/forms/selectors/Dropdown/Item.d.ts.map +0 -1
- package/type_defs/components/forms/selectors/Dropdown.d.ts +0 -28
- package/type_defs/components/forms/selectors/Dropdown.d.ts.map +0 -1
- package/type_defs/components/forms/selectors/MonthYearSelector.d.ts +0 -9
- package/type_defs/components/forms/selectors/MonthYearSelector.d.ts.map +0 -1
- package/type_defs/components/forms/selectors/MultiSelector.d.ts +0 -9
- package/type_defs/components/forms/selectors/MultiSelector.d.ts.map +0 -1
- package/type_defs/components/forms/selectors/SearchableSelector.d.ts +0 -8
- package/type_defs/components/forms/selectors/SearchableSelector.d.ts.map +0 -1
- package/type_defs/components/forms/selectors/Selector.d.ts +0 -4
- package/type_defs/components/forms/selectors/Selector.d.ts.map +0 -1
- package/type_defs/components/forms/selectors/SelectorEmptyState.d.ts +0 -2
- package/type_defs/components/forms/selectors/SelectorEmptyState.d.ts.map +0 -1
- package/type_defs/components/forms/selectors/types.d.ts +0 -41
- package/type_defs/components/forms/selectors/types.d.ts.map +0 -1
- package/type_defs/components/forms/textfields/EmailTextField.d.ts +0 -4
- package/type_defs/components/forms/textfields/EmailTextField.d.ts.map +0 -1
- package/type_defs/components/forms/textfields/NumberTextField.d.ts +0 -4
- package/type_defs/components/forms/textfields/NumberTextField.d.ts.map +0 -1
- package/type_defs/components/forms/textfields/PasswordTextField.d.ts +0 -8
- package/type_defs/components/forms/textfields/PasswordTextField.d.ts.map +0 -1
- package/type_defs/components/forms/textfields/TextArea.d.ts +0 -9
- package/type_defs/components/forms/textfields/TextArea.d.ts.map +0 -1
- package/type_defs/components/forms/textfields/TextField.d.ts +0 -14
- package/type_defs/components/forms/textfields/TextField.d.ts.map +0 -1
- package/type_defs/components/forms/textfields/TextFieldWrapper.d.ts +0 -13
- package/type_defs/components/forms/textfields/TextFieldWrapper.d.ts.map +0 -1
- package/type_defs/components/forms/validationStates.d.ts +0 -7
- package/type_defs/components/forms/validationStates.d.ts.map +0 -1
- package/type_defs/components/layout/AppBar.d.ts +0 -14
- package/type_defs/components/layout/AppBar.d.ts.map +0 -1
- package/type_defs/components/layout/AppBarLayout.d.ts +0 -15
- package/type_defs/components/layout/AppBarLayout.d.ts.map +0 -1
- package/type_defs/components/layout/Carousel.d.ts +0 -13
- package/type_defs/components/layout/Carousel.d.ts.map +0 -1
- package/type_defs/components/layout/Container.d.ts +0 -4
- package/type_defs/components/layout/Container.d.ts.map +0 -1
- package/type_defs/components/layout/FlexBlock.d.ts +0 -19
- package/type_defs/components/layout/FlexBlock.d.ts.map +0 -1
- package/type_defs/components/layout/FlexBox.d.ts +0 -18
- package/type_defs/components/layout/FlexBox.d.ts.map +0 -1
- package/type_defs/components/layout/Grid.d.ts +0 -4
- package/type_defs/components/layout/Grid.d.ts.map +0 -1
- package/type_defs/components/layout/Line.d.ts +0 -6
- package/type_defs/components/layout/Line.d.ts.map +0 -1
- package/type_defs/components/layout/OpacityTransition.d.ts +0 -4
- package/type_defs/components/layout/OpacityTransition.d.ts.map +0 -1
- package/type_defs/components/layout/OverflowMenu.d.ts +0 -13
- package/type_defs/components/layout/OverflowMenu.d.ts.map +0 -1
- package/type_defs/components/layout/Section.d.ts +0 -6
- package/type_defs/components/layout/Section.d.ts.map +0 -1
- package/type_defs/components/layout/Sidebar.d.ts +0 -12
- package/type_defs/components/layout/Sidebar.d.ts.map +0 -1
- package/type_defs/components/layout/SidebarLayout.d.ts +0 -5
- package/type_defs/components/layout/SidebarLayout.d.ts.map +0 -1
- package/type_defs/components/layout/Tabs.d.ts +0 -3
- package/type_defs/components/layout/Tabs.d.ts.map +0 -1
- package/type_defs/components/loaders/AsyncLoadable.d.ts +0 -13
- package/type_defs/components/loaders/AsyncLoadable.d.ts.map +0 -1
- package/type_defs/components/loaders/Dots.d.ts +0 -9
- package/type_defs/components/loaders/Dots.d.ts.map +0 -1
- package/type_defs/components/loaders/Loadable.d.ts +0 -10
- package/type_defs/components/loaders/Loadable.d.ts.map +0 -1
- package/type_defs/components/loaders/Loader.d.ts +0 -15
- package/type_defs/components/loaders/Loader.d.ts.map +0 -1
- package/type_defs/components/loaders/TranslucentLoader.d.ts +0 -9
- package/type_defs/components/loaders/TranslucentLoader.d.ts.map +0 -1
- package/type_defs/components/mobx/Alert.d.ts +0 -4
- package/type_defs/components/mobx/Alert.d.ts.map +0 -1
- package/type_defs/components/mobx/Drawer.d.ts +0 -5
- package/type_defs/components/mobx/Drawer.d.ts.map +0 -1
- package/type_defs/components/mobx/ErrorBoundary.d.ts +0 -24
- package/type_defs/components/mobx/ErrorBoundary.d.ts.map +0 -1
- package/type_defs/components/mobx/Modal.d.ts +0 -4
- package/type_defs/components/mobx/Modal.d.ts.map +0 -1
- package/type_defs/components/navigation/Breadcrumbs.d.ts +0 -3
- package/type_defs/components/navigation/Breadcrumbs.d.ts.map +0 -1
- package/type_defs/components/navigation/ButtonLink.d.ts +0 -25
- package/type_defs/components/navigation/ButtonLink.d.ts.map +0 -1
- package/type_defs/components/navigation/InlineButtonLink.d.ts +0 -3
- package/type_defs/components/navigation/InlineButtonLink.d.ts.map +0 -1
- package/type_defs/components/notification/InfoPanel.d.ts +0 -18
- package/type_defs/components/notification/InfoPanel.d.ts.map +0 -1
- package/type_defs/components/notification/Notification.d.ts +0 -14
- package/type_defs/components/notification/Notification.d.ts.map +0 -1
- package/type_defs/components/tables/MobileTable/Row.d.ts +0 -14
- package/type_defs/components/tables/MobileTable/Row.d.ts.map +0 -1
- package/type_defs/components/tables/MobileTable.d.ts +0 -9
- package/type_defs/components/tables/MobileTable.d.ts.map +0 -1
- package/type_defs/components/tables/NiceTable.d.ts +0 -12
- package/type_defs/components/tables/NiceTable.d.ts.map +0 -1
- package/type_defs/components/tables/Row.d.ts +0 -19
- package/type_defs/components/tables/Row.d.ts.map +0 -1
- package/type_defs/components/tables/SimpleTable.d.ts +0 -9
- package/type_defs/components/tables/SimpleTable.d.ts.map +0 -1
- package/type_defs/components/tables/Table.d.ts +0 -73
- package/type_defs/components/tables/Table.d.ts.map +0 -1
- package/type_defs/components/tables/blocks/Header.d.ts +0 -17
- package/type_defs/components/tables/blocks/Header.d.ts.map +0 -1
- package/type_defs/components/tables/blocks/HelpText.d.ts +0 -5
- package/type_defs/components/tables/blocks/HelpText.d.ts.map +0 -1
- package/type_defs/components/tables/blocks/Pagination.d.ts +0 -8
- package/type_defs/components/tables/blocks/Pagination.d.ts.map +0 -1
- package/type_defs/components/tables/blocks/TableFilter.d.ts +0 -9
- package/type_defs/components/tables/blocks/TableFilter.d.ts.map +0 -1
- package/type_defs/components/tables/blocks/Title.d.ts +0 -7
- package/type_defs/components/tables/blocks/Title.d.ts.map +0 -1
- package/type_defs/components/tables/index.d.ts +0 -9
- package/type_defs/components/tables/index.d.ts.map +0 -1
- package/type_defs/components/tables/utils.d.ts +0 -2
- package/type_defs/components/tables/utils.d.ts.map +0 -1
- package/type_defs/components/tags/Chip.d.ts +0 -18
- package/type_defs/components/tags/Chip.d.ts.map +0 -1
- package/type_defs/components/tags/Tag.d.ts +0 -8
- package/type_defs/components/tags/Tag.d.ts.map +0 -1
- package/type_defs/components/text/Header.d.ts +0 -31
- package/type_defs/components/text/Header.d.ts.map +0 -1
- package/type_defs/components/text/Hint.d.ts +0 -10
- package/type_defs/components/text/Hint.d.ts.map +0 -1
- package/type_defs/components/text/Label.d.ts +0 -7
- package/type_defs/components/text/Label.d.ts.map +0 -1
- package/type_defs/components/text/Paragraph.d.ts +0 -37
- package/type_defs/components/text/Paragraph.d.ts.map +0 -1
- package/type_defs/components/text/Text.d.ts +0 -7
- package/type_defs/components/text/Text.d.ts.map +0 -1
- package/type_defs/components/tooltips/IconTooltip.d.ts +0 -10
- package/type_defs/components/tooltips/IconTooltip.d.ts.map +0 -1
- package/type_defs/components/tooltips/IconTooltip.stories.d.ts +0 -18
- package/type_defs/components/tooltips/IconTooltip.stories.d.ts.map +0 -1
- package/type_defs/components/tooltips/Tooltip.d.ts +0 -14
- package/type_defs/components/tooltips/Tooltip.d.ts.map +0 -1
- package/type_defs/hooks/useIsMounted.d.ts +0 -2
- package/type_defs/hooks/useIsMounted.d.ts.map +0 -1
- package/type_defs/hooks/useLoader.d.ts +0 -10
- package/type_defs/hooks/useLoader.d.ts.map +0 -1
- package/type_defs/hooks/useLoaderV2.d.ts +0 -15
- package/type_defs/hooks/useLoaderV2.d.ts.map +0 -1
- package/type_defs/index.d.ts +0 -2
- package/type_defs/index.d.ts.map +0 -1
- package/type_defs/stores/useStores.d.ts +0 -5
- package/type_defs/stores/useStores.d.ts.map +0 -1
- package/type_defs/styles/DeviceSizeWatcher.d.ts +0 -21
- package/type_defs/styles/DeviceSizeWatcher.d.ts.map +0 -1
- package/type_defs/styles/alignments.d.ts +0 -8
- package/type_defs/styles/alignments.d.ts.map +0 -1
- package/type_defs/styles/colors.d.ts +0 -35
- package/type_defs/styles/colors.d.ts.map +0 -1
- package/type_defs/styles/deviceSizes.d.ts +0 -9
- package/type_defs/styles/deviceSizes.d.ts.map +0 -1
- package/type_defs/styles/mediaQueries.d.ts +0 -21
- package/type_defs/styles/mediaQueries.d.ts.map +0 -1
- package/type_defs/styles/mixins.d.ts +0 -8
- package/type_defs/styles/mixins.d.ts.map +0 -1
- package/type_defs/styles/spacings.d.ts +0 -15
- package/type_defs/styles/spacings.d.ts.map +0 -1
- package/type_defs/styles/theme/Theme.type.d.ts +0 -79
- package/type_defs/styles/theme/Theme.type.d.ts.map +0 -1
- package/type_defs/styles/theme/base.d.ts +0 -3
- package/type_defs/styles/theme/base.d.ts.map +0 -1
- package/type_defs/styles/theme/dark.d.ts +0 -3
- package/type_defs/styles/theme/dark.d.ts.map +0 -1
- package/type_defs/styles/theme/light.d.ts +0 -3
- package/type_defs/styles/theme/light.d.ts.map +0 -1
- package/type_defs/styles/theme/light2.d.ts +0 -3
- package/type_defs/styles/theme/light2.d.ts.map +0 -1
- package/type_defs/styles/theme/useTheme.d.ts +0 -3
- package/type_defs/styles/theme/useTheme.d.ts.map +0 -1
- package/type_defs/styles/types.d.ts +0 -17
- package/type_defs/styles/types.d.ts.map +0 -1
- package/type_defs/styles/typography.d.ts +0 -56
- package/type_defs/styles/typography.d.ts.map +0 -1
- package/type_defs/utils/NavBarScrollWatcher.d.ts +0 -7
- package/type_defs/utils/NavBarScrollWatcher.d.ts.map +0 -1
- package/type_defs/utils/arrayHelpers.d.ts +0 -23
- package/type_defs/utils/arrayHelpers.d.ts.map +0 -1
- package/type_defs/utils/dateTime/DateRange.type.d.ts +0 -6
- package/type_defs/utils/dateTime/DateRange.type.d.ts.map +0 -1
- package/type_defs/utils/dateTime/calendar.d.ts +0 -18
- package/type_defs/utils/dateTime/calendar.d.ts.map +0 -1
- package/type_defs/utils/dateTimeHelpers.d.ts +0 -23
- package/type_defs/utils/dateTimeHelpers.d.ts.map +0 -1
- package/type_defs/utils/function.types.d.ts +0 -2
- package/type_defs/utils/function.types.d.ts.map +0 -1
- package/type_defs/utils/functionHelpers.d.ts +0 -7
- package/type_defs/utils/functionHelpers.d.ts.map +0 -1
- package/type_defs/utils/idGenerator.d.ts +0 -3
- package/type_defs/utils/idGenerator.d.ts.map +0 -1
- package/type_defs/utils/logging/Logger.d.ts +0 -10
- package/type_defs/utils/logging/Logger.d.ts.map +0 -1
- package/type_defs/utils/logging/Logger.type.d.ts +0 -7
- package/type_defs/utils/logging/Logger.type.d.ts.map +0 -1
- package/type_defs/utils/logging/loggable.d.ts +0 -7
- package/type_defs/utils/logging/loggable.d.ts.map +0 -1
- package/type_defs/utils/logging/with_module_logging.d.ts +0 -3
- package/type_defs/utils/logging/with_module_logging.d.ts.map +0 -1
- package/type_defs/utils/numberHelpers.d.ts +0 -3
- package/type_defs/utils/numberHelpers.d.ts.map +0 -1
- package/type_defs/utils/typeCheckers.d.ts +0 -5
- package/type_defs/utils/typeCheckers.d.ts.map +0 -1
- package/type_defs/utils/validateFields.d.ts +0 -13
- package/type_defs/utils/validateFields.d.ts.map +0 -1
- package/type_defs/zendeskGardenCss.d.ts +0 -2
- package/type_defs/zendeskGardenCss.d.ts.map +0 -1
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { mdiArrowLeft, mdiArrowRight } from "@mdi/js"
|
|
2
|
-
import { MonthPicker } from "components/calendars/blocks/MonthPicker"
|
|
3
|
-
import { YearPicker } from "components/calendars/blocks/YearPicker"
|
|
4
|
-
import { IconButton } from "components/forms/IconButton"
|
|
5
|
-
import { FlexBlock } from "components/layout/FlexBlock"
|
|
6
|
-
import moment, { Moment } from "moment"
|
|
7
|
-
import React from "react"
|
|
8
|
-
import styled from "styled-components"
|
|
9
|
-
import { SPACINGS } from "styles/spacings"
|
|
10
|
-
import { getNextMonth, getPrevMonth, MONTH_MAP } from "utils/dateTime/calendar"
|
|
11
|
-
import { maxNumberBetween } from "utils/numberHelpers"
|
|
12
|
-
|
|
13
|
-
export type MonthYearPickerChange = { month: number, year: number }
|
|
14
|
-
|
|
15
|
-
type Props = {
|
|
16
|
-
month: number,
|
|
17
|
-
year: number,
|
|
18
|
-
minDate?: Moment,
|
|
19
|
-
pastFutureYearRangeSize: number,
|
|
20
|
-
onChange: (c: MonthYearPickerChange) => void,
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export const MonthYearPicker = ({
|
|
24
|
-
month,
|
|
25
|
-
year,
|
|
26
|
-
minDate,
|
|
27
|
-
pastFutureYearRangeSize,
|
|
28
|
-
onChange,
|
|
29
|
-
}: Props) => {
|
|
30
|
-
|
|
31
|
-
const currentYear = moment().year()
|
|
32
|
-
const maxYear = currentYear + pastFutureYearRangeSize
|
|
33
|
-
const minYear = maxNumberBetween(
|
|
34
|
-
currentYear - pastFutureYearRangeSize,
|
|
35
|
-
minDate ? minDate.year() : Number.NEGATIVE_INFINITY,
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
const sendPreviousMonth = () => {
|
|
39
|
-
const changes = {
|
|
40
|
-
month: getPrevMonth(month),
|
|
41
|
-
year: month === MONTH_MAP.JANUARY ? year - 1 : year,
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (changes.year < minYear) return
|
|
45
|
-
|
|
46
|
-
// @ts-ignore
|
|
47
|
-
onChange(changes)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const sendNextMonth = () => {
|
|
51
|
-
const changes = {
|
|
52
|
-
month: getNextMonth(month),
|
|
53
|
-
year: month === MONTH_MAP.DECEMBER ? year + 1 : year,
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (changes.year > maxYear) return
|
|
57
|
-
|
|
58
|
-
// @ts-ignore
|
|
59
|
-
onChange(changes)
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const sendSelectedMonth = (m: string) => {
|
|
63
|
-
onChange({ month: Number(m), year })
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const sendSelectedYear = (y: string) => {
|
|
67
|
-
onChange({ month, year: Number(y) })
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return <Container alignItems={"center"}>
|
|
71
|
-
<NavButton icon={mdiArrowLeft}
|
|
72
|
-
onClick={sendPreviousMonth} />
|
|
73
|
-
<PickersContainer>
|
|
74
|
-
{/*@ts-ignore*/}
|
|
75
|
-
<MonthPicker month={month} onMonthSelected={sendSelectedMonth} />
|
|
76
|
-
<YearPicker year={year}
|
|
77
|
-
minYear={minYear}
|
|
78
|
-
maxYear={maxYear}
|
|
79
|
-
onYearSelected={sendSelectedYear} />
|
|
80
|
-
</PickersContainer>
|
|
81
|
-
<NavButton icon={mdiArrowRight}
|
|
82
|
-
onClick={sendNextMonth} />
|
|
83
|
-
</Container>
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const NavButton = styled(IconButton).attrs({
|
|
87
|
-
flat: true,
|
|
88
|
-
})``
|
|
89
|
-
|
|
90
|
-
const Container = styled(FlexBlock)`
|
|
91
|
-
margin-bottom: ${SPACINGS.XS};
|
|
92
|
-
align-items: center;
|
|
93
|
-
`
|
|
94
|
-
|
|
95
|
-
const PickersContainer = styled(FlexBlock).attrs({
|
|
96
|
-
spacing: SPACINGS.XS,
|
|
97
|
-
})`
|
|
98
|
-
margin-left: ${SPACINGS.XS};
|
|
99
|
-
flex: 1;
|
|
100
|
-
justify-content: center;
|
|
101
|
-
`
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { SearchableSelector } from "components/forms/selectors/SearchableSelector"
|
|
2
|
-
import { OnItemSelectedFunc } from "components/forms/selectors/types"
|
|
3
|
-
import React from "react"
|
|
4
|
-
import { arrayOfSizeN } from "utils/arrayHelpers"
|
|
5
|
-
|
|
6
|
-
type Props = {
|
|
7
|
-
year: number,
|
|
8
|
-
minYear: number,
|
|
9
|
-
maxYear: number,
|
|
10
|
-
onYearSelected: (year: string) => void
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const KEY_FIELD = "value"
|
|
14
|
-
|
|
15
|
-
const yearOptions = (minYear: number, maxYear: number) => (
|
|
16
|
-
arrayOfSizeN(maxYear - minYear + 1).reduce(
|
|
17
|
-
([options, optionsKeyMap], _, i: number) => {
|
|
18
|
-
const op = { [KEY_FIELD]: `${minYear + i}` }
|
|
19
|
-
options.push(op)
|
|
20
|
-
optionsKeyMap[minYear + i] = op
|
|
21
|
-
return [options, optionsKeyMap]
|
|
22
|
-
}
|
|
23
|
-
, [[], {}],
|
|
24
|
-
)
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
export const YearPicker = ({
|
|
28
|
-
year,
|
|
29
|
-
minYear,
|
|
30
|
-
maxYear,
|
|
31
|
-
onYearSelected,
|
|
32
|
-
}: Props) => {
|
|
33
|
-
const [options, optionsKeyMap] = yearOptions(minYear, maxYear)
|
|
34
|
-
return <SearchableSelector compact
|
|
35
|
-
flat
|
|
36
|
-
options={options}
|
|
37
|
-
optionsKeyMap={optionsKeyMap}
|
|
38
|
-
keyField={"value"}
|
|
39
|
-
valueField={"value"}
|
|
40
|
-
selectedKey={year}
|
|
41
|
-
emptyState={"Type or Select Year"}
|
|
42
|
-
onChange={onYearSelected as OnItemSelectedFunc}
|
|
43
|
-
/>
|
|
44
|
-
}
|
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
// @ts-ignore
|
|
2
|
-
import { Button as SButton } from "@zendeskgarden/react-buttons"
|
|
3
|
-
import {
|
|
4
|
-
buttonLikeHoverable,
|
|
5
|
-
getInlineStyling,
|
|
6
|
-
} from "components/forms/buttonMixins"
|
|
7
|
-
import { Icon } from "components/Icon"
|
|
8
|
-
import { FlexBox } from "components/layout/FlexBox"
|
|
9
|
-
import { Dots } from "components/loaders/Dots"
|
|
10
|
-
import { StyledProps } from "components/StyledProps.type"
|
|
11
|
-
import { useIsMounted } from "hooks/useIsMounted"
|
|
12
|
-
import React, {
|
|
13
|
-
ComponentType,
|
|
14
|
-
ForwardedRef,
|
|
15
|
-
forwardRef,
|
|
16
|
-
MouseEvent,
|
|
17
|
-
PropsWithChildren,
|
|
18
|
-
Ref,
|
|
19
|
-
useCallback,
|
|
20
|
-
useState
|
|
21
|
-
} from "react"
|
|
22
|
-
import styled, { css } from "styled-components"
|
|
23
|
-
import { Alignment } from "styles/alignments"
|
|
24
|
-
import { COLORS } from "styles/colors"
|
|
25
|
-
import { SPACINGS } from "styles/spacings"
|
|
26
|
-
import { Theme } from "styles/theme/Theme.type"
|
|
27
|
-
import { ColorProps, ContainerProps } from "styles/types"
|
|
28
|
-
import { FONT_SIZES } from "styles/typography"
|
|
29
|
-
import { PromiseFunc } from "utils/function.types"
|
|
30
|
-
|
|
31
|
-
const fitContent = css`
|
|
32
|
-
width: fit-content;
|
|
33
|
-
${({ compact }: Props) => compact
|
|
34
|
-
? "min-width: fit-content; padding: 0 1em;"
|
|
35
|
-
: ""}
|
|
36
|
-
`
|
|
37
|
-
const fitContainer = css`width: 100%;`
|
|
38
|
-
const colors = css<Props & { color: string }>`
|
|
39
|
-
${buttonLikeHoverable};
|
|
40
|
-
border-color: ${({ flat, primary, inline, color }: Props) =>
|
|
41
|
-
!flat && !primary && !inline
|
|
42
|
-
? color
|
|
43
|
-
: "transparent"};
|
|
44
|
-
|
|
45
|
-
${getInlineStyling}
|
|
46
|
-
:hover, :active {
|
|
47
|
-
border-color: transparent;
|
|
48
|
-
}
|
|
49
|
-
`
|
|
50
|
-
const alignment = ({ alignSelf }: Props) => (
|
|
51
|
-
alignSelf ? css`align-self: ${alignSelf};` : ""
|
|
52
|
-
)
|
|
53
|
-
|
|
54
|
-
const casing = ({ theme }: { theme: Theme }) => {
|
|
55
|
-
const casing = theme.styles.buttons.textTransform
|
|
56
|
-
return casing ? css`text-transform: ${casing};` : ""
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const baseColor = ({
|
|
60
|
-
color,
|
|
61
|
-
danger,
|
|
62
|
-
neutral,
|
|
63
|
-
success,
|
|
64
|
-
theme,
|
|
65
|
-
warning,
|
|
66
|
-
}: Props & StyledProps) => {
|
|
67
|
-
if (color) return color
|
|
68
|
-
if (danger) return theme.styles.colorDanger
|
|
69
|
-
if (neutral) return COLORS.LIGHT_GREY
|
|
70
|
-
if (success) return theme.styles.colorSuccess
|
|
71
|
-
if (warning) return theme.styles.colorWarning
|
|
72
|
-
|
|
73
|
-
return theme.styles.colorPrimary
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export const BUTTON_SIZES = { SMALL: "small", LARGE: "large" } as const
|
|
77
|
-
export type ButtonSize = typeof BUTTON_SIZES[keyof typeof BUTTON_SIZES]
|
|
78
|
-
|
|
79
|
-
type AutoLoadable = {
|
|
80
|
-
autoLoadable: true,
|
|
81
|
-
onClick: PromiseFunc,
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
type ButtonBaseProps = PropsWithChildren<{
|
|
85
|
-
alignSelf?: Alignment,
|
|
86
|
-
disabled?: boolean,
|
|
87
|
-
groupKey?: string,
|
|
88
|
-
icon?: string,
|
|
89
|
-
iconPosition?: "left" | "right",
|
|
90
|
-
iconSize?: string,
|
|
91
|
-
innerAs?: string,
|
|
92
|
-
innerRef?: Ref<HTMLButtonElement>,
|
|
93
|
-
loading?: boolean,
|
|
94
|
-
pill?: boolean,
|
|
95
|
-
primary?: boolean,
|
|
96
|
-
size?: ButtonSize,
|
|
97
|
-
onClick: Function,
|
|
98
|
-
}>
|
|
99
|
-
|
|
100
|
-
type CommonProps = ButtonBaseProps & {
|
|
101
|
-
autoLoadable?: boolean,
|
|
102
|
-
flat?: boolean,
|
|
103
|
-
inline?: boolean,
|
|
104
|
-
} & ColorProps & ContainerProps
|
|
105
|
-
|
|
106
|
-
type ControlledLoadable = {
|
|
107
|
-
loading?: boolean,
|
|
108
|
-
onClick: Function,
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export type Props = (CommonProps & ControlledLoadable)
|
|
112
|
-
| (CommonProps & AutoLoadable)
|
|
113
|
-
|
|
114
|
-
const ButtonBase = styled(({
|
|
115
|
-
children,
|
|
116
|
-
disabled,
|
|
117
|
-
groupKey,
|
|
118
|
-
icon,
|
|
119
|
-
iconSize,
|
|
120
|
-
innerAs,
|
|
121
|
-
innerRef,
|
|
122
|
-
iconPosition,
|
|
123
|
-
loading,
|
|
124
|
-
onClick,
|
|
125
|
-
...props
|
|
126
|
-
}: ButtonBaseProps) => {
|
|
127
|
-
return <SButton as={innerAs}
|
|
128
|
-
disabled={disabled}
|
|
129
|
-
ref={innerRef}
|
|
130
|
-
onClick={onClick}
|
|
131
|
-
{...props}>
|
|
132
|
-
{
|
|
133
|
-
loading
|
|
134
|
-
? <FlexBox alignItems={"center"}
|
|
135
|
-
css={`min-height: 30px`}
|
|
136
|
-
justifyContent={"center"}>
|
|
137
|
-
<Dots size={FONT_SIZES.MD} />
|
|
138
|
-
</FlexBox>
|
|
139
|
-
: (
|
|
140
|
-
icon
|
|
141
|
-
? <FlexBox alignItems={"center"}
|
|
142
|
-
gap={SPACINGS.XS}
|
|
143
|
-
justifyContent={"center"}>
|
|
144
|
-
{iconPosition === "left" &&
|
|
145
|
-
<Icon color={"currentColor"} svg={icon} size={iconSize} />}
|
|
146
|
-
{children ? <span>{children}</span> : undefined}
|
|
147
|
-
{iconPosition === "right" &&
|
|
148
|
-
<Icon color={"currentColor"} svg={icon} size={iconSize} />}
|
|
149
|
-
</FlexBox>
|
|
150
|
-
: <span>{children}</span>
|
|
151
|
-
)
|
|
152
|
-
}
|
|
153
|
-
</SButton>
|
|
154
|
-
}).attrs((props: Props & StyledProps) => ({
|
|
155
|
-
...props,
|
|
156
|
-
color: baseColor(props),
|
|
157
|
-
}))`
|
|
158
|
-
&&&& {
|
|
159
|
-
font-size: inherit;
|
|
160
|
-
font-weight: bold;
|
|
161
|
-
${({ fluid }) => !fluid ? fitContent : fitContainer}
|
|
162
|
-
${alignment}
|
|
163
|
-
${casing}
|
|
164
|
-
${({ disabled }) => !disabled ? colors : ""}
|
|
165
|
-
}
|
|
166
|
-
`
|
|
167
|
-
|
|
168
|
-
export const Button: ComponentType<Props> = styled(
|
|
169
|
-
forwardRef<HTMLButtonElement, Props>(
|
|
170
|
-
(
|
|
171
|
-
{
|
|
172
|
-
autoLoadable = false,
|
|
173
|
-
disabled,
|
|
174
|
-
loading: loadingProp = false,
|
|
175
|
-
onClick,
|
|
176
|
-
...props
|
|
177
|
-
}: Props,
|
|
178
|
-
ref: ForwardedRef<HTMLButtonElement>,
|
|
179
|
-
) => {
|
|
180
|
-
const [isLoading, setIsLoadingTo] = useState(false)
|
|
181
|
-
const isMounted = useIsMounted()
|
|
182
|
-
|
|
183
|
-
const computedIsLoading = useCallback(
|
|
184
|
-
() => {
|
|
185
|
-
return autoLoadable ? isLoading : loadingProp
|
|
186
|
-
}, [autoLoadable, isLoading, loadingProp]
|
|
187
|
-
)
|
|
188
|
-
|
|
189
|
-
const processClick = async (e: MouseEvent) => {
|
|
190
|
-
setIsLoadingTo(true)
|
|
191
|
-
try { await onClick(e) } catch {}
|
|
192
|
-
if (isMounted()) setIsLoadingTo(false)
|
|
193
|
-
}
|
|
194
|
-
return <ButtonBase {...props}
|
|
195
|
-
disabled={disabled || computedIsLoading()}
|
|
196
|
-
innerRef={ref}
|
|
197
|
-
loading={computedIsLoading()}
|
|
198
|
-
onClick={autoLoadable
|
|
199
|
-
? processClick
|
|
200
|
-
: onClick} />
|
|
201
|
-
}
|
|
202
|
-
)
|
|
203
|
-
)``
|
|
204
|
-
|
|
205
|
-
// @ts-ignore
|
|
206
|
-
Button.COMPONENT_NAME = "Button"
|
|
207
|
-
// @ts-ignore
|
|
208
|
-
Button.defaultProps = {
|
|
209
|
-
fluid: false,
|
|
210
|
-
flat: false,
|
|
211
|
-
iconPosition: "right",
|
|
212
|
-
primary: true,
|
|
213
|
-
disabled: false,
|
|
214
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Checkbox as ZCheckbox,
|
|
3
|
-
Field,
|
|
4
|
-
Hint,
|
|
5
|
-
Label,
|
|
6
|
-
Message,
|
|
7
|
-
/* @ts-ignore */
|
|
8
|
-
} from "@zendeskgarden/react-forms"
|
|
9
|
-
import { FormFieldProps } from "components/forms/formField.types"
|
|
10
|
-
import { VALIDATION_STATES } from "components/forms/validationStates"
|
|
11
|
-
import { FlexBox } from "components/layout/FlexBox"
|
|
12
|
-
import { StyledProps } from "components/StyledProps.type"
|
|
13
|
-
import React, { ChangeEvent, useEffect, useState } from "react"
|
|
14
|
-
import styled from "styled-components"
|
|
15
|
-
import { dark, fade } from "styles/colors"
|
|
16
|
-
import { ContainerProps } from "styles/types"
|
|
17
|
-
import { FONT_SIZES } from "styles/typography"
|
|
18
|
-
|
|
19
|
-
type Props = FormFieldProps & {
|
|
20
|
-
checked?: boolean,
|
|
21
|
-
indeterminate?: boolean,
|
|
22
|
-
onChange: (checked: boolean) => void
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export let Checkbox = ({
|
|
26
|
-
checked: checkedProp = false,
|
|
27
|
-
compact,
|
|
28
|
-
emptyState,
|
|
29
|
-
fluid,
|
|
30
|
-
hint,
|
|
31
|
-
indeterminate,
|
|
32
|
-
label,
|
|
33
|
-
message,
|
|
34
|
-
validation = { validation: VALIDATION_STATES.NONE },
|
|
35
|
-
onChange,
|
|
36
|
-
...props
|
|
37
|
-
}: Props) => {
|
|
38
|
-
const [checked, setCheckedTo] = useState(checkedProp)
|
|
39
|
-
|
|
40
|
-
const handleCheck = (e: ChangeEvent<HTMLInputElement>) => {
|
|
41
|
-
const checked = e.target.checked
|
|
42
|
-
setCheckedTo(checked)
|
|
43
|
-
onChange(checked)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
useEffect(() => { setCheckedTo(checkedProp) }, [checkedProp])
|
|
47
|
-
|
|
48
|
-
return <Container fluid={fluid} gap={null} withRows>
|
|
49
|
-
<Field>
|
|
50
|
-
<ZCheckbox
|
|
51
|
-
checked={checked}
|
|
52
|
-
validation={validation?.validation}
|
|
53
|
-
{...props}
|
|
54
|
-
onChange={handleCheck}
|
|
55
|
-
>
|
|
56
|
-
<Label hidden={!label}
|
|
57
|
-
indeterminate={indeterminate}>
|
|
58
|
-
{label ?? ""}
|
|
59
|
-
</Label>
|
|
60
|
-
{
|
|
61
|
-
hint
|
|
62
|
-
? <Hint css={`&&& { font-size: ${FONT_SIZES.XS}; }`}>{hint}</Hint>
|
|
63
|
-
: null
|
|
64
|
-
}
|
|
65
|
-
{
|
|
66
|
-
message
|
|
67
|
-
?
|
|
68
|
-
<Message css={`&&& { font-size: ${FONT_SIZES.XS};}`}
|
|
69
|
-
validation={validation?.validation}>
|
|
70
|
-
{message}
|
|
71
|
-
</Message>
|
|
72
|
-
: null
|
|
73
|
-
}
|
|
74
|
-
</ZCheckbox>
|
|
75
|
-
</Field>
|
|
76
|
-
</Container>
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
Checkbox = styled(Checkbox)`
|
|
80
|
-
&&&& {
|
|
81
|
-
font-size: inherit;
|
|
82
|
-
|
|
83
|
-
:hover {
|
|
84
|
-
border-color: ${({ theme }: StyledProps) => theme.styles.colorPrimary};
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
:focus {
|
|
88
|
-
border-color: ${({ theme }: StyledProps) => dark(theme.styles.colorPrimary)};
|
|
89
|
-
box-shadow: ${({ theme }: StyledProps) => `0 0 0 3px ${fade(theme.styles.colorPrimary)}`};
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
`
|
|
93
|
-
|
|
94
|
-
const Container = styled(FlexBox)`
|
|
95
|
-
${({ fluid }: ContainerProps) => fluid ? "width: 100%;" : ""}
|
|
96
|
-
&& * {
|
|
97
|
-
font-size: inherit;
|
|
98
|
-
}
|
|
99
|
-
`
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React, { useState } from "react"
|
|
2
|
-
import { CycleButton } from "components/forms/CycleButton"
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: "react_components_zendesk/forms/CycleButton",
|
|
6
|
-
component: CycleButton,
|
|
7
|
-
argTypes: {},
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const OPTIONS = ["AYE", "BE", "SEE"]
|
|
11
|
-
|
|
12
|
-
const Story = () => {
|
|
13
|
-
const [option, setOption] = useState(OPTIONS[0])
|
|
14
|
-
|
|
15
|
-
return <CycleButton options={OPTIONS.map((o) => ({ label: o, value: o }))}
|
|
16
|
-
selectedOption={option}
|
|
17
|
-
onCycleChanged={setOption}
|
|
18
|
-
/>
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const Default = Story.bind({})
|
|
22
|
-
// @ts-ignore
|
|
23
|
-
Default.args = {}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import React, { Fragment } from "react"
|
|
2
|
-
import { Button, Props as ButtonProps } from "components/forms/Button"
|
|
3
|
-
import styled from "styled-components"
|
|
4
|
-
import { isLastItem, isNotLastItem } from "utils/arrayHelpers"
|
|
5
|
-
import { FlexBox } from "components/layout/FlexBox"
|
|
6
|
-
import { COLORS } from "styles/colors"
|
|
7
|
-
import { FONT_SIZES } from "styles/typography"
|
|
8
|
-
|
|
9
|
-
type Option = { label: string, value: string }
|
|
10
|
-
|
|
11
|
-
type Props = Omit<ButtonProps, "onClick"> & {
|
|
12
|
-
options: Array<Option>,
|
|
13
|
-
selectedOption: string,
|
|
14
|
-
onCycleChanged: (value: string) => void,
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export const CycleButton = ({
|
|
18
|
-
options,
|
|
19
|
-
selectedOption,
|
|
20
|
-
onCycleChanged,
|
|
21
|
-
...buttonProps
|
|
22
|
-
}: Props) => (
|
|
23
|
-
<Button primary={false}
|
|
24
|
-
{...buttonProps}
|
|
25
|
-
onClick={() => {
|
|
26
|
-
const next = cycle<string>(
|
|
27
|
-
options.map((o: Option): string => o.value),
|
|
28
|
-
selectedOption,
|
|
29
|
-
)
|
|
30
|
-
onCycleChanged(next)
|
|
31
|
-
}}>
|
|
32
|
-
<FlexBox alignItems={"center"} gap={"5px"}>
|
|
33
|
-
{options.map((o: Option) => (
|
|
34
|
-
<Fragment key={o.label}>
|
|
35
|
-
<Label selected={selectedOption === o.value}>{o.label}</Label>
|
|
36
|
-
{isNotLastItem(options, o) ? <Label>/</Label> : null}
|
|
37
|
-
</Fragment>
|
|
38
|
-
))}
|
|
39
|
-
</FlexBox>
|
|
40
|
-
</Button>
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
const Label = styled.span<{ selected?: boolean }>`
|
|
44
|
-
color: ${p => p.selected ? "inherit" : COLORS.LIGHT_GREY};
|
|
45
|
-
font-size: ${p => p.selected ? "inherit" : FONT_SIZES.XS};;
|
|
46
|
-
`
|
|
47
|
-
|
|
48
|
-
const cycle = <T, >(cycleables: T[], current: T): T => (
|
|
49
|
-
isLastItem(cycleables, current)
|
|
50
|
-
? cycleables[0]
|
|
51
|
-
: cycleables[cycleables.indexOf(current) + 1]
|
|
52
|
-
)
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { FlexBox } from "components/layout/FlexBox"
|
|
2
|
-
import React, { FC, FormEvent, forwardRef, PropsWithChildren, Ref } from "react"
|
|
3
|
-
import styled from "styled-components"
|
|
4
|
-
import { SPACINGS } from "styles/spacings"
|
|
5
|
-
import { ContainerProps } from "styles/types"
|
|
6
|
-
import { PromiseFunc } from "utils/function.types"
|
|
7
|
-
|
|
8
|
-
type Props = PropsWithChildren<{
|
|
9
|
-
onSubmit: PromiseFunc,
|
|
10
|
-
}> & ContainerProps
|
|
11
|
-
|
|
12
|
-
export let Form: FC<Props> = forwardRef<HTMLFormElement, Props>((
|
|
13
|
-
{ onSubmit, className, children, ...props },
|
|
14
|
-
ref: Ref<HTMLFormElement>,
|
|
15
|
-
) => {
|
|
16
|
-
const handleSubmit = (e: FormEvent<HTMLFormElement>) => {
|
|
17
|
-
e.preventDefault()
|
|
18
|
-
onSubmit()
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return <FlexBox withRows
|
|
22
|
-
as={"form"}
|
|
23
|
-
onSubmit={handleSubmit}
|
|
24
|
-
gap={SPACINGS.SM}
|
|
25
|
-
className={className}
|
|
26
|
-
ref={ref}
|
|
27
|
-
{...props}>
|
|
28
|
-
<HiddenSubmit />
|
|
29
|
-
{children}
|
|
30
|
-
</FlexBox>
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
const HiddenSubmit = styled.input.attrs({
|
|
34
|
-
type: "submit",
|
|
35
|
-
tabIndex: -1,
|
|
36
|
-
})`
|
|
37
|
-
position: absolute;
|
|
38
|
-
left: -9999px;
|
|
39
|
-
width: 1px;
|
|
40
|
-
height: 1px;
|
|
41
|
-
`
|
|
42
|
-
|
|
43
|
-
Form = styled(Form)``
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// @ts-ignore
|
|
2
|
-
import { Hint as ZHint } from "@zendeskgarden/react-forms"
|
|
3
|
-
import styled from "styled-components"
|
|
4
|
-
import { FONT_SIZES, FONT_WEIGHTS } from "styles/typography"
|
|
5
|
-
|
|
6
|
-
export const Hint = styled(ZHint)`
|
|
7
|
-
&& {
|
|
8
|
-
font-size: ${FONT_SIZES.XS};
|
|
9
|
-
font-weight: ${FONT_WEIGHTS.MEDIUM};
|
|
10
|
-
color: ${({ theme }) => theme.styles.textColorSecondary};
|
|
11
|
-
}
|
|
12
|
-
`
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Button, Props as ButtonProps } from "components/forms/Button"
|
|
2
|
-
import React from "react"
|
|
3
|
-
import styled from "styled-components"
|
|
4
|
-
|
|
5
|
-
const COMPONENT_NAME = "IconButton"
|
|
6
|
-
|
|
7
|
-
type Props = Omit<ButtonProps, "children">
|
|
8
|
-
|
|
9
|
-
export const IconButton = styled(({
|
|
10
|
-
primary,
|
|
11
|
-
flat,
|
|
12
|
-
pill,
|
|
13
|
-
...props
|
|
14
|
-
}: Props): JSX.Element => {
|
|
15
|
-
return <Button flat={flat != null ? flat : true}
|
|
16
|
-
fluid={false}
|
|
17
|
-
{...props}
|
|
18
|
-
pill={pill != null ? pill : true}
|
|
19
|
-
primary={primary ?? false}
|
|
20
|
-
/>
|
|
21
|
-
})<Props>`
|
|
22
|
-
&& {
|
|
23
|
-
padding: .5em;
|
|
24
|
-
min-width: 0;
|
|
25
|
-
}
|
|
26
|
-
`
|
|
27
|
-
|
|
28
|
-
// @ts-ignore
|
|
29
|
-
IconButton.COMPONENT_NAME = COMPONENT_NAME
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React, { useState } from "react"
|
|
2
|
-
import { TaggedToggle } from "components/forms/TaggedToggle"
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: "react_components_zendesk/forms/TaggedToggle",
|
|
6
|
-
component: TaggedToggle,
|
|
7
|
-
argTypes: {},
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const Story = () => {
|
|
12
|
-
const [active, setState] = useState(false)
|
|
13
|
-
return <TaggedToggle active={active} onChange={setState} />
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const Default = Story.bind({})
|
|
17
|
-
// @ts-ignore
|
|
18
|
-
Default.args = {}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Toggle } from "components/forms/Toggle"
|
|
2
|
-
import { FlexBox } from "components/layout/FlexBox"
|
|
3
|
-
import { Chip } from "components/tags/Chip"
|
|
4
|
-
import React from "react"
|
|
5
|
-
|
|
6
|
-
type Props = {
|
|
7
|
-
active: boolean,
|
|
8
|
-
onChange: (checked: boolean) => void,
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const TaggedToggle = ({ active, onChange }: Props) => {
|
|
12
|
-
return <FlexBox alignItems={"baseline"}>
|
|
13
|
-
<Chip success={active}>
|
|
14
|
-
{active ? "Enabled" : "Disabled"}
|
|
15
|
-
</Chip>
|
|
16
|
-
<Toggle checked={active}
|
|
17
|
-
onChange={onChange} />
|
|
18
|
-
</FlexBox>
|
|
19
|
-
}
|