@sproutsocial/racine 12.22.0 → 12.23.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/CHANGELOG.md +12 -0
- package/README.md +2 -0
- package/__flow__/Avatar/__tests__/features.test.js +98 -0
- package/__flow__/Banner/index.js +2 -1
- package/__flow__/CharacterCounter/index.test.js +1 -1
- package/__flow__/Collapsible/index.js +2 -2
- package/__flow__/Drawer/index.js +11 -0
- package/__flow__/Drawer/index.stories.js +2 -1
- package/__flow__/EmptyState/index.test.js +1 -1
- package/__flow__/EnumIllustrationNames.js +1 -1
- package/__flow__/Fieldset/index.js +1 -1
- package/__flow__/IllustrationViewBoxes.js +1 -1
- package/__flow__/Indicator/index.js +1 -1
- package/__flow__/Input/index.js +2 -1
- package/__flow__/Link/index.js +2 -1
- package/__flow__/Link/index.test.js +2 -0
- package/__flow__/Listbox/index.stories.js +1 -0
- package/__flow__/Loader/index.js +1 -1
- package/__flow__/Modal/index.stories.js +1 -1
- package/__flow__/Numeral/tests/testNumeral.js +1 -0
- package/__flow__/Popout/index.js +1 -1
- package/__flow__/Portal/index.stories.js +7 -7
- package/__flow__/SegmentedControl/index.js +1 -1
- package/__flow__/SpotIllustration/illustrationNames.js +1 -0
- package/__flow__/SpotIllustration/spotIllustrations/campaign-tag.svg +6 -0
- package/__flow__/SpotIllustration/spotIllustrations/tag.svg +4 -4
- package/__flow__/Table/index.js +4 -4
- package/__flow__/TableCell/index.js +1 -1
- package/__flow__/TableHeaderCell/index.js +1 -1
- package/__flow__/Tabs/index.js +1 -1
- package/__flow__/Textarea/index.js +1 -1
- package/__flow__/Toast/index.js +1 -1
- package/__flow__/Toast/styles.js +1 -1
- package/__flow__/TokenInput/index.stories.js +4 -4
- package/__flow__/TokenInput/tests/default/pasting.test.js +6 -2
- package/__flow__/code-guidelines.mdx +244 -0
- package/__flow__/setupTests.js +1 -0
- package/__flow__/utils/a11yTest.js +1 -0
- package/__flow__/utils/system-props.js +1 -0
- package/commonjs/Avatar/index.js +19 -10
- package/commonjs/Badge/constants.js +3 -1
- package/commonjs/Badge/index.js +7 -3
- package/commonjs/Badge/styles.js +4 -2
- package/commonjs/Banner/index.js +9 -4
- package/commonjs/Banner/styles.js +5 -2
- package/commonjs/Box/index.js +5 -2
- package/commonjs/Box/styles.js +3 -1
- package/commonjs/Breadcrumb/index.js +12 -5
- package/commonjs/Breadcrumb/styles.js +3 -1
- package/commonjs/Button/index.js +7 -3
- package/commonjs/Button/styles.js +6 -3
- package/commonjs/Card/index.js +7 -3
- package/commonjs/Card/styles.js +3 -1
- package/commonjs/CharacterCounter/index.js +39 -22
- package/commonjs/CharacterCounter/styles.js +5 -2
- package/commonjs/ChartLegend/index.js +7 -3
- package/commonjs/ChartLegend/styles.js +5 -2
- package/commonjs/Checkbox/index.js +117 -97
- package/commonjs/Checkbox/styles.js +5 -2
- package/commonjs/Collapsible/index.js +27 -12
- package/commonjs/Collapsible/styles.js +4 -2
- package/commonjs/DatePicker/DateRangePicker.js +7 -3
- package/commonjs/DatePicker/SingleDatePicker.js +7 -3
- package/commonjs/DatePicker/StatefulDateRangePicker.js +19 -7
- package/commonjs/DatePicker/StatefulSingleDatePicker.js +16 -5
- package/commonjs/DatePicker/common.js +4 -2
- package/commonjs/DatePicker/index.js +15 -3
- package/commonjs/DatePicker/styles.js +5 -2
- package/commonjs/Drawer/SlideTransition.js +9 -5
- package/commonjs/Drawer/index.js +15 -7
- package/commonjs/Drawer/styles.js +5 -2
- package/commonjs/EmptyState/index.js +7 -3
- package/commonjs/Fieldset/index.js +10 -6
- package/commonjs/Fieldset/styles.js +5 -2
- package/commonjs/FormField/index.js +17 -6
- package/commonjs/Icon/deprecatedIcons.js +3 -1
- package/commonjs/Icon/index.js +9 -5
- package/commonjs/Icon/styles.js +6 -3
- package/commonjs/IllustrationViewBoxes.js +2 -1
- package/commonjs/Image/index.js +78 -58
- package/commonjs/Image/styles.js +5 -2
- package/commonjs/Indicator/index.js +40 -23
- package/commonjs/Indicator/styles.js +4 -2
- package/commonjs/Input/index.js +156 -132
- package/commonjs/Input/styles.js +5 -2
- package/commonjs/KeyboardKey/index.js +30 -14
- package/commonjs/KeyboardKey/styles.js +3 -1
- package/commonjs/Label/index.js +32 -16
- package/commonjs/Link/constants.js +3 -1
- package/commonjs/Link/index.js +9 -4
- package/commonjs/Link/styles.js +5 -2
- package/commonjs/Listbox/index.js +15 -8
- package/commonjs/Loader/index.js +43 -26
- package/commonjs/Loader/styles.js +5 -2
- package/commonjs/LoaderButton/index.js +7 -3
- package/commonjs/Menu/constants.js +3 -1
- package/commonjs/Menu/descendants.js +35 -20
- package/commonjs/Menu/hooks.js +8 -8
- package/commonjs/Menu/index.flow.js +2 -1
- package/commonjs/Menu/index.js +44 -27
- package/commonjs/Menu/names.js +3 -1
- package/commonjs/Menu/styles.js +6 -3
- package/commonjs/Message/index.js +7 -3
- package/commonjs/Message/styles.js +4 -2
- package/commonjs/Modal/index.js +9 -5
- package/commonjs/Modal/styles.js +9 -5
- package/commonjs/Numeral/constants.js +3 -1
- package/commonjs/Numeral/index.js +16 -5
- package/commonjs/Numeral/styles.js +3 -1
- package/commonjs/Numeral/tests/testNumeral.js +16 -11
- package/commonjs/OverflowList/index.flow.js +2 -1
- package/commonjs/OverflowList/index.js +6 -3
- package/commonjs/OverflowList/styles.js +5 -2
- package/commonjs/PartnerLogo/index.js +9 -6
- package/commonjs/PartnerLogo/styles.js +5 -2
- package/commonjs/Popout/index.js +28 -13
- package/commonjs/Popout/styles.js +3 -1
- package/commonjs/Portal/index.js +50 -30
- package/commonjs/Radio/index.js +73 -56
- package/commonjs/Radio/styles.js +5 -2
- package/commonjs/SegmentedControl/index.js +21 -9
- package/commonjs/SegmentedControl/styles.js +5 -2
- package/commonjs/Select/index.js +78 -61
- package/commonjs/Select/styles.js +8 -5
- package/commonjs/Skeleton/index.js +4 -2
- package/commonjs/SpotIllustration/illustrationNames.js +4 -2
- package/commonjs/SpotIllustration/index.js +5 -3
- package/commonjs/Stack/index.js +7 -3
- package/commonjs/Switch/index.js +52 -35
- package/commonjs/Switch/styles.js +6 -3
- package/commonjs/Table/index.js +14 -10
- package/commonjs/Table/styles.js +3 -1
- package/commonjs/TableCell/index.js +39 -23
- package/commonjs/TableCell/styles.js +3 -1
- package/commonjs/TableHeaderCell/index.js +54 -37
- package/commonjs/TableHeaderCell/styles.js +5 -2
- package/commonjs/TableRowAccordion/index.js +61 -44
- package/commonjs/TableRowAccordion/styles.js +5 -2
- package/commonjs/Tabs/index.js +116 -90
- package/commonjs/Tabs/styles.js +8 -5
- package/commonjs/Text/index.js +7 -3
- package/commonjs/Text/styles.js +5 -2
- package/commonjs/Textarea/index.js +104 -87
- package/commonjs/Textarea/styles.js +5 -2
- package/commonjs/ThemeProvider/index.js +5 -2
- package/commonjs/Toast/index.js +7 -8
- package/commonjs/Toast/styles.js +5 -2
- package/commonjs/ToggleHint/index.js +43 -26
- package/commonjs/ToggleHint/styles.js +6 -3
- package/commonjs/Token/index.js +7 -3
- package/commonjs/Token/styles.js +5 -2
- package/commonjs/TokenInput/index.js +221 -192
- package/commonjs/TokenInput/styles.js +5 -2
- package/commonjs/TokenInput/util.js +5 -3
- package/commonjs/Tooltip/index.js +30 -14
- package/commonjs/Tooltip/styles.js +3 -1
- package/commonjs/VisuallyHidden/index.js +3 -1
- package/commonjs/dataviz/index.js +3 -1
- package/commonjs/index.js +451 -84
- package/commonjs/systemProps/background.js +3 -1
- package/commonjs/systemProps/border.js +3 -1
- package/commonjs/systemProps/color.js +3 -1
- package/commonjs/systemProps/custom.js +3 -1
- package/commonjs/systemProps/flexbox.js +3 -1
- package/commonjs/systemProps/grid.js +3 -1
- package/commonjs/systemProps/index.js +87 -15
- package/commonjs/systemProps/layout.js +3 -1
- package/commonjs/systemProps/position.js +3 -1
- package/commonjs/systemProps/shadow.js +3 -1
- package/commonjs/systemProps/space.js +3 -1
- package/commonjs/systemProps/systemProps.js +3 -1
- package/commonjs/systemProps/typography.js +3 -1
- package/commonjs/systemProps/variant.js +3 -1
- package/commonjs/themes/dark/dataviz-palette.js +3 -1
- package/commonjs/themes/dark/decorative-palettes.js +3 -1
- package/commonjs/themes/dark/theme.js +11 -7
- package/commonjs/themes/extendedThemes/sproutTheme/dark/theme.js +9 -5
- package/commonjs/themes/extendedThemes/sproutTheme/index.js +15 -4
- package/commonjs/themes/extendedThemes/sproutTheme/light/theme.js +8 -4
- package/commonjs/themes/light/dataviz-palette.js +3 -1
- package/commonjs/themes/light/decorative-palettes.js +3 -1
- package/commonjs/themes/light/literal-colors.js +3 -1
- package/commonjs/themes/light/theme.js +17 -13
- package/commonjs/utils/a11yTest.js +5 -2
- package/commonjs/utils/chartColors.js +3 -1
- package/commonjs/utils/constants.js +3 -1
- package/commonjs/utils/dataQaLabelQueries.js +26 -16
- package/commonjs/utils/hooks.js +39 -26
- package/commonjs/utils/index.js +18 -8
- package/commonjs/utils/innerText.js +4 -2
- package/commonjs/utils/mixins.js +3 -1
- package/commonjs/utils/react-testing-library.js +74 -18
- package/commonjs/utils/responsiveProps/index.js +16 -8
- package/commonjs/utils/system-props.js +6 -2
- package/commonjs/utils/useInteractiveColor.js +3 -1
- package/dist/illustration.svg +1 -1
- package/dist/illustrationList.js +1 -1
- package/dist/themes/dark/theme.scss +0 -1
- package/dist/themes/extendedThemes/sproutTheme/dark/theme.scss +0 -1
- package/dist/themes/extendedThemes/sproutTheme/light/theme.scss +0 -1
- package/dist/themes/light/theme.scss +0 -1
- package/lib/Avatar/index.js +17 -11
- package/lib/Badge/index.js +5 -4
- package/lib/Badge/styles.js +3 -3
- package/lib/Banner/index.js +7 -5
- package/lib/Banner/styles.js +1 -1
- package/lib/Box/index.js +1 -1
- package/lib/Box/styles.js +1 -1
- package/lib/Breadcrumb/index.js +11 -7
- package/lib/Button/index.js +3 -2
- package/lib/Button/styles.js +4 -4
- package/lib/Card/index.js +3 -2
- package/lib/Card/styles.js +2 -2
- package/lib/CharacterCounter/index.js +36 -21
- package/lib/CharacterCounter/styles.js +1 -1
- package/lib/ChartLegend/index.js +5 -4
- package/lib/ChartLegend/styles.js +1 -1
- package/lib/Checkbox/index.js +114 -96
- package/lib/Checkbox/styles.js +5 -5
- package/lib/Collapsible/index.js +24 -12
- package/lib/Collapsible/styles.js +2 -2
- package/lib/DatePicker/DateRangePicker.js +4 -3
- package/lib/DatePicker/SingleDatePicker.js +4 -3
- package/lib/DatePicker/StatefulDateRangePicker.js +15 -6
- package/lib/DatePicker/StatefulSingleDatePicker.js +12 -4
- package/lib/DatePicker/common.js +3 -3
- package/lib/DatePicker/index.js +2 -2
- package/lib/DatePicker/styles.js +2 -2
- package/lib/Drawer/SlideTransition.js +4 -3
- package/lib/Drawer/index.js +17 -12
- package/lib/Drawer/styles.js +2 -2
- package/lib/EmptyState/index.js +4 -3
- package/lib/Fieldset/index.js +8 -7
- package/lib/Fieldset/styles.js +1 -1
- package/lib/FormField/index.js +17 -9
- package/lib/Icon/index.js +8 -7
- package/lib/Icon/styles.js +2 -2
- package/lib/IllustrationViewBoxes.js +2 -1
- package/lib/Image/index.js +75 -57
- package/lib/Image/styles.js +1 -1
- package/lib/Indicator/index.js +38 -23
- package/lib/Indicator/styles.js +3 -3
- package/lib/Input/index.js +157 -135
- package/lib/Input/styles.js +2 -2
- package/lib/KeyboardKey/index.js +28 -14
- package/lib/KeyboardKey/styles.js +1 -1
- package/lib/Label/index.js +29 -15
- package/lib/Link/index.js +5 -3
- package/lib/Link/styles.js +3 -3
- package/lib/Listbox/index.js +14 -10
- package/lib/Loader/index.js +40 -25
- package/lib/Loader/styles.js +2 -2
- package/lib/LoaderButton/index.js +5 -4
- package/lib/Menu/descendants.js +30 -18
- package/lib/Menu/hooks.js +7 -9
- package/lib/Menu/index.flow.js +4 -4
- package/lib/Menu/index.js +54 -40
- package/lib/Menu/styles.js +3 -3
- package/lib/Message/index.js +6 -5
- package/lib/Message/styles.js +4 -4
- package/lib/Modal/index.js +9 -8
- package/lib/Modal/styles.js +6 -5
- package/lib/Numeral/index.js +15 -7
- package/lib/Numeral/styles.js +1 -1
- package/lib/Numeral/tests/testNumeral.js +15 -11
- package/lib/OverflowList/index.js +3 -3
- package/lib/OverflowList/styles.js +1 -1
- package/lib/PartnerLogo/index.js +8 -7
- package/lib/PartnerLogo/styles.js +1 -1
- package/lib/Popout/index.js +27 -15
- package/lib/Popout/styles.js +1 -1
- package/lib/Portal/index.js +47 -29
- package/lib/Radio/index.js +70 -55
- package/lib/Radio/styles.js +3 -3
- package/lib/SegmentedControl/index.js +18 -9
- package/lib/SegmentedControl/styles.js +3 -3
- package/lib/Select/index.js +76 -61
- package/lib/Select/styles.js +5 -5
- package/lib/Skeleton/index.js +2 -2
- package/lib/SpotIllustration/illustrationNames.js +1 -1
- package/lib/SpotIllustration/index.js +3 -3
- package/lib/Stack/index.js +4 -3
- package/lib/Switch/index.js +51 -36
- package/lib/Switch/styles.js +4 -4
- package/lib/Table/index.js +12 -11
- package/lib/Table/styles.js +1 -1
- package/lib/TableCell/index.js +36 -22
- package/lib/TableCell/styles.js +1 -1
- package/lib/TableHeaderCell/index.js +52 -37
- package/lib/TableHeaderCell/styles.js +1 -1
- package/lib/TableRowAccordion/index.js +60 -45
- package/lib/TableRowAccordion/styles.js +1 -1
- package/lib/Tabs/index.js +113 -89
- package/lib/Tabs/styles.js +5 -5
- package/lib/Text/index.js +3 -2
- package/lib/Text/styles.js +1 -1
- package/lib/Textarea/index.js +101 -86
- package/lib/Textarea/styles.js +2 -2
- package/lib/ThemeProvider/index.js +1 -1
- package/lib/Toast/index.js +6 -10
- package/lib/Toast/styles.js +4 -3
- package/lib/ToggleHint/index.js +41 -26
- package/lib/ToggleHint/styles.js +3 -3
- package/lib/Token/index.js +6 -5
- package/lib/Token/styles.js +3 -3
- package/lib/TokenInput/index.js +223 -196
- package/lib/TokenInput/styles.js +2 -2
- package/lib/TokenInput/util.js +2 -2
- package/lib/Tooltip/index.js +28 -14
- package/lib/Tooltip/styles.js +1 -1
- package/lib/VisuallyHidden/index.js +1 -1
- package/lib/dataviz/index.js +1 -1
- package/lib/index.js +64 -64
- package/lib/systemProps/index.js +14 -14
- package/lib/systemProps/systemProps.js +12 -12
- package/lib/themes/dark/theme.js +11 -9
- package/lib/themes/extendedThemes/sproutTheme/dark/theme.js +7 -5
- package/lib/themes/extendedThemes/sproutTheme/index.js +2 -2
- package/lib/themes/extendedThemes/sproutTheme/light/theme.js +6 -4
- package/lib/themes/light/theme.js +17 -15
- package/lib/types/theme.colors.flow.js +2 -2
- package/lib/types/theme.flow.js +2 -2
- package/lib/utils/a11yTest.js +3 -1
- package/lib/utils/dataQaLabelQueries.js +23 -15
- package/lib/utils/hooks.js +37 -26
- package/lib/utils/index.js +15 -7
- package/lib/utils/innerText.js +1 -1
- package/lib/utils/mixins.js +1 -1
- package/lib/utils/react-testing-library.js +11 -8
- package/lib/utils/responsiveProps/index.js +14 -8
- package/lib/utils/system-props.js +1 -0
- package/package.json +16 -27
- package/__flow__/Avatar/index.test.js +0 -23
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
4
7
|
exports.default = void 0;
|
|
5
8
|
var React = _interopRequireWildcard(require("react"));
|
|
6
9
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
@@ -12,45 +15,57 @@ var _Token = _interopRequireDefault(require("../Token"));
|
|
|
12
15
|
var _excluded = ["autoFocus", "autocomplete", "disabled", "isInvalid", "hasWarning", "id", "name", "placeholder", "required", "value", "elemBefore", "elemAfter", "maxLength", "ariaDescribedby", "ariaLabel", "innerRef", "onAddToken", "onRemoveToken", "onChangeTokens", "onClickToken", "onBlur", "onChange", "onFocus", "onKeyDown", "onKeyUp", "onPaste", "inputProps", "qa", "tokens"];
|
|
13
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
17
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null ||
|
|
18
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
16
19
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
20
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
17
21
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
18
|
-
function
|
|
22
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
23
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
24
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
25
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
19
26
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
27
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
28
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
29
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
30
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
31
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
32
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
20
33
|
var DefaultDelimiters = [',', 'Enter'];
|
|
21
34
|
var ControlledPropNames = ['value', 'hasFocus', 'activeToken'];
|
|
22
35
|
var TokenInput = /*#__PURE__*/function (_React$Component) {
|
|
23
|
-
|
|
36
|
+
_inherits(TokenInput, _React$Component);
|
|
37
|
+
var _super = _createSuper(TokenInput);
|
|
24
38
|
function TokenInput(props) {
|
|
25
39
|
var _this;
|
|
26
|
-
|
|
27
|
-
_this
|
|
28
|
-
_this
|
|
40
|
+
_classCallCheck(this, TokenInput);
|
|
41
|
+
_this = _super.call(this, props);
|
|
42
|
+
_defineProperty(_assertThisInitialized(_this), "handleChangeText", function (e) {
|
|
29
43
|
var value = e.currentTarget.value;
|
|
30
44
|
var onChange = _this.props.onChange;
|
|
31
45
|
_this.setState({
|
|
32
46
|
value: value
|
|
33
47
|
});
|
|
34
|
-
onChange
|
|
35
|
-
};
|
|
36
|
-
_this
|
|
48
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(e, value);
|
|
49
|
+
});
|
|
50
|
+
_defineProperty(_assertThisInitialized(_this), "handleFocus", function (e) {
|
|
37
51
|
var onFocus = _this.props.onFocus;
|
|
38
52
|
_this.setState({
|
|
39
53
|
hasFocus: true
|
|
40
54
|
});
|
|
41
|
-
onFocus
|
|
42
|
-
};
|
|
43
|
-
_this
|
|
55
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus(e);
|
|
56
|
+
});
|
|
57
|
+
_defineProperty(_assertThisInitialized(_this), "handleBlur", function (e) {
|
|
44
58
|
var onBlur = _this.props.onBlur;
|
|
45
59
|
if (onBlur) onBlur(e);
|
|
46
60
|
_this.setState({
|
|
47
61
|
hasFocus: false
|
|
48
62
|
});
|
|
49
|
-
};
|
|
50
|
-
_this
|
|
51
|
-
_this
|
|
52
|
-
|
|
53
|
-
|
|
63
|
+
});
|
|
64
|
+
_defineProperty(_assertThisInitialized(_this), "handleKeyUp", function (e) {
|
|
65
|
+
var _this$props$onKeyUp, _this$props;
|
|
66
|
+
(_this$props$onKeyUp = (_this$props = _this.props).onKeyUp) === null || _this$props$onKeyUp === void 0 ? void 0 : _this$props$onKeyUp.call(_this$props, e, e.currentTarget.value);
|
|
67
|
+
});
|
|
68
|
+
_defineProperty(_assertThisInitialized(_this), "handleKeyDown", function (e) {
|
|
54
69
|
var onKeyDown = _this.props.onKeyDown;
|
|
55
70
|
var key = e.key,
|
|
56
71
|
currentTarget = e.currentTarget;
|
|
@@ -70,8 +85,8 @@ var TokenInput = /*#__PURE__*/function (_React$Component) {
|
|
|
70
85
|
_this.deleteToken();
|
|
71
86
|
}
|
|
72
87
|
}
|
|
73
|
-
};
|
|
74
|
-
_this
|
|
88
|
+
});
|
|
89
|
+
_defineProperty(_assertThisInitialized(_this), "handlePaste", function (e) {
|
|
75
90
|
var text = e.clipboardData.getData('text');
|
|
76
91
|
var onPaste = _this.props.onPaste;
|
|
77
92
|
if (onPaste) onPaste(e, text);
|
|
@@ -83,16 +98,16 @@ var TokenInput = /*#__PURE__*/function (_React$Component) {
|
|
|
83
98
|
_this.spawnNewTokens(texts);
|
|
84
99
|
e.preventDefault();
|
|
85
100
|
}
|
|
86
|
-
};
|
|
87
|
-
_this
|
|
88
|
-
var _this$
|
|
89
|
-
onClickToken = _this$
|
|
90
|
-
disabled = _this$
|
|
101
|
+
});
|
|
102
|
+
_defineProperty(_assertThisInitialized(_this), "handleClickToken", function (e, token) {
|
|
103
|
+
var _this$props2 = _this.props,
|
|
104
|
+
onClickToken = _this$props2.onClickToken,
|
|
105
|
+
disabled = _this$props2.disabled;
|
|
91
106
|
if (onClickToken) onClickToken(e, token.id);
|
|
92
107
|
if (!disabled) {
|
|
93
108
|
_this.deleteToken(token.id);
|
|
94
109
|
}
|
|
95
|
-
};
|
|
110
|
+
});
|
|
96
111
|
var hasFocus = props.hasFocus,
|
|
97
112
|
activeToken = props.activeToken,
|
|
98
113
|
_value = props.value,
|
|
@@ -106,175 +121,189 @@ var TokenInput = /*#__PURE__*/function (_React$Component) {
|
|
|
106
121
|
};
|
|
107
122
|
return _this;
|
|
108
123
|
}
|
|
109
|
-
TokenInput
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
124
|
+
_createClass(TokenInput, [{
|
|
125
|
+
key: "isDelimiter",
|
|
126
|
+
value: function isDelimiter(keyName) {
|
|
127
|
+
var _this$props$delimiter = this.props.delimiters,
|
|
128
|
+
delimiters = _this$props$delimiter === void 0 ? DefaultDelimiters : _this$props$delimiter;
|
|
129
|
+
return delimiters.includes(keyName);
|
|
130
|
+
}
|
|
131
|
+
}, {
|
|
132
|
+
key: "spawnNewTokens",
|
|
133
|
+
value: function spawnNewTokens(texts) {
|
|
134
|
+
var _this$props3 = this.props,
|
|
135
|
+
onAddToken = _this$props3.onAddToken,
|
|
136
|
+
onChangeTokens = _this$props3.onChangeTokens,
|
|
137
|
+
_this$props3$tokenMax = _this$props3.tokenMaxLength,
|
|
138
|
+
max = _this$props3$tokenMax === void 0 ? Infinity : _this$props3$tokenMax,
|
|
139
|
+
_this$props3$tokens = _this$props3.tokens,
|
|
140
|
+
tokens = _this$props3$tokens === void 0 ? [] : _this$props3$tokens;
|
|
141
|
+
var tokenSpecs = texts.map(function (text) {
|
|
142
|
+
return (0, _util.asTokenSpec)(text.slice(0, max));
|
|
143
|
+
});
|
|
144
|
+
if (onAddToken) {
|
|
145
|
+
tokenSpecs.forEach(onAddToken);
|
|
146
|
+
} else if (onChangeTokens) {
|
|
147
|
+
onChangeTokens(tokens.concat(tokenSpecs));
|
|
116
148
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
};
|
|
121
|
-
var _proto = TokenInput.prototype;
|
|
122
|
-
_proto.isDelimiter = function isDelimiter(keyName) {
|
|
123
|
-
var _this$props$delimiter = this.props.delimiters,
|
|
124
|
-
delimiters = _this$props$delimiter === void 0 ? DefaultDelimiters : _this$props$delimiter;
|
|
125
|
-
return delimiters.includes(keyName);
|
|
126
|
-
};
|
|
127
|
-
_proto.spawnNewTokens = function spawnNewTokens(texts) {
|
|
128
|
-
var _this$props2 = this.props,
|
|
129
|
-
onAddToken = _this$props2.onAddToken,
|
|
130
|
-
onChangeTokens = _this$props2.onChangeTokens,
|
|
131
|
-
_this$props2$tokenMax = _this$props2.tokenMaxLength,
|
|
132
|
-
max = _this$props2$tokenMax === void 0 ? Infinity : _this$props2$tokenMax,
|
|
133
|
-
_this$props2$tokens = _this$props2.tokens,
|
|
134
|
-
tokens = _this$props2$tokens === void 0 ? [] : _this$props2$tokens;
|
|
135
|
-
var tokenSpecs = texts.map(function (text) {
|
|
136
|
-
return (0, _util.asTokenSpec)(text.slice(0, max));
|
|
137
|
-
});
|
|
138
|
-
if (onAddToken) {
|
|
139
|
-
tokenSpecs.forEach(onAddToken);
|
|
140
|
-
} else if (onChangeTokens) {
|
|
141
|
-
onChangeTokens(tokens.concat(tokenSpecs));
|
|
149
|
+
this.setState({
|
|
150
|
+
value: ''
|
|
151
|
+
});
|
|
142
152
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
153
|
+
}, {
|
|
154
|
+
key: "deleteToken",
|
|
155
|
+
value: function deleteToken(tokenId) {
|
|
156
|
+
var _this$props4 = this.props,
|
|
157
|
+
onRemoveToken = _this$props4.onRemoveToken,
|
|
158
|
+
onChangeTokens = _this$props4.onChangeTokens,
|
|
159
|
+
_this$props4$tokens = _this$props4.tokens,
|
|
160
|
+
tokens = _this$props4$tokens === void 0 ? [] : _this$props4$tokens;
|
|
161
|
+
var count = tokens.length;
|
|
162
|
+
if (count === 0) return;
|
|
163
|
+
var id = tokenId !== null && tokenId !== void 0 ? tokenId : tokens[count - 1].id;
|
|
164
|
+
if (onRemoveToken) {
|
|
165
|
+
onRemoveToken(id);
|
|
166
|
+
} else if (onChangeTokens) {
|
|
167
|
+
onChangeTokens(tokens.filter(function (tokenSpec) {
|
|
168
|
+
return tokenSpec.id !== id;
|
|
169
|
+
}));
|
|
170
|
+
}
|
|
171
|
+
this.setState({
|
|
172
|
+
value: ''
|
|
173
|
+
});
|
|
162
174
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
"
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
175
|
+
}, {
|
|
176
|
+
key: "renderToken",
|
|
177
|
+
value: function renderToken(token) {
|
|
178
|
+
var _this2 = this;
|
|
179
|
+
var _this$props5 = this.props,
|
|
180
|
+
defaultIconName = _this$props5.iconName,
|
|
181
|
+
disabled = _this$props5.disabled;
|
|
182
|
+
var activeId = this.state.activeToken;
|
|
183
|
+
var id = token.id,
|
|
184
|
+
tokenIconName = token.iconName,
|
|
185
|
+
value = token.value,
|
|
186
|
+
valid = token.valid;
|
|
187
|
+
var iconName = tokenIconName || defaultIconName;
|
|
188
|
+
var isActive = activeId === id;
|
|
189
|
+
return /*#__PURE__*/React.createElement(_Token.default, {
|
|
190
|
+
id: id,
|
|
191
|
+
onClick: function onClick(e) {
|
|
192
|
+
return _this2.handleClickToken(e, token);
|
|
193
|
+
},
|
|
194
|
+
valid: valid,
|
|
195
|
+
active: isActive,
|
|
196
|
+
disabled: disabled
|
|
197
|
+
}, /*#__PURE__*/React.createElement(_Box.default, {
|
|
198
|
+
display: "flex",
|
|
199
|
+
alignItems: "center"
|
|
200
|
+
}, iconName && /*#__PURE__*/React.createElement(_Icon.default, {
|
|
201
|
+
name: iconName,
|
|
202
|
+
size: "mini",
|
|
203
|
+
pr: 300
|
|
204
|
+
}), value));
|
|
205
|
+
}
|
|
206
|
+
}, {
|
|
207
|
+
key: "renderTokens",
|
|
208
|
+
value: function renderTokens(tokens) {
|
|
209
|
+
var _this3 = this;
|
|
210
|
+
return tokens.map(function (token) {
|
|
211
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
212
|
+
key: token.id,
|
|
213
|
+
className: "TokenInput-token"
|
|
214
|
+
}, _this3.renderToken(token));
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
}, {
|
|
218
|
+
key: "render",
|
|
219
|
+
value: function render() {
|
|
220
|
+
var _this$props6 = this.props,
|
|
221
|
+
autoFocus = _this$props6.autoFocus,
|
|
222
|
+
autocomplete = _this$props6.autocomplete,
|
|
223
|
+
disabled = _this$props6.disabled,
|
|
224
|
+
isInvalid = _this$props6.isInvalid,
|
|
225
|
+
hasWarning = _this$props6.hasWarning,
|
|
226
|
+
id = _this$props6.id,
|
|
227
|
+
name = _this$props6.name,
|
|
228
|
+
placeholder = _this$props6.placeholder,
|
|
229
|
+
required = _this$props6.required,
|
|
230
|
+
value = _this$props6.value,
|
|
231
|
+
elemBefore = _this$props6.elemBefore,
|
|
232
|
+
elemAfter = _this$props6.elemAfter,
|
|
233
|
+
maxLength = _this$props6.maxLength,
|
|
234
|
+
ariaDescribedby = _this$props6.ariaDescribedby,
|
|
235
|
+
ariaLabel = _this$props6.ariaLabel,
|
|
236
|
+
innerRef = _this$props6.innerRef,
|
|
237
|
+
onAddToken = _this$props6.onAddToken,
|
|
238
|
+
onRemoveToken = _this$props6.onRemoveToken,
|
|
239
|
+
onChangeTokens = _this$props6.onChangeTokens,
|
|
240
|
+
onClickToken = _this$props6.onClickToken,
|
|
241
|
+
onBlur = _this$props6.onBlur,
|
|
242
|
+
onChange = _this$props6.onChange,
|
|
243
|
+
onFocus = _this$props6.onFocus,
|
|
244
|
+
onKeyDown = _this$props6.onKeyDown,
|
|
245
|
+
onKeyUp = _this$props6.onKeyUp,
|
|
246
|
+
onPaste = _this$props6.onPaste,
|
|
247
|
+
_this$props6$inputPro = _this$props6.inputProps,
|
|
248
|
+
inputProps = _this$props6$inputPro === void 0 ? {} : _this$props6$inputPro,
|
|
249
|
+
_this$props6$qa = _this$props6.qa,
|
|
250
|
+
qa = _this$props6$qa === void 0 ? {} : _this$props6$qa,
|
|
251
|
+
tokens = _this$props6.tokens,
|
|
252
|
+
rest = _objectWithoutProperties(_this$props6, _excluded);
|
|
253
|
+
var state = this.state;
|
|
254
|
+
return /*#__PURE__*/React.createElement(_styles.default, _extends({
|
|
255
|
+
hasBeforeElement: !!elemBefore,
|
|
256
|
+
hasAfterElement: !!elemAfter,
|
|
257
|
+
disabled: disabled,
|
|
258
|
+
invalid: !!isInvalid,
|
|
259
|
+
warning: hasWarning,
|
|
260
|
+
focused: state.hasFocus
|
|
261
|
+
// $FlowIssue - upgrade v0.112.0
|
|
262
|
+
}, rest), elemBefore && /*#__PURE__*/React.createElement(_styles2.Accessory, {
|
|
263
|
+
before: true
|
|
264
|
+
}, elemBefore), tokens && this.renderTokens(tokens), /*#__PURE__*/React.createElement("input", _extends({
|
|
265
|
+
"aria-describedby": ariaDescribedby,
|
|
266
|
+
"aria-invalid": !!isInvalid,
|
|
267
|
+
"aria-label": ariaLabel,
|
|
268
|
+
autoFocus: autoFocus,
|
|
269
|
+
autoComplete: autocomplete,
|
|
270
|
+
disabled: disabled,
|
|
271
|
+
id: id,
|
|
272
|
+
name: name,
|
|
273
|
+
placeholder: placeholder,
|
|
274
|
+
type: "text",
|
|
275
|
+
required: required,
|
|
276
|
+
value: state.value,
|
|
277
|
+
maxLength: maxLength,
|
|
278
|
+
onBlur: this.handleBlur,
|
|
279
|
+
onChange: this.handleChangeText,
|
|
280
|
+
onFocus: this.handleFocus,
|
|
281
|
+
onKeyDown: this.handleKeyDown,
|
|
282
|
+
onKeyUp: this.handleKeyUp,
|
|
283
|
+
onPaste: this.handlePaste,
|
|
284
|
+
ref: innerRef,
|
|
285
|
+
"data-qa-input": name || '',
|
|
286
|
+
"data-qa-input-isdisabled": !!disabled,
|
|
287
|
+
"data-qa-input-isrequired": !!required
|
|
288
|
+
}, qa, inputProps)), elemAfter && /*#__PURE__*/React.createElement(_styles2.Accessory, {
|
|
289
|
+
after: true
|
|
290
|
+
}, elemAfter));
|
|
291
|
+
}
|
|
292
|
+
}], [{
|
|
293
|
+
key: "getDerivedStateFromProps",
|
|
294
|
+
value: function getDerivedStateFromProps(props, state) {
|
|
295
|
+
var prevProps = state.prevProps;
|
|
296
|
+
var modifiedState = {};
|
|
297
|
+
ControlledPropNames.forEach(function (propName) {
|
|
298
|
+
var currentProp = props[propName];
|
|
299
|
+
if (currentProp !== prevProps[propName]) {
|
|
300
|
+
modifiedState[propName] = currentProp;
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
modifiedState.prevProps = props;
|
|
304
|
+
return modifiedState;
|
|
305
|
+
}
|
|
306
|
+
}]);
|
|
278
307
|
return TokenInput;
|
|
279
308
|
}(React.Component);
|
|
280
309
|
exports.default = TokenInput;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
4
7
|
exports.default = void 0;
|
|
5
8
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
6
9
|
var _systemProps = require("../utils/system-props");
|
|
7
10
|
var _mixins = require("../utils/mixins");
|
|
8
11
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
9
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null ||
|
|
12
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
10
13
|
|
|
11
14
|
var Container = _styledComponents.default.div.withConfig({
|
|
12
15
|
displayName: "styles__Container",
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
exports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
4
6
|
exports.delimitersAsRegExp = exports.asTokenSpec = void 0;
|
|
5
7
|
var _lodash = _interopRequireDefault(require("lodash.uniqueid"));
|
|
6
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
7
9
|
|
|
8
10
|
var asTokenSpec = function asTokenSpec(text) {
|
|
9
11
|
return {
|
|
10
|
-
id: (0, _lodash.default)(text
|
|
12
|
+
id: (0, _lodash.default)("".concat(text, "-")),
|
|
11
13
|
value: text.trim()
|
|
12
14
|
};
|
|
13
15
|
};
|
|
@@ -20,6 +22,6 @@ var delimitersAsRegExp = function delimitersAsRegExp(delimiters) {
|
|
|
20
22
|
var chars = delimiters.map(function (key) {
|
|
21
23
|
return KeyNameToRegExpChar[key] || key;
|
|
22
24
|
}).join('');
|
|
23
|
-
return RegExp("["
|
|
25
|
+
return RegExp("[".concat(chars, "]"));
|
|
24
26
|
};
|
|
25
27
|
exports.delimitersAsRegExp = delimitersAsRegExp;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
exports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
4
6
|
exports.default = void 0;
|
|
5
7
|
var React = _interopRequireWildcard(require("react"));
|
|
6
8
|
var _styles = require("./styles");
|
|
@@ -10,7 +12,18 @@ var _excluded = ["content", "children", "enterDelay", "placement", "appearance",
|
|
|
10
12
|
_excluded2 = ["appearance", "children"];
|
|
11
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null ||
|
|
15
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
16
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
17
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
18
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
19
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
20
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
21
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
22
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
23
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
24
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
25
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
26
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
14
27
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
15
28
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
16
29
|
var idCounter = 0;
|
|
@@ -38,15 +51,18 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
38
51
|
popoutProps = _ref.popoutProps,
|
|
39
52
|
_ref$truncated = _ref.truncated,
|
|
40
53
|
truncated = _ref$truncated === void 0 ? false : _ref$truncated,
|
|
41
|
-
rest =
|
|
54
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
42
55
|
var _useState = (0, React.useState)(false),
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
56
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
57
|
+
shouldShow = _useState2[0],
|
|
58
|
+
setShouldShow = _useState2[1];
|
|
59
|
+
var _useState3 = (0, React.useState)(false),
|
|
60
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
61
|
+
isOpen = _useState4[0],
|
|
62
|
+
setIsOpen = _useState4[1];
|
|
63
|
+
var _useState5 = (0, React.useState)("Racine-tooltip-".concat(idCounter++)),
|
|
64
|
+
_useState6 = _slicedToArray(_useState5, 1),
|
|
65
|
+
id = _useState6[0];
|
|
50
66
|
var isInvalidContent = content === null || content === undefined;
|
|
51
67
|
var show = function show() {
|
|
52
68
|
return setShouldShow(true);
|
|
@@ -55,7 +71,7 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
55
71
|
return setShouldShow(false);
|
|
56
72
|
};
|
|
57
73
|
var exitDelay = _seedsMotionUnitless.default.MOTION_DURATION_FAST * 1000;
|
|
58
|
-
var defaultAppearance = appearance || (
|
|
74
|
+
var defaultAppearance = appearance || (_typeof(content) === 'object' ? 'box' : 'pill');
|
|
59
75
|
var shouldTooltipContentsBeInteractive = defaultAppearance === 'box';
|
|
60
76
|
(0, React.useEffect)(function () {
|
|
61
77
|
var timeout;
|
|
@@ -74,7 +90,7 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
74
90
|
}, [isOpen, shouldShow, enterDelay, exitDelay]);
|
|
75
91
|
var wrappedContent = wrapContent(
|
|
76
92
|
// $FlowIssue - https://github.com/facebook/flow/issues/6392
|
|
77
|
-
content, shouldTooltipContentsBeInteractive ? show : undefined, shouldTooltipContentsBeInteractive ? hide : undefined, Content, defaultAppearance,
|
|
93
|
+
content, shouldTooltipContentsBeInteractive ? show : undefined, shouldTooltipContentsBeInteractive ? hide : undefined, Content, defaultAppearance, _objectSpread({
|
|
78
94
|
id: id
|
|
79
95
|
}, rest), {});
|
|
80
96
|
var ariaPropsForWrappedChildren = isOpen ? {
|
|
@@ -92,7 +108,7 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
92
108
|
content: !isInvalidContent ? wrappedContent : undefined,
|
|
93
109
|
isOpen: isOpen,
|
|
94
110
|
placement: placement,
|
|
95
|
-
qa:
|
|
111
|
+
qa: _objectSpread({
|
|
96
112
|
'data-qa-tooltip': id
|
|
97
113
|
}, qa),
|
|
98
114
|
focusOnContent: false,
|
|
@@ -104,7 +120,7 @@ var Content = function Content(_ref2) {
|
|
|
104
120
|
var _ref2$appearance = _ref2.appearance,
|
|
105
121
|
appearance = _ref2$appearance === void 0 ? 'pill' : _ref2$appearance,
|
|
106
122
|
children = _ref2.children,
|
|
107
|
-
rest =
|
|
123
|
+
rest = _objectWithoutProperties(_ref2, _excluded2);
|
|
108
124
|
return /*#__PURE__*/React.createElement(_styles.TooltipContent, _extends({
|
|
109
125
|
appearance: appearance,
|
|
110
126
|
borderRadius: appearance === 'box' ? 500 : '5000em',
|