@zenkigen-inc/component-ui 1.1.2 → 1.1.3

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
@@ -10,6 +10,7 @@ export * from './icon-button';
10
10
  export * from './loading';
11
11
  export * from './modal';
12
12
  export * from './notification-inline';
13
+ export * from './pagination-select';
13
14
  export * from './radio';
14
15
  export * from './search';
15
16
  export * from './select';
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, cloneElement, forwardRef } from 'react';
4
+ import aa, { useState, useCallback, useEffect, createContext, useContext, useRef, forwardRef } from 'react';
5
5
  import { iconElements } from '@zenkigen-inc/component-icons';
6
6
 
7
7
  function _objectWithoutPropertiesLoose(source, excluded) {
@@ -345,11 +345,7 @@ function Dropdown(_ref) {
345
345
  }
346
346
  }, [isVisible]);
347
347
  var wrapperClasses = clsx$1('relative', 'flex shrink-0 items-center gap-1', 'rounded', isDisabled && 'cursor-not-allowed');
348
- var childrenButtonClasses = clsx$1('flex items-center justify-center', 'rounded', 'hover:bg-hover-hover02', 'active:bg-active-active02', focusVisible.normal, isDisabled && 'pointer-events-none', {
349
- 'h-6 w-6': size === 'x-small',
350
- 'h-8 w-8': size === 'small',
351
- 'h-10 w-10': size === 'medium',
352
- 'h-12 w-12': size === 'large',
348
+ var childrenButtonClasses = clsx$1('flex items-center justify-center', 'rounded', 'hover:bg-hover-hover02', 'active:bg-active-active02', focusVisible.normal, isDisabled && 'pointer-events-none', 'p-1', {
353
349
  'border border-border-uiBorder02': variant === 'outline'
354
350
  });
355
351
  var buttonClasses = clsx$1('flex items-center', 'rounded', buttonColors[variant].base, buttonColors[variant].hover, buttonColors[variant].active, buttonColors[variant].disabled, focusVisible.normal, isDisabled && 'pointer-events-none', {
@@ -358,9 +354,6 @@ function Dropdown(_ref) {
358
354
  'h-10 px-4': size === 'large'
359
355
  });
360
356
  var labelClasses = clsx$1('flex', 'items-center', !isArrowHidden ? size === 'x-small' ? 'mr-1' : 'mr-2' : null, typography.label[size === 'x-small' ? 'label3regular' : size === 'small' || size === 'medium' ? 'label2regular' : 'label1regular']);
361
- var targetWithProps = target && /*#__PURE__*/cloneElement(target, {
362
- isDisabled: isDisabled
363
- });
364
357
  return /*#__PURE__*/jsx(DropdownContext.Provider, {
365
358
  value: {
366
359
  isVisible: isVisible,
@@ -378,7 +371,7 @@ function Dropdown(_ref) {
378
371
  className: childrenButtonClasses,
379
372
  onClick: handleToggle,
380
373
  disabled: isDisabled,
381
- children: targetWithProps
374
+ children: target
382
375
  }) : /*#__PURE__*/jsxs("button", {
383
376
  type: "button",
384
377
  title: title,
@@ -31680,132 +31673,6 @@ function NotificationInline(_ref) {
31680
31673
  });
31681
31674
  }
31682
31675
 
31683
- function Radio(_ref) {
31684
- var name = _ref.name,
31685
- value = _ref.value,
31686
- id = _ref.id,
31687
- label = _ref.label,
31688
- _ref$isChecked = _ref.isChecked,
31689
- isChecked = _ref$isChecked === void 0 ? false : _ref$isChecked,
31690
- _ref$isDisabled = _ref.isDisabled,
31691
- isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
31692
- onChange = _ref.onChange;
31693
- var _useState = useState(false),
31694
- isMouseOver = _useState[0],
31695
- setIsMouseOver = _useState[1];
31696
- var handleMouseOverInput = useCallback(function () {
31697
- setIsMouseOver(true);
31698
- }, []);
31699
- var handleMouseOutInput = useCallback(function () {
31700
- setIsMouseOver(false);
31701
- }, []);
31702
- var handleChange = useCallback(function (e) {
31703
- return !isDisabled && (onChange == null ? void 0 : onChange(e));
31704
- }, [isDisabled, onChange]);
31705
- var inputClasses = clsx$1('absolute', 'z-[1]', 'opacity-0', 'peer', 'h-6', 'w-6', {
31706
- 'cursor-not-allowed': isDisabled,
31707
- 'cursor-pointer': !isDisabled
31708
- });
31709
- var boxClasses = clsx$1('inline-flex', 'items-center', 'justify-center', 'h-5', 'w-5', 'bg-white', 'border', 'border-solid', 'rounded-full', focusVisible.normalPeer, {
31710
- 'border-disabled-disabled01 hover:border-disabled-disabled01': isDisabled && !isMouseOver,
31711
- 'border-hover-hoverUiBorder': !isDisabled && isMouseOver,
31712
- 'border-border-uiBorder03': !isDisabled,
31713
- 'cursor-not-allowed': isDisabled,
31714
- 'cursor-pointer': !isDisabled
31715
- });
31716
- var afterClasses = clsx$1('h-3', 'w-3', 'absolute', 'top-0', 'right-0', 'bottom-0', 'left-0', 'block', 'm-auto', 'rounded-full', {
31717
- 'bg-disabled-disabled01': isDisabled && isChecked,
31718
- 'bg-active-activeSelectedUi': !isDisabled && isChecked,
31719
- 'scale-0': !isChecked,
31720
- 'scale-100': isChecked
31721
- });
31722
- var hoverIndicatorClasses = clsx$1('w-3', 'h-3', 'inline-block', 'rounded-full', !isDisabled && !isChecked && isMouseOver && 'bg-hover-hoverUi');
31723
- var labelClasses = clsx$1('flex-[1_0_0]', 'ml-2', typography.label.label2regular, 'break-all', 'select-none', {
31724
- 'pointer-events-none cursor-not-allowed text-disabled-disabled01': isDisabled,
31725
- 'cursor-pointer text-text-text01': !isDisabled
31726
- });
31727
- return /*#__PURE__*/jsxs("div", {
31728
- className: "flex items-center",
31729
- children: [/*#__PURE__*/jsxs("div", {
31730
- className: "flex h-6 w-6 items-center justify-center",
31731
- children: [/*#__PURE__*/jsx("input", {
31732
- type: "checkbox",
31733
- value: value,
31734
- name: name,
31735
- id: id,
31736
- checked: isChecked,
31737
- disabled: isDisabled,
31738
- onChange: handleChange,
31739
- onMouseOver: handleMouseOverInput,
31740
- onMouseLeave: handleMouseOutInput,
31741
- className: inputClasses
31742
- }), /*#__PURE__*/jsx("div", {
31743
- className: boxClasses,
31744
- children: /*#__PURE__*/jsxs("div", {
31745
- className: "relative flex h-5 w-5 flex-[0_0_auto] items-center justify-center",
31746
- children: [/*#__PURE__*/jsx("span", {
31747
- className: afterClasses
31748
- }), /*#__PURE__*/jsx("span", {
31749
- className: hoverIndicatorClasses
31750
- })]
31751
- })
31752
- })]
31753
- }), /*#__PURE__*/jsx("label", {
31754
- htmlFor: id,
31755
- className: labelClasses,
31756
- children: label
31757
- })]
31758
- });
31759
- }
31760
-
31761
- var _excluded = ["width", "size"];
31762
- var Search = /*#__PURE__*/forwardRef(function (_ref, ref) {
31763
- var _clsx;
31764
- var _ref$width = _ref.width,
31765
- width = _ref$width === void 0 ? '100%' : _ref$width,
31766
- _ref$size = _ref.size,
31767
- size = _ref$size === void 0 ? 'medium' : _ref$size,
31768
- props = _objectWithoutPropertiesLoose(_ref, _excluded);
31769
- var classes = clsx('flex', 'items-center', 'rounded-full', 'border', 'border-border-uiBorder02', 'focus-within:border-active-activeInput', {
31770
- 'h-8 px-3': size === 'medium'
31771
- }, {
31772
- 'h-10 px-4': size === 'large'
31773
- });
31774
- var inputClasses = clsx('ml-2.5', 'mr-2.5', 'h-full', 'flex-1', 'outline-0', 'text-text-text01', 'placeholder:text-text-textPlaceholder', (_clsx = {}, _clsx["" + typography.label.label2regular] = size === 'medium', _clsx["" + typography.label.label1regular] = size === 'large', _clsx));
31775
- return /*#__PURE__*/jsx("div", {
31776
- className: "relative",
31777
- ref: ref,
31778
- children: /*#__PURE__*/jsx("form", {
31779
- onSubmit: props.onSubmit,
31780
- children: /*#__PURE__*/jsxs("div", {
31781
- className: classes,
31782
- style: {
31783
- width: width
31784
- },
31785
- children: [/*#__PURE__*/jsx(Icon, {
31786
- name: "search",
31787
- color: "icon01",
31788
- size: "medium"
31789
- }), /*#__PURE__*/jsx("input", {
31790
- type: "text",
31791
- size: 1,
31792
- value: props.value,
31793
- className: inputClasses,
31794
- placeholder: props.placeholder,
31795
- onChange: props.onChange
31796
- }), props.onClickClearButton && props.value && props.value.length !== 0 && /*#__PURE__*/jsx(IconButton, {
31797
- variant: "text",
31798
- icon: "close",
31799
- size: size === 'medium' ? 'small' : 'medium',
31800
- isNoPadding: true,
31801
- onClick: props.onClickClearButton
31802
- })]
31803
- })
31804
- })
31805
- });
31806
- });
31807
- Search.displayName = 'Search';
31808
-
31809
31676
  var SelectContext = /*#__PURE__*/createContext({
31810
31677
  size: 'medium',
31811
31678
  setIsOptionListOpen: function setIsOptionListOpen() {
@@ -31984,6 +31851,200 @@ function Select(_ref) {
31984
31851
  }
31985
31852
  Select.Option = SelectItem$1;
31986
31853
 
31854
+ function PaginationSelect(_ref) {
31855
+ var totalSize = _ref.totalSize,
31856
+ currentPage = _ref.currentPage,
31857
+ sizePerPage = _ref.sizePerPage,
31858
+ _ref$countLabel = _ref.countLabel,
31859
+ countLabel = _ref$countLabel === void 0 ? '件' : _ref$countLabel,
31860
+ _ref$pageLabel = _ref.pageLabel,
31861
+ pageLabel = _ref$pageLabel === void 0 ? 'ページ' : _ref$pageLabel,
31862
+ _ref$optionListMaxHei = _ref.optionListMaxHeight,
31863
+ optionListMaxHeight = _ref$optionListMaxHei === void 0 ? 190 : _ref$optionListMaxHei,
31864
+ onClickPrevButton = _ref.onClickPrevButton,
31865
+ onClickNextButton = _ref.onClickNextButton,
31866
+ _onChange = _ref.onChange;
31867
+ var pageMax = Math.ceil(totalSize / sizePerPage);
31868
+ var optionsList = [].concat(Array(pageMax)).map(function (_, index) {
31869
+ var value = (index + 1).toString();
31870
+ return {
31871
+ id: value,
31872
+ value: value,
31873
+ label: value
31874
+ };
31875
+ });
31876
+ return /*#__PURE__*/jsxs("nav", {
31877
+ "aria-label": "pagination",
31878
+ className: "flex items-center gap-x-1",
31879
+ children: [/*#__PURE__*/jsxs("div", {
31880
+ className: "flex items-center gap-x-2",
31881
+ children: [/*#__PURE__*/jsxs("div", {
31882
+ className: clsx$1('text-text-text01', typography.label.label2regular),
31883
+ children: [(currentPage - 1) * sizePerPage + 1, " -", ' ', currentPage * sizePerPage > totalSize ? totalSize : currentPage * sizePerPage, countLabel]
31884
+ }), /*#__PURE__*/jsx(Select, {
31885
+ size: "medium",
31886
+ variant: "outline",
31887
+ selectedOption: optionsList.find(function (option) {
31888
+ return option.value === currentPage.toString();
31889
+ }),
31890
+ optionListMaxHeight: optionListMaxHeight,
31891
+ onChange: function onChange(option) {
31892
+ return option && _onChange(Number(option.value));
31893
+ },
31894
+ children: optionsList && optionsList.map(function (option) {
31895
+ return /*#__PURE__*/jsx(Select.Option, {
31896
+ option: option
31897
+ }, option.id);
31898
+ })
31899
+ }), /*#__PURE__*/jsxs("div", {
31900
+ className: clsx$1('text-text-text03', typography.label.label2regular),
31901
+ children: ["/ ", pageMax, pageLabel]
31902
+ })]
31903
+ }), /*#__PURE__*/jsxs("div", {
31904
+ className: "flex items-center",
31905
+ children: [/*#__PURE__*/jsx(IconButton, {
31906
+ variant: "text",
31907
+ icon: "angle-left",
31908
+ size: "small",
31909
+ isDisabled: currentPage === 1,
31910
+ onClick: onClickPrevButton
31911
+ }), /*#__PURE__*/jsx(IconButton, {
31912
+ variant: "text",
31913
+ icon: "angle-right",
31914
+ size: "small",
31915
+ isDisabled: currentPage === pageMax,
31916
+ onClick: onClickNextButton
31917
+ })]
31918
+ })]
31919
+ });
31920
+ }
31921
+
31922
+ function Radio(_ref) {
31923
+ var name = _ref.name,
31924
+ value = _ref.value,
31925
+ id = _ref.id,
31926
+ label = _ref.label,
31927
+ _ref$isChecked = _ref.isChecked,
31928
+ isChecked = _ref$isChecked === void 0 ? false : _ref$isChecked,
31929
+ _ref$isDisabled = _ref.isDisabled,
31930
+ isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
31931
+ onChange = _ref.onChange;
31932
+ var _useState = useState(false),
31933
+ isMouseOver = _useState[0],
31934
+ setIsMouseOver = _useState[1];
31935
+ var handleMouseOverInput = useCallback(function () {
31936
+ setIsMouseOver(true);
31937
+ }, []);
31938
+ var handleMouseOutInput = useCallback(function () {
31939
+ setIsMouseOver(false);
31940
+ }, []);
31941
+ var handleChange = useCallback(function (e) {
31942
+ return !isDisabled && (onChange == null ? void 0 : onChange(e));
31943
+ }, [isDisabled, onChange]);
31944
+ var inputClasses = clsx$1('absolute', 'z-[1]', 'opacity-0', 'peer', 'h-6', 'w-6', {
31945
+ 'cursor-not-allowed': isDisabled,
31946
+ 'cursor-pointer': !isDisabled
31947
+ });
31948
+ var boxClasses = clsx$1('inline-flex', 'items-center', 'justify-center', 'h-5', 'w-5', 'bg-white', 'border', 'border-solid', 'rounded-full', focusVisible.normalPeer, {
31949
+ 'border-disabled-disabled01 hover:border-disabled-disabled01': isDisabled && !isMouseOver,
31950
+ 'border-hover-hoverUiBorder': !isDisabled && isMouseOver,
31951
+ 'border-border-uiBorder03': !isDisabled,
31952
+ 'cursor-not-allowed': isDisabled,
31953
+ 'cursor-pointer': !isDisabled
31954
+ });
31955
+ var afterClasses = clsx$1('h-3', 'w-3', 'absolute', 'top-0', 'right-0', 'bottom-0', 'left-0', 'block', 'm-auto', 'rounded-full', {
31956
+ 'bg-disabled-disabled01': isDisabled && isChecked,
31957
+ 'bg-active-activeSelectedUi': !isDisabled && isChecked,
31958
+ 'scale-0': !isChecked,
31959
+ 'scale-100': isChecked
31960
+ });
31961
+ var hoverIndicatorClasses = clsx$1('w-3', 'h-3', 'inline-block', 'rounded-full', !isDisabled && !isChecked && isMouseOver && 'bg-hover-hoverUi');
31962
+ var labelClasses = clsx$1('flex-[1_0_0]', 'ml-2', typography.label.label2regular, 'break-all', 'select-none', {
31963
+ 'pointer-events-none cursor-not-allowed text-disabled-disabled01': isDisabled,
31964
+ 'cursor-pointer text-text-text01': !isDisabled
31965
+ });
31966
+ return /*#__PURE__*/jsxs("div", {
31967
+ className: "flex items-center",
31968
+ children: [/*#__PURE__*/jsxs("div", {
31969
+ className: "flex h-6 w-6 items-center justify-center",
31970
+ children: [/*#__PURE__*/jsx("input", {
31971
+ type: "checkbox",
31972
+ value: value,
31973
+ name: name,
31974
+ id: id,
31975
+ checked: isChecked,
31976
+ disabled: isDisabled,
31977
+ onChange: handleChange,
31978
+ onMouseOver: handleMouseOverInput,
31979
+ onMouseLeave: handleMouseOutInput,
31980
+ className: inputClasses
31981
+ }), /*#__PURE__*/jsx("div", {
31982
+ className: boxClasses,
31983
+ children: /*#__PURE__*/jsxs("div", {
31984
+ className: "relative flex h-5 w-5 flex-[0_0_auto] items-center justify-center",
31985
+ children: [/*#__PURE__*/jsx("span", {
31986
+ className: afterClasses
31987
+ }), /*#__PURE__*/jsx("span", {
31988
+ className: hoverIndicatorClasses
31989
+ })]
31990
+ })
31991
+ })]
31992
+ }), /*#__PURE__*/jsx("label", {
31993
+ htmlFor: id,
31994
+ className: labelClasses,
31995
+ children: label
31996
+ })]
31997
+ });
31998
+ }
31999
+
32000
+ var _excluded = ["width", "size"];
32001
+ var Search = /*#__PURE__*/forwardRef(function (_ref, ref) {
32002
+ var _clsx;
32003
+ var _ref$width = _ref.width,
32004
+ width = _ref$width === void 0 ? '100%' : _ref$width,
32005
+ _ref$size = _ref.size,
32006
+ size = _ref$size === void 0 ? 'medium' : _ref$size,
32007
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
32008
+ var classes = clsx('flex', 'items-center', 'rounded-full', 'border', 'border-border-uiBorder02', 'focus-within:border-active-activeInput', {
32009
+ 'h-8 px-3': size === 'medium'
32010
+ }, {
32011
+ 'h-10 px-4': size === 'large'
32012
+ });
32013
+ var inputClasses = clsx('ml-2.5', 'mr-2.5', 'h-full', 'flex-1', 'outline-0', 'text-text-text01', 'placeholder:text-text-textPlaceholder', (_clsx = {}, _clsx["" + typography.label.label2regular] = size === 'medium', _clsx["" + typography.label.label1regular] = size === 'large', _clsx));
32014
+ return /*#__PURE__*/jsx("div", {
32015
+ className: "relative",
32016
+ ref: ref,
32017
+ children: /*#__PURE__*/jsx("form", {
32018
+ onSubmit: props.onSubmit,
32019
+ children: /*#__PURE__*/jsxs("div", {
32020
+ className: classes,
32021
+ style: {
32022
+ width: width
32023
+ },
32024
+ children: [/*#__PURE__*/jsx(Icon, {
32025
+ name: "search",
32026
+ color: "icon01",
32027
+ size: "medium"
32028
+ }), /*#__PURE__*/jsx("input", {
32029
+ type: "text",
32030
+ size: 1,
32031
+ value: props.value,
32032
+ className: inputClasses,
32033
+ placeholder: props.placeholder,
32034
+ onChange: props.onChange
32035
+ }), props.onClickClearButton && props.value && props.value.length !== 0 && /*#__PURE__*/jsx(IconButton, {
32036
+ variant: "text",
32037
+ icon: "close",
32038
+ size: size === 'medium' ? 'small' : 'medium',
32039
+ isNoPadding: true,
32040
+ onClick: props.onClickClearButton
32041
+ })]
32042
+ })
32043
+ })
32044
+ });
32045
+ });
32046
+ Search.displayName = 'Search';
32047
+
31987
32048
  function SelectItem(_ref) {
31988
32049
  var children = _ref.children,
31989
32050
  isSortKey = _ref.isSortKey,
@@ -32488,5 +32549,5 @@ function Tooltip(_ref) {
32488
32549
  });
32489
32550
  }
32490
32551
 
32491
- export { Avatar, Breadcrumb, Button, Checkbox, Dropdown, EvaluationStar, Heading, Icon, IconButton, Loading, Modal, NotificationInline, Radio, Search, Select, SelectSort, Tab, TabItem, Table, TableCell, TableRow, Tag, Toast, ToastProvider, Toggle, Tooltip, useToast };
32552
+ 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 };
32492
32553
  //# sourceMappingURL=index.esm.js.map