@uva-glass/component-library 1.64.7 → 1.65.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/Label.css +1 -1
- package/dist/components/FormInput/FormInput.d.ts +3 -1
- package/dist/components/FormInput/FormInput.js +22 -21
- package/dist/components/FormInput/FormInput.js.map +1 -1
- package/dist/components/Label/Label.d.ts +3 -1
- package/dist/components/Label/Label.js +14 -12
- package/dist/components/Label/Label.js.map +1 -1
- package/package.json +1 -1
package/dist/assets/Label.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._label_16gis_1{font-weight:var(--semibold);text-align:left}._label--required_16gis_6:after{color:var(--color-red-500);content:"★";font-size:.5rem;margin-left:.25rem;vertical-align:top}._label--unset-font-weight_16gis_14{font-weight:unset}._label--align-right_16gis_18{text-align:right}
|
|
@@ -13,5 +13,7 @@ export interface FormInputProps {
|
|
|
13
13
|
notValidatedText?: string;
|
|
14
14
|
/** Returns array of selected values as number */
|
|
15
15
|
onChange: (value: string) => void;
|
|
16
|
+
/** Determines if the container wrapper is rendered. */
|
|
17
|
+
noContainer?: boolean;
|
|
16
18
|
}
|
|
17
|
-
export declare const FormInput: ({ id, label, labelPosition, type, required, notValidatedText, onChange, }: FormInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare const FormInput: ({ id, label, labelPosition, type, required, notValidatedText, onChange, noContainer, }: FormInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { c
|
|
1
|
+
import { jsxs as l, Fragment as b, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "../../clsx-OuTLNxxd.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import "../Buttons/Button.js";
|
|
5
5
|
import "../Buttons/LinkButton.js";
|
|
6
6
|
import "@react-aria/button";
|
|
7
|
-
import { Label as
|
|
7
|
+
import { Label as h } from "../Label/Label.js";
|
|
8
8
|
import "@react-aria/dialog";
|
|
9
9
|
import "@react-aria/focus";
|
|
10
10
|
import "@react-aria/overlays";
|
|
11
11
|
import "../OverlayCloseButton/OverlayCloseButton.js";
|
|
12
|
-
import { FeedbackBox as
|
|
12
|
+
import { FeedbackBox as j } from "../FeedbackBox/FeedbackBox.js";
|
|
13
13
|
import "../GridRow/GridRow.js";
|
|
14
14
|
import "../IconButton/IconButton.js";
|
|
15
15
|
import "../Input/Input.js";
|
|
@@ -32,38 +32,39 @@ import '../../assets/FormInput.css';const r = {
|
|
|
32
32
|
"form-field__input-container": "_form-field__input-container_c9jem_34",
|
|
33
33
|
"form-field__input": "_form-field__input_c9jem_25",
|
|
34
34
|
"form-field__input--error": "_form-field__input--error_c9jem_60"
|
|
35
|
-
},
|
|
35
|
+
}, Q = ({
|
|
36
36
|
id: t,
|
|
37
37
|
label: m,
|
|
38
38
|
labelPosition: p = "top",
|
|
39
|
-
type:
|
|
40
|
-
required:
|
|
39
|
+
type: n = "text",
|
|
40
|
+
required: a = !1,
|
|
41
41
|
notValidatedText: i = "",
|
|
42
|
-
onChange:
|
|
42
|
+
onChange: _,
|
|
43
|
+
noContainer: d = !1
|
|
43
44
|
}) => {
|
|
44
|
-
const
|
|
45
|
-
typeof
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
/* @__PURE__ */ o("div", { className: r["form-field__input-container"], children: /* @__PURE__ */ o(
|
|
45
|
+
const s = (o) => ["e", "E", "+", "-"].includes(o.key) && o.preventDefault(), u = (o) => {
|
|
46
|
+
typeof _ == "function" && _(o.target.value);
|
|
47
|
+
}, f = /* @__PURE__ */ l(b, { children: [
|
|
48
|
+
m && /* @__PURE__ */ e(h, { htmlFor: t, required: a, alignRight: !0, children: m }),
|
|
49
|
+
/* @__PURE__ */ l("div", { className: r["form-field__input-feedback-container"], children: [
|
|
50
|
+
/* @__PURE__ */ e("div", { className: r["form-field__input-container"], children: /* @__PURE__ */ e(
|
|
51
51
|
"input",
|
|
52
52
|
{
|
|
53
53
|
id: t,
|
|
54
|
-
type:
|
|
55
|
-
...
|
|
56
|
-
onChange:
|
|
57
|
-
className:
|
|
54
|
+
type: n,
|
|
55
|
+
...n === "number" && { onKeyDown: s },
|
|
56
|
+
onChange: u,
|
|
57
|
+
className: c(r["form-field__input"], [
|
|
58
58
|
i !== "" && r["form-field__input--error"]
|
|
59
59
|
])
|
|
60
60
|
}
|
|
61
61
|
) }),
|
|
62
|
-
i !== "" && /* @__PURE__ */
|
|
62
|
+
i !== "" && /* @__PURE__ */ e(j, { level: "error", feedback: i })
|
|
63
63
|
] })
|
|
64
64
|
] });
|
|
65
|
+
return d ? f : /* @__PURE__ */ e("div", { className: c(r["form-field__container"], r[`form-field__container--label-${p}`]), children: f });
|
|
65
66
|
};
|
|
66
67
|
export {
|
|
67
|
-
|
|
68
|
+
Q as FormInput
|
|
68
69
|
};
|
|
69
70
|
//# sourceMappingURL=FormInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormInput.js","sources":["../../../src/components/FormInput/FormInput.tsx"],"sourcesContent":["import clsx from 'clsx';\n\nimport styles from './FormInput.module.css';\n\nimport { FeedbackBox, Label } from 'components';\n\nexport interface FormInputProps {\n /** The id of the input element. */\n id: string;\n /** label text if empthy the label is not renderd */\n label: string;\n /** label position `top` or `left`. The default is `top`. */\n labelPosition?: 'top' | 'left';\n /** The type of the input element. */\n type?: 'text' | 'password' | 'email' | 'number';\n /** Shows red * */\n required?: boolean;\n /** error text to display if set */\n notValidatedText?: string;\n /** Returns array of selected values as number */\n onChange: (value: string) => void;\n}\n\nexport const FormInput = ({\n id,\n label,\n labelPosition = 'top',\n type = 'text',\n required = false,\n notValidatedText = '',\n onChange,\n}: FormInputProps) => {\n const blockInvalidChar = (event: React.KeyboardEvent<HTMLInputElement>) =>\n ['e', 'E', '+', '-'].includes(event.key) && event.preventDefault();\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n if (typeof onChange === 'function') {\n onChange(event.target.value);\n }\n };\n\n
|
|
1
|
+
{"version":3,"file":"FormInput.js","sources":["../../../src/components/FormInput/FormInput.tsx"],"sourcesContent":["import clsx from 'clsx';\n\nimport styles from './FormInput.module.css';\n\nimport { FeedbackBox, Label } from 'components';\n\nexport interface FormInputProps {\n /** The id of the input element. */\n id: string;\n /** label text if empthy the label is not renderd */\n label: string;\n /** label position `top` or `left`. The default is `top`. */\n labelPosition?: 'top' | 'left';\n /** The type of the input element. */\n type?: 'text' | 'password' | 'email' | 'number';\n /** Shows red * */\n required?: boolean;\n /** error text to display if set */\n notValidatedText?: string;\n /** Returns array of selected values as number */\n onChange: (value: string) => void;\n /** Determines if the container wrapper is rendered. */\n noContainer?: boolean;\n}\n\nexport const FormInput = ({\n id,\n label,\n labelPosition = 'top',\n type = 'text',\n required = false,\n notValidatedText = '',\n onChange,\n noContainer = false,\n}: FormInputProps) => {\n const blockInvalidChar = (event: React.KeyboardEvent<HTMLInputElement>) =>\n ['e', 'E', '+', '-'].includes(event.key) && event.preventDefault();\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n if (typeof onChange === 'function') {\n onChange(event.target.value);\n }\n };\n\n const componentContent = (\n <>\n {label && (\n <Label htmlFor={id} required={required} alignRight>\n {label}\n </Label>\n )}\n\n <div className={styles['form-field__input-feedback-container']}>\n <div className={styles['form-field__input-container']}>\n <input\n id={id}\n type={type}\n {...(type === 'number' && { onKeyDown: blockInvalidChar })}\n onChange={handleChange}\n className={clsx(styles['form-field__input'], [\n notValidatedText !== '' && styles['form-field__input--error'],\n ])}\n />\n </div>\n {notValidatedText !== '' && <FeedbackBox level=\"error\" feedback={notValidatedText} />}\n </div>\n </>\n );\n\n return noContainer ? (\n componentContent\n ) : (\n <div className={clsx(styles['form-field__container'], styles[`form-field__container--label-${labelPosition}`])}>\n {componentContent}\n </div>\n );\n};\n"],"names":["FormInput","id","label","labelPosition","type","required","notValidatedText","onChange","noContainer","blockInvalidChar","event","handleChange","componentContent","jsxs","Fragment","Label","styles","jsx","clsx","FeedbackBox"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyBaA,IAAY,CAAC;AAAA,EACxB,IAAAC;AAAA,EACA,OAAAC;AAAA,EACA,eAAAC,IAAgB;AAAA,EAChB,MAAAC,IAAO;AAAA,EACP,UAAAC,IAAW;AAAA,EACX,kBAAAC,IAAmB;AAAA,EACnB,UAAAC;AAAA,EACA,aAAAC,IAAc;AAChB,MAAsB;AACpB,QAAMC,IAAmB,CAACC,MACxB,CAAC,KAAK,KAAK,KAAK,GAAG,EAAE,SAASA,EAAM,GAAG,KAAKA,EAAM,eAAe,GAE7DC,IAAe,CAACD,MAA+C;AAC/D,IAAA,OAAOH,KAAa,cACbA,EAAAG,EAAM,OAAO,KAAK;AAAA,EAC7B,GAGIE,IAED,gBAAAC,EAAAC,GAAA,EAAA,UAAA;AAAA,IAAAZ,uBACEa,GAAM,EAAA,SAASd,GAAI,UAAAI,GAAoB,YAAU,IAC/C,UACHH,EAAA,CAAA;AAAA,IAGD,gBAAAW,EAAA,OAAA,EAAI,WAAWG,EAAO,sCAAsC,GAC3D,UAAA;AAAA,MAAA,gBAAAC,EAAC,OAAI,EAAA,WAAWD,EAAO,6BAA6B,GAClD,UAAA,gBAAAC;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,IAAAhB;AAAA,UACA,MAAAG;AAAA,UACC,GAAIA,MAAS,YAAY,EAAE,WAAWK,EAAiB;AAAA,UACxD,UAAUE;AAAA,UACV,WAAWO,EAAKF,EAAO,mBAAmB,GAAG;AAAA,YAC3CV,MAAqB,MAAMU,EAAO,0BAA0B;AAAA,UAAA,CAC7D;AAAA,QAAA;AAAA,MAAA,GAEL;AAAA,MACCV,MAAqB,MAAM,gBAAAW,EAACE,KAAY,OAAM,SAAQ,UAAUb,GAAkB;AAAA,IAAA,GACrF;AAAA,EACF,EAAA,CAAA;AAGF,SAAOE,IACLI,IAEC,gBAAAK,EAAA,OAAA,EAAI,WAAWC,EAAKF,EAAO,uBAAuB,GAAGA,EAAO,gCAAgCb,CAAa,EAAE,CAAC,GAC1G,UACHS,EAAA,CAAA;AAEJ;"}
|
|
@@ -6,6 +6,8 @@ export interface LabelProps extends Omit<LabelHTMLAttributes<HTMLLabelElement>,
|
|
|
6
6
|
noFontWeight?: boolean;
|
|
7
7
|
/** `true` to show an asterisk to indicate an item is required; otherwise, `false`. */
|
|
8
8
|
required?: boolean;
|
|
9
|
+
/** `true` to align text right; otherwise, `false`. */
|
|
10
|
+
alignRight?: boolean;
|
|
9
11
|
}
|
|
10
12
|
/** Represents a component that renders a label for an input element. */
|
|
11
|
-
export declare const Label: ({ children, htmlFor, noFontWeight, required, ...restProps }: LabelProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const Label: ({ children, htmlFor, noFontWeight, required, alignRight, ...restProps }: LabelProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { c as
|
|
3
|
-
import '../../assets/Label.css';const n = "
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { c as g } from "../../clsx-OuTLNxxd.js";
|
|
3
|
+
import '../../assets/Label.css';const n = "_label_16gis_1", l = {
|
|
4
4
|
label: n,
|
|
5
|
-
"label--required": "_label--
|
|
6
|
-
"label--unset-font-weight": "_label--unset-font-
|
|
7
|
-
|
|
5
|
+
"label--required": "_label--required_16gis_6",
|
|
6
|
+
"label--unset-font-weight": "_label--unset-font-weight_16gis_14",
|
|
7
|
+
"label--align-right": "_label--align-right_16gis_18"
|
|
8
|
+
}, c = ({ children: e, htmlFor: a, noFontWeight: t, required: i = !1, alignRight: s, ...b }) => /* @__PURE__ */ r(
|
|
8
9
|
"label",
|
|
9
10
|
{
|
|
10
|
-
...
|
|
11
|
-
htmlFor:
|
|
12
|
-
className:
|
|
13
|
-
[
|
|
14
|
-
[
|
|
11
|
+
...b,
|
|
12
|
+
htmlFor: a,
|
|
13
|
+
className: g(l.label, {
|
|
14
|
+
[l["label--unset-font-weight"]]: t,
|
|
15
|
+
[l["label--required"]]: i,
|
|
16
|
+
[l["label--align-right"]]: s
|
|
15
17
|
}),
|
|
16
|
-
children:
|
|
18
|
+
children: e
|
|
17
19
|
}
|
|
18
20
|
);
|
|
19
21
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Label.js","sources":["../../../src/components/Label/Label.tsx"],"sourcesContent":["import clsx from 'clsx';\n\nimport type { LabelHTMLAttributes } from 'react';\n\nimport styles from './Label.module.css';\n\nexport interface LabelProps extends Omit<LabelHTMLAttributes<HTMLLabelElement>, 'className' | 'style'> {\n /** The id of the element for which the label is intended. */\n htmlFor: string;\n /** `true` if the font-weight needs to be unset; otherwise, `false`. The default is `false`. */\n noFontWeight?: boolean;\n /** `true` to show an asterisk to indicate an item is required; otherwise, `false`. */\n required?: boolean;\n}\n\n/** Represents a component that renders a label for an input element. */\nexport const Label = ({ children, htmlFor, noFontWeight, required = false, ...restProps }: LabelProps) => (\n <label\n {...restProps}\n htmlFor={htmlFor}\n className={clsx(styles['label'], {\n [styles['label--unset-font-weight']]: noFontWeight,\n [styles['label--required']]: required,\n })}\n >\n {children}\n </label>\n);\n"],"names":["Label","children","htmlFor","noFontWeight","required","restProps","jsx","clsx","styles"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Label.js","sources":["../../../src/components/Label/Label.tsx"],"sourcesContent":["import clsx from 'clsx';\n\nimport type { LabelHTMLAttributes } from 'react';\n\nimport styles from './Label.module.css';\n\nexport interface LabelProps extends Omit<LabelHTMLAttributes<HTMLLabelElement>, 'className' | 'style'> {\n /** The id of the element for which the label is intended. */\n htmlFor: string;\n /** `true` if the font-weight needs to be unset; otherwise, `false`. The default is `false`. */\n noFontWeight?: boolean;\n /** `true` to show an asterisk to indicate an item is required; otherwise, `false`. */\n required?: boolean;\n /** `true` to align text right; otherwise, `false`. */\n alignRight?: boolean;\n}\n\n/** Represents a component that renders a label for an input element. */\nexport const Label = ({ children, htmlFor, noFontWeight, required = false, alignRight, ...restProps }: LabelProps) => (\n <label\n {...restProps}\n htmlFor={htmlFor}\n className={clsx(styles['label'], {\n [styles['label--unset-font-weight']]: noFontWeight,\n [styles['label--required']]: required,\n [styles['label--align-right']]: alignRight,\n })}\n >\n {children}\n </label>\n);\n"],"names":["Label","children","htmlFor","noFontWeight","required","alignRight","restProps","jsx","clsx","styles"],"mappings":";;;;;;;GAkBaA,IAAQ,CAAC,EAAE,UAAAC,GAAU,SAAAC,GAAS,cAAAC,GAAc,UAAAC,IAAW,IAAO,YAAAC,GAAY,GAAGC,EAAA,MACxF,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACE,GAAGD;AAAA,IACJ,SAAAJ;AAAA,IACA,WAAWM,EAAKC,EAAO,OAAU;AAAA,MAC/B,CAACA,EAAO,0BAA0B,CAAC,GAAGN;AAAA,MACtC,CAACM,EAAO,iBAAiB,CAAC,GAAGL;AAAA,MAC7B,CAACK,EAAO,oBAAoB,CAAC,GAAGJ;AAAA,IAAA,CACjC;AAAA,IAEA,UAAAJ;AAAA,EAAA;AACH;"}
|