@sproutsocial/racine 12.21.2 → 12.22.1
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 +20 -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 +3 -3
- 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__/Fieldset/index.js +1 -1
- package/__flow__/Indicator/index.js +1 -1
- package/__flow__/Input/index.js +2 -1
- package/__flow__/Input/styles.js +1 -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__/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 +28 -13
- 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/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 +6 -3
- 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 +75 -57
- 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 +3 -1
- package/commonjs/SpotIllustration/index.js +5 -3
- package/commonjs/Stack/index.js +7 -3
- package/commonjs/Switch/index.js +54 -36
- 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 +41 -24
- package/commonjs/TableCell/styles.js +3 -1
- package/commonjs/TableHeaderCell/index.js +56 -38
- package/commonjs/TableHeaderCell/styles.js +5 -2
- package/commonjs/TableRowAccordion/index.js +63 -45
- package/commonjs/TableRowAccordion/styles.js +5 -2
- package/commonjs/Tabs/index.js +118 -91
- 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 +45 -27
- 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/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 +25 -13
- 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/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 +3 -3
- 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 +72 -56
- 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/index.js +3 -3
- package/lib/Stack/index.js +4 -3
- package/lib/Switch/index.js +53 -37
- 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 +38 -23
- package/lib/TableCell/styles.js +1 -1
- package/lib/TableHeaderCell/index.js +54 -38
- package/lib/TableHeaderCell/styles.js +1 -1
- package/lib/TableRowAccordion/index.js +62 -46
- package/lib/TableRowAccordion/styles.js +1 -1
- package/lib/Tabs/index.js +115 -90
- 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 +43 -27
- 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 +21 -35
- package/__flow__/Avatar/index.test.js +0 -23
package/commonjs/Input/index.js
CHANGED
|
@@ -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 = _interopRequireWildcard(require("./styles"));
|
|
@@ -12,11 +15,21 @@ var _useInteractiveColor = require("../utils/useInteractiveColor");
|
|
|
12
15
|
var _excluded = ["autoComplete", "autoFocus", "disabled", "readOnly", "isInvalid", "hasWarning", "id", "name", "placeholder", "type", "required", "value", "elemBefore", "elemAfter", "maxLength", "ariaLabel", "ariaDescribedby", "clearButtonLabel", "innerRef", "onBlur", "onChange", "onClear", "onFocus", "onKeyDown", "onKeyUp", "onPaste", "inputProps", "qa", "appearance", "size"];
|
|
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 InputContext = /*#__PURE__*/React.createContext({});
|
|
21
34
|
var StyledButton = (0, _styledComponents.default)(_Button.default).withConfig({
|
|
22
35
|
displayName: "Input__StyledButton",
|
|
@@ -38,6 +51,7 @@ var ClearButton = function ClearButton() {
|
|
|
38
51
|
|
|
39
52
|
// Warn if clearButtonLabel is not included, so that the unlocalized fallback will not be mistaken for a proper label.
|
|
40
53
|
if (!clearButtonLabel) {
|
|
54
|
+
// eslint-disable-next-line no-console
|
|
41
55
|
console.warn('Warning: clearButtonLabel prop is required when using Input.ClearButton. Please pass a localized clearButtonLabel to Input.');
|
|
42
56
|
}
|
|
43
57
|
|
|
@@ -62,27 +76,30 @@ var ClearButton = function ClearButton() {
|
|
|
62
76
|
// Used for positioning elementAfter. This logic will detect if the element is a ClearButton,
|
|
63
77
|
// regardless of whether it was manually passed as elemAfter or automatically added to a search Input.
|
|
64
78
|
var isClearButton = function isClearButton(elem) {
|
|
65
|
-
if (elem
|
|
79
|
+
if (elem !== null && elem !== void 0 && elem.type) {
|
|
66
80
|
return elem.type.displayName === 'Input.ClearButton';
|
|
67
81
|
}
|
|
68
82
|
return false;
|
|
69
83
|
};
|
|
70
84
|
var Input = /*#__PURE__*/function (_React$Component) {
|
|
71
|
-
|
|
85
|
+
_inherits(Input, _React$Component);
|
|
86
|
+
var _super = _createSuper(Input);
|
|
72
87
|
function Input(props) {
|
|
73
88
|
var _this;
|
|
74
|
-
|
|
75
|
-
_this
|
|
76
|
-
_this
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
89
|
+
_classCallCheck(this, Input);
|
|
90
|
+
_this = _super.call(this, props);
|
|
91
|
+
_defineProperty(_assertThisInitialized(_this), "inputRef", /*#__PURE__*/React.createRef());
|
|
92
|
+
_defineProperty(_assertThisInitialized(_this), "handleBlur", function (e) {
|
|
93
|
+
var _this$props$onBlur, _this$props;
|
|
94
|
+
return (_this$props$onBlur = (_this$props = _this.props).onBlur) === null || _this$props$onBlur === void 0 ? void 0 : _this$props$onBlur.call(_this$props, e);
|
|
95
|
+
});
|
|
96
|
+
_defineProperty(_assertThisInitialized(_this), "handleClear", function (e) {
|
|
80
97
|
var input = _this.inputRef.current;
|
|
81
98
|
if (input) {
|
|
82
|
-
var _Object$getOwnPropert;
|
|
99
|
+
var _Object$getOwnPropert, _this$props$onClear, _this$props2;
|
|
83
100
|
// Clear the value via the input prototype, then dispatch an input event in order to trigger handleChange
|
|
84
|
-
var nativeInputValueSetter = (_Object$getOwnPropert = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'value'))
|
|
85
|
-
nativeInputValueSetter
|
|
101
|
+
var nativeInputValueSetter = (_Object$getOwnPropert = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'value')) === null || _Object$getOwnPropert === void 0 ? void 0 : _Object$getOwnPropert.set;
|
|
102
|
+
nativeInputValueSetter === null || nativeInputValueSetter === void 0 ? void 0 : nativeInputValueSetter.call(input, '');
|
|
86
103
|
var inputEvent = new Event('input', {
|
|
87
104
|
bubbles: true
|
|
88
105
|
});
|
|
@@ -91,26 +108,31 @@ var Input = /*#__PURE__*/function (_React$Component) {
|
|
|
91
108
|
// Focus the input, update hasValue, and call any onClear callback
|
|
92
109
|
input.focus();
|
|
93
110
|
_this.updateState('');
|
|
94
|
-
_this.props.onClear
|
|
111
|
+
(_this$props$onClear = (_this$props2 = _this.props).onClear) === null || _this$props$onClear === void 0 ? void 0 : _this$props$onClear.call(_this$props2, e);
|
|
95
112
|
}
|
|
96
|
-
};
|
|
97
|
-
_this
|
|
98
|
-
|
|
113
|
+
});
|
|
114
|
+
_defineProperty(_assertThisInitialized(_this), "handleChange", function (e) {
|
|
115
|
+
var _this$props$onChange, _this$props3;
|
|
116
|
+
(_this$props$onChange = (_this$props3 = _this.props).onChange) === null || _this$props$onChange === void 0 ? void 0 : _this$props$onChange.call(_this$props3, e, e.currentTarget.value);
|
|
99
117
|
_this.updateState(e.currentTarget.value);
|
|
100
|
-
};
|
|
101
|
-
_this
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
return _this.props.
|
|
112
|
-
};
|
|
113
|
-
_this
|
|
118
|
+
});
|
|
119
|
+
_defineProperty(_assertThisInitialized(_this), "handleFocus", function (e) {
|
|
120
|
+
var _this$props$onFocus, _this$props4;
|
|
121
|
+
return (_this$props$onFocus = (_this$props4 = _this.props).onFocus) === null || _this$props$onFocus === void 0 ? void 0 : _this$props$onFocus.call(_this$props4, e);
|
|
122
|
+
});
|
|
123
|
+
_defineProperty(_assertThisInitialized(_this), "handleKeyDown", function (e) {
|
|
124
|
+
var _this$props$onKeyDown, _this$props5;
|
|
125
|
+
return (_this$props$onKeyDown = (_this$props5 = _this.props).onKeyDown) === null || _this$props$onKeyDown === void 0 ? void 0 : _this$props$onKeyDown.call(_this$props5, e, e.currentTarget.value);
|
|
126
|
+
});
|
|
127
|
+
_defineProperty(_assertThisInitialized(_this), "handleKeyUp", function (e) {
|
|
128
|
+
var _this$props$onKeyUp, _this$props6;
|
|
129
|
+
return (_this$props$onKeyUp = (_this$props6 = _this.props).onKeyUp) === null || _this$props$onKeyUp === void 0 ? void 0 : _this$props$onKeyUp.call(_this$props6, e, e.currentTarget.value);
|
|
130
|
+
});
|
|
131
|
+
_defineProperty(_assertThisInitialized(_this), "handlePaste", function (e) {
|
|
132
|
+
var _this$props$onPaste, _this$props7;
|
|
133
|
+
return (_this$props$onPaste = (_this$props7 = _this.props).onPaste) === null || _this$props$onPaste === void 0 ? void 0 : _this$props$onPaste.call(_this$props7, e, e.currentTarget.value);
|
|
134
|
+
});
|
|
135
|
+
_defineProperty(_assertThisInitialized(_this), "updateState", function (inputValue) {
|
|
114
136
|
var hasValue = inputValue !== '';
|
|
115
137
|
var previousHasValue = _this.state.hasValue;
|
|
116
138
|
// Only update state if the value of `hasValue` has changed to avoid unnecessary renders.
|
|
@@ -119,7 +141,7 @@ var Input = /*#__PURE__*/function (_React$Component) {
|
|
|
119
141
|
hasValue: hasValue
|
|
120
142
|
});
|
|
121
143
|
}
|
|
122
|
-
};
|
|
144
|
+
});
|
|
123
145
|
_this.state = {
|
|
124
146
|
// Tracking hasValue in state allows us to hide ClearButton when there is no value to clear
|
|
125
147
|
// for both controlled and uncontrolled inputs.
|
|
@@ -127,115 +149,117 @@ var Input = /*#__PURE__*/function (_React$Component) {
|
|
|
127
149
|
};
|
|
128
150
|
return _this;
|
|
129
151
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
152
|
+
_createClass(Input, [{
|
|
153
|
+
key: "render",
|
|
154
|
+
value: function render() {
|
|
155
|
+
var _this$props8 = this.props,
|
|
156
|
+
autoComplete = _this$props8.autoComplete,
|
|
157
|
+
autoFocus = _this$props8.autoFocus,
|
|
158
|
+
disabled = _this$props8.disabled,
|
|
159
|
+
readOnly = _this$props8.readOnly,
|
|
160
|
+
isInvalid = _this$props8.isInvalid,
|
|
161
|
+
hasWarning = _this$props8.hasWarning,
|
|
162
|
+
id = _this$props8.id,
|
|
163
|
+
name = _this$props8.name,
|
|
164
|
+
placeholder = _this$props8.placeholder,
|
|
165
|
+
type = _this$props8.type,
|
|
166
|
+
required = _this$props8.required,
|
|
167
|
+
value = _this$props8.value,
|
|
168
|
+
elemBefore = _this$props8.elemBefore,
|
|
169
|
+
elemAfter = _this$props8.elemAfter,
|
|
170
|
+
maxLength = _this$props8.maxLength,
|
|
171
|
+
ariaLabel = _this$props8.ariaLabel,
|
|
172
|
+
ariaDescribedby = _this$props8.ariaDescribedby,
|
|
173
|
+
clearButtonLabel = _this$props8.clearButtonLabel,
|
|
174
|
+
innerRef = _this$props8.innerRef,
|
|
175
|
+
onBlur = _this$props8.onBlur,
|
|
176
|
+
onChange = _this$props8.onChange,
|
|
177
|
+
onClear = _this$props8.onClear,
|
|
178
|
+
onFocus = _this$props8.onFocus,
|
|
179
|
+
onKeyDown = _this$props8.onKeyDown,
|
|
180
|
+
onKeyUp = _this$props8.onKeyUp,
|
|
181
|
+
onPaste = _this$props8.onPaste,
|
|
182
|
+
_this$props8$inputPro = _this$props8.inputProps,
|
|
183
|
+
inputProps = _this$props8$inputPro === void 0 ? {} : _this$props8$inputPro,
|
|
184
|
+
_this$props8$qa = _this$props8.qa,
|
|
185
|
+
qa = _this$props8$qa === void 0 ? {} : _this$props8$qa,
|
|
186
|
+
appearance = _this$props8.appearance,
|
|
187
|
+
size = _this$props8.size,
|
|
188
|
+
rest = _objectWithoutProperties(_this$props8, _excluded);
|
|
166
189
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
190
|
+
// Convert autoComplete from a boolean prop to a string value.
|
|
191
|
+
var autoCompleteValue;
|
|
192
|
+
if (autoComplete !== undefined) {
|
|
193
|
+
autoCompleteValue = autoComplete ? 'on' : 'off';
|
|
194
|
+
}
|
|
172
195
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
size: size
|
|
189
|
-
// $FlowIssue - upgrade v0.112.0
|
|
190
|
-
}, rest), /*#__PURE__*/React.createElement(InputContext.Provider, {
|
|
191
|
-
value: {
|
|
192
|
-
handleClear: this.handleClear,
|
|
193
|
-
hasValue: this.state.hasValue,
|
|
194
|
-
clearButtonLabel: clearButtonLabel,
|
|
196
|
+
// Add default elemBefore and elemAfter elements if type is search.
|
|
197
|
+
var elementBefore = type === 'search' && !elemBefore ? /*#__PURE__*/React.createElement(_Icon.default, {
|
|
198
|
+
name: "search",
|
|
199
|
+
ariaHidden: true,
|
|
200
|
+
color: "icon.base"
|
|
201
|
+
}) : elemBefore;
|
|
202
|
+
// Do not add a ClearButton if an elemAfter prop was passed.
|
|
203
|
+
var elementAfter = type === 'search' && !elemAfter ? /*#__PURE__*/React.createElement(ClearButton, null) : elemAfter;
|
|
204
|
+
return /*#__PURE__*/React.createElement(_styles.default, _extends({
|
|
205
|
+
hasBeforeElement: !!elementBefore,
|
|
206
|
+
hasAfterElement: !!elementAfter,
|
|
207
|
+
disabled: disabled,
|
|
208
|
+
invalid: !!isInvalid,
|
|
209
|
+
warning: hasWarning,
|
|
210
|
+
appearance: appearance,
|
|
195
211
|
size: size
|
|
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
|
-
|
|
212
|
+
// $FlowIssue - upgrade v0.112.0
|
|
213
|
+
}, rest), /*#__PURE__*/React.createElement(InputContext.Provider, {
|
|
214
|
+
value: {
|
|
215
|
+
handleClear: this.handleClear,
|
|
216
|
+
hasValue: this.state.hasValue,
|
|
217
|
+
clearButtonLabel: clearButtonLabel,
|
|
218
|
+
size: size
|
|
219
|
+
}
|
|
220
|
+
}, elementBefore && /*#__PURE__*/React.createElement(_styles.Accessory, {
|
|
221
|
+
before: true
|
|
222
|
+
}, elementBefore), /*#__PURE__*/React.createElement("input", _extends({
|
|
223
|
+
"aria-invalid": !!isInvalid,
|
|
224
|
+
"aria-label": ariaLabel,
|
|
225
|
+
"aria-describedby": ariaDescribedby,
|
|
226
|
+
autoComplete: autoCompleteValue,
|
|
227
|
+
autoFocus: autoFocus,
|
|
228
|
+
disabled: disabled,
|
|
229
|
+
readOnly: readOnly,
|
|
230
|
+
id: id,
|
|
231
|
+
name: name,
|
|
232
|
+
placeholder: placeholder,
|
|
233
|
+
type: type,
|
|
234
|
+
required: required,
|
|
235
|
+
value: value,
|
|
236
|
+
maxLength: maxLength,
|
|
237
|
+
onBlur: this.handleBlur,
|
|
238
|
+
onChange: this.handleChange,
|
|
239
|
+
onFocus: this.handleFocus,
|
|
240
|
+
onKeyDown: this.handleKeyDown,
|
|
241
|
+
onKeyUp: this.handleKeyUp,
|
|
242
|
+
onPaste: this.handlePaste,
|
|
243
|
+
ref: (0, _utils.mergeRefs)([innerRef, this.inputRef]),
|
|
244
|
+
"data-qa-input": name || '',
|
|
245
|
+
"data-qa-input-isdisabled": disabled === true,
|
|
246
|
+
"data-qa-input-isrequired": required === true
|
|
247
|
+
}, qa, inputProps)), elementAfter && /*#__PURE__*/React.createElement(_styles.Accessory, {
|
|
248
|
+
after: true,
|
|
249
|
+
isClearButton: isClearButton(elementAfter)
|
|
250
|
+
}, elementAfter)));
|
|
251
|
+
}
|
|
252
|
+
}]);
|
|
229
253
|
return Input;
|
|
230
254
|
}(React.Component);
|
|
231
|
-
Input
|
|
255
|
+
_defineProperty(Input, "defaultProps", {
|
|
232
256
|
autoFocus: false,
|
|
233
257
|
disabled: false,
|
|
234
258
|
type: 'text',
|
|
235
259
|
size: 'default',
|
|
236
260
|
appearance: 'primary'
|
|
237
|
-
};
|
|
238
|
-
Input
|
|
261
|
+
});
|
|
262
|
+
_defineProperty(Input, "ClearButton", ClearButton);
|
|
239
263
|
Input.ClearButton.displayName = 'Input.ClearButton';
|
|
240
264
|
var _default = Input;
|
|
241
265
|
exports.default = _default;
|
package/commonjs/Input/styles.js
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
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 = exports.Accessory = 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",
|
|
13
16
|
componentId: "sc-uozj0s-0"
|
|
14
|
-
})(["box-sizing:border-box;position:relative;input{box-sizing:border-box;width:100%;border:1px solid transparent;border-radius:", ";background-color:", ";color:", ";outline:none;transition:border-color ", " ", ",box-shadow ", " ", ";font-family:", ";font-weight:", ";appearance:none;line-height:16px;margin:0;padding:", ";font-size:", ";&::-ms-clear{display:none;}&::-webkit-search-cancel-button{appearance:none;}&:focus{", "}&:not(output):not(:focus):-moz-ui-invalid{box-shadow:none;}
|
|
17
|
+
})(["box-sizing:border-box;position:relative;input{box-sizing:border-box;width:100%;border:1px solid transparent;border-radius:", ";background-color:", ";color:", ";outline:none;transition:border-color ", " ", ",box-shadow ", " ", ";font-family:", ";font-weight:", ";appearance:none;line-height:16px;margin:0;padding:", ";font-size:", ";&::-ms-clear{display:none;}&::-webkit-search-cancel-button{appearance:none;}&:focus{", "}&:not(output):not(:focus):-moz-ui-invalid{box-shadow:none;}&::placeholder{color:", ";}", " ", "}", " ", " ", " ", " ", ""], function (props) {
|
|
15
18
|
return props.theme.radii[500];
|
|
16
19
|
}, function (props) {
|
|
17
20
|
return props.theme.colors.form.background.base;
|
|
@@ -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 _Text = _interopRequireDefault(require("../Text"));
|
|
@@ -8,24 +11,37 @@ var _styles = _interopRequireDefault(require("./styles"));
|
|
|
8
11
|
var _excluded = ["children"];
|
|
9
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
13
|
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); }
|
|
11
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null ||
|
|
14
|
+
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; }
|
|
15
|
+
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; }
|
|
12
16
|
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; }
|
|
13
|
-
function
|
|
17
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
18
|
+
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); } }
|
|
19
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
20
|
+
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); }
|
|
14
21
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
22
|
+
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); }; }
|
|
23
|
+
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); }
|
|
24
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
25
|
+
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; } }
|
|
26
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
15
27
|
var KeyboardKey = /*#__PURE__*/function (_React$Component) {
|
|
16
|
-
|
|
28
|
+
_inherits(KeyboardKey, _React$Component);
|
|
29
|
+
var _super = _createSuper(KeyboardKey);
|
|
17
30
|
function KeyboardKey() {
|
|
18
|
-
|
|
31
|
+
_classCallCheck(this, KeyboardKey);
|
|
32
|
+
return _super.apply(this, arguments);
|
|
19
33
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
34
|
+
_createClass(KeyboardKey, [{
|
|
35
|
+
key: "render",
|
|
36
|
+
value: function render() {
|
|
37
|
+
var _this$props = this.props,
|
|
38
|
+
children = _this$props.children,
|
|
39
|
+
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
40
|
+
return /*#__PURE__*/React.createElement(_styles.default, rest, /*#__PURE__*/React.createElement("kbd", {
|
|
41
|
+
"data-qa-keyboardkey": children
|
|
42
|
+
}, /*#__PURE__*/React.createElement(_Text.default, null, children)));
|
|
43
|
+
}
|
|
44
|
+
}]);
|
|
29
45
|
return KeyboardKey;
|
|
30
46
|
}(React.Component);
|
|
31
47
|
exports.default = KeyboardKey;
|
|
@@ -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 _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
6
8
|
var _systemProps = require("../utils/system-props");
|
package/commonjs/Label/index.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
'no babel-plugin-flow-react-proptypes';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
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); }
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
5
8
|
exports.default = void 0;
|
|
6
9
|
var React = _interopRequireWildcard(require("react"));
|
|
7
10
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
@@ -9,15 +12,24 @@ var _Text = _interopRequireDefault(require("../Text"));
|
|
|
9
12
|
var _excluded = ["as"];
|
|
10
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
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); }
|
|
12
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null ||
|
|
13
|
-
function
|
|
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
17
|
+
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); } }
|
|
18
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
19
|
+
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); }
|
|
14
20
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
21
|
+
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); }; }
|
|
22
|
+
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); }
|
|
23
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
24
|
+
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; } }
|
|
25
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
15
26
|
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); }
|
|
27
|
+
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; }
|
|
16
28
|
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; }
|
|
17
29
|
var LabelBase = function LabelBase(_ref) {
|
|
18
30
|
var _ref$as = _ref.as,
|
|
19
31
|
as = _ref$as === void 0 ? 'label' : _ref$as,
|
|
20
|
-
rest =
|
|
32
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
21
33
|
return /*#__PURE__*/React.createElement(_Text.default, _extends({}, rest, {
|
|
22
34
|
as: as
|
|
23
35
|
}));
|
|
@@ -27,20 +39,24 @@ var StyledLabel = (0, _styledComponents.default)(LabelBase).withConfig({
|
|
|
27
39
|
componentId: "sc-rqdi0a-0"
|
|
28
40
|
})(["display:flex;align-items:center;"]);
|
|
29
41
|
var Label = /*#__PURE__*/function (_React$Component) {
|
|
30
|
-
|
|
42
|
+
_inherits(Label, _React$Component);
|
|
43
|
+
var _super = _createSuper(Label);
|
|
31
44
|
function Label() {
|
|
32
|
-
|
|
45
|
+
_classCallCheck(this, Label);
|
|
46
|
+
return _super.apply(this, arguments);
|
|
33
47
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
48
|
+
_createClass(Label, [{
|
|
49
|
+
key: "render",
|
|
50
|
+
value: function render() {
|
|
51
|
+
return /*#__PURE__*/React.createElement(StyledLabel, _extends({
|
|
52
|
+
fontSize: 200,
|
|
53
|
+
fontWeight: "semibold",
|
|
54
|
+
color: "text.headline",
|
|
55
|
+
"data-qa-label": this.props.htmlFor
|
|
56
|
+
// $FlowIssue - upgrade v0.112.0
|
|
57
|
+
}, this.props));
|
|
58
|
+
}
|
|
59
|
+
}]);
|
|
44
60
|
return Label;
|
|
45
61
|
}(React.Component);
|
|
46
62
|
exports.default = Label;
|