@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
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Meta } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import * as PhoneNumberFieldStories from './PhoneNumberField.stories';
|
|
3
|
+
import AccessibilityTable from '../../utils/docUtils/AccessibilityTable';
|
|
4
|
+
import { KeyboardRows } from '../../utils/docUtils/accessibilityTableConstants';
|
|
5
|
+
|
|
6
|
+
<Meta of={PhoneNumberFieldStories} isTemplate />
|
|
7
|
+
|
|
8
|
+
# PhoneNumberField
|
|
9
|
+
|
|
10
|
+
The PhoneNumberField component combines a country selector with a phone number input, providing a complete, form-ready solution for collecting international phone numbers. The country selector is an accessible combo box that filters all countries from the `countries-list` package, and the phone input validates that only numeric characters (with an optional leading `+`) are entered.
|
|
11
|
+
|
|
12
|
+
### Required components
|
|
13
|
+
|
|
14
|
+
This component requires the following dependency to be present in the project:
|
|
15
|
+
|
|
16
|
+
- **`countries-list ^2.6.1`** — provides the full list of countries and their dial codes used to populate the country selector dropdown.
|
|
17
|
+
|
|
18
|
+
The `ComboBoxField` component (from the Astro design system) is used internally for the country selector. No additional external setup is needed beyond having `countries-list` installed.
|
|
19
|
+
|
|
20
|
+
### Accessibility
|
|
21
|
+
|
|
22
|
+
<AccessibilityTable keyboardRows={[
|
|
23
|
+
{ key: 'Tab', description: 'Moves focus between the country selector trigger and the phone number input, following the page tab sequence.' },
|
|
24
|
+
KeyboardRows.shiftTabFocusPrevious,
|
|
25
|
+
{ key: 'Arrow Down / Arrow Up', description: 'When the country selector dropdown is open, moves focus through the list of countries.' },
|
|
26
|
+
{ key: 'Enter', description: 'Selects the currently focused country in the dropdown and closes the selector.' },
|
|
27
|
+
{ key: 'Escape', description: 'Closes the country selector dropdown without changing the selection.' },
|
|
28
|
+
]} screenReaderRows={[
|
|
29
|
+
'The phone number input uses the **`aria-labelledby`** attribute to reference the field label ID, associating the visible label with the input.',
|
|
30
|
+
'The country selector combo box uses the **`aria-label`** attribute (value: `"Country Picker"`) to provide an accessible name for the combo box trigger, since its visible content is the dial code rather than a descriptive label.',
|
|
31
|
+
'The **`aria-invalid`** attribute is set on the phone input when the field has an error status.',
|
|
32
|
+
]} />
|
|
@@ -0,0 +1,126 @@
|
|
|
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 _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
|
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; }
|
|
14
|
+
import React, { useState } from 'react';
|
|
15
|
+
import DocsLayout from '../../../.storybook/storybookDocsLayout';
|
|
16
|
+
import { PhoneNumberField } from '../../index';
|
|
17
|
+
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks';
|
|
18
|
+
import { ariaAttributeBaseArgTypes } from '../../utils/docUtils/ariaAttributes';
|
|
19
|
+
import { inputFieldAttributeBaseArgTypes } from '../../utils/docUtils/fieldAttributes';
|
|
20
|
+
import { statusArgTypes } from '../../utils/docUtils/statusProp';
|
|
21
|
+
import PhoneNumberFieldReadme from './PhoneNumberField.mdx';
|
|
22
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
23
|
+
export default {
|
|
24
|
+
title: 'Form/PhoneNumberField',
|
|
25
|
+
component: PhoneNumberField,
|
|
26
|
+
parameters: {
|
|
27
|
+
docs: {
|
|
28
|
+
page: function page() {
|
|
29
|
+
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(PhoneNumberFieldReadme, null), ___EmotionJSX(DocsLayout, null));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
argTypes: _objectSpread(_objectSpread(_objectSpread({}, statusArgTypes), ariaAttributeBaseArgTypes), inputFieldAttributeBaseArgTypes)
|
|
34
|
+
};
|
|
35
|
+
export var Default = function Default(args) {
|
|
36
|
+
return ___EmotionJSX(PhoneNumberField, _extends({
|
|
37
|
+
label: "Phone Number"
|
|
38
|
+
}, args));
|
|
39
|
+
};
|
|
40
|
+
Default.parameters = {
|
|
41
|
+
design: {
|
|
42
|
+
type: 'figma',
|
|
43
|
+
url: FIGMA_LINKS.phoneNumberField["default"]
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
export var Controlled = function Controlled() {
|
|
47
|
+
var _useState = useState(''),
|
|
48
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
49
|
+
value = _useState2[0],
|
|
50
|
+
setValue = _useState2[1];
|
|
51
|
+
var _useState3 = useState(undefined),
|
|
52
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
53
|
+
countryValue = _useState4[0],
|
|
54
|
+
setCountryValue = _useState4[1];
|
|
55
|
+
return ___EmotionJSX(PhoneNumberField, {
|
|
56
|
+
label: "Phone Number",
|
|
57
|
+
value: value,
|
|
58
|
+
onChange: function onChange(e) {
|
|
59
|
+
return setValue(e.target.value);
|
|
60
|
+
},
|
|
61
|
+
countryValue: countryValue,
|
|
62
|
+
onCountryChange: function onCountryChange(key) {
|
|
63
|
+
return setCountryValue(key);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
export var Disabled = function Disabled(args) {
|
|
68
|
+
return ___EmotionJSX(PhoneNumberField, _extends({
|
|
69
|
+
label: "Phone Number",
|
|
70
|
+
isDisabled: true
|
|
71
|
+
}, args));
|
|
72
|
+
};
|
|
73
|
+
export var ReadOnly = function ReadOnly(args) {
|
|
74
|
+
return ___EmotionJSX(PhoneNumberField, _extends({
|
|
75
|
+
label: "Phone Number",
|
|
76
|
+
isReadOnly: true,
|
|
77
|
+
defaultCountryValue: "US",
|
|
78
|
+
value: "2025550177"
|
|
79
|
+
}, args));
|
|
80
|
+
};
|
|
81
|
+
export var Required = function Required(args) {
|
|
82
|
+
return ___EmotionJSX(PhoneNumberField, _extends({
|
|
83
|
+
label: "Phone Number",
|
|
84
|
+
isRequired: true
|
|
85
|
+
}, args));
|
|
86
|
+
};
|
|
87
|
+
export var Error = function Error(args) {
|
|
88
|
+
return ___EmotionJSX(PhoneNumberField, _extends({
|
|
89
|
+
label: "Phone Number",
|
|
90
|
+
status: "error",
|
|
91
|
+
helperText: "Please enter a valid phone number."
|
|
92
|
+
}, args));
|
|
93
|
+
};
|
|
94
|
+
export var Warning = function Warning(args) {
|
|
95
|
+
return ___EmotionJSX(PhoneNumberField, _extends({
|
|
96
|
+
label: "Phone Number",
|
|
97
|
+
status: "warning",
|
|
98
|
+
helperText: "Double-check the country code."
|
|
99
|
+
}, args));
|
|
100
|
+
};
|
|
101
|
+
Warning.parameters = {
|
|
102
|
+
a11y: {
|
|
103
|
+
config: {
|
|
104
|
+
rules: [{
|
|
105
|
+
id: 'color-contrast',
|
|
106
|
+
enabled: false
|
|
107
|
+
}]
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
export var Success = function Success(args) {
|
|
112
|
+
return ___EmotionJSX(PhoneNumberField, _extends({
|
|
113
|
+
label: "Phone Number",
|
|
114
|
+
status: "success",
|
|
115
|
+
helperText: "Phone number verified."
|
|
116
|
+
}, args));
|
|
117
|
+
};
|
|
118
|
+
export var WithHelpHint = function WithHelpHint(args) {
|
|
119
|
+
return ___EmotionJSX(PhoneNumberField, _extends({
|
|
120
|
+
label: "Phone Number",
|
|
121
|
+
hintText: "Include country code for international numbers.",
|
|
122
|
+
helpHintProps: {
|
|
123
|
+
direction: 'right'
|
|
124
|
+
}
|
|
125
|
+
}, args));
|
|
126
|
+
};
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { createEvent, fireEvent, render, screen } from '@testing-library/react';
|
|
4
|
+
import { universalComponentTests } from '../../utils/testUtils/universalComponentTest';
|
|
5
|
+
import { universalFieldComponentTests } from '../../utils/testUtils/universalFormSubmitTest';
|
|
6
|
+
import PhoneNumberField from '.';
|
|
7
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
8
|
+
var testId = 'test-phone-number-field';
|
|
9
|
+
var testLabel = 'Test Label';
|
|
10
|
+
var defaultProps = {
|
|
11
|
+
'data-testid': testId,
|
|
12
|
+
label: testLabel
|
|
13
|
+
};
|
|
14
|
+
var getComponent = function getComponent() {
|
|
15
|
+
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
16
|
+
return render(___EmotionJSX(PhoneNumberField, _extends({}, defaultProps, props)));
|
|
17
|
+
};
|
|
18
|
+
universalFieldComponentTests({
|
|
19
|
+
renderComponent: function renderComponent(props) {
|
|
20
|
+
return ___EmotionJSX(PhoneNumberField, _extends({}, defaultProps, props));
|
|
21
|
+
},
|
|
22
|
+
testValue: '+12345678',
|
|
23
|
+
testLabel: testLabel,
|
|
24
|
+
componentType: 'PhoneNumberField'
|
|
25
|
+
});
|
|
26
|
+
universalComponentTests({
|
|
27
|
+
renderComponent: function renderComponent(props) {
|
|
28
|
+
return ___EmotionJSX(PhoneNumberField, _extends({}, defaultProps, props));
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
afterEach(function () {
|
|
32
|
+
jest.clearAllMocks();
|
|
33
|
+
});
|
|
34
|
+
test('default render has label, phone input, and country combobox', function () {
|
|
35
|
+
getComponent();
|
|
36
|
+
expect(screen.getByTestId(testId)).toBeInTheDocument();
|
|
37
|
+
expect(screen.getByText(testLabel)).toBeInstanceOf(HTMLLabelElement);
|
|
38
|
+
expect(screen.getByRole('textbox')).toBeInTheDocument();
|
|
39
|
+
expect(screen.getByRole('combobox')).toBeInTheDocument();
|
|
40
|
+
});
|
|
41
|
+
test('typing a non-numeric character does not update phone input value', function () {
|
|
42
|
+
getComponent();
|
|
43
|
+
var phoneInput = screen.getByRole('textbox');
|
|
44
|
+
fireEvent.change(phoneInput, {
|
|
45
|
+
target: {
|
|
46
|
+
value: 'a'
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
expect(phoneInput).toHaveValue('');
|
|
50
|
+
});
|
|
51
|
+
test('typing a "+" character is accepted', function () {
|
|
52
|
+
getComponent();
|
|
53
|
+
var phoneInput = screen.getByRole('textbox');
|
|
54
|
+
fireEvent.change(phoneInput, {
|
|
55
|
+
target: {
|
|
56
|
+
value: '+'
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
expect(phoneInput).toHaveValue('+');
|
|
60
|
+
});
|
|
61
|
+
test('typing "+" followed by digits is valid', function () {
|
|
62
|
+
getComponent();
|
|
63
|
+
var phoneInput = screen.getByRole('textbox');
|
|
64
|
+
fireEvent.change(phoneInput, {
|
|
65
|
+
target: {
|
|
66
|
+
value: '+123'
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
expect(phoneInput).toHaveValue('+123');
|
|
70
|
+
});
|
|
71
|
+
test('typing "+" followed by a letter is not accepted', function () {
|
|
72
|
+
getComponent();
|
|
73
|
+
var phoneInput = screen.getByRole('textbox');
|
|
74
|
+
fireEvent.change(phoneInput, {
|
|
75
|
+
target: {
|
|
76
|
+
value: '+a'
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
expect(phoneInput).toHaveValue('');
|
|
80
|
+
});
|
|
81
|
+
test('pasting a string with spaces and dashes strips non-numeric characters and dial code', function () {
|
|
82
|
+
getComponent();
|
|
83
|
+
var phoneInput = screen.getByRole('textbox');
|
|
84
|
+
var pasteEvent = createEvent.paste(phoneInput, {
|
|
85
|
+
clipboardData: {
|
|
86
|
+
getData: function getData() {
|
|
87
|
+
return '+1 (800) 555-1234';
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
fireEvent(phoneInput, pasteEvent);
|
|
92
|
+
expect(phoneInput).toHaveValue('8005551234');
|
|
93
|
+
});
|
|
94
|
+
test('pasting a string without leading "+" strips all non-numeric characters', function () {
|
|
95
|
+
getComponent();
|
|
96
|
+
var phoneInput = screen.getByRole('textbox');
|
|
97
|
+
var pasteEvent = createEvent.paste(phoneInput, {
|
|
98
|
+
clipboardData: {
|
|
99
|
+
getData: function getData() {
|
|
100
|
+
return '800-555-1234';
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
fireEvent(phoneInput, pasteEvent);
|
|
105
|
+
expect(phoneInput).toHaveValue('8005551234');
|
|
106
|
+
});
|
|
107
|
+
test('onChange callback is called with a valid phone number change', function () {
|
|
108
|
+
var onChange = jest.fn();
|
|
109
|
+
getComponent({
|
|
110
|
+
onChange: onChange
|
|
111
|
+
});
|
|
112
|
+
var phoneInput = screen.getByRole('textbox');
|
|
113
|
+
fireEvent.change(phoneInput, {
|
|
114
|
+
target: {
|
|
115
|
+
value: '+12345678'
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
expect(onChange).toHaveBeenCalled();
|
|
119
|
+
});
|
|
120
|
+
test('onChange callback is not called when an invalid character is typed', function () {
|
|
121
|
+
var onChange = jest.fn();
|
|
122
|
+
getComponent({
|
|
123
|
+
onChange: onChange
|
|
124
|
+
});
|
|
125
|
+
var phoneInput = screen.getByRole('textbox');
|
|
126
|
+
fireEvent.change(phoneInput, {
|
|
127
|
+
target: {
|
|
128
|
+
value: 'abc'
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
expect(onChange).not.toHaveBeenCalled();
|
|
132
|
+
});
|
|
133
|
+
test('isDisabled disables the phone input', function () {
|
|
134
|
+
getComponent({
|
|
135
|
+
isDisabled: true
|
|
136
|
+
});
|
|
137
|
+
var phoneInput = screen.getByRole('textbox');
|
|
138
|
+
expect(phoneInput).toBeDisabled();
|
|
139
|
+
});
|
|
140
|
+
test('helperText renders FieldHelperText content', function () {
|
|
141
|
+
var helperText = 'Enter your phone number';
|
|
142
|
+
getComponent({
|
|
143
|
+
helperText: helperText
|
|
144
|
+
});
|
|
145
|
+
expect(screen.getByText(helperText)).toBeInTheDocument();
|
|
146
|
+
});
|
|
147
|
+
test('controlled countryValue sets initial selected country', function () {
|
|
148
|
+
getComponent({
|
|
149
|
+
countryValue: 'US'
|
|
150
|
+
});
|
|
151
|
+
var phoneInput = screen.getByRole('textbox');
|
|
152
|
+
expect(phoneInput).toBeInTheDocument();
|
|
153
|
+
// The combobox should be present and the phone input available
|
|
154
|
+
expect(screen.getByRole('combobox')).toBeInTheDocument();
|
|
155
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './PhoneNumberField';
|
|
@@ -7,6 +7,7 @@ import { useGetTheme } from '../../hooks';
|
|
|
7
7
|
import { Icon, IconButton, Item, Menu, OverlayProvider, PopoverMenu, Section, Text } from '../../index';
|
|
8
8
|
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks';
|
|
9
9
|
import PopoverMenuReadme from './PopoverMenu.mdx';
|
|
10
|
+
import { popoverMenuArgTypes } from './popoverMenuAttributes';
|
|
10
11
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
11
12
|
export default {
|
|
12
13
|
title: 'Components/PopoverMenu',
|
|
@@ -18,19 +19,7 @@ export default {
|
|
|
18
19
|
}
|
|
19
20
|
}
|
|
20
21
|
},
|
|
21
|
-
argTypes:
|
|
22
|
-
align: {},
|
|
23
|
-
direction: {},
|
|
24
|
-
isDefaultOpen: {},
|
|
25
|
-
isNotClosedOnSelect: {},
|
|
26
|
-
isNotFlippable: {},
|
|
27
|
-
isOpen: {
|
|
28
|
-
onClick: {
|
|
29
|
-
action: 'clicked'
|
|
30
|
-
},
|
|
31
|
-
control: false
|
|
32
|
-
}
|
|
33
|
-
}
|
|
22
|
+
argTypes: popoverMenuArgTypes
|
|
34
23
|
};
|
|
35
24
|
export var Default = function Default(args) {
|
|
36
25
|
var _useGetTheme = useGetTheme(),
|
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import DocsLayout from '../../../.storybook/storybookDocsLayout';
|
|
4
4
|
import { ProgressBar } from '../../index';
|
|
5
5
|
import ProgressBarReadMe from './ProgressBar.mdx';
|
|
6
|
+
import { progressBarArgTypes } from './progressBarAttributes';
|
|
6
7
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
7
8
|
export default {
|
|
8
9
|
title: 'Experimental/ProgressBar',
|
|
@@ -14,33 +15,7 @@ export default {
|
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
17
|
},
|
|
17
|
-
argTypes:
|
|
18
|
-
isIndeterminate: {
|
|
19
|
-
table: {
|
|
20
|
-
disable: true
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
'data-testid': {
|
|
24
|
-
table: {
|
|
25
|
-
disable: true
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
label: {
|
|
29
|
-
table: {
|
|
30
|
-
disable: true
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
shouldShowValueLabel: {
|
|
34
|
-
table: {
|
|
35
|
-
disable: true
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
valueLabel: {
|
|
39
|
-
table: {
|
|
40
|
-
disable: true
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
18
|
+
argTypes: progressBarArgTypes
|
|
44
19
|
};
|
|
45
20
|
export var Default = function Default(args) {
|
|
46
21
|
return ___EmotionJSX(ProgressBar, _extends({}, args, {
|
|
@@ -0,0 +1,58 @@
|
|
|
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 } from '../../utils/docUtils/docArgTypes';
|
|
13
|
+
export var progressBarArgTypes = {
|
|
14
|
+
'data-testid': {
|
|
15
|
+
table: {
|
|
16
|
+
disable: true
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
value: {
|
|
20
|
+
control: {
|
|
21
|
+
type: 'number'
|
|
22
|
+
},
|
|
23
|
+
description: 'The current value of the progress bar (required).'
|
|
24
|
+
},
|
|
25
|
+
minValue: {
|
|
26
|
+
control: {
|
|
27
|
+
type: 'number'
|
|
28
|
+
},
|
|
29
|
+
description: 'The minimum value of the progress bar.'
|
|
30
|
+
},
|
|
31
|
+
maxValue: {
|
|
32
|
+
control: {
|
|
33
|
+
type: 'number'
|
|
34
|
+
},
|
|
35
|
+
description: 'The maximum value of the progress bar.'
|
|
36
|
+
},
|
|
37
|
+
isIndeterminate: _objectSpread(_objectSpread({}, booleanArg), {}, {
|
|
38
|
+
description: 'Whether the progress bar is in an indeterminate state (progress is unknown).'
|
|
39
|
+
}),
|
|
40
|
+
shouldShowValueLabel: _objectSpread(_objectSpread({}, booleanArg), {}, {
|
|
41
|
+
description: 'Whether to display a label showing the current value of the progress bar.'
|
|
42
|
+
}),
|
|
43
|
+
label: {
|
|
44
|
+
control: {
|
|
45
|
+
type: 'text'
|
|
46
|
+
},
|
|
47
|
+
description: 'A label describing the progress bar.'
|
|
48
|
+
},
|
|
49
|
+
valueLabel: {
|
|
50
|
+
control: {
|
|
51
|
+
type: 'text'
|
|
52
|
+
},
|
|
53
|
+
description: 'A custom label to display for the current value instead of the default formatted value.'
|
|
54
|
+
},
|
|
55
|
+
formatOptions: {
|
|
56
|
+
description: 'The display format of the value label (Intl.NumberFormatOptions).'
|
|
57
|
+
}
|
|
58
|
+
};
|
|
@@ -15,9 +15,8 @@ import React, { useState } from 'react';
|
|
|
15
15
|
import DocsLayout from '../../../.storybook/storybookDocsLayout';
|
|
16
16
|
import { RadioField, RadioGroupField } from '../../index';
|
|
17
17
|
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks';
|
|
18
|
-
import { ariaAttributeBaseArgTypes } from '../../utils/docUtils/ariaAttributes';
|
|
19
|
-
import { statusArgTypes } from '../../utils/docUtils/statusProp';
|
|
20
18
|
import RadioGroupFieldReadme from './RadioGroupField.mdx';
|
|
19
|
+
import { radioGroupFieldArgTypes } from './radioGroupFieldAttributes';
|
|
21
20
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
22
21
|
export default {
|
|
23
22
|
title: 'Form/RadioGroupField',
|
|
@@ -29,32 +28,7 @@ export default {
|
|
|
29
28
|
}
|
|
30
29
|
}
|
|
31
30
|
},
|
|
32
|
-
argTypes: _objectSpread(
|
|
33
|
-
label: {
|
|
34
|
-
control: {
|
|
35
|
-
type: 'text'
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
helperText: {
|
|
39
|
-
control: {
|
|
40
|
-
type: 'text'
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
hintText: {
|
|
44
|
-
control: {
|
|
45
|
-
type: 'text'
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
defaultValue: {},
|
|
49
|
-
orientation: {},
|
|
50
|
-
isDisabled: {},
|
|
51
|
-
isRequired: {},
|
|
52
|
-
name: {},
|
|
53
|
-
id: {},
|
|
54
|
-
value: {
|
|
55
|
-
control: false
|
|
56
|
-
}
|
|
57
|
-
}, statusArgTypes), ariaAttributeBaseArgTypes),
|
|
31
|
+
argTypes: _objectSpread({}, radioGroupFieldArgTypes),
|
|
58
32
|
args: {
|
|
59
33
|
label: 'Pick one',
|
|
60
34
|
defaultValue: 'A'
|
|
@@ -0,0 +1,39 @@
|
|
|
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 { ariaAttributeBaseArgTypes } from '../../utils/docUtils/ariaAttributes';
|
|
13
|
+
import { statusArgTypes } from '../../utils/docUtils/statusProp';
|
|
14
|
+
export var radioGroupFieldArgTypes = _objectSpread(_objectSpread({
|
|
15
|
+
label: {
|
|
16
|
+
control: {
|
|
17
|
+
type: 'text'
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
helperText: {
|
|
21
|
+
control: {
|
|
22
|
+
type: 'text'
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
hintText: {
|
|
26
|
+
control: {
|
|
27
|
+
type: 'text'
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
defaultValue: {},
|
|
31
|
+
orientation: {},
|
|
32
|
+
isDisabled: {},
|
|
33
|
+
isRequired: {},
|
|
34
|
+
name: {},
|
|
35
|
+
id: {},
|
|
36
|
+
value: {
|
|
37
|
+
control: false
|
|
38
|
+
}
|
|
39
|
+
}, statusArgTypes), ariaAttributeBaseArgTypes);
|
|
@@ -1,23 +1,12 @@
|
|
|
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
1
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
|
10
2
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
|
11
|
-
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
|
12
3
|
import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/some";
|
|
13
|
-
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; }
|
|
14
|
-
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; }
|
|
15
4
|
import React, { useState } from 'react';
|
|
16
5
|
import { parseDate } from '@internationalized/date';
|
|
17
6
|
import DocsLayout from '../../../.storybook/storybookDocsLayout';
|
|
18
7
|
import { RangeCalendar } from '../../index';
|
|
19
|
-
import { ariaAttributeBaseArgTypes } from '../../utils/docUtils/ariaAttributes';
|
|
20
8
|
import RangeCalendarReadme from './RangeCalendar.mdx';
|
|
9
|
+
import { rangeCalendarArgTypes } from './rangeCalendarAttributes';
|
|
21
10
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
22
11
|
export default {
|
|
23
12
|
title: 'Experimental/RangeCalendar',
|
|
@@ -32,7 +21,7 @@ export default {
|
|
|
32
21
|
}
|
|
33
22
|
}
|
|
34
23
|
},
|
|
35
|
-
argTypes:
|
|
24
|
+
argTypes: rangeCalendarArgTypes,
|
|
36
25
|
args: {
|
|
37
26
|
defaultFocusedValue: '2030-01-15'
|
|
38
27
|
}
|
|
@@ -0,0 +1,84 @@
|
|
|
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 { ariaAttributeBaseArgTypes } from '../../utils/docUtils/ariaAttributes';
|
|
13
|
+
import { booleanArg, funcArg } from '../../utils/docUtils/docArgTypes';
|
|
14
|
+
export var rangeCalendarArgTypes = _objectSpread(_objectSpread({}, ariaAttributeBaseArgTypes), {}, {
|
|
15
|
+
defaultValue: {
|
|
16
|
+
control: {
|
|
17
|
+
type: null
|
|
18
|
+
},
|
|
19
|
+
description: 'The default selected date range (uncontrolled).'
|
|
20
|
+
},
|
|
21
|
+
value: {
|
|
22
|
+
control: {
|
|
23
|
+
type: null
|
|
24
|
+
},
|
|
25
|
+
description: 'The currently selected date range (controlled).'
|
|
26
|
+
},
|
|
27
|
+
customWeekDays: {
|
|
28
|
+
control: {
|
|
29
|
+
type: null
|
|
30
|
+
},
|
|
31
|
+
description: 'Custom week day labels for use with non-Gregorian calendars.'
|
|
32
|
+
},
|
|
33
|
+
defaultFocusedValue: {
|
|
34
|
+
control: {
|
|
35
|
+
type: 'text'
|
|
36
|
+
},
|
|
37
|
+
description: 'The default focused date when the calendar first mounts (uncontrolled).'
|
|
38
|
+
},
|
|
39
|
+
minValue: {
|
|
40
|
+
control: {
|
|
41
|
+
type: 'text'
|
|
42
|
+
},
|
|
43
|
+
description: 'The minimum allowed date that a user may select.'
|
|
44
|
+
},
|
|
45
|
+
maxValue: {
|
|
46
|
+
control: {
|
|
47
|
+
type: 'text'
|
|
48
|
+
},
|
|
49
|
+
description: 'The maximum allowed date that a user may select.'
|
|
50
|
+
},
|
|
51
|
+
isDisabled: _objectSpread(_objectSpread({}, booleanArg), {}, {
|
|
52
|
+
description: 'Whether the calendar is disabled.'
|
|
53
|
+
}),
|
|
54
|
+
isReadOnly: _objectSpread(_objectSpread({}, booleanArg), {}, {
|
|
55
|
+
description: 'Whether the calendar dates are only focusable (not selectable).'
|
|
56
|
+
}),
|
|
57
|
+
isRequired: _objectSpread(_objectSpread({}, booleanArg), {}, {
|
|
58
|
+
description: 'Whether user input is required on the calendar before form submission.'
|
|
59
|
+
}),
|
|
60
|
+
hasAutoFocus: _objectSpread(_objectSpread({}, booleanArg), {}, {
|
|
61
|
+
description: 'Whether the element should receive focus on render.'
|
|
62
|
+
}),
|
|
63
|
+
onChange: _objectSpread(_objectSpread({}, funcArg), {}, {
|
|
64
|
+
description: 'Handler that is called when the selected date range changes.'
|
|
65
|
+
}),
|
|
66
|
+
isDateUnavailable: _objectSpread(_objectSpread({}, funcArg), {}, {
|
|
67
|
+
description: 'Callback that is called for each date. If it returns true, the date is unavailable.'
|
|
68
|
+
}),
|
|
69
|
+
onBlur: _objectSpread(_objectSpread({}, funcArg), {}, {
|
|
70
|
+
description: 'Handler that is called when the element loses focus.'
|
|
71
|
+
}),
|
|
72
|
+
onFocus: _objectSpread(_objectSpread({}, funcArg), {}, {
|
|
73
|
+
description: 'Handler that is called when the element receives focus.'
|
|
74
|
+
}),
|
|
75
|
+
onFocusChange: _objectSpread(_objectSpread({}, funcArg), {}, {
|
|
76
|
+
description: "Handler that is called when the element's focus status changes."
|
|
77
|
+
}),
|
|
78
|
+
onKeyDown: _objectSpread(_objectSpread({}, funcArg), {}, {
|
|
79
|
+
description: 'Handler that is called when a key is pressed.'
|
|
80
|
+
}),
|
|
81
|
+
onKeyUp: _objectSpread(_objectSpread({}, funcArg), {}, {
|
|
82
|
+
description: 'Handler that is called when a key is released.'
|
|
83
|
+
})
|
|
84
|
+
});
|