@kaizen/components 1.68.9 → 1.68.10
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.
|
@@ -27,27 +27,27 @@ var TextArea = function (_a) {
|
|
|
27
27
|
disabled = _a.disabled,
|
|
28
28
|
propsOnChange = _a.onChange,
|
|
29
29
|
restProps = tslib.__rest(_a, ["textAreaRef", "status", "autogrow", "reversed", "rows", "defaultValue", "value", "disabled", "onChange"]);
|
|
30
|
-
var _h = React.useState(
|
|
30
|
+
var _h = React.useState(defaultValue),
|
|
31
31
|
internalValue = _h[0],
|
|
32
32
|
setInternalValue = _h[1];
|
|
33
|
-
// ^
|
|
34
|
-
// essentially forces the textarea into an (interally) controlled mode if autogrow is true and mode is uncontrolled
|
|
35
|
-
var controlledValue = value !== null && value !== void 0 ? value : internalValue;
|
|
33
|
+
// ^holds an internal state of the value, used for the autogrow feature if uncontrolled (no `value` provided)
|
|
36
34
|
var fallbackRef = React.useRef(null);
|
|
37
35
|
var textAreaRef = propsTextAreaRef !== null && propsTextAreaRef !== void 0 ? propsTextAreaRef : fallbackRef;
|
|
38
36
|
var onChange = function (event) {
|
|
39
37
|
propsOnChange === null || propsOnChange === void 0 ? void 0 : propsOnChange(event);
|
|
40
|
-
|
|
38
|
+
if (!value && autogrow) {
|
|
39
|
+
setInternalValue(event.target.value);
|
|
40
|
+
}
|
|
41
41
|
};
|
|
42
42
|
return React__default.default.createElement("div", {
|
|
43
43
|
className: classnames__default.default(TextArea_module.wrapper, (_b = {}, _b[TextArea_module.wrapperAutogrow] = autogrow, _b)),
|
|
44
|
-
"data-value": autogrow ?
|
|
44
|
+
"data-value": autogrow ? value !== null && value !== void 0 ? value : internalValue : undefined
|
|
45
45
|
}, React__default.default.createElement("textarea", tslib.__assign({
|
|
46
46
|
className: classnames__default.default(TextArea_module.textarea, TextArea_module[status], reversed ? TextArea_module.reversed : TextArea_module.default, (_c = {}, _c[TextArea_module.disabled] = disabled, _c[TextArea_module.textareaAutogrow] = autogrow, _c)),
|
|
47
47
|
rows: rows,
|
|
48
48
|
onChange: onChange,
|
|
49
|
-
value:
|
|
50
|
-
defaultValue:
|
|
49
|
+
value: value,
|
|
50
|
+
defaultValue: value ? undefined : defaultValue,
|
|
51
51
|
// ^ React throws a warning if you specify both a value and a defaultValue
|
|
52
52
|
ref: textAreaRef,
|
|
53
53
|
disabled: disabled
|
|
@@ -19,27 +19,27 @@ const TextArea = /*#__PURE__*/function () {
|
|
|
19
19
|
disabled = _a.disabled,
|
|
20
20
|
propsOnChange = _a.onChange,
|
|
21
21
|
restProps = __rest(_a, ["textAreaRef", "status", "autogrow", "reversed", "rows", "defaultValue", "value", "disabled", "onChange"]);
|
|
22
|
-
var _h = useState(
|
|
22
|
+
var _h = useState(defaultValue),
|
|
23
23
|
internalValue = _h[0],
|
|
24
24
|
setInternalValue = _h[1];
|
|
25
|
-
// ^
|
|
26
|
-
// essentially forces the textarea into an (interally) controlled mode if autogrow is true and mode is uncontrolled
|
|
27
|
-
var controlledValue = value !== null && value !== void 0 ? value : internalValue;
|
|
25
|
+
// ^holds an internal state of the value, used for the autogrow feature if uncontrolled (no `value` provided)
|
|
28
26
|
var fallbackRef = useRef(null);
|
|
29
27
|
var textAreaRef = propsTextAreaRef !== null && propsTextAreaRef !== void 0 ? propsTextAreaRef : fallbackRef;
|
|
30
28
|
var onChange = function (event) {
|
|
31
29
|
propsOnChange === null || propsOnChange === void 0 ? void 0 : propsOnChange(event);
|
|
32
|
-
|
|
30
|
+
if (!value && autogrow) {
|
|
31
|
+
setInternalValue(event.target.value);
|
|
32
|
+
}
|
|
33
33
|
};
|
|
34
34
|
return /*#__PURE__*/React.createElement("div", {
|
|
35
35
|
className: classnames(styles.wrapper, (_b = {}, _b[styles.wrapperAutogrow] = autogrow, _b)),
|
|
36
|
-
"data-value": autogrow ?
|
|
36
|
+
"data-value": autogrow ? value !== null && value !== void 0 ? value : internalValue : undefined
|
|
37
37
|
}, /*#__PURE__*/React.createElement("textarea", __assign({
|
|
38
38
|
className: classnames(styles.textarea, styles[status], reversed ? styles.reversed : styles.default, (_c = {}, _c[styles.disabled] = disabled, _c[styles.textareaAutogrow] = autogrow, _c)),
|
|
39
39
|
rows: rows,
|
|
40
40
|
onChange: onChange,
|
|
41
|
-
value:
|
|
42
|
-
defaultValue:
|
|
41
|
+
value: value,
|
|
42
|
+
defaultValue: value ? undefined : defaultValue,
|
|
43
43
|
// ^ React throws a warning if you specify both a value and a defaultValue
|
|
44
44
|
ref: textAreaRef,
|
|
45
45
|
disabled: disabled
|
package/dist/styles.css
CHANGED
|
@@ -312,26 +312,6 @@
|
|
|
312
312
|
visibility: hidden;
|
|
313
313
|
}
|
|
314
314
|
|
|
315
|
-
.ButtonContent-module_buttonContent__v5mHZ {
|
|
316
|
-
display: inline-flex;
|
|
317
|
-
align-items: center;
|
|
318
|
-
gap: var(--button-icon-gap, var(--spacing-6));
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
.ButtonContent-module_large__mLOdb {
|
|
322
|
-
--button-icon-gap: var(--spacing-8);
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
.ButtonContent-module_buttonLabel__T5XAq {
|
|
326
|
-
display: inline-flex;
|
|
327
|
-
align-items: center;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
.ButtonContent-module_buttonIcon__qkAX- {
|
|
331
|
-
display: inline-flex;
|
|
332
|
-
align-items: center;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
315
|
.PendingContent-module_pendingContent__c4IFS {
|
|
336
316
|
display: inline-flex;
|
|
337
317
|
align-items: center;
|
|
@@ -349,37 +329,26 @@
|
|
|
349
329
|
transform: translate(-50%, -50%);
|
|
350
330
|
}
|
|
351
331
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
padding: 8px;
|
|
357
|
-
}
|
|
358
|
-
.OverlayArrow-module_overlayArrow__hoDyK[data-placement=top], .OverlayArrow-module_overlayArrow__hoDyK[data-placement=bottom] {
|
|
359
|
-
padding: 0 8px;
|
|
360
|
-
}
|
|
361
|
-
.OverlayArrow-module_overlayArrow__hoDyK[data-placement=left], .OverlayArrow-module_overlayArrow__hoDyK[data-placement=right] {
|
|
362
|
-
padding: 8px 0;
|
|
363
|
-
}
|
|
364
|
-
.OverlayArrow-module_overlayArrow__hoDyK path {
|
|
365
|
-
fill: var(--color-purple-800, #2f2438);
|
|
366
|
-
box-shadow: var(--shadow-small-box-shadow, 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 3px 16px 0 rgba(0, 0, 0, 0.06));
|
|
367
|
-
}
|
|
368
|
-
.OverlayArrow-module_overlayArrow__hoDyK[data-placement=right] svg {
|
|
369
|
-
transform: rotate(90deg);
|
|
370
|
-
}
|
|
371
|
-
.OverlayArrow-module_overlayArrow__hoDyK[data-placement=bottom] svg {
|
|
372
|
-
transform: rotate(180deg);
|
|
332
|
+
.ButtonContent-module_buttonContent__v5mHZ {
|
|
333
|
+
display: inline-flex;
|
|
334
|
+
align-items: center;
|
|
335
|
+
gap: var(--button-icon-gap, var(--spacing-6));
|
|
373
336
|
}
|
|
374
|
-
|
|
375
|
-
|
|
337
|
+
|
|
338
|
+
.ButtonContent-module_large__mLOdb {
|
|
339
|
+
--button-icon-gap: var(--spacing-8);
|
|
376
340
|
}
|
|
377
|
-
|
|
378
|
-
|
|
341
|
+
|
|
342
|
+
.ButtonContent-module_buttonLabel__T5XAq {
|
|
343
|
+
display: inline-flex;
|
|
344
|
+
align-items: center;
|
|
379
345
|
}
|
|
380
|
-
|
|
346
|
+
|
|
347
|
+
.ButtonContent-module_buttonIcon__qkAX- {
|
|
381
348
|
display: inline-flex;
|
|
349
|
+
align-items: center;
|
|
382
350
|
}
|
|
351
|
+
|
|
383
352
|
/** THIS IS AN AUTOGENERATED FILE **/
|
|
384
353
|
/** THIS IS AN AUTOGENERATED FILE **/
|
|
385
354
|
/** THIS IS AN AUTOGENERATED FILE **/
|
|
@@ -436,6 +405,37 @@
|
|
|
436
405
|
opacity: 1;
|
|
437
406
|
}
|
|
438
407
|
}
|
|
408
|
+
.Focusable-module_focusableWrapper__NfuIi {
|
|
409
|
+
display: inline-flex;
|
|
410
|
+
}
|
|
411
|
+
/** THIS IS AN AUTOGENERATED FILE **/
|
|
412
|
+
/** THIS IS AN AUTOGENERATED FILE **/
|
|
413
|
+
.OverlayArrow-module_overlayArrow__hoDyK {
|
|
414
|
+
display: flex;
|
|
415
|
+
padding: 8px;
|
|
416
|
+
}
|
|
417
|
+
.OverlayArrow-module_overlayArrow__hoDyK[data-placement=top], .OverlayArrow-module_overlayArrow__hoDyK[data-placement=bottom] {
|
|
418
|
+
padding: 0 8px;
|
|
419
|
+
}
|
|
420
|
+
.OverlayArrow-module_overlayArrow__hoDyK[data-placement=left], .OverlayArrow-module_overlayArrow__hoDyK[data-placement=right] {
|
|
421
|
+
padding: 8px 0;
|
|
422
|
+
}
|
|
423
|
+
.OverlayArrow-module_overlayArrow__hoDyK path {
|
|
424
|
+
fill: var(--color-purple-800, #2f2438);
|
|
425
|
+
box-shadow: var(--shadow-small-box-shadow, 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 3px 16px 0 rgba(0, 0, 0, 0.06));
|
|
426
|
+
}
|
|
427
|
+
.OverlayArrow-module_overlayArrow__hoDyK[data-placement=right] svg {
|
|
428
|
+
transform: rotate(90deg);
|
|
429
|
+
}
|
|
430
|
+
.OverlayArrow-module_overlayArrow__hoDyK[data-placement=bottom] svg {
|
|
431
|
+
transform: rotate(180deg);
|
|
432
|
+
}
|
|
433
|
+
.OverlayArrow-module_overlayArrow__hoDyK[data-placement=left] svg {
|
|
434
|
+
transform: rotate(270deg);
|
|
435
|
+
}
|
|
436
|
+
.OverlayArrow-module_overlayArrow__hoDyK.OverlayArrow-module_reversed__-WGcR path {
|
|
437
|
+
fill: var(--color-white, #ffffff);
|
|
438
|
+
}
|
|
439
439
|
/*
|
|
440
440
|
* This is taken from the Material Symbols CDN
|
|
441
441
|
* font-weight & font-size removed as overridden in .icon
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaizen/components",
|
|
3
|
-
"version": "1.68.
|
|
3
|
+
"version": "1.68.10",
|
|
4
4
|
"description": "Kaizen component library",
|
|
5
5
|
"author": "Geoffrey Chong <geoff.chong@cultureamp.com>",
|
|
6
6
|
"homepage": "https://cultureamp.design",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"react": "^18.3.1",
|
|
111
111
|
"react-dom": "^18.3.1",
|
|
112
112
|
"react-highlight": "^0.15.0",
|
|
113
|
-
"react-intl": "^
|
|
113
|
+
"react-intl": "^7.0.1",
|
|
114
114
|
"rollup": "^4.28.0",
|
|
115
115
|
"sass": "1.79.6",
|
|
116
116
|
"serialize-query-params": "^2.0.2",
|
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
"@cultureamp/i18n-react-intl": "^2.5.9",
|
|
129
129
|
"react": "^18.3.1",
|
|
130
130
|
"react-dom": "^18.3.1",
|
|
131
|
-
"react-intl": "^6.6.8",
|
|
131
|
+
"react-intl": "^6.6.8 || ^7.0.0",
|
|
132
132
|
"typescript": "5.x"
|
|
133
133
|
},
|
|
134
134
|
"peerDependenciesMeta": {
|
|
@@ -33,17 +33,18 @@ export const TextArea = ({
|
|
|
33
33
|
}: TextAreaProps): JSX.Element => {
|
|
34
34
|
const [internalValue, setInternalValue] = useState<
|
|
35
35
|
string | number | readonly string[] | undefined
|
|
36
|
-
>(
|
|
37
|
-
// ^
|
|
38
|
-
// essentially forces the textarea into an (interally) controlled mode if autogrow is true and mode is uncontrolled
|
|
36
|
+
>(defaultValue)
|
|
37
|
+
// ^holds an internal state of the value, used for the autogrow feature if uncontrolled (no `value` provided)
|
|
39
38
|
|
|
40
|
-
const controlledValue = value ?? internalValue
|
|
41
39
|
const fallbackRef = useRef(null)
|
|
42
40
|
const textAreaRef = propsTextAreaRef ?? fallbackRef
|
|
43
41
|
|
|
44
42
|
const onChange = (event: React.ChangeEvent<HTMLTextAreaElement>): void => {
|
|
45
43
|
propsOnChange?.(event)
|
|
46
|
-
|
|
44
|
+
|
|
45
|
+
if (!value && autogrow) {
|
|
46
|
+
setInternalValue(event.target.value)
|
|
47
|
+
}
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
return (
|
|
@@ -51,7 +52,7 @@ export const TextArea = ({
|
|
|
51
52
|
className={classnames(styles.wrapper, {
|
|
52
53
|
[styles.wrapperAutogrow]: autogrow,
|
|
53
54
|
})}
|
|
54
|
-
data-value={autogrow ?
|
|
55
|
+
data-value={autogrow ? (value ?? internalValue) : undefined}
|
|
55
56
|
>
|
|
56
57
|
<textarea
|
|
57
58
|
className={classnames(
|
|
@@ -65,8 +66,8 @@ export const TextArea = ({
|
|
|
65
66
|
)}
|
|
66
67
|
rows={rows}
|
|
67
68
|
onChange={onChange}
|
|
68
|
-
value={
|
|
69
|
-
defaultValue={
|
|
69
|
+
value={value}
|
|
70
|
+
defaultValue={value ? undefined : defaultValue}
|
|
70
71
|
// ^ React throws a warning if you specify both a value and a defaultValue
|
|
71
72
|
ref={textAreaRef}
|
|
72
73
|
disabled={disabled}
|
|
@@ -24,20 +24,29 @@ export default {
|
|
|
24
24
|
|
|
25
25
|
const StickerSheetTemplate: StickerSheetStory = {
|
|
26
26
|
render: ({ isReversed }) => (
|
|
27
|
-
|
|
28
|
-
<StickerSheet
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
27
|
+
<>
|
|
28
|
+
<StickerSheet isReversed={isReversed} headers={['Default', 'Hover', 'Active', 'Focus']}>
|
|
29
|
+
<StickerSheet.Row header="Enabled">
|
|
30
|
+
<TextArea reversed={isReversed} />
|
|
31
|
+
<TextArea reversed={isReversed} data-sb-pseudo-styles="hover" />
|
|
32
|
+
<TextArea reversed={isReversed} data-sb-pseudo-styles="active" />
|
|
33
|
+
<TextArea reversed={isReversed} data-sb-pseudo-styles="focus" />
|
|
34
|
+
</StickerSheet.Row>
|
|
35
|
+
<StickerSheet.Row header="Disabled">
|
|
36
|
+
<TextArea reversed={isReversed} disabled />
|
|
37
|
+
<TextArea reversed={isReversed} disabled data-sb-pseudo-styles="hover" />
|
|
38
|
+
<TextArea reversed={isReversed} disabled data-sb-pseudo-styles="active" />
|
|
39
|
+
<TextArea reversed={isReversed} disabled data-sb-pseudo-styles="focus" />
|
|
40
|
+
</StickerSheet.Row>
|
|
41
|
+
</StickerSheet>
|
|
42
|
+
<StickerSheet title="Autogrow">
|
|
43
|
+
<TextArea
|
|
44
|
+
rows={1}
|
|
45
|
+
value="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque mattis nisi sit amet consectetur ultricies. Vestibulum porta arcu vitae erat egestas pulvinar. Proin tincidunt mi ultricies risus ultrices semper. Donec consequat, mi at tincidunt mattis, felis metus semper metus, a imperdiet justo odio ac elit. Nulla et lacinia enim. Donec placerat, arcu a hendrerit iaculis, massa ante venenatis urna, vitae vestibulum massa orci et erat. Sed in cursus arcu. Fusce fringilla urna tincidunt risus sodales mollis. Ut sit amet mi vitae justo aliquam congue eget eu nisl. Mauris sit amet dolor fermentum, rutrum orci eget, feugiat mi. Etiam feugiat auctor augue, non volutpat nisi aliquet non. Praesent dignissim, lacus id iaculis porttitor, purus libero fermentum urna, in faucibus massa enim sed dui. Maecenas et nisi in nulla condimentum dictum. Maecenas tincidunt turpis non consequat pharetra. Suspendisse in auctor erat, vel ullamcorper elit. Nullam rutrum pharetra turpis, id luctus nisi sollicitudin ac. Maecenas sodales malesuada orci. Integer ultrices, nisi non blandit commodo, turpis enim iaculis ante, vel blandit diam sapien eget justo. Mauris scelerisque euismod quam, nec accumsan lorem venenatis vel. Sed rhoncus purus turpis, vel efficitur metus placerat et."
|
|
46
|
+
autogrow
|
|
47
|
+
/>
|
|
48
|
+
</StickerSheet>
|
|
49
|
+
</>
|
|
41
50
|
),
|
|
42
51
|
parameters: {
|
|
43
52
|
pseudo: {
|