@tecsinapse/cortex-react 1.3.0-beta.9 → 1.3.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/dist/cjs/components/Badge.js +22 -3
- package/dist/cjs/components/{Breadcrumbs.js → Breadcrumbs/Breadcrumbs.js} +1 -1
- package/dist/cjs/components/Button.js +1 -1
- package/dist/cjs/components/{Calendar.js → Calendar/Calendar.js} +1 -1
- package/dist/cjs/components/{CalendarCell.js → Calendar/CalendarCell.js} +5 -5
- package/dist/cjs/components/{CalendarGrid.js → Calendar/CalendarGrid.js} +1 -1
- package/dist/cjs/components/{CalendarGridHeaderRow.js → Calendar/CalendarGridHeaderRow.js} +1 -1
- package/dist/cjs/components/{CalendarHeader.js → Calendar/CalendarHeader.js} +1 -1
- package/dist/cjs/components/{RangeCalendar.js → Calendar/RangeCalendar.js} +1 -1
- package/dist/cjs/components/DatePicker/Content.js +21 -0
- package/dist/cjs/components/DatePicker/DatePickerInput.js +52 -0
- package/dist/cjs/components/{DatePickerInputBase.js → DatePicker/DatePickerInputBase.js} +3 -5
- package/dist/cjs/components/{DateRangePickerInput.js → DatePicker/DateRangePickerInput.js} +14 -12
- package/dist/cjs/components/Drawer.js +1 -1
- package/dist/cjs/components/Hint.js +5 -15
- package/dist/cjs/components/Input/Mask.js +33 -0
- package/dist/cjs/components/Input/Search.js +11 -3
- package/dist/cjs/components/Input/index.js +3 -1
- package/dist/cjs/components/Input/masks.js +43 -0
- package/dist/cjs/components/Menubar/Dropdown.js +1 -1
- package/dist/cjs/components/Menubar/Header.js +4 -5
- package/dist/cjs/components/Menubar/Item.js +1 -1
- package/dist/cjs/components/Menubar/MostUsedList.js +14 -5
- package/dist/cjs/components/Modal.js +1 -1
- package/dist/cjs/components/Popover/Content.js +2 -2
- package/dist/cjs/components/Popover/Root.js +2 -2
- package/dist/cjs/components/Popover/Trigger.js +2 -2
- package/dist/cjs/components/RadioButton.js +22 -0
- package/dist/cjs/components/Select/Content.js +4 -10
- package/dist/cjs/components/Select/GroupedOptions.js +13 -5
- package/dist/cjs/components/Select/MultiCheckAllOptions.js +47 -0
- package/dist/cjs/components/Select/MultiGroupedOptions.js +51 -0
- package/dist/cjs/components/Select/MultiOption.js +43 -0
- package/dist/cjs/components/Select/MultiOptions.js +33 -0
- package/dist/cjs/components/Select/Option.js +4 -2
- package/dist/cjs/components/Select/Options.js +13 -4
- package/dist/cjs/components/Select/Popover.js +1 -1
- package/dist/cjs/components/Select/Root.js +3 -10
- package/dist/cjs/components/Select/SkeletonOptions.js +11 -0
- package/dist/cjs/components/Select/Trigger.js +14 -8
- package/dist/cjs/components/Select/context.js +4 -0
- package/dist/cjs/components/Select/index.js +9 -1
- package/dist/cjs/components/Select/utils.js +16 -0
- package/dist/cjs/components/Skeleton.js +1 -5
- package/dist/cjs/components/Tag.js +2 -9
- package/dist/cjs/components/TextArea/Box.js +47 -0
- package/dist/cjs/components/TextArea/Face.js +27 -0
- package/dist/cjs/components/TextArea/Left.js +10 -0
- package/dist/cjs/components/TextArea/Right.js +10 -0
- package/dist/cjs/components/TextArea/Root.js +11 -0
- package/dist/cjs/components/TextArea/index.js +17 -0
- package/dist/cjs/components/TextArea/utils.js +11 -0
- package/dist/cjs/components/{TimeField.js → TimeField/TimeField.js} +3 -3
- package/dist/cjs/components/{TimeFieldInput.js → TimeField/TimeFieldInput.js} +3 -3
- package/dist/cjs/components/Tooltip.js +3 -2
- package/dist/cjs/components/utils.js +5 -0
- package/dist/cjs/hooks/useSelectGroupedOptions.js +35 -0
- package/dist/cjs/hooks/useSelectOptions.js +35 -0
- package/dist/cjs/index.js +42 -15
- package/dist/cjs/provider/MenubarProvider.js +1 -1
- package/dist/cjs/provider/SnackbarProvider.js +17 -47
- package/dist/cjs/service/SnackbarSonner.js +14 -5
- package/dist/cjs/styles/menubar.js +11 -3
- package/dist/esm/components/Avatar.js +6 -6
- package/dist/esm/components/Badge.js +2 -1
- package/dist/esm/components/{BreadcrumbItem.js → Breadcrumbs/BreadcrumbItem.js} +4 -4
- package/dist/esm/components/{Breadcrumbs.js → Breadcrumbs/Breadcrumbs.js} +4 -4
- package/dist/esm/components/Button.js +2 -2
- package/dist/esm/components/{Calendar.js → Calendar/Calendar.js} +4 -4
- package/dist/esm/components/{CalendarCell.js → Calendar/CalendarCell.js} +8 -8
- package/dist/esm/components/Calendar/CalendarGrid.js +22 -0
- package/dist/esm/components/Calendar/CalendarGridBodyRows.js +10 -0
- package/dist/esm/components/Calendar/CalendarGridHeaderRow.js +10 -0
- package/dist/esm/components/{CalendarHeader.js → Calendar/CalendarHeader.js} +8 -8
- package/dist/esm/components/{RangeCalendar.js → Calendar/RangeCalendar.js} +5 -5
- package/dist/esm/components/Card.js +2 -2
- package/dist/esm/components/DatePicker/Content.js +19 -0
- package/dist/esm/components/{DateField.js → DatePicker/DateField.js} +3 -3
- package/dist/esm/components/DatePicker/DatePickerInput.js +50 -0
- package/dist/esm/components/DatePicker/DatePickerInputBase.js +20 -0
- package/dist/esm/components/DatePicker/DateRangePickerInput.js +63 -0
- package/dist/esm/components/{DateSegment.js → DatePicker/DateSegment.js} +3 -3
- package/dist/esm/components/Divider.js +2 -2
- package/dist/esm/components/Drawer.js +3 -3
- package/dist/esm/components/GroupButton.js +3 -3
- package/dist/esm/components/Hint.js +5 -15
- package/dist/esm/components/Input/Box.js +4 -4
- package/dist/esm/components/Input/Face.js +6 -6
- package/dist/esm/components/Input/Left.js +3 -3
- package/dist/esm/components/Input/Mask.js +31 -0
- package/dist/esm/components/Input/Right.js +3 -3
- package/dist/esm/components/Input/Root.js +3 -3
- package/dist/esm/components/Input/Search.js +13 -5
- package/dist/esm/components/Input/index.js +3 -1
- package/dist/esm/components/Input/masks.js +38 -0
- package/dist/esm/components/Masonry.js +6 -6
- package/dist/esm/components/Menubar/Categories.js +2 -2
- package/dist/esm/components/Menubar/Category.js +2 -2
- package/dist/esm/components/Menubar/Dropdown.js +3 -3
- package/dist/esm/components/Menubar/DropdownRoot.js +4 -4
- package/dist/esm/components/Menubar/Header.js +7 -8
- package/dist/esm/components/Menubar/IconControlSubItem.js +2 -2
- package/dist/esm/components/Menubar/Item.js +3 -3
- package/dist/esm/components/Menubar/ItemLink.js +2 -2
- package/dist/esm/components/Menubar/Left.js +2 -2
- package/dist/esm/components/Menubar/MostUsed.js +2 -2
- package/dist/esm/components/Menubar/MostUsedItem.js +4 -4
- package/dist/esm/components/Menubar/MostUsedList.js +18 -9
- package/dist/esm/components/Menubar/Right.js +2 -2
- package/dist/esm/components/Menubar/Root.js +2 -2
- package/dist/esm/components/Menubar/Search.js +2 -2
- package/dist/esm/components/Menubar/SubItem.js +2 -2
- package/dist/esm/components/Modal.js +3 -3
- package/dist/esm/components/Popover/Content.js +4 -4
- package/dist/esm/components/Popover/Provider.js +2 -2
- package/dist/esm/components/Popover/Root.js +3 -3
- package/dist/esm/components/Popover/Trigger.js +2 -2
- package/dist/esm/components/ProgressBar.js +4 -4
- package/dist/esm/components/RadioButton.js +20 -0
- package/dist/esm/components/Select/Content.js +5 -11
- package/dist/esm/components/Select/GroupedOptions.js +14 -6
- package/dist/esm/components/Select/MultiCheckAllOptions.js +45 -0
- package/dist/esm/components/Select/MultiGroupedOptions.js +49 -0
- package/dist/esm/components/Select/MultiOption.js +41 -0
- package/dist/esm/components/Select/MultiOptions.js +31 -0
- package/dist/esm/components/Select/Option.js +6 -4
- package/dist/esm/components/Select/Options.js +14 -5
- package/dist/esm/components/Select/Popover.js +2 -2
- package/dist/esm/components/Select/Root.js +4 -11
- package/dist/esm/components/Select/SkeletonOptions.js +9 -0
- package/dist/esm/components/Select/Trigger.js +17 -11
- package/dist/esm/components/Select/context.js +4 -1
- package/dist/esm/components/Select/index.js +9 -1
- package/dist/esm/components/Select/utils.js +14 -0
- package/dist/esm/components/Skeleton.js +3 -7
- package/dist/esm/components/Snackbar/BaseSnackbar.js +11 -0
- package/dist/esm/components/{DefaultSnack.js → Snackbar/DefaultSnack.js} +4 -4
- package/dist/esm/components/Table.js +9 -9
- package/dist/esm/components/Tag.js +2 -9
- package/dist/esm/components/TextArea/Box.js +45 -0
- package/dist/esm/components/TextArea/Face.js +25 -0
- package/dist/esm/components/TextArea/Left.js +8 -0
- package/dist/esm/components/TextArea/Right.js +8 -0
- package/dist/esm/components/TextArea/Root.js +9 -0
- package/dist/esm/components/TextArea/index.js +15 -0
- package/dist/esm/components/TextArea/utils.js +9 -0
- package/dist/esm/components/TimeField/TimeField.js +10 -0
- package/dist/esm/components/TimeField/TimeFieldInput.js +20 -0
- package/dist/esm/components/Toggle.js +4 -4
- package/dist/esm/components/Tooltip.js +5 -4
- package/dist/esm/components/utils.js +5 -1
- package/dist/esm/hooks/useSelectGroupedOptions.js +33 -0
- package/dist/esm/hooks/useSelectOptions.js +33 -0
- package/dist/esm/hooks/useTimeField.js +2 -2
- package/dist/esm/index.js +21 -10
- package/dist/esm/provider/MenubarProvider.js +4 -4
- package/dist/esm/provider/SnackbarProvider.js +17 -48
- package/dist/esm/service/SnackbarSonner.js +16 -7
- package/dist/esm/styles/menubar.js +11 -3
- package/dist/types/components/Avatar.d.ts +1 -2
- package/dist/types/components/Badge.d.ts +4 -5
- package/dist/types/components/{BreadcrumbItem.d.ts → Breadcrumbs/BreadcrumbItem.d.ts} +6 -1
- package/dist/types/components/{Breadcrumbs.d.ts → Breadcrumbs/Breadcrumbs.d.ts} +2 -6
- package/dist/types/components/Breadcrumbs/index.d.ts +2 -0
- package/dist/types/components/Button.d.ts +2 -3
- package/dist/types/components/{RangeCalendar.d.ts → Calendar/RangeCalendar.d.ts} +1 -2
- package/dist/types/components/Calendar/index.d.ts +2 -0
- package/dist/types/components/DatePicker/Content.d.ts +5 -0
- package/dist/types/components/{DatePickerInput.d.ts → DatePicker/DatePickerInput.d.ts} +1 -1
- package/dist/types/components/{DatePickerInputBase.d.ts → DatePicker/DatePickerInputBase.d.ts} +2 -3
- package/dist/types/components/{DateRangePickerInput.d.ts → DatePicker/DateRangePickerInput.d.ts} +2 -2
- package/dist/types/components/DatePicker/index.d.ts +5 -0
- package/dist/types/components/Drawer.d.ts +1 -2
- package/dist/types/components/Hint.d.ts +4 -11
- package/dist/types/components/Input/Mask.d.ts +3 -0
- package/dist/types/components/Input/index.d.ts +2 -0
- package/dist/types/components/Input/masks.d.ts +39 -0
- package/dist/types/components/Input/types.d.ts +11 -0
- package/dist/types/components/Popover/Provider.d.ts +1 -1
- package/dist/types/components/Popover/Trigger.d.ts +1 -1
- package/dist/types/components/Popover/index.d.ts +1 -1
- package/dist/types/components/RadioButton.d.ts +6 -0
- package/dist/types/components/Select/Content.d.ts +2 -9
- package/dist/types/components/Select/GroupedOptions.d.ts +1 -5
- package/dist/types/components/Select/MultiCheckAllOptions.d.ts +2 -0
- package/dist/types/components/Select/MultiGroupedOptions.d.ts +2 -0
- package/dist/types/components/Select/MultiOption.d.ts +2 -0
- package/dist/types/components/Select/MultiOptions.d.ts +2 -0
- package/dist/types/components/Select/Option.d.ts +2 -5
- package/dist/types/components/Select/Options.d.ts +1 -4
- package/dist/types/components/Select/Popover.d.ts +1 -4
- package/dist/types/components/Select/Root.d.ts +1 -7
- package/dist/types/components/Select/SkeletonOptions.d.ts +1 -0
- package/dist/types/components/Select/Trigger.d.ts +2 -5
- package/dist/types/components/Select/context.d.ts +6 -1
- package/dist/types/components/Select/index.d.ts +11 -6
- package/dist/types/components/Select/types.d.ts +51 -0
- package/dist/types/components/Select/utils.d.ts +1 -0
- package/dist/types/components/Skeleton.d.ts +6 -4
- package/dist/types/components/Snackbar/index.d.ts +2 -0
- package/dist/types/components/Tag.d.ts +1 -1
- package/dist/types/components/TextArea/Box.d.ts +3 -0
- package/dist/types/components/TextArea/Face.d.ts +3 -0
- package/dist/types/components/TextArea/Left.d.ts +3 -0
- package/dist/types/components/TextArea/Right.d.ts +3 -0
- package/dist/types/components/TextArea/Root.d.ts +3 -0
- package/dist/types/components/TextArea/index.d.ts +8 -0
- package/dist/types/components/TextArea/types.d.ts +15 -0
- package/dist/types/components/TextArea/utils.d.ts +2 -0
- package/dist/types/components/{TimeField.d.ts → TimeField/TimeField.d.ts} +1 -2
- package/dist/types/components/{TimeFieldInput.d.ts → TimeField/TimeFieldInput.d.ts} +1 -1
- package/dist/types/components/TimeField/index.d.ts +2 -0
- package/dist/types/components/Tooltip.d.ts +1 -1
- package/dist/types/components/index.d.ts +4 -6
- package/dist/types/components/utils.d.ts +2 -0
- package/dist/types/hooks/index.d.ts +3 -1
- package/dist/types/hooks/useSelectGroupedOptions.d.ts +9 -0
- package/dist/types/hooks/useSelectOptions.d.ts +9 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/styles/menubar.d.ts +47 -43
- package/dist/types/tests/Input/Mask.test.d.ts +1 -0
- package/dist/types/tests/RadioButton.test.d.ts +1 -0
- package/package.json +4 -3
- package/dist/cjs/components/DatePickerInput.js +0 -49
- package/dist/cjs/components/TextArea.js +0 -83
- package/dist/esm/components/BaseSnackbar.js +0 -11
- package/dist/esm/components/CalendarGrid.js +0 -22
- package/dist/esm/components/CalendarGridBodyRows.js +0 -10
- package/dist/esm/components/CalendarGridHeaderRow.js +0 -10
- package/dist/esm/components/DatePickerInput.js +0 -47
- package/dist/esm/components/DatePickerInputBase.js +0 -22
- package/dist/esm/components/DateRangePickerInput.js +0 -61
- package/dist/esm/components/TextArea.js +0 -81
- package/dist/esm/components/TimeField.js +0 -10
- package/dist/esm/components/TimeFieldInput.js +0 -20
- package/dist/types/components/SearchInput.d.ts +0 -0
- package/dist/types/components/TextArea.d.ts +0 -24
- package/dist/cjs/components/{BreadcrumbItem.js → Breadcrumbs/BreadcrumbItem.js} +0 -0
- package/dist/cjs/components/{CalendarGridBodyRows.js → Calendar/CalendarGridBodyRows.js} +0 -0
- package/dist/cjs/components/{DateField.js → DatePicker/DateField.js} +0 -0
- package/dist/cjs/components/{DateSegment.js → DatePicker/DateSegment.js} +0 -0
- package/dist/cjs/components/{BaseSnackbar.js → Snackbar/BaseSnackbar.js} +1 -1
- package/dist/cjs/components/{DefaultSnack.js → Snackbar/DefaultSnack.js} +1 -1
- package/dist/types/components/{Calendar.d.ts → Calendar/Calendar.d.ts} +0 -0
- package/dist/types/components/{CalendarCell.d.ts → Calendar/CalendarCell.d.ts} +0 -0
- package/dist/types/components/{CalendarGrid.d.ts → Calendar/CalendarGrid.d.ts} +0 -0
- package/dist/types/components/{CalendarGridBodyRows.d.ts → Calendar/CalendarGridBodyRows.d.ts} +0 -0
- package/dist/types/components/{CalendarGridHeaderRow.d.ts → Calendar/CalendarGridHeaderRow.d.ts} +0 -0
- package/dist/types/components/{CalendarHeader.d.ts → Calendar/CalendarHeader.d.ts} +0 -0
- package/dist/types/components/{DateField.d.ts → DatePicker/DateField.d.ts} +0 -0
- package/dist/types/components/{DateSegment.d.ts → DatePicker/DateSegment.d.ts} +0 -0
- package/dist/types/components/{BaseSnackbar.d.ts → Snackbar/BaseSnackbar.d.ts} +1 -1
- /package/dist/types/components/{DefaultSnack.d.ts → Snackbar/DefaultSnack.d.ts} +0 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var cortexCore = require('@tecsinapse/cortex-core');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
|
|
6
|
+
const { container, input, label: labelStyle } = cortexCore.radioButtonStyles();
|
|
7
|
+
const RadioButton = React.forwardRef(
|
|
8
|
+
({ label, reversed, id, ...rest }, ref) => {
|
|
9
|
+
return /* @__PURE__ */ React.createElement(
|
|
10
|
+
"div",
|
|
11
|
+
{
|
|
12
|
+
className: container({ reversed }),
|
|
13
|
+
ref,
|
|
14
|
+
"data-testid": "radio-button-container"
|
|
15
|
+
},
|
|
16
|
+
/* @__PURE__ */ React.createElement("input", { id, type: "radio", className: input(), ...rest }),
|
|
17
|
+
label ? /* @__PURE__ */ React.createElement("label", { htmlFor: id, className: labelStyle() }, label) : /* @__PURE__ */ React.createElement(React.Fragment, null)
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
exports.RadioButton = RadioButton;
|
|
@@ -4,24 +4,18 @@ var React = require('react');
|
|
|
4
4
|
require('@internationalized/date');
|
|
5
5
|
require('react-aria');
|
|
6
6
|
require('react-stately');
|
|
7
|
-
var useOutsideClickListener = require('../../hooks/useOutsideClickListener.js');
|
|
8
7
|
require('@floating-ui/react');
|
|
8
|
+
var useOutsideClickListener = require('../../hooks/useOutsideClickListener.js');
|
|
9
9
|
var Context = require('../Popover/Context.js');
|
|
10
|
-
var context = require('./context.js');
|
|
11
10
|
|
|
12
|
-
const Content = ({
|
|
13
|
-
children,
|
|
14
|
-
keyExtractor,
|
|
15
|
-
labelExtractor,
|
|
16
|
-
value
|
|
17
|
-
}) => {
|
|
11
|
+
const Content = ({ children }) => {
|
|
18
12
|
const { setIsOpen } = Context.usePopoverContext();
|
|
19
13
|
const ref = React.useRef(null);
|
|
20
14
|
useOutsideClickListener.useOutsideClickListener({
|
|
21
15
|
ref,
|
|
22
16
|
onClickOutside: () => setIsOpen(false)
|
|
23
17
|
});
|
|
24
|
-
return /* @__PURE__ */ React.createElement(
|
|
18
|
+
return /* @__PURE__ */ React.createElement("div", { className: "w-full relative", ref }, children);
|
|
25
19
|
};
|
|
26
20
|
|
|
27
|
-
|
|
21
|
+
exports.Content = Content;
|
|
@@ -2,11 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
var cortexCore = require('@tecsinapse/cortex-core');
|
|
4
4
|
var React = require('react');
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
require('@internationalized/date');
|
|
6
|
+
require('react-aria');
|
|
7
|
+
require('react-stately');
|
|
8
|
+
require('@floating-ui/react');
|
|
9
|
+
var useSelectGroupedOptions = require('../../hooks/useSelectGroupedOptions.js');
|
|
7
10
|
var Context = require('../Popover/Context.js');
|
|
11
|
+
var Option = require('./Option.js');
|
|
12
|
+
var SkeletonOptions = require('./SkeletonOptions.js');
|
|
13
|
+
var context = require('./context.js');
|
|
8
14
|
|
|
9
|
-
const { groupedTitle,
|
|
15
|
+
const { groupedTitle, list } = cortexCore.selectVariants();
|
|
10
16
|
const SelectGroupedOptions = ({
|
|
11
17
|
onSelect,
|
|
12
18
|
groupedLabelExtractor,
|
|
@@ -14,6 +20,7 @@ const SelectGroupedOptions = ({
|
|
|
14
20
|
}) => {
|
|
15
21
|
const { keyExtractor } = React.useContext(context.SelectContext);
|
|
16
22
|
const { setIsOpen } = Context.usePopoverContext();
|
|
23
|
+
const { options: _options, isLoading } = useSelectGroupedOptions.useSelectGroupedOptions({ options });
|
|
17
24
|
const handleSelect = React.useCallback(
|
|
18
25
|
(option) => {
|
|
19
26
|
onSelect(option);
|
|
@@ -21,9 +28,10 @@ const SelectGroupedOptions = ({
|
|
|
21
28
|
},
|
|
22
29
|
[onSelect]
|
|
23
30
|
);
|
|
24
|
-
return /* @__PURE__ */ React.createElement("ul", { role: "select", className:
|
|
25
|
-
|
|
31
|
+
return isLoading ? /* @__PURE__ */ React.createElement(SkeletonOptions.SkeletonOptions, null) : /* @__PURE__ */ React.createElement("ul", { role: "select", className: list() }, [..._options ?? []].map(([key, value]) => /* @__PURE__ */ React.createElement("div", { key }, /* @__PURE__ */ React.createElement("span", { className: groupedTitle() }, groupedLabelExtractor?.(key)), value.map((option) => /* @__PURE__ */ React.createElement(
|
|
32
|
+
Option.SelectOption,
|
|
26
33
|
{
|
|
34
|
+
grouped: true,
|
|
27
35
|
option,
|
|
28
36
|
key: keyExtractor(option),
|
|
29
37
|
onSelectOption: handleSelect
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var cortexCore = require('@tecsinapse/cortex-core');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var context = require('./context.js');
|
|
6
|
+
|
|
7
|
+
const SelectMultiCheckAllOptions = ({
|
|
8
|
+
checkAllLabel = "Select all"
|
|
9
|
+
}) => {
|
|
10
|
+
const { keyExtractor, value: currentValue = [] } = React.useContext(context.SelectContext);
|
|
11
|
+
const { options, onSelect } = React.useContext(context.SelectMultiOptionsContext);
|
|
12
|
+
const isChecked = React.useMemo(
|
|
13
|
+
() => (options ?? []).filter(
|
|
14
|
+
(it) => currentValue.find((value) => keyExtractor(value) === keyExtractor(it))
|
|
15
|
+
).length == (options ?? []).length,
|
|
16
|
+
[keyExtractor, currentValue, options]
|
|
17
|
+
);
|
|
18
|
+
const checkAll = React.useCallback(() => {
|
|
19
|
+
{
|
|
20
|
+
let updateSelected = [...currentValue];
|
|
21
|
+
if (!isChecked) {
|
|
22
|
+
updateSelected = [
|
|
23
|
+
.../* @__PURE__ */ new Set([...updateSelected, ...options ?? []])
|
|
24
|
+
];
|
|
25
|
+
} else {
|
|
26
|
+
const optionKeys = new Set(
|
|
27
|
+
options?.map((option2) => keyExtractor(option2))
|
|
28
|
+
);
|
|
29
|
+
updateSelected = updateSelected.filter(
|
|
30
|
+
(item) => !optionKeys.has(keyExtractor(item))
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
onSelect(updateSelected);
|
|
34
|
+
}
|
|
35
|
+
}, [options, onSelect]);
|
|
36
|
+
return options?.length ? /* @__PURE__ */ React.createElement("div", { className: cortexCore.option(), onClick: checkAll }, /* @__PURE__ */ React.createElement(
|
|
37
|
+
"input",
|
|
38
|
+
{
|
|
39
|
+
type: "checkbox",
|
|
40
|
+
className: cortexCore.checkbox(),
|
|
41
|
+
onChange: () => void 0,
|
|
42
|
+
checked: isChecked
|
|
43
|
+
}
|
|
44
|
+
), /* @__PURE__ */ React.createElement("span", null, checkAllLabel)) : /* @__PURE__ */ React.createElement(React.Fragment, null);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
exports.SelectMultiCheckAllOptions = SelectMultiCheckAllOptions;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var cortexCore = require('@tecsinapse/cortex-core');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
require('@internationalized/date');
|
|
6
|
+
require('react-aria');
|
|
7
|
+
require('react-stately');
|
|
8
|
+
require('@floating-ui/react');
|
|
9
|
+
var useSelectGroupedOptions = require('../../hooks/useSelectGroupedOptions.js');
|
|
10
|
+
var MultiOption = require('./MultiOption.js');
|
|
11
|
+
var SkeletonOptions = require('./SkeletonOptions.js');
|
|
12
|
+
var context = require('./context.js');
|
|
13
|
+
var utils = require('./utils.js');
|
|
14
|
+
|
|
15
|
+
const { groupedTitle, list } = cortexCore.selectVariants();
|
|
16
|
+
const SelectMultiGroupedOptions = ({
|
|
17
|
+
onSelect,
|
|
18
|
+
groupedLabelExtractor,
|
|
19
|
+
options,
|
|
20
|
+
children
|
|
21
|
+
}) => {
|
|
22
|
+
const { value: currentValue = [], keyExtractor } = React.useContext(context.SelectContext);
|
|
23
|
+
const { options: _options, isLoading } = useSelectGroupedOptions.useSelectGroupedOptions({ options });
|
|
24
|
+
const flattenMap = React.useMemo(
|
|
25
|
+
() => _options ? Array.from(_options?.values()).flatMap((value) => value) : [],
|
|
26
|
+
[options]
|
|
27
|
+
);
|
|
28
|
+
return /* @__PURE__ */ React.createElement(
|
|
29
|
+
context.SelectMultiOptionsContext.Provider,
|
|
30
|
+
{
|
|
31
|
+
value: { onSelect, options: flattenMap }
|
|
32
|
+
},
|
|
33
|
+
children,
|
|
34
|
+
isLoading ? /* @__PURE__ */ React.createElement(SkeletonOptions.SkeletonOptions, null) : /* @__PURE__ */ React.createElement("ul", { role: "select", className: list() }, [..._options ?? []].map(([key, value]) => /* @__PURE__ */ React.createElement("div", { key }, /* @__PURE__ */ React.createElement("span", { className: groupedTitle() }, groupedLabelExtractor?.(key)), value.map((option) => /* @__PURE__ */ React.createElement(
|
|
35
|
+
MultiOption.SelectMultiOption,
|
|
36
|
+
{
|
|
37
|
+
grouped: true,
|
|
38
|
+
option,
|
|
39
|
+
key: keyExtractor(option),
|
|
40
|
+
onSelectOption: (option2) => utils.handleSelectMulti(
|
|
41
|
+
option2,
|
|
42
|
+
currentValue,
|
|
43
|
+
onSelect,
|
|
44
|
+
keyExtractor
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
)))))
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
exports.SelectMultiGroupedOptions = SelectMultiGroupedOptions;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var cortexCore = require('@tecsinapse/cortex-core');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var context = require('./context.js');
|
|
6
|
+
|
|
7
|
+
const SelectMultiOption = ({
|
|
8
|
+
onSelectOption,
|
|
9
|
+
option,
|
|
10
|
+
grouped = false
|
|
11
|
+
}) => {
|
|
12
|
+
const { keyExtractor, labelExtractor, value } = React.useContext(context.SelectContext);
|
|
13
|
+
const inputRef = React.useRef(null);
|
|
14
|
+
const isChecked = React.useMemo(
|
|
15
|
+
() => value?.length > 0 && value.find((it) => keyExtractor(it) === keyExtractor(option)) !== void 0,
|
|
16
|
+
[value, option]
|
|
17
|
+
);
|
|
18
|
+
const onClickOption = React.useCallback(() => {
|
|
19
|
+
onSelectOption(option);
|
|
20
|
+
inputRef.current?.click();
|
|
21
|
+
}, [onSelectOption, inputRef]);
|
|
22
|
+
return /* @__PURE__ */ React.createElement(
|
|
23
|
+
"li",
|
|
24
|
+
{
|
|
25
|
+
onClick: onClickOption,
|
|
26
|
+
className: cortexCore.option({ grouped }),
|
|
27
|
+
role: "option"
|
|
28
|
+
},
|
|
29
|
+
/* @__PURE__ */ React.createElement(
|
|
30
|
+
"input",
|
|
31
|
+
{
|
|
32
|
+
type: "checkbox",
|
|
33
|
+
checked: isChecked,
|
|
34
|
+
className: cortexCore.checkbox({ className: "pointer-events-none" }),
|
|
35
|
+
onChange: () => false,
|
|
36
|
+
ref: inputRef
|
|
37
|
+
}
|
|
38
|
+
),
|
|
39
|
+
labelExtractor(option)
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
exports.SelectMultiOption = SelectMultiOption;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var cortexCore = require('@tecsinapse/cortex-core');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
require('@internationalized/date');
|
|
6
|
+
require('react-aria');
|
|
7
|
+
require('react-stately');
|
|
8
|
+
require('@floating-ui/react');
|
|
9
|
+
var useSelectOptions = require('../../hooks/useSelectOptions.js');
|
|
10
|
+
var MultiOption = require('./MultiOption.js');
|
|
11
|
+
var SkeletonOptions = require('./SkeletonOptions.js');
|
|
12
|
+
var context = require('./context.js');
|
|
13
|
+
var utils = require('./utils.js');
|
|
14
|
+
|
|
15
|
+
const { list } = cortexCore.selectVariants();
|
|
16
|
+
const SelectMultiOptions = ({
|
|
17
|
+
onSelect,
|
|
18
|
+
options,
|
|
19
|
+
children
|
|
20
|
+
}) => {
|
|
21
|
+
const { keyExtractor, value: currentValue = [] } = React.useContext(context.SelectContext);
|
|
22
|
+
const { options: _options, isLoading } = useSelectOptions.useSelectOptions({ options });
|
|
23
|
+
return /* @__PURE__ */ React.createElement(context.SelectMultiOptionsContext.Provider, { value: { onSelect, options: _options } }, isLoading ? /* @__PURE__ */ React.createElement(SkeletonOptions.SkeletonOptions, null) : /* @__PURE__ */ React.createElement("ul", { role: "select", className: list() }, children, _options?.map((option) => /* @__PURE__ */ React.createElement(
|
|
24
|
+
MultiOption.SelectMultiOption,
|
|
25
|
+
{
|
|
26
|
+
option,
|
|
27
|
+
key: keyExtractor(option),
|
|
28
|
+
onSelectOption: (option2) => utils.handleSelectMulti(option2, currentValue, onSelect, keyExtractor)
|
|
29
|
+
}
|
|
30
|
+
))));
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
exports.SelectMultiOptions = SelectMultiOptions;
|
|
@@ -6,7 +6,8 @@ var context = require('./context.js');
|
|
|
6
6
|
|
|
7
7
|
const SelectOption = ({
|
|
8
8
|
onSelectOption,
|
|
9
|
-
option
|
|
9
|
+
option,
|
|
10
|
+
grouped = false
|
|
10
11
|
}) => {
|
|
11
12
|
const { keyExtractor, labelExtractor, value } = React.useContext(context.SelectContext);
|
|
12
13
|
return /* @__PURE__ */ React.createElement(
|
|
@@ -14,7 +15,8 @@ const SelectOption = ({
|
|
|
14
15
|
{
|
|
15
16
|
onClick: () => onSelectOption(option),
|
|
16
17
|
className: cortexCore.option({
|
|
17
|
-
selected: value && keyExtractor(value) === keyExtractor(option)
|
|
18
|
+
selected: value && keyExtractor(value) === keyExtractor(option),
|
|
19
|
+
grouped
|
|
18
20
|
}),
|
|
19
21
|
role: "option"
|
|
20
22
|
},
|
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var cortexCore = require('@tecsinapse/cortex-core');
|
|
3
4
|
var React = require('react');
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
require('@internationalized/date');
|
|
6
|
+
require('react-aria');
|
|
7
|
+
require('react-stately');
|
|
8
|
+
require('@floating-ui/react');
|
|
9
|
+
var useSelectOptions = require('../../hooks/useSelectOptions.js');
|
|
6
10
|
var Context = require('../Popover/Context.js');
|
|
11
|
+
var Option = require('./Option.js');
|
|
12
|
+
var SkeletonOptions = require('./SkeletonOptions.js');
|
|
13
|
+
var context = require('./context.js');
|
|
7
14
|
|
|
15
|
+
const { list } = cortexCore.selectVariants();
|
|
8
16
|
const SelectOptions = ({
|
|
9
17
|
onSelect,
|
|
10
18
|
options
|
|
11
19
|
}) => {
|
|
12
20
|
const { keyExtractor } = React.useContext(context.SelectContext);
|
|
13
21
|
const { setIsOpen } = Context.usePopoverContext();
|
|
22
|
+
const { options: _options, isLoading } = useSelectOptions.useSelectOptions({ options });
|
|
14
23
|
const handleSelect = React.useCallback(
|
|
15
24
|
(option) => {
|
|
16
25
|
onSelect(option);
|
|
@@ -18,8 +27,8 @@ const SelectOptions = ({
|
|
|
18
27
|
},
|
|
19
28
|
[onSelect]
|
|
20
29
|
);
|
|
21
|
-
return /* @__PURE__ */ React.createElement("ul", { role: "select", className:
|
|
22
|
-
|
|
30
|
+
return isLoading ? /* @__PURE__ */ React.createElement(SkeletonOptions.SkeletonOptions, null) : /* @__PURE__ */ React.createElement("ul", { role: "select", className: list() }, _options?.map((option) => /* @__PURE__ */ React.createElement(
|
|
31
|
+
Option.SelectOption,
|
|
23
32
|
{
|
|
24
33
|
option,
|
|
25
34
|
key: keyExtractor(option),
|
|
@@ -4,7 +4,7 @@ var React = require('react');
|
|
|
4
4
|
var index = require('../Popover/index.js');
|
|
5
5
|
|
|
6
6
|
const SelectPopover = ({ children }) => {
|
|
7
|
-
return /* @__PURE__ */ React.createElement(index.Popover.Content, { className: "bg-white max-h-[30vh] w-full overflow-y-scroll gap-y-mili flex flex-col" }, children);
|
|
7
|
+
return /* @__PURE__ */ React.createElement(index.Popover.Content, { className: "bg-white max-h-[30vh] w-full overflow-y-scroll gap-y-mili flex flex-col p-0" }, children);
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
exports.SelectPopover = SelectPopover;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
|
-
var Content = require('./Content.js');
|
|
5
4
|
var index = require('../Popover/index.js');
|
|
5
|
+
var Content = require('./Content.js');
|
|
6
|
+
var context = require('./context.js');
|
|
6
7
|
|
|
7
8
|
const SelectRoot = ({
|
|
8
9
|
children,
|
|
@@ -10,15 +11,7 @@ const SelectRoot = ({
|
|
|
10
11
|
keyExtractor,
|
|
11
12
|
labelExtractor
|
|
12
13
|
}) => {
|
|
13
|
-
return /* @__PURE__ */ React.createElement(index.Popover.
|
|
14
|
-
Content,
|
|
15
|
-
{
|
|
16
|
-
keyExtractor,
|
|
17
|
-
labelExtractor,
|
|
18
|
-
value
|
|
19
|
-
},
|
|
20
|
-
children
|
|
21
|
-
)));
|
|
14
|
+
return /* @__PURE__ */ React.createElement(index.Popover.Root, { placement: "bottom", trigger: "click" }, /* @__PURE__ */ React.createElement(context.SelectContext.Provider, { value: { value, keyExtractor, labelExtractor } }, /* @__PURE__ */ React.createElement(Content.Content, null, children)));
|
|
22
15
|
};
|
|
23
16
|
|
|
24
17
|
exports.SelectRoot = SelectRoot;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var Skeleton = require('../Skeleton.js');
|
|
5
|
+
|
|
6
|
+
const optionSkeletonStyle = "w-full px-deca my-nano h-[30px]";
|
|
7
|
+
const SkeletonOptions = () => {
|
|
8
|
+
return /* @__PURE__ */ React.createElement("div", { className: "flex flex-col gap-y-nano" }, Array.from(Array(10).keys()).map((value) => /* @__PURE__ */ React.createElement(Skeleton.Skeleton, { key: value }, /* @__PURE__ */ React.createElement("div", { className: optionSkeletonStyle }))));
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
exports.SkeletonOptions = SkeletonOptions;
|
|
@@ -3,24 +3,30 @@
|
|
|
3
3
|
var cortexCore = require('@tecsinapse/cortex-core');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var io5 = require('react-icons/io5');
|
|
6
|
-
var context = require('./context.js');
|
|
7
6
|
var index = require('../Popover/index.js');
|
|
7
|
+
var context = require('./context.js');
|
|
8
8
|
|
|
9
9
|
const { button } = cortexCore.selectVariants();
|
|
10
|
-
const SelectTrigger = ({
|
|
10
|
+
const SelectTrigger = ({
|
|
11
|
+
label,
|
|
12
|
+
placeholder,
|
|
13
|
+
disabled
|
|
14
|
+
}) => {
|
|
11
15
|
const { value, labelExtractor } = React.useContext(context.SelectContext);
|
|
12
|
-
const
|
|
13
|
-
(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
const _placeholder = React.useMemo(() => {
|
|
17
|
+
if (value?.length === 0 || !value) return placeholder ?? label;
|
|
18
|
+
if (value?.length === 1) return labelExtractor(value[0]);
|
|
19
|
+
if (value?.length > 1) return `${value.length} items selected`;
|
|
20
|
+
return labelExtractor(value);
|
|
21
|
+
}, [label, value]);
|
|
16
22
|
return /* @__PURE__ */ React.createElement(index.Popover.Trigger, null, /* @__PURE__ */ React.createElement(
|
|
17
23
|
"button",
|
|
18
24
|
{
|
|
19
|
-
className: button({ disabled }),
|
|
25
|
+
className: button({ disabled, className: "bg-white" }),
|
|
20
26
|
disabled,
|
|
21
27
|
role: "button"
|
|
22
28
|
},
|
|
23
|
-
/* @__PURE__ */ React.createElement("span", { "data-testid": "select-placeholder" },
|
|
29
|
+
/* @__PURE__ */ React.createElement("span", { "data-testid": "select-placeholder" }, _placeholder),
|
|
24
30
|
/* @__PURE__ */ React.createElement(io5.IoChevronDownOutline, null)
|
|
25
31
|
));
|
|
26
32
|
};
|
|
@@ -6,5 +6,9 @@ const SelectContext = React.createContext({
|
|
|
6
6
|
keyExtractor: () => "",
|
|
7
7
|
labelExtractor: () => ""
|
|
8
8
|
});
|
|
9
|
+
const SelectMultiOptionsContext = React.createContext({
|
|
10
|
+
onSelect: () => ""
|
|
11
|
+
});
|
|
9
12
|
|
|
10
13
|
exports.SelectContext = SelectContext;
|
|
14
|
+
exports.SelectMultiOptionsContext = SelectMultiOptionsContext;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var GroupedOptions = require('./GroupedOptions.js');
|
|
4
|
+
var MultiCheckAllOptions = require('./MultiCheckAllOptions.js');
|
|
5
|
+
var MultiGroupedOptions = require('./MultiGroupedOptions.js');
|
|
6
|
+
var MultiOption = require('./MultiOption.js');
|
|
7
|
+
var MultiOptions = require('./MultiOptions.js');
|
|
4
8
|
var Option = require('./Option.js');
|
|
5
9
|
var Options = require('./Options.js');
|
|
6
10
|
var Popover = require('./Popover.js');
|
|
@@ -13,7 +17,11 @@ const Select = {
|
|
|
13
17
|
Popover: Popover.SelectPopover,
|
|
14
18
|
Options: Options.SelectOptions,
|
|
15
19
|
GroupedOptions: GroupedOptions.SelectGroupedOptions,
|
|
16
|
-
Option: Option.SelectOption
|
|
20
|
+
Option: Option.SelectOption,
|
|
21
|
+
MultiOptions: MultiOptions.SelectMultiOptions,
|
|
22
|
+
MultiGroupedOptions: MultiGroupedOptions.SelectMultiGroupedOptions,
|
|
23
|
+
MultiOption: MultiOption.SelectMultiOption,
|
|
24
|
+
MultiCheckAllOptions: MultiCheckAllOptions.SelectMultiCheckAllOptions
|
|
17
25
|
};
|
|
18
26
|
|
|
19
27
|
exports.Select = Select;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const handleSelectMulti = (option, value, onSelect, keyExtractor) => {
|
|
4
|
+
const current = Array.from(value ?? []);
|
|
5
|
+
const indexOf = current.findIndex(
|
|
6
|
+
(it) => keyExtractor(it) === keyExtractor(option)
|
|
7
|
+
);
|
|
8
|
+
if (indexOf === -1) {
|
|
9
|
+
current.push(option);
|
|
10
|
+
} else {
|
|
11
|
+
current.splice(indexOf, 1);
|
|
12
|
+
}
|
|
13
|
+
onSelect(current);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
exports.handleSelectMulti = handleSelectMulti;
|
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var React = require('react');
|
|
4
3
|
var cortexCore = require('@tecsinapse/cortex-core');
|
|
4
|
+
var React = require('react');
|
|
5
5
|
|
|
6
6
|
const Tag = React.forwardRef((props, ref) => {
|
|
7
7
|
const { label, variants } = props;
|
|
8
|
-
return /* @__PURE__ */ React.createElement(
|
|
9
|
-
"div",
|
|
10
|
-
{
|
|
11
|
-
className: cortexCore.tag(variants),
|
|
12
|
-
ref
|
|
13
|
-
},
|
|
14
|
-
/* @__PURE__ */ React.createElement("p", null, label)
|
|
15
|
-
);
|
|
8
|
+
return /* @__PURE__ */ React.createElement("div", { className: cortexCore.tag(variants), ref }, /* @__PURE__ */ React.createElement("p", null, label));
|
|
16
9
|
});
|
|
17
10
|
|
|
18
11
|
exports.Tag = Tag;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var cortexCore = require('@tecsinapse/cortex-core');
|
|
4
|
+
var clsx = require('clsx');
|
|
5
|
+
var React = require('react');
|
|
6
|
+
|
|
7
|
+
const TextAreaBox = React.forwardRef(
|
|
8
|
+
({
|
|
9
|
+
id,
|
|
10
|
+
name,
|
|
11
|
+
variants,
|
|
12
|
+
label,
|
|
13
|
+
placeholder,
|
|
14
|
+
rows,
|
|
15
|
+
className,
|
|
16
|
+
...rest
|
|
17
|
+
}, ref) => {
|
|
18
|
+
return /* @__PURE__ */ React.createElement("div", { className: "flex w-full flex-col" }, /* @__PURE__ */ React.createElement(
|
|
19
|
+
"textarea",
|
|
20
|
+
{
|
|
21
|
+
"data-testid": "textarea-box",
|
|
22
|
+
ref,
|
|
23
|
+
id: id ?? name,
|
|
24
|
+
name,
|
|
25
|
+
placeholder: placeholder ?? " ",
|
|
26
|
+
className: clsx(
|
|
27
|
+
cortexCore.inputBox(placeholder, label, className),
|
|
28
|
+
"resize-none mt-mili"
|
|
29
|
+
),
|
|
30
|
+
rows,
|
|
31
|
+
...rest
|
|
32
|
+
}
|
|
33
|
+
), /* @__PURE__ */ React.createElement(
|
|
34
|
+
"label",
|
|
35
|
+
{
|
|
36
|
+
htmlFor: id ?? name,
|
|
37
|
+
className: cortexCore.labelStyle({
|
|
38
|
+
intent: variants?.intent,
|
|
39
|
+
placeholder
|
|
40
|
+
})
|
|
41
|
+
},
|
|
42
|
+
label
|
|
43
|
+
));
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
exports.TextAreaBox = TextAreaBox;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var cortexCore = require('@tecsinapse/cortex-core');
|
|
4
|
+
var clsx = require('clsx');
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var utils = require('./utils.js');
|
|
7
|
+
|
|
8
|
+
const TextAreaFace = React.forwardRef(
|
|
9
|
+
({ children, variants, className, ...rest }, ref) => {
|
|
10
|
+
const clones = utils.getValidChildren(children).map((el) => {
|
|
11
|
+
return React.cloneElement(el, { ...el.props, variants });
|
|
12
|
+
});
|
|
13
|
+
return /* @__PURE__ */ React.createElement(
|
|
14
|
+
"div",
|
|
15
|
+
{
|
|
16
|
+
ref,
|
|
17
|
+
className: clsx(cortexCore.input(variants), className),
|
|
18
|
+
"data-testid": "textarea-face",
|
|
19
|
+
id: "textarea-face",
|
|
20
|
+
...rest
|
|
21
|
+
},
|
|
22
|
+
clones
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
exports.TextAreaFace = TextAreaFace;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var clsx = require('clsx');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
|
|
6
|
+
const TextAreaLeft = React.forwardRef(({ children, className, ...rest }, ref) => {
|
|
7
|
+
return /* @__PURE__ */ React.createElement("div", { className: clsx(className, "mr-2.5"), ...rest, ref }, children);
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
exports.TextAreaLeft = TextAreaLeft;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var clsx = require('clsx');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
|
|
6
|
+
const TextAreaRight = React.forwardRef(({ children, className, ...rest }, ref) => {
|
|
7
|
+
return /* @__PURE__ */ React.createElement("div", { className: clsx(className, "ml-2.5"), ...rest, ref }, children);
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
exports.TextAreaRight = TextAreaRight;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var Box = require('./Box.js');
|
|
5
|
+
var Face = require('./Face.js');
|
|
6
|
+
|
|
7
|
+
const TextAreaRoot = React.forwardRef(({ variants, className, ...rest }, ref) => {
|
|
8
|
+
return /* @__PURE__ */ React.createElement(Face.TextAreaFace, { variants, className }, /* @__PURE__ */ React.createElement(Box.TextAreaBox, { ref, ...rest }));
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
exports.TextAreaRoot = TextAreaRoot;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var Box = require('./Box.js');
|
|
4
|
+
var Face = require('./Face.js');
|
|
5
|
+
var Left = require('./Left.js');
|
|
6
|
+
var Right = require('./Right.js');
|
|
7
|
+
var Root = require('./Root.js');
|
|
8
|
+
|
|
9
|
+
const TextArea = {
|
|
10
|
+
Root: Root.TextAreaRoot,
|
|
11
|
+
Face: Face.TextAreaFace,
|
|
12
|
+
Box: Box.TextAreaBox,
|
|
13
|
+
Left: Left.TextAreaLeft,
|
|
14
|
+
Right: Right.TextAreaRight
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
exports.TextArea = TextArea;
|