@kaizen/components 2.5.0 → 3.0.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/cjs/src/Button/Button.cjs +2 -4
- package/dist/cjs/src/GuidanceBlock/GuidanceBlock.cjs +16 -82
- package/dist/cjs/src/GuidanceBlock/GuidanceBlock.module.css.cjs +0 -1
- package/dist/cjs/src/LinkButton/LinkButton.cjs +2 -4
- package/dist/cjs/src/Modal/ConfirmationModal/ConfirmationModal.cjs +3 -2
- package/dist/cjs/src/Modal/ContextModal/ContextModal.cjs +0 -1
- package/dist/cjs/src/Modal/GenericModal/GenericModal.cjs +2 -2
- package/dist/cjs/src/Modal/GenericModal/subcomponents/ModalFooter/ModalFooter.cjs +3 -6
- package/dist/cjs/src/Select/Select.cjs +14 -15
- package/dist/cjs/src/Select/Select.module.scss.cjs +0 -1
- package/dist/cjs/src/SingleSelect/SingleSelect.cjs +12 -19
- package/dist/cjs/src/SingleSelect/subcomponents/SelectToggle/SelectToggle.cjs +3 -5
- package/dist/cjs/src/SingleSelect/subcomponents/SelectToggle/SelectToggle.module.scss.cjs +0 -1
- package/dist/cjs/src/TimeField/TimeField.cjs +2 -3
- package/dist/esm/src/Button/Button.mjs +2 -4
- package/dist/esm/src/GuidanceBlock/GuidanceBlock.mjs +18 -84
- package/dist/esm/src/GuidanceBlock/GuidanceBlock.module.css.mjs +0 -1
- package/dist/esm/src/LinkButton/LinkButton.mjs +2 -4
- package/dist/esm/src/Modal/ConfirmationModal/ConfirmationModal.mjs +3 -2
- package/dist/esm/src/Modal/ContextModal/ContextModal.mjs +0 -1
- package/dist/esm/src/Modal/GenericModal/GenericModal.mjs +2 -2
- package/dist/esm/src/Modal/GenericModal/subcomponents/ModalFooter/ModalFooter.mjs +3 -6
- package/dist/esm/src/Select/Select.mjs +14 -15
- package/dist/esm/src/Select/Select.module.scss.mjs +0 -1
- package/dist/esm/src/SingleSelect/SingleSelect.mjs +12 -19
- package/dist/esm/src/SingleSelect/subcomponents/SelectToggle/SelectToggle.mjs +3 -5
- package/dist/esm/src/SingleSelect/subcomponents/SelectToggle/SelectToggle.module.scss.mjs +0 -1
- package/dist/esm/src/TimeField/TimeField.mjs +2 -3
- package/dist/styles.css +0 -94
- package/dist/types/Button/Button.d.ts +0 -5
- package/dist/types/Calendar/CalendarRange/CalendarRange.d.ts +2 -1
- package/dist/types/Calendar/CalendarSingle/CalendarSingle.d.ts +2 -1
- package/dist/types/Calendar/types.d.ts +1 -0
- package/dist/types/GuidanceBlock/GuidanceBlock.d.ts +1 -26
- package/dist/types/Input/Input/Input.d.ts +1 -6
- package/dist/types/Modal/GenericModal/subcomponents/ModalFooter/ModalFooter.d.ts +1 -5
- package/dist/types/Select/Select.d.ts +3 -13
- package/dist/types/SingleSelect/SingleSelect.d.ts +2 -24
- package/dist/types/SingleSelect/subcomponents/SelectToggle/SelectToggle.d.ts +2 -12
- package/dist/types/TextArea/TextArea.d.ts +1 -6
- package/dist/types/TimeField/TimeField.d.ts +1 -1
- package/package.json +1 -2
- package/src/Button/Button.tsx +1 -8
- package/src/Button/_docs/Button--api-specification.mdx +0 -1
- package/src/Calendar/CalendarRange/CalendarRange.tsx +4 -1
- package/src/Calendar/CalendarSingle/CalendarSingle.tsx +4 -1
- package/src/Calendar/types.ts +18 -0
- package/src/GuidanceBlock/GuidanceBlock.module.css +0 -8
- package/src/GuidanceBlock/GuidanceBlock.spec.tsx +1 -26
- package/src/GuidanceBlock/GuidanceBlock.tsx +2 -112
- package/src/GuidanceBlock/_docs/GuidanceBlock.stories.tsx +0 -90
- package/src/Input/Input/Input.module.scss +0 -31
- package/src/Input/Input/Input.tsx +1 -6
- package/src/LinkButton/LinkButton.tsx +1 -3
- package/src/LinkButton/_docs/LinkButton--api-specification.mdx +0 -1
- package/src/Modal/ConfirmationModal/ConfirmationModal.tsx +7 -6
- package/src/Modal/ContextModal/ContextModal.tsx +0 -1
- package/src/Modal/GenericModal/GenericModal.tsx +3 -4
- package/src/Modal/GenericModal/subcomponents/ModalFooter/ModalFooter.tsx +2 -8
- package/src/Select/Select.module.scss +0 -16
- package/src/Select/Select.tsx +16 -19
- package/src/SingleSelect/SingleSelect.tsx +1 -14
- package/src/SingleSelect/_docs/SingleSelect.stories.tsx +5 -2
- package/src/SingleSelect/subcomponents/SelectToggle/SelectToggle.module.scss +0 -8
- package/src/SingleSelect/subcomponents/SelectToggle/SelectToggle.tsx +2 -9
- package/src/TextArea/TextArea.tsx +1 -6
- package/src/TimeField/TimeField.tsx +2 -9
- package/dist/cjs/src/Modal/util/console.cjs +0 -16
- package/dist/esm/src/Modal/util/console.mjs +0 -13
- package/dist/types/Modal/util/console.d.ts +0 -5
- package/dist/types/utils/useResizeObserver.d.ts +0 -22
- package/src/Modal/util/console.ts +0 -13
- package/src/utils/useResizeObserver.ts +0 -73
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
$input-height: 48px;
|
|
9
9
|
$input-base-padding-horizontal: $spacing-sm;
|
|
10
10
|
$input-icon-size: 1.25rem; // 20px
|
|
11
|
-
$input-placeholder-opacity: 0.5;
|
|
12
11
|
$input-disabled-background: $color-gray-300;
|
|
13
12
|
$input-disabled-opacity: 0.3;
|
|
14
13
|
$input-disabled-border-alpha: 50%;
|
|
@@ -45,29 +44,17 @@
|
|
|
45
44
|
width: 100%;
|
|
46
45
|
margin-bottom: 2px;
|
|
47
46
|
|
|
48
|
-
@include form-input-placeholder {
|
|
49
|
-
opacity: 100%;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
47
|
&:focus:not([disabled]),
|
|
53
48
|
&:hover:focus:not([disabled]) {
|
|
54
49
|
outline: var(--border-focus-ring-border-width) var(--border-focus-ring-border-style)
|
|
55
50
|
var(--color-blue-500);
|
|
56
51
|
outline-offset: 1px;
|
|
57
|
-
|
|
58
|
-
@include form-input-placeholder {
|
|
59
|
-
opacity: 0%;
|
|
60
|
-
}
|
|
61
52
|
}
|
|
62
53
|
|
|
63
54
|
&.disabled {
|
|
64
55
|
&:not(.reversed) {
|
|
65
56
|
background: $input-disabled-background;
|
|
66
57
|
}
|
|
67
|
-
|
|
68
|
-
@include form-input-placeholder {
|
|
69
|
-
color: rgba($color-purple-800-rgb, $input-disabled-opacity);
|
|
70
|
-
}
|
|
71
58
|
}
|
|
72
59
|
}
|
|
73
60
|
|
|
@@ -204,11 +191,6 @@
|
|
|
204
191
|
display: flex;
|
|
205
192
|
align-items: center;
|
|
206
193
|
|
|
207
|
-
@include form-input-placeholder {
|
|
208
|
-
color: $color-purple-800;
|
|
209
|
-
opacity: $input-placeholder-opacity;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
194
|
@include form-input-focus-state {
|
|
213
195
|
background-color: $color-gray-200;
|
|
214
196
|
}
|
|
@@ -221,10 +203,6 @@
|
|
|
221
203
|
background-color: $color-white;
|
|
222
204
|
border-color: rgba($color-gray-500-rgb, $input-disabled-opacity);
|
|
223
205
|
color: rgba($color-purple-800-rgb, $input-disabled-opacity);
|
|
224
|
-
|
|
225
|
-
@include form-input-placeholder {
|
|
226
|
-
opacity: $input-disabled-opacity;
|
|
227
|
-
}
|
|
228
206
|
}
|
|
229
207
|
|
|
230
208
|
&:not(.error, .caution) {
|
|
@@ -261,11 +239,6 @@
|
|
|
261
239
|
background: transparent;
|
|
262
240
|
color: $color-white;
|
|
263
241
|
|
|
264
|
-
@include form-input-placeholder {
|
|
265
|
-
color: $color-white;
|
|
266
|
-
opacity: $input-placeholder-opacity;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
242
|
@include form-input-focus-state {
|
|
270
243
|
background: rgba($color-white-rgb, 0.1);
|
|
271
244
|
}
|
|
@@ -289,10 +262,6 @@
|
|
|
289
262
|
&.disabled {
|
|
290
263
|
background: transparent;
|
|
291
264
|
color: rgba($color-white-rgb, $input-disabled-opacity);
|
|
292
|
-
|
|
293
|
-
@include form-input-placeholder {
|
|
294
|
-
opacity: $input-disabled-opacity;
|
|
295
|
-
}
|
|
296
265
|
}
|
|
297
266
|
|
|
298
267
|
&.error {
|
|
@@ -14,12 +14,7 @@ export type InputProps = {
|
|
|
14
14
|
endIconAdornment?: React.ReactNode
|
|
15
15
|
reversed?: boolean
|
|
16
16
|
type?: InputType
|
|
17
|
-
|
|
18
|
-
* @deprecated Use of placeholder text goes against our a11y standards.
|
|
19
|
-
* Use the `labelText` prop to provide a concise name, and the `description` prop for any help text.
|
|
20
|
-
*/
|
|
21
|
-
placeholder?: string
|
|
22
|
-
} & OverrideClassName<InputHTMLAttributes<HTMLInputElement>>
|
|
17
|
+
} & OverrideClassName<Omit<InputHTMLAttributes<HTMLInputElement>, 'placeholder'>>
|
|
23
18
|
|
|
24
19
|
export const Input = ({
|
|
25
20
|
inputRef,
|
|
@@ -25,13 +25,11 @@ export const LinkButton = forwardRef(
|
|
|
25
25
|
isFullWidth = false,
|
|
26
26
|
isDisabled,
|
|
27
27
|
className,
|
|
28
|
-
isReversed,
|
|
29
28
|
...otherProps
|
|
30
29
|
}: LinkButtonProps,
|
|
31
30
|
ref: React.ForwardedRef<HTMLAnchorElement>,
|
|
32
31
|
) => {
|
|
33
|
-
const
|
|
34
|
-
const isReversedVariant = isReversed ?? shouldUseReverse
|
|
32
|
+
const isReversedVariant = useReversedColors()
|
|
35
33
|
|
|
36
34
|
return (
|
|
37
35
|
<RACLink
|
|
@@ -102,7 +102,12 @@ export const ConfirmationModal = ({
|
|
|
102
102
|
const footerActions: ButtonProps[] = []
|
|
103
103
|
|
|
104
104
|
if (onConfirm) {
|
|
105
|
-
const confirmAction = {
|
|
105
|
+
const confirmAction = {
|
|
106
|
+
label: confirmLabel,
|
|
107
|
+
onClick: onConfirm,
|
|
108
|
+
destructive: variant === 'warning',
|
|
109
|
+
primary: variant !== 'warning',
|
|
110
|
+
}
|
|
106
111
|
const workingProps = confirmWorking
|
|
107
112
|
? {
|
|
108
113
|
working: true,
|
|
@@ -154,11 +159,7 @@ export const ConfirmationModal = ({
|
|
|
154
159
|
<ModalAccessibleDescription>{children}</ModalAccessibleDescription>
|
|
155
160
|
</div>
|
|
156
161
|
</ModalBody>
|
|
157
|
-
<ModalFooter
|
|
158
|
-
actions={footerActions}
|
|
159
|
-
appearance={variant == 'warning' ? 'destructive' : 'primary'}
|
|
160
|
-
unpadded={unpadded}
|
|
161
|
-
/>
|
|
162
|
+
<ModalFooter actions={footerActions} unpadded={unpadded} />
|
|
162
163
|
</div>
|
|
163
164
|
</GenericModal>
|
|
164
165
|
)
|
|
@@ -5,7 +5,6 @@ import classnames from 'classnames'
|
|
|
5
5
|
import { FocusOn } from 'react-focus-on'
|
|
6
6
|
import { useIsClientReady } from '../../utils/useIsClientReady'
|
|
7
7
|
|
|
8
|
-
import { warn } from '../util/console'
|
|
9
8
|
import { ModalContext } from './context/ModalContext'
|
|
10
9
|
import styles from './GenericModal.module.scss'
|
|
11
10
|
|
|
@@ -63,9 +62,9 @@ export const GenericModal = ({
|
|
|
63
62
|
// Ensure that consumers have provided an element that labels the modal
|
|
64
63
|
// to meet ARIA accessibility guidelines.
|
|
65
64
|
if (!document.getElementById(labelledByID)) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
Make sure you have a <ModalAccessibleLabel /> component with content that labels the modal
|
|
65
|
+
// eslint-disable-next-line no-console
|
|
66
|
+
console.warn(
|
|
67
|
+
'When using the Modal component, you must provide a label for the modal. Make sure you have a <ModalAccessibleLabel /> component with content that labels the modal.',
|
|
69
68
|
)
|
|
70
69
|
}
|
|
71
70
|
}
|
|
@@ -18,10 +18,6 @@ export type ModalFooterProps = {
|
|
|
18
18
|
'variant'?: ActionsVariantProps
|
|
19
19
|
'unpadded'?: boolean
|
|
20
20
|
'actions': ButtonProps[]
|
|
21
|
-
/**
|
|
22
|
-
* @deprecated we are no longer supporting different appearances for ModalFooter, instead there will only be a single default appearance set by the Button.
|
|
23
|
-
*/
|
|
24
|
-
'appearance'?: 'primary' | 'destructive'
|
|
25
21
|
'data-testid'?: string
|
|
26
22
|
'alignStart'?: boolean
|
|
27
23
|
} & HTMLAttributes<HTMLDivElement>
|
|
@@ -29,7 +25,6 @@ export type ModalFooterProps = {
|
|
|
29
25
|
export const ModalFooter = ({
|
|
30
26
|
unpadded,
|
|
31
27
|
actions,
|
|
32
|
-
appearance = 'primary',
|
|
33
28
|
alignStart,
|
|
34
29
|
variant,
|
|
35
30
|
...props
|
|
@@ -51,9 +46,8 @@ export const ModalFooter = ({
|
|
|
51
46
|
<div className={styles.actionButton} key={index}>
|
|
52
47
|
<Button
|
|
53
48
|
type="button"
|
|
54
|
-
primary={index === 0 &&
|
|
55
|
-
|
|
56
|
-
secondary={index > 0}
|
|
49
|
+
primary={index === 0 && !action.destructive && !action.secondary}
|
|
50
|
+
secondary={index > 0 && !action.destructive && !action.primary}
|
|
57
51
|
fullWidth={queries.isSmall}
|
|
58
52
|
{...action}
|
|
59
53
|
/>
|
|
@@ -22,8 +22,6 @@
|
|
|
22
22
|
|
|
23
23
|
// Should match the values for the Input component
|
|
24
24
|
$input-height: 48px;
|
|
25
|
-
$input-placeholder-opacity: 0.7;
|
|
26
|
-
|
|
27
25
|
$focus-border-color: $color-blue-500;
|
|
28
26
|
|
|
29
27
|
%focus-border {
|
|
@@ -106,12 +104,6 @@ $focus-border-color: $color-blue-500;
|
|
|
106
104
|
}
|
|
107
105
|
}
|
|
108
106
|
|
|
109
|
-
.placeholder {
|
|
110
|
-
@include base-font-style;
|
|
111
|
-
|
|
112
|
-
opacity: $input-placeholder-opacity;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
107
|
.menu {
|
|
116
108
|
// Temporary 6px until we redesign this component with Inter
|
|
117
109
|
border: 6px $border-solid-border-style transparent;
|
|
@@ -227,10 +219,6 @@ $focus-border-color: $color-blue-500;
|
|
|
227
219
|
color: $color-white;
|
|
228
220
|
}
|
|
229
221
|
|
|
230
|
-
.placeholder {
|
|
231
|
-
color: $color-white;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
222
|
&.error {
|
|
235
223
|
.control {
|
|
236
224
|
border: $border-solid-border-width $border-solid-border-style $color-red-300;
|
|
@@ -304,10 +292,6 @@ $focus-border-color: $color-blue-500;
|
|
|
304
292
|
border-color: $secondary-reversed-focus-color;
|
|
305
293
|
}
|
|
306
294
|
}
|
|
307
|
-
|
|
308
|
-
.placeholder {
|
|
309
|
-
color: $color-white;
|
|
310
|
-
}
|
|
311
295
|
}
|
|
312
296
|
}
|
|
313
297
|
|
package/src/Select/Select.tsx
CHANGED
|
@@ -37,12 +37,14 @@ export type SelectProps = {
|
|
|
37
37
|
* @default false
|
|
38
38
|
*/
|
|
39
39
|
fullWidth?: boolean
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
} & Omit<ReactSelectProps<any, boolean>, 'placeholder'>
|
|
41
|
+
|
|
42
|
+
// react-select defaults to showing "Select..." placeholder text, which goes against our a11y
|
|
43
|
+
// standards — use `label` for the field name and `description` for help text instead.
|
|
44
|
+
// `noPlaceholderText` overrides the default string; `NullPlaceholder` removes the empty DOM node
|
|
45
|
+
// that react-select still renders even when the text is empty.
|
|
46
|
+
const noPlaceholderText = ''
|
|
47
|
+
const NullPlaceholder = (): null => null
|
|
46
48
|
|
|
47
49
|
/**
|
|
48
50
|
* {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3081896474/Select Guidance} |
|
|
@@ -59,7 +61,6 @@ export const Select = React.forwardRef<any, SelectProps>(
|
|
|
59
61
|
description,
|
|
60
62
|
fullWidth: propsFullWidth,
|
|
61
63
|
className: propsClassName,
|
|
62
|
-
placeholder,
|
|
63
64
|
...props
|
|
64
65
|
},
|
|
65
66
|
ref,
|
|
@@ -94,10 +95,10 @@ export const Select = React.forwardRef<any, SelectProps>(
|
|
|
94
95
|
{...props}
|
|
95
96
|
ref={ref}
|
|
96
97
|
aria-labelledby={labelId}
|
|
97
|
-
placeholder={
|
|
98
|
+
placeholder={noPlaceholderText}
|
|
98
99
|
components={{
|
|
99
100
|
Control,
|
|
100
|
-
Placeholder,
|
|
101
|
+
Placeholder: NullPlaceholder,
|
|
101
102
|
DropdownIndicator,
|
|
102
103
|
Menu,
|
|
103
104
|
GroupHeading,
|
|
@@ -122,17 +123,19 @@ export const Select = React.forwardRef<any, SelectProps>(
|
|
|
122
123
|
Select.displayName = 'Select'
|
|
123
124
|
|
|
124
125
|
interface AsyncProps
|
|
125
|
-
extends
|
|
126
|
+
extends
|
|
127
|
+
Omit<ReactAsyncSelectProps<any, boolean, any>, 'placeholder'>,
|
|
128
|
+
Omit<ReactSelectProps<any, boolean, any>, 'placeholder'> {}
|
|
126
129
|
|
|
127
130
|
export const AsyncSelect = React.forwardRef(
|
|
128
|
-
({ className: propsClassName,
|
|
131
|
+
({ className: propsClassName, ...props }: AsyncProps, ref: React.Ref<any>) => (
|
|
129
132
|
<Async
|
|
130
133
|
{...props}
|
|
131
134
|
ref={ref}
|
|
132
|
-
placeholder={
|
|
135
|
+
placeholder={noPlaceholderText}
|
|
133
136
|
components={{
|
|
134
137
|
Control,
|
|
135
|
-
Placeholder,
|
|
138
|
+
Placeholder: NullPlaceholder,
|
|
136
139
|
DropdownIndicator,
|
|
137
140
|
Menu,
|
|
138
141
|
Option,
|
|
@@ -165,12 +168,6 @@ const Control: typeof components.Control = (props) => (
|
|
|
165
168
|
</div>
|
|
166
169
|
)
|
|
167
170
|
|
|
168
|
-
const Placeholder: typeof components.Placeholder = (props) => (
|
|
169
|
-
<components.Placeholder {...props} className={styles.placeholderOverrides}>
|
|
170
|
-
<span className={styles.placeholder}>{props.children}</span>
|
|
171
|
-
</components.Placeholder>
|
|
172
|
-
)
|
|
173
|
-
|
|
174
171
|
const DropdownIndicator: typeof components.DropdownIndicator = (props) => (
|
|
175
172
|
<components.DropdownIndicator {...props} className={styles.dropdownIndicator}>
|
|
176
173
|
<Icon
|
|
@@ -10,7 +10,6 @@ import { Popover, useFloating } from '~components/MultiSelect/subcomponents/Popo
|
|
|
10
10
|
import { type OverrideClassName } from '~components/types/OverrideClassName'
|
|
11
11
|
import { SelectProvider } from './context'
|
|
12
12
|
import {
|
|
13
|
-
ListBox,
|
|
14
13
|
ListBoxSection,
|
|
15
14
|
ListItem,
|
|
16
15
|
Option,
|
|
@@ -69,16 +68,11 @@ export type SingleSelectProps<Option extends SingleSelectOption = SingleSelectOp
|
|
|
69
68
|
* Creates a portal for the Popover to the matching element id
|
|
70
69
|
*/
|
|
71
70
|
portalContainerId?: string
|
|
72
|
-
/**
|
|
73
|
-
* @deprecated Use of placeholder text goes against our a11y standards.
|
|
74
|
-
* Use the `labelText` prop to provide a concise name, and the `description` prop for any help text.
|
|
75
|
-
*/
|
|
76
|
-
placeholder?: string
|
|
77
71
|
/**
|
|
78
72
|
* Handler that is called when the selection changes.
|
|
79
73
|
*/
|
|
80
74
|
onSelectionChange?: (key: Key) => void
|
|
81
|
-
} & OverrideClassName<Omit<AriaSelectProps<Option>, OmittedAriaSelectProps>>
|
|
75
|
+
} & OverrideClassName<Omit<AriaSelectProps<Option>, OmittedAriaSelectProps | 'placeholder'>>
|
|
82
76
|
|
|
83
77
|
/**
|
|
84
78
|
* {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3081896474/Select Guidance} |
|
|
@@ -98,7 +92,6 @@ export const SingleSelect = <Option extends SingleSelectOption = SingleSelectOpt
|
|
|
98
92
|
classNameOverride,
|
|
99
93
|
selectedKey,
|
|
100
94
|
description,
|
|
101
|
-
placeholder = '',
|
|
102
95
|
isDisabled,
|
|
103
96
|
onSelectionChange,
|
|
104
97
|
portalContainerId,
|
|
@@ -121,7 +114,6 @@ export const SingleSelect = <Option extends SingleSelectOption = SingleSelectOpt
|
|
|
121
114
|
disabledKeys: disabledKeys,
|
|
122
115
|
selectedKey: typeof selectedKey === 'number' ? selectedKey.toString() : selectedKey,
|
|
123
116
|
description,
|
|
124
|
-
placeholder,
|
|
125
117
|
isDisabled,
|
|
126
118
|
isRequired,
|
|
127
119
|
onSelectionChange: onSelectionChange ? (key) => onSelectionChange(key!) : undefined,
|
|
@@ -158,7 +150,6 @@ export const SingleSelect = <Option extends SingleSelectOption = SingleSelectOpt
|
|
|
158
150
|
'value': state?.selectedItem?.rendered,
|
|
159
151
|
valueProps,
|
|
160
152
|
'isOpen': state.isOpen,
|
|
161
|
-
placeholder,
|
|
162
153
|
status,
|
|
163
154
|
'isDisabled': triggerProps.isDisabled,
|
|
164
155
|
isReversed,
|
|
@@ -225,7 +216,3 @@ SingleSelect.Section = ListBoxSection
|
|
|
225
216
|
SingleSelect.SectionDivider = SectionDivider
|
|
226
217
|
SingleSelect.Option = Option
|
|
227
218
|
SingleSelect.ItemDefaultRender = ListItem
|
|
228
|
-
|
|
229
|
-
// @deprecated Legacy exported aliases
|
|
230
|
-
SingleSelect.TriggerButton = SelectToggle
|
|
231
|
-
SingleSelect.ListBox = ListBox
|
|
@@ -6,6 +6,7 @@ import { FieldMessage } from '~components/FieldMessage'
|
|
|
6
6
|
import { ContextModal } from '~components/Modal'
|
|
7
7
|
import { RadioField, RadioGroup } from '~components/Radio'
|
|
8
8
|
import { SingleSelect } from '../SingleSelect'
|
|
9
|
+
import { SelectToggle } from '../subcomponents'
|
|
9
10
|
import { type SingleSelectOption } from '../types'
|
|
10
11
|
import { groupedMockItems, mixedMockItemsDisabled, singleMockItems } from './mockData'
|
|
11
12
|
|
|
@@ -125,13 +126,15 @@ export const AdditionalProperties: Story = {
|
|
|
125
126
|
}
|
|
126
127
|
|
|
127
128
|
const sourceCodeCustomiseTrigger = `
|
|
129
|
+
import { SelectToggle } from '@kaizen/components/subcomponents'
|
|
130
|
+
|
|
128
131
|
<SingleSelect
|
|
129
|
-
trigger={props => <
|
|
132
|
+
trigger={props => <SelectToggle {...props} id="select--custom-trigger" />}
|
|
130
133
|
/>
|
|
131
134
|
`
|
|
132
135
|
export const CustomiseTrigger: Story = {
|
|
133
136
|
args: {
|
|
134
|
-
trigger: (props) => <
|
|
137
|
+
trigger: (props) => <SelectToggle {...props} id="select--custom-trigger" />,
|
|
135
138
|
},
|
|
136
139
|
parameters: {
|
|
137
140
|
docs: {
|
|
@@ -63,10 +63,6 @@
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
.placeholder {
|
|
67
|
-
color: rgb($color-purple-800-rgb, 0.7);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
66
|
.error {
|
|
71
67
|
border: $border-solid-border-width $border-solid-border-style $color-red-500;
|
|
72
68
|
}
|
|
@@ -87,10 +83,6 @@
|
|
|
87
83
|
background-color: transparent;
|
|
88
84
|
color: $color-white;
|
|
89
85
|
|
|
90
|
-
&.placeholder {
|
|
91
|
-
color: rgba($color-white-rgb, 0.65);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
86
|
&.selectToggle .icon {
|
|
95
87
|
color: rgb(255, 255, 255, 0.8);
|
|
96
88
|
}
|
|
@@ -13,17 +13,12 @@ export type SelectToggleProps = {
|
|
|
13
13
|
/** Props for the element representing the selected value. */
|
|
14
14
|
valueProps: DOMAttributes<FocusableElement>
|
|
15
15
|
isOpen?: boolean
|
|
16
|
-
/**
|
|
17
|
-
* @deprecated Use of placeholder text goes against our a11y standards.
|
|
18
|
-
* Use the `labelText` prop to provide a concise name, and the `description` prop for any help text.
|
|
19
|
-
*/
|
|
20
|
-
placeholder?: string
|
|
21
16
|
/** Updates the styling of the validation. */
|
|
22
17
|
status?: 'error' | 'caution'
|
|
23
18
|
isDisabled?: boolean
|
|
24
19
|
/** Use the `reversed` styles. */
|
|
25
20
|
isReversed?: boolean
|
|
26
|
-
} & OverrideClassName<HTMLAttributes<HTMLButtonElement>>
|
|
21
|
+
} & OverrideClassName<Omit<HTMLAttributes<HTMLButtonElement>, 'placeholder'>>
|
|
27
22
|
|
|
28
23
|
export const SelectToggle = React.forwardRef<HTMLButtonElement, SelectToggleProps>(
|
|
29
24
|
(
|
|
@@ -33,7 +28,6 @@ export const SelectToggle = React.forwardRef<HTMLButtonElement, SelectToggleProp
|
|
|
33
28
|
value,
|
|
34
29
|
valueProps,
|
|
35
30
|
isOpen,
|
|
36
|
-
placeholder = 'Select',
|
|
37
31
|
status,
|
|
38
32
|
isDisabled,
|
|
39
33
|
isReversed,
|
|
@@ -55,7 +49,6 @@ export const SelectToggle = React.forwardRef<HTMLButtonElement, SelectToggleProp
|
|
|
55
49
|
ref={ref}
|
|
56
50
|
className={classnames(
|
|
57
51
|
styles.selectToggle,
|
|
58
|
-
(value === null || value === undefined) && styles.placeholder,
|
|
59
52
|
status === 'error' && styles.error,
|
|
60
53
|
status === 'caution' && styles.caution,
|
|
61
54
|
isDisabled && styles.disabled,
|
|
@@ -64,7 +57,7 @@ export const SelectToggle = React.forwardRef<HTMLButtonElement, SelectToggleProp
|
|
|
64
57
|
)}
|
|
65
58
|
>
|
|
66
59
|
<span {...valueProps} className={styles.value}>
|
|
67
|
-
{value
|
|
60
|
+
{value}
|
|
68
61
|
</span>
|
|
69
62
|
<Icon
|
|
70
63
|
name={isOpen ? 'keyboard_arrow_up' : 'keyboard_arrow_down'}
|
|
@@ -12,12 +12,7 @@ export type TextAreaProps = {
|
|
|
12
12
|
*/
|
|
13
13
|
autogrow?: boolean
|
|
14
14
|
reversed?: boolean
|
|
15
|
-
|
|
16
|
-
* @deprecated Use of placeholder text goes against our a11y standards.
|
|
17
|
-
* Use the `labelText` prop to provide a concise name, and the `description` prop for any help text.
|
|
18
|
-
*/
|
|
19
|
-
placeholder?: string
|
|
20
|
-
} & OverrideClassName<TextareaHTMLAttributes<HTMLTextAreaElement>>
|
|
15
|
+
} & OverrideClassName<Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'placeholder'>>
|
|
21
16
|
|
|
22
17
|
export const TextArea = ({
|
|
23
18
|
textAreaRef: propsTextAreaRef,
|
|
@@ -11,13 +11,7 @@ import { TimeSegment } from './subcomponents/TimeSegment'
|
|
|
11
11
|
import { type StatusType, type TimeValue, type ValueType } from './types'
|
|
12
12
|
import styles from './TimeField.module.scss'
|
|
13
13
|
|
|
14
|
-
type OmittedTimeFieldProps =
|
|
15
|
-
| 'errorMessage'
|
|
16
|
-
| 'validationState'
|
|
17
|
-
| 'value'
|
|
18
|
-
| 'onChange'
|
|
19
|
-
| 'label'
|
|
20
|
-
| 'hideTimeZone'
|
|
14
|
+
type OmittedTimeFieldProps = 'errorMessage' | 'value' | 'onChange' | 'label' | 'hideTimeZone'
|
|
21
15
|
|
|
22
16
|
export type TimeFieldProps = {
|
|
23
17
|
id?: string
|
|
@@ -80,7 +74,6 @@ const TimeFieldComponent = ({
|
|
|
80
74
|
isDisabled,
|
|
81
75
|
hideTimeZone: true,
|
|
82
76
|
locale,
|
|
83
|
-
validationState: status === 'default' ? 'valid' : 'invalid',
|
|
84
77
|
})
|
|
85
78
|
|
|
86
79
|
const hasError = !!validationMessage && status === 'error'
|
|
@@ -111,7 +104,7 @@ const TimeFieldComponent = ({
|
|
|
111
104
|
className={classnames(
|
|
112
105
|
styles.input,
|
|
113
106
|
state.isDisabled && styles.isDisabled,
|
|
114
|
-
|
|
107
|
+
status === 'error' && styles.error,
|
|
115
108
|
)}
|
|
116
109
|
>
|
|
117
110
|
{state.segments.map((segment, i) => {
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var yellow = '\u001b[33m ';
|
|
4
|
-
var reset = '\u001b[0m ';
|
|
5
|
-
/**
|
|
6
|
-
* @deprecated Do not use ever again
|
|
7
|
-
*/
|
|
8
|
-
var warn = function (message) {
|
|
9
|
-
// eslint-disable-next-line no-console
|
|
10
|
-
console.warn("".concat(yellow, "\nCULTUREAMP UI WARNING:\n").concat(singleLine(message)).concat(reset, "\n"));
|
|
11
|
-
};
|
|
12
|
-
var singleLine = function (message) {
|
|
13
|
-
return message.replace(/^ +/gm, ' ').replace(/\n|\r/gm, '').trim();
|
|
14
|
-
};
|
|
15
|
-
exports.singleLine = singleLine;
|
|
16
|
-
exports.warn = warn;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
var yellow = '\u001b[33m ';
|
|
2
|
-
var reset = '\u001b[0m ';
|
|
3
|
-
/**
|
|
4
|
-
* @deprecated Do not use ever again
|
|
5
|
-
*/
|
|
6
|
-
var warn = function (message) {
|
|
7
|
-
// eslint-disable-next-line no-console
|
|
8
|
-
console.warn("".concat(yellow, "\nCULTUREAMP UI WARNING:\n").concat(singleLine(message)).concat(reset, "\n"));
|
|
9
|
-
};
|
|
10
|
-
var singleLine = function (message) {
|
|
11
|
-
return message.replace(/^ +/gm, ' ').replace(/\n|\r/gm, '').trim();
|
|
12
|
-
};
|
|
13
|
-
export { singleLine, warn };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { type Ref } from 'react';
|
|
2
|
-
export interface DOMRectReadOnly {
|
|
3
|
-
readonly x: number;
|
|
4
|
-
readonly y: number;
|
|
5
|
-
readonly width: number;
|
|
6
|
-
readonly height: number;
|
|
7
|
-
readonly top: number;
|
|
8
|
-
readonly right: number;
|
|
9
|
-
readonly bottom: number;
|
|
10
|
-
readonly left: number;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Hook for observing changes to a DOM element via ResizeObserver.
|
|
14
|
-
*
|
|
15
|
-
* @param {resolveEntryCallback} resolveEntry - Callback for resolving the
|
|
16
|
-
* desired value from each ResizeObserverEntry emitted by ResizeObserver
|
|
17
|
-
* @return {Array} An array containing a ref for binding to the observed DOM
|
|
18
|
-
* element, and the current value of the callback-resolved ResizeObserverEntry
|
|
19
|
-
* @callback resolveEntryCallback
|
|
20
|
-
* @deprecated use native `ResizeObserver` DOM API instead
|
|
21
|
-
*/
|
|
22
|
-
export declare const useResizeObserver: <T, E extends Element = HTMLElement>(resolveEntry?: (entry: ResizeObserverEntry) => any) => [Ref<E>, T | undefined];
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
const yellow = '\u001b[33m '
|
|
2
|
-
const reset = '\u001b[0m '
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @deprecated Do not use ever again
|
|
6
|
-
*/
|
|
7
|
-
export const warn = (message: string): void => {
|
|
8
|
-
// eslint-disable-next-line no-console
|
|
9
|
-
console.warn(`${yellow}\nCULTUREAMP UI WARNING:\n${singleLine(message)}${reset}\n`)
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const singleLine = (message: string): string =>
|
|
13
|
-
message.replace(/^ +/gm, ' ').replace(/\n|\r/gm, '').trim()
|