@kaizen/components 1.68.8 → 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(autogrow && !value ? defaultValue : undefined),
30
+ var _h = React.useState(defaultValue),
31
31
  internalValue = _h[0],
32
32
  setInternalValue = _h[1];
33
- // ^ holds an internal state of the value so that autogrow can still work with uncontrolled textareas
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
- setInternalValue(event.target.value);
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 ? controlledValue : undefined
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: controlledValue,
50
- defaultValue: controlledValue ? undefined : 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
@@ -1,6 +1,6 @@
1
1
  import { __rest, __assign } from 'tslib';
2
2
  import React, { useState } from 'react';
3
- import { useFloating, autoUpdate, size, offset, autoPlacement } from '@floating-ui/react-dom';
3
+ import { useFloating, size, offset, autoPlacement, autoUpdate } from '@floating-ui/react-dom';
4
4
  import classnames from 'classnames';
5
5
  import styles from './CalendarPopover.module.scss.mjs';
6
6
 
@@ -4,7 +4,7 @@ import classnames from 'classnames';
4
4
  import { Heading } from '../Heading/Heading.mjs';
5
5
  import '../Illustration/subcomponents/Base/Base.mjs';
6
6
  import '../Illustration/Scene/BrandMomentCaptureIntro/BrandMomentCaptureIntro.mjs';
7
- import { EmptyStatesNegative, EmptyStatesNeutral, EmptyStatesPositive, EmptyStatesInformative } from '../Illustration/Scene/Scene.mjs';
7
+ import { EmptyStatesPositive, EmptyStatesNegative, EmptyStatesInformative, EmptyStatesNeutral } from '../Illustration/Scene/Scene.mjs';
8
8
  import { Text } from '../Text/Text.mjs';
9
9
  import styles from './EmptyState.module.css.mjs';
10
10
  var ILLUSTRATIONS = {
@@ -1,4 +1,4 @@
1
- import { __spreadArray, __assign } from 'tslib';
1
+ import { __assign, __spreadArray } from 'tslib';
2
2
  import React, { useState, useEffect } from 'react';
3
3
  import classnames from 'classnames';
4
4
  import { useSelectionContext } from '../../context/SelectionProvider/SelectionProvider.mjs';
@@ -1,7 +1,7 @@
1
1
  import { __rest, __assign } from 'tslib';
2
2
  import React from 'react';
3
3
  import { createPortal } from 'react-dom';
4
- import { useFloating, autoUpdate, offset, flip, size } from '@floating-ui/react-dom';
4
+ import { useFloating, offset, flip, size, autoUpdate } from '@floating-ui/react-dom';
5
5
  import classnames from 'classnames';
6
6
  import { FocusOn } from 'react-focus-on';
7
7
  import styles from './Popover.module.scss.mjs';
@@ -1,4 +1,4 @@
1
- import { __rest, __spreadArray, __assign } from 'tslib';
1
+ import { __rest, __assign, __spreadArray } from 'tslib';
2
2
  import React, { useId, useState, useEffect } from 'react';
3
3
  import classnames from 'classnames';
4
4
  import { FieldMessage } from '../../FieldMessage/FieldMessage.mjs';
@@ -1,4 +1,4 @@
1
- import { __assign, __spreadArray } from 'tslib';
1
+ import { __spreadArray, __assign } from 'tslib';
2
2
  import { TOOLBAR_CONTROLS } from '../constants.mjs';
3
3
  import 'prosemirror-commands';
4
4
  import 'prosemirror-keymap';
@@ -1,6 +1,6 @@
1
1
  import { __rest, __assign } from 'tslib';
2
2
  import { nodes } from 'prosemirror-schema-basic';
3
- import { listItem, bulletList, orderedList } from 'prosemirror-schema-list';
3
+ import { orderedList, bulletList, listItem } from 'prosemirror-schema-list';
4
4
  var getNodes = function () {
5
5
  // We use camel case names instead of ProseMirror's snake case, so we remove any snake case properties here before spreading
6
6
  var hardBreak = nodes.hard_break,
@@ -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(autogrow && !value ? defaultValue : undefined),
22
+ var _h = useState(defaultValue),
23
23
  internalValue = _h[0],
24
24
  setInternalValue = _h[1];
25
- // ^ holds an internal state of the value so that autogrow can still work with uncontrolled textareas
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
- setInternalValue(event.target.value);
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 ? controlledValue : undefined
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: controlledValue,
42
- defaultValue: controlledValue ? undefined : 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
@@ -1,4 +1,4 @@
1
- import { __rest, __assign } from 'tslib';
1
+ import { __assign, __rest } from 'tslib';
2
2
  import React, { useId } from 'react';
3
3
  import { Time } from '@internationalized/date';
4
4
  import { useTimeField } from '@react-aria/datepicker';
@@ -3,7 +3,7 @@ import React, { useState, useId, useRef, useEffect, cloneElement } from 'react';
3
3
  import ReactDOM from 'react-dom';
4
4
  import classnames from 'classnames';
5
5
  import { usePopper } from 'react-popper';
6
- import { useAnimation, AnimationProvider } from './subcomponents/AppearanceAnim.mjs';
6
+ import { AnimationProvider, useAnimation } from './subcomponents/AppearanceAnim.mjs';
7
7
  import { isSemanticElement } from './utils/isSemanticElement.mjs';
8
8
  import styles from './Tooltip.module.scss.mjs';
9
9
  var positionToPlacement = new Map([['above', 'top'], ['below', 'bottom'], ['left', 'left'], ['right', 'right']]);
package/dist/styles.css CHANGED
@@ -349,9 +349,6 @@
349
349
  align-items: center;
350
350
  }
351
351
 
352
- .Focusable-module_focusableWrapper__NfuIi {
353
- display: inline-flex;
354
- }
355
352
  /** THIS IS AN AUTOGENERATED FILE **/
356
353
  /** THIS IS AN AUTOGENERATED FILE **/
357
354
  /** THIS IS AN AUTOGENERATED FILE **/
@@ -408,6 +405,9 @@
408
405
  opacity: 1;
409
406
  }
410
407
  }
408
+ .Focusable-module_focusableWrapper__NfuIi {
409
+ display: inline-flex;
410
+ }
411
411
  /** THIS IS AN AUTOGENERATED FILE **/
412
412
  /** THIS IS AN AUTOGENERATED FILE **/
413
413
  .OverlayArrow-module_overlayArrow__hoDyK {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaizen/components",
3
- "version": "1.68.8",
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",
@@ -104,21 +104,21 @@
104
104
  "postcss": "^8.4.49",
105
105
  "postcss-cli": "^11.0.0",
106
106
  "postcss-import": "^16.1.0",
107
- "postcss-preset-env": "^10.0.8",
107
+ "postcss-preset-env": "^10.1.1",
108
108
  "postcss-scss": "^4.0.9",
109
109
  "query-string": "^9.1.1",
110
110
  "react": "^18.3.1",
111
111
  "react-dom": "^18.3.1",
112
112
  "react-highlight": "^0.15.0",
113
- "react-intl": "^6.8.9",
114
- "rollup": "^4.27.2",
113
+ "react-intl": "^7.0.1",
114
+ "rollup": "^4.28.0",
115
115
  "sass": "1.79.6",
116
116
  "serialize-query-params": "^2.0.2",
117
117
  "svgo": "^3.3.2",
118
- "tslib": "^2.8.0",
118
+ "tslib": "^2.8.1",
119
119
  "tsx": "^4.19.2",
120
- "@kaizen/design-tokens": "10.8.5",
121
- "@kaizen/package-bundler": "2.0.2"
120
+ "@kaizen/design-tokens": "10.8.6",
121
+ "@kaizen/package-bundler": "2.0.3"
122
122
  },
123
123
  "devDependenciesComments": {
124
124
  "sass": "Prevent deprecation warnings introduced in 1.80 as we plan to move away from sass",
@@ -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
- >(autogrow && !value ? defaultValue : undefined)
37
- // ^ holds an internal state of the value so that autogrow can still work with uncontrolled textareas
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
- setInternalValue(event.target.value)
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 ? controlledValue : undefined}
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={controlledValue}
69
- defaultValue={controlledValue ? undefined : 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
- <StickerSheet isReversed={isReversed} headers={['Default', 'Hover', 'Active', 'Focus']}>
28
- <StickerSheet.Row header="Enabled">
29
- <TextArea reversed={isReversed} />
30
- <TextArea reversed={isReversed} data-sb-pseudo-styles="hover" />
31
- <TextArea reversed={isReversed} data-sb-pseudo-styles="active" />
32
- <TextArea reversed={isReversed} data-sb-pseudo-styles="focus" />
33
- </StickerSheet.Row>
34
- <StickerSheet.Row header="Disabled">
35
- <TextArea reversed={isReversed} disabled />
36
- <TextArea reversed={isReversed} disabled data-sb-pseudo-styles="hover" />
37
- <TextArea reversed={isReversed} disabled data-sb-pseudo-styles="active" />
38
- <TextArea reversed={isReversed} disabled data-sb-pseudo-styles="focus" />
39
- </StickerSheet.Row>
40
- </StickerSheet>
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: {