@helpdice/ui 1.8.4 → 2.0.5

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 (113) hide show
  1. package/dist/CurrencyInput/components/CurrencyInput.d.ts +4 -0
  2. package/dist/CurrencyInput/components/CurrencyInputProps.d.ts +160 -0
  3. package/dist/CurrencyInput/components/utils/cleanValue.d.ts +8 -0
  4. package/dist/CurrencyInput/components/utils/escapeRegExp.d.ts +6 -0
  5. package/dist/CurrencyInput/components/utils/fixedDecimalValue.d.ts +1 -0
  6. package/dist/CurrencyInput/components/utils/formatValue.d.ts +49 -0
  7. package/dist/CurrencyInput/components/utils/getLocaleConfig.d.ts +13 -0
  8. package/dist/CurrencyInput/components/utils/getSuffix.d.ts +6 -0
  9. package/dist/CurrencyInput/components/utils/index.d.ts +8 -0
  10. package/dist/CurrencyInput/components/utils/isNumber.d.ts +1 -0
  11. package/dist/CurrencyInput/components/utils/padTrimValue.d.ts +1 -0
  12. package/dist/CurrencyInput/components/utils/parseAbbrValue.d.ts +10 -0
  13. package/dist/CurrencyInput/components/utils/removeInvalidChars.d.ts +4 -0
  14. package/dist/CurrencyInput/components/utils/removeSeparators.d.ts +4 -0
  15. package/dist/CurrencyInput/components/utils/repositionCursor.d.ts +16 -0
  16. package/dist/CurrencyInput/index.d.ts +5 -0
  17. package/dist/CurrencyInput/index.js +3 -2122
  18. package/dist/ITooltip/index.d.ts +13 -0
  19. package/dist/Loadable/index.js +29 -3
  20. package/dist/PhoneInput/index.js +21 -2140
  21. package/dist/Placeholder/index.js +5 -2124
  22. package/dist/auto-complete/index.js +73 -12092
  23. package/dist/avatar/index.js +15 -2134
  24. package/dist/badge/index.js +8 -2127
  25. package/dist/breadcrumbs/index.js +19 -2138
  26. package/dist/button/index.js +36 -2229
  27. package/dist/button-dropdown/index.js +28 -2147
  28. package/dist/button-group/index.js +9 -2128
  29. package/dist/capacity/index.js +10 -2129
  30. package/dist/card/index.js +46 -2165
  31. package/dist/carousal/index.js +644 -12666
  32. package/dist/checkbox/index.js +10 -2129
  33. package/dist/code/index.js +14 -2133
  34. package/dist/collapse/index.js +16 -2135
  35. package/dist/description/index.js +9 -2128
  36. package/dist/display/index.js +11 -2130
  37. package/dist/divider/index.js +12 -2131
  38. package/dist/dot/index.js +6 -2125
  39. package/dist/drawer/index.js +21 -2139
  40. package/dist/fieldset/index.js +22 -2141
  41. package/dist/grid/index.js +8 -2127
  42. package/dist/image/index.js +31 -2150
  43. package/dist/index.d.ts +4 -0
  44. package/dist/index.js +2065 -23539
  45. package/dist/input/index.js +42 -2158
  46. package/dist/keyboard/index.js +11 -2130
  47. package/dist/link/index.js +11 -2130
  48. package/dist/list/index.js +25 -2143
  49. package/dist/list/list-item.d.ts +1 -0
  50. package/dist/loading/index.js +14 -2133
  51. package/dist/menu/index.js +2 -10245
  52. package/dist/modal/index.js +59 -2177
  53. package/dist/note/index.js +10 -2129
  54. package/dist/page/index.js +6 -2125
  55. package/dist/pagination/index.js +11 -2130
  56. package/dist/popover/index.js +23 -2141
  57. package/dist/progress/index.js +10 -2129
  58. package/dist/radio/index.js +17 -2136
  59. package/dist/rating/index.js +7 -2126
  60. package/dist/row/index.js +5 -2124
  61. package/dist/select/index.js +54 -2173
  62. package/dist/slider/index.js +21 -2140
  63. package/dist/snippet/index.js +12 -2131
  64. package/dist/spacer/index.js +2 -2121
  65. package/dist/spinner/index.js +5 -2124
  66. package/dist/table/index.js +910 -12918
  67. package/dist/tabs/index.js +16 -2135
  68. package/dist/tag/index.js +5 -2124
  69. package/dist/text/index.js +5 -2124
  70. package/dist/textarea/index.js +10 -2129
  71. package/dist/toggle/index.js +14 -2133
  72. package/dist/tooltip/index.js +17 -2135
  73. package/dist/tree/index.js +39 -2158
  74. package/dist/use-input/index.js +2 -2122
  75. package/dist/use-modal/index.js +2 -2122
  76. package/dist/use-scale/index.js +2 -2121
  77. package/dist/use-tabs/index.js +2 -2122
  78. package/dist/user/index.js +31 -2150
  79. package/esm/CurrencyInput/components/CurrencyInput.d.ts +4 -0
  80. package/esm/CurrencyInput/components/CurrencyInputProps.d.ts +160 -0
  81. package/esm/CurrencyInput/components/utils/cleanValue.d.ts +8 -0
  82. package/esm/CurrencyInput/components/utils/escapeRegExp.d.ts +6 -0
  83. package/esm/CurrencyInput/components/utils/fixedDecimalValue.d.ts +1 -0
  84. package/esm/CurrencyInput/components/utils/formatValue.d.ts +49 -0
  85. package/esm/CurrencyInput/components/utils/getLocaleConfig.d.ts +13 -0
  86. package/esm/CurrencyInput/components/utils/getSuffix.d.ts +6 -0
  87. package/esm/CurrencyInput/components/utils/index.d.ts +8 -0
  88. package/esm/CurrencyInput/components/utils/isNumber.d.ts +1 -0
  89. package/esm/CurrencyInput/components/utils/padTrimValue.d.ts +1 -0
  90. package/esm/CurrencyInput/components/utils/parseAbbrValue.d.ts +10 -0
  91. package/esm/CurrencyInput/components/utils/removeInvalidChars.d.ts +4 -0
  92. package/esm/CurrencyInput/components/utils/removeSeparators.d.ts +4 -0
  93. package/esm/CurrencyInput/components/utils/repositionCursor.d.ts +16 -0
  94. package/esm/CurrencyInput/index.d.ts +5 -0
  95. package/esm/ITooltip/index.d.ts +13 -0
  96. package/esm/ITooltip/index.js +97 -0
  97. package/esm/Loadable/loader.js +13 -0
  98. package/esm/button/button.compact.js +13 -86
  99. package/esm/index.d.ts +4 -0
  100. package/esm/index.js +4 -1
  101. package/esm/input/input.js +13 -10
  102. package/esm/link/link.js +3 -3
  103. package/esm/list/list-item.d.ts +1 -0
  104. package/esm/list/list-item.js +4 -2
  105. package/esm/login-with/LoginSocialAmazon/index.js +1 -1
  106. package/esm/login-with/LoginSocialApple/index.js +1 -1
  107. package/esm/login-with/LoginSocialFacebook/index.js +1 -1
  108. package/esm/login-with/LoginSocialGoogle/index.js +1 -1
  109. package/esm/table/table-body.js +14 -4
  110. package/esm/table/table-cell.js +1 -1
  111. package/esm/table/table-head.js +13 -13
  112. package/esm/table/table.js +8 -8
  113. package/package.json +5 -5
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
- var require$$1 = require('react-dom');
6
+ var theme = require('@helpdice/theme');
7
7
 
8
8
  function _arrayLikeToArray(r, a) {
9
9
  (null == a || a > r.length) && (a = r.length);
@@ -686,2132 +686,13 @@ function requireStyle () {
686
686
  var styleExports = requireStyle();
687
687
  var _JSXStyle = /*@__PURE__*/getDefaultExportFromCjs(styleExports);
688
688
 
689
- var dist = {};
690
-
691
- var hasRequiredDist;
692
-
693
- function requireDist () {
694
- if (hasRequiredDist) return dist;
695
- hasRequiredDist = 1;
696
-
697
- var React$1 = React;
698
- var reactDom = require$$1;
699
-
700
- function _arrayLikeToArray(r, a) {
701
- (null == a || a > r.length) && (a = r.length);
702
- for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
703
- return n;
704
- }
705
- function _arrayWithHoles(r) {
706
- if (Array.isArray(r)) return r;
707
- }
708
- function _arrayWithoutHoles(r) {
709
- if (Array.isArray(r)) return _arrayLikeToArray(r);
710
- }
711
- function _defineProperty(e, r, t) {
712
- return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
713
- value: t,
714
- enumerable: true,
715
- configurable: true,
716
- writable: true
717
- }) : e[r] = t, e;
718
- }
719
- function _extends() {
720
- return _extends = Object.assign ? Object.assign.bind() : function (n) {
721
- for (var e = 1; e < arguments.length; e++) {
722
- var t = arguments[e];
723
- for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
724
- }
725
- return n;
726
- }, _extends.apply(null, arguments);
727
- }
728
- function _iterableToArray(r) {
729
- if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
730
- }
731
- function _iterableToArrayLimit(r, l) {
732
- var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
733
- if (null != t) {
734
- var e,
735
- n,
736
- i,
737
- u,
738
- a = [],
739
- f = true,
740
- o = false;
741
- try {
742
- if (i = (t = t.call(r)).next, 0 === l) {
743
- if (Object(t) !== t) return;
744
- f = !1;
745
- } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
746
- } catch (r) {
747
- o = true, n = r;
748
- } finally {
749
- try {
750
- if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
751
- } finally {
752
- if (o) throw n;
753
- }
754
- }
755
- return a;
756
- }
757
- }
758
- function _nonIterableRest() {
759
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
760
- }
761
- function _nonIterableSpread() {
762
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
763
- }
764
- function ownKeys(e, r) {
765
- var t = Object.keys(e);
766
- if (Object.getOwnPropertySymbols) {
767
- var o = Object.getOwnPropertySymbols(e);
768
- r && (o = o.filter(function (r) {
769
- return Object.getOwnPropertyDescriptor(e, r).enumerable;
770
- })), t.push.apply(t, o);
771
- }
772
- return t;
773
- }
774
- function _objectSpread2(e) {
775
- for (var r = 1; r < arguments.length; r++) {
776
- var t = null != arguments[r] ? arguments[r] : {};
777
- r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
778
- _defineProperty(e, r, t[r]);
779
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
780
- Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
781
- });
782
- }
783
- return e;
784
- }
785
- function _objectWithoutProperties(e, t) {
786
- if (null == e) return {};
787
- var o,
788
- r,
789
- i = _objectWithoutPropertiesLoose(e, t);
790
- if (Object.getOwnPropertySymbols) {
791
- var n = Object.getOwnPropertySymbols(e);
792
- for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
793
- }
794
- return i;
795
- }
796
- function _objectWithoutPropertiesLoose(r, e) {
797
- if (null == r) return {};
798
- var t = {};
799
- for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
800
- if (-1 !== e.indexOf(n)) continue;
801
- t[n] = r[n];
802
- }
803
- return t;
804
- }
805
- function _slicedToArray(r, e) {
806
- return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
807
- }
808
- function _toConsumableArray(r) {
809
- return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
810
- }
811
- function _toPrimitive(t, r) {
812
- if ("object" != typeof t || !t) return t;
813
- var e = t[Symbol.toPrimitive];
814
- if (void 0 !== e) {
815
- var i = e.call(t, r);
816
- if ("object" != typeof i) return i;
817
- throw new TypeError("@@toPrimitive must return a primitive value.");
818
- }
819
- return ("string" === r ? String : Number)(t);
820
- }
821
- function _toPropertyKey(t) {
822
- var i = _toPrimitive(t, "string");
823
- return "symbol" == typeof i ? i : i + "";
824
- }
825
- function _typeof(o) {
826
- "@babel/helpers - typeof";
827
-
828
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
829
- return typeof o;
830
- } : function (o) {
831
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
832
- }, _typeof(o);
833
- }
834
- function _unsupportedIterableToArray(r, a) {
835
- if (r) {
836
- if ("string" == typeof r) return _arrayLikeToArray(r, a);
837
- var t = {}.toString.call(r).slice(8, -1);
838
- return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
839
- }
840
- }
841
-
842
- var defaultToastLayout = {
843
- padding: '12px 16px',
844
- margin: '8px 0',
845
- width: '420px',
846
- maxWidth: '90vw',
847
- maxHeight: '75px',
848
- placement: 'bottomRight'
849
- };
850
- var defaultParams = {
851
- toasts: [],
852
- toastLayout: defaultToastLayout,
853
- updateToastLayout: function updateToastLayout(t) {
854
- return t;
855
- },
856
- updateToasts: function updateToasts(t) {
857
- return t;
858
- },
859
- lastUpdateToastId: null,
860
- updateLastToastId: function updateLastToastId() {
861
- return null;
862
- }
863
- };
864
- var HUIContent = /*#__PURE__*/React$1.createContext(defaultParams);
865
- var useHUIContext = function useHUIContext() {
866
- return React$1.useContext(HUIContent);
867
- };
868
-
869
- var defaultFont = {
870
- sans: '"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif',
871
- mono: 'Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace',
872
- prism: 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,"Liberation Mono", "Courier New", monospace'
873
- };
874
- var defaultBreakpoints = {
875
- xs: {
876
- min: '0',
877
- max: '650px'
878
- },
879
- sm: {
880
- min: '650px',
881
- max: '900px'
882
- },
883
- md: {
884
- min: '900px',
885
- max: '1280px'
886
- },
887
- lg: {
888
- min: '1280px',
889
- max: '1920px'
890
- },
891
- xl: {
892
- min: '1920px',
893
- max: '10000px'
894
- }
895
- };
896
- var defaultLayout = {
897
- gap: '16pt',
898
- gapNegative: '-16pt',
899
- gapHalf: '8pt',
900
- gapHalfNegative: '-8pt',
901
- gapQuarter: '4pt',
902
- gapQuarterNegative: '-4pt',
903
- pageMargin: '16pt',
904
- pageWidth: '750pt',
905
- pageWidthWithMargin: '782pt',
906
- breakpointMobile: defaultBreakpoints.xs.max,
907
- breakpointTablet: defaultBreakpoints.sm.max,
908
- radius: '6px',
909
- unit: '16px'
910
- };
911
-
912
- var palette$1 = {
913
- accents_1: '#fafafa',
914
- accents_2: '#eaeaea',
915
- accents_3: '#999',
916
- accents_4: '#888',
917
- accents_5: '#666',
918
- accents_6: '#444',
919
- accents_7: '#333',
920
- accents_8: '#111',
921
- background: '#fff',
922
- foreground: '#000',
923
- selection: '#79ffe1',
924
- secondary: '#666',
925
- code: '#f81ce5',
926
- border: '#eaeaea',
927
- error: '#e00',
928
- errorLight: '#ff1a1a',
929
- errorLighter: '#f7d4d6',
930
- errorDark: '#c50000',
931
- success: '#0070f3',
932
- successLight: '#3291ff',
933
- successLighter: '#d3e5ff',
934
- successDark: '#0761d1',
935
- warning: '#f5a623',
936
- warningLight: '#f7b955',
937
- warningLighter: '#ffefcf',
938
- warningDark: '#ab570a',
939
- cyan: '#50e3c2',
940
- cyanLighter: '#aaffec',
941
- cyanLight: '#79ffe1',
942
- cyanDark: '#29bc9b',
943
- violet: '#7928ca',
944
- violetLighter: '#e3d7fc',
945
- violetLight: '#8a63d2',
946
- violetDark: '#4c2889',
947
- purple: '#f81ce5',
948
- alert: '#ff0080',
949
- magenta: '#eb367f',
950
- link: '#0070f3'
951
- };
952
- var expressiveness$1 = {
953
- linkStyle: 'none',
954
- linkHoverStyle: 'none',
955
- dropdownBoxShadow: '0 4px 4px 0 rgba(0, 0, 0, 0.02)',
956
- scrollerStart: 'rgba(255, 255, 255, 1)',
957
- scrollerEnd: 'rgba(255, 255, 255, 0)',
958
- shadowSmall: '0 5px 10px rgba(0, 0, 0, 0.12)',
959
- shadowMedium: '0 8px 30px rgba(0, 0, 0, 0.12)',
960
- shadowLarge: '0 30px 60px rgba(0, 0, 0, 0.12)',
961
- portalOpacity: 0.25
962
- };
963
- var font$1 = defaultFont;
964
- var breakpoints$1 = defaultBreakpoints;
965
- var layout$1 = defaultLayout;
966
- var themes$1 = {
967
- type: 'light',
968
- font: font$1,
969
- layout: layout$1,
970
- palette: palette$1,
971
- breakpoints: breakpoints$1,
972
- expressiveness: expressiveness$1
973
- };
974
-
975
- var palette = {
976
- accents_1: '#111',
977
- accents_2: '#333',
978
- accents_3: '#444',
979
- accents_4: '#666',
980
- accents_5: '#888',
981
- accents_6: '#999',
982
- accents_7: '#eaeaea',
983
- accents_8: '#fafafa',
984
- background: '#000',
985
- foreground: '#fff',
986
- selection: '#f81ce5',
987
- secondary: '#888',
988
- code: '#79ffe1',
989
- border: '#333',
990
- error: '#e00',
991
- errorLighter: '#f7d4d6',
992
- errorLight: '#ff1a1a',
993
- errorDark: '#c50000',
994
- success: '#0070f3',
995
- successLighter: '#d3e5ff',
996
- successLight: '#3291ff',
997
- successDark: '#0761d1',
998
- warning: '#f5a623',
999
- warningLighter: '#ffefcf',
1000
- warningLight: '#f7b955',
1001
- warningDark: '#ab570a',
1002
- cyan: '#50e3c2',
1003
- cyanLighter: '#aaffec',
1004
- cyanLight: '#79ffe1',
1005
- cyanDark: '#29bc9b',
1006
- violet: '#7928ca',
1007
- violetLighter: '#e3d7fc',
1008
- violetLight: '#8a63d2',
1009
- violetDark: '#4c2889',
1010
- purple: '#f81ce5',
1011
- alert: '#ff0080',
1012
- magenta: '#eb367f',
1013
- link: '#3291ff'
1014
- };
1015
- var expressiveness = {
1016
- linkStyle: 'none',
1017
- linkHoverStyle: 'none',
1018
- dropdownBoxShadow: '0 0 0 1px #333',
1019
- scrollerStart: 'rgba(255, 255, 255, 1)',
1020
- scrollerEnd: 'rgba(255, 255, 255, 0)',
1021
- shadowSmall: '0 0 0 1px #333',
1022
- shadowMedium: '0 0 0 1px #333',
1023
- shadowLarge: '0 0 0 1px #333',
1024
- portalOpacity: 0.75
1025
- };
1026
- var font = defaultFont;
1027
- var breakpoints = defaultBreakpoints;
1028
- var layout = defaultLayout;
1029
- var themes = {
1030
- type: 'dark',
1031
- font: font,
1032
- layout: layout,
1033
- palette: palette,
1034
- breakpoints: breakpoints,
1035
- expressiveness: expressiveness
1036
- };
1037
-
1038
- var isObject = function isObject(target) {
1039
- return target && _typeof(target) === 'object';
1040
- };
1041
- var _deepDuplicable = function deepDuplicable(source, target) {
1042
- if (!isObject(target) || !isObject(source)) return source;
1043
- var sourceKeys = Object.keys(source);
1044
- var result = {};
1045
- for (var _i = 0, _sourceKeys = sourceKeys; _i < _sourceKeys.length; _i++) {
1046
- var key = _sourceKeys[_i];
1047
- var sourceValue = source[key];
1048
- var targetValue = target[key];
1049
- if (Array.isArray(sourceValue) && Array.isArray(targetValue)) {
1050
- result[key] = targetValue.concat(sourceValue);
1051
- } else if (isObject(sourceValue) && isObject(targetValue)) {
1052
- result[key] = _deepDuplicable(sourceValue, _objectSpread2({}, targetValue));
1053
- } else if (targetValue) {
1054
- result[key] = targetValue;
1055
- } else {
1056
- result[key] = sourceValue;
1057
- }
1058
- }
1059
- return result;
1060
- };
1061
- var getPresets = function getPresets() {
1062
- return [themes$1, themes];
1063
- };
1064
- var getPresetStaticTheme = function getPresetStaticTheme() {
1065
- return themes$1;
1066
- };
1067
- var isAvailableThemeType = function isAvailableThemeType(type) {
1068
- if (!type) return false;
1069
- var presetThemes = getPresets();
1070
- var hasType = presetThemes.find(function (theme) {
1071
- return theme.type === type;
1072
- });
1073
- return !hasType;
1074
- };
1075
- var isPresetTheme = function isPresetTheme(themeOrType) {
1076
- if (!themeOrType) return false;
1077
- var isType = typeof themeOrType === 'string';
1078
- var type = isType ? themeOrType : themeOrType.type;
1079
- return !isAvailableThemeType(type);
1080
- };
1081
- var hasUserCustomTheme = function hasUserCustomTheme() {
1082
- var themes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
1083
- return !!themes.find(function (item) {
1084
- return isAvailableThemeType(item.type);
1085
- });
1086
- };
1087
- var create = function create(base, custom) {
1088
- if (!isAvailableThemeType(custom.type)) {
1089
- throw new Error('Duplicate or unavailable theme type');
1090
- }
1091
- return _deepDuplicable(base, custom);
1092
- };
1093
- var createFromDark = function createFromDark(custom) {
1094
- return create(themes, custom);
1095
- };
1096
- var createFromLight = function createFromLight(custom) {
1097
- return create(themes$1, custom);
1098
- };
1099
- var Themes = {
1100
- isPresetTheme: isPresetTheme,
1101
- isAvailableThemeType: isAvailableThemeType,
1102
- hasUserCustomTheme: hasUserCustomTheme,
1103
- getPresets: getPresets,
1104
- getPresetStaticTheme: getPresetStaticTheme,
1105
- create: create,
1106
- createFromDark: createFromDark,
1107
- createFromLight: createFromLight
1108
- };
1109
-
1110
- /* "use client" */
1111
-
1112
- var defaultTheme = Themes.getPresetStaticTheme();
1113
- var ThemeContext = /*#__PURE__*/React$1.createContext(defaultTheme);
1114
- var useTheme = function useTheme() {
1115
- return React$1.useContext(ThemeContext);
1116
- };
1117
-
1118
- /* "use client" */
1119
-
1120
- var defaultAllThemesConfig = {
1121
- themes: Themes.getPresets()
1122
- };
1123
- var AllThemesContext = /*#__PURE__*/React$1.createContext(defaultAllThemesConfig);
1124
- var useAllThemes = function useAllThemes() {
1125
- return React$1.useContext(AllThemesContext);
1126
- };
1127
-
1128
- var ThemeProvider = function ThemeProvider(_ref) {
1129
- var children = _ref.children,
1130
- themeType = _ref.themeType,
1131
- _ref$themes = _ref.themes,
1132
- themes = _ref$themes === void 0 ? [] : _ref$themes;
1133
- var _React$useState = React$1.useState({
1134
- themes: Themes.getPresets()
1135
- }),
1136
- _React$useState2 = _slicedToArray(_React$useState, 2),
1137
- allThemes = _React$useState2[0],
1138
- setAllThemes = _React$useState2[1];
1139
- var currentTheme = React$1.useMemo(function () {
1140
- var theme = allThemes.themes.find(function (item) {
1141
- return item.type === themeType;
1142
- });
1143
- if (theme) return theme;
1144
- return Themes.getPresetStaticTheme();
1145
- }, [allThemes, themeType]);
1146
- React$1.useEffect(function () {
1147
- if (!(themes !== null && themes !== void 0 && themes.length)) return;
1148
- setAllThemes(function (last) {
1149
- var safeThemes = themes.filter(function (item) {
1150
- return Themes.isAvailableThemeType(item.type);
1151
- });
1152
- var nextThemes = Themes.getPresets().concat(safeThemes);
1153
- return _objectSpread2(_objectSpread2({}, last), {}, {
1154
- themes: nextThemes
1155
- });
1156
- });
1157
- }, [themes]);
1158
- return /*#__PURE__*/React$1.createElement(AllThemesContext.Provider, {
1159
- value: allThemes
1160
- }, /*#__PURE__*/React$1.createElement(ThemeContext.Provider, {
1161
- value: currentTheme
1162
- }, children));
1163
- };
1164
-
1165
- var useCurrentState = function useCurrentState(initialState) {
1166
- var _useState = React$1.useState(function () {
1167
- return typeof initialState === 'function' ? initialState() : initialState;
1168
- }),
1169
- _useState2 = _slicedToArray(_useState, 2),
1170
- state = _useState2[0],
1171
- setState = _useState2[1];
1172
- var ref = React$1.useRef(initialState);
1173
- React$1.useEffect(function () {
1174
- ref.current = state;
1175
- }, [state]);
1176
- var setValue = function setValue(val) {
1177
- var result = typeof val === 'function' ? val(ref.current) : val;
1178
- ref.current = result;
1179
- setState(result);
1180
- };
1181
- return [state, setValue, ref];
1182
- };
1183
-
1184
- function getDefaultExportFromCjs (x) {
1185
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
1186
- }
1187
-
1188
- var index = {};
1189
-
1190
- var hasRequiredIndex;
1191
-
1192
- function requireIndex () {
1193
- if (hasRequiredIndex) return index;
1194
- hasRequiredIndex = 1;
1195
- var React$1$1 = React$1;
1196
-
1197
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
1198
-
1199
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React$1$1);
1200
-
1201
- /*
1202
- Based on Glamor's sheet
1203
- https://github.com/threepointone/glamor/blob/667b480d31b3721a905021b26e1290ce92ca2879/src/sheet.js
1204
- */ function _defineProperties(target, props) {
1205
- for(var i = 0; i < props.length; i++){
1206
- var descriptor = props[i];
1207
- descriptor.enumerable = descriptor.enumerable || false;
1208
- descriptor.configurable = true;
1209
- if ("value" in descriptor) descriptor.writable = true;
1210
- Object.defineProperty(target, descriptor.key, descriptor);
1211
- }
1212
- }
1213
- function _createClass(Constructor, protoProps, staticProps) {
1214
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
1215
- return Constructor;
1216
- }
1217
- var isProd = typeof process !== "undefined" && process.env && process.env.NODE_ENV === "production";
1218
- var isString = function(o) {
1219
- return Object.prototype.toString.call(o) === "[object String]";
1220
- };
1221
- var StyleSheet = /*#__PURE__*/ function() {
1222
- function StyleSheet(param) {
1223
- var ref = param === void 0 ? {} : param, _name = ref.name, name = _name === void 0 ? "stylesheet" : _name, _optimizeForSpeed = ref.optimizeForSpeed, optimizeForSpeed = _optimizeForSpeed === void 0 ? isProd : _optimizeForSpeed;
1224
- invariant$1(isString(name), "`name` must be a string");
1225
- this._name = name;
1226
- this._deletedRulePlaceholder = "#" + name + "-deleted-rule____{}";
1227
- invariant$1(typeof optimizeForSpeed === "boolean", "`optimizeForSpeed` must be a boolean");
1228
- this._optimizeForSpeed = optimizeForSpeed;
1229
- this._serverSheet = undefined;
1230
- this._tags = [];
1231
- this._injected = false;
1232
- this._rulesCount = 0;
1233
- var node = typeof window !== "undefined" && document.querySelector('meta[property="csp-nonce"]');
1234
- this._nonce = node ? node.getAttribute("content") : null;
1235
- }
1236
- var _proto = StyleSheet.prototype;
1237
- _proto.setOptimizeForSpeed = function setOptimizeForSpeed(bool) {
1238
- invariant$1(typeof bool === "boolean", "`setOptimizeForSpeed` accepts a boolean");
1239
- invariant$1(this._rulesCount === 0, "optimizeForSpeed cannot be when rules have already been inserted");
1240
- this.flush();
1241
- this._optimizeForSpeed = bool;
1242
- this.inject();
1243
- };
1244
- _proto.isOptimizeForSpeed = function isOptimizeForSpeed() {
1245
- return this._optimizeForSpeed;
1246
- };
1247
- _proto.inject = function inject() {
1248
- var _this = this;
1249
- invariant$1(!this._injected, "sheet already injected");
1250
- this._injected = true;
1251
- if (typeof window !== "undefined" && this._optimizeForSpeed) {
1252
- this._tags[0] = this.makeStyleTag(this._name);
1253
- this._optimizeForSpeed = "insertRule" in this.getSheet();
1254
- if (!this._optimizeForSpeed) {
1255
- if (!isProd) {
1256
- console.warn("StyleSheet: optimizeForSpeed mode not supported falling back to standard mode.");
1257
- }
1258
- this.flush();
1259
- this._injected = true;
1260
- }
1261
- return;
1262
- }
1263
- this._serverSheet = {
1264
- cssRules: [],
1265
- insertRule: function(rule, index) {
1266
- if (typeof index === "number") {
1267
- _this._serverSheet.cssRules[index] = {
1268
- cssText: rule
1269
- };
1270
- } else {
1271
- _this._serverSheet.cssRules.push({
1272
- cssText: rule
1273
- });
1274
- }
1275
- return index;
1276
- },
1277
- deleteRule: function(index) {
1278
- _this._serverSheet.cssRules[index] = null;
1279
- }
1280
- };
1281
- };
1282
- _proto.getSheetForTag = function getSheetForTag(tag) {
1283
- if (tag.sheet) {
1284
- return tag.sheet;
1285
- }
1286
- // this weirdness brought to you by firefox
1287
- for(var i = 0; i < document.styleSheets.length; i++){
1288
- if (document.styleSheets[i].ownerNode === tag) {
1289
- return document.styleSheets[i];
1290
- }
1291
- }
1292
- };
1293
- _proto.getSheet = function getSheet() {
1294
- return this.getSheetForTag(this._tags[this._tags.length - 1]);
1295
- };
1296
- _proto.insertRule = function insertRule(rule, index) {
1297
- invariant$1(isString(rule), "`insertRule` accepts only strings");
1298
- if (typeof window === "undefined") {
1299
- if (typeof index !== "number") {
1300
- index = this._serverSheet.cssRules.length;
1301
- }
1302
- this._serverSheet.insertRule(rule, index);
1303
- return this._rulesCount++;
1304
- }
1305
- if (this._optimizeForSpeed) {
1306
- var sheet = this.getSheet();
1307
- if (typeof index !== "number") {
1308
- index = sheet.cssRules.length;
1309
- }
1310
- // this weirdness for perf, and chrome's weird bug
1311
- // https://stackoverflow.com/questions/20007992/chrome-suddenly-stopped-accepting-insertrule
1312
- try {
1313
- sheet.insertRule(rule, index);
1314
- } catch (error) {
1315
- if (!isProd) {
1316
- console.warn("StyleSheet: illegal rule: \n\n" + rule + "\n\nSee https://stackoverflow.com/q/20007992 for more info");
1317
- }
1318
- return -1;
1319
- }
1320
- } else {
1321
- var insertionPoint = this._tags[index];
1322
- this._tags.push(this.makeStyleTag(this._name, rule, insertionPoint));
1323
- }
1324
- return this._rulesCount++;
1325
- };
1326
- _proto.replaceRule = function replaceRule(index, rule) {
1327
- if (this._optimizeForSpeed || typeof window === "undefined") {
1328
- var sheet = typeof window !== "undefined" ? this.getSheet() : this._serverSheet;
1329
- if (!rule.trim()) {
1330
- rule = this._deletedRulePlaceholder;
1331
- }
1332
- if (!sheet.cssRules[index]) {
1333
- // @TBD Should we throw an error?
1334
- return index;
1335
- }
1336
- sheet.deleteRule(index);
1337
- try {
1338
- sheet.insertRule(rule, index);
1339
- } catch (error) {
1340
- if (!isProd) {
1341
- console.warn("StyleSheet: illegal rule: \n\n" + rule + "\n\nSee https://stackoverflow.com/q/20007992 for more info");
1342
- }
1343
- // In order to preserve the indices we insert a deleteRulePlaceholder
1344
- sheet.insertRule(this._deletedRulePlaceholder, index);
1345
- }
1346
- } else {
1347
- var tag = this._tags[index];
1348
- invariant$1(tag, "old rule at index `" + index + "` not found");
1349
- tag.textContent = rule;
1350
- }
1351
- return index;
1352
- };
1353
- _proto.deleteRule = function deleteRule(index) {
1354
- if (typeof window === "undefined") {
1355
- this._serverSheet.deleteRule(index);
1356
- return;
1357
- }
1358
- if (this._optimizeForSpeed) {
1359
- this.replaceRule(index, "");
1360
- } else {
1361
- var tag = this._tags[index];
1362
- invariant$1(tag, "rule at index `" + index + "` not found");
1363
- tag.parentNode.removeChild(tag);
1364
- this._tags[index] = null;
1365
- }
1366
- };
1367
- _proto.flush = function flush() {
1368
- this._injected = false;
1369
- this._rulesCount = 0;
1370
- if (typeof window !== "undefined") {
1371
- this._tags.forEach(function(tag) {
1372
- return tag && tag.parentNode.removeChild(tag);
1373
- });
1374
- this._tags = [];
1375
- } else {
1376
- // simpler on server
1377
- this._serverSheet.cssRules = [];
1378
- }
1379
- };
1380
- _proto.cssRules = function cssRules() {
1381
- var _this = this;
1382
- if (typeof window === "undefined") {
1383
- return this._serverSheet.cssRules;
1384
- }
1385
- return this._tags.reduce(function(rules, tag) {
1386
- if (tag) {
1387
- rules = rules.concat(Array.prototype.map.call(_this.getSheetForTag(tag).cssRules, function(rule) {
1388
- return rule.cssText === _this._deletedRulePlaceholder ? null : rule;
1389
- }));
1390
- } else {
1391
- rules.push(null);
1392
- }
1393
- return rules;
1394
- }, []);
1395
- };
1396
- _proto.makeStyleTag = function makeStyleTag(name, cssString, relativeToTag) {
1397
- if (cssString) {
1398
- invariant$1(isString(cssString), "makeStyleTag accepts only strings as second parameter");
1399
- }
1400
- var tag = document.createElement("style");
1401
- if (this._nonce) tag.setAttribute("nonce", this._nonce);
1402
- tag.type = "text/css";
1403
- tag.setAttribute("data-" + name, "");
1404
- if (cssString) {
1405
- tag.appendChild(document.createTextNode(cssString));
1406
- }
1407
- var head = document.head || document.getElementsByTagName("head")[0];
1408
- if (relativeToTag) {
1409
- head.insertBefore(tag, relativeToTag);
1410
- } else {
1411
- head.appendChild(tag);
1412
- }
1413
- return tag;
1414
- };
1415
- _createClass(StyleSheet, [
1416
- {
1417
- key: "length",
1418
- get: function get() {
1419
- return this._rulesCount;
1420
- }
1421
- }
1422
- ]);
1423
- return StyleSheet;
1424
- }();
1425
- function invariant$1(condition, message) {
1426
- if (!condition) {
1427
- throw new Error("StyleSheet: " + message + ".");
1428
- }
1429
- }
1430
-
1431
- function hash(str) {
1432
- var _$hash = 5381, i = str.length;
1433
- while(i){
1434
- _$hash = _$hash * 33 ^ str.charCodeAt(--i);
1435
- }
1436
- /* JavaScript does bitwise operations (like XOR, above) on 32-bit signed
1437
- * integers. Since we want the results to be always positive, convert the
1438
- * signed int to an unsigned by doing an unsigned bitshift. */ return _$hash >>> 0;
1439
- }
1440
- var stringHash = hash;
1441
-
1442
- var sanitize = function(rule) {
1443
- return rule.replace(/\/style/gi, "\\/style");
1444
- };
1445
- var cache = {};
1446
- /**
1447
- * computeId
1448
- *
1449
- * Compute and memoize a jsx id from a basedId and optionally props.
1450
- */ function computeId(baseId, props) {
1451
- if (!props) {
1452
- return "jsx-" + baseId;
1453
- }
1454
- var propsToString = String(props);
1455
- var key = baseId + propsToString;
1456
- if (!cache[key]) {
1457
- cache[key] = "jsx-" + stringHash(baseId + "-" + propsToString);
1458
- }
1459
- return cache[key];
1460
- }
1461
- /**
1462
- * computeSelector
1463
- *
1464
- * Compute and memoize dynamic selectors.
1465
- */ function computeSelector(id, css) {
1466
- var selectoPlaceholderRegexp = /__jsx-style-dynamic-selector/g;
1467
- // Sanitize SSR-ed CSS.
1468
- // Client side code doesn't need to be sanitized since we use
1469
- // document.createTextNode (dev) and the CSSOM api sheet.insertRule (prod).
1470
- if (typeof window === "undefined") {
1471
- css = sanitize(css);
1472
- }
1473
- var idcss = id + css;
1474
- if (!cache[idcss]) {
1475
- cache[idcss] = css.replace(selectoPlaceholderRegexp, id);
1476
- }
1477
- return cache[idcss];
1478
- }
1479
-
1480
- function mapRulesToStyle(cssRules, options) {
1481
- if (options === void 0) options = {};
1482
- return cssRules.map(function(args) {
1483
- var id = args[0];
1484
- var css = args[1];
1485
- return /*#__PURE__*/ React__default["default"].createElement("style", {
1486
- id: "__" + id,
1487
- // Avoid warnings upon render with a key
1488
- key: "__" + id,
1489
- nonce: options.nonce ? options.nonce : undefined,
1490
- dangerouslySetInnerHTML: {
1491
- __html: css
1492
- }
1493
- });
1494
- });
1495
- }
1496
- var StyleSheetRegistry = /*#__PURE__*/ function() {
1497
- function StyleSheetRegistry(param) {
1498
- var ref = param === void 0 ? {} : param, _styleSheet = ref.styleSheet, styleSheet = _styleSheet === void 0 ? null : _styleSheet, _optimizeForSpeed = ref.optimizeForSpeed, optimizeForSpeed = _optimizeForSpeed === void 0 ? false : _optimizeForSpeed;
1499
- this._sheet = styleSheet || new StyleSheet({
1500
- name: "styled-jsx",
1501
- optimizeForSpeed: optimizeForSpeed
1502
- });
1503
- this._sheet.inject();
1504
- if (styleSheet && typeof optimizeForSpeed === "boolean") {
1505
- this._sheet.setOptimizeForSpeed(optimizeForSpeed);
1506
- this._optimizeForSpeed = this._sheet.isOptimizeForSpeed();
1507
- }
1508
- this._fromServer = undefined;
1509
- this._indices = {};
1510
- this._instancesCounts = {};
1511
- }
1512
- var _proto = StyleSheetRegistry.prototype;
1513
- _proto.add = function add(props) {
1514
- var _this = this;
1515
- if (undefined === this._optimizeForSpeed) {
1516
- this._optimizeForSpeed = Array.isArray(props.children);
1517
- this._sheet.setOptimizeForSpeed(this._optimizeForSpeed);
1518
- this._optimizeForSpeed = this._sheet.isOptimizeForSpeed();
1519
- }
1520
- if (typeof window !== "undefined" && !this._fromServer) {
1521
- this._fromServer = this.selectFromServer();
1522
- this._instancesCounts = Object.keys(this._fromServer).reduce(function(acc, tagName) {
1523
- acc[tagName] = 0;
1524
- return acc;
1525
- }, {});
1526
- }
1527
- var ref = this.getIdAndRules(props), styleId = ref.styleId, rules = ref.rules;
1528
- // Deduping: just increase the instances count.
1529
- if (styleId in this._instancesCounts) {
1530
- this._instancesCounts[styleId] += 1;
1531
- return;
1532
- }
1533
- var indices = rules.map(function(rule) {
1534
- return _this._sheet.insertRule(rule);
1535
- })// Filter out invalid rules
1536
- .filter(function(index) {
1537
- return index !== -1;
1538
- });
1539
- this._indices[styleId] = indices;
1540
- this._instancesCounts[styleId] = 1;
1541
- };
1542
- _proto.remove = function remove(props) {
1543
- var _this = this;
1544
- var styleId = this.getIdAndRules(props).styleId;
1545
- invariant(styleId in this._instancesCounts, "styleId: `" + styleId + "` not found");
1546
- this._instancesCounts[styleId] -= 1;
1547
- if (this._instancesCounts[styleId] < 1) {
1548
- var tagFromServer = this._fromServer && this._fromServer[styleId];
1549
- if (tagFromServer) {
1550
- tagFromServer.parentNode.removeChild(tagFromServer);
1551
- delete this._fromServer[styleId];
1552
- } else {
1553
- this._indices[styleId].forEach(function(index) {
1554
- return _this._sheet.deleteRule(index);
1555
- });
1556
- delete this._indices[styleId];
1557
- }
1558
- delete this._instancesCounts[styleId];
1559
- }
1560
- };
1561
- _proto.update = function update(props, nextProps) {
1562
- this.add(nextProps);
1563
- this.remove(props);
1564
- };
1565
- _proto.flush = function flush() {
1566
- this._sheet.flush();
1567
- this._sheet.inject();
1568
- this._fromServer = undefined;
1569
- this._indices = {};
1570
- this._instancesCounts = {};
1571
- };
1572
- _proto.cssRules = function cssRules() {
1573
- var _this = this;
1574
- var fromServer = this._fromServer ? Object.keys(this._fromServer).map(function(styleId) {
1575
- return [
1576
- styleId,
1577
- _this._fromServer[styleId]
1578
- ];
1579
- }) : [];
1580
- var cssRules = this._sheet.cssRules();
1581
- return fromServer.concat(Object.keys(this._indices).map(function(styleId) {
1582
- return [
1583
- styleId,
1584
- _this._indices[styleId].map(function(index) {
1585
- return cssRules[index].cssText;
1586
- }).join(_this._optimizeForSpeed ? "" : "\n")
1587
- ];
1588
- })// filter out empty rules
1589
- .filter(function(rule) {
1590
- return Boolean(rule[1]);
1591
- }));
1592
- };
1593
- _proto.styles = function styles(options) {
1594
- return mapRulesToStyle(this.cssRules(), options);
1595
- };
1596
- _proto.getIdAndRules = function getIdAndRules(props) {
1597
- var css = props.children, dynamic = props.dynamic, id = props.id;
1598
- if (dynamic) {
1599
- var styleId = computeId(id, dynamic);
1600
- return {
1601
- styleId: styleId,
1602
- rules: Array.isArray(css) ? css.map(function(rule) {
1603
- return computeSelector(styleId, rule);
1604
- }) : [
1605
- computeSelector(styleId, css)
1606
- ]
1607
- };
1608
- }
1609
- return {
1610
- styleId: computeId(id),
1611
- rules: Array.isArray(css) ? css : [
1612
- css
1613
- ]
1614
- };
1615
- };
1616
- /**
1617
- * selectFromServer
1618
- *
1619
- * Collects style tags from the document with id __jsx-XXX
1620
- */ _proto.selectFromServer = function selectFromServer() {
1621
- var elements = Array.prototype.slice.call(document.querySelectorAll('[id^="__jsx-"]'));
1622
- return elements.reduce(function(acc, element) {
1623
- var id = element.id.slice(2);
1624
- acc[id] = element;
1625
- return acc;
1626
- }, {});
1627
- };
1628
- return StyleSheetRegistry;
1629
- }();
1630
- function invariant(condition, message) {
1631
- if (!condition) {
1632
- throw new Error("StyleSheetRegistry: " + message + ".");
1633
- }
1634
- }
1635
- var StyleSheetContext = /*#__PURE__*/ React$1$1.createContext(null);
1636
- StyleSheetContext.displayName = "StyleSheetContext";
1637
- function createStyleRegistry() {
1638
- return new StyleSheetRegistry();
1639
- }
1640
- function StyleRegistry(param) {
1641
- var configuredRegistry = param.registry, children = param.children;
1642
- var rootRegistry = React$1$1.useContext(StyleSheetContext);
1643
- var ref = React$1$1.useState(function() {
1644
- return rootRegistry || configuredRegistry || createStyleRegistry();
1645
- }), registry = ref[0];
1646
- return /*#__PURE__*/ React__default["default"].createElement(StyleSheetContext.Provider, {
1647
- value: registry
1648
- }, children);
1649
- }
1650
- function useStyleRegistry() {
1651
- return React$1$1.useContext(StyleSheetContext);
1652
- }
1653
-
1654
- // Opt-into the new `useInsertionEffect` API in React 18, fallback to `useLayoutEffect`.
1655
- // https://github.com/reactwg/react-18/discussions/110
1656
- var useInsertionEffect = React__default["default"].useInsertionEffect || React$1$1.useLayoutEffect;
1657
- var defaultRegistry = typeof window !== "undefined" ? createStyleRegistry() : undefined;
1658
- function JSXStyle(props) {
1659
- var registry = defaultRegistry ? defaultRegistry : useStyleRegistry();
1660
- var insertionEffectCalled = React$1$1.useRef(false);
1661
- // `registry` might not exist while server-side rendering
1662
- if (!registry) {
1663
- return null;
1664
- }
1665
- if (typeof window === "undefined") {
1666
- registry.add(props);
1667
- return null;
1668
- }
1669
- useInsertionEffect(function() {
1670
- // ReactDOM removes all DOM during hydration in certain cases
1671
- if (!document.head) {
1672
- return;
1673
- }
1674
- registry.add(props);
1675
- insertionEffectCalled.current = true;
1676
- return function() {
1677
- insertionEffectCalled.current = false;
1678
- registry.remove(props);
1679
- };
1680
- }, [
1681
- props.id,
1682
- String(props.dynamic)
1683
- ]);
1684
- React$1$1.useLayoutEffect(function() {
1685
- if (!document.head || insertionEffectCalled.current) {
1686
- return;
1687
- }
1688
- registry.add(props);
1689
- return function() {
1690
- registry.remove(props);
1691
- };
1692
- // props.children can be string[], will be striped since id is identical
1693
- }, [
1694
- props.id,
1695
- String(props.dynamic)
1696
- ]);
1697
- return null;
1698
- }
1699
- JSXStyle.dynamic = function(info) {
1700
- return info.map(function(tagInfo) {
1701
- var baseId = tagInfo[0];
1702
- var props = tagInfo[1];
1703
- return computeId(baseId, props);
1704
- }).join(" ");
1705
- };
1706
-
1707
- index.StyleRegistry = StyleRegistry;
1708
- index.createStyleRegistry = createStyleRegistry;
1709
- index.style = JSXStyle;
1710
- index.useStyleRegistry = useStyleRegistry;
1711
- return index;
1712
- }
1713
-
1714
- var style;
1715
- var hasRequiredStyle;
1716
-
1717
- function requireStyle () {
1718
- if (hasRequiredStyle) return style;
1719
- hasRequiredStyle = 1;
1720
- style = requireIndex().style;
1721
- return style;
1722
- }
1723
-
1724
- var styleExports = requireStyle();
1725
- var _JSXStyle = /*@__PURE__*/getDefaultExportFromCjs(styleExports);
1726
-
1727
- /* "use client" */
1728
-
1729
- var getId = function getId() {
1730
- return Math.random().toString(32).slice(2, 10);
1731
- };
1732
- var isBrowser = function isBrowser() {
1733
- return Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);
1734
- };
1735
-
1736
- var useSSR = function useSSR() {
1737
- var _useState = React$1.useState(false),
1738
- _useState2 = _slicedToArray(_useState, 2),
1739
- browser = _useState2[0],
1740
- setBrowser = _useState2[1];
1741
- React$1.useEffect(function () {
1742
- setBrowser(isBrowser());
1743
- }, []);
1744
- return {
1745
- isBrowser: browser,
1746
- isServer: !browser
1747
- };
1748
- };
1749
-
1750
- var createElement = function createElement(id) {
1751
- var el = document.createElement('div');
1752
- el.setAttribute('id', id);
1753
- return el;
1754
- };
1755
- var usePortal = function usePortal() {
1756
- var selectId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getId();
1757
- var getContainer = arguments.length > 1 ? arguments[1] : undefined;
1758
- var id = "helpdice-ui-".concat(selectId);
1759
- var _useSSR = useSSR(),
1760
- isBrowser = _useSSR.isBrowser;
1761
- var _useState = React$1.useState(isBrowser ? createElement(id) : null),
1762
- _useState2 = _slicedToArray(_useState, 2),
1763
- elSnapshot = _useState2[0],
1764
- setElSnapshot = _useState2[1];
1765
- React$1.useEffect(function () {
1766
- var customContainer = getContainer ? getContainer() : null;
1767
- var parentElement = customContainer || document.body;
1768
- var hasElement = parentElement.querySelector("#".concat(id));
1769
- var el = hasElement || createElement(id);
1770
- if (!hasElement) {
1771
- parentElement.appendChild(el);
1772
- }
1773
- setElSnapshot(el);
1774
- }, []);
1775
- return elSnapshot;
1776
- };
1777
-
1778
- var _excluded$2 = ["children", "className", "visible", "enterTime", "leaveTime", "clearTime", "name"];
1779
- var CssTransition = function CssTransition(_ref) {
1780
- var children = _ref.children,
1781
- _ref$className = _ref.className,
1782
- className = _ref$className === void 0 ? '' : _ref$className,
1783
- _ref$visible = _ref.visible,
1784
- visible = _ref$visible === void 0 ? false : _ref$visible,
1785
- _ref$enterTime = _ref.enterTime,
1786
- enterTime = _ref$enterTime === void 0 ? 60 : _ref$enterTime,
1787
- _ref$leaveTime = _ref.leaveTime,
1788
- leaveTime = _ref$leaveTime === void 0 ? 60 : _ref$leaveTime,
1789
- _ref$clearTime = _ref.clearTime,
1790
- clearTime = _ref$clearTime === void 0 ? 60 : _ref$clearTime,
1791
- _ref$name = _ref.name,
1792
- name = _ref$name === void 0 ? 'transition' : _ref$name,
1793
- props = _objectWithoutProperties(_ref, _excluded$2);
1794
- var _useState = React$1.useState(''),
1795
- _useState2 = _slicedToArray(_useState, 2),
1796
- classes = _useState2[0],
1797
- setClasses = _useState2[1];
1798
- var _useState3 = React$1.useState(visible),
1799
- _useState4 = _slicedToArray(_useState3, 2),
1800
- renderable = _useState4[0],
1801
- setRenderable = _useState4[1];
1802
- React$1.useEffect(function () {
1803
- var statusClassName = visible ? 'enter' : 'leave';
1804
- var time = visible ? enterTime : leaveTime;
1805
- if (visible && !renderable) {
1806
- setRenderable(true);
1807
- }
1808
- setClasses("".concat(name, "-").concat(statusClassName));
1809
-
1810
- // set class to active
1811
- var timer = setTimeout(function () {
1812
- setClasses("".concat(name, "-").concat(statusClassName, " ").concat(name, "-").concat(statusClassName, "-active"));
1813
- clearTimeout(timer);
1814
- }, time);
1815
-
1816
- // remove classess when animation over
1817
- var clearClassesTimer = setTimeout(function () {
1818
- if (!visible) {
1819
- setClasses('');
1820
- setRenderable(false);
1821
- }
1822
- clearTimeout(clearClassesTimer);
1823
- }, time + clearTime);
1824
- return function () {
1825
- clearTimeout(timer);
1826
- clearTimeout(clearClassesTimer);
1827
- };
1828
- }, [visible, renderable]);
1829
- if (! /*#__PURE__*/React$1.isValidElement(children) || !renderable) return null;
1830
- var propsTransition = _objectSpread2(_objectSpread2({}, props), {}, {
1831
- className: "".concat(children.props.className, " ").concat(className, " ").concat(classes)
1832
- });
1833
- return /*#__PURE__*/React$1.cloneElement(children, propsTransition);
1834
- };
1835
- CssTransition.displayName = 'CssTransition';
1836
-
1837
- var tuple = function tuple() {
1838
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1839
- args[_key] = arguments[_key];
1840
- }
1841
- return args;
1842
- };
1843
- tuple('default', 'secondary', 'success', 'warning', 'error', 'abort', 'secondary-light', 'success-light', 'warning-light', 'error-light');
1844
- tuple('default', 'secondary', 'success', 'warning', 'error');
1845
- tuple('default', 'secondary', 'success', 'warning', 'error', 'dark', 'lite');
1846
- tuple('default', 'secondary', 'success', 'warning', 'error', 'dark', 'lite', 'alert', 'purple', 'violet', 'cyan');
1847
- tuple('default', 'silent', 'prevent');
1848
- tuple('hover', 'click');
1849
- tuple('top', 'topStart', 'topEnd', 'left', 'leftStart', 'leftEnd', 'bottom', 'bottomStart', 'bottomEnd', 'right', 'rightStart', 'rightEnd');
1850
- tuple('start', 'center', 'end', 'left', 'right');
1851
-
1852
- var makeToastActions = function makeToastActions(actions, cancelHandle) {
1853
- var handler = function handler(event, userHandler) {
1854
- userHandler && userHandler(event, cancelHandle);
1855
- };
1856
- if (!actions || !actions.length) return null;
1857
- return actions.map(function (action, index) {
1858
- return /*#__PURE__*/React$1.createElement("button", {
1859
- color: action.passive ? 'default' : 'secondary',
1860
- key: "action-".concat(index),
1861
- onClick: function onClick(event) {
1862
- return handler(event, action.handler);
1863
- }
1864
- }, action.name);
1865
- });
1866
- };
1867
- var getColors = function getColors(palette, type) {
1868
- var colors = {
1869
- "default": palette.background,
1870
- secondary: palette.secondary,
1871
- success: palette.success,
1872
- warning: palette.warning,
1873
- error: palette.error
1874
- };
1875
- var isDefault = !type || type === 'default';
1876
- if (isDefault) return {
1877
- bgColor: colors["default"],
1878
- color: palette.foreground
1879
- };
1880
- /**
1881
- * Prevent main color change in special types.
1882
- * The color will only follow the theme when it is in the default type.
1883
- */
1884
- return {
1885
- bgColor: colors[type],
1886
- color: 'white'
1887
- };
1888
- };
1889
- tuple('topLeft', 'topRight', 'bottomLeft', 'bottomRight');
1890
- var isTopPlacement = function isTopPlacement(placement) {
1891
- return "".concat(placement).toLowerCase().startsWith('top');
1892
- };
1893
- var isLeftPlacement = function isLeftPlacement(placement) {
1894
- return "".concat(placement).toLowerCase().endsWith('left');
1895
- };
1896
- var getTranslateByPlacement = function getTranslateByPlacement(placement) {
1897
- var translateInByPlacement = {
1898
- topLeft: 'translate(-60px, -60px)',
1899
- topRight: 'translate(60px, -60px)',
1900
- bottomLeft: 'translate(-60px, 60px)',
1901
- bottomRight: 'translate(60px, 60px)'
1902
- };
1903
- var translateOutByPlacement = {
1904
- topLeft: 'translate(-50px, 15px) scale(0.85)',
1905
- topRight: 'translate(50px, 15px) scale(0.85)',
1906
- bottomLeft: 'translate(-50px, -15px) scale(0.85)',
1907
- bottomRight: 'translate(50px, -15px) scale(0.85)'
1908
- };
1909
- return {
1910
- enter: translateInByPlacement[placement],
1911
- leave: translateOutByPlacement[placement]
1912
- };
1913
- };
1914
-
1915
- var ToastItem = /*#__PURE__*/React$1.memo(function (_ref) {
1916
- var toast = _ref.toast,
1917
- layout = _ref.layout;
1918
- var theme = useTheme();
1919
- var _useMemo = React$1.useMemo(function () {
1920
- return getColors(theme.palette, toast.type);
1921
- }, [theme.palette, toast.type]),
1922
- color = _useMemo.color,
1923
- bgColor = _useMemo.bgColor;
1924
- var isReactNode = typeof toast.text !== 'string';
1925
- var padding = layout.padding,
1926
- margin = layout.margin,
1927
- maxHeight = layout.maxHeight,
1928
- maxWidth = layout.maxWidth,
1929
- width = layout.width,
1930
- placement = layout.placement;
1931
- var _useMemo2 = React$1.useMemo(function () {
1932
- return getTranslateByPlacement(placement);
1933
- }, [placement]),
1934
- enter = _useMemo2.enter,
1935
- leave = _useMemo2.leave;
1936
- return /*#__PURE__*/React$1.createElement(CssTransition, {
1937
- name: "toast",
1938
- visible: toast.visible,
1939
- clearTime: 350
1940
- }, /*#__PURE__*/React$1.createElement("div", {
1941
- key: toast.id,
1942
- className: _JSXStyle.dynamic([["1407001838", [width, maxWidth, maxHeight, theme.palette.foreground, bgColor, color, theme.layout.radius, theme.expressiveness.shadowSmall, theme.layout.gapHalf, enter, margin, padding, margin, padding, leave]]]) + " " + "toast"
1943
- }, isReactNode ? toast.text : /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement("div", {
1944
- className: _JSXStyle.dynamic([["1407001838", [width, maxWidth, maxHeight, theme.palette.foreground, bgColor, color, theme.layout.radius, theme.expressiveness.shadowSmall, theme.layout.gapHalf, enter, margin, padding, margin, padding, leave]]]) + " " + "message"
1945
- }, toast.text), /*#__PURE__*/React$1.createElement("div", {
1946
- className: _JSXStyle.dynamic([["1407001838", [width, maxWidth, maxHeight, theme.palette.foreground, bgColor, color, theme.layout.radius, theme.expressiveness.shadowSmall, theme.layout.gapHalf, enter, margin, padding, margin, padding, leave]]]) + " " + "action"
1947
- }, makeToastActions(toast.actions, toast.cancel))), /*#__PURE__*/React$1.createElement(_JSXStyle, {
1948
- id: "1407001838",
1949
- dynamic: [width, maxWidth, maxHeight, theme.palette.foreground, bgColor, color, theme.layout.radius, theme.expressiveness.shadowSmall, theme.layout.gapHalf, enter, margin, padding, margin, padding, leave]
1950
- }, ".toast.__jsx-style-dynamic-selector{width:".concat(width, ";max-width:").concat(maxWidth, ";max-height:").concat(maxHeight, ";display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:").concat(theme.palette.foreground, ";background-color:").concat(bgColor, ";color:").concat(color, ";border:0;border-radius:").concat(theme.layout.radius, ";opacity:1;box-shadow:").concat(theme.expressiveness.shadowSmall, ";-webkit-transition:all 350ms cubic-bezier(0.1,0.2,0.1,1);transition:all 350ms cubic-bezier(0.1,0.2,0.1,1);overflow:hidden;}.message.__jsx-style-dynamic-selector{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:100%;font-size:0.875em;display:-webkit-box;word-break:break-all;padding-right:").concat(theme.layout.gapHalf, ";overflow:hidden;max-height:100%;text-overflow:ellipsis;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-height:1.1rem;}.toast-enter.__jsx-style-dynamic-selector{opacity:0;height:0;padding:0;margin:0;-webkit-transform:").concat(enter, ";-ms-transform:").concat(enter, ";transform:").concat(enter, ";}.toast-enter-active.__jsx-style-dynamic-selector{opacity:1;height:auto;margin:").concat(margin, ";padding:").concat(padding, ";-webkit-transform:translate(0,0);-ms-transform:translate(0,0);transform:translate(0,0);}.toast-leave.__jsx-style-dynamic-selector{opacity:1;-webkit-transform:translate(0,0);-ms-transform:translate(0,0);transform:translate(0,0);height:auto;margin:").concat(margin, ";padding:").concat(padding, ";}.toast-leave-active.__jsx-style-dynamic-selector{opacity:0;-webkit-transform:").concat(leave, ";-ms-transform:").concat(leave, ";transform:").concat(leave, ";}"))));
1951
- });
1952
-
1953
- /* "use client" */
1954
-
1955
- var classObjectToString = function classObjectToString(className) {
1956
- var keys = Object.keys(className);
1957
- var len = keys.length;
1958
- var str = '';
1959
- for (var index = 0; index < len; index++) {
1960
- var key = keys[index];
1961
- var val = className[keys[index]];
1962
- if (!val) continue;
1963
- str = str ? "".concat(str, " ").concat(String(key)) : String(key);
1964
- }
1965
- return str;
1966
- };
1967
- var isObjectClassName = function isObjectClassName(value) {
1968
- return _typeof(value) === 'object' && !Array.isArray(value);
1969
- };
1970
- var useClasses = function useClasses() {
1971
- var len = arguments.length;
1972
- var classes = '';
1973
- if (len === 0) return classes;
1974
- for (var index = 0; index < len; index++) {
1975
- var val = index < 0 || arguments.length <= index ? undefined : arguments[index];
1976
- if (!val) continue;
1977
- if (isObjectClassName(val)) {
1978
- classes += " ".concat(classObjectToString(val));
1979
- } else {
1980
- classes += " ".concat(String(val).trim());
1981
- }
1982
- }
1983
- return classes.trim();
1984
- };
1985
-
1986
- var ToastContainer = function ToastContainer() {
1987
- var theme = useTheme();
1988
- var portal = usePortal('toast');
1989
- var _useCurrentState = useCurrentState(false),
1990
- _useCurrentState2 = _slicedToArray(_useCurrentState, 3),
1991
- setHovering = _useCurrentState2[1],
1992
- hoveringRef = _useCurrentState2[2];
1993
- var _useHUIContext = useHUIContext(),
1994
- toasts = _useHUIContext.toasts,
1995
- updateToasts = _useHUIContext.updateToasts,
1996
- toastLayout = _useHUIContext.toastLayout,
1997
- lastUpdateToastId = _useHUIContext.lastUpdateToastId;
1998
- var memoizedLayout = React$1.useMemo(function () {
1999
- return toastLayout;
2000
- }, [toastLayout]);
2001
- var toastElements = React$1.useMemo(function () {
2002
- return toasts.map(function (toast) {
2003
- return /*#__PURE__*/React$1.createElement(ToastItem, {
2004
- toast: toast,
2005
- layout: memoizedLayout,
2006
- key: toast._internalIdent
2007
- });
2008
- });
2009
- }, [toasts, memoizedLayout]);
2010
- var classNames = React$1.useMemo(function () {
2011
- return useClasses('toasts', {
2012
- top: isTopPlacement(toastLayout.placement),
2013
- left: isLeftPlacement(toastLayout.placement)
2014
- });
2015
- }, [memoizedLayout]);
2016
- var hoverHandler = function hoverHandler(isHovering) {
2017
- setHovering(isHovering);
2018
- if (isHovering) {
2019
- return updateToasts(function (last) {
2020
- return last.map(function (toast) {
2021
- if (!toast.visible) return toast;
2022
- toast._timeout && window.clearTimeout(toast._timeout);
2023
- return _objectSpread2(_objectSpread2({}, toast), {}, {
2024
- timeout: null
2025
- });
2026
- });
2027
- });
2028
- }
2029
- updateToasts(function (last) {
2030
- return last.map(function (toast, index) {
2031
- if (!toast.visible) return toast;
2032
- toast._timeout && window.clearTimeout(toast._timeout);
2033
- return _objectSpread2(_objectSpread2({}, toast), {}, {
2034
- _timeout: function () {
2035
- var timer = window.setTimeout(function () {
2036
- toast.cancel();
2037
- window.clearTimeout(timer);
2038
- }, toast.delay + index * 100);
2039
- return timer;
2040
- }()
2041
- });
2042
- });
2043
- });
2044
- };
2045
- React$1.useEffect(function () {
2046
- var index = toasts.findIndex(function (r) {
2047
- return r._internalIdent === lastUpdateToastId;
2048
- });
2049
- var toast = toasts[index];
2050
- if (!toast || toast.visible || !hoveringRef.current) return;
2051
- var hasVisible = toasts.find(function (r, i) {
2052
- return i < index && r.visible;
2053
- });
2054
- if (hasVisible || !hoveringRef.current) return;
2055
- hoverHandler(false);
2056
- }, [toasts, lastUpdateToastId]);
2057
- React$1.useEffect(function () {
2058
- var timeout = null;
2059
- var timer = window.setInterval(function () {
2060
- if (toasts.length === 0) return;
2061
- timeout = window.setTimeout(function () {
2062
- var allInvisible = !toasts.find(function (r) {
2063
- return r.visible;
2064
- });
2065
- allInvisible && updateToasts(function () {
2066
- return [];
2067
- });
2068
- timeout && clearTimeout(timeout);
2069
- }, 350);
2070
- }, 5000);
2071
- return function () {
2072
- timer && clearInterval(timer);
2073
- timeout && clearTimeout(timeout);
2074
- };
2075
- }, [toasts]);
2076
- if (!portal) return null;
2077
- if (!toasts || toasts.length === 0) return null;
2078
- return /*#__PURE__*/reactDom.createPortal(/*#__PURE__*/React$1.createElement("div", {
2079
- onMouseEnter: function onMouseEnter() {
2080
- return hoverHandler(true);
2081
- },
2082
- onMouseLeave: function onMouseLeave() {
2083
- return hoverHandler(false);
2084
- },
2085
- className: _JSXStyle.dynamic([["622610754", [theme.layout.gap, theme.layout.gap, theme.layout.gap, theme.layout.gap]]]) + " " + (classNames || "")
2086
- }, toastElements, /*#__PURE__*/React$1.createElement(_JSXStyle, {
2087
- id: "622610754",
2088
- dynamic: [theme.layout.gap, theme.layout.gap, theme.layout.gap, theme.layout.gap]
2089
- }, ".toasts.__jsx-style-dynamic-selector{position:fixed;width:auto;max-width:100%;right:".concat(theme.layout.gap, ";bottom:").concat(theme.layout.gap, ";z-index:2000;-webkit-transition:all 400ms ease;transition:all 400ms ease;box-sizing:border-box;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}.top.__jsx-style-dynamic-selector{bottom:unset;-webkit-flex-direction:column-reverse;-ms-flex-direction:column-reverse;flex-direction:column-reverse;top:").concat(theme.layout.gap, ";}.left.__jsx-style-dynamic-selector{right:unset;left:").concat(theme.layout.gap, ";}"))), portal);
2090
- };
2091
-
2092
- var HuiProvider = function HuiProvider(_ref) {
2093
- var themes = _ref.themes,
2094
- themeType = _ref.themeType,
2095
- children = _ref.children;
2096
- var _React$useState = React$1.useState(''),
2097
- _React$useState2 = _slicedToArray(_React$useState, 2),
2098
- lastUpdateToastId = _React$useState2[0],
2099
- setLastUpdateToastId = _React$useState2[1];
2100
- var _useCurrentState = useCurrentState([]),
2101
- _useCurrentState2 = _slicedToArray(_useCurrentState, 3),
2102
- toasts = _useCurrentState2[0],
2103
- setToasts = _useCurrentState2[1],
2104
- toastsRef = _useCurrentState2[2];
2105
- var _useCurrentState3 = useCurrentState(defaultToastLayout),
2106
- _useCurrentState4 = _slicedToArray(_useCurrentState3, 3),
2107
- toastLayout = _useCurrentState4[0],
2108
- setToastLayout = _useCurrentState4[1],
2109
- toastLayoutRef = _useCurrentState4[2];
2110
- var updateToasts = function updateToasts(fn) {
2111
- var nextToasts = fn(toastsRef.current);
2112
- setToasts(nextToasts);
2113
- };
2114
- var updateToastLayout = function updateToastLayout(fn) {
2115
- var nextLayout = fn(toastLayoutRef.current);
2116
- setToastLayout(nextLayout);
2117
- };
2118
- var updateLastToastId = function updateLastToastId(fn) {
2119
- setLastUpdateToastId(fn());
2120
- };
2121
- var initialValue = React$1.useMemo(function () {
2122
- return {
2123
- toasts: toasts,
2124
- toastLayout: toastLayout,
2125
- updateToasts: updateToasts,
2126
- lastUpdateToastId: lastUpdateToastId,
2127
- updateToastLayout: updateToastLayout,
2128
- updateLastToastId: updateLastToastId
2129
- };
2130
- }, [toasts, toastLayout, lastUpdateToastId]);
2131
- return /*#__PURE__*/React$1.createElement(HUIContent.Provider, {
2132
- value: initialValue
2133
- }, /*#__PURE__*/React$1.createElement(ThemeProvider, {
2134
- themes: themes,
2135
- themeType: themeType
2136
- }, children, /*#__PURE__*/React$1.createElement(ToastContainer, null)));
2137
- };
2138
-
2139
- // import flush from 'styled-jsx'
2140
-
2141
- // export type FlushToReact = <T>(opts?: { nonce?: string }) => Array<ReactElement<T>>
2142
-
2143
- // export type FlushToHTML = (opts?: { nonce?: string }) => string
2144
-
2145
- var CssBaseline = function CssBaseline(_ref) {
2146
- var children = _ref.children;
2147
- var theme = useTheme();
2148
- return /*#__PURE__*/React$1.createElement(React$1.Fragment, null, children, /*#__PURE__*/React$1.createElement(_JSXStyle, {
2149
- id: "3647548829",
2150
- dynamic: [theme.palette.background, theme.palette.foreground, theme.palette.background, theme.font.sans, theme.font.sans, theme.palette.link, theme.expressiveness.linkStyle, theme.expressiveness.linkHoverStyle, theme.layout.gapHalf, theme.layout.gapHalf, theme.layout.gapHalf, theme.layout.gap, theme.palette.foreground, theme.palette.code, theme.font.mono, theme.layout.gap, theme.layout.gap, theme.layout.gap, theme.palette.accents_2, theme.layout.radius, theme.font.mono, theme.palette.foreground, theme.palette.accents_2, theme.palette.accents_1, theme.layout.gap, theme.layout.gap, theme.palette.accents_5, theme.palette.accents_1, theme.layout.radius, theme.palette.border, theme.palette.selection, theme.palette.foreground]
2151
- }, "html,body{background-color:".concat(theme.palette.background, ";color:").concat(theme.palette.foreground, ";}html{font-size:16px;--helpdice-icons-background:").concat(theme.palette.background, ";}body{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility;font-size:1rem;line-height:1.5;margin:0;padding:0;min-height:100%;position:relative;overflow-x:hidden;font-family:").concat(theme.font.sans, ";}#__next{overflow-x:hidden;}*,*:before,*:after{box-sizing:inherit;text-rendering:geometricPrecision;-webkit-tap-highlight-color:transparent;}p,small{font-weight:400;color:inherit;-webkit-letter-spacing:-0.005625em;-moz-letter-spacing:-0.005625em;-ms-letter-spacing:-0.005625em;letter-spacing:-0.005625em;font-family:").concat(theme.font.sans, ";}p{margin:1em 0;font-size:1em;line-height:1.625em;}small{margin:0;line-height:1.5;font-size:0.875em;}b{font-weight:600;}span{font-size:inherit;color:inherit;font-weight:inherit;}img{max-width:100%;}a{cursor:pointer;font-size:inherit;-webkit-touch-callout:none;-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-box-align:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:").concat(theme.palette.link, ";-webkit-text-decoration:").concat(theme.expressiveness.linkStyle, ";text-decoration:").concat(theme.expressiveness.linkStyle, ";}a:hover{-webkit-text-decoration:").concat(theme.expressiveness.linkHoverStyle, ";text-decoration:").concat(theme.expressiveness.linkHoverStyle, ";}ul,ol{padding:0;list-style-type:none;margin:").concat(theme.layout.gapHalf, " ").concat(theme.layout.gapHalf, " ").concat(theme.layout.gapHalf, " ").concat(theme.layout.gap, ";color:").concat(theme.palette.foreground, ";}ol{list-style-type:decimal;}li{margin-bottom:0.625em;font-size:1em;line-height:1.625em;}h1,h2,h3,h4,h5,h6{color:inherit;margin:0 0 0.7rem 0;}h1{font-size:3rem;-webkit-letter-spacing:-0.02em;-moz-letter-spacing:-0.02em;-ms-letter-spacing:-0.02em;letter-spacing:-0.02em;line-height:1.5;font-weight:700;}h2{font-size:2.25rem;-webkit-letter-spacing:-0.02em;-moz-letter-spacing:-0.02em;-ms-letter-spacing:-0.02em;letter-spacing:-0.02em;font-weight:600;}h3{font-size:1.5rem;-webkit-letter-spacing:-0.02em;-moz-letter-spacing:-0.02em;-ms-letter-spacing:-0.02em;letter-spacing:-0.02em;font-weight:600;}h4{font-size:1.25rem;-webkit-letter-spacing:-0.02em;-moz-letter-spacing:-0.02em;-ms-letter-spacing:-0.02em;letter-spacing:-0.02em;font-weight:600;}h5{font-size:1rem;-webkit-letter-spacing:-0.01em;-moz-letter-spacing:-0.01em;-ms-letter-spacing:-0.01em;letter-spacing:-0.01em;font-weight:600;}h6{font-size:0.875rem;-webkit-letter-spacing:-0.005em;-moz-letter-spacing:-0.005em;-ms-letter-spacing:-0.005em;letter-spacing:-0.005em;font-weight:600;}button,input,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit;color:inherit;margin:0;}button:focus,input:focus,select:focus,textarea:focus{outline:none;}code{color:").concat(theme.palette.code, ";font-family:").concat(theme.font.mono, ";font-size:0.9em;white-space:pre-wrap;}code:before,code:after{content:'\\`';}pre{padding:calc(").concat(theme.layout.gap, " * 0.9) ").concat(theme.layout.gap, ";margin:").concat(theme.layout.gap, " 0;border:1px solid ").concat(theme.palette.accents_2, ";border-radius:").concat(theme.layout.radius, ";font-family:").concat(theme.font.mono, ";white-space:pre;overflow:auto;line-height:1.5;text-align:left;font-size:14px;-webkit-overflow-scrolling:touch;}pre code{color:").concat(theme.palette.foreground, ";font-size:1em;line-height:1.25em;white-space:pre;}pre code:before,pre code:after{display:none;}pre p{margin:0;}pre::-webkit-scrollbar{display:none;width:0;height:0;background:transparent;}hr{border-color:").concat(theme.palette.accents_2, ";}details{background-color:").concat(theme.palette.accents_1, ";border:none;}details:focus,details:hover,details:active{outline:none;}summary{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;list-style:none;outline:none;}summary::marker,summary::before,summary::-webkit-details-marker{display:none;}summary::-moz-list-bullet{font-size:0;}summary:focus,summary:hover,summary:active{outline:none;list-style:none;}blockquote{padding:calc(0.667 * ").concat(theme.layout.gap, ") ").concat(theme.layout.gap, ";color:").concat(theme.palette.accents_5, ";background-color:").concat(theme.palette.accents_1, ";border-radius:").concat(theme.layout.radius, ";margin:1.5em 0;border:1px solid ").concat(theme.palette.border, ";}blockquote *:first-child{margin-top:0;}blockquote *:last-child{margin-bottom:0;}::selection{background-color:").concat(theme.palette.selection, ";color:").concat(theme.palette.foreground, ";}")));
2152
- };
2153
- var MemoCssBaseline = /*#__PURE__*/React$1.memo(CssBaseline);
2154
-
2155
- var getElementOffset = function getElementOffset(el) {
2156
- if (!el) return {
2157
- top: 0,
2158
- left: 0
2159
- };
2160
- var _el$getBoundingClient = el.getBoundingClientRect(),
2161
- top = _el$getBoundingClient.top,
2162
- left = _el$getBoundingClient.left;
2163
- return {
2164
- top: top,
2165
- left: left
2166
- };
2167
- };
2168
- var defaultRect$1 = {
2169
- top: -1e3,
2170
- left: -1e3,
2171
- right: -1e3,
2172
- width: 0,
2173
- height: 0,
2174
- elementTop: -1e3
2175
- };
2176
- var getRectFromDOMWithContainer = function getRectFromDOMWithContainer(domRect, getContainer) {
2177
- if (!domRect) return defaultRect$1;
2178
- var container = getContainer ? getContainer() : null;
2179
- var scrollElement = container || document.documentElement;
2180
- var _getElementOffset = getElementOffset(container),
2181
- offsetTop = _getElementOffset.top,
2182
- offsetLeft = _getElementOffset.left;
2183
- return _objectSpread2(_objectSpread2({}, domRect), {}, {
2184
- width: domRect.width || domRect.right - domRect.left,
2185
- height: domRect.height || domRect.top - domRect.bottom,
2186
- top: domRect.bottom + scrollElement.scrollTop - offsetTop,
2187
- left: domRect.left + scrollElement.scrollLeft - offsetLeft,
2188
- elementTop: domRect.top + scrollElement.scrollTop - offsetTop
2189
- });
2190
- };
2191
- var isUnplacedRect = function isUnplacedRect(rect) {
2192
- if (!rect) return true;
2193
- return rect.top === defaultRect$1.top && rect.left === defaultRect$1.left;
2194
- };
2195
- var getRefRect = function getRefRect(ref, getContainer) {
2196
- if (!ref || !ref.current) return defaultRect$1;
2197
- var rect = ref.current.getBoundingClientRect();
2198
- return getRectFromDOMWithContainer(rect, getContainer);
2199
- };
2200
- var getEventRect = function getEventRect(event, getContainer) {
2201
- var _event$target;
2202
- var rect = event === null || event === void 0 || (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.getBoundingClientRect();
2203
- if (!rect) return defaultRect$1;
2204
- return getRectFromDOMWithContainer(rect, getContainer);
2205
- };
2206
- var isRefTarget = function isRefTarget(eventOrRef) {
2207
- return typeof (eventOrRef === null || eventOrRef === void 0 ? void 0 : eventOrRef.target) === 'undefined';
2208
- };
2209
- var useRect = function useRect(initialState) {
2210
- var _useState = React$1.useState(initialState || defaultRect$1),
2211
- _useState2 = _slicedToArray(_useState, 2),
2212
- rect = _useState2[0],
2213
- setRect = _useState2[1];
2214
- var updateRect = function updateRect(eventOrRef, getContainer) {
2215
- if (isRefTarget(eventOrRef)) return setRect(getRefRect(eventOrRef, getContainer));
2216
- setRect(getEventRect(eventOrRef, getContainer));
2217
- };
2218
- return {
2219
- rect: rect,
2220
- setRect: updateRect
2221
- };
2222
- };
2223
-
2224
- var defaultToast = {
2225
- delay: 2000,
2226
- type: 'default'
2227
- };
2228
- var useToasts = function useToasts(layout) {
2229
- var _useHUIContext = useHUIContext(),
2230
- updateToasts = _useHUIContext.updateToasts,
2231
- toasts = _useHUIContext.toasts,
2232
- updateToastLayout = _useHUIContext.updateToastLayout,
2233
- updateLastToastId = _useHUIContext.updateLastToastId;
2234
- React$1.useEffect(function () {
2235
- if (!layout) return;
2236
- updateToastLayout(function () {
2237
- return layout ? _objectSpread2(_objectSpread2({}, defaultToastLayout), layout) : defaultToastLayout;
2238
- });
2239
- }, []);
2240
- var _cancel = function cancel(internalId) {
2241
- updateToasts(function (currentToasts) {
2242
- return currentToasts.map(function (item) {
2243
- if (item._internalIdent !== internalId) return item;
2244
- return _objectSpread2(_objectSpread2({}, item), {}, {
2245
- visible: false
2246
- });
2247
- });
2248
- });
2249
- updateLastToastId(function () {
2250
- return internalId;
2251
- });
2252
- };
2253
- var removeAll = function removeAll() {
2254
- updateToasts(function (last) {
2255
- return last.map(function (toast) {
2256
- return _objectSpread2(_objectSpread2({}, toast), {}, {
2257
- visible: false
2258
- });
2259
- });
2260
- });
2261
- };
2262
- var findToastOneByID = function findToastOneByID(id) {
2263
- return toasts.find(function (t) {
2264
- return t.id === id;
2265
- });
2266
- };
2267
- var removeToastOneByID = function removeToastOneByID(id) {
2268
- updateToasts(function (last) {
2269
- return last.map(function (toast) {
2270
- if (toast.id !== id) return toast;
2271
- return _objectSpread2(_objectSpread2({}, toast), {}, {
2272
- visible: false
2273
- });
2274
- });
2275
- });
2276
- };
2277
- var setToast = function setToast(toast) {
2278
- var internalIdent = "toast-".concat(getId());
2279
- var delay = toast.delay || defaultToast.delay;
2280
- if (toast.id) {
2281
- var hasIdent = toasts.find(function (t) {
2282
- return t.id === toast.id;
2283
- });
2284
- if (hasIdent) {
2285
- throw new Error('Toast: Already have the same key: "ident"');
2286
- }
2287
- }
2288
- updateToasts(function (last) {
2289
- var newToast = {
2290
- delay: delay,
2291
- text: toast.text,
2292
- visible: true,
2293
- type: toast.type || defaultToast.type,
2294
- id: toast.id || internalIdent,
2295
- actions: toast.actions || [],
2296
- _internalIdent: internalIdent,
2297
- _timeout: window.setTimeout(function () {
2298
- _cancel(internalIdent);
2299
- if (newToast._timeout) {
2300
- window.clearTimeout(newToast._timeout);
2301
- newToast._timeout = null;
2302
- }
2303
- }, delay),
2304
- cancel: function cancel() {
2305
- return _cancel(internalIdent);
2306
- }
2307
- };
2308
- return [].concat(_toConsumableArray(last), [newToast]);
2309
- });
2310
- };
2311
- return {
2312
- toasts: toasts,
2313
- setToast: setToast,
2314
- removeAll: removeAll,
2315
- findToastOneByID: findToastOneByID,
2316
- removeToastOneByID: removeToastOneByID
2317
- };
2318
- };
2319
-
2320
- tuple('xs', 'sm', 'md', 'lg', 'xl', 'mobile');
2321
- tuple('up', 'down', 'default');
2322
- var defaultResponsiveOptions = {
2323
- match: 'default'
2324
- };
2325
- var makeQueries = function makeQueries(bp, up, down) {
2326
- var queryString = function queryString(item) {
2327
- var upQuery = "(min-width: ".concat(item.min, ")");
2328
- var downQuery = "(max-width: ".concat(item.max, ")");
2329
- return up ? upQuery : down ? downQuery : "".concat(upQuery, " and ").concat(downQuery);
2330
- };
2331
- var xs = queryString(bp.xs);
2332
- return {
2333
- xs: xs,
2334
- mobile: xs,
2335
- sm: queryString(bp.sm),
2336
- md: queryString(bp.md),
2337
- lg: queryString(bp.lg),
2338
- xl: queryString(bp.xl)
2339
- };
2340
- };
2341
- var useMediaQuery = function useMediaQuery(breakpoint) {
2342
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultResponsiveOptions;
2343
- var _options$match = options.match,
2344
- matchType = _options$match === void 0 ? 'default' : _options$match,
2345
- _options$ssrMatchMedi = options.ssrMatchMedia,
2346
- ssrMatchMedia = _options$ssrMatchMedi === void 0 ? null : _options$ssrMatchMedi;
2347
- var supportMedia = typeof window !== 'undefined' && typeof window.matchMedia !== 'undefined';
2348
- var theme = useTheme();
2349
- var mediaQueries = React$1.useMemo(function () {
2350
- var up = matchType === 'up';
2351
- var down = matchType === 'down';
2352
- return makeQueries(theme.breakpoints, up, down);
2353
- }, [theme.breakpoints, options]);
2354
- var query = React$1.useMemo(function () {
2355
- return mediaQueries[breakpoint];
2356
- }, [mediaQueries, breakpoint]);
2357
- var matchQuery = function matchQuery(q) {
2358
- return window.matchMedia(q);
2359
- };
2360
-
2361
- /**
2362
- * Do nothing in the server-side rendering.
2363
- * If server match query fucntion is simulated, return user-defined value first.
2364
- */
2365
- var _useState = React$1.useState(function () {
2366
- if (supportMedia) return matchQuery(query).matches;
2367
- if (ssrMatchMedia && typeof ssrMatchMedia === 'function') {
2368
- return ssrMatchMedia(query).matches;
2369
- }
2370
- return false;
2371
- }),
2372
- _useState2 = _slicedToArray(_useState, 2),
2373
- state = _useState2[0],
2374
- setState = _useState2[1];
2375
- React$1.useEffect(function () {
2376
- if (!supportMedia) return;
2377
- var queryList = matchQuery(query);
2378
- var update = function update() {
2379
- return setState(matchQuery(query).matches);
2380
- };
2381
- update();
2382
-
2383
- /**
2384
- * addListener is deprecated. EventTarget.addEventListener is recommended.
2385
- * But in some old browsers, MediaQueryList does not inherit from EventTarget.
2386
- */
2387
- queryList.addListener(update);
2388
- return function () {
2389
- queryList.removeListener(update);
2390
- };
2391
- }, [supportMedia]);
2392
- return state;
2393
- };
2394
-
2395
- /* "use client" */
2396
-
2397
- var usePrevious = function usePrevious(state) {
2398
- var ref = React$1.useRef(null);
2399
- React$1.useEffect(function () {
2400
- ref.current = state;
2401
- });
2402
- return ref ? ref.current : null;
2403
- };
2404
-
2405
- var _excluded$1 = ["rect", "visible", "hoverHeightRatio", "hoverWidthRatio", "activeOpacity", "className"];
2406
- var Highlight = function Highlight(_ref) {
2407
- var rect = _ref.rect,
2408
- visible = _ref.visible,
2409
- _ref$hoverHeightRatio = _ref.hoverHeightRatio,
2410
- hoverHeightRatio = _ref$hoverHeightRatio === void 0 ? 1 : _ref$hoverHeightRatio,
2411
- _ref$hoverWidthRatio = _ref.hoverWidthRatio,
2412
- hoverWidthRatio = _ref$hoverWidthRatio === void 0 ? 1 : _ref$hoverWidthRatio,
2413
- _ref$activeOpacity = _ref.activeOpacity,
2414
- activeOpacity = _ref$activeOpacity === void 0 ? 0.8 : _ref$activeOpacity,
2415
- className = _ref.className,
2416
- props = _objectWithoutProperties(_ref, _excluded$1);
2417
- var theme = useTheme();
2418
- var ref = React$1.useRef(null);
2419
- var isFirstVisible = usePrevious(isUnplacedRect(rect));
2420
- var position = React$1.useMemo(function () {
2421
- var width = rect.width * hoverWidthRatio;
2422
- var height = rect.height * hoverHeightRatio;
2423
- return {
2424
- width: "".concat(width, "px"),
2425
- left: "".concat(rect.left + (rect.width - width) / 2, "px"),
2426
- height: "".concat(height, "px"),
2427
- top: "".concat(rect.elementTop + (rect.height - height) / 2, "px"),
2428
- transition: isFirstVisible ? 'opacity' : 'opacity, width, left, top'
2429
- };
2430
- }, [rect, hoverWidthRatio, hoverHeightRatio]);
2431
- return /*#__PURE__*/React$1.createElement("div", _extends({
2432
- ref: ref
2433
- }, props, {
2434
- className: _JSXStyle.dynamic([["603024321", [theme.palette.accents_2, position.width, position.left, position.height, position.top, visible ? activeOpacity : 0, position.transition]]]) + " " + (props && props.className != null && props.className || useClasses('highlight', className) || "")
2435
- }), /*#__PURE__*/React$1.createElement(_JSXStyle, {
2436
- id: "603024321",
2437
- dynamic: [theme.palette.accents_2, position.width, position.left, position.height, position.top, visible ? activeOpacity : 0, position.transition]
2438
- }, ".highlight.__jsx-style-dynamic-selector{background:".concat(theme.palette.accents_2, ";position:absolute;border-radius:5px;width:").concat(position.width, ";left:").concat(position.left, ";height:").concat(position.height, ";top:").concat(position.top, ";opacity:").concat(visible ? activeOpacity : 0, ";-webkit-transition:0.15s ease;transition:0.15s ease;-webkit-transition-property:").concat(position.transition, ";transition-property:").concat(position.transition, ";}")));
2439
- };
2440
-
2441
- var Ellipsis = function Ellipsis(_ref) {
2442
- var children = _ref.children,
2443
- height = _ref.height;
2444
- return /*#__PURE__*/React$1.createElement("span", {
2445
- className: _JSXStyle.dynamic([["822089635", [height]]])
2446
- }, children, /*#__PURE__*/React$1.createElement(_JSXStyle, {
2447
- id: "822089635",
2448
- dynamic: [height]
2449
- }, "span.__jsx-style-dynamic-selector{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:".concat(height, ";min-width:0;}")));
2450
- };
2451
- var ellipsis = /*#__PURE__*/React$1.memo(Ellipsis);
2452
-
2453
- var getRealShape = function getRealShape(el) {
2454
- var defaultShape = {
2455
- width: 0,
2456
- height: 0
2457
- };
2458
- if (!el || typeof window === 'undefined') return defaultShape;
2459
- var rect = el.getBoundingClientRect();
2460
- var _window$getComputedSt = window.getComputedStyle(el),
2461
- width = _window$getComputedSt.width,
2462
- height = _window$getComputedSt.height;
2463
- var getCSSStyleVal = function getCSSStyleVal(str, parentNum) {
2464
- if (!str) return 0;
2465
- var strVal = str.includes('px') ? +str.split('px')[0] : str.includes('%') ? +str.split('%')[0] * parentNum * 0.01 : str;
2466
- return Number.isNaN(+strVal) ? 0 : +strVal;
2467
- };
2468
- return {
2469
- width: getCSSStyleVal("".concat(width), rect.width),
2470
- height: getCSSStyleVal("".concat(height), rect.height)
2471
- };
2472
- };
2473
- var useRealShape = function useRealShape(ref) {
2474
- var _useState = React$1.useState({
2475
- width: 0,
2476
- height: 0
2477
- }),
2478
- _useState2 = _slicedToArray(_useState, 2),
2479
- state = _useState2[0],
2480
- setState = _useState2[1];
2481
- var update = function update() {
2482
- var _getRealShape = getRealShape(ref.current),
2483
- width = _getRealShape.width,
2484
- height = _getRealShape.height;
2485
- setState({
2486
- width: width,
2487
- height: height
2488
- });
2489
- };
2490
- React$1.useEffect(function () {
2491
- return update();
2492
- }, [ref.current]);
2493
- return [state, update];
2494
- };
2495
-
2496
- var Expand = function Expand(_ref) {
2497
- var _ref$isExpanded = _ref.isExpanded,
2498
- isExpanded = _ref$isExpanded === void 0 ? false : _ref$isExpanded,
2499
- _ref$delay = _ref.delay,
2500
- delay = _ref$delay === void 0 ? 200 : _ref$delay,
2501
- children = _ref.children;
2502
- var _useState = React$1.useState(isExpanded ? 'auto' : '0'),
2503
- _useState2 = _slicedToArray(_useState, 2),
2504
- height = _useState2[0],
2505
- setHeight = _useState2[1];
2506
- var _useState3 = React$1.useState(isExpanded),
2507
- _useState4 = _slicedToArray(_useState3, 2),
2508
- selfExpanded = _useState4[0],
2509
- setSelfExpanded = _useState4[1];
2510
- var _useState5 = React$1.useState(isExpanded),
2511
- _useState6 = _slicedToArray(_useState5, 2),
2512
- visible = _useState6[0],
2513
- setVisible = _useState6[1];
2514
- var contentRef = React$1.useRef(null);
2515
- var entryTimer = React$1.useRef();
2516
- var leaveTimer = React$1.useRef();
2517
- var resetTimer = React$1.useRef();
2518
- var _useRealShape = useRealShape(contentRef),
2519
- _useRealShape2 = _slicedToArray(_useRealShape, 2),
2520
- state = _useRealShape2[0],
2521
- updateShape = _useRealShape2[1];
2522
- var classes = useClasses('container', {
2523
- expanded: selfExpanded
2524
- });
2525
- React$1.useEffect(function () {
2526
- return setHeight("".concat(state.height, "px"));
2527
- }, [state.height]);
2528
- React$1.useEffect(function () {
2529
- // show element or reset height.
2530
- // force an update once manually, even if the element does not change.
2531
- // (the height of the element might be "auto")
2532
- if (isExpanded) {
2533
- setVisible(isExpanded);
2534
- } else {
2535
- updateShape();
2536
- setHeight("".concat(state.height, "px"));
2537
- }
2538
-
2539
- // show expand animation
2540
- entryTimer.current = window.setTimeout(function () {
2541
- setSelfExpanded(isExpanded);
2542
- clearTimeout(entryTimer.current);
2543
- }, 30);
2544
-
2545
- // Reset height after animation
2546
- if (isExpanded) {
2547
- resetTimer.current = window.setTimeout(function () {
2548
- setHeight('auto');
2549
- clearTimeout(resetTimer.current);
2550
- }, delay);
2551
- } else {
2552
- leaveTimer.current = window.setTimeout(function () {
2553
- setVisible(isExpanded);
2554
- clearTimeout(leaveTimer.current);
2555
- }, delay / 2);
2556
- }
2557
- return function () {
2558
- clearTimeout(entryTimer.current);
2559
- clearTimeout(leaveTimer.current);
2560
- clearTimeout(resetTimer.current);
2561
- };
2562
- }, [isExpanded]);
2563
- return /*#__PURE__*/React$1.createElement("div", {
2564
- className: _JSXStyle.dynamic([["1918690829", [visible ? 'visible' : 'hidden', delay, height]]]) + " " + (classes || "")
2565
- }, /*#__PURE__*/React$1.createElement("div", {
2566
- ref: contentRef,
2567
- className: _JSXStyle.dynamic([["1918690829", [visible ? 'visible' : 'hidden', delay, height]]]) + " " + "content"
2568
- }, children), /*#__PURE__*/React$1.createElement(_JSXStyle, {
2569
- id: "1918690829",
2570
- dynamic: [visible ? 'visible' : 'hidden', delay, height]
2571
- }, ".container.__jsx-style-dynamic-selector{padding:0;margin:0;height:0;overflow:hidden;visibility:".concat(visible ? 'visible' : 'hidden', ";-webkit-transition:height ").concat(delay, "ms ease;transition:height ").concat(delay, "ms ease;}.expanded.__jsx-style-dynamic-selector{height:").concat(height, ";visibility:visible;}")));
2572
- };
2573
- Expand.displayName = 'Expand';
2574
-
2575
- /* "use client" */
2576
-
2577
- var useResize = function useResize(callback) {
2578
- var immediatelyInvoke = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
2579
- React$1.useEffect(function () {
2580
- var fn = function fn() {
2581
- return callback();
2582
- };
2583
- if (immediatelyInvoke) {
2584
- fn();
2585
- }
2586
- window.addEventListener('resize', fn);
2587
- return function () {
2588
- return window.removeEventListener('resize', fn);
2589
- };
2590
- }, []);
2591
- };
2592
-
2593
- /* "use client" */
2594
-
2595
- var useClickAnyWhere = function useClickAnyWhere(handler) {
2596
- React$1.useEffect(function () {
2597
- var callback = function callback(event) {
2598
- return handler(event);
2599
- };
2600
- document.addEventListener('click', callback);
2601
- return function () {
2602
- return document.removeEventListener('click', callback);
2603
- };
2604
- }, [handler]);
2605
- };
2606
-
2607
- /* "use client" */
2608
-
2609
- var useDOMObserver = function useDOMObserver(ref) {
2610
- var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
2611
- var config = {
2612
- attributes: false,
2613
- childList: true,
2614
- subtree: true
2615
- };
2616
- React$1.useEffect(function () {
2617
- if (!ref || !ref.current) return;
2618
- var unmount = false;
2619
- var done = function done() {
2620
- if (unmount) return;
2621
- callback.apply(void 0, arguments);
2622
- };
2623
- var observer = new MutationObserver(done);
2624
- observer.observe(ref.current, config);
2625
- return function () {
2626
- unmount = true;
2627
- observer.disconnect();
2628
- };
2629
- }, [ref]);
2630
- };
2631
-
2632
- var warningStack = {};
2633
- var useWarning = function useWarning(message, component) {
2634
- var tag = ' ';
2635
- var log = "[Helpdice UI]".concat(tag, ": ").concat(message);
2636
- if (typeof console === 'undefined') return;
2637
- if (warningStack[log]) return;
2638
- warningStack[log] = true;
2639
- if (process.env.NODE_ENV !== 'production') {
2640
- return console.error(log);
2641
- }
2642
- console.warn(log);
2643
- };
2644
-
2645
- var defaultRect = {
2646
- top: -1e3,
2647
- left: -1e3,
2648
- right: -1e3,
2649
- width: 0
2650
- };
2651
- var Dropdown = /*#__PURE__*/React$1.memo(function (_ref) {
2652
- var children = _ref.children,
2653
- parent = _ref.parent,
2654
- visible = _ref.visible,
2655
- disableMatchWidth = _ref.disableMatchWidth,
2656
- getPopupContainer = _ref.getPopupContainer;
2657
- var el = usePortal('dropdown', getPopupContainer);
2658
- var _useState = React$1.useState(defaultRect),
2659
- _useState2 = _slicedToArray(_useState, 2),
2660
- rect = _useState2[0],
2661
- setRect = _useState2[1];
2662
- var classes = useClasses('dropdown', disableMatchWidth ? 'disable-match' : 'width-match');
2663
- if (!parent) return null;
2664
-
2665
- /* istanbul ignore next */
2666
- if (process.env.NODE_ENV !== 'production') {
2667
- if (getPopupContainer && getPopupContainer()) {
2668
- var _el = getPopupContainer();
2669
- var style = window.getComputedStyle(_el);
2670
- if (style.position === 'static') {
2671
- useWarning('The element specified by "getPopupContainer" must have "position" set.');
2672
- }
2673
- }
2674
- }
2675
- var updateRect = function updateRect() {
2676
- var _getRefRect = getRefRect(parent, getPopupContainer),
2677
- top = _getRefRect.top,
2678
- left = _getRefRect.left,
2679
- right = _getRefRect.right,
2680
- nativeWidth = _getRefRect.width;
2681
- setRect({
2682
- top: top,
2683
- left: left,
2684
- right: right,
2685
- width: nativeWidth
2686
- });
2687
- };
2688
- useResize(updateRect);
2689
- useClickAnyWhere(function () {
2690
- var _getRefRect2 = getRefRect(parent, getPopupContainer),
2691
- top = _getRefRect2.top,
2692
- left = _getRefRect2.left;
2693
- var shouldUpdatePosition = top !== rect.top || left !== rect.left;
2694
- if (!shouldUpdatePosition) return;
2695
- updateRect();
2696
- });
2697
- useDOMObserver(parent, function () {
2698
- updateRect();
2699
- });
2700
- React$1.useEffect(function () {
2701
- if (!parent || !parent.current) return;
2702
- parent.current.addEventListener('mouseenter', updateRect);
2703
- /* istanbul ignore next */
2704
- return function () {
2705
- if (!parent || !parent.current) return;
2706
- parent.current.removeEventListener('mouseenter', updateRect);
2707
- };
2708
- }, [parent]);
2709
- var clickHandler = function clickHandler(event) {
2710
- event.stopPropagation();
2711
- event.nativeEvent.stopImmediatePropagation();
2712
- event.preventDefault();
2713
- };
2714
- var mouseDownHandler = function mouseDownHandler(event) {
2715
- event.preventDefault();
2716
- };
2717
- if (!el) return null;
2718
- return /*#__PURE__*/reactDom.createPortal(/*#__PURE__*/React$1.createElement(CssTransition, {
2719
- visible: visible
2720
- }, /*#__PURE__*/React$1.createElement("div", {
2721
- onClick: clickHandler,
2722
- onMouseDown: mouseDownHandler,
2723
- className: _JSXStyle.dynamic([["1644673105", [rect.top + 2, rect.left, rect.width, rect.width]]]) + " " + (classes || "")
2724
- }, children, /*#__PURE__*/React$1.createElement(_JSXStyle, {
2725
- id: "1644673105",
2726
- dynamic: [rect.top + 2, rect.left, rect.width, rect.width]
2727
- }, ".dropdown.__jsx-style-dynamic-selector{position:absolute;top:".concat(rect.top + 2, "px;left:").concat(rect.left, "px;z-index:1100;}.width-match.__jsx-style-dynamic-selector{width:").concat(rect.width, "px;}.disable-match.__jsx-style-dynamic-selector{min-width:").concat(rect.width, "px;}")))), el);
2728
- });
2729
-
2730
- var _excluded = ["children", "onClick", "visible", "width", "onContentClick", "backdropClassName", "positionClassName", "layerClassName"];
2731
- var Backdrop = /*#__PURE__*/React$1.memo(function (_ref) {
2732
- var children = _ref.children,
2733
- _ref$onClick = _ref.onClick,
2734
- onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick,
2735
- _ref$visible = _ref.visible,
2736
- visible = _ref$visible === void 0 ? false : _ref$visible,
2737
- width = _ref.width,
2738
- _ref$onContentClick = _ref.onContentClick,
2739
- onContentClick = _ref$onContentClick === void 0 ? function () {} : _ref$onContentClick,
2740
- _ref$backdropClassNam = _ref.backdropClassName,
2741
- backdropClassName = _ref$backdropClassNam === void 0 ? '' : _ref$backdropClassNam,
2742
- _ref$positionClassNam = _ref.positionClassName,
2743
- positionClassName = _ref$positionClassNam === void 0 ? '' : _ref$positionClassNam,
2744
- _ref$layerClassName = _ref.layerClassName,
2745
- layerClassName = _ref$layerClassName === void 0 ? '' : _ref$layerClassName,
2746
- props = _objectWithoutProperties(_ref, _excluded);
2747
- var theme = useTheme();
2748
- var _useCurrentState = useCurrentState(false),
2749
- _useCurrentState2 = _slicedToArray(_useCurrentState, 3),
2750
- setIsContentMouseDown = _useCurrentState2[1],
2751
- IsContentMouseDownRef = _useCurrentState2[2];
2752
- var clickHandler = function clickHandler(event) {
2753
- if (IsContentMouseDownRef.current) return;
2754
- onClick && onClick(event);
2755
- };
2756
- var mouseUpHandler = function mouseUpHandler() {
2757
- if (!IsContentMouseDownRef.current) return;
2758
- var timer = setTimeout(function () {
2759
- setIsContentMouseDown(false);
2760
- clearTimeout(timer);
2761
- }, 0);
2762
- };
2763
- return /*#__PURE__*/React$1.createElement(CssTransition, {
2764
- name: "backdrop-wrapper",
2765
- visible: visible,
2766
- clearTime: 300
2767
- }, /*#__PURE__*/React$1.createElement("div", _extends({
2768
- onClick: clickHandler,
2769
- onMouseUp: mouseUpHandler
2770
- }, props, {
2771
- className: _JSXStyle.dynamic([["2021762493", [width, theme.expressiveness.portalOpacity, theme.expressiveness.portalOpacity, theme.expressiveness.portalOpacity]]]) + " " + (props && props.className != null && props.className || useClasses('backdrop', backdropClassName) || "")
2772
- }), /*#__PURE__*/React$1.createElement("div", {
2773
- className: _JSXStyle.dynamic([["2021762493", [width, theme.expressiveness.portalOpacity, theme.expressiveness.portalOpacity, theme.expressiveness.portalOpacity]]]) + " " + (useClasses('layer', layerClassName) || "")
2774
- }), /*#__PURE__*/React$1.createElement("div", {
2775
- onClick: onContentClick,
2776
- onMouseDown: function onMouseDown() {
2777
- return setIsContentMouseDown(true);
2778
- },
2779
- className: _JSXStyle.dynamic([["2021762493", [width, theme.expressiveness.portalOpacity, theme.expressiveness.portalOpacity, theme.expressiveness.portalOpacity]]]) + " " + (useClasses('position', positionClassName) || "")
2780
- }, children), /*#__PURE__*/React$1.createElement(_JSXStyle, {
2781
- id: "2021762493",
2782
- dynamic: [width, theme.expressiveness.portalOpacity, theme.expressiveness.portalOpacity, theme.expressiveness.portalOpacity]
2783
- }, ".backdrop.__jsx-style-dynamic-selector{position:fixed;top:0;left:0;right:0;bottom:0;overflow:auto;z-index:1000;-webkit-overflow-scrolling:touch;box-sizing:border-box;text-align:center;}.position.__jsx-style-dynamic-selector{position:relative;z-index:1001;outline:none;max-width:90%;width:".concat(width, ";margin:20px auto;vertical-align:middle;display:inline-block;}.backdrop.__jsx-style-dynamic-selector:before{display:inline-block;width:0;height:100%;vertical-align:middle;content:'';}.layer.__jsx-style-dynamic-selector{position:fixed;top:0;left:0;right:0;bottom:0;width:100%;height:100%;opacity:").concat(theme.expressiveness.portalOpacity, ";background-color:black;-webkit-transition:opacity 0.35s cubic-bezier(0.4,0,0.2,1);transition:opacity 0.35s cubic-bezier(0.4,0,0.2,1);pointer-events:none;z-index:1000;}.backdrop-wrapper-enter.__jsx-style-dynamic-selector .layer.__jsx-style-dynamic-selector{opacity:0;}.backdrop-wrapper-enter-active.__jsx-style-dynamic-selector .layer.__jsx-style-dynamic-selector{opacity:").concat(theme.expressiveness.portalOpacity, ";}.backdrop-wrapper-leave.__jsx-style-dynamic-selector .layer.__jsx-style-dynamic-selector{opacity:").concat(theme.expressiveness.portalOpacity, ";}.backdrop-wrapper-leave-active.__jsx-style-dynamic-selector .layer.__jsx-style-dynamic-selector{opacity:0;}"))));
2784
- });
2785
- Backdrop.displayName = 'Backdrop';
2786
-
2787
- dist.Backdrop = Backdrop;
2788
- dist.CssBaseline = MemoCssBaseline;
2789
- dist.CssTransition = CssTransition;
2790
- dist.Dropdown = Dropdown;
2791
- dist.Ellipsis = ellipsis;
2792
- dist.Expand = Expand;
2793
- dist.Highlight = Highlight;
2794
- dist.Themes = Themes;
2795
- dist.UiProvider = HuiProvider;
2796
- dist.useAllThemes = useAllThemes;
2797
- dist.useClasses = useClasses;
2798
- dist.useCurrentState = useCurrentState;
2799
- dist.useMediaQuery = useMediaQuery;
2800
- dist.useRect = useRect;
2801
- dist.useTheme = useTheme;
2802
- dist.useToasts = useToasts;
2803
- return dist;
2804
- }
2805
-
2806
- var distExports = /*@__PURE__*/ requireDist();
2807
-
2808
689
  var _excluded$6 = ["className", "children"];
2809
690
  var FieldsetTitle = function FieldsetTitle(_ref) {
2810
691
  var _ref$className = _ref.className,
2811
692
  className = _ref$className === void 0 ? '' : _ref$className,
2812
693
  children = _ref.children,
2813
694
  props = _objectWithoutProperties(_ref, _excluded$6);
2814
- var classes = distExports.useClasses('title', className);
695
+ var classes = theme.useClasses('title', className);
2815
696
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", _extends({}, props, {
2816
697
  className: "jsx-4105044205" + " " + (props && props.className != null && props.className || classes || "")
2817
698
  }), children), /*#__PURE__*/React.createElement(_JSXStyle, {
@@ -2954,7 +835,7 @@ var withScale = function withScale(Render) {
2954
835
  var _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _ref0, _ref1, _ref10, _ref11, _ref12, _ref13, _ref14, _ref15, _ref16, _ref17, _ref18, _ref19, _ref20, _ref21, _ref22, _ref23, _ref24, _ref25, _ref26, _ref27, _ref28, _ref29, _ref30, _ref31;
2955
836
  var children = _ref.children,
2956
837
  props = _objectWithoutProperties(_ref, _excluded$4);
2957
- var _useTheme = distExports.useTheme(),
838
+ var _useTheme = theme.useTheme(),
2958
839
  layout = _useTheme.layout;
2959
840
  var paddingLeft = props.paddingLeft,
2960
841
  pl = props.pl,
@@ -3042,15 +923,15 @@ var FieldsetFooterComponent = function FieldsetFooterComponent(_ref) {
3042
923
  className = _ref$className === void 0 ? '' : _ref$className,
3043
924
  children = _ref.children,
3044
925
  props = _objectWithoutProperties(_ref, _excluded$3);
3045
- var theme = distExports.useTheme();
926
+ var theme$1 = theme.useTheme();
3046
927
  var _useScale = useScale(),
3047
928
  SCALES = _useScale.SCALES;
3048
929
  return /*#__PURE__*/React.createElement("footer", _extends({}, props, {
3049
- className: _JSXStyle.dynamic([["903731644", [theme.palette.accents_1, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.accents_6, theme.layout.gapHalf, theme.layout.gap, SCALES.font(0.875), SCALES.width(1, 'auto'), SCALES.height(2.875), SCALES.pt(0.625), SCALES.pr(1.31), SCALES.pb(0.625), SCALES.pl(1.31), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]]]) + " " + (props && props.className != null && props.className || className || "")
930
+ className: _JSXStyle.dynamic([["903731644", [theme$1.palette.accents_1, theme$1.palette.border, theme$1.layout.radius, theme$1.layout.radius, theme$1.palette.accents_6, theme$1.layout.gapHalf, theme$1.layout.gap, SCALES.font(0.875), SCALES.width(1, 'auto'), SCALES.height(2.875), SCALES.pt(0.625), SCALES.pr(1.31), SCALES.pb(0.625), SCALES.pl(1.31), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]]]) + " " + (props && props.className != null && props.className || className || "")
3050
931
  }), children, /*#__PURE__*/React.createElement(_JSXStyle, {
3051
932
  id: "903731644",
3052
- dynamic: [theme.palette.accents_1, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.accents_6, theme.layout.gapHalf, theme.layout.gap, SCALES.font(0.875), SCALES.width(1, 'auto'), SCALES.height(2.875), SCALES.pt(0.625), SCALES.pr(1.31), SCALES.pb(0.625), SCALES.pl(1.31), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]
3053
- }, "footer.__jsx-style-dynamic-selector{background-color:".concat(theme.palette.accents_1, ";border-top:1px solid ").concat(theme.palette.border, ";border-bottom-left-radius:").concat(theme.layout.radius, ";border-bottom-right-radius:").concat(theme.layout.radius, ";display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;overflow:hidden;color:").concat(theme.palette.accents_6, ";padding:").concat(theme.layout.gapHalf, " ").concat(theme.layout.gap, ";box-sizing:border-box;font-size:").concat(SCALES.font(0.875), ";width:").concat(SCALES.width(1, 'auto'), ";height:").concat(SCALES.height(2.875), ";padding:").concat(SCALES.pt(0.625), " ").concat(SCALES.pr(1.31), " ").concat(SCALES.pb(0.625), " ").concat(SCALES.pl(1.31), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}")));
933
+ dynamic: [theme$1.palette.accents_1, theme$1.palette.border, theme$1.layout.radius, theme$1.layout.radius, theme$1.palette.accents_6, theme$1.layout.gapHalf, theme$1.layout.gap, SCALES.font(0.875), SCALES.width(1, 'auto'), SCALES.height(2.875), SCALES.pt(0.625), SCALES.pr(1.31), SCALES.pb(0.625), SCALES.pl(1.31), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]
934
+ }, "footer.__jsx-style-dynamic-selector{background-color:".concat(theme$1.palette.accents_1, ";border-top:1px solid ").concat(theme$1.palette.border, ";border-bottom-left-radius:").concat(theme$1.layout.radius, ";border-bottom-right-radius:").concat(theme$1.layout.radius, ";display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;overflow:hidden;color:").concat(theme$1.palette.accents_6, ";padding:").concat(theme$1.layout.gapHalf, " ").concat(theme$1.layout.gap, ";box-sizing:border-box;font-size:").concat(SCALES.font(0.875), ";width:").concat(SCALES.width(1, 'auto'), ";height:").concat(SCALES.height(2.875), ";padding:").concat(SCALES.pt(0.625), " ").concat(SCALES.pr(1.31), " ").concat(SCALES.pb(0.625), " ").concat(SCALES.pl(1.31), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}")));
3054
935
  };
3055
936
  FieldsetFooterComponent.displayName = 'FieldsetFooter';
3056
937
  var FieldsetFooter = withScale(FieldsetFooterComponent);
@@ -3063,7 +944,7 @@ var FieldsetContentComponent = function FieldsetContentComponent(_ref) {
3063
944
  props = _objectWithoutProperties(_ref, _excluded$2);
3064
945
  var _useScale = useScale(),
3065
946
  SCALES = _useScale.SCALES;
3066
- var classes = distExports.useClasses('content', className);
947
+ var classes = theme.useClasses('content', className);
3067
948
  return /*#__PURE__*/React.createElement("div", _extends({}, props, {
3068
949
  className: _JSXStyle.dynamic([["2403982542", [SCALES.width(1, '100%'), SCALES.height(1, 'auto'), SCALES.pt(1.3), SCALES.pr(1.3), SCALES.pb(1.3), SCALES.pl(1.3), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]]]) + " " + (props && props.className != null && props.className || classes || "")
3069
950
  }), children, /*#__PURE__*/React.createElement(_JSXStyle, {
@@ -3112,7 +993,7 @@ var FieldsetComponent = function FieldsetComponent(_ref) {
3112
993
  _ref$label = _ref.label,
3113
994
  label = _ref$label === void 0 ? '' : _ref$label,
3114
995
  props = _objectWithoutProperties(_ref, _excluded$1);
3115
- var theme = distExports.useTheme();
996
+ var theme$1 = theme.useTheme();
3116
997
  var _useScale = useScale(),
3117
998
  SCALES = _useScale.SCALES;
3118
999
  var _useFieldset = useFieldset(),
@@ -3123,7 +1004,7 @@ var FieldsetComponent = function FieldsetComponent(_ref) {
3123
1004
  _useState2 = _slicedToArray(_useState, 2),
3124
1005
  hidden = _useState2[0],
3125
1006
  setHidden = _useState2[1];
3126
- var classes = distExports.useClasses('fieldset', className);
1007
+ var classes = theme.useClasses('fieldset', className);
3127
1008
  var _pickChild = pickChild(children, FieldsetFooter),
3128
1009
  _pickChild2 = _slicedToArray(_pickChild, 2),
3129
1010
  withoutFooterChildren = _pickChild2[0],
@@ -3156,11 +1037,11 @@ var FieldsetComponent = function FieldsetComponent(_ref) {
3156
1037
  return /*#__PURE__*/React.createElement(React.Fragment, null, withoutFooterChildren, !hasTitle && title && /*#__PURE__*/React.createElement(FieldsetTitle, null, title), !hasSubtitle && subtitle && /*#__PURE__*/React.createElement(FieldsetSubtitle, null, subtitle));
3157
1038
  }, [withoutFooterChildren, hasTitle, hasSubtitle, title, subtitle]);
3158
1039
  return /*#__PURE__*/React.createElement("div", _extends({}, props, {
3159
- className: _JSXStyle.dynamic([["3253250630", [theme.palette.background, theme.palette.border, theme.layout.radius, hidden ? 'none' : 'block', SCALES.font(1), SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]]]) + " " + (props && props.className != null && props.className || classes || "")
1040
+ className: _JSXStyle.dynamic([["3253250630", [theme$1.palette.background, theme$1.palette.border, theme$1.layout.radius, hidden ? 'none' : 'block', SCALES.font(1), SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]]]) + " " + (props && props.className != null && props.className || classes || "")
3160
1041
  }), hasContent ? content : /*#__PURE__*/React.createElement(FieldsetContent, null, content), FooterChildren && FooterChildren, /*#__PURE__*/React.createElement(_JSXStyle, {
3161
1042
  id: "3253250630",
3162
- dynamic: [theme.palette.background, theme.palette.border, theme.layout.radius, hidden ? 'none' : 'block', SCALES.font(1), SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]
3163
- }, ".fieldset.__jsx-style-dynamic-selector{background-color:".concat(theme.palette.background, ";border:1px solid ").concat(theme.palette.border, ";border-radius:").concat(theme.layout.radius, ";overflow:hidden;display:").concat(hidden ? 'none' : 'block', ";font-size:").concat(SCALES.font(1), ";width:").concat(SCALES.width(1, 'auto'), ";height:").concat(SCALES.height(1, 'auto'), ";padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}")));
1043
+ dynamic: [theme$1.palette.background, theme$1.palette.border, theme$1.layout.radius, hidden ? 'none' : 'block', SCALES.font(1), SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]
1044
+ }, ".fieldset.__jsx-style-dynamic-selector{background-color:".concat(theme$1.palette.background, ";border:1px solid ").concat(theme$1.palette.border, ";border-radius:").concat(theme$1.layout.radius, ";overflow:hidden;display:").concat(hidden ? 'none' : 'block', ";font-size:").concat(SCALES.font(1), ";width:").concat(SCALES.width(1, 'auto'), ";height:").concat(SCALES.height(1, 'auto'), ";padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}")));
3164
1045
  };
3165
1046
  FieldsetComponent.displayName = 'Fieldset';
3166
1047
  var Fieldset = withScale(FieldsetComponent);
@@ -3173,19 +1054,19 @@ var FieldsetGroupComponent = function FieldsetGroupComponent(_ref) {
3173
1054
  value = _ref.value,
3174
1055
  onChange = _ref.onChange,
3175
1056
  props = _objectWithoutProperties(_ref, _excluded);
3176
- var theme = distExports.useTheme();
1057
+ var theme$1 = theme.useTheme();
3177
1058
  var _useScale = useScale(),
3178
1059
  SCALES = _useScale.SCALES;
3179
1060
  var _useState = React.useState(value),
3180
1061
  _useState2 = _slicedToArray(_useState, 2),
3181
1062
  selfVal = _useState2[0],
3182
1063
  setSelfVal = _useState2[1];
3183
- var _useCurrentState = distExports.useCurrentState([]),
1064
+ var _useCurrentState = theme.useCurrentState([]),
3184
1065
  _useCurrentState2 = _slicedToArray(_useCurrentState, 3),
3185
1066
  items = _useCurrentState2[0],
3186
1067
  setItems = _useCurrentState2[1],
3187
1068
  ref = _useCurrentState2[2];
3188
- var classes = distExports.useClasses('group', className);
1069
+ var classes = theme.useClasses('group', className);
3189
1070
  var register = function register(newItem) {
3190
1071
  var hasItem = ref.current.find(function (item) {
3191
1072
  return item.value === newItem.value;
@@ -3209,9 +1090,9 @@ var FieldsetGroupComponent = function FieldsetGroupComponent(_ref) {
3209
1090
  return /*#__PURE__*/React.createElement(FieldsetContext.Provider, {
3210
1091
  value: providerValue
3211
1092
  }, /*#__PURE__*/React.createElement("div", _extends({}, props, {
3212
- className: _JSXStyle.dynamic([["3411776855", [SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0, 0), SCALES.ml(0), SCALES.font(1), theme.palette.accents_3, theme.palette.accents_1, theme.palette.border, theme.palette.background, theme.palette.foreground, theme.layout.radius, theme.layout.radius]]]) + " " + (props && props.className != null && props.className || classes || "")
1093
+ className: _JSXStyle.dynamic([["3411776855", [SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0, 0), SCALES.ml(0), SCALES.font(1), theme$1.palette.accents_3, theme$1.palette.accents_1, theme$1.palette.border, theme$1.palette.background, theme$1.palette.foreground, theme$1.layout.radius, theme$1.layout.radius]]]) + " " + (props && props.className != null && props.className || classes || "")
3213
1094
  }), /*#__PURE__*/React.createElement("div", {
3214
- className: _JSXStyle.dynamic([["3411776855", [SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0, 0), SCALES.ml(0), SCALES.font(1), theme.palette.accents_3, theme.palette.accents_1, theme.palette.border, theme.palette.background, theme.palette.foreground, theme.layout.radius, theme.layout.radius]]]) + " " + "group-tabs"
1095
+ className: _JSXStyle.dynamic([["3411776855", [SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0, 0), SCALES.ml(0), SCALES.font(1), theme$1.palette.accents_3, theme$1.palette.accents_1, theme$1.palette.border, theme$1.palette.background, theme$1.palette.foreground, theme$1.layout.radius, theme$1.layout.radius]]]) + " " + "group-tabs"
3215
1096
  }, items.map(function (item) {
3216
1097
  return /*#__PURE__*/React.createElement("button", {
3217
1098
  type: "button",
@@ -3219,14 +1100,14 @@ var FieldsetGroupComponent = function FieldsetGroupComponent(_ref) {
3219
1100
  return clickHandle(item.value);
3220
1101
  },
3221
1102
  key: item.value,
3222
- className: _JSXStyle.dynamic([["3411776855", [SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0, 0), SCALES.ml(0), SCALES.font(1), theme.palette.accents_3, theme.palette.accents_1, theme.palette.border, theme.palette.background, theme.palette.foreground, theme.layout.radius, theme.layout.radius]]]) + " " + ((selfVal === item.value ? 'active' : '') || "")
1103
+ className: _JSXStyle.dynamic([["3411776855", [SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0, 0), SCALES.ml(0), SCALES.font(1), theme$1.palette.accents_3, theme$1.palette.accents_1, theme$1.palette.border, theme$1.palette.background, theme$1.palette.foreground, theme$1.layout.radius, theme$1.layout.radius]]]) + " " + ((selfVal === item.value ? 'active' : '') || "")
3223
1104
  }, item.label);
3224
1105
  })), /*#__PURE__*/React.createElement("div", {
3225
- className: _JSXStyle.dynamic([["3411776855", [SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0, 0), SCALES.ml(0), SCALES.font(1), theme.palette.accents_3, theme.palette.accents_1, theme.palette.border, theme.palette.background, theme.palette.foreground, theme.layout.radius, theme.layout.radius]]]) + " " + "group-content"
1106
+ className: _JSXStyle.dynamic([["3411776855", [SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0, 0), SCALES.ml(0), SCALES.font(1), theme$1.palette.accents_3, theme$1.palette.accents_1, theme$1.palette.border, theme$1.palette.background, theme$1.palette.foreground, theme$1.layout.radius, theme$1.layout.radius]]]) + " " + "group-content"
3226
1107
  }, children), /*#__PURE__*/React.createElement(_JSXStyle, {
3227
1108
  id: "3411776855",
3228
- dynamic: [SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0, 0), SCALES.ml(0), SCALES.font(1), theme.palette.accents_3, theme.palette.accents_1, theme.palette.border, theme.palette.background, theme.palette.foreground, theme.layout.radius, theme.layout.radius]
3229
- }, ".group.__jsx-style-dynamic-selector{width:".concat(SCALES.width(1, 'auto'), ";height:").concat(SCALES.height(1, 'auto'), ";padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0, 0), " ").concat(SCALES.ml(0), ";}.group-tabs.__jsx-style-dynamic-selector{white-space:nowrap;overflow-y:hidden;overflow-x:auto;font-size:").concat(SCALES.font(1), ";margin-bottom:-1px;}.group-content.__jsx-style-dynamic-selector{border-top-left-radius:0;overflow:hidden;}.group-content.__jsx-style-dynamic-selector .fieldset{border-top-left-radius:0;}button.__jsx-style-dynamic-selector{height:2.7em;line-height:2.7em;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;color:").concat(theme.palette.accents_3, ";background-color:").concat(theme.palette.accents_1, ";font-size:0.875em;white-space:nowrap;text-transform:capitalize;-webkit-appearance:none;cursor:pointer;margin:0;padding:0 1.45em;overflow:hidden;-webkit-transition:all 0.2s ease 0s;transition:all 0.2s ease 0s;border-radius:0;border:1px solid ").concat(theme.palette.border, ";-webkit-text-decoration:none;text-decoration:none;outline:none;}button.active.__jsx-style-dynamic-selector{border-bottom-color:transparent;background-color:").concat(theme.palette.background, ";color:").concat(theme.palette.foreground, ";cursor:default;}button.__jsx-style-dynamic-selector:first-of-type{border-top-left-radius:").concat(theme.layout.radius, ";}button.__jsx-style-dynamic-selector:last-of-type{border-top-right-radius:").concat(theme.layout.radius, ";}button.__jsx-style-dynamic-selector+button.__jsx-style-dynamic-selector{border-left:0;}"))));
1109
+ dynamic: [SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0, 0), SCALES.ml(0), SCALES.font(1), theme$1.palette.accents_3, theme$1.palette.accents_1, theme$1.palette.border, theme$1.palette.background, theme$1.palette.foreground, theme$1.layout.radius, theme$1.layout.radius]
1110
+ }, ".group.__jsx-style-dynamic-selector{width:".concat(SCALES.width(1, 'auto'), ";height:").concat(SCALES.height(1, 'auto'), ";padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0, 0), " ").concat(SCALES.ml(0), ";}.group-tabs.__jsx-style-dynamic-selector{white-space:nowrap;overflow-y:hidden;overflow-x:auto;font-size:").concat(SCALES.font(1), ";margin-bottom:-1px;}.group-content.__jsx-style-dynamic-selector{border-top-left-radius:0;overflow:hidden;}.group-content.__jsx-style-dynamic-selector .fieldset{border-top-left-radius:0;}button.__jsx-style-dynamic-selector{height:2.7em;line-height:2.7em;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;color:").concat(theme$1.palette.accents_3, ";background-color:").concat(theme$1.palette.accents_1, ";font-size:0.875em;white-space:nowrap;text-transform:capitalize;-webkit-appearance:none;cursor:pointer;margin:0;padding:0 1.45em;overflow:hidden;-webkit-transition:all 0.2s ease 0s;transition:all 0.2s ease 0s;border-radius:0;border:1px solid ").concat(theme$1.palette.border, ";-webkit-text-decoration:none;text-decoration:none;outline:none;}button.active.__jsx-style-dynamic-selector{border-bottom-color:transparent;background-color:").concat(theme$1.palette.background, ";color:").concat(theme$1.palette.foreground, ";cursor:default;}button.__jsx-style-dynamic-selector:first-of-type{border-top-left-radius:").concat(theme$1.layout.radius, ";}button.__jsx-style-dynamic-selector:last-of-type{border-top-right-radius:").concat(theme$1.layout.radius, ";}button.__jsx-style-dynamic-selector+button.__jsx-style-dynamic-selector{border-left:0;}"))));
3230
1111
  };
3231
1112
  FieldsetGroupComponent.displayName = 'FieldsetGroup';
3232
1113
  var FieldsetGroup = withScale(FieldsetGroupComponent);