@superdispatch/ui-lab 0.50.5 → 0.50.7

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 (124) hide show
  1. package/LICENSE +21 -0
  2. package/{pkg/dist-node → dist-node}/index.js +31 -23
  3. package/dist-node/index.js.map +1 -0
  4. package/{pkg/dist-src → dist-src}/navbar/Navbar.js +18 -3
  5. package/{pkg/dist-src → dist-src}/navbar/NavbarAccordion.js +9 -19
  6. package/{pkg/dist-src → dist-src}/navbar/NavbarContext.js +3 -1
  7. package/{pkg/dist-src → dist-src}/navbar/NavbarList.js +2 -1
  8. package/{pkg/dist-types → dist-types}/index.d.ts +8 -6
  9. package/{pkg/dist-web → dist-web}/index.js +31 -23
  10. package/dist-web/index.js.map +1 -0
  11. package/package.json +14 -39
  12. package/.babelrc.js +0 -5
  13. package/pkg/README.md +0 -10
  14. package/pkg/dist-node/index.js.map +0 -1
  15. package/pkg/dist-web/index.js.map +0 -1
  16. package/pkg/package.json +0 -41
  17. package/playroom.ts +0 -24
  18. package/src/alert/Alert.stories.tsx +0 -162
  19. package/src/alert/Alert.tsx +0 -135
  20. package/src/banner/Banner.stories.tsx +0 -64
  21. package/src/banner/Banner.tsx +0 -120
  22. package/src/box/Box.stories.tsx +0 -20
  23. package/src/box/Box.tsx +0 -257
  24. package/src/button/Button.stories.tsx +0 -739
  25. package/src/button/Button.tsx +0 -498
  26. package/src/button-area/ButtonArea.stories.tsx +0 -65
  27. package/src/button-area/ButtonArea.tsx +0 -90
  28. package/src/chat/Chat.stories.tsx +0 -130
  29. package/src/chat/Chat.tsx +0 -57
  30. package/src/chat/ChatMessage.tsx +0 -45
  31. package/src/chat/README.MD +0 -7
  32. package/src/chat/__tests__/Chat.spec.tsx +0 -29
  33. package/src/chat/__tests__/ChatMessage.spec.tsx +0 -39
  34. package/src/container/Container.tsx +0 -48
  35. package/src/description-item/DescriptionItem.stories.tsx +0 -163
  36. package/src/description-item/DescriptionItem.tsx +0 -104
  37. package/src/description-line-item/DescriptionLineItem.stories.tsx +0 -23
  38. package/src/description-line-item/DescriptionLineItem.tsx +0 -29
  39. package/src/email-autocomplate/CloseIcon.tsx +0 -20
  40. package/src/email-autocomplate/EmailAutocomplete.stories.tsx +0 -47
  41. package/src/email-autocomplate/EmailAutocomplete.tsx +0 -138
  42. package/src/file-drop-zone/FileDropZone.stories.tsx +0 -44
  43. package/src/file-drop-zone/FileDropZone.tsx +0 -170
  44. package/src/file-list-item/FileListItem.stories.tsx +0 -37
  45. package/src/file-list-item/FileListItem.tsx +0 -148
  46. package/src/file-list-item/__tests__/FileListItem.spec.tsx +0 -339
  47. package/src/flag-list/FlagList.stories.tsx +0 -72
  48. package/src/flag-list/FlagList.tsx +0 -54
  49. package/src/flag-list/FlagListItem.tsx +0 -126
  50. package/src/index.spec.ts +0 -53
  51. package/src/index.ts +0 -36
  52. package/src/linked-text/LinkeText.stories.tsx +0 -42
  53. package/src/linked-text/LinkedText.tsx +0 -47
  54. package/src/multiline-text/MultilineText.stories.tsx +0 -30
  55. package/src/multiline-text/MultilineText.ts +0 -16
  56. package/src/navbar/Navbar.stories.tsx +0 -137
  57. package/src/navbar/Navbar.tsx +0 -132
  58. package/src/navbar/NavbarAccordion.tsx +0 -195
  59. package/src/navbar/NavbarAvatar.tsx +0 -51
  60. package/src/navbar/NavbarBottomBar.tsx +0 -135
  61. package/src/navbar/NavbarContext.tsx +0 -22
  62. package/src/navbar/NavbarItem.tsx +0 -125
  63. package/src/navbar/NavbarList.tsx +0 -247
  64. package/src/navbar/NavbarMenu.tsx +0 -102
  65. package/src/passwordStepper/PasswordStrength.stories.tsx +0 -95
  66. package/src/passwordStepper/PasswordStrength.tsx +0 -107
  67. package/src/passwordStepper/PasswordUtils.tsx +0 -42
  68. package/src/passwordStepper/PasswordValidationComponents.tsx +0 -95
  69. package/src/sidebar/Sidebar.stories.tsx +0 -376
  70. package/src/sidebar/Sidebar.tsx +0 -75
  71. package/src/sidebar/SidebarBackButton.tsx +0 -33
  72. package/src/sidebar/SidebarContainer.tsx +0 -114
  73. package/src/sidebar/SidebarContent.tsx +0 -119
  74. package/src/sidebar/SidebarDivider.tsx +0 -15
  75. package/src/sidebar/SidebarMenuItem.tsx +0 -196
  76. package/src/sidebar/SidebarMenuItemAction.tsx +0 -27
  77. package/src/sidebar/SidebarMenuItemAvatar.tsx +0 -59
  78. package/src/sidebar/SidebarMenuItemContext.tsx +0 -33
  79. package/src/sidebar/SidebarSubheader.tsx +0 -38
  80. package/src/styled.d.ts +0 -12
  81. package/src/text-box/TextBox.stories.tsx +0 -114
  82. package/src/text-box/TextBox.tsx +0 -238
  83. package/src/utils/RuleNormalizer.ts +0 -24
  84. package/src/utils/mergeStyles.ts +0 -28
  85. package/tsconfig.json +0 -19
  86. /package/{pkg/dist-src → dist-src}/alert/Alert.js +0 -0
  87. /package/{pkg/dist-src → dist-src}/banner/Banner.js +0 -0
  88. /package/{pkg/dist-src → dist-src}/box/Box.js +0 -0
  89. /package/{pkg/dist-src → dist-src}/button/Button.js +0 -0
  90. /package/{pkg/dist-src → dist-src}/button-area/ButtonArea.js +0 -0
  91. /package/{pkg/dist-src → dist-src}/chat/Chat.js +0 -0
  92. /package/{pkg/dist-src → dist-src}/chat/ChatMessage.js +0 -0
  93. /package/{pkg/dist-src → dist-src}/container/Container.js +0 -0
  94. /package/{pkg/dist-src → dist-src}/description-item/DescriptionItem.js +0 -0
  95. /package/{pkg/dist-src → dist-src}/description-line-item/DescriptionLineItem.js +0 -0
  96. /package/{pkg/dist-src → dist-src}/email-autocomplate/CloseIcon.js +0 -0
  97. /package/{pkg/dist-src → dist-src}/email-autocomplate/EmailAutocomplete.js +0 -0
  98. /package/{pkg/dist-src → dist-src}/file-drop-zone/FileDropZone.js +0 -0
  99. /package/{pkg/dist-src → dist-src}/file-list-item/FileListItem.js +0 -0
  100. /package/{pkg/dist-src → dist-src}/flag-list/FlagList.js +0 -0
  101. /package/{pkg/dist-src → dist-src}/flag-list/FlagListItem.js +0 -0
  102. /package/{pkg/dist-src → dist-src}/index.js +0 -0
  103. /package/{pkg/dist-src → dist-src}/linked-text/LinkedText.js +0 -0
  104. /package/{pkg/dist-src → dist-src}/multiline-text/MultilineText.js +0 -0
  105. /package/{pkg/dist-src → dist-src}/navbar/NavbarAvatar.js +0 -0
  106. /package/{pkg/dist-src → dist-src}/navbar/NavbarBottomBar.js +0 -0
  107. /package/{pkg/dist-src → dist-src}/navbar/NavbarItem.js +0 -0
  108. /package/{pkg/dist-src → dist-src}/navbar/NavbarMenu.js +0 -0
  109. /package/{pkg/dist-src → dist-src}/passwordStepper/PasswordStrength.js +0 -0
  110. /package/{pkg/dist-src → dist-src}/passwordStepper/PasswordUtils.js +0 -0
  111. /package/{pkg/dist-src → dist-src}/passwordStepper/PasswordValidationComponents.js +0 -0
  112. /package/{pkg/dist-src → dist-src}/sidebar/Sidebar.js +0 -0
  113. /package/{pkg/dist-src → dist-src}/sidebar/SidebarBackButton.js +0 -0
  114. /package/{pkg/dist-src → dist-src}/sidebar/SidebarContainer.js +0 -0
  115. /package/{pkg/dist-src → dist-src}/sidebar/SidebarContent.js +0 -0
  116. /package/{pkg/dist-src → dist-src}/sidebar/SidebarDivider.js +0 -0
  117. /package/{pkg/dist-src → dist-src}/sidebar/SidebarMenuItem.js +0 -0
  118. /package/{pkg/dist-src → dist-src}/sidebar/SidebarMenuItemAction.js +0 -0
  119. /package/{pkg/dist-src → dist-src}/sidebar/SidebarMenuItemAvatar.js +0 -0
  120. /package/{pkg/dist-src → dist-src}/sidebar/SidebarMenuItemContext.js +0 -0
  121. /package/{pkg/dist-src → dist-src}/sidebar/SidebarSubheader.js +0 -0
  122. /package/{pkg/dist-src → dist-src}/text-box/TextBox.js +0 -0
  123. /package/{pkg/dist-src → dist-src}/utils/RuleNormalizer.js +0 -0
  124. /package/{pkg/dist-src → dist-src}/utils/mergeStyles.js +0 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Super Dispatch
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1341,8 +1341,10 @@ var NavbarContext = /*#__PURE__*/react.createContext({
1341
1341
  isDrawerOpen: false,
1342
1342
  isMenuExpanded: false,
1343
1343
  isNavbarExpanded: false,
1344
+ groupExpanded: {},
1344
1345
  setMenuExpanded: () => void 0,
1345
- setDrawerOpen: () => void 0
1346
+ setDrawerOpen: () => void 0,
1347
+ setGroupExpanded: () => void 0
1346
1348
  });
1347
1349
  function useNavbarContext() {
1348
1350
  return react.useContext(NavbarContext);
@@ -1485,33 +1487,23 @@ var IconWrapper$2 = /*#__PURE__*/styled__default.div.withConfig({
1485
1487
  componentId: "SD__sc-1s7g3kw-3"
1486
1488
  })(["width:24px;margin-right:8px;& svg{font-size:24px;}"]);
1487
1489
  function NavbarAccordion(_ref2) {
1490
+ var _groupExpanded$groupK;
1488
1491
  var {
1489
1492
  label,
1490
1493
  icon,
1491
1494
  gutter,
1492
1495
  items,
1493
1496
  onClick: _onClick,
1494
- isExpanded: controlledIsExpanded,
1495
- onExpandedChange
1497
+ groupKey
1496
1498
  } = _ref2;
1497
1499
  var uid = ui.useUID();
1498
1500
  var {
1499
1501
  setDrawerOpen,
1500
- isNavbarExpanded
1502
+ isNavbarExpanded,
1503
+ groupExpanded,
1504
+ setGroupExpanded
1501
1505
  } = useNavbarContext();
1502
- var [internalIsExpanded, setInternalExpanded] = react.useState(true);
1503
- react.useEffect(() => {
1504
- if (controlledIsExpanded === undefined) {
1505
- setInternalExpanded(isNavbarExpanded);
1506
- }
1507
- }, [isNavbarExpanded, controlledIsExpanded]);
1508
- var isExpanded = controlledIsExpanded !== undefined ? controlledIsExpanded : internalIsExpanded;
1509
- function setExpanded(value) {
1510
- if (controlledIsExpanded === undefined) {
1511
- setInternalExpanded(value);
1512
- }
1513
- onExpandedChange === null || onExpandedChange === void 0 || onExpandedChange(value);
1514
- }
1506
+ var isExpanded = (_groupExpanded$groupK = groupExpanded[groupKey]) !== null && _groupExpanded$groupK !== void 0 ? _groupExpanded$groupK : true;
1515
1507
  var filteredItems = react.useMemo(() => items.filter(item => !item.hide), [items]);
1516
1508
  return /*#__PURE__*/jsxRuntime.jsxs(NavbarAccordionRoot, {
1517
1509
  square: true,
@@ -1520,8 +1512,8 @@ function NavbarAccordion(_ref2) {
1520
1512
  expanded: isExpanded,
1521
1513
  onClick: event => {
1522
1514
  _onClick === null || _onClick === void 0 || _onClick(event);
1523
- if (controlledIsExpanded !== undefined || isNavbarExpanded) {
1524
- setExpanded(!isExpanded);
1515
+ if (isNavbarExpanded) {
1516
+ setGroupExpanded(groupKey, !isExpanded);
1525
1517
  }
1526
1518
  },
1527
1519
  children: [/*#__PURE__*/jsxRuntime.jsxs(NavbarAccordionSummary, {
@@ -1665,7 +1657,8 @@ function NavbarList(_ref6) {
1665
1657
  return /*#__PURE__*/react.createElement(NavbarAccordion, _objectSpread(_objectSpread({}, item), {}, {
1666
1658
  key: item.key,
1667
1659
  gutter: prev && prev.groupKey !== item.groupKey,
1668
- onClick: item.onClick
1660
+ onClick: item.onClick,
1661
+ groupKey: item.groupKey || item.key
1669
1662
  }));
1670
1663
  }
1671
1664
  return /*#__PURE__*/react.createElement(NavbarItem, _objectSpread(_objectSpread({}, item), {}, {
@@ -1703,8 +1696,10 @@ function Navbar(_ref) {
1703
1696
  children,
1704
1697
  containerStyle,
1705
1698
  hasExtraBadge,
1699
+ groupExpanded: controlledGroupExpanded,
1706
1700
  isMenuExpanded: controlledIsMenuExpanded,
1707
- onMenuExpandedChange
1701
+ onMenuExpandedChange,
1702
+ onGroupExpandedChange
1708
1703
  } = _ref;
1709
1704
  var theme = core.useTheme();
1710
1705
  var [isDrawerOpen, setDrawerOpen] = react.useState(false);
@@ -1714,6 +1709,8 @@ function Navbar(_ref) {
1714
1709
  noSsr: true
1715
1710
  });
1716
1711
  var [internalIsMenuExpanded, setInternalMenuExpanded] = react.useState(matches);
1712
+ var [groupExpandedState, setGroupExpandedState] = react.useState(controlledGroupExpanded || {});
1713
+ var groupExpanded = controlledGroupExpanded ? controlledGroupExpanded : groupExpandedState;
1717
1714
  var isMenuExpanded = controlledIsMenuExpanded !== undefined ? controlledIsMenuExpanded : internalIsMenuExpanded;
1718
1715
  var setMenuExpanded = react.useCallback(value => {
1719
1716
  if (controlledIsMenuExpanded === undefined) {
@@ -1721,14 +1718,25 @@ function Navbar(_ref) {
1721
1718
  }
1722
1719
  onMenuExpandedChange === null || onMenuExpandedChange === void 0 || onMenuExpandedChange(value);
1723
1720
  }, [controlledIsMenuExpanded, onMenuExpandedChange]);
1721
+ var setGroupExpanded = react.useCallback((groupKey, isExpanded) => {
1722
+ var updatedGroupExpanded = _objectSpread(_objectSpread({}, groupExpanded), {}, {
1723
+ [groupKey]: isExpanded
1724
+ });
1725
+ if (!controlledGroupExpanded) {
1726
+ setGroupExpandedState(updatedGroupExpanded);
1727
+ }
1728
+ onGroupExpandedChange === null || onGroupExpandedChange === void 0 || onGroupExpandedChange(updatedGroupExpanded);
1729
+ }, [controlledGroupExpanded, groupExpanded, onGroupExpandedChange]);
1724
1730
  var hasBadge = hasExtraBadge || items.some(item => item.badge);
1725
1731
  var ctx = react.useMemo(() => ({
1726
1732
  isDrawerOpen,
1727
1733
  isMenuExpanded,
1728
1734
  setDrawerOpen,
1729
1735
  setMenuExpanded,
1730
- isNavbarExpanded: isMenuExpanded || isDrawerOpen
1731
- }), [isDrawerOpen, isMenuExpanded, setDrawerOpen, setMenuExpanded]);
1736
+ isNavbarExpanded: isMenuExpanded || isDrawerOpen,
1737
+ setGroupExpanded,
1738
+ groupExpanded
1739
+ }), [isDrawerOpen, isMenuExpanded, setMenuExpanded, setGroupExpanded, groupExpanded]);
1732
1740
  return /*#__PURE__*/jsxRuntime.jsx(NavbarContext.Provider, {
1733
1741
  value: ctx,
1734
1742
  children: /*#__PURE__*/jsxRuntime.jsxs("div", {