@phillips/seldon 1.7.0 → 1.7.2

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.
Files changed (37) hide show
  1. package/dist/_virtual/_commonjsHelpers.js +3 -5
  2. package/dist/components/Button/Button.d.ts +13 -19
  3. package/dist/components/Button/Button.js +10 -15
  4. package/dist/components/Header/Header.js +3 -21
  5. package/dist/components/HeroBanner/HeroBanner.d.ts +6 -6
  6. package/dist/components/HeroBanner/HeroBanner.js +1 -9
  7. package/dist/components/Input/Input.js +48 -51
  8. package/dist/components/Select/Select.js +45 -48
  9. package/dist/index.d.ts +0 -1
  10. package/dist/index.js +12 -14
  11. package/dist/scss/_reset.scss +20 -5
  12. package/dist/scss/_typography.scss +20 -11
  13. package/dist/scss/_utils.scss +2 -2
  14. package/dist/scss/_vars.scss +1 -4
  15. package/dist/scss/components/Button/_button.scss +35 -5
  16. package/dist/scss/components/DatePicker/_datePicker.scss +3 -4
  17. package/dist/scss/components/Header/_header.scss +1 -1
  18. package/dist/scss/components/HeroBanner/_heroBanner.scss +81 -81
  19. package/dist/scss/components/Input/_input.scss +2 -2
  20. package/dist/scss/components/Toggle/_toggle.scss +19 -13
  21. package/dist/scss/pages/_page.scss +1 -1
  22. package/dist/scss/styles.scss +1 -1
  23. package/dist/utils/index.d.ts +10 -0
  24. package/dist/utils/index.js +7 -23
  25. package/package.json +7 -4
  26. package/dist/_virtual/index2.js +0 -4
  27. package/dist/components/DatePicker/DatePicker.d.ts +0 -90
  28. package/dist/components/DatePicker/DatePicker.js +0 -92
  29. package/dist/node_modules/flatpickr/dist/esm/index.js +0 -947
  30. package/dist/node_modules/flatpickr/dist/esm/l10n/default.js +0 -75
  31. package/dist/node_modules/flatpickr/dist/esm/types/options.js +0 -80
  32. package/dist/node_modules/flatpickr/dist/esm/utils/dates.js +0 -90
  33. package/dist/node_modules/flatpickr/dist/esm/utils/dom.js +0 -45
  34. package/dist/node_modules/flatpickr/dist/esm/utils/formatting.js +0 -170
  35. package/dist/node_modules/flatpickr/dist/esm/utils/index.js +0 -23
  36. package/dist/node_modules/flatpickr/dist/esm/utils/polyfills.js +0 -15
  37. package/dist/node_modules/flatpickr/dist/l10n/index.js +0 -3471
@@ -1,101 +1,101 @@
1
1
  @import '../../vars';
2
2
 
3
3
  .#{$px}-hero-banner {
4
- align-items: center;
5
- background: var(--background);
6
- background-repeat: no-repeat;
7
- background-size: cover;
8
- background-position: center center;
9
- display: flex;
10
- flex-flow: column;
11
- justify-content: center;
12
- min-height: 25rem;
13
- padding: 1rem;
14
- width: 100%;
4
+ align-items: center;
5
+ background: var(--background);
6
+ background-repeat: no-repeat;
7
+ background-size: cover;
8
+ background-position: center center;
9
+ display: flex;
10
+ flex-flow: column;
11
+ justify-content: center;
12
+ min-height: 25rem;
13
+ padding: 1rem;
14
+ width: 100%;
15
15
 
16
- @media (max-width: 28.8125rem) {
17
- flex-direction: column;
18
- align-items: center;
19
- gap: 1.875rem;
20
- align-self: stretch;
21
- padding: 1.875rem 0.9375rem;
22
- background: $pure-black;
16
+ @media (max-width: 28.8125rem) {
17
+ flex-direction: column;
18
+ align-items: center;
19
+ gap: 1.875rem;
20
+ align-self: stretch;
21
+ padding: 1.875rem 0.9375rem;
22
+ background: $pure-black;
23
23
 
24
- &::before{
25
- content: '';
26
- background: var(--background);
27
- width: 100%;
28
- height: 12rem;
29
- background-size: cover;
30
- background-repeat: no-repeat;
31
- background-position: center center;
32
- }
24
+ &::before {
25
+ content: '';
26
+ background: var(--background);
27
+ width: 100%;
28
+ height: 12rem;
29
+ background-size: cover;
30
+ background-repeat: no-repeat;
31
+ background-position: center center;
33
32
  }
33
+ }
34
34
 
35
- h1 {
36
- font-family: 'DistinctDisplay', sans-serif;
37
- }
35
+ h1 {
36
+ font-family: 'DistinctDisplay', sans-serif;
37
+ }
38
38
 
39
- h1 span,
40
- p {
41
- font-family: 'DistinctText', sans-serif;
42
- }
39
+ h1 span,
40
+ p {
41
+ font-family: 'DistinctText', sans-serif;
42
+ }
43
43
 
44
- h1,
45
- h1 span,
46
- p {
47
- color: $pure-white;
48
- font-weight: 400;
49
- margin: 0;
50
- text-transform: uppercase;
51
- }
44
+ h1,
45
+ h1 span,
46
+ p {
47
+ color: $pure-white;
48
+ font-weight: 400;
49
+ margin: 0;
50
+ text-transform: uppercase;
51
+ }
52
52
 
53
- p {
54
- font-size: 0.875rem;
55
- line-height: 1;
56
- letter-spacing: 0.125rem;
57
- text-align: center;
58
- }
53
+ p {
54
+ font-size: 0.875rem;
55
+ line-height: 1;
56
+ letter-spacing: 0.125rem;
57
+ text-align: center;
58
+ }
59
59
 
60
- & .#{$px}-hero-banner__content-wrapper {
61
- max-width: 1082px;
62
- display: flex;
63
- flex-direction: column;
64
- align-items: center;
65
- }
60
+ & .#{$px}-hero-banner__content-wrapper {
61
+ max-width: 1082px;
62
+ display: flex;
63
+ flex-direction: column;
64
+ align-items: center;
65
+ }
66
66
 
67
- & .#{$px}-hero-banner__pre-head {
68
- align-items: flex-start;
69
- display: flex;
70
- font-size: 0.75rem;
71
- gap: 1.875rem;
67
+ & .#{$px}-hero-banner__pre-head {
68
+ align-items: flex-start;
69
+ display: flex;
70
+ font-size: 0.75rem;
71
+ gap: 1.875rem;
72
72
 
73
- @media (min-width: 28.8125rem) {
74
- font-size: 0.875rem;
75
- }
73
+ @media (min-width: 28.8125rem) {
74
+ font-size: 0.875rem;
75
+ }
76
76
 
77
- @media (max-width: 28.8125rem) {
78
- flex-direction: column;
79
- gap: 1rem;
80
- align-items: center;
81
- }
77
+ @media (max-width: 28.8125rem) {
78
+ flex-direction: column;
79
+ gap: 1rem;
80
+ align-items: center;
82
81
  }
82
+ }
83
83
 
84
- & .#{$px}-hero-banner__heading {
85
- align-self: stretch;
86
- display: flex;
87
- flex-direction: column;
88
- font-size: 2rem;
89
- line-height: 1;
90
- margin: 1.875rem 0;
91
- text-align: center;
84
+ & .#{$px}-hero-banner__heading {
85
+ align-self: stretch;
86
+ display: flex;
87
+ flex-direction: column;
88
+ font-size: 2rem;
89
+ line-height: 1;
90
+ margin: 1.875rem 0;
91
+ text-align: center;
92
92
 
93
- @media (min-width: 28.8125rem) {
94
- font-size: 2.375rem;
95
- }
93
+ @media (min-width: 28.8125rem) {
94
+ font-size: 2.375rem;
95
+ }
96
96
 
97
- span {
98
- font-size: 1.625rem;
99
- }
97
+ span {
98
+ font-size: 1.625rem;
100
99
  }
100
+ }
101
101
  }
@@ -129,7 +129,7 @@ $lg: #{$px}-input--lg;
129
129
 
130
130
  .#{$px}-input--inline.#{$px}-radio-input,
131
131
  .#{$px}-input--inline.#{$px}-checkbox-input,
132
- .#{$px}-input--inline.#{$px}-toggle-input {
132
+ .#{$px}-input--inline.#{$px}-toggle-input {
133
133
  flex-direction: row-reverse;
134
134
  justify-content: flex-end;
135
135
  position: relative;
@@ -142,7 +142,7 @@ $lg: #{$px}-input--lg;
142
142
  .#{$px}-input__validation {
143
143
  left: 0;
144
144
  position: absolute;
145
- top: 0
145
+ top: 0;
146
146
  }
147
147
  }
148
148
 
@@ -28,19 +28,23 @@ $lg: #{$px}-input--lg;
28
28
  }
29
29
 
30
30
  &::before {
31
- background-color: rgba(0,0,0, .4);
31
+ background-color: rgba(0, 0, 0, 0.4);
32
32
  border-radius: 1rem;
33
33
  width: $toggleBaseWidth;
34
34
  height: 1rem;
35
35
  left: 0;
36
- transition: background-color 0.25s, color 0.25s;
36
+ transition:
37
+ background-color 0.25s,
38
+ color 0.25s;
37
39
  }
38
40
 
39
41
  &::after {
40
42
  // background-color: transparent;
41
- background: #fff linear-gradient(transparent,rgba($pure-black, 0.05));
43
+ background: #fff linear-gradient(transparent, rgba($pure-black, 0.05));
42
44
  border-radius: 50%;
43
- box-shadow: 0 1px 2px 0 rgba($pure-black,.15), 0 0 0 1px rgba($pure-black,.15) inset;
45
+ box-shadow:
46
+ 0 1px 2px 0 rgba($pure-black, 0.15),
47
+ 0 0 0 1px rgba($pure-black, 0.15) inset;
44
48
  color: white;
45
49
  height: 1rem;
46
50
  left: 0;
@@ -51,7 +55,6 @@ $lg: #{$px}-input--lg;
51
55
  }
52
56
 
53
57
  &.#{$inline} {
54
-
55
58
  .#{$px}-input__label {
56
59
  margin-bottom: 0.5rem;
57
60
  margin-left: 66px;
@@ -82,7 +85,6 @@ $lg: #{$px}-input--lg;
82
85
  padding-top: 2rem;
83
86
  }
84
87
 
85
-
86
88
  // Height changes
87
89
  &.#{$md},
88
90
  &.#{$lg} {
@@ -140,24 +142,24 @@ $lg: #{$px}-input--lg;
140
142
 
141
143
  // When in checked state
142
144
  &:has(input:checked) {
143
-
144
145
  .#{$px}-input__label {
145
146
  &::before {
146
147
  background-color: $pure-black;
147
148
  }
148
149
 
149
150
  &::after {
150
- transform: translate($toggleBaseWidth - 1rem, 0)
151
+ transform: translate($toggleBaseWidth - 1rem, 0);
151
152
  }
152
153
  }
153
154
 
154
155
  &.#{$md} .#{$px}-input__label::after,
155
156
  &.#{$lg} .#{$px}-input__label::after {
156
- transform: translate($toggleBaseWidth - 1.5rem, 0)
157
+ transform: translate($toggleBaseWidth - 1.5rem, 0);
157
158
  }
158
159
 
159
-
160
- &.#{$inline} .#{$px}-input__label::after { transform: translate($toggleBaseWidth - 1rem, -50%); }
160
+ &.#{$inline} .#{$px}-input__label::after {
161
+ transform: translate($toggleBaseWidth - 1rem, -50%);
162
+ }
161
163
 
162
164
  &.#{$md}.#{$inline} .#{$px}-input__label::after,
163
165
  &.#{$lg}.#{$inline} .#{$px}-input__label::after {
@@ -165,10 +167,14 @@ $lg: #{$px}-input--lg;
165
167
  }
166
168
 
167
169
  // Error state checked
168
- &.#{$invalid} .#{$px}-input__label::before { background-color: $error-red; }
170
+ &.#{$invalid} .#{$px}-input__label::before {
171
+ background-color: $error-red;
172
+ }
169
173
 
170
174
  // warn state checked
171
- &.#{$warn} .#{$px}-input__label::before { background-color: $warn-yellow; }
175
+ &.#{$warn} .#{$px}-input__label::before {
176
+ background-color: $warn-yellow;
177
+ }
172
178
  }
173
179
  &.#{$warn} {
174
180
  &.#{$md},
@@ -1,5 +1,5 @@
1
1
  .storybook-page {
2
- font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
2
+ font-family: 'Montserrat', 'Helvetica Neue', Helvetica, Arial, sans-serif;
3
3
  font-size: 14px;
4
4
  line-height: 24px;
5
5
  padding: 48px 20px;
@@ -11,4 +11,4 @@
11
11
  @import 'components/Input/input';
12
12
  @import 'components/Toggle/toggle';
13
13
  // 📑 Pages
14
- @import 'pages/page';
14
+ @import 'pages/page';
@@ -1,6 +1,16 @@
1
1
  import * as React from 'react';
2
2
  export declare const px = "phillips";
3
3
  export declare const noOP: () => void;
4
+ export interface CommonProps {
5
+ /**
6
+ * Optional className to be applied to the outer most element
7
+ */
8
+ className?: string;
9
+ /**
10
+ * A custom `id`
11
+ */
12
+ id?: string;
13
+ }
4
14
  export interface InputProps {
5
15
  /**
6
16
  * Specify whether the `<input>` should be disabled
@@ -1,13 +1,12 @@
1
1
  import { jsx as s } from "react/jsx-runtime";
2
- const a = "phillips", p = () => {
3
- };
4
- function u({
2
+ const n = "phillips";
3
+ function c({
5
4
  disabled: l = !1,
6
5
  id: r,
7
6
  invalid: d = !1,
8
7
  invalidText: t = "invalid",
9
8
  readOnly: o = !1,
10
- type: n,
9
+ type: a,
11
10
  warn: v = !1,
12
11
  warnText: e
13
12
  }) {
@@ -15,29 +14,14 @@ function u({
15
14
  disabled: !o && l,
16
15
  invalid: !o && !l && d,
17
16
  invalidId: `${r}-error-msg`,
18
- type: n === "toggle" ? "checkbox" : n,
17
+ type: a === "toggle" ? "checkbox" : a,
19
18
  warn: !o && !l && !d && v,
20
19
  warnId: `${r}-warn-msg`,
21
20
  validation: null
22
21
  };
23
- return i.invalid && (i.validation = /* @__PURE__ */ s(
24
- "div",
25
- {
26
- className: `${a}-input__validation ${a}-${n}-input--invalid`,
27
- id: i.invalidId,
28
- children: t
29
- }
30
- )), i.warn && (i.validation = /* @__PURE__ */ s(
31
- "div",
32
- {
33
- className: `${a}-input__validation ${a}-${n}-input--warn`,
34
- id: i.warnId,
35
- children: e
36
- }
37
- )), i;
22
+ return i.invalid && (i.validation = /* @__PURE__ */ s("div", { className: `${n}-input__validation ${n}-${a}-input--invalid`, id: i.invalidId, children: t })), i.warn && (i.validation = /* @__PURE__ */ s("div", { className: `${n}-input__validation ${n}-${a}-input--warn`, id: i.warnId, children: e })), i;
38
23
  }
39
24
  export {
40
- p as noOP,
41
- a as px,
42
- u as useNormalizedInputProps
25
+ n as px,
26
+ c as useNormalizedInputProps
43
27
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phillips/seldon",
3
- "version": "1.7.0",
3
+ "version": "1.7.2",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -8,8 +8,8 @@
8
8
  "exports": {
9
9
  ".": {
10
10
  "import": {
11
- "types": "./dist/index.js",
12
- "default": "./dist/index.d.ts"
11
+ "types": "./dist/index.d.ts",
12
+ "default": "./dist/index.js"
13
13
  }
14
14
  },
15
15
  "./dist/": {
@@ -28,6 +28,7 @@
28
28
  "preview": "npx http-server storybook-static",
29
29
  "clean": "rimraf './dist'",
30
30
  "clean:stories": "rimraf './storybook-static'",
31
+ "format": "prettier . --write",
31
32
  "lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
32
33
  "prepare": "husky install"
33
34
  },
@@ -67,6 +68,7 @@
67
68
  "husky": "^8.0.3",
68
69
  "jest": "^29.6.1",
69
70
  "jest-environment-jsdom": "^29.6.1",
71
+ "prettier": "3.0.3",
70
72
  "prop-types": "^15.8.1",
71
73
  "rimraf": "^5.0.1",
72
74
  "rollup-plugin-copy": "^3.4.0",
@@ -78,7 +80,8 @@
78
80
  "ts-node": "^10.9.1",
79
81
  "typescript": "^5.0.2",
80
82
  "vite": "^4.3.9",
81
- "vite-plugin-dts": "^2.3.0"
83
+ "vite-plugin-dts": "^2.3.0",
84
+ "vite-plugin-svgr": "^4.1.0"
82
85
  },
83
86
  "peerDependencies": {
84
87
  "react": "^18.2.0",
@@ -1,4 +0,0 @@
1
- var e = { exports: {} };
2
- export {
3
- e as __module
4
- };
@@ -1,90 +0,0 @@
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;
@@ -1,92 +0,0 @@
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
- };