@hitachivantara/uikit-react-core 5.1.2 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/Button/Button.styles.cjs +6 -6
- package/dist/cjs/components/Button/Button.styles.cjs.map +1 -1
- package/dist/cjs/components/Card/Card.styles.cjs.map +1 -1
- package/dist/cjs/components/Card/Content/Content.styles.cjs.map +1 -1
- package/dist/cjs/components/Card/Header/Header.styles.cjs.map +1 -1
- package/dist/cjs/components/Card/Media/Media.styles.cjs.map +1 -1
- package/dist/cjs/components/Controls/RightControl/RightControl.cjs +3 -3
- package/dist/cjs/components/Controls/RightControl/RightControl.cjs.map +1 -1
- package/dist/cjs/components/FilterGroup/Counter/Counter.cjs +51 -0
- package/dist/cjs/components/FilterGroup/Counter/Counter.cjs.map +1 -0
- package/dist/cjs/components/FilterGroup/Counter/Counter.styles.cjs +17 -0
- package/dist/cjs/components/FilterGroup/Counter/Counter.styles.cjs.map +1 -0
- package/dist/cjs/components/FilterGroup/FilterContent/FilterContent.cjs +168 -0
- package/dist/cjs/components/FilterGroup/FilterContent/FilterContent.cjs.map +1 -0
- package/dist/cjs/components/FilterGroup/FilterContent/FilterContent.styles.cjs +60 -0
- package/dist/cjs/components/FilterGroup/FilterContent/FilterContent.styles.cjs.map +1 -0
- package/dist/cjs/components/FilterGroup/FilterContent/filterContentClasses.cjs +8 -0
- package/dist/cjs/components/FilterGroup/FilterContent/filterContentClasses.cjs.map +1 -0
- package/dist/cjs/components/FilterGroup/FilterGroup.cjs +116 -0
- package/dist/cjs/components/FilterGroup/FilterGroup.cjs.map +1 -0
- package/dist/cjs/components/FilterGroup/FilterGroup.styles.cjs +14 -0
- package/dist/cjs/components/FilterGroup/FilterGroup.styles.cjs.map +1 -0
- package/dist/cjs/components/FilterGroup/FilterGroupContext.cjs +69 -0
- package/dist/cjs/components/FilterGroup/FilterGroupContext.cjs.map +1 -0
- package/dist/cjs/components/FilterGroup/LeftPanel/LeftPanel.cjs +52 -0
- package/dist/cjs/components/FilterGroup/LeftPanel/LeftPanel.cjs.map +1 -0
- package/dist/cjs/components/FilterGroup/LeftPanel/LeftPanel.styles.cjs +10 -0
- package/dist/cjs/components/FilterGroup/LeftPanel/LeftPanel.styles.cjs.map +1 -0
- package/dist/cjs/components/FilterGroup/RightPanel/RightPanel.cjs +135 -0
- package/dist/cjs/components/FilterGroup/RightPanel/RightPanel.cjs.map +1 -0
- package/dist/cjs/components/FilterGroup/RightPanel/RightPanel.styles.cjs +34 -0
- package/dist/cjs/components/FilterGroup/RightPanel/RightPanel.styles.cjs.map +1 -0
- package/dist/cjs/components/FilterGroup/filterGroupClasses.cjs +8 -0
- package/dist/cjs/components/FilterGroup/filterGroupClasses.cjs.map +1 -0
- package/dist/cjs/components/MultiButton/MultiButton.styles.cjs +22 -6
- package/dist/cjs/components/MultiButton/MultiButton.styles.cjs.map +1 -1
- package/dist/cjs/components/VerticalNavigation/Actions/Action.styles.cjs +2 -5
- package/dist/cjs/components/VerticalNavigation/Actions/Action.styles.cjs.map +1 -1
- package/dist/cjs/components/VerticalNavigation/Navigation/Navigation.cjs +6 -0
- package/dist/cjs/components/VerticalNavigation/Navigation/Navigation.cjs.map +1 -1
- package/dist/cjs/components/VerticalNavigation/TreeView/TreeViewItem.cjs +2 -2
- package/dist/cjs/components/VerticalNavigation/TreeView/TreeViewItem.cjs.map +1 -1
- package/dist/cjs/components/VerticalNavigation/TreeView/TreeViewItem.styles.cjs +4 -7
- package/dist/cjs/components/VerticalNavigation/TreeView/TreeViewItem.styles.cjs.map +1 -1
- package/dist/cjs/index.cjs +6 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/utils/useSavedState.cjs +19 -0
- package/dist/cjs/utils/useSavedState.cjs.map +1 -0
- package/dist/esm/components/Button/Button.styles.js +6 -6
- package/dist/esm/components/Button/Button.styles.js.map +1 -1
- package/dist/esm/components/Card/Card.styles.js.map +1 -1
- package/dist/esm/components/Card/Content/Content.styles.js.map +1 -1
- package/dist/esm/components/Card/Header/Header.styles.js.map +1 -1
- package/dist/esm/components/Card/Media/Media.styles.js.map +1 -1
- package/dist/esm/components/Controls/RightControl/RightControl.js +4 -4
- package/dist/esm/components/Controls/RightControl/RightControl.js.map +1 -1
- package/dist/esm/components/FilterGroup/Counter/Counter.js +51 -0
- package/dist/esm/components/FilterGroup/Counter/Counter.js.map +1 -0
- package/dist/esm/components/FilterGroup/Counter/Counter.styles.js +17 -0
- package/dist/esm/components/FilterGroup/Counter/Counter.styles.js.map +1 -0
- package/dist/esm/components/FilterGroup/FilterContent/FilterContent.js +168 -0
- package/dist/esm/components/FilterGroup/FilterContent/FilterContent.js.map +1 -0
- package/dist/esm/components/FilterGroup/FilterContent/FilterContent.styles.js +60 -0
- package/dist/esm/components/FilterGroup/FilterContent/FilterContent.styles.js.map +1 -0
- package/dist/esm/components/FilterGroup/FilterContent/filterContentClasses.js +8 -0
- package/dist/esm/components/FilterGroup/FilterContent/filterContentClasses.js.map +1 -0
- package/dist/esm/components/FilterGroup/FilterGroup.js +116 -0
- package/dist/esm/components/FilterGroup/FilterGroup.js.map +1 -0
- package/dist/esm/components/FilterGroup/FilterGroup.styles.js +14 -0
- package/dist/esm/components/FilterGroup/FilterGroup.styles.js.map +1 -0
- package/dist/esm/components/FilterGroup/FilterGroupContext.js +67 -0
- package/dist/esm/components/FilterGroup/FilterGroupContext.js.map +1 -0
- package/dist/esm/components/FilterGroup/LeftPanel/LeftPanel.js +52 -0
- package/dist/esm/components/FilterGroup/LeftPanel/LeftPanel.js.map +1 -0
- package/dist/esm/components/FilterGroup/LeftPanel/LeftPanel.styles.js +10 -0
- package/dist/esm/components/FilterGroup/LeftPanel/LeftPanel.styles.js.map +1 -0
- package/dist/esm/components/FilterGroup/RightPanel/RightPanel.js +133 -0
- package/dist/esm/components/FilterGroup/RightPanel/RightPanel.js.map +1 -0
- package/dist/esm/components/FilterGroup/RightPanel/RightPanel.styles.js +34 -0
- package/dist/esm/components/FilterGroup/RightPanel/RightPanel.styles.js.map +1 -0
- package/dist/esm/components/FilterGroup/filterGroupClasses.js +8 -0
- package/dist/esm/components/FilterGroup/filterGroupClasses.js.map +1 -0
- package/dist/esm/components/MultiButton/MultiButton.styles.js +22 -6
- package/dist/esm/components/MultiButton/MultiButton.styles.js.map +1 -1
- package/dist/esm/components/VerticalNavigation/Actions/Action.styles.js +2 -5
- package/dist/esm/components/VerticalNavigation/Actions/Action.styles.js.map +1 -1
- package/dist/esm/components/VerticalNavigation/Navigation/Navigation.js +6 -0
- package/dist/esm/components/VerticalNavigation/Navigation/Navigation.js.map +1 -1
- package/dist/esm/components/VerticalNavigation/TreeView/TreeViewItem.js +2 -2
- package/dist/esm/components/VerticalNavigation/TreeView/TreeViewItem.js.map +1 -1
- package/dist/esm/components/VerticalNavigation/TreeView/TreeViewItem.styles.js +4 -7
- package/dist/esm/components/VerticalNavigation/TreeView/TreeViewItem.styles.js.map +1 -1
- package/dist/esm/index.js +24 -18
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/utils/useSavedState.js +19 -0
- package/dist/esm/utils/useSavedState.js.map +1 -0
- package/dist/types/index.d.ts +135 -0
- package/package.json +5 -5
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import filterGroupClasses from "./filterGroupClasses.js";
|
|
2
|
+
import { clsx } from "clsx";
|
|
3
|
+
import { styles } from "./FilterGroup.styles.js";
|
|
4
|
+
import { HvFilterGroupProvider } from "./FilterGroupContext.js";
|
|
5
|
+
import { ClassNames } from "@emotion/react";
|
|
6
|
+
import { jsx, jsxs } from "@emotion/react/jsx-runtime";
|
|
7
|
+
import useUniqueId from "../../hooks/useUniqueId.js";
|
|
8
|
+
import { HvFilterGroupContent } from "./FilterContent/FilterContent.js";
|
|
9
|
+
import { useControlled } from "../../hooks/useControlled.js";
|
|
10
|
+
import { useLabels } from "../../hooks/useLabels.js";
|
|
11
|
+
import { HvFormElement } from "../Forms/FormElement/FormElement.js";
|
|
12
|
+
import { HvLabel } from "../Forms/Label/Label.js";
|
|
13
|
+
import { setId } from "../../utils/setId.js";
|
|
14
|
+
import { HvInfoMessage } from "../Forms/InfoMessage/InfoMessage.js";
|
|
15
|
+
import { HvWarningText } from "../Forms/WarningText/WarningText.js";
|
|
16
|
+
const DEFAULT_LABELS = {
|
|
17
|
+
applyLabel: "Apply",
|
|
18
|
+
cancelLabel: "Cancel",
|
|
19
|
+
clearLabel: "Clear Filters",
|
|
20
|
+
placeholder: "Filters",
|
|
21
|
+
searchBoxPlaceholder: "Search",
|
|
22
|
+
selectAll: "All",
|
|
23
|
+
multiSelectionConjunction: "/"
|
|
24
|
+
};
|
|
25
|
+
const HvFilterGroup = ({
|
|
26
|
+
className,
|
|
27
|
+
id,
|
|
28
|
+
name,
|
|
29
|
+
required = false,
|
|
30
|
+
disabled = false,
|
|
31
|
+
label,
|
|
32
|
+
"aria-label": ariaLabel,
|
|
33
|
+
"aria-labelledby": ariaLabelledBy,
|
|
34
|
+
description,
|
|
35
|
+
"aria-describedby": ariaDescribedBy,
|
|
36
|
+
onChange,
|
|
37
|
+
onCancel,
|
|
38
|
+
onClear,
|
|
39
|
+
status,
|
|
40
|
+
statusMessage,
|
|
41
|
+
labels: labelsProp,
|
|
42
|
+
defaultValue,
|
|
43
|
+
value,
|
|
44
|
+
filters,
|
|
45
|
+
horizontalPlacement = "right",
|
|
46
|
+
disablePortal = true,
|
|
47
|
+
escapeWithReference = true,
|
|
48
|
+
height = 350,
|
|
49
|
+
filterContentProps,
|
|
50
|
+
classes,
|
|
51
|
+
...others
|
|
52
|
+
}) => {
|
|
53
|
+
const [validationMessage] = useControlled(statusMessage, "Required");
|
|
54
|
+
const elementId = useUniqueId(id, "hvfiltergroup");
|
|
55
|
+
const labels = useLabels(DEFAULT_LABELS, labelsProp);
|
|
56
|
+
const hasLabel = label != null;
|
|
57
|
+
const hasDescription = description != null;
|
|
58
|
+
const canShowError = status !== void 0 || required;
|
|
59
|
+
return /* @__PURE__ */ jsx(ClassNames, {
|
|
60
|
+
children: ({
|
|
61
|
+
css
|
|
62
|
+
}) => /* @__PURE__ */ jsxs(HvFormElement, {
|
|
63
|
+
id,
|
|
64
|
+
name,
|
|
65
|
+
value,
|
|
66
|
+
status,
|
|
67
|
+
disabled,
|
|
68
|
+
required,
|
|
69
|
+
className: clsx(className, classes == null ? void 0 : classes.root, filterGroupClasses.root),
|
|
70
|
+
...others,
|
|
71
|
+
children: [(hasLabel || hasDescription) && /* @__PURE__ */ jsxs("div", {
|
|
72
|
+
className: clsx(classes == null ? void 0 : classes.labelContainer, filterGroupClasses.labelContainer, css(styles.labelContainer)),
|
|
73
|
+
children: [hasLabel && /* @__PURE__ */ jsx(HvLabel, {
|
|
74
|
+
id: setId(elementId, "label"),
|
|
75
|
+
htmlFor: setId(elementId, "input"),
|
|
76
|
+
label,
|
|
77
|
+
className: clsx(classes == null ? void 0 : classes.label, filterGroupClasses.label, css(styles.label))
|
|
78
|
+
}), hasDescription && /* @__PURE__ */ jsx(HvInfoMessage, {
|
|
79
|
+
id: setId(elementId, "description"),
|
|
80
|
+
className: clsx(classes == null ? void 0 : classes.description, filterGroupClasses.description),
|
|
81
|
+
children: description
|
|
82
|
+
})]
|
|
83
|
+
}), /* @__PURE__ */ jsxs(HvFilterGroupProvider, {
|
|
84
|
+
defaultValue,
|
|
85
|
+
value,
|
|
86
|
+
filters,
|
|
87
|
+
children: [/* @__PURE__ */ jsx(HvFilterGroupContent, {
|
|
88
|
+
id: elementId,
|
|
89
|
+
disabled,
|
|
90
|
+
disablePortal,
|
|
91
|
+
variableWidth: true,
|
|
92
|
+
placement: horizontalPlacement,
|
|
93
|
+
escapeWithReference,
|
|
94
|
+
"aria-label": ariaLabel,
|
|
95
|
+
"aria-labelledby": ariaLabelledBy,
|
|
96
|
+
status,
|
|
97
|
+
onChange,
|
|
98
|
+
onCancel,
|
|
99
|
+
onClear,
|
|
100
|
+
labels,
|
|
101
|
+
height,
|
|
102
|
+
...filterContentProps
|
|
103
|
+
}), canShowError && /* @__PURE__ */ jsx(HvWarningText, {
|
|
104
|
+
id: setId(elementId, "error"),
|
|
105
|
+
disableBorder: true,
|
|
106
|
+
className: clsx(classes == null ? void 0 : classes.error, filterGroupClasses.error),
|
|
107
|
+
children: validationMessage
|
|
108
|
+
})]
|
|
109
|
+
})]
|
|
110
|
+
})
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
export {
|
|
114
|
+
HvFilterGroup
|
|
115
|
+
};
|
|
116
|
+
//# sourceMappingURL=FilterGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterGroup.js","sources":["../../../../src/components/FilterGroup/FilterGroup.tsx"],"sourcesContent":["import {\n HvFormElement,\n HvFormElementProps,\n HvFormStatus,\n HvInfoMessage,\n HvLabel,\n HvWarningText,\n} from \"@core/components\";\nimport filterGroupClasses, { HvFilterGroupClasses } from \"./filterGroupClasses\";\nimport {\n HvFilterGroupContent,\n HvFilterGroupContentProps,\n} from \"./FilterContent\";\nimport { clsx } from \"clsx\";\nimport { useControlled, useLabels, useUniqueId } from \"@core/hooks\";\nimport { styles } from \"./FilterGroup.styles\";\nimport { setId } from \"@core/utils\";\nimport { HvFilterGroupProvider } from \"./FilterGroupContext\";\nimport { ClassNames } from \"@emotion/react\";\n\nexport type HvFilterGroupValue = (string | number)[][];\n\nexport interface HvFilterGroupLabels {\n /** Apply button label. */\n applyLabel?: string;\n /** Cancel button label. */\n cancelLabel?: string;\n /** Cancel button label. */\n clearLabel?: string;\n /** Placeholder label. */\n placeholder?: string;\n /** SearchBox placeholder label. */\n searchBoxPlaceholder?: string;\n /** Select All placeholder label. */\n selectAll?: string;\n /** Multi selection conjunction placeholder label. */\n multiSelectionConjunction?: string;\n}\n\nexport type HvFilterGroupFilters = {\n id: string;\n name: string;\n data: {\n id: string | number;\n name: string;\n }[];\n}[];\n\nexport type HvFilterGroupHorizontalPlacement = \"left\" | \"right\";\n\nexport interface HvFilterGroupProps\n extends Omit<\n HvFormElementProps,\n \"onChange\" | \"defaultValue\" | \"statusMessage\"\n > {\n /** The initial value of the input when in single calendar mode. */\n filters: HvFilterGroupFilters;\n /** The form element name. */\n name?: string;\n /**\n * The label of the form element.\n *\n * The form element must be labeled for accessibility reasons.\n * If not provided, an aria-label or aria-labelledby must be provided instead.\n */\n label?: React.ReactNode;\n /** Provide additional descriptive text for the form element. */\n description?: React.ReactNode;\n /** Indicates that the form element is disabled. */\n disabled?: boolean;\n /** Indicates that user input is required on the form element. */\n required?: boolean;\n /**\n * The status of the form element.\n *\n * Valid is correct, invalid is incorrect and standBy means no validations have run.\n *\n * When uncontrolled and unspecified it will default to \"standBy\" and change to either \"valid\"\n * or \"invalid\" after any change to the state.\n */\n status?: HvFormStatus;\n /** The error message to show when `status` is \"invalid\". Defaults to \"Required\". */\n statusMessage?: React.ReactNode;\n /** The callback fired when the cancel button is clicked. */\n onCancel?: (event: React.MouseEvent<HTMLButtonElement> | Event) => void;\n /** The callback fired when the clear filters button is clicked. */\n onClear?: (event: React.MouseEvent<HTMLButtonElement>) => void;\n /** The callback fired when the value changes. */\n onChange?: (\n event: React.MouseEvent<HTMLButtonElement>,\n value?: HvFilterGroupValue\n ) => void;\n /** An Object containing the various text associated with the input. */\n labels?: HvFilterGroupLabels;\n /** The placeholder value when nothing is selected. */\n placeholder?: string;\n /** The default value of the filter group. If defined the clear action will reset to it. */\n defaultValue?: HvFilterGroupValue;\n /** The value of the filter group. */\n value?: HvFilterGroupValue;\n /** The placement where the filter group should be placed according to the input. Options are `left` or `right`. */\n horizontalPlacement?: HvFilterGroupHorizontalPlacement;\n /** Disable the portal behavior. The children stay within it's parent DOM hierarchy. */\n disablePortal?: boolean;\n /** Sets if the filter container should be out of the screen or stay visible. */\n escapeWithReference?: boolean;\n /** The height of the filter panel, between 295 and 425. Defaults to 350 */\n height?: number | string;\n /** The filter content props */\n filterContentProps?: Partial<HvFilterGroupContentProps>;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvFilterGroupClasses;\n}\n\nconst DEFAULT_LABELS: HvFilterGroupLabels = {\n applyLabel: \"Apply\",\n cancelLabel: \"Cancel\",\n clearLabel: \"Clear Filters\",\n placeholder: \"Filters\",\n searchBoxPlaceholder: \"Search\",\n selectAll: \"All\",\n multiSelectionConjunction: \"/\",\n};\n\n/**\n * This component implements one potential use-case of the Filter Group pattern Design System Specifies.\n * Due to the enormous variety of capabilities required for this, we strongly recommend checking the code of the component and extend it yourself,\n * while we do not provide a better approach for building this component with smaller and more composable parts.\n */\nexport const HvFilterGroup = ({\n className,\n id,\n name,\n required = false,\n disabled = false,\n label,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n description,\n \"aria-describedby\": ariaDescribedBy,\n onChange,\n onCancel,\n onClear,\n status,\n statusMessage,\n labels: labelsProp,\n defaultValue,\n value,\n filters,\n horizontalPlacement = \"right\",\n disablePortal = true,\n escapeWithReference = true,\n height = 350,\n filterContentProps,\n classes,\n ...others\n}: HvFilterGroupProps) => {\n const [validationMessage] = useControlled(statusMessage, \"Required\");\n\n const elementId = useUniqueId(id, \"hvfiltergroup\");\n\n const labels = useLabels(DEFAULT_LABELS, labelsProp);\n\n const hasLabel = label != null;\n\n const hasDescription = description != null;\n\n // Error message area will only be needed if the status is being controlled\n // or if required is true\n const canShowError = status !== undefined || required;\n\n return (\n <ClassNames>\n {({ css }) => (\n <HvFormElement\n id={id}\n name={name}\n value={value}\n status={status}\n disabled={disabled}\n required={required}\n className={clsx(className, classes?.root, filterGroupClasses.root)}\n {...others}\n >\n {(hasLabel || hasDescription) && (\n <div\n className={clsx(\n classes?.labelContainer,\n filterGroupClasses.labelContainer,\n css(styles.labelContainer)\n )}\n >\n {hasLabel && (\n <HvLabel\n id={setId(elementId, \"label\")}\n htmlFor={setId(elementId, \"input\")}\n label={label}\n className={clsx(\n classes?.label,\n filterGroupClasses.label,\n css(styles.label)\n )}\n />\n )}\n\n {hasDescription && (\n <HvInfoMessage\n id={setId(elementId, \"description\")}\n className={clsx(\n classes?.description,\n filterGroupClasses.description\n )}\n >\n {description}\n </HvInfoMessage>\n )}\n </div>\n )}\n <HvFilterGroupProvider\n defaultValue={defaultValue}\n value={value}\n filters={filters}\n >\n <HvFilterGroupContent\n id={elementId}\n disabled={disabled}\n disablePortal={disablePortal}\n variableWidth\n placement={horizontalPlacement}\n escapeWithReference={escapeWithReference}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n status={status}\n onChange={onChange}\n onCancel={onCancel}\n onClear={onClear}\n labels={labels}\n height={height}\n {...filterContentProps}\n />\n {canShowError && (\n <HvWarningText\n id={setId(elementId, \"error\")}\n disableBorder\n className={clsx(classes?.error, filterGroupClasses.error)}\n >\n {validationMessage}\n </HvWarningText>\n )}\n </HvFilterGroupProvider>\n </HvFormElement>\n )}\n </ClassNames>\n );\n};\n"],"names":["DEFAULT_LABELS","applyLabel","cancelLabel","clearLabel","placeholder","searchBoxPlaceholder","selectAll","multiSelectionConjunction","HvFilterGroup","className","id","name","required","disabled","label","ariaLabel","ariaLabelledBy","description","ariaDescribedBy","onChange","onCancel","onClear","status","statusMessage","labels","labelsProp","defaultValue","value","filters","horizontalPlacement","disablePortal","escapeWithReference","height","filterContentProps","classes","others","validationMessage","useControlled","elementId","useUniqueId","useLabels","hasLabel","hasDescription","canShowError","undefined","ClassNames","children","css","HvFormElement","clsx","root","filterGroupClasses","labelContainer","styles","_jsx","HvLabel","setId","htmlFor","HvInfoMessage","_jsxs","HvFilterGroupProvider","HvFilterGroupContent","variableWidth","placement","HvWarningText","disableBorder","error"],"mappings":";;;;;;;;;;;;;;;AAkHA,MAAMA,iBAAsC;AAAA,EAC1CC,YAAY;AAAA,EACZC,aAAa;AAAA,EACbC,YAAY;AAAA,EACZC,aAAa;AAAA,EACbC,sBAAsB;AAAA,EACtBC,WAAW;AAAA,EACXC,2BAA2B;AAC7B;AAOO,MAAMC,gBAAgBA,CAAC;AAAA,EAC5BC;AAAAA,EACAC;AAAAA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C,OACnBiC,IAAIM,OAAOvC,KAAK,CAAC;AAAA,QAAA,CACjB,GAIL4B,kBACCY,oBAACI,eAAa;AAAA,UACZhD,IAAI8C,MAAMlB,WAAW,aAAa;AAAA,UAClC7B,WAAWwC,KACTf,mCAASjB,aACTkC,mBAAmBlC,WAAW;AAAA,UAC9B6B,UAED7B;AAAAA,QAAAA,CAEJ,CAAA;AAAA,MAAA,CAEJ,GACD0C,qBAACC,uBAAqB;AAAA,QACpBlC;AAAAA,QACAC;AAAAA,QACAC;AAAAA,QAAiBkB,UAAA,CAEjBQ,oBAACO,sBAAoB;AAAA,UACnBnD,IAAI4B;AAAAA,UACJzB;AAAAA,UACAiB;AAAAA,UACAgC,eAAa;AAAA,UACbC,WAAWlC;AAAAA,UACXE;AAAAA,UACA,cAAYhB;AAAAA,UACZ,mBAAiBC;AAAAA,UACjBM;AAAAA,UACAH;AAAAA,UACAC;AAAAA,UACAC;AAAAA,UACAG;AAAAA,UACAQ;AAAAA,UAAe,GACXC;AAAAA,QAAAA,CAAkB,GAEvBU,gBACCW,oBAACU,eAAa;AAAA,UACZtD,IAAI8C,MAAMlB,WAAW,OAAO;AAAA,UAC5B2B,eAAa;AAAA,UACbxD,WAAWwC,KAAKf,mCAASgC,OAAOf,mBAAmBe,KAAK;AAAA,UAAEpB,UAEzDV;AAAAA,QAAAA,CAEJ,CAAA;AAAA,MAAA,CACqB,CAAA;AAAA,IAAA,CAAA;AAAA,EAAA,CAGjB;AAEjB;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterGroup.styles.js","sources":["../../../../src/components/FilterGroup/FilterGroup.styles.tsx"],"sourcesContent":["import { CSSInterpolation } from \"@emotion/serialize\";\n\nexport const styles: {\n label: CSSInterpolation;\n labelContainer: CSSInterpolation;\n} = {\n label: {\n display: \"flex\",\n alignItems: \"flex-start\",\n },\n labelContainer: { display: \"flex\", alignItems: \"flex-start\" },\n};\n"],"names":["styles","label","display","alignItems","labelContainer"],"mappings":"AAEO,MAAMA,SAGT;AAAA,EACFC,OAAO;AAAA,IACLC,SAAS;AAAA,IACTC,YAAY;AAAA,EACd;AAAA,EACAC,gBAAgB;AAAA,IAAEF,SAAS;AAAA,IAAQC,YAAY;AAAA,EAAa;AAC9D;"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { createContext, useState, useEffect, useCallback, useMemo } from "react";
|
|
2
|
+
import isEqual from "lodash/isEqual";
|
|
3
|
+
import { jsx } from "@emotion/react/jsx-runtime";
|
|
4
|
+
import { useSavedState } from "../../utils/useSavedState.js";
|
|
5
|
+
const HvFilterGroupContext = createContext({
|
|
6
|
+
activeGroup: 0,
|
|
7
|
+
setActiveGroup: () => {
|
|
8
|
+
},
|
|
9
|
+
filterOptions: [],
|
|
10
|
+
setFilterValues: () => {
|
|
11
|
+
},
|
|
12
|
+
rollbackFilters: () => {
|
|
13
|
+
},
|
|
14
|
+
clearFilters: () => {
|
|
15
|
+
},
|
|
16
|
+
applyFilters: () => {
|
|
17
|
+
},
|
|
18
|
+
applyDisabled: false,
|
|
19
|
+
filterValues: [],
|
|
20
|
+
appliedFilters: void 0,
|
|
21
|
+
defaultValue: void 0
|
|
22
|
+
});
|
|
23
|
+
const groups = (filters) => filters.map(() => []);
|
|
24
|
+
const HvFilterGroupProvider = ({
|
|
25
|
+
defaultValue,
|
|
26
|
+
value,
|
|
27
|
+
filters,
|
|
28
|
+
children
|
|
29
|
+
}) => {
|
|
30
|
+
const [group, setActiveGroup] = useState(0);
|
|
31
|
+
const [filterValues, setFilterValues, rollbackFilters, appliedFilters] = useSavedState(value || groups(filters));
|
|
32
|
+
const [applyDisabled, setApplyDisabled] = useState(false);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
setFilterValues(value, true);
|
|
35
|
+
}, [value, setFilterValues]);
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
setApplyDisabled(isEqual(filterValues, appliedFilters));
|
|
38
|
+
}, [filterValues, appliedFilters]);
|
|
39
|
+
const clearFilters = useCallback(() => {
|
|
40
|
+
setFilterValues(defaultValue || groups(filters));
|
|
41
|
+
}, [filters, setFilterValues, defaultValue]);
|
|
42
|
+
const applyFilters = useCallback(() => {
|
|
43
|
+
setFilterValues(filterValues, true);
|
|
44
|
+
}, [filterValues, setFilterValues]);
|
|
45
|
+
const contextValue = useMemo(() => ({
|
|
46
|
+
activeGroup: group,
|
|
47
|
+
setActiveGroup,
|
|
48
|
+
filterOptions: filters,
|
|
49
|
+
filterValues,
|
|
50
|
+
setFilterValues,
|
|
51
|
+
appliedFilters,
|
|
52
|
+
rollbackFilters,
|
|
53
|
+
clearFilters,
|
|
54
|
+
applyFilters,
|
|
55
|
+
applyDisabled,
|
|
56
|
+
defaultValue
|
|
57
|
+
}), [appliedFilters, applyDisabled, applyFilters, clearFilters, filterValues, filters, group, rollbackFilters, setFilterValues, defaultValue]);
|
|
58
|
+
return /* @__PURE__ */ jsx(HvFilterGroupContext.Provider, {
|
|
59
|
+
value: contextValue,
|
|
60
|
+
children
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
export {
|
|
64
|
+
HvFilterGroupContext,
|
|
65
|
+
HvFilterGroupProvider
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=FilterGroupContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterGroupContext.js","sources":["../../../../src/components/FilterGroup/FilterGroupContext.tsx"],"sourcesContent":["import {\n Dispatch,\n SetStateAction,\n createContext,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport isEqual from \"lodash/isEqual\";\nimport { useSavedState } from \"@core/utils\";\nimport { HvFilterGroupFilters, HvFilterGroupValue } from \"./FilterGroup\";\n\ninterface HvFilterGroupContextValue {\n activeGroup: number;\n setActiveGroup: Dispatch<SetStateAction<number>>;\n filterOptions: HvFilterGroupFilters;\n setFilterValues: (value?: HvFilterGroupValue, save?: boolean) => void;\n rollbackFilters: () => void;\n clearFilters: () => void;\n applyFilters: () => void;\n applyDisabled: boolean;\n appliedFilters?: HvFilterGroupValue;\n defaultValue?: HvFilterGroupValue;\n filterValues?: HvFilterGroupValue;\n}\n\nexport const HvFilterGroupContext = createContext<HvFilterGroupContextValue>({\n activeGroup: 0,\n setActiveGroup: () => {},\n filterOptions: [],\n setFilterValues: () => {},\n rollbackFilters: () => {},\n clearFilters: () => {},\n applyFilters: () => {},\n applyDisabled: false,\n filterValues: [],\n appliedFilters: undefined,\n defaultValue: undefined,\n});\n\nconst groups = (filters: HvFilterGroupFilters) => filters.map(() => []);\n\ninterface HvFilterGroupProviderProps {\n children: React.ReactNode;\n filters: HvFilterGroupFilters;\n defaultValue?: HvFilterGroupValue;\n value?: HvFilterGroupValue;\n}\n\nexport const HvFilterGroupProvider = ({\n defaultValue,\n value,\n filters,\n children,\n}: HvFilterGroupProviderProps) => {\n const [group, setActiveGroup] = useState<number>(0);\n const [filterValues, setFilterValues, rollbackFilters, appliedFilters] =\n useSavedState<HvFilterGroupValue>(value || groups(filters));\n const [applyDisabled, setApplyDisabled] = useState<boolean>(false);\n\n useEffect(() => {\n setFilterValues(value, true);\n }, [value, setFilterValues]);\n\n useEffect(() => {\n setApplyDisabled(isEqual(filterValues, appliedFilters));\n }, [filterValues, appliedFilters]);\n\n const clearFilters = useCallback(() => {\n setFilterValues(defaultValue || groups(filters));\n }, [filters, setFilterValues, defaultValue]);\n\n const applyFilters = useCallback(() => {\n setFilterValues(filterValues, true);\n }, [filterValues, setFilterValues]);\n\n const contextValue: HvFilterGroupContextValue = useMemo(\n () => ({\n activeGroup: group,\n setActiveGroup,\n filterOptions: filters,\n filterValues,\n setFilterValues,\n appliedFilters,\n rollbackFilters,\n clearFilters,\n applyFilters,\n applyDisabled,\n defaultValue,\n }),\n [\n appliedFilters,\n applyDisabled,\n applyFilters,\n clearFilters,\n filterValues,\n filters,\n group,\n rollbackFilters,\n setFilterValues,\n defaultValue,\n ]\n );\n\n return (\n <HvFilterGroupContext.Provider value={contextValue}>\n {children}\n </HvFilterGroupContext.Provider>\n );\n};\n"],"names":["HvFilterGroupContext","createContext","activeGroup","setActiveGroup","filterOptions","setFilterValues","rollbackFilters","clearFilters","applyFilters","applyDisabled","filterValues","appliedFilters","undefined","defaultValue","groups","filters","map","HvFilterGroupProvider","value","children","group","useState","useSavedState","setApplyDisabled","useEffect","isEqual","useCallback","contextValue","useMemo","_jsx","Provider"],"mappings":";;;;AA2BO,MAAMA,uBAAuBC,cAAyC;AAAA,EAC3EC,aAAa;AAAA,EACbC,gBAAgBA,MAAM;AAAA,EAAC;AAAA,EACvBC,eAAe,CAAE;AAAA,EACjBC,iBAAiBA,MAAM;AAAA,EAAC;AAAA,EACxBC,iBAAiBA,MAAM;AAAA,EAAC;AAAA,EACxBC,cAAcA,MAAM;AAAA,EAAC;AAAA,EACrBC,cAAcA,MAAM;AAAA,EAAC;AAAA,EACrBC,eAAe;AAAA,EACfC,cAAc,CAAE;AAAA,EAChBC,gBAAgBC;AAAAA,EAChBC,cAAcD;AAChB,CAAC;AAED,MAAME,SAASA,CAACC,YAAkCA,QAAQC,IAAI,MAAM,CAAE,CAAA;AAS/D,MAAMC,wBAAwBA,CAAC;AAAA,EACpCJ;AAAAA,EACAK;AAAAA,EACAH;AAAAA,EACAI;AAC0B,MAAM;AAChC,QAAM,CAACC,OAAOjB,cAAc,IAAIkB,SAAiB,CAAC;AAC5C,QAAA,CAACX,cAAcL,iBAAiBC,iBAAiBK,cAAc,IACnEW,cAAkCJ,SAASJ,OAAOC,OAAO,CAAC;AAC5D,QAAM,CAACN,eAAec,gBAAgB,IAAIF,SAAkB,KAAK;AAEjEG,YAAU,MAAM;AACdnB,oBAAgBa,OAAO,IAAI;AAAA,EAAA,GAC1B,CAACA,OAAOb,eAAe,CAAC;AAE3BmB,YAAU,MAAM;AACGC,qBAAAA,QAAQf,cAAcC,cAAc,CAAC;AAAA,EAAA,GACrD,CAACD,cAAcC,cAAc,CAAC;AAE3BJ,QAAAA,eAAemB,YAAY,MAAM;AACrBb,oBAAAA,gBAAgBC,OAAOC,OAAO,CAAC;AAAA,EAC9C,GAAA,CAACA,SAASV,iBAAiBQ,YAAY,CAAC;AAErCL,QAAAA,eAAekB,YAAY,MAAM;AACrCrB,oBAAgBK,cAAc,IAAI;AAAA,EAAA,GACjC,CAACA,cAAcL,eAAe,CAAC;AAE5BsB,QAAAA,eAA0CC,QAC9C,OAAO;AAAA,IACL1B,aAAakB;AAAAA,IACbjB;AAAAA,IACAC,eAAeW;AAAAA,IACfL;AAAAA,IACAL;AAAAA,IACAM;AAAAA,IACAL;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAI;AAAAA,EAEF,IAAA,CACEF,gBACAF,eACAD,cACAD,cACAG,cACAK,SACAK,OACAd,iBACAD,iBACAQ,YAAY,CACb;AAIDgB,SAAAA,oBAAC7B,qBAAqB8B,UAAQ;AAAA,IAACZ,OAAOS;AAAAA,IAAaR;AAAAA,EAAAA,CAEnB;AAEpC;"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
import { HvFilterGroupContext } from "../FilterGroupContext.js";
|
|
3
|
+
import { ClassNames } from "@emotion/react";
|
|
4
|
+
import { styles } from "./LeftPanel.styles.js";
|
|
5
|
+
import { jsx } from "@emotion/react/jsx-runtime";
|
|
6
|
+
import { HvFilterGroupCounter } from "../Counter/Counter.js";
|
|
7
|
+
import { HvPanel } from "../../Panel/Panel.js";
|
|
8
|
+
import { setId } from "../../../utils/setId.js";
|
|
9
|
+
import { HvListContainer } from "../../ListContainer/ListContainer.js";
|
|
10
|
+
import { wrapperTooltip } from "../../../utils/wrapperTooltip.js";
|
|
11
|
+
import { HvListItem } from "../../ListContainer/ListItem/ListItem.js";
|
|
12
|
+
const HvFilterGroupLeftPanel = ({
|
|
13
|
+
id,
|
|
14
|
+
className,
|
|
15
|
+
emptyElement
|
|
16
|
+
}) => {
|
|
17
|
+
const {
|
|
18
|
+
filterOptions,
|
|
19
|
+
activeGroup,
|
|
20
|
+
setActiveGroup
|
|
21
|
+
} = useContext(HvFilterGroupContext);
|
|
22
|
+
return /* @__PURE__ */ jsx(ClassNames, {
|
|
23
|
+
children: ({
|
|
24
|
+
css
|
|
25
|
+
}) => /* @__PURE__ */ jsx(HvPanel, {
|
|
26
|
+
id: setId(id, "leftPanel"),
|
|
27
|
+
className,
|
|
28
|
+
children: filterOptions.length > 0 ? /* @__PURE__ */ jsx(HvListContainer, {
|
|
29
|
+
id: setId(id, "leftPanel-list"),
|
|
30
|
+
condensed: true,
|
|
31
|
+
interactive: true,
|
|
32
|
+
children: filterOptions.map((group, index) => {
|
|
33
|
+
const ItemText = wrapperTooltip(true, group.name, group.name);
|
|
34
|
+
return /* @__PURE__ */ jsx(HvListItem, {
|
|
35
|
+
id: group.id,
|
|
36
|
+
className: css(styles.listItem),
|
|
37
|
+
onClick: () => setActiveGroup(index),
|
|
38
|
+
selected: filterOptions[activeGroup].id === group.id,
|
|
39
|
+
endAdornment: /* @__PURE__ */ jsx(HvFilterGroupCounter, {
|
|
40
|
+
id: group.id
|
|
41
|
+
}),
|
|
42
|
+
children: /* @__PURE__ */ jsx(ItemText, {})
|
|
43
|
+
}, group.name);
|
|
44
|
+
})
|
|
45
|
+
}) : emptyElement
|
|
46
|
+
})
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
export {
|
|
50
|
+
HvFilterGroupLeftPanel
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=LeftPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LeftPanel.js","sources":["../../../../../src/components/FilterGroup/LeftPanel/LeftPanel.tsx"],"sourcesContent":["import { useContext } from \"react\";\nimport { HvFilterGroupContext } from \"../FilterGroupContext\";\nimport { HvListContainer, HvListItem, HvPanel } from \"@core/components\";\nimport { setId, wrapperTooltip } from \"@core/utils\";\nimport { HvFilterGroupCounter } from \"../Counter\";\nimport { ClassNames } from \"@emotion/react\";\nimport { styles } from \"./LeftPanel.styles\";\n\nexport interface HvFilterGroupLeftPanelProps {\n id?: string;\n className?: string;\n emptyElement?: React.ReactNode;\n}\n\nexport const HvFilterGroupLeftPanel = ({\n id,\n className,\n emptyElement,\n}: HvFilterGroupLeftPanelProps) => {\n const { filterOptions, activeGroup, setActiveGroup } =\n useContext(HvFilterGroupContext);\n\n return (\n <ClassNames>\n {({ css }) => (\n <HvPanel id={setId(id, \"leftPanel\")} className={className}>\n {filterOptions.length > 0 ? (\n <HvListContainer\n id={setId(id, \"leftPanel-list\")}\n condensed\n interactive\n >\n {filterOptions.map((group, index) => {\n const ItemText = wrapperTooltip(true, group.name, group.name);\n\n return (\n <HvListItem\n id={group.id}\n key={group.name}\n className={css(styles.listItem)}\n onClick={() => setActiveGroup(index)}\n selected={filterOptions[activeGroup].id === group.id}\n endAdornment={<HvFilterGroupCounter id={group.id} />}\n >\n <ItemText />\n </HvListItem>\n );\n })}\n </HvListContainer>\n ) : (\n emptyElement\n )}\n </HvPanel>\n )}\n </ClassNames>\n );\n};\n"],"names":["HvFilterGroupLeftPanel","id","className","emptyElement","filterOptions","activeGroup","setActiveGroup","useContext","HvFilterGroupContext","ClassNames","children","css","HvPanel","setId","length","HvListContainer","condensed","interactive","map","group","index","ItemText","wrapperTooltip","name","HvListItem","styles","listItem","onClick","selected","endAdornment","HvFilterGroupCounter","_jsx"],"mappings":";;;;;;;;;;;AAcO,MAAMA,yBAAyBA,CAAC;AAAA,EACrCC;AAAAA,EACAC;AAAAA,EACAC;AAC2B,MAAM;AAC3B,QAAA;AAAA,IAAEC;AAAAA,IAAeC;AAAAA,IAAaC;AAAAA,EAAAA,IAClCC,WAAWC,oBAAoB;AAEjC,6BACGC,YAAU;AAAA,IAAAC,UACRA,CAAC;AAAA,MAAEC;AAAAA,IAAAA,0BACDC,SAAO;AAAA,MAACX,IAAIY,MAAMZ,IAAI,WAAW;AAAA,MAAGC;AAAAA,MAAqBQ,UACvDN,cAAcU,SAAS,wBACrBC,iBAAe;AAAA,QACdd,IAAIY,MAAMZ,IAAI,gBAAgB;AAAA,QAC9Be,WAAS;AAAA,QACTC,aAAW;AAAA,QAAAP,UAEVN,cAAcc,IAAI,CAACC,OAAOC,UAAU;AACnC,gBAAMC,WAAWC,eAAe,MAAMH,MAAMI,MAAMJ,MAAMI,IAAI;AAE5D,qCACGC,YAAU;AAAA,YACTvB,IAAIkB,MAAMlB;AAAAA,YAEVC,WAAWS,IAAIc,OAAOC,QAAQ;AAAA,YAC9BC,SAASA,MAAMrB,eAAec,KAAK;AAAA,YACnCQ,UAAUxB,cAAcC,WAAW,EAAEJ,OAAOkB,MAAMlB;AAAAA,YAClD4B,kCAAeC,sBAAoB;AAAA,cAAC7B,IAAIkB,MAAMlB;AAAAA,YAAAA,CAAO;AAAA,YAAAS,UAErDqB,oBAACV,UAAQ,EAAA;AAAA,UAAA,GANJF,MAAMI,IAAI;AAAA,QAAA,CASpB;AAAA,MAAC,CAAA,IAGJpB;AAAAA,IAAAA,CACD;AAAA,EAAA,CAGM;AAEjB;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LeftPanel.styles.js","sources":["../../../../../src/components/FilterGroup/LeftPanel/LeftPanel.styles.tsx"],"sourcesContent":["import { CSSInterpolation } from \"@emotion/serialize\";\n\nexport const styles: {\n listItem: CSSInterpolation;\n} = {\n listItem: {\n display: \"flex\",\n justifyContent: \"space-between\",\n },\n};\n"],"names":["styles","listItem","display","justifyContent"],"mappings":"AAEO,MAAMA,SAET;AAAA,EACFC,UAAU;AAAA,IACRC,SAAS;AAAA,IACTC,gBAAgB;AAAA,EAClB;AACF;"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { useState, useContext, useMemo, useCallback, useEffect } from "react";
|
|
2
|
+
import { HvFilterGroupContext } from "../FilterGroupContext.js";
|
|
3
|
+
import cloneDeep from "lodash/cloneDeep";
|
|
4
|
+
import { ClassNames } from "@emotion/react";
|
|
5
|
+
import { styles } from "./RightPanel.styles.js";
|
|
6
|
+
import { jsx, jsxs, Fragment } from "@emotion/react/jsx-runtime";
|
|
7
|
+
import { HvTypography } from "../../Typography/Typography.js";
|
|
8
|
+
import { HvCheckBox } from "../../CheckBox/CheckBox.js";
|
|
9
|
+
import { setId } from "../../../utils/setId.js";
|
|
10
|
+
import { HvPanel } from "../../Panel/Panel.js";
|
|
11
|
+
import { HvInput } from "../../Input/Input.js";
|
|
12
|
+
import { HvList } from "../../List/List.js";
|
|
13
|
+
const HvFilterGroupRightPanel = ({
|
|
14
|
+
id,
|
|
15
|
+
className,
|
|
16
|
+
labels,
|
|
17
|
+
emptyElement
|
|
18
|
+
}) => {
|
|
19
|
+
const [searchStr, setSearchStr] = useState("");
|
|
20
|
+
const [allSelected, setAllSelected] = useState(false);
|
|
21
|
+
const [anySelected, setAnySelected] = useState(false);
|
|
22
|
+
const {
|
|
23
|
+
filterOptions,
|
|
24
|
+
filterValues = [],
|
|
25
|
+
setFilterValues,
|
|
26
|
+
activeGroup
|
|
27
|
+
} = useContext(HvFilterGroupContext);
|
|
28
|
+
const activeGroupOptions = useMemo(() => {
|
|
29
|
+
var _a;
|
|
30
|
+
return ((_a = filterOptions[activeGroup]) == null ? void 0 : _a.data.map((option) => option.id)) || [];
|
|
31
|
+
}, [filterOptions, activeGroup]);
|
|
32
|
+
const activeFilterValues = useMemo(() => {
|
|
33
|
+
var _a;
|
|
34
|
+
return ((_a = filterValues[activeGroup]) == null ? void 0 : _a.filter((value) => activeGroupOptions.includes(value))) || [];
|
|
35
|
+
}, [filterValues, activeGroupOptions, activeGroup]);
|
|
36
|
+
const listValues = useMemo(() => {
|
|
37
|
+
var _a;
|
|
38
|
+
return ((_a = filterOptions[activeGroup]) == null ? void 0 : _a.data.map((option) => {
|
|
39
|
+
var _a2;
|
|
40
|
+
return {
|
|
41
|
+
...option,
|
|
42
|
+
label: option.name,
|
|
43
|
+
selected: (_a2 = filterValues[activeGroup]) == null ? void 0 : _a2.includes(option.id),
|
|
44
|
+
isHidden: option.name.toLowerCase().indexOf(searchStr.toLowerCase()) < 0
|
|
45
|
+
};
|
|
46
|
+
})) || [];
|
|
47
|
+
}, [filterOptions, filterValues, activeGroup, searchStr]);
|
|
48
|
+
const updateSelectAll = useCallback(() => {
|
|
49
|
+
const nbrSelected = activeFilterValues == null ? void 0 : activeFilterValues.length;
|
|
50
|
+
const hasSelection = nbrSelected > 0;
|
|
51
|
+
const allSelect = nbrSelected === activeGroupOptions.length;
|
|
52
|
+
setAnySelected(hasSelection);
|
|
53
|
+
setAllSelected(hasSelection && allSelect);
|
|
54
|
+
}, [activeFilterValues, activeGroupOptions]);
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
updateSelectAll();
|
|
57
|
+
}, [activeFilterValues, updateSelectAll]);
|
|
58
|
+
useEffect(() => setSearchStr(""), [activeGroup]);
|
|
59
|
+
const onChangeHandler = (values) => {
|
|
60
|
+
const newFilterValues = filterOptions.map((_, i) => activeGroup === i ? values.filter((v) => v.selected).map((v) => v.id) : [...filterValues[i] || []]);
|
|
61
|
+
setFilterValues(newFilterValues);
|
|
62
|
+
};
|
|
63
|
+
const handleSelectAll = useCallback(() => {
|
|
64
|
+
const newFilterValues = cloneDeep(filterValues);
|
|
65
|
+
newFilterValues[activeGroup] = anySelected ? [] : activeGroupOptions;
|
|
66
|
+
setFilterValues(newFilterValues);
|
|
67
|
+
}, [activeGroup, activeGroupOptions, anySelected, filterValues, setFilterValues]);
|
|
68
|
+
const SelectAll = useCallback(() => {
|
|
69
|
+
const nbrSelected = activeFilterValues == null ? void 0 : activeFilterValues.length;
|
|
70
|
+
const defaultLabel = /* @__PURE__ */ jsx(HvTypography, {
|
|
71
|
+
component: "span",
|
|
72
|
+
children: nbrSelected > 0 ? /* @__PURE__ */ jsxs(Fragment, {
|
|
73
|
+
children: [/* @__PURE__ */ jsx("b", {
|
|
74
|
+
children: nbrSelected
|
|
75
|
+
}), ` ${labels == null ? void 0 : labels.multiSelectionConjunction} ${activeGroupOptions.length}`]
|
|
76
|
+
}) : /* @__PURE__ */ jsxs(Fragment, {
|
|
77
|
+
children: [/* @__PURE__ */ jsx("b", {
|
|
78
|
+
children: labels == null ? void 0 : labels.selectAll
|
|
79
|
+
}), ` (${activeGroupOptions.length})`]
|
|
80
|
+
})
|
|
81
|
+
});
|
|
82
|
+
return /* @__PURE__ */ jsx(ClassNames, {
|
|
83
|
+
children: ({
|
|
84
|
+
css
|
|
85
|
+
}) => /* @__PURE__ */ jsx("div", {
|
|
86
|
+
className: css(styles.selectAllContainer),
|
|
87
|
+
children: /* @__PURE__ */ jsx(HvCheckBox, {
|
|
88
|
+
id: setId(id, "select-all"),
|
|
89
|
+
label: defaultLabel,
|
|
90
|
+
onChange: () => handleSelectAll(),
|
|
91
|
+
className: css(styles.selectAll),
|
|
92
|
+
indeterminate: anySelected && !allSelected,
|
|
93
|
+
checked: allSelected
|
|
94
|
+
})
|
|
95
|
+
})
|
|
96
|
+
});
|
|
97
|
+
}, [activeFilterValues == null ? void 0 : activeFilterValues.length, activeGroupOptions.length, allSelected, anySelected, handleSelectAll, id, labels]);
|
|
98
|
+
return /* @__PURE__ */ jsx(ClassNames, {
|
|
99
|
+
children: ({
|
|
100
|
+
css
|
|
101
|
+
}) => /* @__PURE__ */ jsx(HvPanel, {
|
|
102
|
+
id: setId(id, "rightPanel"),
|
|
103
|
+
className,
|
|
104
|
+
children: listValues.length > 0 ? /* @__PURE__ */ jsxs(Fragment, {
|
|
105
|
+
children: [/* @__PURE__ */ jsx(HvInput, {
|
|
106
|
+
id: setId(id, "search"),
|
|
107
|
+
classes: {
|
|
108
|
+
root: css(styles.search)
|
|
109
|
+
},
|
|
110
|
+
type: "search",
|
|
111
|
+
placeholder: labels == null ? void 0 : labels.searchBoxPlaceholder,
|
|
112
|
+
value: searchStr,
|
|
113
|
+
onChange: (_, str) => setSearchStr(str)
|
|
114
|
+
}), /* @__PURE__ */ jsx(SelectAll, {}), /* @__PURE__ */ jsx(HvList, {
|
|
115
|
+
id: setId(id, "list"),
|
|
116
|
+
values: listValues,
|
|
117
|
+
className: css(styles.list),
|
|
118
|
+
multiSelect: true,
|
|
119
|
+
useSelector: true,
|
|
120
|
+
showSelectAll: false,
|
|
121
|
+
onChange: onChangeHandler,
|
|
122
|
+
selectable: true,
|
|
123
|
+
condensed: true,
|
|
124
|
+
hasTooltips: true
|
|
125
|
+
}, activeGroup)]
|
|
126
|
+
}) : emptyElement
|
|
127
|
+
})
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
export {
|
|
131
|
+
HvFilterGroupRightPanel
|
|
132
|
+
};
|
|
133
|
+
//# sourceMappingURL=RightPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RightPanel.js","sources":["../../../../../src/components/FilterGroup/RightPanel/RightPanel.tsx"],"sourcesContent":["import {\n HvCheckBox,\n HvInput,\n HvList,\n HvPanel,\n HvTypography,\n} from \"@core/components\";\nimport { setId } from \"@core/utils\";\nimport { useCallback, useContext, useEffect, useMemo, useState } from \"react\";\nimport { HvFilterGroupContext } from \"../FilterGroupContext\";\nimport cloneDeep from \"lodash/cloneDeep\";\nimport { ClassNames } from \"@emotion/react\";\nimport { styles } from \"./RightPanel.styles\";\n\nexport interface HvFilterGroupRightPanelProps {\n id?: string;\n className?: string;\n labels?: {\n searchBoxPlaceholder?: string;\n selectAll?: string;\n multiSelectionConjunction?: string;\n };\n emptyElement?: React.ReactNode;\n}\n\nexport const HvFilterGroupRightPanel = ({\n id,\n className,\n labels,\n emptyElement,\n}: HvFilterGroupRightPanelProps) => {\n const [searchStr, setSearchStr] = useState<string>(\"\");\n const [allSelected, setAllSelected] = useState<boolean>(false);\n const [anySelected, setAnySelected] = useState<boolean>(false);\n\n const {\n filterOptions,\n filterValues = [],\n setFilterValues,\n activeGroup,\n } = useContext(HvFilterGroupContext);\n\n const activeGroupOptions = useMemo(\n () => filterOptions[activeGroup]?.data.map((option) => option.id) || [],\n [filterOptions, activeGroup]\n );\n\n const activeFilterValues = useMemo(\n () =>\n filterValues[activeGroup]?.filter((value) =>\n activeGroupOptions.includes(value)\n ) || [],\n [filterValues, activeGroupOptions, activeGroup]\n );\n\n const listValues = useMemo(\n () =>\n filterOptions[activeGroup]?.data.map((option) => ({\n ...option,\n label: option.name,\n selected: filterValues[activeGroup]?.includes(option.id),\n isHidden:\n option.name.toLowerCase().indexOf(searchStr.toLowerCase()) < 0,\n })) || [],\n [filterOptions, filterValues, activeGroup, searchStr]\n );\n\n const updateSelectAll = useCallback(() => {\n const nbrSelected = activeFilterValues?.length;\n const hasSelection = nbrSelected > 0;\n const allSelect = nbrSelected === activeGroupOptions.length;\n\n setAnySelected(hasSelection);\n setAllSelected(hasSelection && allSelect);\n }, [activeFilterValues, activeGroupOptions]);\n\n useEffect(() => {\n updateSelectAll();\n }, [activeFilterValues, updateSelectAll]);\n\n useEffect(() => setSearchStr(\"\"), [activeGroup]);\n\n const onChangeHandler = (values) => {\n const newFilterValues = filterOptions.map((_, i) =>\n activeGroup === i\n ? values.filter((v) => v.selected).map((v) => v.id)\n : [...(filterValues[i] || [])]\n );\n setFilterValues(newFilterValues);\n };\n\n const handleSelectAll = useCallback(() => {\n const newFilterValues = cloneDeep(filterValues);\n newFilterValues[activeGroup] = anySelected ? [] : activeGroupOptions;\n\n setFilterValues(newFilterValues);\n }, [\n activeGroup,\n activeGroupOptions,\n anySelected,\n filterValues,\n setFilterValues,\n ]);\n\n /**\n * Create selectAll component.\n *\n * @returns {*}\n */\n const SelectAll = useCallback(() => {\n const nbrSelected = activeFilterValues?.length;\n\n const defaultLabel = (\n <HvTypography component=\"span\">\n {nbrSelected > 0 ? (\n <>\n <b>{nbrSelected}</b>\n {` ${labels?.multiSelectionConjunction} ${activeGroupOptions.length}`}\n </>\n ) : (\n <>\n <b>{labels?.selectAll}</b>\n {` (${activeGroupOptions.length})`}\n </>\n )}\n </HvTypography>\n );\n\n return (\n <ClassNames>\n {({ css }) => (\n <div className={css(styles.selectAllContainer)}>\n <HvCheckBox\n id={setId(id, \"select-all\")}\n label={defaultLabel}\n onChange={() => handleSelectAll()}\n className={css(styles.selectAll)}\n indeterminate={anySelected && !allSelected}\n checked={allSelected}\n />\n </div>\n )}\n </ClassNames>\n );\n }, [\n activeFilterValues?.length,\n activeGroupOptions.length,\n allSelected,\n anySelected,\n handleSelectAll,\n id,\n labels,\n ]);\n\n return (\n <ClassNames>\n {({ css }) => (\n <HvPanel id={setId(id, \"rightPanel\")} className={className}>\n {listValues.length > 0 ? (\n <>\n <HvInput\n id={setId(id, \"search\")}\n classes={{\n root: css(styles.search),\n }}\n type=\"search\"\n placeholder={labels?.searchBoxPlaceholder}\n value={searchStr}\n onChange={(_, str) => setSearchStr(str)}\n />\n <SelectAll />\n <HvList\n key={activeGroup}\n id={setId(id, \"list\")}\n values={listValues}\n className={css(styles.list)}\n multiSelect\n useSelector\n showSelectAll={false}\n onChange={onChangeHandler}\n selectable\n condensed\n hasTooltips\n />\n </>\n ) : (\n emptyElement\n )}\n </HvPanel>\n )}\n </ClassNames>\n );\n};\n"],"names":["HvFilterGroupRightPanel","id","className","labels","emptyElement","searchStr","setSearchStr","useState","allSelected","setAllSelected","anySelected","setAnySelected","filterOptions","filterValues","setFilterValues","activeGroup","useContext","HvFilterGroupContext","activeGroupOptions","useMemo","data","map","option","activeFilterValues","filter","value","includes","listValues","label","name","selected","isHidden","toLowerCase","indexOf","updateSelectAll","useCallback","nbrSelected","length","hasSelection","allSelect","useEffect","onChangeHandler","values","newFilterValues","_","i","v","handleSelectAll","cloneDeep","SelectAll","defaultLabel","HvTypography","component","children","_jsxs","_Fragment","_jsx","multiSelectionConjunction","selectAll","ClassNames","css","styles","selectAllContainer","HvCheckBox","setId","onChange","indeterminate","checked","HvPanel","HvInput","classes","root","search","type","placeholder","searchBoxPlaceholder","str","HvList","list","multiSelect","useSelector","showSelectAll","selectable","condensed","hasTooltips"],"mappings":";;;;;;;;;;;;AAyBO,MAAMA,0BAA0BA,CAAC;AAAA,EACtCC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A,UACVyC,YAAU;AAAA,UACVC,WAAS;AAAA,UACTC,aAAW;AAAA,QAAA,GAVNrE,WAAW,CAWhB;AAAA,MAAA,CAAA,IAGJX;AAAAA,IAAAA,CACD;AAAA,EAAA,CAGM;AAEjB;"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { theme } from "@hitachivantara/uikit-styles";
|
|
2
|
+
const styles = {
|
|
3
|
+
search: {
|
|
4
|
+
marginBottom: theme.spacing("xs")
|
|
5
|
+
},
|
|
6
|
+
list: {
|
|
7
|
+
width: "calc(100% + 8px)",
|
|
8
|
+
height: "calc(100% - 70px)",
|
|
9
|
+
overflowY: "auto",
|
|
10
|
+
margin: -4,
|
|
11
|
+
padding: 4
|
|
12
|
+
},
|
|
13
|
+
selectAllContainer: {
|
|
14
|
+
// Prevent the focus ring to be hidden by sibling hover background
|
|
15
|
+
"&": {
|
|
16
|
+
position: "relative",
|
|
17
|
+
zIndex: 0
|
|
18
|
+
},
|
|
19
|
+
"&:focus-within": {
|
|
20
|
+
zIndex: 1
|
|
21
|
+
},
|
|
22
|
+
// IE fallback code (using focus-within-polyfill)
|
|
23
|
+
"&.focus-within": {
|
|
24
|
+
zIndex: 1
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
selectAll: {
|
|
28
|
+
width: "100%"
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
styles
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=RightPanel.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RightPanel.styles.js","sources":["../../../../../src/components/FilterGroup/RightPanel/RightPanel.styles.tsx"],"sourcesContent":["import { CSSInterpolation } from \"@emotion/serialize\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nexport const styles: {\n search: CSSInterpolation;\n selectAllContainer: CSSInterpolation;\n selectAll: CSSInterpolation;\n list: CSSInterpolation;\n} = {\n search: {\n marginBottom: theme.spacing(\"xs\"),\n },\n list: {\n width: \"calc(100% + 8px)\",\n height: \"calc(100% - 70px)\",\n overflowY: \"auto\",\n margin: -4,\n padding: 4,\n },\n selectAllContainer: {\n // Prevent the focus ring to be hidden by sibling hover background\n \"&\": {\n position: \"relative\",\n zIndex: 0,\n },\n \"&:focus-within\": {\n zIndex: 1,\n },\n // IE fallback code (using focus-within-polyfill)\n \"&.focus-within\": {\n zIndex: 1,\n },\n },\n selectAll: {\n width: \"100%\",\n },\n};\n"],"names":["styles","search","marginBottom","theme","spacing","list","width","height","overflowY","margin","padding","selectAllContainer","position","zIndex","selectAll"],"mappings":";AAGO,MAAMA,SAKT;AAAA,EACFC,QAAQ;AAAA,IACNC,cAAcC,MAAMC,QAAQ,IAAI;AAAA,EAClC;AAAA,EACAC,MAAM;AAAA,IACJC,OAAO;AAAA,IACPC,QAAQ;AAAA,IACRC,WAAW;AAAA,IACXC,QAAQ;AAAA,IACRC,SAAS;AAAA,EACX;AAAA,EACAC,oBAAoB;AAAA;AAAA,IAElB,KAAK;AAAA,MACHC,UAAU;AAAA,MACVC,QAAQ;AAAA,IACV;AAAA,IACA,kBAAkB;AAAA,MAChBA,QAAQ;AAAA,IACV;AAAA;AAAA,IAEA,kBAAkB;AAAA,MAChBA,QAAQ;AAAA,IACV;AAAA,EACF;AAAA,EACAC,WAAW;AAAA,IACTR,OAAO;AAAA,EACT;AACF;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { getClasses } from "../../utils/classes.js";
|
|
2
|
+
const classKeys = ["root", "labelContainer", "label", "description", "error"];
|
|
3
|
+
const filterGroupClasses = getClasses(classKeys, "HvFilterGroup");
|
|
4
|
+
const filterGroupClasses$1 = filterGroupClasses;
|
|
5
|
+
export {
|
|
6
|
+
filterGroupClasses$1 as default
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=filterGroupClasses.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filterGroupClasses.js","sources":["../../../../src/components/FilterGroup/filterGroupClasses.ts"],"sourcesContent":["import { getClasses } from \"@core/utils\";\n\nexport interface HvFilterGroupClasses {\n root?: string;\n labelContainer?: string;\n label?: string;\n description?: string;\n error?: string;\n}\n\nconst classKeys: string[] = [\n \"root\",\n \"labelContainer\",\n \"label\",\n \"description\",\n \"error\",\n];\n\nconst filterGroupClasses = getClasses<HvFilterGroupClasses>(\n classKeys,\n \"HvFilterGroup\"\n);\n\nexport default filterGroupClasses;\n"],"names":["classKeys","filterGroupClasses","getClasses"],"mappings":";AAUA,MAAMA,YAAsB,CAC1B,QACA,kBACA,SACA,eACA,OAAO;AAGT,MAAMC,qBAAqBC,WACzBF,WACA,eAAe;AAGjB,MAAA,uBAAeC;"}
|