@phillips/seldon 1.4.1 → 1.6.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/_virtual/_commonjsHelpers.js +5 -3
- package/dist/_virtual/index2.js +4 -0
- package/dist/components/Button/Button.d.ts +4 -4
- package/dist/components/Button/Button.js +7 -7
- package/dist/components/DatePicker/DatePicker.d.ts +90 -0
- package/dist/components/DatePicker/DatePicker.js +92 -0
- package/dist/components/Header/Header.js +16 -16
- package/dist/components/Input/Input.d.ts +77 -0
- package/dist/components/Input/Input.js +65 -0
- package/dist/components/Select/Select.d.ts +10 -0
- package/dist/components/Select/Select.js +61 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +14 -8
- package/dist/node_modules/flatpickr/dist/esm/index.js +947 -0
- package/dist/node_modules/flatpickr/dist/esm/l10n/default.js +75 -0
- package/dist/node_modules/flatpickr/dist/esm/types/options.js +80 -0
- package/dist/node_modules/flatpickr/dist/esm/utils/dates.js +90 -0
- package/dist/node_modules/flatpickr/dist/esm/utils/dom.js +45 -0
- package/dist/node_modules/flatpickr/dist/esm/utils/formatting.js +170 -0
- package/dist/node_modules/flatpickr/dist/esm/utils/index.js +23 -0
- package/dist/node_modules/flatpickr/dist/esm/utils/polyfills.js +15 -0
- package/dist/node_modules/flatpickr/dist/l10n/index.js +3471 -0
- package/dist/scss/_typography.scss +30 -10
- package/dist/scss/_utils.scss +38 -0
- package/dist/scss/_vars.scss +12 -1
- package/dist/scss/components/Button/_button.scss +21 -14
- package/dist/scss/components/DatePicker/_datePicker.scss +81 -0
- package/dist/scss/components/Input/_input.scss +165 -0
- package/dist/scss/components/Toggle/_toggle.scss +179 -0
- package/dist/scss/styles.scss +6 -0
- package/dist/utils/index.d.ts +56 -0
- package/dist/utils/index.js +41 -2
- package/package.json +3 -3
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
var o = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
2
|
+
function l(e) {
|
|
3
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
3
4
|
}
|
|
4
5
|
export {
|
|
5
|
-
|
|
6
|
+
o as commonjsGlobal,
|
|
7
|
+
l as getDefaultExportFromCjs
|
|
6
8
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
interface ButtonProps {
|
|
1
|
+
export interface ButtonProps {
|
|
2
2
|
/**
|
|
3
3
|
* Is this the principal call to action on the page?
|
|
4
4
|
*/
|
|
@@ -10,11 +10,11 @@ interface ButtonProps {
|
|
|
10
10
|
/**
|
|
11
11
|
* How large should the button be?
|
|
12
12
|
*/
|
|
13
|
-
size?: '
|
|
13
|
+
size?: 'sm' | 'md' | 'lg';
|
|
14
14
|
/**
|
|
15
15
|
* Button contents
|
|
16
16
|
*/
|
|
17
|
-
|
|
17
|
+
children: React.ReactNode;
|
|
18
18
|
/**
|
|
19
19
|
* Unique id for component
|
|
20
20
|
*/
|
|
@@ -27,5 +27,5 @@ interface ButtonProps {
|
|
|
27
27
|
/**
|
|
28
28
|
* Primary UI component for user interaction
|
|
29
29
|
*/
|
|
30
|
-
declare const Button: ({ primary, size, backgroundColor,
|
|
30
|
+
declare const Button: ({ primary, size, backgroundColor, children, id, ...props }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
31
31
|
export default Button;
|
|
@@ -2,22 +2,22 @@ import { jsx as a } from "react/jsx-runtime";
|
|
|
2
2
|
import m from "../../node_modules/classnames/index.js";
|
|
3
3
|
import { px as o } from "../../utils/index.js";
|
|
4
4
|
const c = ({
|
|
5
|
-
primary: n = !
|
|
6
|
-
size:
|
|
5
|
+
primary: n = !0,
|
|
6
|
+
size: r = "md",
|
|
7
7
|
backgroundColor: s,
|
|
8
|
-
|
|
8
|
+
children: u,
|
|
9
9
|
id: t,
|
|
10
|
-
...
|
|
10
|
+
...e
|
|
11
11
|
}) => /* @__PURE__ */ a(
|
|
12
12
|
"button",
|
|
13
13
|
{
|
|
14
14
|
"data-testid": t ? `button-${t}` : "button",
|
|
15
15
|
id: t,
|
|
16
16
|
type: "button",
|
|
17
|
-
className: m(`${o}-button`, `${o}-button--${
|
|
17
|
+
className: m(`${o}-button`, `${o}-button--${r}`, { [`${o}-button--secondary`]: !n }),
|
|
18
18
|
style: { backgroundColor: s },
|
|
19
|
-
...
|
|
20
|
-
children:
|
|
19
|
+
...e,
|
|
20
|
+
children: u
|
|
21
21
|
}
|
|
22
22
|
);
|
|
23
23
|
export {
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import flatpickr from 'flatpickr';
|
|
3
|
+
import { InputProps } from '../Input/Input';
|
|
4
|
+
export interface DatePickerProps extends Omit<InputProps, 'defaultValue'>, Record<string, unknown> {
|
|
5
|
+
/**
|
|
6
|
+
* Optionally allow manual entry to the date input
|
|
7
|
+
*/
|
|
8
|
+
allowInput?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Optionally provide the default value of the `<input>`. Should not be passed into controlled input!
|
|
11
|
+
*/
|
|
12
|
+
defaultValue?: (Date | string)[];
|
|
13
|
+
/**
|
|
14
|
+
* Booolean to specify whether the `<input>` should be disabled
|
|
15
|
+
*/
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Render time picker on dropdown
|
|
19
|
+
*/
|
|
20
|
+
enableTime?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Boolean to specify whether you want the underlying label to be visually hidden
|
|
23
|
+
*/
|
|
24
|
+
hideLabel?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* A custom `id` for the `<input>`
|
|
27
|
+
*/
|
|
28
|
+
id: string;
|
|
29
|
+
/**
|
|
30
|
+
* Boolean to dictate whether input is inline with the label or not. `true` to use the inline version.
|
|
31
|
+
*/
|
|
32
|
+
inline?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Boolean to specify whether the control is currently invalid
|
|
35
|
+
*/
|
|
36
|
+
invalid?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Validation text that is displayed when the control is in an invalid state
|
|
39
|
+
*/
|
|
40
|
+
invalidText?: React.ReactNode;
|
|
41
|
+
/**
|
|
42
|
+
* Text that will be read by a screen reader when visiting this control
|
|
43
|
+
*/
|
|
44
|
+
labelText: string;
|
|
45
|
+
/**
|
|
46
|
+
* Locatiion you want the calendar to render for
|
|
47
|
+
*/
|
|
48
|
+
locale: string;
|
|
49
|
+
/**
|
|
50
|
+
* Optional `onChange` handler that is called whenever flatpickr is updated
|
|
51
|
+
* @param {array} selectedDates
|
|
52
|
+
* @param {string} dateStr
|
|
53
|
+
* @param {object} instance
|
|
54
|
+
*/
|
|
55
|
+
onChange?: flatpickr.Options.Hook;
|
|
56
|
+
/**
|
|
57
|
+
* Optional `onClick` handler that is called whenever the `<input>` is clicked
|
|
58
|
+
*/
|
|
59
|
+
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
60
|
+
/**
|
|
61
|
+
* Optional text to be used for the placeholder attribute of the `<input>`
|
|
62
|
+
*/
|
|
63
|
+
placeholder?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Boolean to deterimine whether the input should be read-only
|
|
66
|
+
*/
|
|
67
|
+
readOnly?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Enum to determine the height of the Text Input. Currently supports the following:
|
|
70
|
+
*/
|
|
71
|
+
size?: 'sm' | 'md' | 'lg';
|
|
72
|
+
/**
|
|
73
|
+
* Enum to determine whether component is a range or range and time
|
|
74
|
+
*/
|
|
75
|
+
type?: 'single' | 'range';
|
|
76
|
+
/**
|
|
77
|
+
* Specify the value of the `<input>` for controlled inputs
|
|
78
|
+
*/
|
|
79
|
+
value?: string | number | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* Boolean to specify whether the control is currently in warning state
|
|
82
|
+
*/
|
|
83
|
+
warn?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Text that is displayed when the control is in warning state
|
|
86
|
+
*/
|
|
87
|
+
warnText?: React.ReactNode;
|
|
88
|
+
}
|
|
89
|
+
declare const DatePicker: React.ForwardRefExoticComponent<Omit<DatePickerProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
90
|
+
export default DatePicker;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { jsx as G } from "react/jsx-runtime";
|
|
2
|
+
import * as d from "react";
|
|
3
|
+
import O from "../../node_modules/flatpickr/dist/esm/index.js";
|
|
4
|
+
import k from "../../node_modules/flatpickr/dist/l10n/index.js";
|
|
5
|
+
import { noOP as R, useNormalizedInputProps as J } from "../../utils/index.js";
|
|
6
|
+
import Q from "../Input/Input.js";
|
|
7
|
+
k.en.weekdays.shorthand.forEach((u, o) => {
|
|
8
|
+
const c = k.en.weekdays.shorthand;
|
|
9
|
+
c[o] === "Thu" || c[o] === "Th" ? c[o] = "Th" : c[o] = c[o].charAt(0);
|
|
10
|
+
});
|
|
11
|
+
const W = d.forwardRef(({
|
|
12
|
+
allowInput: u = !1,
|
|
13
|
+
className: o,
|
|
14
|
+
defaultValue: c = [],
|
|
15
|
+
disabled: S,
|
|
16
|
+
enableTime: p = !1,
|
|
17
|
+
hideLabel: z,
|
|
18
|
+
id: a,
|
|
19
|
+
inline: A,
|
|
20
|
+
invalid: y,
|
|
21
|
+
invalidText: g,
|
|
22
|
+
labelText: H,
|
|
23
|
+
locale: D = "en",
|
|
24
|
+
onChange: f = R,
|
|
25
|
+
onClick: M = R,
|
|
26
|
+
placeholder: U,
|
|
27
|
+
readOnly: P,
|
|
28
|
+
size: _ = "md",
|
|
29
|
+
type: l = "range",
|
|
30
|
+
value: $,
|
|
31
|
+
warn: b,
|
|
32
|
+
warnText: j,
|
|
33
|
+
...q
|
|
34
|
+
}, e) => {
|
|
35
|
+
const m = J({ disabled: S, id: a, invalid: y, invalidText: g, readOnly: P, type: l, warn: b, warnText: j }), t = d.useRef(), s = d.useRef(), r = d.useRef();
|
|
36
|
+
d.useEffect(
|
|
37
|
+
() => {
|
|
38
|
+
const n = {
|
|
39
|
+
allowInput: u,
|
|
40
|
+
clickOpens: !m.disabled,
|
|
41
|
+
defaultDate: c,
|
|
42
|
+
enableTime: p,
|
|
43
|
+
locale: k[D],
|
|
44
|
+
mode: l,
|
|
45
|
+
onChange: f
|
|
46
|
+
};
|
|
47
|
+
return typeof e == "object" && (e != null && e.current) && (t.current = O(e.current, n)), e === null && typeof s == "object" && s != null && s.current && (t.current = O(s == null ? void 0 : s.current, n)), () => {
|
|
48
|
+
t.current && t.current.destroy && t.current.destroy();
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
[u, c, m.disabled, p, a, D, f, e, l]
|
|
52
|
+
);
|
|
53
|
+
const v = (n) => {
|
|
54
|
+
var i;
|
|
55
|
+
u && /[0-9-/:]+/g.test(n.key) && (r.current = (i = t == null ? void 0 : t.current) == null ? void 0 : i.selectedDates);
|
|
56
|
+
}, F = (n) => {
|
|
57
|
+
var i, E, N, T, B, K, L;
|
|
58
|
+
if (!(!u || n.relatedTarget instanceof HTMLElement && ((i = n.relatedTarget) != null && i.classList.value.includes("flatpickr"))) && "current" in r && (E = r == null ? void 0 : r.current) != null && E.length && ((N = r == null ? void 0 : r.current) == null ? void 0 : N.length) > 0 && ((T = r == null ? void 0 : r.current) == null ? void 0 : T.join().toString()) !== ((B = t == null ? void 0 : t.current) == null ? void 0 : B.selectedDates.join().toString())) {
|
|
59
|
+
const h = (K = t.current) == null ? void 0 : K.element;
|
|
60
|
+
r.current = [], f((L = t.current) == null ? void 0 : L.selectedDates, h == null ? void 0 : h.value, t.current);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
return /* @__PURE__ */ G(
|
|
64
|
+
Q,
|
|
65
|
+
{
|
|
66
|
+
className: `${o} flatpickr`,
|
|
67
|
+
"data-testid": a,
|
|
68
|
+
disabled: m.disabled,
|
|
69
|
+
hideLabel: z,
|
|
70
|
+
id: a,
|
|
71
|
+
inline: A,
|
|
72
|
+
invalid: y,
|
|
73
|
+
invalidText: g,
|
|
74
|
+
labelText: H,
|
|
75
|
+
onClick: M,
|
|
76
|
+
placeholder: U,
|
|
77
|
+
readOnly: P,
|
|
78
|
+
ref: e || s,
|
|
79
|
+
size: _,
|
|
80
|
+
value: $,
|
|
81
|
+
warn: b,
|
|
82
|
+
warnText: j,
|
|
83
|
+
onKeyUp: v,
|
|
84
|
+
onBlur: F,
|
|
85
|
+
...q
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
});
|
|
89
|
+
W.displayName = "DatePicker";
|
|
90
|
+
export {
|
|
91
|
+
W as default
|
|
92
|
+
};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as e, jsxs as l, Fragment as d } from "react/jsx-runtime";
|
|
2
2
|
import i from "../Button/Button.js";
|
|
3
|
-
const
|
|
4
|
-
/* @__PURE__ */
|
|
5
|
-
/* @__PURE__ */
|
|
6
|
-
/* @__PURE__ */
|
|
3
|
+
const a = ({ user: n, onLogin: r, onLogout: h, onCreateAccount: c }) => /* @__PURE__ */ e("header", { children: /* @__PURE__ */ l("div", { className: "storybook-header", children: [
|
|
4
|
+
/* @__PURE__ */ l("div", { children: [
|
|
5
|
+
/* @__PURE__ */ e("svg", { width: "32", height: "32", viewBox: "0 0 32 32", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ l("g", { fill: "none", fillRule: "evenodd", children: [
|
|
6
|
+
/* @__PURE__ */ e(
|
|
7
7
|
"path",
|
|
8
8
|
{
|
|
9
9
|
d: "M10 0h12a10 10 0 0110 10v12a10 10 0 01-10 10H10A10 10 0 010 22V10A10 10 0 0110 0z",
|
|
10
10
|
fill: "#FFF"
|
|
11
11
|
}
|
|
12
12
|
),
|
|
13
|
-
/* @__PURE__ */
|
|
13
|
+
/* @__PURE__ */ e(
|
|
14
14
|
"path",
|
|
15
15
|
{
|
|
16
16
|
d: "M5.3 10.6l10.4 6v11.1l-10.4-6v-11zm11.4-6.2l9.7 5.5-9.7 5.6V4.4z",
|
|
17
17
|
fill: "#555AB9"
|
|
18
18
|
}
|
|
19
19
|
),
|
|
20
|
-
/* @__PURE__ */
|
|
20
|
+
/* @__PURE__ */ e(
|
|
21
21
|
"path",
|
|
22
22
|
{
|
|
23
23
|
d: "M27.2 10.6v11.2l-10.5 6V16.5l10.5-6zM15.7 4.4v11L6 10l9.7-5.5z",
|
|
@@ -25,20 +25,20 @@ const s = ({ user: n, onLogin: d, onLogout: r, onCreateAccount: h }) => /* @__PU
|
|
|
25
25
|
}
|
|
26
26
|
)
|
|
27
27
|
] }) }),
|
|
28
|
-
/* @__PURE__ */
|
|
28
|
+
/* @__PURE__ */ e("h1", { children: "Acme" })
|
|
29
29
|
] }),
|
|
30
|
-
/* @__PURE__ */
|
|
31
|
-
/* @__PURE__ */
|
|
30
|
+
/* @__PURE__ */ e("div", { children: n ? /* @__PURE__ */ l(d, { children: [
|
|
31
|
+
/* @__PURE__ */ l("span", { className: "welcome", children: [
|
|
32
32
|
"Welcome, ",
|
|
33
|
-
/* @__PURE__ */
|
|
33
|
+
/* @__PURE__ */ e("b", { children: n.name }),
|
|
34
34
|
"!"
|
|
35
35
|
] }),
|
|
36
|
-
/* @__PURE__ */
|
|
37
|
-
] }) : /* @__PURE__ */
|
|
38
|
-
/* @__PURE__ */
|
|
39
|
-
/* @__PURE__ */
|
|
36
|
+
/* @__PURE__ */ e(i, { size: "sm", onClick: h, children: "Log out" })
|
|
37
|
+
] }) : /* @__PURE__ */ l(d, { children: [
|
|
38
|
+
/* @__PURE__ */ e(i, { size: "sm", onClick: r, children: "Log in" }),
|
|
39
|
+
/* @__PURE__ */ e(i, { primary: !0, size: "sm", onClick: c, children: "Sign up" })
|
|
40
40
|
] }) })
|
|
41
41
|
] }) });
|
|
42
42
|
export {
|
|
43
|
-
|
|
43
|
+
a as default
|
|
44
44
|
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface InputProps extends Record<string, unknown> {
|
|
3
|
+
/**
|
|
4
|
+
* Optional className to be applied to the `<input>` node
|
|
5
|
+
*/
|
|
6
|
+
className?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Optionally provide the default value of the `<input>`. Should not be passed into controlled input!
|
|
9
|
+
*/
|
|
10
|
+
defaultValue?: string | number;
|
|
11
|
+
/**
|
|
12
|
+
* Booolean to specify whether the `<input>` should be disabled
|
|
13
|
+
*/
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Boolean to specify whether you want the underlying label to be visually hidden
|
|
17
|
+
*/
|
|
18
|
+
hideLabel?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* A custom `id` for the `<input>`
|
|
21
|
+
*/
|
|
22
|
+
id: string;
|
|
23
|
+
/**
|
|
24
|
+
* Boolean to dictate whether input is inline with the label or not. `true` to use the inline version.
|
|
25
|
+
*/
|
|
26
|
+
inline?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Boolean to specify whether the control is currently invalid
|
|
29
|
+
*/
|
|
30
|
+
invalid?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Validation text that is displayed when the control is in an invalid state
|
|
33
|
+
*/
|
|
34
|
+
invalidText?: React.ReactNode;
|
|
35
|
+
/**
|
|
36
|
+
* Text that will be read by a screen reader when visiting this control
|
|
37
|
+
*/
|
|
38
|
+
labelText: string;
|
|
39
|
+
/**
|
|
40
|
+
* Optional `onChange` handler that is called whenever `<input>` is updated
|
|
41
|
+
*/
|
|
42
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement> | React.ChangeEvent<HTMLSelectElement>) => void;
|
|
43
|
+
/**
|
|
44
|
+
* Optional `onClick` handler that is called whenever the `<input>` is clicked
|
|
45
|
+
*/
|
|
46
|
+
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
47
|
+
/**
|
|
48
|
+
* Optional text to be used for the placeholder attribute of the `<input>`
|
|
49
|
+
*/
|
|
50
|
+
placeholder?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Boolean to deterimine whether the input should be read-only
|
|
53
|
+
*/
|
|
54
|
+
readOnly?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Enum to determine the height of the Text Input. Currently supports the following:
|
|
57
|
+
*/
|
|
58
|
+
size?: 'sm' | 'md' | 'lg';
|
|
59
|
+
/**
|
|
60
|
+
* String that determines the type of the `<input>` (e.g 'text', 'date', 'numeber', etc.)
|
|
61
|
+
*/
|
|
62
|
+
type?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Specify the value of the `<input>` for controlled inputs
|
|
65
|
+
*/
|
|
66
|
+
value?: string | number | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* Boolean to specify whether the control is currently in warning state
|
|
69
|
+
*/
|
|
70
|
+
warn?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Text that is displayed when the control is in warning state
|
|
73
|
+
*/
|
|
74
|
+
warnText?: React.ReactNode;
|
|
75
|
+
}
|
|
76
|
+
declare const Input: React.ForwardRefExoticComponent<Omit<InputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
77
|
+
export default Input;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsxs as P, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import * as R from "react";
|
|
3
|
+
import e from "../../node_modules/classnames/index.js";
|
|
4
|
+
import { px as t, useNormalizedInputProps as y } from "../../utils/index.js";
|
|
5
|
+
const z = R.forwardRef(({
|
|
6
|
+
className: p,
|
|
7
|
+
defaultValue: l,
|
|
8
|
+
disabled: u,
|
|
9
|
+
hideLabel: d,
|
|
10
|
+
id: n,
|
|
11
|
+
inline: o,
|
|
12
|
+
invalid: m,
|
|
13
|
+
invalidText: $,
|
|
14
|
+
labelText: c,
|
|
15
|
+
onChange: _,
|
|
16
|
+
onClick: b,
|
|
17
|
+
placeholder: f,
|
|
18
|
+
readOnly: a,
|
|
19
|
+
size: w = "md",
|
|
20
|
+
type: s = "text",
|
|
21
|
+
value: x,
|
|
22
|
+
warn: h,
|
|
23
|
+
warnText: v,
|
|
24
|
+
...I
|
|
25
|
+
}, N) => {
|
|
26
|
+
const i = y({ disabled: u, id: n, invalid: m, invalidText: $, readOnly: a, type: s, warn: h, warnText: v }), j = e(
|
|
27
|
+
`${t}-${s}-input`,
|
|
28
|
+
`${t}-input`,
|
|
29
|
+
`${t}-input--${w}`,
|
|
30
|
+
{
|
|
31
|
+
[`${t}-input--inline`]: o,
|
|
32
|
+
[`${t}-input--readonly`]: a,
|
|
33
|
+
[`${t}-input--disabled`]: i.disabled,
|
|
34
|
+
[`${t}-input--invalid`]: i.invalid,
|
|
35
|
+
[`${t}-input--warn`]: i.warn,
|
|
36
|
+
[`${p}__wrapper`]: p
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
return /* @__PURE__ */ P("div", { className: j, children: [
|
|
40
|
+
/* @__PURE__ */ r("label", { htmlFor: n, className: e(`${t}-input__label`, { [`${t}-input__label--hidden`]: d }), children: c }),
|
|
41
|
+
/* @__PURE__ */ r(
|
|
42
|
+
"input",
|
|
43
|
+
{
|
|
44
|
+
className: e(`${t}-input__input`, { className: p }),
|
|
45
|
+
"data-testid": n,
|
|
46
|
+
defaultValue: l,
|
|
47
|
+
disabled: i.disabled,
|
|
48
|
+
id: n,
|
|
49
|
+
onChange: _,
|
|
50
|
+
onClick: b,
|
|
51
|
+
placeholder: f,
|
|
52
|
+
readOnly: a,
|
|
53
|
+
ref: N,
|
|
54
|
+
type: i.type,
|
|
55
|
+
value: x,
|
|
56
|
+
...I
|
|
57
|
+
}
|
|
58
|
+
),
|
|
59
|
+
i.validation
|
|
60
|
+
] });
|
|
61
|
+
});
|
|
62
|
+
z.displayName = "Input";
|
|
63
|
+
export {
|
|
64
|
+
z as default
|
|
65
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { InputProps } from '../Input/Input';
|
|
3
|
+
export interface SelectProps extends InputProps {
|
|
4
|
+
/**
|
|
5
|
+
* Option elements that are selectable
|
|
6
|
+
*/
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
declare const Select: React.ForwardRefExoticComponent<Omit<SelectProps, "ref"> & React.RefAttributes<HTMLSelectElement>>;
|
|
10
|
+
export default Select;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsxs as R, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import * as y from "react";
|
|
3
|
+
import a from "../../node_modules/classnames/index.js";
|
|
4
|
+
import { px as t, useNormalizedInputProps as z } from "../../utils/index.js";
|
|
5
|
+
const S = y.forwardRef(({
|
|
6
|
+
children: r,
|
|
7
|
+
className: n,
|
|
8
|
+
defaultValue: o,
|
|
9
|
+
disabled: d,
|
|
10
|
+
hideLabel: u,
|
|
11
|
+
id: e,
|
|
12
|
+
inline: m,
|
|
13
|
+
invalid: $,
|
|
14
|
+
invalidText: c,
|
|
15
|
+
labelText: _,
|
|
16
|
+
onChange: b,
|
|
17
|
+
onClick: f,
|
|
18
|
+
readOnly: p,
|
|
19
|
+
size: w = "md",
|
|
20
|
+
value: h,
|
|
21
|
+
warn: v,
|
|
22
|
+
warnText: x,
|
|
23
|
+
...j
|
|
24
|
+
}, N) => {
|
|
25
|
+
const s = "select", i = z({ disabled: d, id: e, invalid: $, invalidText: c, readOnly: p, type: s, warn: v, warnText: x }), P = a(
|
|
26
|
+
`${t}-${s}-input`,
|
|
27
|
+
`${t}-input`,
|
|
28
|
+
`${t}-input--${w}`,
|
|
29
|
+
{
|
|
30
|
+
[`${t}-input--inline`]: m,
|
|
31
|
+
[`${t}-input--readonly`]: p,
|
|
32
|
+
[`${t}-input--disabled`]: i.disabled,
|
|
33
|
+
[`${t}-input--invalid`]: i.invalid,
|
|
34
|
+
[`${t}-input--warn`]: i.warn,
|
|
35
|
+
[`${n}__wrapper`]: n
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
return /* @__PURE__ */ R("div", { className: P, children: [
|
|
39
|
+
/* @__PURE__ */ l("label", { htmlFor: e, className: a(`${t}-input__label`, { [`${t}-input__label--hidden`]: u }), children: _ }),
|
|
40
|
+
/* @__PURE__ */ l(
|
|
41
|
+
"select",
|
|
42
|
+
{
|
|
43
|
+
className: a(`${t}-input__input`, { className: n }),
|
|
44
|
+
"data-testid": e,
|
|
45
|
+
defaultValue: o,
|
|
46
|
+
disabled: i.disabled,
|
|
47
|
+
id: e,
|
|
48
|
+
onChange: b,
|
|
49
|
+
onClick: f,
|
|
50
|
+
ref: N,
|
|
51
|
+
value: h,
|
|
52
|
+
...j,
|
|
53
|
+
children: r
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
i.validation
|
|
57
|
+
] });
|
|
58
|
+
});
|
|
59
|
+
export {
|
|
60
|
+
S as default
|
|
61
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export { default as Button } from './components/Button/Button';
|
|
2
|
+
export { default as DatePicker } from './components/DatePicker/DatePicker';
|
|
2
3
|
export { default as Header } from './components/Header/Header';
|
|
3
4
|
export { default as HeroBanner } from './components/HeroBanner/HeroBanner';
|
|
5
|
+
export { default as Input } from './components/Input/Input';
|
|
6
|
+
export { default as Select } from './components/Select/Select';
|
|
4
7
|
export { default as Page } from './pages/Page';
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import { default as
|
|
2
|
-
import { default as
|
|
3
|
-
import { default as
|
|
4
|
-
import { default as l } from "./
|
|
1
|
+
import { default as a } from "./components/Button/Button.js";
|
|
2
|
+
import { default as o } from "./components/DatePicker/DatePicker.js";
|
|
3
|
+
import { default as u } from "./components/Header/Header.js";
|
|
4
|
+
import { default as l } from "./components/HeroBanner/HeroBanner.js";
|
|
5
|
+
import { default as m } from "./components/Input/Input.js";
|
|
6
|
+
import { default as x } from "./components/Select/Select.js";
|
|
7
|
+
import { default as c } from "./pages/Page.js";
|
|
5
8
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
l as
|
|
9
|
+
a as Button,
|
|
10
|
+
o as DatePicker,
|
|
11
|
+
u as Header,
|
|
12
|
+
l as HeroBanner,
|
|
13
|
+
m as Input,
|
|
14
|
+
c as Page,
|
|
15
|
+
x as Select
|
|
10
16
|
};
|