@decisiv/ui-components 2.0.1-alpha.15 → 2.0.1-alpha.152
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/lib/atoms/BaseButton/index.d.ts.map +1 -1
- package/lib/atoms/BaseButton/index.js +1 -1
- package/lib/atoms/BooleanInput/elements.d.ts.map +1 -1
- package/lib/atoms/BooleanInput/elements.js +8 -3
- package/lib/atoms/BooleanInput/index.d.ts.map +1 -1
- package/lib/atoms/BooleanInput/index.js +26 -5
- package/lib/atoms/BooleanInput/index.test.js +17 -6
- package/lib/atoms/BooleanInput/types.d.ts +4 -0
- package/lib/atoms/BooleanInput/types.d.ts.map +1 -1
- package/lib/atoms/BooleanInput/types.js +5 -1
- package/lib/atoms/Calendar/hooks/useCalendar/index.d.ts.map +1 -1
- package/lib/atoms/Calendar/hooks/useCalendar/index.js +2 -1
- package/lib/atoms/Calendar/hooks/useCalendar/index.test.js +5 -6
- package/lib/atoms/Calendar/index.d.ts.map +1 -1
- package/lib/atoms/Calendar/index.js +46 -6
- package/lib/atoms/Calendar/index.test.js +68 -38
- package/lib/atoms/Calendar/types.d.ts +1 -1
- package/lib/atoms/Calendar/types.d.ts.map +1 -1
- package/lib/atoms/Calendar/types.js +5 -1
- package/lib/atoms/InputField/Containers.d.ts +12 -6
- package/lib/atoms/InputField/Containers.d.ts.map +1 -1
- package/lib/atoms/InputField/Containers.js +8 -6
- package/lib/atoms/InputField/InputLabel.d.ts +1 -0
- package/lib/atoms/InputField/InputLabel.d.ts.map +1 -1
- package/lib/atoms/InputField/InputLabel.js +2 -1
- package/lib/atoms/InputField/index.d.ts +6 -0
- package/lib/atoms/InputField/index.d.ts.map +1 -1
- package/lib/atoms/InputField/index.js +25 -8
- package/lib/atoms/InputField/index.test.js +91 -0
- package/lib/atoms/InputField/schema.d.ts.map +1 -1
- package/lib/atoms/InputField/schema.js +3 -2
- package/lib/atoms/OptionsList/Category.d.ts +1 -1
- package/lib/atoms/OptionsList/Category.d.ts.map +1 -1
- package/lib/atoms/OptionsList/Category.js +4 -2
- package/lib/atoms/OptionsList/Footer.d.ts +8 -0
- package/lib/atoms/OptionsList/Footer.d.ts.map +1 -0
- package/lib/atoms/OptionsList/Footer.js +72 -0
- package/lib/atoms/OptionsList/Option.d.ts.map +1 -1
- package/lib/atoms/OptionsList/Option.js +24 -9
- package/lib/atoms/OptionsList/index.d.ts.map +1 -1
- package/lib/atoms/OptionsList/index.js +44 -17
- package/lib/atoms/OptionsList/index.test.js +127 -17
- package/lib/atoms/OptionsList/schema.d.ts.map +1 -1
- package/lib/atoms/OptionsList/schema.js +5 -0
- package/lib/atoms/OptionsList/types.d.ts +15 -0
- package/lib/atoms/OptionsList/types.d.ts.map +1 -1
- package/lib/atoms/OptionsList/types.js +5 -1
- package/lib/atoms/RequiredIcon.d.ts +9 -0
- package/lib/atoms/RequiredIcon.d.ts.map +1 -0
- package/lib/atoms/{InputField/RequiredIcon.js → RequiredIcon.js} +7 -3
- package/lib/components/Accordion/types.js +5 -1
- package/lib/components/Accordion/useAccordion/types.js +5 -1
- package/lib/components/Alert/Container.d.ts +201 -0
- package/lib/components/Alert/Container.d.ts.map +1 -0
- package/lib/components/Alert/Container.js +26 -0
- package/lib/components/Alert/StyledButton.d.ts +5 -0
- package/lib/components/Alert/StyledButton.d.ts.map +1 -0
- package/lib/components/Alert/StyledButton.js +23 -0
- package/lib/components/Alert/index.d.ts +27 -0
- package/lib/components/Alert/index.d.ts.map +1 -0
- package/lib/components/Alert/index.js +112 -0
- package/lib/components/Alert/index.test.js +79 -0
- package/lib/components/Alert/intents.d.ts +13 -0
- package/lib/components/Alert/intents.d.ts.map +1 -0
- package/lib/components/Alert/intents.js +72 -0
- package/lib/components/Alert/schema.d.ts +3 -0
- package/lib/components/Alert/schema.d.ts.map +1 -0
- package/lib/components/Alert/schema.js +25 -0
- package/lib/components/Alert/types.d.ts +36 -0
- package/lib/components/Alert/types.d.ts.map +1 -0
- package/lib/components/Alert/types.js +32 -0
- package/lib/components/Avatar/types.js +5 -1
- package/lib/components/Badge/constants.d.ts +2 -0
- package/lib/components/Badge/constants.d.ts.map +1 -0
- package/lib/components/Badge/constants.js +29 -0
- package/lib/components/Badge/index.d.ts.map +1 -1
- package/lib/components/Badge/index.js +12 -23
- package/lib/components/Badge/index.test.js +51 -8
- package/lib/components/Badge/schema.js +1 -1
- package/lib/components/Badge/types.d.ts +1 -1
- package/lib/components/Badge/types.d.ts.map +1 -1
- package/lib/components/Badge/types.js +7 -3
- package/lib/components/Breadcrumbs/types.js +5 -1
- package/lib/components/Button/StyledButton.d.ts +3 -2
- package/lib/components/Button/StyledButton.d.ts.map +1 -1
- package/lib/components/Button/StyledButton.js +21 -7
- package/lib/components/Button/index.d.ts.map +1 -1
- package/lib/components/Button/index.js +19 -9
- package/lib/components/Button/index.test.js +24 -8
- package/lib/components/Button/schema.d.ts +6 -1
- package/lib/components/Button/schema.d.ts.map +1 -1
- package/lib/components/Button/schema.js +11 -5
- package/lib/components/Button/types.d.ts +2 -1
- package/lib/components/Button/types.d.ts.map +1 -1
- package/lib/components/Button/types.js +5 -1
- package/lib/components/Checkbox/index.d.ts.map +1 -1
- package/lib/components/Checkbox/index.js +3 -1
- package/lib/components/Checkbox/schema.d.ts.map +1 -1
- package/lib/components/Checkbox/schema.js +2 -0
- package/lib/components/Combobox/Target.d.ts.map +1 -1
- package/lib/components/Combobox/Target.js +51 -14
- package/lib/components/Combobox/index.d.ts.map +1 -1
- package/lib/components/Combobox/index.js +196 -66
- package/lib/components/Combobox/index.test.js +369 -146
- package/lib/components/Combobox/schema.d.ts.map +1 -1
- package/lib/components/Combobox/schema.js +10 -2
- package/lib/components/Combobox/types.d.ts +12 -3
- package/lib/components/Combobox/types.d.ts.map +1 -1
- package/lib/components/Combobox/types.js +5 -1
- package/lib/components/DropdownList/index.d.ts +4 -0
- package/lib/components/DropdownList/index.d.ts.map +1 -1
- package/lib/components/DropdownList/index.js +76 -11
- package/lib/components/DropdownList/propTypes.d.ts +4 -0
- package/lib/components/DropdownList/propTypes.d.ts.map +1 -0
- package/lib/components/DropdownList/propTypes.js +42 -0
- package/lib/components/DropdownList/schema.d.ts.map +1 -1
- package/lib/components/DropdownList/schema.js +6 -1
- package/lib/components/DropdownList/types.d.ts +4 -1
- package/lib/components/DropdownList/types.d.ts.map +1 -1
- package/lib/components/Filter/IconWrapper/index.d.ts +197 -0
- package/lib/components/Filter/IconWrapper/index.d.ts.map +1 -0
- package/lib/components/Filter/IconWrapper/index.js +35 -0
- package/lib/components/Filter/SimplePrimary/index.d.ts +31 -0
- package/lib/components/Filter/SimplePrimary/index.d.ts.map +1 -0
- package/lib/components/Filter/SimplePrimary/index.js +58 -0
- package/lib/components/Filter/SimplePrimary/index.test.js +34 -0
- package/lib/components/Filter/StyledFilter.d.ts +4 -0
- package/lib/components/Filter/StyledFilter.d.ts.map +1 -0
- package/lib/components/Filter/StyledFilter.js +41 -0
- package/lib/components/Filter/StyledLabel/index.d.ts +8 -0
- package/lib/components/Filter/StyledLabel/index.d.ts.map +1 -0
- package/lib/components/Filter/StyledLabel/index.js +30 -0
- package/lib/components/Filter/index.d.ts +5 -0
- package/lib/components/Filter/index.d.ts.map +1 -0
- package/lib/components/Filter/index.js +107 -0
- package/lib/components/Filter/index.test.js +60 -0
- package/lib/components/Filter/kind.d.ts +6 -0
- package/lib/components/Filter/kind.d.ts.map +1 -0
- package/lib/components/Filter/kind.js +45 -0
- package/lib/components/Filter/schema.d.ts +9 -0
- package/lib/components/Filter/schema.d.ts.map +1 -0
- package/lib/components/Filter/schema.js +33 -0
- package/lib/components/Filter/types.d.ts +18 -0
- package/lib/components/Filter/types.d.ts.map +1 -0
- package/lib/components/Filter/types.js +5 -0
- package/lib/components/JumpTo/JumpToMenu.d.ts +2 -2
- package/lib/components/JumpTo/JumpToMenu.d.ts.map +1 -1
- package/lib/components/JumpTo/JumpToMenu.js +3 -3
- package/lib/components/JumpTo/types.js +5 -1
- package/lib/components/JumpTo/utils.d.ts.map +1 -1
- package/lib/components/JumpTo/utils.js +3 -7
- package/lib/components/LeftNav/Item/ClickArea.d.ts.map +1 -1
- package/lib/components/LeftNav/Item/ClickArea.js +2 -2
- package/lib/components/LeftNav/Item/ItemWrapper.d.ts.map +1 -1
- package/lib/components/LeftNav/Item/ItemWrapper.js +3 -3
- package/lib/components/LeftNav/Item/MenuItemWrapper.d.ts +7 -0
- package/lib/components/LeftNav/Item/MenuItemWrapper.d.ts.map +1 -0
- package/lib/components/LeftNav/Item/MenuItemWrapper.js +20 -0
- package/lib/components/LeftNav/Item/NavCollapsedXItem/index.d.ts.map +1 -1
- package/lib/components/LeftNav/Item/NavCollapsedXItem/index.js +7 -5
- package/lib/components/LeftNav/Item/NavExpandedItem/index.d.ts.map +1 -1
- package/lib/components/LeftNav/Item/NavExpandedItem/index.js +24 -13
- package/lib/components/LeftNav/Item/types.d.ts +1 -1
- package/lib/components/LeftNav/Item/types.d.ts.map +1 -1
- package/lib/components/LeftNav/Item/types.js +5 -1
- package/lib/components/LeftNav/index.test.js +13 -3
- package/lib/components/LeftNav/schema.d.ts.map +1 -1
- package/lib/components/LeftNav/schema.js +2 -0
- package/lib/components/LeftNav/types.d.ts +1 -0
- package/lib/components/LeftNav/types.d.ts.map +1 -1
- package/lib/components/LeftNav/types.js +5 -1
- package/lib/components/Link/DisabledLink.d.ts +7 -0
- package/lib/components/Link/DisabledLink.d.ts.map +1 -0
- package/lib/components/Link/DisabledLink.js +46 -0
- package/lib/components/Link/Link.d.ts +4 -0
- package/lib/components/Link/Link.d.ts.map +1 -0
- package/lib/components/Link/Link.js +67 -0
- package/lib/components/Link/index.d.ts +4 -23
- package/lib/components/Link/index.d.ts.map +1 -1
- package/lib/components/Link/index.js +20 -158
- package/lib/components/Link/index.test.js +63 -42
- package/lib/components/Link/schema.d.ts.map +1 -1
- package/lib/components/Link/schema.js +2 -1
- package/lib/components/Link/styles.d.ts +20 -0
- package/lib/components/Link/styles.d.ts.map +1 -0
- package/lib/components/Link/styles.js +131 -0
- package/lib/components/Link/types.d.ts +28 -0
- package/lib/components/Link/types.d.ts.map +1 -0
- package/lib/components/Link/types.js +5 -0
- package/lib/components/Menu/index.d.ts.map +1 -1
- package/lib/components/Menu/index.js +3 -1
- package/lib/components/Menu/types.d.ts +2 -0
- package/lib/components/Menu/types.d.ts.map +1 -1
- package/lib/components/Menu/types.js +5 -1
- package/lib/components/Modal/components.d.ts +2 -2
- package/lib/components/Modal/types.js +5 -1
- package/lib/components/Notifications/Notification/components.d.ts +3 -3
- package/lib/components/Notifications/Notification/components.d.ts.map +1 -1
- package/lib/components/Notifications/Notification/components.js +12 -6
- package/lib/components/Notifications/Notification/index.d.ts +3 -6
- package/lib/components/Notifications/Notification/index.d.ts.map +1 -1
- package/lib/components/Notifications/Notification/index.js +19 -12
- package/lib/components/Notifications/Notification/index.test.js +38 -19
- package/lib/components/Notifications/NotificationsPanel/index.d.ts +2 -1
- package/lib/components/Notifications/NotificationsPanel/index.d.ts.map +1 -1
- package/lib/components/Notifications/NotificationsPanel/index.js +44 -21
- package/lib/components/Notifications/NotificationsPanel/schema.js +1 -1
- package/lib/components/Notifications/Notifier.test.js +79 -10
- package/lib/components/Notifications/constants.d.ts +2 -0
- package/lib/components/Notifications/constants.d.ts.map +1 -0
- package/lib/components/Notifications/constants.js +16 -0
- package/lib/components/Notifications/schema.d.ts.map +1 -1
- package/lib/components/Notifications/schema.js +2 -1
- package/lib/components/Notifications/useNotifications.d.ts +1 -0
- package/lib/components/Notifications/useNotifications.d.ts.map +1 -1
- package/lib/components/Notifications/useNotifications.test.js +7 -4
- package/lib/components/Pagination/Pagination.d.ts +1 -1
- package/lib/components/Pagination/Pagination.d.ts.map +1 -1
- package/lib/components/Pagination/Pagination.js +1 -0
- package/lib/components/Pagination/Pagination.test.js +9 -0
- package/lib/components/Pagination/types.js +5 -1
- package/lib/components/PasswordField/IconWrapper.d.ts +198 -0
- package/lib/components/PasswordField/IconWrapper.d.ts.map +1 -0
- package/lib/components/PasswordField/IconWrapper.js +32 -0
- package/lib/components/PasswordField/Input.d.ts +6 -0
- package/lib/components/PasswordField/Input.d.ts.map +1 -0
- package/lib/components/PasswordField/Input.js +28 -0
- package/lib/components/PasswordField/ShowPasswordButton.d.ts +8 -0
- package/lib/components/PasswordField/ShowPasswordButton.d.ts.map +1 -0
- package/lib/components/PasswordField/ShowPasswordButton.js +48 -0
- package/lib/components/PasswordField/index.d.ts +14 -0
- package/lib/components/PasswordField/index.d.ts.map +1 -0
- package/lib/components/PasswordField/index.js +113 -0
- package/lib/components/PasswordField/index.test.js +217 -0
- package/lib/components/PasswordField/schema.d.ts +3 -0
- package/lib/components/PasswordField/schema.d.ts.map +1 -0
- package/lib/components/PasswordField/schema.js +27 -0
- package/lib/components/Popover/index.d.ts.map +1 -1
- package/lib/components/Popover/index.js +6 -3
- package/lib/components/Popover/schema.d.ts.map +1 -1
- package/lib/components/Popover/schema.js +27 -20
- package/lib/components/Popover/types.d.ts +1 -0
- package/lib/components/Popover/types.d.ts.map +1 -1
- package/lib/components/Popover/utils.d.ts +1 -1
- package/lib/components/SearchInput/index.d.ts +11 -0
- package/lib/components/SearchInput/index.d.ts.map +1 -0
- package/lib/components/SearchInput/index.js +190 -0
- package/lib/components/SearchInput/index.test.js +417 -0
- package/lib/components/SearchInput/schema.d.ts +3 -0
- package/lib/components/SearchInput/schema.d.ts.map +1 -0
- package/lib/components/SearchInput/schema.js +24 -0
- package/lib/components/SearchInput/types.d.ts +28 -0
- package/lib/components/SearchInput/types.d.ts.map +1 -0
- package/lib/components/SearchInput/types.js +5 -0
- package/lib/components/Select/Target.d.ts.map +1 -1
- package/lib/components/Select/Target.js +6 -2
- package/lib/components/Select/index.d.ts.map +1 -1
- package/lib/components/Select/index.js +41 -3
- package/lib/components/Select/index.test.js +82 -23
- package/lib/components/Select/schema.d.ts.map +1 -1
- package/lib/components/Select/schema.js +8 -0
- package/lib/components/Select/types.d.ts +5 -1
- package/lib/components/Select/types.d.ts.map +1 -1
- package/lib/components/Select/types.js +5 -1
- package/lib/components/SelectDate/Target.d.ts.map +1 -1
- package/lib/components/SelectDate/Target.js +6 -2
- package/lib/components/SelectDate/index.d.ts.map +1 -1
- package/lib/components/SelectDate/index.js +32 -3
- package/lib/components/SelectDate/index.test.js +108 -51
- package/lib/components/SelectDate/schema.d.ts.map +1 -1
- package/lib/components/SelectDate/schema.js +3 -0
- package/lib/components/SelectDate/types.d.ts +3 -0
- package/lib/components/SelectDate/types.d.ts.map +1 -1
- package/lib/components/SelectDate/types.js +5 -1
- package/lib/components/SelectDateRange/index.d.ts.map +1 -1
- package/lib/components/SelectDateRange/index.js +31 -2
- package/lib/components/SelectDateRange/index.test.js +115 -58
- package/lib/components/SelectDateRange/schema.d.ts.map +1 -1
- package/lib/components/SelectDateRange/schema.js +3 -0
- package/lib/components/SelectDateRange/types.js +5 -1
- package/lib/components/SelectMenu/index.d.ts +5 -0
- package/lib/components/SelectMenu/index.d.ts.map +1 -1
- package/lib/components/SelectMenu/index.js +27 -3
- package/lib/components/SelectMenu/schema.d.ts.map +1 -1
- package/lib/components/SelectMenu/schema.js +4 -0
- package/lib/components/Table/Body.d.ts.map +1 -1
- package/lib/components/Table/Body.js +28 -17
- package/lib/components/Table/Container.d.ts.map +1 -1
- package/lib/components/Table/Container.js +6 -1
- package/lib/components/Table/DataRow.d.ts.map +1 -1
- package/lib/components/Table/DataRow.js +26 -18
- package/lib/components/Table/Head.d.ts +1 -1
- package/lib/components/Table/Head.d.ts.map +1 -1
- package/lib/components/Table/Head.js +10 -5
- package/lib/components/Table/HeaderCell/index.d.ts.map +1 -1
- package/lib/components/Table/HeaderCell/index.js +19 -6
- package/lib/components/Table/HeaderCell/types.d.ts +6 -1
- package/lib/components/Table/HeaderCell/types.d.ts.map +1 -1
- package/lib/components/Table/HeaderCell/types.js +5 -1
- package/lib/components/Table/Provider.d.ts +5 -5
- package/lib/components/Table/Provider.d.ts.map +1 -1
- package/lib/components/Table/Provider.js +10 -11
- package/lib/components/Table/index.d.ts.map +1 -1
- package/lib/components/Table/index.js +110 -20
- package/lib/components/Table/index.test.js +80 -33
- package/lib/components/Table/schema.columns.d.ts.map +1 -1
- package/lib/components/Table/schema.columns.js +6 -4
- package/lib/components/Table/schema.d.ts.map +1 -1
- package/lib/components/Table/schema.js +7 -6
- package/lib/components/Table/types.d.ts +19 -4
- package/lib/components/Table/types.d.ts.map +1 -1
- package/lib/components/Table/utils.d.ts +2 -8
- package/lib/components/Table/utils.d.ts.map +1 -1
- package/lib/components/Table/utils.js +21 -20
- package/lib/components/Tabs/types.js +5 -1
- package/lib/components/Tag/types.d.ts +1 -1
- package/lib/components/Tag/types.d.ts.map +1 -1
- package/lib/components/Tag/types.js +5 -1
- package/lib/components/TextArea/TextArea.d.ts.map +1 -1
- package/lib/components/TextArea/TextArea.js +1 -1
- package/lib/components/TextArea/index.js +1 -0
- package/lib/components/TextArea/index.test.js +5 -0
- package/lib/components/TextField/Input.js +1 -1
- package/lib/components/TextField/index.test.js +5 -0
- package/lib/components/Toggle/index.d.ts.map +1 -1
- package/lib/components/Toggle/index.js +4 -0
- package/lib/components/Toggle/index.test.js +39 -10
- package/lib/components/Toggle/types.js +5 -1
- package/lib/components/Tooltip/index.d.ts.map +1 -1
- package/lib/components/Tooltip/index.js +3 -13
- package/lib/components/Tooltip/schema.d.ts +3 -0
- package/lib/components/Tooltip/schema.d.ts.map +1 -0
- package/lib/components/Tooltip/schema.js +29 -0
- package/lib/components/index.d.ts +4 -0
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/index.js +50 -0
- package/lib/modifiers/spacingSchema.d.ts.map +1 -1
- package/lib/modifiers/spacingSchema.js +29 -16
- package/lib/providers/ConfigProvider/index.d.ts.map +1 -1
- package/lib/providers/ConfigProvider/index.js +5 -1
- package/lib/providers/ConfigProvider/utils/context.d.ts +1 -1
- package/lib/providers/ConfigProvider/utils/context.d.ts.map +1 -1
- package/lib/providers/ConfigProvider/utils/normalizer.d.ts.map +1 -1
- package/lib/providers/ConfigProvider/utils/normalizer.js +1 -1
- package/lib/providers/ConfigProvider/utils/translations.d.ts +14 -0
- package/lib/providers/ConfigProvider/utils/translations.d.ts.map +1 -1
- package/lib/providers/ConfigProvider/utils/translations.js +14 -0
- package/lib/providers/NotificationsProvider/index.d.ts +6 -5
- package/lib/providers/NotificationsProvider/index.d.ts.map +1 -1
- package/lib/providers/NotificationsProvider/index.js +47 -28
- package/lib/providers/NotificationsProvider/types.d.ts +4 -1
- package/lib/providers/NotificationsProvider/types.d.ts.map +1 -1
- package/lib/utils/joinClassnames.d.ts +3 -0
- package/lib/utils/joinClassnames.d.ts.map +1 -0
- package/lib/utils/joinClassnames.js +26 -0
- package/lib/utils/useFirstMount.d.ts +2 -0
- package/lib/utils/useFirstMount.d.ts.map +1 -0
- package/lib/utils/useFirstMount.js +19 -0
- package/lib/utils/useUpdateEffect.d.ts +4 -0
- package/lib/utils/useUpdateEffect.d.ts.map +1 -0
- package/lib/utils/useUpdateEffect.js +28 -0
- package/package.json +3 -3
- package/lib/atoms/InputField/RequiredIcon.d.ts +0 -4
- package/lib/atoms/InputField/RequiredIcon.d.ts.map +0 -1
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _react = _interopRequireDefault(require("react"));
|
|
4
|
+
|
|
5
|
+
var _react2 = require("@testing-library/react");
|
|
6
|
+
|
|
7
|
+
var _ConfigProvider = require("../../providers/ConfigProvider");
|
|
8
|
+
|
|
9
|
+
var _ = _interopRequireDefault(require("."));
|
|
10
|
+
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
|
|
13
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
14
|
+
|
|
15
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
16
|
+
|
|
17
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
18
|
+
|
|
19
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { keys.push.apply(keys, Object.getOwnPropertySymbols(object)); } if (enumerableOnly) keys = keys.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); return keys; }
|
|
20
|
+
|
|
21
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
22
|
+
|
|
23
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
24
|
+
|
|
25
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
26
|
+
|
|
27
|
+
// Prevent warnings about missing document methods (createRange, etc.)
|
|
28
|
+
jest.mock('popper.js', function () {
|
|
29
|
+
var _class, _temp;
|
|
30
|
+
|
|
31
|
+
var PopperJS = jest.requireActual('popper.js');
|
|
32
|
+
return _temp = _class = function _class() {
|
|
33
|
+
_classCallCheck(this, _class);
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
destroy: function destroy() {},
|
|
37
|
+
scheduleUpdate: function scheduleUpdate() {}
|
|
38
|
+
};
|
|
39
|
+
}, _defineProperty(_class, "placements", PopperJS.placements), _temp;
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
var wrapper = function wrapper(_ref) {
|
|
43
|
+
var children = _ref.children;
|
|
44
|
+
return _react.default.createElement(_ConfigProvider.ConfigProvider, null, children);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
var render = function render(ui, options) {
|
|
48
|
+
return (0, _react2.render)(ui, _objectSpread({}, options, {
|
|
49
|
+
wrapper: wrapper
|
|
50
|
+
}));
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
var defaultProps = {
|
|
54
|
+
id: 'text-field-1',
|
|
55
|
+
label: 'label',
|
|
56
|
+
name: 'name',
|
|
57
|
+
onChange: function onChange() {},
|
|
58
|
+
value: ''
|
|
59
|
+
};
|
|
60
|
+
describe('PasswordField', function () {
|
|
61
|
+
it('renders the password input', function () {
|
|
62
|
+
var props = _objectSpread({}, defaultProps, {
|
|
63
|
+
value: 'samplepasswd'
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
var container = render(_react.default.createElement(_.default, props));
|
|
67
|
+
expect(container.getByTestId('password-input')).toHaveAttribute('type', 'password');
|
|
68
|
+
});
|
|
69
|
+
it('shows the label "Password"', function () {
|
|
70
|
+
var props = _objectSpread({}, defaultProps, {
|
|
71
|
+
value: 'samplepasswd'
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
var container = render(_react.default.createElement(_.default, props));
|
|
75
|
+
expect(container.getByText('Password')).not.toBeNull();
|
|
76
|
+
});
|
|
77
|
+
it('does not show the label "Password" when hideLabel is true', function () {
|
|
78
|
+
var props = _objectSpread({}, defaultProps, {
|
|
79
|
+
value: 'samplepasswd',
|
|
80
|
+
hideLabel: true
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
var container = render(_react.default.createElement(_.default, props));
|
|
84
|
+
expect(container.queryByText('Password')).not.toBeVisible();
|
|
85
|
+
});
|
|
86
|
+
it('renders the input as a text-type input', function () {
|
|
87
|
+
var props = _objectSpread({}, defaultProps, {
|
|
88
|
+
value: 'samplepasswd',
|
|
89
|
+
initialPasswordVisible: true
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
var container = render(_react.default.createElement(_.default, props));
|
|
93
|
+
expect(container.getByTestId('password-input')).toHaveAttribute('type', 'text');
|
|
94
|
+
expect(container.queryByTestId('password-input')).not.toBeNull();
|
|
95
|
+
});
|
|
96
|
+
it('toggles the input type when the eye icon is clicked', function () {
|
|
97
|
+
var props = _objectSpread({}, defaultProps, {
|
|
98
|
+
value: 'samplepasswd'
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
var container = render(_react.default.createElement(_.default, props));
|
|
102
|
+
expect(container.getByTestId('password-input')).toHaveAttribute('type', 'password');
|
|
103
|
+
|
|
104
|
+
_react2.fireEvent.click(container.getByTestId('toggle-password-visible'));
|
|
105
|
+
|
|
106
|
+
expect(container.getByTestId('password-input')).toHaveAttribute('type', 'text');
|
|
107
|
+
|
|
108
|
+
_react2.fireEvent.click(container.getByTestId('toggle-password-visible'));
|
|
109
|
+
|
|
110
|
+
expect(container.getByTestId('password-input')).toHaveAttribute('type', 'password');
|
|
111
|
+
});
|
|
112
|
+
it('shows the eye icon when the password is hidden', function () {
|
|
113
|
+
var props = _objectSpread({}, defaultProps, {
|
|
114
|
+
value: 'samplepasswd'
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
var container = render(_react.default.createElement(_.default, props));
|
|
118
|
+
expect(container).toMatchSnapshot();
|
|
119
|
+
});
|
|
120
|
+
it('shows the eye slash icon when the password is visible', function () {
|
|
121
|
+
var props = _objectSpread({}, defaultProps, {
|
|
122
|
+
value: 'samplepasswd',
|
|
123
|
+
initialPasswordVisible: true
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
var container = render(_react.default.createElement(_.default, props));
|
|
127
|
+
expect(container).toMatchSnapshot();
|
|
128
|
+
});
|
|
129
|
+
it('toggle the eye button with the enter key', function () {
|
|
130
|
+
var props = _objectSpread({}, defaultProps, {
|
|
131
|
+
value: 'samplepasswd'
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
var container = render(_react.default.createElement(_.default, props));
|
|
135
|
+
expect(container.getByTestId('password-input')).toHaveAttribute('type', 'password');
|
|
136
|
+
|
|
137
|
+
_react2.fireEvent.keyPress(container.getByTestId('toggle-password-visible'), {
|
|
138
|
+
code: 'Enter',
|
|
139
|
+
key: 'Enter',
|
|
140
|
+
charCode: 13
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
expect(container.getByTestId('password-input')).toHaveAttribute('type', 'text');
|
|
144
|
+
|
|
145
|
+
_react2.fireEvent.keyPress(container.getByTestId('toggle-password-visible'), {
|
|
146
|
+
code: 'Enter',
|
|
147
|
+
key: 'Enter',
|
|
148
|
+
charCode: 13
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
expect(container.getByTestId('password-input')).toHaveAttribute('type', 'password');
|
|
152
|
+
});
|
|
153
|
+
it('shows the "Show Password" tooltip', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
154
|
+
var props, container;
|
|
155
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
156
|
+
while (1) {
|
|
157
|
+
switch (_context.prev = _context.next) {
|
|
158
|
+
case 0:
|
|
159
|
+
props = _objectSpread({}, defaultProps, {
|
|
160
|
+
value: 'samplepasswd'
|
|
161
|
+
});
|
|
162
|
+
container = render(_react.default.createElement(_.default, props));
|
|
163
|
+
_context.next = 4;
|
|
164
|
+
return _react2.fireEvent.focus(container.getByTestId('toggle-password-visible'), {
|
|
165
|
+
bubbles: true
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
case 4:
|
|
169
|
+
_context.t0 = expect;
|
|
170
|
+
_context.next = 7;
|
|
171
|
+
return container.findByText('Show Password');
|
|
172
|
+
|
|
173
|
+
case 7:
|
|
174
|
+
_context.t1 = _context.sent;
|
|
175
|
+
(0, _context.t0)(_context.t1).not.toBeNull();
|
|
176
|
+
|
|
177
|
+
case 9:
|
|
178
|
+
case "end":
|
|
179
|
+
return _context.stop();
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}, _callee);
|
|
183
|
+
})));
|
|
184
|
+
it('shows the "Hide Password" tooltip', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
185
|
+
var props, container;
|
|
186
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
187
|
+
while (1) {
|
|
188
|
+
switch (_context2.prev = _context2.next) {
|
|
189
|
+
case 0:
|
|
190
|
+
props = _objectSpread({}, defaultProps, {
|
|
191
|
+
value: 'samplepasswd'
|
|
192
|
+
});
|
|
193
|
+
container = render(_react.default.createElement(_.default, _extends({}, props, {
|
|
194
|
+
initialPasswordVisible: true
|
|
195
|
+
})));
|
|
196
|
+
_context2.next = 4;
|
|
197
|
+
return _react2.fireEvent.focus(container.getByTestId('toggle-password-visible'), {
|
|
198
|
+
bubbles: true
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
case 4:
|
|
202
|
+
_context2.t0 = expect;
|
|
203
|
+
_context2.next = 7;
|
|
204
|
+
return container.findByText('Hide Password');
|
|
205
|
+
|
|
206
|
+
case 7:
|
|
207
|
+
_context2.t1 = _context2.sent;
|
|
208
|
+
(0, _context2.t0)(_context2.t1).not.toBeNull();
|
|
209
|
+
|
|
210
|
+
case 9:
|
|
211
|
+
case "end":
|
|
212
|
+
return _context2.stop();
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}, _callee2);
|
|
216
|
+
})));
|
|
217
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/components/PasswordField/schema.ts"],"names":[],"mappings":"AAOA,QAAA,MAAM,MAAM,KAA6C,CAAC;AAa1D,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _omit = _interopRequireDefault(require("lodash/omit"));
|
|
9
|
+
|
|
10
|
+
var _reactDesc = require("react-desc");
|
|
11
|
+
|
|
12
|
+
var _InputField = require("../../atoms/InputField");
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { keys.push.apply(keys, Object.getOwnPropertySymbols(object)); } if (enumerableOnly) keys = keys.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); return keys; }
|
|
17
|
+
|
|
18
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
19
|
+
|
|
20
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
21
|
+
|
|
22
|
+
var schema = (0, _reactDesc.describe)({
|
|
23
|
+
displayName: 'PasswordField'
|
|
24
|
+
});
|
|
25
|
+
schema.propTypes = _objectSpread({}, (0, _omit.default)(_InputField.schema.makePropTypes(), ['children', 'maxLength', 'showCharacterCount', 'icon', 'readOnly', 'label']));
|
|
26
|
+
var _default = schema;
|
|
27
|
+
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAUN,MAAM,OAAO,CAAC;AAWf,OAAc,EAAE,WAAW,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,SAAS,CAAC;AAE7E,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,UAAU,IAAI,cAAc,EAC5B,WAAW,IAAI,eAAe,EAE9B,SAAS,IAAI,aAAa,EAC1B,YAAY,IAAI,SAAS,EACzB,MAAM,IAAI,aAAa,EACvB,cAAc,IAAI,kBAAkB,EACpC,mBAAmB,IAAI,uBAAuB,EAE/C,MAAM,SAAS,CAAC;AAGjB,oBAAY,UAAU,GAAG,cAAc,CAAC;AACxC,oBAAY,WAAW,GAAG,eAAe,CAAC;AAC1C,oBAAY,WAAW,GAAG,eAAe,CAAC;AAC1C,oBAAY,SAAS,GAAG,aAAa,CAAC;AACtC,oBAAY,YAAY,GAAG,SAAS,CAAC;AACrC,oBAAY,MAAM,GAAG,aAAa,CAAC;AACnC,oBAAY,cAAc,GAAG,kBAAkB,CAAC;AAChD,oBAAY,mBAAmB,GAAG,uBAAuB,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAUN,MAAM,OAAO,CAAC;AAWf,OAAc,EAAE,WAAW,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,SAAS,CAAC;AAE7E,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,UAAU,IAAI,cAAc,EAC5B,WAAW,IAAI,eAAe,EAE9B,SAAS,IAAI,aAAa,EAC1B,YAAY,IAAI,SAAS,EACzB,MAAM,IAAI,aAAa,EACvB,cAAc,IAAI,kBAAkB,EACpC,mBAAmB,IAAI,uBAAuB,EAE/C,MAAM,SAAS,CAAC;AAGjB,oBAAY,UAAU,GAAG,cAAc,CAAC;AACxC,oBAAY,WAAW,GAAG,eAAe,CAAC;AAC1C,oBAAY,WAAW,GAAG,eAAe,CAAC;AAC1C,oBAAY,SAAS,GAAG,aAAa,CAAC;AACtC,oBAAY,YAAY,GAAG,SAAS,CAAC;AACrC,oBAAY,MAAM,GAAG,aAAa,CAAC;AACnC,oBAAY,cAAc,GAAG,kBAAkB,CAAC;AAChD,oBAAY,mBAAmB,GAAG,uBAAuB,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC;AA+PnC,QAAA,MAAM,cAAc,mFAAsB,CAAC;AAkD3C,eAAe,cAAc,CAAC"}
|
|
@@ -85,12 +85,13 @@ var modifiers = {
|
|
|
85
85
|
var Popover = function Popover(props, instanceRef) {
|
|
86
86
|
var alwaysRender = props.alwaysRender,
|
|
87
87
|
arrowColor = props.arrowColor,
|
|
88
|
+
borderRadius = props.borderRadius,
|
|
88
89
|
children = props.children,
|
|
89
90
|
containerSelector = props.containerSelector,
|
|
90
91
|
_props$contentRole = props.contentRole,
|
|
91
92
|
contentRole = _props$contentRole === void 0 ? 'dialog' : _props$contentRole,
|
|
92
93
|
defaultVisible = props.defaultVisible,
|
|
93
|
-
|
|
94
|
+
enabled = props.enabled,
|
|
94
95
|
_props$hideOnClickOut = props.hideOnClickOutside,
|
|
95
96
|
hideOnClickOutside = _props$hideOnClickOut === void 0 ? true : _props$hideOnClickOut,
|
|
96
97
|
_props$hideOnESC = props.hideOnESC,
|
|
@@ -106,7 +107,7 @@ var Popover = function Popover(props, instanceRef) {
|
|
|
106
107
|
target = props.target,
|
|
107
108
|
visible = props.visible,
|
|
108
109
|
zIndex = props.zIndex,
|
|
109
|
-
rest = _objectWithoutProperties(props, ["alwaysRender", "arrowColor", "children", "containerSelector", "contentRole", "defaultVisible", "
|
|
110
|
+
rest = _objectWithoutProperties(props, ["alwaysRender", "arrowColor", "borderRadius", "children", "containerSelector", "contentRole", "defaultVisible", "enabled", "hideOnClickOutside", "hideOnESC", "id", "manageEvents", "onHide", "onRequestHide", "onShow", "placement", "showArrow", "target", "visible", "zIndex"]);
|
|
110
111
|
|
|
111
112
|
var contentRef = (0, _react.useRef)(null);
|
|
112
113
|
var internalNodeRef = (0, _react.useRef)(null);
|
|
@@ -286,7 +287,7 @@ var Popover = function Popover(props, instanceRef) {
|
|
|
286
287
|
return target(data);
|
|
287
288
|
}), targetType === _types.TargetType.Element && (0, _react.cloneElement)(target, _objectSpread({
|
|
288
289
|
ref: internalNodeRef
|
|
289
|
-
}, ariaAttributes)), (alwaysRender || isVisible) && (containerSelector === 'parent' ?
|
|
290
|
+
}, ariaAttributes)), enabled && (alwaysRender || isVisible) && (containerSelector === 'parent' ?
|
|
290
291
|
/* istanbul ignore next */
|
|
291
292
|
popper : createPortal(popper, containerSelector)));
|
|
292
293
|
};
|
|
@@ -295,6 +296,7 @@ var PopoverWithRef = (0, _react.forwardRef)(Popover); // @ts-ignore
|
|
|
295
296
|
|
|
296
297
|
PopoverWithRef.propTypes = {
|
|
297
298
|
id: _propTypes.default.string,
|
|
299
|
+
enabled: _propTypes.default.bool,
|
|
298
300
|
onShow: _propTypes.default.func,
|
|
299
301
|
onHide: _propTypes.default.func,
|
|
300
302
|
target: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.element, _propTypes.default.shape({
|
|
@@ -319,6 +321,7 @@ PopoverWithRef.propTypes = {
|
|
|
319
321
|
};
|
|
320
322
|
PopoverWithRef.defaultProps = {
|
|
321
323
|
alwaysRender: false,
|
|
324
|
+
enabled: true,
|
|
322
325
|
showArrow: true,
|
|
323
326
|
placement: 'bottom'
|
|
324
327
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/schema.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,MAAM,KAA8C,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/schema.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,MAAM,KAA8C,CAAC;AAoG3D,eAAe,MAAM,CAAC"}
|
|
@@ -11,26 +11,33 @@ var _reactDesc = require("react-desc");
|
|
|
11
11
|
var schema = (0, _reactDesc.describe)({
|
|
12
12
|
displayName: 'ConfigProvider'
|
|
13
13
|
});
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
14
|
+
|
|
15
|
+
schema.makePropTypes = function () {
|
|
16
|
+
var component = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'popover';
|
|
17
|
+
return {
|
|
18
|
+
id: _reactDesc.PropTypes.string.description("A unique identifier for the ".concat(component, ". Auto generated if none provided.")),
|
|
19
|
+
ref: _reactDesc.PropTypes.string.description("A React Ref that will be set to the ".concat(component, " instance. See notes below.")),
|
|
20
|
+
target: _reactDesc.PropTypes.any.description("The element the ".concat(component, " will point to. See usage notes above.")).format('Element, Ref or function').isRequired,
|
|
21
|
+
children: _reactDesc.PropTypes.any.description("What should be rendered inside the ".concat(component, ". See notes below.")).format('React node or function').isRequired,
|
|
22
|
+
enabled: _reactDesc.PropTypes.bool.description("If `false` the ".concat(component, " will never be shown; only its target will be rendered.")),
|
|
23
|
+
placement: _reactDesc.PropTypes.string.description("The preferred side of the target the ".concat(component, " should attach to. See notes below.")).defaultValue('bottom'),
|
|
24
|
+
visible: _reactDesc.PropTypes.bool.description("Whether or not the ".concat(component, " should be visible. Setting this prop makes the ").concat(component, " a \"controlled\" component.")),
|
|
25
|
+
defaultVisible: _reactDesc.PropTypes.bool.description("Whether or not the ".concat(component, " should be visible when first rendered.")),
|
|
26
|
+
alwaysRender: _reactDesc.PropTypes.bool.description("If true, the ".concat(component, " window will be hidden instead of destroyed when closed. Useful if the ").concat(component, " window needs to maintain state.")),
|
|
27
|
+
showArrow: _reactDesc.PropTypes.bool.description('Whether or not to show an arrow pointing to the target.').defaultValue(true),
|
|
28
|
+
borderRadius: _reactDesc.PropTypes.string.description("Applies a custom border radius value to the ".concat(component, " content.")),
|
|
29
|
+
arrowColor: _reactDesc.PropTypes.string.description('The color of the arrow. See notes below.'),
|
|
30
|
+
manageEvents: _reactDesc.PropTypes.string.description('The type of events that should be automatically attached to the target. Only applied if `visible` is `undefined`.').format('click,hover,false'),
|
|
31
|
+
containerSelector: _reactDesc.PropTypes.string.description("A CSS selector to the element where the ".concat(component, "s should be rendered in, or \"parent\" to render the ").concat(component, " in-place.")).defaultValue('body'),
|
|
32
|
+
hideOnESC: _reactDesc.PropTypes.bool.description("Whether or not to close the ".concat(component, " when the user presses the \"Escape\" key. No effect when `visible` is not `undefined`.")).defaultValue('true'),
|
|
33
|
+
hideOnClickOutside: _reactDesc.PropTypes.bool.description("Whether or not to close the ".concat(component, " when the user clicks outside the ").concat(component, ". No effect when `visible` is not `undefined`.")).defaultValue('true'),
|
|
34
|
+
zIndex: _reactDesc.PropTypes.number.description("The css `z-index` value to apply to the ".concat(component, " content wrapper. Is set to `auto` when not provided.")),
|
|
35
|
+
onShow: _reactDesc.PropTypes.func.description("A function called when the ".concat(component, " becomes visible. Only called if `visible` is `undefined`.")),
|
|
36
|
+
onHide: _reactDesc.PropTypes.func.description("A function called when the ".concat(component, " becomes hidden. Only called if `visible` is `undefined`.")),
|
|
37
|
+
onRequestHide: _reactDesc.PropTypes.func.description("A function called if `visible` is not `undefined` and when the user clicks outside the ".concat(component, " or presses the \"Escape\" key."))
|
|
38
|
+
};
|
|
34
39
|
};
|
|
40
|
+
|
|
41
|
+
schema.propTypes = schema.makePropTypes();
|
|
35
42
|
var _default = schema;
|
|
36
43
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/types.ts"],"names":[],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
2
|
import { PopoverProps, Side, TargetType, VisibilityActions } from './types';
|
|
3
|
-
export declare const getPlacementParts: (placement?: "
|
|
3
|
+
export declare const getPlacementParts: (placement?: "auto" | "bottom" | "left" | "right" | "top" | "top-start" | "top-end" | "right-start" | "right-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end" | "auto-start" | "auto-end") => [Side, ("end" | "start" | undefined)?];
|
|
4
4
|
interface UseTargetProps extends PopoverProps {
|
|
5
5
|
actions: VisibilityActions;
|
|
6
6
|
internalNodeRef: RefObject<HTMLElement>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SearchInputProps, SearchItem, StyledFlexProps } from './types';
|
|
3
|
+
declare function SearchInput({ onSearch, value, onChange, size, disabled, searchOn, ...props }: SearchInputProps): JSX.Element;
|
|
4
|
+
declare namespace SearchInput {
|
|
5
|
+
var defaultProps: {
|
|
6
|
+
size: string;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export default SearchInput;
|
|
10
|
+
export { SearchInputProps, SearchItem, StyledFlexProps };
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/SearchInput/index.tsx"],"names":[],"mappings":";AAiBA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAkExE,iBAAwB,WAAW,CAAC,EAClC,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,QAAmB,EACnB,GAAG,KAAK,EACT,EAAE,gBAAgB,GAAG,GAAG,CAAC,OAAO,CA0GhC;kBAlHuB,WAAW;;;;;eAAX,WAAW;AAwHnC,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = SearchInput;
|
|
7
|
+
Object.defineProperty(exports, "SearchInputProps", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function get() {
|
|
10
|
+
return _types.SearchInputProps;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "SearchItem", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function get() {
|
|
16
|
+
return _types.SearchItem;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "StyledFlexProps", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function get() {
|
|
22
|
+
return _types.StyledFlexProps;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
27
|
+
|
|
28
|
+
var _Times = _interopRequireDefault(require("@decisiv/iconix/lib/components/Times"));
|
|
29
|
+
|
|
30
|
+
var _Search = _interopRequireDefault(require("@decisiv/iconix/lib/components/Search"));
|
|
31
|
+
|
|
32
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
33
|
+
|
|
34
|
+
var _spacing = _interopRequireDefault(require("@decisiv/design-tokens/lib/spacing"));
|
|
35
|
+
|
|
36
|
+
var _rem = _interopRequireDefault(require("polished/lib/helpers/rem"));
|
|
37
|
+
|
|
38
|
+
var _color = _interopRequireDefault(require("@decisiv/design-tokens/lib/color"));
|
|
39
|
+
|
|
40
|
+
var _toColorString = _interopRequireDefault(require("polished/lib/color/toColorString"));
|
|
41
|
+
|
|
42
|
+
var _useTranslations = _interopRequireDefault(require("../../utils/useTranslations"));
|
|
43
|
+
|
|
44
|
+
var _Flex = _interopRequireDefault(require("../Flex"));
|
|
45
|
+
|
|
46
|
+
var _Button = _interopRequireDefault(require("../Button"));
|
|
47
|
+
|
|
48
|
+
var _InputField = _interopRequireDefault(require("../../atoms/InputField"));
|
|
49
|
+
|
|
50
|
+
var _Tooltip = _interopRequireDefault(require("../Tooltip"));
|
|
51
|
+
|
|
52
|
+
var _focusRingWithColor = _interopRequireDefault(require("../../utils/focusRingWithColor"));
|
|
53
|
+
|
|
54
|
+
var _types = require("./types");
|
|
55
|
+
|
|
56
|
+
var _Input = _interopRequireDefault(require("../TextField/Input"));
|
|
57
|
+
|
|
58
|
+
var _useUpdateEffect = _interopRequireDefault(require("../../utils/useUpdateEffect"));
|
|
59
|
+
|
|
60
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
61
|
+
|
|
62
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
|
63
|
+
|
|
64
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
65
|
+
|
|
66
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
67
|
+
|
|
68
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
69
|
+
|
|
70
|
+
var StyledFlex = (0, _styledComponents.default)(_Flex.default).withConfig({
|
|
71
|
+
displayName: "SearchInput__StyledFlex",
|
|
72
|
+
componentId: "sc-1lgi0sd-0"
|
|
73
|
+
})(["align-items:center;[cursor='text']{height:", "px;> div{", ";padding-bottom:", ";}}"], function (_ref) {
|
|
74
|
+
var mediumSized = _ref.mediumSized;
|
|
75
|
+
return mediumSized ? 50 : 32;
|
|
76
|
+
}, function (_ref2) {
|
|
77
|
+
var mediumSized = _ref2.mediumSized;
|
|
78
|
+
return !mediumSized && "padding-top: ".concat((0, _rem.default)(_spacing.default.base * 0.1));
|
|
79
|
+
}, function (_ref3) {
|
|
80
|
+
var mediumSized = _ref3.mediumSized;
|
|
81
|
+
return (0, _rem.default)(_spacing.default.base * (mediumSized ? 0.6 : 0.1));
|
|
82
|
+
});
|
|
83
|
+
var StyledBody = (0, _styledComponents.default)(_Flex.default).withConfig({
|
|
84
|
+
displayName: "SearchInput__StyledBody",
|
|
85
|
+
componentId: "sc-1lgi0sd-1"
|
|
86
|
+
})(["flex:1;align-items:center;height:inherit;"]);
|
|
87
|
+
var ButtonGroup = (0, _styledComponents.default)(_Flex.default).withConfig({
|
|
88
|
+
displayName: "SearchInput__ButtonGroup",
|
|
89
|
+
componentId: "sc-1lgi0sd-2"
|
|
90
|
+
})(["align-items:center;margin-right:", ";cursor:default;"], function (_ref4) {
|
|
91
|
+
var mediumSized = _ref4.mediumSized;
|
|
92
|
+
return (0, _rem.default)(_spacing.default.base * (mediumSized ? 1 : 0.3));
|
|
93
|
+
});
|
|
94
|
+
var SearchIconWrapper = (0, _styledComponents.default)(_Flex.default).withConfig({
|
|
95
|
+
displayName: "SearchInput__SearchIconWrapper",
|
|
96
|
+
componentId: "sc-1lgi0sd-3"
|
|
97
|
+
})(["color:", ";margin-right:", ";margin-left:", ";align-items:center;"], (0, _toColorString.default)(_color.default.base.alaskanHusky), (0, _rem.default)(_spacing.default.base * 1.5), function (_ref5) {
|
|
98
|
+
var inputSize = _ref5.inputSize;
|
|
99
|
+
return inputSize === 'small' ? 0 : (0, _rem.default)(_spacing.default.base * 0.5);
|
|
100
|
+
});
|
|
101
|
+
var TimesIconWrapper = (0, _styledComponents.default)(_Flex.default).withConfig({
|
|
102
|
+
displayName: "SearchInput__TimesIconWrapper",
|
|
103
|
+
componentId: "sc-1lgi0sd-4"
|
|
104
|
+
})(["height:inherit;visibility:", ";margin-right:", ";color:", ";align-items:center;border:1px solid transparent;border-radius:2px;&:hover{color:", ";}&:focus{outline:none;border:1px solid ", ";", "}"], function (_ref6) {
|
|
105
|
+
var visible = _ref6.visible;
|
|
106
|
+
return visible ? 'visible' : 'hidden';
|
|
107
|
+
}, (0, _rem.default)(_spacing.default.base), (0, _toColorString.default)(_color.default.interaction.pacificOcean), (0, _toColorString.default)(_color.default.status.danger.medium), (0, _toColorString.default)(_color.default.interaction.pacificOcean), (0, _focusRingWithColor.default)(_color.default.interaction.pacificOcean40));
|
|
108
|
+
var StyledInput = (0, _styledComponents.default)(_Input.default).withConfig({
|
|
109
|
+
displayName: "SearchInput__StyledInput",
|
|
110
|
+
componentId: "sc-1lgi0sd-5"
|
|
111
|
+
})(["padding:0;color:", ";"], (0, _toColorString.default)(_color.default.base.charcoal));
|
|
112
|
+
|
|
113
|
+
function SearchInput(_ref7) {
|
|
114
|
+
var onSearch = _ref7.onSearch,
|
|
115
|
+
value = _ref7.value,
|
|
116
|
+
onChange = _ref7.onChange,
|
|
117
|
+
size = _ref7.size,
|
|
118
|
+
disabled = _ref7.disabled,
|
|
119
|
+
_ref7$searchOn = _ref7.searchOn,
|
|
120
|
+
searchOn = _ref7$searchOn === void 0 ? 'submit' : _ref7$searchOn,
|
|
121
|
+
props = _objectWithoutProperties(_ref7, ["onSearch", "value", "onChange", "size", "disabled", "searchOn"]);
|
|
122
|
+
|
|
123
|
+
var translate = (0, _useTranslations.default)();
|
|
124
|
+
var handleSearch = (0, _react.useCallback)(function () {
|
|
125
|
+
!disabled && onSearch && onSearch(value);
|
|
126
|
+
}, [disabled, onSearch, value]);
|
|
127
|
+
var mediumSized = size === 'medium';
|
|
128
|
+
var hasText = !!value && !!value.length;
|
|
129
|
+
var handleClear = (0, _react.useCallback)(function () {
|
|
130
|
+
!disabled && onChange && onChange({
|
|
131
|
+
target: {
|
|
132
|
+
value: ''
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
}, [disabled, onChange]);
|
|
136
|
+
var handleKeyPress = (0, _react.useCallback)(function (event) {
|
|
137
|
+
if (event.key === 'Enter') handleSearch();
|
|
138
|
+
}, [handleSearch]);
|
|
139
|
+
(0, _useUpdateEffect.default)(function () {
|
|
140
|
+
if (searchOn === 'change') {
|
|
141
|
+
handleSearch();
|
|
142
|
+
}
|
|
143
|
+
}, [searchOn, value]);
|
|
144
|
+
var renderLeftIcon = searchOn === 'change' || searchOn === 'submit' && mediumSized;
|
|
145
|
+
return _react.default.createElement(StyledFlex, {
|
|
146
|
+
flex: 1,
|
|
147
|
+
mediumSized: mediumSized,
|
|
148
|
+
"data-testid": "search-container"
|
|
149
|
+
}, _react.default.createElement(_InputField.default, _extends({
|
|
150
|
+
label: "",
|
|
151
|
+
hideLabel: true,
|
|
152
|
+
disabled: disabled,
|
|
153
|
+
value: value
|
|
154
|
+
}, props), function (p) {
|
|
155
|
+
return _react.default.createElement(_react.default.Fragment, null, _react.default.createElement(StyledBody, null, renderLeftIcon && _react.default.createElement(SearchIconWrapper, {
|
|
156
|
+
inputSize: size
|
|
157
|
+
}, _react.default.createElement(_Search.default, {
|
|
158
|
+
size: "medium",
|
|
159
|
+
"data-testid": "search-icon"
|
|
160
|
+
})), _react.default.createElement(StyledInput, _extends({}, p, {
|
|
161
|
+
onChange: onChange,
|
|
162
|
+
onKeyPress: handleKeyPress
|
|
163
|
+
})), _react.default.createElement(ButtonGroup, {
|
|
164
|
+
mediumSized: mediumSized
|
|
165
|
+
}, !disabled && _react.default.createElement(_Tooltip.default, {
|
|
166
|
+
placement: "top",
|
|
167
|
+
target: // eslint-disable-next-line react/jsx-wrap-multilines
|
|
168
|
+
_react.default.createElement(TimesIconWrapper, {
|
|
169
|
+
tabIndex: 0,
|
|
170
|
+
"aria-label": translate(undefined, 'searchInput.clearSearch'),
|
|
171
|
+
onClick: handleClear,
|
|
172
|
+
visible: hasText
|
|
173
|
+
}, _react.default.createElement(_Times.default, {
|
|
174
|
+
size: "small"
|
|
175
|
+
}))
|
|
176
|
+
}, translate(undefined, 'searchInput.clear')), searchOn === 'submit' && _react.default.createElement(_Button.default, {
|
|
177
|
+
"aria-label": "Search",
|
|
178
|
+
tabIndex: 0,
|
|
179
|
+
disabled: disabled || !hasText,
|
|
180
|
+
text: mediumSized ? translate(undefined, 'searchInput.search') : '',
|
|
181
|
+
icon: mediumSized ? undefined : _Search.default,
|
|
182
|
+
size: size,
|
|
183
|
+
onClick: handleSearch
|
|
184
|
+
}))));
|
|
185
|
+
}));
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
SearchInput.defaultProps = {
|
|
189
|
+
size: 'medium'
|
|
190
|
+
};
|