@zenkigen-inc/component-ui 1.2.0 → 1.3.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.
@@ -1,4 +1,4 @@
1
- import { CSSProperties, ReactNode } from 'react';
1
+ import { CSSProperties, PropsWithChildren, ReactNode } from 'react';
2
2
  type Size = 'small' | 'medium' | 'large';
3
3
  type Variant = 'fill' | 'fillDanger' | 'outline' | 'text';
4
4
  type Props = {
@@ -8,7 +8,6 @@ type Props = {
8
8
  variant?: Variant;
9
9
  before?: ReactNode;
10
10
  after?: ReactNode;
11
- children: ReactNode;
12
11
  } & ({
13
12
  isAnchor: true;
14
13
  href: string;
@@ -17,5 +16,5 @@ type Props = {
17
16
  isAnchor?: false;
18
17
  onClick?: () => void;
19
18
  });
20
- export declare function Button({ size, variant, ...props }: Props): import("react").JSX.Element;
19
+ export declare function Button({ size, variant, ...props }: PropsWithChildren<Props>): import("react").JSX.Element;
21
20
  export {};
@@ -1,8 +1,7 @@
1
- import { MouseEvent, ReactNode } from 'react';
1
+ import { MouseEvent, PropsWithChildren } from 'react';
2
2
  type Props = {
3
- children: ReactNode;
4
3
  color?: 'gray' | 'red';
5
4
  onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
6
5
  };
7
- export declare function DropdownItem({ children, color, onClick }: Props): import("react").JSX.Element;
6
+ export declare function DropdownItem({ children, color, onClick }: PropsWithChildren<Props>): import("react").JSX.Element;
8
7
  export {};
@@ -1,11 +1,10 @@
1
- import { CSSProperties, ReactNode } from 'react';
1
+ import { CSSProperties, PropsWithChildren } from 'react';
2
2
  import { DropdownHorizontalAlign, DropdownVerticalPosition } from './type';
3
3
  type Props = {
4
- children: ReactNode;
5
4
  maxHeight?: CSSProperties['height'];
6
5
  isNoPadding?: boolean;
7
6
  verticalPosition?: DropdownVerticalPosition;
8
7
  horizontalAlign?: DropdownHorizontalAlign;
9
8
  };
10
- export declare function DropdownMenu({ children, maxHeight, isNoPadding, verticalPosition, horizontalAlign, }: Props): false | import("react").JSX.Element;
9
+ export declare function DropdownMenu({ children, maxHeight, isNoPadding, verticalPosition, horizontalAlign, }: PropsWithChildren<Props>): false | import("react").JSX.Element;
11
10
  export {};
@@ -1,5 +1,5 @@
1
- import { ReactElement, ReactNode } from 'react';
2
1
  import { IconName } from '@zenkigen-inc/component-icons';
2
+ import { PropsWithChildren, ReactElement } from 'react';
3
3
  import { DropdownItem } from './dropdown-item';
4
4
  import { DropdownMenu } from './dropdown-menu';
5
5
  type Props = {
@@ -8,7 +8,6 @@ type Props = {
8
8
  title?: string;
9
9
  isDisabled?: boolean;
10
10
  isArrowHidden?: boolean;
11
- children: ReactNode;
12
11
  } & ({
13
12
  target: ReactElement;
14
13
  label?: never;
@@ -18,7 +17,7 @@ type Props = {
18
17
  label: string;
19
18
  icon?: IconName;
20
19
  });
21
- export declare function Dropdown({ children, target, label, icon, size, variant, title, isDisabled, isArrowHidden, }: Props): import("react").JSX.Element;
20
+ export declare function Dropdown({ children, target, label, icon, size, variant, title, isDisabled, isArrowHidden, }: PropsWithChildren<Props>): import("react").JSX.Element;
22
21
  export declare namespace Dropdown {
23
22
  var Menu: typeof DropdownMenu;
24
23
  var Item: typeof DropdownItem;
package/dist/index.d.ts CHANGED
@@ -18,6 +18,7 @@ export * from './select-sort';
18
18
  export * from './tab';
19
19
  export * from './table';
20
20
  export * from './tag';
21
+ export * from './text-input';
21
22
  export * from './toast';
22
23
  export * from './toggle';
23
24
  export * from './tooltip';
package/dist/index.esm.js CHANGED
@@ -4,6 +4,20 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
4
  import aa, { useState, useCallback, useEffect, createContext, useContext, useRef, forwardRef } from 'react';
5
5
  import { iconElements } from '@zenkigen-inc/component-icons';
6
6
 
7
+ function _extends() {
8
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
9
+ for (var i = 1; i < arguments.length; i++) {
10
+ var source = arguments[i];
11
+ for (var key in source) {
12
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
13
+ target[key] = source[key];
14
+ }
15
+ }
16
+ }
17
+ return target;
18
+ };
19
+ return _extends.apply(this, arguments);
20
+ }
7
21
  function _objectWithoutPropertiesLoose(source, excluded) {
8
22
  if (source == null) return {};
9
23
  var target = {};
@@ -17,7 +31,7 @@ function _objectWithoutPropertiesLoose(source, excluded) {
17
31
  return target;
18
32
  }
19
33
 
20
- var _excluded$5 = ["size"];
34
+ var _excluded$6 = ["size"];
21
35
  var isAsciiString = function isAsciiString(str) {
22
36
  return str.charCodeAt(0) < 256;
23
37
  };
@@ -25,7 +39,7 @@ function Avatar(_ref) {
25
39
  var _clsx;
26
40
  var _ref$size = _ref.size,
27
41
  size = _ref$size === void 0 ? 'medium' : _ref$size,
28
- props = _objectWithoutPropertiesLoose(_ref, _excluded$5);
42
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$6);
29
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));
30
44
  var trimmedFirstName = props.firstName.trim();
31
45
  var trimmedLastName = props.lastName.trim();
@@ -56,13 +70,13 @@ function Breadcrumb(_ref) {
56
70
  }
57
71
  Breadcrumb.Item = BreadcrumbItem;
58
72
 
59
- var _excluded$4 = ["size", "variant"];
73
+ var _excluded$5 = ["size", "variant"];
60
74
  function Button(_ref) {
61
75
  var _ref$size = _ref.size,
62
76
  size = _ref$size === void 0 ? 'medium' : _ref$size,
63
77
  _ref$variant = _ref.variant,
64
78
  variant = _ref$variant === void 0 ? 'fill' : _ref$variant,
65
- props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
79
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$5);
66
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, {
67
81
  'h-6 px-2.5': size === 'small'
68
82
  }, {
@@ -215,12 +229,12 @@ var useOutsideClick = function useOutsideClick(ref, handler, enabled) {
215
229
  }, [ref, enabled, handler]);
216
230
  };
217
231
 
218
- var _excluded$3 = ["size"];
232
+ var _excluded$4 = ["size"];
219
233
  var Icon = function Icon(_ref) {
220
234
  var _ref2;
221
235
  var _ref$size = _ref.size,
222
236
  size = _ref$size === void 0 ? 'medium' : _ref$size,
223
- props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
237
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
224
238
  return /*#__PURE__*/jsx("span", {
225
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), {
226
240
  'w-3 h-3': size === 'x-small',
@@ -459,13 +473,13 @@ function Heading(props) {
459
473
  });
460
474
  }
461
475
 
462
- var _excluded$2 = ["size", "variant"];
476
+ var _excluded$3 = ["size", "variant"];
463
477
  function IconButton(_ref) {
464
478
  var _ref$size = _ref.size,
465
479
  size = _ref$size === void 0 ? 'medium' : _ref$size,
466
480
  _ref$variant = _ref.variant,
467
481
  variant = _ref$variant === void 0 ? 'outline' : _ref$variant,
468
- props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
482
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
469
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, {
470
484
  'h-6 w-6': size === 'small' && !props.isNoPadding
471
485
  }, {
@@ -31513,13 +31527,13 @@ Modal.Body = ModalBody;
31513
31527
  Modal.Header = ModalHeader;
31514
31528
  Modal.Footer = ModalFooter;
31515
31529
 
31516
- var _excluded$1 = ["state", "size"];
31530
+ var _excluded$2 = ["state", "size"];
31517
31531
  function NotificationInline(_ref) {
31518
31532
  var _ref$state = _ref.state,
31519
31533
  state = _ref$state === void 0 ? 'default' : _ref$state,
31520
31534
  _ref$size = _ref.size,
31521
31535
  size = _ref$size === void 0 ? 'medium' : _ref$size,
31522
- props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
31536
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
31523
31537
  var wrapperClasses = clsx('rounded', 'text-text-text01', 'flex', 'gap-1', 'items-center', typography.body.body2regular, {
31524
31538
  'bg-background-uiBackgroundError': state === 'attention',
31525
31539
  'bg-background-uiBackgroundWarning': state === 'warning',
@@ -31891,14 +31905,14 @@ function Radio(_ref) {
31891
31905
  });
31892
31906
  }
31893
31907
 
31894
- var _excluded = ["width", "size"];
31908
+ var _excluded$1 = ["width", "size"];
31895
31909
  var Search = /*#__PURE__*/forwardRef(function (_ref, ref) {
31896
31910
  var _clsx;
31897
31911
  var _ref$width = _ref.width,
31898
31912
  width = _ref$width === void 0 ? '100%' : _ref$width,
31899
31913
  _ref$size = _ref.size,
31900
31914
  size = _ref$size === void 0 ? 'medium' : _ref$size,
31901
- props = _objectWithoutPropertiesLoose(_ref, _excluded);
31915
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
31902
31916
  var classes = clsx('flex', 'items-center', 'rounded-full', 'border', 'border-border-uiBorder02', 'focus-within:border-active-activeInput', {
31903
31917
  'h-8 px-3': size === 'medium'
31904
31918
  }, {
@@ -32193,6 +32207,39 @@ function Tag(_ref) {
32193
32207
  });
32194
32208
  }
32195
32209
 
32210
+ var _excluded = ["size"];
32211
+ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
32212
+ var _clsx;
32213
+ var _ref$size = _ref.size,
32214
+ size = _ref$size === void 0 ? 'medium' : _ref$size,
32215
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
32216
+ var inputWrapClasses = clsx('flex items-center gap-2 overflow-hidden rounded border pl-2 pr-3', {
32217
+ 'border-border-uiBorder01': !props.isError,
32218
+ 'border-support-supportError': props.isError && !props.disabled,
32219
+ 'hover:border-hover-hoverInput': !props.disabled && !props.isError,
32220
+ 'hover:focus-within:border-active-activeInput': !props.isError,
32221
+ 'focus-within:border-active-activeInput': !props.isError,
32222
+ 'bg-disabled-disabled02 border-disabled-disabled02': props.disabled
32223
+ });
32224
+ var inputClasses = clsx('flex-1 outline-0 placeholder:text-text-textPlaceholder disabled:text-text-text03', (_clsx = {}, _clsx[typography.label.label2regular + " pt-1.5 pb-2"] = size === 'medium', _clsx[typography.label.label1regular + " py-2.5"] = size === 'large', _clsx['text-text-text01'] = !props.isError, _clsx['text-support-supportError'] = props.isError, _clsx));
32225
+ return /*#__PURE__*/jsxs("div", {
32226
+ className: inputWrapClasses,
32227
+ children: [/*#__PURE__*/jsx("input", _extends({
32228
+ ref: ref,
32229
+ size: 1,
32230
+ className: inputClasses,
32231
+ onChange: props.onChange
32232
+ }, props)), props.onClickClearButton && props.value && props.value.length !== 0 && !props.disabled && /*#__PURE__*/jsx(IconButton, {
32233
+ variant: "text",
32234
+ icon: "close",
32235
+ size: "small",
32236
+ isNoPadding: true,
32237
+ onClick: props.onClickClearButton
32238
+ })]
32239
+ });
32240
+ });
32241
+ TextInput.displayName = 'TextInput';
32242
+
32196
32243
  var CLOSE_TIME_MSEC = 5000;
32197
32244
  function Toast(_ref) {
32198
32245
  var _clsx;
@@ -32470,5 +32517,5 @@ function Tooltip(_ref) {
32470
32517
  });
32471
32518
  }
32472
32519
 
32473
- export { Avatar, Breadcrumb, Button, Checkbox, Dropdown, EvaluationStar, Heading, Icon, IconButton, Loading, Modal, NotificationInline, PaginationSelect, Radio, Search, Select, SelectSort, Tab, TabItem, Table, TableCell, TableRow, Tag, Toast, ToastProvider, Toggle, Tooltip, useToast };
32520
+ export { Avatar, Breadcrumb, Button, Checkbox, Dropdown, EvaluationStar, Heading, Icon, IconButton, Loading, Modal, NotificationInline, PaginationSelect, Radio, Search, Select, SelectSort, Tab, TabItem, Table, TableCell, TableRow, Tag, TextInput, Toast, ToastProvider, Toggle, Tooltip, useToast };
32474
32521
  //# sourceMappingURL=index.esm.js.map