@tedi-design-system/react 18.1.0-rc.15 → 18.1.0-rc.17

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 (73) hide show
  1. package/_virtual/index.cjs10.js +1 -1
  2. package/_virtual/index.cjs11.js +1 -1
  3. package/_virtual/index.cjs12.js +1 -1
  4. package/_virtual/index.cjs5.js +1 -1
  5. package/_virtual/index.cjs6.js +1 -1
  6. package/_virtual/index.cjs7.js +1 -1
  7. package/_virtual/index.cjs8.js +1 -1
  8. package/_virtual/index.cjs9.js +1 -1
  9. package/_virtual/index.es10.js +1 -1
  10. package/_virtual/index.es11.js +1 -1
  11. package/_virtual/index.es12.js +1 -1
  12. package/_virtual/index.es5.js +1 -1
  13. package/_virtual/index.es6.js +1 -1
  14. package/_virtual/index.es7.js +1 -1
  15. package/_virtual/index.es8.js +1 -1
  16. package/_virtual/index.es9.js +1 -1
  17. package/bundle-stats.html +1 -1
  18. package/external/@mui/system/colorManipulator.cjs.js +1 -1
  19. package/external/@mui/system/colorManipulator.es.js +2 -2
  20. package/external/@mui/system/createStyled.cjs.js +1 -1
  21. package/external/@mui/system/createStyled.es.js +6 -6
  22. package/external/@mui/system/useThemeWithoutDefault.cjs.js +1 -1
  23. package/external/@mui/system/useThemeWithoutDefault.es.js +1 -1
  24. package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.cjs.js +1 -1
  25. package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.es.js +1 -1
  26. package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
  27. package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.es.js +1 -1
  28. package/external/hoist-non-react-statics/external/react-is/index.cjs.js +1 -1
  29. package/external/hoist-non-react-statics/external/react-is/index.es.js +1 -1
  30. package/external/prop-types/external/react-is/cjs/react-is.development.cjs.js +1 -1
  31. package/external/prop-types/external/react-is/cjs/react-is.development.es.js +1 -1
  32. package/external/prop-types/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
  33. package/external/prop-types/external/react-is/cjs/react-is.production.min.es.js +1 -1
  34. package/external/prop-types/external/react-is/index.cjs.js +1 -1
  35. package/external/prop-types/external/react-is/index.es.js +1 -1
  36. package/index.css +1 -1
  37. package/package.json +1 -1
  38. package/src/community/components/anchor/anchor.d.ts +1 -0
  39. package/src/community/components/button/button.d.ts +1 -0
  40. package/src/community/components/card/card-content/card-content.d.ts +3 -0
  41. package/src/community/components/card/card-header/card-header.d.ts +3 -0
  42. package/src/community/components/card/card-notification/card-notification.d.ts +3 -0
  43. package/src/community/components/card/card.d.ts +3 -0
  44. package/src/community/components/dropdown/dropdown.d.ts +3 -0
  45. package/src/community/components/form/choice-group/choice-group.d.ts +3 -0
  46. package/src/community/components/form/file-upload/file-upload.d.ts +6 -0
  47. package/src/community/components/form/radio/radio.d.ts +3 -0
  48. package/src/community/components/form/select/select.d.ts +3 -0
  49. package/src/community/components/form/toggle/toggle.d.ts +3 -0
  50. package/src/community/components/layout/header/components/header-language/header-language.d.ts +3 -0
  51. package/src/community/components/layout/header/components/header-role/header-role.d.ts +3 -0
  52. package/src/community/components/layout/header/components/sidenav-toggle/sidenav-toggle.d.ts +3 -0
  53. package/src/community/components/layout/header/header/header.d.ts +3 -0
  54. package/src/community/components/layout/sidenav/sidenav.d.ts +3 -0
  55. package/src/community/components/status/status.d.ts +3 -0
  56. package/src/community/components/table/table.d.ts +3 -0
  57. package/src/community/components/tag/tag.d.ts +3 -0
  58. package/src/community/components/toggle-open/toggle-open.d.ts +3 -0
  59. package/src/community/components/tooltip/tooltip-trigger.d.ts +3 -0
  60. package/src/community/components/tooltip/tooltip.d.ts +3 -0
  61. package/src/tedi/components/form/file-upload/file-upload.cjs.js +1 -1
  62. package/src/tedi/components/form/file-upload/file-upload.d.ts +4 -1
  63. package/src/tedi/components/form/file-upload/file-upload.es.js +138 -119
  64. package/src/tedi/components/form/file-upload/file-upload.module.scss.cjs.js +1 -1
  65. package/src/tedi/components/form/file-upload/file-upload.module.scss.es.js +1 -1
  66. package/src/tedi/components/tags/tag/tag.cjs.js +1 -1
  67. package/src/tedi/components/tags/tag/tag.d.ts +9 -0
  68. package/src/tedi/components/tags/tag/tag.es.js +18 -17
  69. package/src/tedi/helpers/hooks/use-file-upload.cjs.js +1 -1
  70. package/src/tedi/helpers/hooks/use-file-upload.es.js +71 -66
  71. package/src/tedi/providers/label-provider/labels-map.cjs.js +1 -1
  72. package/src/tedi/providers/label-provider/labels-map.d.ts +14 -0
  73. package/src/tedi/providers/label-provider/labels-map.es.js +14 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tedi-design-system/react",
3
- "version": "18.1.0-rc.15",
3
+ "version": "18.1.0-rc.17",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "exports": {
@@ -18,6 +18,7 @@ export type AnchorComponent = <C extends React.ElementType = 'a'>(props: AnchorP
18
18
  * Inherits all props from the component passed into `as`. If `as` is omitted, then the default is native `<a>` tag
19
19
  *
20
20
  * To allow Customized Anchor usage as direct children of Header you need to add displayName to it. <a href="/docs/components-layout-header-header-overview--header-overview#settings">See more.</a>
21
+ * @deprecated Use `Link` from `@tedi-design-system/react/tedi` instead.
21
22
  */
22
23
  export declare const Anchor: AnchorComponent;
23
24
  export default Anchor;
@@ -19,6 +19,7 @@ export type ButtonProps<C extends React.ElementType = 'button'> = ButtonContentP
19
19
  export type ButtonComponent = <C extends React.ElementType = 'button'>(props: ButtonProps<C>) => React.ReactElement | null;
20
20
  /**
21
21
  * Renders a `<button>` tag and has all of its props plus our own defined props. For more info about usage of buttons see [Button](/docs/documentation-buttons-buttons--buttons) & [ButtonGroups](/docs/documentation-buttons-buttongroups--buttongroups) documentation.
22
+ * @deprecated Use `Button` from `@tedi-design-system/react/tedi` instead.
22
23
  */
23
24
  export declare const Button: ButtonComponent;
24
25
  export default Button;
@@ -37,6 +37,9 @@ export interface CardContentProps extends BreakpointSupport<CardContentBreakpoin
37
37
  */
38
38
  children?: React.ReactNode;
39
39
  }
40
+ /**
41
+ * @deprecated Use `CardContent` from `@tedi-design-system/react/tedi` instead.
42
+ */
40
43
  export declare const CardContent: {
41
44
  (props: CardContentProps): JSX.Element;
42
45
  displayName: string;
@@ -38,6 +38,9 @@ export type CardHeaderProps = BreakpointSupport<CardHeaderBreakpointProps> & {
38
38
  export interface CardHeaderAsButton extends Partial<React.ButtonHTMLAttributes<HTMLButtonElement>> {
39
39
  role: 'button';
40
40
  }
41
+ /**
42
+ * @deprecated Use `CardHeader` from `@tedi-design-system/react/tedi` instead.
43
+ */
41
44
  export declare const CardHeader: {
42
45
  (props: CardHeaderProps): JSX.Element;
43
46
  displayName: string;
@@ -1,5 +1,8 @@
1
1
  import { AlertProps } from '../../../../tedi/components/notifications/alert/alert';
2
2
  import { CardContentProps } from '../card-content/card-content';
3
3
  export type CardNotificationProps = AlertProps & Pick<CardContentProps, 'padding'>;
4
+ /**
5
+ * @deprecated Use `CardNotification` from `@tedi-design-system/react/tedi` instead.
6
+ */
4
7
  export declare const CardNotification: (props: CardNotificationProps) => JSX.Element;
5
8
  export default CardNotification;
@@ -36,5 +36,8 @@ export interface CardProps extends BreakpointSupport<CardBreakpointProps> {
36
36
  */
37
37
  children?: React.ReactElement<CardContentProps | CardHeaderProps> | React.ReactElement<CardContentProps | CardHeaderProps>[] | React.ReactNode;
38
38
  }
39
+ /**
40
+ * @deprecated Use `Card` from `@tedi-design-system/react/tedi` instead.
41
+ */
39
42
  export declare const Card: React.ForwardRefExoticComponent<CardProps & React.RefAttributes<HTMLDivElement>>;
40
43
  export default Card;
@@ -42,5 +42,8 @@ export type DropdownProps = {
42
42
  */
43
43
  focusManager?: Omit<React.ComponentProps<typeof FloatingFocusManager>, 'context' | 'children'>;
44
44
  };
45
+ /**
46
+ * @deprecated Use `Dropdown` from `@tedi-design-system/react/tedi` instead.
47
+ */
45
48
  export declare const Dropdown: (props: DropdownProps) => import("react/jsx-runtime").JSX.Element;
46
49
  export default Dropdown;
@@ -78,5 +78,8 @@ export interface ChoiceGroupProps extends FormLabelProps {
78
78
  indented?: boolean;
79
79
  } & Partial<Omit<CheckProps, 'indeterminate' | 'checked' | 'onChange' | 'defaultChecked' | 'label'>>;
80
80
  }
81
+ /**
82
+ * @deprecated Use `ChoiceGroup` from `@tedi-design-system/react/tedi` instead.
83
+ */
81
84
  export declare const ChoiceGroup: (props: ChoiceGroupProps) => React.ReactElement;
82
85
  export default ChoiceGroup;
@@ -12,6 +12,9 @@ export interface RejectedFile {
12
12
  type: FileRejectionType;
13
13
  file: File;
14
14
  }
15
+ /**
16
+ * @deprecated Use FileUpload from `@tedi-design-system/react/tedi` instead.
17
+ */
15
18
  export interface FileUploadProps extends FormLabelProps {
16
19
  /**
17
20
  * Additional classes.
@@ -65,5 +68,8 @@ export interface FileUploadProps extends FormLabelProps {
65
68
  */
66
69
  maxSize?: number;
67
70
  }
71
+ /**
72
+ * @deprecated Use `FileUpload` from `@tedi-design-system/react/tedi` instead.
73
+ */
68
74
  export declare const FileUpload: (props: FileUploadProps) => JSX.Element;
69
75
  export default FileUpload;
@@ -1,4 +1,7 @@
1
1
  import { ChoiceInputProps } from '../choice-input.types';
2
2
  export type RadioProps = ChoiceInputProps;
3
+ /**
4
+ * @deprecated Use `Radio` from `@tedi-design-system/react/tedi` instead.
5
+ */
3
6
  export declare const Radio: (props: RadioProps) => JSX.Element;
4
7
  export default Radio;
@@ -233,5 +233,8 @@ export interface IGroupedOptions<CustomOption = unknown> extends GroupBase<Custo
233
233
  backgroundColor?: TColorsBackground;
234
234
  }
235
235
  export type TSelectValue<CustomData = unknown> = ISelectOption<CustomData> | ReadonlyArray<ISelectOption<CustomData>> | null;
236
+ /**
237
+ * @deprecated Use `Select` from `@tedi-design-system/react/tedi` instead.
238
+ */
236
239
  export declare const Select: React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<SelectInstance<ISelectOption<unknown>, boolean, IGroupedOptions<ISelectOption<unknown>>>>>;
237
240
  export default Select;
@@ -62,5 +62,8 @@ export interface ToggleProps {
62
62
  */
63
63
  isLoading?: boolean;
64
64
  }
65
+ /**
66
+ * @deprecated Use `Toggle` from `@tedi-design-system/react/tedi` instead.
67
+ */
65
68
  export declare const Toggle: React.ForwardRefExoticComponent<ToggleProps & React.RefAttributes<HTMLButtonElement>>;
66
69
  export default Toggle;
@@ -13,5 +13,8 @@ export interface HeaderLanguageProps {
13
13
  */
14
14
  languages?: Language[];
15
15
  }
16
+ /**
17
+ * @deprecated Use `HeaderLanguage` from `@tedi-design-system/react/tedi` instead.
18
+ */
16
19
  export declare const HeaderLanguage: React.FC<HeaderLanguageProps>;
17
20
  export default HeaderLanguage;
@@ -25,5 +25,8 @@ export interface HeaderRoleProps {
25
25
  */
26
26
  renderModal?: boolean;
27
27
  }
28
+ /**
29
+ * @deprecated Use `HeaderRole` from `@tedi-design-system/react/tedi` instead.
30
+ */
28
31
  export declare const HeaderRole: React.FC<HeaderRoleProps>;
29
32
  export default HeaderRole;
@@ -1,2 +1,5 @@
1
+ /**
2
+ * @deprecated Use `SidenavToggle` from `@tedi-design-system/react/tedi` instead.
3
+ */
1
4
  export declare const SidenavToggle: () => import("react/jsx-runtime").JSX.Element | null;
2
5
  export default SidenavToggle;
@@ -49,5 +49,8 @@ export interface HeaderProps<H extends React.ElementType> {
49
49
  */
50
50
  notification?: HeaderNotificationProps;
51
51
  }
52
+ /**
53
+ * @deprecated Use `Header` from `@tedi-design-system/react/tedi` instead.
54
+ */
52
55
  export declare const Header: <H extends React.ElementType = "a">(props: HeaderProps<H>) => import("react/jsx-runtime").JSX.Element;
53
56
  export default Header;
@@ -62,5 +62,8 @@ export type SideNavItem<C extends React.ElementType = 'a'> = AnchorProps<C> & {
62
62
  */
63
63
  subItems?: SideNavItem<C>[];
64
64
  };
65
+ /**
66
+ * @deprecated Use `SideNav` from `@tedi-design-system/react/tedi` instead.
67
+ */
65
68
  export declare const SideNav: <C extends React.ElementType = "a">(props: SideNavProps<C>) => import("react/jsx-runtime").JSX.Element | null;
66
69
  export default SideNav;
@@ -16,5 +16,8 @@ export interface StatusProps {
16
16
  */
17
17
  tooltipContent?: React.ReactNode;
18
18
  }
19
+ /**
20
+ * @deprecated Use `StatusIndicator` from `@tedi-design-system/react/tedi` instead.
21
+ */
19
22
  export declare const Status: (props: StatusProps) => JSX.Element;
20
23
  export default Status;
@@ -1,4 +1,7 @@
1
1
  import { DefaultTData, TableProps } from './table.types';
2
2
  export declare const PAGE_SIZE_WITHOUT_PAGINATION = 10000;
3
+ /**
4
+ * @deprecated Use `Table` from `@tedi-design-system/react/tedi` instead.
5
+ */
3
6
  export declare function Table<TData extends DefaultTData<TData>>(props: TableProps<TData>): JSX.Element;
4
7
  export default Table;
@@ -65,5 +65,8 @@ export interface TagProps {
65
65
  */
66
66
  id?: string;
67
67
  }
68
+ /**
69
+ * @deprecated Use `Tag` from `@tedi-design-system/react/tedi` instead.
70
+ */
68
71
  export declare const Tag: React.ForwardRefExoticComponent<TagProps & React.RefAttributes<HTMLDivElement>>;
69
72
  export default Tag;
@@ -19,5 +19,8 @@ export interface ToggleOpenProps extends Omit<ButtonProps, 'children' | 'iconRig
19
19
  */
20
20
  iconRight?: Partial<IconProps>;
21
21
  }
22
+ /**
23
+ * @deprecated Use `CollapseButton` from `@tedi-design-system/react/tedi` instead.
24
+ */
22
25
  export declare const ToggleOpen: ({ openText, closeText, isOpen, iconRight, ...rest }: ToggleOpenProps) => JSX.Element;
23
26
  export default ToggleOpen;
@@ -4,5 +4,8 @@ export interface TooltipTriggerProps {
4
4
  */
5
5
  children: JSX.Element;
6
6
  }
7
+ /**
8
+ * @deprecated Use `TooltipTrigger` from `@tedi-design-system/react/tedi` instead.
9
+ */
7
10
  export declare const TooltipTrigger: (props: TooltipTriggerProps) => JSX.Element;
8
11
  export default TooltipTrigger;
@@ -21,5 +21,8 @@ export interface TooltipProps {
21
21
  */
22
22
  maxWidth?: 'none' | 'small' | 'medium' | 'large';
23
23
  }
24
+ /**
25
+ * @deprecated Use `Tooltip` from `@tedi-design-system/react/tedi` instead.
26
+ */
24
27
  export declare const Tooltip: (props: TooltipProps) => JSX.Element | null;
25
28
  export default Tooltip;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),f=require("../../../../../external/classnames/index.cjs.js"),h=require("react"),Y=require("../../../helpers/hooks/use-file-upload.cjs.js"),Z=require("../../base/typography/text/text.cjs.js"),k=require("../../buttons/button/button.cjs.js"),H=require("../../buttons/closing-button/closing-button.cjs.js"),G=require("../form-label/form-label.cjs.js"),ee=require("../../misc/separator/separator.cjs.js"),le=require("../../tags/tag/tag.cjs.js"),B=require("../feedback-text/feedback-text.cjs.js"),g=require("../input-group/input-group.cjs.js"),a=require("./file-upload.module.scss.cjs.js"),ae=require("../../../providers/label-provider/use-labels.cjs.js"),T=require("../../../helpers/hooks/use-breakpoint.cjs.js"),ie=require("../../layout/grid/row.cjs.js"),I=require("../../layout/grid/col.cjs.js"),te=j=>{var N;const{getLabel:n}=ae.useLabels(),{id:se,name:w,label:_,accept:v,multiple:q,onChange:m,className:R,wrapperClassName:U,defaultFiles:S,onDelete:z,hasClearButton:M=!0,files:u,readOnly:p,disabled:s=!1,maxSize:O,validateIndividually:V=!1,size:c="default",helper:i,...$}=j,{innerFiles:y,uploadErrorHelper:t,onFileChange:D,onFileRemove:P,handleClear:F,announcement:W}=Y.useFileUpload({accept:v,maxSize:O,multiple:q,validateIndividually:V,defaultFiles:S,onChange:m,onDelete:z,files:u}),A=T.default(),E=h.useId(),d=(N=g.useOptionalInputGroup)==null?void 0:N.call(g),J=d==null?void 0:d.hasExternalLabel,x=j.id??(d==null?void 0:d.inputId)??E,L=h.useRef(null),K=f.default(a.default["tedi-file-upload"],{[a.default["tedi-file-upload--disabled"]]:s},R),b=(i==null?void 0:i.id)??(i||t?`${x}-helper`:void 0),o=h.useMemo(()=>u&&m?u:y,[u,y,m]),Q=(l,r)=>{const X=l.isValid===!1?`${l.name} (${n("file-upload.failed")})`:l.name;return e.jsx("li",{children:e.jsx(le.Tag,{color:l.isValid===!1?"danger":"primary",onClose:!l.isLoading&&!s&&!p?()=>P(l):void 0,isLoading:l.isLoading,"aria-label":X,children:l.name})},r)},C=()=>{if(o.length>1)return e.jsx("ul",{className:f.default(a.default["tedi-file-upload__items"],a.default["tedi-file-upload__truncate-list"]),children:o.map((l,r)=>Q(l,r))});if(o.length===1){const l=o[0],r=l.isValid===!1?`${l.name} (${n("file-upload.failed")})`:l.name;return e.jsx(Z.Text,{"aria-label":r,className:f.default(a.default["tedi-file-upload__items"],a.default["tedi-file-upload__truncate"]),children:l.name})}return null};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:a.default["tedi-file-upload__label-wrapper"],children:!J&&_&&e.jsx(G.FormLabel,{id:x,label:_??"",...$,renderWithoutLabel:p,className:a.default["tedi-file-upload__label"],size:c})}),e.jsx("div",{"aria-live":"polite","aria-atomic":"true",className:"sr-only",children:W}),p?C():e.jsx("div",{className:f.default(a.default["tedi-file-upload__container"],{[a.default["tedi-file-upload--disabled"]]:s,[a.default["tedi-file-upload--error"]]:((t==null?void 0:t.type)||(i==null?void 0:i.type))==="error",[a.default["tedi-file-upload--valid"]]:((t==null?void 0:t.type)||(i==null?void 0:i.type))==="valid"},{[a.default[`tedi-file-upload__container--${c}`]]:c},U),children:e.jsx("div",{className:a.default["tedi-file-upload__content"],children:e.jsxs(ie.Row,{children:[e.jsx(I.Col,{className:"display-flex",children:C()}),e.jsx(I.Col,{xs:12,md:"auto",children:e.jsxs("div",{className:K,children:[e.jsx("input",{ref:L,id:x,type:"file",name:w,accept:v,onChange:D,multiple:q,disabled:s,"aria-invalid":!!t&&t.type==="error","aria-describedby":b}),M&&o.length>0&&!s&&e.jsxs(e.Fragment,{children:[T.isBreakpointBelow(A,"md")?e.jsx(k.Button,{visualType:"neutral",iconLeft:"close",disabled:s,onClick:F,className:a.default["tedi-file-upload__button"],children:n("clear")}):e.jsx(H.ClosingButton,{onClick:F,iconSize:18,title:n("clear")}),e.jsx(ee.Separator,{axis:"vertical",height:1.5,spacing:.5,color:"primary"})]}),e.jsx(k.Button,{visualType:"neutral",iconLeft:"file_upload",disabled:s,onClick:()=>{var l;return(l=L.current)==null?void 0:l.click()},className:a.default["tedi-file-upload__button"],size:c,children:n("file-upload.add")})]})})]})})}),i?e.jsx(B.FeedbackText,{...i,id:b}):t?e.jsx(B.FeedbackText,{...t,id:b}):null]})};exports.FileUpload=te;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),j=require("../../../../../external/classnames/index.cjs.js"),p=require("react"),de=require("../../../helpers/hooks/use-file-upload.cjs.js"),oe=require("../../base/typography/text/text.cjs.js"),S=require("../../buttons/button/button.cjs.js"),re=require("../../buttons/closing-button/closing-button.cjs.js"),ce=require("../form-label/form-label.cjs.js"),ue=require("../../misc/separator/separator.cjs.js"),fe=require("../../tags/tag/tag.cjs.js"),z=require("../feedback-text/feedback-text.cjs.js"),g=require("../input-group/input-group.cjs.js"),a=require("./file-upload.module.scss.cjs.js"),pe=require("../../../providers/label-provider/use-labels.cjs.js"),M=require("../../../helpers/hooks/use-breakpoint.cjs.js"),me=require("../../layout/grid/row.cjs.js"),O=require("../../layout/grid/col.cjs.js"),A=P=>{var U;const{getLabel:n}=pe.useLabels(),{id:V,name:$,label:v,accept:y,multiple:F,onChange:m,className:D,wrapperClassName:W,defaultFiles:H,onDelete:J,hasClearButton:K=!0,files:c,readOnly:x,disabled:s=!1,maxSize:Q,validateIndividually:X=!1,size:u="default",helper:i,...Y}=P,{innerFiles:_,uploadErrorHelper:t,onFileChange:Z,onFileRemove:E,handleClear:G,announcement:ee}=de.useFileUpload({accept:y,maxSize:Q,multiple:F,validateIndividually:X,defaultFiles:H,onChange:m,onDelete:J,files:c}),le=M.default(),ae=p.useId(),d=(U=g.useOptionalInputGroup)==null?void 0:U.call(g),te=d==null?void 0:d.hasExternalLabel,f=V??(d==null?void 0:d.inputId)??ae,q=p.useRef(null),N=p.useRef(null),ie=j.default(a.default["tedi-file-upload"],{[a.default["tedi-file-upload--disabled"]]:s},D),B=(t==null?void 0:t.type)==="error",h=i??(B?void 0:t),b=B?t:void 0,C=h?(i==null?void 0:i.id)??`${f}-helper`:void 0,L=b?`${f}-error`:void 0,k=[C,L].filter(Boolean).join(" ")||void 0,o=p.useMemo(()=>c&&m?c:_,[c,_,m]),R=()=>{var l;return(l=N.current)==null?void 0:l.focus()},se=l=>{E(l),R()},I=()=>{G(),R()},ne=(l,r)=>{const w=l.isValid===!1;return e.jsx("li",{children:e.jsxs(fe.Tag,{role:"presentation",color:w?"danger":"primary",onClose:!l.isLoading&&!s&&!x?()=>se(l):void 0,isLoading:l.isLoading,closeButtonProps:{title:`${n("remove")} ${l.name}`},children:[l.name,w&&e.jsxs("span",{className:"sr-only",children:[" (",n("file-upload.failed"),")"]})]})},l.id??r)},T=()=>{if(o.length>1)return e.jsx("ul",{className:a.default["tedi-file-upload__items"],children:o.map((l,r)=>ne(l,r))});if(o.length===1){const l=o[0],r=l.isValid===!1;return e.jsxs(oe.Text,{className:j.default(a.default["tedi-file-upload__items"],a.default["tedi-file-upload__items--truncate"]),children:[l.name,r&&e.jsxs("span",{className:"sr-only",children:[" (",n("file-upload.failed"),")"]})]})}return null};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:a.default["tedi-file-upload__label-wrapper"],children:!te&&v&&e.jsx(ce.FormLabel,{id:f,label:v??"",...Y,renderWithoutLabel:x,className:a.default["tedi-file-upload__label"],size:u})}),e.jsx("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:ee}),x?T():e.jsx("div",{className:j.default(a.default["tedi-file-upload__container"],{[a.default["tedi-file-upload--disabled"]]:s,[a.default["tedi-file-upload--error"]]:((t==null?void 0:t.type)||(i==null?void 0:i.type))==="error",[a.default["tedi-file-upload--valid"]]:((t==null?void 0:t.type)||(i==null?void 0:i.type))==="valid"},{[a.default[`tedi-file-upload__container--${u}`]]:u},W),children:e.jsx("div",{className:a.default["tedi-file-upload__content"],children:e.jsxs(me.Row,{children:[e.jsx(O.Col,{className:"display-flex",children:T()}),e.jsx(O.Col,{xs:12,md:"auto",children:e.jsxs("div",{className:ie,children:[e.jsx("input",{ref:q,id:f,type:"file",name:$,accept:y,onChange:Z,multiple:F,disabled:s,"aria-invalid":!!t&&t.type==="error","aria-describedby":k}),K&&o.length>0&&!s&&e.jsxs(e.Fragment,{children:[M.isBreakpointBelow(le,"md")?e.jsx(S.Button,{visualType:"neutral",iconLeft:"close",disabled:s,onClick:I,className:a.default["tedi-file-upload__button"],children:n("clear")}):e.jsx(re.ClosingButton,{onClick:I,iconSize:18,title:n("clear")}),e.jsx(ue.Separator,{axis:"vertical",height:1.5,spacing:.5,color:"primary"})]}),e.jsx(S.Button,{ref:N,visualType:"neutral",iconLeft:"file_upload",disabled:s,onClick:()=>{var l;return(l=q.current)==null?void 0:l.click()},className:a.default["tedi-file-upload__button"],size:u,"aria-describedby":k,children:n("file-upload.add")})]})})]})})}),h&&e.jsx(z.FeedbackText,{...h,id:C}),b&&e.jsx(z.FeedbackText,{...b,id:L})]})};A.displayName="FileUpload";exports.FileUpload=A;
@@ -84,5 +84,8 @@ export interface FileUploadProps extends Omit<FormLabelProps, 'id' | 'label'> {
84
84
  */
85
85
  size?: 'small' | 'default';
86
86
  }
87
- export declare const FileUpload: (props: FileUploadProps) => JSX.Element;
87
+ export declare const FileUpload: {
88
+ (props: FileUploadProps): JSX.Element;
89
+ displayName: string;
90
+ };
88
91
  export default FileUpload;
@@ -1,159 +1,178 @@
1
- import { jsxs as u, Fragment as I, jsx as l } from "react/jsx-runtime";
2
- import p from "../../../../../external/classnames/index.es.js";
3
- import g from "react";
4
- import { useFileUpload as Y } from "../../../helpers/hooks/use-file-upload.es.js";
5
- import { Text as Z } from "../../base/typography/text/text.es.js";
6
- import { Button as $ } from "../../buttons/button/button.es.js";
7
- import { ClosingButton as G } from "../../buttons/closing-button/closing-button.es.js";
8
- import { FormLabel as H } from "../form-label/form-label.es.js";
9
- import { Separator as ee } from "../../misc/separator/separator.es.js";
10
- import { Tag as le } from "../../tags/tag/tag.es.js";
11
- import { FeedbackText as w } from "../feedback-text/feedback-text.es.js";
12
- import { useOptionalInputGroup as ie } from "../input-group/input-group.es.js";
13
- import i from "./file-upload.module.scss.es.js";
14
- import { useLabels as ae } from "../../../providers/label-provider/use-labels.es.js";
15
- import te, { isBreakpointBelow as oe } from "../../../helpers/hooks/use-breakpoint.es.js";
16
- import { Row as ne } from "../../layout/grid/row.es.js";
17
- import { Col as R } from "../../layout/grid/col.es.js";
18
- const xe = (v) => {
19
- var B;
20
- const { getLabel: d } = ae(), {
21
- id: de,
22
- name: T,
23
- label: y,
24
- accept: N,
25
- multiple: F,
26
- onChange: f,
27
- className: z,
28
- wrapperClassName: S,
29
- defaultFiles: U,
30
- onDelete: V,
31
- hasClearButton: j = !0,
32
- files: c,
33
- readOnly: h,
34
- disabled: o = !1,
35
- maxSize: M,
36
- validateIndividually: O = !1,
37
- size: m = "default",
38
- helper: a,
39
- ...D
40
- } = v, { innerFiles: L, uploadErrorHelper: t, onFileChange: W, onFileRemove: q, handleClear: C, announcement: A } = Y({
41
- accept: N,
42
- maxSize: M,
43
- multiple: F,
44
- validateIndividually: O,
45
- defaultFiles: U,
46
- onChange: f,
47
- onDelete: V,
48
- files: c
49
- }), E = te(), J = g.useId(), n = (B = ie) == null ? void 0 : B(), K = n == null ? void 0 : n.hasExternalLabel, _ = v.id ?? (n == null ? void 0 : n.inputId) ?? J, x = g.useRef(null), P = p(i["tedi-file-upload"], { [i["tedi-file-upload--disabled"]]: o }, z), b = (a == null ? void 0 : a.id) ?? (a || t ? `${_}-helper` : void 0), r = g.useMemo(() => c && f ? c : L, [c, L, f]), Q = (e, s) => {
50
- const X = e.isValid === !1 ? `${e.name} (${d("file-upload.failed")})` : e.name;
51
- return /* @__PURE__ */ l("li", { children: /* @__PURE__ */ l(
52
- le,
1
+ import { jsxs as t, Fragment as z, jsx as i } from "react/jsx-runtime";
2
+ import y from "../../../../../external/classnames/index.es.js";
3
+ import f from "react";
4
+ import { useFileUpload as ne } from "../../../helpers/hooks/use-file-upload.es.js";
5
+ import { Text as se } from "../../base/typography/text/text.es.js";
6
+ import { Button as S } from "../../buttons/button/button.es.js";
7
+ import { ClosingButton as re } from "../../buttons/closing-button/closing-button.es.js";
8
+ import { FormLabel as de } from "../form-label/form-label.es.js";
9
+ import { Separator as ce } from "../../misc/separator/separator.es.js";
10
+ import { Tag as me } from "../../tags/tag/tag.es.js";
11
+ import { FeedbackText as A } from "../feedback-text/feedback-text.es.js";
12
+ import { useOptionalInputGroup as pe } from "../input-group/input-group.es.js";
13
+ import l from "./file-upload.module.scss.es.js";
14
+ import { useLabels as ue } from "../../../providers/label-provider/use-labels.es.js";
15
+ import fe, { isBreakpointBelow as he } from "../../../helpers/hooks/use-breakpoint.es.js";
16
+ import { Row as ve } from "../../layout/grid/row.es.js";
17
+ import { Col as M } from "../../layout/grid/col.es.js";
18
+ const be = (O) => {
19
+ var $;
20
+ const { getLabel: s } = ue(), {
21
+ id: V,
22
+ name: D,
23
+ label: g,
24
+ accept: F,
25
+ multiple: N,
26
+ onChange: h,
27
+ className: P,
28
+ wrapperClassName: W,
29
+ defaultFiles: q,
30
+ onDelete: H,
31
+ hasClearButton: J = !0,
32
+ files: m,
33
+ readOnly: v,
34
+ disabled: n = !1,
35
+ maxSize: K,
36
+ validateIndividually: Q = !1,
37
+ size: p = "default",
38
+ helper: o,
39
+ ...X
40
+ } = O, { innerFiles: B, uploadErrorHelper: a, onFileChange: Y, onFileRemove: Z, handleClear: E, announcement: G } = ne({
41
+ accept: F,
42
+ maxSize: K,
43
+ multiple: N,
44
+ validateIndividually: Q,
45
+ defaultFiles: q,
46
+ onChange: h,
47
+ onDelete: H,
48
+ files: m
49
+ }), ee = fe(), ie = f.useId(), r = ($ = pe) == null ? void 0 : $(), le = r == null ? void 0 : r.hasExternalLabel, u = V ?? (r == null ? void 0 : r.inputId) ?? ie, C = f.useRef(null), L = f.useRef(null), ae = y(l["tedi-file-upload"], { [l["tedi-file-upload--disabled"]]: n }, P), x = (a == null ? void 0 : a.type) === "error", b = o ?? (x ? void 0 : a), _ = x ? a : void 0, k = b ? (o == null ? void 0 : o.id) ?? `${u}-helper` : void 0, I = _ ? `${u}-error` : void 0, R = [k, I].filter(Boolean).join(" ") || void 0, d = f.useMemo(() => m && h ? m : B, [m, B, h]), w = () => {
50
+ var e;
51
+ return (e = L.current) == null ? void 0 : e.focus();
52
+ }, oe = (e) => {
53
+ Z(e), w();
54
+ }, T = () => {
55
+ E(), w();
56
+ }, te = (e, c) => {
57
+ const j = e.isValid === !1;
58
+ return /* @__PURE__ */ i("li", { children: /* @__PURE__ */ t(
59
+ me,
53
60
  {
54
- color: e.isValid === !1 ? "danger" : "primary",
55
- onClose: !e.isLoading && !o && !h ? () => q(e) : void 0,
61
+ role: "presentation",
62
+ color: j ? "danger" : "primary",
63
+ onClose: !e.isLoading && !n && !v ? () => oe(e) : void 0,
56
64
  isLoading: e.isLoading,
57
- "aria-label": X,
58
- children: e.name
65
+ closeButtonProps: { title: `${s("remove")} ${e.name}` },
66
+ children: [
67
+ e.name,
68
+ j && /* @__PURE__ */ t("span", { className: "sr-only", children: [
69
+ " (",
70
+ s("file-upload.failed"),
71
+ ")"
72
+ ] })
73
+ ]
59
74
  }
60
- ) }, s);
61
- }, k = () => {
62
- if (r.length > 1)
63
- return /* @__PURE__ */ l("ul", { className: p(i["tedi-file-upload__items"], i["tedi-file-upload__truncate-list"]), children: r.map((e, s) => Q(e, s)) });
64
- if (r.length === 1) {
65
- const e = r[0], s = e.isValid === !1 ? `${e.name} (${d("file-upload.failed")})` : e.name;
66
- return /* @__PURE__ */ l(
67
- Z,
68
- {
69
- "aria-label": s,
70
- className: p(i["tedi-file-upload__items"], i["tedi-file-upload__truncate"]),
71
- children: e.name
72
- }
73
- );
75
+ ) }, e.id ?? c);
76
+ }, U = () => {
77
+ if (d.length > 1)
78
+ return /* @__PURE__ */ i("ul", { className: l["tedi-file-upload__items"], children: d.map((e, c) => te(e, c)) });
79
+ if (d.length === 1) {
80
+ const e = d[0], c = e.isValid === !1;
81
+ return /* @__PURE__ */ t(se, { className: y(l["tedi-file-upload__items"], l["tedi-file-upload__items--truncate"]), children: [
82
+ e.name,
83
+ c && /* @__PURE__ */ t("span", { className: "sr-only", children: [
84
+ " (",
85
+ s("file-upload.failed"),
86
+ ")"
87
+ ] })
88
+ ] });
74
89
  }
75
90
  return null;
76
91
  };
77
- return /* @__PURE__ */ u(I, { children: [
78
- /* @__PURE__ */ l("div", { className: i["tedi-file-upload__label-wrapper"], children: !K && y && /* @__PURE__ */ l(
79
- H,
92
+ return /* @__PURE__ */ t(z, { children: [
93
+ /* @__PURE__ */ i("div", { className: l["tedi-file-upload__label-wrapper"], children: !le && g && /* @__PURE__ */ i(
94
+ de,
80
95
  {
81
- id: _,
82
- label: y ?? "",
83
- ...D,
84
- renderWithoutLabel: h,
85
- className: i["tedi-file-upload__label"],
86
- size: m
96
+ id: u,
97
+ label: g ?? "",
98
+ ...X,
99
+ renderWithoutLabel: v,
100
+ className: l["tedi-file-upload__label"],
101
+ size: p
87
102
  }
88
103
  ) }),
89
- /* @__PURE__ */ l("div", { "aria-live": "polite", "aria-atomic": "true", className: "sr-only", children: A }),
90
- h ? k() : /* @__PURE__ */ l(
104
+ /* @__PURE__ */ i("div", { role: "status", "aria-live": "polite", "aria-atomic": "true", className: "sr-only", children: G }),
105
+ v ? U() : /* @__PURE__ */ i(
91
106
  "div",
92
107
  {
93
- className: p(
94
- i["tedi-file-upload__container"],
108
+ className: y(
109
+ l["tedi-file-upload__container"],
95
110
  {
96
- [i["tedi-file-upload--disabled"]]: o,
97
- [i["tedi-file-upload--error"]]: ((t == null ? void 0 : t.type) || (a == null ? void 0 : a.type)) === "error",
98
- [i["tedi-file-upload--valid"]]: ((t == null ? void 0 : t.type) || (a == null ? void 0 : a.type)) === "valid"
111
+ [l["tedi-file-upload--disabled"]]: n,
112
+ [l["tedi-file-upload--error"]]: ((a == null ? void 0 : a.type) || (o == null ? void 0 : o.type)) === "error",
113
+ [l["tedi-file-upload--valid"]]: ((a == null ? void 0 : a.type) || (o == null ? void 0 : o.type)) === "valid"
99
114
  },
100
- { [i[`tedi-file-upload__container--${m}`]]: m },
101
- S
115
+ { [l[`tedi-file-upload__container--${p}`]]: p },
116
+ W
102
117
  ),
103
- children: /* @__PURE__ */ l("div", { className: i["tedi-file-upload__content"], children: /* @__PURE__ */ u(ne, { children: [
104
- /* @__PURE__ */ l(R, { className: "display-flex", children: k() }),
105
- /* @__PURE__ */ l(R, { xs: 12, md: "auto", children: /* @__PURE__ */ u("div", { className: P, children: [
106
- /* @__PURE__ */ l(
118
+ children: /* @__PURE__ */ i("div", { className: l["tedi-file-upload__content"], children: /* @__PURE__ */ t(ve, { children: [
119
+ /* @__PURE__ */ i(M, { className: "display-flex", children: U() }),
120
+ /* @__PURE__ */ i(M, { xs: 12, md: "auto", children: /* @__PURE__ */ t("div", { className: ae, children: [
121
+ /* @__PURE__ */ i(
107
122
  "input",
108
123
  {
109
- ref: x,
110
- id: _,
124
+ ref: C,
125
+ id: u,
111
126
  type: "file",
112
- name: T,
113
- accept: N,
114
- onChange: W,
115
- multiple: F,
116
- disabled: o,
117
- "aria-invalid": !!t && t.type === "error",
118
- "aria-describedby": b
127
+ name: D,
128
+ accept: F,
129
+ onChange: Y,
130
+ multiple: N,
131
+ disabled: n,
132
+ "aria-invalid": !!a && a.type === "error",
133
+ "aria-describedby": R
119
134
  }
120
135
  ),
121
- j && r.length > 0 && !o && /* @__PURE__ */ u(I, { children: [
122
- oe(E, "md") ? /* @__PURE__ */ l(
123
- $,
136
+ J && d.length > 0 && !n && /* @__PURE__ */ t(z, { children: [
137
+ he(ee, "md") ? /* @__PURE__ */ i(
138
+ S,
124
139
  {
125
140
  visualType: "neutral",
126
141
  iconLeft: "close",
127
- disabled: o,
128
- onClick: C,
129
- className: i["tedi-file-upload__button"],
130
- children: d("clear")
142
+ disabled: n,
143
+ onClick: T,
144
+ className: l["tedi-file-upload__button"],
145
+ children: s("clear")
131
146
  }
132
- ) : /* @__PURE__ */ l(G, { onClick: C, iconSize: 18, title: d("clear") }),
133
- /* @__PURE__ */ l(ee, { axis: "vertical", height: 1.5, spacing: 0.5, color: "primary" })
147
+ ) : /* @__PURE__ */ i(re, { onClick: T, iconSize: 18, title: s("clear") }),
148
+ /* @__PURE__ */ i(ce, { axis: "vertical", height: 1.5, spacing: 0.5, color: "primary" })
134
149
  ] }),
135
- /* @__PURE__ */ l(
136
- $,
150
+ /* @__PURE__ */ i(
151
+ S,
137
152
  {
153
+ ref: L,
138
154
  visualType: "neutral",
139
155
  iconLeft: "file_upload",
140
- disabled: o,
156
+ disabled: n,
141
157
  onClick: () => {
142
158
  var e;
143
- return (e = x.current) == null ? void 0 : e.click();
159
+ return (e = C.current) == null ? void 0 : e.click();
144
160
  },
145
- className: i["tedi-file-upload__button"],
146
- size: m,
147
- children: d("file-upload.add")
161
+ className: l["tedi-file-upload__button"],
162
+ size: p,
163
+ "aria-describedby": R,
164
+ children: s("file-upload.add")
148
165
  }
149
166
  )
150
167
  ] }) })
151
168
  ] }) })
152
169
  }
153
170
  ),
154
- a ? /* @__PURE__ */ l(w, { ...a, id: b }) : t ? /* @__PURE__ */ l(w, { ...t, id: b }) : null
171
+ b && /* @__PURE__ */ i(A, { ...b, id: k }),
172
+ _ && /* @__PURE__ */ i(A, { ..._, id: I })
155
173
  ] });
156
174
  };
175
+ be.displayName = "FileUpload";
157
176
  export {
158
- xe as FileUpload
177
+ be as FileUpload
159
178
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-file-upload":"tedi-file-upload-115f37c2","tedi-file-upload__items":"tedi-file-upload__items-c73c19e5","tedi-file-upload__container":"tedi-file-upload__container-6b0f28a8","tedi-file-upload__container--default":"tedi-file-upload__container--default-56af0d96","tedi-file-upload__button":"tedi-file-upload__button-f37449e6","tedi-file-upload__container--small":"tedi-file-upload__container--small-4d5cd36e","tedi-file-upload--disabled":"tedi-file-upload--disabled-88f4fdcd","tedi-file-upload--error":"tedi-file-upload--error-388cda6f","tedi-file-upload--valid":"tedi-file-upload--valid-28d5eb71","tedi-file-upload__content":"tedi-file-upload__content-8b6bf324","tedi-file-upload__items--truncate":"tedi-file-upload__items--truncate-5c249a01","tedi-file-upload__tag--truncate":"tedi-file-upload__tag--truncate-4c99cb2b"};exports.default=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-file-upload":"tedi-file-upload-115f37c2","tedi-file-upload__button":"tedi-file-upload__button-f37449e6","tedi-file-upload__items":"tedi-file-upload__items-c73c19e5","tedi-file-upload__container":"tedi-file-upload__container-6b0f28a8","tedi-file-upload__container--default":"tedi-file-upload__container--default-56af0d96","tedi-file-upload__container--small":"tedi-file-upload__container--small-4d5cd36e","tedi-file-upload--disabled":"tedi-file-upload--disabled-88f4fdcd","tedi-file-upload--error":"tedi-file-upload--error-388cda6f","tedi-file-upload--valid":"tedi-file-upload--valid-28d5eb71","tedi-file-upload__content":"tedi-file-upload__content-8b6bf324","tedi-file-upload__items--truncate":"tedi-file-upload__items--truncate-5c249a01","tedi-file-upload__tag--truncate":"tedi-file-upload__tag--truncate-4c99cb2b"};exports.default=e;
@@ -1,9 +1,9 @@
1
1
  const e = {
2
2
  "tedi-file-upload": "tedi-file-upload-115f37c2",
3
+ "tedi-file-upload__button": "tedi-file-upload__button-f37449e6",
3
4
  "tedi-file-upload__items": "tedi-file-upload__items-c73c19e5",
4
5
  "tedi-file-upload__container": "tedi-file-upload__container-6b0f28a8",
5
6
  "tedi-file-upload__container--default": "tedi-file-upload__container--default-56af0d96",
6
- "tedi-file-upload__button": "tedi-file-upload__button-f37449e6",
7
7
  "tedi-file-upload__container--small": "tedi-file-upload__container--small-4d5cd36e",
8
8
  "tedi-file-upload--disabled": "tedi-file-upload--disabled-88f4fdcd",
9
9
  "tedi-file-upload--error": "tedi-file-upload--error-388cda6f",