@commercelayer/app-elements 1.8.2 → 1.9.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 (31) hide show
  1. package/dist/{InputDateComponent-bd691997.js → InputDateComponent-35a039ff.js} +1 -1
  2. package/dist/dictionaries/orders.d.ts +3 -3
  3. package/dist/dictionaries/returns.d.ts +3 -3
  4. package/dist/dictionaries/shipments.d.ts +3 -3
  5. package/dist/dictionaries/stockTransfers.d.ts +3 -3
  6. package/dist/dictionaries/types.d.ts +3 -3
  7. package/dist/hooks/useOverlay.d.ts +4 -0
  8. package/dist/{main-9651b7ba.js → main-1f5280bc.js} +8751 -8402
  9. package/dist/main.d.ts +2 -1
  10. package/dist/main.js +137 -135
  11. package/dist/style.css +1 -1
  12. package/dist/ui/atoms/Badge/Badge.d.ts +2 -0
  13. package/dist/ui/atoms/ButtonFilter.d.ts +2 -2
  14. package/dist/ui/atoms/EmptyState.d.ts +2 -2
  15. package/dist/ui/atoms/Icon/Icon.d.ts +2 -9
  16. package/dist/ui/atoms/Icon/icons.d.ts +8 -0
  17. package/dist/ui/atoms/RadialProgress.d.ts +2 -2
  18. package/dist/ui/atoms/StatusIcon.d.ts +17 -0
  19. package/dist/ui/atoms/StatusIcon.test.d.ts +1 -0
  20. package/dist/ui/atoms/Tag.d.ts +1 -1
  21. package/dist/ui/composite/Dropdown/Dropdown.d.ts +2 -1
  22. package/dist/ui/composite/Dropdown/Dropdown.test.d.ts +1 -0
  23. package/dist/ui/composite/Dropdown/DropdownDivider.d.ts +2 -5
  24. package/dist/ui/composite/Dropdown/DropdownItem.d.ts +4 -6
  25. package/dist/ui/composite/Dropdown/DropdownMenu.d.ts +17 -7
  26. package/dist/ui/composite/Dropdown/DropdownSearch.d.ts +25 -0
  27. package/dist/ui/composite/Dropdown/DropdownSearch.test.d.ts +1 -0
  28. package/dist/ui/composite/Dropdown/index.d.ts +1 -0
  29. package/dist/ui/composite/ListItem.d.ts +1 -1
  30. package/dist/ui/resources/ResourceListItem/common.d.ts +1 -1
  31. package/package.json +1 -1
@@ -1,8 +1,10 @@
1
+ import { type IconProps } from '../../atoms/Icon';
1
2
  import React from 'react';
2
3
  import { variantCss } from './badgeVariants';
3
4
  export interface BadgeProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
4
5
  /** Render a different variant. */
5
6
  variant: keyof typeof variantCss;
7
+ icon?: IconProps['name'];
6
8
  children: React.ReactNode;
7
9
  }
8
10
  /** Badges are used to highlight an item's status for quick recognition. */
@@ -1,9 +1,9 @@
1
1
  /// <reference types="react" />
2
- import { type IconProps } from './Icon';
2
+ import { type StatusIconProps } from './StatusIcon';
3
3
  export interface ButtonFilterProps extends React.HTMLAttributes<HTMLDivElement> {
4
4
  onClick?: () => void;
5
5
  onRemoveRequest?: () => void;
6
- icon?: IconProps['name'];
6
+ icon?: StatusIconProps['name'];
7
7
  label: string;
8
8
  }
9
9
  declare function ButtonFilter({ onClick, onRemoveRequest, label, icon, className, ...rest }: ButtonFilterProps): JSX.Element;
@@ -1,11 +1,11 @@
1
1
  import { type ReactNode } from 'react';
2
- import { type IconProps } from './Icon';
2
+ import { type StatusIconProps } from './StatusIcon';
3
3
  export interface EmptyStateProps {
4
4
  title: string;
5
5
  description?: ReactNode;
6
6
  action?: ReactNode;
7
7
  className?: string;
8
- icon?: IconProps['name'];
8
+ icon?: StatusIconProps['name'];
9
9
  }
10
10
  declare function EmptyState({ title, description, action, icon, className, ...rest }: EmptyStateProps): JSX.Element;
11
11
  declare namespace EmptyState {
@@ -1,18 +1,11 @@
1
1
  /// <reference types="react" />
2
+ import { type IconProps as PhosphorIconProps } from '@phosphor-icons/react';
2
3
  import { iconMapping } from './icons';
3
- export interface IconProps extends React.HTMLAttributes<HTMLDivElement> {
4
+ export interface IconProps extends PhosphorIconProps {
4
5
  /**
5
6
  * Name of the icon to display
6
7
  */
7
8
  name: keyof typeof iconMapping;
8
- /**
9
- * Background color, `none` for no background
10
- */
11
- background?: 'green' | 'orange' | 'red' | 'gray' | 'teal' | 'white' | 'black' | 'none';
12
- /**
13
- * padding around the icon can bne: 'none' | 'small' | 'large'
14
- */
15
- gap?: 'none' | 'small' | 'large';
16
9
  }
17
10
  /** `app-elements` provides a subset of [Phosphor Icons](https://phosphoricons.com/) out-of-the-box. */
18
11
  export declare const Icon: React.FC<IconProps>;
@@ -9,6 +9,8 @@ export declare const iconMapping: {
9
9
  readonly arrowsLeftRight: phosphor.Icon;
10
10
  readonly arrowUpRight: phosphor.Icon;
11
11
  readonly asterisk: phosphor.Icon;
12
+ readonly buildings: phosphor.Icon;
13
+ readonly caretDown: phosphor.Icon;
12
14
  readonly caretRight: phosphor.Icon;
13
15
  readonly chatCircle: phosphor.Icon;
14
16
  readonly check: phosphor.Icon;
@@ -23,20 +25,26 @@ export declare const iconMapping: {
23
25
  readonly google: phosphor.Icon;
24
26
  readonly home: phosphor.Icon;
25
27
  readonly hourglass: phosphor.Icon;
28
+ readonly lifebuoy: phosphor.Icon;
26
29
  readonly magnifyingGlass: phosphor.Icon;
27
30
  readonly minus: phosphor.Icon;
31
+ readonly minusCircle: phosphor.Icon;
28
32
  readonly package: phosphor.Icon;
29
33
  readonly pencilSimple: phosphor.Icon;
30
34
  readonly printer: phosphor.Icon;
35
+ readonly plus: phosphor.Icon;
31
36
  readonly pulse: phosphor.Icon;
32
37
  readonly resources: phosphor.Icon;
33
38
  readonly settings: phosphor.Icon;
34
39
  readonly shoppingBag: phosphor.Icon;
40
+ readonly signOut: phosphor.Icon;
35
41
  readonly team: phosphor.Icon;
36
42
  readonly truck: phosphor.Icon;
37
43
  readonly upload: phosphor.Icon;
38
44
  readonly user: phosphor.Icon;
45
+ readonly userCircle: phosphor.Icon;
39
46
  readonly warning: phosphor.Icon;
40
47
  readonly warningCircle: phosphor.Icon;
41
48
  readonly x: phosphor.Icon;
49
+ readonly xCircle: phosphor.Icon;
42
50
  };
@@ -1,5 +1,5 @@
1
1
  import { type SVGAttributes } from 'react';
2
- import { type IconProps } from './Icon';
2
+ import { type StatusIconProps } from './StatusIcon';
3
3
  export interface RadialProgressProps extends SVGAttributes<SVGElement> {
4
4
  /**
5
5
  * Progress percentage express as number from 0 to 100.
@@ -15,7 +15,7 @@ export interface RadialProgressProps extends SVGAttributes<SVGElement> {
15
15
  /**
16
16
  * Optional icon to be rendered in the center of the circle
17
17
  */
18
- icon?: IconProps['name'];
18
+ icon?: StatusIconProps['name'];
19
19
  }
20
20
  /**
21
21
  * Used to render a radial progress with a pending and a progress state. It also accepts an optional icon to be rendered in the center of the circle.
@@ -0,0 +1,17 @@
1
+ /// <reference types="react" />
2
+ import { type iconMapping } from './Icon/icons';
3
+ export interface StatusIconProps extends React.HTMLAttributes<HTMLDivElement> {
4
+ /**
5
+ * Name of the icon to display
6
+ */
7
+ name: keyof typeof iconMapping;
8
+ /**
9
+ * Background color, `none` for no background
10
+ */
11
+ background?: 'green' | 'orange' | 'red' | 'gray' | 'teal' | 'white' | 'black' | 'none';
12
+ /**
13
+ * padding around the icon can bne: 'none' | 'small' | 'large'
14
+ */
15
+ gap?: 'none' | 'small' | 'large';
16
+ }
17
+ export declare const StatusIcon: React.FC<StatusIconProps>;
@@ -0,0 +1 @@
1
+ export {};
@@ -3,7 +3,7 @@ import { type FC } from 'react';
3
3
  type Props = Pick<FlexRowProps, 'children'> & {
4
4
  /**
5
5
  * Icon component
6
- * Example: `<Icon>` or `<RadialProgress>` or `<Avatar>`
6
+ * Example: `<StatusIcon>` or `<RadialProgress>` or `<Avatar>`
7
7
  */
8
8
  icon?: JSX.Element;
9
9
  };
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
- export interface DropdownProps {
2
+ import { type DropdownMenuProps } from '../../composite/Dropdown/DropdownMenu';
3
+ export interface DropdownProps extends Pick<DropdownMenuProps, 'menuHeader' | 'menuPosition'> {
3
4
  /** The trigger for the dropdown menu. Can be a JSX Element or simply a `string`. */
4
5
  dropdownLabel?: React.ReactNode;
5
6
  /** List of links and actions. You can use a combination of `DropdownItem` and `DropdownDivider` components. */
@@ -0,0 +1 @@
1
+ export {};
@@ -1,8 +1,5 @@
1
- /// <reference types="react" />
1
+ import { type FC } from 'react';
2
2
  export interface DropdownDividerProps extends React.HTMLAttributes<HTMLElement> {
3
3
  children?: React.ReactNode;
4
4
  }
5
- export declare function DropdownDivider({ children, ...rest }: DropdownDividerProps): JSX.Element;
6
- export declare namespace DropdownDivider {
7
- var displayName: string;
8
- }
5
+ export declare const DropdownDivider: FC<DropdownDividerProps>;
@@ -1,9 +1,7 @@
1
- /// <reference types="react" />
1
+ import { type IconProps } from '../../atoms/Icon/Icon';
2
+ import { type FC } from 'react';
2
3
  export interface DropdownItemProps extends React.HTMLAttributes<HTMLElement> {
3
4
  label: string;
4
- icon?: React.ReactNode;
5
- }
6
- export declare function DropdownItem({ label, icon, ...rest }: DropdownItemProps): JSX.Element;
7
- export declare namespace DropdownItem {
8
- var displayName: string;
5
+ icon?: IconProps['name'] | 'keep-space';
9
6
  }
7
+ export declare const DropdownItem: FC<DropdownItemProps>;
@@ -1,10 +1,20 @@
1
- /// <reference types="react" />
2
- interface Props extends React.HTMLAttributes<HTMLElement> {
1
+ import { type FC } from 'react';
2
+ export interface DropdownMenuProps extends React.HTMLAttributes<HTMLElement> {
3
+ /** Menu content */
3
4
  children?: React.ReactNode;
5
+ /** Set to `none` to hide the top arrow */
4
6
  arrow?: 'none';
7
+ /** Optional header for the dropdown menu */
8
+ menuHeader?: string;
9
+ /**
10
+ * Opening position of the dropdown menu
11
+ * @default bottom-right
12
+ */
13
+ menuPosition?: 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right';
14
+ /**
15
+ * If set, the arrow will be centered when trigger button is smaller than 50px
16
+ * Otherwise it will fallback to a default centering based on 32px trigger button
17
+ */
18
+ parentElementRef?: React.RefObject<HTMLDivElement>;
5
19
  }
6
- export declare function DropdownMenu({ children, arrow, ...rest }: Props): JSX.Element;
7
- export declare namespace DropdownMenu {
8
- var displayName: string;
9
- }
10
- export {};
20
+ export declare const DropdownMenu: FC<DropdownMenuProps>;
@@ -0,0 +1,25 @@
1
+ /// <reference types="react" />
2
+ export interface DropdownSearchProps {
3
+ /**
4
+ * Callback triggered when the user types in the search input.
5
+ * By default, this callback is debounced by 500ms.
6
+ */
7
+ onSearch: (hint: string) => void;
8
+ /**
9
+ * Debounce time in ms for the onSearch callback. Set to 0 to disable debounce.
10
+ * @default 500
11
+ */
12
+ debounceMs?: number;
13
+ /**
14
+ * Placeholder text for the input element
15
+ */
16
+ placeholder?: string;
17
+ /**
18
+ * Enable auto focus on the input element
19
+ */
20
+ autoFocus?: boolean;
21
+ }
22
+ /**
23
+ * This component renders an input as dropdown menu item with debounced `onSearch` callback.
24
+ */
25
+ export declare const DropdownSearch: import("react").ForwardRefExoticComponent<DropdownSearchProps & import("react").RefAttributes<HTMLInputElement>>;
@@ -1,3 +1,4 @@
1
1
  export { Dropdown, type DropdownProps } from './Dropdown';
2
2
  export { DropdownDivider, type DropdownDividerProps } from './DropdownDivider';
3
3
  export { DropdownItem, type DropdownItemProps } from './DropdownItem';
4
+ export { DropdownSearch, type DropdownSearchProps } from './DropdownSearch';
@@ -3,7 +3,7 @@ import { type FC } from 'react';
3
3
  type Props = Pick<FlexRowProps, 'alignItems' | 'children'> & {
4
4
  /**
5
5
  * Icon component
6
- * Example: `<Icon>` or `<RadialProgress>` or `<Avatar>`
6
+ * Example: `<StatusIcon>` or `<RadialProgress>` or `<Avatar>`
7
7
  */
8
8
  icon?: JSX.Element;
9
9
  /**
@@ -8,7 +8,7 @@ export declare const ListItemDescription: import('../../atoms/SkeletonTemplate')
8
8
  }>;
9
9
  export declare const ListItemIcon: import('../../atoms/SkeletonTemplate').SkeletonTemplateComponent<{
10
10
  color: "none" | "green" | "orange" | "red" | "gray" | "teal" | "white" | "black" | undefined;
11
- icon: "download" | "package" | "settings" | "arrowBendDownRight" | "apps" | "arrowCircleDown" | "arrowClockwise" | "arrowDown" | "arrowLeft" | "arrowsLeftRight" | "arrowUpRight" | "asterisk" | "caretRight" | "chatCircle" | "check" | "cloud" | "credentials" | "creditCard" | "eye" | "flag" | "funnel" | "github" | "google" | "home" | "hourglass" | "magnifyingGlass" | "minus" | "pencilSimple" | "printer" | "pulse" | "resources" | "shoppingBag" | "team" | "truck" | "upload" | "user" | "warning" | "warningCircle" | "x";
11
+ icon: "download" | "package" | "settings" | "x" | "arrowBendDownRight" | "apps" | "arrowCircleDown" | "arrowClockwise" | "arrowDown" | "arrowLeft" | "arrowsLeftRight" | "arrowUpRight" | "asterisk" | "buildings" | "caretDown" | "caretRight" | "chatCircle" | "check" | "cloud" | "credentials" | "creditCard" | "eye" | "flag" | "funnel" | "github" | "google" | "home" | "hourglass" | "lifebuoy" | "magnifyingGlass" | "minus" | "minusCircle" | "pencilSimple" | "printer" | "plus" | "pulse" | "resources" | "shoppingBag" | "signOut" | "team" | "truck" | "upload" | "user" | "userCircle" | "warning" | "warningCircle" | "xCircle";
12
12
  delayMs?: number | undefined;
13
13
  isLoading?: boolean | undefined;
14
14
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercelayer/app-elements",
3
- "version": "1.8.2",
3
+ "version": "1.9.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "files": [