@tecsinapse/cortex-react 1.3.0-beta.3 → 1.3.0-beta.31
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/Divider.js +10 -0
- 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/Masonry.js +49 -0
- package/dist/cjs/components/Menubar/Categories.js +10 -0
- package/dist/cjs/components/Menubar/Category.js +11 -0
- package/dist/cjs/components/Menubar/Dropdown.js +23 -0
- package/dist/cjs/components/Menubar/DropdownRoot.js +38 -0
- package/dist/cjs/components/Menubar/Header.js +25 -0
- package/dist/cjs/components/Menubar/IconControlSubItem.js +19 -0
- package/dist/cjs/components/Menubar/Item.js +22 -0
- package/dist/cjs/components/Menubar/ItemLink.js +18 -0
- package/dist/cjs/components/Menubar/Left.js +11 -0
- package/dist/cjs/components/Menubar/MostUsed.js +11 -0
- package/dist/cjs/components/Menubar/MostUsedItem.js +31 -0
- package/dist/cjs/components/Menubar/MostUsedList.js +67 -0
- package/dist/cjs/components/Menubar/Right.js +11 -0
- package/dist/cjs/components/Menubar/Root.js +11 -0
- package/dist/cjs/components/Menubar/Search.js +21 -0
- package/dist/cjs/components/Menubar/SubItem.js +20 -0
- package/dist/cjs/components/Menubar/index.js +33 -0
- package/dist/cjs/components/Modal.js +1 -1
- package/dist/cjs/components/Popover/{PopoverContent.js → Content.js} +9 -6
- package/dist/cjs/components/Popover/Context.js +15 -0
- package/dist/cjs/components/Popover/Provider.js +19 -0
- package/dist/cjs/components/Popover/Root.js +14 -0
- package/dist/cjs/components/Popover/Trigger.js +11 -0
- package/dist/cjs/components/Popover/index.js +15 -0
- package/dist/cjs/components/RadioButton.js +22 -0
- package/dist/cjs/components/Select/Content.js +21 -0
- package/dist/cjs/components/Select/GroupedOptions.js +14 -4
- 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 +14 -3
- package/dist/cjs/components/Select/Popover.js +2 -5
- package/dist/cjs/components/Select/Root.js +3 -18
- package/dist/cjs/components/Select/SkeletonOptions.js +11 -0
- package/dist/cjs/components/Select/Trigger.js +16 -10
- 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 +47 -39
- 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 +52 -20
- package/dist/cjs/provider/MenubarProvider.js +22 -0
- package/dist/cjs/provider/SnackbarProvider.js +21 -0
- package/dist/cjs/service/SnackbarSonner.js +25 -6
- package/dist/cjs/styles/menubar.js +70 -0
- 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 +8 -0
- 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 +47 -0
- package/dist/esm/components/Menubar/Categories.js +8 -0
- package/dist/esm/components/Menubar/Category.js +9 -0
- package/dist/esm/components/Menubar/Dropdown.js +21 -0
- package/dist/esm/components/Menubar/DropdownRoot.js +36 -0
- package/dist/esm/components/Menubar/Header.js +23 -0
- package/dist/esm/components/Menubar/IconControlSubItem.js +17 -0
- package/dist/esm/components/Menubar/Item.js +20 -0
- package/dist/esm/components/Menubar/ItemLink.js +16 -0
- package/dist/esm/components/Menubar/Left.js +9 -0
- package/dist/esm/components/Menubar/MostUsed.js +9 -0
- package/dist/esm/components/Menubar/MostUsedItem.js +29 -0
- package/dist/esm/components/Menubar/MostUsedList.js +65 -0
- package/dist/esm/components/Menubar/Right.js +9 -0
- package/dist/esm/components/Menubar/Root.js +9 -0
- package/dist/esm/components/Menubar/Search.js +19 -0
- package/dist/esm/components/Menubar/SubItem.js +18 -0
- package/dist/esm/components/Menubar/index.js +31 -0
- package/dist/esm/components/Modal.js +3 -3
- package/dist/esm/components/Popover/Content.js +29 -0
- package/dist/esm/components/Popover/Context.js +12 -0
- package/dist/esm/components/Popover/Provider.js +17 -0
- package/dist/esm/components/Popover/Root.js +12 -0
- package/dist/esm/components/Popover/Trigger.js +9 -0
- package/dist/esm/components/Popover/index.js +13 -0
- package/dist/esm/components/ProgressBar.js +4 -4
- package/dist/esm/components/RadioButton.js +20 -0
- package/dist/esm/components/Select/Content.js +19 -0
- package/dist/esm/components/Select/GroupedOptions.js +15 -5
- 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 +15 -4
- package/dist/esm/components/Select/Popover.js +3 -6
- package/dist/esm/components/Select/Root.js +4 -19
- package/dist/esm/components/Select/SkeletonOptions.js +9 -0
- package/dist/esm/components/Select/Trigger.js +18 -12
- 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 +44 -39
- 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 +25 -12
- package/dist/esm/provider/MenubarProvider.js +19 -0
- package/dist/esm/provider/SnackbarProvider.js +18 -0
- package/dist/esm/service/SnackbarSonner.js +27 -8
- package/dist/esm/styles/menubar.js +62 -0
- 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/Card.d.ts +3 -4
- 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/Divider.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/Masonry.d.ts +7 -0
- package/dist/types/components/Menubar/Categories.d.ts +3 -0
- package/dist/types/components/Menubar/Category.d.ts +8 -0
- package/dist/types/components/Menubar/Dropdown.d.ts +3 -0
- package/dist/types/components/Menubar/DropdownRoot.d.ts +17 -0
- package/dist/types/components/Menubar/Header.d.ts +6 -0
- package/dist/types/components/Menubar/IconControlSubItem.d.ts +6 -0
- package/dist/types/components/Menubar/Item.d.ts +10 -0
- package/dist/types/components/Menubar/ItemLink.d.ts +8 -0
- package/dist/types/components/Menubar/Left.d.ts +3 -0
- package/dist/types/components/Menubar/MostUsed.d.ts +8 -0
- package/dist/types/components/Menubar/MostUsedItem.d.ts +8 -0
- package/dist/types/components/Menubar/MostUsedList.d.ts +3 -0
- package/dist/types/components/Menubar/Right.d.ts +3 -0
- package/dist/types/components/Menubar/Root.d.ts +6 -0
- package/dist/types/components/Menubar/Search.d.ts +3 -0
- package/dist/types/components/Menubar/SubItem.d.ts +6 -0
- package/dist/types/components/Menubar/index.d.ts +15 -0
- package/dist/types/components/Menubar/interface.d.ts +4 -0
- package/dist/types/components/Popover/Content.d.ts +6 -0
- package/dist/types/components/Popover/{PopoverContext.d.ts → Context.d.ts} +5 -9
- package/dist/types/components/Popover/Provider.d.ts +8 -0
- package/dist/types/components/Popover/{PopoverRoot.d.ts → Root.d.ts} +1 -2
- package/dist/types/components/Popover/Trigger.d.ts +5 -0
- package/dist/types/components/Popover/index.d.ts +6 -3
- package/dist/types/components/RadioButton.d.ts +6 -0
- package/dist/types/components/Select/Content.d.ts +2 -0
- 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 -4
- 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 +2 -2
- package/dist/types/components/index.d.ts +7 -14
- 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/provider/MenubarProvider.d.ts +8 -0
- package/dist/types/provider/index.d.ts +2 -0
- package/dist/types/styles/menubar.d.ts +350 -0
- package/dist/types/tests/Divider.test.d.ts +1 -0
- package/dist/types/tests/Input/Mask.test.d.ts +1 -0
- package/dist/types/tests/Menubar/Categories.test.d.ts +1 -0
- package/dist/types/tests/Menubar/Category.test.d.ts +1 -0
- package/dist/types/tests/Menubar/Dropdown.test.d.ts +1 -0
- package/dist/types/tests/Menubar/DropdownRoot.test.d.ts +1 -0
- package/dist/types/tests/Menubar/Header.test.d.ts +1 -0
- package/dist/types/tests/Menubar/HeaderLeft.test.d.ts +1 -0
- package/dist/types/tests/Menubar/HeaderRigth.test.d.ts +1 -0
- package/dist/types/tests/Menubar/Item.test.d.ts +1 -0
- package/dist/types/tests/Menubar/MostUsed.test.d.ts +1 -0
- package/dist/types/tests/Menubar/MostUsedItem.test.d.ts +1 -0
- package/dist/types/tests/Menubar/MostUsedList.test.d.ts +1 -0
- package/dist/types/tests/Menubar/Root.test.d.ts +1 -0
- package/dist/types/tests/Menubar/SubItem.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/Popover/Popover.js +0 -13
- package/dist/cjs/components/Popover/PopoverContext.js +0 -29
- package/dist/cjs/components/Popover/PopoverRoot.js +0 -10
- package/dist/cjs/components/Popover/PopoverTrigger.js +0 -11
- 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/Popover/Popover.js +0 -11
- package/dist/esm/components/Popover/PopoverContent.js +0 -26
- package/dist/esm/components/Popover/PopoverContext.js +0 -26
- package/dist/esm/components/Popover/PopoverRoot.js +0 -8
- package/dist/esm/components/Popover/PopoverTrigger.js +0 -9
- 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/Popover/Popover.d.ts +0 -5
- package/dist/types/components/Popover/PopoverContent.d.ts +0 -7
- package/dist/types/components/Popover/PopoverTrigger.d.ts +0 -6
- 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 React = require('react');
|
|
4
|
+
var menubar = require('../../styles/menubar.js');
|
|
5
|
+
var IconControlSubItem = require('./IconControlSubItem.js');
|
|
6
|
+
var ItemLink = require('./ItemLink.js');
|
|
7
|
+
|
|
8
|
+
const { container, text } = menubar.item();
|
|
9
|
+
const Item = ({
|
|
10
|
+
children,
|
|
11
|
+
subItems,
|
|
12
|
+
renderSubItems,
|
|
13
|
+
className,
|
|
14
|
+
href,
|
|
15
|
+
...rest
|
|
16
|
+
}) => {
|
|
17
|
+
const [showSubItem, setShowSubItem] = React.useState(false);
|
|
18
|
+
const hasSubItems = (subItems ?? []).length > 0;
|
|
19
|
+
return /* @__PURE__ */ React.createElement(ItemLink, { href }, /* @__PURE__ */ React.createElement("div", { "data-testid": "item-menubar", ...rest, className: container() }, /* @__PURE__ */ React.createElement("div", { className: text({ className }) }, children), hasSubItems ? /* @__PURE__ */ React.createElement(IconControlSubItem, { show: showSubItem, setShow: setShowSubItem }) : /* @__PURE__ */ React.createElement(React.Fragment, null)), showSubItem ? /* @__PURE__ */ React.createElement(React.Fragment, null, subItems?.map((subItem) => renderSubItems?.(subItem))) : /* @__PURE__ */ React.createElement(React.Fragment, null));
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
module.exports = Item;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
|
|
5
|
+
const ItemLink = ({ href, children, classNameAnchor }) => {
|
|
6
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, href ? /* @__PURE__ */ React.createElement(
|
|
7
|
+
"a",
|
|
8
|
+
{
|
|
9
|
+
href,
|
|
10
|
+
target: "_blank",
|
|
11
|
+
rel: "noopener noreferrer",
|
|
12
|
+
className: classNameAnchor
|
|
13
|
+
},
|
|
14
|
+
children
|
|
15
|
+
) : children);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
module.exports = ItemLink;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var menubar = require('../../styles/menubar.js');
|
|
5
|
+
|
|
6
|
+
const { left } = menubar.menubar();
|
|
7
|
+
const Left = ({ children, ...rest }) => {
|
|
8
|
+
return /* @__PURE__ */ React.createElement("div", { className: left(), "data-testid": "header-left-menubar", ...rest }, children);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
module.exports = Left;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var menubar = require('../../styles/menubar.js');
|
|
5
|
+
|
|
6
|
+
const { container, label: labelClass, containerList } = menubar.mostUsed();
|
|
7
|
+
const MostUsed = ({ label, children, ...rest }) => {
|
|
8
|
+
return /* @__PURE__ */ React.createElement("div", { className: container(), "data-testid": "most-used-menubar", ...rest }, /* @__PURE__ */ React.createElement("p", { className: labelClass() }, label), /* @__PURE__ */ React.createElement("div", { className: containerList() }, children));
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
module.exports = MostUsed;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var menubar = require('../../styles/menubar.js');
|
|
5
|
+
var Card = require('../Card.js');
|
|
6
|
+
var ItemLink = require('./ItemLink.js');
|
|
7
|
+
|
|
8
|
+
const {
|
|
9
|
+
title: titleClass,
|
|
10
|
+
category: categoryClass,
|
|
11
|
+
container
|
|
12
|
+
} = menubar.mostUsedItem();
|
|
13
|
+
const MostUsedItem = ({
|
|
14
|
+
title,
|
|
15
|
+
category,
|
|
16
|
+
href,
|
|
17
|
+
...rest
|
|
18
|
+
}) => {
|
|
19
|
+
return /* @__PURE__ */ React.createElement(ItemLink, { href, classNameAnchor: "w-full" }, /* @__PURE__ */ React.createElement(
|
|
20
|
+
Card.Card,
|
|
21
|
+
{
|
|
22
|
+
...rest,
|
|
23
|
+
"data-testid": "most-used-item-menubar",
|
|
24
|
+
className: container()
|
|
25
|
+
},
|
|
26
|
+
/* @__PURE__ */ React.createElement("p", { className: titleClass() }, title),
|
|
27
|
+
/* @__PURE__ */ React.createElement("p", { className: categoryClass() }, category)
|
|
28
|
+
));
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
module.exports = MostUsedItem;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
require('clsx');
|
|
5
|
+
require('@internationalized/date');
|
|
6
|
+
require('../Badge.js');
|
|
7
|
+
require('react-icons/md');
|
|
8
|
+
require('../Card.js');
|
|
9
|
+
require('../Button.js');
|
|
10
|
+
require('react-aria');
|
|
11
|
+
require('react-stately');
|
|
12
|
+
require('@floating-ui/react');
|
|
13
|
+
require('../Calendar/CalendarCell.js');
|
|
14
|
+
require('@tecsinapse/cortex-core');
|
|
15
|
+
require('react-icons/fa');
|
|
16
|
+
require('react-icons/lia');
|
|
17
|
+
require('../Input/Box.js');
|
|
18
|
+
require('../Input/Face.js');
|
|
19
|
+
require('../Input/Left.js');
|
|
20
|
+
require('../Input/Mask.js');
|
|
21
|
+
require('../Input/Right.js');
|
|
22
|
+
require('../Input/Root.js');
|
|
23
|
+
require('../Input/Search.js');
|
|
24
|
+
require('../Popover/Context.js');
|
|
25
|
+
require('../GroupButton.js');
|
|
26
|
+
require('../Hint.js');
|
|
27
|
+
var index = require('./index.js');
|
|
28
|
+
require('../Modal.js');
|
|
29
|
+
require('../../styles/calendar-cell.js');
|
|
30
|
+
require('../../styles/groupButton.js');
|
|
31
|
+
require('../../styles/progressBar.js');
|
|
32
|
+
require('../RadioButton.js');
|
|
33
|
+
require('../Select/GroupedOptions.js');
|
|
34
|
+
require('../Select/context.js');
|
|
35
|
+
require('../Select/MultiGroupedOptions.js');
|
|
36
|
+
require('../Select/MultiOptions.js');
|
|
37
|
+
require('../Select/Options.js');
|
|
38
|
+
require('../Select/Trigger.js');
|
|
39
|
+
require('../Snackbar/BaseSnackbar.js');
|
|
40
|
+
require('react-icons/io');
|
|
41
|
+
require('../Tag.js');
|
|
42
|
+
require('../TextArea/Box.js');
|
|
43
|
+
require('../TextArea/Face.js');
|
|
44
|
+
require('../TextArea/Left.js');
|
|
45
|
+
require('../TextArea/Right.js');
|
|
46
|
+
require('../TextArea/Root.js');
|
|
47
|
+
require('../Toggle.js');
|
|
48
|
+
require('../Tooltip.js');
|
|
49
|
+
|
|
50
|
+
const MostUsedList = ({ mostUsed }) => {
|
|
51
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, (mostUsed ?? []).map((item, index$1) => {
|
|
52
|
+
const { title, category, ...rest } = item;
|
|
53
|
+
if (index$1 > 3)
|
|
54
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, { key: `${title}-${category}` });
|
|
55
|
+
return /* @__PURE__ */ React.createElement(
|
|
56
|
+
index.Menubar.MostUsedItem,
|
|
57
|
+
{
|
|
58
|
+
key: `${title}-${category}`,
|
|
59
|
+
title,
|
|
60
|
+
category,
|
|
61
|
+
...rest
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
}));
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
module.exports = MostUsedList;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var menubar = require('../../styles/menubar.js');
|
|
5
|
+
|
|
6
|
+
const { right } = menubar.menubar();
|
|
7
|
+
const Right = ({ children, ...rest }) => {
|
|
8
|
+
return /* @__PURE__ */ React.createElement("div", { className: right(), "data-testid": "header-right-menubar", ...rest }, children);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
module.exports = Right;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var MenubarProvider = require('../../provider/MenubarProvider.js');
|
|
5
|
+
require('../../provider/SnackbarProvider.js');
|
|
6
|
+
|
|
7
|
+
const Root = ({ children, ...rest }) => {
|
|
8
|
+
return /* @__PURE__ */ React.createElement(MenubarProvider.MenubarProvider, null, /* @__PURE__ */ React.createElement("div", { ...rest }, children));
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
module.exports = Root;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var index = require('../Input/index.js');
|
|
5
|
+
var clsx = require('clsx');
|
|
6
|
+
var menubar = require('../../styles/menubar.js');
|
|
7
|
+
var MenubarProvider = require('../../provider/MenubarProvider.js');
|
|
8
|
+
require('../../provider/SnackbarProvider.js');
|
|
9
|
+
|
|
10
|
+
const Search = (props) => {
|
|
11
|
+
const [show] = MenubarProvider.useMenubar();
|
|
12
|
+
return /* @__PURE__ */ React.createElement(
|
|
13
|
+
index.Input.Search,
|
|
14
|
+
{
|
|
15
|
+
...props,
|
|
16
|
+
className: clsx("mr-tera flex-1", menubar.animate({ show }))
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
module.exports = Search;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var menubar = require('../../styles/menubar.js');
|
|
5
|
+
var ItemLink = require('./ItemLink.js');
|
|
6
|
+
|
|
7
|
+
const { container } = menubar.subItem();
|
|
8
|
+
const SubItem = ({ children, href, className, ...rest }) => {
|
|
9
|
+
return /* @__PURE__ */ React.createElement(ItemLink, { href }, /* @__PURE__ */ React.createElement(
|
|
10
|
+
"div",
|
|
11
|
+
{
|
|
12
|
+
...rest,
|
|
13
|
+
"data-testid": "sub-item-menubar",
|
|
14
|
+
className: container({ className })
|
|
15
|
+
},
|
|
16
|
+
children
|
|
17
|
+
));
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
module.exports = SubItem;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var Root = require('./Root.js');
|
|
4
|
+
var Left = require('./Left.js');
|
|
5
|
+
var Search = require('./Search.js');
|
|
6
|
+
var Right = require('./Right.js');
|
|
7
|
+
var Dropdown = require('./Dropdown.js');
|
|
8
|
+
var MostUsed = require('./MostUsed.js');
|
|
9
|
+
var MostUsedItem = require('./MostUsedItem.js');
|
|
10
|
+
var Header = require('./Header.js');
|
|
11
|
+
var Category = require('./Category.js');
|
|
12
|
+
var Item = require('./Item.js');
|
|
13
|
+
var Categories = require('./Categories.js');
|
|
14
|
+
var SubItem = require('./SubItem.js');
|
|
15
|
+
var DropdownRoot = require('./DropdownRoot.js');
|
|
16
|
+
|
|
17
|
+
const Menubar = {
|
|
18
|
+
Root,
|
|
19
|
+
Header,
|
|
20
|
+
HeaderLeft: Left,
|
|
21
|
+
Search,
|
|
22
|
+
HeaderRight: Right,
|
|
23
|
+
Dropdown,
|
|
24
|
+
MostUsed,
|
|
25
|
+
MostUsedItem,
|
|
26
|
+
Category,
|
|
27
|
+
Categories,
|
|
28
|
+
Item,
|
|
29
|
+
SubItem,
|
|
30
|
+
DropdownRoot
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
exports.Menubar = Menubar;
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var React = require('react');
|
|
4
3
|
var clsx = require('clsx');
|
|
5
|
-
var
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var Context = require('./Context.js');
|
|
6
6
|
|
|
7
|
-
const PopoverContent = ({
|
|
8
|
-
|
|
7
|
+
const PopoverContent = ({
|
|
8
|
+
children,
|
|
9
|
+
className
|
|
10
|
+
}) => {
|
|
11
|
+
const { isOpen, x, y, strategy, floatingStyles, refs } = Context.usePopoverContext();
|
|
9
12
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, isOpen ? /* @__PURE__ */ React.createElement(
|
|
10
13
|
"div",
|
|
11
14
|
{
|
|
12
15
|
ref: refs.setFloating,
|
|
13
16
|
className: clsx(
|
|
14
|
-
"border border-gray-200 bg-black
|
|
17
|
+
"border border-gray-200 bg-black p-[0px] rounded-md shadow-lg z-popover",
|
|
15
18
|
className
|
|
16
19
|
),
|
|
17
20
|
style: {
|
|
@@ -25,4 +28,4 @@ const PopoverContent = ({ children, className }) => {
|
|
|
25
28
|
) : /* @__PURE__ */ React.createElement(React.Fragment, null));
|
|
26
29
|
};
|
|
27
30
|
|
|
28
|
-
|
|
31
|
+
exports.PopoverContent = PopoverContent;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
|
|
5
|
+
const Context = React.createContext(void 0);
|
|
6
|
+
const usePopoverContext = () => {
|
|
7
|
+
const context = React.useContext(Context);
|
|
8
|
+
if (!context) {
|
|
9
|
+
throw new Error("usePopoverContext must be used within a PopoverProvider");
|
|
10
|
+
}
|
|
11
|
+
return context;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.Context = Context;
|
|
15
|
+
exports.usePopoverContext = usePopoverContext;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
require('@internationalized/date');
|
|
5
|
+
require('react-aria');
|
|
6
|
+
require('react-stately');
|
|
7
|
+
var useFloatingLogic = require('../../hooks/useFloatingLogic.js');
|
|
8
|
+
var Context = require('./Context.js');
|
|
9
|
+
|
|
10
|
+
const PopoverProvider = ({
|
|
11
|
+
children,
|
|
12
|
+
placement,
|
|
13
|
+
trigger
|
|
14
|
+
}) => {
|
|
15
|
+
const floatingLogic = useFloatingLogic.useFloatingLogic({ placement, trigger });
|
|
16
|
+
return /* @__PURE__ */ React.createElement(Context.Context.Provider, { value: { ...floatingLogic } }, children);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
exports.PopoverProvider = PopoverProvider;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var index = require('./index.js');
|
|
5
|
+
|
|
6
|
+
const PopoverRoot = ({
|
|
7
|
+
children,
|
|
8
|
+
placement,
|
|
9
|
+
trigger
|
|
10
|
+
}) => {
|
|
11
|
+
return /* @__PURE__ */ React.createElement(index.Popover.Provider, { placement, trigger }, children);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.PopoverRoot = PopoverRoot;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var utils = require('../utils.js');
|
|
4
|
+
var Context = require('./Context.js');
|
|
5
|
+
|
|
6
|
+
const PopoverTrigger = ({ children }) => {
|
|
7
|
+
const { triggerProps } = Context.usePopoverContext();
|
|
8
|
+
return utils.cloneWithProps(children, triggerProps);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
exports.PopoverTrigger = PopoverTrigger;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var Root = require('./Root.js');
|
|
4
|
+
var Trigger = require('./Trigger.js');
|
|
5
|
+
var Content = require('./Content.js');
|
|
6
|
+
var Provider = require('./Provider.js');
|
|
7
|
+
|
|
8
|
+
const Popover = {
|
|
9
|
+
Root: Root.PopoverRoot,
|
|
10
|
+
Trigger: Trigger.PopoverTrigger,
|
|
11
|
+
Content: Content.PopoverContent,
|
|
12
|
+
Provider: Provider.PopoverProvider
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
exports.Popover = Popover;
|
|
@@ -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;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
require('@internationalized/date');
|
|
5
|
+
require('react-aria');
|
|
6
|
+
require('react-stately');
|
|
7
|
+
require('@floating-ui/react');
|
|
8
|
+
var useOutsideClickListener = require('../../hooks/useOutsideClickListener.js');
|
|
9
|
+
var Context = require('../Popover/Context.js');
|
|
10
|
+
|
|
11
|
+
const Content = ({ children }) => {
|
|
12
|
+
const { setIsOpen } = Context.usePopoverContext();
|
|
13
|
+
const ref = React.useRef(null);
|
|
14
|
+
useOutsideClickListener.useOutsideClickListener({
|
|
15
|
+
ref,
|
|
16
|
+
onClickOutside: () => setIsOpen(false)
|
|
17
|
+
});
|
|
18
|
+
return /* @__PURE__ */ React.createElement("div", { className: "w-full relative bg-white", ref }, children);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
exports.Content = Content;
|
|
@@ -3,25 +3,35 @@
|
|
|
3
3
|
var cortexCore = require('@tecsinapse/cortex-core');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var index = require('./index.js');
|
|
6
|
+
require('@internationalized/date');
|
|
7
|
+
require('react-aria');
|
|
8
|
+
require('react-stately');
|
|
9
|
+
require('@floating-ui/react');
|
|
10
|
+
var useSelectGroupedOptions = require('../../hooks/useSelectGroupedOptions.js');
|
|
11
|
+
var Context = require('../Popover/Context.js');
|
|
12
|
+
var SkeletonOptions = require('./SkeletonOptions.js');
|
|
6
13
|
var context = require('./context.js');
|
|
7
14
|
|
|
8
|
-
const { groupedTitle,
|
|
15
|
+
const { groupedTitle, list } = cortexCore.selectVariants();
|
|
9
16
|
const SelectGroupedOptions = ({
|
|
10
17
|
onSelect,
|
|
11
18
|
groupedLabelExtractor,
|
|
12
19
|
options
|
|
13
20
|
}) => {
|
|
14
|
-
const {
|
|
21
|
+
const { keyExtractor } = React.useContext(context.SelectContext);
|
|
22
|
+
const { setIsOpen } = Context.usePopoverContext();
|
|
23
|
+
const { options: _options, isLoading } = useSelectGroupedOptions.useSelectGroupedOptions({ options });
|
|
15
24
|
const handleSelect = React.useCallback(
|
|
16
25
|
(option) => {
|
|
17
26
|
onSelect(option);
|
|
18
|
-
|
|
27
|
+
setIsOpen?.(false);
|
|
19
28
|
},
|
|
20
29
|
[onSelect]
|
|
21
30
|
);
|
|
22
|
-
return /* @__PURE__ */ React.createElement("ul", { role: "select", className:
|
|
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(
|
|
23
32
|
index.Select.Option,
|
|
24
33
|
{
|
|
34
|
+
grouped: true,
|
|
25
35
|
option,
|
|
26
36
|
key: keyExtractor(option),
|
|
27
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
|
+
var index = require('./index.js');
|
|
6
|
+
require('@internationalized/date');
|
|
7
|
+
require('react-aria');
|
|
8
|
+
require('react-stately');
|
|
9
|
+
require('@floating-ui/react');
|
|
10
|
+
var useSelectGroupedOptions = require('../../hooks/useSelectGroupedOptions.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
|
+
index.Select.MultiOption,
|
|
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
|
+
var index = require('./index.js');
|
|
6
|
+
require('@internationalized/date');
|
|
7
|
+
require('react-aria');
|
|
8
|
+
require('react-stately');
|
|
9
|
+
require('@floating-ui/react');
|
|
10
|
+
var useSelectOptions = require('../../hooks/useSelectOptions.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
|
+
index.Select.MultiOption,
|
|
25
|
+
{
|
|
26
|
+
option,
|
|
27
|
+
key: keyExtractor(option),
|
|
28
|
+
onSelectOption: (option2) => utils.handleSelectMulti(option2, currentValue, onSelect, keyExtractor)
|
|
29
|
+
}
|
|
30
|
+
))));
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
exports.SelectMultiOptions = SelectMultiOptions;
|