@openedx/paragon 22.12.0 → 22.14.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/dist/Alert/_variables.scss +2 -1
- package/dist/Annotation/index.js.map +1 -1
- package/dist/Annotation/index.scss +6 -5
- package/dist/Avatar/index.js.map +1 -1
- package/dist/AvatarButton/index.js.map +1 -1
- package/dist/Breadcrumb/index.js.map +1 -1
- package/dist/Bubble/index.js +1 -0
- package/dist/Bubble/index.js.map +1 -1
- package/dist/Bubble/index.scss +3 -2
- package/dist/Button/deprecated/index.js.map +1 -1
- package/dist/Button/index.scss +19 -18
- package/dist/Card/CardCarousel/CardCarouselHeader.js +2 -2
- package/dist/Card/CardCarousel/CardCarouselHeader.js.map +1 -1
- package/dist/Card/CardFooter.js.map +1 -1
- package/dist/Card/CardHeader.js +1 -1
- package/dist/Card/CardHeader.js.map +1 -1
- package/dist/Card/CardImageCap.js.map +1 -1
- package/dist/Card/CardStatus.js.map +1 -1
- package/dist/Card/_variables.scss +3 -2
- package/dist/Card/index.js.map +1 -1
- package/dist/Card/index.scss +10 -9
- package/dist/Chip/ChipIcon.d.ts +1 -1
- package/dist/Chip/index.js +1 -0
- package/dist/Chip/index.js.map +1 -1
- package/dist/ChipCarousel/index.js.map +1 -1
- package/dist/Collapsible/index.js.map +1 -1
- package/dist/ColorPicker/index.js +1 -1
- package/dist/ColorPicker/index.js.map +1 -1
- package/dist/ColorPicker/index.scss +2 -1
- package/dist/DataTable/CollapsibleButtonGroup.js +2 -2
- package/dist/DataTable/CollapsibleButtonGroup.js.map +1 -1
- package/dist/DataTable/DropdownFilters.js +1 -1
- package/dist/DataTable/DropdownFilters.js.map +1 -1
- package/dist/DataTable/TableRow.js.map +1 -1
- package/dist/DataTable/filters/CheckboxFilter.js.map +1 -1
- package/dist/DataTable/filters/DropdownFilter.js.map +1 -1
- package/dist/DataTable/filters/MultiSelectDropdownFilter.js.map +1 -1
- package/dist/DataTable/filters/TextFilter.js.map +1 -1
- package/dist/DataTable/index.scss +14 -13
- package/dist/DataTable/utils/getVisibleColumns.js +1 -1
- package/dist/DataTable/utils/getVisibleColumns.js.map +1 -1
- package/dist/Dropdown/_variables.scss +2 -1
- package/dist/Dropdown/deprecated/DropdownMenu.js +15 -19
- package/dist/Dropdown/deprecated/DropdownMenu.js.map +1 -1
- package/dist/Dropdown/deprecated/index.js +1 -1
- package/dist/Dropdown/deprecated/index.js.map +1 -1
- package/dist/Dropdown/index.js.map +1 -1
- package/dist/Dropzone/DefaultContent.js.map +1 -1
- package/dist/Dropzone/UploadProgress.js.map +1 -1
- package/dist/Dropzone/index.scss +3 -2
- package/dist/Fieldset/index.js.map +1 -1
- package/dist/Form/FormAutosuggest.js +1 -1
- package/dist/Form/FormAutosuggest.js.map +1 -1
- package/dist/Form/FormControl.js.map +1 -1
- package/dist/Form/FormControlDecorator.js.map +1 -1
- package/dist/Form/FormGroupContext.d.ts +1 -1
- package/dist/Form/FormGroupContext.js.map +1 -1
- package/dist/Form/FormText.js.map +1 -1
- package/dist/Form/_index.scss +9 -7
- package/dist/Form/_variables.scss +4 -2
- package/dist/Form/fieldUtils.js.map +1 -1
- package/dist/Hyperlink/index.js +1 -0
- package/dist/Hyperlink/index.js.map +1 -1
- package/dist/Hyperlink/index.scss +3 -1
- package/dist/Icon/index.js.map +1 -1
- package/dist/IconButton/index.d.ts +13 -8
- package/dist/IconButton/index.js.map +1 -1
- package/dist/IconButtonToggle/index.js.map +1 -1
- package/dist/IconButtonToggle/index.scss +3 -1
- package/dist/Input/index.js.map +1 -1
- package/dist/InputSelect/index.js.map +1 -1
- package/dist/Layout/index.js.map +1 -1
- package/dist/ListBox/index.js.map +1 -1
- package/dist/ListBoxOption/index.js.map +1 -1
- package/dist/Menu/SelectMenu.js +1 -1
- package/dist/Menu/SelectMenu.js.map +1 -1
- package/dist/Menu/index.js +1 -1
- package/dist/Menu/index.js.map +1 -1
- package/dist/Modal/ModalContext.d.ts +1 -1
- package/dist/Modal/ModalDialog.d.ts +1 -1
- package/dist/Modal/ModalDialog.js.map +1 -1
- package/dist/Modal/ModalDialogBody.js +1 -1
- package/dist/Modal/ModalDialogBody.js.map +1 -1
- package/dist/Modal/ModalDialogHeroBackground.js.map +1 -1
- package/dist/Modal/ModalLayer.d.ts +3 -3
- package/dist/Modal/ModalLayer.js.map +1 -1
- package/dist/Modal/ModalPopup.js.map +1 -1
- package/dist/Modal/_ModalDialog.scss +3 -1
- package/dist/Modal/index.js +3 -1
- package/dist/Modal/index.js.map +1 -1
- package/dist/Modal/index.scss +3 -5
- package/dist/Nav/_mixins.scss +3 -1
- package/dist/Overlay/index.d.ts +2 -2
- package/dist/PageBanner/index.js.map +1 -1
- package/dist/PageBanner/index.scss +2 -1
- package/dist/Pagination/PaginationContext.js.map +1 -1
- package/dist/Pagination/index.js.map +1 -1
- package/dist/Popover/_variables.scss +2 -1
- package/dist/Popover/index.js.map +1 -1
- package/dist/ProductTour/Checkpoint.scss +9 -8
- package/dist/ProductTour/index.js +1 -1
- package/dist/ProductTour/index.js.map +1 -1
- package/dist/ProgressBar/index.js.map +1 -1
- package/dist/Scrollable/index.js +1 -1
- package/dist/Scrollable/index.js.map +1 -1
- package/dist/SearchField/SearchFieldAdvanced.js.map +1 -1
- package/dist/SearchField/index.scss +2 -1
- package/dist/SelectableBox/SelectableBoxSet.js.map +1 -1
- package/dist/Sheet/index.js.map +1 -1
- package/dist/Stack/index.js.map +1 -1
- package/dist/StatefulButton/index.js.map +1 -1
- package/dist/StatusAlert/index.js.map +1 -1
- package/dist/Stepper/StepperHeader.js +1 -1
- package/dist/Stepper/StepperHeader.js.map +1 -1
- package/dist/Stepper/StepperHeaderStep.js.map +1 -1
- package/dist/Sticky/index.js.map +1 -1
- package/dist/Table/_variables.scss +2 -1
- package/dist/Tabs/deprecated/index.js.map +1 -1
- package/dist/Tabs/index.js +1 -1
- package/dist/Tabs/index.js.map +1 -1
- package/dist/Toast/ToastContainer.scss +1 -1
- package/dist/Toast/index.scss +2 -2
- package/dist/Truncate/index.js +1 -1
- package/dist/Truncate/index.js.map +1 -1
- package/dist/ValidationFormGroup/index.js.map +1 -1
- package/dist/asInput/index.js.map +1 -1
- package/dist/hooks/useArrowKeyNavigationHook.d.ts +10 -0
- package/dist/hooks/{useArrowKeyNavigation.js → useArrowKeyNavigationHook.js} +13 -11
- package/dist/hooks/useArrowKeyNavigationHook.js.map +1 -0
- package/dist/hooks/useIndexOfLastVisibleChildHook.d.ts +12 -0
- package/dist/hooks/{useIndexOfLastVisibleChild.js → useIndexOfLastVisibleChildHook.js} +16 -12
- package/dist/hooks/useIndexOfLastVisibleChildHook.js.map +1 -0
- package/dist/hooks/useIsVisibleHook.d.ts +3 -0
- package/dist/hooks/{useIsVisible.js → useIsVisibleHook.js} +2 -2
- package/dist/hooks/useIsVisibleHook.js.map +1 -0
- package/dist/hooks/useToggleHook.d.ts +12 -0
- package/dist/hooks/useToggleHook.js +31 -0
- package/dist/hooks/useToggleHook.js.map +1 -0
- package/dist/hooks/useWindowSizeHook.d.ts +6 -0
- package/dist/hooks/{useWindowSize.js → useWindowSizeHook.js} +1 -1
- package/dist/hooks/useWindowSizeHook.js.map +1 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.js +5 -5
- package/dist/paragon.css +1 -45
- package/dist/utils/newId.js.map +1 -1
- package/dist/withDeprecatedProps.js.map +1 -1
- package/icons/node_modules/@svgr/babel-plugin-add-jsx-attribute/CHANGELOG.md +50 -0
- package/icons/node_modules/@svgr/babel-plugin-add-jsx-attribute/LICENSE +7 -0
- package/icons/node_modules/@svgr/babel-plugin-add-jsx-attribute/README.md +37 -0
- package/icons/node_modules/@svgr/babel-plugin-add-jsx-attribute/dist/index.d.ts +20 -0
- package/icons/node_modules/@svgr/babel-plugin-add-jsx-attribute/dist/index.js +79 -0
- package/icons/node_modules/@svgr/babel-plugin-add-jsx-attribute/dist/index.js.map +1 -0
- package/icons/node_modules/@svgr/babel-plugin-add-jsx-attribute/package.json +40 -0
- package/icons/node_modules/@svgr/babel-plugin-add-jsx-attribute/tsconfig.json +4 -0
- package/icons/package.json +1 -1
- package/package.json +12 -19
- package/scss/core/_exports.module.scss +7 -6
- package/scss/core/_functions.scss +9 -7
- package/scss/core/_typography.scss +2 -1
- package/scss/core/_utilities.scss +2 -1
- package/scss/core/_variables.scss +98 -95
- package/src/Alert/_variables.scss +2 -1
- package/src/Annotation/index.scss +6 -5
- package/src/Breadcrumb/Breadcrumb.test.jsx +3 -2
- package/src/Bubble/index.scss +3 -2
- package/src/Bubble/index.tsx +1 -0
- package/src/Button/deprecated/Button.test.jsx +6 -4
- package/src/Button/index.scss +19 -18
- package/src/Card/CardCarousel/tests/CardCarouselControls.test.jsx +6 -4
- package/src/Card/_variables.scss +3 -2
- package/src/Card/index.scss +10 -9
- package/src/Chip/index.tsx +1 -0
- package/src/Collapsible/Collapsible.test.jsx +15 -7
- package/src/ColorPicker/ColorPicker.test.jsx +9 -16
- package/src/ColorPicker/index.jsx +1 -1
- package/src/ColorPicker/index.scss +2 -1
- package/src/DataTable/CollapsibleButtonGroup.jsx +2 -2
- package/src/DataTable/DropdownFilters.jsx +1 -1
- package/src/DataTable/dataviews.mdx +1 -8
- package/src/DataTable/index.scss +14 -13
- package/src/DataTable/selection/tests/ControlledSelectHeader.test.jsx +6 -4
- package/src/DataTable/tests/BulkActions.test.jsx +2 -4
- package/src/DataTable/tests/DataViewToggle.test.jsx +3 -7
- package/src/DataTable/tests/DropdownFilters.test.jsx +1 -1
- package/src/DataTable/tests/TableActions.test.jsx +1 -1
- package/src/Dropdown/_variables.scss +2 -1
- package/src/Dropdown/deprecated/Dropdown.test.jsx +43 -27
- package/src/Dropzone/README.md +3 -3
- package/src/Dropzone/index.scss +3 -2
- package/src/Dropzone/tests/__snapshots__/Dropzone.test.jsx.snap +10 -1
- package/src/Form/FormAutosuggest.jsx +1 -1
- package/src/Form/FormGroupContext.tsx +1 -1
- package/src/Form/_index.scss +9 -7
- package/src/Form/_variables.scss +4 -2
- package/src/Form/tests/FormAutosuggest.test.jsx +76 -57
- package/src/Form/tests/FormCheckboxSet.test.jsx +3 -2
- package/src/Form/tests/FormControl.test.jsx +9 -6
- package/src/Form/tests/FormRadioSet.test.jsx +3 -2
- package/src/Hyperlink/index.scss +3 -1
- package/src/Hyperlink/index.tsx +1 -0
- package/src/IconButtonToggle/IconButtonToggle.test.jsx +3 -2
- package/src/IconButtonToggle/index.scss +3 -1
- package/src/ListBox/ListBox.test.jsx +8 -4
- package/src/Menu/Menu.test.jsx +15 -10
- package/src/Menu/SelectMenu.jsx +1 -1
- package/src/Menu/index.jsx +1 -1
- package/src/Modal/ModalDialogBody.jsx +1 -1
- package/src/Modal/_ModalDialog.scss +3 -1
- package/src/Modal/index.jsx +2 -0
- package/src/Modal/index.scss +3 -5
- package/src/Modal/tests/ModalLayer.test.tsx +3 -2
- package/src/Nav/_mixins.scss +3 -1
- package/src/OverflowScroll/data/tests/useOverflowScroll.test.jsx +1 -2
- package/src/OverflowScroll/data/tests/useOverflowScrollActions.test.jsx +1 -1
- package/src/OverflowScroll/data/tests/useOverflowScrollElementAttributes.test.jsx +1 -1
- package/src/OverflowScroll/data/tests/useOverflowScrollEventListeners.test.jsx +1 -2
- package/src/PageBanner/index.scss +2 -1
- package/src/Pagination/Pagination.test.jsx +36 -28
- package/src/Popover/_variables.scss +2 -1
- package/src/ProductTour/Checkpoint.scss +9 -8
- package/src/ProductTour/Checkpoint.test.jsx +3 -2
- package/src/ProductTour/ProductTour.test.jsx +11 -24
- package/src/ProductTour/index.jsx +1 -1
- package/src/Scrollable/Scrollable.test.jsx +2 -2
- package/src/Scrollable/index.jsx +1 -1
- package/src/SearchField/index.scss +2 -1
- package/src/SelectableBox/tests/SelectableBox.test.jsx +3 -2
- package/src/StatusAlert/StatusAlert.test.jsx +6 -2
- package/src/Stepper/StepperHeader.jsx +1 -1
- package/src/Stepper/tests/Stepper.test.jsx +1 -1
- package/src/Table/_variables.scss +2 -1
- package/src/Tabs/Tabs.test.jsx +1 -1
- package/src/Tabs/deprecated/Tabs.test.jsx +6 -4
- package/src/Tabs/index.jsx +1 -1
- package/src/Toast/ToastContainer.scss +1 -1
- package/src/Toast/index.scss +2 -2
- package/src/Truncate/index.jsx +1 -1
- package/src/hooks/tests/{useIndexOfLastVisibleChild.test.jsx → useIndexOfLastVisibleChild.test.tsx} +2 -2
- package/src/hooks/tests/{useToggle.test.jsx → useToggle.test.tsx} +2 -1
- package/src/hooks/{useArrowKeyNavigation.jsx → useArrowKeyNavigationHook.tsx} +41 -13
- package/src/hooks/{useIndexOfLastVisibleChild.jsx → useIndexOfLastVisibleChildHook.tsx} +22 -16
- package/src/hooks/{useIsVisible.jsx → useIsVisibleHook.tsx} +6 -3
- package/src/hooks/useToggleHook.tsx +42 -0
- package/src/hooks/{useWindowSize.jsx → useWindowSizeHook.tsx} +7 -2
- package/src/index.d.ts +5 -5
- package/src/index.js +5 -5
- package/dist/hooks/useArrowKeyNavigation.js.map +0 -1
- package/dist/hooks/useIndexOfLastVisibleChild.js.map +0 -1
- package/dist/hooks/useIsVisible.js.map +0 -1
- package/dist/hooks/useToggle.js +0 -38
- package/dist/hooks/useToggle.js.map +0 -1
- package/dist/hooks/useWindowSize.js.map +0 -1
- package/src/DataTable/tests/utils.js +0 -9
- package/src/hooks/useToggle.jsx +0 -37
- /package/src/hooks/tests/{useWindowSize.test.jsx → useWindowSize.test.tsx} +0 -0
|
@@ -47,7 +47,7 @@ interface PropsWithTooltip extends Props {
|
|
|
47
47
|
/**
|
|
48
48
|
* An icon button wrapped in overlaytrigger to display a tooltip.
|
|
49
49
|
*/
|
|
50
|
-
declare function IconButtonWithTooltip({ tooltipPlacement, tooltipContent, ...props }: PropsWithTooltip):
|
|
50
|
+
declare function IconButtonWithTooltip({ tooltipPlacement, tooltipContent, ...props }: PropsWithTooltip): import("react/jsx-runtime").JSX.Element;
|
|
51
51
|
declare namespace IconButtonWithTooltip {
|
|
52
52
|
var defaultProps: {
|
|
53
53
|
tooltipPlacement: string;
|
|
@@ -73,16 +73,17 @@ declare namespace IconButtonWithTooltip {
|
|
|
73
73
|
suppressContentEditableWarning?: boolean | undefined;
|
|
74
74
|
suppressHydrationWarning?: boolean | undefined;
|
|
75
75
|
accessKey?: string | undefined;
|
|
76
|
+
autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | (string & {}) | undefined;
|
|
76
77
|
autoFocus?: boolean | undefined;
|
|
77
|
-
contentEditable?: (boolean | "true" | "false") | "inherit" | undefined;
|
|
78
|
+
contentEditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
|
|
78
79
|
contextMenu?: string | undefined;
|
|
79
80
|
dir?: string | undefined;
|
|
80
81
|
draggable?: (boolean | "true" | "false") | undefined;
|
|
82
|
+
enterKeyHint?: "search" | "enter" | "done" | "go" | "next" | "previous" | "send" | undefined;
|
|
81
83
|
hidden?: boolean | undefined;
|
|
82
84
|
id?: string | undefined;
|
|
83
85
|
lang?: string | undefined;
|
|
84
86
|
nonce?: string | undefined;
|
|
85
|
-
placeholder?: string | undefined;
|
|
86
87
|
slot?: string | undefined;
|
|
87
88
|
spellCheck?: (boolean | "true" | "false") | undefined;
|
|
88
89
|
style?: React.CSSProperties | undefined;
|
|
@@ -102,7 +103,6 @@ declare namespace IconButtonWithTooltip {
|
|
|
102
103
|
rev?: string | undefined;
|
|
103
104
|
typeof?: string | undefined;
|
|
104
105
|
vocab?: string | undefined;
|
|
105
|
-
autoCapitalize?: string | undefined;
|
|
106
106
|
autoCorrect?: string | undefined;
|
|
107
107
|
autoSave?: string | undefined;
|
|
108
108
|
color?: string | undefined;
|
|
@@ -113,20 +113,24 @@ declare namespace IconButtonWithTooltip {
|
|
|
113
113
|
itemRef?: string | undefined;
|
|
114
114
|
results?: number | undefined;
|
|
115
115
|
security?: string | undefined;
|
|
116
|
-
unselectable?: "
|
|
116
|
+
unselectable?: "off" | "on" | undefined;
|
|
117
117
|
inputMode?: "search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
|
|
118
118
|
is?: string | undefined;
|
|
119
119
|
"aria-activedescendant"?: string | undefined;
|
|
120
120
|
"aria-atomic"?: (boolean | "true" | "false") | undefined;
|
|
121
121
|
"aria-autocomplete"?: "inline" | "list" | "none" | "both" | undefined;
|
|
122
|
+
"aria-braillelabel"?: string | undefined;
|
|
123
|
+
"aria-brailleroledescription"?: string | undefined;
|
|
122
124
|
"aria-busy"?: (boolean | "true" | "false") | undefined;
|
|
123
125
|
"aria-checked"?: boolean | "true" | "false" | "mixed" | undefined;
|
|
124
126
|
"aria-colcount"?: number | undefined;
|
|
125
127
|
"aria-colindex"?: number | undefined;
|
|
128
|
+
"aria-colindextext"?: string | undefined;
|
|
126
129
|
"aria-colspan"?: number | undefined;
|
|
127
130
|
"aria-controls"?: string | undefined;
|
|
128
131
|
"aria-current"?: boolean | "time" | "step" | "true" | "false" | "page" | "location" | "date" | undefined;
|
|
129
132
|
"aria-describedby"?: string | undefined;
|
|
133
|
+
"aria-description"?: string | undefined;
|
|
130
134
|
"aria-details"?: string | undefined;
|
|
131
135
|
"aria-disabled"?: (boolean | "true" | "false") | undefined;
|
|
132
136
|
"aria-dropeffect"?: "link" | "none" | "copy" | "execute" | "move" | "popup" | undefined;
|
|
@@ -156,6 +160,7 @@ declare namespace IconButtonWithTooltip {
|
|
|
156
160
|
"aria-roledescription"?: string | undefined;
|
|
157
161
|
"aria-rowcount"?: number | undefined;
|
|
158
162
|
"aria-rowindex"?: number | undefined;
|
|
163
|
+
"aria-rowindextext"?: string | undefined;
|
|
159
164
|
"aria-rowspan"?: number | undefined;
|
|
160
165
|
"aria-selected"?: (boolean | "true" | "false") | undefined;
|
|
161
166
|
"aria-setsize"?: number | undefined;
|
|
@@ -235,6 +240,8 @@ declare namespace IconButtonWithTooltip {
|
|
|
235
240
|
onProgressCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
236
241
|
onRateChange?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
237
242
|
onRateChangeCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
243
|
+
onResize?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
244
|
+
onResizeCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
238
245
|
onSeeked?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
239
246
|
onSeekedCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
240
247
|
onSeeking?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
@@ -303,9 +310,7 @@ declare namespace IconButtonWithTooltip {
|
|
|
303
310
|
onPointerCancel?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
304
311
|
onPointerCancelCapture?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
305
312
|
onPointerEnter?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
306
|
-
onPointerEnterCapture?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
307
313
|
onPointerLeave?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
308
|
-
onPointerLeaveCapture?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
309
314
|
onPointerOver?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
310
315
|
onPointerOverCapture?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
311
316
|
onPointerOut?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
@@ -326,7 +331,7 @@ declare namespace IconButtonWithTooltip {
|
|
|
326
331
|
onAnimationIterationCapture?: React.AnimationEventHandler<HTMLButtonElement> | undefined;
|
|
327
332
|
onTransitionEnd?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
328
333
|
onTransitionEndCapture?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
329
|
-
ref?: React.
|
|
334
|
+
ref?: React.LegacyRef<HTMLButtonElement> | undefined;
|
|
330
335
|
key?: React.Key | null | undefined;
|
|
331
336
|
};
|
|
332
337
|
var propTypes: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","PropTypes","classNames","FontAwesomeIcon","OverlayTrigger","Tooltip","IconButton","forwardRef","_ref","ref","className","alt","invertColors","icon","src","iconClassNames","onClick","size","variant","iconAs","isActive","children","attrs","invert","activeStyle","process","env","NODE_ENV","console","msg","warn","IconComponent","createElement","type","defaultProps","undefined","value","propTypes","string","elementType","isRequired","bool","shape","prefix","iconName","array","func","oneOf","IconButtonWithTooltip","_ref2","tooltipPlacement","tooltipContent","props","placement","overlay","id","node"],"sources":["../../src/IconButton/index.tsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { type Placement } from 'react-bootstrap/Overlay';\n\nimport { OverlayTrigger } from '../Overlay';\nimport Tooltip from '../Tooltip';\nimport Icon from '../Icon';\n\ninterface Props extends React.HTMLAttributes<HTMLButtonElement> {\n iconAs?: typeof Icon | typeof FontAwesomeIcon,\n /** Additional CSS class[es] to apply to this button */\n className?: string;\n /** Alt text for your icon. For best practice, avoid using alt text to describe\n * the image in the `IconButton`. Instead, we recommend describing the function\n * of the button. */\n alt: string;\n /** Changes icon styles for dark background */\n invertColors?: boolean;\n /** An icon component to render. Example import of a Paragon icon component:\n * `import { Check } from '@openedx/paragon/icons';`\n * */\n // Note: React.ComponentType is what we want here. React.ElementType would allow some element type strings like \"div\",\n // but we only want to allow components like 'Add' (a specific icon component function/class)\n src?: React.ComponentType;\n /** Extra class names that will be added to the icon */\n iconClassNames?: string;\n /** Click handler for the button */\n onClick?: React.MouseEventHandler<HTMLButtonElement>;\n /** whether to show the `IconButton` in an active state, whose styling is distinct from default state */\n isActive?: boolean;\n /** @deprecated Using FontAwesome icons is deprecated. Instead, pass iconAs={Icon} src={...} */\n icon?: { prefix?: string; iconName?: string, icon?: any[] },\n /** Type of button (uses Bootstrap options) */\n variant?: 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'light' | 'dark' | 'black' | 'brand';\n /** size of button to render */\n size?: 'sm' | 'md' | 'inline';\n /** Used with `IconButtonToggle` */\n value?: string;\n /** no children */\n children?: never;\n}\n\nconst IconButton = React.forwardRef<HTMLButtonElement, Props>(({\n className,\n alt,\n invertColors,\n icon,\n src,\n iconClassNames,\n onClick,\n size,\n variant,\n iconAs,\n isActive,\n children, // unused, just here because we don't want it to be part of 'attrs'\n ...attrs\n}, ref) => {\n const invert = invertColors ? 'inverse-' : '';\n const activeStyle = isActive ? `${variant}-` : '';\n if (!iconAs && process.env.NODE_ENV === 'development' && console) {\n const msg = '[Deprecated] IconButton: you have not provided a value for iconAs prop and '\n + 'are using a default one - FontAwesomeIcon, the default value is going to be changed soon '\n + 'as Paragon is moving away from FontAwesome, please use Paragon\\'s icons instead.';\n // eslint-disable-next-line no-console\n console.warn(msg);\n }\n const IconComponent = iconAs || FontAwesomeIcon;\n return (\n <button\n aria-label={alt}\n className={classNames(\n 'btn-icon',\n `btn-icon-${invert}${variant}`,\n `btn-icon-${size}`,\n {\n [`btn-icon-${invert}${activeStyle}active`]: isActive,\n },\n className,\n )}\n onClick={onClick}\n type=\"button\"\n ref={ref}\n {...attrs}\n >\n <span className=\"btn-icon__icon-container\">\n <IconComponent\n className={classNames('btn-icon__icon', iconClassNames)}\n icon={icon as any}\n src={src}\n />\n </span>\n </button>\n );\n});\n\nIconButton.defaultProps = {\n iconAs: undefined,\n src: undefined,\n icon: undefined,\n iconClassNames: undefined,\n className: undefined,\n invertColors: false,\n variant: 'primary',\n size: 'md',\n onClick: () => {},\n isActive: false,\n value: undefined,\n children: undefined,\n};\n\nIconButton.propTypes = {\n /** A custom class name. */\n className: PropTypes.string,\n /** Component that renders the icon, currently defaults to `FontAwesomeIcon`,\n * but is going to be deprecated soon, please use Paragon's icons instead. */\n iconAs: PropTypes.elementType as any,\n /** An icon component to render. Example import of a Paragon icon component:\n * `import { Check } from '@openedx/paragon/icons';`\n * */\n src: PropTypes.elementType as any,\n /** Alt text for your icon. For best practice, avoid using alt text to describe\n * the image in the `IconButton`. Instead, we recommend describing the function\n * of the button. */\n alt: PropTypes.string.isRequired,\n /** Changes icon styles for dark background */\n invertColors: PropTypes.bool,\n /** Accepts a React fontawesome icon. */\n icon: PropTypes.shape({\n prefix: PropTypes.string,\n iconName: PropTypes.string,\n // eslint-disable-next-line react/forbid-prop-types\n icon: PropTypes.array,\n }) as any,\n /** Extra class names that will be added to the icon */\n iconClassNames: PropTypes.string,\n /** Click handler for the button */\n onClick: PropTypes.func,\n /** Type of button (uses Bootstrap options) */\n variant: PropTypes.oneOf(['primary', 'secondary', 'success', 'warning', 'danger', 'light', 'dark', 'black', 'brand']),\n /** size of button to render */\n size: PropTypes.oneOf(['sm', 'md', 'inline']),\n /** whether to show the `IconButton` in an active state, whose styling is distinct from default state */\n isActive: PropTypes.bool,\n /** Used with `IconButtonToggle` */\n value: PropTypes.string,\n};\n\ninterface PropsWithTooltip extends Props {\n /** choose from https://popper.js.org/docs/v2/constructors/#options */\n tooltipPlacement: Placement,\n /** any content to pass to tooltip content area */\n tooltipContent: React.ReactNode,\n}\n\n/**\n * An icon button wrapped in overlaytrigger to display a tooltip.\n */\nfunction IconButtonWithTooltip({\n tooltipPlacement, tooltipContent, ...props\n}: PropsWithTooltip) {\n const invert = props.invertColors ? 'inverse-' : '';\n return (\n <OverlayTrigger\n placement={tooltipPlacement}\n overlay={(\n <Tooltip\n id={`iconbutton-tooltip-${tooltipPlacement}`}\n variant={invert ? 'light' : undefined}\n >\n {tooltipContent}\n </Tooltip>\n )}\n >\n <IconButton {...props} />\n </OverlayTrigger>\n );\n}\n\nIconButtonWithTooltip.defaultProps = {\n ...IconButton.defaultProps,\n tooltipPlacement: 'top',\n};\n\nIconButtonWithTooltip.propTypes = {\n /** tooltip placement can be top, left, right etc, per https://popper.js.org/docs/v2/constructors/#options */\n tooltipPlacement: PropTypes.string,\n /** any valid JSX or text to be rendered as tooltip contents */\n tooltipContent: PropTypes.node.isRequired,\n /** Type of button (uses Bootstrap options) */\n variant: PropTypes.oneOf(['primary', 'secondary', 'success', 'warning', 'danger', 'light', 'dark', 'black', 'brand']),\n /** Changes icon styles for dark background */\n invertColors: PropTypes.bool,\n};\n\n(IconButton as any).IconButtonWithTooltip = IconButtonWithTooltip;\n\nexport default IconButton as typeof IconButton & {\n IconButtonWithTooltip: typeof IconButtonWithTooltip,\n};\nexport { IconButtonWithTooltip };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,eAAe,QAAQ,gCAAgC;AAGhE,SAASC,cAAc,QAAQ,YAAY;AAC3C,OAAOC,OAAO,MAAM,YAAY;AAqChC,MAAMC,UAAU,gBAAGN,KAAK,CAACO,UAAU,CAA2B,CAAAC,IAAA,EAc3DC,GAAG,KAAK;EAAA,IAdoD;IAC7DC,SAAS;IACTC,GAAG;IACHC,YAAY;IACZC,IAAI;IACJC,GAAG;IACHC,cAAc;IACdC,OAAO;IACPC,IAAI;IACJC,OAAO;IACPC,MAAM;IACNC,QAAQ;IACRC,QAAQ;IAAE;IACV,GAAGC;EACL,CAAC,GAAAd,IAAA;EACC,MAAMe,MAAM,GAAGX,YAAY,GAAG,UAAU,GAAG,EAAE;EAC7C,MAAMY,WAAW,GAAGJ,QAAQ,GAAI,GAAEF,OAAQ,GAAE,GAAG,EAAE;EACjD,IAAI,CAACC,MAAM,IAAIM,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,aAAa,IAAIC,OAAO,EAAE;IAChE,MAAMC,GAAG,GAAG,6EAA6E,GACrF,2FAA2F,GAC3F,kFAAkF;IACtF;IACAD,OAAO,CAACE,IAAI,CAACD,GAAG,CAAC;EACnB;EACA,MAAME,aAAa,GAAGZ,MAAM,IAAIhB,eAAe;EAC/C,oBACEH,KAAA,CAAAgC,aAAA;IACE,cAAYrB,GAAI;IAChBD,S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C,GAAG5B,UAAU,CAAC4B,YAAY;EAC1BgB,gBAAgB,EAAE;AACpB,CAAC;AAEDF,qBAAqB,CAACX,SAAS,GAAG;EAChC;EACAa,gBAAgB,EAAEjD,SAAS,CAACqC,MAAM;EAClC;EACAa,cAAc,EAAElD,SAAS,CAACuD,IAAI,CAAChB,UAAU;EACzC;EACAtB,OAAO,EAAEjB,SAAS,CAAC8C,KAAK,CAAC,CAAC,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;EACrH;EACAnC,YAAY,EAAEX,SAAS,CAACwC;AAC1B,CAAC;AAEAnC,UAAU,CAAS0C,qBAAqB,GAAGA,qBAAqB;AAEjE,eAAe1C,UAAU;AAGzB,SAAS0C,qBAAqB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","PropTypes","classNames","FontAwesomeIcon","OverlayTrigger","Tooltip","IconButton","forwardRef","_ref","ref","className","alt","invertColors","icon","src","iconClassNames","onClick","size","variant","iconAs","isActive","children","attrs","invert","activeStyle","process","env","NODE_ENV","console","msg","warn","IconComponent","createElement","type","defaultProps","undefined","value","propTypes","string","elementType","isRequired","bool","shape","prefix","iconName","array","func","oneOf","IconButtonWithTooltip","_ref2","tooltipPlacement","tooltipContent","props","placement","overlay","id","node"],"sources":["../../src/IconButton/index.tsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { type Placement } from 'react-bootstrap/Overlay';\n\nimport { OverlayTrigger } from '../Overlay';\nimport Tooltip from '../Tooltip';\nimport Icon from '../Icon';\n\ninterface Props extends React.HTMLAttributes<HTMLButtonElement> {\n iconAs?: typeof Icon | typeof FontAwesomeIcon,\n /** Additional CSS class[es] to apply to this button */\n className?: string;\n /** Alt text for your icon. For best practice, avoid using alt text to describe\n * the image in the `IconButton`. Instead, we recommend describing the function\n * of the button. */\n alt: string;\n /** Changes icon styles for dark background */\n invertColors?: boolean;\n /** An icon component to render. Example import of a Paragon icon component:\n * `import { Check } from '@openedx/paragon/icons';`\n * */\n // Note: React.ComponentType is what we want here. React.ElementType would allow some element type strings like \"div\",\n // but we only want to allow components like 'Add' (a specific icon component function/class)\n src?: React.ComponentType;\n /** Extra class names that will be added to the icon */\n iconClassNames?: string;\n /** Click handler for the button */\n onClick?: React.MouseEventHandler<HTMLButtonElement>;\n /** whether to show the `IconButton` in an active state, whose styling is distinct from default state */\n isActive?: boolean;\n /** @deprecated Using FontAwesome icons is deprecated. Instead, pass iconAs={Icon} src={...} */\n icon?: { prefix?: string; iconName?: string, icon?: any[] },\n /** Type of button (uses Bootstrap options) */\n variant?: 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'light' | 'dark' | 'black' | 'brand';\n /** size of button to render */\n size?: 'sm' | 'md' | 'inline';\n /** Used with `IconButtonToggle` */\n value?: string;\n /** no children */\n children?: never;\n}\n\nconst IconButton = React.forwardRef<HTMLButtonElement, Props>(({\n className,\n alt,\n invertColors,\n icon,\n src,\n iconClassNames,\n onClick,\n size,\n variant,\n iconAs,\n isActive,\n children, // unused, just here because we don't want it to be part of 'attrs'\n ...attrs\n}, ref) => {\n const invert = invertColors ? 'inverse-' : '';\n const activeStyle = isActive ? `${variant}-` : '';\n if (!iconAs && process.env.NODE_ENV === 'development' && console) {\n const msg = '[Deprecated] IconButton: you have not provided a value for iconAs prop and '\n + 'are using a default one - FontAwesomeIcon, the default value is going to be changed soon '\n + 'as Paragon is moving away from FontAwesome, please use Paragon\\'s icons instead.';\n // eslint-disable-next-line no-console\n console.warn(msg);\n }\n const IconComponent = iconAs || FontAwesomeIcon;\n return (\n <button\n aria-label={alt}\n className={classNames(\n 'btn-icon',\n `btn-icon-${invert}${variant}`,\n `btn-icon-${size}`,\n {\n [`btn-icon-${invert}${activeStyle}active`]: isActive,\n },\n className,\n )}\n onClick={onClick}\n type=\"button\"\n ref={ref}\n {...attrs}\n >\n <span className=\"btn-icon__icon-container\">\n <IconComponent\n className={classNames('btn-icon__icon', iconClassNames)}\n icon={icon as any}\n src={src}\n />\n </span>\n </button>\n );\n});\n\nIconButton.defaultProps = {\n iconAs: undefined,\n src: undefined,\n icon: undefined,\n iconClassNames: undefined,\n className: undefined,\n invertColors: false,\n variant: 'primary',\n size: 'md',\n onClick: () => {},\n isActive: false,\n value: undefined,\n children: undefined,\n};\n\nIconButton.propTypes = {\n /** A custom class name. */\n className: PropTypes.string,\n /** Component that renders the icon, currently defaults to `FontAwesomeIcon`,\n * but is going to be deprecated soon, please use Paragon's icons instead. */\n iconAs: PropTypes.elementType as any,\n /** An icon component to render. Example import of a Paragon icon component:\n * `import { Check } from '@openedx/paragon/icons';`\n * */\n src: PropTypes.elementType as any,\n /** Alt text for your icon. For best practice, avoid using alt text to describe\n * the image in the `IconButton`. Instead, we recommend describing the function\n * of the button. */\n alt: PropTypes.string.isRequired,\n /** Changes icon styles for dark background */\n invertColors: PropTypes.bool,\n /** Accepts a React fontawesome icon. */\n icon: PropTypes.shape({\n prefix: PropTypes.string,\n iconName: PropTypes.string,\n // eslint-disable-next-line react/forbid-prop-types\n icon: PropTypes.array,\n }) as any,\n /** Extra class names that will be added to the icon */\n iconClassNames: PropTypes.string,\n /** Click handler for the button */\n onClick: PropTypes.func,\n /** Type of button (uses Bootstrap options) */\n variant: PropTypes.oneOf(['primary', 'secondary', 'success', 'warning', 'danger', 'light', 'dark', 'black', 'brand']),\n /** size of button to render */\n size: PropTypes.oneOf(['sm', 'md', 'inline']),\n /** whether to show the `IconButton` in an active state, whose styling is distinct from default state */\n isActive: PropTypes.bool,\n /** Used with `IconButtonToggle` */\n value: PropTypes.string,\n};\n\ninterface PropsWithTooltip extends Props {\n /** choose from https://popper.js.org/docs/v2/constructors/#options */\n tooltipPlacement: Placement,\n /** any content to pass to tooltip content area */\n tooltipContent: React.ReactNode,\n}\n\n/**\n * An icon button wrapped in overlaytrigger to display a tooltip.\n */\nfunction IconButtonWithTooltip({\n tooltipPlacement, tooltipContent, ...props\n}: PropsWithTooltip) {\n const invert = props.invertColors ? 'inverse-' : '';\n return (\n <OverlayTrigger\n placement={tooltipPlacement}\n overlay={(\n <Tooltip\n id={`iconbutton-tooltip-${tooltipPlacement}`}\n variant={invert ? 'light' : undefined}\n >\n {tooltipContent}\n </Tooltip>\n )}\n >\n <IconButton {...props} />\n </OverlayTrigger>\n );\n}\n\nIconButtonWithTooltip.defaultProps = {\n ...IconButton.defaultProps,\n tooltipPlacement: 'top',\n};\n\nIconButtonWithTooltip.propTypes = {\n /** tooltip placement can be top, left, right etc, per https://popper.js.org/docs/v2/constructors/#options */\n tooltipPlacement: PropTypes.string,\n /** any valid JSX or text to be rendered as tooltip contents */\n tooltipContent: PropTypes.node.isRequired,\n /** Type of button (uses Bootstrap options) */\n variant: PropTypes.oneOf(['primary', 'secondary', 'success', 'warning', 'danger', 'light', 'dark', 'black', 'brand']),\n /** Changes icon styles for dark background */\n invertColors: PropTypes.bool,\n};\n\n(IconButton as any).IconButtonWithTooltip = IconButtonWithTooltip;\n\nexport default IconButton as typeof IconButton & {\n IconButtonWithTooltip: typeof IconButtonWithTooltip,\n};\nexport { IconButtonWithTooltip };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,eAAe,QAAQ,gCAAgC;AAGhE,SAASC,cAAc,QAAQ,YAAY;AAC3C,OAAOC,OAAO,MAAM,YAAY;AAqChC,MAAMC,UAAU,gBAAGN,KAAK,CAACO,UAAU,CAA2B,CAAAC,IAAA,EAc3DC,GAAG,KAAK;EAAA,IAdoD;IAC7DC,SAAS;IACTC,GAAG;IACHC,YAAY;IACZC,IAAI;IACJC,GAAG;IACHC,cAAc;IACdC,OAAO;IACPC,IAAI;IACJC,OAAO;IACPC,MAAM;IACNC,QAAQ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AgB;IAAEC,cAAc;IAAE,GAAGC;EACrB,CAAC,GAAAH,KAAA;EACjB,MAAM1B,MAAM,GAAG6B,KAAK,CAACxC,YAAY,GAAG,UAAU,GAAG,EAAE;EACnD,oBACEZ,KAAA,CAAAgC,aAAA,CAAC5B,cAAc;IACbiD,SAAS,EAAEH,gBAAiB;IAC5BI,OAAO,eACLtD,KAAA,CAAAgC,aAAA,CAAC3B,OAAO;MACNkD,EAAE,EAAE,sBAAsBL,gBAAgB,EAAG;MAC7ChC,OAAO,EAAEK,MAAM,GAAG,OAAO,GAAGY;IAAU,GAErCgB,cACM;EACT,gBAEFnD,KAAA,CAAAgC,aAAA,CAAC1B,UAAU;IAAA,GAAK8C;EAAK,CAAG,CACV,CAAC;AAErB;AAEAJ,qBAAqB,CAACd,YAAY,GAAG;EACnC,GAAG5B,UAAU,CAAC4B,YAAY;EAC1BgB,gBAAgB,EAAE;AACpB,CAAC;AAEDF,qBAAqB,CAACX,SAAS,GAAG;EAChC;EACAa,gBAAgB,EAAEjD,SAAS,CAACqC,MAAM;EAClC;EACAa,cAAc,EAAElD,SAAS,CAACuD,IAAI,CAAChB,UAAU;EACzC;EACAtB,OAAO,EAAEjB,SAAS,CAAC8C,KAAK,CAAC,CAAC,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;EACrH;EACAnC,YAAY,EAAEX,SAAS,CAACwC;AAC1B,CAAC;AAEAnC,UAAU,CAAS0C,qBAAqB,GAAGA,qBAAqB;AAEjE,eAAe1C,UAAU;AAGzB,SAAS0C,qBAAqB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useMemo","PropTypes","IconButtonToggle","_ref","activeValue","onChange","children","iconButtons","Children","map","iconButton","isActive","props","value","cloneElement","onClick","createElement","className","defaultProps","undefined","propTypes","string","func","node","isRequired"],"sources":["../../src/IconButtonToggle/index.jsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport PropTypes from 'prop-types';\n\n/**\n *\n * @param {object} args arguments\n * @param {boolean} args.activeValue the current value of the active/selected iconButton.\n * if not provided, none of the iconButtons will initially be active\n * @param {Function} args.onChange callback to call when toggle value changes.\n * Receives value of the selected toggle button.\n * @param {Array<IconButton>} args.children children components expected to be IconButton\n * @returns {React.Component} A React component\n */\nfunction IconButtonToggle({ activeValue, onChange, children }) {\n const iconButtons = useMemo(\n () => React.Children.map(children, iconButton => {\n const isActive = iconButton.props.value === activeValue;\n return React.cloneElement(iconButton, {\n onClick: () => { onChange(iconButton.props.value); },\n isActive,\n 'aria-selected': isActive,\n 'data-testid': `icon-btn-val-${iconButton.props.value}`,\n });\n }),\n [children, activeValue, onChange],\n );\n return <div className=\"pgn__icon-button-toggle__container\">{iconButtons}</div>;\n}\n\nIconButtonToggle.defaultProps = {\n onChange: () => {},\n activeValue: undefined,\n};\n\nIconButtonToggle.propTypes = {\n /** value to use to check which button to set to active */\n activeValue: PropTypes.string,\n /** handler that is passed the currently active button's value when a button is selected */\n onChange: PropTypes.func,\n /** child nodes of type `IconButton` (or its subcomponents) to be rendered within toggle group */\n children: PropTypes.node.isRequired,\n};\n\nexport default IconButtonToggle;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,OAAO,QAAQ,OAAO;AACtC,OAAOC,SAAS,MAAM,YAAY;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,gBAAgBA,CAAAC,IAAA,EAAsC;EAAA,IAArC;IAAEC,WAAW;IAAEC,QAAQ;IAAEC;EAAS,CAAC,GAAAH,IAAA;EAC3D,MAAMI,WAAW,GAAGP,OAAO,CACzB,MAAMD,KAAK,CAACS,QAAQ,CAACC,GAAG,CAACH,QAAQ,EAAEI,UAAU,IAAI;IAC/C,MAAMC,QAAQ,GAAGD,UAAU,CAACE,KAAK,CAACC,KAAK,KAAKT,WAAW;IACvD,oBAAOL,KAAK,CAACe,YAAY,CAACJ,UAAU,EAAE;MACpCK,OAAO,EAAEA,CAAA,KAAM;QAAEV,QAAQ,CAACK,UAAU,CAACE,KAAK,CAACC,KAAK,CAAC;MAAE,CAAC;MACpDF,QAAQ;MACR,eAAe,EAAEA,QAAQ;MACzB,aAAa,
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useMemo","PropTypes","IconButtonToggle","_ref","activeValue","onChange","children","iconButtons","Children","map","iconButton","isActive","props","value","cloneElement","onClick","createElement","className","defaultProps","undefined","propTypes","string","func","node","isRequired"],"sources":["../../src/IconButtonToggle/index.jsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport PropTypes from 'prop-types';\n\n/**\n *\n * @param {object} args arguments\n * @param {boolean} args.activeValue the current value of the active/selected iconButton.\n * if not provided, none of the iconButtons will initially be active\n * @param {Function} args.onChange callback to call when toggle value changes.\n * Receives value of the selected toggle button.\n * @param {Array<IconButton>} args.children children components expected to be IconButton\n * @returns {React.Component} A React component\n */\nfunction IconButtonToggle({ activeValue, onChange, children }) {\n const iconButtons = useMemo(\n () => React.Children.map(children, iconButton => {\n const isActive = iconButton.props.value === activeValue;\n return React.cloneElement(iconButton, {\n onClick: () => { onChange(iconButton.props.value); },\n isActive,\n 'aria-selected': isActive,\n 'data-testid': `icon-btn-val-${iconButton.props.value}`,\n });\n }),\n [children, activeValue, onChange],\n );\n return <div className=\"pgn__icon-button-toggle__container\">{iconButtons}</div>;\n}\n\nIconButtonToggle.defaultProps = {\n onChange: () => {},\n activeValue: undefined,\n};\n\nIconButtonToggle.propTypes = {\n /** value to use to check which button to set to active */\n activeValue: PropTypes.string,\n /** handler that is passed the currently active button's value when a button is selected */\n onChange: PropTypes.func,\n /** child nodes of type `IconButton` (or its subcomponents) to be rendered within toggle group */\n children: PropTypes.node.isRequired,\n};\n\nexport default IconButtonToggle;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,OAAO,QAAQ,OAAO;AACtC,OAAOC,SAAS,MAAM,YAAY;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,gBAAgBA,CAAAC,IAAA,EAAsC;EAAA,IAArC;IAAEC,WAAW;IAAEC,QAAQ;IAAEC;EAAS,CAAC,GAAAH,IAAA;EAC3D,MAAMI,WAAW,GAAGP,OAAO,CACzB,MAAMD,KAAK,CAACS,QAAQ,CAACC,GAAG,CAACH,QAAQ,EAAEI,UAAU,IAAI;IAC/C,MAAMC,QAAQ,GAAGD,UAAU,CAACE,KAAK,CAACC,KAAK,KAAKT,WAAW;IACvD,oBAAOL,KAAK,CAACe,YAAY,CAACJ,UAAU,EAAE;MACpCK,OAAO,EAAEA,CAAA,KAAM;QAAEV,QAAQ,CAACK,UAAU,CAACE,KAAK,CAACC,KAAK,CAAC;MAAE,CAAC;MACpDF,QAAQ;MACR,eAAe,EAAEA,QAAQ;MACzB,aAAa,EAAE,gBAAgBD,UAAU,CAACE,KAAK,CAACC,KAAK;IACvD,CAAC,CAAC;EACJ,CAAC,CAAC,EACF,CAACP,QAAQ,EAAEF,WAAW,EAAEC,QAAQ,CAClC,CAAC;EACD,oBAAON,KAAA,CAAAiB,aAAA;IAAKC,SAAS,EAAC;EAAoC,GAAEV,WAAiB,CAAC;AAChF;AAEAL,gBAAgB,CAACgB,YAAY,GAAG;EAC9Bb,QAAQ,EAAEA,CAAA,KAAM,CAAC,CAAC;EAClBD,WAAW,EAAEe;AACf,CAAC;AAEDjB,gBAAgB,CAACkB,SAAS,GAAG;EAC3B;EACAhB,WAAW,EAAEH,SAAS,CAACoB,MAAM;EAC7B;EACAhB,QAAQ,EAAEJ,SAAS,CAACqB,IAAI;EACxB;EACAhB,QAAQ,EAAEL,SAAS,CAACsB,IAAI,CAACC;AAC3B,CAAC;AAED,eAAetB,gBAAgB","ignoreList":[]}
|
package/dist/Input/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","classNames","PropTypes","Input","Component","componentDidMount","process","env","NODE_ENV","checkHasLabel","getHTMLTagForType","type","props","getClassNameForType","setRef","forwardedRef","element","current","inputEl","labels","length","getAttribute","console","warn","renderOptions","options","map","option","value","label","group","attributes","createElement","key","render","className","htmlTag","htmlProps","undefined","ref","htmlChildren","propTypes","oneOf","isRequired","string","arrayOf","shape","oneOfType","number","disabled","bool","defaultProps","InputWithRefForwarding","forwardRef"],"sources":["../../src/Input/index.jsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport PropTypes from 'prop-types';\n\nclass Input extends React.Component {\n componentDidMount() {\n if (process.env.NODE_ENV === 'development') {\n this.checkHasLabel();\n }\n }\n\n getHTMLTagForType() {\n const { type } = this.props;\n if (type === 'select' || type === 'textarea') { return type; }\n return 'input';\n }\n\n getClassNameForType() {\n switch (this.props.type) {\n case 'file':\n return 'form-control-file';\n case 'checkbox':\n case 'radio':\n return 'form-check-input';\n default:\n return 'form-control';\n }\n }\n\n setRef(forwardedRef) {\n // In production just return the optional forwardedRef\n if (process.env.NODE_ENV !== 'development') { return forwardedRef; }\n\n return (element) => {\n if (forwardedRef) { forwardedRef.current = element; } // eslint-disable-line no-param-reassign\n this.inputEl = element;\n };\n }\n\n checkHasLabel() {\n if (this.inputEl.labels.length > 0) { return; }\n if (this.inputEl.getAttribute('aria-label') !== null) { return; }\n if (this.inputEl.getAttribute('aria-labelledby') !== null) { return; }\n\n if (console) {\n // eslint-disable-next-line no-console\n console.warn('Input[a11y]: There is no associated label for this Input');\n }\n }\n\n renderOptions(options) {\n return options.map((option) => {\n const {\n value,\n label,\n group,\n ...attributes\n } = option;\n\n if (group) {\n return (\n <optgroup key={`optgroup-${label}`} label={label} {...attributes}>\n {this.renderOptions(group)}\n </optgroup>\n );\n }\n return (\n <option key={value} value={value} {...attributes}>\n {label}\n </option>\n );\n }, this);\n }\n\n render() {\n const {\n type,\n className,\n options,\n forwardedRef, // eslint-disable-line react/prop-types\n ...attributes // eslint-disable-line react/prop-types\n } = this.props;\n\n const htmlTag = this.getHTMLTagForType();\n const htmlProps = {\n className: classNames(this.getClassNameForType(), className),\n type: htmlTag === 'input' ? type : undefined,\n ...attributes,\n ref: this.setRef(forwardedRef),\n };\n const htmlChildren = type === 'select' ? this.renderOptions(options) : null;\n\n return React.createElement(htmlTag, htmlProps, htmlChildren);\n }\n}\n\nInput.propTypes = {\n /** specifies the type of component.\n * One of select, textarea, or any valid type for an html input tag. */\n type: PropTypes.oneOf([\n 'textarea',\n 'select',\n 'checkbox',\n 'color',\n 'date',\n 'datetime',\n 'datetime-local',\n 'email',\n 'file',\n 'hidden',\n 'image',\n 'month',\n 'number',\n 'password',\n 'radio',\n 'range',\n 'reset',\n 'search',\n 'submit',\n 'tel',\n 'text',\n 'time',\n 'url',\n 'week',\n ]).isRequired,\n /** specifies the className in addition to a bootstrap class name. */\n className: PropTypes.string,\n /** should be used to specify the options of an Input of type select */\n options: PropTypes.arrayOf(PropTypes.shape({\n label: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n disabled: PropTypes.bool,\n group: PropTypes.arrayOf(PropTypes.shape({\n label: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n disabled: PropTypes.bool,\n })),\n })),\n};\n\nInput.defaultProps = {\n className: undefined,\n options: [],\n};\n\n// eslint-disable-next-line react/no-multi-comp\nconst InputWithRefForwarding = React.forwardRef((props, ref) => (\n <Input forwardedRef={ref} {...props} />\n));\n\nexport default InputWithRefForwarding;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,SAAS,MAAM,YAAY;AAElC,MAAMC,KAAK,SAASH,KAAK,CAACI,SAAS,CAAC;EAClCC,iBAAiBA,CAAA,EAAG;IAClB,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,aAAa,EAAE;MAC1C,I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C,KAAK;QACL,GAAGC;MACL,CAAC,GAAGJ,MAAM;MAEV,IAAIG,KAAK,EAAE;QACT,oBACE9B,KAAA,CAAAgC,aAAA;UAAUC,GAAG,
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","classNames","PropTypes","Input","Component","componentDidMount","process","env","NODE_ENV","checkHasLabel","getHTMLTagForType","type","props","getClassNameForType","setRef","forwardedRef","element","current","inputEl","labels","length","getAttribute","console","warn","renderOptions","options","map","option","value","label","group","attributes","createElement","key","render","className","htmlTag","htmlProps","undefined","ref","htmlChildren","propTypes","oneOf","isRequired","string","arrayOf","shape","oneOfType","number","disabled","bool","defaultProps","InputWithRefForwarding","forwardRef"],"sources":["../../src/Input/index.jsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport PropTypes from 'prop-types';\n\nclass Input extends React.Component {\n componentDidMount() {\n if (process.env.NODE_ENV === 'development') {\n this.checkHasLabel();\n }\n }\n\n getHTMLTagForType() {\n const { type } = this.props;\n if (type === 'select' || type === 'textarea') { return type; }\n return 'input';\n }\n\n getClassNameForType() {\n switch (this.props.type) {\n case 'file':\n return 'form-control-file';\n case 'checkbox':\n case 'radio':\n return 'form-check-input';\n default:\n return 'form-control';\n }\n }\n\n setRef(forwardedRef) {\n // In production just return the optional forwardedRef\n if (process.env.NODE_ENV !== 'development') { return forwardedRef; }\n\n return (element) => {\n if (forwardedRef) { forwardedRef.current = element; } // eslint-disable-line no-param-reassign\n this.inputEl = element;\n };\n }\n\n checkHasLabel() {\n if (this.inputEl.labels.length > 0) { return; }\n if (this.inputEl.getAttribute('aria-label') !== null) { return; }\n if (this.inputEl.getAttribute('aria-labelledby') !== null) { return; }\n\n if (console) {\n // eslint-disable-next-line no-console\n console.warn('Input[a11y]: There is no associated label for this Input');\n }\n }\n\n renderOptions(options) {\n return options.map((option) => {\n const {\n value,\n label,\n group,\n ...attributes\n } = option;\n\n if (group) {\n return (\n <optgroup key={`optgroup-${label}`} label={label} {...attributes}>\n {this.renderOptions(group)}\n </optgroup>\n );\n }\n return (\n <option key={value} value={value} {...attributes}>\n {label}\n </option>\n );\n }, this);\n }\n\n render() {\n const {\n type,\n className,\n options,\n forwardedRef, // eslint-disable-line react/prop-types\n ...attributes // eslint-disable-line react/prop-types\n } = this.props;\n\n const htmlTag = this.getHTMLTagForType();\n const htmlProps = {\n className: classNames(this.getClassNameForType(), className),\n type: htmlTag === 'input' ? type : undefined,\n ...attributes,\n ref: this.setRef(forwardedRef),\n };\n const htmlChildren = type === 'select' ? this.renderOptions(options) : null;\n\n return React.createElement(htmlTag, htmlProps, htmlChildren);\n }\n}\n\nInput.propTypes = {\n /** specifies the type of component.\n * One of select, textarea, or any valid type for an html input tag. */\n type: PropTypes.oneOf([\n 'textarea',\n 'select',\n 'checkbox',\n 'color',\n 'date',\n 'datetime',\n 'datetime-local',\n 'email',\n 'file',\n 'hidden',\n 'image',\n 'month',\n 'number',\n 'password',\n 'radio',\n 'range',\n 'reset',\n 'search',\n 'submit',\n 'tel',\n 'text',\n 'time',\n 'url',\n 'week',\n ]).isRequired,\n /** specifies the className in addition to a bootstrap class name. */\n className: PropTypes.string,\n /** should be used to specify the options of an Input of type select */\n options: PropTypes.arrayOf(PropTypes.shape({\n label: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n disabled: PropTypes.bool,\n group: PropTypes.arrayOf(PropTypes.shape({\n label: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n disabled: PropTypes.bool,\n })),\n })),\n};\n\nInput.defaultProps = {\n className: undefined,\n options: [],\n};\n\n// eslint-disable-next-line react/no-multi-comp\nconst InputWithRefForwarding = React.forwardRef((props, ref) => (\n <Input forwardedRef={ref} {...props} />\n));\n\nexport default InputWithRefForwarding;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAO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YAAY,GAAG;EACnBhB,SAAS,EAAEG,SAAS;EACpBb,OAAO,EAAE;AACX,CAAC;;AAED;AACA,MAAM2B,sBAAsB,gBAAGpD,KAAK,CAACqD,UAAU,CAAC,CAACzC,KAAK,EAAE2B,GAAG,kBACzDvC,KAAA,CAAAgC,aAAA,CAAC7B,KAAK;EAACY,YAAY,EAAEwB,GAAI;EAAA,GAAK3B;AAAK,CAAG,CACvC,CAAC;AAEF,eAAewC,sBAAsB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","PropTypes","asInput","withDeprecatedProps","DeprTypes","Select","Component","getOption","option","i","disabled","label","value","createElement","key","getOptions","props","options","map","section","groupOpts","opt","j","render","className","inputRef","others","type","ref","propTypes","string","oneOfType","func","shape","current","instanceOf","element","arrayOf","isRequired","defaultProps","undefined","InputSelect","deprType","FORMAT","expect","transform","Array","isArray","join","message"],"sources":["../../src/InputSelect/index.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nimport asInput from '../asInput';\nimport withDeprecatedProps, { DeprTypes } from '../withDeprecatedProps';\n\nclass Select extends React.Component {\n static getOption(option, i) {\n const { disabled } = option;\n let { label, value } = option;\n\n if (typeof option === 'string') {\n label = option;\n value = option;\n }\n\n return (\n <option\n key={`option-${i}`}\n value={value}\n disabled={disabled}\n >\n {label}\n </option>\n );\n }\n\n getOptions() {\n return this.props.options.map((option, i) => {\n let section;\n if (option.options) {\n const groupOpts = option.options.map((opt, j) => Select.getOption(opt, j));\n section = (\n <optgroup label={option.label} key={option.label}>\n {groupOpts}\n </optgroup>\n );\n } else {\n section = Select.getOption(option, i);\n }\n return section;\n });\n }\n\n render() {\n const {\n className,\n inputRef,\n ...others\n } = this.props;\n const options = this.getOptions();\n\n return (\n <select\n {...others}\n className={className}\n type=\"select\"\n ref={inputRef}\n >\n {options}\n </select>\n );\n }\n}\n\nSelect.propTypes = {\n className: PropTypes.string,\n inputRef: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.shape({ current: PropTypes.instanceOf(PropTypes.element) }),\n ]),\n options: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.string),\n PropTypes.arrayOf(PropTypes.shape({})),\n ]).isRequired,\n};\n\nSelect.defaultProps = {\n className: undefined,\n inputRef: undefined,\n};\n\nconst InputSelect = asInput(withDeprecatedProps(Select, 'InputSelect', {\n className: {\n deprType: DeprTypes.FORMAT,\n expect: value => typeof value === 'string',\n transform: value => (Array.isArray(value) ? value.join(' ') : value),\n message: 'It should be a string.',\n },\n}));\n\nexport default InputSelect;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAElC,OAAOC,OAAO,MAAM,YAAY;AAChC,OAAOC,mBAAmB,IAAIC,SAAS,QAAQ,wBAAwB;AAEvE,MAAMC,MAAM,SAASL,KAAK,CAACM,SAAS,CAAC;EACnC,OAAOC,SAASA,CAACC,MAAM,EAAEC,CAAC,EAAE;IAC1B,MAAM;MAAEC;IAAS,CAAC,GAAGF,MAAM;IAC3B,IAAI;MAAEG,KAAK;MAAEC;IAAM,CAAC,GAAGJ,MAAM;IAE7B,IAAI,OAAOA,MAAM,KAAK,QAAQ,EAAE;MAC9BG,KAAK,GAAGH,MAAM;MACdI,KAAK,GAAGJ,MAAM;IAChB;IAEA,oBACER,KAAA,CAAAa,aAAA;MACEC,GAAG,
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","PropTypes","asInput","withDeprecatedProps","DeprTypes","Select","Component","getOption","option","i","disabled","label","value","createElement","key","getOptions","props","options","map","section","groupOpts","opt","j","render","className","inputRef","others","type","ref","propTypes","string","oneOfType","func","shape","current","instanceOf","element","arrayOf","isRequired","defaultProps","undefined","InputSelect","deprType","FORMAT","expect","transform","Array","isArray","join","message"],"sources":["../../src/InputSelect/index.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nimport asInput from '../asInput';\nimport withDeprecatedProps, { DeprTypes } from '../withDeprecatedProps';\n\nclass Select extends React.Component {\n static getOption(option, i) {\n const { disabled } = option;\n let { label, value } = option;\n\n if (typeof option === 'string') {\n label = option;\n value = option;\n }\n\n return (\n <option\n key={`option-${i}`}\n value={value}\n disabled={disabled}\n >\n {label}\n </option>\n );\n }\n\n getOptions() {\n return this.props.options.map((option, i) => {\n let section;\n if (option.options) {\n const groupOpts = option.options.map((opt, j) => Select.getOption(opt, j));\n section = (\n <optgroup label={option.label} key={option.label}>\n {groupOpts}\n </optgroup>\n );\n } else {\n section = Select.getOption(option, i);\n }\n return section;\n });\n }\n\n render() {\n const {\n className,\n inputRef,\n ...others\n } = this.props;\n const options = this.getOptions();\n\n return (\n <select\n {...others}\n className={className}\n type=\"select\"\n ref={inputRef}\n >\n {options}\n </select>\n );\n }\n}\n\nSelect.propTypes = {\n className: PropTypes.string,\n inputRef: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.shape({ current: PropTypes.instanceOf(PropTypes.element) }),\n ]),\n options: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.string),\n PropTypes.arrayOf(PropTypes.shape({})),\n ]).isRequired,\n};\n\nSelect.defaultProps = {\n className: undefined,\n inputRef: undefined,\n};\n\nconst InputSelect = asInput(withDeprecatedProps(Select, 'InputSelect', {\n className: {\n deprType: DeprTypes.FORMAT,\n expect: value => typeof value === 'string',\n transform: value => (Array.isArray(value) ? value.join(' ') : value),\n message: 'It should be a string.',\n },\n}));\n\nexport default InputSelect;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAElC,OAAOC,OAAO,MAAM,YAAY;AAChC,OAAOC,mBAAmB,IAAIC,SAAS,QAAQ,wBAAwB;AAEvE,MAAMC,MAAM,SAASL,KAAK,CAACM,SAAS,CAAC;EACnC,OAAOC,SAASA,CAACC,MAAM,EAAEC,CAAC,EAAE;IAC1B,MAAM;MAAEC;IAAS,CAAC,GAAGF,MAAM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EAZ,MAAM,CAACwB,SAAS,GAAG;EACjBL,SAAS,EAAEvB,SAAS,CAAC6B,MAAM;EAC3BL,QAAQ,EAAExB,SAAS,CAAC8B,SAAS,CAAC,CAC5B9B,SAAS,CAAC+B,IAAI,EACd/B,SAAS,CAACgC,KAAK,CAAC;IAAEC,OAAO,EAAEjC,SAAS,CAACkC,UAAU,CAAClC,SAAS,CAACmC,OAAO;EAAE,CAAC,CAAC,CACtE,CAAC;EACFnB,OAAO,EAAEhB,SAAS,CAAC8B,SAAS,CAAC,CAC3B9B,SAAS,CAACoC,OAAO,CAACpC,SAAS,CAAC6B,MAAM,CAAC,EACnC7B,SAAS,CAACoC,OAAO,CAACpC,SAAS,CAACgC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CACvC,CAAC,CAACK;AACL,CAAC;AAEDjC,MAAM,CAACkC,YAAY,GAAG;EACpBf,SAAS,EAAEgB,SAAS;EACpBf,QAAQ,EAAEe;AACZ,CAAC;AAED,MAAMC,WAAW,GAAGvC,OAAO,CAACC,mBAAmB,CAACE,MAAM,EAAE,aAAa,EAAE;EACrEmB,SAAS,EAAE;IACTkB,QAAQ,EAAEtC,SAAS,CAACuC,MAAM;IAC1BC,MAAM,EAAEhC,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ;IAC1CiC,SAAS,EAAEjC,KAAK,IAAKkC,KAAK,CAACC,OAAO,CAACnC,KAAK,CAAC,GAAGA,KAAK,CAACoC,IAAI,CAAC,GAAG,CAAC,GAAGpC,KAAM;IACpEqC,OAAO,EAAE;EACX;AACF,CAAC,CAAC,CAAC;AAEH,eAAeR,WAAW","ignoreList":[]}
|
package/dist/Layout/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","Col","Row","PropTypes","COL_VALUES","SIZES","LayoutElement","forwardRef","props","ref","createElement","Layout","_ref","children","childrenLength","length","isValidDimensions","dataList","validLength","errors","layout","Children","map","child","index","newProps","forEach","size","sizeProps","span","offset","undefined","Object","keys","breakpoint","console","error","defaultProps","xs","sm","md","lg","xl","propTypes","node","isRequired","arrayOf","shape","oneOf","sizeDefaultProps","Element"],"sources":["../../src/Layout/index.jsx"],"sourcesContent":["import React from 'react';\nimport Col from 'react-bootstrap/Col';\nimport Row from 'react-bootstrap/Row';\nimport PropTypes from 'prop-types';\n\nconst COL_VALUES = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 'auto'];\nconst SIZES = ['xs', 'sm', 'md', 'lg', 'xl'];\n\nconst LayoutElement = React.forwardRef((props, ref) => <div ref={ref} {...props} />);\n\nconst Layout = React.forwardRef(({ children, ...props }, ref) => {\n const childrenLength = children.length;\n\n const isValidDimensions = (dataList, validLength) => !dataList || dataList.length === validLength;\n const errors = {};\n\n const layout = React.Children.map(children, (child, index) => {\n const newProps = { ...child.props };\n SIZES.forEach(size => {\n const sizeProps = props[size];\n const { span = 0, offset = 0 } = (sizeProps && sizeProps[index]) || {};\n if (errors[size] === undefined) {\n errors[size] = false;\n if (!isValidDimensions(sizeProps, childrenLength)) {\n errors[size] = `${size} prop accepts array which length must be equal to the number of children.`;\n }\n }\n newProps[size] = { span, offset };\n });\n newProps.ref = child.ref;\n return React.createElement(Col, newProps, child.props.children);\n });\n\n Object.keys(errors).forEach(breakpoint => {\n if (errors[breakpoint]) {\n // eslint-disable-next-line no-console\n console.error(errors[breakpoint]);\n }\n });\n\n return (\n <Row ref={ref}>\n {layout}\n </Row>\n );\n});\n\nLayout.defaultProps = {\n xs: undefined,\n sm: undefined,\n md: undefined,\n lg: undefined,\n xl: undefined,\n};\n\nLayout.propTypes = {\n children: PropTypes.node.isRequired,\n xs: PropTypes.arrayOf(PropTypes.shape({\n span: PropTypes.oneOf(COL_VALUES).isRequired,\n offset: PropTypes.oneOf(COL_VALUES),\n })),\n sm: PropTypes.arrayOf(PropTypes.shape({\n span: PropTypes.oneOf(COL_VALUES).isRequired,\n offset: PropTypes.oneOf(COL_VALUES),\n })),\n md: PropTypes.arrayOf(PropTypes.shape({\n span: PropTypes.oneOf(COL_VALUES).isRequired,\n offset: PropTypes.oneOf(COL_VALUES),\n })),\n lg: PropTypes.arrayOf(PropTypes.shape({\n span: PropTypes.oneOf(COL_VALUES).isRequired,\n offset: PropTypes.oneOf(COL_VALUES),\n })),\n xl: PropTypes.arrayOf(PropTypes.shape({\n span: PropTypes.oneOf(COL_VALUES).isRequired,\n offset: PropTypes.oneOf(COL_VALUES),\n })),\n};\n\nconst sizeDefaultProps = { span: [], offset: [] };\n\nSIZES.forEach(size => {\n // eslint-disable-next-line react/default-props-match-prop-types\n Layout.defaultProps[size] = sizeDefaultProps;\n});\n\nexport { Col, Row };\nLayout.Element = LayoutElement;\nexport default Layout;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,GAAG,MAAM,qBAAqB;AACrC,OAAOC,GAAG,MAAM,qBAAqB;AACrC,OAAOC,SAAS,MAAM,YAAY;AAElC,MAAMC,UAAU,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC;AACrE,MAAMC,KAAK,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;AAE5C,MAAMC,aAAa,gBAAGN,KAAK,CAACO,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,kBAAKT,KAAA,CAAAU,aAAA;EAAKD,GAAG,EAAEA,GAAI;EAAA,GAAKD;AAAK,CAAG,CAAC,CAAC;AAEpF,MAAMG,MAAM,gBAAGX,KAAK,CAACO,UAAU,CAAC,CAAAK,IAAA,EAAyBH,GAAG,KAAK;EAAA,IAAhC;IAAEI,QAAQ;IAAE,GAAGL;EAAM,CAAC,GAAAI,IAAA;EACrD,MAAME,cAAc,GAAGD,QAAQ,CAACE,MAAM;EAEtC,MAAMC,iBAAiB,GAAGA,CAACC,QAAQ,EAAEC,WAAW,KAAK,CAACD,QAAQ,IAAIA,QAAQ,CAACF,MAAM,KAAKG,WAAW;EACjG,MAAMC,MAAM,GAAG,CAAC,CAAC;EAEjB,MAAMC,MAAM,GAAGpB,KAAK,CAACqB,QAAQ,CAACC,GAAG,CAACT,QAAQ,EAAE,CAACU,KAAK,EAAEC,KAAK,KAAK;IAC5D,MAAMC,QAAQ,GAAG;MAAE,GAAGF,KAAK,CAACf;IAAM,CAAC;IACnCH,KAAK,CAACqB,OAAO,CAACC,IAAI,IAAI;MACpB,MAAMC,SAAS,GAAGpB,KAAK,CAACmB,IAAI,CAAC;MAC7B,MAAM;QAAEE,IAAI,GAAG,CAAC;QAAEC,MAAM,GAAG;MAAE,CAAC,GAAIF,SAAS,IAAIA,SAAS,CAACJ,KAAK,CAAC,IAAK,CAAC,CAAC;MACtE,IAAIL,MAAM,CAACQ,IAAI,CAAC,KAAKI,SAAS,EAAE;QAC9BZ,MAAM,CAACQ,IAAI,CAAC,GAAG,KAAK;QACpB,IAAI,CAACX,iBAAiB,CAACY,SAAS,EAAEd,cAAc,CAAC,EAAE;UACjDK,MAAM,CAACQ,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","Col","Row","PropTypes","COL_VALUES","SIZES","LayoutElement","forwardRef","props","ref","createElement","Layout","_ref","children","childrenLength","length","isValidDimensions","dataList","validLength","errors","layout","Children","map","child","index","newProps","forEach","size","sizeProps","span","offset","undefined","Object","keys","breakpoint","console","error","defaultProps","xs","sm","md","lg","xl","propTypes","node","isRequired","arrayOf","shape","oneOf","sizeDefaultProps","Element"],"sources":["../../src/Layout/index.jsx"],"sourcesContent":["import React from 'react';\nimport Col from 'react-bootstrap/Col';\nimport Row from 'react-bootstrap/Row';\nimport PropTypes from 'prop-types';\n\nconst COL_VALUES = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 'auto'];\nconst SIZES = ['xs', 'sm', 'md', 'lg', 'xl'];\n\nconst LayoutElement = React.forwardRef((props, ref) => <div ref={ref} {...props} />);\n\nconst Layout = React.forwardRef(({ children, ...props }, ref) => {\n const childrenLength = children.length;\n\n const isValidDimensions = (dataList, validLength) => !dataList || dataList.length === validLength;\n const errors = {};\n\n const layout = React.Children.map(children, (child, index) => {\n const newProps = { ...child.props };\n SIZES.forEach(size => {\n const sizeProps = props[size];\n const { span = 0, offset = 0 } = (sizeProps && sizeProps[index]) || {};\n if (errors[size] === undefined) {\n errors[size] = false;\n if (!isValidDimensions(sizeProps, childrenLength)) {\n errors[size] = `${size} prop accepts array which length must be equal to the number of children.`;\n }\n }\n newProps[size] = { span, offset };\n });\n newProps.ref = child.ref;\n return React.createElement(Col, newProps, child.props.children);\n });\n\n Object.keys(errors).forEach(breakpoint => {\n if (errors[breakpoint]) {\n // eslint-disable-next-line no-console\n console.error(errors[breakpoint]);\n }\n });\n\n return (\n <Row ref={ref}>\n {layout}\n </Row>\n );\n});\n\nLayout.defaultProps = {\n xs: undefined,\n sm: undefined,\n md: undefined,\n lg: undefined,\n xl: undefined,\n};\n\nLayout.propTypes = {\n children: PropTypes.node.isRequired,\n xs: PropTypes.arrayOf(PropTypes.shape({\n span: PropTypes.oneOf(COL_VALUES).isRequired,\n offset: PropTypes.oneOf(COL_VALUES),\n })),\n sm: PropTypes.arrayOf(PropTypes.shape({\n span: PropTypes.oneOf(COL_VALUES).isRequired,\n offset: PropTypes.oneOf(COL_VALUES),\n })),\n md: PropTypes.arrayOf(PropTypes.shape({\n span: PropTypes.oneOf(COL_VALUES).isRequired,\n offset: PropTypes.oneOf(COL_VALUES),\n })),\n lg: PropTypes.arrayOf(PropTypes.shape({\n span: PropTypes.oneOf(COL_VALUES).isRequired,\n offset: PropTypes.oneOf(COL_VALUES),\n })),\n xl: PropTypes.arrayOf(PropTypes.shape({\n span: PropTypes.oneOf(COL_VALUES).isRequired,\n offset: PropTypes.oneOf(COL_VALUES),\n })),\n};\n\nconst sizeDefaultProps = { span: [], offset: [] };\n\nSIZES.forEach(size => {\n // eslint-disable-next-line react/default-props-match-prop-types\n Layout.defaultProps[size] = sizeDefaultProps;\n});\n\nexport { Col, Row };\nLayout.Element = LayoutElement;\nexport default Layout;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,GAAG,MAAM,qBAAqB;AACrC,OAAOC,GAAG,MAAM,qBAAqB;AACrC,OAAOC,SAAS,MAAM,YAAY;AAElC,MAAMC,UAAU,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC;AACrE,MAAMC,KAAK,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;AAE5C,MAAMC,aAAa,gBAAGN,KAAK,CAACO,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,kBAAKT,KAAA,CAAAU,aAAA;EAAKD,GAAG,EAAEA,GAAI;EAAA,GAAKD;AAAK,CAAG,CAAC,CAAC;AAEpF,MAAMG,MAAM,gBAAGX,KAAK,CAACO,UAAU,CAAC,CAAAK,IAAA,EAAyBH,GAAG,KAAK;EAAA,IAAhC;IAAEI,QAAQ;IAAE,GAAGL;EAAM,CAAC,GAAAI,IAAA;EACrD,MAAME,cAAc,GAAGD,QAAQ,CAACE,MAAM;EAEtC,MAAMC,iBAAiB,GAAGA,CAACC,QAAQ,EAAEC,WAAW,KAAK,CAACD,QAAQ,IAAIA,QAAQ,CAACF,MAAM,KAAKG,WAAW;EACjG,MAAMC,MAAM,GAAG,CAAC,CAAC;EAEjB,MAAMC,MAAM,GAAGpB,KAAK,CAACqB,QAAQ,CAACC,GAAG,CAACT,QAAQ,EAAE,CAACU,KAAK,EAAE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yC,UAAU;IAC5Cf,MAAM,EAAE3B,SAAS,CAAC6C,KAAK,CAAC5C,UAAU;EACpC,CAAC,CAAC;AACJ,CAAC;AAED,MAAM6C,gBAAgB,GAAG;EAAEpB,IAAI,EAAE,EAAE;EAAEC,MAAM,EAAE;AAAG,CAAC;AAEjDzB,KAAK,CAACqB,OAAO,CAACC,IAAI,IAAI;EACpB;EACAhB,MAAM,CAAC0B,YAAY,CAACV,IAAI,CAAC,GAAGsB,gBAAgB;AAC9C,CAAC,CAAC;AAEF,SAAShD,GAAG,EAAEC,GAAG;AACjBS,MAAM,CAACuC,OAAO,GAAG5C,aAAa;AAC9B,eAAeK,MAAM","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["classNames","PropTypes","React","nonNegativeInteger","ListBox","Component","constructor","props","onFocus","bind","onKeyDown","state","selectedOptionIndex","getDerivedStateFromProps","nextProps","prevState","undefined","setState","e","key","preventDefault","Children","count","children","renderChildren","map","child","index","cloneElement","isSelected","onSelect","render","className","tag","other","createElement","role","tabIndex","propTypes","node","isRequired","string","defaultProps"],"sources":["../../src/ListBox/index.jsx"],"sourcesContent":["/* eslint-disable max-len */\nimport classNames from 'classnames';\nimport PropTypes from 'prop-types';\nimport React from 'react';\nimport { nonNegativeInteger } from '../utils/propTypes';\n\nexport default class ListBox extends React.Component {\n constructor(props) {\n super(props);\n\n this.onFocus = this.onFocus.bind(this);\n this.onKeyDown = this.onKeyDown.bind(this);\n\n this.state = {\n selectedOptionIndex: null,\n };\n }\n\n static getDerivedStateFromProps(nextProps, prevState) {\n const { selectedOptionIndex } = nextProps;\n\n if (selectedOptionIndex !== prevState.selectedOptionIndex\n && selectedOptionIndex !== undefined) {\n return { selectedOptionIndex };\n }\n\n return null;\n }\n\n onFocus() {\n // if no ListBoxOption is selected, select first ListBoxOption on ListBox focus\n if (!this.state.selectedOptionIndex) {\n this.setState({\n selectedOptionIndex: 0,\n });\n }\n }\n\n onKeyDown(e) {\n switch (e.key) {\n case 'ArrowDown': {\n // prevent scrolling entire modal body with arrow keys\n e.preventDefault();\n if (this.state.selectedOptionIndex < React.Children.count(this.props.children) - 1) {\n this.setState(state => ({\n selectedOptionIndex: state.selectedOptionIndex + 1,\n }));\n }\n break;\n }\n case 'ArrowUp': {\n // prevent scrolling entire modal body with arrow keys\n e.preventDefault();\n\n if (this.state.selectedOptionIndex > 0) {\n this.setState(state => ({\n selectedOptionIndex: state.selectedOptionIndex - 1,\n }));\n }\n break;\n }\n default:\n }\n }\n\n renderChildren() {\n return React.Children.map(this.props.children, (child, index) => React.cloneElement(child, {\n index,\n isSelected: index === this.state.selectedOptionIndex,\n onSelect: () => { this.setState({ selectedOptionIndex: index }); child.props.onSelect(); },\n }));\n }\n\n render() {\n const {\n children,\n className,\n selectedOptionIndex,\n tag,\n ...other\n } = this.props;\n\n return React.createElement(\n this.props.tag,\n {\n 'aria-activedescendant': this.state.selectedOptionIndex === null ? null : `list-box-option-${this.state.selectedOptionIndex}`,\n className: classNames(['list-group', this.props.className]),\n onFocus: this.onFocus,\n onKeyDown: this.onKeyDown,\n role: 'listbox',\n tabIndex: 0,\n ...other,\n },\n this.renderChildren(),\n );\n }\n}\n\nListBox.propTypes = {\n /** specifies the ListBoxOption component(s) that will be displayed within the ListBox element. You can pass in one or more ListBoxOption components.\n */\n children: PropTypes.node.isRequired,\n /** specifies Bootstrap class names to apply to the ListBox component. The default is an empty string. */\n className: PropTypes.string,\n /** Although the ListBox component keeps track of which ListBoxOption is selected, `selectedOptionIndex` provides a mechanism for an override, if necessary. An example would be to clear the selectedOption when moving between views. Note that override is not permanent and that clicking on a ListBoxOption or interacting with the ListBox with the keyboard will change the selected ListBoxOption relative to the original override. The default is undefined. */\n selectedOptionIndex: nonNegativeInteger,\n /** used to specify the element type of the rendered ListBox component. The default is div. Example alternatives include ol, ul, span, etc. */\n tag: PropTypes.string,\n};\n\nListBox.defaultProps = {\n className: undefined,\n selectedOptionIndex: undefined,\n tag: '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cACtBC,mBAAmB,EAAED,KAAK,CAACC,mBAAmB,GAAG;YACnD,CAAC,CAAC,CAAC;UACL;UACA;QACF;MACA,KAAK,SAAS;QAAE;UACd;UACAM,CAAC,CAACE,cAAc,CAAC,CAAC;UAElB,IAAI,IAAI,CAACT,KAAK,CAACC,mBAAmB,GAAG,CAAC,EAAE;YACtC,IAAI,CAACK,QAAQ,CAACN,KAAK,KAAK;cACtBC,mBAAmB,EAAED,KAAK,CAACC,mBAAmB,GAAG;YACnD,CAAC,CAAC,CAAC;UACL;UACA;QACF;MACA;IACF;EACF;EAEAY,cAAcA,CAAA,EAAG;IACf,OAAOtB,KAAK,CAACmB,QAAQ,CAACI,GAAG,CAAC,IAAI,CAAClB,KAAK,CAACgB,QAAQ,EAAE,CAACG,KAAK,EAAEC,KAAK,kBAAKzB,KAAK,CAAC0B,YAAY,CAACF,KAAK,EAAE;MACzFC,KAAK;MACLE,UAAU,EAAEF,KAAK,KAAK,IAAI,CAAChB,KAAK,CAACC,mBAAmB;MACpDkB,QAAQ,EAAEA,CAAA,KAAM;QAAE,IAAI,CAACb,QAAQ,CAAC;UAAEL,mBAAmB,EAAEe;QAAM,CAAC,CAAC;QAAED,KAAK,CAACnB,KAAK,CAACuB,QAAQ,CAAC,CAAC;MAAE;IAC3F,CAAC,CAAC,CAAC;EACL;EAEAC,MAAMA,CAAA,EAAG;IACP,MAAM;MACJR,QAAQ;MACRS,SAAS;MACTpB,mBAAmB;MACnBqB,GAAG;MACH,GAAGC;IACL,CAAC,GAAG,IAAI,CAAC3B,KAAK;IAEd,oBAAOL,KAAK,CAACiC,aAAa,CACxB,IAAI,CAAC5B,KAAK,CAAC0B,GAAG,EACd;MACE,uBAAuB,EAAE,IAAI,CAACtB,KAAK,CAACC,mBAAmB,KAAK,IAAI,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"index.js","names":["classNames","PropTypes","React","nonNegativeInteger","ListBox","Component","constructor","props","onFocus","bind","onKeyDown","state","selectedOptionIndex","getDerivedStateFromProps","nextProps","prevState","undefined","setState","e","key","preventDefault","Children","count","children","renderChildren","map","child","index","cloneElement","isSelected","onSelect","render","className","tag","other","createElement","role","tabIndex","propTypes","node","isRequired","string","defaultProps"],"sources":["../../src/ListBox/index.jsx"],"sourcesContent":["/* eslint-disable max-len */\nimport classNames from 'classnames';\nimport PropTypes from 'prop-types';\nimport React from 'react';\nimport { nonNegativeInteger } from '../utils/propTypes';\n\nexport default class ListBox extends React.Component {\n constructor(props) {\n super(props);\n\n this.onFocus = this.onFocus.bind(this);\n this.onKeyDown = this.onKeyDown.bind(this);\n\n this.state = {\n selectedOptionIndex: null,\n };\n }\n\n static getDerivedStateFromProps(nextProps, prevState) {\n const { selectedOptionIndex } = nextProps;\n\n if (selectedOptionIndex !== prevState.selectedOptionIndex\n && selectedOptionIndex !== undefined) {\n return { selectedOptionIndex };\n }\n\n return null;\n }\n\n onFocus() {\n // if no ListBoxOption is selected, select first ListBoxOption on ListBox focus\n if (!this.state.selectedOptionIndex) {\n this.setState({\n selectedOptionIndex: 0,\n });\n }\n }\n\n onKeyDown(e) {\n switch (e.key) {\n case 'ArrowDown': {\n // prevent scrolling entire modal body with arrow keys\n e.preventDefault();\n if (this.state.selectedOptionIndex < React.Children.count(this.props.children) - 1) {\n this.setState(state => ({\n selectedOptionIndex: state.selectedOptionIndex + 1,\n }));\n }\n break;\n }\n case 'ArrowUp': {\n // prevent scrolling entire modal body with arrow keys\n e.preventDefault();\n\n if (this.state.selectedOptionIndex > 0) {\n this.setState(state => ({\n selectedOptionIndex: state.selectedOptionIndex - 1,\n }));\n }\n break;\n }\n default:\n }\n }\n\n renderChildren() {\n return React.Children.map(this.props.children, (child, index) => React.cloneElement(child, {\n index,\n isSelected: index === this.state.selectedOptionIndex,\n onSelect: () => { this.setState({ selectedOptionIndex: index }); child.props.onSelect(); },\n }));\n }\n\n render() {\n const {\n children,\n className,\n selectedOptionIndex,\n tag,\n ...other\n } = this.props;\n\n return React.createElement(\n this.props.tag,\n {\n 'aria-activedescendant': this.state.selectedOptionIndex === null ? null : `list-box-option-${this.state.selectedOptionIndex}`,\n className: classNames(['list-group', this.props.className]),\n onFocus: this.onFocus,\n onKeyDown: this.onKeyDown,\n role: 'listbox',\n tabIndex: 0,\n ...other,\n },\n this.renderChildren(),\n );\n }\n}\n\nListBox.propTypes = {\n /** specifies the ListBoxOption component(s) that will be displayed within the ListBox element. You can pass in one or more ListBoxOption components.\n */\n children: PropTypes.node.isRequired,\n /** specifies Bootstrap class names to apply to the ListBox component. The default is an empty string. */\n className: PropTypes.string,\n /** Although the ListBox component keeps track of which ListBoxOption is selected, `selectedOptionIndex` provides a mechanism for an override, if necessary. An example would be to clear the selectedOption when moving between views. Note that override is not permanent and that clicking on a ListBoxOption or interacting with the ListBox with the keyboard will change the selected ListBoxOption relative to the original override. The default is undefined. */\n selectedOptionIndex: nonNegativeInteger,\n /** used to specify the element type of the rendered ListBox component. The default is div. Example alternatives include ol, ul, span, etc. */\n tag: PropTypes.string,\n};\n\nListBox.defaultProps = {\n className: undefined,\n selectedOptionIndex: undefined,\n tag: 'div',\n};\n"],"mappings":"AAAA;AACA,OAAOA,UAAU,MAAM,YAAY;AACnC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,kBAAkB,QAAQ,oBAAoB;AAEvD,eAAe,MAAMC,OAAO,SAASF,KAAK,CAACG,SAAS,CAAC;EACnDC,WAAWA,CAACC,KAAK,EAAE;IACjB,KAAK,CAACA,KAAK,CAAC;IAEZ,IAAI,CAACC,OAAO,GAAG,IAAI,CAACA,OAAO,CAACC,IAAI,CAAC,IAAI,CAAC;IACtC,IAAI,CAACC,SAAS,GAAG,IAAI,CAACA,SAAS,CAACD,IAAI,CAAC,IAAI,CAAC;IAE1C,IAAI,CAACE,KAAK,GAAG;MACXC,mBAAmB,EAAE;IACvB,CAAC;EACH;EAEA,OAAOC,wBAAwBA,CAACC,SAAS,EAAEC,SAAS,EAAE;IACpD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,SAAS;EAC9BiB,GAAG,EAAE;AACP,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","classNames","PropTypes","ListBoxOption","Component","constructor","props","onMouseDown","bind","componentDidUpdate","prevProps","isSelected","onSelect","render","children","className","index","tag","other","createElement","active","id","undefined","role","propTypes","node","isRequired","string","number","bool","func","defaultProps"],"sources":["../../src/ListBoxOption/index.jsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport PropTypes from 'prop-types';\n\nexport default class ListBoxOption extends React.Component {\n constructor(props) {\n super(props);\n\n this.onMouseDown = this.onMouseDown.bind(this);\n }\n\n componentDidUpdate(prevProps) {\n if (this.props.isSelected && !prevProps.isSelected) {\n this.props.onSelect();\n }\n }\n\n /**\n * onMouseDown is used instead of onClick because onClick triggers the focus\n * event before click event. This focus event bubbles up to the parent\n * (since onFocus bubbles in React), which triggers the ListBox's onFocus function.\n * This function will select the first ListBoxOption if one is not selected, and this\n * causes the user to see the first option selected before their desired option is selected\n * when the click event is fired shortly thereafter. The mouseDown event occurs before the\n * focus event, which prevents this behavior.\n */\n onMouseDown() {\n this.props.onSelect();\n }\n\n render() {\n const {\n children,\n className,\n index,\n isSelected,\n tag,\n ...other\n } = this.props;\n\n return React.createElement(\n this.props.tag,\n {\n 'aria-selected': isSelected,\n className: classNames(\n 'list-group-item',\n 'list-group-item-action',\n {\n active: this.props.isSelected,\n },\n className,\n ),\n id: index === undefined ? null : `list-box-option-${index}`,\n onMouseDown: this.onMouseDown,\n role: 'option',\n ...other,\n },\n children,\n );\n }\n}\n\nListBoxOption.propTypes = {\n children: PropTypes.node.isRequired,\n className: PropTypes.string,\n index: PropTypes.number,\n isSelected: PropTypes.bool,\n tag: PropTypes.string,\n onSelect: PropTypes.func,\n};\n\nListBoxOption.defaultProps = {\n className: undefined,\n index: undefined,\n isSelected: false,\n tag: 'div',\n onSelect: () => { },\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,SAAS,MAAM,YAAY;AAElC,eAAe,MAAMC,aAAa,SAASH,KAAK,CAACI,SAAS,CAAC;EACzDC,WAAWA,CAACC,KAAK,EAAE;IACjB,KAAK,CAACA,KAAK,CAAC;IAEZ,IAAI,CAACC,WAAW,GAAG,IAAI,CAACA,WAAW,CAACC,IAAI,CAAC,IAAI,CAAC;EAChD;EAEAC,kBAAkBA,CAACC,SAAS,EAAE;IAC5B,IAAI,IAAI,CAACJ,KAAK,CAACK,UAAU,IAAI,CAACD,SAAS,CAACC,UAAU,EAAE;MAClD,IAAI,CAACL,KAAK,CAACM,QAAQ,CAAC,CAAC;IACvB;EACF;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEL,WAAWA,CAAA,EAAG;IACZ,IAAI,CAACD,KAAK,CAACM,QAAQ,CAAC,CAAC;EACvB;EAEAC,MAAMA,CAAA,EAAG;IACP,MAAM;MACJC,QAAQ;MACRC,SAAS;MACTC,KAAK;MACLL,UAAU;MACVM,GAAG;MACH,GAAGC;IACL,CAAC,GAAG,IAAI,CAACZ,KAAK;IAEd,oBAAON,KAAK,CAACmB,aAAa,CACxB,IAAI,CAACb,KAAK,CAACW,GAAG,EACd;MACE,eAAe,EAAEN,UAAU;MAC3BI,SAAS,EAAEd,UAAU,CACnB,iBAAiB,EACjB,wBAAwB,EACxB;QACEmB,MAAM,EAAE,IAAI,CAACd,KAAK,CAACK;MACrB,CAAC,EACDI,SACF,CAAC;MACDM,EAAE,EAAEL,KAAK,KAAKM,SAAS,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","classNames","PropTypes","ListBoxOption","Component","constructor","props","onMouseDown","bind","componentDidUpdate","prevProps","isSelected","onSelect","render","children","className","index","tag","other","createElement","active","id","undefined","role","propTypes","node","isRequired","string","number","bool","func","defaultProps"],"sources":["../../src/ListBoxOption/index.jsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport PropTypes from 'prop-types';\n\nexport default class ListBoxOption extends React.Component {\n constructor(props) {\n super(props);\n\n this.onMouseDown = this.onMouseDown.bind(this);\n }\n\n componentDidUpdate(prevProps) {\n if (this.props.isSelected && !prevProps.isSelected) {\n this.props.onSelect();\n }\n }\n\n /**\n * onMouseDown is used instead of onClick because onClick triggers the focus\n * event before click event. This focus event bubbles up to the parent\n * (since onFocus bubbles in React), which triggers the ListBox's onFocus function.\n * This function will select the first ListBoxOption if one is not selected, and this\n * causes the user to see the first option selected before their desired option is selected\n * when the click event is fired shortly thereafter. The mouseDown event occurs before the\n * focus event, which prevents this behavior.\n */\n onMouseDown() {\n this.props.onSelect();\n }\n\n render() {\n const {\n children,\n className,\n index,\n isSelected,\n tag,\n ...other\n } = this.props;\n\n return React.createElement(\n this.props.tag,\n {\n 'aria-selected': isSelected,\n className: classNames(\n 'list-group-item',\n 'list-group-item-action',\n {\n active: this.props.isSelected,\n },\n className,\n ),\n id: index === undefined ? null : `list-box-option-${index}`,\n onMouseDown: this.onMouseDown,\n role: 'option',\n ...other,\n },\n children,\n );\n }\n}\n\nListBoxOption.propTypes = {\n children: PropTypes.node.isRequired,\n className: PropTypes.string,\n index: PropTypes.number,\n isSelected: PropTypes.bool,\n tag: PropTypes.string,\n onSelect: PropTypes.func,\n};\n\nListBoxOption.defaultProps = {\n className: undefined,\n index: undefined,\n isSelected: false,\n tag: 'div',\n onSelect: () => { },\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,SAAS,MAAM,YAAY;AAElC,eAAe,MAAMC,aAAa,SAASH,KAAK,CAACI,SAAS,CAAC;EACzDC,WAAWA,CAACC,KAAK,EAAE;IACjB,KAAK,CAACA,KAAK,CAAC;IAEZ,IAAI,CAACC,WAAW,GAAG,IAAI,CAACA,WAAW,CAACC,IAAI,CAAC,IAAI,CAAC;EAChD;EAEAC,kBAAkBA,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AK,EAAEM,SAAS;EAChBX,UAAU,EAAE,KAAK;EACjBM,GAAG,EAAE,KAAK;EACVL,QAAQ,EAAEA,CAAA,KAAM,CAAE;AACpB,CAAC","ignoreList":[]}
|
package/dist/Menu/SelectMenu.js
CHANGED
|
@@ -4,7 +4,7 @@ import classNames from 'classnames';
|
|
|
4
4
|
import { ExpandMore } from '../../icons';
|
|
5
5
|
import Button from '../Button';
|
|
6
6
|
import ModalPopup from '../Modal/ModalPopup';
|
|
7
|
-
import useToggle from '../hooks/
|
|
7
|
+
import useToggle from '../hooks/useToggleHook';
|
|
8
8
|
import Menu from '.';
|
|
9
9
|
import withDeprecatedProps, { DeprTypes } from '../withDeprecatedProps';
|
|
10
10
|
export const SELECT_MENU_DEFAULT_MESSAGE = 'Select...';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectMenu.js","names":["React","useState","useEffect","useCallback","PropTypes","classNames","ExpandMore","Button","ModalPopup","useToggle","Menu","withDeprecatedProps","DeprTypes","SELECT_MENU_DEFAULT_MESSAGE","SelectMenu","_ref","defaultMessage","children","className","variant","disabled","props","triggerTarget","setTriggerTarget","focusMenuRef","useRef","itemsCollection","useMemo","Array","from","length","map","createRef","defaultIndex","i","defaultSelected","undefined","selected","setSelected","isOpen","open","close","createMenuItems","Children","child","index","newProps","onClick","e","current","id","toString","role","cloneElement","prevOpenRef","numItems","scrollIntoView","block","focus","preventScroll","createElement","ref","iconAfter","placement","positionRef","onClose","modifiers","name","options","padding","top","bottom","key","propTypes","string","node","isRequired","bool","defaultProps","SelectMenuWithDeprecatedProp","isLink","deprType","MOVED_AND_FORMAT","message","newName","transform"],"sources":["../../src/Menu/SelectMenu.jsx"],"sourcesContent":["import React, { useState, useEffect, useCallback } from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { ExpandMore } from '../../icons';\nimport Button from '../Button';\nimport ModalPopup from '../Modal/ModalPopup';\nimport useToggle from '../hooks/useToggle';\nimport Menu from '.';\nimport withDeprecatedProps, { DeprTypes } from '../withDeprecatedProps';\n\nexport const SELECT_MENU_DEFAULT_MESSAGE = 'Select...';\n\nfunction SelectMenu({\n defaultMessage,\n children,\n className,\n variant,\n disabled,\n ...props\n}) {\n const [triggerTarget, setTriggerTarget] = useState(null);\n // this ref is used to focus the menu open button after any menu option is clicked.\n // triggerTarget.current.focus() inside the onCLick() function didn't guarantee element focus.\n const focusMenuRef = React.useRef(false);\n const itemsCollection = React.useMemo(\n () => Array.from({ length: children.length }).map(() => React.createRef()),\n [children.length],\n );\n\n const defaultIndex = useCallback(() => {\n for (let i = 0; i < children.length; i++) {\n if (children[i].props && children[i].props.defaultSelected) {\n return i;\n }\n }\n return undefined;\n }, [children]);\n\n const [selected, setSelected] = useState(defaultIndex());\n const [isOpen, open, close] = useToggle(false);\n\n const createMenuItems = () => React.Children.map(children, (child, index) => {\n const newProps = {\n onClick(e) {\n if (child.props.onClick) {\n child.props.onClick(e);\n }\n setSelected(index);\n close();\n focusMenuRef.current = true;\n },\n id: `${index.toString()}_pgn__menu-item`,\n role: 'link',\n };\n if (selected === index) {\n newProps['aria-current'] = 'page';\n }\n return React.cloneElement(child, newProps);\n });\n\n const prevOpenRef = React.useRef();\n\n useEffect(() => {\n if (isOpen && selected) {\n const numItems = children.length;\n if (numItems > 6 && selected > 1 && numItems - selected > 2) {\n // on \"middle elements\", set offset to center of block and scroll to center\n itemsCollection[selected].current.children[0].scrollIntoView({\n block: 'center',\n });\n }\n }\n // set focus on open\n if (isOpen && !prevOpenRef.current && selected) {\n itemsCollection[selected].current.children[0].focus({ preventScroll: (defaultIndex() === selected) });\n }\n if (focusMenuRef.current) {\n triggerTarget.focus();\n focusMenuRef.current = false;\n }\n prevOpenRef.current = isOpen;\n }, [isOpen, children.length, defaultIndex, itemsCollection, selected, triggerTarget]);\n\n return (\n <div className={classNames('pgn__menu-select', className)} {...props}>\n <Button\n aria-haspopup=\"true\"\n aria-expanded={isOpen}\n ref={setTriggerTarget}\n variant={variant}\n iconAfter={ExpandMore}\n onClick={open}\n disabled={disabled}\n >\n {selected !== undefined && children[selected] ? children[selected].props.children : defaultMessage}\n </Button>\n <div className=\"pgn__menu-select-popup\">\n <ModalPopup\n placement=\"bottom-start\"\n positionRef={triggerTarget}\n isOpen={isOpen}\n onClose={close}\n modifiers={\n [\n {\n name: 'flip',\n options: {\n padding: { top: 150, bottom: 150 },\n },\n },\n ]\n }\n >\n <Menu aria-label=\"Select Menu\">\n {createMenuItems().map((child, index) => (\n <div key={child.props.id} ref={itemsCollection[index]}>\n {child}\n </div>\n ))}\n </Menu>\n </ModalPopup>\n </div>\n </div>\n );\n}\n\nSelectMenu.propTypes = {\n /** String that is displayed for default value of the ``SelectMenu`` */\n defaultMessage: PropTypes.string,\n /** Specifies the content of the ``SelectMenu`` */\n children: PropTypes.node.isRequired,\n /** Specifies class name to append to the base element */\n className: PropTypes.string,\n /** Specifies variant to use. */\n variant: PropTypes.string,\n /** Specifies if the `SelectMenu` is disabled. */\n disabled: PropTypes.bool,\n};\n\nSelectMenu.defaultProps = {\n defaultMessage: SELECT_MENU_DEFAULT_MESSAGE,\n className: undefined,\n variant: 'outline-primary',\n disabled: false,\n};\n\nconst SelectMenuWithDeprecatedProp = withDeprecatedProps(SelectMenu, 'SelectMenu', {\n isLink: {\n deprType: DeprTypes.MOVED_AND_FORMAT,\n message: 'Use \"variant\" prop instead, i.e. variant=\"link\"',\n newName: 'variant',\n transform: () => 'link',\n },\n});\n\nexport default SelectMenuWithDeprecatedProp;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,SAAS,EAAEC,WAAW,QAAQ,OAAO;AAC/D,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,UAAU,QAAQ,aAAa;AACxC,OAAOC,MAAM,MAAM,WAAW;AAC9B,OAAOC,UAAU,MAAM,qBAAqB;AAC5C,OAAOC,SAAS,MAAM,oBAAoB;AAC1C,OAAOC,I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AC;EAEJ,gBAEDvE,KAAA,CAAA4D,aAAA,CAAClD,IAAI;IAAC,cAAW;EAAa,GAC3BgC,eAAe,CAAC,CAAC,CAACX,GAAG,CAAC,CAACa,KAAK,EAAEC,KAAK,kBAClC7C,KAAA,CAAA4D,aAAA;IAAKY,GAAG,EAAE5B,KAAK,CAACvB,KAAK,CAAC6B,EAAG;IAACW,GAAG,EAAEnC,eAAe,CAACmB,KAAK;EAAE,GACnDD,KACE,CACN,CACG,CACI,CACT,CACF,CAAC;AAEV;AAEA9B,UAAU,CAAC2D,SAAS,GAAG;EACrB;EACAzD,cAAc,EAAEZ,SAAS,CAACsE,MAAM;EAChC;EACAzD,QAAQ,EAAEb,SAAS,CAACuE,IAAI,CAACC,UAAU;EACnC;EACA1D,SAAS,EAAEd,SAAS,CAACsE,MAAM;EAC3B;EACAvD,OAAO,EAAEf,SAAS,CAACsE,MAAM;EACzB;EACAtD,QAAQ,EAAEhB,SAAS,CAACyE;AACtB,CAAC;AAED/D,UAAU,CAACgE,YAAY,GAAG;EACxB9D,cAAc,EAAEH,2BAA2B;EAC3CK,SAAS,EAAEkB,SAAS;EACpBjB,OAAO,EAAE,iBAAiB;EAC1BC,QAAQ,EAAE;AACZ,CAAC;AAED,MAAM2D,4BAA4B,GAAGpE,mBAAmB,CAACG,UAAU,EAAE,YAAY,EAAE;EACjFkE,MAAM,EAAE;IACNC,QAAQ,EAAErE,SAAS,CAACsE,gBAAgB;IACpCC,OAAO,EAAE,iDAAiD;IAC1DC,OAAO,EAAE,SAAS;IAClBC,SAAS,EAAEA,CAAA,KAAM;EACnB;AACF,CAAC,CAAC;AAEF,eAAeN,4BAA4B","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"SelectMenu.js","names":["React","useState","useEffect","useCallback","PropTypes","classNames","ExpandMore","Button","ModalPopup","useToggle","Menu","withDeprecatedProps","DeprTypes","SELECT_MENU_DEFAULT_MESSAGE","SelectMenu","_ref","defaultMessage","children","className","variant","disabled","props","triggerTarget","setTriggerTarget","focusMenuRef","useRef","itemsCollection","useMemo","Array","from","length","map","createRef","defaultIndex","i","defaultSelected","undefined","selected","setSelected","isOpen","open","close","createMenuItems","Children","child","index","newProps","onClick","e","current","id","toString","role","cloneElement","prevOpenRef","numItems","scrollIntoView","block","focus","preventScroll","createElement","ref","iconAfter","placement","positionRef","onClose","modifiers","name","options","padding","top","bottom","key","propTypes","string","node","isRequired","bool","defaultProps","SelectMenuWithDeprecatedProp","isLink","deprType","MOVED_AND_FORMAT","message","newName","transform"],"sources":["../../src/Menu/SelectMenu.jsx"],"sourcesContent":["import React, { useState, useEffect, useCallback } from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { ExpandMore } from '../../icons';\nimport Button from '../Button';\nimport ModalPopup from '../Modal/ModalPopup';\nimport useToggle from '../hooks/useToggleHook';\nimport Menu from '.';\nimport withDeprecatedProps, { DeprTypes } from '../withDeprecatedProps';\n\nexport const SELECT_MENU_DEFAULT_MESSAGE = 'Select...';\n\nfunction SelectMenu({\n defaultMessage,\n children,\n className,\n variant,\n disabled,\n ...props\n}) {\n const [triggerTarget, setTriggerTarget] = useState(null);\n // this ref is used to focus the menu open button after any menu option is clicked.\n // triggerTarget.current.focus() inside the onCLick() function didn't guarantee element focus.\n const focusMenuRef = React.useRef(false);\n const itemsCollection = React.useMemo(\n () => Array.from({ length: children.length }).map(() => React.createRef()),\n [children.length],\n );\n\n const defaultIndex = useCallback(() => {\n for (let i = 0; i < children.length; i++) {\n if (children[i].props && children[i].props.defaultSelected) {\n return i;\n }\n }\n return undefined;\n }, [children]);\n\n const [selected, setSelected] = useState(defaultIndex());\n const [isOpen, open, close] = useToggle(false);\n\n const createMenuItems = () => React.Children.map(children, (child, index) => {\n const newProps = {\n onClick(e) {\n if (child.props.onClick) {\n child.props.onClick(e);\n }\n setSelected(index);\n close();\n focusMenuRef.current = true;\n },\n id: `${index.toString()}_pgn__menu-item`,\n role: 'link',\n };\n if (selected === index) {\n newProps['aria-current'] = 'page';\n }\n return React.cloneElement(child, newProps);\n });\n\n const prevOpenRef = React.useRef();\n\n useEffect(() => {\n if (isOpen && selected) {\n const numItems = children.length;\n if (numItems > 6 && selected > 1 && numItems - selected > 2) {\n // on \"middle elements\", set offset to center of block and scroll to center\n itemsCollection[selected].current.children[0].scrollIntoView({\n block: 'center',\n });\n }\n }\n // set focus on open\n if (isOpen && !prevOpenRef.current && selected) {\n itemsCollection[selected].current.children[0].focus({ preventScroll: (defaultIndex() === selected) });\n }\n if (focusMenuRef.current) {\n triggerTarget.focus();\n focusMenuRef.current = false;\n }\n prevOpenRef.current = isOpen;\n }, [isOpen, children.length, defaultIndex, itemsCollection, selected, triggerTarget]);\n\n return (\n <div className={classNames('pgn__menu-select', className)} {...props}>\n <Button\n aria-haspopup=\"true\"\n aria-expanded={isOpen}\n ref={setTriggerTarget}\n variant={variant}\n iconAfter={ExpandMore}\n onClick={open}\n disabled={disabled}\n >\n {selected !== undefined && children[selected] ? children[selected].props.children : defaultMessage}\n </Button>\n <div className=\"pgn__menu-select-popup\">\n <ModalPopup\n placement=\"bottom-start\"\n positionRef={triggerTarget}\n isOpen={isOpen}\n onClose={close}\n modifiers={\n [\n {\n name: 'flip',\n options: {\n padding: { top: 150, bottom: 150 },\n },\n },\n ]\n }\n >\n <Menu aria-label=\"Select Menu\">\n {createMenuItems().map((child, index) => (\n <div key={child.props.id} ref={itemsCollection[index]}>\n {child}\n </div>\n ))}\n </Menu>\n </ModalPopup>\n </div>\n </div>\n );\n}\n\nSelectMenu.propTypes = {\n /** String that is displayed for default value of the ``SelectMenu`` */\n defaultMessage: PropTypes.string,\n /** Specifies the content of the ``SelectMenu`` */\n children: PropTypes.node.isRequired,\n /** Specifies class name to append to the base element */\n className: PropTypes.string,\n /** Specifies variant to use. */\n variant: PropTypes.string,\n /** Specifies if the `SelectMenu` is disabled. */\n disabled: PropTypes.bool,\n};\n\nSelectMenu.defaultProps = {\n defaultMessage: SELECT_MENU_DEFAULT_MESSAGE,\n className: undefined,\n variant: 'outline-primary',\n disabled: false,\n};\n\nconst SelectMenuWithDeprecatedProp = withDeprecatedProps(SelectMenu, 'SelectMenu', {\n isLink: {\n deprType: DeprTypes.MOVED_AND_FORMAT,\n message: 'Use \"variant\" prop instead, i.e. variant=\"link\"',\n newName: 'variant',\n transform: () => 'link',\n },\n});\n\nexport default SelectMenuWithDeprecatedProp;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,SAAS,EAAEC,WAAW,QAAQ,OAAO;AAC/D,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,UAAU,QAAQ,aAAa;AACxC,OAAOC,MAAM,MAAM,WAAW;AAC9B,OAAOC,UAAU,MAAM,qBAAqB;AAC5C,OAAOC,SAAS,MAAM,wBAAwB;AAC9C,OAAOC,IAAI,MAAM,GAAG;AACpB,OAAOC,mBAAmB,IAAIC,SAAS,QAAQ,wBAAwB;AAEvE,OAAO,MAAMC,2BAA2B,GAAG,WAAW;AAEtD,SAASC,UAAUA,CAAAC,IAAA,EAOhB;EAAA,IAPiB;IAClBC,cAAc;IACdC,QAAQ;IACRC,SAAS;IACTC,OAAO;IACPC,QAAQ;IACR,GAAGC;EACL,CAAC,GAAAN,IAAA;EACC,MAAM,CAACO,aAAa,EAAEC,gBAAgB,CAAC,GAAGtB,QAAQ,CAAC,IAAI,CAAC;EACxD;EACA;EACA,MAAMuB,YAAY,GAAGxB,KAAK,CAACyB,MAAM,CAAC,KAAK,CAAC;EACxC,MAAMC,eAAe,GAAG1B,KAAK,CAAC2B,OAAO,CACnC,MAAMC,KAAK,CAACC,IAAI,CAAC;IAAEC,MAAM,EAAEb,QAAQ,CAACa;EAAO,CAAC,CAAC,CAACC,GAAG,CAAC,mBAAM/B,KAAK,CAACgC,SAAS,CAAC,CAAC,CAAC,EAC1E,CAACf,QAAQ,CAACa,MAAM,CAClB,CAAC;EAED,MAAMG,YAAY,GAAG9B,WAAW,C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AAS;EACpBjB,OAAO,EAAE,iBAAiB;EAC1BC,QAAQ,EAAE;AACZ,CAAC;AAED,MAAM2D,4BAA4B,GAAGpE,mBAAmB,CAACG,UAAU,EAAE,YAAY,EAAE;EACjFkE,MAAM,EAAE;IACNC,QAAQ,EAAErE,SAAS,CAACsE,gBAAgB;IACpCC,OAAO,EAAE,iDAAiD;IAC1DC,OAAO,EAAE,SAAS;IAClBC,SAAS,EAAEA,CAAA,KAAM;EACnB;AACF,CAAC,CAAC;AAEF,eAAeN,4BAA4B","ignoreList":[]}
|
package/dist/Menu/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import useArrowKeyNavigation from '../hooks/
|
|
4
|
+
import useArrowKeyNavigation from '../hooks/useArrowKeyNavigationHook';
|
|
5
5
|
function Menu(_ref) {
|
|
6
6
|
let {
|
|
7
7
|
as,
|
package/dist/Menu/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","PropTypes","classNames","useArrowKeyNavigation","Menu","_ref","as","arrowKeyNavigationSelector","children","props","parentRef","selectors","className","createElement","ref","Fragment","propTypes","string","elementType","node","defaultProps","undefined"],"sources":["../../src/Menu/index.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport useArrowKeyNavigation from '../hooks/
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","PropTypes","classNames","useArrowKeyNavigation","Menu","_ref","as","arrowKeyNavigationSelector","children","props","parentRef","selectors","className","createElement","ref","Fragment","propTypes","string","elementType","node","defaultProps","undefined"],"sources":["../../src/Menu/index.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport useArrowKeyNavigation from '../hooks/useArrowKeyNavigationHook';\n\nfunction Menu({\n as,\n arrowKeyNavigationSelector,\n children,\n ...props\n}) {\n const parentRef = useArrowKeyNavigation({ selectors: arrowKeyNavigationSelector });\n const className = classNames(props.className, 'pgn__menu');\n\n return React.createElement(\n as,\n {\n ...props,\n ref: parentRef,\n className,\n },\n (\n // eslint-disable-next-line react/jsx-no-useless-fragment\n <>\n {children}\n </>\n ),\n );\n}\n\nMenu.propTypes = {\n /** Specifies class name to append to the base element */\n className: PropTypes.string,\n /**\n * Specifies the CSS selector string that indicates to which elements\n * the user can navigate using the arrow keys\n */\n arrowKeyNavigationSelector: PropTypes.string,\n /** Specifies the base element */\n as: PropTypes.elementType,\n /** Specifies the content of the menu */\n children: PropTypes.node,\n};\n\nMenu.defaultProps = {\n className: undefined,\n arrowKeyNavigationSelector: 'a:not(:disabled),button:not(:disabled),input:not(:disabled)',\n as: 'div',\n children: null,\n};\n\nexport default Menu;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,qBAAqB,MAAM,oCAAoC;AAEtE,SAASC,IAAIA,CAAAC,IAAA,EAKV;EAAA,IALW;IACZC,EAAE;IACFC,0BAA0B;IAC1BC,QAAQ;IACR,GAAGC;EACL,CAAC,GAAAJ,IAAA;EACC,MAAMK,SAAS,GAAGP,qBAAqB,CAAC;IAAEQ,SAAS,EAAEJ;EAA2B,CAAC,CAAC;EAClF,MAAMK,SAAS,GAAGV,UAAU,CAACO,KAAK,CAACG,SAAS,EAAE,WAAW,CAAC;EAE1D,oBAAOZ,KAAK,CAACa,aAAa,CACxBP,EAAE,EACF;IACE,GAAGG,KAAK;IACRK,GAAG,EAAEJ,SAAS;IACdE;EACF,CAAC;EAAA;EAEC;EACAZ,KAAA,CAAAa,aAAA,CAAAb,KAAA,CAAAe,QAAA,QACGP,QACD,CAEN,CAAC;AACH;AAEAJ,IAAI,CAACY,SAAS,GAAG;EACf;EACAJ,SAAS,EAAEX,SAAS,CAACgB,MAAM;EAC3B;AACF;AACA;AACA;EACEV,0BAA0B,EAAEN,SAAS,CAACgB,MAAM;EAC5C;EACAX,EAAE,EAAEL,SAAS,CAACiB,WAAW;EACzB;EACAV,QAAQ,EAAEP,SAAS,CAACkB;AACtB,CAAC;AAEDf,IAAI,CAACgB,YAAY,GAAG;EAClBR,SAAS,EAAES,SAAS;EACpBd,0BAA0B,EAAE,6DAA6D;EACzFD,EAAE,EAAE,KAAK;EACTE,QAAQ,EAAE;AACZ,CAAC;AAED,eAAeJ,IAAI","ignoreList":[]}
|
|
@@ -10,6 +10,6 @@ declare function ModalContextProvider({ onClose, isOpen, isBlocking, children, }
|
|
|
10
10
|
isOpen: boolean;
|
|
11
11
|
isBlocking?: boolean;
|
|
12
12
|
children?: React.ReactNode;
|
|
13
|
-
}):
|
|
13
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
14
14
|
export { ModalContextProvider };
|
|
15
15
|
export default ModalContext;
|
|
@@ -35,7 +35,7 @@ interface Props {
|
|
|
35
35
|
/** Specifies whether overflow is visible in the modal */
|
|
36
36
|
isOverflowVisible?: boolean;
|
|
37
37
|
}
|
|
38
|
-
declare function ModalDialog({ children, title, isOpen, onClose, size, variant, hasCloseButton, closeLabel, isFullscreenScroll, className, isFullscreenOnMobile, isBlocking, zIndex, isOverflowVisible, }: Props):
|
|
38
|
+
declare function ModalDialog({ children, title, isOpen, onClose, size, variant, hasCloseButton, closeLabel, isFullscreenScroll, className, isFullscreenOnMobile, isBlocking, zIndex, isOverflowVisible, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
39
39
|
declare namespace ModalDialog {
|
|
40
40
|
var propTypes: {
|
|
41
41
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalDialog.js","names":["React","PropTypes","classNames","useMediaQuery","ModalLayer","ModalCloseButton","ModalDialogHeader","ModalDialogTitle","ModalDialogFooter","ModalDialogBody","ModalDialogHero","Icon","IconButton","Close","MODAL_DIALOG_CLOSE_LABEL","ModalDialog","_ref","children","title","isOpen","onClose","size","variant","hasCloseButton","closeLabel","isFullscreenScroll","className","isFullscreenOnMobile","isBlocking","zIndex","isOverflowVisible","isMobile","query","showFullScreen","createElement","role","as","iconAs","invertColors","src","alt","propTypes","node","isRequired","string","func","bool","oneOf","number","Header","Title","Footer","CloseButton","Body","Hero"],"sources":["../../src/Modal/ModalDialog.tsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { useMediaQuery } from 'react-responsive';\nimport ModalLayer from './ModalLayer';\n// @ts-ignore for now - this needs to be converted to TypeScript\nimport ModalCloseButton from './ModalCloseButton';\nimport ModalDialogHeader from './ModalDialogHeader';\n// @ts-ignore for now - this needs to be converted to TypeScript\nimport ModalDialogTitle from './ModalDialogTitle';\n// @ts-ignore for now - this needs to be converted to TypeScript\nimport ModalDialogFooter from './ModalDialogFooter';\n// @ts-ignore for now - this needs to be converted to TypeScript\nimport ModalDialogBody from './ModalDialogBody';\n// @ts-ignore for now - this needs to be converted to TypeScript\nimport ModalDialogHero from './ModalDialogHero';\n\nimport Icon from '../Icon';\nimport IconButton from '../IconButton';\nimport { Close } from '../../icons';\n\nexport const MODAL_DIALOG_CLOSE_LABEL = 'Close';\n\ninterface Props {\n /** Specifies the content of the dialog */\n children: React.ReactNode;\n /** The aria-label of the dialog */\n title: string;\n /** A callback to close the modal dialog, e.g. when Escape is pressed */\n onClose: () => void;\n /** Is the modal dialog open or closed? */\n isOpen?: boolean;\n /** The close 'x' icon button in the top right of the dialog box */\n hasCloseButton?: boolean;\n /** Size determines the maximum width of the dialog box */\n size?: 'sm' | 'md' | 'lg' | 'xl' | 'fullscreen';\n /** The visual style of the dialog box */\n variant?: 'default' | 'warning' | 'danger' | 'success' | 'dark';\n /** The label supplied to the close icon button if one is rendered */\n closeLabel?: string;\n /** Specifies class name to append to the base element */\n className?: string;\n /**\n * Determines where a scrollbar should appear if a modal is too large for the\n * viewport. When false, the ``ModalDialog``. Body receives a scrollbar, when true\n * the browser window itself receives the scrollbar.\n */\n isFullscreenScroll?: boolean;\n /** To show full screen view on mobile screens */\n isFullscreenOnMobile?: boolean;\n /** Prevent clicking on the backdrop or pressing Esc to close the modal */\n isBlocking?: boolean;\n /** Specifies the z-index of the modal */\n zIndex?: number;\n /** Specifies whether overflow is visible in the modal */\n isOverflowVisible?: boolean;\n}\n\nfunction ModalDialog({\n children,\n title,\n isOpen = false,\n onClose,\n size = 'md',\n variant = 'default',\n hasCloseButton = true,\n closeLabel = MODAL_DIALOG_CLOSE_LABEL,\n isFullscreenScroll = false,\n className,\n isFullscreenOnMobile = false,\n isBlocking = false,\n zIndex,\n isOverflowVisible = true,\n}: Props) {\n const isMobile = useMediaQuery({ query: '(max-width: 767.98px)' });\n const showFullScreen = (isFullscreenOnMobile && isMobile);\n return (\n <ModalLayer isOpen={isOpen} onClose={onClose} isBlocking={isBlocking} zIndex={zIndex}>\n <div\n role=\"dialog\"\n aria-label={title}\n className={classNames(\n 'pgn__modal',\n {\n [`pgn__modal-${showFullScreen ? 'fullscreen' : size}`]: size,\n [`pgn__modal-${variant}`]: variant,\n 'pgn__modal-scroll-fullscreen': isFullscreenScroll,\n 'pgn__modal-visible-overflow': isOverflowVisible,\n },\n className,\n )}\n >\n {hasCloseButton && (\n <div className=\"pgn__modal-close-container\">\n <ModalCloseButton\n as={IconButton}\n iconAs={Icon}\n invertColors={variant === 'dark'}\n src={Close}\n alt={closeLabel}\n />\n </div>\n )}\n {children}\n </div>\n </ModalLayer>\n );\n}\n\nModalDialog.propTypes = {\n /**\n * Specifies the content of the dialog\n */\n children: PropTypes.node.isRequired,\n /**\n * The aria-label of the dialog\n */\n title: PropTypes.string.isRequired,\n /**\n * A callback to close the modal dialog\n */\n onClose: PropTypes.func.isRequired,\n /**\n * Is the modal dialog open or closed\n */\n isOpen: PropTypes.bool,\n /**\n * The close 'x' icon button in the top right of the dialog box\n */\n hasCloseButton: PropTypes.bool,\n /**\n * Sizes determine the maximum width of the dialog box\n */\n size: PropTypes.oneOf(['sm', 'md', 'lg', 'xl', 'fullscreen']),\n /**\n * The visual style of the dialog box\n */\n variant: PropTypes.oneOf(['default', 'warning', 'danger', 'success', 'dark']),\n /**\n * The label supplied to the close icon button if one is rendered\n */\n closeLabel: PropTypes.string,\n /**\n * Specifies class name to append to the base element\n */\n className: PropTypes.string,\n /**\n * Determines where a scrollbar should appear if a modal is too large for the\n * viewport. When false, the ``ModalDialog``. Body receives a scrollbar, when true\n * the browser window itself receives the scrollbar.\n */\n isFullscreenScroll: PropTypes.bool,\n /**\n * To show full screen view on mobile screens\n */\n isFullscreenOnMobile: PropTypes.bool,\n /**\n * Prevent clicking on the backdrop or pressing Esc to close the modal\n */\n isBlocking: PropTypes.bool,\n /**\n * Specifies the z-index of the modal\n */\n zIndex: PropTypes.number,\n /** Specifies whether overflow is visible in the modal */\n isOverflowVisible: PropTypes.bool,\n};\n\nModalDialog.Header = ModalDialogHeader;\nModalDialog.Title = ModalDialogTitle;\nModalDialog.Footer = ModalDialogFooter;\nModalDialog.CloseButton = ModalCloseButton;\nModalDialog.Body = ModalDialogBody;\nModalDialog.Hero = ModalDialogHero;\n\nexport default ModalDialog;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,aAAa,QAAQ,kBAAkB;AAChD,OAAOC,UAAU,MAAM,cAAc;AACrC;AACA,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,iBAAiB,MAAM,qBAAqB;AACnD;AACA,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD;AACA,OAAOC,iBAAiB,MAAM,qBAAqB;AACnD;AACA,OAAOC,eAAe,MAAM,mBAAmB;AAC/C;AACA,OAAOC,eAAe,MAAM,mBAAmB;AAE/C,OAAOC,IAAI,MAAM,SAAS;AAC1B,OAAOC,UAAU,MAAM,eAAe;AACtC,SAASC,KAAK,QAAQ,aAAa;AAEnC,OAAO,MAAMC,wBAAwB,GAAG,OAAO;AAqC/C,SAASC,WAAWA,CAAAC,IAAA,EAeV;EAAA,IAfW;IACnBC,QAAQ;IACRC,KAAK;IACLC,MAAM,GAAG,KAAK;IACdC,OAAO;IACPC,IAAI,GAAG,IAAI;IACXC,OAAO,GAAG,SAAS;IACnBC,cAAc,GAAG,IAAI;IACrBC,UAAU,GAAGV,wBAAwB;IACrCW,kBAAkB,GAAG,KAAK;IAC1BC,SAAS;IACTC,oBAAoB,GAAG,KAAK;IAC5BC,UAAU,GAAG,KAAK;IAClBC,MAAM;IACNC,iBAAiB,GAAG;EACf,CAAC,GAAAd,IAAA;EACN,MAAMe,QAAQ,GAAG5B,aAAa,CAAC;IAAE6B,KAAK,EAAE;EAAwB,CAAC,CAAC;EAClE,MAAMC,cAAc,GAAIN,oBAAoB,IAAII,QAAS;EACzD,oBACE/B,KAAA,CAAAkC,aAAA,CAAC9B,UAAU;IAACe,MAAM,EAAEA,MAAO;IAACC,OAAO,EAAEA,OAAQ;IAACQ,UAAU,EAAEA,UAAW;IAACC,MAAM,EAAEA;EAAO,gBACnF7B,KAAA,CAAAkC,aAAA;IACEC,IAAI,EAAC,QAAQ;IACb,cAAYjB,KAAM;IAClBQ,SAAS,EAAExB,UAAU,CACnB,YAAY,EACZ;MACE,
|
|
1
|
+
{"version":3,"file":"ModalDialog.js","names":["React","PropTypes","classNames","useMediaQuery","ModalLayer","ModalCloseButton","ModalDialogHeader","ModalDialogTitle","ModalDialogFooter","ModalDialogBody","ModalDialogHero","Icon","IconButton","Close","MODAL_DIALOG_CLOSE_LABEL","ModalDialog","_ref","children","title","isOpen","onClose","size","variant","hasCloseButton","closeLabel","isFullscreenScroll","className","isFullscreenOnMobile","isBlocking","zIndex","isOverflowVisible","isMobile","query","showFullScreen","createElement","role","as","iconAs","invertColors","src","alt","propTypes","node","isRequired","string","func","bool","oneOf","number","Header","Title","Footer","CloseButton","Body","Hero"],"sources":["../../src/Modal/ModalDialog.tsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { useMediaQuery } from 'react-responsive';\nimport ModalLayer from './ModalLayer';\n// @ts-ignore for now - this needs to be converted to TypeScript\nimport ModalCloseButton from './ModalCloseButton';\nimport ModalDialogHeader from './ModalDialogHeader';\n// @ts-ignore for now - this needs to be converted to TypeScript\nimport ModalDialogTitle from './ModalDialogTitle';\n// @ts-ignore for now - this needs to be converted to TypeScript\nimport ModalDialogFooter from './ModalDialogFooter';\n// @ts-ignore for now - this needs to be converted to TypeScript\nimport ModalDialogBody from './ModalDialogBody';\n// @ts-ignore for now - this needs to be converted to TypeScript\nimport ModalDialogHero from './ModalDialogHero';\n\nimport Icon from '../Icon';\nimport IconButton from '../IconButton';\nimport { Close } from '../../icons';\n\nexport const MODAL_DIALOG_CLOSE_LABEL = 'Close';\n\ninterface Props {\n /** Specifies the content of the dialog */\n children: React.ReactNode;\n /** The aria-label of the dialog */\n title: string;\n /** A callback to close the modal dialog, e.g. when Escape is pressed */\n onClose: () => void;\n /** Is the modal dialog open or closed? */\n isOpen?: boolean;\n /** The close 'x' icon button in the top right of the dialog box */\n hasCloseButton?: boolean;\n /** Size determines the maximum width of the dialog box */\n size?: 'sm' | 'md' | 'lg' | 'xl' | 'fullscreen';\n /** The visual style of the dialog box */\n variant?: 'default' | 'warning' | 'danger' | 'success' | 'dark';\n /** The label supplied to the close icon button if one is rendered */\n closeLabel?: string;\n /** Specifies class name to append to the base element */\n className?: string;\n /**\n * Determines where a scrollbar should appear if a modal is too large for the\n * viewport. When false, the ``ModalDialog``. Body receives a scrollbar, when true\n * the browser window itself receives the scrollbar.\n */\n isFullscreenScroll?: boolean;\n /** To show full screen view on mobile screens */\n isFullscreenOnMobile?: boolean;\n /** Prevent clicking on the backdrop or pressing Esc to close the modal */\n isBlocking?: boolean;\n /** Specifies the z-index of the modal */\n zIndex?: number;\n /** Specifies whether overflow is visible in the modal */\n isOverflowVisible?: boolean;\n}\n\nfunction ModalDialog({\n children,\n title,\n isOpen = false,\n onClose,\n size = 'md',\n variant = 'default',\n hasCloseButton = true,\n closeLabel = MODAL_DIALOG_CLOSE_LABEL,\n isFullscreenScroll = false,\n className,\n isFullscreenOnMobile = false,\n isBlocking = false,\n zIndex,\n isOverflowVisible = true,\n}: Props) {\n const isMobile = useMediaQuery({ query: '(max-width: 767.98px)' });\n const showFullScreen = (isFullscreenOnMobile && isMobile);\n return (\n <ModalLayer isOpen={isOpen} onClose={onClose} isBlocking={isBlocking} zIndex={zIndex}>\n <div\n role=\"dialog\"\n aria-label={title}\n className={classNames(\n 'pgn__modal',\n {\n [`pgn__modal-${showFullScreen ? 'fullscreen' : size}`]: size,\n [`pgn__modal-${variant}`]: variant,\n 'pgn__modal-scroll-fullscreen': isFullscreenScroll,\n 'pgn__modal-visible-overflow': isOverflowVisible,\n },\n className,\n )}\n >\n {hasCloseButton && (\n <div className=\"pgn__modal-close-container\">\n <ModalCloseButton\n as={IconButton}\n iconAs={Icon}\n invertColors={variant === 'dark'}\n src={Close}\n alt={closeLabel}\n />\n </div>\n )}\n {children}\n </div>\n </ModalLayer>\n );\n}\n\nModalDialog.propTypes = {\n /**\n * Specifies the content of the dialog\n */\n children: PropTypes.node.isRequired,\n /**\n * The aria-label of the dialog\n */\n title: PropTypes.string.isRequired,\n /**\n * A callback to close the modal dialog\n */\n onClose: PropTypes.func.isRequired,\n /**\n * Is the modal dialog open or closed\n */\n isOpen: PropTypes.bool,\n /**\n * The close 'x' icon button in the top right of the dialog box\n */\n hasCloseButton: PropTypes.bool,\n /**\n * Sizes determine the maximum width of the dialog box\n */\n size: PropTypes.oneOf(['sm', 'md', 'lg', 'xl', 'fullscreen']),\n /**\n * The visual style of the dialog box\n */\n variant: PropTypes.oneOf(['default', 'warning', 'danger', 'success', 'dark']),\n /**\n * The label supplied to the close icon button if one is rendered\n */\n closeLabel: PropTypes.string,\n /**\n * Specifies class name to append to the base element\n */\n className: PropTypes.string,\n /**\n * Determines where a scrollbar should appear if a modal is too large for the\n * viewport. When false, the ``ModalDialog``. Body receives a scrollbar, when true\n * the browser window itself receives the scrollbar.\n */\n isFullscreenScroll: PropTypes.bool,\n /**\n * To show full screen view on mobile screens\n */\n isFullscreenOnMobile: PropTypes.bool,\n /**\n * Prevent clicking on the backdrop or pressing Esc to close the modal\n */\n isBlocking: PropTypes.bool,\n /**\n * Specifies the z-index of the modal\n */\n zIndex: PropTypes.number,\n /** Specifies whether overflow is visible in the modal */\n isOverflowVisible: PropTypes.bool,\n};\n\nModalDialog.Header = ModalDialogHeader;\nModalDialog.Title = ModalDialogTitle;\nModalDialog.Footer = ModalDialogFooter;\nModalDialog.CloseButton = ModalCloseButton;\nModalDialog.Body = ModalDialogBody;\nModalDialog.Hero = ModalDialogHero;\n\nexport default ModalDialog;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,aAAa,QAAQ,kBAAkB;AAChD,OAAOC,UAAU,MAAM,cAAc;AACrC;AACA,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,iBAAiB,MAAM,qBAAqB;AACnD;AACA,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD;AACA,OAAOC,iBAAiB,MAAM,qBAAqB;AACnD;AACA,OAAOC,eAAe,MAAM,mBAAmB;AAC/C;AACA,OAAOC,eAAe,MAAM,mBAAmB;AAE/C,OAAOC,IAAI,MAAM,SAAS;AAC1B,OAAOC,UAAU,MAAM,eAAe;AACtC,SAASC,KAAK,QAAQ,aAAa;AAEnC,OAAO,MAAMC,wBAAwB,GAAG,OAAO;AAqC/C,SAASC,WAAWA,CAAAC,IAAA,EAeV;EAAA,IAfW;IACnBC,QAAQ;IACRC,KAAK;IACLC,MAAM,GAAG,KAAK;IACdC,OAAO;IACPC,IAAI,GAAG,IAAI;IACXC,OAAO,GAAG,SAAS;IACnBC,cA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
|
|
1
|
-
{"version":3,"file":"ModalDialogBody.js","names":["React","PropTypes","classNames","useIsVisible","ModalDialogBody","_ref","as","children","props","isScrolledToTop","topSentinelRef","isScrolledToBottom","bottomSentinelRef","className","createElement","Fragment","ref","propTypes","elementType","node","isRequired","string","defaultProps","undefined"],"sources":["../../src/Modal/ModalDialogBody.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport useIsVisible from '../hooks/
|
|
1
|
+
{"version":3,"file":"ModalDialogBody.js","names":["React","PropTypes","classNames","useIsVisible","ModalDialogBody","_ref","as","children","props","isScrolledToTop","topSentinelRef","isScrolledToBottom","bottomSentinelRef","className","createElement","Fragment","ref","propTypes","elementType","node","isRequired","string","defaultProps","undefined"],"sources":["../../src/Modal/ModalDialogBody.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport useIsVisible from '../hooks/useIsVisibleHook';\n\nfunction ModalDialogBody({\n as,\n children,\n ...props\n}) {\n const [isScrolledToTop, topSentinelRef] = useIsVisible();\n const [isScrolledToBottom, bottomSentinelRef] = useIsVisible();\n const className = classNames(\n 'pgn__modal-body',\n props.className,\n {\n 'pgn__modal-body-scroll-top': isScrolledToTop,\n 'pgn__modal-body-scroll-bottom': isScrolledToBottom,\n },\n );\n return React.createElement(\n as,\n { ...props, className },\n (\n <>\n <div ref={topSentinelRef} />\n <div className=\"pgn__modal-body-content\">\n {children}\n </div>\n <div ref={bottomSentinelRef} />\n </>\n ),\n );\n}\n\nModalDialogBody.propTypes = {\n /** Specifies the base element */\n as: PropTypes.elementType,\n /** Specifies the contents of the header */\n children: PropTypes.node.isRequired,\n /** Specifies class name to append to the base element */\n className: PropTypes.string,\n};\n\nModalDialogBody.defaultProps = {\n as: 'div',\n className: undefined,\n};\n\nexport default ModalDialogBody;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,YAAY,MAAM,2BAA2B;AAEpD,SAASC,eAAeA,CAAAC,IAAA,EAIrB;EAAA,IAJsB;IACvBC,EAAE;IACFC,QAAQ;IACR,GAAGC;EACL,CAAC,GAAAH,IAAA;EACC,MAAM,CAACI,eAAe,EAAEC,cAAc,CAAC,GAAGP,YAAY,CAAC,CAAC;EACxD,MAAM,CAACQ,kBAAkB,EAAEC,iBAAiB,CAAC,GAAGT,YAAY,CAAC,CAAC;EAC9D,MAAMU,SAAS,GAAGX,UAAU,CAC1B,iBAAiB,EACjBM,KAAK,CAACK,SAAS,EACf;IACE,4BAA4B,EAAEJ,eAAe;IAC7C,+BAA+B,EAAEE;EACnC,CACF,CAAC;EACD,oBAAOX,KAAK,CAACc,aAAa,CACxBR,EAAE,EACF;IAAE,GAAGE,KAAK;IAAEK;EAAU,CAAC,eAErBb,KAAA,CAAAc,aAAA,CAAAd,KAAA,CAAAe,QAAA,qBACEf,KAAA,CAAAc,aAAA;IAAKE,GAAG,EAAEN;EAAe,CAAE,CAAC,eAC5BV,KAAA,CAAAc,aAAA;IAAKD,SAAS,EAAC;EAAyB,GACrCN,QACE,CAAC,eACNP,KAAA,CAAAc,aAAA;IAAKE,GAAG,EAAEJ;EAAkB,CAAE,CAC9B,CAEN,CAAC;AACH;AAEAR,eAAe,CAACa,SAAS,GAAG;EAC1B;EACAX,EAAE,EAAEL,SAAS,CAACiB,WAAW;EACzB;EACAX,QAAQ,EAAEN,SAAS,CAACkB,IAAI,CAACC,UAAU;EACnC;EACAP,SAAS,EAAEZ,SAAS,CAACoB;AACvB,CAAC;AAEDjB,eAAe,CAACkB,YAAY,GAAG;EAC7BhB,EAAE,EAAE,KAAK;EACTO,SAAS,EAAEU;AACb,CAAC;AAED,eAAenB,eAAe","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalDialogHeroBackground.js","names":["React","PropTypes","classNames","ModalDialogHeroBackground","_ref","as","backgroundSrc","children","props","createElement","className","style","backgroundImage","undefined","propTypes","elementType","string","node","shape","defaultProps"],"sources":["../../src/Modal/ModalDialogHeroBackground.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\n\nfunction ModalDialogHeroBackground({\n as,\n backgroundSrc,\n children,\n ...props\n}) {\n return React.createElement(\n as,\n {\n ...props,\n className: classNames('pgn__modal-hero-bg', props.className),\n style: {\n backgroundImage: backgroundSrc ? `url(${backgroundSrc})` : undefined,\n ...props.style,\n },\n },\n children,\n );\n}\n\nModalDialogHeroBackground.propTypes = {\n as: PropTypes.elementType,\n backgroundSrc: PropTypes.string,\n children: PropTypes.node,\n className: PropTypes.string,\n style: PropTypes.shape({}),\n};\n\nModalDialogHeroBackground.defaultProps = {\n as: 'div',\n backgroundSrc: undefined,\n children: null,\n className: undefined,\n style: {},\n};\n\nexport default ModalDialogHeroBackground;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,yBAAyBA,CAAAC,IAAA,EAK/B;EAAA,IALgC;IACjCC,EAAE;IACFC,aAAa;IACbC,QAAQ;IACR,GAAGC;EACL,CAAC,GAAAJ,IAAA;EACC,oBAAOJ,KAAK,CAACS,aAAa,CACxBJ,EAAE,EACF;IACE,GAAGG,KAAK;IACRE,SAAS,EAAER,UAAU,CAAC,oBAAoB,EAAEM,KAAK,CAACE,SAAS,CAAC;IAC5DC,KAAK,EAAE;MACLC,eAAe,EAAEN,aAAa,
|
|
1
|
+
{"version":3,"file":"ModalDialogHeroBackground.js","names":["React","PropTypes","classNames","ModalDialogHeroBackground","_ref","as","backgroundSrc","children","props","createElement","className","style","backgroundImage","undefined","propTypes","elementType","string","node","shape","defaultProps"],"sources":["../../src/Modal/ModalDialogHeroBackground.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\n\nfunction ModalDialogHeroBackground({\n as,\n backgroundSrc,\n children,\n ...props\n}) {\n return React.createElement(\n as,\n {\n ...props,\n className: classNames('pgn__modal-hero-bg', props.className),\n style: {\n backgroundImage: backgroundSrc ? `url(${backgroundSrc})` : undefined,\n ...props.style,\n },\n },\n children,\n );\n}\n\nModalDialogHeroBackground.propTypes = {\n as: PropTypes.elementType,\n backgroundSrc: PropTypes.string,\n children: PropTypes.node,\n className: PropTypes.string,\n style: PropTypes.shape({}),\n};\n\nModalDialogHeroBackground.defaultProps = {\n as: 'div',\n backgroundSrc: undefined,\n children: null,\n className: undefined,\n style: {},\n};\n\nexport default ModalDialogHeroBackground;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,yBAAyBA,CAAAC,IAAA,EAK/B;EAAA,IALgC;IACjCC,EAAE;IACFC,aAAa;IACbC,QAAQ;IACR,GAAGC;EACL,CAAC,GAAAJ,IAAA;EACC,oBAAOJ,KAAK,CAACS,aAAa,CACxBJ,EAAE,EACF;IACE,GAAGG,KAAK;IACRE,SAAS,EAAER,UAAU,CAAC,oBAAoB,EAAEM,KAAK,CAACE,SAAS,CAAC;IAC5DC,KAAK,EAAE;MACLC,eAAe,EAAEN,aAAa,GAAG,OAAOA,aAAa,GAAG,GAAGO,SAAS;MACpE,GAAGL,KAAK,CAACG;IACX;EACF,CAAC,EACDJ,QACF,CAAC;AACH;AAEAJ,yBAAyB,CAACW,SAAS,GAAG;EACpCT,EAAE,EAAEJ,SAAS,CAACc,WAAW;EACzBT,aAAa,EAAEL,SAAS,CAACe,MAAM;EAC/BT,QAAQ,EAAEN,SAAS,CAACgB,IAAI;EACxBP,SAAS,EAAET,SAAS,CAACe,MAAM;EAC3BL,KAAK,EAAEV,SAAS,CAACiB,KAAK,CAAC,CAAC,CAAC;AAC3B,CAAC;AAEDf,yBAAyB,CAACgB,YAAY,GAAG;EACvCd,EAAE,EAAE,KAAK;EACTC,aAAa,EAAEO,SAAS;EACxBN,QAAQ,EAAE,IAAI;EACdG,SAAS,EAAEG,SAAS;EACpBF,KAAK,EAAE,CAAC;AACV,CAAC;AAED,eAAeR,yBAAyB","ignoreList":[]}
|