@tecsinapse/cortex-react 1.3.0-beta.8 → 1.3.0
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 +7 -1
- 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/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 +11 -3
- 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 +11 -2
- 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 +10 -4
- 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 +2 -2
- 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 +12 -4
- 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 +12 -3
- 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,31 @@
|
|
|
1
|
+
import { selectVariants } from '@tecsinapse/cortex-core';
|
|
2
|
+
import React__default, { useContext } from 'react';
|
|
3
|
+
import { Select } from './index.js';
|
|
4
|
+
import '@internationalized/date';
|
|
5
|
+
import 'react-aria';
|
|
6
|
+
import 'react-stately';
|
|
7
|
+
import '@floating-ui/react';
|
|
8
|
+
import { useSelectOptions } from '../../hooks/useSelectOptions.js';
|
|
9
|
+
import { SkeletonOptions } from './SkeletonOptions.js';
|
|
10
|
+
import { SelectContext, SelectMultiOptionsContext } from './context.js';
|
|
11
|
+
import { handleSelectMulti } from './utils.js';
|
|
12
|
+
|
|
13
|
+
const { list } = selectVariants();
|
|
14
|
+
const SelectMultiOptions = ({
|
|
15
|
+
onSelect,
|
|
16
|
+
options,
|
|
17
|
+
children
|
|
18
|
+
}) => {
|
|
19
|
+
const { keyExtractor, value: currentValue = [] } = useContext(SelectContext);
|
|
20
|
+
const { options: _options, isLoading } = useSelectOptions({ options });
|
|
21
|
+
return /* @__PURE__ */ React__default.createElement(SelectMultiOptionsContext.Provider, { value: { onSelect, options: _options } }, isLoading ? /* @__PURE__ */ React__default.createElement(SkeletonOptions, null) : /* @__PURE__ */ React__default.createElement("ul", { role: "select", className: list() }, children, _options?.map((option) => /* @__PURE__ */ React__default.createElement(
|
|
22
|
+
Select.MultiOption,
|
|
23
|
+
{
|
|
24
|
+
option,
|
|
25
|
+
key: keyExtractor(option),
|
|
26
|
+
onSelectOption: (option2) => handleSelectMulti(option2, currentValue, onSelect, keyExtractor)
|
|
27
|
+
}
|
|
28
|
+
))));
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export { SelectMultiOptions };
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import { option } from '@tecsinapse/cortex-core';
|
|
2
|
-
import
|
|
2
|
+
import React__default, { useContext } from 'react';
|
|
3
3
|
import { SelectContext } from './context.js';
|
|
4
4
|
|
|
5
5
|
const SelectOption = ({
|
|
6
6
|
onSelectOption,
|
|
7
|
-
option: option$1
|
|
7
|
+
option: option$1,
|
|
8
|
+
grouped = false
|
|
8
9
|
}) => {
|
|
9
10
|
const { keyExtractor, labelExtractor, value } = useContext(SelectContext);
|
|
10
|
-
return /* @__PURE__ */
|
|
11
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
11
12
|
"li",
|
|
12
13
|
{
|
|
13
14
|
onClick: () => onSelectOption(option$1),
|
|
14
15
|
className: option({
|
|
15
|
-
selected: value && keyExtractor(value) === keyExtractor(option$1)
|
|
16
|
+
selected: value && keyExtractor(value) === keyExtractor(option$1),
|
|
17
|
+
grouped
|
|
16
18
|
}),
|
|
17
19
|
role: "option"
|
|
18
20
|
},
|
|
@@ -1,14 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { selectVariants } from '@tecsinapse/cortex-core';
|
|
2
|
+
import React__default, { useContext, useCallback } from 'react';
|
|
3
3
|
import { Select } from './index.js';
|
|
4
|
+
import '@internationalized/date';
|
|
5
|
+
import 'react-aria';
|
|
6
|
+
import 'react-stately';
|
|
7
|
+
import '@floating-ui/react';
|
|
8
|
+
import { useSelectOptions } from '../../hooks/useSelectOptions.js';
|
|
4
9
|
import { usePopoverContext } from '../Popover/Context.js';
|
|
10
|
+
import { SkeletonOptions } from './SkeletonOptions.js';
|
|
11
|
+
import { SelectContext } from './context.js';
|
|
5
12
|
|
|
13
|
+
const { list } = selectVariants();
|
|
6
14
|
const SelectOptions = ({
|
|
7
15
|
onSelect,
|
|
8
16
|
options
|
|
9
17
|
}) => {
|
|
10
18
|
const { keyExtractor } = useContext(SelectContext);
|
|
11
19
|
const { setIsOpen } = usePopoverContext();
|
|
20
|
+
const { options: _options, isLoading } = useSelectOptions({ options });
|
|
12
21
|
const handleSelect = useCallback(
|
|
13
22
|
(option) => {
|
|
14
23
|
onSelect(option);
|
|
@@ -16,7 +25,7 @@ const SelectOptions = ({
|
|
|
16
25
|
},
|
|
17
26
|
[onSelect]
|
|
18
27
|
);
|
|
19
|
-
return /* @__PURE__ */
|
|
28
|
+
return isLoading ? /* @__PURE__ */ React__default.createElement(SkeletonOptions, null) : /* @__PURE__ */ React__default.createElement("ul", { role: "select", className: list() }, _options?.map((option) => /* @__PURE__ */ React__default.createElement(
|
|
20
29
|
Select.Option,
|
|
21
30
|
{
|
|
22
31
|
option,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React__default from 'react';
|
|
2
2
|
import { Popover } from '../Popover/index.js';
|
|
3
3
|
|
|
4
4
|
const SelectPopover = ({ children }) => {
|
|
5
|
-
return /* @__PURE__ */
|
|
5
|
+
return /* @__PURE__ */ React__default.createElement(Popover.Content, { className: "bg-white max-h-[30vh] w-full overflow-y-scroll gap-y-mili flex flex-col p-0" }, children);
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
export { SelectPopover };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import Content from './Content.js';
|
|
1
|
+
import React__default from 'react';
|
|
3
2
|
import { Popover } from '../Popover/index.js';
|
|
3
|
+
import { Content } from './Content.js';
|
|
4
|
+
import { SelectContext } from './context.js';
|
|
4
5
|
|
|
5
6
|
const SelectRoot = ({
|
|
6
7
|
children,
|
|
@@ -8,15 +9,7 @@ const SelectRoot = ({
|
|
|
8
9
|
keyExtractor,
|
|
9
10
|
labelExtractor
|
|
10
11
|
}) => {
|
|
11
|
-
return /* @__PURE__ */
|
|
12
|
-
Content,
|
|
13
|
-
{
|
|
14
|
-
keyExtractor,
|
|
15
|
-
labelExtractor,
|
|
16
|
-
value
|
|
17
|
-
},
|
|
18
|
-
children
|
|
19
|
-
)));
|
|
12
|
+
return /* @__PURE__ */ React__default.createElement(Popover.Root, { placement: "bottom", trigger: "click" }, /* @__PURE__ */ React__default.createElement(SelectContext.Provider, { value: { value, keyExtractor, labelExtractor } }, /* @__PURE__ */ React__default.createElement(Content, null, children)));
|
|
20
13
|
};
|
|
21
14
|
|
|
22
15
|
export { SelectRoot };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { Skeleton } from '../Skeleton.js';
|
|
3
|
+
|
|
4
|
+
const optionSkeletonStyle = "w-full px-deca my-nano h-[30px]";
|
|
5
|
+
const SkeletonOptions = () => {
|
|
6
|
+
return /* @__PURE__ */ React__default.createElement("div", { className: "flex flex-col gap-y-nano" }, Array.from(Array(10).keys()).map((value) => /* @__PURE__ */ React__default.createElement(Skeleton, { key: value }, /* @__PURE__ */ React__default.createElement("div", { className: optionSkeletonStyle }))));
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export { SkeletonOptions };
|
|
@@ -1,25 +1,31 @@
|
|
|
1
1
|
import { selectVariants } from '@tecsinapse/cortex-core';
|
|
2
|
-
import
|
|
2
|
+
import React__default, { useContext, useMemo } from 'react';
|
|
3
3
|
import { IoChevronDownOutline } from 'react-icons/io5';
|
|
4
|
-
import { SelectContext } from './context.js';
|
|
5
4
|
import { Popover } from '../Popover/index.js';
|
|
5
|
+
import { SelectContext } from './context.js';
|
|
6
6
|
|
|
7
7
|
const { button } = selectVariants();
|
|
8
|
-
const SelectTrigger = ({
|
|
8
|
+
const SelectTrigger = ({
|
|
9
|
+
label,
|
|
10
|
+
placeholder,
|
|
11
|
+
disabled
|
|
12
|
+
}) => {
|
|
9
13
|
const { value, labelExtractor } = useContext(SelectContext);
|
|
10
|
-
const
|
|
11
|
-
(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
const _placeholder = useMemo(() => {
|
|
15
|
+
if (value?.length === 0 || !value) return placeholder ?? label;
|
|
16
|
+
if (value?.length === 1) return labelExtractor(value[0]);
|
|
17
|
+
if (value?.length > 1) return `${value.length} items selected`;
|
|
18
|
+
return labelExtractor(value);
|
|
19
|
+
}, [label, value]);
|
|
20
|
+
return /* @__PURE__ */ React__default.createElement(Popover.Trigger, null, /* @__PURE__ */ React__default.createElement(
|
|
15
21
|
"button",
|
|
16
22
|
{
|
|
17
|
-
className: button({ disabled }),
|
|
23
|
+
className: button({ disabled, className: "bg-white" }),
|
|
18
24
|
disabled,
|
|
19
25
|
role: "button"
|
|
20
26
|
},
|
|
21
|
-
/* @__PURE__ */
|
|
22
|
-
/* @__PURE__ */
|
|
27
|
+
/* @__PURE__ */ React__default.createElement("span", { "data-testid": "select-placeholder" }, _placeholder),
|
|
28
|
+
/* @__PURE__ */ React__default.createElement(IoChevronDownOutline, null)
|
|
23
29
|
));
|
|
24
30
|
};
|
|
25
31
|
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { SelectGroupedOptions } from './GroupedOptions.js';
|
|
2
|
+
import { SelectMultiCheckAllOptions } from './MultiCheckAllOptions.js';
|
|
3
|
+
import { SelectMultiGroupedOptions } from './MultiGroupedOptions.js';
|
|
4
|
+
import { SelectMultiOption } from './MultiOption.js';
|
|
5
|
+
import { SelectMultiOptions } from './MultiOptions.js';
|
|
2
6
|
import { SelectOption } from './Option.js';
|
|
3
7
|
import { SelectOptions } from './Options.js';
|
|
4
8
|
import { SelectPopover } from './Popover.js';
|
|
@@ -11,7 +15,11 @@ const Select = {
|
|
|
11
15
|
Popover: SelectPopover,
|
|
12
16
|
Options: SelectOptions,
|
|
13
17
|
GroupedOptions: SelectGroupedOptions,
|
|
14
|
-
Option: SelectOption
|
|
18
|
+
Option: SelectOption,
|
|
19
|
+
MultiOptions: SelectMultiOptions,
|
|
20
|
+
MultiGroupedOptions: SelectMultiGroupedOptions,
|
|
21
|
+
MultiOption: SelectMultiOption,
|
|
22
|
+
MultiCheckAllOptions: SelectMultiCheckAllOptions
|
|
15
23
|
};
|
|
16
24
|
|
|
17
25
|
export { Select };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const handleSelectMulti = (option, value, onSelect, keyExtractor) => {
|
|
2
|
+
const current = Array.from(value ?? []);
|
|
3
|
+
const indexOf = current.findIndex(
|
|
4
|
+
(it) => keyExtractor(it) === keyExtractor(option)
|
|
5
|
+
);
|
|
6
|
+
if (indexOf === -1) {
|
|
7
|
+
current.push(option);
|
|
8
|
+
} else {
|
|
9
|
+
current.splice(indexOf, 1);
|
|
10
|
+
}
|
|
11
|
+
onSelect(current);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { handleSelectMulti };
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
|
-
import
|
|
2
|
+
import React__default from 'react';
|
|
3
3
|
|
|
4
|
-
const Skeleton = ({
|
|
5
|
-
|
|
6
|
-
children,
|
|
7
|
-
...rest
|
|
8
|
-
}) => {
|
|
9
|
-
return /* @__PURE__ */ React.createElement(
|
|
4
|
+
const Skeleton = ({ className, children, ...rest }) => {
|
|
5
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
10
6
|
"div",
|
|
11
7
|
{
|
|
12
8
|
...rest,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { snackbar } from '@tecsinapse/cortex-core';
|
|
2
|
+
import React__default, { forwardRef } from 'react';
|
|
3
|
+
|
|
4
|
+
const BaseSnackbar = forwardRef(
|
|
5
|
+
(props, ref) => {
|
|
6
|
+
const { children, show, variants } = props;
|
|
7
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, show ? /* @__PURE__ */ React__default.createElement("div", { className: snackbar(variants), ref, "data-testid": "snackbar" }, children) : /* @__PURE__ */ React__default.createElement(React__default.Fragment, null));
|
|
8
|
+
}
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
export { BaseSnackbar };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { BaseSnackbar } from './BaseSnackbar.js';
|
|
1
|
+
import React__default from 'react';
|
|
3
2
|
import { IoMdInformationCircleOutline, IoMdClose } from 'react-icons/io';
|
|
3
|
+
import { BaseSnackbar } from './BaseSnackbar.js';
|
|
4
4
|
|
|
5
5
|
const DefaultSnack = ({
|
|
6
6
|
text,
|
|
7
7
|
onDismiss,
|
|
8
8
|
variants
|
|
9
|
-
}) => /* @__PURE__ */
|
|
9
|
+
}) => /* @__PURE__ */ React__default.createElement(BaseSnackbar, { show: true, variants: { intent: variants?.intent } }, /* @__PURE__ */ React__default.createElement("div", { className: "flex justify-between items-center flex-row gap-x-mili" }, /* @__PURE__ */ React__default.createElement(
|
|
10
10
|
IoMdInformationCircleOutline,
|
|
11
11
|
{
|
|
12
12
|
className: "w-[20px] h-[20px] shrink-0",
|
|
13
13
|
"data-testid": "icon-info"
|
|
14
14
|
}
|
|
15
|
-
), /* @__PURE__ */
|
|
15
|
+
), /* @__PURE__ */ React__default.createElement("p", null, text), /* @__PURE__ */ React__default.createElement(
|
|
16
16
|
IoMdClose,
|
|
17
17
|
{
|
|
18
18
|
"data-testid": "icon-close",
|
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
import { tHead, tRow, tHeadCell, hr, tCell, tFoot, tRoot } from '@tecsinapse/cortex-core';
|
|
2
|
-
import
|
|
2
|
+
import React__default from 'react';
|
|
3
3
|
|
|
4
4
|
const THead = ({
|
|
5
5
|
children,
|
|
6
6
|
className,
|
|
7
7
|
...rest
|
|
8
|
-
}) => /* @__PURE__ */
|
|
8
|
+
}) => /* @__PURE__ */ React__default.createElement("thead", { className: tHead({ className }), "data-testid": "thead", ...rest }, children);
|
|
9
9
|
const TRow = ({
|
|
10
10
|
children,
|
|
11
11
|
className,
|
|
12
12
|
...rest
|
|
13
|
-
}) => /* @__PURE__ */
|
|
13
|
+
}) => /* @__PURE__ */ React__default.createElement("tr", { className: tRow({ className }), "data-testid": "trow", ...rest }, children);
|
|
14
14
|
const THeadCell = ({
|
|
15
15
|
children,
|
|
16
16
|
className,
|
|
17
17
|
...rest
|
|
18
|
-
}) => /* @__PURE__ */
|
|
18
|
+
}) => /* @__PURE__ */ React__default.createElement("th", { className: tHeadCell({ className }), "data-testid": "thead-cell", ...rest }, children);
|
|
19
19
|
const TRowHeader = ({
|
|
20
20
|
children
|
|
21
|
-
}) => /* @__PURE__ */
|
|
21
|
+
}) => /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("tr", { className: tRow(), "data-testid": "trow-header" }, children), /* @__PURE__ */ React__default.createElement("tr", { className: tRow() }, /* @__PURE__ */ React__default.createElement("td", { colSpan: 99 }, /* @__PURE__ */ React__default.createElement("hr", { className: hr() }))));
|
|
22
22
|
const TCell = ({
|
|
23
23
|
children,
|
|
24
24
|
className,
|
|
25
25
|
...rest
|
|
26
|
-
}) => /* @__PURE__ */
|
|
26
|
+
}) => /* @__PURE__ */ React__default.createElement("td", { className: tCell({ className }), "data-testid": "tcell", ...rest }, children);
|
|
27
27
|
const TFoot = ({
|
|
28
28
|
children,
|
|
29
29
|
className,
|
|
30
30
|
...rest
|
|
31
|
-
}) => /* @__PURE__ */
|
|
31
|
+
}) => /* @__PURE__ */ React__default.createElement("tfoot", { className: tFoot({ className }), "data-testid": "tfoot", ...rest }, children);
|
|
32
32
|
const Table = ({
|
|
33
33
|
children,
|
|
34
34
|
className,
|
|
35
35
|
...rest
|
|
36
|
-
}) => /* @__PURE__ */
|
|
36
|
+
}) => /* @__PURE__ */ React__default.createElement("table", { className: tRoot({ className }), "data-testid": "table", ...rest }, children);
|
|
37
37
|
const Td = ({
|
|
38
38
|
children,
|
|
39
39
|
...rest
|
|
40
|
-
}) => /* @__PURE__ */
|
|
40
|
+
}) => /* @__PURE__ */ React__default.createElement("td", { "data-testid": "td", ...rest }, children);
|
|
41
41
|
|
|
42
42
|
export { TCell, TFoot, THead, THeadCell, TRow, TRowHeader, Table, Td };
|
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
2
1
|
import { tag } from '@tecsinapse/cortex-core';
|
|
2
|
+
import React__default, { forwardRef } from 'react';
|
|
3
3
|
|
|
4
4
|
const Tag = forwardRef((props, ref) => {
|
|
5
5
|
const { label, variants } = props;
|
|
6
|
-
return /* @__PURE__ */
|
|
7
|
-
"div",
|
|
8
|
-
{
|
|
9
|
-
className: tag(variants),
|
|
10
|
-
ref
|
|
11
|
-
},
|
|
12
|
-
/* @__PURE__ */ React.createElement("p", null, label)
|
|
13
|
-
);
|
|
6
|
+
return /* @__PURE__ */ React__default.createElement("div", { className: tag(variants), ref }, /* @__PURE__ */ React__default.createElement("p", null, label));
|
|
14
7
|
});
|
|
15
8
|
|
|
16
9
|
export { Tag };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { inputBox, labelStyle } from '@tecsinapse/cortex-core';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import React__default from 'react';
|
|
4
|
+
|
|
5
|
+
const TextAreaBox = React__default.forwardRef(
|
|
6
|
+
({
|
|
7
|
+
id,
|
|
8
|
+
name,
|
|
9
|
+
variants,
|
|
10
|
+
label,
|
|
11
|
+
placeholder,
|
|
12
|
+
rows,
|
|
13
|
+
className,
|
|
14
|
+
...rest
|
|
15
|
+
}, ref) => {
|
|
16
|
+
return /* @__PURE__ */ React__default.createElement("div", { className: "flex w-full flex-col" }, /* @__PURE__ */ React__default.createElement(
|
|
17
|
+
"textarea",
|
|
18
|
+
{
|
|
19
|
+
"data-testid": "textarea-box",
|
|
20
|
+
ref,
|
|
21
|
+
id: id ?? name,
|
|
22
|
+
name,
|
|
23
|
+
placeholder: placeholder ?? " ",
|
|
24
|
+
className: clsx(
|
|
25
|
+
inputBox(placeholder, label, className),
|
|
26
|
+
"resize-none mt-mili"
|
|
27
|
+
),
|
|
28
|
+
rows,
|
|
29
|
+
...rest
|
|
30
|
+
}
|
|
31
|
+
), /* @__PURE__ */ React__default.createElement(
|
|
32
|
+
"label",
|
|
33
|
+
{
|
|
34
|
+
htmlFor: id ?? name,
|
|
35
|
+
className: labelStyle({
|
|
36
|
+
intent: variants?.intent,
|
|
37
|
+
placeholder
|
|
38
|
+
})
|
|
39
|
+
},
|
|
40
|
+
label
|
|
41
|
+
));
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
export { TextAreaBox };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { input } from '@tecsinapse/cortex-core';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import React__default from 'react';
|
|
4
|
+
import { getValidChildren } from './utils.js';
|
|
5
|
+
|
|
6
|
+
const TextAreaFace = React__default.forwardRef(
|
|
7
|
+
({ children, variants, className, ...rest }, ref) => {
|
|
8
|
+
const clones = getValidChildren(children).map((el) => {
|
|
9
|
+
return React__default.cloneElement(el, { ...el.props, variants });
|
|
10
|
+
});
|
|
11
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
12
|
+
"div",
|
|
13
|
+
{
|
|
14
|
+
ref,
|
|
15
|
+
className: clsx(input(variants), className),
|
|
16
|
+
"data-testid": "textarea-face",
|
|
17
|
+
id: "textarea-face",
|
|
18
|
+
...rest
|
|
19
|
+
},
|
|
20
|
+
clones
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
export { TextAreaFace };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
|
|
4
|
+
const TextAreaLeft = React__default.forwardRef(({ children, className, ...rest }, ref) => {
|
|
5
|
+
return /* @__PURE__ */ React__default.createElement("div", { className: clsx(className, "mr-2.5"), ...rest, ref }, children);
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export { TextAreaLeft };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
|
|
4
|
+
const TextAreaRight = React__default.forwardRef(({ children, className, ...rest }, ref) => {
|
|
5
|
+
return /* @__PURE__ */ React__default.createElement("div", { className: clsx(className, "ml-2.5"), ...rest, ref }, children);
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export { TextAreaRight };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { TextAreaBox } from './Box.js';
|
|
3
|
+
import { TextAreaFace } from './Face.js';
|
|
4
|
+
|
|
5
|
+
const TextAreaRoot = React__default.forwardRef(({ variants, className, ...rest }, ref) => {
|
|
6
|
+
return /* @__PURE__ */ React__default.createElement(TextAreaFace, { variants, className }, /* @__PURE__ */ React__default.createElement(TextAreaBox, { ref, ...rest }));
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export { TextAreaRoot };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TextAreaBox } from './Box.js';
|
|
2
|
+
import { TextAreaFace } from './Face.js';
|
|
3
|
+
import { TextAreaLeft } from './Left.js';
|
|
4
|
+
import { TextAreaRight } from './Right.js';
|
|
5
|
+
import { TextAreaRoot } from './Root.js';
|
|
6
|
+
|
|
7
|
+
const TextArea = {
|
|
8
|
+
Root: TextAreaRoot,
|
|
9
|
+
Face: TextAreaFace,
|
|
10
|
+
Box: TextAreaBox,
|
|
11
|
+
Left: TextAreaLeft,
|
|
12
|
+
Right: TextAreaRight
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { TextArea };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { useTimeField } from '../../hooks/useTimeField.js';
|
|
3
|
+
import { DateSegment } from '../DatePicker/DateSegment.js';
|
|
4
|
+
|
|
5
|
+
const TimeField = (props) => {
|
|
6
|
+
const { fieldProps, ref, state } = useTimeField(props);
|
|
7
|
+
return /* @__PURE__ */ React__default.createElement("div", { ...fieldProps, ref, className: "flex flex-row" }, state.segments.map((segment, i) => /* @__PURE__ */ React__default.createElement(DateSegment, { key: i, segment, state })));
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { TimeField };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { labelStyle, inputBox } from '@tecsinapse/cortex-core';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
import { Input } from '../Input/index.js';
|
|
4
|
+
import { TimeField } from './TimeField.js';
|
|
5
|
+
|
|
6
|
+
const TimeFieldInput = (props) => {
|
|
7
|
+
const { onChange, value, label, variants } = props;
|
|
8
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
|
|
9
|
+
Input.Face,
|
|
10
|
+
{
|
|
11
|
+
variants,
|
|
12
|
+
className: "flex flex-row",
|
|
13
|
+
"data-testid": "time-field-input"
|
|
14
|
+
},
|
|
15
|
+
/* @__PURE__ */ React__default.createElement("span", { className: labelStyle({}) }, label),
|
|
16
|
+
/* @__PURE__ */ React__default.createElement("div", { className: inputBox("", label) }, /* @__PURE__ */ React__default.createElement(TimeField, { onChange, value }))
|
|
17
|
+
));
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export { TimeFieldInput };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { styleLabelElement, styleInputElement, toggle } from '@tecsinapse/cortex-core';
|
|
2
|
-
import
|
|
2
|
+
import React__default, { forwardRef } from 'react';
|
|
3
3
|
|
|
4
4
|
const Toggle = forwardRef((props, ref) => {
|
|
5
|
-
return /* @__PURE__ */
|
|
5
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
6
6
|
"div",
|
|
7
7
|
{
|
|
8
8
|
className: "flex flex-row items-center gap-x-centi",
|
|
9
9
|
"data-testid": "toggle-div"
|
|
10
10
|
},
|
|
11
|
-
/* @__PURE__ */
|
|
11
|
+
/* @__PURE__ */ React__default.createElement("label", { className: styleLabelElement() }, /* @__PURE__ */ React__default.createElement(
|
|
12
12
|
"input",
|
|
13
13
|
{
|
|
14
14
|
type: "checkbox",
|
|
@@ -17,7 +17,7 @@ const Toggle = forwardRef((props, ref) => {
|
|
|
17
17
|
"data-testid": "toggle-input",
|
|
18
18
|
...props
|
|
19
19
|
}
|
|
20
|
-
), /* @__PURE__ */
|
|
20
|
+
), /* @__PURE__ */ React__default.createElement("div", { className: toggle() }))
|
|
21
21
|
);
|
|
22
22
|
});
|
|
23
23
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import React, { forwardRef, useRef } from 'react';
|
|
2
1
|
import { FloatingArrow } from '@floating-ui/react';
|
|
2
|
+
import React__default, { forwardRef, useRef } from 'react';
|
|
3
3
|
import '@internationalized/date';
|
|
4
4
|
import 'react-aria';
|
|
5
5
|
import 'react-stately';
|
|
6
|
+
import { cloneWithProps } from './utils.js';
|
|
6
7
|
import { useFloatingLogic } from '../hooks/useFloatingLogic.js';
|
|
7
8
|
|
|
8
9
|
const Tooltip = forwardRef(
|
|
@@ -26,7 +27,7 @@ const Tooltip = forwardRef(
|
|
|
26
27
|
context,
|
|
27
28
|
floatingStyles
|
|
28
29
|
} = useFloatingLogic({ placement, arrowRef, trigger });
|
|
29
|
-
return /* @__PURE__ */
|
|
30
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, cloneWithProps(children, triggerProps), isOpen ? /* @__PURE__ */ React__default.createElement(
|
|
30
31
|
"div",
|
|
31
32
|
{
|
|
32
33
|
ref: ref || refs.setFloating,
|
|
@@ -41,8 +42,8 @@ const Tooltip = forwardRef(
|
|
|
41
42
|
}
|
|
42
43
|
},
|
|
43
44
|
text,
|
|
44
|
-
/* @__PURE__ */
|
|
45
|
-
) : /* @__PURE__ */
|
|
45
|
+
/* @__PURE__ */ React__default.createElement(FloatingArrow, { ref: arrowRef, context, fill: "black" })
|
|
46
|
+
) : /* @__PURE__ */ React__default.createElement(React__default.Fragment, null));
|
|
46
47
|
}
|
|
47
48
|
);
|
|
48
49
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CalendarDate, getLocalTimeZone } from '@internationalized/date';
|
|
2
|
+
import React__default from 'react';
|
|
2
3
|
|
|
3
4
|
const getNameInitials = (name) => {
|
|
4
5
|
const nameSplit = name.split(" ");
|
|
@@ -18,5 +19,8 @@ const dateToCalendarDate = (value) => {
|
|
|
18
19
|
const calendarDateToDate = (value) => {
|
|
19
20
|
return value.toDate(getLocalTimeZone());
|
|
20
21
|
};
|
|
22
|
+
function cloneWithProps(children, triggerProps) {
|
|
23
|
+
return React__default.cloneElement(/* @__PURE__ */ React__default.createElement("div", null, children), triggerProps);
|
|
24
|
+
}
|
|
21
25
|
|
|
22
|
-
export { calendarDateToDate, dateToCalendarDate, getNameInitials };
|
|
26
|
+
export { calendarDateToDate, cloneWithProps, dateToCalendarDate, getNameInitials };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
const useSelectGroupedOptions = ({
|
|
4
|
+
options: _options
|
|
5
|
+
}) => {
|
|
6
|
+
const [options, setOptions] = useState();
|
|
7
|
+
const [isLoading, setIsLoading] = useState();
|
|
8
|
+
const [error, setError] = useState();
|
|
9
|
+
const initData = async (fetch) => {
|
|
10
|
+
setIsLoading(true);
|
|
11
|
+
try {
|
|
12
|
+
const result = await fetch();
|
|
13
|
+
if (result) {
|
|
14
|
+
setOptions(result ?? []);
|
|
15
|
+
}
|
|
16
|
+
} catch (e) {
|
|
17
|
+
setError(String(e));
|
|
18
|
+
} finally {
|
|
19
|
+
setIsLoading(false);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (typeof _options === "function") initData(_options);
|
|
24
|
+
else setOptions(_options);
|
|
25
|
+
}, [_options]);
|
|
26
|
+
return {
|
|
27
|
+
isLoading,
|
|
28
|
+
options,
|
|
29
|
+
error
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { useSelectGroupedOptions };
|