@zenkigen-inc/component-ui 1.6.3 → 1.7.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.js CHANGED
@@ -51,8 +51,8 @@ function Avatar(_ref) {
51
51
  'bg-icon-icon01': !props.userId,
52
52
  [userColors[((_props$userId = props.userId) != null ? _props$userId : 0) % userColors.length]]: props.userId && !props.isDisabled
53
53
  });
54
- const trimmedFirstName = props.firstName.trim();
55
- const trimmedLastName = props.lastName.trim();
54
+ const trimmedFirstName = props.firstName.replace(' ', ' ').trim();
55
+ const trimmedLastName = props.lastName.replace(' ', ' ').trim().trim();
56
56
  const nameOnIcon = isAsciiString(trimmedLastName) ? trimmedFirstName.slice(0, 1).toUpperCase() + trimmedLastName.slice(0, 1).toUpperCase() : (trimmedLastName + trimmedFirstName).slice(0, 2);
57
57
  return /*#__PURE__*/jsx("span", {
58
58
  className: classes,
@@ -31219,7 +31219,7 @@ function Dropdown({
31219
31219
  label,
31220
31220
  icon,
31221
31221
  size = 'medium',
31222
- variant = target ? 'text' : 'outline',
31222
+ variant = 'outline',
31223
31223
  title,
31224
31224
  isDisabled = false,
31225
31225
  isArrowHidden = false,
@@ -31280,13 +31280,19 @@ function Dropdown({
31280
31280
  children: /*#__PURE__*/jsxs("div", {
31281
31281
  ref: targetRef,
31282
31282
  className: wrapperClasses,
31283
- children: [target ? /*#__PURE__*/jsx("button", {
31283
+ children: [target ? /*#__PURE__*/jsxs("button", {
31284
31284
  type: "button",
31285
31285
  title: title,
31286
31286
  className: childrenButtonClasses,
31287
31287
  onClick: handleToggle,
31288
31288
  disabled: isDisabled,
31289
- children: target
31289
+ children: [target, !isArrowHidden && /*#__PURE__*/jsx("div", {
31290
+ className: "ml-2 flex items-center fill-icon-icon01",
31291
+ children: /*#__PURE__*/jsx(Icon, {
31292
+ name: isVisible ? 'angle-small-up' : 'angle-small-down',
31293
+ size: size === 'large' ? 'medium' : 'small'
31294
+ })
31295
+ })]
31290
31296
  }) : /*#__PURE__*/jsxs("button", {
31291
31297
  type: "button",
31292
31298
  title: title,
@@ -31543,7 +31549,7 @@ function Modal({
31543
31549
  children: /*#__PURE__*/jsx("div", {
31544
31550
  className: "fixed left-0 top-0 z-overlay flex h-full w-full items-center justify-center bg-background-backgroundOverlayBlack",
31545
31551
  children: /*#__PURE__*/jsx("div", {
31546
- className: "flex shrink-0 flex-col rounded-lg bg-background-uiBackground01 shadow-modalShadow",
31552
+ className: "grid grid-rows-[max-content_1fr_max-content] flex-col rounded-lg bg-background-uiBackground01 shadow-modalShadow",
31547
31553
  style: {
31548
31554
  width: renderWidth,
31549
31555
  height: renderHeight
@@ -32602,8 +32608,8 @@ const TailIcon = props => {
32602
32608
  'right-4': props.horizontalAlign === 'right' && props.size !== 'small',
32603
32609
  'left-2': props.horizontalAlign === 'left' && props.size === 'small',
32604
32610
  'left-4': props.horizontalAlign === 'left' && props.size !== 'small',
32605
- 'left-2/4 -translate-x-1': props.horizontalAlign === 'center' && props.size === 'small',
32606
- 'left-2/4 -translate-x-2': props.horizontalAlign === 'center' && props.size !== 'small'
32611
+ 'left-1/2 -translate-x-1': props.horizontalAlign === 'center' && props.size === 'small',
32612
+ 'left-1/2 -translate-x-2': props.horizontalAlign === 'center' && props.size !== 'small'
32607
32613
  });
32608
32614
  if (props.size === 'small') {
32609
32615
  return /*#__PURE__*/jsx("svg", {
@@ -32641,52 +32647,53 @@ function Tooltip({
32641
32647
  isDisabledHover = false
32642
32648
  }) {
32643
32649
  const [isVisible, setIsVisible] = useState(false);
32644
- const [targetDimensions, setTargetDimensions] = useState({
32645
- width: 0,
32646
- height: 0
32647
- });
32648
32650
  const targetRef = useRef(null);
32649
32651
  const handleMouseOverWrapper = useCallback(() => {
32650
- if (targetRef.current === null || isDisabledHover) {
32652
+ if (isDisabledHover) {
32651
32653
  return;
32652
32654
  }
32653
- const dimensions = targetRef.current.getBoundingClientRect();
32654
- const calculatedDimensions = {
32655
- width: dimensions.right - dimensions.left,
32656
- height: dimensions.bottom - dimensions.top
32657
- };
32658
- setTargetDimensions(calculatedDimensions);
32659
32655
  setIsVisible(true);
32660
32656
  }, [isDisabledHover]);
32661
32657
  const handleMouseOutWrapper = useCallback(() => {
32662
32658
  setIsVisible(false);
32663
32659
  }, []);
32660
+ const tooltipWrapClasses = clsx$1('absolute inset-x-0 z-tooltip m-auto flex', {
32661
+ 'top-0': verticalPosition !== 'bottom',
32662
+ 'bottom-0': verticalPosition === 'bottom',
32663
+ 'justify-start': horizontalAlign === 'left',
32664
+ 'justify-center': horizontalAlign === 'center',
32665
+ 'justify-end': horizontalAlign === 'right',
32666
+ 'w-[24px]': size === 'small',
32667
+ 'w-[46px]': size !== 'small'
32668
+ });
32664
32669
  const tooltipBodyClasses = clsx$1('absolute z-tooltip inline-block w-max rounded bg-background-uiBackgroundTooltip text-text-textOnColor', {
32665
32670
  'typography-body3regular': size === 'small',
32666
32671
  'typography-body2regular': size === 'medium',
32667
32672
  'px-2 pb-1 pt-1.5': size === 'small',
32668
32673
  'px-4 py-3': size === 'medium',
32669
- 'left-0': horizontalAlign === 'left',
32670
- 'right-0': horizontalAlign === 'right',
32671
- 'left-auto': horizontalAlign === 'center'
32674
+ 'bottom-2': verticalPosition !== 'bottom' && size === 'small',
32675
+ 'bottom-3': verticalPosition !== 'bottom' && size === 'medium',
32676
+ 'top-2': verticalPosition === 'bottom' && size === 'small',
32677
+ 'top-3': verticalPosition === 'bottom' && size === 'medium'
32672
32678
  });
32673
32679
  return /*#__PURE__*/jsxs("div", {
32674
32680
  ref: targetRef,
32675
32681
  className: "relative flex items-center justify-center",
32676
32682
  onMouseOver: handleMouseOverWrapper,
32677
32683
  onMouseLeave: handleMouseOutWrapper,
32678
- children: [children, isVisible && /*#__PURE__*/jsxs("div", {
32679
- className: tooltipBodyClasses,
32680
- style: {
32681
- maxWidth,
32682
- top: verticalPosition === 'bottom' ? size === 'small' ? `${targetDimensions.height + 8}px` : `${targetDimensions.height + 12}px` : 'unset',
32683
- bottom: verticalPosition === 'top' ? size === 'small' ? `${targetDimensions.height + 8}px` : `${targetDimensions.height + 12}px` : 'unset'
32684
- },
32685
- children: [content, /*#__PURE__*/jsx(TailIcon, {
32686
- size: size,
32687
- verticalPosition: verticalPosition,
32688
- horizontalAlign: horizontalAlign
32689
- })]
32684
+ children: [children, isVisible && /*#__PURE__*/jsx("div", {
32685
+ className: tooltipWrapClasses,
32686
+ children: /*#__PURE__*/jsxs("div", {
32687
+ className: tooltipBodyClasses,
32688
+ style: {
32689
+ maxWidth
32690
+ },
32691
+ children: [content, /*#__PURE__*/jsx(TailIcon, {
32692
+ size: size,
32693
+ verticalPosition: verticalPosition,
32694
+ horizontalAlign: horizontalAlign
32695
+ })]
32696
+ })
32690
32697
  })]
32691
32698
  });
32692
32699
  }