@uva-glass/component-library 3.12.0 → 3.13.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/InputField.css +1 -1
- package/dist/assets/variables.css +3 -3
- package/dist/components/InputField/InputField.d.ts +5 -3
- package/dist/components/InputField/InputField.js +41 -37
- package/dist/components/InputField/InputField.js.map +1 -1
- package/dist/components/InputField/InputField.stories.js +25 -17
- package/dist/components/InputField/InputField.stories.js.map +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
._input-field-
|
|
1
|
+
._input-field-wrapper_z4v9l_1{align-items:center;display:flex;position:relative}._input-field_z4v9l_1{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:transparent;border:1px solid;border-radius:.5rem;color:var(--color-black);flex:1;font-family:inherit;font-size:inherit;height:2.75rem;margin:0;padding:0 1rem;text-align:inherit}._input-field--large_z4v9l_22{height:3rem}._input-field--small_z4v9l_26{max-width:5.25rem}._input-field--compact_z4v9l_30{max-width:6.25rem}._input-field--white_z4v9l_34{background-color:var(--color-white)}._input-field_z4v9l_1:disabled{color:var(--color-scarpa-flow)}._input-field__clear-button_z4v9l_42{align-items:center;background:none;border:none;cursor:pointer;display:flex;height:100%;padding:0 1rem 0 .5rem;position:absolute;right:0}
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
--color-amour: #ffe5ec;
|
|
42
42
|
--color-dandelion: #ffde66;
|
|
43
43
|
--color-natural-wood: #fff6d6;
|
|
44
|
-
--color-uva-black: #
|
|
44
|
+
--color-uva-black: #1F1D20;
|
|
45
45
|
--color-uva-red-transparent: rgba(189 0 50 / 10%);
|
|
46
|
-
--color-electric-violet: #
|
|
46
|
+
--color-electric-violet: #9747FF;
|
|
47
47
|
--color-lemon-grass: #99998a;
|
|
48
48
|
--color-vista-blue: #8feabb;
|
|
49
49
|
--color-medium-aquamarine: #62df9f;
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
--color-columbia-blue: #a1e7fc;
|
|
54
54
|
--color-light-cyan: #e1f8ff;
|
|
55
55
|
--color-lavender-transparent: rgba(235 235 236 / 50%);
|
|
56
|
-
--color-natural-wool: #
|
|
56
|
+
--color-natural-wool: #FFF6D6;
|
|
57
57
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { InputHTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
export interface InputFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'className' | 'style'> {
|
|
3
|
-
/** The variant to render.
|
|
3
|
+
/** The variant to render. */
|
|
4
4
|
variant?: 'large';
|
|
5
|
-
/** The width to render.
|
|
6
|
-
width?: 'compact';
|
|
5
|
+
/** The width to render. */
|
|
6
|
+
width?: 'small' | 'compact';
|
|
7
7
|
/** The type of the input element. */
|
|
8
8
|
type?: 'text' | 'password' | 'email';
|
|
9
|
+
/** The background color of the input. InputField is by default transparent. */
|
|
10
|
+
background?: 'white';
|
|
9
11
|
/** The id of the input element. */
|
|
10
12
|
id: string;
|
|
11
13
|
/** An element that represents a clear button. */
|
|
@@ -1,57 +1,61 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { jsxs as z, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as v, useState as b, useRef as g, useEffect as x } from "react";
|
|
3
3
|
import { c as y } from "../../clsx-OuTLNxxd.js";
|
|
4
|
-
import '../../assets/InputField.css';const
|
|
5
|
-
"input-field-wrapper": "_input-field-
|
|
6
|
-
"input-field": "_input-
|
|
7
|
-
"input-field--large": "_input-field--
|
|
8
|
-
"input-field--
|
|
9
|
-
"input-
|
|
10
|
-
|
|
4
|
+
import '../../assets/InputField.css';const t = {
|
|
5
|
+
"input-field-wrapper": "_input-field-wrapper_z4v9l_1",
|
|
6
|
+
"input-field": "_input-field_z4v9l_1",
|
|
7
|
+
"input-field--large": "_input-field--large_z4v9l_22",
|
|
8
|
+
"input-field--small": "_input-field--small_z4v9l_26",
|
|
9
|
+
"input-field--compact": "_input-field--compact_z4v9l_30",
|
|
10
|
+
"input-field--white": "_input-field--white_z4v9l_34",
|
|
11
|
+
"input-field__clear-button": "_input-field__clear-button_z4v9l_42"
|
|
12
|
+
}, W = v(
|
|
11
13
|
({
|
|
12
|
-
autoComplete:
|
|
13
|
-
id:
|
|
14
|
+
autoComplete: s = "off",
|
|
15
|
+
id: u,
|
|
14
16
|
value: e,
|
|
15
|
-
variant:
|
|
16
|
-
width:
|
|
17
|
-
type:
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
variant: _,
|
|
18
|
+
width: p,
|
|
19
|
+
type: o = "text",
|
|
20
|
+
background: r,
|
|
21
|
+
clearTrigger: l,
|
|
22
|
+
onClear: f,
|
|
20
23
|
...a
|
|
21
|
-
},
|
|
22
|
-
const [
|
|
24
|
+
}, i) => {
|
|
25
|
+
const [d, m] = b(0), n = g(null);
|
|
23
26
|
x(() => {
|
|
24
|
-
|
|
27
|
+
n.current && m(n.current.offsetWidth);
|
|
25
28
|
}, [e]);
|
|
26
|
-
const
|
|
27
|
-
|
|
29
|
+
const h = () => {
|
|
30
|
+
f && i && "current" in i && i.current && (f(), i.current.focus());
|
|
28
31
|
};
|
|
29
|
-
return /* @__PURE__ */
|
|
30
|
-
/* @__PURE__ */
|
|
32
|
+
return /* @__PURE__ */ z("div", { className: t["input-field-wrapper"], children: [
|
|
33
|
+
/* @__PURE__ */ c(
|
|
31
34
|
"input",
|
|
32
35
|
{
|
|
33
36
|
...a,
|
|
34
|
-
autoComplete:
|
|
35
|
-
ref:
|
|
36
|
-
id:
|
|
37
|
-
className: y(
|
|
38
|
-
[
|
|
39
|
-
[
|
|
37
|
+
autoComplete: s,
|
|
38
|
+
ref: i,
|
|
39
|
+
id: u,
|
|
40
|
+
className: y(t["input-field"], {
|
|
41
|
+
[t["input-field--large"]]: _ === "large",
|
|
42
|
+
[t[`input-field--${p}`]]: p,
|
|
43
|
+
[t[`input-field--${r}`]]: r
|
|
40
44
|
}),
|
|
41
|
-
type:
|
|
45
|
+
type: o,
|
|
42
46
|
value: e,
|
|
43
|
-
style: { paddingRight: e &&
|
|
47
|
+
style: { paddingRight: e && l ? d : void 0 }
|
|
44
48
|
}
|
|
45
49
|
),
|
|
46
|
-
e &&
|
|
50
|
+
e && l && /* @__PURE__ */ c(
|
|
47
51
|
"button",
|
|
48
52
|
{
|
|
49
53
|
type: "button",
|
|
50
|
-
className:
|
|
51
|
-
onClick:
|
|
52
|
-
ref:
|
|
53
|
-
"aria-label": `clear trigger for ${
|
|
54
|
-
children:
|
|
54
|
+
className: t["input-field__clear-button"],
|
|
55
|
+
onClick: h,
|
|
56
|
+
ref: n,
|
|
57
|
+
"aria-label": `clear trigger for ${u}`,
|
|
58
|
+
children: l
|
|
55
59
|
}
|
|
56
60
|
)
|
|
57
61
|
] });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputField.js","sources":["../../../src/components/InputField/InputField.tsx"],"sourcesContent":["import { forwardRef, useEffect, useRef, useState } from 'react';\nimport { clsx } from 'clsx';\n\nimport type { InputHTMLAttributes, ReactNode } from 'react';\n\nimport styles from './InputField.module.css';\n\nexport interface InputFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'className' | 'style'> {\n /** The variant to render.
|
|
1
|
+
{"version":3,"file":"InputField.js","sources":["../../../src/components/InputField/InputField.tsx"],"sourcesContent":["import { forwardRef, useEffect, useRef, useState } from 'react';\nimport { clsx } from 'clsx';\n\nimport type { InputHTMLAttributes, ReactNode } from 'react';\n\nimport styles from './InputField.module.css';\n\nexport interface InputFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'className' | 'style'> {\n /** The variant to render. */\n variant?: 'large';\n /** The width to render. */\n width?: 'small' | 'compact';\n /** The type of the input element. */\n type?: 'text' | 'password' | 'email';\n /** The background color of the input. InputField is by default transparent. */\n background?: 'white';\n /** The id of the input element. */\n id: string;\n /** An element that represents a clear button. */\n clearTrigger?: ReactNode;\n /** The callback that is invoked when the clear button is triggered. */\n onClear?: () => void;\n}\n\n/** Represents a component that renders an input field which can have a clear button. */\nexport const InputField = forwardRef<HTMLInputElement, InputFieldProps>(\n (\n {\n autoComplete = 'off',\n id,\n value,\n variant,\n width,\n type = 'text',\n background,\n clearTrigger,\n onClear,\n ...restProps\n }: InputFieldProps,\n forwardedRef\n ) => {\n const [clearButtonWidth, setClearButtonWidth] = useState<number>(0);\n const clearButtonRef = useRef<HTMLButtonElement>(null);\n\n useEffect(() => {\n if (clearButtonRef.current) {\n setClearButtonWidth(clearButtonRef.current.offsetWidth);\n }\n }, [value]);\n\n const handleClearTriggerClick = () => {\n if (onClear && forwardedRef && 'current' in forwardedRef && forwardedRef.current) {\n onClear();\n forwardedRef.current.focus();\n }\n };\n\n return (\n <div className={styles['input-field-wrapper']}>\n <input\n {...restProps}\n autoComplete={autoComplete}\n ref={forwardedRef}\n id={id}\n className={clsx(styles['input-field'], {\n [styles['input-field--large']]: variant === 'large',\n [styles[`input-field--${width}`]]: width,\n [styles[`input-field--${background}`]]: background,\n })}\n type={type}\n value={value}\n style={{ paddingRight: value && clearTrigger ? clearButtonWidth : undefined }}\n />\n {value && clearTrigger && (\n <button\n type=\"button\"\n className={styles['input-field__clear-button']}\n onClick={handleClearTriggerClick}\n ref={clearButtonRef}\n aria-label={`clear trigger for ${id}`}\n >\n {clearTrigger}\n </button>\n )}\n </div>\n );\n }\n);\n"],"names":["InputField","forwardRef","autoComplete","id","value","variant","width","type","background","clearTrigger","onClear","restProps","forwardedRef","clearButtonWidth","setClearButtonWidth","useState","clearButtonRef","useRef","useEffect","handleClearTriggerClick","jsxs","styles","jsx","clsx"],"mappings":";;;;;;;;;;;GAyBaA,IAAaC;AAAA,EACxB,CACE;AAAA,IACE,cAAAC,IAAe;AAAA,IACf,IAAAC;AAAA,IACA,OAAAC;AAAA,IACA,SAAAC;AAAA,IACA,OAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,YAAAC;A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-
import { jsx as
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import { useState as d, useRef as g } from "react";
|
|
3
|
-
import { fn as
|
|
4
|
-
import { InputField as
|
|
3
|
+
import { fn as l } from "../../index-BCvy9BiK.js";
|
|
4
|
+
import { InputField as e } from "./InputField.js";
|
|
5
5
|
import { Container as u } from "../../storyComponents/Container/Container.js";
|
|
6
|
-
import { Icon as
|
|
6
|
+
import { Icon as h } from "../Icon/Icon.js";
|
|
7
7
|
import "../Buttons/Button.js";
|
|
8
8
|
import "../Buttons/LinkButton.js";
|
|
9
9
|
import "@react-aria/button";
|
|
@@ -25,25 +25,33 @@ import "../SelectListbox/SelectListbox.js";
|
|
|
25
25
|
import "../SelectListbox/SelectProvider.js";
|
|
26
26
|
import "../Sortable/components/SortableItem.js";
|
|
27
27
|
import "../../SortableProvider-DZggDO3M.js";
|
|
28
|
-
const
|
|
28
|
+
const f = `
|
|
29
29
|
// Has all HTMLInputElement props available except "className" and "style"
|
|
30
30
|
<InputField aria-labelledby={aria-labelledby} id={id} onChange={onChangeFunction}
|
|
31
31
|
value={value} type={type} clearTrigger={clearTrigger} />
|
|
32
|
-
`,
|
|
32
|
+
`, C = (t) => {
|
|
33
33
|
const r = t.variant ?? [];
|
|
34
34
|
return { ...t, variant: r.toString() };
|
|
35
35
|
}, Q = {
|
|
36
36
|
title: "Atoms/InputField",
|
|
37
|
-
component:
|
|
37
|
+
component: e,
|
|
38
38
|
argTypes: {
|
|
39
39
|
variant: {
|
|
40
40
|
options: ["large"],
|
|
41
41
|
control: "check"
|
|
42
42
|
},
|
|
43
|
+
width: {
|
|
44
|
+
control: "radio",
|
|
45
|
+
options: [void 0, "small", "compact"]
|
|
46
|
+
},
|
|
43
47
|
type: {
|
|
44
48
|
control: "radio",
|
|
45
49
|
options: ["text", "password", "email"]
|
|
46
50
|
},
|
|
51
|
+
background: {
|
|
52
|
+
control: "check",
|
|
53
|
+
options: ["white"]
|
|
54
|
+
},
|
|
47
55
|
id: {
|
|
48
56
|
control: "text"
|
|
49
57
|
},
|
|
@@ -54,23 +62,23 @@ const C = `
|
|
|
54
62
|
}
|
|
55
63
|
},
|
|
56
64
|
parameters: {
|
|
57
|
-
inspectComponent:
|
|
58
|
-
codeString:
|
|
65
|
+
inspectComponent: e,
|
|
66
|
+
codeString: f
|
|
59
67
|
}
|
|
60
68
|
}, a = (t) => {
|
|
61
|
-
const [r, n] = d(""),
|
|
62
|
-
n(c.target.value),
|
|
69
|
+
const [r, n] = d(""), p = g(null), m = (c) => {
|
|
70
|
+
n(c.target.value), l()("handleChange");
|
|
63
71
|
}, s = () => {
|
|
64
|
-
n(""),
|
|
72
|
+
n(""), l()("handleClear");
|
|
65
73
|
};
|
|
66
|
-
return /* @__PURE__ */
|
|
67
|
-
|
|
74
|
+
return /* @__PURE__ */ o(u, { children: /* @__PURE__ */ o(
|
|
75
|
+
e,
|
|
68
76
|
{
|
|
69
|
-
...
|
|
77
|
+
...C(t),
|
|
70
78
|
value: r,
|
|
71
79
|
onChange: m,
|
|
72
80
|
onClear: s,
|
|
73
|
-
ref:
|
|
81
|
+
ref: p
|
|
74
82
|
}
|
|
75
83
|
) });
|
|
76
84
|
}, i = {
|
|
@@ -89,7 +97,7 @@ b.args = {
|
|
|
89
97
|
const y = a.bind({});
|
|
90
98
|
y.args = {
|
|
91
99
|
...i,
|
|
92
|
-
clearTrigger: /* @__PURE__ */
|
|
100
|
+
clearTrigger: /* @__PURE__ */ o(h, { name: "Cross" })
|
|
93
101
|
};
|
|
94
102
|
export {
|
|
95
103
|
v as InputFieldExample,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputField.stories.js","sources":["../../../src/components/InputField/InputField.stories.tsx"],"sourcesContent":["import { useRef, useState } from 'react';\nimport { fn } from '@storybook/test';\n\nimport type { ChangeEvent } from 'react';\nimport type { Meta, StoryFn } from '@storybook/react';\nimport type { InputFieldProps } from './InputField';\n\nimport { InputField } from './InputField';\n\nimport { Container } from 'storyComponents/Container';\nimport { Icon } from 'components';\n\nconst codeString = `\n// Has all HTMLInputElement props available except \"className\" and \"style\" \n<InputField aria-labelledby={aria-labelledby} id={id} onChange={onChangeFunction}\n value={value} type={type} clearTrigger={clearTrigger} />\n`;\n\nconst transformArgs = (args: InputFieldProps) => {\n // args.variant is provided as an array because the control type is set to a checkbox. So this transforms the selected value into its proper value: a string\n const variantArray = (args.variant as unknown as string[]) ?? [];\n return { ...args, ...{ variant: variantArray.toString() } } as InputFieldProps;\n};\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n title: 'Atoms/InputField',\n component: InputField,\n argTypes: {\n variant: {\n options: ['large'],\n control: 'check',\n },\n type: {\n control: 'radio',\n options: ['text', 'password', 'email'],\n },\n id: {\n control: 'text',\n },\n autoComplete: {\n table: {\n disable: true,\n },\n },\n },\n parameters: {\n inspectComponent: InputField,\n codeString: codeString,\n },\n} as Meta<InputFieldProps>;\n\nconst Template: StoryFn<InputFieldProps> = (args) => {\n const [inputValue, setInputValue] = useState<InputFieldProps['value']>('');\n const inputRef = useRef<HTMLInputElement>(null);\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n setInputValue(event.target.value);\n fn()('handleChange');\n };\n\n const handleClear = () => {\n setInputValue('');\n fn()('handleClear');\n };\n\n return (\n <Container>\n <InputField\n {...transformArgs(args)}\n value={inputValue}\n onChange={handleChange}\n onClear={handleClear}\n ref={inputRef}\n />\n </Container>\n );\n};\n\nconst defaultArgs: Partial<InputFieldProps> = {\n type: 'text',\n variant: undefined,\n id: '4f9ca77d',\n};\n\nexport const InputFieldExample = Template.bind({});\nInputFieldExample.args = {\n ...defaultArgs,\n};\n\nexport const WithStringClearTrigger = Template.bind({});\nWithStringClearTrigger.args = {\n ...defaultArgs,\n clearTrigger: 'Clear',\n};\n\nexport const WithIconClearTrigger = Template.bind({});\nWithIconClearTrigger.args = {\n ...defaultArgs,\n clearTrigger: <Icon name=\"Cross\" />,\n};\n"],"names":["codeString","transformArgs","args","variantArray","InputField_stories","InputField","Template","inputValue","setInputValue","useState","inputRef","useRef","handleChange","event","fn","handleClear","Container","jsx","defaultArgs","InputFieldExample","WithStringClearTrigger","WithIconClearTrigger","Icon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,MAAMA,IAAa;AAAA;AAAA;AAAA;AAAA,GAMbC,IAAgB,CAACC,MAA0B;AAEzC,QAAAC,IAAgBD,EAAK,WAAmC,CAAC;AACxD,SAAA,EAAE,GAAGA,GAAW,SAASC,EAAa,SAAS,EAAI;AAC5D,GAGeC,IAAA;AAAA,EACb,OAAO;AAAA,EACP,WAAWC;AAAA,EACX,UAAU;AAAA,IACR,SAAS;AAAA,MACP,SAAS,CAAC,OAAO;AAAA,MACjB,SAAS;AAAA,IACX;AAAA,IACA,MAAM;AAAA,MACJ,SAAS;AAAA,MACT,SAAS,CAAC,QAAQ,YAAY,OAAO;AAAA,IACvC;AAAA,IACA,IAAI;AAAA,MACF,SAAS;AAAA,IACX;AAAA,IACA,cAAc;AAAA,MACZ,OAAO;AAAA,QACL,SAAS;AAAA,MAAA;AAAA,IACX;AAAA,EAEJ;AAAA,EACA,YAAY;AAAA,IACV,kBAAkBA;AAAA,IAClB,YAAAL;AAAA,EAAA;AAEJ,GAEMM,IAAqC,CAACJ,MAAS;AACnD,QAAM,CAACK,GAAYC,CAAa,IAAIC,EAAmC,EAAE,GACnEC,IAAWC,EAAyB,IAAI,GAExCC,IAAe,CAACC,MAAyC;AAC/C,IAAAL,EAAAK,EAAM,OAAO,KAAK,GAChCC,EAAA,EAAK,cAAc;AAAA,EACrB,GAEMC,IAAc,MAAM;AACxB,IAAAP,EAAc,EAAE,GAChBM,EAAA,EAAK,aAAa;AAAA,EACpB;AAEA,2BACGE,GACC,EAAA,UAAA,gBAAAC;AAAA,IAACZ;AAAA,IAAA;AAAA,MACE,GAAGJ,EAAcC,CAAI;AAAA,MACtB,OAAOK;AAAA,MACP,UAAUK;AAAA,MACV,SAASG;AAAA,MACT,KAAKL;AAAA,IAAA;AAAA,EAAA,GAET;AAEJ,GAEMQ,IAAwC;AAAA,EAC5C,MAAM;AAAA,EACN,SAAS;AAAA,EACT,IAAI;AACN,GAEaC,IAAoBb,EAAS,KAAK,CAAE,CAAA;AACjDa,EAAkB,OAAO;AAAA,EACvB,GAAGD;AACL;AAEO,MAAME,IAAyBd,EAAS,KAAK,CAAE,CAAA;AACtDc,EAAuB,OAAO;AAAA,EAC5B,GAAGF;AAAA,EACH,cAAc;AAChB;AAEO,MAAMG,IAAuBf,EAAS,KAAK,CAAE,CAAA;AACpDe,EAAqB,OAAO;AAAA,EAC1B,GAAGH;AAAA,EACH,cAAc,gBAAAD,EAACK,GAAK,EAAA,MAAK,QAAQ,CAAA;AACnC;"}
|
|
1
|
+
{"version":3,"file":"InputField.stories.js","sources":["../../../src/components/InputField/InputField.stories.tsx"],"sourcesContent":["import { useRef, useState } from 'react';\nimport { fn } from '@storybook/test';\n\nimport type { ChangeEvent } from 'react';\nimport type { Meta, StoryFn } from '@storybook/react';\nimport type { InputFieldProps } from './InputField';\n\nimport { InputField } from './InputField';\n\nimport { Container } from 'storyComponents/Container';\nimport { Icon } from 'components';\n\nconst codeString = `\n// Has all HTMLInputElement props available except \"className\" and \"style\" \n<InputField aria-labelledby={aria-labelledby} id={id} onChange={onChangeFunction}\n value={value} type={type} clearTrigger={clearTrigger} />\n`;\n\nconst transformArgs = (args: InputFieldProps) => {\n // args.variant is provided as an array because the control type is set to a checkbox. So this transforms the selected value into its proper value: a string\n const variantArray = (args.variant as unknown as string[]) ?? [];\n return { ...args, ...{ variant: variantArray.toString() } } as InputFieldProps;\n};\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n title: 'Atoms/InputField',\n component: InputField,\n argTypes: {\n variant: {\n options: ['large'],\n control: 'check',\n },\n width: {\n control: 'radio',\n options: [undefined, 'small', 'compact'],\n },\n type: {\n control: 'radio',\n options: ['text', 'password', 'email'],\n },\n background: {\n control: 'check',\n options: ['white'],\n },\n id: {\n control: 'text',\n },\n autoComplete: {\n table: {\n disable: true,\n },\n },\n },\n parameters: {\n inspectComponent: InputField,\n codeString: codeString,\n },\n} as Meta<InputFieldProps>;\n\nconst Template: StoryFn<InputFieldProps> = (args) => {\n const [inputValue, setInputValue] = useState<InputFieldProps['value']>('');\n const inputRef = useRef<HTMLInputElement>(null);\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n setInputValue(event.target.value);\n fn()('handleChange');\n };\n\n const handleClear = () => {\n setInputValue('');\n fn()('handleClear');\n };\n\n return (\n <Container>\n <InputField\n {...transformArgs(args)}\n value={inputValue}\n onChange={handleChange}\n onClear={handleClear}\n ref={inputRef}\n />\n </Container>\n );\n};\n\nconst defaultArgs: Partial<InputFieldProps> = {\n type: 'text',\n variant: undefined,\n id: '4f9ca77d',\n};\n\nexport const InputFieldExample = Template.bind({});\nInputFieldExample.args = {\n ...defaultArgs,\n};\n\nexport const WithStringClearTrigger = Template.bind({});\nWithStringClearTrigger.args = {\n ...defaultArgs,\n clearTrigger: 'Clear',\n};\n\nexport const WithIconClearTrigger = Template.bind({});\nWithIconClearTrigger.args = {\n ...defaultArgs,\n clearTrigger: <Icon name=\"Cross\" />,\n};\n"],"names":["codeString","transformArgs","args","variantArray","InputField_stories","InputField","Template","inputValue","setInputValue","useState","inputRef","useRef","handleChange","event","fn","handleClear","Container","jsx","defaultArgs","InputFieldExample","WithStringClearTrigger","WithIconClearTrigger","Icon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,MAAMA,IAAa;AAAA;AAAA;AAAA;AAAA,GAMbC,IAAgB,CAACC,MAA0B;AAEzC,QAAAC,IAAgBD,EAAK,WAAmC,CAAC;AACxD,SAAA,EAAE,GAAGA,GAAW,SAASC,EAAa,SAAS,EAAI;AAC5D,GAGeC,IAAA;AAAA,EACb,OAAO;AAAA,EACP,WAAWC;AAAA,EACX,UAAU;AAAA,IACR,SAAS;AAAA,MACP,SAAS,CAAC,OAAO;AAAA,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cAAc;AAChB;AAEO,MAAMG,IAAuBf,EAAS,KAAK,CAAE,CAAA;AACpDe,EAAqB,OAAO;AAAA,EAC1B,GAAGH;AAAA,EACH,cAAc,gBAAAD,EAACK,GAAK,EAAA,MAAK,QAAQ,CAAA;AACnC;"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@uva-glass/component-library",
|
|
3
3
|
"author": "Team Glass - Frontend vrienden",
|
|
4
4
|
"private": false,
|
|
5
|
-
"version": "3.
|
|
5
|
+
"version": "3.13.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"types": "dist/index.d.ts",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"babel-plugin-transform-vite-meta-env": "^1.0.3",
|
|
75
75
|
"clsx": "^2.1.1",
|
|
76
76
|
"eslint-plugin-react-hooks": "^6.0.0",
|
|
77
|
-
"glob": "^11.0.
|
|
77
|
+
"glob": "^11.0.2",
|
|
78
78
|
"husky": "^9.1.7",
|
|
79
79
|
"identity-obj-proxy": "^3.0.0",
|
|
80
80
|
"jest": "^29.7.0",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"semantic-release": "^24.2.3",
|
|
89
89
|
"storybook": "^8.6.12",
|
|
90
90
|
"style-dictionary": "^4.3.3",
|
|
91
|
-
"stylelint": "^16.
|
|
91
|
+
"stylelint": "^16.19.0",
|
|
92
92
|
"stylelint-config-recommended": "^16.0.0",
|
|
93
93
|
"stylelint-config-standard": "^38.0.0",
|
|
94
94
|
"stylelint-order": "^7.0.0",
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"vite-plugin-static-copy": "^2.3.1",
|
|
100
100
|
"vite-plugin-svgr": "^4.3.0",
|
|
101
101
|
"vite-tsconfig-paths": "^5.1.4",
|
|
102
|
-
"vite": "^6.3.
|
|
102
|
+
"vite": "^6.3.3"
|
|
103
103
|
},
|
|
104
104
|
"dependencies": {
|
|
105
105
|
"@babel/preset-env": "^7.26.9",
|
|
@@ -113,8 +113,8 @@
|
|
|
113
113
|
},
|
|
114
114
|
"optionalDependencies": {
|
|
115
115
|
"@rollup/rollup-linux-x64-gnu": "^4.40.0",
|
|
116
|
-
"@rspack/binding-darwin-arm64": "1.3.
|
|
117
|
-
"@rspack/binding-linux-x64-gnu": "1.3.
|
|
116
|
+
"@rspack/binding-darwin-arm64": "1.3.6",
|
|
117
|
+
"@rspack/binding-linux-x64-gnu": "1.3.6",
|
|
118
118
|
"@ast-grep/napi-linux-x64-gnu": "0.37.0"
|
|
119
119
|
}
|
|
120
120
|
}
|