@teamturing/react-kit 2.70.1 → 2.71.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,7 +1,12 @@
1
1
  import { ElementType, ReactNode, MouseEvent as ReactMouseEvent, KeyboardEvent as ReactKeyboardEvent, LiHTMLAttributes } from 'react';
2
+ import { ResponsiveValue } from 'styled-system';
2
3
  import { SxProp } from '../../utils/styled-system';
3
4
  type Props = {
4
5
  variant?: 'neutral' | 'danger';
6
+ /**
7
+ * 아이템 사이즈. 미지정 시 ActionList의 size를 따릅니다 (기본값 `m`).
8
+ */
9
+ size?: ResponsiveValue<'m' | 's'>;
5
10
  leadingVisual?: ElementType | ReactNode;
6
11
  trailingVisual?: ElementType | ReactNode;
7
12
  description?: ReactNode;
@@ -12,6 +17,10 @@ type Props = {
12
17
  } & Pick<LiHTMLAttributes<HTMLLIElement>, 'onFocus' | 'onBlur' | 'onClick' | 'onKeyDown' | 'tabIndex' | 'onMouseEnter' | 'onMouseLeave'> & SxProp;
13
18
  declare const _default: import("react").ForwardRefExoticComponent<{
14
19
  variant?: "neutral" | "danger" | undefined;
20
+ /**
21
+ * 아이템 사이즈. 미지정 시 ActionList의 size를 따릅니다 (기본값 `m`).
22
+ */
23
+ size?: ResponsiveValue<"m" | "s"> | undefined;
15
24
  leadingVisual?: string | number | boolean | import("react").ComponentClass<any, any> | import("react").FunctionComponent<any> | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | import("react").ReactPortal | null | undefined;
16
25
  trailingVisual?: string | number | boolean | import("react").ComponentClass<any, any> | import("react").FunctionComponent<any> | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | import("react").ReactPortal | null | undefined;
17
26
  description?: ReactNode;
@@ -1,5 +1,13 @@
1
- import { HorizontalDividerProps } from '../HorizontalDivider';
2
- type Props = {} & HorizontalDividerProps;
3
- declare const ActionListSectionDivider: ({ color, variant, width, sx }: Props) => import("react/jsx-runtime").JSX.Element;
1
+ import { ColorKey } from '@teamturing/token-studio';
2
+ import { HTMLAttributes } from 'react';
3
+ import { BorderColorProps, BorderProps, ResponsiveValue, Theme } from 'styled-system';
4
+ import { SxProp } from '../../utils/styled-system';
5
+ type Props = {
6
+ width?: BorderProps['borderBottomWidth'];
7
+ color?: BorderColorProps<Theme, ColorKey>['borderBottomColor'];
8
+ variant?: BorderProps['borderBottomStyle'];
9
+ size?: ResponsiveValue<'m' | 's'>;
10
+ } & SxProp & Pick<HTMLAttributes<HTMLHRElement>, 'className'>;
11
+ declare const ActionListSectionDivider: ({ color, variant, width, size: propsSize, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
4
12
  export default ActionListSectionDivider;
5
13
  export type { Props as ActionListSectionDividerProps };
@@ -1,9 +1,16 @@
1
1
  import { PropsWithChildren, MouseEvent as ReactMouseEvent, KeyboardEvent as ReactKeyboardEvent } from 'react';
2
+ import { ResponsiveValue } from 'styled-system';
2
3
  import { SxProp } from '../../utils/styled-system';
3
4
  import { ActionListItemProps } from './ActionListItem';
4
5
  import { ActionListSectionDividerProps } from './ActionListSectionDivider';
5
6
  import { ActionListSectionHeaderProps } from './ActionListSectionHeader';
6
7
  type Props = {
8
+ /**
9
+ * ActionList 아이템들의 사이즈를 지정합니다.
10
+ * `m` (기본값): 표준 사이즈
11
+ * `s`: 작은 사이즈
12
+ */
13
+ size?: ResponsiveValue<'m' | 's'>;
7
14
  /**
8
15
  * ActionList의 아이템에 선택이 되어있다는 것을 표시할 때 사용하는 속성입니다.
9
16
  * `undefined`: 선택에 대한 표시를 하지 않습니다.
@@ -19,11 +26,12 @@ type Props = {
19
26
  selectionPosition?: 'leading' | 'trailing';
20
27
  onSelect?: (event: ReactMouseEvent<HTMLLIElement> | ReactKeyboardEvent<HTMLLIElement>) => void;
21
28
  } & SxProp;
22
- type ActionListContextValue = {} & Pick<Props, 'selectionVariant' | 'selectionPosition' | 'onSelect'>;
23
- declare const ActionListContext: import("react").Context<Pick<Props, "onSelect" | "selectionVariant" | "selectionPosition">>;
24
- declare const _default: (({ selectionVariant, selectionPosition, onSelect, ...props }: PropsWithChildren<Props>) => import("react/jsx-runtime").JSX.Element) & {
29
+ type ActionListContextValue = {} & Pick<Props, 'size' | 'selectionVariant' | 'selectionPosition' | 'onSelect'>;
30
+ declare const ActionListContext: import("react").Context<Pick<Props, "size" | "onSelect" | "selectionVariant" | "selectionPosition">>;
31
+ declare const _default: (({ size, selectionVariant, selectionPosition, onSelect, ...props }: PropsWithChildren<Props>) => import("react/jsx-runtime").JSX.Element) & {
25
32
  Item: import("react").ForwardRefExoticComponent<{
26
33
  variant?: "neutral" | "danger" | undefined;
34
+ size?: ResponsiveValue<"m" | "s"> | undefined;
27
35
  leadingVisual?: string | number | boolean | import("react").ComponentClass<any, any> | import("react").FunctionComponent<any> | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | import("react").ReactPortal | null | undefined;
28
36
  trailingVisual?: string | number | boolean | import("react").ComponentClass<any, any> | import("react").FunctionComponent<any> | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | import("react").ReactPortal | null | undefined;
29
37
  description?: import("react").ReactNode;
@@ -34,7 +42,7 @@ declare const _default: (({ selectionVariant, selectionPosition, onSelect, ...pr
34
42
  } & Pick<import("react").LiHTMLAttributes<HTMLLIElement>, "tabIndex" | "onFocus" | "onBlur" | "onKeyDown" | "onClick" | "onMouseEnter" | "onMouseLeave"> & SxProp & {
35
43
  children?: import("react").ReactNode;
36
44
  } & import("react").RefAttributes<HTMLLIElement>>;
37
- SectionDivider: ({ color, variant, width, sx }: ActionListSectionDividerProps) => import("react/jsx-runtime").JSX.Element;
45
+ SectionDivider: ({ color, variant, width, size: propsSize, ...props }: ActionListSectionDividerProps) => import("react/jsx-runtime").JSX.Element;
38
46
  SectionHeader: ({ ...props }: PropsWithChildren<SxProp>) => import("react/jsx-runtime").JSX.Element;
39
47
  };
40
48
  export default _default;
package/dist/index.js CHANGED
@@ -1258,27 +1258,6 @@ var Grid$1 = Object.assign(Grid, {
1258
1258
  Unit
1259
1259
  });
1260
1260
 
1261
- const StyledIcon = /*#__PURE__*/React.forwardRef(({
1262
- icon: Icon,
1263
- sx,
1264
- className,
1265
- ...props
1266
- }, ref) => /*#__PURE__*/jsxRuntime.jsx(View, {
1267
- ref: ref,
1268
- ...props,
1269
- className: `trk-styled_icon__wrapper ${className}`,
1270
- color: props.color,
1271
- sx: {
1272
- '& svg': {
1273
- display: 'inline-flex',
1274
- width: '100%',
1275
- height: '100%'
1276
- },
1277
- ...sx
1278
- },
1279
- children: /*#__PURE__*/jsxRuntime.jsx(Icon, {})
1280
- }));
1281
-
1282
1261
  const Text = /*#__PURE__*/styled__default.default.span.attrs(props => ({
1283
1262
  color: props.color ?? 'text/neutral'
1284
1263
  })).withConfig({
@@ -1425,6 +1404,7 @@ const Text = /*#__PURE__*/styled__default.default.span.attrs(props => ({
1425
1404
 
1426
1405
  const ActionListItem = ({
1427
1406
  variant = 'neutral',
1407
+ size: propSize,
1428
1408
  leadingVisual: LeadingVisual,
1429
1409
  trailingVisual: TrailingVisual,
1430
1410
  description,
@@ -1444,10 +1424,12 @@ const ActionListItem = ({
1444
1424
  }, ref) => {
1445
1425
  const itemRef = useProvidedOrCreatedRef(ref);
1446
1426
  const {
1427
+ size: contextSize,
1447
1428
  selectionVariant,
1448
1429
  selectionPosition = 'leading',
1449
1430
  onSelect: defaultOnSelect
1450
1431
  } = React.useContext(ActionListContext);
1432
+ const size = propSize ?? contextSize ?? 'm';
1451
1433
  if (!selectionVariant && selected) {
1452
1434
  throw new Error('To use selected props in ActionList.Item, ActionList selectionVariant props should be defined.');
1453
1435
  }
@@ -1465,10 +1447,10 @@ const ActionListItem = ({
1465
1447
  }
1466
1448
  externalOnKeyDown?.(event);
1467
1449
  }, [handleSelect, disabled, externalOnKeyDown]);
1468
- const selectionContent = !utils.isNullable(selectionVariant) ? /*#__PURE__*/jsxRuntime.jsx(View, {
1450
+ const selectionContent = !utils.isNullable(selectionVariant) ? /*#__PURE__*/jsxRuntime.jsx(SelectionWrapper, {
1469
1451
  className: 'action_list_item__selection_wrapper',
1470
1452
  display: 'inline-flex',
1471
- minWidth: 20,
1453
+ size: size,
1472
1454
  sx: {
1473
1455
  ...(selectionPosition === 'trailing' ? {
1474
1456
  ml: 2
@@ -1479,27 +1461,29 @@ const ActionListItem = ({
1479
1461
  color: 'icon/selected/primary'
1480
1462
  }
1481
1463
  },
1482
- children: selectionVariant === 'single' ? selected ? /*#__PURE__*/jsxRuntime.jsx(StyledIcon, {
1483
- className: 'action_list_item__selection_wrapper_single',
1484
- icon: icons.CheckIcon,
1485
- size: 20
1464
+ children: selectionVariant === 'single' ? selected ? /*#__PURE__*/jsxRuntime.jsx(icons.CheckIcon, {
1465
+ className: 'action_list_item__selection_wrapper_single'
1486
1466
  }) : null : selectionVariant === 'multiple' ? /*#__PURE__*/jsxRuntime.jsx(FakeCheckbox, {
1487
1467
  className: 'action_list_item__selection_wrapper_multiple',
1488
1468
  "aria-checked": selected,
1489
1469
  checked: selected,
1490
1470
  onChange: utils.noop,
1491
1471
  "aria-disabled": disabled,
1492
- disabled: disabled
1472
+ disabled: disabled,
1473
+ size: size
1493
1474
  }) : null
1494
1475
  }) : null;
1495
1476
  return /*#__PURE__*/jsxRuntime.jsxs(BaseActionListItem, {
1496
1477
  ref: itemRef,
1497
1478
  variant: variant,
1479
+ size: size,
1498
1480
  ...(disabled ? {
1499
1481
  disabled
1500
1482
  } : {
1501
1483
  tabIndex: externalTabIndex ?? 0
1502
1484
  }),
1485
+ hasLeadingVisual: !utils.isNullable(LeadingVisual),
1486
+ hasTrailingVisual: !utils.isNullable(TrailingVisual),
1503
1487
  sx: sx,
1504
1488
  onClick: handleClick,
1505
1489
  onKeyDown: handleKeyDown,
@@ -1531,7 +1515,7 @@ const ActionListItem = ({
1531
1515
  fontWeight: description && descriptionLayout === 'block' ? 'bold' : 'medium'
1532
1516
  },
1533
1517
  children: children
1534
- }), /*#__PURE__*/jsxRuntime.jsx(Grid$1.Unit, {
1518
+ }), description ? /*#__PURE__*/jsxRuntime.jsx(Grid$1.Unit, {
1535
1519
  className: 'action_list_item__content__description',
1536
1520
  size: descriptionLayout === 'inline' ? 'max' : 1,
1537
1521
  children: /*#__PURE__*/jsxRuntime.jsx(Text, {
@@ -1539,7 +1523,7 @@ const ActionListItem = ({
1539
1523
  color: disabled ? 'text/disabled' : 'text/neutral/subtler',
1540
1524
  children: description
1541
1525
  })
1542
- })]
1526
+ }) : null]
1543
1527
  })
1544
1528
  }), /*#__PURE__*/jsxRuntime.jsx(VisualWrapper, {
1545
1529
  className: 'action_list_item__content__trailing_visual',
@@ -1553,9 +1537,23 @@ const ActionListItem = ({
1553
1537
  }), selectionPosition === 'trailing' && selectionContent]
1554
1538
  });
1555
1539
  };
1540
+ const SelectionWrapper = /*#__PURE__*/styled__default.default(View).withConfig({
1541
+ displayName: "ActionListItem__SelectionWrapper",
1542
+ componentId: "sc-cpn5js-0"
1543
+ })(["", ""], () => variant({
1544
+ prop: 'size',
1545
+ variants: {
1546
+ m: {
1547
+ minWidth: utils.forcePixelValue(20)
1548
+ },
1549
+ s: {
1550
+ minWidth: utils.forcePixelValue(20)
1551
+ }
1552
+ }
1553
+ }));
1556
1554
  const VisualWrapper = /*#__PURE__*/styled__default.default(View).withConfig({
1557
1555
  displayName: "ActionListItem__VisualWrapper",
1558
- componentId: "sc-cpn5js-0"
1556
+ componentId: "sc-cpn5js-1"
1559
1557
  })(["", ""], variant({
1560
1558
  prop: 'variant',
1561
1559
  variants: {
@@ -1575,20 +1573,59 @@ const VisualWrapper = /*#__PURE__*/styled__default.default(View).withConfig({
1575
1573
  }));
1576
1574
  const BaseActionListItem = /*#__PURE__*/styled__default.default.li.withConfig({
1577
1575
  displayName: "ActionListItem__BaseActionListItem",
1578
- componentId: "sc-cpn5js-1"
1579
- })(["display:flex;align-items:flex-start;font-size:", ";font-weight:", ";line-height:", ";& svg{width:", ";height:", ";}padding:", ";background-color:", ";border-radius:", ";cursor:pointer;transition:background-color 100ms;", " ", " ", ";"], ({
1580
- theme
1581
- }) => utils.forcePixelValue(theme.fontSizes.xs), ({
1576
+ componentId: "sc-cpn5js-2"
1577
+ })(["display:flex;align-items:flex-start;font-weight:", ";line-height:", ";background-color:", ";border-radius:", ";cursor:pointer;transition:background-color 100ms;", " ", " ", " ", ";"], ({
1582
1578
  theme
1583
1579
  }) => theme.fontWeights.medium, ({
1584
1580
  theme
1585
- }) => theme.lineHeights[2], utils.forcePixelValue(20), utils.forcePixelValue(20), ({
1586
- theme
1587
- }) => utils.forcePixelValue(theme.space[3]), ({
1581
+ }) => theme.lineHeights[2], ({
1588
1582
  theme
1589
1583
  }) => theme.colors['bg/neutral/subtler'], ({
1590
1584
  theme
1591
1585
  }) => utils.forcePixelValue(theme.radii.xs), ({
1586
+ theme,
1587
+ hasLeadingVisual,
1588
+ hasTrailingVisual
1589
+ }) => variant({
1590
+ prop: 'size',
1591
+ variants: {
1592
+ m: {
1593
+ 'fontSize': utils.forcePixelValue(theme.fontSizes.xs),
1594
+ 'padding': utils.forcePixelValue(theme.space[3]),
1595
+ '& svg': {
1596
+ width: utils.forcePixelValue(20),
1597
+ height: utils.forcePixelValue(20)
1598
+ }
1599
+ },
1600
+ s: {
1601
+ 'fontSize': utils.forcePixelValue(theme.fontSizes.xs),
1602
+ 'paddingX': utils.forcePixelValue(theme.space[3]),
1603
+ 'paddingY': utils.forcePixelValue(theme.space[2]),
1604
+ ...(hasLeadingVisual ? {
1605
+ '& .action_list_item__leading_visual': {
1606
+ width: utils.forcePixelValue(16),
1607
+ height: utils.forcePixelValue(20),
1608
+ display: 'flex',
1609
+ alignItems: 'center',
1610
+ justifyContent: 'center'
1611
+ }
1612
+ } : {}),
1613
+ ...(hasTrailingVisual ? {
1614
+ '& .action_list_item__content__trailing_visual': {
1615
+ width: utils.forcePixelValue(16),
1616
+ height: utils.forcePixelValue(20),
1617
+ display: 'flex',
1618
+ alignItems: 'center',
1619
+ justifyContent: 'center'
1620
+ }
1621
+ } : {}),
1622
+ '& svg': {
1623
+ width: utils.forcePixelValue(20),
1624
+ height: utils.forcePixelValue(20)
1625
+ }
1626
+ }
1627
+ }
1628
+ }), ({
1592
1629
  theme,
1593
1630
  disabled
1594
1631
  }) => disabled ? styled.css`
@@ -1623,8 +1660,21 @@ const BaseActionListItem = /*#__PURE__*/styled__default.default.li.withConfig({
1623
1660
  ` : null, sx);
1624
1661
  const FakeCheckbox = /*#__PURE__*/styled__default.default.div.withConfig({
1625
1662
  displayName: "ActionListItem__FakeCheckbox",
1626
- componentId: "sc-cpn5js-2"
1627
- })(["position:relative;width:", ";height:", ";border-width:", ";border-style:solid;border-color:", ";border-radius:", ";cursor:pointer;transition:visibility 200ms;&::before{visibility:hidden;content:'';display:grid;position:absolute;top:0;right:0;bottom:0;left:0;border-radius:", ";background-color:", ";mask-image:url(\"data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10.6 17.2C10.3 17.2 10 17.1 9.80001 16.8L5.20001 12.2C4.70001 11.7 4.70001 11 5.20001 10.5C5.70001 9.99998 6.40001 9.99998 6.90001 10.5L10.6 14.2L17.2 7.59998C17.7 7.09998 18.4 7.09998 18.9 7.59998C19.4 8.09998 19.4 8.79998 18.9 9.29998L11.5 16.7C11.2 17.1 10.9 17.2 10.6 17.2Z' fill='%238D94A0'/%3E%3C/svg%3E%0A\");-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10.6 17.2C10.3 17.2 10 17.1 9.80001 16.8L5.20001 12.2C4.70001 11.7 4.70001 11 5.20001 10.5C5.70001 9.99998 6.40001 9.99998 6.90001 10.5L10.6 14.2L17.2 7.59998C17.7 7.09998 18.4 7.09998 18.9 7.59998C19.4 8.09998 19.4 8.79998 18.9 9.29998L11.5 16.7C11.2 17.1 10.9 17.2 10.6 17.2Z' fill='%238D94A0'/%3E%3C/svg%3E%0A\");mask-size:100%;-webkit-mask-size:100%;mask-repeat:no-repeat;-webkit-mask-repeat:no-repeat;mask-position:center;-webkit-mask-position:center;}&[aria-disabled='true']{background-color:", ";border-color:", ";}&[aria-checked='true']{background-color:", ";border-width:0;&::before{visibility:visible;}&[aria-disabled='true']{background-color:", ";border-color:", ";&::before{background-color:", ";}}}", ""], utils.forcePixelValue(20), utils.forcePixelValue(20), utils.forcePixelValue(2), ({
1663
+ componentId: "sc-cpn5js-3"
1664
+ })(["position:relative;", " border-width:", ";border-style:solid;border-color:", ";border-radius:", ";cursor:pointer;transition:visibility 200ms;&::before{visibility:hidden;content:'';display:grid;position:absolute;top:0;right:0;bottom:0;left:0;border-radius:", ";background-color:", ";mask-image:url(\"data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10.6 17.2C10.3 17.2 10 17.1 9.80001 16.8L5.20001 12.2C4.70001 11.7 4.70001 11 5.20001 10.5C5.70001 9.99998 6.40001 9.99998 6.90001 10.5L10.6 14.2L17.2 7.59998C17.7 7.09998 18.4 7.09998 18.9 7.59998C19.4 8.09998 19.4 8.79998 18.9 9.29998L11.5 16.7C11.2 17.1 10.9 17.2 10.6 17.2Z' fill='%238D94A0'/%3E%3C/svg%3E%0A\");-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10.6 17.2C10.3 17.2 10 17.1 9.80001 16.8L5.20001 12.2C4.70001 11.7 4.70001 11 5.20001 10.5C5.70001 9.99998 6.40001 9.99998 6.90001 10.5L10.6 14.2L17.2 7.59998C17.7 7.09998 18.4 7.09998 18.9 7.59998C19.4 8.09998 19.4 8.79998 18.9 9.29998L11.5 16.7C11.2 17.1 10.9 17.2 10.6 17.2Z' fill='%238D94A0'/%3E%3C/svg%3E%0A\");mask-size:100%;-webkit-mask-size:100%;mask-repeat:no-repeat;-webkit-mask-repeat:no-repeat;mask-position:center;-webkit-mask-position:center;}&[aria-disabled='true']{background-color:", ";border-color:", ";}&[aria-checked='true']{background-color:", ";border-width:0;&::before{visibility:visible;}&[aria-disabled='true']{background-color:", ";border-color:", ";&::before{background-color:", ";}}}", ""], () => variant({
1665
+ prop: 'size',
1666
+ variants: {
1667
+ m: {
1668
+ width: utils.forcePixelValue(20),
1669
+ height: utils.forcePixelValue(20)
1670
+ },
1671
+ // TODO: replace with the actual 's' dimensions once the size spec is finalized.
1672
+ s: {
1673
+ width: utils.forcePixelValue(20),
1674
+ height: utils.forcePixelValue(20)
1675
+ }
1676
+ }
1677
+ }), utils.forcePixelValue(2), ({
1628
1678
  theme
1629
1679
  }) => theme.colors['border/neutral'], ({
1630
1680
  theme
@@ -1647,40 +1697,40 @@ const FakeCheckbox = /*#__PURE__*/styled__default.default.div.withConfig({
1647
1697
  }) => theme.colors['icon/disabled'], sx);
1648
1698
  var ActionListItem$1 = /*#__PURE__*/React.forwardRef(ActionListItem);
1649
1699
 
1650
- const HorizontalDivider = ({
1651
- className,
1652
- width = 1,
1653
- color = 'border/neutral',
1654
- variant = 'solid',
1655
- ...props
1656
- }) => /*#__PURE__*/jsxRuntime.jsx(BaseHorizontalDivider, {
1657
- className: className,
1658
- borderBottomWidth: width,
1659
- borderBottomStyle: variant,
1660
- borderBottomColor: color,
1661
- ...props
1662
- });
1663
- const BaseHorizontalDivider = /*#__PURE__*/styled__default.default.hr.withConfig({
1664
- displayName: "HorizontalDivider__BaseHorizontalDivider",
1665
- componentId: "sc-1nsxooh-0"
1666
- })(["display:block;margin:0;padding:0;border:none;width:100%;", " ", ""], border, sx);
1667
-
1668
1700
  const ActionListSectionDivider = ({
1669
1701
  color = 'border/neutral',
1670
1702
  variant = 'solid',
1671
1703
  width = 1,
1672
- sx
1673
- }) => /*#__PURE__*/jsxRuntime.jsx(BaseActionListSectionDivider, {
1674
- className: 'action_list_section_divider',
1675
- color: color,
1676
- variant: variant,
1677
- width: width,
1678
- sx: {
1679
- ...sx,
1680
- my: 3
1704
+ size: propsSize,
1705
+ ...props
1706
+ }) => {
1707
+ const {
1708
+ size: contextSize
1709
+ } = React.useContext(ActionListContext);
1710
+ const size = propsSize ?? contextSize ?? 'm';
1711
+ return /*#__PURE__*/jsxRuntime.jsx(BaseActionListSectionDivider, {
1712
+ className: 'action_list_section_divider',
1713
+ size: size,
1714
+ borderBottomWidth: width,
1715
+ borderBottomStyle: variant,
1716
+ borderBottomColor: color,
1717
+ ...props
1718
+ });
1719
+ };
1720
+ const BaseActionListSectionDivider = /*#__PURE__*/styled__default.default.hr.withConfig({
1721
+ displayName: "ActionListSectionDivider__BaseActionListSectionDivider",
1722
+ componentId: "sc-b8z51g-0"
1723
+ })(["display:block;margin:0;padding:0;border:none;width:100%;", " ", " ", ""], () => variant({
1724
+ prop: 'size',
1725
+ variants: {
1726
+ m: {
1727
+ my: 3
1728
+ },
1729
+ s: {
1730
+ my: 2
1731
+ }
1681
1732
  }
1682
- });
1683
- const BaseActionListSectionDivider = HorizontalDivider;
1733
+ }), border, sx);
1684
1734
 
1685
1735
  const ActionListSectionHeader = ({
1686
1736
  ...props
@@ -1708,6 +1758,7 @@ const BaseActionListSectionHeader = /*#__PURE__*/styled__default.default.div.wit
1708
1758
 
1709
1759
  const ActionListContext = /*#__PURE__*/React.createContext({});
1710
1760
  const ActionList = ({
1761
+ size = 'm',
1711
1762
  selectionVariant,
1712
1763
  selectionPosition,
1713
1764
  onSelect,
@@ -1715,6 +1766,7 @@ const ActionList = ({
1715
1766
  }) => {
1716
1767
  return /*#__PURE__*/jsxRuntime.jsx(ActionListContext.Provider, {
1717
1768
  value: {
1769
+ size,
1718
1770
  selectionVariant,
1719
1771
  selectionPosition,
1720
1772
  onSelect
@@ -3200,6 +3252,45 @@ const useDevice = () => {
3200
3252
  return deviceState || {};
3201
3253
  };
3202
3254
 
3255
+ const HorizontalDivider = ({
3256
+ className,
3257
+ width = 1,
3258
+ color = 'border/neutral',
3259
+ variant = 'solid',
3260
+ ...props
3261
+ }) => /*#__PURE__*/jsxRuntime.jsx(BaseHorizontalDivider, {
3262
+ className: className,
3263
+ borderBottomWidth: width,
3264
+ borderBottomStyle: variant,
3265
+ borderBottomColor: color,
3266
+ ...props
3267
+ });
3268
+ const BaseHorizontalDivider = /*#__PURE__*/styled__default.default.hr.withConfig({
3269
+ displayName: "HorizontalDivider__BaseHorizontalDivider",
3270
+ componentId: "sc-1nsxooh-0"
3271
+ })(["display:block;margin:0;padding:0;border:none;width:100%;", " ", ""], border, sx);
3272
+
3273
+ const StyledIcon = /*#__PURE__*/React.forwardRef(({
3274
+ icon: Icon,
3275
+ sx,
3276
+ className,
3277
+ ...props
3278
+ }, ref) => /*#__PURE__*/jsxRuntime.jsx(View, {
3279
+ ref: ref,
3280
+ ...props,
3281
+ className: `trk-styled_icon__wrapper ${className}`,
3282
+ color: props.color,
3283
+ sx: {
3284
+ '& svg': {
3285
+ display: 'inline-flex',
3286
+ width: '100%',
3287
+ height: '100%'
3288
+ },
3289
+ ...sx
3290
+ },
3291
+ children: /*#__PURE__*/jsxRuntime.jsx(Icon, {})
3292
+ }));
3293
+
3203
3294
  const TextInputTrailingAction = ({
3204
3295
  icon: Icon,
3205
3296
  disabled,
@@ -7,7 +7,6 @@ import '../../node_modules/styled-system/dist/index.esm.js';
7
7
  import useProvidedOrCreatedRef from '../../hook/useProvidedOrCreatedRef.js';
8
8
  import { sx } from '../../utils/styled-system/index.js';
9
9
  import Grid from '../Grid/index.js';
10
- import StyledIcon from '../StyledIcon/index.js';
11
10
  import Text from '../Text/index.js';
12
11
  import View from '../View/index.js';
13
12
  import { ActionListContext } from './index.js';
@@ -16,6 +15,7 @@ import { variant } from '../../node_modules/@styled-system/variant/dist/index.es
16
15
 
17
16
  const ActionListItem = ({
18
17
  variant = 'neutral',
18
+ size: propSize,
19
19
  leadingVisual: LeadingVisual,
20
20
  trailingVisual: TrailingVisual,
21
21
  description,
@@ -35,10 +35,12 @@ const ActionListItem = ({
35
35
  }, ref) => {
36
36
  const itemRef = useProvidedOrCreatedRef(ref);
37
37
  const {
38
+ size: contextSize,
38
39
  selectionVariant,
39
40
  selectionPosition = 'leading',
40
41
  onSelect: defaultOnSelect
41
42
  } = useContext(ActionListContext);
43
+ const size = propSize ?? contextSize ?? 'm';
42
44
  if (!selectionVariant && selected) {
43
45
  throw new Error('To use selected props in ActionList.Item, ActionList selectionVariant props should be defined.');
44
46
  }
@@ -56,10 +58,10 @@ const ActionListItem = ({
56
58
  }
57
59
  externalOnKeyDown?.(event);
58
60
  }, [handleSelect, disabled, externalOnKeyDown]);
59
- const selectionContent = !isNullable(selectionVariant) ? /*#__PURE__*/jsx(View, {
61
+ const selectionContent = !isNullable(selectionVariant) ? /*#__PURE__*/jsx(SelectionWrapper, {
60
62
  className: 'action_list_item__selection_wrapper',
61
63
  display: 'inline-flex',
62
- minWidth: 20,
64
+ size: size,
63
65
  sx: {
64
66
  ...(selectionPosition === 'trailing' ? {
65
67
  ml: 2
@@ -70,27 +72,29 @@ const ActionListItem = ({
70
72
  color: 'icon/selected/primary'
71
73
  }
72
74
  },
73
- children: selectionVariant === 'single' ? selected ? /*#__PURE__*/jsx(StyledIcon, {
74
- className: 'action_list_item__selection_wrapper_single',
75
- icon: CheckIcon,
76
- size: 20
75
+ children: selectionVariant === 'single' ? selected ? /*#__PURE__*/jsx(CheckIcon, {
76
+ className: 'action_list_item__selection_wrapper_single'
77
77
  }) : null : selectionVariant === 'multiple' ? /*#__PURE__*/jsx(FakeCheckbox, {
78
78
  className: 'action_list_item__selection_wrapper_multiple',
79
79
  "aria-checked": selected,
80
80
  checked: selected,
81
81
  onChange: noop,
82
82
  "aria-disabled": disabled,
83
- disabled: disabled
83
+ disabled: disabled,
84
+ size: size
84
85
  }) : null
85
86
  }) : null;
86
87
  return /*#__PURE__*/jsxs(BaseActionListItem, {
87
88
  ref: itemRef,
88
89
  variant: variant,
90
+ size: size,
89
91
  ...(disabled ? {
90
92
  disabled
91
93
  } : {
92
94
  tabIndex: externalTabIndex ?? 0
93
95
  }),
96
+ hasLeadingVisual: !isNullable(LeadingVisual),
97
+ hasTrailingVisual: !isNullable(TrailingVisual),
94
98
  sx: sx,
95
99
  onClick: handleClick,
96
100
  onKeyDown: handleKeyDown,
@@ -122,7 +126,7 @@ const ActionListItem = ({
122
126
  fontWeight: description && descriptionLayout === 'block' ? 'bold' : 'medium'
123
127
  },
124
128
  children: children
125
- }), /*#__PURE__*/jsx(Grid.Unit, {
129
+ }), description ? /*#__PURE__*/jsx(Grid.Unit, {
126
130
  className: 'action_list_item__content__description',
127
131
  size: descriptionLayout === 'inline' ? 'max' : 1,
128
132
  children: /*#__PURE__*/jsx(Text, {
@@ -130,7 +134,7 @@ const ActionListItem = ({
130
134
  color: disabled ? 'text/disabled' : 'text/neutral/subtler',
131
135
  children: description
132
136
  })
133
- })]
137
+ }) : null]
134
138
  })
135
139
  }), /*#__PURE__*/jsx(VisualWrapper, {
136
140
  className: 'action_list_item__content__trailing_visual',
@@ -144,9 +148,23 @@ const ActionListItem = ({
144
148
  }), selectionPosition === 'trailing' && selectionContent]
145
149
  });
146
150
  };
151
+ const SelectionWrapper = /*#__PURE__*/styled(View).withConfig({
152
+ displayName: "ActionListItem__SelectionWrapper",
153
+ componentId: "sc-cpn5js-0"
154
+ })(["", ""], () => variant({
155
+ prop: 'size',
156
+ variants: {
157
+ m: {
158
+ minWidth: forcePixelValue(20)
159
+ },
160
+ s: {
161
+ minWidth: forcePixelValue(20)
162
+ }
163
+ }
164
+ }));
147
165
  const VisualWrapper = /*#__PURE__*/styled(View).withConfig({
148
166
  displayName: "ActionListItem__VisualWrapper",
149
- componentId: "sc-cpn5js-0"
167
+ componentId: "sc-cpn5js-1"
150
168
  })(["", ""], variant({
151
169
  prop: 'variant',
152
170
  variants: {
@@ -166,20 +184,59 @@ const VisualWrapper = /*#__PURE__*/styled(View).withConfig({
166
184
  }));
167
185
  const BaseActionListItem = /*#__PURE__*/styled.li.withConfig({
168
186
  displayName: "ActionListItem__BaseActionListItem",
169
- componentId: "sc-cpn5js-1"
170
- })(["display:flex;align-items:flex-start;font-size:", ";font-weight:", ";line-height:", ";& svg{width:", ";height:", ";}padding:", ";background-color:", ";border-radius:", ";cursor:pointer;transition:background-color 100ms;", " ", " ", ";"], ({
171
- theme
172
- }) => forcePixelValue(theme.fontSizes.xs), ({
187
+ componentId: "sc-cpn5js-2"
188
+ })(["display:flex;align-items:flex-start;font-weight:", ";line-height:", ";background-color:", ";border-radius:", ";cursor:pointer;transition:background-color 100ms;", " ", " ", " ", ";"], ({
173
189
  theme
174
190
  }) => theme.fontWeights.medium, ({
175
191
  theme
176
- }) => theme.lineHeights[2], forcePixelValue(20), forcePixelValue(20), ({
177
- theme
178
- }) => forcePixelValue(theme.space[3]), ({
192
+ }) => theme.lineHeights[2], ({
179
193
  theme
180
194
  }) => theme.colors['bg/neutral/subtler'], ({
181
195
  theme
182
196
  }) => forcePixelValue(theme.radii.xs), ({
197
+ theme,
198
+ hasLeadingVisual,
199
+ hasTrailingVisual
200
+ }) => variant({
201
+ prop: 'size',
202
+ variants: {
203
+ m: {
204
+ 'fontSize': forcePixelValue(theme.fontSizes.xs),
205
+ 'padding': forcePixelValue(theme.space[3]),
206
+ '& svg': {
207
+ width: forcePixelValue(20),
208
+ height: forcePixelValue(20)
209
+ }
210
+ },
211
+ s: {
212
+ 'fontSize': forcePixelValue(theme.fontSizes.xs),
213
+ 'paddingX': forcePixelValue(theme.space[3]),
214
+ 'paddingY': forcePixelValue(theme.space[2]),
215
+ ...(hasLeadingVisual ? {
216
+ '& .action_list_item__leading_visual': {
217
+ width: forcePixelValue(16),
218
+ height: forcePixelValue(20),
219
+ display: 'flex',
220
+ alignItems: 'center',
221
+ justifyContent: 'center'
222
+ }
223
+ } : {}),
224
+ ...(hasTrailingVisual ? {
225
+ '& .action_list_item__content__trailing_visual': {
226
+ width: forcePixelValue(16),
227
+ height: forcePixelValue(20),
228
+ display: 'flex',
229
+ alignItems: 'center',
230
+ justifyContent: 'center'
231
+ }
232
+ } : {}),
233
+ '& svg': {
234
+ width: forcePixelValue(20),
235
+ height: forcePixelValue(20)
236
+ }
237
+ }
238
+ }
239
+ }), ({
183
240
  theme,
184
241
  disabled
185
242
  }) => disabled ? css`
@@ -214,8 +271,21 @@ const BaseActionListItem = /*#__PURE__*/styled.li.withConfig({
214
271
  ` : null, sx);
215
272
  const FakeCheckbox = /*#__PURE__*/styled.div.withConfig({
216
273
  displayName: "ActionListItem__FakeCheckbox",
217
- componentId: "sc-cpn5js-2"
218
- })(["position:relative;width:", ";height:", ";border-width:", ";border-style:solid;border-color:", ";border-radius:", ";cursor:pointer;transition:visibility 200ms;&::before{visibility:hidden;content:'';display:grid;position:absolute;top:0;right:0;bottom:0;left:0;border-radius:", ";background-color:", ";mask-image:url(\"data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10.6 17.2C10.3 17.2 10 17.1 9.80001 16.8L5.20001 12.2C4.70001 11.7 4.70001 11 5.20001 10.5C5.70001 9.99998 6.40001 9.99998 6.90001 10.5L10.6 14.2L17.2 7.59998C17.7 7.09998 18.4 7.09998 18.9 7.59998C19.4 8.09998 19.4 8.79998 18.9 9.29998L11.5 16.7C11.2 17.1 10.9 17.2 10.6 17.2Z' fill='%238D94A0'/%3E%3C/svg%3E%0A\");-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10.6 17.2C10.3 17.2 10 17.1 9.80001 16.8L5.20001 12.2C4.70001 11.7 4.70001 11 5.20001 10.5C5.70001 9.99998 6.40001 9.99998 6.90001 10.5L10.6 14.2L17.2 7.59998C17.7 7.09998 18.4 7.09998 18.9 7.59998C19.4 8.09998 19.4 8.79998 18.9 9.29998L11.5 16.7C11.2 17.1 10.9 17.2 10.6 17.2Z' fill='%238D94A0'/%3E%3C/svg%3E%0A\");mask-size:100%;-webkit-mask-size:100%;mask-repeat:no-repeat;-webkit-mask-repeat:no-repeat;mask-position:center;-webkit-mask-position:center;}&[aria-disabled='true']{background-color:", ";border-color:", ";}&[aria-checked='true']{background-color:", ";border-width:0;&::before{visibility:visible;}&[aria-disabled='true']{background-color:", ";border-color:", ";&::before{background-color:", ";}}}", ""], forcePixelValue(20), forcePixelValue(20), forcePixelValue(2), ({
274
+ componentId: "sc-cpn5js-3"
275
+ })(["position:relative;", " border-width:", ";border-style:solid;border-color:", ";border-radius:", ";cursor:pointer;transition:visibility 200ms;&::before{visibility:hidden;content:'';display:grid;position:absolute;top:0;right:0;bottom:0;left:0;border-radius:", ";background-color:", ";mask-image:url(\"data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10.6 17.2C10.3 17.2 10 17.1 9.80001 16.8L5.20001 12.2C4.70001 11.7 4.70001 11 5.20001 10.5C5.70001 9.99998 6.40001 9.99998 6.90001 10.5L10.6 14.2L17.2 7.59998C17.7 7.09998 18.4 7.09998 18.9 7.59998C19.4 8.09998 19.4 8.79998 18.9 9.29998L11.5 16.7C11.2 17.1 10.9 17.2 10.6 17.2Z' fill='%238D94A0'/%3E%3C/svg%3E%0A\");-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10.6 17.2C10.3 17.2 10 17.1 9.80001 16.8L5.20001 12.2C4.70001 11.7 4.70001 11 5.20001 10.5C5.70001 9.99998 6.40001 9.99998 6.90001 10.5L10.6 14.2L17.2 7.59998C17.7 7.09998 18.4 7.09998 18.9 7.59998C19.4 8.09998 19.4 8.79998 18.9 9.29998L11.5 16.7C11.2 17.1 10.9 17.2 10.6 17.2Z' fill='%238D94A0'/%3E%3C/svg%3E%0A\");mask-size:100%;-webkit-mask-size:100%;mask-repeat:no-repeat;-webkit-mask-repeat:no-repeat;mask-position:center;-webkit-mask-position:center;}&[aria-disabled='true']{background-color:", ";border-color:", ";}&[aria-checked='true']{background-color:", ";border-width:0;&::before{visibility:visible;}&[aria-disabled='true']{background-color:", ";border-color:", ";&::before{background-color:", ";}}}", ""], () => variant({
276
+ prop: 'size',
277
+ variants: {
278
+ m: {
279
+ width: forcePixelValue(20),
280
+ height: forcePixelValue(20)
281
+ },
282
+ // TODO: replace with the actual 's' dimensions once the size spec is finalized.
283
+ s: {
284
+ width: forcePixelValue(20),
285
+ height: forcePixelValue(20)
286
+ }
287
+ }
288
+ }), forcePixelValue(2), ({
219
289
  theme
220
290
  }) => theme.colors['border/neutral'], ({
221
291
  theme
@@ -1,21 +1,45 @@
1
- import HorizontalDivider from '../HorizontalDivider/index.js';
1
+ import { useContext } from 'react';
2
+ import styled from 'styled-components';
3
+ import '../../node_modules/styled-system/dist/index.esm.js';
4
+ import { sx } from '../../utils/styled-system/index.js';
5
+ import { ActionListContext } from './index.js';
2
6
  import { jsx } from 'react/jsx-runtime';
7
+ import { variant } from '../../node_modules/@styled-system/variant/dist/index.esm.js';
8
+ import { border } from '../../node_modules/@styled-system/border/dist/index.esm.js';
3
9
 
4
10
  const ActionListSectionDivider = ({
5
11
  color = 'border/neutral',
6
12
  variant = 'solid',
7
13
  width = 1,
8
- sx
9
- }) => /*#__PURE__*/jsx(BaseActionListSectionDivider, {
10
- className: 'action_list_section_divider',
11
- color: color,
12
- variant: variant,
13
- width: width,
14
- sx: {
15
- ...sx,
16
- my: 3
14
+ size: propsSize,
15
+ ...props
16
+ }) => {
17
+ const {
18
+ size: contextSize
19
+ } = useContext(ActionListContext);
20
+ const size = propsSize ?? contextSize ?? 'm';
21
+ return /*#__PURE__*/jsx(BaseActionListSectionDivider, {
22
+ className: 'action_list_section_divider',
23
+ size: size,
24
+ borderBottomWidth: width,
25
+ borderBottomStyle: variant,
26
+ borderBottomColor: color,
27
+ ...props
28
+ });
29
+ };
30
+ const BaseActionListSectionDivider = /*#__PURE__*/styled.hr.withConfig({
31
+ displayName: "ActionListSectionDivider__BaseActionListSectionDivider",
32
+ componentId: "sc-b8z51g-0"
33
+ })(["display:block;margin:0;padding:0;border:none;width:100%;", " ", " ", ""], () => variant({
34
+ prop: 'size',
35
+ variants: {
36
+ m: {
37
+ my: 3
38
+ },
39
+ s: {
40
+ my: 2
41
+ }
17
42
  }
18
- });
19
- const BaseActionListSectionDivider = HorizontalDivider;
43
+ }), border, sx);
20
44
 
21
45
  export { ActionListSectionDivider as default };
@@ -8,6 +8,7 @@ import { jsx } from 'react/jsx-runtime';
8
8
 
9
9
  const ActionListContext = /*#__PURE__*/createContext({});
10
10
  const ActionList = ({
11
+ size = 'm',
11
12
  selectionVariant,
12
13
  selectionPosition,
13
14
  onSelect,
@@ -15,6 +16,7 @@ const ActionList = ({
15
16
  }) => {
16
17
  return /*#__PURE__*/jsx(ActionListContext.Provider, {
17
18
  value: {
19
+ size,
18
20
  selectionVariant,
19
21
  selectionPosition,
20
22
  onSelect
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamturing/react-kit",
3
- "version": "2.70.1",
3
+ "version": "2.71.0",
4
4
  "description": "React components, hooks for create teamturing web application",
5
5
  "author": "Sungchang Park <psch300@gmail.com> (https://github.com/psch300)",
6
6
  "homepage": "https://github.com/weareteamturing/bombe#readme",
@@ -65,5 +65,5 @@
65
65
  "react-textarea-autosize": "^8.5.3",
66
66
  "styled-system": "^5.1.5"
67
67
  },
68
- "gitHead": "83d4929390e6b37022f432b181916aafc411008d"
68
+ "gitHead": "b0310d74360eb37f02d3f6df12f64cb7538e2383"
69
69
  }