@zenkigen-inc/component-ui 1.3.1 → 1.4.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/index.d.ts CHANGED
@@ -19,6 +19,7 @@ export * from './select-sort';
19
19
  export * from './tab';
20
20
  export * from './table';
21
21
  export * from './tag';
22
+ export * from './text-area';
22
23
  export * from './text-input';
23
24
  export * from './toast';
24
25
  export * from './toggle';
package/dist/index.esm.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { userColors, typography, buttonColors, focusVisible, iconColors, tagColors, tagLightColors } from '@zenkigen-inc/component-theme';
2
2
  import clsx$1, { clsx } from 'clsx';
3
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
- import aa, { useState, useCallback, useEffect, createContext, useContext, useRef, forwardRef } from 'react';
4
+ import aa, { useState, useCallback, useEffect, createContext, useContext, useRef, useLayoutEffect, forwardRef } from 'react';
5
5
  import { iconElements } from '@zenkigen-inc/component-icons';
6
6
 
7
7
  function _extends() {
@@ -31,7 +31,7 @@ function _objectWithoutPropertiesLoose(source, excluded) {
31
31
  return target;
32
32
  }
33
33
 
34
- var _excluded$6 = ["size"];
34
+ var _excluded$7 = ["size"];
35
35
  var isAsciiString = function isAsciiString(str) {
36
36
  return str.charCodeAt(0) < 256;
37
37
  };
@@ -39,7 +39,7 @@ function Avatar(_ref) {
39
39
  var _clsx;
40
40
  var _ref$size = _ref.size,
41
41
  size = _ref$size === void 0 ? 'medium' : _ref$size,
42
- props = _objectWithoutPropertiesLoose(_ref, _excluded$6);
42
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$7);
43
43
  var classes = clsx('text-text-textOnColor', 'rounded-full', 'flex items-center justify-center', props.isDisabled ? 'bg-disabled-disabled01' : props.userId ? userColors[props.userId % userColors.length] : 'bg-icon-icon01', (_clsx = {}, _clsx["w-16 h-16 " + typography.label.label1regular] = size === 'x-large', _clsx["w-12 h-12 " + typography.label.label2regular] = size === 'large', _clsx["w-10 h-10 " + typography.label.label2regular] = size === 'medium', _clsx["w-8 h-8 " + typography.label.label4regular] = size === 'small', _clsx["w-6 h-6 " + typography.label.label4regular] = size === 'x-small', _clsx));
44
44
  var trimmedFirstName = props.firstName.trim();
45
45
  var trimmedLastName = props.lastName.trim();
@@ -70,13 +70,13 @@ function Breadcrumb(_ref) {
70
70
  }
71
71
  Breadcrumb.Item = BreadcrumbItem;
72
72
 
73
- var _excluded$5 = ["size", "variant"];
73
+ var _excluded$6 = ["size", "variant"];
74
74
  function Button(_ref) {
75
75
  var _ref$size = _ref.size,
76
76
  size = _ref$size === void 0 ? 'medium' : _ref$size,
77
77
  _ref$variant = _ref.variant,
78
78
  variant = _ref$variant === void 0 ? 'fill' : _ref$variant,
79
- props = _objectWithoutPropertiesLoose(_ref, _excluded$5);
79
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$6);
80
80
  var baseClasses = clsx('rounded-button', 'flex', 'shrink-0', 'gap-1', 'items-center', 'justify-center', buttonColors[variant].base, buttonColors[variant].hover, buttonColors[variant].active, buttonColors[variant].disabled, focusVisible.normal, size === 'large' ? typography.label.label1regular : typography.label.label2regular, {
81
81
  'h-6 px-2.5': size === 'small'
82
82
  }, {
@@ -229,12 +229,12 @@ var useOutsideClick = function useOutsideClick(ref, handler, enabled) {
229
229
  }, [ref, enabled, handler]);
230
230
  };
231
231
 
232
- var _excluded$4 = ["size"];
232
+ var _excluded$5 = ["size"];
233
233
  var Icon = function Icon(_ref) {
234
234
  var _ref2;
235
235
  var _ref$size = _ref.size,
236
236
  size = _ref$size === void 0 ? 'medium' : _ref$size,
237
- props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
237
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$5);
238
238
  return /*#__PURE__*/jsx("span", {
239
239
  className: clsx('inline-block', 'shrink-0', props.isDisabled ? 'fill-disabled-disabled01' : (_ref2 = {}, _ref2[iconColors.icon01] = props.color === 'icon01', _ref2[iconColors.icon01Dark] = props.color === 'icon01Dark', _ref2[iconColors.icon02] = props.color === 'icon02', _ref2[iconColors.icon02Dark] = props.color === 'icon02Dark', _ref2[iconColors.icon03] = props.color === 'icon03', _ref2[iconColors.icon03Dark] = props.color === 'icon03Dark', _ref2[iconColors.iconOnColor] = props.color === 'iconOnColor', _ref2), {
240
240
  'w-3 h-3': size === 'x-small',
@@ -473,13 +473,13 @@ function Heading(props) {
473
473
  });
474
474
  }
475
475
 
476
- var _excluded$3 = ["size", "variant"];
476
+ var _excluded$4 = ["size", "variant"];
477
477
  function IconButton(_ref) {
478
478
  var _ref$size = _ref.size,
479
479
  size = _ref$size === void 0 ? 'medium' : _ref$size,
480
480
  _ref$variant = _ref.variant,
481
481
  variant = _ref$variant === void 0 ? 'outline' : _ref$variant,
482
- props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
482
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
483
483
  var baseClasses = clsx('rounded', 'flex', 'gap-1', 'items-center', 'justify-center', buttonColors[variant].base, buttonColors[variant].hover, buttonColors[variant].active, buttonColors[variant].disabled, focusVisible.normal, typography.label.label1regular, {
484
484
  'h-6 w-6': size === 'small' && !props.isNoPadding
485
485
  }, {
@@ -31527,13 +31527,13 @@ Modal.Body = ModalBody;
31527
31527
  Modal.Header = ModalHeader;
31528
31528
  Modal.Footer = ModalFooter;
31529
31529
 
31530
- var _excluded$2 = ["state", "size"];
31530
+ var _excluded$3 = ["state", "size"];
31531
31531
  function NotificationInline(_ref) {
31532
31532
  var _ref$state = _ref.state,
31533
31533
  state = _ref$state === void 0 ? 'default' : _ref$state,
31534
31534
  _ref$size = _ref.size,
31535
31535
  size = _ref$size === void 0 ? 'medium' : _ref$size,
31536
- props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
31536
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
31537
31537
  var wrapperClasses = clsx('rounded', 'text-text-text01', 'flex', 'gap-1', 'items-center', typography.body.body2regular, {
31538
31538
  'bg-background-uiBackgroundError': state === 'attention',
31539
31539
  'bg-background-uiBackgroundWarning': state === 'warning',
@@ -31701,13 +31701,13 @@ function SelectItem$1(_ref) {
31701
31701
  onChange == null || onChange(option);
31702
31702
  setIsOptionListOpen(false);
31703
31703
  };
31704
- var listItemClasses = clsx$1('flex w-full items-center');
31705
31704
  var itemClasses = clsx$1('flex', 'items-center', 'w-full', 'h-8', 'px-3', 'hover:bg-hover-hover02', 'active:bg-active-active02', focusVisible.inset, typography.label.label2regular, {
31706
31705
  'text-interactive-interactive01 fill-interactive-interactive01 bg-selected-selectedUi': option.id === (selectedOption == null ? void 0 : selectedOption.id),
31707
31706
  'text-interactive-interactive02 fill-icon-icon01 bg-background-uiBackground01': option.id !== (selectedOption == null ? void 0 : selectedOption.id)
31708
31707
  });
31709
31708
  return /*#__PURE__*/jsx("li", {
31710
- className: listItemClasses,
31709
+ className: "flex w-full items-center",
31710
+ "data-id": option.id,
31711
31711
  children: /*#__PURE__*/jsxs("button", {
31712
31712
  className: itemClasses,
31713
31713
  type: "button",
@@ -31734,6 +31734,7 @@ function SelectItem$1(_ref) {
31734
31734
  function SelectList$1(_ref) {
31735
31735
  var children = _ref.children,
31736
31736
  maxHeight = _ref.maxHeight;
31737
+ var ref = useRef(null);
31737
31738
  var _useContext = useContext(SelectContext),
31738
31739
  size = _useContext.size,
31739
31740
  selectedOption = _useContext.selectedOption,
@@ -31745,6 +31746,19 @@ function SelectList$1(_ref) {
31745
31746
  onChange == null || onChange(null);
31746
31747
  setIsOptionListOpen(false);
31747
31748
  };
31749
+ useLayoutEffect(function () {
31750
+ if (maxHeight && ref.current) {
31751
+ var element = Array.from(ref.current.children || []).find(function (item) {
31752
+ return item.getAttribute('data-id') === (selectedOption == null ? void 0 : selectedOption.id);
31753
+ });
31754
+ if (element) {
31755
+ var wrapRect = ref.current.getBoundingClientRect();
31756
+ var rect = element.getBoundingClientRect();
31757
+ ref.current.scroll(0, rect.top - wrapRect.top - wrapRect.height / 2 + rect.height / 2);
31758
+ }
31759
+ }
31760
+ // eslint-disable-next-line react-hooks/exhaustive-deps
31761
+ }, []);
31748
31762
  var listClasses = clsx$1('z-dropdown', 'absolute', 'w-max', 'py-2', 'overflow-y-auto', 'bg-background-uiBackground01', 'rounded', 'shadow-floatingShadow', {
31749
31763
  'top-7': size === 'x-small' || size === 'small',
31750
31764
  'top-9': size === 'medium',
@@ -31757,6 +31771,7 @@ function SelectList$1(_ref) {
31757
31771
  style: {
31758
31772
  maxHeight: maxHeight
31759
31773
  },
31774
+ ref: ref,
31760
31775
  children: [children, placeholder && selectedOption !== null && /*#__PURE__*/jsx("li", {
31761
31776
  children: /*#__PURE__*/jsx("button", {
31762
31777
  className: deselectButtonClasses,
@@ -32007,14 +32022,14 @@ function Radio(_ref) {
32007
32022
  });
32008
32023
  }
32009
32024
 
32010
- var _excluded$1 = ["width", "size"];
32025
+ var _excluded$2 = ["width", "size"];
32011
32026
  var Search = /*#__PURE__*/forwardRef(function (_ref, ref) {
32012
32027
  var _clsx;
32013
32028
  var _ref$width = _ref.width,
32014
32029
  width = _ref$width === void 0 ? '100%' : _ref$width,
32015
32030
  _ref$size = _ref.size,
32016
32031
  size = _ref$size === void 0 ? 'medium' : _ref$size,
32017
- props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
32032
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
32018
32033
  var classes = clsx('flex', 'items-center', 'rounded-full', 'border', 'border-border-uiBorder02', 'focus-within:border-active-activeInput', {
32019
32034
  'h-8 px-3': size === 'medium'
32020
32035
  }, {
@@ -32309,6 +32324,35 @@ function Tag(_ref) {
32309
32324
  });
32310
32325
  }
32311
32326
 
32327
+ var _excluded$1 = ["size", "isResizable", "isError"];
32328
+ var TextArea = /*#__PURE__*/forwardRef(function (_ref, ref) {
32329
+ var _clsx;
32330
+ var _ref$size = _ref.size,
32331
+ size = _ref$size === void 0 ? 'medium' : _ref$size,
32332
+ _ref$isResizable = _ref.isResizable,
32333
+ isResizable = _ref$isResizable === void 0 ? false : _ref$isResizable,
32334
+ isError = _ref.isError,
32335
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
32336
+ var classes = clsx('w-full rounded border outline-0 placeholder:text-text-textPlaceholder disabled:text-text-textPlaceholder', (_clsx = {
32337
+ 'border-support-supportError': isError && !props.disabled,
32338
+ 'hover:border-hover-hoverInput': !props.disabled && !isError,
32339
+ 'border-border-uiBorder01 hover:focus-within:border-active-activeInput focus-within:border-active-activeInput text-text-text01': !isError,
32340
+ 'bg-disabled-disabled02 border-disabled-disabled02': props.disabled
32341
+ }, _clsx[typography.body.body1regular + " px-2 pt-1.5 pb-2"] = size === 'medium', _clsx["text-4 px-3.5 py-2.5 "] = size === 'large', _clsx['text-support-supportError'] = isError, _clsx['resize-none'] = !isResizable, _clsx));
32342
+ return /*#__PURE__*/jsx("div", {
32343
+ className: "flex",
32344
+ children: /*#__PURE__*/jsx("textarea", _extends({
32345
+ ref: ref,
32346
+ className: classes
32347
+ }, props, {
32348
+ style: {
32349
+ height: props.height
32350
+ }
32351
+ }))
32352
+ });
32353
+ });
32354
+ TextArea.displayName = 'TextArea';
32355
+
32312
32356
  var _excluded = ["size", "isError", "onClickClearButton"];
32313
32357
  var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
32314
32358
  var _clsx;
@@ -32621,5 +32665,5 @@ function Tooltip(_ref) {
32621
32665
  });
32622
32666
  }
32623
32667
 
32624
- export { Avatar, Breadcrumb, Button, Checkbox, Dropdown, EvaluationStar, Heading, Icon, IconButton, Loading, Modal, NotificationInline, Pagination, PaginationSelect, Radio, Search, Select, SelectSort, Tab, TabItem, Table, TableCell, TableRow, Tag, TextInput, Toast, ToastProvider, Toggle, Tooltip, useToast };
32668
+ export { Avatar, Breadcrumb, Button, Checkbox, Dropdown, EvaluationStar, Heading, Icon, IconButton, Loading, Modal, NotificationInline, Pagination, PaginationSelect, Radio, Search, Select, SelectSort, Tab, TabItem, Table, TableCell, TableRow, Tag, TextArea, TextInput, Toast, ToastProvider, Toggle, Tooltip, useToast };
32625
32669
  //# sourceMappingURL=index.esm.js.map