@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.
Files changed (33) hide show
  1. package/dist/_virtual/_commonjsHelpers.js +5 -3
  2. package/dist/_virtual/index2.js +4 -0
  3. package/dist/components/Button/Button.d.ts +4 -4
  4. package/dist/components/Button/Button.js +7 -7
  5. package/dist/components/DatePicker/DatePicker.d.ts +90 -0
  6. package/dist/components/DatePicker/DatePicker.js +92 -0
  7. package/dist/components/Header/Header.js +16 -16
  8. package/dist/components/Input/Input.d.ts +77 -0
  9. package/dist/components/Input/Input.js +65 -0
  10. package/dist/components/Select/Select.d.ts +10 -0
  11. package/dist/components/Select/Select.js +61 -0
  12. package/dist/index.d.ts +3 -0
  13. package/dist/index.js +14 -8
  14. package/dist/node_modules/flatpickr/dist/esm/index.js +947 -0
  15. package/dist/node_modules/flatpickr/dist/esm/l10n/default.js +75 -0
  16. package/dist/node_modules/flatpickr/dist/esm/types/options.js +80 -0
  17. package/dist/node_modules/flatpickr/dist/esm/utils/dates.js +90 -0
  18. package/dist/node_modules/flatpickr/dist/esm/utils/dom.js +45 -0
  19. package/dist/node_modules/flatpickr/dist/esm/utils/formatting.js +170 -0
  20. package/dist/node_modules/flatpickr/dist/esm/utils/index.js +23 -0
  21. package/dist/node_modules/flatpickr/dist/esm/utils/polyfills.js +15 -0
  22. package/dist/node_modules/flatpickr/dist/l10n/index.js +3471 -0
  23. package/dist/scss/_typography.scss +30 -10
  24. package/dist/scss/_utils.scss +38 -0
  25. package/dist/scss/_vars.scss +12 -1
  26. package/dist/scss/components/Button/_button.scss +21 -14
  27. package/dist/scss/components/DatePicker/_datePicker.scss +81 -0
  28. package/dist/scss/components/Input/_input.scss +165 -0
  29. package/dist/scss/components/Toggle/_toggle.scss +179 -0
  30. package/dist/scss/styles.scss +6 -0
  31. package/dist/utils/index.d.ts +56 -0
  32. package/dist/utils/index.js +41 -2
  33. package/package.json +3 -3
@@ -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,33 @@ p {
56
47
  }
57
48
  @mixin DistinctText {
58
49
  font-family: $DistinctText;
59
- }
50
+ }
51
+
52
+ @mixin headerText {
53
+ color: $primary-black;
54
+ @include DistinctDisplay();
55
+ }
56
+
57
+ @mixin bodyText {
58
+ color: $soft-black;
59
+ @include DistinctText();
60
+ }
61
+
62
+ // @TODO: uncomment when site is able to be refactored
63
+ // h1,
64
+ // h2,
65
+ // h3,
66
+ // h4 {
67
+ // color: $primary-black;
68
+ // @include DistinctDisplay();
69
+ // }
70
+
71
+ // p,
72
+ // input,
73
+ // label,
74
+ // div,
75
+ // a,
76
+ // button {
77
+ // color: $soft-black;
78
+ // @include DistinctText();
79
+ // }
@@ -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;
@@ -32,4 +33,14 @@ $articker-orange: #ff8201;
32
33
  $articker-red-orange-gradient: linear-gradient(90deg, #fc1e2b, #ff8201);
33
34
 
34
35
 
35
- $text-color: $pure-black;
36
+ // Font-variables
37
+ $DistinctDisplay: 'DistinctDisplay';
38
+ $DistinctDisplayItalic: 'DistinctDisplayItalic';
39
+ $DistinctItalic: 'DistinctItalic';
40
+ $DistinctText: 'DistinctText';
41
+
42
+ // Text variables
43
+ $header-color: $pure-black;
44
+ $header-family: $DistinctDisplay;
45
+ $text-color: $soft-black;
46
+ $text-family: $DistinctText;
@@ -1,34 +1,41 @@
1
1
  @import '../../vars';
2
2
 
3
3
  .#{$px}-button {
4
- background-color: #1ea7fd;
4
+ @include bodyText;
5
+ align-items: center;
6
+ background-color: $pure-black;
5
7
  border: 0;
6
- border-radius: 3rem;
8
+ border-radius: 3em;
7
9
  color: white;
8
10
  cursor: pointer;
9
- display: inline-block;
10
- font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
11
- font-weight: 700;
12
- line-height: 1;
13
- min-width: 4rem;
14
- padding: 0.5rem 1rem;
11
+ display: inline-flex;
12
+ justify-content: center;
13
+ min-width: 9rem;
14
+ padding: 0.5em 1.75em;
15
+ transition: color 0.25s, background-color 0.25s, font-weight 0.25s;
16
+
17
+ &:hover,
18
+ &:focus {
19
+ background-color: $soft-black;
20
+ }
15
21
 
16
22
  &--secondary {
17
23
  color: $text-color;
18
24
  background-color: transparent;
19
- box-shadow: rgba(0, 0, 0, 0.15) 0 0 0 1px inset;
25
+ box-shadow: rgba(0, 0, 0, 0.5) 0 0 0 1px inset;
20
26
  }
21
27
 
22
- &--small {
28
+ &--sm {
23
29
  font-size: 0.75rem;
24
30
  }
25
31
 
26
- &--medium {
27
- font-size: 0.875rem;
32
+ &--md {
33
+ font-size: 1rem;
28
34
  }
29
35
 
30
- &--large {
31
- font-size: 1rem;
36
+ &--lg {
37
+ font-size: 1.05rem;
38
+ padding: 0.75em 1.75em;
32
39
  }
33
40
 
34
41
  * {
@@ -0,0 +1,81 @@
1
+ @import 'flatpickr/dist/flatpickr.css';
2
+ @import '../../vars';
3
+ @import '../../typography';
4
+
5
+
6
+ .flatpickr-calendar {
7
+ @include DistinctText;
8
+
9
+ .flatpickr-day,
10
+ .flatpickr-day.selected,
11
+ .flatpickr-day:hover,
12
+ .flatpickr-day:focus,
13
+ .flatpickr-day.startRange,
14
+ .flatpickr-day.endRange {
15
+ border-radius: 0;
16
+ }
17
+ .flatpickr-day.selected,
18
+ .flatpickr-day:hover,
19
+ .flatpickr-day:focus,
20
+ .flatpickr-day.startRange,
21
+ .flatpickr-day.endRange {
22
+ background: $pure-black;
23
+ border-color: $pure-black;
24
+ color: $pure-white;
25
+ }
26
+
27
+ .flatpickr-day.today {
28
+ border-color: transparent;
29
+ @include DistinctDisplay;
30
+ font-weight: bold;
31
+ position: relative;
32
+
33
+ &::after {
34
+ background-color: $pure-black;
35
+ bottom: 2px;
36
+ content: '';
37
+ height: 0.25rem;
38
+ width: 0.25rem;
39
+ position: absolute;
40
+ left: 50%;
41
+ transform: translateX(-50%);
42
+ }
43
+ }
44
+
45
+ .flatpickr-months .flatpickr-prev-month:hover,
46
+ .flatpickr-months .flatpickr-next-month:hover {
47
+ background-color: $pure-black;
48
+ svg {
49
+ fill: $pure-white;
50
+ }
51
+ }
52
+
53
+ .flatpickr-current-month,
54
+ .flatpickr-monthDropdown-months,
55
+ .flatpickr-current-month input.cur-year {
56
+ @include DistinctDisplay;
57
+ font-size: 1rem;
58
+ text-transform: uppercase;
59
+ }
60
+
61
+ .flatpickr-weekday {
62
+ @include DistinctDisplay;
63
+ font-weight: bold;
64
+ }
65
+
66
+ .flatpickr-current-month {
67
+ padding: 0.65rem 0 0 0;
68
+ }
69
+
70
+ .flatpickr-day.selected.startRange + .endRange:not(:nth-child(7n+1)),
71
+ .flatpickr-day.startRange.startRange + .endRange:not(:nth-child(7n+1)),
72
+ .flatpickr-day.endRange.startRange + .endRange:not(:nth-child(7n+1)) {
73
+ -webkit-box-shadow: -10px 0 0 #e6e6e6;
74
+ box-shadow: -10px 0 0 #e6e6e6;
75
+ }
76
+
77
+ &.arrowTop:before,
78
+ &.arrowTop:after {
79
+ content: unset;
80
+ }
81
+ }
@@ -0,0 +1,165 @@
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
+ .#{$px}-input__input {
88
+ background-color: rgba(239, 239, 239, 0.3);
89
+ }
90
+ }
91
+
92
+ // Invalid
93
+ &--invalid {
94
+ color: $error-red;
95
+
96
+ .#{$px}-input__label,
97
+ .#{$px}-input__input,
98
+ .#{$px}-input__input::placeholder,
99
+ .#{$px}-input__validation {
100
+ color: inherit;
101
+ }
102
+ }
103
+
104
+ // warn
105
+ &--warn {
106
+ .#{$px}-input__label {
107
+ position: relative;
108
+ }
109
+ }
110
+
111
+ .#{$px}-input__validation {
112
+ animation: reveal 0.45s linear forwards;
113
+ margin-bottom: 0.5rem;
114
+ }
115
+ }
116
+
117
+ .#{$px}-radio-input,
118
+ .#{$px}-checkbox-input {
119
+ .#{$px}-input__input {
120
+ align-self: flex-start;
121
+ }
122
+
123
+ &.#{$px}-input--inline {
124
+ .#{$px}-input__input {
125
+ align-self: center;
126
+ }
127
+ }
128
+ }
129
+
130
+ .#{$px}-input--inline.#{$px}-radio-input,
131
+ .#{$px}-input--inline.#{$px}-checkbox-input,
132
+ .#{$px}-input--inline.#{$px}-toggle-input {
133
+ flex-direction: row-reverse;
134
+ justify-content: flex-end;
135
+ position: relative;
136
+ transition: padding 0.25s;
137
+
138
+ &.#{$px}-input--invalid,
139
+ &.#{$px}-input--warn {
140
+ padding-top: 1.5rem;
141
+
142
+ .#{$px}-input__validation {
143
+ left: 0;
144
+ position: absolute;
145
+ top: 0
146
+ }
147
+ }
148
+
149
+ &.#{$px}-input--warn {
150
+ padding-top: 2.75rem;
151
+ }
152
+ }
153
+
154
+ .#{$px}-select-input .#{$px}-input__input {
155
+ flex: 1;
156
+ }
157
+
158
+ @keyframes reveal {
159
+ 0% {
160
+ opacity: 0;
161
+ }
162
+ 100% {
163
+ opacity: 1;
164
+ }
165
+ }
@@ -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
+ }
@@ -1,8 +1,14 @@
1
+ // 🌎 Globals
1
2
  @import './vars';
2
3
  // @TODO: add styles when we can do a site wide regressions QA
3
4
  // @use 'reset';
4
5
  @import './typography';
6
+ // ⚛️ Components
5
7
  @import 'components/Button/button';
8
+ @import 'components/DatePicker/datePicker';
6
9
  @import 'components/Header/header';
7
10
  @import 'components/HeroBanner/heroBanner';
11
+ @import 'components/Input/input';
12
+ @import 'components/Toggle/toggle';
13
+ // 📑 Pages
8
14
  @import 'pages/page';
@@ -1 +1,57 @@
1
+ import * as React from 'react';
1
2
  export declare const px = "phillips";
3
+ export declare const noOP: () => void;
4
+ export interface InputProps {
5
+ /**
6
+ * Specify whether the `<input>` should be disabled
7
+ */
8
+ disabled?: boolean;
9
+ /**
10
+ * Specify a custom `id` for the `<input>`
11
+ */
12
+ id: string;
13
+ /**
14
+ * Specify whether the control is currently invalid
15
+ */
16
+ invalid?: boolean;
17
+ /**
18
+ * Provide the text that is displayed when the control is in an invalid state
19
+ */
20
+ invalidText?: React.ReactNode;
21
+ /**
22
+ * Whether the input should be read-only
23
+ */
24
+ readOnly?: boolean;
25
+ /**
26
+ * Specify the type of the `<input>`
27
+ */
28
+ type: string;
29
+ /**
30
+ * Specify whether the control is currently in warning state
31
+ */
32
+ warn?: boolean;
33
+ /**
34
+ * Provide the text that is displayed when the control is in warning state
35
+ */
36
+ warnText?: React.ReactNode;
37
+ }
38
+ interface NormalizedProps {
39
+ disabled?: boolean;
40
+ invalid?: boolean;
41
+ invalidId?: string;
42
+ type?: string;
43
+ warn?: boolean;
44
+ warnId?: string;
45
+ validation: JSX.Element | null;
46
+ }
47
+ /**
48
+ * Returns an object containing non-colliding props and additional, generated ones.
49
+ * This hook ensures that only either "invalid" or "warn" is true but never both at
50
+ * the same time. Regardless whether "invalid" or "warn", the appropriate validation
51
+ * message is passed as "validation".
52
+ * It also ensure that neither "invalid", nor "warn", nor "disabled" are enabled when
53
+ * "readonly" is passed as "readonly" takes precedence.
54
+
55
+ */
56
+ export declare function useNormalizedInputProps({ disabled, id, invalid, invalidText, readOnly, type, warn, warnText, }: InputProps): NormalizedProps;
57
+ export {};
@@ -1,4 +1,43 @@
1
- const p = "phillips";
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ const a = "phillips", p = () => {
3
+ };
4
+ function u({
5
+ disabled: l = !1,
6
+ id: r,
7
+ invalid: d = !1,
8
+ invalidText: t = "invalid",
9
+ readOnly: o = !1,
10
+ type: n,
11
+ warn: v = !1,
12
+ warnText: e
13
+ }) {
14
+ const i = {
15
+ disabled: !o && l,
16
+ invalid: !o && !l && d,
17
+ invalidId: `${r}-error-msg`,
18
+ type: n === "toggle" ? "checkbox" : n,
19
+ warn: !o && !l && !d && v,
20
+ warnId: `${r}-warn-msg`,
21
+ validation: null
22
+ };
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;
38
+ }
2
39
  export {
3
- p as px
40
+ p as noOP,
41
+ a as px,
42
+ u as useNormalizedInputProps
4
43
  };