@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/commonjs/Switch/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 = _interopRequireDefault(require("./styles"));
|
|
@@ -9,23 +12,35 @@ var _VisuallyHidden = require("../VisuallyHidden");
|
|
|
9
12
|
var _excluded = ["checked", "disabled", "name", "a11yLabels", "onClick", "qa"];
|
|
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 ||
|
|
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; }
|
|
13
16
|
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); }
|
|
17
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
14
18
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
15
|
-
function
|
|
19
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
20
|
+
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); } }
|
|
21
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
22
|
+
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); }
|
|
16
23
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
24
|
+
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); }; }
|
|
25
|
+
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); }
|
|
26
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
27
|
+
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; } }
|
|
28
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
29
|
+
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; }
|
|
17
30
|
/**
|
|
18
31
|
* Switch acts as a toggle, enabling users to turn a particular action on or off.
|
|
19
32
|
*/
|
|
20
33
|
var Switch = /*#__PURE__*/function (_React$Component) {
|
|
21
|
-
|
|
34
|
+
_inherits(Switch, _React$Component);
|
|
35
|
+
var _super = _createSuper(Switch);
|
|
22
36
|
function Switch() {
|
|
23
37
|
var _this;
|
|
38
|
+
_classCallCheck(this, Switch);
|
|
24
39
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
25
40
|
args[_key] = arguments[_key];
|
|
26
41
|
}
|
|
27
|
-
_this =
|
|
28
|
-
_this
|
|
42
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
43
|
+
_defineProperty(_assertThisInitialized(_this), "handleClick", function (e) {
|
|
29
44
|
var _this$props = _this.props,
|
|
30
45
|
checked = _this$props.checked,
|
|
31
46
|
onClick = _this$props.onClick,
|
|
@@ -33,42 +48,44 @@ var Switch = /*#__PURE__*/function (_React$Component) {
|
|
|
33
48
|
if (!disabled) {
|
|
34
49
|
onClick(e, !checked);
|
|
35
50
|
}
|
|
36
|
-
};
|
|
51
|
+
});
|
|
37
52
|
return _this;
|
|
38
53
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
54
|
+
_createClass(Switch, [{
|
|
55
|
+
key: "render",
|
|
56
|
+
value: function render() {
|
|
57
|
+
var _this$props2 = this.props,
|
|
58
|
+
checked = _this$props2.checked,
|
|
59
|
+
disabled = _this$props2.disabled,
|
|
60
|
+
name = _this$props2.name,
|
|
61
|
+
a11yLabels = _this$props2.a11yLabels,
|
|
62
|
+
onClick = _this$props2.onClick,
|
|
63
|
+
_this$props2$qa = _this$props2.qa,
|
|
64
|
+
qa = _this$props2$qa === void 0 ? {} : _this$props2$qa,
|
|
65
|
+
rest = _objectWithoutProperties(_this$props2, _excluded);
|
|
66
|
+
return /*#__PURE__*/React.createElement(_styles.default, _extends({
|
|
67
|
+
role: "button",
|
|
68
|
+
type: "button",
|
|
69
|
+
"aria-pressed": checked,
|
|
70
|
+
disabled: disabled,
|
|
71
|
+
onClick: this.handleClick,
|
|
72
|
+
"data-qa-switch": name || '',
|
|
73
|
+
"data-qa-switch-ischecked": checked === true,
|
|
74
|
+
"data-qa-switch-isdisabled": disabled === true,
|
|
75
|
+
checked: checked
|
|
76
|
+
}, qa, rest), /*#__PURE__*/React.createElement(_VisuallyHidden.VisuallyHidden, null, checked ? a11yLabels.on : a11yLabels.off), checked ? /*#__PURE__*/React.createElement(_Icon.default, {
|
|
77
|
+
size: "mini",
|
|
78
|
+
name: "check"
|
|
79
|
+
}) : null);
|
|
80
|
+
}
|
|
81
|
+
}]);
|
|
65
82
|
return Switch;
|
|
66
83
|
}(React.Component);
|
|
67
84
|
exports.default = Switch;
|
|
68
|
-
Switch
|
|
85
|
+
_defineProperty(Switch, "defaultProps", {
|
|
69
86
|
disabled: false,
|
|
70
87
|
a11yLabels: {
|
|
71
88
|
on: 'on',
|
|
72
89
|
off: 'off'
|
|
73
90
|
}
|
|
74
|
-
};
|
|
91
|
+
});
|
|
@@ -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 _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
6
9
|
var _systemProps = require("../utils/system-props");
|
|
@@ -8,7 +11,7 @@ var _mixins = require("../utils/mixins");
|
|
|
8
11
|
var _styles = _interopRequireDefault(require("../Icon/styles"));
|
|
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; }
|
|
12
15
|
|
|
13
16
|
// eslint-disable-next-line flowtype/generic-spacing
|
|
14
17
|
var Container = _styledComponents.default.button.withConfig({
|
|
@@ -36,7 +39,7 @@ var Container = _styledComponents.default.button.withConfig({
|
|
|
36
39
|
if (props.checked) {
|
|
37
40
|
return (0, _styledComponents.css)(["color:", ";text-align:left;border-color:", ";background-color:", ";&::after{background-color:", ";opacity:1;transform:translate(17px,-50%);}", "{position:absolute;top:50%;left:4px;transform:translate(0,-50%);color:", ";}"], props.theme.colors.text.body, props.theme.colors.form.border.selected, props.theme.colors.form.background.selected, props.theme.colors.icon.inverse, _styles.default, props.theme.colors.icon.inverse);
|
|
38
41
|
} else {
|
|
39
|
-
return "\n &:hover,\n &:focus {\n border-color: "
|
|
42
|
+
return "\n &:hover,\n &:focus {\n border-color: ".concat(props.theme.colors.form.border.base, ";\n background-color: ").concat(props.theme.colors.form.background.base, ";\n }\n &:hover {\n &::after {\n transform: translate(6px, -50%);\n }\n }\n ");
|
|
40
43
|
}
|
|
41
44
|
}, function (props) {
|
|
42
45
|
return props.disabled && (0, _styledComponents.css)(["opacity:0.4;cursor:not-allowed;&[aria-pressed='true']{&:hover,&:focus{background-color:", ";}}"], function (props) {
|
package/commonjs/Table/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 = exports.TableRow = exports.TableHead = exports.TableBody = exports.Table = void 0;
|
|
5
8
|
var React = _interopRequireWildcard(require("react"));
|
|
6
9
|
var _TableCell = _interopRequireDefault(require("../TableCell"));
|
|
@@ -12,13 +15,14 @@ var _excluded = ["head", "rows", "onSort", "sortId", "sortDirection", "rowRender
|
|
|
12
15
|
_excluded4 = ["children"];
|
|
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; }
|
|
19
|
+
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
20
|
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
21
|
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); }
|
|
18
22
|
var renderTableRow = function renderTableRow(row) {
|
|
19
23
|
return /*#__PURE__*/React.createElement("tbody", {
|
|
20
24
|
key: row.id,
|
|
21
|
-
"data-qa-table-row":
|
|
25
|
+
"data-qa-table-row": ""
|
|
22
26
|
}, /*#__PURE__*/React.createElement("tr", null, row.cells.map(function (td) {
|
|
23
27
|
return /*#__PURE__*/React.createElement(_TableCell.default, _extends({}, td, {
|
|
24
28
|
key: td.id
|
|
@@ -39,16 +43,16 @@ var Table = function Table(_ref) {
|
|
|
39
43
|
sortDirection = _ref.sortDirection,
|
|
40
44
|
rowRender = _ref.rowRender,
|
|
41
45
|
children = _ref.children,
|
|
42
|
-
rest =
|
|
46
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
43
47
|
if (children) {
|
|
44
48
|
return /*#__PURE__*/React.createElement(_styles.default, _extends({}, rest, {
|
|
45
|
-
"data-qa-table":
|
|
49
|
+
"data-qa-table": ""
|
|
46
50
|
}), children);
|
|
47
51
|
}
|
|
48
52
|
return /*#__PURE__*/React.createElement(_styles.default, _extends({}, rest, {
|
|
49
|
-
"data-qa-table":
|
|
53
|
+
"data-qa-table": ""
|
|
50
54
|
}), head.length > 0 && /*#__PURE__*/React.createElement("thead", {
|
|
51
|
-
"data-qa-table-header":
|
|
55
|
+
"data-qa-table-header": ""
|
|
52
56
|
}, /*#__PURE__*/React.createElement("tr", null, head.map(function (th) {
|
|
53
57
|
return /*#__PURE__*/React.createElement(_TableHeaderCell.default, _extends({}, th, {
|
|
54
58
|
key: th.id,
|
|
@@ -63,19 +67,19 @@ var Table = function Table(_ref) {
|
|
|
63
67
|
exports.Table = Table;
|
|
64
68
|
var TableHead = function TableHead(_ref2) {
|
|
65
69
|
var children = _ref2.children,
|
|
66
|
-
props =
|
|
70
|
+
props = _objectWithoutProperties(_ref2, _excluded2);
|
|
67
71
|
return /*#__PURE__*/React.createElement("thead", props, children);
|
|
68
72
|
};
|
|
69
73
|
exports.TableHead = TableHead;
|
|
70
74
|
var TableBody = function TableBody(_ref3) {
|
|
71
75
|
var children = _ref3.children,
|
|
72
|
-
props =
|
|
76
|
+
props = _objectWithoutProperties(_ref3, _excluded3);
|
|
73
77
|
return /*#__PURE__*/React.createElement("tbody", props, children);
|
|
74
78
|
};
|
|
75
79
|
exports.TableBody = TableBody;
|
|
76
80
|
var TableRow = function TableRow(_ref4) {
|
|
77
81
|
var children = _ref4.children,
|
|
78
|
-
props =
|
|
82
|
+
props = _objectWithoutProperties(_ref4, _excluded4);
|
|
79
83
|
return /*#__PURE__*/React.createElement("tr", props, children);
|
|
80
84
|
};
|
|
81
85
|
exports.TableRow = TableRow;
|
package/commonjs/Table/styles.js
CHANGED
|
@@ -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");
|
|
@@ -1,43 +1,59 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
4
7
|
exports.default = void 0;
|
|
5
8
|
var React = _interopRequireWildcard(require("react"));
|
|
6
9
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
7
10
|
var _excluded = ["id", "content", "colSpan", "width", "align", "children"];
|
|
8
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
12
|
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); }
|
|
10
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null ||
|
|
13
|
+
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; }
|
|
11
14
|
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); }
|
|
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
|
/**
|
|
16
28
|
* The table cell component is for rendering table cells and is meant to be used with the table component.
|
|
17
29
|
*/
|
|
18
30
|
var TableCell = /*#__PURE__*/function (_React$Component) {
|
|
19
|
-
|
|
31
|
+
_inherits(TableCell, _React$Component);
|
|
32
|
+
var _super = _createSuper(TableCell);
|
|
20
33
|
function TableCell() {
|
|
21
|
-
|
|
34
|
+
_classCallCheck(this, TableCell);
|
|
35
|
+
return _super.apply(this, arguments);
|
|
22
36
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
_createClass(TableCell, [{
|
|
38
|
+
key: "render",
|
|
39
|
+
value: function render() {
|
|
40
|
+
var _this$props = this.props,
|
|
41
|
+
id = _this$props.id,
|
|
42
|
+
content = _this$props.content,
|
|
43
|
+
colSpan = _this$props.colSpan,
|
|
44
|
+
width = _this$props.width,
|
|
45
|
+
align = _this$props.align,
|
|
46
|
+
children = _this$props.children,
|
|
47
|
+
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
48
|
+
return /*#__PURE__*/React.createElement(_styles.default, _extends({}, rest, {
|
|
49
|
+
alignment: align || 'left',
|
|
50
|
+
key: id,
|
|
51
|
+
colSpan: colSpan,
|
|
52
|
+
width: width,
|
|
53
|
+
"data-qa-table-cell": ""
|
|
54
|
+
}), children || content);
|
|
55
|
+
}
|
|
56
|
+
}]);
|
|
41
57
|
return TableCell;
|
|
42
58
|
}(React.Component);
|
|
43
59
|
exports.default = TableCell;
|
|
@@ -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");
|
|
@@ -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 = exports.SORT_DIRECTIONS = void 0;
|
|
5
8
|
var React = _interopRequireWildcard(require("react"));
|
|
6
9
|
var _styles = _interopRequireWildcard(require("./styles"));
|
|
@@ -8,11 +11,21 @@ var _Icon = _interopRequireDefault(require("../Icon/"));
|
|
|
8
11
|
var _excluded = ["id", "content", "colSpan", "width", "align", "isSortable", "shouldTruncate", "onSort", "sortId", "sortDirection", "children", "onClick"];
|
|
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; }
|
|
12
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; }
|
|
13
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; }
|
|
14
|
-
function
|
|
18
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
19
|
+
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); } }
|
|
20
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
21
|
+
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); }
|
|
15
22
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
23
|
+
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); }; }
|
|
24
|
+
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); }
|
|
25
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
26
|
+
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; } }
|
|
27
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
28
|
+
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; }
|
|
16
29
|
var SORT_DIRECTIONS = {
|
|
17
30
|
ASC: 'ASC',
|
|
18
31
|
DESC: 'DESC'
|
|
@@ -22,14 +35,16 @@ exports.SORT_DIRECTIONS = SORT_DIRECTIONS;
|
|
|
22
35
|
* The table header cell component is for rendering table header cells and is meant to be used with the table component.
|
|
23
36
|
*/
|
|
24
37
|
var TableHeaderCell = /*#__PURE__*/function (_React$Component) {
|
|
25
|
-
|
|
38
|
+
_inherits(TableHeaderCell, _React$Component);
|
|
39
|
+
var _super = _createSuper(TableHeaderCell);
|
|
26
40
|
function TableHeaderCell() {
|
|
27
41
|
var _this;
|
|
42
|
+
_classCallCheck(this, TableHeaderCell);
|
|
28
43
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
29
44
|
args[_key] = arguments[_key];
|
|
30
45
|
}
|
|
31
|
-
_this =
|
|
32
|
-
_this
|
|
46
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
47
|
+
_defineProperty(_assertThisInitialized(_this), "getSortIcon", function (isSorted) {
|
|
33
48
|
var sortDirection = _this.props.sortDirection;
|
|
34
49
|
var iconName = 'chevron-up-down-filled';
|
|
35
50
|
if (isSorted && sortDirection === SORT_DIRECTIONS.ASC) {
|
|
@@ -41,8 +56,8 @@ var TableHeaderCell = /*#__PURE__*/function (_React$Component) {
|
|
|
41
56
|
size: "mini",
|
|
42
57
|
name: iconName
|
|
43
58
|
}));
|
|
44
|
-
};
|
|
45
|
-
_this
|
|
59
|
+
});
|
|
60
|
+
_defineProperty(_assertThisInitialized(_this), "handleClick", function (e) {
|
|
46
61
|
var _this$props = _this.props,
|
|
47
62
|
onClick = _this$props.onClick,
|
|
48
63
|
onSort = _this$props.onSort,
|
|
@@ -54,37 +69,39 @@ var TableHeaderCell = /*#__PURE__*/function (_React$Component) {
|
|
|
54
69
|
}
|
|
55
70
|
if (!isSortable || !onSort) return;
|
|
56
71
|
onSort(id);
|
|
57
|
-
};
|
|
72
|
+
});
|
|
58
73
|
return _this;
|
|
59
74
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
75
|
+
_createClass(TableHeaderCell, [{
|
|
76
|
+
key: "render",
|
|
77
|
+
value: function render() {
|
|
78
|
+
var _this$props2 = this.props,
|
|
79
|
+
id = _this$props2.id,
|
|
80
|
+
content = _this$props2.content,
|
|
81
|
+
colSpan = _this$props2.colSpan,
|
|
82
|
+
width = _this$props2.width,
|
|
83
|
+
align = _this$props2.align,
|
|
84
|
+
isSortable = _this$props2.isSortable,
|
|
85
|
+
shouldTruncate = _this$props2.shouldTruncate,
|
|
86
|
+
onSort = _this$props2.onSort,
|
|
87
|
+
sortId = _this$props2.sortId,
|
|
88
|
+
sortDirection = _this$props2.sortDirection,
|
|
89
|
+
children = _this$props2.children,
|
|
90
|
+
onClick = _this$props2.onClick,
|
|
91
|
+
rest = _objectWithoutProperties(_this$props2, _excluded);
|
|
92
|
+
return /*#__PURE__*/React.createElement(_styles.default, _extends({}, rest, {
|
|
93
|
+
key: id,
|
|
94
|
+
alignment: align || 'left',
|
|
95
|
+
sortable: isSortable,
|
|
96
|
+
colSpan: colSpan,
|
|
97
|
+
width: width,
|
|
98
|
+
onClick: this.handleClick,
|
|
99
|
+
"data-tableheadercell-sortable": isSortable,
|
|
100
|
+
"data-qa-table-header-cell": "",
|
|
101
|
+
"data-qa-table-header-cell-sortdirection": sortDirection
|
|
102
|
+
}), children || content, isSortable && !children && this.getSortIcon(id === sortId));
|
|
103
|
+
}
|
|
104
|
+
}]);
|
|
88
105
|
return TableHeaderCell;
|
|
89
106
|
}(React.Component);
|
|
90
107
|
exports.default = TableHeaderCell;
|
|
@@ -1,11 +1,14 @@
|
|
|
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.SortIcon = void 0;
|
|
5
8
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
6
9
|
var _systemProps = require("../utils/system-props");
|
|
7
10
|
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); }
|
|
8
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null ||
|
|
11
|
+
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; }
|
|
9
12
|
|
|
10
13
|
var Container = _styledComponents.default.th.withConfig({
|
|
11
14
|
displayName: "styles__Container",
|