@synerise/ds-item-picker 2.2.3 → 2.4.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.
Files changed (45) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/CLAUDE.md +71 -13
  3. package/README.md +42 -0
  4. package/dist/components/ItemPickerDropdown/ItemPickerDropdown.style.js +2 -4
  5. package/dist/components/ItemPickerList/ItemPickerList.js +41 -11
  6. package/dist/components/ItemPickerList/ItemPickerList.styles.d.ts +4 -1
  7. package/dist/components/ItemPickerList/ItemPickerList.styles.js +24 -9
  8. package/dist/components/ItemPickerList/components/EmptyListMessage.d.ts +3 -2
  9. package/dist/components/ItemPickerList/components/EmptyListMessage.js +4 -0
  10. package/dist/components/ItemPickerList/components/ErrorMessage.js +2 -3
  11. package/dist/components/ItemPickerList/components/ItemPickerListRow.js +1 -1
  12. package/dist/components/ItemPickerList/components/ItemPickerListSkeleton.d.ts +3 -1
  13. package/dist/components/ItemPickerList/components/ItemPickerListSkeleton.js +17 -10
  14. package/dist/components/ItemPickerList/components/ListSearchInput.d.ts +3 -1
  15. package/dist/components/ItemPickerList/components/ListSearchInput.js +10 -5
  16. package/dist/components/ItemPickerList/constants.d.ts +2 -0
  17. package/dist/components/ItemPickerList/constants.js +4 -0
  18. package/dist/components/ItemPickerList/hooks/index.d.ts +1 -0
  19. package/dist/components/ItemPickerList/hooks/index.js +2 -0
  20. package/dist/components/ItemPickerList/hooks/useFolderLevel.d.ts +9 -0
  21. package/dist/components/ItemPickerList/hooks/useFolderLevel.js +31 -0
  22. package/dist/components/ItemPickerList/hooks/useItemsInSections.d.ts +5 -0
  23. package/dist/components/ItemPickerList/hooks/useItemsInSections.js +208 -68
  24. package/dist/components/ItemPickerList/hooks/useItemsInSections.utils.d.ts +9 -1
  25. package/dist/components/ItemPickerList/hooks/useItemsInSections.utils.js +33 -1
  26. package/dist/components/ItemPickerList/types/renderMode.d.ts +1 -0
  27. package/dist/components/ItemPickerList/types/renderMode.js +2 -1
  28. package/dist/components/ItemPickerList/utils/actionItemsUtils.js +6 -2
  29. package/dist/components/ItemPickerList/utils/formatFolderPath.d.ts +4 -0
  30. package/dist/components/ItemPickerList/utils/formatFolderPath.js +13 -0
  31. package/dist/components/ItemPickerList/utils/index.d.ts +1 -0
  32. package/dist/components/ItemPickerList/utils/index.js +5 -1
  33. package/dist/components/ItemPickerList/utils/typeguards.utils.d.ts +7 -2
  34. package/dist/components/ItemPickerList/utils/typeguards.utils.js +4 -0
  35. package/dist/components/ItemPickerNew/ItemPickerNew.js +5 -3
  36. package/dist/components/ItemPickerNew/ItemPickerNew.types.d.ts +2 -1
  37. package/dist/components/ItemPickerNew/types/actions.types.d.ts +5 -0
  38. package/dist/components/ItemPickerNew/types/itemPickerListTexts.types.d.ts +1 -1
  39. package/dist/components/ItemPickerNew/types/mixedLoader.types.d.ts +52 -0
  40. package/dist/components/ItemPickerNew/types/mixedLoader.types.js +1 -0
  41. package/dist/components/ItemPickerTrigger/Trigger.js +3 -4
  42. package/dist/components/ItemPickerTrigger/Trigger.styles.js +16 -16
  43. package/dist/hooks/useDefaultTexts.js +8 -0
  44. package/dist/index.d.ts +1 -0
  45. package/package.json +23 -23
@@ -4,8 +4,12 @@ import "../constants.js";
4
4
  import { isSearchInAction, isSearchByAction, isTruthy } from "./typeguards.utils.js";
5
5
  import { getContextAwareActions } from "./getContextAwareActions.js";
6
6
  const getActionItem = (action, searchQuery) => {
7
+ const {
8
+ showInList: _showInList,
9
+ ...item
10
+ } = action;
7
11
  return {
8
- ...action,
12
+ ...item,
9
13
  highlight: searchQuery,
10
14
  onClick: "onClick" in action && action.onClick ? () => action.onClick?.(action) : void 0
11
15
  };
@@ -94,7 +98,7 @@ const getSectionActionItems = ({
94
98
  searchByParamConfig,
95
99
  setSearchByParamConfig
96
100
  }) => {
97
- const filteredActions = actions?.filter((action) => (action.actionType === ACTION_TYPES.searchBy || action.actionType === ACTION_TYPES.searchIn || action.sectionId === sectionId) && (!searchQuery || matchesSearchQuery(action.text, searchQuery)));
101
+ const filteredActions = actions?.filter((action) => action.showInList !== false && (action.actionType === ACTION_TYPES.searchBy || action.actionType === ACTION_TYPES.searchIn || action.sectionId === sectionId) && (!searchQuery || matchesSearchQuery(action.text, searchQuery)));
98
102
  return getActionItems({
99
103
  actions: filteredActions,
100
104
  texts,
@@ -0,0 +1,4 @@
1
+ export declare const formatFolderPath: (steps: string[]) => {
2
+ label: string;
3
+ fullPath: string;
4
+ };
@@ -0,0 +1,13 @@
1
+ const FOLDER_PATH_SEPARATOR = " / ";
2
+ const MAX_UNCOLLAPSED_STEPS = 4;
3
+ const formatFolderPath = (steps) => {
4
+ const fullPath = steps.join(FOLDER_PATH_SEPARATOR);
5
+ const label = steps.length <= MAX_UNCOLLAPSED_STEPS ? fullPath : [steps[0], "…", ...steps.slice(-2)].join(FOLDER_PATH_SEPARATOR);
6
+ return {
7
+ label,
8
+ fullPath
9
+ };
10
+ };
11
+ export {
12
+ formatFolderPath
13
+ };
@@ -1,4 +1,5 @@
1
1
  export * from './createTitleFromTitlePath';
2
2
  export * from './findSectionById';
3
+ export * from './formatFolderPath';
3
4
  export * from './isNavKey';
4
5
  export * from './typeguards.utils';
@@ -1,12 +1,16 @@
1
1
  import { createTitleFromTitlePath } from "./createTitleFromTitlePath.js";
2
2
  import { findSectionById } from "./findSectionById.js";
3
+ import { formatFolderPath } from "./formatFolderPath.js";
3
4
  import { isNavKey } from "./isNavKey.js";
4
- import { isItems, isItemsConfig, isSearchByAction, isSearchInAction, isTitle, isTruthy, isWithOutSections } from "./typeguards.utils.js";
5
+ import { isItemLoaderConfig, isItems, isItemsConfig, isMixedLoaderConfig, isSearchByAction, isSearchInAction, isTitle, isTruthy, isWithOutSections } from "./typeguards.utils.js";
5
6
  export {
6
7
  createTitleFromTitlePath,
7
8
  findSectionById,
9
+ formatFolderPath,
10
+ isItemLoaderConfig,
8
11
  isItems,
9
12
  isItemsConfig,
13
+ isMixedLoaderConfig,
10
14
  isNavKey,
11
15
  isSearchByAction,
12
16
  isSearchInAction,
@@ -2,11 +2,16 @@ import { ListItemProps } from '@synerise/ds-list-item';
2
2
  import { ItemLoaderConfig, ItemsConfig } from '../../ItemPickerNew/ItemPickerNew.types';
3
3
  import { Action, SearchByAction, SearchInAction } from '../../ItemPickerNew/types/actions.types';
4
4
  import { BaseItemType, BaseSectionType, BaseSectionTypeWithFolders } from '../../ItemPickerNew/types/baseItemSectionType.types';
5
+ import { MixedLoaderConfig } from '../../ItemPickerNew/types/mixedLoader.types';
5
6
  import { TitleListItemProps } from '../ItemPickerList.types';
6
7
  export declare const isTitle: (item: TitleListItemProps | ListItemProps) => item is TitleListItemProps;
7
- export declare const isItems: <ItemType extends BaseItemType>(items: ItemType[] | ItemsConfig<ItemType> | ItemLoaderConfig<ItemType>) => items is ItemType[];
8
- export declare const isItemsConfig: <ItemType extends BaseItemType>(items: ItemType[] | ItemsConfig<ItemType> | ItemLoaderConfig<ItemType>) => items is ItemsConfig<ItemType>;
8
+ type ItemsProp<ItemType extends BaseItemType> = ItemType[] | ItemsConfig<ItemType> | ItemLoaderConfig<ItemType> | MixedLoaderConfig<ItemType>;
9
+ export declare const isItems: <ItemType extends BaseItemType>(items: ItemsProp<ItemType>) => items is ItemType[];
10
+ export declare const isItemsConfig: <ItemType extends BaseItemType>(items: ItemsProp<ItemType>) => items is ItemsConfig<ItemType>;
11
+ export declare const isMixedLoaderConfig: <ItemType extends BaseItemType>(items: ItemsProp<ItemType>) => items is MixedLoaderConfig<ItemType>;
12
+ export declare const isItemLoaderConfig: <ItemType extends BaseItemType>(items: ItemsProp<ItemType>) => items is ItemLoaderConfig<ItemType>;
9
13
  export declare const isWithOutSections: <SectionType extends BaseSectionTypeWithFolders<BaseSectionType> | undefined>(sections?: SectionType[]) => sections is undefined;
10
14
  export declare const isTruthy: <T>(value: T) => value is NonNullable<T>;
11
15
  export declare const isSearchByAction: (action?: Action) => action is SearchByAction;
12
16
  export declare const isSearchInAction: (action?: Action) => action is SearchInAction;
17
+ export {};
@@ -14,6 +14,8 @@ const isItemsConfig = (items) => {
14
14
  }
15
15
  return false;
16
16
  };
17
+ const isMixedLoaderConfig = (items) => !Array.isArray(items) && "loadLevel" in items;
18
+ const isItemLoaderConfig = (items) => !Array.isArray(items) && "loadItems" in items;
17
19
  const isWithOutSections = (sections) => {
18
20
  return sections === void 0;
19
21
  };
@@ -27,8 +29,10 @@ const isSearchInAction = (action) => {
27
29
  return action?.actionType === ACTION_TYPES.searchIn;
28
30
  };
29
31
  export {
32
+ isItemLoaderConfig,
30
33
  isItems,
31
34
  isItemsConfig,
35
+ isMixedLoaderConfig,
32
36
  isSearchByAction,
33
37
  isSearchInAction,
34
38
  isTitle,
@@ -4,6 +4,7 @@ import Dropdown from "@synerise/ds-dropdown";
4
4
  import FormField from "@synerise/ds-form-field";
5
5
  import { useDefaultTexts } from "../../hooks/useDefaultTexts.js";
6
6
  import { ItemPickerWrapper } from "../../ItemPicker.styles.js";
7
+ import { GET_ITEM_KEY } from "../ItemPickerList/constants.js";
7
8
  import { ItemPickerList } from "../ItemPickerList/ItemPickerList.js";
8
9
  import Trigger from "../ItemPickerTrigger/Trigger.js";
9
10
  const ItemPickerNewInner = ({
@@ -46,12 +47,13 @@ const ItemPickerNewInner = ({
46
47
  onChange?.(item);
47
48
  closeDropdown();
48
49
  };
50
+ const selectedItemKey = selectedItem ? GET_ITEM_KEY(selectedItem) : void 0;
51
+ useEffect(() => setSelected(selectedItem), [selectedItem]);
49
52
  useEffect(() => {
50
- setSelected(selectedItem);
51
- if (selectedItem) {
53
+ if (selectedItemKey !== void 0) {
52
54
  setVisible(false);
53
55
  }
54
- }, [selectedItem]);
56
+ }, [selectedItemKey]);
55
57
  const trigger = useMemo(() => {
56
58
  return renderTrigger ? renderTrigger({
57
59
  selected: selectedItem,
@@ -11,6 +11,7 @@ import { ItemPickerTriggerProps, ItemPickerTriggerTexts } from '../ItemPickerTri
11
11
  import { Action } from './types/actions.types';
12
12
  import { BaseItemType, BaseSectionType, BaseSectionTypeWithFolders } from './types/baseItemSectionType.types';
13
13
  import { ItemPickerListTexts } from './types/itemPickerListTexts.types';
14
+ import { MixedLoaderConfig } from './types/mixedLoader.types';
14
15
  type HeightConfig = {
15
16
  defaultHeight: number;
16
17
  viewportHeightThreshold?: number;
@@ -87,7 +88,7 @@ export type ItemPickerListProps<ItemType extends BaseItemType, SectionType exten
87
88
  scrollbarProps?: ScrollbarAdditionalProps;
88
89
  searchBarProps?: Omit<SearchBarProps, 'value' | 'onSearchChange' | 'placeholder'>;
89
90
  onRefresh?: () => void;
90
- items: ItemType[] | ItemsConfig<ItemType> | ItemLoaderConfig<ItemType>;
91
+ items: ItemType[] | ItemsConfig<ItemType> | ItemLoaderConfig<ItemType> | MixedLoaderConfig<ItemType>;
91
92
  isLoading?: boolean;
92
93
  isVisible?: boolean;
93
94
  sections?: SectionType extends BaseSectionType ? BaseSectionTypeWithFolders<SectionType>[] : undefined;
@@ -11,6 +11,11 @@ type BasicAction = Omit<InheritedFromListItem, 'onClick'> & {
11
11
  id: string | number;
12
12
  text: ReactNode;
13
13
  icon?: ReactNode;
14
+ /**
15
+ * `false` keeps the action out of the list; it is still offered under `/`.
16
+ * @default true
17
+ */
18
+ showInList?: boolean;
14
19
  };
15
20
  type RedirectAction = BasicAction & {
16
21
  actionType: typeof ACTION_TYPES.redirect;
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- type TextsAsReactNode = 'basicSearchPlaceholder' | 'searchPlaceholder' | 'refreshButtonLabel' | 'showMoreResultsLabel' | 'noItems' | 'noResults' | 'noResultsInSection' | 'searchAllFoldersButtonLabel' | 'recentsSectionLabel' | 'actionsSectionLabel' | 'resultsSectionLabel' | 'noActions' | 'emptyStateLabel' | 'itemsSectionLabel' | 'infiniteScrollLoadingMore' | 'infiniteScrollLoadingError' | 'errorMessageTitle' | 'errorMessageDetails' | 'backTooltip' | 'clearSearchTooltip' | 'infiniteScrollAllLoaded';
2
+ type TextsAsReactNode = 'basicSearchPlaceholder' | 'searchPlaceholder' | 'refreshButtonLabel' | 'showMoreResultsLabel' | 'noItems' | 'noResults' | 'noResultsInSection' | 'searchAllFoldersButtonLabel' | 'recentsSectionLabel' | 'actionsSectionLabel' | 'resultsSectionLabel' | 'noActions' | 'emptyStateLabel' | 'itemsSectionLabel' | 'infiniteScrollLoadingMore' | 'infiniteScrollLoadingError' | 'errorMessageTitle' | 'errorMessageDetails' | 'backTooltip' | 'clearSearchTooltip' | 'infiniteScrollAllLoaded' | 'searchInFolderPlaceholder' | 'emptyFolder';
3
3
  export type ItemPickerListTexts = {
4
4
  [key in TextsAsReactNode]: ReactNode;
5
5
  };
@@ -0,0 +1,52 @@
1
+ import { ReactNode } from 'react';
2
+ import { InformationCardProps } from '@synerise/ds-information-card';
3
+ import { BaseItemType } from './baseItemSectionType.types';
4
+ export type FolderNode = {
5
+ id: string;
6
+ text: string;
7
+ /** Second line of a large row. */
8
+ description?: ReactNode;
9
+ disabled?: boolean;
10
+ /** Shown on the right of a disabled default row, or as the second line of a large one. */
11
+ disabledReason?: ReactNode;
12
+ informationCardProps?: InformationCardProps;
13
+ };
14
+ export type LevelEntry<ItemType extends BaseItemType> = ({
15
+ type: 'folder';
16
+ folder: FolderNode;
17
+ } | {
18
+ type: 'item';
19
+ item: ItemType;
20
+ }) & {
21
+ /** Where a search result sits; the second line of a large row in search results. */
22
+ location?: ReactNode;
23
+ };
24
+ /** `id: null` is the root. */
25
+ export type PathStep = {
26
+ id: string | null;
27
+ text: string;
28
+ };
29
+ export type LoadLevelParams = {
30
+ /** `null` is the root. */
31
+ folderId: string | null;
32
+ /** Empty: the level itself. Otherwise: matches from this level and every level below it. */
33
+ searchQuery: string;
34
+ searchKey?: string;
35
+ page: number;
36
+ limit: number;
37
+ abortController?: AbortController;
38
+ };
39
+ export type LoadLevelResult<ItemType extends BaseItemType> = {
40
+ /** One page, folders first. */
41
+ entries: LevelEntry<ItemType>[];
42
+ total: number;
43
+ /** From the root to `folderId`. */
44
+ path: PathStep[];
45
+ };
46
+ export type MixedLoaderConfig<ItemType extends BaseItemType> = {
47
+ loadLevel: (params: LoadLevelParams) => Promise<LoadLevelResult<ItemType>>;
48
+ /** @default 30 */
49
+ limitPerPage?: number;
50
+ /** @default 'default' */
51
+ rowSize?: 'default' | 'large';
52
+ };
@@ -1,7 +1,6 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import { forwardRef, useCallback, useMemo } from "react";
3
3
  import Button from "@synerise/ds-button";
4
- import { theme } from "@synerise/ds-core";
5
4
  import Icon, { Close3S, WarningFillM, AngleDownS, EditM } from "@synerise/ds-icon";
6
5
  import { InformationCardTooltip } from "@synerise/ds-information-card";
7
6
  import Popconfirm from "@synerise/ds-popconfirm";
@@ -44,19 +43,19 @@ const Trigger = forwardRef(({
44
43
  onClear && onClear();
45
44
  }, [onClear, closeDropdown]);
46
45
  const renderClear = useMemo(() => {
47
- const tooltip = /* @__PURE__ */ jsx(Tooltip, { title: allTexts.clear, children: /* @__PURE__ */ jsx(ClearIconWrapper, { onClick: (event) => withClearConfirmation && event.stopPropagation(), children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(Close3S, {}), color: theme.palette["red-600"] }) }) });
46
+ const tooltip = /* @__PURE__ */ jsx(Tooltip, { title: allTexts.clear, children: /* @__PURE__ */ jsx(ClearIconWrapper, { onClick: (event) => withClearConfirmation && event.stopPropagation(), children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(Close3S, {}), color: "var(--ds-form-clear-icon)" }) }) });
48
47
  if (selected) {
49
48
  if (withClearConfirmation) {
50
49
  return /* @__PURE__ */ jsx(Popconfirm, { title: allTexts.clearConfirmTitle, okButtonProps: {
51
50
  onClick: handleClear
52
- }, okText: allTexts.yes, cancelText: allTexts.no, icon: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(WarningFillM, {}), color: theme.palette["yellow-600"] }), children: tooltip });
51
+ }, okText: allTexts.yes, cancelText: allTexts.no, icon: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(WarningFillM, {}), color: "var(--ds-color-icon-warning-default)" }), children: tooltip });
53
52
  }
54
53
  return /* @__PURE__ */ jsx(ClearWrapper, { onClick: handleClear, "data-testid": "clear-icon", children: tooltip });
55
54
  }
56
55
  return null;
57
56
  }, [allTexts.clear, allTexts.clearConfirmTitle, allTexts.yes, allTexts.no, selected, withClearConfirmation, handleClear]);
58
57
  const renderAngleIcon = useMemo(() => {
59
- return size === "small" && /* @__PURE__ */ jsx(AngleIconWrapper, { children: /* @__PURE__ */ jsx(Icon, { "data-testid": "angle-icon", component: /* @__PURE__ */ jsx(AngleDownS, {}), color: theme.palette["grey-600"] }) });
58
+ return size === "small" && /* @__PURE__ */ jsx(AngleIconWrapper, { children: /* @__PURE__ */ jsx(Icon, { "data-testid": "angle-icon", component: /* @__PURE__ */ jsx(AngleDownS, {}), color: "var(--ds-form-icon-color-default)" }) });
60
59
  }, [size]);
61
60
  const handleChangeButtonClick = useCallback((event) => {
62
61
  event.stopPropagation();
@@ -1,27 +1,27 @@
1
1
  import styled, { css } from "styled-components";
2
2
  const getDefaultStyles = (props) => {
3
3
  if (props.size === "small") {
4
- return `box-shadow: inset 0 0 0 1px ${props.theme.palette["grey-400"]};`;
4
+ return `box-shadow: inset 0 0 0 1px var(--ds-form-field-border-default);`;
5
5
  }
6
- return `border: 1px dashed ${props.theme.palette["grey-400"]};`;
6
+ return `border: 1px dashed var(--ds-form-field-border-default);`;
7
7
  };
8
8
  const getHoverStyles = (props) => {
9
9
  if (props.size === "small") {
10
- return `box-shadow: inset 0 0 0 1px ${props.theme.palette["grey-500"]};`;
10
+ return `box-shadow: inset 0 0 0 1px var(--ds-form-field-border-hover);`;
11
11
  }
12
- return `border: 1px dashed ${props.theme.palette["grey-500"]};`;
12
+ return `border: 1px dashed var(--ds-form-field-border-hover);`;
13
13
  };
14
14
  const getErrorStyles = (props) => {
15
15
  if (props.size === "small") {
16
- return `box-shadow: inset 0 0 0 1px ${props.theme.palette["red-600"]};`;
16
+ return `box-shadow: inset 0 0 0 2px var(--ds-form-field-border-validated);`;
17
17
  }
18
- return `border: 1px dashed ${props.theme.palette["red-600"]};`;
18
+ return `border: 1px dashed var(--ds-form-field-border-validated);`;
19
19
  };
20
20
  const getFocusStyles = (props) => {
21
21
  if (props.size === "small") {
22
- return `box-shadow: inset 0 0 0 2px ${props.theme.palette["blue-600"]};`;
22
+ return `box-shadow: inset 0 0 0 2px var(--ds-form-field-border-focus);`;
23
23
  }
24
- return `border: 1px dashed ${props.theme.palette["blue-600"]};`;
24
+ return `border: 1px dashed var(--ds-form-field-border-focus);`;
25
25
  };
26
26
  const ClearIconWrapper = /* @__PURE__ */ styled.div.withConfig({
27
27
  displayName: "Triggerstyles__ClearIconWrapper",
@@ -46,11 +46,11 @@ const Prefix = /* @__PURE__ */ styled.div.withConfig({
46
46
  const Placeholder = /* @__PURE__ */ styled.div.withConfig({
47
47
  displayName: "Triggerstyles__Placeholder",
48
48
  componentId: "sc-1t1uce7-5"
49
- })(["display:flex;flex-direction:row;align-items:center;justify-content:flex-start;flex:1;color:", ";padding:0 0 0 4px;", "{svg{fill:", ";color:", ";}}&:hover{color:", ";", "{svg{fill:", ";color:", ";}}}"], (props) => props.theme.palette["grey-500"], Prefix, (props) => props.theme.palette["grey-500"], (props) => props.theme.palette["grey-500"], (props) => props.size === "large" ? props.theme.palette["grey-600"] : props.theme.palette["grey-500"], Prefix, (props) => props.theme.palette["grey-600"], (props) => props.theme.palette["grey-600"]);
49
+ })(["display:flex;flex-direction:row;align-items:center;justify-content:flex-start;flex:1;color:var(--ds-form-field-text-placeholder);padding:0 0 0 4px;", "{color:var(--ds-color-icon-base-subtle);}&:hover{color:", ";", "{color:var(--ds-form-icon-color-default);}}"], Prefix, (props) => props.size === "large" ? "var(--ds-color-text-base-muted)" : "var(--ds-form-field-text-placeholder)", Prefix);
50
50
  const Value = /* @__PURE__ */ styled.div.withConfig({
51
51
  displayName: "Triggerstyles__Value",
52
52
  componentId: "sc-1t1uce7-6"
53
- })(["display:flex;flex-direction:row;align-items:center;justify-content:flex-start;flex:1;color:", ";max-width:100%;overflow:hidden;padding:0 0 0 4px;", ""], (props) => props.theme.palette["grey-800"], (props) => !props.isObjectDeleted && css(["", "{svg{fill:", ";color:", ";}}"], Prefix, props.theme.palette["grey-600"], props.theme.palette["grey-600"]));
53
+ })(["display:flex;flex-direction:row;align-items:center;justify-content:flex-start;flex:1;color:var(--ds-form-field-text-value);max-width:100%;overflow:hidden;padding:0 0 0 4px;", ""], (props) => !props.isObjectDeleted && css(["", "{color:var(--ds-form-icon-color-default);}"], Prefix));
54
54
  const Trigger = /* @__PURE__ */ styled.div.withConfig({
55
55
  displayName: "Triggerstyles__Trigger",
56
56
  componentId: "sc-1t1uce7-7"
@@ -62,7 +62,7 @@ const InformationCardTriggerWrapper = /* @__PURE__ */ styled.span.withConfig({
62
62
  const TriggerWrapper = /* @__PURE__ */ styled.div.withConfig({
63
63
  displayName: "Triggerstyles__TriggerWrapper",
64
64
  componentId: "sc-1t1uce7-9"
65
- })(["width:100%;display:flex;flex-direction:row;align-items:center;justify-content:space-between;cursor:", ";pointer-events:", ";position:relative;border-radius:3px;transition:all 0.3s ease;padding:", ";background-color:", ";", " ", " &:hover{", ";", "}&:focus{background-color:", ";", ";}&&{", ";", " ", ";", ";}"], (props) => {
65
+ })(["width:100%;display:flex;flex-direction:row;align-items:center;justify-content:space-between;cursor:", ";pointer-events:", ";position:relative;border-radius:3px;transition:all 0.3s ease;padding:", ";background-color:", ";", " ", " &:hover{", ";", "}&:focus{background-color:var(--ds-form-field-bg-focus);", ";}&&{", ";", " ", ";", ";}"], (props) => {
66
66
  if (props.disabled) {
67
67
  return "not-allowed";
68
68
  }
@@ -72,15 +72,15 @@ const TriggerWrapper = /* @__PURE__ */ styled.div.withConfig({
72
72
  return "pointer";
73
73
  }, (props) => props.disabled ? "none" : "all", (props) => props.size === "small" ? "0 8px" : "0 12px", (props) => {
74
74
  if (props.disabled) {
75
- return props.theme.palette["grey-100"];
75
+ return "var(--ds-form-field-bg-disabled)";
76
76
  }
77
77
  if (props.error) {
78
- return props.theme.palette["red-050"];
78
+ return "var(--ds-form-field-bg-validated)";
79
79
  }
80
80
  if (props.size === "large") {
81
81
  return "transparent";
82
82
  }
83
- return props.theme.palette.white;
83
+ return "var(--ds-form-field-bg-default)";
84
84
  }, (props) => getDefaultStyles(props), (props) => props.clearable && props.size === "small" && `
85
85
  ${AngleIconWrapper} {
86
86
  display: block;
@@ -95,7 +95,7 @@ const TriggerWrapper = /* @__PURE__ */ styled.div.withConfig({
95
95
  ${ClearIconWrapper} {
96
96
  display: block;
97
97
  }
98
- `, (props) => props.theme.palette["blue-050"], (props) => getFocusStyles(props), (props) => props.selected && props.size === "large" && css(["border:1px solid ", ";&:hover{border:1px solid ", ";}"], props.theme.palette["grey-300"], props.theme.palette["grey-400"]), (props) => props.opened && !props.error && css(["background-color:", ";", ";"], props.theme.palette["blue-050"], getFocusStyles(props)), (props) => Boolean(props.error) && css(["background-color:", ";", ""], props.theme.palette["red-050"], getErrorStyles(props)), (props) => Boolean(props.disabled) && css(["", "{opacity:0.4;}"], IconWrapper));
98
+ `, (props) => getFocusStyles(props), (props) => props.selected && props.size === "large" && css(["border:1px solid var(--ds-form-field-border-default);&:hover{border:1px solid var(--ds-form-field-border-hover);}"]), (props) => props.opened && !props.error && css(["background-color:var(--ds-form-field-bg-focus);", ";"], getFocusStyles(props)), (props) => Boolean(props.error) && css(["background-color:var(--ds-form-field-bg-validated);", ""], getErrorStyles(props)), (props) => Boolean(props.disabled) && css(["", "{opacity:var(--ds-opacity-disabled);}"], IconWrapper));
99
99
  const ChangeButtonWrapper = /* @__PURE__ */ styled.div.withConfig({
100
100
  displayName: "Triggerstyles__ChangeButtonWrapper",
101
101
  componentId: "sc-1t1uce7-10"
@@ -103,7 +103,7 @@ const ChangeButtonWrapper = /* @__PURE__ */ styled.div.withConfig({
103
103
  const ValueText = /* @__PURE__ */ styled.span.withConfig({
104
104
  displayName: "Triggerstyles__ValueText",
105
105
  componentId: "sc-1t1uce7-11"
106
- })(["text-overflow:ellipsis;overflow:hidden;white-space:nowrap;", ""], (props) => props.isObjectDeleted && css(["color:", ";"], props.theme.palette["red-600"]));
106
+ })(["text-overflow:ellipsis;overflow:hidden;white-space:nowrap;", ""], (props) => props.isObjectDeleted && css(["color:var(--ds-form-error-text-color);"]));
107
107
  export {
108
108
  AngleIconWrapper,
109
109
  ChangeButtonWrapper,
@@ -88,6 +88,14 @@ const useDefaultTexts = (texts) => {
88
88
  id: "DS.ITEM-PICKER-DROPDOWN.LOADED-ALL",
89
89
  defaultMessage: "All items loaded"
90
90
  }),
91
+ searchInFolderPlaceholder: intl.formatMessage({
92
+ id: "DS.ITEM-PICKER-DROPDOWN.SEARCH-IN-FOLDER-PLACEHOLDER",
93
+ defaultMessage: "Search in this folder"
94
+ }),
95
+ emptyFolder: intl.formatMessage({
96
+ id: "DS.ITEM-PICKER-DROPDOWN.EMPTY-FOLDER",
97
+ defaultMessage: "This folder is empty"
98
+ }),
91
99
  errorMessageTitle: intl.formatMessage({
92
100
  id: "DS.ITEM-PICKER-DROPDOWN.ERROR-TITLE",
93
101
  defaultMessage: "Items can`t be loaded"
package/dist/index.d.ts CHANGED
@@ -8,5 +8,6 @@ export type { ItemLoaderConfig, ItemLoaderResponse, ItemPickerListProps, ItemPic
8
8
  export type { Action } from './components/ItemPickerNew/types/actions.types';
9
9
  export type { BaseItemType, BaseSectionType, BaseSectionTypeWithFolders, } from './components/ItemPickerNew/types/baseItemSectionType.types';
10
10
  export type { ItemPickerListTexts } from './components/ItemPickerNew/types/itemPickerListTexts.types';
11
+ export type { FolderNode, LevelEntry, LoadLevelParams, LoadLevelResult, MixedLoaderConfig, PathStep, } from './components/ItemPickerNew/types/mixedLoader.types';
11
12
  export { default as ItemPickerTrigger } from './components/ItemPickerTrigger/Trigger';
12
13
  export { default } from './ItemPicker';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-item-picker",
3
- "version": "2.2.3",
3
+ "version": "2.4.0",
4
4
  "description": "ItemPicker UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -42,27 +42,27 @@
42
42
  ],
43
43
  "types": "dist/index.d.ts",
44
44
  "dependencies": {
45
- "@synerise/ds-avatar": "^2.0.11",
46
- "@synerise/ds-button": "^2.1.6",
47
- "@synerise/ds-dropdown": "^2.1.8",
48
- "@synerise/ds-empty-states": "^2.0.8",
49
- "@synerise/ds-flag": "^2.0.3",
50
- "@synerise/ds-form-field": "^2.0.11",
51
- "@synerise/ds-icon": "^2.2.3",
52
- "@synerise/ds-information-card": "^2.0.14",
53
- "@synerise/ds-inline-alert": "^2.0.8",
54
- "@synerise/ds-list-item": "^2.2.4",
55
- "@synerise/ds-loader": "^2.0.3",
56
- "@synerise/ds-popconfirm": "^2.0.11",
57
- "@synerise/ds-result": "^2.0.11",
58
- "@synerise/ds-scrollbar": "^2.0.9",
59
- "@synerise/ds-search": "^2.0.11",
60
- "@synerise/ds-search-bar": "^2.0.12",
61
- "@synerise/ds-short-cuts": "^2.0.11",
62
- "@synerise/ds-skeleton": "^2.0.11",
63
- "@synerise/ds-tooltip": "^2.0.11",
64
- "@synerise/ds-typography": "^2.0.11",
65
- "@synerise/ds-utils": "^2.2.2",
45
+ "@synerise/ds-avatar": "^2.1.1",
46
+ "@synerise/ds-button": "^2.2.1",
47
+ "@synerise/ds-dropdown": "^2.2.1",
48
+ "@synerise/ds-empty-states": "^2.1.1",
49
+ "@synerise/ds-flag": "^2.0.4",
50
+ "@synerise/ds-form-field": "^2.1.1",
51
+ "@synerise/ds-icon": "^2.3.1",
52
+ "@synerise/ds-information-card": "^2.1.1",
53
+ "@synerise/ds-inline-alert": "^2.1.1",
54
+ "@synerise/ds-list-item": "^2.4.0",
55
+ "@synerise/ds-loader": "^2.1.1",
56
+ "@synerise/ds-popconfirm": "^2.1.1",
57
+ "@synerise/ds-result": "^2.1.1",
58
+ "@synerise/ds-scrollbar": "^2.1.1",
59
+ "@synerise/ds-search": "^2.1.1",
60
+ "@synerise/ds-search-bar": "^2.1.1",
61
+ "@synerise/ds-short-cuts": "^2.1.1",
62
+ "@synerise/ds-skeleton": "^2.1.1",
63
+ "@synerise/ds-tooltip": "^2.1.1",
64
+ "@synerise/ds-typography": "^2.1.1",
65
+ "@synerise/ds-utils": "^2.3.1",
66
66
  "lodash.debounce": "^4.0.8",
67
67
  "react-window": "^1.8.11"
68
68
  },
@@ -76,5 +76,5 @@
76
76
  "react-intl": ">=3.12.0 <= 6.8",
77
77
  "styled-components": "^5.3.3"
78
78
  },
79
- "gitHead": "c356039703d8826bbbdb6dadcb18bb008fea8bc5"
79
+ "gitHead": "2d2a540b35fddf8855da45f0dec2f4612c6d87b6"
80
80
  }