@basic-ui/material 0.1.11 → 0.1.14

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 (121) hide show
  1. package/build/cjs/index.js +33 -28
  2. package/build/cjs/index.js.map +1 -1
  3. package/build/esm/Alert/Alert.d.ts +1 -1
  4. package/build/esm/AppBar/AppBar.d.ts +1 -1
  5. package/build/esm/AppBar/AppBarButton.d.ts +1 -1
  6. package/build/esm/Badge/Badge.d.ts +1 -1
  7. package/build/esm/BottomSheet/BottomSheet.d.ts +1 -1
  8. package/build/esm/BottomSheet/BottomSheetSurface.d.ts +1 -1
  9. package/build/esm/Button/BaseButton.d.ts +1 -1
  10. package/build/esm/Button/Button.d.ts +1 -1
  11. package/build/esm/Button/FilledButton.d.ts +1 -1
  12. package/build/esm/Button/FloatingActionButton.d.ts +7 -0
  13. package/build/esm/Button/FloatingActionButton.js +8 -0
  14. package/build/esm/Button/FloatingActionButton.js.map +1 -0
  15. package/build/esm/Button/OutlinedButton.d.ts +1 -1
  16. package/build/esm/Button/TransparentButton.d.ts +1 -1
  17. package/build/esm/CheckBox/CheckBox.d.ts +1 -1
  18. package/build/esm/CheckBox/CheckBoxIcon.d.ts +1 -1
  19. package/build/esm/Chip/ButtonChip.d.ts +1 -1
  20. package/build/esm/Chip/ChoiceChip.d.ts +1 -1
  21. package/build/esm/ColorMode/ColorModeProvider.js +10 -3
  22. package/build/esm/ColorMode/ColorModeProvider.js.map +1 -1
  23. package/build/esm/Combobox/Combobox.d.ts +7 -7
  24. package/build/esm/Dialog/Dialog.d.ts +1 -1
  25. package/build/esm/Dialog/DialogBackdrop.d.ts +1 -1
  26. package/build/esm/Dialog/DialogSurface.d.ts +1 -1
  27. package/build/esm/Dialog/useDialogAnimation.js +1 -1
  28. package/build/esm/Dialog/useDialogAnimation.js.map +1 -1
  29. package/build/esm/Divider/Divider.d.ts +1 -1
  30. package/build/esm/LineRipple/LineRipple.d.ts +1 -1
  31. package/build/esm/Link/Link.d.ts +1 -1
  32. package/build/esm/List/List.d.ts +1 -1
  33. package/build/esm/ListItem/ListItem.d.ts +1 -1
  34. package/build/esm/Menu/Menu.d.ts +4 -4
  35. package/build/esm/Paper/Paper.d.ts +1 -1
  36. package/build/esm/RadioButton/RadioGroup.d.ts +1 -1
  37. package/build/esm/Ripple/keyframes.js +0 -2
  38. package/build/esm/Ripple/keyframes.js.map +1 -1
  39. package/build/esm/Ripple/useRipple.js +1 -1
  40. package/build/esm/Ripple/useRipple.js.map +1 -1
  41. package/build/esm/Select/SelectIcon.d.ts +1 -1
  42. package/build/esm/SelectItem/SelectItem.d.ts +1 -1
  43. package/build/esm/SelectionControl/SelectionControlLabel.d.ts +1 -1
  44. package/build/esm/SelectionControl/SelectionControlText.d.ts +1 -1
  45. package/build/esm/Skeleton/DelayAppearance.d.ts +1 -1
  46. package/build/esm/Skeleton/Skeleton.d.ts +1 -1
  47. package/build/esm/Snackbar/Snackbar.d.ts +1 -1
  48. package/build/esm/Switch/Switch.d.ts +1 -1
  49. package/build/esm/Tab/Tab.d.ts +1 -1
  50. package/build/esm/Tab/TabList.d.ts +1 -1
  51. package/build/esm/Tab/TabPanel.d.ts +1 -1
  52. package/build/esm/TabIndicator/TabIndicator.d.ts +1 -1
  53. package/build/esm/Table/Table.d.ts +1 -1
  54. package/build/esm/Table/TableHead.d.ts +1 -1
  55. package/build/esm/Table/TableRow.d.ts +1 -1
  56. package/build/esm/Text/Text.d.ts +1 -1
  57. package/build/esm/TextField/FilledContainer.d.ts +1 -1
  58. package/build/esm/TextField/HelperText.d.ts +1 -1
  59. package/build/esm/TextField/Input.d.ts +1 -1
  60. package/build/esm/TextField/OutlinedContainer.d.ts +1 -1
  61. package/build/esm/TextField/TextField.d.ts +1 -1
  62. package/build/esm/ThemeExplorer/ColorPicker.d.ts +8 -0
  63. package/build/esm/ThemeExplorer/ColorPicker.js +76 -0
  64. package/build/esm/ThemeExplorer/ColorPicker.js.map +1 -0
  65. package/build/esm/ThemeExplorer/TextFieldColorPicker.d.ts +9 -0
  66. package/build/esm/ThemeExplorer/TextFieldColorPicker.js +100 -0
  67. package/build/esm/ThemeExplorer/TextFieldColorPicker.js.map +1 -0
  68. package/build/esm/ThemeExplorer/ThemeColors.d.ts +5 -0
  69. package/build/esm/ThemeExplorer/ThemeColors.js +80 -0
  70. package/build/esm/ThemeExplorer/ThemeColors.js.map +1 -0
  71. package/build/esm/ThemeExplorer/components.d.ts +31 -0
  72. package/build/esm/ThemeExplorer/components.js +184 -0
  73. package/build/esm/ThemeExplorer/components.js.map +1 -0
  74. package/build/esm/ThemeExplorer/makeColorScheme.d.ts +66 -0
  75. package/build/esm/ThemeExplorer/makeColorScheme.js +66 -0
  76. package/build/esm/ThemeExplorer/makeColorScheme.js.map +1 -0
  77. package/build/esm/ThemeExplorer/useDeferredColor.d.ts +3 -0
  78. package/build/esm/ThemeExplorer/useDeferredColor.js +11 -0
  79. package/build/esm/ThemeExplorer/useDeferredColor.js.map +1 -0
  80. package/build/esm/ThemeExplorer/useLocalStorageCachedState.d.ts +1 -0
  81. package/build/esm/ThemeExplorer/useLocalStorageCachedState.js +11 -0
  82. package/build/esm/ThemeExplorer/useLocalStorageCachedState.js.map +1 -0
  83. package/build/esm/Tooltip/Tooltip.d.ts +1 -1
  84. package/build/esm/hooks/useAnimation.js +22 -21
  85. package/build/esm/hooks/useAnimation.js.map +1 -1
  86. package/build/tsconfig.tsbuildinfo +54 -54
  87. package/package.json +3 -3
  88. package/src/Alert/Alert.story.tsx +5 -6
  89. package/src/AppBar/AppBar.story.tsx +11 -20
  90. package/src/BottomSheet/BottomSheet.story.tsx +5 -6
  91. package/src/Button/Button.story.tsx +14 -14
  92. package/src/Button/SpinnerButton.story.tsx +6 -6
  93. package/src/CheckBox/CheckBox.story.tsx +7 -6
  94. package/src/Chip/Chip.story.tsx +5 -7
  95. package/src/ColorMode/ColorModeProvider.tsx +9 -3
  96. package/src/Combobox/Combobox.story.tsx +12 -10
  97. package/src/Dialog/Dialog.story.tsx +7 -8
  98. package/src/Dialog/useDialogAnimation.tsx +1 -1
  99. package/src/Divider/Divider.story.tsx +6 -5
  100. package/src/FloatingLabel/FloatingLabel.story.tsx +10 -9
  101. package/src/LineRipple/LineRipple.story.tsx +5 -4
  102. package/src/Link/Link.story.tsx +3 -4
  103. package/src/ListItem/ListItem.story.tsx +6 -5
  104. package/src/Menu/Menu.story.tsx +8 -7
  105. package/src/NotchedOutline/NotchedOutline.story.tsx +5 -4
  106. package/src/Paper/Paper.story.tsx +5 -4
  107. package/src/ProgressSpinner/ProgressSpinner.story.tsx +5 -4
  108. package/src/RadioButton/RadioButton.story.tsx +12 -10
  109. package/src/Ripple/Ripple.story.tsx +5 -4
  110. package/src/Ripple/keyframes.ts +0 -2
  111. package/src/Ripple/useRipple.ts +3 -1
  112. package/src/Select/Select.story.tsx +8 -7
  113. package/src/Skeleton/Skeleton.story.tsx +7 -6
  114. package/src/Snackbar/Snackbar.story.tsx +7 -6
  115. package/src/Switch/Switch.story.tsx +5 -4
  116. package/src/Tab/Tab.story.tsx +7 -5
  117. package/src/Table/Table.story.tsx +5 -4
  118. package/src/Text/Text.story.tsx +5 -4
  119. package/src/TextField/TextField.story.tsx +7 -6
  120. package/src/Tooltip/Tooltip.story.tsx +5 -4
  121. package/src/hooks/useAnimation.ts +42 -32
@@ -560,16 +560,22 @@ const ColorModeProvider = props => {
560
560
  }, [setColorMode]);
561
561
  const globalStyles = react$1.useMemo(() => {
562
562
  const ret = {
563
- body: styles['default'] || {}
563
+ body: _extends__default['default']({
564
+ colorScheme: 'light'
565
+ }, styles['default'] || {})
564
566
  };
565
- ret[`.${DEFAULT_THEME_CLASS}`] = styles['default'] || {};
567
+ ret[`.${DEFAULT_THEME_CLASS}`] = _extends__default['default']({
568
+ colorScheme: 'light'
569
+ }, styles['default'] || {});
566
570
 
567
571
  for (const key in styles) {
568
572
  if (key === 'default') {
569
573
  continue;
570
574
  }
571
575
 
572
- ret[`.${DARK_THEME_CLASS}`] = styles[key];
576
+ ret[`.${DARK_THEME_CLASS}`] = _extends__default['default']({
577
+ colorScheme: 'dark'
578
+ }, styles[key]);
573
579
  }
574
580
 
575
581
  return ret;
@@ -930,11 +936,9 @@ const opacityIn = react.keyframes({
930
936
  });
931
937
  const opacityOut = react.keyframes({
932
938
  from: {
933
- transform: `translate(var(${RIPPLE_TRANSLATE_END}, 0)) scale(var(${RIPPLE_SCALE_END}, 1))`,
934
939
  opacity: `var(${RIPPLE_OPACITY_END})`
935
940
  },
936
941
  to: {
937
- transform: `translate(var(${RIPPLE_TRANSLATE_END}, 0)) scale(var(${RIPPLE_SCALE_END}, 1))`,
938
942
  opacity: '0'
939
943
  }
940
944
  });
@@ -1063,7 +1067,7 @@ const useRipple = opts => {
1063
1067
  break;
1064
1068
 
1065
1069
  case 'leaving':
1066
- animation = `${opacityOut} ${leaveDuration}ms forwards`;
1070
+ animation = `${radiusIn} ${enterDuration}ms forwards,` + `${opacityOut} ${leaveDuration}ms forwards`;
1067
1071
  break;
1068
1072
  }
1069
1073
 
@@ -1600,45 +1604,46 @@ function useAnimation(opts) {
1600
1604
  open: openProp
1601
1605
  });
1602
1606
  const handleClose = react$1.useCallback(() => {
1603
- setAnimation(animation => _extends__default['default']({}, animation, {
1607
+ setAnimation(animation => animation.state === 'closed' ? animation : _extends__default['default']({}, animation, {
1604
1608
  state: 'close',
1605
1609
  style: animationStyle.close || animationStyle.closed,
1606
1610
  timing: closeTimeoutInMilliseconds
1607
1611
  }));
1608
- return setTimeout(() => {
1609
- setAnimation({
1610
- state: 'closed',
1611
- style: animationStyle.closed,
1612
- open: false,
1613
- timing: closeTimeoutInMilliseconds
1614
- });
1615
- }, closeTimeoutInMilliseconds);
1616
1612
  }, [animationStyle, closeTimeoutInMilliseconds]);
1617
1613
  const handleOpen = react$1.useCallback(() => {
1618
- setAnimation(animation => _extends__default['default']({}, animation, {
1614
+ setAnimation(animation => animation.state === 'open' ? animation : _extends__default['default']({}, animation, {
1619
1615
  open: true,
1620
1616
  state: 'opening',
1621
1617
  style: animationStyle.opening || animationStyle.closed
1622
1618
  }));
1623
- return requestAnimationFrame(() => {
1619
+ }, [animationStyle]);
1620
+ react$1.useEffect(() => {
1621
+ if (state === 'opening') {
1624
1622
  setAnimation(animation => _extends__default['default']({}, animation, {
1625
1623
  state: 'open',
1626
1624
  style: animationStyle.open,
1627
1625
  timing: openTimeoutInMilliseconds
1628
1626
  }));
1629
- });
1630
- }, [animationStyle, openTimeoutInMilliseconds]);
1627
+ }
1628
+ }, [animationStyle.open, openTimeoutInMilliseconds, state]);
1629
+ react$1.useEffect(() => {
1630
+ if (state === 'close') {
1631
+ const timeout = setTimeout(() => {
1632
+ setAnimation({
1633
+ state: 'closed',
1634
+ style: animationStyle.closed,
1635
+ open: false,
1636
+ timing: closeTimeoutInMilliseconds
1637
+ });
1638
+ }, closeTimeoutInMilliseconds);
1639
+ return () => clearTimeout(timeout);
1640
+ }
1641
+ }, [animationStyle.closed, closeTimeoutInMilliseconds, state]);
1631
1642
  react$1.useEffect(() => {
1632
1643
  if (openProp) {
1633
- const frameHandler = handleOpen();
1634
- return () => {
1635
- cancelAnimationFrame(frameHandler);
1636
- };
1644
+ handleOpen();
1637
1645
  } else {
1638
- const timeoutHandler = handleClose();
1639
- return () => {
1640
- clearTimeout(timeoutHandler);
1641
- };
1646
+ handleClose();
1642
1647
  }
1643
1648
  }, [handleClose, handleOpen, openProp]);
1644
1649
  return {
@@ -1661,7 +1666,7 @@ const styles = {
1661
1666
  },
1662
1667
  close: {
1663
1668
  opacity: 0,
1664
- transform: 'translateY(100%)'
1669
+ transform: 'translateY(10%)'
1665
1670
  }
1666
1671
  },
1667
1672
  grow: {