@phillips/seldon 1.4.0 → 1.5.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.
@@ -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,64 @@
1
+ import { jsxs as P, jsx as s } 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 z } from "../../utils/index.js";
5
+ const k = R.forwardRef(({
6
+ className: p,
7
+ defaultValue: l,
8
+ disabled: o,
9
+ hideLabel: u,
10
+ id: n,
11
+ inline: d,
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: r = "text",
21
+ value: x,
22
+ warn: h,
23
+ warnText: v,
24
+ ...j
25
+ }, I) => {
26
+ const i = z({ disabled: o, id: n, invalid: m, invalidText: $, readOnly: a, type: r, warn: h, warnText: v }), N = e(
27
+ `${t}-${r}-input`,
28
+ `${t}-input`,
29
+ `${t}-input--${w}`,
30
+ {
31
+ [`${t}-input--inline`]: d,
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: N, children: [
40
+ /* @__PURE__ */ s("label", { htmlFor: n, className: e(`${t}-input__label`, { [`${t}-input__label--hidden`]: u }), children: c }),
41
+ /* @__PURE__ */ s(
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: I,
54
+ type: i.type,
55
+ value: x,
56
+ ...j
57
+ }
58
+ ),
59
+ i.validation
60
+ ] });
61
+ });
62
+ export {
63
+ k as default
64
+ };
@@ -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,6 @@
1
1
  export { default as Button } from './components/Button/Button';
2
2
  export { default as Header } from './components/Header/Header';
3
3
  export { default as HeroBanner } from './components/HeroBanner/HeroBanner';
4
+ export { default as Input } from './components/Input/Input';
5
+ export { default as Select } from './components/Select/Select';
4
6
  export { default as Page } from './pages/Page';
package/dist/index.js CHANGED
@@ -1,10 +1,14 @@
1
- import { default as r } from "./components/Button/Button.js";
2
- import { default as t } from "./components/Header/Header.js";
3
- import { default as d } from "./components/HeroBanner/HeroBanner.js";
4
- import { default as l } from "./pages/Page.js";
1
+ import { default as a } from "./components/Button/Button.js";
2
+ import { default as o } from "./components/Header/Header.js";
3
+ import { default as u } from "./components/HeroBanner/HeroBanner.js";
4
+ import { default as l } from "./components/Input/Input.js";
5
+ import { default as m } from "./components/Select/Select.js";
6
+ import { default as x } from "./pages/Page.js";
5
7
  export {
6
- r as Button,
7
- t as Header,
8
- d as HeroBanner,
9
- l as Page
8
+ a as Button,
9
+ o as Header,
10
+ u as HeroBanner,
11
+ l as Input,
12
+ x as Page,
13
+ m as Select
10
14
  };
@@ -10,16 +10,7 @@ body {
10
10
  -webkit-overflow-scrolling: touch;
11
11
  }
12
12
 
13
- h1,
14
- h2,
15
- h3,
16
- h4 {
17
- color: $primary-black;
18
- }
19
13
 
20
- p {
21
- color: $soft-black;
22
- }
23
14
 
24
15
  /** Fonts **/
25
16
  @font-face {
@@ -56,4 +47,22 @@ p {
56
47
  }
57
48
  @mixin DistinctText {
58
49
  font-family: $DistinctText;
50
+ }
51
+
52
+ h1,
53
+ h2,
54
+ h3,
55
+ h4 {
56
+ color: $primary-black;
57
+ @include DistinctDisplay();
58
+ }
59
+
60
+ p,
61
+ input,
62
+ label,
63
+ div,
64
+ a,
65
+ button {
66
+ color: $soft-black;
67
+ @include DistinctText();
59
68
  }
@@ -0,0 +1,38 @@
1
+ @mixin hidden {
2
+ position: absolute;
3
+ overflow: hidden;
4
+ padding: 0;
5
+ border: 0;
6
+ margin: -1px;
7
+ block-size: 1px;
8
+ clip: rect(0,0,0,0);
9
+ inline-size: 1px;
10
+ visibility: inherit;
11
+ white-space: nowrap;
12
+ }
13
+
14
+ @mixin warning-icon-before {
15
+ border-left: 0.75rem solid transparent;
16
+ border-right: 0.75rem solid transparent;
17
+ border-bottom: 1.25rem solid #d6d141;
18
+ content: '';
19
+ height: 0;
20
+ position: absolute;
21
+ right: 14px;
22
+ top: 45px;
23
+ width: 0;
24
+ }
25
+
26
+ @mixin warning-icon-after {
27
+ color: $pure-black;
28
+ content: '!';
29
+ font-family: arial;
30
+ font-size: 0.85vrem;
31
+ height: 2rem;
32
+ width: 2rem;
33
+ position: absolute;
34
+ right: 10px;
35
+ top: 50px;
36
+ text-align: center;
37
+ line-height: 1;
38
+ }
@@ -20,6 +20,7 @@ $off-white: #f4f2f1;
20
20
 
21
21
  // Notification color palette
22
22
  $error-red: #ff0000;
23
+ $warn-yellow: #d6d141;
23
24
  $post-sale-magenta: #ff0085;
24
25
  $clock-widget-blue: #4a90e2;
25
26
  $clock-widget-green: #6a9c53;
@@ -33,3 +34,9 @@ $articker-red-orange-gradient: linear-gradient(90deg, #fc1e2b, #ff8201);
33
34
 
34
35
 
35
36
  $text-color: $pure-black;
37
+
38
+ // Font-variables
39
+ $DistinctDisplay: 'DistinctDisplay';
40
+ $DistinctDisplayItalic: 'DistinctDisplayItalic';
41
+ $DistinctItalic: 'DistinctItalic';
42
+ $DistinctText: 'DistinctText';
@@ -94,10 +94,6 @@
94
94
  font-size: 2.375rem;
95
95
  }
96
96
 
97
- @media (max-width: 28.8125rem) {
98
- margin: 0;
99
- }
100
-
101
97
  span {
102
98
  font-size: 1.625rem;
103
99
  }
@@ -0,0 +1,160 @@
1
+ @import '../../vars';
2
+ @import '../../_utils';
3
+
4
+ $md: #{$px}-input--md;
5
+ $lg: #{$px}-input--lg;
6
+
7
+ // Shared Input styles
8
+ .#{$px}-input {
9
+ display: flex;
10
+ flex-direction: column;
11
+
12
+ &__label {
13
+ margin-bottom: 0.5rem;
14
+
15
+ &--hidden {
16
+ @include hidden();
17
+ }
18
+ }
19
+
20
+ &__input {
21
+ accent-color: $pure-black;
22
+ border: 3px solid currentColor;
23
+ margin-bottom: 0.5rem;
24
+ padding: 0.5rem;
25
+ // width: 100%;
26
+ }
27
+
28
+ &__validation {
29
+ display: -webkit-box;
30
+ line-height: 1.25;
31
+ overflow: hidden;
32
+ -webkit-box-orient: vertical;
33
+ -webkit-line-clamp: 2;
34
+ }
35
+
36
+ // Small input size
37
+ &--sm {
38
+ .#{$px}-input__input {
39
+ padding: 0.25rem 0.5rem;
40
+ }
41
+ }
42
+
43
+ // Large input size
44
+ &--lg {
45
+ .#{$px}-input__input {
46
+ padding: 0.75rem 0.5rem;
47
+ }
48
+ }
49
+
50
+ // Inline
51
+ &--inline {
52
+ align-items: center;
53
+ flex-direction: row;
54
+ flex-wrap: wrap;
55
+ gap: 1rem;
56
+
57
+ .#{$px}-input__input {
58
+ align-self: center;
59
+ width: unset;
60
+ }
61
+
62
+ .#{$px}-input__label {
63
+ max-width: 8.75rem;
64
+ }
65
+ }
66
+
67
+ // Disabled
68
+ &--disabled {
69
+ color: $keyline-gray;
70
+
71
+ .#{$px}-input__label,
72
+ .#{$px}-input__input {
73
+ color: inherit;
74
+ cursor: not-allowed;
75
+ }
76
+ }
77
+
78
+ // Read only
79
+ &--readonly {
80
+ pointer-events: none;
81
+
82
+ .#{$px}-input__label,
83
+ .#{$px}-input__input {
84
+ cursor: default;
85
+ }
86
+ }
87
+
88
+ // Invalid
89
+ &--invalid {
90
+ color: $error-red;
91
+
92
+ .#{$px}-input__label,
93
+ .#{$px}-input__input,
94
+ .#{$px}-input__validation {
95
+ color: inherit;
96
+ }
97
+ }
98
+
99
+ // warn
100
+ &--warn {
101
+ .#{$px}-input__label {
102
+ position: relative;
103
+ }
104
+ }
105
+
106
+ .#{$px}-input__validation {
107
+ animation: reveal 0.45s linear forwards;
108
+ margin-bottom: 0.5rem;
109
+ }
110
+ }
111
+
112
+ .#{$px}-radio-input,
113
+ .#{$px}-checkbox-input {
114
+ .#{$px}-input__input {
115
+ align-self: flex-start;
116
+ }
117
+
118
+ &.#{$px}-input--inline {
119
+ .#{$px}-input__input {
120
+ align-self: center;
121
+ }
122
+ }
123
+ }
124
+
125
+ .#{$px}-input--inline.#{$px}-radio-input,
126
+ .#{$px}-input--inline.#{$px}-checkbox-input,
127
+ .#{$px}-input--inline.#{$px}-toggle-input {
128
+ flex-direction: row-reverse;
129
+ justify-content: flex-end;
130
+ position: relative;
131
+ transition: padding 0.25s;
132
+
133
+ &.#{$px}-input--invalid,
134
+ &.#{$px}-input--warn {
135
+ padding-top: 1.5rem;
136
+
137
+ .#{$px}-input__validation {
138
+ left: 0;
139
+ position: absolute;
140
+ top: 0
141
+ }
142
+ }
143
+
144
+ &.#{$px}-input--warn {
145
+ padding-top: 2.75rem;
146
+ }
147
+ }
148
+
149
+ .#{$px}-select-input .#{$px}-input__input {
150
+ flex: 1;
151
+ }
152
+
153
+ @keyframes reveal {
154
+ 0% {
155
+ opacity: 0;
156
+ }
157
+ 100% {
158
+ opacity: 1;
159
+ }
160
+ }
@@ -0,0 +1,179 @@
1
+ @import '../../vars';
2
+ @import '../../_utils';
3
+
4
+ $toggleBaseWidth: 3rem;
5
+ $inline: #{$px}-input--inline;
6
+ $disabled: #{$px}-input--disabled;
7
+ $invalid: #{$px}-input--invalid;
8
+ $warn: #{$px}-input--warn;
9
+ $md: #{$px}-input--md;
10
+ $lg: #{$px}-input--lg;
11
+ // Shared Input styles
12
+ .#{$px}-toggle-input {
13
+ position: relative;
14
+ transition: padding 0.25s;
15
+
16
+ .#{$px}-input__label {
17
+ line-height: 1;
18
+ margin-bottom: 2.5rem;
19
+ // margin-left: 66px;
20
+ position: relative;
21
+
22
+ &::after,
23
+ &::before {
24
+ content: '';
25
+ display: block;
26
+ position: absolute;
27
+ top: 1.85rem;
28
+ }
29
+
30
+ &::before {
31
+ background-color: rgba(0,0,0, .4);
32
+ border-radius: 1rem;
33
+ width: $toggleBaseWidth;
34
+ height: 1rem;
35
+ left: 0;
36
+ transition: background-color 0.25s, color 0.25s;
37
+ }
38
+
39
+ &::after {
40
+ // background-color: transparent;
41
+ background: #fff linear-gradient(transparent,rgba($pure-black, 0.05));
42
+ border-radius: 50%;
43
+ box-shadow: 0 1px 2px 0 rgba($pure-black,.15), 0 0 0 1px rgba($pure-black,.15) inset;
44
+ color: white;
45
+ height: 1rem;
46
+ left: 0;
47
+ width: 1rem;
48
+ transform: translate(0, 0);
49
+ transition: transform 0.25s;
50
+ }
51
+ }
52
+
53
+ &.#{$inline} {
54
+
55
+ .#{$px}-input__label {
56
+ margin-bottom: 0.5rem;
57
+ margin-left: 66px;
58
+
59
+ &::before {
60
+ left: unset;
61
+ right: calc(1rem + 100%);
62
+ top: 50%;
63
+ transform: translate(0, -50%);
64
+ }
65
+
66
+ &::after {
67
+ left: unset;
68
+ right: calc($toggleBaseWidth + 100%);
69
+ top: 50%;
70
+ transform: translate(0, -50%);
71
+ }
72
+ }
73
+ }
74
+
75
+ // Hide actual checkbox input
76
+ .#{$px}-input__input {
77
+ @include hidden;
78
+ margin-bottom: 0;
79
+ }
80
+
81
+ &.#{$invalid}.#{$inline} {
82
+ padding-top: 2rem;
83
+ }
84
+
85
+
86
+ // Height changes
87
+ &.#{$md},
88
+ &.#{$lg} {
89
+ .#{$px}-input__label::after {
90
+ right: calc($toggleBaseWidth - 0.5rem + 100%);
91
+ }
92
+ }
93
+ &.#{$md} {
94
+ .#{$px}-input__label {
95
+ margin-bottom: 3rem;
96
+
97
+ &::before {
98
+ height: 1.5rem;
99
+ }
100
+
101
+ &::after {
102
+ height: 1.5rem;
103
+ width: 1.5rem;
104
+ }
105
+ }
106
+
107
+ &.#{$inline} {
108
+ .#{$px}-input__label {
109
+ margin-bottom: 0.5rem;
110
+ }
111
+ }
112
+ }
113
+ &.#{$lg} {
114
+ .#{$px}-input__label {
115
+ margin-bottom: 3.5rem;
116
+
117
+ &::before {
118
+ width: 3.5rem;
119
+ height: 2rem;
120
+ }
121
+
122
+ &::after {
123
+ height: 2rem;
124
+ width: 2rem;
125
+ }
126
+ }
127
+
128
+ &.#{$inline} {
129
+ .#{$px}-input__label {
130
+ margin-bottom: 0.5rem;
131
+ }
132
+ }
133
+ }
134
+
135
+ &.#{$lg}.#{$inline} {
136
+ .#{$px}-input__label {
137
+ margin-left: 4.375rem;
138
+ }
139
+ }
140
+
141
+ // When in checked state
142
+ &:has(input:checked) {
143
+
144
+ .#{$px}-input__label {
145
+ &::before {
146
+ background-color: $pure-black;
147
+ }
148
+
149
+ &::after {
150
+ transform: translate($toggleBaseWidth - 1rem, 0)
151
+ }
152
+ }
153
+
154
+ &.#{$md} .#{$px}-input__label::after,
155
+ &.#{$lg} .#{$px}-input__label::after {
156
+ transform: translate($toggleBaseWidth - 1.5rem, 0)
157
+ }
158
+
159
+
160
+ &.#{$inline} .#{$px}-input__label::after { transform: translate($toggleBaseWidth - 1rem, -50%); }
161
+
162
+ &.#{$md}.#{$inline} .#{$px}-input__label::after,
163
+ &.#{$lg}.#{$inline} .#{$px}-input__label::after {
164
+ transform: translate($toggleBaseWidth - 1.5rem, -50%);
165
+ }
166
+
167
+ // Error state checked
168
+ &.#{$invalid} .#{$px}-input__label::before { background-color: $error-red; }
169
+
170
+ // warn state checked
171
+ &.#{$warn} .#{$px}-input__label::before { background-color: $warn-yellow; }
172
+ }
173
+ &.#{$warn} {
174
+ &.#{$md},
175
+ &.#{$lg} {
176
+ padding-top: 3.5rem;
177
+ }
178
+ }
179
+ }
@@ -5,4 +5,6 @@
5
5
  @import 'components/Button/button';
6
6
  @import 'components/Header/header';
7
7
  @import 'components/HeroBanner/heroBanner';
8
+ @import 'components/Input/input';
9
+ @import 'components/Toggle/toggle';
8
10
  @import 'pages/page';
@@ -1 +1,56 @@
1
+ import * as React from 'react';
1
2
  export declare const px = "phillips";
3
+ export interface InputProps {
4
+ /**
5
+ * Specify whether the `<input>` should be disabled
6
+ */
7
+ disabled?: boolean;
8
+ /**
9
+ * Specify a custom `id` for the `<input>`
10
+ */
11
+ id: string;
12
+ /**
13
+ * Specify whether the control is currently invalid
14
+ */
15
+ invalid?: boolean;
16
+ /**
17
+ * Provide the text that is displayed when the control is in an invalid state
18
+ */
19
+ invalidText?: React.ReactNode;
20
+ /**
21
+ * Whether the input should be read-only
22
+ */
23
+ readOnly?: boolean;
24
+ /**
25
+ * Specify the type of the `<input>`
26
+ */
27
+ type: string;
28
+ /**
29
+ * Specify whether the control is currently in warning state
30
+ */
31
+ warn?: boolean;
32
+ /**
33
+ * Provide the text that is displayed when the control is in warning state
34
+ */
35
+ warnText?: React.ReactNode;
36
+ }
37
+ interface NormalizedProps {
38
+ disabled?: boolean;
39
+ invalid?: boolean;
40
+ invalidId?: string;
41
+ type?: string;
42
+ warn?: boolean;
43
+ warnId?: string;
44
+ validation: JSX.Element | null;
45
+ }
46
+ /**
47
+ * Returns an object containing non-colliding props and additional, generated ones.
48
+ * This hook ensures that only either "invalid" or "warn" is true but never both at
49
+ * the same time. Regardless whether "invalid" or "warn", the appropriate validation
50
+ * message is passed as "validation".
51
+ * It also ensure that neither "invalid", nor "warn", nor "disabled" are enabled when
52
+ * "readonly" is passed as "readonly" takes precedence.
53
+
54
+ */
55
+ export declare function useNormalizedInputProps({ disabled, id, invalid, invalidText, readOnly, type, warn, warnText, }: InputProps): NormalizedProps;
56
+ export {};
@@ -1,4 +1,41 @@
1
- const p = "phillips";
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ const n = "phillips";
3
+ function c({
4
+ disabled: l = !1,
5
+ id: r,
6
+ invalid: d = !1,
7
+ invalidText: t = "invalid",
8
+ readOnly: o = !1,
9
+ type: a,
10
+ warn: v = !1,
11
+ warnText: e
12
+ }) {
13
+ const i = {
14
+ disabled: !o && l,
15
+ invalid: !o && !l && d,
16
+ invalidId: `${r}-error-msg`,
17
+ type: a === "toggle" ? "checkbox" : a,
18
+ warn: !o && !l && !d && v,
19
+ warnId: `${r}-warn-msg`,
20
+ validation: null
21
+ };
22
+ return i.invalid && (i.validation = /* @__PURE__ */ s(
23
+ "div",
24
+ {
25
+ className: `${n}-input__validation ${n}-${a}-input--invalid`,
26
+ id: i.invalidId,
27
+ children: t
28
+ }
29
+ )), i.warn && (i.validation = /* @__PURE__ */ s(
30
+ "div",
31
+ {
32
+ className: `${n}-input__validation ${n}-${a}-input--warn`,
33
+ id: i.warnId,
34
+ children: e
35
+ }
36
+ )), i;
37
+ }
2
38
  export {
3
- p as px
39
+ n as px,
40
+ c as useNormalizedInputProps
4
41
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phillips/seldon",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -47,10 +47,9 @@
47
47
  "@storybook/blocks": "^7.0.22",
48
48
  "@storybook/react": "^7.0.22",
49
49
  "@storybook/react-vite": "^7.0.22",
50
- "@storybook/testing-library": "^0.0.14-next.2",
51
50
  "@testing-library/jest-dom": "^5.17.0",
52
51
  "@testing-library/react": "^14.0.0",
53
- "@testing-library/user-event": "^14.4.3",
52
+ "@testing-library/user-event": "^14.5.1",
54
53
  "@types/color": "^3.0.3",
55
54
  "@types/jest": "^29.5.3",
56
55
  "@types/react": "^18.0.37",