@dreamcommerce/aurora 3.0.0-79 → 3.0.0-80
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/build/cjs/packages/aurora/src/components/accordion/components/accordion_trigger.js +1 -3
- package/build/cjs/packages/aurora/src/components/accordion/components/accordion_trigger.js.map +1 -1
- package/build/cjs/packages/aurora/src/components/checkbox/checkbox.js +1 -1
- package/build/cjs/packages/aurora/src/components/controls/multiselect_control/multiselect_control.js +50 -0
- package/build/cjs/packages/aurora/src/components/controls/multiselect_control/multiselect_control.js.map +1 -0
- package/build/cjs/packages/aurora/src/components/divider/divider.js +2 -2
- package/build/cjs/packages/aurora/src/components/multiselect/components/multiselect_content.js +94 -0
- package/build/cjs/packages/aurora/src/components/multiselect/components/multiselect_content.js.map +1 -0
- package/build/cjs/packages/aurora/src/components/multiselect/components/multiselect_group.js +40 -0
- package/build/cjs/packages/aurora/src/components/multiselect/components/multiselect_group.js.map +1 -0
- package/build/cjs/packages/aurora/src/components/multiselect/components/multiselect_group_label.js +40 -0
- package/build/cjs/packages/aurora/src/components/multiselect/components/multiselect_group_label.js.map +1 -0
- package/build/cjs/packages/aurora/src/components/multiselect/components/multiselect_item.js +47 -0
- package/build/cjs/packages/aurora/src/components/multiselect/components/multiselect_item.js.map +1 -0
- package/build/cjs/packages/aurora/src/components/multiselect/components/multiselect_trigger.js +36 -0
- package/build/cjs/packages/aurora/src/components/multiselect/components/multiselect_trigger.js.map +1 -0
- package/build/cjs/packages/aurora/src/components/multiselect/multiselect.js +81 -0
- package/build/cjs/packages/aurora/src/components/multiselect/multiselect.js.map +1 -0
- package/build/cjs/packages/aurora/src/index.js +4 -0
- package/build/cjs/packages/aurora/src/index.js.map +1 -1
- package/build/esm/packages/aurora/src/components/accordion/components/accordion_trigger.js +1 -3
- package/build/esm/packages/aurora/src/components/accordion/components/accordion_trigger.js.map +1 -1
- package/build/esm/packages/aurora/src/components/action_list/components/action_list_radio_item.d.ts +1 -1
- package/build/esm/packages/aurora/src/components/checkbox/checkbox.js +1 -1
- package/build/esm/packages/aurora/src/components/controls/multiselect_control/multiselect_control.d.ts +3 -0
- package/build/esm/packages/aurora/src/components/controls/multiselect_control/multiselect_control.js +42 -0
- package/build/esm/packages/aurora/src/components/controls/multiselect_control/multiselect_control.js.map +1 -0
- package/build/esm/packages/aurora/src/components/controls/multiselect_control/multiselect_control_types.d.ts +9 -0
- package/build/esm/packages/aurora/src/components/controls/multiselect_control/multiselect_control_types.js +3 -0
- package/build/esm/packages/aurora/src/components/controls/multiselect_control/multiselect_control_types.js.map +1 -0
- package/build/esm/packages/aurora/src/components/divider/divider.js +2 -2
- package/build/esm/packages/aurora/src/components/multiselect/components/multiselect_content.d.ts +3 -0
- package/build/esm/packages/aurora/src/components/multiselect/components/multiselect_content.js +86 -0
- package/build/esm/packages/aurora/src/components/multiselect/components/multiselect_content.js.map +1 -0
- package/build/esm/packages/aurora/src/components/multiselect/components/multiselect_group.d.ts +3 -0
- package/build/esm/packages/aurora/src/components/multiselect/components/multiselect_group.js +32 -0
- package/build/esm/packages/aurora/src/components/multiselect/components/multiselect_group.js.map +1 -0
- package/build/esm/packages/aurora/src/components/multiselect/components/multiselect_group_label.d.ts +6 -0
- package/build/esm/packages/aurora/src/components/multiselect/components/multiselect_group_label.js +32 -0
- package/build/esm/packages/aurora/src/components/multiselect/components/multiselect_group_label.js.map +1 -0
- package/build/esm/packages/aurora/src/components/multiselect/components/multiselect_item.d.ts +3 -0
- package/build/esm/packages/aurora/src/components/multiselect/components/multiselect_item.js +39 -0
- package/build/esm/packages/aurora/src/components/multiselect/components/multiselect_item.js.map +1 -0
- package/build/esm/packages/aurora/src/components/multiselect/components/multiselect_trigger.d.ts +3 -0
- package/build/esm/packages/aurora/src/components/multiselect/components/multiselect_trigger.js +28 -0
- package/build/esm/packages/aurora/src/components/multiselect/components/multiselect_trigger.js.map +1 -0
- package/build/esm/packages/aurora/src/components/multiselect/multiselect.d.ts +3 -0
- package/build/esm/packages/aurora/src/components/multiselect/multiselect.js +73 -0
- package/build/esm/packages/aurora/src/components/multiselect/multiselect.js.map +1 -0
- package/build/esm/packages/aurora/src/components/multiselect/multiselect_types.d.ts +45 -0
- package/build/esm/packages/aurora/src/components/multiselect/multiselect_types.js +3 -0
- package/build/esm/packages/aurora/src/components/multiselect/multiselect_types.js.map +1 -0
- package/build/esm/packages/aurora/src/index.d.ts +3 -1
- package/build/esm/packages/aurora/src/index.js +2 -0
- package/build/esm/packages/aurora/src/index.js.map +1 -1
- package/build/index.css +1 -1
- package/package.json +1 -1
package/build/esm/packages/aurora/src/components/multiselect/components/multiselect_content.js
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, objectSpread2 as _objectSpread2 } from '../../../../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
3
|
+
import { cn } from '../../../utilities/cn.js';
|
|
4
|
+
import { Content } from '@radix-ui/react-dropdown-menu';
|
|
5
|
+
import { Input } from '../../input/input.js';
|
|
6
|
+
import { SearchLineIcon } from '../../../assets/icons/search_icon.js';
|
|
7
|
+
import { MultiSelectItem } from './multiselect_item.js';
|
|
8
|
+
import { MultiSelectGroup } from './multiselect_group.js';
|
|
9
|
+
|
|
10
|
+
var _excluded = ["options", "isGrouped", "selectedOptions", "toggleOption", "triggerWidth", "hasSearch", "searchPlaceholder", "className"];
|
|
11
|
+
var MultiSelectContent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
12
|
+
var options = _ref.options,
|
|
13
|
+
isGrouped = _ref.isGrouped,
|
|
14
|
+
selectedOptions = _ref.selectedOptions,
|
|
15
|
+
toggleOption = _ref.toggleOption,
|
|
16
|
+
triggerWidth = _ref.triggerWidth,
|
|
17
|
+
hasSearch = _ref.hasSearch,
|
|
18
|
+
searchPlaceholder = _ref.searchPlaceholder,
|
|
19
|
+
className = _ref.className,
|
|
20
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
21
|
+
var _React$useState = React.useState(''),
|
|
22
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
23
|
+
searchTerm = _React$useState2[0],
|
|
24
|
+
setSearchTerm = _React$useState2[1];
|
|
25
|
+
var filteredOptions = React.useMemo(function () {
|
|
26
|
+
var lowercasedSearchTerm = searchTerm.toLowerCase();
|
|
27
|
+
if (isGrouped) {
|
|
28
|
+
return options.map(function (group) {
|
|
29
|
+
return _objectSpread2(_objectSpread2({}, group), {}, {
|
|
30
|
+
options: group.options.filter(function (option) {
|
|
31
|
+
return option.label.toLowerCase().includes(lowercasedSearchTerm);
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
} else {
|
|
36
|
+
return options.filter(function (option) {
|
|
37
|
+
return option.label.toLowerCase().includes(lowercasedSearchTerm);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}, [options, searchTerm, isGrouped]);
|
|
41
|
+
return /*#__PURE__*/React.createElement(Content, _objectSpread2(_objectSpread2({
|
|
42
|
+
className: cn("aurora-z-50 aurora-bg aurora-flex aurora-flex-col aurora-gap-1 aurora-mt-1 aurora-overflow-hidden aurora-rounded-8 aurora-border aurora-p-3 aurora-shadow-m data-[state=open]:aurora-animate-in data-[state=closed]:aurora-animate-out data-[state=closed]:aurora-fade-out-0 data-[state=open]:aurora-fade-in-0 data-[state=closed]:aurora-zoom-out-95 data-[state=open]:aurora-zoom-in-95 data-[side=bottom]:aurora-slide-in-from-top-2 data-[side=left]:aurora-slide-in-from-right-2 data-[side=right]:aurora-slide-in-from-left-2 data-[side=top]:aurora-slide-in-from-bottom-2", className)
|
|
43
|
+
}, props), {}, {
|
|
44
|
+
ref: ref,
|
|
45
|
+
style: {
|
|
46
|
+
width: "".concat(triggerWidth, "px")
|
|
47
|
+
}
|
|
48
|
+
}), hasSearch && (/*#__PURE__*/React.createElement("div", {
|
|
49
|
+
className: "aurora-p-2"
|
|
50
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
51
|
+
type: "text",
|
|
52
|
+
preElement: /*#__PURE__*/React.createElement(SearchLineIcon, {
|
|
53
|
+
className: "aurora-h-4 aurora-w-4 aurora-text-inverse-subtle-light"
|
|
54
|
+
}),
|
|
55
|
+
value: searchTerm,
|
|
56
|
+
tabIndex: 0,
|
|
57
|
+
onChange: function onChange(e) {
|
|
58
|
+
e.stopPropagation();
|
|
59
|
+
setSearchTerm(e.target.value);
|
|
60
|
+
},
|
|
61
|
+
onKeyDown: function onKeyDown(e) {
|
|
62
|
+
e.stopPropagation();
|
|
63
|
+
},
|
|
64
|
+
placeholder: searchPlaceholder
|
|
65
|
+
}))), isGrouped ? filteredOptions.map(function (group) {
|
|
66
|
+
return /*#__PURE__*/React.createElement(MultiSelectGroup, {
|
|
67
|
+
key: group.label,
|
|
68
|
+
group: group,
|
|
69
|
+
selectedOptions: selectedOptions,
|
|
70
|
+
toggleOption: toggleOption
|
|
71
|
+
});
|
|
72
|
+
}) : filteredOptions.map(function (option) {
|
|
73
|
+
return /*#__PURE__*/React.createElement(MultiSelectItem, {
|
|
74
|
+
key: option.value,
|
|
75
|
+
option: option,
|
|
76
|
+
isSelected: selectedOptions.some(function (selected) {
|
|
77
|
+
return selected.value === option.value;
|
|
78
|
+
}),
|
|
79
|
+
toggleOption: toggleOption
|
|
80
|
+
});
|
|
81
|
+
}));
|
|
82
|
+
});
|
|
83
|
+
MultiSelectContent.displayName = 'MultiSelectContent';
|
|
84
|
+
|
|
85
|
+
export { MultiSelectContent };
|
|
86
|
+
//# sourceMappingURL=multiselect_content.js.map
|
package/build/esm/packages/aurora/src/components/multiselect/components/multiselect_content.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../../../../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
3
|
+
import { cn } from '../../../utilities/cn.js';
|
|
4
|
+
import { Group } from '@radix-ui/react-dropdown-menu';
|
|
5
|
+
import { MultiSelectGroupLabel } from './multiselect_group_label.js';
|
|
6
|
+
import { MultiSelectItem } from './multiselect_item.js';
|
|
7
|
+
|
|
8
|
+
var _excluded = ["group", "selectedOptions", "toggleOption", "className"];
|
|
9
|
+
var MultiSelectGroup = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
10
|
+
var group = _ref.group,
|
|
11
|
+
selectedOptions = _ref.selectedOptions,
|
|
12
|
+
toggleOption = _ref.toggleOption,
|
|
13
|
+
className = _ref.className,
|
|
14
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
15
|
+
return /*#__PURE__*/React.createElement(Group, _objectSpread2({
|
|
16
|
+
ref: ref,
|
|
17
|
+
className: cn('aurora-flex aurora-flex-col aurora-gap-1', className)
|
|
18
|
+
}, props), /*#__PURE__*/React.createElement(MultiSelectGroupLabel, null, group.label), group.options.map(function (option) {
|
|
19
|
+
return /*#__PURE__*/React.createElement(MultiSelectItem, {
|
|
20
|
+
key: option.value,
|
|
21
|
+
option: option,
|
|
22
|
+
isSelected: selectedOptions.some(function (selected) {
|
|
23
|
+
return selected.value === option.value;
|
|
24
|
+
}),
|
|
25
|
+
toggleOption: toggleOption
|
|
26
|
+
});
|
|
27
|
+
}));
|
|
28
|
+
});
|
|
29
|
+
MultiSelectGroup.displayName = 'MultiSelectGroup';
|
|
30
|
+
|
|
31
|
+
export { MultiSelectGroup };
|
|
32
|
+
//# sourceMappingURL=multiselect_group.js.map
|
package/build/esm/packages/aurora/src/components/multiselect/components/multiselect_group.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
package/build/esm/packages/aurora/src/components/multiselect/components/multiselect_group_label.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../../../../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
3
|
+
import { Stack } from '../../stack/stack.js';
|
|
4
|
+
import { Box } from '../../box/box.js';
|
|
5
|
+
import { Typography } from '../../typography/typography.js';
|
|
6
|
+
import { Divider } from '../../divider/divider.js';
|
|
7
|
+
|
|
8
|
+
var _excluded = ["children"];
|
|
9
|
+
var MultiSelectGroupLabel = function MultiSelectGroupLabel(_ref) {
|
|
10
|
+
var children = _ref.children,
|
|
11
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
12
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
13
|
+
paddings: {
|
|
14
|
+
pl: '2',
|
|
15
|
+
pt: '2',
|
|
16
|
+
pb: '2',
|
|
17
|
+
pr: '0'
|
|
18
|
+
}
|
|
19
|
+
}, /*#__PURE__*/React.createElement(Stack, {
|
|
20
|
+
align: "center",
|
|
21
|
+
spacing: "2.5"
|
|
22
|
+
}, /*#__PURE__*/React.createElement(Typography, {
|
|
23
|
+
className: "aurora-whitespace-nowrap",
|
|
24
|
+
size: "s",
|
|
25
|
+
color: "subtle",
|
|
26
|
+
weight: "bold"
|
|
27
|
+
}, children), /*#__PURE__*/React.createElement(Divider, _objectSpread2({}, props))));
|
|
28
|
+
};
|
|
29
|
+
MultiSelectGroupLabel.displayName = 'MultiSelectGroupLabel';
|
|
30
|
+
|
|
31
|
+
export { MultiSelectGroupLabel };
|
|
32
|
+
//# sourceMappingURL=multiselect_group_label.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../../../../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
3
|
+
import { cn } from '../../../utilities/cn.js';
|
|
4
|
+
import { Item } from '@radix-ui/react-dropdown-menu';
|
|
5
|
+
import { Box } from '../../box/box.js';
|
|
6
|
+
import { Typography } from '../../typography/typography.js';
|
|
7
|
+
import { Checkbox } from '../../checkbox/checkbox.js';
|
|
8
|
+
|
|
9
|
+
var _excluded = ["option", "isSelected", "toggleOption", "className"];
|
|
10
|
+
var MultiSelectItem = /*#__PURE__*/React.forwardRef(function (_ref) {
|
|
11
|
+
var option = _ref.option,
|
|
12
|
+
isSelected = _ref.isSelected,
|
|
13
|
+
toggleOption = _ref.toggleOption,
|
|
14
|
+
className = _ref.className,
|
|
15
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
16
|
+
var handleSelect = function handleSelect(event) {
|
|
17
|
+
event.preventDefault();
|
|
18
|
+
toggleOption(option);
|
|
19
|
+
};
|
|
20
|
+
return /*#__PURE__*/React.createElement(Item, _objectSpread2({
|
|
21
|
+
onSelect: handleSelect,
|
|
22
|
+
className: cn('aurora-relative aurora-flex aurora-w-full aurora-select-none aurora-rounded-sm aurora-p-2 aurora-outline-none focus:aurora-bg-accent data-[disabled]:aurora-pointer-events-none data-[disabled]:aurora-opacity-50 data-[state=checked]:aurora-font-semibold data-[highlighted]:aurora-font-semibold data-[highlighted]:aurora-bg-hover aurora-cursor-pointer aurora-rounded-6', {
|
|
23
|
+
'aurora-bg-hover': isSelected
|
|
24
|
+
}, className)
|
|
25
|
+
}, props), /*#__PURE__*/React.createElement(Box, {
|
|
26
|
+
align: "center",
|
|
27
|
+
spacing: "2",
|
|
28
|
+
backgroundColor: "transparent"
|
|
29
|
+
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
30
|
+
checked: isSelected
|
|
31
|
+
}), /*#__PURE__*/React.createElement(Typography, {
|
|
32
|
+
size: "s",
|
|
33
|
+
weight: "medium"
|
|
34
|
+
}, option.label)));
|
|
35
|
+
});
|
|
36
|
+
MultiSelectItem.displayName = 'MultiSelectItem';
|
|
37
|
+
|
|
38
|
+
export { MultiSelectItem };
|
|
39
|
+
//# sourceMappingURL=multiselect_item.js.map
|
package/build/esm/packages/aurora/src/components/multiselect/components/multiselect_item.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
package/build/esm/packages/aurora/src/components/multiselect/components/multiselect_trigger.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../../../../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
3
|
+
import { cn } from '../../../utilities/cn.js';
|
|
4
|
+
import { Trigger } from '@radix-ui/react-dropdown-menu';
|
|
5
|
+
|
|
6
|
+
var _excluded = ["selectedOptions", "placeholder", "hasErrors", "className"];
|
|
7
|
+
var MultiSelectTrigger = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
8
|
+
var selectedOptions = _ref.selectedOptions,
|
|
9
|
+
placeholder = _ref.placeholder,
|
|
10
|
+
hasErrors = _ref.hasErrors,
|
|
11
|
+
className = _ref.className,
|
|
12
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
13
|
+
return /*#__PURE__*/React.createElement(Trigger, _objectSpread2(_objectSpread2({
|
|
14
|
+
asChild: true
|
|
15
|
+
}, props), {}, {
|
|
16
|
+
ref: ref
|
|
17
|
+
}), /*#__PURE__*/React.createElement("button", {
|
|
18
|
+
className: cn('aurora-flex aurora-h-10 aurora-w-full aurora-items-center aurora-justify-between aurora-rounded-8 aurora-border aurora-border-input aurora-bg-neutral-0 aurora-px-3 aurora-py-2 aurora-text-s hover:aurora-border-strong focus:focus disabled:aurora-cursor-not-allowed disabled:aurora-bg-subtle disabled:aurora-text-subtle-light disabled:aurora-border-subtle [&>span]:aurora-line-clamp-1 focus:aurora-border-active focus:aurora-border-2 active:aurora-border-active active:aurora-border-2', {
|
|
19
|
+
'!aurora-border-danger aurora-border-2': hasErrors
|
|
20
|
+
}, className)
|
|
21
|
+
}, selectedOptions.length > 0 ? selectedOptions.map(function (option) {
|
|
22
|
+
return option.label;
|
|
23
|
+
}).join(', ') : placeholder !== null && placeholder !== void 0 ? placeholder : ''));
|
|
24
|
+
});
|
|
25
|
+
MultiSelectTrigger.displayName = 'MultiSelectTrigger';
|
|
26
|
+
|
|
27
|
+
export { MultiSelectTrigger };
|
|
28
|
+
//# sourceMappingURL=multiselect_trigger.js.map
|
package/build/esm/packages/aurora/src/components/multiselect/components/multiselect_trigger.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import React, { useRef, useEffect } from 'react';
|
|
2
|
+
import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, objectSpread2 as _objectSpread2, toConsumableArray as _toConsumableArray } from '../../../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
3
|
+
import { Root, Portal } from '@radix-ui/react-dropdown-menu';
|
|
4
|
+
import { MultiSelectContent } from './components/multiselect_content.js';
|
|
5
|
+
import { MultiSelectTrigger } from './components/multiselect_trigger.js';
|
|
6
|
+
|
|
7
|
+
var _excluded = ["id", "options", "isGrouped", "placeholder", "disabled", "hasSearch", "searchPlaceholder", "hasErrors", "onValueChange"];
|
|
8
|
+
var MultiSelect = /*#__PURE__*/React.forwardRef(function (_ref) {
|
|
9
|
+
var id = _ref.id,
|
|
10
|
+
options = _ref.options,
|
|
11
|
+
_ref$isGrouped = _ref.isGrouped,
|
|
12
|
+
isGrouped = _ref$isGrouped === void 0 ? false : _ref$isGrouped,
|
|
13
|
+
placeholder = _ref.placeholder,
|
|
14
|
+
disabled = _ref.disabled,
|
|
15
|
+
hasSearch = _ref.hasSearch,
|
|
16
|
+
searchPlaceholder = _ref.searchPlaceholder,
|
|
17
|
+
hasErrors = _ref.hasErrors,
|
|
18
|
+
onValueChange = _ref.onValueChange,
|
|
19
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
20
|
+
var _React$useState = React.useState([]),
|
|
21
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
22
|
+
selectedOptions = _React$useState2[0],
|
|
23
|
+
setSelectedOptions = _React$useState2[1];
|
|
24
|
+
var _React$useState3 = React.useState(0),
|
|
25
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
26
|
+
triggerWidth = _React$useState4[0],
|
|
27
|
+
settriggerWidth = _React$useState4[1];
|
|
28
|
+
var triggerRef = useRef(null);
|
|
29
|
+
useEffect(function () {
|
|
30
|
+
if (triggerRef.current) settriggerWidth(triggerRef.current.offsetWidth);
|
|
31
|
+
var handleResize = function handleResize() {
|
|
32
|
+
if (triggerRef.current) {
|
|
33
|
+
settriggerWidth(triggerRef.current.offsetWidth);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
window.addEventListener('resize', handleResize);
|
|
37
|
+
return function () {
|
|
38
|
+
window.removeEventListener('resize', handleResize);
|
|
39
|
+
};
|
|
40
|
+
}, []);
|
|
41
|
+
useEffect(function () {
|
|
42
|
+
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(selectedOptions);
|
|
43
|
+
}, [selectedOptions]);
|
|
44
|
+
var toggleOption = function toggleOption(option) {
|
|
45
|
+
setSelectedOptions(function (prev) {
|
|
46
|
+
return prev.some(function (selected) {
|
|
47
|
+
return selected.value === option.value;
|
|
48
|
+
}) ? prev.filter(function (selected) {
|
|
49
|
+
return selected.value !== option.value;
|
|
50
|
+
}) : [].concat(_toConsumableArray(prev), [option]);
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
return /*#__PURE__*/React.createElement(Root, _objectSpread2({}, props), /*#__PURE__*/React.createElement(MultiSelectTrigger, {
|
|
54
|
+
id: id,
|
|
55
|
+
selectedOptions: selectedOptions,
|
|
56
|
+
placeholder: placeholder,
|
|
57
|
+
disabled: disabled,
|
|
58
|
+
ref: triggerRef,
|
|
59
|
+
hasErrors: hasErrors
|
|
60
|
+
}), /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(MultiSelectContent, {
|
|
61
|
+
options: options,
|
|
62
|
+
isGrouped: isGrouped,
|
|
63
|
+
selectedOptions: selectedOptions,
|
|
64
|
+
toggleOption: toggleOption,
|
|
65
|
+
triggerWidth: triggerWidth,
|
|
66
|
+
hasSearch: hasSearch,
|
|
67
|
+
searchPlaceholder: searchPlaceholder
|
|
68
|
+
})));
|
|
69
|
+
});
|
|
70
|
+
MultiSelect.displayName = 'MultiSelect';
|
|
71
|
+
|
|
72
|
+
export { MultiSelect };
|
|
73
|
+
//# sourceMappingURL=multiselect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export declare type Option = {
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
};
|
|
7
|
+
export declare type OptionGroup = {
|
|
8
|
+
label: string;
|
|
9
|
+
options: Option[];
|
|
10
|
+
};
|
|
11
|
+
export interface TMultiSelectProps extends React.ComponentPropsWithoutRef<typeof DropdownMenu.Root> {
|
|
12
|
+
id?: string;
|
|
13
|
+
options: Option[] | OptionGroup[];
|
|
14
|
+
isGrouped?: boolean;
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
hasSearch?: boolean;
|
|
18
|
+
searchPlaceholder?: string;
|
|
19
|
+
hasErrors?: boolean;
|
|
20
|
+
onValueChange?: (selectedOption: Option[]) => void;
|
|
21
|
+
}
|
|
22
|
+
export interface TMultiSelectTriggerProps extends React.ComponentPropsWithoutRef<typeof DropdownMenu.Trigger> {
|
|
23
|
+
selectedOptions: Option[];
|
|
24
|
+
placeholder?: string;
|
|
25
|
+
hasErrors?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface TMultiSelectContentProps extends React.ComponentPropsWithoutRef<typeof DropdownMenu.Content> {
|
|
28
|
+
options: Option[] | OptionGroup[];
|
|
29
|
+
isGrouped?: boolean;
|
|
30
|
+
selectedOptions: Option[];
|
|
31
|
+
toggleOption: (option: Option) => void;
|
|
32
|
+
triggerWidth?: number;
|
|
33
|
+
hasSearch?: boolean;
|
|
34
|
+
searchPlaceholder?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface TMultiSelectGroupProps extends React.ComponentPropsWithoutRef<typeof DropdownMenu.Group> {
|
|
37
|
+
group: OptionGroup;
|
|
38
|
+
selectedOptions: Option[];
|
|
39
|
+
toggleOption: (option: Option) => void;
|
|
40
|
+
}
|
|
41
|
+
export interface TMultiSelectItemProps extends React.ComponentPropsWithoutRef<typeof DropdownMenu.Item> {
|
|
42
|
+
option: Option;
|
|
43
|
+
isSelected: boolean;
|
|
44
|
+
toggleOption: (option: Option) => void;
|
|
45
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multiselect_types.js","sourceRoot":"","sources":["../../../../../../../src/components/multiselect/multiselect_types.ts"],"names":[],"mappings":"AAAA,OAA8B,+BAA+B,CAAC;AAE9D,OAAkB,OAAO,CAAC"}
|
|
@@ -95,7 +95,9 @@ export { CheckboxControl } from './components/controls/checkbox_control/checkbox
|
|
|
95
95
|
export { Select } from "./components/select/select";
|
|
96
96
|
export { SelectControl } from './components/controls/select_control/select_control';
|
|
97
97
|
export { RadioGroup } from "./components/radio_group/radio_group";
|
|
98
|
-
export { RadioGroupControl } from
|
|
98
|
+
export { RadioGroupControl } from './components/controls/radio_group_control/radio_group_control';
|
|
99
|
+
export { MultiSelect } from "./components/multiselect/multiselect";
|
|
100
|
+
export { MultiSelectControl } from './components/controls/multiselect_control/multiselect_control';
|
|
99
101
|
export { TextArea } from "./components/text_area/text_area";
|
|
100
102
|
export { TextAreaControl } from "./components/controls/text_area_control/text_area_control";
|
|
101
103
|
export { ControlsGroup } from "./components/controls/controls_group/controls_group";
|
|
@@ -92,6 +92,8 @@ export { Select } from './components/select/select.js';
|
|
|
92
92
|
export { SelectControl } from './components/controls/select_control/select_control.js';
|
|
93
93
|
export { RadioGroup } from './components/radio_group/radio_group.js';
|
|
94
94
|
export { RadioGroupControl } from './components/controls/radio_group_control/radio_group_control.js';
|
|
95
|
+
export { MultiSelect } from './components/multiselect/multiselect.js';
|
|
96
|
+
export { MultiSelectControl } from './components/controls/multiselect_control/multiselect_control.js';
|
|
95
97
|
export { TextArea } from './components/text_area/text_area.js';
|
|
96
98
|
export { TextAreaControl } from './components/controls/text_area_control/text_area_control.js';
|
|
97
99
|
export { ControlsGroup } from './components/controls/controls_group/controls_group.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|