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