@m4l/components 9.54.2 → 9.55.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/@types/types.d.ts +8 -0
- package/components/CheckableList/CheckableList.d.ts.map +1 -1
- package/components/CheckableList/CheckableList.js +163 -143
- package/components/CheckableList/CheckableList.styles.d.ts.map +1 -1
- package/components/CheckableList/CheckableList.styles.js +20 -8
- package/components/CheckableList/constants.d.ts +1 -1
- package/components/CheckableList/constants.d.ts.map +1 -1
- package/components/CheckableList/hooks/useCheckableListRender.d.ts +6 -1
- package/components/CheckableList/hooks/useCheckableListRender.d.ts.map +1 -1
- package/components/CheckableList/hooks/useCheckableListRender.js +126 -113
- package/components/CheckableList/slots/slots.d.ts +1 -0
- package/components/CheckableList/slots/slots.d.ts.map +1 -1
- package/components/CheckableList/slots/slots.js +1 -1
- package/components/CheckableList/slots/styled.d.ts +3 -0
- package/components/CheckableList/slots/styled.d.ts.map +1 -1
- package/components/CheckableList/slots/styled.js +56 -51
- package/components/CheckableList/types.d.ts +20 -0
- package/components/CheckableList/types.d.ts.map +1 -1
- package/components/ColorPicker/ColorPicker.js +2 -2
- package/components/DateTimeRangePicker/DateTimeRangePicker.js +1 -1
- package/components/DevicesPicker/DevicesPicker.d.ts +14 -0
- package/components/DevicesPicker/DevicesPicker.d.ts.map +1 -0
- package/components/DevicesPicker/DevicesPicker.js +344 -0
- package/components/DevicesPicker/DevicesPicker.styles.d.ts +3 -0
- package/components/DevicesPicker/DevicesPicker.styles.d.ts.map +1 -0
- package/components/DevicesPicker/DevicesPicker.styles.js +510 -0
- package/components/DevicesPicker/constants.d.ts +85 -0
- package/components/DevicesPicker/constants.d.ts.map +1 -0
- package/components/DevicesPicker/constants.js +41 -0
- package/components/DevicesPicker/dictionary.d.ts +19 -0
- package/components/DevicesPicker/dictionary.d.ts.map +1 -0
- package/components/DevicesPicker/dictionary.js +20 -0
- package/components/DevicesPicker/helpers/resolveDeviceGroup.d.ts +11 -0
- package/components/DevicesPicker/helpers/resolveDeviceGroup.d.ts.map +1 -0
- package/components/DevicesPicker/helpers/resolveDeviceGroup.js +14 -0
- package/components/DevicesPicker/helpers/toDeviceArray.d.ts +7 -0
- package/components/DevicesPicker/helpers/toDeviceArray.d.ts.map +1 -0
- package/components/DevicesPicker/helpers/toDeviceArray.js +6 -0
- package/components/DevicesPicker/hooks/types.d.ts +176 -0
- package/components/DevicesPicker/hooks/types.d.ts.map +1 -0
- package/components/DevicesPicker/hooks/useDeviceGroups.d.ts +13 -0
- package/components/DevicesPicker/hooks/useDeviceGroups.d.ts.map +1 -0
- package/components/DevicesPicker/hooks/useDeviceGroups.js +51 -0
- package/components/DevicesPicker/hooks/useDevicesAsyncOptions.d.ts +13 -0
- package/components/DevicesPicker/hooks/useDevicesAsyncOptions.d.ts.map +1 -0
- package/components/DevicesPicker/hooks/useDevicesAsyncOptions.js +71 -0
- package/components/DevicesPicker/hooks/useDevicesSelection.d.ts +12 -0
- package/components/DevicesPicker/hooks/useDevicesSelection.d.ts.map +1 -0
- package/components/DevicesPicker/hooks/useDevicesSelection.js +26 -0
- package/components/DevicesPicker/hooks/usePanelColumns.d.ts +12 -0
- package/components/DevicesPicker/hooks/usePanelColumns.d.ts.map +1 -0
- package/components/DevicesPicker/hooks/usePanelColumns.js +30 -0
- package/components/DevicesPicker/index.d.ts +11 -0
- package/components/DevicesPicker/index.d.ts.map +1 -0
- package/components/DevicesPicker/slots/DevicesPickerEnum.d.ts +77 -0
- package/components/DevicesPicker/slots/DevicesPickerEnum.d.ts.map +1 -0
- package/components/DevicesPicker/slots/DevicesPickerEnum.js +4 -0
- package/components/DevicesPicker/slots/DevicesPickerSlots.d.ts +112 -0
- package/components/DevicesPicker/slots/DevicesPickerSlots.d.ts.map +1 -0
- package/components/DevicesPicker/slots/DevicesPickerSlots.js +163 -0
- package/components/DevicesPicker/slots/index.d.ts +3 -0
- package/components/DevicesPicker/slots/index.d.ts.map +1 -0
- package/components/DevicesPicker/subcomponents/DeviceCard/DeviceCard.d.ts +8 -0
- package/components/DevicesPicker/subcomponents/DeviceCard/DeviceCard.d.ts.map +1 -0
- package/components/DevicesPicker/subcomponents/DeviceCard/DeviceCard.js +77 -0
- package/components/DevicesPicker/subcomponents/DeviceCard/index.d.ts +3 -0
- package/components/DevicesPicker/subcomponents/DeviceCard/index.d.ts.map +1 -0
- package/components/DevicesPicker/subcomponents/DeviceCard/types.d.ts +42 -0
- package/components/DevicesPicker/subcomponents/DeviceCard/types.d.ts.map +1 -0
- package/components/DevicesPicker/subcomponents/DevicesPanel/DevicesPanel.d.ts +11 -0
- package/components/DevicesPicker/subcomponents/DevicesPanel/DevicesPanel.d.ts.map +1 -0
- package/components/DevicesPicker/subcomponents/DevicesPanel/DevicesPanel.js +141 -0
- package/components/DevicesPicker/subcomponents/DevicesPanel/index.d.ts +3 -0
- package/components/DevicesPicker/subcomponents/DevicesPanel/index.d.ts.map +1 -0
- package/components/DevicesPicker/subcomponents/DevicesPanel/types.d.ts +68 -0
- package/components/DevicesPicker/subcomponents/DevicesPanel/types.d.ts.map +1 -0
- package/components/DevicesPicker/subcomponents/DevicesPickerSkeleton/DevicesPickerSkeleton.d.ts +10 -0
- package/components/DevicesPicker/subcomponents/DevicesPickerSkeleton/DevicesPickerSkeleton.d.ts.map +1 -0
- package/components/DevicesPicker/subcomponents/DevicesPickerSkeleton/DevicesPickerSkeleton.js +35 -0
- package/components/DevicesPicker/subcomponents/DevicesPickerSkeleton/index.d.ts +3 -0
- package/components/DevicesPicker/subcomponents/DevicesPickerSkeleton/index.d.ts.map +1 -0
- package/components/DevicesPicker/subcomponents/DevicesPickerSkeleton/types.d.ts +11 -0
- package/components/DevicesPicker/subcomponents/DevicesPickerSkeleton/types.d.ts.map +1 -0
- package/components/DevicesPicker/subcomponents/SelectedDevicesList/SelectedDevicesList.d.ts +11 -0
- package/components/DevicesPicker/subcomponents/SelectedDevicesList/SelectedDevicesList.d.ts.map +1 -0
- package/components/DevicesPicker/subcomponents/SelectedDevicesList/SelectedDevicesList.js +61 -0
- package/components/DevicesPicker/subcomponents/SelectedDevicesList/index.d.ts +3 -0
- package/components/DevicesPicker/subcomponents/SelectedDevicesList/index.d.ts.map +1 -0
- package/components/DevicesPicker/subcomponents/SelectedDevicesList/types.d.ts +32 -0
- package/components/DevicesPicker/subcomponents/SelectedDevicesList/types.d.ts.map +1 -0
- package/components/DevicesPicker/types.d.ts +171 -0
- package/components/DevicesPicker/types.d.ts.map +1 -0
- package/components/DynamicFilter/DynamicFilter.styles.d.ts.map +1 -1
- package/components/DynamicFilter/DynamicFilter.styles.js +41 -33
- package/components/DynamicFilter/subcomponents/AppliedFilters/useAppliedFilters.d.ts +1 -1
- package/components/DynamicFilter/subcomponents/AppliedFilters/useAppliedFilters.js +1 -1
- package/components/DynamicFilter/subcomponents/FieldTypes/SelectAsyncFilter/index.d.ts.map +1 -1
- package/components/DynamicFilter/subcomponents/FieldTypes/SelectAsyncFilter/index.js +24 -24
- package/components/DynamicFilter/types.d.ts +9 -1
- package/components/DynamicFilter/types.d.ts.map +1 -1
- package/components/DynamicSort/subcomponents/AppliedSorts/useAppliedSorts.d.ts +1 -1
- package/components/DynamicSort/subcomponents/AppliedSorts/useAppliedSorts.js +1 -1
- package/components/extended/mui/CheckBox/CheckBox.js +7 -7
- package/components/extended/mui/Select/Select.js +6 -6
- package/components/hook-form/RHFDevicesPicker/RHFDevicesPicker.d.ts +21 -0
- package/components/hook-form/RHFDevicesPicker/RHFDevicesPicker.d.ts.map +1 -0
- package/components/hook-form/RHFDevicesPicker/RHFDevicesPicker.js +6 -0
- package/components/hook-form/RHFDevicesPicker/index.d.ts +3 -0
- package/components/hook-form/RHFDevicesPicker/index.d.ts.map +1 -0
- package/components/hook-form/RHFDevicesPicker/types.d.ts +8 -0
- package/components/hook-form/RHFDevicesPicker/types.d.ts.map +1 -0
- package/components/hook-form/index.d.ts +3 -0
- package/components/hook-form/index.d.ts.map +1 -1
- package/components/hook-form/renderAsRegistry.d.ts +33 -0
- package/components/hook-form/renderAsRegistry.d.ts.map +1 -0
- package/components/hook-form/renderAsRegistry.js +7 -0
- package/components/index.d.ts +1 -0
- package/components/index.d.ts.map +1 -1
- package/helpers/resolveDeviceIconSrc/constants.d.ts +14 -0
- package/helpers/resolveDeviceIconSrc/constants.d.ts.map +1 -0
- package/helpers/resolveDeviceIconSrc/constants.js +6 -0
- package/helpers/resolveDeviceIconSrc/index.d.ts +3 -0
- package/helpers/resolveDeviceIconSrc/index.d.ts.map +1 -0
- package/helpers/resolveDeviceIconSrc/resolveDeviceIconSrc.d.ts +14 -0
- package/helpers/resolveDeviceIconSrc/resolveDeviceIconSrc.d.ts.map +1 -0
- package/helpers/resolveDeviceIconSrc/resolveDeviceIconSrc.js +8 -0
- package/helpers/resolveDeviceLabels/index.d.ts +3 -0
- package/helpers/resolveDeviceLabels/index.d.ts.map +1 -0
- package/helpers/resolveDeviceLabels/resolveDeviceLabels.d.ts +22 -0
- package/helpers/resolveDeviceLabels/resolveDeviceLabels.d.ts.map +1 -0
- package/helpers/resolveDeviceLabels/resolveDeviceLabels.js +10 -0
- package/helpers/resolveDeviceLabels/types.d.ts +19 -0
- package/helpers/resolveDeviceLabels/types.d.ts.map +1 -0
- package/hooks/useChipsOverflow/helpers/calculateLeftoverWidth.d.ts +14 -0
- package/hooks/useChipsOverflow/helpers/calculateLeftoverWidth.d.ts.map +1 -0
- package/hooks/useChipsOverflow/helpers/calculateLeftoverWidth.js +7 -0
- package/hooks/useChipsOverflow/helpers/calculateVisibleChipsCount.d.ts.map +1 -0
- package/hooks/useChipsOverflow/helpers/index.d.ts +3 -0
- package/hooks/useChipsOverflow/helpers/index.d.ts.map +1 -0
- package/hooks/useChipsOverflow/index.d.ts +3 -0
- package/hooks/useChipsOverflow/index.d.ts.map +1 -0
- package/hooks/useChipsOverflow/types.d.ts +24 -0
- package/hooks/useChipsOverflow/types.d.ts.map +1 -0
- package/{components/DynamicFilter/hooks → hooks/useChipsOverflow}/useChipsOverflow.d.ts +7 -5
- package/hooks/useChipsOverflow/useChipsOverflow.d.ts.map +1 -0
- package/hooks/useChipsOverflow/useChipsOverflow.js +110 -0
- package/index.d.ts +2 -0
- package/index.d.ts.map +1 -1
- package/index.js +803 -757
- package/package.json +10 -10
- package/components/DynamicFilter/helpers/calculateVisibleChipsCount.d.ts.map +0 -1
- package/components/DynamicFilter/hooks/useChipsOverflow.d.ts.map +0 -1
- package/components/DynamicFilter/hooks/useChipsOverflow.js +0 -83
- /package/{components/DynamicFilter → hooks/useChipsOverflow}/helpers/calculateVisibleChipsCount.d.ts +0 -0
- /package/{components/DynamicFilter → hooks/useChipsOverflow}/helpers/calculateVisibleChipsCount.js +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Ref } from 'react';
|
|
2
|
+
import { DevicePickerOption } from '../../DevicesPicker/types';
|
|
3
|
+
import { RHFDevicesPickerProps } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* RHFDevicesPicker: device selector integrated with react-hook-form.
|
|
6
|
+
* Wraps DevicesPicker with the same HOC as RHFAutocompleteAsync, so form
|
|
7
|
+
* state, label and error message behave identically.
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <RHFDevicesPicker
|
|
11
|
+
* name="devices"
|
|
12
|
+
* label="Dispositivos"
|
|
13
|
+
* endPoint="devices"
|
|
14
|
+
* multiple
|
|
15
|
+
* />
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare const RHFDevicesPicker: <T = DevicePickerOption>(props: RHFDevicesPickerProps<T> & {
|
|
19
|
+
ref?: Ref<HTMLDivElement>;
|
|
20
|
+
}) => JSX.Element;
|
|
21
|
+
//# sourceMappingURL=RHFDevicesPicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RHFDevicesPicker.d.ts","sourceRoot":"","sources":["../../../../../../../packages/components/src/components/hook-form/RHFDevicesPicker/RHFDevicesPicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAG5B,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAIrD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gBAAgB,EAAsC,CACjE,CAAC,GAAG,kBAAkB,EAEtB,KAAK,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAAG;IAChC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B,KACE,GAAG,CAAC,OAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../packages/components/src/components/hook-form/RHFDevicesPicker/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseRHFProps } from '../../../hocs/withRHFController/types';
|
|
2
|
+
import { DevicePickerOption, DevicesPickerProps } from '../../DevicesPicker/types';
|
|
3
|
+
/**
|
|
4
|
+
* Props for RHFDevicesPicker (DevicesPicker wrapped with withRHFController).
|
|
5
|
+
* value and onChange are injected by the HOC from the form state.
|
|
6
|
+
*/
|
|
7
|
+
export type RHFDevicesPickerProps<T = DevicePickerOption> = BaseRHFProps & Omit<DevicesPickerProps<T>, 'value' | 'onChange'>;
|
|
8
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../packages/components/src/components/hook-form/RHFDevicesPicker/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEnF;;;GAGG;AACH,MAAM,MAAM,qBAAqB,CAAC,CAAC,GAAG,kBAAkB,IAAI,YAAY,GACtE,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC,CAAC"}
|
|
@@ -5,6 +5,9 @@ export { getRHFAutocompleteComponentsDictionary } from './RHFAutocomplete/dictio
|
|
|
5
5
|
export { RHFAutocompleteAsync } from './RHFAutocompleteAsync/RHFAutocompleteAsync';
|
|
6
6
|
export * from './RHFImageSelector';
|
|
7
7
|
export { getRHFAutocompleteAsyncComponentsDictionary } from './RHFAutocompleteAsync/dictionary';
|
|
8
|
+
export * from './RHFDevicesPicker';
|
|
9
|
+
export { RHF_AUTOCOMPLETE_ASYNC_RENDER_AS_REGISTRY } from './renderAsRegistry';
|
|
10
|
+
export type { RHFAutocompleteAsyncRenderAsKey } from './renderAsRegistry';
|
|
8
11
|
export * from './RHFCheckbox/RHFCheckbox';
|
|
9
12
|
export * from './RHFCheckableList';
|
|
10
13
|
export { RHFDateTime } from './RHFDateTime';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/components/hook-form/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,sCAAsC,EAAE,MAAM,8BAA8B,CAAC;AACtF,OAAO,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AACnF,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,2CAA2C,EAAE,MAAM,mCAAmC,CAAC;AAChG,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,cAAc,0BAA0B,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,qDAAqD,CAAC;AAC1F,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/components/hook-form/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,sCAAsC,EAAE,MAAM,8BAA8B,CAAC;AACtF,OAAO,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AACnF,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,2CAA2C,EAAE,MAAM,mCAAmC,CAAC;AAChG,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,yCAAyC,EAAE,MAAM,oBAAoB,CAAC;AAC/E,YAAY,EAAE,+BAA+B,EAAE,MAAM,oBAAoB,CAAC;AAC1E,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,cAAc,0BAA0B,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,qDAAqD,CAAC;AAC1F,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Home of the `renderAs` catalogs. Each catalog is named after the component
|
|
3
|
+
* its entries stand in for, so a file holding several of them still says which
|
|
4
|
+
* one substitutes what.
|
|
5
|
+
*
|
|
6
|
+
* Every catalog follows the same rule: the consumer resolves the entry it needs
|
|
7
|
+
* and hands the component over already resolved
|
|
8
|
+
* (`renderAs: RHF_AUTOCOMPLETE_ASYNC_RENDER_AS_REGISTRY.devices`). No generic
|
|
9
|
+
* component reads a catalog, so neither `RHFAutocompleteAsync` nor the
|
|
10
|
+
* `DynamicFilter` learns about devices or any other domain a picker may belong
|
|
11
|
+
* to.
|
|
12
|
+
*
|
|
13
|
+
* Once a second catalog needs its own pickers, split this file into one module
|
|
14
|
+
* per catalog: sharing a module would make importing one catalog pull in the
|
|
15
|
+
* components of all the others.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Components that can be rendered in place of `RHFAutocompleteAsync`.
|
|
19
|
+
* To belong here a component must accept `RHFAutocompleteAsyncProps` and be
|
|
20
|
+
* already wired to react-hook-form, which is what the `RHF` prefix states.
|
|
21
|
+
*
|
|
22
|
+
* Adding a picker means adding one entry here; nothing downstream changes.
|
|
23
|
+
*/
|
|
24
|
+
export declare const RHF_AUTOCOMPLETE_ASYNC_RENDER_AS_REGISTRY: {
|
|
25
|
+
readonly devices: <T = import('..').DevicePickerOption>(props: import('./RHFDevicesPicker').RHFDevicesPickerProps<T> & {
|
|
26
|
+
ref?: import('react').Ref<HTMLDivElement>;
|
|
27
|
+
}) => JSX.Element;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Keys of the `RHFAutocompleteAsync` picker catalog.
|
|
31
|
+
*/
|
|
32
|
+
export type RHFAutocompleteAsyncRenderAsKey = keyof typeof RHF_AUTOCOMPLETE_ASYNC_RENDER_AS_REGISTRY;
|
|
33
|
+
//# sourceMappingURL=renderAsRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderAsRegistry.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/components/hook-form/renderAsRegistry.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,yCAAyC;;WANhD,CAAC;;CAQG,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,+BAA+B,GACzC,MAAM,OAAO,yCAAyC,CAAC"}
|
package/components/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/components/src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,YAAY,CAAC;AAC3B,YAAY,EACV,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,+BAA+B,EAC/B,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,YAAY,CAAC;AACpB,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/components/src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,YAAY,CAAC;AAC3B,YAAY,EACV,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,+BAA+B,EAC/B,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,YAAY,CAAC;AACpB,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Backend route that serves a graphic resource by its id, appended to
|
|
3
|
+
* `hostApiRemote`. Exported on its own so a future icon family reuses the
|
|
4
|
+
* endpoint contract instead of re-declaring the path.
|
|
5
|
+
*/
|
|
6
|
+
export declare const DEVICE_ICONS_PATH = "/main/na/icons/";
|
|
7
|
+
/**
|
|
8
|
+
* Variant suffix the backend expects for the 3D vehicle artwork. The devices
|
|
9
|
+
* endpoint publishes the bare id and every consumer appends the variant.
|
|
10
|
+
*/
|
|
11
|
+
export declare const DEVICE_ICON_VARIANT_SUFFIX = "_3d_white";
|
|
12
|
+
/** Used for devices that arrive with no icon id. */
|
|
13
|
+
export declare const DEVICE_FALLBACK_ICON_ID = "i_common_devices_type_sedan";
|
|
14
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/helpers/resolveDeviceIconSrc/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,oBAAoB,CAAC;AAEnD;;;GAGG;AACH,eAAO,MAAM,0BAA0B,cAAc,CAAC;AAEtD,oDAAoD;AACpD,eAAO,MAAM,uBAAuB,gCAAgC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/helpers/resolveDeviceIconSrc/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,0BAA0B,GAC3B,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build the url of a device artwork, asking the backend for the icon id it
|
|
3
|
+
* published in `deviceIcon.iconId`.
|
|
4
|
+
*
|
|
5
|
+
* This is the single place that owns the device-icon contract: the endpoint
|
|
6
|
+
* path, the artwork variant and the fallback id. Every surface that paints a
|
|
7
|
+
* device — pickers, cards, lists, map markers — must resolve through here, so a
|
|
8
|
+
* change to the contract is one edit and never a hunt across components.
|
|
9
|
+
*
|
|
10
|
+
* A new device type needs no change at all: the backend publishes the id and
|
|
11
|
+
* the frontend forwards it.
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolveDeviceIconSrc(hostApiRemote: string | undefined, iconId?: string | null): string;
|
|
14
|
+
//# sourceMappingURL=resolveDeviceIconSrc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveDeviceIconSrc.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/helpers/resolveDeviceIconSrc/resolveDeviceIconSrc.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAClC,aAAa,EAAE,MAAM,GAAG,SAAS,EACjC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GACrB,MAAM,CAKR"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DEVICE_FALLBACK_ICON_ID as r, DEVICE_ICONS_PATH as c, DEVICE_ICON_VARIANT_SUFFIX as _ } from "./constants.js";
|
|
2
|
+
function C(e, I) {
|
|
3
|
+
const o = I?.trim() || r;
|
|
4
|
+
return `${(e ?? "").replace(/\/+$/u, "")}${c}${o}${_}`;
|
|
5
|
+
}
|
|
6
|
+
export {
|
|
7
|
+
C as resolveDeviceIconSrc
|
|
8
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/helpers/resolveDeviceLabels/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAClF,YAAY,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DeviceLabelsSource } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Resolve the first line of a device: the alias, or the name when the device
|
|
4
|
+
* carries no alias.
|
|
5
|
+
*
|
|
6
|
+
* This is the single place that owns the device label contract. The alias is
|
|
7
|
+
* what identifies a vehicle for the people using the platform, so it always
|
|
8
|
+
* wins the prominent line; the name takes it only when there is no alias, and
|
|
9
|
+
* moves to the description line otherwise.
|
|
10
|
+
*
|
|
11
|
+
* Every surface that paints a device — picker cards, panel rows, selected
|
|
12
|
+
* lists, filter chips — must resolve through here, so the same device never
|
|
13
|
+
* reads one way in a module and another way in a shared component.
|
|
14
|
+
*/
|
|
15
|
+
export declare function resolveDeviceTitle(device?: DeviceLabelsSource | null): string;
|
|
16
|
+
/**
|
|
17
|
+
* Resolve the second line of a device: the name, once the alias took the first
|
|
18
|
+
* line. Empty when there is no alias, because the name is already on top and
|
|
19
|
+
* repeating it would paint the same text twice.
|
|
20
|
+
*/
|
|
21
|
+
export declare function resolveDeviceSubtitle(device?: DeviceLabelsSource | null): string;
|
|
22
|
+
//# sourceMappingURL=resolveDeviceLabels.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveDeviceLabels.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/helpers/resolveDeviceLabels/resolveDeviceLabels.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE,kBAAkB,GAAG,IAAI,GAAG,MAAM,CAE7E;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,CAAC,EAAE,kBAAkB,GAAG,IAAI,GAAG,MAAM,CAEhF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal shape the device label contract needs from a device.
|
|
3
|
+
*
|
|
4
|
+
* Declared here instead of imported from a component so any surface that paints
|
|
5
|
+
* a device — pickers, cards, lists, map markers, filter chips — can resolve its
|
|
6
|
+
* labels without depending on the picker.
|
|
7
|
+
*/
|
|
8
|
+
export interface DeviceLabelsSource {
|
|
9
|
+
/**
|
|
10
|
+
* Plate or hardware code the device was registered with, as published by
|
|
11
|
+
* the backend.
|
|
12
|
+
*/
|
|
13
|
+
name?: string | null;
|
|
14
|
+
/**
|
|
15
|
+
* Label the fleet gave the device. When present it owns the first line.
|
|
16
|
+
*/
|
|
17
|
+
alias?: string | null;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/helpers/resolveDeviceLabels/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calculates the width left over after the visible chips, so a consumer can
|
|
3
|
+
* decide whether the first chip that does not fit is worth painting shrunk or
|
|
4
|
+
* should go straight into the "More" chip.
|
|
5
|
+
* Pure function — all measurements are passed in by the caller.
|
|
6
|
+
* @param availableWidth - Width available for the chips, already excluding the
|
|
7
|
+
* "More" chip and any padding.
|
|
8
|
+
* @param gap - Gap between chips in pixels.
|
|
9
|
+
* @param chipWidths - Natural width of each chip in display order.
|
|
10
|
+
* @param visibleCount - How many chips are painted whole.
|
|
11
|
+
* @returns The remaining width, its leading gap already discounted.
|
|
12
|
+
*/
|
|
13
|
+
export declare function calculateLeftoverWidth(availableWidth: number, gap: number, chipWidths: number[], visibleCount: number): number;
|
|
14
|
+
//# sourceMappingURL=calculateLeftoverWidth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calculateLeftoverWidth.d.ts","sourceRoot":"","sources":["../../../../../../../packages/components/src/hooks/useChipsOverflow/helpers/calculateLeftoverWidth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CACpC,cAAc,EAAE,MAAM,EACtB,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,MAAM,EAAE,EACpB,YAAY,EAAE,MAAM,GACnB,MAAM,CAKR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calculateVisibleChipsCount.d.ts","sourceRoot":"","sources":["../../../../../../../packages/components/src/hooks/useChipsOverflow/helpers/calculateVisibleChipsCount.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CACxC,cAAc,EAAE,MAAM,EACtB,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,MAAM,EAAE,GACnB,MAAM,CAsBR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../packages/components/src/hooks/useChipsOverflow/helpers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/hooks/useChipsOverflow/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimum shape an item needs to take part in the overflow calculation.
|
|
3
|
+
* The hook only ever uses the id to cache measured widths, so anything with a
|
|
4
|
+
* stable identifier works: filter chips, sort chips or device cards.
|
|
5
|
+
*/
|
|
6
|
+
export interface OverflowItem {
|
|
7
|
+
/**
|
|
8
|
+
* Stable identifier of the item.
|
|
9
|
+
*/
|
|
10
|
+
id: string | number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Options of the overflow hook.
|
|
14
|
+
*/
|
|
15
|
+
export interface UseChipsOverflowOptions {
|
|
16
|
+
/**
|
|
17
|
+
* Reports the items pending measurement through `measuringItems` instead of
|
|
18
|
+
* showing them all while their width is unknown. The consumer must render
|
|
19
|
+
* them out of the layout so the split does not flicker on every addition.
|
|
20
|
+
* Off by default: the visible set keeps carrying them.
|
|
21
|
+
*/
|
|
22
|
+
deferMeasurement?: boolean;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/hooks/useChipsOverflow/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { OverflowItem, UseChipsOverflowOptions } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* useChipsOverflow: Hook responsible for detecting which filter chips overflow
|
|
4
4
|
* the available container space and splitting them into visible / overflow
|
|
@@ -18,12 +18,14 @@ import { FilterFieldApplied } from '../types';
|
|
|
18
18
|
* space whenever it is rendered, so nothing is hardcoded.
|
|
19
19
|
* @param filters - Sorted array of applied filters
|
|
20
20
|
*/
|
|
21
|
-
export declare function useChipsOverflow(filters:
|
|
22
|
-
visibleFilters:
|
|
23
|
-
overflowFilters:
|
|
21
|
+
export declare function useChipsOverflow<T extends OverflowItem>(filters: T[], options?: UseChipsOverflowOptions): {
|
|
22
|
+
visibleFilters: T[];
|
|
23
|
+
overflowFilters: T[];
|
|
24
|
+
measuringFilters: T[];
|
|
25
|
+
leftoverWidth: number;
|
|
24
26
|
parentRef: import('react').RefObject<HTMLDivElement | null>;
|
|
25
27
|
containerRef: import('react').RefObject<HTMLDivElement | null>;
|
|
26
|
-
setChipRef: (id:
|
|
28
|
+
setChipRef: (id: OverflowItem["id"], el: HTMLElement | null) => void;
|
|
27
29
|
setMoreChipRef: (el: HTMLElement | null) => void;
|
|
28
30
|
setActionsRef: (el: HTMLElement | null) => void;
|
|
29
31
|
setLeadingRef: (el: HTMLElement | null) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useChipsOverflow.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/hooks/useChipsOverflow/useChipsOverflow.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAIrE;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,YAAY,EACrD,OAAO,EAAE,CAAC,EAAE,EACZ,OAAO,GAAE,uBAA4B;;;;;;;qBAmKD,YAAY,CAAC,IAAI,CAAC,MAAM,WAAW,GAAG,IAAI;yBAcvE,WAAW,GAAG,IAAI;wBAalB,WAAW,GAAG,IAAI;wBAYlB,WAAW,GAAG,IAAI;EA6F1B"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { useRef as c, useState as b, useEffect as m, useCallback as h, useMemo as z } from "react";
|
|
2
|
+
import { calculateLeftoverWidth as ne } from "./helpers/calculateLeftoverWidth.js";
|
|
3
|
+
import { calculateVisibleChipsCount as B } from "./helpers/calculateVisibleChipsCount.js";
|
|
4
|
+
const re = [];
|
|
5
|
+
function ae(t, G = {}) {
|
|
6
|
+
const { deferMeasurement: f = !1 } = G, v = c(null), C = c(null), M = c(null), S = c(null), y = c(null), R = c(/* @__PURE__ */ new Map()), a = c(/* @__PURE__ */ new Map()), [o, p] = b(null), [N, A] = b(0), [E, T] = b(/* @__PURE__ */ new Set()), d = c(null);
|
|
7
|
+
m(() => {
|
|
8
|
+
const e = new Set(t.map((r) => r.id));
|
|
9
|
+
for (const r of a.current.keys())
|
|
10
|
+
e.has(r) || a.current.delete(r);
|
|
11
|
+
t.some((r) => !a.current.has(r.id)) && !f && p(null);
|
|
12
|
+
}, [t, f]);
|
|
13
|
+
const s = h(() => {
|
|
14
|
+
const e = v.current, n = C.current;
|
|
15
|
+
if (!e || !n || t.length === 0) {
|
|
16
|
+
p(null);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
let r = !1;
|
|
20
|
+
if (t.forEach((l) => {
|
|
21
|
+
const W = R.current.get(l.id);
|
|
22
|
+
W && W.offsetWidth > 0 && (r = r || !a.current.has(l.id), a.current.set(l.id, W.offsetWidth));
|
|
23
|
+
}), r && T(new Set(a.current.keys())), !t.every((l) => a.current.has(l.id))) {
|
|
24
|
+
d.current === null && (d.current = requestAnimationFrame(() => {
|
|
25
|
+
d.current = null, I.current?.();
|
|
26
|
+
}));
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const i = getComputedStyle(e), F = getComputedStyle(n), K = parseFloat(i.paddingLeft) || 0, Q = parseFloat(i.paddingRight) || 0, X = parseFloat(F.paddingLeft) || 0, Z = parseFloat(F.paddingRight) || 0, u = parseFloat(F.gap) || 0, O = e.getBoundingClientRect().width || e.clientWidth;
|
|
30
|
+
if (O === 0)
|
|
31
|
+
return;
|
|
32
|
+
const P = S.current?.offsetWidth ?? 0, $ = P > 0 ? P + u : 0, k = y.current?.offsetWidth ?? 0, ee = k > 0 ? k + u : 0, U = O - K - Q - X - Z - $ - ee, w = t.map((l) => a.current.get(l.id) ?? 0);
|
|
33
|
+
if (B(U, u, w) >= t.length) {
|
|
34
|
+
p(t.length), A(0);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const q = M.current?.offsetWidth ?? 0, te = q > 0 ? q + u : 0, V = U - te, x = B(V, u, w);
|
|
38
|
+
p(x), A(ne(V, u, w, x));
|
|
39
|
+
}, [t]), I = c(null);
|
|
40
|
+
I.current = s, m(
|
|
41
|
+
() => () => {
|
|
42
|
+
d.current !== null && cancelAnimationFrame(d.current);
|
|
43
|
+
},
|
|
44
|
+
[]
|
|
45
|
+
);
|
|
46
|
+
const Y = h((e, n) => {
|
|
47
|
+
n ? R.current.set(e, n) : R.current.delete(e);
|
|
48
|
+
}, []), _ = h(
|
|
49
|
+
(e) => {
|
|
50
|
+
M.current = e, s();
|
|
51
|
+
},
|
|
52
|
+
[s]
|
|
53
|
+
), j = h(
|
|
54
|
+
(e) => {
|
|
55
|
+
S.current = e, s();
|
|
56
|
+
},
|
|
57
|
+
[s]
|
|
58
|
+
), D = h(
|
|
59
|
+
(e) => {
|
|
60
|
+
y.current = e, s();
|
|
61
|
+
},
|
|
62
|
+
[s]
|
|
63
|
+
);
|
|
64
|
+
m(() => {
|
|
65
|
+
const e = v.current;
|
|
66
|
+
if (!e)
|
|
67
|
+
return;
|
|
68
|
+
const n = new ResizeObserver(() => {
|
|
69
|
+
s();
|
|
70
|
+
});
|
|
71
|
+
return n.observe(e), () => {
|
|
72
|
+
n.disconnect();
|
|
73
|
+
};
|
|
74
|
+
}, [s]), m(() => {
|
|
75
|
+
const e = requestAnimationFrame(() => {
|
|
76
|
+
s();
|
|
77
|
+
});
|
|
78
|
+
return () => cancelAnimationFrame(e);
|
|
79
|
+
}, [t, s]);
|
|
80
|
+
const g = z(
|
|
81
|
+
() => f && o !== null ? t.filter((e) => !E.has(e.id)) : re,
|
|
82
|
+
[t, f, o, E]
|
|
83
|
+
), { visibleFilters: H, overflowFilters: J } = z(() => {
|
|
84
|
+
if (g.length === 0)
|
|
85
|
+
return o === null || o >= t.length ? { visibleFilters: t, overflowFilters: [] } : {
|
|
86
|
+
visibleFilters: t.slice(0, o),
|
|
87
|
+
overflowFilters: t.slice(o)
|
|
88
|
+
};
|
|
89
|
+
const e = new Set(g.map((i) => i.id)), n = t.filter((i) => !e.has(i.id)), r = o === null || o >= n.length ? n : n.slice(0, o), L = new Set(r.map((i) => i.id));
|
|
90
|
+
return {
|
|
91
|
+
visibleFilters: r,
|
|
92
|
+
overflowFilters: t.filter((i) => !L.has(i.id))
|
|
93
|
+
};
|
|
94
|
+
}, [t, o, g]);
|
|
95
|
+
return {
|
|
96
|
+
visibleFilters: H,
|
|
97
|
+
overflowFilters: J,
|
|
98
|
+
measuringFilters: g,
|
|
99
|
+
leftoverWidth: N,
|
|
100
|
+
parentRef: v,
|
|
101
|
+
containerRef: C,
|
|
102
|
+
setChipRef: Y,
|
|
103
|
+
setMoreChipRef: _,
|
|
104
|
+
setActionsRef: j,
|
|
105
|
+
setLeadingRef: D
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
export {
|
|
109
|
+
ae as useChipsOverflow
|
|
110
|
+
};
|
package/index.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export * from './contexts';
|
|
|
8
8
|
export * from './contexts/form';
|
|
9
9
|
export * from './hooks';
|
|
10
10
|
export * from './hocs';
|
|
11
|
+
export * from './helpers/resolveDeviceIconSrc';
|
|
12
|
+
export * from './helpers/resolveDeviceLabels';
|
|
11
13
|
export * from './utils';
|
|
12
14
|
export * from './@types/types.d';
|
|
13
15
|
export type { M4LOverridesStyleRules } from './@types/augmentations';
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/components/src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,YAAY,EACV,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/components/src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,YAAY,EACV,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AAKvB,cAAc,gCAAgC,CAAC;AAM/C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC;AACjC,YAAY,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC"}
|