@pingux/astro 2.208.3 → 2.209.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components/AIComponents/AIPanel/AIPanel.stories.js +3 -1
- package/lib/cjs/components/AIComponents/AIPanel/aiPanelAttributes.d.ts +17 -0
- package/lib/cjs/components/AIComponents/AIPanel/aiPanelAttributes.js +42 -0
- package/lib/cjs/components/AIComponents/Prompt/Prompt.stories.js +7 -1
- package/lib/cjs/components/AIComponents/Response/Response.stories.js +3 -1
- package/lib/cjs/components/AIComponents/Response/responseAttributes.d.ts +20 -0
- package/lib/cjs/components/AIComponents/Response/responseAttributes.js +27 -0
- package/lib/cjs/components/AIComponents/Suggestions/Suggestions.stories.js +17 -1
- package/lib/cjs/components/AccordionGroup/AccordionGroup.stories.js +4 -23
- package/lib/cjs/components/AccordionGroup/accordionGroupAttributes.d.ts +21 -0
- package/lib/cjs/components/AccordionGroup/accordionGroupAttributes.js +29 -0
- package/lib/cjs/components/ArrayField/ArrayField.stories.js +2 -28
- package/lib/cjs/components/ArrayField/arrayFieldAttributes.d.ts +99 -0
- package/lib/cjs/components/ArrayField/arrayFieldAttributes.js +46 -0
- package/lib/cjs/components/AstroProvider/AstroProvider.stories.js +21 -1
- package/lib/cjs/components/Avatar/Avatar.stories.js +2 -23
- package/lib/cjs/components/Avatar/avatarAttributes.d.ts +23 -0
- package/lib/cjs/components/Avatar/avatarAttributes.js +30 -0
- package/lib/cjs/components/Bracket/Bracket.stories.js +2 -25
- package/lib/cjs/components/Bracket/bracketAttributes.d.ts +25 -0
- package/lib/cjs/components/Bracket/bracketAttributes.js +32 -0
- package/lib/cjs/components/CheckboxField/CheckboxField.stories.js +2 -34
- package/lib/cjs/components/CheckboxField/checkboxFieldAttributes.d.ts +1 -0
- package/lib/cjs/components/CheckboxField/checkboxFieldAttributes.js +52 -0
- package/lib/cjs/components/CollapsiblePanel/CollapsiblePanel.stories.js +12 -12
- package/lib/cjs/components/CollapsiblePanel/collapsiblePanelAttributes.d.ts +12 -0
- package/lib/cjs/components/CollapsiblePanel/collapsiblePanelAttributes.js +19 -0
- package/lib/cjs/components/ColorField/ColorField.stories.js +2 -26
- package/lib/cjs/components/ColorField/colorFieldAttributes.d.ts +1 -0
- package/lib/cjs/components/ColorField/colorFieldAttributes.js +44 -0
- package/lib/cjs/components/DataTable/DataTable.stories.js +3 -101
- package/lib/cjs/components/DataTable/dataTableAttributes.d.ts +162 -0
- package/lib/cjs/components/DataTable/dataTableAttributes.js +109 -0
- package/lib/cjs/components/ExpandableText/ExpandableText.stories.js +13 -1
- package/lib/cjs/components/ExpandableText/expandableTextAttributes.d.ts +26 -0
- package/lib/cjs/components/ExpandableText/expandableTextAttributes.js +33 -0
- package/lib/cjs/components/Footer/Footer.stories.js +6 -0
- package/lib/cjs/components/Grid/Grid.stories.js +2 -19
- package/lib/cjs/components/Grid/gridAttributes.d.ts +19 -0
- package/lib/cjs/components/Grid/gridAttributes.js +26 -0
- package/lib/cjs/components/IconBadge/IconBadge.stories.js +32 -1
- package/lib/cjs/components/IconButtonToggle/IconButtonToggle.stories.js +3 -1
- package/lib/cjs/components/IconButtonToggle/iconButtonToggleAttributes.d.ts +40 -0
- package/lib/cjs/components/IconButtonToggle/iconButtonToggleAttributes.js +63 -0
- package/lib/cjs/components/Image/Image.stories.js +2 -16
- package/lib/cjs/components/Image/imageAttributes.d.ts +15 -0
- package/lib/cjs/components/Image/imageAttributes.js +23 -0
- package/lib/cjs/components/Input/Input.stories.js +12 -6
- package/lib/cjs/components/Input/inputAttributes.d.ts +6 -0
- package/lib/cjs/components/Input/inputAttributes.js +13 -0
- package/lib/cjs/components/Label/Label.stories.js +2 -13
- package/lib/cjs/components/Label/labelAttributes.d.ts +17 -0
- package/lib/cjs/components/Label/labelAttributes.js +21 -0
- package/lib/cjs/components/Link/Link.stories.js +2 -33
- package/lib/cjs/components/Link/linkAttributes.d.ts +28 -0
- package/lib/cjs/components/Link/linkAttributes.js +41 -0
- package/lib/cjs/components/ListView/stories/ListViewOnyxDark.stories.js +51 -1
- package/lib/cjs/components/ListView/stories/listViewOnyxDarkAttributes.d.ts +31 -0
- package/lib/cjs/components/ListView/stories/listViewOnyxDarkAttributes.js +58 -0
- package/lib/cjs/components/Modal/Convenience/ModalBody.stories.js +13 -1
- package/lib/cjs/components/Modal/Convenience/ModalFooter.stories.js +13 -1
- package/lib/cjs/components/Modal/Convenience/ModalHeader.stories.js +13 -1
- package/lib/cjs/components/Modal/Convenience/modalBodyAttributes.d.ts +21 -0
- package/lib/cjs/components/Modal/Convenience/modalBodyAttributes.js +42 -0
- package/lib/cjs/components/Modal/Convenience/modalFooterAttributes.d.ts +28 -0
- package/lib/cjs/components/Modal/Convenience/modalFooterAttributes.js +51 -0
- package/lib/cjs/components/Modal/Convenience/modalHeaderAttributes.d.ts +35 -0
- package/lib/cjs/components/Modal/Convenience/modalHeaderAttributes.js +60 -0
- package/lib/cjs/components/Modal/Modal.stories.js +13 -58
- package/lib/cjs/components/Modal/modalAttributes.d.ts +55 -0
- package/lib/cjs/components/Modal/modalAttributes.js +63 -0
- package/lib/cjs/components/NavBar/NavBar.stories.js +13 -2
- package/lib/cjs/components/NavBar/navBarAttributes.d.ts +30 -0
- package/lib/cjs/components/NavBar/navBarAttributes.js +55 -0
- package/lib/cjs/components/NavBar/stories/NavBar.Onyx.stories.js +13 -1
- package/lib/cjs/components/NavBar/stories/navBarOnyxAttributes.d.ts +24 -0
- package/lib/cjs/components/NavBar/stories/navBarOnyxAttributes.js +49 -0
- package/lib/cjs/components/Pagination/Pagination.stories.js +2 -24
- package/lib/cjs/components/Pagination/paginationAttributes.d.ts +24 -0
- package/lib/cjs/components/Pagination/paginationAttributes.js +31 -0
- package/lib/cjs/components/PhoneNumberField/PhoneNumberField.d.ts +4 -0
- package/lib/cjs/components/PhoneNumberField/PhoneNumberField.js +299 -0
- package/lib/cjs/components/PhoneNumberField/PhoneNumberField.mdx +32 -0
- package/lib/cjs/components/PhoneNumberField/PhoneNumberField.stories.js +136 -0
- package/lib/cjs/components/PhoneNumberField/PhoneNumberField.test.js +158 -0
- package/lib/cjs/components/PhoneNumberField/index.d.ts +1 -0
- package/lib/cjs/components/PhoneNumberField/index.js +14 -0
- package/lib/cjs/components/PopoverMenu/PopoverMenu.stories.js +2 -13
- package/lib/cjs/components/PopoverMenu/popoverMenuAttributes.d.ts +13 -0
- package/lib/cjs/components/PopoverMenu/popoverMenuAttributes.js +20 -0
- package/lib/cjs/components/ProgressBar/ProgressBar.stories.js +2 -27
- package/lib/cjs/components/ProgressBar/progressBarAttributes.d.ts +42 -0
- package/lib/cjs/components/ProgressBar/progressBarAttributes.js +65 -0
- package/lib/cjs/components/RadioGroupField/RadioGroupField.stories.js +2 -28
- package/lib/cjs/components/RadioGroupField/radioGroupFieldAttributes.d.ts +1 -0
- package/lib/cjs/components/RadioGroupField/radioGroupFieldAttributes.js +46 -0
- package/lib/cjs/components/RangeCalendar/RangeCalendar.stories.js +4 -13
- package/lib/cjs/components/RangeCalendar/rangeCalendarAttributes.d.ts +121 -0
- package/lib/cjs/components/RangeCalendar/rangeCalendarAttributes.js +91 -0
- package/lib/cjs/components/SearchField/SearchField.stories.js +2 -27
- package/lib/cjs/components/SearchField/searchFieldAttributes.d.ts +1 -0
- package/lib/cjs/components/SearchField/searchFieldAttributes.js +45 -0
- package/lib/cjs/components/SelectField/SelectField.stories.js +2 -41
- package/lib/cjs/components/SelectField/selectFieldAttributes.d.ts +1 -0
- package/lib/cjs/components/SelectField/selectFieldAttributes.js +61 -0
- package/lib/cjs/components/Separator/Separator.stories.js +21 -1
- package/lib/cjs/components/ServerErrorBoundary/ServerErrorBoundary.stories.js +2 -0
- package/lib/cjs/components/ServerErrorBoundary/serverErrorBoundaryAttributes.d.ts +33 -0
- package/lib/cjs/components/ServerErrorBoundary/serverErrorBoundaryAttributes.js +54 -0
- package/lib/cjs/components/SliderField/SliderField.stories.js +2 -38
- package/lib/cjs/components/SliderField/sliderFieldAttributes.d.ts +38 -0
- package/lib/cjs/components/SliderField/sliderFieldAttributes.js +45 -0
- package/lib/cjs/components/StatusIcon/StatusIcon.stories.js +30 -0
- package/lib/cjs/components/Table/Table.stories.js +20 -4
- package/lib/cjs/components/TableBase/TableBase.stories.js +3 -1
- package/lib/cjs/components/TableBase/tableBaseAttributes.d.ts +33 -0
- package/lib/cjs/components/TableBase/tableBaseAttributes.js +62 -0
- package/lib/cjs/components/Tabs/Tabs.stories.js +2 -18
- package/lib/cjs/components/Tabs/tabsAttributes.d.ts +18 -0
- package/lib/cjs/components/Tabs/tabsAttributes.js +25 -0
- package/lib/cjs/components/Text/Text.stories.js +2 -26
- package/lib/cjs/components/Text/textAttributes.d.ts +26 -0
- package/lib/cjs/components/Text/textAttributes.js +33 -0
- package/lib/cjs/components/TextAreaField/TextAreaField.stories.js +2 -41
- package/lib/cjs/components/TextAreaField/textAreaFieldAttributes.d.ts +1 -0
- package/lib/cjs/components/TextAreaField/textAreaFieldAttributes.js +61 -0
- package/lib/cjs/components/TimeField/TimeField.stories.js +2 -1
- package/lib/cjs/components/TimeField/timeFieldAttributes.d.ts +89 -0
- package/lib/cjs/components/TimeField/timeFieldAttributes.js +132 -0
- package/lib/cjs/components/TimeZonePicker/TimeZonePicker.stories.js +55 -0
- package/lib/cjs/components/TooltipTrigger/TooltipTrigger.stories.js +3 -1
- package/lib/cjs/components/TooltipTrigger/tooltipTriggerAttributes.d.ts +130 -0
- package/lib/cjs/components/TooltipTrigger/tooltipTriggerAttributes.js +90 -0
- package/lib/cjs/components/TreeView/TreeView.stories.js +61 -1
- package/lib/cjs/index.d.ts +2 -0
- package/lib/cjs/index.js +56 -37
- package/lib/cjs/styles/themes/next-gen/convertedComponentList.js +1 -1
- package/lib/cjs/types/index.d.ts +1 -0
- package/lib/cjs/types/index.js +32 -21
- package/lib/cjs/types/phoneNumberField.d.ts +45 -0
- package/lib/cjs/types/phoneNumberField.js +6 -0
- package/lib/cjs/utils/designUtils/figmaLinks.d.ts +3 -0
- package/lib/cjs/utils/designUtils/figmaLinks.js +3 -0
- package/lib/cjs/utils/testUtils/universalFormSubmitTest.js +25 -11
- package/lib/components/AIComponents/AIPanel/AIPanel.stories.js +3 -1
- package/lib/components/AIComponents/AIPanel/aiPanelAttributes.js +35 -0
- package/lib/components/AIComponents/Prompt/Prompt.stories.js +7 -1
- package/lib/components/AIComponents/Response/Response.stories.js +3 -1
- package/lib/components/AIComponents/Response/responseAttributes.js +20 -0
- package/lib/components/AIComponents/Suggestions/Suggestions.stories.js +18 -1
- package/lib/components/AccordionGroup/AccordionGroup.stories.js +4 -23
- package/lib/components/AccordionGroup/accordionGroupAttributes.js +22 -0
- package/lib/components/ArrayField/ArrayField.stories.js +2 -28
- package/lib/components/ArrayField/arrayFieldAttributes.js +39 -0
- package/lib/components/AstroProvider/AstroProvider.stories.js +21 -1
- package/lib/components/Avatar/Avatar.stories.js +2 -23
- package/lib/components/Avatar/avatarAttributes.js +23 -0
- package/lib/components/Bracket/Bracket.stories.js +2 -25
- package/lib/components/Bracket/bracketAttributes.js +25 -0
- package/lib/components/CheckboxField/CheckboxField.stories.js +2 -34
- package/lib/components/CheckboxField/checkboxFieldAttributes.js +45 -0
- package/lib/components/CollapsiblePanel/CollapsiblePanel.stories.js +13 -12
- package/lib/components/CollapsiblePanel/collapsiblePanelAttributes.js +12 -0
- package/lib/components/ColorField/ColorField.stories.js +2 -26
- package/lib/components/ColorField/colorFieldAttributes.js +37 -0
- package/lib/components/DataTable/DataTable.stories.js +2 -101
- package/lib/components/DataTable/dataTableAttributes.js +102 -0
- package/lib/components/ExpandableText/ExpandableText.stories.js +14 -1
- package/lib/components/ExpandableText/expandableTextAttributes.js +26 -0
- package/lib/components/Footer/Footer.stories.js +6 -0
- package/lib/components/Grid/Grid.stories.js +2 -19
- package/lib/components/Grid/gridAttributes.js +19 -0
- package/lib/components/IconBadge/IconBadge.stories.js +33 -1
- package/lib/components/IconButtonToggle/IconButtonToggle.stories.js +3 -1
- package/lib/components/IconButtonToggle/iconButtonToggleAttributes.js +56 -0
- package/lib/components/Image/Image.stories.js +2 -16
- package/lib/components/Image/imageAttributes.js +16 -0
- package/lib/components/Input/Input.stories.js +13 -6
- package/lib/components/Input/inputAttributes.js +6 -0
- package/lib/components/Label/Label.stories.js +2 -13
- package/lib/components/Label/labelAttributes.js +14 -0
- package/lib/components/Link/Link.stories.js +2 -33
- package/lib/components/Link/linkAttributes.js +33 -0
- package/lib/components/ListView/stories/ListViewOnyxDark.stories.js +52 -1
- package/lib/components/ListView/stories/listViewOnyxDarkAttributes.js +51 -0
- package/lib/components/Modal/Convenience/ModalBody.stories.js +14 -1
- package/lib/components/Modal/Convenience/ModalFooter.stories.js +14 -1
- package/lib/components/Modal/Convenience/ModalHeader.stories.js +14 -1
- package/lib/components/Modal/Convenience/modalBodyAttributes.js +35 -0
- package/lib/components/Modal/Convenience/modalFooterAttributes.js +44 -0
- package/lib/components/Modal/Convenience/modalHeaderAttributes.js +53 -0
- package/lib/components/Modal/Modal.stories.js +13 -56
- package/lib/components/Modal/modalAttributes.js +56 -0
- package/lib/components/NavBar/NavBar.stories.js +13 -0
- package/lib/components/NavBar/navBarAttributes.js +48 -0
- package/lib/components/NavBar/stories/NavBar.Onyx.stories.js +14 -1
- package/lib/components/NavBar/stories/navBarOnyxAttributes.js +42 -0
- package/lib/components/Pagination/Pagination.stories.js +2 -24
- package/lib/components/Pagination/paginationAttributes.js +24 -0
- package/lib/components/PhoneNumberField/PhoneNumberField.js +288 -0
- package/lib/components/PhoneNumberField/PhoneNumberField.mdx +32 -0
- package/lib/components/PhoneNumberField/PhoneNumberField.stories.js +126 -0
- package/lib/components/PhoneNumberField/PhoneNumberField.test.js +155 -0
- package/lib/components/PhoneNumberField/index.js +1 -0
- package/lib/components/PopoverMenu/PopoverMenu.stories.js +2 -13
- package/lib/components/PopoverMenu/popoverMenuAttributes.js +13 -0
- package/lib/components/ProgressBar/ProgressBar.stories.js +2 -27
- package/lib/components/ProgressBar/progressBarAttributes.js +58 -0
- package/lib/components/RadioGroupField/RadioGroupField.stories.js +2 -28
- package/lib/components/RadioGroupField/radioGroupFieldAttributes.js +39 -0
- package/lib/components/RangeCalendar/RangeCalendar.stories.js +2 -13
- package/lib/components/RangeCalendar/rangeCalendarAttributes.js +84 -0
- package/lib/components/SearchField/SearchField.stories.js +2 -27
- package/lib/components/SearchField/searchFieldAttributes.js +38 -0
- package/lib/components/SelectField/SelectField.stories.js +2 -41
- package/lib/components/SelectField/selectFieldAttributes.js +54 -0
- package/lib/components/Separator/Separator.stories.js +22 -1
- package/lib/components/ServerErrorBoundary/ServerErrorBoundary.stories.js +2 -0
- package/lib/components/ServerErrorBoundary/serverErrorBoundaryAttributes.js +47 -0
- package/lib/components/SliderField/SliderField.stories.js +2 -38
- package/lib/components/SliderField/sliderFieldAttributes.js +38 -0
- package/lib/components/StatusIcon/StatusIcon.stories.js +31 -0
- package/lib/components/Table/Table.stories.js +21 -4
- package/lib/components/TableBase/TableBase.stories.js +3 -1
- package/lib/components/TableBase/tableBaseAttributes.js +55 -0
- package/lib/components/Tabs/Tabs.stories.js +2 -18
- package/lib/components/Tabs/tabsAttributes.js +18 -0
- package/lib/components/Text/Text.stories.js +2 -26
- package/lib/components/Text/textAttributes.js +26 -0
- package/lib/components/TextAreaField/TextAreaField.stories.js +2 -41
- package/lib/components/TextAreaField/textAreaFieldAttributes.js +54 -0
- package/lib/components/TimeField/TimeField.stories.js +2 -1
- package/lib/components/TimeField/timeFieldAttributes.js +125 -0
- package/lib/components/TimeZonePicker/TimeZonePicker.stories.js +56 -0
- package/lib/components/TooltipTrigger/TooltipTrigger.stories.js +3 -1
- package/lib/components/TooltipTrigger/tooltipTriggerAttributes.js +83 -0
- package/lib/components/TreeView/TreeView.stories.js +60 -0
- package/lib/index.js +2 -0
- package/lib/styles/themes/next-gen/convertedComponentList.js +1 -1
- package/lib/types/index.js +1 -0
- package/lib/types/phoneNumberField.js +1 -0
- package/lib/utils/designUtils/figmaLinks.js +3 -0
- package/lib/utils/testUtils/universalFormSubmitTest.js +25 -11
- package/package.json +1 -1
|
@@ -1,12 +1,23 @@
|
|
|
1
|
+
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
2
|
+
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
|
3
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
4
|
+
import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
|
|
5
|
+
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
6
|
+
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
|
7
|
+
import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
|
|
8
|
+
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
|
1
9
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
|
2
10
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
|
11
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
|
12
|
+
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3
14
|
import React, { useState } from 'react';
|
|
4
15
|
import DocsLayout from '../../../.storybook/storybookDocsLayout';
|
|
5
16
|
import { useGetTheme, useModalState } from '../../hooks';
|
|
6
17
|
import { Box, Button, ComboBoxField, Item, Menu, Modal, ModalBody, ModalFooter, ModalHeader, OverlayProvider, PopoverMenu, RadioField, RadioGroupField, SearchField, SelectField, Text } from '../../index';
|
|
7
18
|
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks';
|
|
8
|
-
import { modalSizes } from '../../utils/devUtils/constants/modalSizes';
|
|
9
19
|
import ModalReadme from './Modal.mdx';
|
|
20
|
+
import { modalArgTypes } from './modalAttributes';
|
|
10
21
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
11
22
|
export default {
|
|
12
23
|
title: 'Components/Modal',
|
|
@@ -18,61 +29,7 @@ export default {
|
|
|
18
29
|
}
|
|
19
30
|
}
|
|
20
31
|
},
|
|
21
|
-
argTypes: {
|
|
22
|
-
title: {
|
|
23
|
-
control: {
|
|
24
|
-
type: 'text'
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
role: {},
|
|
28
|
-
id: {
|
|
29
|
-
control: {
|
|
30
|
-
type: 'text'
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
size: {
|
|
34
|
-
control: {
|
|
35
|
-
type: 'select',
|
|
36
|
-
options: modalSizes
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
hasCloseButton: {},
|
|
40
|
-
isClosedOnBlur: {},
|
|
41
|
-
isDismissable: {},
|
|
42
|
-
isKeyboardDismissDisabled: {},
|
|
43
|
-
'aria-label': {
|
|
44
|
-
control: {
|
|
45
|
-
type: 'text'
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
'aria-labelledby': {
|
|
49
|
-
control: {
|
|
50
|
-
type: 'text'
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
'aria-describedby': {
|
|
54
|
-
control: {
|
|
55
|
-
type: 'text'
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
'aria-details': {
|
|
59
|
-
control: {
|
|
60
|
-
type: 'text'
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
closeButton: {
|
|
64
|
-
control: false
|
|
65
|
-
},
|
|
66
|
-
isOpen: {
|
|
67
|
-
control: false
|
|
68
|
-
},
|
|
69
|
-
contentProps: {
|
|
70
|
-
control: false
|
|
71
|
-
},
|
|
72
|
-
containerProps: {
|
|
73
|
-
control: false
|
|
74
|
-
}
|
|
75
|
-
},
|
|
32
|
+
argTypes: _objectSpread({}, modalArgTypes),
|
|
76
33
|
args: {
|
|
77
34
|
hasCloseButton: true,
|
|
78
35
|
hasAutoFocus: true
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { modalSizes } from '../../utils/devUtils/constants/modalSizes';
|
|
2
|
+
export var modalArgTypes = {
|
|
3
|
+
title: {
|
|
4
|
+
control: {
|
|
5
|
+
type: 'text'
|
|
6
|
+
}
|
|
7
|
+
},
|
|
8
|
+
role: {},
|
|
9
|
+
id: {
|
|
10
|
+
control: {
|
|
11
|
+
type: 'text'
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
size: {
|
|
15
|
+
control: {
|
|
16
|
+
type: 'select',
|
|
17
|
+
options: modalSizes
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
hasCloseButton: {},
|
|
21
|
+
isClosedOnBlur: {},
|
|
22
|
+
isDismissable: {},
|
|
23
|
+
isKeyboardDismissDisabled: {},
|
|
24
|
+
'aria-label': {
|
|
25
|
+
control: {
|
|
26
|
+
type: 'text'
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
'aria-labelledby': {
|
|
30
|
+
control: {
|
|
31
|
+
type: 'text'
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
'aria-describedby': {
|
|
35
|
+
control: {
|
|
36
|
+
type: 'text'
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
'aria-details': {
|
|
40
|
+
control: {
|
|
41
|
+
type: 'text'
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
closeButton: {
|
|
45
|
+
control: false
|
|
46
|
+
},
|
|
47
|
+
isOpen: {
|
|
48
|
+
control: false
|
|
49
|
+
},
|
|
50
|
+
contentProps: {
|
|
51
|
+
control: false
|
|
52
|
+
},
|
|
53
|
+
containerProps: {
|
|
54
|
+
control: false
|
|
55
|
+
}
|
|
56
|
+
};
|
|
@@ -1,5 +1,16 @@
|
|
|
1
|
+
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
2
|
+
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
|
3
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
4
|
+
import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
|
|
5
|
+
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
6
|
+
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
|
7
|
+
import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
|
|
8
|
+
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
|
1
9
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
|
2
10
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
|
11
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
|
12
|
+
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3
14
|
import React, { useState } from 'react';
|
|
4
15
|
import AccountCheckIcon from '@pingux/mdi-react/AccountCheckOutlineIcon';
|
|
5
16
|
import AccountMultiple from '@pingux/mdi-react/AccountMultipleIcon';
|
|
@@ -30,6 +41,7 @@ import { Box, Link, NavBar, NavBarItem, NavBarItemButton, NavBarItemLink, NavBar
|
|
|
30
41
|
import { useGetTheme } from '../../hooks';
|
|
31
42
|
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks';
|
|
32
43
|
import NavBarReadme from './NavBar.mdx';
|
|
44
|
+
import { navBarArgTypes } from './navBarAttributes';
|
|
33
45
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
34
46
|
export default {
|
|
35
47
|
component: NavBar,
|
|
@@ -47,6 +59,7 @@ export default {
|
|
|
47
59
|
NavBarItemButton: NavBarItemButton
|
|
48
60
|
},
|
|
49
61
|
title: 'Components/NavBar',
|
|
62
|
+
argTypes: _objectSpread({}, navBarArgTypes),
|
|
50
63
|
parameters: {
|
|
51
64
|
layout: 'fullscreen',
|
|
52
65
|
docs: {
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
2
|
+
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
|
3
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
4
|
+
import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
|
|
5
|
+
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
6
|
+
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
|
7
|
+
import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
|
|
8
|
+
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
|
9
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
|
10
|
+
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
11
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
12
|
+
import { booleanArg, funcArg } from '../../utils/docUtils/docArgTypes';
|
|
13
|
+
export var navBarArgTypes = {
|
|
14
|
+
isAutoСollapsible: _objectSpread(_objectSpread({}, booleanArg), {}, {
|
|
15
|
+
description: 'Allows only one item to be expanded at a time (auto-collapse behavior).'
|
|
16
|
+
}),
|
|
17
|
+
hasRestoreFocus: _objectSpread(_objectSpread({}, booleanArg), {}, {
|
|
18
|
+
description: 'Whether or not the focus will return to the previously focused element upon unmount.'
|
|
19
|
+
}),
|
|
20
|
+
variant: {
|
|
21
|
+
control: {
|
|
22
|
+
type: 'select'
|
|
23
|
+
},
|
|
24
|
+
options: ['default', 'popupNav'],
|
|
25
|
+
description: 'Applies a style to the entire nav tree. Options are default and popupNav.'
|
|
26
|
+
},
|
|
27
|
+
defaultSelectedKey: {
|
|
28
|
+
control: {
|
|
29
|
+
type: 'text'
|
|
30
|
+
},
|
|
31
|
+
description: 'The initial selected key in the collection (uncontrolled).'
|
|
32
|
+
},
|
|
33
|
+
defaultExpandedKeys: {
|
|
34
|
+
control: false,
|
|
35
|
+
description: 'The initial expanded keys in the collection (uncontrolled).'
|
|
36
|
+
},
|
|
37
|
+
selectedKey: {
|
|
38
|
+
control: false,
|
|
39
|
+
description: 'The selected key in the collection (controlled).'
|
|
40
|
+
},
|
|
41
|
+
setSelectedKey: _objectSpread(_objectSpread({}, funcArg), {}, {
|
|
42
|
+
description: 'Callback function that fires when the selected key changes.'
|
|
43
|
+
}),
|
|
44
|
+
children: {
|
|
45
|
+
control: false,
|
|
46
|
+
description: 'Content to render inside the NavBar.'
|
|
47
|
+
}
|
|
48
|
+
};
|
|
@@ -1,10 +1,23 @@
|
|
|
1
|
+
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
2
|
+
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
|
3
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
4
|
+
import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
|
|
5
|
+
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
6
|
+
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
|
7
|
+
import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
|
|
8
|
+
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
|
9
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
|
10
|
+
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
11
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1
12
|
import React from 'react';
|
|
2
13
|
import { AstroProvider, OnyxSideNavOverride } from '../../..';
|
|
3
14
|
import uiLibraryOverride from '../../../styles/themeOverrides/uiLibraryOverride';
|
|
4
15
|
import { NavBarNextGenComponent } from './NavBarNextGenComponent';
|
|
16
|
+
import { navBarOnyxArgTypes } from './navBarOnyxAttributes';
|
|
5
17
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
6
18
|
export default {
|
|
7
|
-
title: 'Onyx SideBar First Steps'
|
|
19
|
+
title: 'Onyx SideBar First Steps',
|
|
20
|
+
argTypes: _objectSpread({}, navBarOnyxArgTypes)
|
|
8
21
|
};
|
|
9
22
|
export var Default = function Default() {
|
|
10
23
|
return ___EmotionJSX(AstroProvider, {
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
2
|
+
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
|
3
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
4
|
+
import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
|
|
5
|
+
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
6
|
+
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
|
7
|
+
import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
|
|
8
|
+
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
|
9
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
|
10
|
+
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
11
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
12
|
+
import { booleanArg, funcArg } from '../../../utils/docUtils/docArgTypes';
|
|
13
|
+
export var navBarOnyxArgTypes = {
|
|
14
|
+
isAutoСollapsible: _objectSpread(_objectSpread({}, booleanArg), {}, {
|
|
15
|
+
description: 'Allows only one item to be expanded at a time (auto-collapse behavior).'
|
|
16
|
+
}),
|
|
17
|
+
hasRestoreFocus: _objectSpread(_objectSpread({}, booleanArg), {}, {
|
|
18
|
+
description: 'Whether or not the focus will return to the previously focused element upon unmount.'
|
|
19
|
+
}),
|
|
20
|
+
variant: {
|
|
21
|
+
control: {
|
|
22
|
+
type: 'select'
|
|
23
|
+
},
|
|
24
|
+
options: ['default', 'popupNav'],
|
|
25
|
+
description: 'Applies a style to the entire nav tree. Options are default and popupNav.'
|
|
26
|
+
},
|
|
27
|
+
defaultSelectedKey: {
|
|
28
|
+
control: {
|
|
29
|
+
type: 'text'
|
|
30
|
+
},
|
|
31
|
+
description: 'The initial selected key in the collection (uncontrolled).'
|
|
32
|
+
},
|
|
33
|
+
setSelectedKey: _objectSpread(_objectSpread({}, funcArg), {}, {
|
|
34
|
+
description: 'Callback function that fires when the selected key changes.'
|
|
35
|
+
}),
|
|
36
|
+
children: {
|
|
37
|
+
control: {
|
|
38
|
+
type: null
|
|
39
|
+
},
|
|
40
|
+
description: 'Content to render inside the NavBar.'
|
|
41
|
+
}
|
|
42
|
+
};
|
|
@@ -8,6 +8,7 @@ import usePaginationState from '../../hooks/usePaginationState';
|
|
|
8
8
|
import { Box, Button, Item, ListView, ListViewItem, Pagination, PaginationProvider, ScrollBox } from '../../index';
|
|
9
9
|
import animals from '../../utils/devUtils/constants/animals';
|
|
10
10
|
import PaginationReadme from './Pagination.mdx';
|
|
11
|
+
import { paginationArgTypes } from './paginationAttributes';
|
|
11
12
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
12
13
|
export default {
|
|
13
14
|
title: 'Components/Pagination',
|
|
@@ -19,30 +20,7 @@ export default {
|
|
|
19
20
|
}
|
|
20
21
|
}
|
|
21
22
|
},
|
|
22
|
-
argTypes:
|
|
23
|
-
totalCount: {
|
|
24
|
-
control: {
|
|
25
|
-
type: 'number'
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
currentPageIndex: {
|
|
29
|
-
control: {
|
|
30
|
-
type: 'number'
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
offsetCount: {
|
|
34
|
-
control: {
|
|
35
|
-
type: 'number'
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
offsetOptions: {
|
|
39
|
-
control: {
|
|
40
|
-
type: 'array'
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
onPageIndexChange: {},
|
|
44
|
-
onOffsetCountChange: {}
|
|
45
|
-
}
|
|
23
|
+
argTypes: paginationArgTypes
|
|
46
24
|
};
|
|
47
25
|
var ExampleComponent = function ExampleComponent() {
|
|
48
26
|
var _context;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export var paginationArgTypes = {
|
|
2
|
+
totalCount: {
|
|
3
|
+
control: {
|
|
4
|
+
type: 'number'
|
|
5
|
+
}
|
|
6
|
+
},
|
|
7
|
+
currentPageIndex: {
|
|
8
|
+
control: {
|
|
9
|
+
type: 'number'
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
offsetCount: {
|
|
13
|
+
control: {
|
|
14
|
+
type: 'number'
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
offsetOptions: {
|
|
18
|
+
control: {
|
|
19
|
+
type: 'array'
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
onPageIndexChange: {},
|
|
23
|
+
onOffsetCountChange: {}
|
|
24
|
+
};
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
|
4
|
+
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
|
5
|
+
var _excluded = ["countryValue", "defaultCountryValue", "helperText", "isReadOnly", "labelMode", "onCountryChange", "status"];
|
|
6
|
+
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context6 = ownKeys(Object(t), !0)).call(_context6, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context7 = ownKeys(Object(t))).call(_context7, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
|
+
import _Object$entries from "@babel/runtime-corejs3/core-js-stable/object/entries";
|
|
9
|
+
import _startsWithInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/starts-with";
|
|
10
|
+
import _trimStartInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/trim-start";
|
|
11
|
+
import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find";
|
|
12
|
+
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
13
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
14
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
15
|
+
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
16
|
+
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
17
|
+
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
|
18
|
+
import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
|
|
19
|
+
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
20
|
+
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
|
21
|
+
import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
|
|
22
|
+
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
|
23
|
+
import React, { forwardRef, useCallback, useState } from 'react';
|
|
24
|
+
import { useFilter } from '@react-aria/i18n';
|
|
25
|
+
import { countries as countriesObj } from 'countries-list';
|
|
26
|
+
import { v4 as uuid } from 'uuid';
|
|
27
|
+
import { Box, ComboBoxField, FieldHelperText, Input, Item, Label } from '../..';
|
|
28
|
+
import { useField, useLocalOrForwardRef, usePropWarning } from '../../hooks';
|
|
29
|
+
import { getPendoID } from '../../utils/devUtils/constants/pendoID';
|
|
30
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
31
|
+
var displayName = 'PhoneNumberField';
|
|
32
|
+
var validatePhoneNumber = function validatePhoneNumber(str) {
|
|
33
|
+
return /^$|^\+\d*$|^\d+$/.test(str);
|
|
34
|
+
};
|
|
35
|
+
var allCountries = _Object$entries(countriesObj);
|
|
36
|
+
var getCountry = function getCountry(key) {
|
|
37
|
+
return countriesObj[key];
|
|
38
|
+
};
|
|
39
|
+
var primaryDial = function primaryDial(key) {
|
|
40
|
+
var _getCountry$phone$spl, _getCountry;
|
|
41
|
+
return (_getCountry$phone$spl = (_getCountry = getCountry(key)) === null || _getCountry === void 0 ? void 0 : _getCountry.phone.split(',')[0]) !== null && _getCountry$phone$spl !== void 0 ? _getCountry$phone$spl : '';
|
|
42
|
+
};
|
|
43
|
+
var toDialCode = function toDialCode(key) {
|
|
44
|
+
var dial = primaryDial(key);
|
|
45
|
+
return dial ? "+".concat(dial) : '';
|
|
46
|
+
};
|
|
47
|
+
var parsePaste = function parsePaste(raw) {
|
|
48
|
+
var _context;
|
|
49
|
+
var digitsOnly = raw.replace(/\D/g, '');
|
|
50
|
+
if (_startsWithInstanceProperty(_context = _trimStartInstanceProperty(raw).call(raw)).call(_context, '+')) {
|
|
51
|
+
var match = _findInstanceProperty(allCountries).call(allCountries, function (_ref) {
|
|
52
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
53
|
+
c = _ref2[1];
|
|
54
|
+
return _startsWithInstanceProperty(digitsOnly).call(digitsOnly, c.phone.split(',')[0]);
|
|
55
|
+
});
|
|
56
|
+
if (match) {
|
|
57
|
+
var dialLen = match[1].phone.split(',')[0].length;
|
|
58
|
+
return {
|
|
59
|
+
countryKey: match[0],
|
|
60
|
+
localNumber: _sliceInstanceProperty(digitsOnly).call(digitsOnly, dialLen)
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
countryKey: null,
|
|
66
|
+
localNumber: digitsOnly
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
var closedState = function closedState(selectedKey) {
|
|
70
|
+
var dialCode = selectedKey ? toDialCode(selectedKey) : '';
|
|
71
|
+
return {
|
|
72
|
+
isOpen: false,
|
|
73
|
+
inputValue: dialCode,
|
|
74
|
+
searchValue: dialCode,
|
|
75
|
+
items: allCountries
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
var PhoneNumberField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
79
|
+
var countryValue = props.countryValue,
|
|
80
|
+
defaultCountryValue = props.defaultCountryValue,
|
|
81
|
+
helperText = props.helperText,
|
|
82
|
+
isReadOnly = props.isReadOnly,
|
|
83
|
+
labelMode = props.labelMode,
|
|
84
|
+
onCountryChange = props.onCountryChange,
|
|
85
|
+
status = props.status,
|
|
86
|
+
others = _objectWithoutProperties(props, _excluded);
|
|
87
|
+
var _useField = useField(_objectSpread({
|
|
88
|
+
status: status,
|
|
89
|
+
isReadOnly: isReadOnly,
|
|
90
|
+
labelMode: labelMode
|
|
91
|
+
}, others)),
|
|
92
|
+
fieldContainerProps = _useField.fieldContainerProps,
|
|
93
|
+
fieldControlInputProps = _useField.fieldControlInputProps,
|
|
94
|
+
fieldControlWrapperProps = _useField.fieldControlWrapperProps,
|
|
95
|
+
fieldLabelProps = _useField.fieldLabelProps;
|
|
96
|
+
var onChange = fieldControlInputProps.onChange;
|
|
97
|
+
var inputRef = useLocalOrForwardRef(ref);
|
|
98
|
+
var helperTextId = uuid();
|
|
99
|
+
usePropWarning(props, 'disabled', 'isDisabled');
|
|
100
|
+
var _useFilter = useFilter({
|
|
101
|
+
sensitivity: 'base'
|
|
102
|
+
}),
|
|
103
|
+
contains = _useFilter.contains;
|
|
104
|
+
var _useState = useState(function () {
|
|
105
|
+
var key = countryValue !== null && countryValue !== void 0 ? countryValue : defaultCountryValue;
|
|
106
|
+
if (key && getCountry(key)) {
|
|
107
|
+
var dialCode = toDialCode(key);
|
|
108
|
+
return {
|
|
109
|
+
inputValue: dialCode,
|
|
110
|
+
selectedKey: key,
|
|
111
|
+
searchValue: dialCode,
|
|
112
|
+
items: allCountries,
|
|
113
|
+
isOpen: false
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
inputValue: '',
|
|
118
|
+
selectedKey: null,
|
|
119
|
+
searchValue: '',
|
|
120
|
+
items: allCountries,
|
|
121
|
+
isOpen: false
|
|
122
|
+
};
|
|
123
|
+
}),
|
|
124
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
125
|
+
fieldState = _useState2[0],
|
|
126
|
+
setFieldState = _useState2[1];
|
|
127
|
+
var isControlledCountry = countryValue !== undefined;
|
|
128
|
+
var currentSelectedKey = isControlledCountry ? countryValue !== null && countryValue !== void 0 ? countryValue : null : fieldState.selectedKey;
|
|
129
|
+
var closedDisplayValue = isControlledCountry ? toDialCode(countryValue !== null && countryValue !== void 0 ? countryValue : '') : fieldState.inputValue;
|
|
130
|
+
var currentCountryInputValue = fieldState.isOpen ? fieldState.searchValue : closedDisplayValue;
|
|
131
|
+
var inputHandler = useCallback(function (value) {
|
|
132
|
+
var search = value.toLowerCase();
|
|
133
|
+
var newItems = value ? _filterInstanceProperty(allCountries).call(allCountries, function (_ref3) {
|
|
134
|
+
var _context2;
|
|
135
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
136
|
+
c = _ref4[1];
|
|
137
|
+
var nameStr = _concatInstanceProperty(_context2 = "".concat(c.name)).call(_context2, c.name !== c["native"] ? " (".concat(c["native"], ")") : '');
|
|
138
|
+
var dialStr = "+".concat(c.phone.split(',')[0]).toLowerCase();
|
|
139
|
+
return contains(nameStr, value) || _includesInstanceProperty(dialStr).call(dialStr, search);
|
|
140
|
+
}) : allCountries;
|
|
141
|
+
setFieldState(function (prev) {
|
|
142
|
+
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
143
|
+
inputValue: value,
|
|
144
|
+
selectedKey: null,
|
|
145
|
+
searchValue: value,
|
|
146
|
+
items: newItems
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
}, [contains]);
|
|
150
|
+
var selectionHandler = useCallback(function (key) {
|
|
151
|
+
if (!key) return;
|
|
152
|
+
var dialCode = toDialCode(key);
|
|
153
|
+
setFieldState({
|
|
154
|
+
inputValue: dialCode,
|
|
155
|
+
selectedKey: key,
|
|
156
|
+
searchValue: dialCode,
|
|
157
|
+
items: allCountries,
|
|
158
|
+
isOpen: false
|
|
159
|
+
});
|
|
160
|
+
if (onCountryChange) onCountryChange(key);
|
|
161
|
+
}, [onCountryChange]);
|
|
162
|
+
var onOpenChangeHandler = useCallback(function (open) {
|
|
163
|
+
if (!open || isReadOnly) {
|
|
164
|
+
setFieldState(function (prev) {
|
|
165
|
+
return _objectSpread(_objectSpread({}, prev), closedState(prev.selectedKey));
|
|
166
|
+
});
|
|
167
|
+
} else {
|
|
168
|
+
setFieldState(function (prev) {
|
|
169
|
+
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
170
|
+
isOpen: true,
|
|
171
|
+
items: allCountries
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}, [isReadOnly]);
|
|
176
|
+
var handlePhoneChange = useCallback(function (e) {
|
|
177
|
+
if (!onChange) return;
|
|
178
|
+
if (validatePhoneNumber(e.target.value)) {
|
|
179
|
+
onChange(e);
|
|
180
|
+
} else if (inputRef.current) {
|
|
181
|
+
inputRef.current.value = '';
|
|
182
|
+
}
|
|
183
|
+
}, [inputRef, onChange]);
|
|
184
|
+
var commitPaste = useCallback(function (raw) {
|
|
185
|
+
if (!inputRef.current || !onChange) return;
|
|
186
|
+
var _parsePaste = parsePaste(raw),
|
|
187
|
+
countryKey = _parsePaste.countryKey,
|
|
188
|
+
localNumber = _parsePaste.localNumber;
|
|
189
|
+
if (countryKey) selectionHandler(countryKey);
|
|
190
|
+
inputRef.current.value = localNumber;
|
|
191
|
+
var event = {
|
|
192
|
+
target: inputRef.current,
|
|
193
|
+
currentTarget: inputRef.current
|
|
194
|
+
};
|
|
195
|
+
onChange(event);
|
|
196
|
+
}, [inputRef, onChange, selectionHandler]);
|
|
197
|
+
var handlePhonePaste = useCallback(function (e) {
|
|
198
|
+
if (isReadOnly) return;
|
|
199
|
+
e.preventDefault();
|
|
200
|
+
commitPaste(e.clipboardData.getData('text'));
|
|
201
|
+
}, [isReadOnly, commitPaste]);
|
|
202
|
+
var handleComboBoxPaste = useCallback(function (e) {
|
|
203
|
+
var _context3;
|
|
204
|
+
if (isReadOnly) return;
|
|
205
|
+
var raw = e.clipboardData.getData('text');
|
|
206
|
+
if (!_startsWithInstanceProperty(_context3 = _trimStartInstanceProperty(raw).call(raw)).call(_context3, '+')) return;
|
|
207
|
+
e.preventDefault();
|
|
208
|
+
commitPaste(raw);
|
|
209
|
+
}, [isReadOnly, commitPaste]);
|
|
210
|
+
var comboBoxWrapperSx = _objectSpread({
|
|
211
|
+
position: 'absolute',
|
|
212
|
+
zIndex: 1
|
|
213
|
+
}, fieldState.isOpen ? {
|
|
214
|
+
width: '100%'
|
|
215
|
+
} : {
|
|
216
|
+
transition: '0.2s width ease',
|
|
217
|
+
width: '110px'
|
|
218
|
+
});
|
|
219
|
+
var countryLabel = function countryLabel(c) {
|
|
220
|
+
var _context4, _context5;
|
|
221
|
+
return _concatInstanceProperty(_context4 = _concatInstanceProperty(_context5 = "".concat(c.name)).call(_context5, c.name !== c["native"] ? " (".concat(c["native"], ")") : '', " +")).call(_context4, c.phone.split(',')[0]);
|
|
222
|
+
};
|
|
223
|
+
return ___EmotionJSX(Box, _extends({
|
|
224
|
+
variant: "forms.input.fieldContainer"
|
|
225
|
+
}, getPendoID(displayName), fieldContainerProps), ___EmotionJSX(Label, fieldLabelProps), ___EmotionJSX(Box, _extends({
|
|
226
|
+
variant: "forms.input.fieldControlWrapper",
|
|
227
|
+
isRow: true
|
|
228
|
+
}, fieldControlWrapperProps, {
|
|
229
|
+
sx: {
|
|
230
|
+
position: 'relative'
|
|
231
|
+
}
|
|
232
|
+
}), ___EmotionJSX(ComboBoxField, {
|
|
233
|
+
width: "100%",
|
|
234
|
+
status: status,
|
|
235
|
+
isReadOnly: isReadOnly,
|
|
236
|
+
isOpen: fieldState.isOpen,
|
|
237
|
+
onOpenChange: onOpenChangeHandler,
|
|
238
|
+
wrapperProps: {
|
|
239
|
+
sx: comboBoxWrapperSx
|
|
240
|
+
},
|
|
241
|
+
controlProps: {
|
|
242
|
+
'aria-label': 'Country Picker',
|
|
243
|
+
onPaste: handleComboBoxPaste
|
|
244
|
+
},
|
|
245
|
+
containerProps: {
|
|
246
|
+
sx: {
|
|
247
|
+
'> label': {
|
|
248
|
+
mb: 0
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
scrollBoxProps: {
|
|
253
|
+
maxHeight: '215px',
|
|
254
|
+
sx: {
|
|
255
|
+
minWidth: '280px'
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
items: fieldState.items,
|
|
259
|
+
inputValue: currentCountryInputValue,
|
|
260
|
+
selectedKey: currentSelectedKey,
|
|
261
|
+
onInputChange: inputHandler,
|
|
262
|
+
onSelectionChange: selectionHandler,
|
|
263
|
+
menuTrigger: "focus",
|
|
264
|
+
isDisabled: fieldControlInputProps.disabled
|
|
265
|
+
}, function (item) {
|
|
266
|
+
return ___EmotionJSX(Item, {
|
|
267
|
+
key: item[0],
|
|
268
|
+
textValue: "+".concat(item[1].phone.split(',')[0])
|
|
269
|
+
}, countryLabel(item[1]));
|
|
270
|
+
}), ___EmotionJSX(Box, {
|
|
271
|
+
sx: {
|
|
272
|
+
ml: '110px',
|
|
273
|
+
width: '100%',
|
|
274
|
+
visibility: fieldState.isOpen ? 'hidden' : undefined
|
|
275
|
+
}
|
|
276
|
+
}, ___EmotionJSX(Input, _extends({
|
|
277
|
+
ref: inputRef
|
|
278
|
+
}, fieldControlInputProps, {
|
|
279
|
+
"aria-describedby": [helperText && helperTextId, fieldControlInputProps['aria-describedby']].join(fieldControlInputProps['aria-describedby'] ? ' ' : '') || undefined,
|
|
280
|
+
onChange: handlePhoneChange,
|
|
281
|
+
onPaste: handlePhonePaste
|
|
282
|
+
})))), helperText && ___EmotionJSX(FieldHelperText, {
|
|
283
|
+
status: status,
|
|
284
|
+
id: helperTextId
|
|
285
|
+
}, helperText));
|
|
286
|
+
});
|
|
287
|
+
PhoneNumberField.displayName = displayName;
|
|
288
|
+
export default PhoneNumberField;
|