@tedi-design-system/react 17.0.0 → 17.1.0-rc.1
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/bundle-stats.html +1 -1
- package/index.css +1 -1
- package/package.json +1 -1
- package/src/tedi/components/form/field/field.cjs.js +1 -0
- package/src/tedi/components/form/field/field.d.ts +88 -0
- package/src/tedi/components/form/field/field.es.js +54 -0
- package/src/tedi/components/form/field/field.module.scss.cjs.js +1 -0
- package/src/tedi/components/form/field/field.module.scss.es.js +6 -0
- package/src/tedi/components/form/file-upload/file-upload.cjs.js +1 -1
- package/src/tedi/components/form/file-upload/file-upload.d.ts +14 -2
- package/src/tedi/components/form/file-upload/file-upload.es.js +97 -90
- package/src/tedi/components/form/input-group/components/input/input.cjs.js +1 -0
- package/src/tedi/components/form/input-group/components/input/input.d.ts +19 -0
- package/src/tedi/components/form/input-group/components/input/input.es.js +20 -0
- package/src/tedi/components/form/input-group/components/prefix/prefix.cjs.js +1 -0
- package/src/tedi/components/form/input-group/components/prefix/prefix.d.ts +18 -0
- package/src/tedi/components/form/input-group/components/prefix/prefix.es.js +26 -0
- package/src/tedi/components/form/input-group/components/suffix/suffix.cjs.js +1 -0
- package/src/tedi/components/form/input-group/components/suffix/suffix.d.ts +18 -0
- package/src/tedi/components/form/input-group/components/suffix/suffix.es.js +26 -0
- package/src/tedi/components/form/input-group/index.d.ts +4 -0
- package/src/tedi/components/form/input-group/input-group.cjs.js +1 -0
- package/src/tedi/components/form/input-group/input-group.d.ts +87 -0
- package/src/tedi/components/form/input-group/input-group.es.js +61 -0
- package/src/tedi/components/form/input-group/input-group.module.scss.cjs.js +1 -0
- package/src/tedi/components/form/input-group/input-group.module.scss.es.js +16 -0
- package/src/tedi/components/form/search/search.cjs.js +1 -1
- package/src/tedi/components/form/search/search.es.js +35 -25
- package/src/tedi/components/form/select/components/select-control.cjs.js +1 -1
- package/src/tedi/components/form/select/components/select-control.es.js +7 -3
- package/src/tedi/components/form/select/select.cjs.js +1 -1
- package/src/tedi/components/form/select/select.d.ts +3 -2
- package/src/tedi/components/form/select/select.es.js +168 -166
- package/src/tedi/components/form/textfield/textfield.cjs.js +1 -1
- package/src/tedi/components/form/textfield/textfield.d.ts +118 -36
- package/src/tedi/components/form/textfield/textfield.es.js +134 -172
- package/src/tedi/index.d.ts +2 -0
- package/tedi.cjs.js +1 -1
- package/tedi.es.js +168 -156
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react/jsx-runtime"),M=require("../../../../../external/classnames/index.cjs.js"),e=require("react"),n=require("../input-group/input-group.cjs.js"),_=require("./field.module.scss.cjs.js"),m=e.forwardRef((l,p)=>{var d;const{id:k,name:v,value:i,type:x,defaultValue:I,onChange:a,onChangeEvent:r,disabled:q,readOnly:y,required:N,invalid:R,placeholder:V,className:g,onFocus:j,onBlur:F,isTextArea:P,inputProps:b,textareaProps:h,...O}=l,t=e.useRef(null),[S,T]=e.useState(i??I??""),w=i??S;e.useImperativeHandle(p,()=>t.current);const C=o=>{const c=o.currentTarget.value;T(c),a==null||a(c),r==null||r(o)},s=(d=n.useOptionalInputGroup)==null?void 0:d.call(n),A=e.useId(),B=l.id??(s==null?void 0:s.inputId)??A,H=M.default(_.default["tedi-field"],g),u={...O,id:B,name:v,value:w,placeholder:V,disabled:q,readOnly:y,required:N,"aria-invalid":R||void 0,onChange:C,onFocus:j,onBlur:F,className:H,ref:t};return P?f.jsx("textarea",{...h,...u,ref:t}):f.jsx("input",{...b,...u,type:x,ref:t})});m.displayName="Field";exports.Field=m;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export type FieldElement = HTMLInputElement | HTMLTextAreaElement;
|
|
3
|
+
export interface FieldProps {
|
|
4
|
+
/**
|
|
5
|
+
* Unique identifier for the field element.
|
|
6
|
+
*/
|
|
7
|
+
id?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Name attribute used in forms and form submissions.
|
|
10
|
+
*/
|
|
11
|
+
name?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Controlled value of the field.
|
|
14
|
+
*/
|
|
15
|
+
value?: string;
|
|
16
|
+
/**
|
|
17
|
+
* The type of the input element (e.g. 'text', 'email', 'password', 'number', 'tel', 'url', etc.).
|
|
18
|
+
*
|
|
19
|
+
* **Note**: This prop is ignored when `isTextArea={true}`.
|
|
20
|
+
* @default 'text'
|
|
21
|
+
*/
|
|
22
|
+
type?: React.InputHTMLAttributes<HTMLInputElement>['type'];
|
|
23
|
+
/**
|
|
24
|
+
* Default value for uncontrolled usage.
|
|
25
|
+
*/
|
|
26
|
+
defaultValue?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Callback fired when value changes (returns string value only).
|
|
29
|
+
*/
|
|
30
|
+
onChange?: (value: string) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Native change event callback (full event access).
|
|
33
|
+
*/
|
|
34
|
+
onChangeEvent?: React.ChangeEventHandler<FieldElement>;
|
|
35
|
+
/**
|
|
36
|
+
* Disables the field and prevents user interaction.
|
|
37
|
+
*/
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Makes the field read-only (user cannot edit but can focus/select).
|
|
41
|
+
*/
|
|
42
|
+
readOnly?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Marks the field as required in form validation.
|
|
45
|
+
*/
|
|
46
|
+
required?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Marks the field visually and semantically as invalid.
|
|
49
|
+
*/
|
|
50
|
+
invalid?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Placeholder text displayed when the field is empty.
|
|
53
|
+
*/
|
|
54
|
+
placeholder?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Custom CSS class for the input/textarea element.
|
|
57
|
+
*/
|
|
58
|
+
className?: string;
|
|
59
|
+
/**
|
|
60
|
+
* ARIA description reference (used for helper/error text association).
|
|
61
|
+
*/
|
|
62
|
+
'aria-describedby'?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Accessible label for screen readers when no visible label exists.
|
|
65
|
+
*/
|
|
66
|
+
'aria-label'?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Focus event handler.
|
|
69
|
+
*/
|
|
70
|
+
onFocus?: React.FocusEventHandler<FieldElement>;
|
|
71
|
+
/**
|
|
72
|
+
* Blur event handler.
|
|
73
|
+
*/
|
|
74
|
+
onBlur?: React.FocusEventHandler<FieldElement>;
|
|
75
|
+
/**
|
|
76
|
+
* Renders a textarea instead of an input element.
|
|
77
|
+
*/
|
|
78
|
+
isTextArea?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Native input element props override (input only).
|
|
81
|
+
*/
|
|
82
|
+
inputProps?: React.InputHTMLAttributes<HTMLInputElement>;
|
|
83
|
+
/**
|
|
84
|
+
* Native textarea element props override (textarea only).
|
|
85
|
+
*/
|
|
86
|
+
textareaProps?: React.TextareaHTMLAttributes<HTMLTextAreaElement>;
|
|
87
|
+
}
|
|
88
|
+
export declare const Field: React.ForwardRefExoticComponent<FieldProps & React.RefAttributes<FieldElement>>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import B from "../../../../../external/classnames/index.es.js";
|
|
3
|
+
import a, { forwardRef as H } from "react";
|
|
4
|
+
import { useOptionalInputGroup as S } from "../input-group/input-group.es.js";
|
|
5
|
+
import k from "./field.module.scss.es.js";
|
|
6
|
+
const z = H((n, m) => {
|
|
7
|
+
var i;
|
|
8
|
+
const {
|
|
9
|
+
id: D,
|
|
10
|
+
name: f,
|
|
11
|
+
value: l,
|
|
12
|
+
type: p,
|
|
13
|
+
defaultValue: v,
|
|
14
|
+
onChange: r,
|
|
15
|
+
onChangeEvent: t,
|
|
16
|
+
disabled: I,
|
|
17
|
+
readOnly: x,
|
|
18
|
+
required: N,
|
|
19
|
+
invalid: V,
|
|
20
|
+
placeholder: y,
|
|
21
|
+
className: R,
|
|
22
|
+
onFocus: h,
|
|
23
|
+
onBlur: F,
|
|
24
|
+
isTextArea: P,
|
|
25
|
+
inputProps: g,
|
|
26
|
+
textareaProps: w,
|
|
27
|
+
...C
|
|
28
|
+
} = n, e = a.useRef(null), [O, T] = a.useState(l ?? v ?? ""), _ = l ?? O;
|
|
29
|
+
a.useImperativeHandle(m, () => e.current);
|
|
30
|
+
const b = (d) => {
|
|
31
|
+
const u = d.currentTarget.value;
|
|
32
|
+
T(u), r == null || r(u), t == null || t(d);
|
|
33
|
+
}, s = (i = S) == null ? void 0 : i(), j = a.useId(), q = n.id ?? (s == null ? void 0 : s.inputId) ?? j, A = B(k["tedi-field"], R), o = {
|
|
34
|
+
...C,
|
|
35
|
+
id: q,
|
|
36
|
+
name: f,
|
|
37
|
+
value: _,
|
|
38
|
+
placeholder: y,
|
|
39
|
+
disabled: I,
|
|
40
|
+
readOnly: x,
|
|
41
|
+
required: N,
|
|
42
|
+
"aria-invalid": V || void 0,
|
|
43
|
+
onChange: b,
|
|
44
|
+
onFocus: h,
|
|
45
|
+
onBlur: F,
|
|
46
|
+
className: A,
|
|
47
|
+
ref: e
|
|
48
|
+
};
|
|
49
|
+
return P ? /* @__PURE__ */ c("textarea", { ...w, ...o, ref: e }) : /* @__PURE__ */ c("input", { ...g, ...o, type: p, ref: e });
|
|
50
|
+
});
|
|
51
|
+
z.displayName = "Field";
|
|
52
|
+
export {
|
|
53
|
+
z as Field
|
|
54
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-field":"tedi-field-df48ad86"};exports.default=e;
|
|
@@ -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"),
|
|
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,11 +1,23 @@
|
|
|
1
1
|
import { FileUploadFile } from '../../../helpers/hooks/use-file-upload';
|
|
2
2
|
import { FormLabelProps } from '../../form/form-label/form-label';
|
|
3
3
|
import { FeedbackTextProps } from '../feedback-text/feedback-text';
|
|
4
|
-
export interface FileUploadProps extends FormLabelProps {
|
|
4
|
+
export interface FileUploadProps extends Omit<FormLabelProps, 'id' | 'label'> {
|
|
5
|
+
id?: string;
|
|
6
|
+
label?: string;
|
|
5
7
|
/**
|
|
6
|
-
* Additional class names
|
|
8
|
+
* Additional class names appended to the inner dropzone element
|
|
9
|
+
* (`tedi-file-upload`) — the content area that holds the file list and the
|
|
10
|
+
* upload button. Use this to tweak the dropzone itself (border, padding,
|
|
11
|
+
* background) without affecting the surrounding container.
|
|
7
12
|
*/
|
|
8
13
|
className?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Additional class names appended to the outer container element
|
|
16
|
+
* (`tedi-file-upload__container`) that wraps the dropzone, file list, and
|
|
17
|
+
* helper/error states. Use this to tweak the component's outer shell
|
|
18
|
+
* (radius, outline, max-width) or to override size/state modifiers.
|
|
19
|
+
*/
|
|
20
|
+
wrapperClassName?: string;
|
|
9
21
|
/**
|
|
10
22
|
* The name of the file input field, used for form submission and accessibility.
|
|
11
23
|
*/
|
|
@@ -1,152 +1,159 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { useFileUpload as
|
|
5
|
-
import { Text as
|
|
6
|
-
import { Button as
|
|
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
7
|
import { ClosingButton as G } from "../../buttons/closing-button/closing-button.es.js";
|
|
8
|
-
import { FormLabel as
|
|
9
|
-
import { Separator as
|
|
10
|
-
import { Tag as
|
|
11
|
-
import { FeedbackText as
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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,
|
|
23
26
|
onChange: f,
|
|
24
|
-
className:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
className: z,
|
|
28
|
+
wrapperClassName: S,
|
|
29
|
+
defaultFiles: U,
|
|
30
|
+
onDelete: V,
|
|
31
|
+
hasClearButton: j = !0,
|
|
28
32
|
files: c,
|
|
29
33
|
readOnly: h,
|
|
30
34
|
disabled: o = !1,
|
|
31
|
-
maxSize:
|
|
32
|
-
validateIndividually:
|
|
35
|
+
maxSize: M,
|
|
36
|
+
validateIndividually: O = !1,
|
|
33
37
|
size: m = "default",
|
|
34
38
|
helper: a,
|
|
35
|
-
...
|
|
36
|
-
} =
|
|
37
|
-
accept:
|
|
38
|
-
maxSize:
|
|
39
|
-
multiple:
|
|
40
|
-
validateIndividually:
|
|
41
|
-
defaultFiles:
|
|
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,
|
|
42
46
|
onChange: f,
|
|
43
|
-
onDelete:
|
|
47
|
+
onDelete: V,
|
|
44
48
|
files: c
|
|
45
|
-
}),
|
|
46
|
-
const
|
|
47
|
-
return /* @__PURE__ */
|
|
48
|
-
|
|
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,
|
|
49
53
|
{
|
|
50
54
|
color: e.isValid === !1 ? "danger" : "primary",
|
|
51
|
-
onClose: !e.isLoading && !o && !h ? () =>
|
|
55
|
+
onClose: !e.isLoading && !o && !h ? () => q(e) : void 0,
|
|
52
56
|
isLoading: e.isLoading,
|
|
53
|
-
"aria-label":
|
|
57
|
+
"aria-label": X,
|
|
54
58
|
children: e.name
|
|
55
59
|
}
|
|
56
|
-
) },
|
|
57
|
-
},
|
|
58
|
-
if (
|
|
59
|
-
return /* @__PURE__ */
|
|
60
|
-
if (
|
|
61
|
-
const e =
|
|
62
|
-
return /* @__PURE__ */
|
|
63
|
-
|
|
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,
|
|
64
68
|
{
|
|
65
|
-
"aria-label":
|
|
66
|
-
className:
|
|
69
|
+
"aria-label": s,
|
|
70
|
+
className: p(i["tedi-file-upload__items"], i["tedi-file-upload__truncate"]),
|
|
67
71
|
children: e.name
|
|
68
72
|
}
|
|
69
73
|
);
|
|
70
74
|
}
|
|
71
75
|
return null;
|
|
72
76
|
};
|
|
73
|
-
return /* @__PURE__ */
|
|
74
|
-
/* @__PURE__ */
|
|
75
|
-
|
|
77
|
+
return /* @__PURE__ */ u(I, { children: [
|
|
78
|
+
/* @__PURE__ */ l("div", { className: i["tedi-file-upload__label-wrapper"], children: !K && y && /* @__PURE__ */ l(
|
|
79
|
+
H,
|
|
76
80
|
{
|
|
77
|
-
id:
|
|
78
|
-
|
|
81
|
+
id: _,
|
|
82
|
+
label: y ?? "",
|
|
83
|
+
...D,
|
|
79
84
|
renderWithoutLabel: h,
|
|
80
|
-
className:
|
|
85
|
+
className: i["tedi-file-upload__label"],
|
|
81
86
|
size: m
|
|
82
87
|
}
|
|
83
88
|
) }),
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
-
h ?
|
|
89
|
+
/* @__PURE__ */ l("div", { "aria-live": "polite", "aria-atomic": "true", className: "sr-only", children: A }),
|
|
90
|
+
h ? k() : /* @__PURE__ */ l(
|
|
86
91
|
"div",
|
|
87
92
|
{
|
|
88
|
-
className:
|
|
89
|
-
|
|
93
|
+
className: p(
|
|
94
|
+
i["tedi-file-upload__container"],
|
|
90
95
|
{
|
|
91
|
-
[
|
|
92
|
-
[
|
|
93
|
-
[
|
|
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"
|
|
94
99
|
},
|
|
95
|
-
{ [
|
|
100
|
+
{ [i[`tedi-file-upload__container--${m}`]]: m },
|
|
101
|
+
S
|
|
96
102
|
),
|
|
97
|
-
children: /* @__PURE__ */
|
|
98
|
-
/* @__PURE__ */
|
|
99
|
-
/* @__PURE__ */
|
|
100
|
-
/* @__PURE__ */
|
|
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(
|
|
101
107
|
"input",
|
|
102
108
|
{
|
|
103
|
-
|
|
109
|
+
ref: x,
|
|
110
|
+
id: _,
|
|
104
111
|
type: "file",
|
|
105
|
-
name:
|
|
106
|
-
accept:
|
|
107
|
-
onChange:
|
|
108
|
-
multiple:
|
|
112
|
+
name: T,
|
|
113
|
+
accept: N,
|
|
114
|
+
onChange: W,
|
|
115
|
+
multiple: F,
|
|
109
116
|
disabled: o,
|
|
110
117
|
"aria-invalid": !!t && t.type === "error",
|
|
111
|
-
"aria-describedby":
|
|
118
|
+
"aria-describedby": b
|
|
112
119
|
}
|
|
113
120
|
),
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
121
|
+
j && r.length > 0 && !o && /* @__PURE__ */ u(I, { children: [
|
|
122
|
+
oe(E, "md") ? /* @__PURE__ */ l(
|
|
123
|
+
$,
|
|
117
124
|
{
|
|
118
125
|
visualType: "neutral",
|
|
119
126
|
iconLeft: "close",
|
|
120
127
|
disabled: o,
|
|
121
|
-
onClick:
|
|
122
|
-
className:
|
|
123
|
-
children:
|
|
128
|
+
onClick: C,
|
|
129
|
+
className: i["tedi-file-upload__button"],
|
|
130
|
+
children: d("clear")
|
|
124
131
|
}
|
|
125
|
-
) : /* @__PURE__ */
|
|
126
|
-
/* @__PURE__ */
|
|
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" })
|
|
127
134
|
] }),
|
|
128
|
-
/* @__PURE__ */
|
|
129
|
-
|
|
135
|
+
/* @__PURE__ */ l(
|
|
136
|
+
$,
|
|
130
137
|
{
|
|
131
138
|
visualType: "neutral",
|
|
132
139
|
iconLeft: "file_upload",
|
|
133
140
|
disabled: o,
|
|
134
141
|
onClick: () => {
|
|
135
142
|
var e;
|
|
136
|
-
return (e =
|
|
143
|
+
return (e = x.current) == null ? void 0 : e.click();
|
|
137
144
|
},
|
|
138
|
-
className:
|
|
145
|
+
className: i["tedi-file-upload__button"],
|
|
139
146
|
size: m,
|
|
140
|
-
children:
|
|
147
|
+
children: d("file-upload.add")
|
|
141
148
|
}
|
|
142
149
|
)
|
|
143
150
|
] }) })
|
|
144
151
|
] }) })
|
|
145
152
|
}
|
|
146
153
|
),
|
|
147
|
-
a ? /* @__PURE__ */
|
|
154
|
+
a ? /* @__PURE__ */ l(w, { ...a, id: b }) : t ? /* @__PURE__ */ l(w, { ...t, id: b }) : null
|
|
148
155
|
] });
|
|
149
156
|
};
|
|
150
157
|
export {
|
|
151
|
-
|
|
158
|
+
xe as FileUpload
|
|
152
159
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../../../../../external/classnames/index.cjs.js"),p=require("react"),a=require("../../input-group.cjs.js"),s=require("../../input-group.module.scss.cjs.js"),n=({children:t})=>{const{disabled:u,inputId:r}=a.useInputGroup();if(!p.isValidElement(t))return t;const o=typeof t.type=="string",i={disabled:u||t.props.disabled,id:t.props.id??r,className:e.default(t.props.className,s.default["tedi-input-group__input"]),...!o&&{wrapperClassName:e.default(t.props.wrapperClassName,s.default["tedi-input-group__input"])}};return p.cloneElement(t,i)};exports.Input=n;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
export interface InputProps {
|
|
3
|
+
/**
|
|
4
|
+
* The form control rendered inside the input slot — must be a single React
|
|
5
|
+
* element (e.g. `TextField`, `Select`, native `<input>`). The element is
|
|
6
|
+
* cloned with extra props from the surrounding `InputGroup`:
|
|
7
|
+
* - `disabled` is OR-ed with the group's disabled state
|
|
8
|
+
* - `id` falls back to the group's `inputId` so an external `Label` can
|
|
9
|
+
* target it via `htmlFor`
|
|
10
|
+
* - `className` (or `wrapperClassName` for non-intrinsic components) is
|
|
11
|
+
* merged with `tedi-input-group__input` to align borders/radii with
|
|
12
|
+
* adjacent prefix/suffix slots
|
|
13
|
+
*
|
|
14
|
+
* Non-element children (text, fragments, `null`) are returned as-is and
|
|
15
|
+
* receive none of these props.
|
|
16
|
+
*/
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
}
|
|
19
|
+
export declare const Input: ({ children }: InputProps) => string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import s from "../../../../../../../external/classnames/index.es.js";
|
|
2
|
+
import t from "react";
|
|
3
|
+
import { useInputGroup as m } from "../../input-group.es.js";
|
|
4
|
+
import o from "../../input-group.module.scss.es.js";
|
|
5
|
+
const f = ({ children: p }) => {
|
|
6
|
+
const { disabled: r, inputId: e } = m();
|
|
7
|
+
if (!t.isValidElement(p)) return p;
|
|
8
|
+
const a = typeof p.type == "string", i = {
|
|
9
|
+
disabled: r || p.props.disabled,
|
|
10
|
+
id: p.props.id ?? e,
|
|
11
|
+
className: s(p.props.className, o["tedi-input-group__input"]),
|
|
12
|
+
...!a && {
|
|
13
|
+
wrapperClassName: s(p.props.wrapperClassName, o["tedi-input-group__input"])
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
return t.cloneElement(p, i);
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
f as Input
|
|
20
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react/jsx-runtime"),f=require("../../../../../../../external/classnames/index.cjs.js"),d=require("react"),a=require("../../input-group.cjs.js"),i=require("../../input-group.module.scss.cjs.js"),c=({children:e,className:u,...n})=>{const{registerPrefix:r,unregisterPrefix:t,disabled:s}=a.useInputGroup();d.useEffect(()=>(r(),()=>t()),[r,t]);const o=typeof e=="string"||typeof e=="number";return p.jsx("div",{...n,className:f.default(i.default["tedi-input-group__prefix"],{[i.default["tedi-input-group__prefix--no-inner-div"]]:o},u),"aria-disabled":s,children:e})};exports.Prefix=c;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface PrefixProps {
|
|
3
|
+
/**
|
|
4
|
+
* Content rendered inside the prefix slot. Typically a short text label,
|
|
5
|
+
* an `Icon`, a `Button`, or any other inline element. When `children` is a
|
|
6
|
+
* plain string or number, the prefix automatically applies the
|
|
7
|
+
* `--no-inner-div` modifier so the wrapper itself receives the correct
|
|
8
|
+
* padding instead of relying on a child element.
|
|
9
|
+
*/
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Additional class name appended to the wrapper `div`. Useful for one-off
|
|
13
|
+
* tweaks; the default `tedi-input-group__prefix` BEM class is always
|
|
14
|
+
* applied.
|
|
15
|
+
*/
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare const Prefix: ({ children, className, ...props }: PrefixProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import n from "../../../../../../../external/classnames/index.es.js";
|
|
3
|
+
import { useEffect as u } from "react";
|
|
4
|
+
import { useInputGroup as a } from "../../input-group.es.js";
|
|
5
|
+
import i from "../../input-group.module.scss.es.js";
|
|
6
|
+
const b = ({ children: r, className: o, ...s }) => {
|
|
7
|
+
const { registerPrefix: e, unregisterPrefix: t, disabled: p } = a();
|
|
8
|
+
u(() => (e(), () => t()), [e, t]);
|
|
9
|
+
const f = typeof r == "string" || typeof r == "number";
|
|
10
|
+
return /* @__PURE__ */ m(
|
|
11
|
+
"div",
|
|
12
|
+
{
|
|
13
|
+
...s,
|
|
14
|
+
className: n(
|
|
15
|
+
i["tedi-input-group__prefix"],
|
|
16
|
+
{ [i["tedi-input-group__prefix--no-inner-div"]]: f },
|
|
17
|
+
o
|
|
18
|
+
),
|
|
19
|
+
"aria-disabled": p,
|
|
20
|
+
children: r
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
b as Prefix
|
|
26
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react/jsx-runtime"),d=require("../../../../../../../external/classnames/index.cjs.js"),p=require("react"),a=require("../../input-group.cjs.js"),i=require("../../input-group.module.scss.cjs.js"),c=({children:e,className:r,...s})=>{const{registerSuffix:t,unregisterSuffix:u,disabled:n}=a.useInputGroup();p.useEffect(()=>(t(),()=>u()),[t,u]);const o=typeof e=="string"||typeof e=="number";return f.jsx("div",{...s,className:d.default(i.default["tedi-input-group__suffix"],{[i.default["tedi-input-group__suffix--no-inner-div"]]:o},r),"aria-disabled":n,children:e})};exports.Suffix=c;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface SuffixProps {
|
|
3
|
+
/**
|
|
4
|
+
* Content rendered inside the suffix slot. Typically a short text label,
|
|
5
|
+
* an `Icon`, a `Button`, or any other inline element. When `children` is a
|
|
6
|
+
* plain string or number, the suffix automatically applies the
|
|
7
|
+
* `--no-inner-div` modifier so the wrapper itself receives the correct
|
|
8
|
+
* padding instead of relying on a child element.
|
|
9
|
+
*/
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Additional class name appended to the wrapper `div`. Useful for one-off
|
|
13
|
+
* tweaks; the default `tedi-input-group__suffix` BEM class is always
|
|
14
|
+
* applied.
|
|
15
|
+
*/
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare const Suffix: ({ children, className, ...props }: SuffixProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import m from "../../../../../../../external/classnames/index.es.js";
|
|
3
|
+
import { useEffect as n } from "react";
|
|
4
|
+
import { useInputGroup as a } from "../../input-group.es.js";
|
|
5
|
+
import s from "../../input-group.module.scss.es.js";
|
|
6
|
+
const b = ({ children: r, className: e, ...o }) => {
|
|
7
|
+
const { registerSuffix: t, unregisterSuffix: i, disabled: f } = a();
|
|
8
|
+
n(() => (t(), () => i()), [t, i]);
|
|
9
|
+
const u = typeof r == "string" || typeof r == "number";
|
|
10
|
+
return /* @__PURE__ */ p(
|
|
11
|
+
"div",
|
|
12
|
+
{
|
|
13
|
+
...o,
|
|
14
|
+
className: m(
|
|
15
|
+
s["tedi-input-group__suffix"],
|
|
16
|
+
{ [s["tedi-input-group__suffix--no-inner-div"]]: u },
|
|
17
|
+
e
|
|
18
|
+
),
|
|
19
|
+
"aria-disabled": f,
|
|
20
|
+
children: r
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
b as Suffix
|
|
26
|
+
};
|