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