@doist/reactist 11.0.0 → 11.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.
Files changed (125) hide show
  1. package/dist/reactist.cjs.development.js +307 -298
  2. package/dist/reactist.cjs.development.js.map +1 -1
  3. package/dist/reactist.cjs.production.min.js +1 -1
  4. package/dist/reactist.cjs.production.min.js.map +1 -1
  5. package/es/components/menu/menu.js +2 -1
  6. package/es/components/menu/menu.js.map +1 -1
  7. package/es/index.js +3 -3
  8. package/es/new-components/alert/alert.js +16 -6
  9. package/es/new-components/alert/alert.js.map +1 -1
  10. package/es/new-components/alert/alert.module.css.js +1 -1
  11. package/es/{components → new-components}/avatar/avatar.js +14 -8
  12. package/es/new-components/avatar/avatar.js.map +1 -0
  13. package/es/new-components/avatar/avatar.module.css.js +4 -0
  14. package/es/new-components/avatar/avatar.module.css.js.map +1 -0
  15. package/es/{components → new-components}/avatar/utils.js +0 -0
  16. package/es/new-components/avatar/utils.js.map +1 -0
  17. package/es/new-components/base-button/base-button.js +5 -5
  18. package/es/new-components/base-button/base-button.js.map +1 -1
  19. package/es/new-components/box/box.js +5 -5
  20. package/es/new-components/box/box.js.map +1 -1
  21. package/es/new-components/box/box.module.css.js +1 -1
  22. package/es/new-components/button/button.js +0 -2
  23. package/es/new-components/button/button.js.map +1 -1
  24. package/es/new-components/button-link/button-link.js +0 -2
  25. package/es/new-components/button-link/button-link.js.map +1 -1
  26. package/es/new-components/heading/heading.module.css.js +1 -1
  27. package/es/new-components/inline/inline.js +2 -2
  28. package/es/new-components/inline/inline.js.map +1 -1
  29. package/es/new-components/modal/modal.js +11 -15
  30. package/es/new-components/modal/modal.js.map +1 -1
  31. package/es/new-components/notice/notice.js +3 -1
  32. package/es/new-components/notice/notice.js.map +1 -1
  33. package/es/new-components/tabs/tabs.module.css.js +1 -1
  34. package/es/new-components/text/text.module.css.js +1 -1
  35. package/es/new-components/text-area/text-area.js.map +1 -1
  36. package/es/new-components/text-link/text-link.module.css.js +1 -1
  37. package/lib/components/menu/menu.js +1 -1
  38. package/lib/components/menu/menu.js.map +1 -1
  39. package/lib/index.d.ts +1 -1
  40. package/lib/index.js +1 -1
  41. package/lib/new-components/alert/alert.js +1 -1
  42. package/lib/new-components/alert/alert.js.map +1 -1
  43. package/lib/new-components/alert/alert.module.css.js +1 -1
  44. package/lib/{components/avatar/avatar.test.d.ts → new-components/alert/alert.test.d.ts} +0 -0
  45. package/lib/{components → new-components}/avatar/avatar.d.ts +6 -3
  46. package/lib/new-components/avatar/avatar.js +2 -0
  47. package/lib/new-components/avatar/avatar.js.map +1 -0
  48. package/lib/new-components/avatar/avatar.module.css.js +2 -0
  49. package/lib/new-components/avatar/avatar.module.css.js.map +1 -0
  50. package/lib/{components/avatar/utils.test.d.ts → new-components/avatar/avatar.test.d.ts} +0 -0
  51. package/lib/new-components/avatar/index.d.ts +1 -0
  52. package/lib/{components → new-components}/avatar/utils.d.ts +0 -0
  53. package/lib/{components → new-components}/avatar/utils.js +0 -0
  54. package/lib/new-components/avatar/utils.js.map +1 -0
  55. package/lib/new-components/avatar/utils.test.d.ts +1 -0
  56. package/lib/new-components/base-button/base-button.d.ts +4 -2
  57. package/lib/new-components/base-button/base-button.js +1 -1
  58. package/lib/new-components/base-button/base-button.js.map +1 -1
  59. package/lib/new-components/box/box.d.ts +5 -2
  60. package/lib/new-components/box/box.js +1 -1
  61. package/lib/new-components/box/box.js.map +1 -1
  62. package/lib/new-components/box/box.module.css.js +1 -1
  63. package/lib/new-components/button/button.d.ts +2 -2
  64. package/lib/new-components/button/button.js.map +1 -1
  65. package/lib/new-components/button-link/button-link.d.ts +0 -2
  66. package/lib/new-components/button-link/button-link.js.map +1 -1
  67. package/lib/new-components/heading/heading.module.css.js +1 -1
  68. package/lib/new-components/inline/inline.js +1 -1
  69. package/lib/new-components/inline/inline.js.map +1 -1
  70. package/lib/new-components/modal/modal.d.ts +2 -1
  71. package/lib/new-components/modal/modal.js +1 -1
  72. package/lib/new-components/modal/modal.js.map +1 -1
  73. package/lib/new-components/notice/notice.js +1 -1
  74. package/lib/new-components/notice/notice.js.map +1 -1
  75. package/lib/new-components/notice/notice.test.d.ts +1 -0
  76. package/lib/new-components/tabs/tabs.module.css.js +1 -1
  77. package/lib/new-components/text/text.module.css.js +1 -1
  78. package/lib/new-components/text-area/text-area.d.ts +3 -1
  79. package/lib/new-components/text-area/text-area.js.map +1 -1
  80. package/lib/new-components/text-link/text-link.module.css.js +1 -1
  81. package/package.json +3 -3
  82. package/styles/alert.css +5 -2
  83. package/styles/alert.module.css.css +1 -1
  84. package/styles/avatar.css +5 -1
  85. package/styles/avatar.module.css.css +1 -0
  86. package/styles/base-button.css +1 -1
  87. package/styles/base-field.css +2 -2
  88. package/styles/box.css +1 -1
  89. package/styles/box.module.css.css +1 -1
  90. package/styles/checkbox-field.css +2 -2
  91. package/styles/columns.css +1 -1
  92. package/styles/divider.css +1 -1
  93. package/styles/heading.css +2 -2
  94. package/styles/heading.module.css.css +1 -1
  95. package/styles/hidden-visually.css +1 -1
  96. package/styles/hidden.css +1 -1
  97. package/styles/inline.css +1 -1
  98. package/styles/loading.css +1 -1
  99. package/styles/menu.css +1 -1
  100. package/styles/modal.css +1 -1
  101. package/styles/notice.css +1 -1
  102. package/styles/password-field.css +2 -2
  103. package/styles/progress-bar.css +1 -1
  104. package/styles/reactist.css +9 -9
  105. package/styles/select-field.css +2 -2
  106. package/styles/stack.css +1 -1
  107. package/styles/switch-field.css +2 -2
  108. package/styles/tabs.css +2 -2
  109. package/styles/tabs.module.css.css +1 -1
  110. package/styles/text-area.css +2 -2
  111. package/styles/text-field.css +2 -2
  112. package/styles/text-link.css +2 -2
  113. package/styles/text-link.module.css.css +1 -1
  114. package/styles/text.css +2 -2
  115. package/styles/text.module.css.css +1 -1
  116. package/es/components/avatar/avatar.js.map +0 -1
  117. package/es/components/avatar/index.js +0 -6
  118. package/es/components/avatar/index.js.map +0 -1
  119. package/es/components/avatar/utils.js.map +0 -1
  120. package/lib/components/avatar/avatar.js +0 -2
  121. package/lib/components/avatar/avatar.js.map +0 -1
  122. package/lib/components/avatar/index.d.ts +0 -2
  123. package/lib/components/avatar/index.js +0 -2
  124. package/lib/components/avatar/index.js.map +0 -1
  125. package/lib/components/avatar/utils.js.map +0 -1
@@ -34,7 +34,8 @@ function Menu(_ref) {
34
34
  props = _objectWithoutPropertiesLoose(_ref, _excluded);
35
35
 
36
36
  var state = useMenuState(_objectSpread2({
37
- loop: true
37
+ loop: true,
38
+ unstable_offset: [8, 8]
38
39
  }, props));
39
40
  var handleItemSelect = useCallback(function handleItemSelect(value) {
40
41
  if (onItemSelect) onItemSelect(value);
@@ -1 +1 @@
1
- {"version":3,"file":"menu.js","sources":["../../../src/components/menu/menu.tsx"],"sourcesContent":["import * as React from 'react'\nimport classNames from 'classnames'\nimport { polymorphicComponent } from '../../utils/polymorphism'\nimport { usePrevious } from '../../hooks/use-previous'\n\n//\n// Reactist menu is a thin wrapper around Reakit's menu components. This may or may not be\n// temporary. Our goal is to make it transparent for the users of Reactist of this implementation\n// detail. We may change in the future the external lib we use, or even implement it all internally,\n// as long as we keep the same outer interface as intact as possible.\n//\n// Around the heavy lifting of the external lib we just add some features to better integrate the\n// menu to Reactist's more opinionated approach (e.g. using our button with its custom variants and\n// other features, easily show keyboard shortcuts in menu items, etc.)\n//\nimport * as Reakit from 'reakit/Menu'\nimport { PopoverBackdrop } from 'reakit/Popover'\n\nimport './menu.less'\n\ntype NativeProps<E extends HTMLElement> = React.DetailedHTMLProps<React.HTMLAttributes<E>, E>\n\ntype MenuContextState = Reakit.MenuStateReturn & {\n handleItemSelect: (value: string | null | undefined) => void\n}\n\nconst MenuContext = React.createContext<MenuContextState>(\n // Reakit gives us no means to obtain a valid initial/default value of type MenuStateReturn\n // (it is normally obtained by calling useMenuState but we can't call hooks outside components).\n // This is however of little consequence since this value is only used if some of the components\n // are used outside Menu, something that should not happen and we do not support.\n // @ts-expect-error\n {},\n)\n\n//\n// Menu\n//\n\ntype MenuProps = Omit<Reakit.MenuInitialState, 'visible'> & {\n /**\n * The `Menu` must contain a `MenuList` that defines the menu options. It must also contain a\n * `MenuButton` that triggers the menu to be opened or closed.\n */\n children: React.ReactNode\n\n /**\n * An optional callback that will be called back whenever a menu item is selected. It receives\n * the `value` of the selected `MenuItem`.\n *\n * If you pass down this callback, it is recommended that you properly memoize it so it does not\n * change on every render.\n */\n onItemSelect?: (value: string | null | undefined) => void\n}\n\n/**\n * Wrapper component to control a menu. It does not render anything, only providing the state\n * management for the menu components inside it.\n */\nfunction Menu({ children, onItemSelect, ...props }: MenuProps) {\n const state = Reakit.useMenuState({ loop: true, ...props })\n\n const handleItemSelect = React.useCallback(\n function handleItemSelect(value: string | null | undefined) {\n if (onItemSelect) onItemSelect(value)\n },\n [onItemSelect],\n )\n\n const value: MenuContextState = React.useMemo(\n () => ({\n ...state,\n handleItemSelect,\n }),\n [state, handleItemSelect],\n )\n\n return <MenuContext.Provider value={value}>{children}</MenuContext.Provider>\n}\n\n//\n// MenuButton\n//\n\ntype MenuButtonProps = Omit<Reakit.MenuButtonProps, keyof Reakit.MenuStateReturn | 'className'>\n\n/**\n * A button to toggle a dropdown menu open or closed.\n */\nconst MenuButton = polymorphicComponent<'button', MenuButtonProps>(function MenuButton(\n { exceptionallySetClassName, ...props },\n ref,\n) {\n const { handleItemSelect, ...state } = React.useContext(MenuContext)\n return (\n <Reakit.MenuButton\n {...props}\n {...state}\n ref={ref}\n className={classNames('reactist_menubutton', exceptionallySetClassName)}\n />\n )\n})\n\n//\n// MenuList\n//\n\ntype MenuBackdropProps = Reakit.MenuStateReturn & {\n children: React.ReactNode\n}\n\nconst BACKDROP_STYLE: React.CSSProperties = {\n width: '100%',\n height: '100%',\n position: 'fixed',\n top: 0,\n left: 0,\n}\n\n/**\n * Internal component to provide a backdrop/overlay to all menus. This is needed because reakit's\n * menus do not show an overlay by default.\n */\nfunction MenuBackdrop({\n baseId,\n visible,\n animated,\n animating,\n stopAnimation,\n modal,\n children,\n}: MenuBackdropProps) {\n return (\n <PopoverBackdrop\n baseId={baseId}\n visible={visible}\n animated={animated}\n animating={animating}\n stopAnimation={stopAnimation}\n modal={modal}\n style={BACKDROP_STYLE}\n >\n {children}\n </PopoverBackdrop>\n )\n}\n\ntype MenuListProps = Omit<Reakit.MenuProps, keyof Reakit.MenuStateReturn | 'className'>\n\n/**\n * The dropdown menu itself, containing a list of menu items.\n */\nconst MenuList = polymorphicComponent<'div', MenuListProps>(function MenuList(\n { exceptionallySetClassName, ...props },\n ref,\n) {\n const { handleItemSelect, ...state } = React.useContext(MenuContext)\n const previousVisible = usePrevious(state.visible)\n\n React.useEffect(\n function focusTriggerOnClose() {\n if (state.visible === false && previousVisible === true) {\n state.unstable_referenceRef?.current?.focus()\n }\n },\n [state.visible, previousVisible, state.unstable_referenceRef],\n )\n\n return state.visible ? (\n <MenuBackdrop {...state}>\n <Reakit.Menu\n {...props}\n {...state}\n ref={ref}\n className={classNames('reactist_menulist', exceptionallySetClassName)}\n />\n </MenuBackdrop>\n ) : null\n})\n\n//\n// MenuItem\n//\n\ntype MenuItemProps = {\n /**\n * An optional value given to this menu item. It is passed on to the parent `Menu`'s\n * `onItemSelect` when you provide that instead of (or alongside) providing individual\n * `onSelect` callbacks to each menu item.\n */\n value?: string\n /**\n * The content inside the menu item.\n */\n children: React.ReactNode\n /**\n * When `true` the menu item is disabled and won't be selectable or be part of the keyboard\n * navigation across the menu options.\n *\n * @default true\n */\n disabled?: boolean\n /**\n * When `true` the menu will close when the menu item is selected, in addition to performing the\n * action that the menu item is set out to do.\n *\n * Set this to `false` to make sure that a given menu item does not auto-closes the menu when\n * selected. This should be the exception and not the norm, as the default is to auto-close.\n *\n * @default true\n */\n hideOnSelect?: boolean\n /**\n * The action to perform when the menu item is selected.\n *\n * If you return `false` from this function, the menu will not auto-close when this menu item\n * is selected. Though you should use `hideOnSelect` for this purpose, this allows you to\n * achieve the same effect conditionally and dynamically deciding at run time.\n */\n onSelect?: () => unknown\n /**\n * The event handler called when the menu item is clicked.\n *\n * This is similar to `onSelect`, but a bit different. You can certainly use it to trigger the\n * action that the menu item represents. But in general you should prefer `onSelect` for that.\n *\n * The main use for this handler is to get access to the click event. This can be used, for\n * example, to call `event.preventDefault()`, which will effectively prevent the rest of the\n * consequences of the click, including preventing `onSelect` from being called. In particular,\n * this is useful in menu items that are links, and you want the click to not trigger navigation\n * under some circumstances.\n */\n onClick?: (event: React.MouseEvent) => void\n}\n\n/**\n * A menu item inside a menu list. It can be selected by the user, triggering the `onSelect`\n * callback.\n */\nconst MenuItem = polymorphicComponent<'button', MenuItemProps>(function MenuItem(\n {\n value,\n children,\n onSelect,\n hideOnSelect = true,\n onClick,\n exceptionallySetClassName,\n ...props\n },\n ref,\n) {\n const { handleItemSelect, ...state } = React.useContext(MenuContext)\n const { hide } = state\n\n const handleClick = React.useCallback(\n function handleClick(event: React.MouseEvent<HTMLButtonElement>) {\n onClick?.(event)\n const onSelectResult: unknown =\n onSelect && !event.defaultPrevented ? onSelect() : undefined\n const shouldClose = onSelectResult !== false && hideOnSelect\n handleItemSelect(value)\n if (shouldClose) hide()\n },\n [onSelect, onClick, handleItemSelect, hideOnSelect, hide, value],\n )\n\n return (\n <Reakit.MenuItem\n {...props}\n {...state}\n ref={ref}\n onClick={handleClick}\n className={exceptionallySetClassName}\n >\n {children}\n </Reakit.MenuItem>\n )\n})\n\n//\n// SubMenu\n//\n\ntype SubMenuProps = Pick<MenuProps, 'children' | 'onItemSelect'>\n\n/**\n * This component can be rendered alongside other `MenuItem` inside a `MenuList` in order to have\n * a sub-menu.\n *\n * Its children are expected to have the structure of a first level menu (a `MenuButton` and a\n * `MenuList`).\n *\n * ```jsx\n * <MenuItem label=\"Edit profile\" />\n * <SubMenu>\n * <MenuButton>More options</MenuButton>\n * <MenuList>\n * <MenuItem label=\"Preferences\" />\n * <MenuItem label=\"Sign out\" />\n * </MenuList>\n * </SubMenu>\n * ```\n *\n * The `MenuButton` will become a menu item in the current menu items list, and it will lead to\n * opening a sub-menu with the menu items list below it.\n */\nconst SubMenu = React.forwardRef<HTMLButtonElement, SubMenuProps>(function SubMenu(\n { children, onItemSelect, ...props },\n ref,\n) {\n const { handleItemSelect: parentMenuItemSelect, ...state } = React.useContext(MenuContext)\n const { hide: parentMenuHide } = state\n\n const handleSubItemSelect = React.useCallback(\n function handleSubItemSelect(value) {\n if (onItemSelect) onItemSelect(value)\n parentMenuItemSelect(value)\n parentMenuHide()\n },\n [parentMenuHide, parentMenuItemSelect, onItemSelect],\n )\n\n const [button, list] = React.Children.toArray(children)\n\n return (\n <Reakit.MenuItem {...state} {...props} ref={ref}>\n {(buttonProps) => (\n <Menu onItemSelect={handleSubItemSelect}>\n {React.cloneElement(button as React.ReactElement, {\n ...buttonProps,\n className: classNames(buttonProps.className, 'reactist_submenu_button'),\n })}\n {list}\n </Menu>\n )}\n </Reakit.MenuItem>\n )\n})\n\n//\n// MenuGroup\n//\n\ntype MenuGroupProps = Omit<NativeProps<HTMLDivElement>, 'className'> & {\n /**\n * A label to be shown visually and also used to semantically label the group.\n */\n label: string\n}\n\n/**\n * A way to semantically group some menu items.\n *\n * This group does not add any visual separator. You can do that yourself adding `<hr />` elements\n * before and/or after the group if you so wish.\n */\nconst MenuGroup = polymorphicComponent<'div', MenuGroupProps>(function MenuGroud(\n { label, children, exceptionallySetClassName, ...props },\n ref,\n) {\n const { handleItemSelect, ...state } = React.useContext(MenuContext)\n return (\n <Reakit.MenuGroup ref={ref} {...props} {...state} className={exceptionallySetClassName}>\n {label ? (\n <div role=\"presentation\" className=\"reactist_menugroup__label\">\n {label}\n </div>\n ) : null}\n {children}\n </Reakit.MenuGroup>\n )\n})\n\nexport { Menu, MenuButton, MenuList, MenuItem, SubMenu, MenuGroup }\nexport type { MenuButtonProps, MenuListProps, MenuItemProps, SubMenuProps, MenuGroupProps }\n"],"names":["MenuContext","React","Menu","children","onItemSelect","props","state","Reakit","loop","handleItemSelect","value","Provider","MenuButton","polymorphicComponent","ref","exceptionallySetClassName","className","classNames","BACKDROP_STYLE","width","height","position","top","left","MenuBackdrop","baseId","visible","animated","animating","stopAnimation","modal","PopoverBackdrop","style","MenuList","previousVisible","usePrevious","focusTriggerOnClose","unstable_referenceRef","current","focus","MenuItem","onSelect","hideOnSelect","onClick","hide","handleClick","event","onSelectResult","defaultPrevented","undefined","shouldClose","SubMenu","parentMenuItemSelect","parentMenuHide","handleSubItemSelect","toArray","button","list","buttonProps","MenuGroup","MenuGroud","label","role"],"mappings":";;;;;;;;;;;;;;;;;;;AA0BA,IAAMA,WAAW,gBAAGC,aAAA;AAEhB;AACA;AACA;AACA;AACA,EANgB,CAApB;AA8BA;;;;;AAIA,SAASC,IAAT;MAAgBC,gBAAAA;MAAUC,oBAAAA;MAAiBC;;AACvC,MAAMC,KAAK,GAAGC,YAAA;AAAsBC,IAAAA,IAAI,EAAE;AAA5B,KAAqCH,KAArC,EAAd;AAEA,MAAMI,gBAAgB,GAAGR,WAAA,CACrB,SAASQ,gBAAT,CAA0BC,KAA1B;AACI,QAAIN,YAAJ,EAAkBA,YAAY,CAACM,KAAD,CAAZ;AACrB,GAHoB,EAIrB,CAACN,YAAD,CAJqB,CAAzB;AAOA,MAAMM,KAAK,GAAqBT,OAAA,CAC5B;AAAA,6CACOK,KADP;AAEIG,MAAAA,gBAAgB,EAAhBA;AAFJ;AAAA,GAD4B,EAK5B,CAACH,KAAD,EAAQG,gBAAR,CAL4B,CAAhC;AAQA,sBAAOR,aAAA,CAACD,WAAW,CAACW,QAAb;AAAsBD,IAAAA,KAAK,EAAEA;GAA7B,EAAqCP,QAArC,CAAP;AACH;AAQD;;;;;IAGMS,UAAU,gBAAGC,oBAAoB,CAA4B,SAASD,UAAT,QAE/DE,GAF+D;MAC7DC,kCAAAA;MAA8BV;;AAGhC,0BAAuCJ,UAAA,CAAiBD,WAAjB,CAAvC;AAAA,MAA6BM,KAA7B;;AACA,sBACIL,aAAA,CAACM,YAAD,oBACQF,OACAC;AACJQ,IAAAA,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iBD,WAAjB,CAAvC;AAAA,MAA6BM,KAA7B;;AACA,sBACIL,aAAA,CAACM,WAAD;AAAkBO,IAAAA,GAAG,EAAEA;KAAST,OAAWC;AAAOU,IAAAA,SAAS,EAAED;IAA7D,EACK8C,KAAK,gBACF5D,aAAA,MAAA;AAAK6D,IAAAA,IAAI,EAAC;AAAe9C,IAAAA,SAAS,EAAC;GAAnC,EACK6C,KADL,CADE,GAIF,IALR,EAMK1D,QANL,CADJ;AAUH,CAfqC;;;;"}
1
+ {"version":3,"file":"menu.js","sources":["../../../src/components/menu/menu.tsx"],"sourcesContent":["import * as React from 'react'\nimport classNames from 'classnames'\nimport { polymorphicComponent } from '../../utils/polymorphism'\nimport { usePrevious } from '../../hooks/use-previous'\n\n//\n// Reactist menu is a thin wrapper around Reakit's menu components. This may or may not be\n// temporary. Our goal is to make it transparent for the users of Reactist of this implementation\n// detail. We may change in the future the external lib we use, or even implement it all internally,\n// as long as we keep the same outer interface as intact as possible.\n//\n// Around the heavy lifting of the external lib we just add some features to better integrate the\n// menu to Reactist's more opinionated approach (e.g. using our button with its custom variants and\n// other features, easily show keyboard shortcuts in menu items, etc.)\n//\nimport * as Reakit from 'reakit/Menu'\nimport { PopoverBackdrop } from 'reakit/Popover'\n\nimport './menu.less'\n\ntype NativeProps<E extends HTMLElement> = React.DetailedHTMLProps<React.HTMLAttributes<E>, E>\n\ntype MenuContextState = Reakit.MenuStateReturn & {\n handleItemSelect: (value: string | null | undefined) => void\n}\n\nconst MenuContext = React.createContext<MenuContextState>(\n // Reakit gives us no means to obtain a valid initial/default value of type MenuStateReturn\n // (it is normally obtained by calling useMenuState but we can't call hooks outside components).\n // This is however of little consequence since this value is only used if some of the components\n // are used outside Menu, something that should not happen and we do not support.\n // @ts-expect-error\n {},\n)\n\n//\n// Menu\n//\n\ntype MenuProps = Omit<Reakit.MenuInitialState, 'visible'> & {\n /**\n * The `Menu` must contain a `MenuList` that defines the menu options. It must also contain a\n * `MenuButton` that triggers the menu to be opened or closed.\n */\n children: React.ReactNode\n\n /**\n * An optional callback that will be called back whenever a menu item is selected. It receives\n * the `value` of the selected `MenuItem`.\n *\n * If you pass down this callback, it is recommended that you properly memoize it so it does not\n * change on every render.\n */\n onItemSelect?: (value: string | null | undefined) => void\n}\n\n/**\n * Wrapper component to control a menu. It does not render anything, only providing the state\n * management for the menu components inside it.\n */\nfunction Menu({ children, onItemSelect, ...props }: MenuProps) {\n const state = Reakit.useMenuState({ loop: true, unstable_offset: [8, 8], ...props })\n\n const handleItemSelect = React.useCallback(\n function handleItemSelect(value: string | null | undefined) {\n if (onItemSelect) onItemSelect(value)\n },\n [onItemSelect],\n )\n\n const value: MenuContextState = React.useMemo(\n () => ({\n ...state,\n handleItemSelect,\n }),\n [state, handleItemSelect],\n )\n\n return <MenuContext.Provider value={value}>{children}</MenuContext.Provider>\n}\n\n//\n// MenuButton\n//\n\ntype MenuButtonProps = Omit<Reakit.MenuButtonProps, keyof Reakit.MenuStateReturn | 'className'>\n\n/**\n * A button to toggle a dropdown menu open or closed.\n */\nconst MenuButton = polymorphicComponent<'button', MenuButtonProps>(function MenuButton(\n { exceptionallySetClassName, ...props },\n ref,\n) {\n const { handleItemSelect, ...state } = React.useContext(MenuContext)\n return (\n <Reakit.MenuButton\n {...props}\n {...state}\n ref={ref}\n className={classNames('reactist_menubutton', exceptionallySetClassName)}\n />\n )\n})\n\n//\n// MenuList\n//\n\ntype MenuBackdropProps = Reakit.MenuStateReturn & {\n children: React.ReactNode\n}\n\nconst BACKDROP_STYLE: React.CSSProperties = {\n width: '100%',\n height: '100%',\n position: 'fixed',\n top: 0,\n left: 0,\n}\n\n/**\n * Internal component to provide a backdrop/overlay to all menus. This is needed because reakit's\n * menus do not show an overlay by default.\n */\nfunction MenuBackdrop({\n baseId,\n visible,\n animated,\n animating,\n stopAnimation,\n modal,\n children,\n}: MenuBackdropProps) {\n return (\n <PopoverBackdrop\n baseId={baseId}\n visible={visible}\n animated={animated}\n animating={animating}\n stopAnimation={stopAnimation}\n modal={modal}\n style={BACKDROP_STYLE}\n >\n {children}\n </PopoverBackdrop>\n )\n}\n\ntype MenuListProps = Omit<Reakit.MenuProps, keyof Reakit.MenuStateReturn | 'className'>\n\n/**\n * The dropdown menu itself, containing a list of menu items.\n */\nconst MenuList = polymorphicComponent<'div', MenuListProps>(function MenuList(\n { exceptionallySetClassName, ...props },\n ref,\n) {\n const { handleItemSelect, ...state } = React.useContext(MenuContext)\n const previousVisible = usePrevious(state.visible)\n\n React.useEffect(\n function focusTriggerOnClose() {\n if (state.visible === false && previousVisible === true) {\n state.unstable_referenceRef?.current?.focus()\n }\n },\n [state.visible, previousVisible, state.unstable_referenceRef],\n )\n\n return state.visible ? (\n <MenuBackdrop {...state}>\n <Reakit.Menu\n {...props}\n {...state}\n ref={ref}\n className={classNames('reactist_menulist', exceptionallySetClassName)}\n />\n </MenuBackdrop>\n ) : null\n})\n\n//\n// MenuItem\n//\n\ntype MenuItemProps = {\n /**\n * An optional value given to this menu item. It is passed on to the parent `Menu`'s\n * `onItemSelect` when you provide that instead of (or alongside) providing individual\n * `onSelect` callbacks to each menu item.\n */\n value?: string\n /**\n * The content inside the menu item.\n */\n children: React.ReactNode\n /**\n * When `true` the menu item is disabled and won't be selectable or be part of the keyboard\n * navigation across the menu options.\n *\n * @default true\n */\n disabled?: boolean\n /**\n * When `true` the menu will close when the menu item is selected, in addition to performing the\n * action that the menu item is set out to do.\n *\n * Set this to `false` to make sure that a given menu item does not auto-closes the menu when\n * selected. This should be the exception and not the norm, as the default is to auto-close.\n *\n * @default true\n */\n hideOnSelect?: boolean\n /**\n * The action to perform when the menu item is selected.\n *\n * If you return `false` from this function, the menu will not auto-close when this menu item\n * is selected. Though you should use `hideOnSelect` for this purpose, this allows you to\n * achieve the same effect conditionally and dynamically deciding at run time.\n */\n onSelect?: () => unknown\n /**\n * The event handler called when the menu item is clicked.\n *\n * This is similar to `onSelect`, but a bit different. You can certainly use it to trigger the\n * action that the menu item represents. But in general you should prefer `onSelect` for that.\n *\n * The main use for this handler is to get access to the click event. This can be used, for\n * example, to call `event.preventDefault()`, which will effectively prevent the rest of the\n * consequences of the click, including preventing `onSelect` from being called. In particular,\n * this is useful in menu items that are links, and you want the click to not trigger navigation\n * under some circumstances.\n */\n onClick?: (event: React.MouseEvent) => void\n}\n\n/**\n * A menu item inside a menu list. It can be selected by the user, triggering the `onSelect`\n * callback.\n */\nconst MenuItem = polymorphicComponent<'button', MenuItemProps>(function MenuItem(\n {\n value,\n children,\n onSelect,\n hideOnSelect = true,\n onClick,\n exceptionallySetClassName,\n ...props\n },\n ref,\n) {\n const { handleItemSelect, ...state } = React.useContext(MenuContext)\n const { hide } = state\n\n const handleClick = React.useCallback(\n function handleClick(event: React.MouseEvent<HTMLButtonElement>) {\n onClick?.(event)\n const onSelectResult: unknown =\n onSelect && !event.defaultPrevented ? onSelect() : undefined\n const shouldClose = onSelectResult !== false && hideOnSelect\n handleItemSelect(value)\n if (shouldClose) hide()\n },\n [onSelect, onClick, handleItemSelect, hideOnSelect, hide, value],\n )\n\n return (\n <Reakit.MenuItem\n {...props}\n {...state}\n ref={ref}\n onClick={handleClick}\n className={exceptionallySetClassName}\n >\n {children}\n </Reakit.MenuItem>\n )\n})\n\n//\n// SubMenu\n//\n\ntype SubMenuProps = Pick<MenuProps, 'children' | 'onItemSelect'>\n\n/**\n * This component can be rendered alongside other `MenuItem` inside a `MenuList` in order to have\n * a sub-menu.\n *\n * Its children are expected to have the structure of a first level menu (a `MenuButton` and a\n * `MenuList`).\n *\n * ```jsx\n * <MenuItem label=\"Edit profile\" />\n * <SubMenu>\n * <MenuButton>More options</MenuButton>\n * <MenuList>\n * <MenuItem label=\"Preferences\" />\n * <MenuItem label=\"Sign out\" />\n * </MenuList>\n * </SubMenu>\n * ```\n *\n * The `MenuButton` will become a menu item in the current menu items list, and it will lead to\n * opening a sub-menu with the menu items list below it.\n */\nconst SubMenu = React.forwardRef<HTMLButtonElement, SubMenuProps>(function SubMenu(\n { children, onItemSelect, ...props },\n ref,\n) {\n const { handleItemSelect: parentMenuItemSelect, ...state } = React.useContext(MenuContext)\n const { hide: parentMenuHide } = state\n\n const handleSubItemSelect = React.useCallback(\n function handleSubItemSelect(value) {\n if (onItemSelect) onItemSelect(value)\n parentMenuItemSelect(value)\n parentMenuHide()\n },\n [parentMenuHide, parentMenuItemSelect, onItemSelect],\n )\n\n const [button, list] = React.Children.toArray(children)\n\n return (\n <Reakit.MenuItem {...state} {...props} ref={ref}>\n {(buttonProps) => (\n <Menu onItemSelect={handleSubItemSelect}>\n {React.cloneElement(button as React.ReactElement, {\n ...buttonProps,\n className: classNames(buttonProps.className, 'reactist_submenu_button'),\n })}\n {list}\n </Menu>\n )}\n </Reakit.MenuItem>\n )\n})\n\n//\n// MenuGroup\n//\n\ntype MenuGroupProps = Omit<NativeProps<HTMLDivElement>, 'className'> & {\n /**\n * A label to be shown visually and also used to semantically label the group.\n */\n label: string\n}\n\n/**\n * A way to semantically group some menu items.\n *\n * This group does not add any visual separator. You can do that yourself adding `<hr />` elements\n * before and/or after the group if you so wish.\n */\nconst MenuGroup = polymorphicComponent<'div', MenuGroupProps>(function MenuGroud(\n { label, children, exceptionallySetClassName, ...props },\n ref,\n) {\n const { handleItemSelect, ...state } = React.useContext(MenuContext)\n return (\n <Reakit.MenuGroup ref={ref} {...props} {...state} className={exceptionallySetClassName}>\n {label ? (\n <div role=\"presentation\" className=\"reactist_menugroup__label\">\n {label}\n </div>\n ) : null}\n {children}\n </Reakit.MenuGroup>\n )\n})\n\nexport { Menu, MenuButton, MenuList, MenuItem, SubMenu, MenuGroup }\nexport type { MenuButtonProps, MenuListProps, MenuItemProps, SubMenuProps, MenuGroupProps }\n"],"names":["MenuContext","React","Menu","children","onItemSelect","props","state","Reakit","loop","unstable_offset","handleItemSelect","value","Provider","MenuButton","polymorphicComponent","ref","exceptionallySetClassName","className","classNames","BACKDROP_STYLE","width","height","position","top","left","MenuBackdrop","baseId","visible","animated","animating","stopAnimation","modal","PopoverBackdrop","style","MenuList","previousVisible","usePrevious","focusTriggerOnClose","unstable_referenceRef","current","focus","MenuItem","onSelect","hideOnSelect","onClick","hide","handleClick","event","onSelectResult","defaultPrevented","undefined","shouldClose","SubMenu","parentMenuItemSelect","parentMenuHide","handleSubItemSelect","toArray","button","list","buttonProps","MenuGroup","MenuGroud","label","role"],"mappings":";;;;;;;;;;;;;;;;;;;AA0BA,IAAMA,WAAW,gBAAGC,aAAA;AAEhB;AACA;AACA;AACA;AACA,EANgB,CAApB;AA8BA;;;;;AAIA,SAASC,IAAT;MAAgBC,gBAAAA;MAAUC,oBAAAA;MAAiBC;;AACvC,MAAMC,KAAK,GAAGC,YAAA;AAAsBC,IAAAA,IAAI,EAAE,IAA5B;AAAkCC,IAAAA,eAAe,EAAE,CAAC,CAAD,EAAI,CAAJ;AAAnD,KAA8DJ,KAA9D,EAAd;AAEA,MAAMK,gBAAgB,GAAGT,WAAA,CACrB,SAASS,gBAAT,CAA0BC,KAA1B;AACI,QAAIP,YAAJ,EAAkBA,YAAY,CAACO,KAAD,CAAZ;AACrB,GAHoB,EAIrB,CAACP,YAAD,CAJqB,CAAzB;AAOA,MAAMO,KAAK,GAAqBV,OAAA,CAC5B;AAAA,6CACOK,KADP;AAEII,MAAAA,gBAAgB,EAAhBA;AAFJ;AAAA,GAD4B,EAK5B,CAACJ,KAAD,EAAQI,gBAAR,CAL4B,CAAhC;AAQA,sBAAOT,aAAA,CAACD,WAAW,CAACY,QAAb;AAAsBD,IAAAA,KAAK,EAAEA;GAA7B,EAAqCR,QAArC,CAAP;AACH;AAQD;;;;;IAGMU,UAAU,gBAAGC,oBAAoB,CAA4B,SAASD,UAAT,QAE/DE,GAF+D;MAC7DC,kCAAAA;MAA8BX;;AAGhC,0BAAuCJ,UAAA,CAAiBD,WAAjB,CAAvC;AAAA,MAA6BM,KAA7B;;AACA,sBACIL,aAAA,CAACM,YAAD,oBACQF,OACAC;AACJS,IAAAA,GAAG,EAAEA;AACLE,IAAAA,SAAS,E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KAA7B;;AACA,sBACIL,aAAA,CAACM,WAAD;AAAkBQ,IAAAA,GAAG,EAAEA;KAASV,OAAWC;AAAOW,IAAAA,SAAS,EAAED;IAA7D,EACK8C,KAAK,gBACF7D,aAAA,MAAA;AAAK8D,IAAAA,IAAI,EAAC;AAAe9C,IAAAA,SAAS,EAAC;GAAnC,EACK6C,KADL,CADE,GAIF,IALR,EAMK3D,QANL,CADJ;AAUH,CAfqC;;;;"}
package/es/index.js CHANGED
@@ -5,13 +5,13 @@ export { Inline } from './new-components/inline/inline.js';
5
5
  export { Stack } from './new-components/stack/stack.js';
6
6
  export { Hidden } from './new-components/hidden/hidden.js';
7
7
  export { HiddenVisually } from './new-components/hidden-visually/hidden-visually.js';
8
+ export { Tooltip } from './components/tooltip/tooltip.js';
9
+ export { Button } from './new-components/button/button.js';
8
10
  export { Alert } from './new-components/alert/alert.js';
9
11
  export { Loading } from './new-components/loading/loading.js';
10
12
  export { Notice } from './new-components/notice/notice.js';
11
13
  export { Heading } from './new-components/heading/heading.js';
12
14
  export { Text } from './new-components/text/text.js';
13
- export { Tooltip } from './components/tooltip/tooltip.js';
14
- export { Button } from './new-components/button/button.js';
15
15
  export { ButtonLink } from './new-components/button-link/button-link.js';
16
16
  export { TextLink } from './new-components/text-link/text-link.js';
17
17
  export { CheckboxField } from './new-components/checkbox-field/checkbox-field.js';
@@ -23,7 +23,7 @@ export { TextField } from './new-components/text-field/text-field.js';
23
23
  export { usePrevious } from './hooks/use-previous/use-previous.js';
24
24
  export { Tab, TabAwareSlot, TabList, TabPanel, Tabs } from './new-components/tabs/tabs.js';
25
25
  export { Modal, ModalActions, ModalBody, ModalCloseButton, ModalFooter, ModalHeader } from './new-components/modal/modal.js';
26
- export { default as Avatar } from './components/avatar/index.js';
26
+ export { Avatar } from './new-components/avatar/avatar.js';
27
27
  export { default as Checkbox } from './components/checkbox/index.js';
28
28
  export { default as DeprecatedButton } from './components/deprecated-button/index.js';
29
29
  export { default as Dropdown } from './components/dropdown/index.js';
@@ -2,6 +2,7 @@ import { createElement } from 'react';
2
2
  import { getClassNames } from '../responsive-props.js';
3
3
  import { Box } from '../box/box.js';
4
4
  import { Columns, Column } from '../columns/columns.js';
5
+ import { Button } from '../button/button.js';
5
6
  import { AlertIcon } from '../icons/alert-icon.js';
6
7
  import { CloseIcon } from '../icons/close-icon.js';
7
8
  import styles from './alert.module.css.js';
@@ -16,7 +17,7 @@ function Alert(_ref) {
16
17
  id: id,
17
18
  role: "alert",
18
19
  "aria-live": "polite",
19
- padding: "small",
20
+ borderRadius: "standard",
20
21
  className: [styles.container, getClassNames(styles, 'tone', tone)]
21
22
  }, /*#__PURE__*/createElement(Columns, {
22
23
  space: "small",
@@ -25,13 +26,22 @@ function Alert(_ref) {
25
26
  width: "content"
26
27
  }, /*#__PURE__*/createElement(AlertIcon, {
27
28
  tone: tone
28
- })), /*#__PURE__*/createElement(Column, null, children), onClose != null ? /*#__PURE__*/createElement(Column, {
29
+ })), /*#__PURE__*/createElement(Column, null, /*#__PURE__*/createElement(Box, {
30
+ paddingY: "xsmall",
31
+ paddingRight: onClose != null && closeLabel != null ? undefined : 'small'
32
+ }, children)), onClose != null && closeLabel != null ? /*#__PURE__*/createElement(Column, {
29
33
  width: "content"
30
- }, /*#__PURE__*/createElement("button", {
31
- type: "button",
34
+ }, /*#__PURE__*/createElement(Button, {
35
+ variant: "quaternary",
36
+ size: "small",
32
37
  onClick: onClose,
33
- "aria-label": closeLabel
34
- }, /*#__PURE__*/createElement(CloseIcon, null))) : null));
38
+ "aria-label": closeLabel,
39
+ icon: /*#__PURE__*/createElement(CloseIcon, null),
40
+ style: {
41
+ // @ts-expect-error not sure how to make TypeScript understand custom CSS properties
42
+ '--reactist-btn-hover-fill': 'transparent'
43
+ }
44
+ })) : null));
35
45
  }
36
46
 
37
47
  export { Alert };
@@ -1 +1 @@
1
- {"version":3,"file":"alert.js","sources":["../../../src/new-components/alert/alert.tsx"],"sourcesContent":["import * as React from 'react'\nimport { AlertTone } from '../common-types'\nimport { getClassNames } from '../responsive-props'\nimport { Box } from '../box'\nimport { Columns, Column } from '../columns'\n\nimport { AlertIcon } from '../icons/alert-icon'\nimport { CloseIcon } from '../icons/close-icon'\n\nimport styles from './alert.module.css'\n\ntype AllOrNone<T> = T | { [K in keyof T]?: never }\n\ntype AlertCloseProps = AllOrNone<{\n closeLabel: string\n onClose: () => void\n}>\n\ntype AlertProps = {\n id?: string\n children: React.ReactNode\n tone: AlertTone\n} & AlertCloseProps\n\nfunction Alert({ id, children, tone, closeLabel, onClose }: AlertProps) {\n return (\n <Box\n id={id}\n role=\"alert\"\n aria-live=\"polite\"\n padding=\"small\"\n className={[styles.container, getClassNames(styles, 'tone', tone)]}\n >\n <Columns space=\"small\" alignY=\"top\">\n <Column width=\"content\">\n <AlertIcon tone={tone} />\n </Column>\n <Column>{children}</Column>\n {onClose != null ? (\n <Column width=\"content\">\n <button type=\"button\" onClick={onClose} aria-label={closeLabel}>\n <CloseIcon />\n </button>\n </Column>\n ) : null}\n </Columns>\n </Box>\n )\n}\n\nexport { Alert }\nexport type { AlertProps }\n"],"names":["Alert","id","children","tone","closeLabel","onClose","React","Box","role","padding","className","styles","container","getClassNames","Columns","space","alignY","Column","width","AlertIcon","type","onClick","CloseIcon"],"mappings":";;;;;;;;AAwBA,SAASA,KAAT;MAAiBC,UAAAA;MAAIC,gBAAAA;MAAUC,YAAAA;MAAMC,kBAAAA;MAAYC,eAAAA;AAC7C,sBACIC,aAAA,CAACC,GAAD;AACIN,IAAAA,EAAE,EAAEA;AACJO,IAAAA,IAAI,EAAC;iBACK;AACVC,IAAAA,OAAO,EAAC;AACRC,IAAAA,SAAS,EAAE,CAACC,MAAM,CAACC,SAAR,EAAmBC,aAAa,CAACF,MAAD,EAAS,MAAT,EAAiBR,IAAjB,CAAhC;GALf,eAOIG,aAAA,CAACQ,OAAD;AAASC,IAAAA,KAAK,EAAC;AAAQC,IAAAA,MAAM,EAAC;GAA9B,eACIV,aAAA,CAACW,MAAD;AAAQC,IAAAA,KAAK,EAAC;GAAd,eACIZ,aAAA,CAACa,SAAD;AAAWhB,IAAAA,IAAI,EAAEA;GAAjB,CADJ,CADJ,eAIIG,aAAA,CAACW,MAAD,MAAA,EAASf,QAAT,CAJJ,EAKKG,OAAO,IAAI,IAAX,gBACGC,aAAA,CAACW,MAAD;AAAQC,IAAAA,KAAK,EAAC;GAAd,eACIZ,aAAA,SAAA;AAAQc,IAAAA,IAAI,EAAC;AAASC,IAAAA,OAAO,EAAEhB;kBAAqBD;GAApD,eACIE,aAAA,CAACgB,SAAD,MAAA,CADJ,CADJ,CADH,GAMG,IAXR,CAPJ,CADJ;AAuBH;;;;"}
1
+ {"version":3,"file":"alert.js","sources":["../../../src/new-components/alert/alert.tsx"],"sourcesContent":["import * as React from 'react'\nimport { AlertTone } from '../common-types'\nimport { getClassNames } from '../responsive-props'\nimport { Box } from '../box'\nimport { Button } from '../button'\nimport { Columns, Column } from '../columns'\n\nimport { AlertIcon } from '../icons/alert-icon'\nimport { CloseIcon } from '../icons/close-icon'\n\nimport styles from './alert.module.css'\n\ntype AllOrNone<T> = T | { [K in keyof T]?: never }\n\ntype AlertCloseProps = AllOrNone<{\n closeLabel: string\n onClose: () => void\n}>\n\ntype AlertProps = {\n id?: string\n children: React.ReactNode\n tone: AlertTone\n} & AlertCloseProps\n\nfunction Alert({ id, children, tone, closeLabel, onClose }: AlertProps) {\n return (\n <Box\n id={id}\n role=\"alert\"\n aria-live=\"polite\"\n borderRadius=\"standard\"\n className={[styles.container, getClassNames(styles, 'tone', tone)]}\n >\n <Columns space=\"small\" alignY=\"top\">\n <Column width=\"content\">\n <AlertIcon tone={tone} />\n </Column>\n <Column>\n <Box\n paddingY=\"xsmall\"\n paddingRight={onClose != null && closeLabel != null ? undefined : 'small'}\n >\n {children}\n </Box>\n </Column>\n {onClose != null && closeLabel != null ? (\n <Column width=\"content\">\n <Button\n variant=\"quaternary\"\n size=\"small\"\n onClick={onClose}\n aria-label={closeLabel}\n icon={<CloseIcon />}\n style={{\n // @ts-expect-error not sure how to make TypeScript understand custom CSS properties\n '--reactist-btn-hover-fill': 'transparent',\n }}\n />\n </Column>\n ) : null}\n </Columns>\n </Box>\n )\n}\n\nexport { Alert }\nexport type { AlertProps }\n"],"names":["Alert","id","children","tone","closeLabel","onClose","React","Box","role","borderRadius","className","styles","container","getClassNames","Columns","space","alignY","Column","width","AlertIcon","paddingY","paddingRight","undefined","Button","variant","size","onClick","icon","CloseIcon","style"],"mappings":";;;;;;;;;AAyBA,SAASA,KAAT;MAAiBC,UAAAA;MAAIC,gBAAAA;MAAUC,YAAAA;MAAMC,kBAAAA;MAAYC,eAAAA;AAC7C,sBACIC,aAAA,CAACC,GAAD;AACIN,IAAAA,EAAE,EAAEA;AACJO,IAAAA,IAAI,EAAC;iBACK;AACVC,IAAAA,YAAY,EAAC;AACbC,IAAAA,SAAS,EAAE,CAACC,MAAM,CAACC,SAAR,EAAmBC,aAAa,CAACF,MAAD,EAAS,MAAT,EAAiBR,IAAjB,CAAhC;GALf,eAOIG,aAAA,CAACQ,OAAD;AAASC,IAAAA,KAAK,EAAC;AAAQC,IAAAA,MAAM,EAAC;GAA9B,eACIV,aAAA,CAACW,MAAD;AAAQC,IAAAA,KAAK,EAAC;GAAd,eACIZ,aAAA,CAACa,SAAD;AAAWhB,IAAAA,IAAI,EAAEA;GAAjB,CADJ,CADJ,eAIIG,aAAA,CAACW,MAAD,MAAA,eACIX,aAAA,CAACC,GAAD;AACIa,IAAAA,QAAQ,EAAC;AACTC,IAAAA,YAAY,EAAEhB,OAAO,IAAI,IAAX,IAAmBD,UAAU,IAAI,IAAjC,GAAwCkB,SAAxC,GAAoD;GAFtE,EAIKpB,QAJL,CADJ,CAJJ,EAYKG,OAAO,IAAI,IAAX,IAAmBD,UAAU,IAAI,IAAjC,gBACGE,aAAA,CAACW,MAAD;AAAQC,IAAAA,KAAK,EAAC;GAAd,eACIZ,aAAA,CAACiB,MAAD;AACIC,IAAAA,OAAO,EAAC;AACRC,IAAAA,IAAI,EAAC;AACLC,IAAAA,OAAO,EAAErB;kBACGD;AACZuB,IAAAA,IAAI,eAAErB,aAAA,CAACsB,SAAD,MAAA;AACNC,IAAAA,KAAK,EAAE;AACH;AACA,mCAA6B;AAF1B;GANX,CADJ,CADH,GAcG,IA1BR,CAPJ,CADJ;AAsCH;;;;"}
@@ -1,4 +1,4 @@
1
- var modules_6205a58e = {"container":"ad19f859","tone-info":"_7fd19074","tone-positive":"b6504efb","tone-caution":"_1668c1a3","tone-critical":"_59663dff"};
1
+ var modules_6205a58e = {"container":"eb665121","tone-info":"d0373ff9","tone-positive":"bb18dcab","tone-caution":"_0af02331","tone-critical":"f76146f9"};
2
2
 
3
3
  export default modules_6205a58e;
4
4
  //# sourceMappingURL=alert.module.css.js.map
@@ -1,9 +1,12 @@
1
+ import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../_virtual/_rollupPluginBabelHelpers.js';
1
2
  import React__default from 'react';
2
- import classNames from 'classnames';
3
+ import { getClassNames } from '../responsive-props.js';
4
+ import { Box } from '../box/box.js';
3
5
  import { getInitials, emailToIndex } from './utils.js';
6
+ import styles from './avatar.module.css.js';
4
7
 
8
+ var _excluded = ["user", "avatarUrl", "size", "className", "colorList", "exceptionallySetClassName"];
5
9
  var AVATAR_COLORS = ['#fcc652', '#e9952c', '#e16b2d', '#d84b40', '#e8435a', '#e5198a', '#ad3889', '#86389c', '#a8a8a8', '#98be2f', '#5d9d50', '#5f9f85', '#5bbcb6', '#32a3bf', '#2bafeb', '#2d88c3', '#3863cc', '#5e5e5e'];
6
- var AVATAR_SIZES = ['xxs', 'xs', 's', 'm', 'l', 'xl', 'xxl', 'xxxl'];
7
10
 
8
11
  function Avatar(_ref) {
9
12
  var user = _ref.user,
@@ -12,20 +15,23 @@ function Avatar(_ref) {
12
15
  size = _ref$size === void 0 ? 'l' : _ref$size,
13
16
  className = _ref.className,
14
17
  _ref$colorList = _ref.colorList,
15
- colorList = _ref$colorList === void 0 ? AVATAR_COLORS : _ref$colorList;
18
+ colorList = _ref$colorList === void 0 ? AVATAR_COLORS : _ref$colorList,
19
+ exceptionallySetClassName = _ref.exceptionallySetClassName,
20
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
21
+
16
22
  var userInitials = getInitials(user.name) || getInitials(user.email);
17
- var avatarSize = size && AVATAR_SIZES.includes(size) ? size : 'l';
18
- var avatarClass = classNames("reactist_avatar reactist_avatar_size--" + avatarSize, className);
23
+ var avatarSize = size ? size : 'l';
19
24
  var style = avatarUrl ? {
20
25
  backgroundImage: "url(" + avatarUrl + ")",
21
26
  textIndent: '-9999px'
22
27
  } : {
23
28
  backgroundColor: colorList[emailToIndex(user.email, colorList.length)]
24
29
  };
25
- return /*#__PURE__*/React__default.createElement("div", {
26
- className: avatarClass,
30
+ var sizeClassName = getClassNames(styles, 'size', avatarSize);
31
+ return /*#__PURE__*/React__default.createElement(Box, Object.assign({
32
+ className: [className, styles.avatar, sizeClassName, exceptionallySetClassName],
27
33
  style: style
28
- }, userInitials);
34
+ }, props), userInitials);
29
35
  }
30
36
 
31
37
  Avatar.displayName = 'Avatar';
@@ -0,0 +1 @@
1
+ {"version":3,"file":"avatar.js","sources":["../../../src/new-components/avatar/avatar.tsx"],"sourcesContent":["import React from 'react'\n\nimport { getInitials, emailToIndex } from './utils'\n\nimport { getClassNames, ResponsiveProp } from '../responsive-props'\nimport styles from './avatar.module.css'\nimport { Box } from '../box'\n\nconst AVATAR_COLORS = [\n '#fcc652',\n '#e9952c',\n '#e16b2d',\n '#d84b40',\n '#e8435a',\n '#e5198a',\n '#ad3889',\n '#86389c',\n '#a8a8a8',\n '#98be2f',\n '#5d9d50',\n '#5f9f85',\n '#5bbcb6',\n '#32a3bf',\n '#2bafeb',\n '#2d88c3',\n '#3863cc',\n '#5e5e5e',\n]\n\ntype AvatarSize = 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl' | 'xxxl'\n\ntype Props = {\n /** @deprecated Please use `exceptionallySetClassName` */\n className?: string\n exceptionallySetClassName?: string\n /** @deprecated */\n colorList?: string[]\n size?: ResponsiveProp<AvatarSize>\n avatarUrl?: string\n user: { name?: string; email: string }\n}\n\nfunction Avatar({\n user,\n avatarUrl,\n size = 'l',\n className,\n colorList = AVATAR_COLORS,\n exceptionallySetClassName,\n ...props\n}: Props) {\n const userInitials = getInitials(user.name) || getInitials(user.email)\n const avatarSize = size ? size : 'l'\n\n const style = avatarUrl\n ? {\n backgroundImage: `url(${avatarUrl})`,\n textIndent: '-9999px', // hide the initials\n }\n : {\n backgroundColor: colorList[emailToIndex(user.email, colorList.length)],\n }\n\n const sizeClassName = getClassNames(styles, 'size', avatarSize)\n\n return (\n <Box\n className={[className, styles.avatar, sizeClassName, exceptionallySetClassName]}\n style={style}\n {...props}\n >\n {userInitials}\n </Box>\n )\n}\nAvatar.displayName = 'Avatar'\n\nexport { Avatar }\n"],"names":["AVATAR_COLORS","Avatar","user","avatarUrl","size","className","colorList","exceptionallySetClassName","props","userInitials","getInitials","name","email","avatarSize","style","backgroundImage","textIndent","backgroundColor","emailToIndex","length","sizeClassName","getClassNames","styles","React","Box","avatar","displayName"],"mappings":";;;;;;;;AAQA,IAAMA,aAAa,GAAG,CAClB,SADkB,EAElB,SAFkB,EAGlB,SAHkB,EAIlB,SAJkB,EAKlB,SALkB,EAMlB,SANkB,EAOlB,SAPkB,EAQlB,SARkB,EASlB,SATkB,EAUlB,SAVkB,EAWlB,SAXkB,EAYlB,SAZkB,EAalB,SAbkB,EAclB,SAdkB,EAelB,SAfkB,EAgBlB,SAhBkB,EAiBlB,SAjBkB,EAkBlB,SAlBkB,CAAtB;;AAkCA,SAASC,MAAT;MACIC,YAAAA;MACAC,iBAAAA;uBACAC;MAAAA,8BAAO;MACPC,iBAAAA;4BACAC;MAAAA,wCAAYN;MACZO,iCAAAA;MACGC;;AAEH,MAAMC,YAAY,GAAGC,WAAW,CAACR,IAAI,CAACS,IAAN,CAAX,IAA0BD,WAAW,CAACR,IAAI,CAACU,KAAN,CAA1D;AACA,MAAMC,UAAU,GAAGT,IAAI,GAAGA,IAAH,GAAU,GAAjC;AAEA,MAAMU,KAAK,GAAGX,SAAS,GACjB;AACIY,IAAAA,eAAe,WAASZ,SAAT,MADnB;AAEIa,IAAAA,UAAU,EAAE;AAFhB,GADiB,GAKjB;AACIC,IAAAA,eAAe,EAAEX,SAAS,CAACY,YAAY,CAAChB,IAAI,CAACU,KAAN,EAAaN,SAAS,CAACa,MAAvB,CAAb;AAD9B,GALN;AASA,MAAMC,aAAa,GAAGC,aAAa,CAACC,MAAD,EAAS,MAAT,EAAiBT,UAAjB,CAAnC;AAEA,sBACIU,4BAAA,CAACC,GAAD;AACInB,IAAAA,SAAS,EAAE,CAACA,SAAD,EAAYiB,MAAM,CAACG,MAAnB,EAA2BL,aAA3B,EAA0Cb,yBAA1C;AACXO,IAAAA,KAAK,EAAEA;KACHN,MAHR,EAKKC,YALL,CADJ;AASH;;AACDR,MAAM,CAACyB,WAAP,GAAqB,QAArB;;;;"}
@@ -0,0 +1,4 @@
1
+ var modules_08f3eeac = {"avatar":"_38a1be89","size-xxs":"d32e92ae","size-xs":"_0667d719","size-s":"cf529fcf","size-m":"_6e268eab","size-l":"d64c62cf","size-xl":"_44fb77de","size-xxl":"_01f85e0e","size-xxxl":"_41a5fe19","tablet-size-xxs":"_6ab1577d","tablet-size-xs":"b52a4963","tablet-size-s":"_714a8419","tablet-size-m":"_81cd4d51","tablet-size-l":"bf0a4edb","tablet-size-xl":"e4f0dabd","tablet-size-xxl":"_67ea065d","tablet-size-xxxl":"_2af7f76f","desktop-size-xxs":"_759081dc","desktop-size-xs":"_8290d1c1","desktop-size-s":"_48ea172d","desktop-size-m":"_758f6641","desktop-size-l":"f9ada088","desktop-size-xl":"d3bb7470","desktop-size-xxl":"_9a312ee3","desktop-size-xxxl":"a1d30c23"};
2
+
3
+ export default modules_08f3eeac;
4
+ //# sourceMappingURL=avatar.module.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"avatar.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sources":["../../../src/new-components/avatar/utils.ts"],"sourcesContent":["function getInitials(name?: string) {\n if (!name) {\n return ''\n }\n\n const seed = name.trim().split(' ')\n const firstInitial = seed[0]\n const lastInitial = seed[seed.length - 1]\n\n let initials = firstInitial[0]\n // Better readable this way.\n // eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with\n if (firstInitial[0] !== lastInitial[0]) {\n initials += lastInitial[0]\n }\n return initials.toUpperCase()\n}\n\nfunction emailToIndex(email: string, maxIndex: number) {\n const seed = email.split('@')[0]\n const hash = seed.charCodeAt(0) + seed.charCodeAt(seed.length - 1) || 0\n return hash % maxIndex\n}\n\nexport { getInitials, emailToIndex }\n"],"names":["getInitials","name","seed","trim","split","firstInitial","lastInitial","length","initials","toUpperCase","emailToIndex","email","maxIndex","hash","charCodeAt"],"mappings":"AAAA,SAASA,WAAT,CAAqBC,IAArB;AACI,MAAI,CAACA,IAAL,EAAW;AACP,WAAO,EAAP;AACH;;AAED,MAAMC,IAAI,GAAGD,IAAI,CAACE,IAAL,GAAYC,KAAZ,CAAkB,GAAlB,CAAb;AACA,MAAMC,YAAY,GAAGH,IAAI,CAAC,CAAD,CAAzB;AACA,MAAMI,WAAW,GAAGJ,IAAI,CAACA,IAAI,CAACK,MAAL,GAAc,CAAf,CAAxB;AAEA,MAAIC,QAAQ,GAAGH,YAAY,CAAC,CAAD,CAA3B;AAEA;;AACA,MAAIA,YAAY,CAAC,CAAD,CAAZ,KAAoBC,WAAW,CAAC,CAAD,CAAnC,EAAwC;AACpCE,IAAAA,QAAQ,IAAIF,WAAW,CAAC,CAAD,CAAvB;AACH;;AACD,SAAOE,QAAQ,CAACC,WAAT,EAAP;AACH;;AAED,SAASC,YAAT,CAAsBC,KAAtB,EAAqCC,QAArC;AACI,MAAMV,IAAI,GAAGS,KAAK,CAACP,KAAN,CAAY,GAAZ,EAAiB,CAAjB,CAAb;AACA,MAAMS,IAAI,GAAGX,IAAI,CAACY,UAAL,CAAgB,CAAhB,IAAqBZ,IAAI,CAACY,UAAL,CAAgBZ,IAAI,CAACK,MAAL,GAAc,CAA9B,CAArB,IAAyD,CAAtE;AACA,SAAOM,IAAI,GAAGD,QAAd;AACH;;;;"}
@@ -2,11 +2,11 @@ import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '.
2
2
  import { createElement, Fragment } from 'react';
3
3
  import { polymorphicComponent } from '../../utils/polymorphism.js';
4
4
  import { Box } from '../box/box.js';
5
- import { Spinner } from '../spinner/spinner.js';
6
5
  import { Tooltip } from '../../components/tooltip/tooltip.js';
6
+ import { Spinner } from '../spinner/spinner.js';
7
7
  import styles from './base-button.module.css.js';
8
8
 
9
- var _excluded = ["as", "variant", "tone", "size", "disabled", "loading", "tooltip", "onClick", "exceptionallySetClassName", "children", "startIcon", "endIcon", "icon"];
9
+ var _excluded = ["as", "variant", "tone", "size", "disabled", "loading", "tooltip", "tooltipGapSize", "onClick", "exceptionallySetClassName", "children", "startIcon", "endIcon", "icon"];
10
10
 
11
11
  function preventDefault(event) {
12
12
  event.preventDefault();
@@ -15,8 +15,6 @@ function preventDefault(event) {
15
15
  * The component that powers `Button` and `ButtonLink`, where the button styling logic and some
16
16
  * common functionality resides. This component is internal to Reactist.
17
17
  *
18
- * 🎨 [Figma](https://www.figma.com/file/LYlWNzvhMDh907l07mPPQk/Product-Web?node-id=4693%3A175143)
19
- *
20
18
  * @see Button
21
19
  * @see ButtonLink
22
20
  */
@@ -35,6 +33,7 @@ var BaseButton = /*#__PURE__*/polymorphicComponent(function BaseButton(_ref, ref
35
33
  _ref$loading = _ref.loading,
36
34
  loading = _ref$loading === void 0 ? false : _ref$loading,
37
35
  tooltip = _ref.tooltip,
36
+ tooltipGapSize = _ref.tooltipGapSize,
38
37
  onClick = _ref.onClick,
39
38
  exceptionallySetClassName = _ref.exceptionallySetClassName,
40
39
  children = _ref.children,
@@ -64,7 +63,8 @@ var BaseButton = /*#__PURE__*/polymorphicComponent(function BaseButton(_ref, ref
64
63
 
65
64
  var tooltipContent = icon ? tooltip !== null && tooltip !== void 0 ? tooltip : props['aria-label'] : tooltip;
66
65
  return tooltipContent ? /*#__PURE__*/createElement(Tooltip, {
67
- content: tooltipContent
66
+ content: tooltipContent,
67
+ gapSize: tooltipGapSize
68
68
  }, buttonElement) : buttonElement;
69
69
  });
70
70
 
@@ -1 +1 @@
1
- {"version":3,"file":"base-button.js","sources":["../../../src/new-components/base-button/base-button.tsx"],"sourcesContent":["import * as React from 'react'\nimport { Tooltip, TooltipProps } from '../../components/tooltip'\nimport { polymorphicComponent } from '../../utils/polymorphism'\nimport { Box } from '../box'\nimport { Spinner } from '../spinner'\nimport styles from './base-button.module.css'\n\nfunction preventDefault(event: React.SyntheticEvent) {\n event.preventDefault()\n}\n\ntype ButtonVariant = 'primary' | 'secondary' | 'tertiary' | 'quaternary'\ntype ButtonTone = 'normal' | 'destructive'\ntype ButtonSize = 'small' | 'normal' | 'large'\ntype IconElement = React.ReactChild\n\ntype CommonProps = {\n /**\n * The button's variant.\n */\n variant: ButtonVariant\n /**\n * The button's tone.\n * @default 'normal'\n */\n tone?: ButtonTone\n /**\n * The button's size.\n * @default 'normal'\n */\n size?: ButtonSize\n /**\n * Whether the button is disabled or not.\n * @default false\n */\n disabled?: boolean\n /**\n * Whether the button is busy/loading.\n *\n * A button in this state is functionally and semantically disabled. Visually is does not look\n * dimmed (as disabled buttons normally do), but it shows a loading spinner instead.\n *\n * @default false\n */\n loading?: boolean\n /**\n * A tooltip linked to the button element.\n */\n tooltip?: TooltipProps['content']\n}\n\ntype IconButtonProps = {\n icon: IconElement\n 'aria-label': string\n children?: never\n startIcon?: never\n endIcon?: never\n}\n\ntype LabelledButtonProps = {\n children: NonNullable<React.ReactNode>\n startIcon?: IconElement\n endIcon?: IconElement\n icon?: never\n}\n\nexport type BaseButtonProps = CommonProps & (IconButtonProps | LabelledButtonProps)\n\n/**\n * The component that powers `Button` and `ButtonLink`, where the button styling logic and some\n * common functionality resides. This component is internal to Reactist.\n *\n * 🎨 [Figma](https://www.figma.com/file/LYlWNzvhMDh907l07mPPQk/Product-Web?node-id=4693%3A175143)\n *\n * @see Button\n * @see ButtonLink\n */\nexport const BaseButton = polymorphicComponent<'div', BaseButtonProps>(function BaseButton(\n {\n as = 'div',\n variant,\n tone = 'normal',\n size = 'normal',\n disabled = false,\n loading = false,\n tooltip,\n onClick,\n exceptionallySetClassName,\n children,\n startIcon,\n endIcon,\n icon,\n ...props\n },\n ref,\n) {\n const isDisabled = loading || disabled\n const buttonElement = (\n <Box\n {...props}\n as={as}\n ref={ref}\n aria-disabled={isDisabled}\n onClick={isDisabled ? preventDefault : onClick}\n className={[\n exceptionallySetClassName,\n styles.baseButton,\n styles[`variant-${variant}`],\n styles[`tone-${tone}`],\n styles[`size-${size}`],\n icon ? styles.iconButton : null,\n disabled ? styles.disabled : null,\n ]}\n >\n {icon ? (\n (loading && <Spinner />) || icon\n ) : (\n <>\n {startIcon ? (\n <Box display=\"flex\" className={styles.startIcon} aria-hidden>\n {loading && !endIcon ? <Spinner /> : startIcon}\n </Box>\n ) : null}\n {children ? <span className={styles.label}>{children}</span> : null}\n {endIcon || (loading && !startIcon) ? (\n <Box display=\"flex\" className={styles.endIcon} aria-hidden>\n {loading ? <Spinner /> : endIcon}\n </Box>\n ) : null}\n </>\n )}\n </Box>\n )\n\n // If it's an icon-only button, make sure it uses the aria-label as tooltip if no tooltip was provided\n const tooltipContent = icon ? tooltip ?? props['aria-label'] : tooltip\n return tooltipContent ? (\n <Tooltip content={tooltipContent}>{buttonElement}</Tooltip>\n ) : (\n buttonElement\n )\n})\n"],"names":["preventDefault","event","BaseButton","polymorphicComponent","ref","as","variant","tone","size","disabled","loading","tooltip","onClick","exceptionallySetClassName","children","startIcon","endIcon","icon","props","isDisabled","buttonElement","React","Box","className","styles","baseButton","iconButton","Spinner","display","label","t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,EAMKD,QAAQ,gBAAGO,aAAA,OAAA;AAAME,IAAAA,SAAS,EAAEC,MAAM,CAACK;GAAxB,EAAgCf,QAAhC,CAAH,GAAsD,IANnE,EAOKE,OAAO,IAAKN,OAAO,IAAI,CAACK,SAAxB,gBACGM,aAAA,CAACC,GAAD;AAAKM,IAAAA,OAAO,EAAC;AAAOL,IAAAA,SAAS,EAAEC,MAAM,CAACR;;GAAtC,EACKN,OAAO,gBAAGW,aAAA,CAACM,OAAD,MAAA,CAAH,GAAiBX,OAD7B,CADH,GAIG,IAXR,CAnBR,CADJ;;AAsCA,MAAMc,cAAc,GAAGb,IAAI,GAAGN,OAAH,aAAGA,OAAH,cAAGA,OAAH,GAAcO,KAAK,CAAC,YAAD,CAAnB,GAAoCP,OAA/D;AACA,SAAOmB,cAAc,gBACjBT,aAAA,CAACU,OAAD;AAASC,IAAAA,OAAO,EAAEF;GAAlB,EAAmCV,aAAnC,CADiB,GAGjBA,aAHJ;AAKH,CAhE6C;;;;"}
1
+ {"version":3,"file":"base-button.js","sources":["../../../src/new-components/base-button/base-button.tsx"],"sourcesContent":["import * as React from 'react'\nimport { Tooltip, TooltipProps } from '../../components/tooltip'\nimport { polymorphicComponent } from '../../utils/polymorphism'\nimport { Box } from '../box'\nimport { Spinner } from '../spinner'\nimport styles from './base-button.module.css'\n\nfunction preventDefault(event: React.SyntheticEvent) {\n event.preventDefault()\n}\n\ntype ButtonVariant = 'primary' | 'secondary' | 'tertiary' | 'quaternary'\ntype ButtonTone = 'normal' | 'destructive'\ntype ButtonSize = 'small' | 'normal' | 'large'\ntype IconElement = React.ReactChild\n\ntype CommonProps = {\n /**\n * The button's variant.\n */\n variant: ButtonVariant\n /**\n * The button's tone.\n * @default 'normal'\n */\n tone?: ButtonTone\n /**\n * The button's size.\n * @default 'normal'\n */\n size?: ButtonSize\n /**\n * Whether the button is disabled or not.\n * @default false\n */\n disabled?: boolean\n /**\n * Whether the button is busy/loading.\n *\n * A button in this state is functionally and semantically disabled. Visually is does not look\n * dimmed (as disabled buttons normally do), but it shows a loading spinner instead.\n *\n * @default false\n */\n loading?: boolean\n /**\n * A tooltip linked to the button element.\n */\n tooltip?: TooltipProps['content']\n /**\n * The distance between the button element and the linked tooltip.\n */\n tooltipGapSize?: TooltipProps['gapSize']\n}\n\ntype IconButtonProps = {\n icon: IconElement\n 'aria-label': string\n children?: never\n startIcon?: never\n endIcon?: never\n}\n\ntype LabelledButtonProps = {\n children: NonNullable<React.ReactNode>\n startIcon?: IconElement\n endIcon?: IconElement\n icon?: never\n}\n\nexport type BaseButtonProps = CommonProps & (IconButtonProps | LabelledButtonProps)\n\n/**\n * The component that powers `Button` and `ButtonLink`, where the button styling logic and some\n * common functionality resides. This component is internal to Reactist.\n *\n * @see Button\n * @see ButtonLink\n */\nexport const BaseButton = polymorphicComponent<'div', BaseButtonProps>(function BaseButton(\n {\n as = 'div',\n variant,\n tone = 'normal',\n size = 'normal',\n disabled = false,\n loading = false,\n tooltip,\n tooltipGapSize,\n onClick,\n exceptionallySetClassName,\n children,\n startIcon,\n endIcon,\n icon,\n ...props\n },\n ref,\n) {\n const isDisabled = loading || disabled\n const buttonElement = (\n <Box\n {...props}\n as={as}\n ref={ref}\n aria-disabled={isDisabled}\n onClick={isDisabled ? preventDefault : onClick}\n className={[\n exceptionallySetClassName,\n styles.baseButton,\n styles[`variant-${variant}`],\n styles[`tone-${tone}`],\n styles[`size-${size}`],\n icon ? styles.iconButton : null,\n disabled ? styles.disabled : null,\n ]}\n >\n {icon ? (\n (loading && <Spinner />) || icon\n ) : (\n <>\n {startIcon ? (\n <Box display=\"flex\" className={styles.startIcon} aria-hidden>\n {loading && !endIcon ? <Spinner /> : startIcon}\n </Box>\n ) : null}\n {children ? <span className={styles.label}>{children}</span> : null}\n {endIcon || (loading && !startIcon) ? (\n <Box display=\"flex\" className={styles.endIcon} aria-hidden>\n {loading ? <Spinner /> : endIcon}\n </Box>\n ) : null}\n </>\n )}\n </Box>\n )\n\n // If it's an icon-only button, make sure it uses the aria-label as tooltip if no tooltip was provided\n const tooltipContent = icon ? tooltip ?? props['aria-label'] : tooltip\n return tooltipContent ? (\n <Tooltip content={tooltipContent} gapSize={tooltipGapSize}>\n {buttonElement}\n </Tooltip>\n ) : (\n buttonElement\n )\n})\n"],"names":["preventDefault","event","BaseButton","polymorphicComponent","ref","as","variant","tone","size","disabled","loading","tooltip","tooltipGapSize","onClick","exceptionallySetClassName","children","startIcon","endIcon","icon","props","isDisabled","buttonElement","React","Box","className","styles","baseButton","iconButton","Spinner","display","label","tooltipContent","Tooltip","content","gapSize"],"mappings":";;;;;;;;;;AAOA,SAASA,cAAT,CAAwBC,KAAxB;AACIA,EAAAA,KAAK,CAACD,cAAN;AACH;AA+DD;;;;;;;;;IAOaE,UAAU,gBAAGC,oBAAoB,CAAyB,SAASD,UAAT,OAkBnEE,GAlBmE;qBAE/DC;MAAAA,0BAAK;MACLC,eAAAA;uBACAC;MAAAA,8BAAO;uBACPC;MAAAA,8BAAO;2BACPC;MAAAA,sCAAW;0BACXC;MAAAA,oCAAU;MACVC,eAAAA;MACAC,sBAAAA;MACAC,eAAAA;MACAC,iCAAAA;MACAC,gBAAAA;MACAC,iBAAAA;MACAC,eAAAA;MACAC,YAAAA;MACGC;;AAIP,MAAMC,UAAU,GAAGV,OAAO,IAAID,QAA9B;AACA,MAAMY,aAAa,gBACfC,aAAA,CAACC,GAAD,oBACQJ;AACJd,IAAAA,EAAE,EAAEA;AACJD,IAAAA,GAAG,EAAEA;qBACUgB;AACfP,IAAAA,OAAO,EAAEO,UAAU,GAAGpB,cAAH,GAAoBa;AACvCW,IAAAA,SAAS,EAAE,CACPV,yBADO,EAEPW,MAAM,CAACC,UAFA,EAGPD,MAAM,cAAYnB,OAAZ,CAHC,EAIPmB,MAAM,WAASlB,IAAT,CAJC,EAKPkB,MAAM,WAASjB,IAAT,CALC,EAMPU,IAAI,GAAGO,MAAM,CAACE,UAAV,GAAuB,IANpB,EAOPlB,QAAQ,GAAGgB,MAAM,CAAChB,QAAV,GAAqB,IAPtB;IANf,EAgBKS,IAAI,GACAR,OAAO,iBAAIY,aAAA,CAACM,OAAD,MAAA,CAAZ,IAA4BV,IAD3B,gBAGDI,aAAA,SAAA,MAAA,EACKN,SAAS,gBACNM,aAAA,CAACC,GAAD;AAAKM,IAAAA,OAAO,EAAC;AAAOL,IAAAA,SAAS,EAAEC,MAAM,CAACT;;GAAtC,EACKN,OAAO,IAAI,CAACO,OAAZ,gBAAsBK,aAAA,CAACM,OAAD,MAAA,CAAtB,GAAoCZ,SADzC,CADM,GAIN,IALR,EAMKD,QAAQ,gBAAGO,aAAA,OAAA;AAAME,IAAAA,SAAS,EAAEC,MAAM,CAACK;GAAxB,EAAgCf,QAAhC,CAAH,GAAsD,IANnE,EAOKE,OAAO,IAAKP,OAAO,IAAI,CAACM,SAAxB,gBACGM,aAAA,CAACC,GAAD;AAAKM,IAAAA,OAAO,EAAC;AAAOL,IAAAA,SAAS,EAAEC,MAAM,CAACR;;GAAtC,EACKP,OAAO,gBAAGY,aAAA,CAACM,OAAD,MAAA,CAAH,GAAiBX,OAD7B,CADH,GAIG,IAXR,CAnBR,CADJ;;AAsCA,MAAMc,cAAc,GAAGb,IAAI,GAAGP,OAAH,aAAGA,OAAH,cAAGA,OAAH,GAAcQ,KAAK,CAAC,YAAD,CAAnB,GAAoCR,OAA/D;AACA,SAAOoB,cAAc,gBACjBT,aAAA,CAACU,OAAD;AAASC,IAAAA,OAAO,EAAEF;AAAgBG,IAAAA,OAAO,EAAEtB;GAA3C,EACKS,aADL,CADiB,GAKjBA,aALJ;AAOH,CAnE6C;;;;"}
@@ -8,7 +8,7 @@ import paddingStyles from './padding.module.css.js';
8
8
  import marginStyles from './margin.module.css.js';
9
9
  import widthStyles from './width.module.css.js';
10
10
 
11
- var _excluded = ["as", "position", "display", "flexDirection", "flexWrap", "flexGrow", "flexShrink", "alignItems", "justifyContent", "overflow", "width", "height", "background", "border", "borderRadius", "minWidth", "maxWidth", "textAlign", "padding", "paddingY", "paddingX", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "margin", "marginY", "marginX", "marginTop", "marginRight", "marginBottom", "marginLeft", "className", "children"];
11
+ var _excluded = ["as", "position", "display", "flexDirection", "flexWrap", "flexGrow", "flexShrink", "alignItems", "justifyContent", "alignSelf", "overflow", "width", "height", "background", "border", "borderRadius", "minWidth", "maxWidth", "textAlign", "padding", "paddingY", "paddingX", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "margin", "marginY", "marginX", "marginTop", "marginRight", "marginBottom", "marginLeft", "className", "children"];
12
12
  var Box = /*#__PURE__*/polymorphicComponent(function Box(_ref, ref) {
13
13
  var _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9;
14
14
 
@@ -24,6 +24,7 @@ var Box = /*#__PURE__*/polymorphicComponent(function Box(_ref, ref) {
24
24
  flexShrink = _ref.flexShrink,
25
25
  alignItems = _ref.alignItems,
26
26
  justifyContent = _ref.justifyContent,
27
+ alignSelf = _ref.alignSelf,
27
28
  overflow = _ref.overflow,
28
29
  width = _ref.width,
29
30
  height = _ref.height,
@@ -32,8 +33,7 @@ var Box = /*#__PURE__*/polymorphicComponent(function Box(_ref, ref) {
32
33
  borderRadius = _ref.borderRadius,
33
34
  minWidth = _ref.minWidth,
34
35
  maxWidth = _ref.maxWidth,
35
- _ref$textAlign = _ref.textAlign,
36
- textAlign = _ref$textAlign === void 0 ? 'start' : _ref$textAlign,
36
+ textAlign = _ref.textAlign,
37
37
  padding = _ref.padding,
38
38
  paddingY = _ref.paddingY,
39
39
  paddingX = _ref.paddingX,
@@ -62,10 +62,10 @@ var Box = /*#__PURE__*/polymorphicComponent(function Box(_ref, ref) {
62
62
  var resolvedMarginLeft = (_ref9 = marginLeft !== null && marginLeft !== void 0 ? marginLeft : marginX) !== null && _ref9 !== void 0 ? _ref9 : margin;
63
63
  var omitFlex = !display || typeof display === 'string' && display !== 'flex' && display !== 'inlineFlex';
64
64
  return /*#__PURE__*/createElement(component, _objectSpread2(_objectSpread2({}, props), {}, {
65
- className: classNames(className, styles.box, display ? getClassNames(styles, 'display', display) : null, position !== 'static' ? getClassNames(styles, 'position', position) : null, minWidth != null ? getClassNames(widthStyles, 'minWidth', String(minWidth)) : null, getClassNames(widthStyles, 'maxWidth', maxWidth), textAlign !== 'start' ? getClassNames(styles, 'textAlign', textAlign) : null, // padding
65
+ className: classNames(className, styles.box, display ? getClassNames(styles, 'display', display) : null, position !== 'static' ? getClassNames(styles, 'position', position) : null, minWidth != null ? getClassNames(widthStyles, 'minWidth', String(minWidth)) : null, getClassNames(widthStyles, 'maxWidth', maxWidth), getClassNames(styles, 'textAlign', textAlign), // padding
66
66
  getClassNames(paddingStyles, 'paddingTop', resolvedPaddingTop), getClassNames(paddingStyles, 'paddingRight', resolvedPaddingRight), getClassNames(paddingStyles, 'paddingBottom', resolvedPaddingBottom), getClassNames(paddingStyles, 'paddingLeft', resolvedPaddingLeft), // margin
67
67
  getClassNames(marginStyles, 'marginTop', resolvedMarginTop), getClassNames(marginStyles, 'marginRight', resolvedMarginRight), getClassNames(marginStyles, 'marginBottom', resolvedMarginBottom), getClassNames(marginStyles, 'marginLeft', resolvedMarginLeft), // flex props
68
- omitFlex ? null : getClassNames(styles, 'flexDirection', flexDirection), omitFlex ? null : getClassNames(styles, 'flexWrap', flexWrap), omitFlex ? null : getClassNames(styles, 'alignItems', alignItems), omitFlex ? null : getClassNames(styles, 'justifyContent', justifyContent), flexShrink != null ? getClassNames(styles, 'flexShrink', String(flexShrink)) : null, flexGrow != null ? getClassNames(styles, 'flexGrow', String(flexGrow)) : null, // other props
68
+ omitFlex ? null : getClassNames(styles, 'flexDirection', flexDirection), omitFlex ? null : getClassNames(styles, 'flexWrap', flexWrap), omitFlex ? null : getClassNames(styles, 'alignItems', alignItems), omitFlex ? null : getClassNames(styles, 'justifyContent', justifyContent), alignSelf != null ? getClassNames(styles, 'alignSelf', alignSelf) : null, flexShrink != null ? getClassNames(styles, 'flexShrink', String(flexShrink)) : null, flexGrow != null ? getClassNames(styles, 'flexGrow', String(flexGrow)) : null, // other props
69
69
  getClassNames(styles, 'overflow', overflow), width != null ? getClassNames(widthStyles, 'width', String(width)) : null, getClassNames(styles, 'height', height), getClassNames(styles, 'bg', background), borderRadius !== 'none' ? getClassNames(styles, 'borderRadius', borderRadius) : null, border !== 'none' ? getClassNames(styles, 'border', border) : null) || undefined,
70
70
  ref: ref
71
71
  }), children);
@@ -1 +1 @@
1
- {"version":3,"file":"box.js","sources":["../../../src/new-components/box/box.tsx"],"sourcesContent":["import * as React from 'react'\nimport classNames from 'classnames'\nimport { polymorphicComponent } from '../../utils/polymorphism'\nimport { getClassNames } from '../responsive-props'\n\nimport type { ResponsiveProp } from '../responsive-props'\nimport type {\n DividerWeight,\n Space,\n SpaceWithNegatives,\n WithEnhancedClassName,\n} from '../common-types'\n\nimport styles from './box.module.css'\nimport paddingStyles from './padding.module.css'\nimport marginStyles from './margin.module.css'\nimport widthStyles from './width.module.css'\n\ninterface BoxPaddingProps {\n padding?: ResponsiveProp<Space>\n paddingX?: ResponsiveProp<Space>\n paddingY?: ResponsiveProp<Space>\n paddingTop?: ResponsiveProp<Space>\n paddingRight?: ResponsiveProp<Space>\n paddingBottom?: ResponsiveProp<Space>\n paddingLeft?: ResponsiveProp<Space>\n}\n\ninterface BoxMarginProps {\n margin?: ResponsiveProp<SpaceWithNegatives>\n marginX?: ResponsiveProp<SpaceWithNegatives>\n marginY?: ResponsiveProp<SpaceWithNegatives>\n marginTop?: ResponsiveProp<SpaceWithNegatives>\n marginRight?: ResponsiveProp<SpaceWithNegatives>\n marginBottom?: ResponsiveProp<SpaceWithNegatives>\n marginLeft?: ResponsiveProp<SpaceWithNegatives>\n}\n\ntype BoxDisplay = 'block' | 'flex' | 'inline' | 'inlineBlock' | 'inlineFlex' | 'none'\ntype BoxFlexDirection = 'column' | 'row'\ntype BoxFlexWrap = 'nowrap' | 'wrap'\ntype BoxAlignItems = 'center' | 'flexEnd' | 'flexStart' | 'baseline'\ntype BoxJustifyContent =\n | 'center'\n | 'flexEnd'\n | 'flexStart'\n | 'spaceAround'\n | 'spaceBetween'\n | 'spaceEvenly'\ntype BoxOverflow = 'hidden' | 'auto' | 'visible' | 'scroll'\n\ntype BoxMaxMinWidth = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge'\ntype BoxMinWidth = 0 | BoxMaxMinWidth\ntype BoxMaxWidth = BoxMaxMinWidth | 'full'\ntype BoxWidth = 0 | BoxMaxMinWidth | 'full' | 'auto' | 'maxContent' | 'minContent' | 'fitContent'\n\ninterface BorderProps {\n borderRadius?: 'standard' | 'none' | 'full'\n border?: DividerWeight\n}\n\ninterface ReusableBoxProps extends BorderProps, BoxPaddingProps {\n minWidth?: BoxMinWidth\n maxWidth?: BoxMaxWidth\n width?: BoxWidth\n background?: 'default' | 'aside' | 'highlight' | 'selected'\n flexGrow?: 0 | 1\n flexShrink?: 0\n}\n\ntype BoxPosition = 'absolute' | 'fixed' | 'relative' | 'static' | 'sticky'\n\ninterface BoxProps extends WithEnhancedClassName, ReusableBoxProps, BoxMarginProps {\n position?: ResponsiveProp<BoxPosition>\n display?: ResponsiveProp<BoxDisplay>\n flexDirection?: ResponsiveProp<BoxFlexDirection>\n flexWrap?: BoxFlexWrap\n alignItems?: ResponsiveProp<BoxAlignItems>\n justifyContent?: ResponsiveProp<BoxJustifyContent>\n overflow?: BoxOverflow\n height?: 'full'\n textAlign?: ResponsiveProp<'start' | 'center' | 'end' | 'justify'>\n}\n\nconst Box = polymorphicComponent<'div', BoxProps, 'keepClassName'>(function Box(\n {\n as: component = 'div',\n position = 'static',\n display,\n flexDirection = 'row',\n flexWrap,\n flexGrow,\n flexShrink,\n alignItems,\n justifyContent,\n overflow,\n width,\n height,\n background,\n border,\n borderRadius,\n minWidth,\n maxWidth,\n textAlign = 'start',\n padding,\n paddingY,\n paddingX,\n paddingTop,\n paddingRight,\n paddingBottom,\n paddingLeft,\n margin,\n marginY,\n marginX,\n marginTop,\n marginRight,\n marginBottom,\n marginLeft,\n className,\n children,\n ...props\n },\n ref,\n) {\n const resolvedPaddingTop = paddingTop ?? paddingY ?? padding\n const resolvedPaddingRight = paddingRight ?? paddingX ?? padding\n const resolvedPaddingBottom = paddingBottom ?? paddingY ?? padding\n const resolvedPaddingLeft = paddingLeft ?? paddingX ?? padding\n\n const resolvedMarginTop = marginTop ?? marginY ?? margin\n const resolvedMarginRight = marginRight ?? marginX ?? margin\n const resolvedMarginBottom = marginBottom ?? marginY ?? margin\n const resolvedMarginLeft = marginLeft ?? marginX ?? margin\n\n const omitFlex =\n !display || (typeof display === 'string' && display !== 'flex' && display !== 'inlineFlex')\n\n return React.createElement(\n component,\n {\n ...props,\n className:\n classNames(\n className,\n styles.box,\n display ? getClassNames(styles, 'display', display) : null,\n position !== 'static' ? getClassNames(styles, 'position', position) : null,\n minWidth != null\n ? getClassNames(widthStyles, 'minWidth', String(minWidth))\n : null,\n getClassNames(widthStyles, 'maxWidth', maxWidth),\n textAlign !== 'start' ? getClassNames(styles, 'textAlign', textAlign) : null,\n // padding\n getClassNames(paddingStyles, 'paddingTop', resolvedPaddingTop),\n getClassNames(paddingStyles, 'paddingRight', resolvedPaddingRight),\n getClassNames(paddingStyles, 'paddingBottom', resolvedPaddingBottom),\n getClassNames(paddingStyles, 'paddingLeft', resolvedPaddingLeft),\n // margin\n getClassNames(marginStyles, 'marginTop', resolvedMarginTop),\n getClassNames(marginStyles, 'marginRight', resolvedMarginRight),\n getClassNames(marginStyles, 'marginBottom', resolvedMarginBottom),\n getClassNames(marginStyles, 'marginLeft', resolvedMarginLeft),\n // flex props\n omitFlex ? null : getClassNames(styles, 'flexDirection', flexDirection),\n omitFlex ? null : getClassNames(styles, 'flexWrap', flexWrap),\n omitFlex ? null : getClassNames(styles, 'alignItems', alignItems),\n omitFlex ? null : getClassNames(styles, 'justifyContent', justifyContent),\n flexShrink != null\n ? getClassNames(styles, 'flexShrink', String(flexShrink))\n : null,\n flexGrow != null ? getClassNames(styles, 'flexGrow', String(flexGrow)) : null,\n // other props\n getClassNames(styles, 'overflow', overflow),\n width != null ? getClassNames(widthStyles, 'width', String(width)) : null,\n getClassNames(styles, 'height', height),\n getClassNames(styles, 'bg', background),\n borderRadius !== 'none'\n ? getClassNames(styles, 'borderRadius', borderRadius)\n : null,\n border !== 'none' ? getClassNames(styles, 'border', border) : null,\n ) || undefined,\n ref,\n },\n children,\n )\n})\n\nexport type {\n BoxProps,\n BoxPaddingProps,\n BoxMarginProps,\n ReusableBoxProps,\n BoxMinWidth,\n BoxMaxWidth,\n BoxDisplay,\n BoxPosition,\n BoxFlexDirection,\n BoxFlexWrap,\n BoxAlignItems,\n BoxJustifyContent,\n BoxOverflow,\n}\n\nexport { Box }\n"],"names":["Box","polymorphicComponent","ref","as","component","position","display","flexDirection","flexWrap","flexGrow","flexShrink","alignItems","justifyContent","overflow","width","height","background","border","borderRadius","minWidth","maxWidth","textAlign","padding","paddingY","paddingX","paddingTop","paddingRight","paddingBottom","paddingLeft","margin","marginY","marginX","marginTop","marginRight","marginBottom","marginLeft","className","children","props","resolvedPaddingTop","resolvedPaddingRight","resolvedPaddingBottom","resolvedPaddingLeft","resolvedMarginTop","resolvedMarginRight","resolvedMarginBottom","resolvedMarginLeft","omitFlex","React","classNames","styles","box","getClassNames","widthStyles","String","paddingStyles","marginStyles","undefined"],"mappings":";;;;;;;;;;;IAoFMA,GAAG,gBAAGC,oBAAoB,CAAmC,SAASD,GAAT,OAsC/DE,GAtC+D;;;qBAE3DC;MAAIC,iCAAY;2BAChBC;MAAAA,sCAAW;MACXC,eAAAA;gCACAC;MAAAA,gDAAgB;MAChBC,gBAAAA;MACAC,gBAAAA;MACAC,kBAAAA;MACAC,kBAAAA;MACAC,sBAAAA;MACAC,gBAAAA;MACAC,aAAAA;MACAC,cAAAA;MACAC,kBAAAA;MACAC,cAAAA;MACAC,oBAAAA;MACAC,gBAAAA;MACAC,gBAAAA;4BACAC;MAAAA,wCAAY;MACZC,eAAAA;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uBvC,UAAvB,CAvBzB,EAwBNoC,QAAQ,GAAG,IAAH,GAAUK,aAAa,CAACF,MAAD,EAAS,gBAAT,EAA2BtC,cAA3B,CAxBzB,EAyBNF,UAAU,IAAI,IAAd,GACM0C,aAAa,CAACF,MAAD,EAAS,YAAT,EAAuBI,MAAM,CAAC5C,UAAD,CAA7B,CADnB,GAEM,IA3BA,EA4BND,QAAQ,IAAI,IAAZ,GAAmB2C,aAAa,CAACF,MAAD,EAAS,UAAT,EAAqBI,MAAM,CAAC7C,QAAD,CAA3B,CAAhC,GAAyE,IA5BnE;AA8BN2C,IAAAA,aAAa,CAACF,MAAD,EAAS,UAAT,EAAqBrC,QAArB,CA9BP,EA+BNC,KAAK,IAAI,IAAT,GAAgBsC,aAAa,CAACC,WAAD,EAAc,OAAd,EAAuBC,MAAM,CAACxC,KAAD,CAA7B,CAA7B,GAAqE,IA/B/D,EAgCNsC,aAAa,CAACF,MAAD,EAAS,QAAT,EAAmBnC,MAAnB,CAhCP,EAiCNqC,aAAa,CAACF,MAAD,EAAS,IAAT,EAAelC,UAAf,CAjCP,EAkCNE,YAAY,KAAK,MAAjB,GACMkC,aAAa,CAACF,MAAD,EAAS,cAAT,EAAyBhC,YAAzB,CADnB,GAEM,IApCA,EAqCND,MAAM,KAAK,MAAX,GAAoBmC,aAAa,CAACF,MAAD,EAAS,QAAT,EAAmBjC,MAAnB,CAAjC,GAA8D,IArCxD,CAAV,IAsCKwC,SA3CV;AA4CCvD,IAAAA,GAAG,EAAHA;AA5CD,MA8CHmC,QA9CG,CAAP;AAgDH,CArG+B;;;;"}
1
+ {"version":3,"file":"box.js","sources":["../../../src/new-components/box/box.tsx"],"sourcesContent":["import * as React from 'react'\nimport classNames from 'classnames'\nimport { polymorphicComponent } from '../../utils/polymorphism'\nimport { getClassNames } from '../responsive-props'\n\nimport type { ResponsiveProp } from '../responsive-props'\nimport type {\n DividerWeight,\n Space,\n SpaceWithNegatives,\n WithEnhancedClassName,\n} from '../common-types'\n\nimport styles from './box.module.css'\nimport paddingStyles from './padding.module.css'\nimport marginStyles from './margin.module.css'\nimport widthStyles from './width.module.css'\n\ninterface BoxPaddingProps {\n padding?: ResponsiveProp<Space>\n paddingX?: ResponsiveProp<Space>\n paddingY?: ResponsiveProp<Space>\n paddingTop?: ResponsiveProp<Space>\n paddingRight?: ResponsiveProp<Space>\n paddingBottom?: ResponsiveProp<Space>\n paddingLeft?: ResponsiveProp<Space>\n}\n\ninterface BoxMarginProps {\n margin?: ResponsiveProp<SpaceWithNegatives>\n marginX?: ResponsiveProp<SpaceWithNegatives>\n marginY?: ResponsiveProp<SpaceWithNegatives>\n marginTop?: ResponsiveProp<SpaceWithNegatives>\n marginRight?: ResponsiveProp<SpaceWithNegatives>\n marginBottom?: ResponsiveProp<SpaceWithNegatives>\n marginLeft?: ResponsiveProp<SpaceWithNegatives>\n}\n\ntype BoxDisplay = 'block' | 'flex' | 'inline' | 'inlineBlock' | 'inlineFlex' | 'none'\ntype BoxFlexDirection = 'column' | 'row'\ntype BoxFlexWrap = 'nowrap' | 'wrap'\ntype BoxAlignItems = 'center' | 'flexEnd' | 'flexStart' | 'baseline'\ntype BoxJustifyContent =\n | 'center'\n | 'flexEnd'\n | 'flexStart'\n | 'spaceAround'\n | 'spaceBetween'\n | 'spaceEvenly'\ntype BoxAlignSelf = 'flexStart' | 'flexEnd' | 'center' | 'baseline' | 'stretch'\ntype BoxOverflow = 'hidden' | 'auto' | 'visible' | 'scroll'\n\ntype BoxMaxMinWidth = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge'\ntype BoxMinWidth = 0 | BoxMaxMinWidth\ntype BoxMaxWidth = BoxMaxMinWidth | 'full'\ntype BoxWidth = 0 | BoxMaxMinWidth | 'full' | 'auto' | 'maxContent' | 'minContent' | 'fitContent'\n\ninterface BorderProps {\n borderRadius?: 'standard' | 'none' | 'full'\n border?: DividerWeight\n}\n\ninterface ReusableBoxProps extends BorderProps, BoxPaddingProps {\n minWidth?: BoxMinWidth\n maxWidth?: BoxMaxWidth\n width?: BoxWidth\n background?: 'default' | 'aside' | 'highlight' | 'selected'\n flexGrow?: 0 | 1\n flexShrink?: 0\n}\n\ntype BoxPosition = 'absolute' | 'fixed' | 'relative' | 'static' | 'sticky'\ntype BoxTextAlign = 'start' | 'center' | 'end' | 'justify'\n\ninterface BoxProps extends WithEnhancedClassName, ReusableBoxProps, BoxMarginProps {\n position?: ResponsiveProp<BoxPosition>\n display?: ResponsiveProp<BoxDisplay>\n flexDirection?: ResponsiveProp<BoxFlexDirection>\n flexWrap?: BoxFlexWrap\n alignItems?: ResponsiveProp<BoxAlignItems>\n alignSelf?: ResponsiveProp<BoxAlignSelf>\n justifyContent?: ResponsiveProp<BoxJustifyContent>\n overflow?: BoxOverflow\n height?: 'full'\n textAlign?: ResponsiveProp<BoxTextAlign>\n}\n\nconst Box = polymorphicComponent<'div', BoxProps, 'keepClassName'>(function Box(\n {\n as: component = 'div',\n position = 'static',\n display,\n flexDirection = 'row',\n flexWrap,\n flexGrow,\n flexShrink,\n alignItems,\n justifyContent,\n alignSelf,\n overflow,\n width,\n height,\n background,\n border,\n borderRadius,\n minWidth,\n maxWidth,\n textAlign,\n padding,\n paddingY,\n paddingX,\n paddingTop,\n paddingRight,\n paddingBottom,\n paddingLeft,\n margin,\n marginY,\n marginX,\n marginTop,\n marginRight,\n marginBottom,\n marginLeft,\n className,\n children,\n ...props\n },\n ref,\n) {\n const resolvedPaddingTop = paddingTop ?? paddingY ?? padding\n const resolvedPaddingRight = paddingRight ?? paddingX ?? padding\n const resolvedPaddingBottom = paddingBottom ?? paddingY ?? padding\n const resolvedPaddingLeft = paddingLeft ?? paddingX ?? padding\n\n const resolvedMarginTop = marginTop ?? marginY ?? margin\n const resolvedMarginRight = marginRight ?? marginX ?? margin\n const resolvedMarginBottom = marginBottom ?? marginY ?? margin\n const resolvedMarginLeft = marginLeft ?? marginX ?? margin\n\n const omitFlex =\n !display || (typeof display === 'string' && display !== 'flex' && display !== 'inlineFlex')\n\n return React.createElement(\n component,\n {\n ...props,\n className:\n classNames(\n className,\n styles.box,\n display ? getClassNames(styles, 'display', display) : null,\n position !== 'static' ? getClassNames(styles, 'position', position) : null,\n minWidth != null\n ? getClassNames(widthStyles, 'minWidth', String(minWidth))\n : null,\n getClassNames(widthStyles, 'maxWidth', maxWidth),\n getClassNames(styles, 'textAlign', textAlign),\n // padding\n getClassNames(paddingStyles, 'paddingTop', resolvedPaddingTop),\n getClassNames(paddingStyles, 'paddingRight', resolvedPaddingRight),\n getClassNames(paddingStyles, 'paddingBottom', resolvedPaddingBottom),\n getClassNames(paddingStyles, 'paddingLeft', resolvedPaddingLeft),\n // margin\n getClassNames(marginStyles, 'marginTop', resolvedMarginTop),\n getClassNames(marginStyles, 'marginRight', resolvedMarginRight),\n getClassNames(marginStyles, 'marginBottom', resolvedMarginBottom),\n getClassNames(marginStyles, 'marginLeft', resolvedMarginLeft),\n // flex props\n omitFlex ? null : getClassNames(styles, 'flexDirection', flexDirection),\n omitFlex ? null : getClassNames(styles, 'flexWrap', flexWrap),\n omitFlex ? null : getClassNames(styles, 'alignItems', alignItems),\n omitFlex ? null : getClassNames(styles, 'justifyContent', justifyContent),\n alignSelf != null ? getClassNames(styles, 'alignSelf', alignSelf) : null,\n flexShrink != null\n ? getClassNames(styles, 'flexShrink', String(flexShrink))\n : null,\n flexGrow != null ? getClassNames(styles, 'flexGrow', String(flexGrow)) : null,\n // other props\n getClassNames(styles, 'overflow', overflow),\n width != null ? getClassNames(widthStyles, 'width', String(width)) : null,\n getClassNames(styles, 'height', height),\n getClassNames(styles, 'bg', background),\n borderRadius !== 'none'\n ? getClassNames(styles, 'borderRadius', borderRadius)\n : null,\n border !== 'none' ? getClassNames(styles, 'border', border) : null,\n ) || undefined,\n ref,\n },\n children,\n )\n})\n\nexport type {\n BoxProps,\n BoxPaddingProps,\n BoxMarginProps,\n ReusableBoxProps,\n BoxMinWidth,\n BoxMaxWidth,\n BoxDisplay,\n BoxPosition,\n BoxFlexDirection,\n BoxFlexWrap,\n BoxAlignItems,\n BoxJustifyContent,\n BoxOverflow,\n BoxTextAlign,\n}\n\nexport { Box }\n"],"names":["Box","polymorphicComponent","ref","as","component","position","display","flexDirection","flexWrap","flexGrow","flexShrink","alignItems","justifyContent","alignSelf","overflow","width","height","background","border","borderRadius","minWidth","maxWidth","textAlign","padding","paddingY","paddingX","paddingTop","paddingRight","paddingBottom","paddingLeft","margin","marginY","marginX","marginTop","marginRight","marginBottom","marginLeft","className","children","props","resolvedPaddingTop","resolvedPaddingRight","resolvedPaddingBottom","resolvedPaddingLeft","resolvedMarginTop","resolvedMarginRight","resolvedMarginBottom","resolvedMarginLeft","omitFlex","React","classNames","styles","box","getClassNames","widthStyles","String","paddingStyles","marginStyles","undefined"],"mappings":";;;;;;;;;;;IAuFMA,GAAG,gBAAGC,oBAAoB,CAAmC,SAASD,GAAT,OAuC/DE,GAvC+D;;;qBAE3DC;MAAIC,iCAAY;2BAChBC;MAAAA,sCAAW;MACXC,eAAAA;gCACAC;MAAAA,gDAAgB;MAChBC,gBAAAA;MACAC,gBAAAA;MACAC,kBAAAA;MACAC,kBAAAA;MACAC,sBAAAA;MACAC,iBAAAA;MACAC,gBAAAA;MACAC,aAAAA;MACAC,cAAAA;MACAC,kBAAAA;MACAC,cAAAA;MACAC,oBAAAA;MACAC,gBAAAA;MACAC,gBAAAA;MACAC,iBAAAA;MACAC,eAAAA;MACAC,gBAAAA;MACAC,gBAAAA;MACAC,kBAAAA;MACAC,oBAAAA;MACAC,qBAAAA;MACAC,mBAAAA;MACAC,cAAAA;MACAC,eAAAA;MACAC,eAAAA;MACAC,iBAAAA;MACAC,mBAAAA;MACAC,oBAAAA;MACAC,kBAAAA;MACAC,iBAAAA;MACAC,gBAAAA;MACGC;;AAIP,MAAMC,kBAAkB,YAAGd,UAAH,aAAGA,UAAH,cAAGA,UAAH,GAAiBF,QAAjB,yCAA6BD,OAArD;AACA,MAAMkB,oBAAoB,YAAGd,YAAH,aAAGA,YAA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,UAAT,EAAqBI,MAAM,CAAC9C,QAAD,CAA3B,CAAhC,GAAyE,IA7BnE;AA+BN4C,IAAAA,aAAa,CAACF,MAAD,EAAS,UAAT,EAAqBrC,QAArB,CA/BP,EAgCNC,KAAK,IAAI,IAAT,GAAgBsC,aAAa,CAACC,WAAD,EAAc,OAAd,EAAuBC,MAAM,CAACxC,KAAD,CAA7B,CAA7B,GAAqE,IAhC/D,EAiCNsC,aAAa,CAACF,MAAD,EAAS,QAAT,EAAmBnC,MAAnB,CAjCP,EAkCNqC,aAAa,CAACF,MAAD,EAAS,IAAT,EAAelC,UAAf,CAlCP,EAmCNE,YAAY,KAAK,MAAjB,GACMkC,aAAa,CAACF,MAAD,EAAS,cAAT,EAAyBhC,YAAzB,CADnB,GAEM,IArCA,EAsCND,MAAM,KAAK,MAAX,GAAoBmC,aAAa,CAACF,MAAD,EAAS,QAAT,EAAmBjC,MAAnB,CAAjC,GAA8D,IAtCxD,CAAV,IAuCKwC,SA5CV;AA6CCxD,IAAAA,GAAG,EAAHA;AA7CD,MA+CHoC,QA/CG,CAAP;AAiDH,CAvG+B;;;;"}
@@ -1,4 +1,4 @@
1
- var modules_54d944f2 = {"box":"_2a8ae321","position-absolute":"_29e047b9","position-fixed":"fe54fea9","position-relative":"_6a95a38d","position-sticky":"ccc689fe","tablet-position-absolute":"aad88ae1","tablet-position-fixed":"_2044ccd3","tablet-position-relative":"a0904035","tablet-position-sticky":"_770506a5","desktop-position-absolute":"_5a954855","desktop-position-fixed":"_2dc73359","desktop-position-relative":"_6ab005ed","desktop-position-sticky":"fa60c726","display-block":"_221ad6a3","display-flex":"_6764f5bc","display-inline":"_50c37dba","display-inlineBlock":"_16546fe0","display-inlineFlex":"_2782a687","display-none":"b70b4fb7","tablet-display-block":"_5b3547cc","tablet-display-flex":"_099432e6","tablet-display-inline":"d99fcd80","tablet-display-inlineBlock":"_8f160568","tablet-display-inlineFlex":"_5b7b4be4","tablet-display-none":"_553721f8","desktop-display-block":"_6b86b317","desktop-display-flex":"eb20eda4","desktop-display-inline":"be19d1e9","desktop-display-inlineBlock":"dcf7c80a","desktop-display-inlineFlex":"e4f02b1f","desktop-display-none":"_3974e6d8","flexDirection-column":"daf5e366","flexDirection-row":"_47f2ddb7","tablet-flexDirection-column":"_27490d54","tablet-flexDirection-row":"_0317f51b","desktop-flexDirection-column":"_97590faa","desktop-flexDirection-row":"bf5d416e","flexWrap-wrap":"_210c1f9e","flexWrap-nowrap":"_2c775d07","flexShrink-0":"_25cae61d","flexGrow-0":"_6068a9cf","flexGrow-1":"c63f682c","alignItems-flexStart":"_0e774dfc","alignItems-center":"_5695a5d5","alignItems-flexEnd":"_139515d8","alignItems-baseline":"cea92f0a","tablet-alignItems-flexStart":"_3dc7ec16","tablet-alignItems-center":"_7993a7fa","tablet-alignItems-flexEnd":"b90d7edc","tablet-alignItems-baseline":"_7bd633f1","desktop-alignItems-flexStart":"_260d232b","desktop-alignItems-center":"_9e2e0a07","desktop-alignItems-flexEnd":"fc97448b","desktop-alignItems-baseline":"_0f76a529","justifyContent-flexStart":"_21d759bf","justifyContent-center":"ff70e049","justifyContent-flexEnd":"ae15d5ad","justifyContent-spaceAround":"_84374266","justifyContent-spaceBetween":"e72a8ca2","justifyContent-spaceEvenly":"_86224cb5","tablet-justifyContent-flexStart":"dceedee0","tablet-justifyContent-center":"_34ab3dab","tablet-justifyContent-flexEnd":"d5da2eb9","tablet-justifyContent-spaceAround":"_1677560d","tablet-justifyContent-spaceBetween":"ef77b2e7","tablet-justifyContent-spaceEvenly":"_685ef848","desktop-justifyContent-flexStart":"_695667f2","desktop-justifyContent-center":"ebb180cc","desktop-justifyContent-flexEnd":"bd5bb675","desktop-justifyContent-spaceBetween":"ae08a70c","overflow-hidden":"_4afa6fac","overflow-auto":"d8d342e4","overflow-visible":"c104da68","overflow-scroll":"_2d6bc0d0","height-full":"_99458759","bg-default":"aadb417c","bg-aside":"_36dca662","bg-highlight":"a1054115","bg-selected":"d17b4e9a","borderRadius-standard":"e3a3ee05","borderRadius-full":"be0cb60b","border-primary":"b9999f44","border-secondary":"_91063996","border-tertiary":"_0902977e","textAlign-start":"a7c58898","textAlign-center":"_2c9a262a","textAlign-end":"_46f07e93","textAlign-justify":"e526003e","tablet-textAlign-start":"_26864fce","tablet-textAlign-center":"e8f51d21","tablet-textAlign-end":"c1dc8b90","tablet-textAlign-justify":"_36bb3fa9","desktop-textAlign-start":"_942e35b0","desktop-textAlign-center":"_92da5c98","desktop-textAlign-end":"_2b0ecaf6","desktop-textAlign-justify":"_3dd24641"};
1
+ var modules_54d944f2 = {"box":"f9408a0e","position-absolute":"_7807dcdd","position-fixed":"dc5f328c","position-relative":"_0e4ff085","position-sticky":"_4019d94a","tablet-position-absolute":"b1865c0f","tablet-position-fixed":"af8c5967","tablet-position-relative":"ef2b609f","tablet-position-sticky":"_04935ffd","desktop-position-absolute":"bda94091","desktop-position-fixed":"_691dfd31","desktop-position-relative":"efda904e","desktop-position-sticky":"bcf04687","display-block":"b5b9f34a","display-flex":"_6e9db9aa","display-inline":"ece6d246","display-inlineBlock":"e5e2223f","display-inlineFlex":"f344a0e2","display-none":"_9002f8c2","tablet-display-block":"d896f0ff","tablet-display-flex":"_56412665","tablet-display-inline":"_6b430cc5","tablet-display-inlineBlock":"_4158c5ad","tablet-display-inlineFlex":"c598eaab","tablet-display-none":"_5a2a6d3f","desktop-display-block":"_132ef8fb","desktop-display-flex":"_5bd11385","desktop-display-inline":"a51c2ec9","desktop-display-inlineBlock":"_93506988","desktop-display-inlineFlex":"_385d45a5","desktop-display-none":"_921732eb","flexDirection-column":"_41ef5755","flexDirection-row":"_6cad1a19","tablet-flexDirection-column":"f1c16205","tablet-flexDirection-row":"_65305ae1","desktop-flexDirection-column":"_4916f0f9","desktop-flexDirection-row":"_430dfc8e","flexWrap-wrap":"_3d2d56fe","flexWrap-nowrap":"_826e4adf","flexShrink-0":"f8344e0f","flexGrow-0":"f117e2ab","flexGrow-1":"_1355325c","alignItems-flexStart":"c5b05c6a","alignItems-center":"_21b8bafa","alignItems-flexEnd":"_56d73c9b","alignItems-baseline":"_052e0707","tablet-alignItems-flexStart":"_90048c98","tablet-alignItems-center":"_7e189a0b","tablet-alignItems-flexEnd":"b8aefb5c","tablet-alignItems-baseline":"_4c1a5ef9","desktop-alignItems-flexStart":"f4d052ef","desktop-alignItems-center":"e5478926","desktop-alignItems-flexEnd":"b4f5051a","desktop-alignItems-baseline":"b21adace","justifyContent-flexStart":"be6deb6a","justifyContent-center":"d8eaf780","justifyContent-flexEnd":"_9212ca89","justifyContent-spaceAround":"_5d2cd095","justifyContent-spaceBetween":"_00d5fe7e","justifyContent-spaceEvenly":"ce4f4c2d","tablet-justifyContent-flexStart":"_6580dbbc","tablet-justifyContent-center":"_3f689891","tablet-justifyContent-flexEnd":"_628df8db","tablet-justifyContent-spaceAround":"_3ea88b4f","tablet-justifyContent-spaceBetween":"_4554d93d","tablet-justifyContent-spaceEvenly":"eb13fb50","desktop-justifyContent-flexStart":"_36dc744d","desktop-justifyContent-center":"ee7077ab","desktop-justifyContent-flexEnd":"_4edc8c86","desktop-justifyContent-spaceBetween":"_7e147696","alignSelf-stretch":"c0655cd6","alignSelf-flexStart":"_11863030","alignSelf-center":"c6d86139","alignSelf-flexEnd":"c0bd1f82","alignSelf-baseline":"_95686aec","tablet-alignSelf-stretch":"_9b712cc7","tablet-alignSelf-flexStart":"f7b935f7","tablet-alignSelf-center":"bf9ad125","tablet-alignSelf-flexEnd":"_3b4f8c3c","tablet-alignSelf-baseline":"_49d27079","desktop-alignSelf-stretch":"_63d27ffa","desktop-alignSelf-flexStart":"d45796cc","desktop-alignSelf-center":"c91c7bf7","desktop-alignSelf-flexEnd":"f2453212","desktop-alignSelf-baseline":"_3882757c","overflow-hidden":"_473810b4","overflow-auto":"_051c2340","overflow-visible":"_14e451d1","overflow-scroll":"_4d8555f8","height-full":"_867d251e","bg-default":"_2d928bf8","bg-aside":"db3f5af6","bg-highlight":"c990fcc3","bg-selected":"_976a662f","borderRadius-standard":"_46b52f05","borderRadius-full":"_1c8b326b","border-primary":"_0ef8c314","border-secondary":"_14871605","border-tertiary":"_36c045c3","textAlign-start":"d745aa1e","textAlign-center":"_31cf99c5","textAlign-end":"_10a7a030","textAlign-justify":"_2cfc8b46","tablet-textAlign-start":"e6b7bb40","tablet-textAlign-center":"_47dcb91c","tablet-textAlign-end":"_1d4011ce","tablet-textAlign-justify":"_18407499","desktop-textAlign-start":"_565de5cf","desktop-textAlign-center":"_64254ba3","desktop-textAlign-end":"_3cc6a504","desktop-textAlign-justify":"_0efec659"};
2
2
 
3
3
  export default modules_54d944f2;
4
4
  //# sourceMappingURL=box.module.css.js.map
@@ -7,8 +7,6 @@ var _excluded = ["variant", "tone", "size", "type", "disabled", "exceptionallySe
7
7
  * A semantic button that also looks like a button, and provides all the necessary visual variants.
8
8
  * It follows the [WAI-ARIA Button Pattern](https://www.w3.org/TR/wai-aria-practices/#button).
9
9
  *
10
- * 🎨 [Figma](https://www.figma.com/file/LYlWNzvhMDh907l07mPPQk/Product-Web?node-id=4693%3A175143)
11
- *
12
10
  * @see ButtonLink
13
11
  */
14
12
 
@@ -1 +1 @@
1
- {"version":3,"file":"button.js","sources":["../../../src/new-components/button/button.tsx"],"sourcesContent":["import * as React from 'react'\nimport { BaseButton } from '../base-button'\nimport type { BaseButtonProps } from '../base-button'\n\ntype NativeButtonProps = Omit<\n React.AllHTMLAttributes<HTMLButtonElement>,\n 'aria-disabled' | 'className' | keyof BaseButtonProps\n>\n\nexport type ButtonProps = NativeButtonProps &\n BaseButtonProps & {\n type?: 'button' | 'submit' | 'reset'\n exceptionallySetClassName?: string\n }\n\n/**\n * A semantic button that also looks like a button, and provides all the necessary visual variants.\n * It follows the [WAI-ARIA Button Pattern](https://www.w3.org/TR/wai-aria-practices/#button).\n *\n * 🎨 [Figma](https://www.figma.com/file/LYlWNzvhMDh907l07mPPQk/Product-Web?node-id=4693%3A175143)\n *\n * @see ButtonLink\n */\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(function Button(\n {\n variant,\n tone = 'normal',\n size = 'normal',\n type = 'button',\n disabled = false,\n exceptionallySetClassName,\n ...props\n },\n ref,\n) {\n return (\n <BaseButton\n {...props}\n as=\"button\"\n ref={ref}\n variant={variant}\n tone={tone}\n size={size}\n type={type}\n disabled={disabled}\n exceptionallySetClassName={exceptionallySetClassName}\n />\n )\n})\n"],"names":["Button","React","ref","variant","tone","size","type","disabled","exceptionallySetClassName","props","BaseButton","as"],"mappings":";;;;;AAeA;;;;;;;;;IAQaA,MAAM,gBAAGC,UAAA,CAAiD,SAASD,MAAT,OAUnEE,GAVmE;MAE/DC,eAAAA;uBACAC;MAAAA,8BAAO;uBACPC;MAAAA,8BAAO;uBACPC;MAAAA,8BAAO;2BACPC;MAAAA,sCAAW;MACXC,iCAAAA;MACGC;;AAIP,sBACIR,aAAA,CAACS,UAAD,oBACQD;AACJE,IAAAA,EAAE,EAAC;AACHT,IAAAA,GAAG,EAAEA;AACLC,IAAAA,OAAO,EAAEA;AACTC,IAAAA,IAAI,EAAEA;AACNC,IAAAA,IAAI,EAAEA;AACNC,IAAAA,IAAI,EAAEA;AACNC,IAAAA,QAAQ,EAAEA;AACVC,IAAAA,yBAAyB,EAAEA;IAT/B,CADJ;AAaH,CAzBqB;;;;"}
1
+ {"version":3,"file":"button.js","sources":["../../../src/new-components/button/button.tsx"],"sourcesContent":["import * as React from 'react'\nimport { BaseButton } from '../base-button'\nimport type { BaseButtonProps } from '../base-button'\n\ntype NativeButtonProps = Omit<\n React.AllHTMLAttributes<HTMLButtonElement>,\n 'aria-disabled' | 'className' | keyof BaseButtonProps\n>\n\nexport type ButtonProps = NativeButtonProps &\n BaseButtonProps & {\n type?: 'button' | 'submit' | 'reset'\n exceptionallySetClassName?: string\n }\n\n/**\n * A semantic button that also looks like a button, and provides all the necessary visual variants.\n * It follows the [WAI-ARIA Button Pattern](https://www.w3.org/TR/wai-aria-practices/#button).\n *\n * @see ButtonLink\n */\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(function Button(\n {\n variant,\n tone = 'normal',\n size = 'normal',\n type = 'button',\n disabled = false,\n exceptionallySetClassName,\n ...props\n },\n ref,\n) {\n return (\n <BaseButton\n {...props}\n as=\"button\"\n ref={ref}\n variant={variant}\n tone={tone}\n size={size}\n type={type}\n disabled={disabled}\n exceptionallySetClassName={exceptionallySetClassName}\n />\n )\n})\n"],"names":["Button","React","ref","variant","tone","size","type","disabled","exceptionallySetClassName","props","BaseButton","as"],"mappings":";;;;;AAeA;;;;;;;IAMaA,MAAM,gBAAGC,UAAA,CAAiD,SAASD,MAAT,OAUnEE,GAVmE;MAE/DC,eAAAA;uBACAC;MAAAA,8BAAO;uBACPC;MAAAA,8BAAO;uBACPC;MAAAA,8BAAO;2BACPC;MAAAA,sCAAW;MACXC,iCAAAA;MACGC;;AAIP,sBACIR,aAAA,CAACS,UAAD,oBACQD;AACJE,IAAAA,EAAE,EAAC;AACHT,IAAAA,GAAG,EAAEA;AACLC,IAAAA,OAAO,EAAEA;AACTC,IAAAA,IAAI,EAAEA;AACNC,IAAAA,IAAI,EAAEA;AACNC,IAAAA,IAAI,EAAEA;AACNC,IAAAA,QAAQ,EAAEA;AACVC,IAAAA,yBAAyB,EAAEA;IAT/B,CADJ;AAaH,CAzBqB;;;;"}
@@ -8,8 +8,6 @@ var _excluded = ["as", "variant", "tone", "size", "exceptionallySetClassName", "
8
8
  * A semantic link that looks like a button, exactly matching the `Button` component in all visual
9
9
  * aspects.
10
10
  *
11
- *🎨 [Figma](https://www.figma.com/file/LYlWNzvhMDh907l07mPPQk/Product-Web?node-id=4693%3A175143)
12
- *
13
11
  * @see Button
14
12
  */
15
13
 
@@ -1 +1 @@
1
- {"version":3,"file":"button-link.js","sources":["../../../src/new-components/button-link/button-link.tsx"],"sourcesContent":["import * as React from 'react'\nimport { polymorphicComponent } from '../../utils/polymorphism'\nimport { BaseButton } from '../base-button'\nimport type { BaseButtonProps } from '../base-button'\nimport type { OpenInNewTab } from '../common-types'\n\ntype NativeLinkProps = Omit<\n JSX.IntrinsicElements['a'],\n 'aria-disabled' | 'target' | 'rel' | 'className'\n>\n\nexport type ButtonLinkProps = NativeLinkProps & BaseButtonProps & OpenInNewTab\n\n/**\n * A semantic link that looks like a button, exactly matching the `Button` component in all visual\n * aspects.\n *\n *🎨 [Figma](https://www.figma.com/file/LYlWNzvhMDh907l07mPPQk/Product-Web?node-id=4693%3A175143)\n *\n * @see Button\n */\nexport const ButtonLink = polymorphicComponent<'a', ButtonLinkProps>(function ButtonLink(\n {\n as = 'a',\n variant,\n tone = 'normal',\n size = 'normal',\n exceptionallySetClassName,\n openInNewTab = false,\n ...props\n },\n ref,\n) {\n return (\n <BaseButton\n {...props}\n as={as}\n ref={ref}\n variant={variant}\n tone={tone}\n size={size}\n exceptionallySetClassName={exceptionallySetClassName}\n target={openInNewTab ? '_blank' : undefined}\n rel={openInNewTab ? 'noopener noreferrer' : undefined}\n />\n )\n})\n"],"names":["ButtonLink","polymorphicComponent","ref","as","variant","tone","size","exceptionallySetClassName","openInNewTab","props","React","BaseButton","target","undefined","rel"],"mappings":";;;;;;AAaA;;;;;;;;;IAQaA,UAAU,gBAAGC,oBAAoB,CAAuB,SAASD,UAAT,OAUjEE,GAViE;qBAE7DC;MAAAA,0BAAK;MACLC,eAAAA;uBACAC;MAAAA,8BAAO;uBACPC;MAAAA,8BAAO;MACPC,iCAAAA;+BACAC;MAAAA,8CAAe;MACZC;;AAIP,sBACIC,aAAA,CAACC,UAAD,oBACQF;AACJN,IAAAA,EAAE,EAAEA;AACJD,IAAAA,GAAG,EAAEA;AACLE,IAAAA,OAAO,EAAEA;AACTC,IAAAA,IAAI,EAAEA;AACNC,IAAAA,IAAI,EAAEA;AACNC,IAAAA,yBAAyB,EAAEA;AAC3BK,IAAAA,MAAM,EAAEJ,YAAY,GAAG,QAAH,GAAcK;AAClCC,IAAAA,GAAG,EAAEN,YAAY,GAAG,qBAAH,GAA2BK;IAThD,CADJ;AAaH,CAzB6C;;;;"}
1
+ {"version":3,"file":"button-link.js","sources":["../../../src/new-components/button-link/button-link.tsx"],"sourcesContent":["import * as React from 'react'\nimport { polymorphicComponent } from '../../utils/polymorphism'\nimport { BaseButton } from '../base-button'\nimport type { BaseButtonProps } from '../base-button'\nimport type { OpenInNewTab } from '../common-types'\n\ntype NativeLinkProps = Omit<\n JSX.IntrinsicElements['a'],\n 'aria-disabled' | 'target' | 'rel' | 'className'\n>\n\nexport type ButtonLinkProps = NativeLinkProps & BaseButtonProps & OpenInNewTab\n\n/**\n * A semantic link that looks like a button, exactly matching the `Button` component in all visual\n * aspects.\n *\n * @see Button\n */\nexport const ButtonLink = polymorphicComponent<'a', ButtonLinkProps>(function ButtonLink(\n {\n as = 'a',\n variant,\n tone = 'normal',\n size = 'normal',\n exceptionallySetClassName,\n openInNewTab = false,\n ...props\n },\n ref,\n) {\n return (\n <BaseButton\n {...props}\n as={as}\n ref={ref}\n variant={variant}\n tone={tone}\n size={size}\n exceptionallySetClassName={exceptionallySetClassName}\n target={openInNewTab ? '_blank' : undefined}\n rel={openInNewTab ? 'noopener noreferrer' : undefined}\n />\n )\n})\n"],"names":["ButtonLink","polymorphicComponent","ref","as","variant","tone","size","exceptionallySetClassName","openInNewTab","props","React","BaseButton","target","undefined","rel"],"mappings":";;;;;;AAaA;;;;;;;IAMaA,UAAU,gBAAGC,oBAAoB,CAAuB,SAASD,UAAT,OAUjEE,GAViE;qBAE7DC;MAAAA,0BAAK;MACLC,eAAAA;uBACAC;MAAAA,8BAAO;uBACPC;MAAAA,8BAAO;MACPC,iCAAAA;+BACAC;MAAAA,8CAAe;MACZC;;AAIP,sBACIC,aAAA,CAACC,UAAD,oBACQF;AACJN,IAAAA,EAAE,EAAEA;AACJD,IAAAA,GAAG,EAAEA;AACLE,IAAAA,OAAO,EAAEA;AACTC,IAAAA,IAAI,EAAEA;AACNC,IAAAA,IAAI,EAAEA;AACNC,IAAAA,yBAAyB,EAAEA;AAC3BK,IAAAA,MAAM,EAAEJ,YAAY,GAAG,QAAH,GAAcK;AAClCC,IAAAA,GAAG,EAAEN,YAAY,GAAG,qBAAH,GAA2BK;IAThD,CADJ;AAaH,CAzB6C;;;;"}
@@ -1,4 +1,4 @@
1
- var modules_949d2ff4 = {"heading":"_2f45487c","weight-light":"a20cbde9","tone-secondary":"_75f44518","tone-danger":"_3952cc59","size-largest":"b71d22ef","size-larger":"f15346e2","size-smaller":"_3cae1428","lineClampMultipleLines":"_347f6fcd","lineClamp-1":"_895c0b16","lineClamp-2":"_2e4808bd","lineClamp-3":"_1bdb7bdc","lineClamp-4":"_159943ea","lineClamp-5":"e44e008d"};
1
+ var modules_949d2ff4 = {"heading":"_71a1610c","weight-light":"_63750f40","tone-secondary":"_9ce984cf","tone-danger":"_1acad35e","size-largest":"_3da27a00","size-larger":"df220733","size-smaller":"eb373739","lineClampMultipleLines":"f53cfd2b","lineClamp-1":"e4819fc9","lineClamp-2":"a0ed6177","lineClamp-3":"_180d433e","lineClamp-4":"_40826ad9","lineClamp-5":"_5999b247"};
2
2
 
3
3
  export default modules_949d2ff4;
4
4
  //# sourceMappingURL=heading.module.css.js.map
@@ -17,7 +17,7 @@ var Inline = /*#__PURE__*/polymorphicComponent(function Inline(_ref, ref) {
17
17
  exceptionallySetClassName = _ref.exceptionallySetClassName,
18
18
  props = _objectWithoutPropertiesLoose(_ref, _excluded);
19
19
 
20
- return /*#__PURE__*/createElement(Box, null, /*#__PURE__*/createElement(Box, Object.assign({}, props, {
20
+ return /*#__PURE__*/createElement(Box, Object.assign({}, props, {
21
21
  as: as,
22
22
  display: "flex",
23
23
  flexWrap: "wrap",
@@ -29,7 +29,7 @@ var Inline = /*#__PURE__*/polymorphicComponent(function Inline(_ref, ref) {
29
29
  justifyContent: mapResponsiveProp(align, function (align) {
30
30
  return align === 'left' ? 'flexStart' : align === 'right' ? 'flexEnd' : 'center';
31
31
  })
32
- }), children));
32
+ }), children);
33
33
  });
34
34
 
35
35
  export { Inline };