@dxc-technology/halstack-react 0.0.0-e4ccd42 → 0.0.0-e690193
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/README.md +1 -2
- package/dist/index.d.mts +3923 -0
- package/dist/index.d.ts +3923 -0
- package/dist/index.js +14133 -0
- package/dist/index.mjs +14045 -0
- package/package.json +83 -67
- package/BackgroundColorContext.d.ts +0 -1
- package/BackgroundColorContext.js +0 -30
- package/HalstackContext.d.ts +0 -1249
- package/HalstackContext.js +0 -310
- package/accordion/Accordion.d.ts +0 -4
- package/accordion/Accordion.js +0 -182
- package/accordion/Accordion.stories.tsx +0 -283
- package/accordion/Accordion.test.js +0 -56
- package/accordion/types.d.ts +0 -57
- package/accordion/types.js +0 -5
- package/accordion-group/AccordionGroup.d.ts +0 -8
- package/accordion-group/AccordionGroup.js +0 -101
- package/accordion-group/AccordionGroup.stories.tsx +0 -252
- package/accordion-group/AccordionGroup.test.js +0 -98
- package/accordion-group/AccordionGroupAccordion.d.ts +0 -4
- package/accordion-group/AccordionGroupAccordion.js +0 -31
- package/accordion-group/types.d.ts +0 -67
- package/accordion-group/types.js +0 -5
- package/action-icon/ActionIcon.d.ts +0 -4
- package/action-icon/ActionIcon.js +0 -47
- package/action-icon/ActionIcon.stories.tsx +0 -41
- package/action-icon/ActionIcon.test.js +0 -64
- package/action-icon/types.d.ts +0 -26
- package/action-icon/types.js +0 -5
- package/alert/Alert.d.ts +0 -4
- package/alert/Alert.js +0 -254
- package/alert/Alert.stories.tsx +0 -198
- package/alert/Alert.test.js +0 -75
- package/alert/types.d.ts +0 -49
- package/alert/types.js +0 -5
- package/badge/Badge.d.ts +0 -4
- package/badge/Badge.js +0 -159
- package/badge/Badge.stories.tsx +0 -210
- package/badge/Badge.test.js +0 -30
- package/badge/types.d.ts +0 -54
- package/badge/types.js +0 -5
- package/bleed/Bleed.d.ts +0 -3
- package/bleed/Bleed.js +0 -43
- package/bleed/Bleed.stories.tsx +0 -342
- package/bleed/types.d.ts +0 -37
- package/bleed/types.js +0 -5
- package/box/Box.d.ts +0 -4
- package/box/Box.js +0 -75
- package/box/Box.stories.tsx +0 -119
- package/box/Box.test.js +0 -13
- package/box/types.d.ts +0 -32
- package/box/types.js +0 -5
- package/bulleted-list/BulletedList.d.ts +0 -7
- package/bulleted-list/BulletedList.js +0 -89
- package/bulleted-list/BulletedList.stories.tsx +0 -115
- package/bulleted-list/types.d.ts +0 -38
- package/bulleted-list/types.js +0 -5
- package/button/Button.d.ts +0 -4
- package/button/Button.js +0 -120
- package/button/Button.stories.tsx +0 -344
- package/button/Button.test.js +0 -38
- package/button/types.d.ts +0 -57
- package/button/types.js +0 -5
- package/card/Card.d.ts +0 -4
- package/card/Card.js +0 -120
- package/card/Card.stories.tsx +0 -171
- package/card/Card.test.js +0 -39
- package/card/types.d.ts +0 -62
- package/card/types.js +0 -5
- package/checkbox/Checkbox.d.ts +0 -4
- package/checkbox/Checkbox.js +0 -215
- package/checkbox/Checkbox.stories.tsx +0 -222
- package/checkbox/Checkbox.test.js +0 -199
- package/checkbox/types.d.ts +0 -72
- package/checkbox/types.js +0 -5
- package/chip/Chip.d.ts +0 -4
- package/chip/Chip.js +0 -121
- package/chip/Chip.stories.tsx +0 -214
- package/chip/Chip.test.js +0 -41
- package/chip/types.d.ts +0 -45
- package/chip/types.js +0 -5
- package/common/OpenSans.css +0 -69
- package/common/coreTokens.d.ts +0 -237
- package/common/coreTokens.js +0 -184
- package/common/fonts/OpenSans-Bold.ttf +0 -0
- package/common/fonts/OpenSans-BoldItalic.ttf +0 -0
- package/common/fonts/OpenSans-ExtraBold.ttf +0 -0
- package/common/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
- package/common/fonts/OpenSans-Italic.ttf +0 -0
- package/common/fonts/OpenSans-Light.ttf +0 -0
- package/common/fonts/OpenSans-LightItalic.ttf +0 -0
- package/common/fonts/OpenSans-Regular.ttf +0 -0
- package/common/fonts/OpenSans-SemiBold.ttf +0 -0
- package/common/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
- package/common/utils.d.ts +0 -1
- package/common/utils.js +0 -16
- package/common/variables.d.ts +0 -1395
- package/common/variables.js +0 -1267
- package/container/Container.d.ts +0 -4
- package/container/Container.js +0 -194
- package/container/Container.stories.tsx +0 -214
- package/container/types.d.ts +0 -74
- package/container/types.js +0 -5
- package/date-input/Calendar.d.ts +0 -4
- package/date-input/Calendar.js +0 -214
- package/date-input/DateInput.d.ts +0 -4
- package/date-input/DateInput.js +0 -223
- package/date-input/DateInput.stories.tsx +0 -285
- package/date-input/DateInput.test.js +0 -808
- package/date-input/DatePicker.d.ts +0 -4
- package/date-input/DatePicker.js +0 -115
- package/date-input/Icons.d.ts +0 -6
- package/date-input/Icons.js +0 -58
- package/date-input/YearPicker.d.ts +0 -4
- package/date-input/YearPicker.js +0 -100
- package/date-input/types.d.ts +0 -164
- package/date-input/types.js +0 -5
- package/dialog/Dialog.d.ts +0 -4
- package/dialog/Dialog.js +0 -104
- package/dialog/Dialog.stories.tsx +0 -365
- package/dialog/Dialog.test.js +0 -307
- package/dialog/types.d.ts +0 -36
- package/dialog/types.js +0 -5
- package/dropdown/Dropdown.d.ts +0 -4
- package/dropdown/Dropdown.js +0 -336
- package/dropdown/Dropdown.stories.tsx +0 -438
- package/dropdown/Dropdown.test.js +0 -599
- package/dropdown/DropdownMenu.d.ts +0 -4
- package/dropdown/DropdownMenu.js +0 -63
- package/dropdown/DropdownMenuItem.d.ts +0 -4
- package/dropdown/DropdownMenuItem.js +0 -67
- package/dropdown/types.d.ts +0 -98
- package/dropdown/types.js +0 -5
- package/file-input/FileInput.d.ts +0 -4
- package/file-input/FileInput.js +0 -479
- package/file-input/FileInput.stories.tsx +0 -618
- package/file-input/FileInput.test.js +0 -459
- package/file-input/FileItem.d.ts +0 -4
- package/file-input/FileItem.js +0 -135
- package/file-input/types.d.ts +0 -129
- package/file-input/types.js +0 -5
- package/flex/Flex.d.ts +0 -4
- package/flex/Flex.js +0 -57
- package/flex/Flex.stories.tsx +0 -112
- package/flex/types.d.ts +0 -97
- package/flex/types.js +0 -5
- package/footer/Footer.d.ts +0 -4
- package/footer/Footer.js +0 -138
- package/footer/Footer.stories.tsx +0 -171
- package/footer/Footer.test.js +0 -85
- package/footer/Icons.d.ts +0 -3
- package/footer/Icons.js +0 -136
- package/footer/types.d.ts +0 -64
- package/footer/types.js +0 -5
- package/grid/Grid.d.ts +0 -7
- package/grid/Grid.js +0 -76
- package/grid/Grid.stories.tsx +0 -219
- package/grid/types.d.ts +0 -115
- package/grid/types.js +0 -5
- package/header/Header.d.ts +0 -8
- package/header/Header.js +0 -220
- package/header/Header.stories.tsx +0 -251
- package/header/Header.test.js +0 -66
- package/header/Icons.d.ts +0 -2
- package/header/Icons.js +0 -29
- package/header/types.d.ts +0 -33
- package/header/types.js +0 -5
- package/heading/Heading.d.ts +0 -4
- package/heading/Heading.js +0 -137
- package/heading/Heading.stories.tsx +0 -54
- package/heading/Heading.test.js +0 -169
- package/heading/types.d.ts +0 -33
- package/heading/types.js +0 -5
- package/image/Image.d.ts +0 -4
- package/image/Image.js +0 -70
- package/image/Image.stories.tsx +0 -129
- package/image/types.d.ts +0 -72
- package/image/types.js +0 -5
- package/inset/Inset.d.ts +0 -3
- package/inset/Inset.js +0 -43
- package/inset/Inset.stories.tsx +0 -230
- package/inset/types.d.ts +0 -37
- package/inset/types.js +0 -5
- package/layout/ApplicationLayout.d.ts +0 -20
- package/layout/ApplicationLayout.js +0 -134
- package/layout/ApplicationLayout.stories.tsx +0 -162
- package/layout/Icons.d.ts +0 -8
- package/layout/Icons.js +0 -58
- package/layout/SidenavContext.d.ts +0 -5
- package/layout/SidenavContext.js +0 -13
- package/layout/types.d.ts +0 -41
- package/layout/types.js +0 -5
- package/link/Link.d.ts +0 -4
- package/link/Link.js +0 -115
- package/link/Link.stories.tsx +0 -253
- package/link/Link.test.js +0 -63
- package/link/types.d.ts +0 -54
- package/link/types.js +0 -5
- package/main.d.ts +0 -47
- package/main.js +0 -343
- package/nav-tabs/NavTabs.d.ts +0 -8
- package/nav-tabs/NavTabs.js +0 -93
- package/nav-tabs/NavTabs.stories.tsx +0 -276
- package/nav-tabs/NavTabs.test.js +0 -76
- package/nav-tabs/Tab.d.ts +0 -4
- package/nav-tabs/Tab.js +0 -118
- package/nav-tabs/types.d.ts +0 -52
- package/nav-tabs/types.js +0 -5
- package/number-input/NumberInput.d.ts +0 -11
- package/number-input/NumberInput.js +0 -86
- package/number-input/NumberInput.stories.tsx +0 -131
- package/number-input/NumberInput.test.js +0 -989
- package/number-input/types.d.ts +0 -130
- package/number-input/types.js +0 -5
- package/paginator/Icons.d.ts +0 -5
- package/paginator/Icons.js +0 -40
- package/paginator/Paginator.d.ts +0 -4
- package/paginator/Paginator.js +0 -135
- package/paginator/Paginator.stories.tsx +0 -87
- package/paginator/Paginator.test.js +0 -335
- package/paginator/types.d.ts +0 -38
- package/paginator/types.js +0 -5
- package/paragraph/Paragraph.d.ts +0 -5
- package/paragraph/Paragraph.js +0 -22
- package/paragraph/Paragraph.stories.tsx +0 -27
- package/password-input/Icons.d.ts +0 -6
- package/password-input/Icons.js +0 -35
- package/password-input/PasswordInput.d.ts +0 -4
- package/password-input/PasswordInput.js +0 -97
- package/password-input/PasswordInput.stories.tsx +0 -99
- package/password-input/PasswordInput.test.js +0 -198
- package/password-input/types.d.ts +0 -111
- package/password-input/types.js +0 -5
- package/progress-bar/ProgressBar.d.ts +0 -4
- package/progress-bar/ProgressBar.js +0 -144
- package/progress-bar/ProgressBar.stories.tsx +0 -93
- package/progress-bar/ProgressBar.test.js +0 -93
- package/progress-bar/types.d.ts +0 -37
- package/progress-bar/types.js +0 -5
- package/quick-nav/QuickNav.d.ts +0 -4
- package/quick-nav/QuickNav.js +0 -94
- package/quick-nav/QuickNav.stories.tsx +0 -356
- package/quick-nav/types.d.ts +0 -21
- package/quick-nav/types.js +0 -5
- package/radio-group/Radio.d.ts +0 -4
- package/radio-group/Radio.js +0 -124
- package/radio-group/RadioGroup.d.ts +0 -4
- package/radio-group/RadioGroup.js +0 -235
- package/radio-group/RadioGroup.stories.tsx +0 -214
- package/radio-group/RadioGroup.test.js +0 -756
- package/radio-group/types.d.ts +0 -114
- package/radio-group/types.js +0 -5
- package/resultset-table/Icons.d.ts +0 -7
- package/resultset-table/Icons.js +0 -47
- package/resultset-table/ResultsetTable.d.ts +0 -7
- package/resultset-table/ResultsetTable.js +0 -166
- package/resultset-table/ResultsetTable.stories.tsx +0 -397
- package/resultset-table/ResultsetTable.test.js +0 -371
- package/resultset-table/types.d.ts +0 -73
- package/resultset-table/types.js +0 -5
- package/select/Icons.d.ts +0 -10
- package/select/Icons.js +0 -89
- package/select/Listbox.d.ts +0 -4
- package/select/Listbox.js +0 -143
- package/select/Option.d.ts +0 -4
- package/select/Option.js +0 -87
- package/select/Select.d.ts +0 -4
- package/select/Select.js +0 -590
- package/select/Select.stories.tsx +0 -971
- package/select/Select.test.js +0 -2370
- package/select/types.d.ts +0 -209
- package/select/types.js +0 -5
- package/sidenav/Icons.d.ts +0 -7
- package/sidenav/Icons.js +0 -47
- package/sidenav/Sidenav.d.ts +0 -10
- package/sidenav/Sidenav.js +0 -196
- package/sidenav/Sidenav.stories.tsx +0 -282
- package/sidenav/Sidenav.test.js +0 -37
- package/sidenav/types.d.ts +0 -76
- package/sidenav/types.js +0 -5
- package/slider/Slider.d.ts +0 -4
- package/slider/Slider.js +0 -285
- package/slider/Slider.test.js +0 -254
- package/slider/types.d.ts +0 -86
- package/slider/types.js +0 -5
- package/spinner/Spinner.d.ts +0 -4
- package/spinner/Spinner.js +0 -206
- package/spinner/Spinner.stories.tsx +0 -129
- package/spinner/Spinner.test.js +0 -55
- package/spinner/types.d.ts +0 -32
- package/spinner/types.js +0 -5
- package/status-light/StatusLight.d.ts +0 -4
- package/status-light/StatusLight.js +0 -51
- package/status-light/StatusLight.stories.tsx +0 -74
- package/status-light/StatusLight.test.js +0 -25
- package/status-light/types.d.ts +0 -17
- package/status-light/types.js +0 -5
- package/switch/Switch.d.ts +0 -4
- package/switch/Switch.js +0 -214
- package/switch/Switch.stories.tsx +0 -137
- package/switch/Switch.test.js +0 -180
- package/switch/types.d.ts +0 -66
- package/switch/types.js +0 -5
- package/table/DropdownTheme.js +0 -62
- package/table/Table.d.ts +0 -8
- package/table/Table.js +0 -170
- package/table/Table.stories.tsx +0 -658
- package/table/Table.test.js +0 -113
- package/table/types.d.ts +0 -63
- package/table/types.js +0 -5
- package/tabs/Tab.d.ts +0 -4
- package/tabs/Tab.js +0 -116
- package/tabs/Tabs.d.ts +0 -4
- package/tabs/Tabs.js +0 -384
- package/tabs/Tabs.stories.tsx +0 -226
- package/tabs/Tabs.test.js +0 -294
- package/tabs/types.d.ts +0 -92
- package/tabs/types.js +0 -5
- package/tag/Tag.d.ts +0 -4
- package/tag/Tag.js +0 -151
- package/tag/Tag.stories.tsx +0 -155
- package/tag/Tag.test.js +0 -49
- package/tag/types.d.ts +0 -69
- package/tag/types.js +0 -5
- package/text-input/Icons.d.ts +0 -8
- package/text-input/Icons.js +0 -56
- package/text-input/Suggestion.d.ts +0 -4
- package/text-input/Suggestion.js +0 -67
- package/text-input/Suggestions.d.ts +0 -4
- package/text-input/Suggestions.js +0 -84
- package/text-input/TextInput.d.ts +0 -4
- package/text-input/TextInput.js +0 -565
- package/text-input/TextInput.stories.tsx +0 -465
- package/text-input/TextInput.test.js +0 -1756
- package/text-input/types.d.ts +0 -205
- package/text-input/types.js +0 -5
- package/textarea/Textarea.d.ts +0 -4
- package/textarea/Textarea.js +0 -234
- package/textarea/Textarea.stories.tsx +0 -174
- package/textarea/Textarea.test.js +0 -406
- package/textarea/types.d.ts +0 -141
- package/textarea/types.js +0 -5
- package/toggle-group/ToggleGroup.d.ts +0 -4
- package/toggle-group/ToggleGroup.js +0 -201
- package/toggle-group/ToggleGroup.stories.tsx +0 -218
- package/toggle-group/ToggleGroup.test.js +0 -137
- package/toggle-group/types.d.ts +0 -114
- package/toggle-group/types.js +0 -5
- package/typography/Typography.d.ts +0 -4
- package/typography/Typography.js +0 -23
- package/typography/Typography.stories.tsx +0 -198
- package/typography/types.d.ts +0 -18
- package/typography/types.js +0 -5
- package/useTheme.d.ts +0 -1148
- package/useTheme.js +0 -15
- package/useTranslatedLabels.d.ts +0 -85
- package/useTranslatedLabels.js +0 -14
- package/utils/BaseTypography.d.ts +0 -21
- package/utils/BaseTypography.js +0 -94
- package/utils/FocusLock.d.ts +0 -13
- package/utils/FocusLock.js +0 -124
- package/wizard/Wizard.d.ts +0 -4
- package/wizard/Wizard.js +0 -250
- package/wizard/Wizard.stories.tsx +0 -253
- package/wizard/Wizard.test.js +0 -114
- package/wizard/types.d.ts +0 -64
- package/wizard/types.js +0 -5
package/select/Listbox.js
DELETED
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = void 0;
|
|
9
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
10
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
12
|
-
var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
|
|
13
|
-
var _Option = _interopRequireDefault(require("./Option"));
|
|
14
|
-
var _Icons = _interopRequireDefault(require("./Icons"));
|
|
15
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
16
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
17
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
18
|
-
var groupsHaveOptions = function groupsHaveOptions(options) {
|
|
19
|
-
return options !== null && options !== void 0 && options[0].options ? options.some(function (groupOption) {
|
|
20
|
-
var _groupOption$options;
|
|
21
|
-
return ((_groupOption$options = groupOption.options) === null || _groupOption$options === void 0 ? void 0 : _groupOption$options.length) > 0;
|
|
22
|
-
}) : true;
|
|
23
|
-
};
|
|
24
|
-
var Listbox = function Listbox(_ref) {
|
|
25
|
-
var id = _ref.id,
|
|
26
|
-
currentValue = _ref.currentValue,
|
|
27
|
-
options = _ref.options,
|
|
28
|
-
visualFocusIndex = _ref.visualFocusIndex,
|
|
29
|
-
lastOptionIndex = _ref.lastOptionIndex,
|
|
30
|
-
multiple = _ref.multiple,
|
|
31
|
-
optional = _ref.optional,
|
|
32
|
-
optionalItem = _ref.optionalItem,
|
|
33
|
-
searchable = _ref.searchable,
|
|
34
|
-
handleOptionOnClick = _ref.handleOptionOnClick,
|
|
35
|
-
styles = _ref.styles;
|
|
36
|
-
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
37
|
-
var listboxRef = (0, _react.useRef)(null);
|
|
38
|
-
var globalIndex = optional && !multiple ? 0 : -1;
|
|
39
|
-
var mapOptionFunc = function mapOptionFunc(option, mapIndex) {
|
|
40
|
-
if (option.options) {
|
|
41
|
-
var groupId = "group-".concat(mapIndex);
|
|
42
|
-
return option.options.length > 0 && /*#__PURE__*/_react["default"].createElement("li", {
|
|
43
|
-
key: "group-".concat(mapIndex)
|
|
44
|
-
}, /*#__PURE__*/_react["default"].createElement(GroupList, {
|
|
45
|
-
role: "group",
|
|
46
|
-
"aria-labelledby": groupId
|
|
47
|
-
}, /*#__PURE__*/_react["default"].createElement(GroupLabel, {
|
|
48
|
-
role: "presentation",
|
|
49
|
-
id: groupId
|
|
50
|
-
}, option.label), option.options.map(function (singleOption) {
|
|
51
|
-
globalIndex++;
|
|
52
|
-
return /*#__PURE__*/_react["default"].createElement(_Option["default"], {
|
|
53
|
-
key: "option-".concat(singleOption.value),
|
|
54
|
-
id: "option-".concat(globalIndex),
|
|
55
|
-
option: singleOption,
|
|
56
|
-
onClick: handleOptionOnClick,
|
|
57
|
-
multiple: multiple,
|
|
58
|
-
visualFocused: visualFocusIndex === globalIndex,
|
|
59
|
-
isGroupedOption: true,
|
|
60
|
-
isLastOption: lastOptionIndex === globalIndex,
|
|
61
|
-
isSelected: multiple ? currentValue.includes(singleOption.value) : currentValue === singleOption.value
|
|
62
|
-
});
|
|
63
|
-
})));
|
|
64
|
-
} else {
|
|
65
|
-
globalIndex++;
|
|
66
|
-
return /*#__PURE__*/_react["default"].createElement(_Option["default"], {
|
|
67
|
-
key: "option-".concat(option.value),
|
|
68
|
-
id: "option-".concat(globalIndex),
|
|
69
|
-
option: option,
|
|
70
|
-
onClick: handleOptionOnClick,
|
|
71
|
-
multiple: multiple,
|
|
72
|
-
visualFocused: visualFocusIndex === globalIndex,
|
|
73
|
-
isLastOption: lastOptionIndex === globalIndex,
|
|
74
|
-
isSelected: multiple ? currentValue.includes(option.value) : currentValue === option.value
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
(0, _react.useLayoutEffect)(function () {
|
|
79
|
-
if (currentValue && !multiple) {
|
|
80
|
-
var _listEl$scrollTo;
|
|
81
|
-
var listEl = listboxRef === null || listboxRef === void 0 ? void 0 : listboxRef.current;
|
|
82
|
-
var selectedListOptionEl = listEl === null || listEl === void 0 ? void 0 : listEl.querySelector("[aria-selected='true']");
|
|
83
|
-
listEl === null || listEl === void 0 ? void 0 : (_listEl$scrollTo = listEl.scrollTo) === null || _listEl$scrollTo === void 0 ? void 0 : _listEl$scrollTo.call(listEl, {
|
|
84
|
-
top: (selectedListOptionEl === null || selectedListOptionEl === void 0 ? void 0 : selectedListOptionEl.offsetTop) - (listEl === null || listEl === void 0 ? void 0 : listEl.clientHeight) / 2
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
}, [currentValue, multiple]);
|
|
88
|
-
(0, _react.useLayoutEffect)(function () {
|
|
89
|
-
var _listboxRef$current, _visualFocusedOptionE;
|
|
90
|
-
var visualFocusedOptionEl = listboxRef === null || listboxRef === void 0 ? void 0 : (_listboxRef$current = listboxRef.current) === null || _listboxRef$current === void 0 ? void 0 : _listboxRef$current.querySelectorAll("[role='option']")[visualFocusIndex];
|
|
91
|
-
visualFocusedOptionEl === null || visualFocusedOptionEl === void 0 ? void 0 : (_visualFocusedOptionE = visualFocusedOptionEl.scrollIntoView) === null || _visualFocusedOptionE === void 0 ? void 0 : _visualFocusedOptionE.call(visualFocusedOptionEl, {
|
|
92
|
-
block: "nearest",
|
|
93
|
-
inline: "start"
|
|
94
|
-
});
|
|
95
|
-
}, [visualFocusIndex]);
|
|
96
|
-
return /*#__PURE__*/_react["default"].createElement(ListboxContainer, {
|
|
97
|
-
id: id,
|
|
98
|
-
onClick: function onClick(event) {
|
|
99
|
-
event.stopPropagation();
|
|
100
|
-
},
|
|
101
|
-
onMouseDown: function onMouseDown(event) {
|
|
102
|
-
event.preventDefault();
|
|
103
|
-
},
|
|
104
|
-
ref: listboxRef,
|
|
105
|
-
role: "listbox",
|
|
106
|
-
"aria-multiselectable": multiple,
|
|
107
|
-
style: styles
|
|
108
|
-
}, searchable && (options.length === 0 || !groupsHaveOptions(options)) ? /*#__PURE__*/_react["default"].createElement(OptionsSystemMessage, null, /*#__PURE__*/_react["default"].createElement(NoMatchesFoundIcon, null, _Icons["default"].searchOff), translatedLabels.select.noMatchesErrorMessage) : optional && !multiple && /*#__PURE__*/_react["default"].createElement(_Option["default"], {
|
|
109
|
-
key: "option-".concat(optionalItem.value),
|
|
110
|
-
id: "option-".concat(0),
|
|
111
|
-
option: optionalItem,
|
|
112
|
-
onClick: handleOptionOnClick,
|
|
113
|
-
multiple: multiple,
|
|
114
|
-
visualFocused: visualFocusIndex === 0,
|
|
115
|
-
isGroupedOption: false,
|
|
116
|
-
isLastOption: lastOptionIndex === 0,
|
|
117
|
-
isSelected: multiple ? currentValue.includes(optionalItem.value) : currentValue === optionalItem.value
|
|
118
|
-
}), options.map(mapOptionFunc));
|
|
119
|
-
};
|
|
120
|
-
var ListboxContainer = _styledComponents["default"].ul(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n max-height: 304px;\n overflow-y: auto;\n margin: 0;\n padding: 0.25rem 0;\n background-color: ", ";\n border: 1px solid ", ";\n border-radius: 0.25rem;\n box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);\n cursor: default;\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n"])), function (props) {
|
|
121
|
-
return props.theme.listDialogBackgroundColor;
|
|
122
|
-
}, function (props) {
|
|
123
|
-
return props.theme.listDialogBorderColor;
|
|
124
|
-
}, function (props) {
|
|
125
|
-
return props.theme.listOptionFontColor;
|
|
126
|
-
}, function (props) {
|
|
127
|
-
return props.theme.fontFamily;
|
|
128
|
-
}, function (props) {
|
|
129
|
-
return props.theme.listOptionFontSize;
|
|
130
|
-
}, function (props) {
|
|
131
|
-
return props.theme.listOptionFontStyle;
|
|
132
|
-
}, function (props) {
|
|
133
|
-
return props.theme.listOptionFontWeight;
|
|
134
|
-
});
|
|
135
|
-
var OptionsSystemMessage = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n padding: 4px 16px;\n color: ", ";\n font-size: 0.875rem;\n line-height: 1.715em;\n"])), function (props) {
|
|
136
|
-
return props.theme.systemMessageFontColor;
|
|
137
|
-
});
|
|
138
|
-
var NoMatchesFoundIcon = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 16px;\n width: 16px;\n padding: 4px;\n margin-right: 0.25rem;\n"])));
|
|
139
|
-
var GroupList = _styledComponents["default"].ul(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n padding: 0;\n"])));
|
|
140
|
-
var GroupLabel = _styledComponents["default"].li(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n padding: 4px 16px;\n font-weight: ", ";\n line-height: 1.715em;\n"])), function (props) {
|
|
141
|
-
return props.theme.listGroupLabelFontWeight;
|
|
142
|
-
});
|
|
143
|
-
var _default = exports["default"] = /*#__PURE__*/_react["default"].memo(Listbox);
|
package/select/Option.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { OptionProps } from "../select/types";
|
|
3
|
-
declare const _default: React.MemoExoticComponent<({ id, option, onClick, multiple, visualFocused, isGroupedOption, isLastOption, isSelected, }: OptionProps) => JSX.Element>;
|
|
4
|
-
export default _default;
|
package/select/Option.js
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports["default"] = void 0;
|
|
8
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
|
-
var _react = _interopRequireDefault(require("react"));
|
|
10
|
-
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
11
|
-
var _Checkbox = _interopRequireDefault(require("../checkbox/Checkbox"));
|
|
12
|
-
var _Icons = _interopRequireDefault(require("./Icons"));
|
|
13
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
14
|
-
var Option = function Option(_ref) {
|
|
15
|
-
var id = _ref.id,
|
|
16
|
-
option = _ref.option,
|
|
17
|
-
_onClick = _ref.onClick,
|
|
18
|
-
multiple = _ref.multiple,
|
|
19
|
-
visualFocused = _ref.visualFocused,
|
|
20
|
-
_ref$isGroupedOption = _ref.isGroupedOption,
|
|
21
|
-
isGroupedOption = _ref$isGroupedOption === void 0 ? false : _ref$isGroupedOption,
|
|
22
|
-
isLastOption = _ref.isLastOption,
|
|
23
|
-
isSelected = _ref.isSelected;
|
|
24
|
-
var handleOnMouseEnter = function handleOnMouseEnter(event) {
|
|
25
|
-
var label = event.currentTarget;
|
|
26
|
-
var optionElement = document.getElementById(id);
|
|
27
|
-
if (optionElement.title === "" && label.scrollWidth > label.clientWidth) optionElement.title = option.label;
|
|
28
|
-
};
|
|
29
|
-
return /*#__PURE__*/_react["default"].createElement(OptionItem, {
|
|
30
|
-
id: id,
|
|
31
|
-
onClick: function onClick() {
|
|
32
|
-
_onClick(option);
|
|
33
|
-
},
|
|
34
|
-
visualFocused: visualFocused,
|
|
35
|
-
selected: isSelected,
|
|
36
|
-
role: "option",
|
|
37
|
-
"aria-selected": isSelected
|
|
38
|
-
}, /*#__PURE__*/_react["default"].createElement(StyledOption, {
|
|
39
|
-
visualFocused: visualFocused,
|
|
40
|
-
selected: isSelected,
|
|
41
|
-
last: isLastOption,
|
|
42
|
-
grouped: isGroupedOption,
|
|
43
|
-
multiple: multiple
|
|
44
|
-
}, multiple && /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
45
|
-
checked: isSelected,
|
|
46
|
-
tabIndex: -1
|
|
47
|
-
}), option.icon && /*#__PURE__*/_react["default"].createElement(OptionIcon, {
|
|
48
|
-
grouped: isGroupedOption,
|
|
49
|
-
multiple: multiple,
|
|
50
|
-
role: !(typeof option.icon === "string") ? "img" : undefined
|
|
51
|
-
}, typeof option.icon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
|
|
52
|
-
src: option.icon
|
|
53
|
-
}) : option.icon), /*#__PURE__*/_react["default"].createElement(OptionContent, {
|
|
54
|
-
grouped: isGroupedOption,
|
|
55
|
-
hasIcon: option.icon ? true : false,
|
|
56
|
-
multiple: multiple
|
|
57
|
-
}, /*#__PURE__*/_react["default"].createElement(OptionLabel, {
|
|
58
|
-
onMouseEnter: handleOnMouseEnter
|
|
59
|
-
}, option.label), !multiple && isSelected && /*#__PURE__*/_react["default"].createElement(OptionSelectedIndicator, null, _Icons["default"].selected))));
|
|
60
|
-
};
|
|
61
|
-
var OptionItem = _styledComponents["default"].li(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n padding: 0 0.5rem;\n box-shadow: inset 0 0 0 2px transparent;\n ", "\n ", ";\n line-height: 1.715em;\n cursor: pointer;\n\n &:hover {\n ", ";\n }\n &:active {\n ", ";\n }\n"])), function (props) {
|
|
62
|
-
return props.visualFocused && "box-shadow: inset 0 0 0 2px ".concat(props.theme.focusListOptionBorderColor, ";");
|
|
63
|
-
}, function (props) {
|
|
64
|
-
return props.selected && "background-color: ".concat(props.theme.selectedListOptionBackgroundColor);
|
|
65
|
-
}, function (props) {
|
|
66
|
-
return props.selected ? "background-color: ".concat(props.theme.selectedHoverListOptionBackgroundColor, ";") : "background-color: ".concat(props.theme.unselectedHoverListOptionBackgroundColor, ";");
|
|
67
|
-
}, function (props) {
|
|
68
|
-
return props.selected ? "background-color: ".concat(props.theme.selectedActiveListOptionBackgroundColor, ";") : "background-color: ".concat(props.theme.unselectedActiveListOptionBackgroundColor, ";");
|
|
69
|
-
});
|
|
70
|
-
var StyledOption = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n padding: 0.25rem 0.5rem 0.188rem 0;\n min-height: 24px;\n ", "\n ", ";\n"])), function (props) {
|
|
71
|
-
return props.grouped && props.multiple && "padding-left: 16px;";
|
|
72
|
-
}, function (props) {
|
|
73
|
-
return props.last || props.visualFocused || props.selected ? "border-bottom: 1px solid transparent" : "border-bottom: 1px solid ".concat(props.theme.listOptionDividerColor);
|
|
74
|
-
});
|
|
75
|
-
var OptionIcon = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n padding: 0.125rem;\n margin-left: ", ";\n color: ", ";\n\n svg,\n img {\n height: 20px;\n width: 20px;\n }\n"])), function (props) {
|
|
76
|
-
return props.grouped && !props.multiple ? "16px" : "8px";
|
|
77
|
-
}, function (props) {
|
|
78
|
-
return props.theme.listOptionIconColor;
|
|
79
|
-
});
|
|
80
|
-
var OptionContent = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n justify-content: space-between;\n gap: 0.25rem;\n width: 100%;\n overflow: hidden;\n margin-left: ", ";\n"])), function (props) {
|
|
81
|
-
return props.grouped && !props.multiple && !props.hasIcon ? "16px" : "8px";
|
|
82
|
-
});
|
|
83
|
-
var OptionLabel = _styledComponents["default"].span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n"])));
|
|
84
|
-
var OptionSelectedIndicator = _styledComponents["default"].span(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n color: ", ";\n\n svg {\n width: 16px;\n height: 16px;\n }\n"])), function (props) {
|
|
85
|
-
return props.theme.selectedListOptionIconColor;
|
|
86
|
-
});
|
|
87
|
-
var _default = exports["default"] = /*#__PURE__*/_react["default"].memo(Option);
|
package/select/Select.d.ts
DELETED