pixelize-design-library 2.4.2-beta.3 → 2.4.2-beta.30
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/Components/Accordion/Accordion.js +5 -3
- package/dist/Components/AppSwitcher/AppMark.d.ts +19 -0
- package/dist/Components/AppSwitcher/AppMark.js +62 -0
- package/dist/Components/AppSwitcher/AppSwitcher.d.ts +4 -0
- package/dist/Components/AppSwitcher/AppSwitcher.js +315 -0
- package/dist/Components/AppSwitcher/AppSwitcherProps.d.ts +64 -0
- package/dist/Components/AppSwitcher/AppSwitcherProps.js +86 -0
- package/dist/Components/AppSwitcher/useAppSwitcherShortcut.d.ts +3 -0
- package/dist/Components/AppSwitcher/useAppSwitcherShortcut.js +31 -0
- package/dist/Components/AppearanceSettings/AppearanceSettings.js +2 -1
- package/dist/Components/Button/Button.d.ts +2 -2
- package/dist/Components/Button/Button.js +4 -3
- package/dist/Components/Button/Button.styles.js +62 -15
- package/dist/Components/Button/ButtonProps.d.ts +6 -1
- package/dist/Components/ButtonGroupIcon/ButtonGroupIcon.js +6 -6
- package/dist/Components/Card/Card.d.ts +1 -1
- package/dist/Components/Card/Card.js +2 -2
- package/dist/Components/Card/CardProps.d.ts +0 -1
- package/dist/Components/Card/PaymentCard/PaymentCard.js +7 -7
- package/dist/Components/Checkbox/Checkbox.js +1 -1
- package/dist/Components/Checkbox/Checkbox.styles.js +12 -7
- package/dist/Components/Common/fieldStyles.js +1 -1
- package/dist/Components/CopyButton/CopyButton.js +6 -2
- package/dist/Components/CustomModulesTable/EditModuleModal.js +1 -1
- package/dist/Components/DatePicker/CalendarPanel.d.ts +5 -0
- package/dist/Components/DatePicker/CalendarPanel.js +24 -5
- package/dist/Components/DatePicker/DatePickerProps.d.ts +21 -0
- package/dist/Components/DatePicker/RangeDatePicker.js +4 -4
- package/dist/Components/DatePicker/SingleDatePicker.js +2 -2
- package/dist/Components/DatePicker/TimeOnlyPicker.js +1 -1
- package/dist/Components/DatePicker/dayStates.d.ts +56 -0
- package/dist/Components/DatePicker/dayStates.js +87 -0
- package/dist/Components/Dropdown/DropDown.js +7 -15
- package/dist/Components/EmailCards/VerifyEmailOtp/VerifyEmailOtp.js +1 -1
- package/dist/Components/EmptyState/EmptyState.js +2 -1
- package/dist/Components/FilePreview/FilePreview.js +1 -1
- package/dist/Components/FileUpload/FileUpload.js +5 -4
- package/dist/Components/FileUpload/FileUploadProps.d.ts +3 -1
- package/dist/Components/FileUpload/constants.js +1 -0
- package/dist/Components/FilterSidebar/FilterSidebar.js +4 -4
- package/dist/Components/FilterSidebar/filterHoverStyle.d.ts +0 -9
- package/dist/Components/FilterSidebar/filterHoverStyle.js +4 -10
- package/dist/Components/Form/FormWrapper.js +1 -1
- package/dist/Components/Header/components/mobileMenu.js +12 -3
- package/dist/Components/Input/TextInput.styles.js +6 -4
- package/dist/Components/InputTextArea/InputTextArea.style.js +5 -4
- package/dist/Components/KanbanBoard/KanbanBoard.js +5 -45
- package/dist/Components/LimitReachedModal/LimitReachedModal.js +4 -5
- package/dist/Components/Loading/Loading.js +15 -14
- package/dist/Components/MultiSelect/MultiSelect.js +1 -1
- package/dist/Components/NavigationBar/NavigationBar.js +3 -3
- package/dist/Components/NoteTextArea/NoteTextArea.js +9 -4
- package/dist/Components/NumberInput/NumberInput.js +3 -1
- package/dist/Components/NumberInput/NumberInput.styles.js +5 -4
- package/dist/Components/OrgSwitcher/OrgSwitcher.js +2 -2
- package/dist/Components/PdfViewer/PdfViewer.js +6 -1
- package/dist/Components/PinInput/PinInput.js +1 -1
- package/dist/Components/PlanPill/PlanPill.js +5 -5
- package/dist/Components/PlanPill/planPillGradient.d.ts +2 -14
- package/dist/Components/PlanPill/planPillGradient.js +3 -15
- package/dist/Components/Primitives/Primitives.d.ts +6 -0
- package/dist/Components/Primitives/Primitives.js +113 -0
- package/dist/Components/ProductCard/ProductPrice.js +1 -1
- package/dist/Components/ProductCard/ProductReview.js +6 -1
- package/dist/Components/ProductCard/ProductTags.js +1 -1
- package/dist/Components/ProfileCard/ProfileCard.js +1 -1
- package/dist/Components/ProfilePhotoViewer/ProfilePhotoViewer.js +1 -1
- package/dist/Components/RadioButton/RadioButton.js +3 -2
- package/dist/Components/Reorder/Reorder.js +1 -1
- package/dist/Components/ScrollToTop/ScrollToTop.js +2 -0
- package/dist/Components/ScrollbarBox/ScrollbarBox.d.ts +13 -0
- package/dist/Components/ScrollbarBox/ScrollbarBox.js +11 -0
- package/dist/Components/Search/Search.js +2 -2
- package/dist/Components/SearchSelect/SearchSelect.js +14 -9
- package/dist/Components/SegmentedControl/SegmentedControl.d.ts +2 -0
- package/dist/Components/SegmentedControl/SegmentedControl.js +58 -0
- package/dist/Components/SegmentedControl/SegmentedControlProps.d.ts +16 -0
- package/dist/Components/SegmentedControl/SegmentedControlProps.js +2 -0
- package/dist/Components/Select/Select.d.ts +1 -1
- package/dist/Components/Select/Select.js +4 -2
- package/dist/Components/Select/Select.styles.js +3 -2
- package/dist/Components/Select/SelectProps.d.ts +3 -0
- package/dist/Components/SelectSearch/SelectSearch.js +7 -4
- package/dist/Components/SelectV2/SelectV2.js +18 -14
- package/dist/Components/SideBar/SecondaryBar.js +1 -1
- package/dist/Components/SideBar/SideBar.js +1 -1
- package/dist/Components/SideBar/components/MenuPopoverContent.js +2 -2
- package/dist/Components/Slider/Slider.js +8 -1
- package/dist/Components/StageProgress/StageProgress.js +2 -9
- package/dist/Components/StageProgress/StepperStage.js +2 -2
- package/dist/Components/Table/Table.d.ts +1 -1
- package/dist/Components/Table/Table.js +17 -24
- package/dist/Components/Table/TableProps.d.ts +4 -0
- package/dist/Components/Table/components/Pagination.js +1 -1
- package/dist/Components/Table/components/TableActions.js +2 -2
- package/dist/Components/Table/components/TableBody.js +41 -12
- package/dist/Components/Table/components/TableGroupRow.js +1 -1
- package/dist/Components/Table/components/TableHeader.js +21 -8
- package/dist/Components/Table/components/TableSearch.js +1 -1
- package/dist/Components/Table/filters/ActiveFilters.js +2 -18
- package/dist/Components/Table/settings/ManageColumns.js +4 -17
- package/dist/Components/Table/settings/TableSettings.js +5 -11
- package/dist/Components/Table/variants/TableVariantContext.d.ts +4 -0
- package/dist/Components/Table/variants/TableVariantContext.js +17 -0
- package/dist/Components/Table/variants/classic.d.ts +6 -0
- package/dist/Components/Table/variants/classic.js +47 -0
- package/dist/Components/Table/variants/index.d.ts +7 -0
- package/dist/Components/Table/variants/index.js +27 -0
- package/dist/Components/Table/variants/pillInk.d.ts +6 -0
- package/dist/Components/Table/variants/pillInk.js +21 -0
- package/dist/Components/Table/variants/studio.d.ts +6 -0
- package/dist/Components/Table/variants/studio.js +50 -0
- package/dist/Components/Table/variants/tokens.d.ts +49 -0
- package/dist/Components/Table/variants/tokens.js +2 -0
- package/dist/Components/Tag/Tag.styles.js +3 -4
- package/dist/Components/Timeline/Timeline.js +2 -2
- package/dist/Components/Toaster/Toaster.js +1 -1
- package/dist/Components/Toggle/TableToggle.js +11 -7
- package/dist/Components/ToggleSwitch/ToggleSwitch.d.ts +2 -0
- package/dist/Components/ToggleSwitch/ToggleSwitch.js +18 -0
- package/dist/Components/ToggleSwitch/ToggleSwitchProps.d.ts +11 -0
- package/dist/Components/ToggleSwitch/ToggleSwitchProps.js +2 -0
- package/dist/Components/ToolTip/ToolTip.js +6 -6
- package/dist/Components/ToolTip/ToolTipProps.d.ts +3 -1
- package/dist/Components/Trail/TrailWorks.js +1 -1
- package/dist/Components/UpgradeButton/UpgradeButton.js +3 -3
- package/dist/Constants/Sidebar.js +3 -2
- package/dist/Theme/assertPalette.d.ts +1 -1
- package/dist/Theme/assertPalette.js +3 -2
- package/dist/Theme/chakra/Menu.styles.d.ts +3 -0
- package/dist/Theme/chakra/Menu.styles.js +5 -0
- package/dist/Theme/chakra/Popover.styles.d.ts +3 -0
- package/dist/Theme/chakra/Popover.styles.js +5 -1
- package/dist/Theme/chakra/componentStyles.d.ts +6 -0
- package/dist/Theme/chakra/createBrandTheme.js +10 -16
- package/dist/Theme/chakra/focusRing.styles.d.ts +52 -0
- package/dist/Theme/chakra/focusRing.styles.js +46 -0
- package/dist/Theme/provider/ThemeSwitcher.js +5 -2
- package/dist/Theme/tokens/brands/index.js +6 -1
- package/dist/Theme/tokens/brands/zinc/palette.dark.d.ts +1 -0
- package/dist/Theme/tokens/builders/buildDarkPalette.js +6 -1
- package/dist/Theme/tokens/builders/chartColorsFromTheme.js +1 -1
- package/dist/Theme/tokens/builders/focusRing.d.ts +52 -0
- package/dist/Theme/tokens/builders/focusRing.js +92 -0
- package/dist/Theme/tokens/builders/gradientInk.d.ts +22 -0
- package/dist/Theme/tokens/builders/gradientInk.js +28 -0
- package/dist/Theme/tokens/builders/index.d.ts +4 -0
- package/dist/Theme/tokens/builders/index.js +4 -0
- package/dist/Theme/tokens/builders/outlineRung.d.ts +46 -3
- package/dist/Theme/tokens/builders/outlineRung.js +101 -5
- package/dist/Theme/tokens/builders/placeholderInk.d.ts +19 -0
- package/dist/Theme/tokens/builders/placeholderInk.js +35 -0
- package/dist/Theme/tokens/builders/resolvedRungs.d.ts +5 -1
- package/dist/Theme/tokens/builders/resolvedRungs.js +7 -2
- package/dist/Theme/tokens/builders/rowStates.d.ts +13 -0
- package/dist/Theme/tokens/builders/rowStates.js +19 -0
- package/dist/Theme/tokens/builders/scrollbar.d.ts +12 -0
- package/dist/Theme/tokens/builders/scrollbar.js +57 -0
- package/dist/Theme/tokens/builders/surfaceRungs.d.ts +5 -0
- package/dist/Theme/tokens/builders/surfaceRungs.js +20 -5
- package/dist/Theme/tokens/types.d.ts +21 -1
- package/dist/esm/Components/Accordion/Accordion.js +5 -3
- package/dist/esm/Components/AppSwitcher/AppMark.js +56 -0
- package/dist/esm/Components/AppSwitcher/AppSwitcher.js +280 -0
- package/dist/esm/Components/AppSwitcher/AppSwitcherProps.js +78 -0
- package/dist/esm/Components/AppSwitcher/useAppSwitcherShortcut.js +27 -0
- package/dist/esm/Components/AppearanceSettings/AppearanceSettings.js +2 -1
- package/dist/esm/Components/Button/Button.js +5 -4
- package/dist/esm/Components/Button/Button.styles.js +63 -16
- package/dist/esm/Components/ButtonGroupIcon/ButtonGroupIcon.js +6 -6
- package/dist/esm/Components/Card/Card.js +2 -2
- package/dist/esm/Components/Card/PaymentCard/PaymentCard.js +7 -7
- package/dist/esm/Components/Checkbox/Checkbox.js +1 -1
- package/dist/esm/Components/Checkbox/Checkbox.styles.js +13 -8
- package/dist/esm/Components/Common/fieldStyles.js +1 -1
- package/dist/esm/Components/CopyButton/CopyButton.js +7 -3
- package/dist/esm/Components/CustomModulesTable/EditModuleModal.js +1 -1
- package/dist/esm/Components/DatePicker/CalendarPanel.js +24 -5
- package/dist/esm/Components/DatePicker/RangeDatePicker.js +4 -4
- package/dist/esm/Components/DatePicker/SingleDatePicker.js +2 -2
- package/dist/esm/Components/DatePicker/TimeOnlyPicker.js +1 -1
- package/dist/esm/Components/DatePicker/dayStates.js +79 -0
- package/dist/esm/Components/Dropdown/DropDown.js +7 -15
- package/dist/esm/Components/EmailCards/VerifyEmailOtp/VerifyEmailOtp.js +1 -1
- package/dist/esm/Components/EmptyState/EmptyState.js +2 -1
- package/dist/esm/Components/FilePreview/FilePreview.js +1 -1
- package/dist/esm/Components/FileUpload/FileUpload.js +6 -5
- package/dist/esm/Components/FileUpload/constants.js +1 -0
- package/dist/esm/Components/FilterSidebar/FilterSidebar.js +4 -4
- package/dist/esm/Components/FilterSidebar/filterHoverStyle.js +4 -10
- package/dist/esm/Components/Form/FormWrapper.js +1 -1
- package/dist/esm/Components/Header/components/mobileMenu.js +12 -3
- package/dist/esm/Components/Input/TextInput.styles.js +6 -4
- package/dist/esm/Components/InputTextArea/InputTextArea.style.js +5 -4
- package/dist/esm/Components/KanbanBoard/KanbanBoard.js +5 -45
- package/dist/esm/Components/LimitReachedModal/LimitReachedModal.js +4 -5
- package/dist/esm/Components/Loading/Loading.js +12 -11
- package/dist/esm/Components/MultiSelect/MultiSelect.js +1 -1
- package/dist/esm/Components/NavigationBar/NavigationBar.js +3 -3
- package/dist/esm/Components/NoteTextArea/NoteTextArea.js +9 -4
- package/dist/esm/Components/NumberInput/NumberInput.js +4 -2
- package/dist/esm/Components/NumberInput/NumberInput.styles.js +5 -4
- package/dist/esm/Components/OrgSwitcher/OrgSwitcher.js +2 -2
- package/dist/esm/Components/PdfViewer/PdfViewer.js +6 -1
- package/dist/esm/Components/PinInput/PinInput.js +1 -1
- package/dist/esm/Components/PlanPill/PlanPill.js +6 -6
- package/dist/esm/Components/PlanPill/planPillGradient.js +3 -15
- package/dist/esm/Components/Primitives/Primitives.js +6 -0
- package/dist/esm/Components/ProductCard/ProductPrice.js +1 -1
- package/dist/esm/Components/ProductCard/ProductReview.js +6 -1
- package/dist/esm/Components/ProductCard/ProductTags.js +1 -1
- package/dist/esm/Components/ProfileCard/ProfileCard.js +1 -1
- package/dist/esm/Components/ProfilePhotoViewer/ProfilePhotoViewer.js +1 -1
- package/dist/esm/Components/RadioButton/RadioButton.js +3 -2
- package/dist/esm/Components/Reorder/Reorder.js +1 -1
- package/dist/esm/Components/ScrollToTop/ScrollToTop.js +2 -0
- package/dist/esm/Components/ScrollbarBox/ScrollbarBox.js +9 -0
- package/dist/esm/Components/Search/Search.js +2 -2
- package/dist/esm/Components/SearchSelect/SearchSelect.js +14 -9
- package/dist/esm/Components/SegmentedControl/SegmentedControl.js +55 -0
- package/dist/esm/Components/SegmentedControl/SegmentedControlProps.js +1 -0
- package/dist/esm/Components/Select/Select.js +5 -3
- package/dist/esm/Components/Select/Select.styles.js +3 -2
- package/dist/esm/Components/SelectSearch/SelectSearch.js +7 -4
- package/dist/esm/Components/SelectV2/SelectV2.js +18 -14
- package/dist/esm/Components/SideBar/SecondaryBar.js +1 -1
- package/dist/esm/Components/SideBar/SideBar.js +1 -1
- package/dist/esm/Components/SideBar/components/MenuPopoverContent.js +2 -2
- package/dist/esm/Components/Slider/Slider.js +8 -1
- package/dist/esm/Components/StageProgress/StageProgress.js +2 -9
- package/dist/esm/Components/StageProgress/StepperStage.js +2 -2
- package/dist/esm/Components/Table/Table.js +17 -24
- package/dist/esm/Components/Table/components/Pagination.js +1 -1
- package/dist/esm/Components/Table/components/TableActions.js +2 -2
- package/dist/esm/Components/Table/components/TableBody.js +42 -13
- package/dist/esm/Components/Table/components/TableGroupRow.js +1 -1
- package/dist/esm/Components/Table/components/TableHeader.js +21 -8
- package/dist/esm/Components/Table/components/TableSearch.js +1 -1
- package/dist/esm/Components/Table/filters/ActiveFilters.js +2 -18
- package/dist/esm/Components/Table/settings/ManageColumns.js +4 -17
- package/dist/esm/Components/Table/settings/TableSettings.js +5 -11
- package/dist/esm/Components/Table/variants/TableVariantContext.js +13 -0
- package/dist/esm/Components/Table/variants/classic.js +43 -0
- package/dist/esm/Components/Table/variants/index.js +9 -0
- package/dist/esm/Components/Table/variants/pillInk.js +18 -0
- package/dist/esm/Components/Table/variants/studio.js +46 -0
- package/dist/esm/Components/Table/variants/tokens.js +1 -0
- package/dist/esm/Components/Tag/Tag.styles.js +3 -4
- package/dist/esm/Components/Timeline/Timeline.js +2 -2
- package/dist/esm/Components/Toaster/Toaster.js +1 -1
- package/dist/esm/Components/Toggle/TableToggle.js +11 -7
- package/dist/esm/Components/ToggleSwitch/ToggleSwitch.js +15 -0
- package/dist/esm/Components/ToggleSwitch/ToggleSwitchProps.js +1 -0
- package/dist/esm/Components/ToolTip/ToolTip.js +6 -6
- package/dist/esm/Components/Trail/TrailWorks.js +1 -1
- package/dist/esm/Components/UpgradeButton/UpgradeButton.js +3 -3
- package/dist/esm/Constants/Sidebar.js +3 -2
- package/dist/esm/Theme/assertPalette.js +3 -2
- package/dist/esm/Theme/chakra/Menu.styles.js +5 -0
- package/dist/esm/Theme/chakra/Popover.styles.js +5 -1
- package/dist/esm/Theme/chakra/createBrandTheme.js +10 -16
- package/dist/esm/Theme/chakra/focusRing.styles.js +40 -0
- package/dist/esm/Theme/provider/ThemeSwitcher.js +5 -2
- package/dist/esm/Theme/tokens/brands/index.js +6 -1
- package/dist/esm/Theme/tokens/builders/buildDarkPalette.js +6 -1
- package/dist/esm/Theme/tokens/builders/chartColorsFromTheme.js +1 -1
- package/dist/esm/Theme/tokens/builders/focusRing.js +85 -0
- package/dist/esm/Theme/tokens/builders/gradientInk.js +22 -0
- package/dist/esm/Theme/tokens/builders/index.js +4 -0
- package/dist/esm/Theme/tokens/builders/outlineRung.js +96 -4
- package/dist/esm/Theme/tokens/builders/placeholderInk.js +29 -0
- package/dist/esm/Theme/tokens/builders/resolvedRungs.js +7 -2
- package/dist/esm/Theme/tokens/builders/rowStates.js +15 -0
- package/dist/esm/Theme/tokens/builders/scrollbar.js +52 -0
- package/dist/esm/Theme/tokens/builders/surfaceRungs.js +20 -5
- package/dist/esm/index.js +24 -1
- package/dist/index.d.ts +27 -3
- package/dist/index.js +64 -4
- package/package.json +8 -2
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback } from "react";
|
|
2
|
+
import { useCallback, useId } from "react";
|
|
3
3
|
import { Select as ChakraSelect, FormControl } from "@chakra-ui/react";
|
|
4
4
|
import { getTextInputIconSizePx } from "../Input/textInputIconSize.js";
|
|
5
5
|
import { TextLabel } from "../Common/FormLabel.js";
|
|
6
6
|
import ErrorMessage from "../Common/ErrorMessage.js";
|
|
7
7
|
import HelperText from "../Common/HelperText.js";
|
|
8
|
-
export default function Select({ placeholder = "Select Option", size = "md", variant = "outline", icon, onChange, onBlur, onFocus, errorBorderColor, isDisabled, isReadOnly, isRequired = false, value = "", colorScheme, label, error, errorMessage, helperText, options = [], height, formControlStyle, isInformation = false, informationMessage, selectStyle, }) {
|
|
8
|
+
export default function Select({ placeholder = "Select Option", size = "md", variant = "outline", icon, onChange, onBlur, onFocus, errorBorderColor, isDisabled, isReadOnly, isRequired = false, value = "", colorScheme, label, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, error, errorMessage, helperText, options = [], height, formControlStyle, isInformation = false, informationMessage, selectStyle, }) {
|
|
9
9
|
const sizeKey = typeof size === "string" ? size : "md";
|
|
10
10
|
const iconSizePx = getTextInputIconSizePx(sizeKey);
|
|
11
|
+
const generatedId = useId();
|
|
12
|
+
const selectId = id !== null && id !== void 0 ? id : (label ? generatedId : undefined);
|
|
11
13
|
const getOptionsList = useCallback(() => {
|
|
12
14
|
if (!options.length)
|
|
13
15
|
return _jsx("option", { value: "", children: "No Options" });
|
|
@@ -20,5 +22,5 @@ export default function Select({ placeholder = "Select Option", size = "md", var
|
|
|
20
22
|
onChange(selectedOption);
|
|
21
23
|
}
|
|
22
24
|
};
|
|
23
|
-
return (_jsxs(FormControl, { isInvalid: error, style: formControlStyle, size: size, children: [label && (_jsx(TextLabel, { label: label, isRequired: isRequired, isInformation: isInformation, informationMessage: informationMessage })), _jsx(ChakraSelect, { placeholder: placeholder, size: size, variant: variant, icon: icon, iconSize: `${iconSizePx}px`, isInvalid: error, value: value, onChange: handleOnChange, onBlur: onBlur, onFocus: onFocus, isDisabled: isDisabled, isReadOnly: isReadOnly, colorScheme: colorScheme, errorBorderColor: errorBorderColor, style: selectStyle, ...(height != null && height !== "" ? { minH: height, h: height } : {}), children: getOptionsList() }), error && _jsx(ErrorMessage, { errorMessage: errorMessage }), helperText && !error && _jsx(HelperText, { helperText: helperText })] }));
|
|
25
|
+
return (_jsxs(FormControl, { isInvalid: error, style: formControlStyle, size: size, children: [label && (_jsx(TextLabel, { label: label, id: selectId, isRequired: isRequired, isInformation: isInformation, informationMessage: informationMessage })), _jsx(ChakraSelect, { id: selectId, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, placeholder: placeholder, size: size, variant: variant, icon: icon, iconSize: `${iconSizePx}px`, isInvalid: error, value: value, onChange: handleOnChange, onBlur: onBlur, onFocus: onFocus, isDisabled: isDisabled, isReadOnly: isReadOnly, colorScheme: colorScheme, errorBorderColor: errorBorderColor, style: selectStyle, ...(height != null && height !== "" ? { minH: height, h: height } : {}), children: getOptionsList() }), error && _jsx(ErrorMessage, { errorMessage: errorMessage }), helperText && !error && _jsx(HelperText, { helperText: helperText })] }));
|
|
24
26
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { placeholderInk } from "../../Theme/tokens/builders/placeholderInk.js";
|
|
1
2
|
export const Select = {
|
|
2
3
|
baseStyle: ({ theme }) => ({
|
|
3
4
|
field: {
|
|
@@ -16,7 +17,7 @@ export const Select = {
|
|
|
16
17
|
width: "100%", // full container width
|
|
17
18
|
maxWidth: "100%",
|
|
18
19
|
_placeholder: {
|
|
19
|
-
|
|
20
|
+
color: placeholderInk(theme.colors),
|
|
20
21
|
whiteSpace: "nowrap",
|
|
21
22
|
overflow: "hidden",
|
|
22
23
|
textOverflow: "ellipsis",
|
|
@@ -60,7 +61,7 @@ export const Select = {
|
|
|
60
61
|
// [800], not [500]/[700]: WCAG 1.4.11 needs >=3.0 for a control boundary, measured
|
|
61
62
|
// against the parent surface — up to `muted` (lightest). [700] fails there (2.41-2.72);
|
|
62
63
|
// [800] clears all named surfaces with margin (3.44-3.90).
|
|
63
|
-
const borderColor = theme.colors.boxborder[
|
|
64
|
+
const borderColor = theme.colors.boxborder[500];
|
|
64
65
|
const shadowPrimary = theme.colors.boxShadow.primary;
|
|
65
66
|
const shadowError = theme.colors.boxShadow.error;
|
|
66
67
|
const primary = theme.colors.primary[500];
|
|
@@ -4,6 +4,7 @@ import { Box, Input, Spinner, VStack, Text, InputGroup, InputRightElement, HStac
|
|
|
4
4
|
import { TextLabel } from "../Common/FormLabel.js";
|
|
5
5
|
import { FIELD_RADIUS, fieldFocusRing } from "../Common/fieldStyles.js";
|
|
6
6
|
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
7
|
+
import { resolveHoverTint } from "../../Theme/tokens/builders/outlineRung.js";
|
|
7
8
|
import { PlusIcon } from "lucide-react";
|
|
8
9
|
import ErrorMessage from "../Common/ErrorMessage.js";
|
|
9
10
|
const RenderOptions = ({ isOptionLoading, filteredOptions, loadingText, handleOptionClick, isProfile, isColorOptions, isOptionSelected, activeIndex, optionRefs, }) => {
|
|
@@ -14,7 +15,9 @@ const RenderOptions = ({ isOptionLoading, filteredOptions, loadingText, handleOp
|
|
|
14
15
|
if (filteredOptions === null || filteredOptions === void 0 ? void 0 : filteredOptions.length) {
|
|
15
16
|
return (_jsx(_Fragment, { children: filteredOptions.map((option, index) => (_jsxs(Box, { as: "button", type: "button", ref: (el) => {
|
|
16
17
|
optionRefs.current[index] = el;
|
|
17
|
-
}, role: "option", "aria-selected": isOptionSelected(option), tabIndex: index === activeIndex ? 0 : -1, w: "100%", textAlign: "left", border: "none", fontFamily: "inherit", bg: "transparent", px: 4, py: 2, cursor: "pointer", _hover: {
|
|
18
|
+
}, role: "option", "aria-selected": isOptionSelected(option), tabIndex: index === activeIndex ? 0 : -1, w: "100%", textAlign: "left", border: "none", fontFamily: "inherit", bg: "transparent", px: 4, py: 2, cursor: "pointer", _hover: {
|
|
19
|
+
backgroundColor: resolveHoverTint(theme.colors.primary[500], theme.colors.background[50]),
|
|
20
|
+
}, onClick: () => handleOptionClick(option), onKeyDown: (e) => {
|
|
18
21
|
if (e.key === "Enter" || e.key === " ") {
|
|
19
22
|
e.preventDefault();
|
|
20
23
|
handleOptionClick(option);
|
|
@@ -30,7 +33,7 @@ BottomIcon = false, BottomText, handleBottomClick, BottomTextColor, isColorOptio
|
|
|
30
33
|
const errorBorder = `2px solid ${theme.colors.semanticText.error}`;
|
|
31
34
|
// [800], not [500]: WCAG 1.4.11 needs >=3.0 for a control boundary against any named surface
|
|
32
35
|
// up to `muted` (lightest); [500] fails there, [800] clears all with margin.
|
|
33
|
-
const defaultBorderThin = `1px solid ${theme.colors.boxborder[
|
|
36
|
+
const defaultBorderThin = `1px solid ${theme.colors.boxborder[500]}`;
|
|
34
37
|
const [selectedOptions, setSelectedOptions] = useState(initialSelectedOption ? [initialSelectedOption] : []);
|
|
35
38
|
const [inputValue, setInputValue] = useState(searchQuery);
|
|
36
39
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -246,7 +249,7 @@ BottomIcon = false, BottomText, handleBottomClick, BottomTextColor, isColorOptio
|
|
|
246
249
|
return;
|
|
247
250
|
}
|
|
248
251
|
setIsOpen(true);
|
|
249
|
-
}, onChange: (e) => handleInputChange(e.target.value), placeholder: placeholder, onKeyDown: handleKeyDown, id: id, name: name, role: "combobox", "aria-autocomplete": "list", "aria-haspopup": "listbox", "aria-expanded": isOpen, "aria-controls": listboxId, cursor: "pointer", borderColor: theme.colors.boxborder[
|
|
252
|
+
}, onChange: (e) => handleInputChange(e.target.value), placeholder: placeholder, onKeyDown: handleKeyDown, id: id, name: name, role: "combobox", "aria-autocomplete": "list", "aria-haspopup": "listbox", "aria-expanded": isOpen, "aria-controls": listboxId, cursor: "pointer", borderColor: theme.colors.boxborder[500], transition: "border-color 0.2s, box-shadow 0.2s", _hover: {
|
|
250
253
|
borderColor: error
|
|
251
254
|
? theme.colors.semanticText.error
|
|
252
255
|
: theme.colors.primary[500],
|
|
@@ -264,7 +267,7 @@ BottomIcon = false, BottomText, handleBottomClick, BottomTextColor, isColorOptio
|
|
|
264
267
|
fontSize: 15,
|
|
265
268
|
letterSpacing: 0.7,
|
|
266
269
|
border: error ? errorBorder : defaultBorderThin,
|
|
267
|
-
} }), rightIcon && (_jsx(InputRightElement, { pointerEvents: "none", children: rightIcon, style: { ...rightElementStyle } }))] }), isOpen && (_jsxs(Box, { ref: dropdownRef, marginTop: "5px", position: "absolute", top: position === "below" ? "100%" : "auto", bottom: position === "above" ? "100%" : "auto", left: 0, right: 0, border: "1px solid", borderColor: theme.colors.boxborder[
|
|
270
|
+
} }), rightIcon && (_jsx(InputRightElement, { pointerEvents: "none", children: rightIcon, style: { ...rightElementStyle } }))] }), isOpen && (_jsxs(Box, { ref: dropdownRef, marginTop: "5px", position: "absolute", top: position === "below" ? "100%" : "auto", bottom: position === "above" ? "100%" : "auto", left: 0, right: 0, border: "1px solid", borderColor: theme.colors.boxborder[200], borderRadius: "md", bg: theme.colors.background[50], maxHeight: "150px", overflowY: "auto", zIndex: 10, children: [_jsx(Box, { id: listboxId, role: "listbox", "aria-label": label !== null && label !== void 0 ? label : placeholder, onKeyDown: handleListKeyDown, children: _jsx(RenderOptions, { isOptionLoading: isOptionLoading, filteredOptions: filteredOptions, loadingText: loadingText, handleOptionClick: handleOptionClick, isProfile: isProfile, isColorOptions: isColorOptions, isOptionSelected: isOptionSelected, activeIndex: activeIndex, optionRefs: optionRefs }) }), _jsx("hr", {}), isBottomIcon && (_jsxs(Box, { position: "sticky", bottom: 0, background: theme.colors.background[50], display: "flex", alignItems: "center", pl: "1rem", cursor: "pointer", onClick: handleBottomClick, borderColor: theme.colors.boxborder[200], zIndex: 1, borderTop: `1px solid ${theme.colors.boxborder[200]}`, children: [_jsx(Box, { children: BottomIcon ? BottomIcon : _jsx(PlusIcon, { size: "1rem" }) }), _jsx(Box, { fontSize: "0.875rem", color: BottomTextColor
|
|
268
271
|
? BottomTextColor
|
|
269
272
|
: theme.colors.accentText, padding: "8px 8px", children: BottomText || "Add New" })] }))] })), error && _jsx(ErrorMessage, { errorMessage: errorMessage })] }) }) }));
|
|
270
273
|
}
|
|
@@ -3,6 +3,9 @@ import React, { useCallback, useEffect, useId, useMemo, useRef, useState } from
|
|
|
3
3
|
import { Box, Checkbox, FormControl, Input, Popover, PopoverAnchor, PopoverContent, Portal, useDisclosure, } from "@chakra-ui/react";
|
|
4
4
|
import { ChevronDown } from "lucide-react";
|
|
5
5
|
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
6
|
+
import { placeholderInk } from "../../Theme/tokens/builders/placeholderInk.js";
|
|
7
|
+
import { listRowBackgrounds } from "../../Theme/tokens/builders/rowStates.js";
|
|
8
|
+
import { scrollbarStyles } from "../../Theme/tokens/builders/scrollbar.js";
|
|
6
9
|
import { getFieldStateStyles } from "../Common/fieldStyles.js";
|
|
7
10
|
import { TextLabel } from "../Common/FormLabel.js";
|
|
8
11
|
import ErrorMessage from "../Common/ErrorMessage.js";
|
|
@@ -16,13 +19,19 @@ const SIZE_MAP = {
|
|
|
16
19
|
const asIdSet = (values) => new Set((values !== null && values !== void 0 ? values : []).map((v) => v.toString()));
|
|
17
20
|
// Derived from the option's own id (not its index) so it stays stable across filtering/reordering.
|
|
18
21
|
const optionDomId = (listboxId, id) => `${listboxId}-option-${id.toString().replace(/[^a-zA-Z0-9_-]/g, "-")}`;
|
|
19
|
-
const OptionRow = React.memo(function OptionRow({ option, index, listboxId, isSelected, isActive, isMulti, theme, renderOption, onSelect, onActivate, }) {
|
|
22
|
+
const OptionRow = React.memo(function OptionRow({ option, index, listboxId, isSelected, isActive, isMulti, theme, backgrounds, renderOption, onSelect, onActivate, }) {
|
|
20
23
|
return (_jsxs(Box, { id: optionDomId(listboxId, option.id), "data-index": index, role: "option", "aria-selected": isSelected, "aria-disabled": option.isDisabled, onMouseEnter: () => onActivate(index), onClick: () => onSelect(option), mx: 1.5, px: 2.5, py: 1.5, borderRadius: "md", cursor: option.isDisabled ? "not-allowed" : "pointer", opacity: option.isDisabled ? 0.4 : 1, display: "flex", alignItems: "center", gap: 2, fontSize: "0.8125rem", fontWeight: isSelected && !isMulti ? 600 : 500, color: isSelected && !isMulti
|
|
21
24
|
? theme.colors.accentText
|
|
22
|
-
: theme.colors.text[700], bg:
|
|
25
|
+
: theme.colors.text[700], bg: isSelected && !isMulti
|
|
26
|
+
? isActive
|
|
27
|
+
? backgrounds.selectedActive
|
|
28
|
+
: backgrounds.selected
|
|
29
|
+
: isActive
|
|
30
|
+
? backgrounds.active
|
|
31
|
+
: "transparent", transition: "background 0.12s ease, color 0.12s ease", children: [isMulti ? (_jsx(Checkbox, { isChecked: isSelected, isDisabled: option.isDisabled, pointerEvents: "none", tabIndex: -1 })) : null, renderOption ? (_jsx(Box, { flex: 1, minW: 0, children: renderOption(option, { isSelected, isActive }) })) : (_jsxs(_Fragment, { children: [option.icon ? (_jsx(Box, { as: "span", display: "inline-flex", flexShrink: 0, children: option.icon })) : null, _jsxs(Box, { flex: 1, minW: 0, isTruncated: true, children: [_jsx(Box, { as: "span", isTruncated: true, children: option.label }), option.description ? (_jsx(Box, { as: "span", display: "block", fontSize: "0.75rem", fontWeight: 400, color: theme.colors.textMuted, isTruncated: true, children: option.description })) : null] })] }))] }));
|
|
23
32
|
});
|
|
24
33
|
export default function SelectV2(props) {
|
|
25
|
-
var _a, _b
|
|
34
|
+
var _a, _b;
|
|
26
35
|
const { options = [], placeholder = "Select Option", label, error = false, errorMessage, helperText, isDisabled = false, isRequired = false, size = "md", isSearchable = true, width, formControlStyle, onBlur, onFocus, renderOption, renderValue, maxMenuHeight = "16rem", defaultOpen = false, "data-testid": dataTestId, "aria-label": ariaLabel, } = props;
|
|
27
36
|
const theme = useCustomTheme();
|
|
28
37
|
const { isOpen, onOpen, onClose } = useDisclosure({ defaultIsOpen: defaultOpen });
|
|
@@ -192,15 +201,10 @@ export default function SelectV2(props) {
|
|
|
192
201
|
const triggerId = `selectv2-trigger-${instanceId}`;
|
|
193
202
|
const activeOption = filteredOptions[activeIndex];
|
|
194
203
|
const activeDescendantId = activeOption ? optionDomId(listboxId, activeOption.id) : undefined;
|
|
195
|
-
const listScrollStyles = useMemo(() => (
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
"&::-webkit-scrollbar-thumb": {
|
|
200
|
-
background: theme.colors.gray[300],
|
|
201
|
-
borderRadius: "base",
|
|
202
|
-
},
|
|
203
|
-
}), [theme]);
|
|
204
|
+
const listScrollStyles = useMemo(() => scrollbarStyles(theme.colors, "overlay"), [theme]);
|
|
205
|
+
// primary[500] is the filled-button rung, so resolveHoverTint short-circuited and every hovered
|
|
206
|
+
// row became a solid brand fill under unresolved ink.
|
|
207
|
+
const rowBackgrounds = useMemo(() => listRowBackgrounds(theme.colors), [theme]);
|
|
204
208
|
const defaultTriggerContent = () => {
|
|
205
209
|
var _a;
|
|
206
210
|
if (props.isMulti) {
|
|
@@ -215,11 +219,11 @@ export default function SelectV2(props) {
|
|
|
215
219
|
return selectedOptions[0] ? selectedOptions[0].label : placeholder;
|
|
216
220
|
};
|
|
217
221
|
const triggerIcon = !props.isMulti && ((_b = selectedOptions[0]) === null || _b === void 0 ? void 0 : _b.icon) ? selectedOptions[0].icon : null;
|
|
218
|
-
return (_jsxs(FormControl, { isInvalid: error, isDisabled: isDisabled, style: formControlStyle, width: width, children: [label && (_jsx(TextLabel, { label: label, id: triggerId, isRequired: isRequired })), _jsxs(Popover, { isOpen: isOpen, onClose: () => resetAndClose(), placement: "bottom-start", matchWidth: true, autoFocus: false, returnFocusOnClose: false, gutter: 4, children: [_jsx(PopoverAnchor, { children: _jsxs(Box, { as: "button", type: "button", id: triggerId, ref: triggerRef, role: "combobox", "aria-haspopup": "listbox", "aria-expanded": isOpen, "aria-controls": listboxId, "aria-activedescendant": activeDescendantId, "aria-disabled": isDisabled, "aria-label": ariaLabel, disabled: isDisabled, onClick: handleOpen, onKeyDown: handleTriggerKeyDown, display: "flex", alignItems: "center", justifyContent: "space-between", width: "100%", h: s.h, px: s.px, fontSize: s.fontSize, fontWeight: 500, textAlign: "left", cursor: isDisabled ? "not-allowed" : "pointer", opacity: isDisabled ? 0.4 : 1, color: selectedOptions.length ? theme.colors.text[900] : theme.colors
|
|
222
|
+
return (_jsxs(FormControl, { isInvalid: error, isDisabled: isDisabled, style: formControlStyle, width: width, children: [label && (_jsx(TextLabel, { label: label, id: triggerId, isRequired: isRequired })), _jsxs(Popover, { isOpen: isOpen, onClose: () => resetAndClose(), placement: "bottom-start", matchWidth: true, autoFocus: false, returnFocusOnClose: false, gutter: 4, children: [_jsx(PopoverAnchor, { children: _jsxs(Box, { as: "button", type: "button", id: triggerId, ref: triggerRef, role: "combobox", "aria-haspopup": "listbox", "aria-expanded": isOpen, "aria-controls": listboxId, "aria-activedescendant": activeDescendantId, "aria-disabled": isDisabled, "aria-label": ariaLabel, disabled: isDisabled, onClick: handleOpen, onKeyDown: handleTriggerKeyDown, display: "flex", alignItems: "center", justifyContent: "space-between", width: "100%", h: s.h, px: s.px, fontSize: s.fontSize, fontWeight: 500, textAlign: "left", cursor: isDisabled ? "not-allowed" : "pointer", opacity: isDisabled ? 0.4 : 1, color: selectedOptions.length ? theme.colors.text[900] : placeholderInk(theme.colors), "data-testid": dataTestId, ...fieldStyles, children: [_jsxs(Box, { as: "span", display: "inline-flex", alignItems: "center", gap: 1.5, minW: 0, isTruncated: true, children: [triggerIcon ? (_jsx(Box, { as: "span", display: "inline-flex", flexShrink: 0, children: triggerIcon })) : null, _jsx(Box, { as: "span", isTruncated: true, children: renderValue ? renderValue(selectedOptions) : defaultTriggerContent() })] }), _jsx(Box, { as: "span", display: "inline-flex", flexShrink: 0, ml: 2, transition: "transform 0.2s ease", transform: isOpen ? "rotate(180deg)" : "rotate(0deg)", color: theme.colors.textMuted, children: _jsx(ChevronDown, { size: 16 }) })] }) }), _jsx(Portal, { children: _jsxs(PopoverContent, { width: "100%", borderRadius: "xl", boxShadow: theme.shadows.lg, overflow: "hidden", onKeyDown: handleListKeyDown, children: [isSearchable && (_jsx(Box, { p: 2, borderBottom: `0.063rem solid ${theme.colors.boxborder[200]}`, children: _jsx(Input, { ref: filterInputRef, size: "sm", placeholder: "Type to filter...", value: filterText, onChange: (event) => {
|
|
219
223
|
setFilterText(event.target.value);
|
|
220
224
|
setActiveIndex(0);
|
|
221
225
|
}, "aria-activedescendant": activeDescendantId, "aria-label": "Filter options" }) })), _jsxs(Box, { id: listboxId, ref: listRef, role: "listbox", "aria-multiselectable": props.isMulti || undefined, maxH: maxMenuHeight, overflowY: "auto", py: 1, sx: listScrollStyles, children: [filteredOptions.length === 0 && (_jsx(Box, { px: 3, py: 2, fontSize: "0.8125rem", color: theme.colors.textMuted, children: "No Options" })), filteredOptions.map((option, index) => {
|
|
222
226
|
var _a;
|
|
223
|
-
return (_jsx(OptionRow, { option: option, index: index, listboxId: listboxId, isSelected: selectedIds.has(option.id.toString()), isActive: index === activeIndex, isMulti: (_a = props.isMulti) !== null && _a !== void 0 ? _a : false, theme: theme, renderOption: renderOption, onSelect: handleSelect, onActivate: setActiveIndex }, option.id));
|
|
227
|
+
return (_jsx(OptionRow, { option: option, index: index, listboxId: listboxId, isSelected: selectedIds.has(option.id.toString()), isActive: index === activeIndex, isMulti: (_a = props.isMulti) !== null && _a !== void 0 ? _a : false, theme: theme, backgrounds: rowBackgrounds, renderOption: renderOption, onSelect: handleSelect, onActivate: setActiveIndex }, option.id));
|
|
224
228
|
})] })] }) })] }), error && _jsx(ErrorMessage, { errorMessage: errorMessage }), helperText && !error && _jsx(HelperText, { helperText: helperText })] }));
|
|
225
229
|
}
|
|
@@ -31,7 +31,7 @@ const CollapsedItem = ({ item, isActive, itemFontSize, onItemClick }) => {
|
|
|
31
31
|
e.preventDefault();
|
|
32
32
|
if (!item.disabled)
|
|
33
33
|
onItemClick === null || onItemClick === void 0 ? void 0 : onItemClick(item);
|
|
34
|
-
}, bg: isActive ? "whiteAlpha.300" : "transparent", transition: "background 0.12s", children: _jsxs(Box, { position: "relative", display: "flex", alignItems: "center", children: [_jsx(Icon, { as: item.icon, fontSize: "1rem", color: isActive ? activeAccent.icon : "whiteAlpha.600", _groupHover: isActive ? undefined : { color: "whiteAlpha.800" }, transition: "color 0.12s" }), badgeVal != null && (_jsx(Box, { position: "absolute", top: "0", right: "0", w: "0.375rem", h: "0.375rem", borderRadius: "full", bg: theme.colors.red[400] }))] }) }) }), _jsx(Portal, { children: _jsx(PopoverContent, { borderRadius: "lg", bg: theme.colors.sidebar.elevated, boxShadow: "lg", minW: "10rem", maxW: "14rem", py: "0.125rem", ml: "-0.5rem", cursor: item.disabled ? "not-allowed" : "pointer", zIndex: 1500, color:
|
|
34
|
+
}, bg: isActive ? "whiteAlpha.300" : "transparent", transition: "background 0.12s", children: _jsxs(Box, { position: "relative", display: "flex", alignItems: "center", children: [_jsx(Icon, { as: item.icon, fontSize: "1rem", color: isActive ? activeAccent.icon : "whiteAlpha.600", _groupHover: isActive ? undefined : { color: "whiteAlpha.800" }, transition: "color 0.12s" }), badgeVal != null && (_jsx(Box, { position: "absolute", top: "0", right: "0", w: "0.375rem", h: "0.375rem", borderRadius: "full", bg: theme.colors.red[400] }))] }) }) }), _jsx(Portal, { children: _jsx(PopoverContent, { borderRadius: "lg", bg: theme.colors.sidebar.elevated, boxShadow: "lg", minW: "10rem", maxW: "14rem", py: "0.125rem", ml: "-0.5rem", cursor: item.disabled ? "not-allowed" : "pointer", zIndex: 1500, color: theme.colors.white, border: 'none', children: _jsx(PopoverBody, { p: "0.75rem", children: _jsxs(Flex, { align: "center", gap: "0.5rem", justify: "space-between", children: [_jsxs(Flex, { align: "center", gap: "0.5rem", flex: "1", minW: 0, children: [_jsx(Icon, { as: item.icon, fontSize: "1rem", flexShrink: 0 }), _jsx(OverflowTooltipText, { placement: "right", maxWidth: "100%", fontSize: itemFontSize, fontWeight: "medium", as: "p", children: item.title })] }), badgeVal != null && (_jsx(Badge, { colorScheme: colorScheme, fontSize: "0.625rem", variant: variant, borderRadius: radius, children: badgeVal }))] }) }) }) })] }));
|
|
35
35
|
};
|
|
36
36
|
const ExpandedItem = ({ item, isActive, itemFontSize, onItemClick }) => {
|
|
37
37
|
var _a;
|
|
@@ -75,7 +75,7 @@ const FooterControls = ({ toggle, overlay, mobileNav, onToggleCollapse, onToggle
|
|
|
75
75
|
return null;
|
|
76
76
|
return shell(_jsx(ControlCell, { onClick: onToggleMobileNav, label: "Show", accent: true, children: _jsx(PanelLeft, { size: 14, color: activeAccent.icon }) }));
|
|
77
77
|
}
|
|
78
|
-
return shell(_jsxs(_Fragment, { children: [_jsx(ControlCell, { onClick: onToggleCollapse, ariaLabel: toggle ? "Expand sidebar" : undefined, label: toggle ? undefined : "Collapse", children: toggle ? (_jsx(ArrowRightToLine, { size: 14, color: iconColor })) : (_jsx(ArrowLeftToLine, { size: 14, color: iconColor })) }), onToggleMobileNav && (_jsx(ControlCell, { onClick: onToggleMobileNav, label: toggle ? undefined : "Hide", children: _jsx(Maximize2, { size: 14, color: iconColor }) }))] }));
|
|
78
|
+
return shell(_jsxs(_Fragment, { children: [_jsx(ControlCell, { onClick: onToggleCollapse, ariaLabel: toggle ? "Expand sidebar" : undefined, label: toggle ? undefined : "Collapse", children: toggle ? (_jsx(ArrowRightToLine, { size: 14, color: iconColor })) : (_jsx(ArrowLeftToLine, { size: 14, color: iconColor })) }), onToggleMobileNav && (_jsx(ControlCell, { onClick: onToggleMobileNav, ariaLabel: toggle ? "Show sidebar in overlay mode" : undefined, label: toggle ? undefined : "Hide", children: _jsx(Maximize2, { size: 14, color: iconColor }) }))] }));
|
|
79
79
|
};
|
|
80
80
|
// --- Main Sidebar component ---
|
|
81
81
|
export default function Sidebar({ menus, activeMenu, handleMenuClick, handleSecondaryNavClick, toggle, changeToggle, logo, companyName, companySubtitle, user, isDisableAddNew = false, onAddNewClick, selectedSubMenu, selectedSecondaryItem, isLoading, loadingLines, open = true, otherApps, mobileOpen = false, onMobileClose, mobileNav = false, onToggleMobileNav, peekOpen = false, onPeekEnd, }) {
|
|
@@ -11,7 +11,7 @@ const MenuPopoverContent = ({ menu, handleMenuClick, activeMenu, }) => {
|
|
|
11
11
|
const { title, icon, subMenu, badge, locked } = menu;
|
|
12
12
|
const hasSubMenu = !!(subMenu === null || subMenu === void 0 ? void 0 : subMenu.length);
|
|
13
13
|
const isParentActive = activeMenu === menu.id;
|
|
14
|
-
return (_jsxs(_Fragment, { children: [_jsxs(Flex, { as: (hasSubMenu ? "div" : "a"), href: hasSubMenu ? undefined : (_a = menu.url) !== null && _a !== void 0 ? _a : "#", "aria-current": !hasSubMenu && isParentActive ? "page" : undefined, textDecoration: "none", align: "center", gap: "8px", px: "8px", py: hasSubMenu ? "6px" : "8px", mb: hasSubMenu ? "4px" : 0, borderBottom: hasSubMenu ? "1px solid" : undefined, borderColor: hasSubMenu ? "whiteAlpha.100" : undefined, borderRadius: hasSubMenu ? "none" : "md", bg: !hasSubMenu && isParentActive ?
|
|
14
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Flex, { as: (hasSubMenu ? "div" : "a"), href: hasSubMenu ? undefined : (_a = menu.url) !== null && _a !== void 0 ? _a : "#", "aria-current": !hasSubMenu && isParentActive ? "page" : undefined, textDecoration: "none", align: "center", gap: "8px", px: "8px", py: hasSubMenu ? "6px" : "8px", mb: hasSubMenu ? "4px" : 0, borderBottom: hasSubMenu ? "1px solid" : undefined, borderColor: hasSubMenu ? "whiteAlpha.100" : undefined, borderRadius: hasSubMenu ? "none" : "md", bg: !hasSubMenu && isParentActive ? "whiteAlpha.300" : "transparent", _hover: !hasSubMenu ? { bg: "whiteAlpha.100" } : undefined, onClick: (e) => {
|
|
15
15
|
if (!hasSubMenu) {
|
|
16
16
|
e.preventDefault();
|
|
17
17
|
handleMenuClick === null || handleMenuClick === void 0 ? void 0 : handleMenuClick(menu);
|
|
@@ -33,7 +33,7 @@ const MenuPopoverContent = ({ menu, handleMenuClick, activeMenu, }) => {
|
|
|
33
33
|
e.preventDefault();
|
|
34
34
|
if (!sub.disabled)
|
|
35
35
|
handleMenuClick === null || handleMenuClick === void 0 ? void 0 : handleMenuClick(sub);
|
|
36
|
-
}, px: "8px", py: "7px", mb: "2px", borderRadius: "md", align: "center", justify: "space-between", gap: "8px", borderLeft: "2px solid", borderLeftColor: isSubActive ? theme.colors.sidebar.activeIcon : "transparent", bg: isSubActive ?
|
|
36
|
+
}, px: "8px", py: "7px", mb: "2px", borderRadius: "md", align: "center", justify: "space-between", gap: "8px", borderLeft: "2px solid", borderLeftColor: isSubActive ? theme.colors.sidebar.activeIcon : "transparent", bg: isSubActive ? "whiteAlpha.300" : "transparent", _hover: {
|
|
37
37
|
bg: !sub.disabled ? "whiteAlpha.100" : "transparent",
|
|
38
38
|
cursor: !sub.disabled ? "pointer" : "not-allowed",
|
|
39
39
|
}, opacity: sub.disabled ? 0.5 : 1, pointerEvents: sub.disabled ? "none" : "auto", transition: "background 0.12s", children: [_jsxs(Flex, { align: "center", gap: "9px", overflow: "hidden", flex: "1", children: [_jsx(Icon, { as: sub.icon, fontSize: "0.95rem", flexShrink: 0, color: isSubActive ? activeAccent.icon : "whiteAlpha.800", _groupHover: isSubActive ? undefined : { color: "white" }, transition: "color 0.12s" }), _jsx(TruncatedTextWithTooltip, { fontSize: "12.5px", fontWeight: isSubActive ? 600 : 500, flex: 1, color: isSubActive ? activeAccent.label : theme.colors.white, _groupHover: isSubActive ? undefined : { color: "white" }, children: sub.title })] }), sub.locked ? (_jsx(Icon, { as: LockKeyhole, fontSize: "1rem", color: theme.colors.sidebar.mutedIcon })) : (() => {
|
|
@@ -3,6 +3,8 @@ import { useEffect, useRef, useState, useCallback } from "react";
|
|
|
3
3
|
import { Box, Flex, IconButton, Image, useBreakpointValue, AspectRatio } from "@chakra-ui/react";
|
|
4
4
|
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
5
5
|
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
6
|
+
import { onFilled } from "../../Theme/tokens/builders/accentText.js";
|
|
7
|
+
import { AA_NON_TEXT, liftToContrast, resolveHoverTint } from "../../Theme/tokens/builders/outlineRung.js";
|
|
6
8
|
const Slider = ({ images, interval = 5000, isArrow = false, mobileImages, }) => {
|
|
7
9
|
var _a, _b;
|
|
8
10
|
const { colors } = useCustomTheme();
|
|
@@ -32,10 +34,15 @@ const Slider = ({ images, interval = 5000, isArrow = false, mobileImages, }) =>
|
|
|
32
34
|
// eslint-disable-next-line
|
|
33
35
|
}, [slides.length]);
|
|
34
36
|
const ratio = (_b = useBreakpointValue({ base: 16 / 9, md: 21 / 9, lg: 21 / 9 })) !== null && _b !== void 0 ? _b : 16 / 9;
|
|
37
|
+
const chipBg = colors.background[50];
|
|
38
|
+
const chipInk = onFilled(chipBg, colors.white, colors.black);
|
|
39
|
+
const chipHoverBg = resolveHoverTint(colors.gray[200], chipBg);
|
|
40
|
+
const chipHoverInk = onFilled(chipHoverBg, colors.white, colors.black);
|
|
41
|
+
const dotInactiveInk = liftToContrast(colors.gray[400], chipBg, AA_NON_TEXT);
|
|
35
42
|
return (_jsxs(Box, { position: "relative", w: "100%", h: "auto", overflow: "hidden", children: [_jsx(Flex, { w: `${slides.length * 100}%`, transform: `translateX(-${(currentIndex * 100) / slides.length}%)`, transition: "transform 0.5s ease", children: [...slides]
|
|
36
43
|
.sort((a, b) => a.order - b.order)
|
|
37
44
|
.map((image, idx) => (_jsx(Box, { w: `${100 / slides.length}%`, h: "auto", flexShrink: 0, display: "flex", justifyContent: "center", alignItems: "center", children: _jsx(AspectRatio, { ratio: ratio, w: "100%", children: _jsx(Image, { src: isMobile && image.mobilePreviewUrl
|
|
38
45
|
? image.mobilePreviewUrl
|
|
39
|
-
: image.previewUrl, alt: `Slide ${idx + 1}`, objectFit: "cover", w: "100%", h: "100%", loading: "lazy" }) }) }, image.id))) }), isArrow && (_jsxs(_Fragment, { children: [_jsx(IconButton, { icon: _jsx(ChevronLeft, {
|
|
46
|
+
: image.previewUrl, alt: `Slide ${idx + 1}`, objectFit: "cover", w: "100%", h: "100%", loading: "lazy" }) }) }, image.id))) }), isArrow && (_jsxs(_Fragment, { children: [_jsx(IconButton, { icon: _jsx(ChevronLeft, {}), "aria-label": "Previous Slide", onClick: prevSlide, position: "absolute", top: "50%", left: "1rem", transform: "translateY(-50%)", zIndex: 2, variant: "ghost", borderRadius: "full", bg: chipBg, color: chipInk, _hover: { bg: chipHoverBg, color: chipHoverInk } }), _jsx(IconButton, { icon: _jsx(ChevronRight, {}), "aria-label": "Next Slide", onClick: nextSlide, position: "absolute", top: "50%", right: "1rem", transform: "translateY(-50%)", zIndex: 2, variant: "ghost", borderRadius: "full", bg: chipBg, color: chipInk, _hover: { bg: chipHoverBg, color: chipHoverInk } })] })), slides.length > 1 && (_jsx(Flex, { position: "absolute", bottom: "1rem", left: "50%", transform: "translateX(-50%)", gap: "0.5rem", zIndex: 2, bg: chipBg, px: "0.6rem", py: "0.4rem", borderRadius: "full", children: slides.map((_, idx) => (_jsx(Box, { as: "button", type: "button", w: { base: "0.5rem", md: "0.8rem" }, h: { base: "0.5rem", md: "0.8rem" }, border: "none", p: 0, bg: idx === currentIndex ? chipInk : dotInactiveInk, borderRadius: "full", cursor: "pointer", onClick: () => setCurrentIndex(idx), "aria-label": `Go to slide ${idx + 1}`, "aria-current": idx === currentIndex, transition: "all 0.3s", _focusVisible: { outline: `2px solid ${chipInk}`, outlineOffset: "2px" } }, idx))) }))] }));
|
|
40
47
|
};
|
|
41
48
|
export default Slider;
|
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Flex, Skeleton } from "@chakra-ui/react";
|
|
3
3
|
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
4
|
+
import { scrollbarStyles } from "../../Theme/tokens/builders/scrollbar.js";
|
|
4
5
|
import StageItem from "./StageItem.js";
|
|
5
6
|
import StepperStage from "./StepperStage.js";
|
|
6
|
-
const scrollSxFor = (thumb) => ({
|
|
7
|
-
"&::-webkit-scrollbar": { height: "4px" },
|
|
8
|
-
"&::-webkit-scrollbar-thumb": {
|
|
9
|
-
borderRadius: "full",
|
|
10
|
-
backgroundColor: thumb,
|
|
11
|
-
},
|
|
12
|
-
"&::-webkit-scrollbar-track": { background: "transparent" },
|
|
13
|
-
});
|
|
14
7
|
// Gap between items per variant (chevron interlocks via negative margin).
|
|
15
8
|
const gapFor = {
|
|
16
9
|
chevron: "0",
|
|
@@ -35,7 +28,7 @@ const StageProgress = ({ stages, variant = "chevron", value, onChange, size = "m
|
|
|
35
28
|
const total = stages.length;
|
|
36
29
|
return (_jsx(Box, { display: "flex", alignItems: variant === "stepper" ? "flex-start" : "stretch", gap: gapFor[variant], overflowX: "hidden", p: "0.1rem", sx: {
|
|
37
30
|
"&:hover": { overflowX: "auto" },
|
|
38
|
-
...
|
|
31
|
+
...scrollbarStyles(theme.colors, "overlay"),
|
|
39
32
|
}, children: stages.map((stage, index) => {
|
|
40
33
|
const state = stateFor(index);
|
|
41
34
|
if (variant === "stepper") {
|
|
@@ -32,7 +32,7 @@ const StepperStage = ({ label, number, state, size = "md", colorScheme = "primar
|
|
|
32
32
|
return (_jsxs(Flex, { ref: ref, direction: "column", align: "center", flex: "1", minWidth: s.minW, flexShrink: 0, as: (interactive ? "button" : "div"), type: interactive ? "button" : undefined, "data-group": "", border: "none", bg: "transparent", cursor: interactive ? "pointer" : "default", opacity: disabled ? 0.55 : 1, onClick: interactive ? onClick : undefined, children: [_jsxs(Flex, { align: "center", width: "100%", children: [line(leftDone, isFirst), _jsx(Flex, { align: "center", justify: "center", boxSize: s.circle, borderRadius: "full", flexShrink: 0, bg: circleBg, color: circleColor, border: "2px solid", borderColor: circleBorder, fontSize: s.font, fontWeight: 600, transition: "all 0.18s ease", "aria-current": state === "active" ? "step" : undefined, sx: state === "active"
|
|
33
33
|
? { boxShadow: `0 0 0 4px ${palette.soft}` }
|
|
34
34
|
: undefined, _groupHover: interactive
|
|
35
|
-
? { borderColor: palette.strong,
|
|
36
|
-
: undefined, children: showCheck && state === "completed" ? _jsx(Check, { size: s.icon }) : number }), line(rightDone, isLast)] }), _jsx(Text, { mt: 2, px: 1, fontSize: s.label, fontWeight: state === "active" ? 600 : 500, color: state === "upcoming" ? palette.mutedText : palette.softText, textAlign: "center", noOfLines: 2, _groupHover: interactive ? {
|
|
35
|
+
? { borderColor: palette.strong, bg: palette.strong, color: palette.onStrong }
|
|
36
|
+
: undefined, children: showCheck && state === "completed" ? _jsx(Check, { size: s.icon }) : number }), line(rightDone, isLast)] }), _jsx(Text, { mt: 2, px: 1, borderRadius: "sm", fontSize: s.label, fontWeight: state === "active" ? 600 : 500, color: state === "upcoming" ? palette.mutedText : palette.softText, textAlign: "center", noOfLines: 2, transition: "background 0.18s ease, color 0.18s ease", _groupHover: interactive ? { bg: palette.strong, color: palette.onStrong } : undefined, children: label })] }));
|
|
37
37
|
};
|
|
38
38
|
export default StepperStage;
|
|
@@ -4,10 +4,14 @@ import { Box, TableContainer, Flex, Spinner, Popover, PopoverTrigger, PopoverCon
|
|
|
4
4
|
import { Table as ChakraTable, Tbody, Thead, Icon } from "@chakra-ui/react";
|
|
5
5
|
import { motion } from "framer-motion";
|
|
6
6
|
import LeftFilterPane from "./filters/LeftFilterPane.js";
|
|
7
|
+
import { TABLE_VARIANTS } from "./variants/index.js";
|
|
8
|
+
import { TableVariantProvider } from "./variants/TableVariantContext.js";
|
|
9
|
+
import { isDarkCanvas } from "../../Theme/tokens/builders/accentText.js";
|
|
7
10
|
import Pagination from "./components/Pagination.js";
|
|
8
11
|
import TableHeader from "./components/TableHeader.js";
|
|
9
12
|
import TableBody from "./components/TableBody.js";
|
|
10
13
|
import { useCustomTheme } from "../../Theme/useCustomTheme.js";
|
|
14
|
+
import { scrollbarStyles, SCROLLBAR_WIDTH } from "../../Theme/tokens/builders/scrollbar.js";
|
|
11
15
|
import useTable from "./hooks/useTable.js";
|
|
12
16
|
import { searchAndSortData, SortMultiColumnData, groupRows, buildTablePalette, pickTableColor } from "../../Utils/table.js";
|
|
13
17
|
import { useGetPreferences, useSavePreferences, } from "../../Hooks/usePreferences.js";
|
|
@@ -27,11 +31,12 @@ export default function Table({ data, columns, onSelection, isLoading, isCheckbo
|
|
|
27
31
|
name: "",
|
|
28
32
|
page: "",
|
|
29
33
|
orgId: "",
|
|
30
|
-
}, paginationMode = "client", infiniteScroll = false, hasMore, isLoadingMore = false, groupLoadMore = false, loadMoreText = "Load more", loadMorePosition = "top", loadMoreChunkSize, noOfRowsPerPage = 50, totalRecords = 0, onPagination, isTableSettings = false, headerActions, onGlobalSearch, onNoOfRowsPerPageChange, paginationSelectOptions, tableMaxHeight, minVisibleRows, maxVisibleRows, autoFitViewport, tableSettings, filterSidebar, loadingSkeletonRows, defaultVisibleColumns, density = "normal", stripe, groupColors, onAddItem, emptyState, onRefresh,
|
|
34
|
+
}, paginationMode = "client", infiniteScroll = false, hasMore, isLoadingMore = false, groupLoadMore = false, loadMoreText = "Load more", loadMorePosition = "top", loadMoreChunkSize, noOfRowsPerPage = 50, totalRecords = 0, onPagination, isTableSettings = false, headerActions, onGlobalSearch, onNoOfRowsPerPageChange, paginationSelectOptions, tableMaxHeight, minVisibleRows, maxVisibleRows, autoFitViewport, tableSettings, filterSidebar, loadingSkeletonRows, defaultVisibleColumns, density = "normal", variant = "classic", stripe, groupColors, onAddItem, emptyState, onRefresh,
|
|
31
35
|
// onColumnFilter
|
|
32
36
|
}) {
|
|
33
37
|
var _a, _b, _c, _d;
|
|
34
38
|
const theme = useCustomTheme();
|
|
39
|
+
const variantTokens = useMemo(() => TABLE_VARIANTS[variant](theme.colors, isDarkCanvas(theme.colors.backgroundColor.main)), [variant, theme.colors]);
|
|
35
40
|
const [columnsSearch, setColumnsSearch] = useState({});
|
|
36
41
|
const tableContainerRef = useRef(null);
|
|
37
42
|
const { isOpen: isFilterModalOpen, onOpen: onFilterModalOpen, onClose: onFilterModalClose } = useDisclosure();
|
|
@@ -350,12 +355,14 @@ export default function Table({ data, columns, onSelection, isLoading, isCheckbo
|
|
|
350
355
|
return acc + (Array.isArray(items) ? items.length : 0);
|
|
351
356
|
}, 0);
|
|
352
357
|
}, [filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.selected]);
|
|
353
|
-
return (_jsxs(
|
|
358
|
+
return (_jsxs(TableVariantProvider, { value: variantTokens, children: [_jsx("style", { children: `
|
|
354
359
|
@keyframes pixelize-table-spin {
|
|
355
360
|
from { transform: rotate(0deg); }
|
|
356
361
|
to { transform: rotate(360deg); }
|
|
357
362
|
}
|
|
358
|
-
` }), _jsxs(Box, { bg: theme.colors.background[50], border: `0.063rem solid ${theme.colors.
|
|
363
|
+
` }), _jsxs(Box, { bg: theme.colors.background[50], border: `0.063rem solid ${theme.colors.boxborder[200]}`, borderRadius: "base",
|
|
364
|
+
// Square children poked past the rounded border, leaving a gap at each corner.
|
|
365
|
+
overflow: "hidden", children: [filterSidebar && filterMode === "modal" && (_jsxs(Modal, { isOpen: isFilterModalOpen, onClose: onFilterModalClose, size: "4xl", scrollBehavior: "inside", children: [_jsx(ModalOverlay, {}), _jsxs(ModalContent, { bg: theme.colors.background[50], my: 0, top: "10%", position: "fixed", left: "auto", right: "auto", children: [_jsx(ModalCloseButton, { size: "sm" }), _jsx(ModalBody, { p: 0, children: _jsx(LeftFilterPane, { theme: theme, sections: (_c = filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.sidebarOptions) !== null && _c !== void 0 ? _c : [], selected: filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.selected, onApply: (sel) => { var _a; (_a = filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.onApply) === null || _a === void 0 ? void 0 : _a.call(filterSidebar, sel); onFilterModalClose(); }, onClear: () => { var _a; (_a = filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.onClearAllHandler) === null || _a === void 0 ? void 0 : _a.call(filterSidebar); }, isApplyLoading: filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.isApplyLoading, filterMode: filterMode }) })] })] })), _jsxs(Flex, { align: "start", children: [filterMode === "sidebar" && (_jsx(MotionBox, { "data-testid": "filter-sidebar-pane", initial: { width: 0 }, animate: { width: (filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.isFilterSidebar) ? 180 : 0 }, transition: { type: "tween", duration: 0.5 }, overflow: "hidden", flexShrink: 0, borderRight: (filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.isFilterSidebar) ? "1px solid" : "none", borderColor: theme.colors.boxborder[200], style: { height: controlsHeight + tableMaxH }, minHeight: (filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.isFilterSidebar) ? "32rem" : "auto", children: _jsx(LeftFilterPane, { height: controlsHeight + tableMaxH, theme: theme, sections: (_d = filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.sidebarOptions) !== null && _d !== void 0 ? _d : [], selected: filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.selected, onApply: filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.onApply, onClear: filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.onClearAllHandler, isApplyLoading: filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.isApplyLoading, filterMode: filterMode }) })), _jsxs(Box, { flex: "1", minW: 0, children: [_jsxs(Box, { display: "flex", alignItems: "center", justifyContent: "space-between", px: 3, py: 0, height: controlsHeight, gap: 3, flexWrap: "nowrap", bg: theme.colors.background[50], borderBottom: `0.063rem solid ${theme.colors.boxborder[200]}`, children: [filterSidebar && (_jsxs(_Fragment, { children: [_jsx(ToolTip, { label: "Filter", placement: "top", children: _jsxs(Box, { position: "relative", display: "inline-block", children: [_jsx(Icon, { as: Filter, transform: "scaleX(-1)", cursor: "pointer", boxSize: 4, color: sidebarActiveCount > 0 ? theme.colors.accentText : theme.colors.text[500], onClick: filterMode === "modal" ? onFilterModalOpen : filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.filterSidebarToggle, _hover: {
|
|
359
366
|
color: theme.colors.accentText,
|
|
360
367
|
} }), sidebarActiveCount > 0 && (_jsx(Box, { position: "absolute", top: "-6px", right: "-10px", bg: theme.colors.primary[500], color: theme.colors.onPrimary, borderRadius: "full", p: "1px", cursor: "pointer", onClick: (e) => {
|
|
361
368
|
var _a;
|
|
@@ -386,29 +393,15 @@ export default function Table({ data, columns, onSelection, isLoading, isCheckbo
|
|
|
386
393
|
}, children: _jsx(RefreshCw, { size: 16 }) }) })] })), headerActions && (_jsxs(_Fragment, { children: [_jsx(VeritcalDivider, {}), _jsx(HeaderActions, { actions: headerActions, selections: selection })] })), _jsx(ActiveFilters, { columns: columnsList, columnsSearch: columnsSearch, setColumnsSearch: setColumnsSearch }), _jsxs(Box, { ml: "auto", display: "flex", alignItems: "center", gap: 2, children: [groupLoadMoreActive && loadMorePosition === "top" && (groupLoadMoreCaption || canGroupLoadMore) && (_jsxs(Box, { display: "flex", alignItems: "center", gap: 2, flex: "0 0 auto", children: [groupLoadMoreCaption && (_jsx(Box, { fontSize: "0.75rem", color: theme.colors.text[500], whiteSpace: "nowrap", children: groupLoadMoreCaption })), canGroupLoadMore && (_jsx(Button, { size: "xs", variant: "outline", colorScheme: "gray", isLoading: isLoadingMore, loadingText: loadMoreText, onClick: handleGroupLoadMore, label: loadMoreText }))] })), (isPagination || isServerPagination) && !isGrouped && !canInfinite && !isCompactHeader && (_jsx("div", { children: _jsx(Pagination, { columns: columns, currentPage: currentPage, setCurrentPage: setCurrentPage, rowsPerPage: rowsPerPage, pages: pages, paginationText: tablePaginationText, handlePageSizeChange: handlePageSizeChange, dataLength: tableData.length, isServerPagination: isServerPagination, paginationSelectOptions: paginationSelectOptions, isVisiblity: true }) })), (isPagination || isServerPagination) && !isGrouped && !canInfinite && isCompactHeader && tableData.length > 0 && (_jsxs(Popover, { isOpen: isPaginationPopoverOpen, onClose: () => setIsPaginationPopoverOpen(false), placement: "bottom-end", children: [_jsx(PopoverTrigger, { children: _jsx(IconButton, { "aria-label": "Pagination", size: "sm", variant: "ghost", icon: _jsx(EllipsisVertical, { size: 18 }), color: theme.colors.text[500], _hover: {
|
|
387
394
|
color: theme.colors.accentText,
|
|
388
395
|
}, onClick: () => setIsPaginationPopoverOpen((open) => !open) }) }), _jsx(Portal, { children: _jsx(PopoverContent, { maxW: "22rem", p: 2, zIndex: 1600, bg: theme.colors.background[50], boxShadow: "lg", children: _jsx(PopoverBody, { p: 0, children: _jsx(Pagination, { columns: columns, currentPage: currentPage, setCurrentPage: setCurrentPage, rowsPerPage: rowsPerPage, pages: pages, paginationText: tablePaginationText, handlePageSizeChange: handlePageSizeChange, dataLength: tableData.length, isServerPagination: isServerPagination, paginationSelectOptions: paginationSelectOptions, isVisiblity: true }) }) }) })] }))] })] }), _jsxs(TableContainer, { ref: tableContainerRef, position: "relative", h: isTableLoading ? tableMaxH : undefined, maxH: !isTableLoading ? tableMaxH : undefined, pb: isTableLoading ? 0 : compactScrollbarPadding, overflowY: isCompactRows ? "hidden" : "auto", overflowX: "auto", sx: {
|
|
396
|
+
...scrollbarStyles(theme.colors),
|
|
397
|
+
// Compact rows hide the horizontal bar until hover to keep the row height.
|
|
389
398
|
'&::-webkit-scrollbar': {
|
|
390
|
-
width:
|
|
391
|
-
height: isCompactRows ? '0px' :
|
|
392
|
-
},
|
|
393
|
-
'&:hover::-webkit-scrollbar': {
|
|
394
|
-
height: '6px',
|
|
395
|
-
},
|
|
396
|
-
'&::-webkit-scrollbar-track': {
|
|
397
|
-
background: theme.colors.gray[100],
|
|
398
|
-
borderRadius: 'base',
|
|
399
|
-
},
|
|
400
|
-
'&::-webkit-scrollbar-thumb': {
|
|
401
|
-
background: theme.colors.gray[400],
|
|
402
|
-
borderRadius: 'base',
|
|
403
|
-
},
|
|
404
|
-
'&::-webkit-scrollbar-thumb:hover': {
|
|
405
|
-
background: theme.colors.gray[500],
|
|
399
|
+
width: SCROLLBAR_WIDTH,
|
|
400
|
+
height: isCompactRows ? '0px' : SCROLLBAR_WIDTH,
|
|
406
401
|
},
|
|
402
|
+
'&:hover::-webkit-scrollbar': { height: SCROLLBAR_WIDTH },
|
|
407
403
|
scrollbarWidth: isCompactRows ? 'none' : 'thin',
|
|
408
|
-
'&:hover': {
|
|
409
|
-
scrollbarWidth: 'thin',
|
|
410
|
-
},
|
|
411
|
-
scrollbarColor: `${theme.colors.gray[400]} ${theme.colors.gray[100]}`,
|
|
404
|
+
'&:hover': { scrollbarWidth: 'thin' },
|
|
412
405
|
}, children: [_jsxs(ChakraTable, { variant: "simple", size: "sm", minW: "100%", role: "grid", "aria-rowcount": isGrouped ? undefined : _filteredData.length + 1, className: "table_wrapper", sx: {
|
|
413
406
|
width: "100%",
|
|
414
407
|
// `separate` (not `collapse`) so sticky header cells paint an opaque
|
|
@@ -426,5 +419,5 @@ export default function Table({ data, columns, onSelection, isLoading, isCheckbo
|
|
|
426
419
|
backgroundColor: "transparent",
|
|
427
420
|
zIndex: 999,
|
|
428
421
|
},
|
|
429
|
-
}, children: [_jsx(Thead, { position: "sticky", top: 0, zIndex: 4, bg:
|
|
422
|
+
}, children: [_jsx(Thead, { position: "sticky", top: 0, zIndex: 4, bg: variantTokens.header.bg, children: _jsx(TableHeader, { columns: columnsList, isCheckbox: isCheckbox, headerBgColor: headerBgColor !== null && headerBgColor !== void 0 ? headerBgColor : theme.colors.backgroundColor.muted, freezedBgColor: freezedBgColor !== null && freezedBgColor !== void 0 ? freezedBgColor : theme.colors.backgroundColor.secondary, freezedTextColor: freezedTextColor !== null && freezedTextColor !== void 0 ? freezedTextColor : theme.colors.text[500], handleSort: handleSort, headerRefs: headerRefs, columnWidths: columnWidths, columnsSort: columnsSort, noBorders: noBorders, handleCheckbox: handleCheckbox, isLoading: isTableLoading, checked: headerChecked, isContent: isContent, isLink: isLink, isActionFreeze: isActionFreeze, setColumnsSearch: setColumnsSearch, columnsSearch: columnsSearch, isSelecting: isSelecting }) }), _jsx(Tbody, { children: _jsx(TableBody, { data: isGrouped ? groupedSource : _filteredData, groups: renderGroups, onAddItem: onAddItem, columns: columnsList, startRow: isGrouped ? 0 : startRow, endRow: endRow, scrollContainerRef: tableContainerRef, isCheckbox: isCheckbox, columnWidths: columnWidths, noBorders: noBorders, freezedBgColor: freezedBgColor !== null && freezedBgColor !== void 0 ? freezedBgColor : theme.colors.backgroundColor.secondary, freezedTextColor: freezedTextColor !== null && freezedTextColor !== void 0 ? freezedTextColor : theme.colors.text[500], handleCheckbox: handleCheckbox, selections: selection, isLoading: isTableLoading, loadingSkeletonRows: loadingSkeletonRows, onRowClick: onRowClick, isContent: isContent, isLink: isLink, isActionFreeze: isActionFreeze, density: densityState, stripe: stripe, emptyState: emptyState }) })] }), canInfinite && isLoadingMore && (_jsxs(Flex, { justify: "center", align: "center", py: 3, gap: 2, children: [_jsx(Spinner, { size: "sm", color: theme.colors.accentText }), _jsx(Box, { fontSize: "0.75rem", color: theme.colors.text[500], children: "Loading more\u2026" })] }))] }), groupLoadMoreActive && loadMorePosition === "bottom" && (groupLoadMoreCaption || canGroupLoadMore) && (_jsxs(Flex, { justify: "center", align: "center", gap: 3, py: 3, borderTop: `0.063rem solid ${theme.colors.boxborder[200]}`, children: [groupLoadMoreCaption && (_jsx(Box, { fontSize: "0.75rem", color: theme.colors.text[500], children: groupLoadMoreCaption })), canGroupLoadMore && (_jsx(Button, { size: "xs", variant: "outline", colorScheme: "gray", isLoading: isLoadingMore, loadingText: loadMoreText, onClick: handleGroupLoadMore, label: loadMoreText }))] }))] })] })] })] }));
|
|
430
423
|
}
|
|
@@ -14,6 +14,6 @@ const Pagination = React.memo(({ paginationText, handlePageSizeChange, rowsPerPa
|
|
|
14
14
|
// const isRightDisabled = currentPage >= pages - 1;
|
|
15
15
|
const isLeftDisabled = dataLength === 0 || currentPage === 0;
|
|
16
16
|
const isRightDisabled = dataLength === 0 || currentPage >= pages - 1;
|
|
17
|
-
return (_jsxs(Flex, { justify: "flex-end", align: "center", flexWrap: "nowrap", children: [(!isServerPagination || paginationSelectOptions) && (_jsxs(Select, { onChange: handlePageSizeChange, value: rowsPerPage, size: "xs", borderRadius: "base", width: "auto", minW: "4.5rem", isDisabled: dataLength === 0, children: [!paginationSelectOptions && dataLength < 100 ? _jsx("option", { value: 0 }) : null, computedOptions.map((size, index) => (_jsx("option", { value: String(size), children: String(size) }, index)))] })), dataLength > 0 && (_jsxs(Flex, { w: "100%", children: [_jsx(ToolTip, { label: "First", placement: "top", children: _jsx(IconButton, { "aria-label": "first-page", color: isLeftDisabled ? theme.colors.textMuted : theme.colors.text[500], rounded: "full", variant: isLeftDisabled ? "plain" : "ghost", onClick: () => setCurrentPage(0), _hover: !isLeftDisabled ? { color: theme.colors.accentText } : {}, children: _jsx(ChevronsLeft, {}) }) }), _jsx(ToolTip, { label: "Previous", placement: "top", children: _jsx(IconButton, { "aria-label": "previous-page", color: isLeftDisabled ? theme.colors.textMuted : theme.colors.text[500], rounded: "full", variant: isLeftDisabled ? "plain" : "ghost", onClick: () => currentPage > 0 && setCurrentPage(currentPage - 1), _hover: !isLeftDisabled ? { color: theme.colors.accentText } : {}, children: _jsx(ChevronLeft, {}) }) }), _jsx(Text, { mt: 3, fontSize: 12, whiteSpace: "nowrap", color: theme.colors.text[500], children: paginationText }), _jsx(ToolTip, { label: "Next", placement: "top", children: _jsx(IconButton, { "aria-label": "next-page", color: isRightDisabled ? theme.colors.textMuted : theme.colors.text[500], rounded: "full", variant: isRightDisabled ? "plain" : "ghost", onClick: () => currentPage < pages - 1 && setCurrentPage(currentPage + 1), _hover: !isRightDisabled ? { color: theme.colors.accentText } : {}, children: _jsx(ChevronRight, {}) }) }), _jsx(ToolTip, { label: "Last", placement: "top", children: _jsx(IconButton, { "aria-label": "last-page", color: isRightDisabled ? theme.colors.textMuted : theme.colors.text[500], rounded: "full", variant: isRightDisabled ? "plain" : "ghost", onClick: () => setCurrentPage(pages - 1), _hover: !isRightDisabled ? { color: theme.colors.accentText } : {}, children: _jsx(ChevronsRight, {}) }) })] }))] }));
|
|
17
|
+
return (_jsxs(Flex, { justify: "flex-end", align: "center", flexWrap: "nowrap", children: [(!isServerPagination || paginationSelectOptions) && (_jsxs(Select, { "aria-label": "Rows per page", onChange: handlePageSizeChange, value: rowsPerPage, size: "xs", borderRadius: "base", width: "auto", minW: "4.5rem", isDisabled: dataLength === 0, children: [!paginationSelectOptions && dataLength < 100 ? _jsx("option", { value: 0 }) : null, computedOptions.map((size, index) => (_jsx("option", { value: String(size), children: String(size) }, index)))] })), dataLength > 0 && (_jsxs(Flex, { w: "100%", children: [_jsx(ToolTip, { label: "First", placement: "top", children: _jsx(IconButton, { "aria-label": "first-page", color: isLeftDisabled ? theme.colors.textMuted : theme.colors.text[500], rounded: "full", variant: isLeftDisabled ? "plain" : "ghost", onClick: () => setCurrentPage(0), _hover: !isLeftDisabled ? { color: theme.colors.accentText } : {}, children: _jsx(ChevronsLeft, {}) }) }), _jsx(ToolTip, { label: "Previous", placement: "top", children: _jsx(IconButton, { "aria-label": "previous-page", color: isLeftDisabled ? theme.colors.textMuted : theme.colors.text[500], rounded: "full", variant: isLeftDisabled ? "plain" : "ghost", onClick: () => currentPage > 0 && setCurrentPage(currentPage - 1), _hover: !isLeftDisabled ? { color: theme.colors.accentText } : {}, children: _jsx(ChevronLeft, {}) }) }), _jsx(Text, { mt: 3, fontSize: 12, whiteSpace: "nowrap", color: theme.colors.text[500], children: paginationText }), _jsx(ToolTip, { label: "Next", placement: "top", children: _jsx(IconButton, { "aria-label": "next-page", color: isRightDisabled ? theme.colors.textMuted : theme.colors.text[500], rounded: "full", variant: isRightDisabled ? "plain" : "ghost", onClick: () => currentPage < pages - 1 && setCurrentPage(currentPage + 1), _hover: !isRightDisabled ? { color: theme.colors.accentText } : {}, children: _jsx(ChevronRight, {}) }) }), _jsx(ToolTip, { label: "Last", placement: "top", children: _jsx(IconButton, { "aria-label": "last-page", color: isRightDisabled ? theme.colors.textMuted : theme.colors.text[500], rounded: "full", variant: isRightDisabled ? "plain" : "ghost", onClick: () => setCurrentPage(pages - 1), _hover: !isRightDisabled ? { color: theme.colors.accentText } : {}, children: _jsx(ChevronsRight, {}) }) })] }))] }));
|
|
18
18
|
});
|
|
19
19
|
export default Pagination;
|
|
@@ -37,11 +37,11 @@ const TableActions = React.memo(({ row }) => {
|
|
|
37
37
|
// ✅ if row itself is missing, render nothing
|
|
38
38
|
if (!row)
|
|
39
39
|
return null;
|
|
40
|
-
return (_jsx(Popover, { placement: "bottom-start", isOpen: isOpen, onClose: handleClose, closeOnBlur: false, children: _jsxs("div", { ref: ref, children: [_jsx(PopoverTrigger, { children: _jsx(IconButton, { "aria-label": "Actions", color: theme.colors.text[900], icon: _jsx(EllipsisVertical, { size: 17 }), size: "sm", p: 0, variant: "ghost", _hover: { transform: "scale(1.2)" }, onClick: () => (isOpen ? handleClose() : handleOpen()) }) }), isOpen && (_jsx(Portal, { children: _jsx(PopoverContent, { w: "auto", minW: "100px", boxShadow: "lg", p: 0, zIndex: 999, bg: theme.colors.background[50], children: _jsx(PopoverBody, { p: 0, m: 0, children: _jsxs(VStack, { align: "stretch", spacing: 1, p: 0, m: 0, children: [row.onLink && (_jsxs(Button, { size: "sm", variant: "ghost", justifyContent: "flex-start", borderBottom: `1px solid ${theme.colors.
|
|
40
|
+
return (_jsx(Popover, { placement: "bottom-start", isOpen: isOpen, onClose: handleClose, closeOnBlur: false, children: _jsxs("div", { ref: ref, children: [_jsx(PopoverTrigger, { children: _jsx(IconButton, { "aria-label": "Actions", color: theme.colors.text[900], icon: _jsx(EllipsisVertical, { size: 17 }), size: "sm", p: 0, variant: "ghost", _hover: { transform: "scale(1.2)" }, onClick: () => (isOpen ? handleClose() : handleOpen()) }) }), isOpen && (_jsx(Portal, { children: _jsx(PopoverContent, { w: "auto", minW: "100px", boxShadow: "lg", p: 0, zIndex: 999, bg: theme.colors.background[50], children: _jsx(PopoverBody, { p: 0, m: 0, children: _jsxs(VStack, { align: "stretch", spacing: 1, p: 0, m: 0, children: [row.onLink && (_jsxs(Button, { size: "sm", variant: "ghost", justifyContent: "flex-start", borderBottom: `1px solid ${theme.colors.boxborder[200]}`, borderRadius: 0, gap: 2, onClick: () => {
|
|
41
41
|
var _a;
|
|
42
42
|
(_a = row.onLink) === null || _a === void 0 ? void 0 : _a.call(row, row);
|
|
43
43
|
handleClose();
|
|
44
|
-
}, children: [_jsx(ExternalLink, { size: 17 }), " View"] })), row.onEdit && (_jsxs(Button, { size: "sm", variant: "ghost", justifyContent: "flex-start", gap: 2, borderBottom: `1px solid ${theme.colors.
|
|
44
|
+
}, children: [_jsx(ExternalLink, { size: 17 }), " View"] })), row.onEdit && (_jsxs(Button, { size: "sm", variant: "ghost", justifyContent: "flex-start", gap: 2, borderBottom: `1px solid ${theme.colors.boxborder[200]}`, borderRadius: 0, onClick: () => {
|
|
45
45
|
var _a;
|
|
46
46
|
(_a = row.onEdit) === null || _a === void 0 ? void 0 : _a.call(row, row);
|
|
47
47
|
handleClose();
|