@chayns-components/core 5.0.0-beta.9 → 5.0.0-beta.98

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 (144) hide show
  1. package/README.md +3 -9
  2. package/lib/components/accordion/Accordion.d.ts +47 -9
  3. package/lib/components/accordion/Accordion.js +83 -87
  4. package/lib/components/accordion/Accordion.js.map +1 -1
  5. package/lib/components/accordion/Accordion.styles.d.ts +6 -5
  6. package/lib/components/accordion/Accordion.styles.js +67 -26
  7. package/lib/components/accordion/Accordion.styles.js.map +1 -1
  8. package/lib/components/accordion/accordion-body/AccordionBody.d.ts +13 -2
  9. package/lib/components/accordion/accordion-body/AccordionBody.js +19 -11
  10. package/lib/components/accordion/accordion-body/AccordionBody.js.map +1 -1
  11. package/lib/components/accordion/accordion-body/AccordionBody.styles.d.ts +4 -1
  12. package/lib/components/accordion/accordion-body/AccordionBody.styles.js +15 -10
  13. package/lib/components/accordion/accordion-body/AccordionBody.styles.js.map +1 -1
  14. package/lib/components/accordion/accordion-content/AccordionContent.d.ts +11 -3
  15. package/lib/components/accordion/accordion-content/AccordionContent.js +13 -11
  16. package/lib/components/accordion/accordion-content/AccordionContent.js.map +1 -1
  17. package/lib/components/accordion/accordion-content/AccordionContent.styles.d.ts +5 -4
  18. package/lib/components/accordion/accordion-content/AccordionContent.styles.js +25 -12
  19. package/lib/components/accordion/accordion-content/AccordionContent.styles.js.map +1 -1
  20. package/lib/components/accordion/accordion-group/AccordionGroup.d.ts +26 -0
  21. package/lib/components/accordion/accordion-group/AccordionGroup.js +57 -0
  22. package/lib/components/accordion/accordion-group/AccordionGroup.js.map +1 -0
  23. package/lib/components/accordion/accordion-head/AccordionHead.d.ts +8 -4
  24. package/lib/components/accordion/accordion-head/AccordionHead.js +79 -64
  25. package/lib/components/accordion/accordion-head/AccordionHead.js.map +1 -1
  26. package/lib/components/accordion/accordion-head/AccordionHead.styles.d.ts +10 -5
  27. package/lib/components/accordion/accordion-head/AccordionHead.styles.js +142 -32
  28. package/lib/components/accordion/accordion-head/AccordionHead.styles.js.map +1 -1
  29. package/lib/components/accordion/accordion-intro/AccordionIntro.d.ts +9 -0
  30. package/lib/components/accordion/accordion-intro/AccordionIntro.js +21 -0
  31. package/lib/components/accordion/accordion-intro/AccordionIntro.js.map +1 -0
  32. package/lib/components/accordion/accordion-intro/AccordionIntro.styles.d.ts +1 -0
  33. package/lib/components/accordion/accordion-intro/AccordionIntro.styles.js +13 -0
  34. package/lib/components/accordion/accordion-intro/AccordionIntro.styles.js.map +1 -0
  35. package/lib/components/accordion/utils.js +10 -12
  36. package/lib/components/accordion/utils.js.map +1 -1
  37. package/lib/components/badge/Badge.d.ts +9 -1
  38. package/lib/components/badge/Badge.js +12 -12
  39. package/lib/components/badge/Badge.js.map +1 -1
  40. package/lib/components/badge/Badge.styles.d.ts +4 -1
  41. package/lib/components/badge/Badge.styles.js +22 -15
  42. package/lib/components/badge/Badge.styles.js.map +1 -1
  43. package/lib/components/button/Button.d.ts +2 -2
  44. package/lib/components/button/Button.js +12 -20
  45. package/lib/components/button/Button.js.map +1 -1
  46. package/lib/components/button/Button.styles.d.ts +2 -0
  47. package/lib/components/button/Button.styles.js +47 -24
  48. package/lib/components/button/Button.styles.js.map +1 -1
  49. package/lib/components/checkbox/Checkbox.d.ts +25 -0
  50. package/lib/components/checkbox/Checkbox.js +44 -0
  51. package/lib/components/checkbox/Checkbox.js.map +1 -0
  52. package/lib/components/checkbox/Checkbox.styles.d.ts +6 -0
  53. package/lib/components/checkbox/Checkbox.styles.js +131 -0
  54. package/lib/components/checkbox/Checkbox.styles.js.map +1 -0
  55. package/lib/components/color-scheme-provider/ColorSchemeProvider.d.ts +7 -1
  56. package/lib/components/color-scheme-provider/ColorSchemeProvider.js +41 -78
  57. package/lib/components/color-scheme-provider/ColorSchemeProvider.js.map +1 -1
  58. package/lib/components/color-scheme-provider/font.d.ts +6 -0
  59. package/lib/components/color-scheme-provider/font.js +59 -0
  60. package/lib/components/color-scheme-provider/font.js.map +1 -0
  61. package/lib/components/context-menu/ContextMenu.d.ts +51 -0
  62. package/lib/components/context-menu/ContextMenu.js +154 -0
  63. package/lib/components/context-menu/ContextMenu.js.map +1 -0
  64. package/lib/components/context-menu/ContextMenu.styles.d.ts +1 -0
  65. package/lib/components/context-menu/ContextMenu.styles.js +13 -0
  66. package/lib/components/context-menu/ContextMenu.styles.js.map +1 -0
  67. package/lib/components/context-menu/constants/alignment.d.ts +8 -0
  68. package/lib/components/context-menu/constants/alignment.js +17 -0
  69. package/lib/components/context-menu/constants/alignment.js.map +1 -0
  70. package/lib/components/context-menu/context-menu-content/ContextMenuContent.d.ts +10 -0
  71. package/lib/components/context-menu/context-menu-content/ContextMenuContent.js +78 -0
  72. package/lib/components/context-menu/context-menu-content/ContextMenuContent.js.map +1 -0
  73. package/lib/components/context-menu/context-menu-content/ContextMenuContent.styles.d.ts +11 -0
  74. package/lib/components/context-menu/context-menu-content/ContextMenuContent.styles.js +117 -0
  75. package/lib/components/context-menu/context-menu-content/ContextMenuContent.styles.js.map +1 -0
  76. package/lib/components/grid-image/GridImage.d.ts +19 -0
  77. package/lib/components/grid-image/GridImage.js +46 -0
  78. package/lib/components/grid-image/GridImage.js.map +1 -0
  79. package/lib/components/grid-image/GridImage.styles.d.ts +21 -0
  80. package/lib/components/grid-image/GridImage.styles.js +105 -0
  81. package/lib/components/grid-image/GridImage.styles.js.map +1 -0
  82. package/lib/components/icon/Icon.d.ts +11 -3
  83. package/lib/components/icon/Icon.js +32 -30
  84. package/lib/components/icon/Icon.js.map +1 -1
  85. package/lib/components/icon/Icon.styles.d.ts +8 -1
  86. package/lib/components/icon/Icon.styles.js +64 -42
  87. package/lib/components/icon/Icon.styles.js.map +1 -1
  88. package/lib/components/icon/utils.js +2 -5
  89. package/lib/components/icon/utils.js.map +1 -1
  90. package/lib/components/input/Input.d.ts +37 -0
  91. package/lib/components/input/Input.js +75 -0
  92. package/lib/components/input/Input.js.map +1 -0
  93. package/lib/components/input/Input.styles.d.ts +7 -0
  94. package/lib/components/input/Input.styles.js +71 -0
  95. package/lib/components/input/Input.styles.js.map +1 -0
  96. package/lib/components/list/List.d.ts +18 -0
  97. package/lib/components/list/List.js +54 -0
  98. package/lib/components/list/List.js.map +1 -0
  99. package/lib/components/list/list-item/ListItem.d.ts +67 -0
  100. package/lib/components/list/list-item/ListItem.js +90 -0
  101. package/lib/components/list/list-item/ListItem.js.map +1 -0
  102. package/lib/components/list/list-item/ListItem.styles.d.ts +6 -0
  103. package/lib/components/list/list-item/ListItem.styles.js +56 -0
  104. package/lib/components/list/list-item/ListItem.styles.js.map +1 -0
  105. package/lib/components/list/list-item/list-item-body/ListItemBody.d.ts +3 -0
  106. package/lib/components/list/list-item/list-item-body/ListItemBody.js +36 -0
  107. package/lib/components/list/list-item/list-item-body/ListItemBody.js.map +1 -0
  108. package/lib/components/list/list-item/list-item-body/ListItemBody.styles.d.ts +1 -0
  109. package/lib/components/list/list-item/list-item-body/ListItemBody.styles.js +14 -0
  110. package/lib/components/list/list-item/list-item-body/ListItemBody.styles.js.map +1 -0
  111. package/lib/components/list/list-item/list-item-content/ListItemContent.d.ts +3 -0
  112. package/lib/components/list/list-item/list-item-content/ListItemContent.js +21 -0
  113. package/lib/components/list/list-item/list-item-content/ListItemContent.js.map +1 -0
  114. package/lib/components/list/list-item/list-item-content/ListItemContent.styles.d.ts +1 -0
  115. package/lib/components/list/list-item/list-item-content/ListItemContent.styles.js +19 -0
  116. package/lib/components/list/list-item/list-item-content/ListItemContent.styles.js.map +1 -0
  117. package/lib/components/list/list-item/list-item-head/ListItemHead.d.ts +18 -0
  118. package/lib/components/list/list-item/list-item-head/ListItemHead.js +100 -0
  119. package/lib/components/list/list-item/list-item-head/ListItemHead.js.map +1 -0
  120. package/lib/components/list/list-item/list-item-head/ListItemHead.styles.d.ts +20 -0
  121. package/lib/components/list/list-item/list-item-head/ListItemHead.styles.js +110 -0
  122. package/lib/components/list/list-item/list-item-head/ListItemHead.styles.js.map +1 -0
  123. package/lib/components/list/list-item/list-item-head/list-item-icon/ListItemIcon.d.ts +6 -0
  124. package/lib/components/list/list-item/list-item-head/list-item-icon/ListItemIcon.js +23 -0
  125. package/lib/components/list/list-item/list-item-head/list-item-icon/ListItemIcon.js.map +1 -0
  126. package/lib/components/list/list-item/list-item-head/list-item-icon/ListItemIcon.styles.d.ts +1 -0
  127. package/lib/components/list/list-item/list-item-head/list-item-icon/ListItemIcon.styles.js +32 -0
  128. package/lib/components/list/list-item/list-item-head/list-item-icon/ListItemIcon.styles.js.map +1 -0
  129. package/lib/components/list/list-item/list-item-head/list-item-image/ListItemImage.d.ts +7 -0
  130. package/lib/components/list/list-item/list-item-head/list-item-image/ListItemImage.js +44 -0
  131. package/lib/components/list/list-item/list-item-head/list-item-image/ListItemImage.js.map +1 -0
  132. package/lib/components/list/list-item/list-item-head/list-item-image/ListItemImage.styles.d.ts +10 -0
  133. package/lib/components/list/list-item/list-item-head/list-item-image/ListItemImage.styles.js +52 -0
  134. package/lib/components/list/list-item/list-item-head/list-item-image/ListItemImage.styles.js.map +1 -0
  135. package/lib/hooks/uuid.d.ts +1 -0
  136. package/lib/hooks/uuid.js +14 -0
  137. package/lib/hooks/uuid.js.map +1 -0
  138. package/lib/index.d.ts +10 -0
  139. package/lib/index.js +69 -13
  140. package/lib/index.js.map +1 -1
  141. package/lib/types/chayns.d.ts +57 -0
  142. package/lib/types/chayns.js +14 -0
  143. package/lib/types/chayns.js.map +1 -0
  144. package/package.json +64 -62
@@ -4,34 +4,57 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.StyledIconWrapper = exports.StyledButton = void 0;
7
-
8
7
  var _styledComponents = _interopRequireDefault(require("styled-components"));
9
-
10
- var _templateObject, _templateObject2;
11
-
12
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
14
- function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
15
-
16
- var StyledButton = _styledComponents.default.button(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background-color: ", ";\n border-radius: 3px;\n box-shadow: 1px 2px 3px rgba(0, 0, 0, 0.2);\n border: none;\n color: ", ";\n cursor: pointer;\n display: inline-block;\n line-height: 1.15;\n min-height: 30px;\n opacity: ", ";\n padding: ", ";\n position: relative;\n user-select: none;\n transition: opacity 0.3s ease;\n"])), function (_ref) {
17
- var isSecondary = _ref.isSecondary,
18
- theme = _ref.theme;
9
+ const StyledButton = _styledComponents.default.button`
10
+ background-color: ${_ref => {
11
+ let {
12
+ isSecondary,
13
+ theme
14
+ } = _ref;
19
15
  return isSecondary ? theme['202'] : theme['408'];
20
- }, function (_ref2) {
21
- var isSecondary = _ref2.isSecondary,
22
- theme = _ref2.theme;
23
- return isSecondary ? theme['text'] : 'white';
24
- }, function (_ref3) {
25
- var disabled = _ref3.disabled;
16
+ }};
17
+ border-radius: 3px;
18
+ box-shadow: 1px 2px 3px rgba(0, 0, 0, 0.2);
19
+ border: none;
20
+ color: ${_ref2 => {
21
+ let {
22
+ isSecondary,
23
+ theme
24
+ } = _ref2;
25
+ return isSecondary ? theme.text : 'white';
26
+ }};
27
+ cursor: pointer;
28
+ display: inline-block;
29
+ line-height: 1.15;
30
+ min-height: 30px;
31
+ opacity: ${_ref3 => {
32
+ let {
33
+ disabled
34
+ } = _ref3;
26
35
  return disabled ? 0.5 : 1;
27
- }, function (_ref4) {
28
- var hasIcon = _ref4.hasIcon;
29
- return "7px 12px 7px ".concat(hasIcon ? '42px' : '12px');
30
- });
31
-
36
+ }};
37
+ padding: ${_ref4 => {
38
+ let {
39
+ hasIcon
40
+ } = _ref4;
41
+ return `7px 12px 7px ${hasIcon ? '42px' : '12px'}`;
42
+ }};
43
+ position: relative;
44
+ user-select: none;
45
+ transition: opacity 0.3s ease;
46
+ `;
32
47
  exports.StyledButton = StyledButton;
33
-
34
- var StyledIconWrapper = _styledComponents.default.span(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n align-items: center;\n background-color: rgba(255, 255, 255, 0.2);\n bottom: 0;\n display: flex;\n justify-content: center;\n left: 0;\n position: absolute;\n top: 0;\n width: 30px;\n"])));
35
-
48
+ const StyledIconWrapper = _styledComponents.default.span`
49
+ align-items: center;
50
+ background-color: rgba(255, 255, 255, 0.2);
51
+ bottom: 0;
52
+ display: flex;
53
+ justify-content: center;
54
+ left: 0;
55
+ position: absolute;
56
+ top: 0;
57
+ width: 30px;
58
+ `;
36
59
  exports.StyledIconWrapper = StyledIconWrapper;
37
60
  //# sourceMappingURL=Button.styles.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/button/Button.styles.ts"],"names":["StyledButton","styled","button","isSecondary","theme","disabled","hasIcon","StyledIconWrapper","span"],"mappings":";;;;;;;AAAA;;;;;;;;AAOO,IAAMA,YAAY,GAAGC,0BAAOC,MAAV,kbACD;AAAA,MAAGC,WAAH,QAAGA,WAAH;AAAA,MAAgBC,KAAhB,QAAgBA,KAAhB;AAAA,SAA6BD,WAAW,GAAGC,KAAK,CAAC,KAAD,CAAR,GAAkBA,KAAK,CAAC,KAAD,CAA/D;AAAA,CADC,EAKZ;AAAA,MAAGD,WAAH,SAAGA,WAAH;AAAA,MAAgBC,KAAhB,SAAgBA,KAAhB;AAAA,SAA6BD,WAAW,GAAGC,KAAK,CAAC,MAAD,CAAR,GAAmB,OAA3D;AAAA,CALY,EAUV;AAAA,MAAGC,QAAH,SAAGA,QAAH;AAAA,SAAmBA,QAAQ,GAAG,GAAH,GAAS,CAApC;AAAA,CAVU,EAWV;AAAA,MAAGC,OAAH,SAAGA,OAAH;AAAA,gCAAiCA,OAAO,GAAG,MAAH,GAAY,MAApD;AAAA,CAXU,CAAlB;;;;AAiBA,IAAMC,iBAAiB,GAAGN,0BAAOO,IAAV,4RAAvB","sourcesContent":["import styled from 'styled-components';\nimport type { ButtonProps } from './Button';\n\ntype StyledButtonProps = ButtonProps & {\n hasIcon: boolean;\n};\n\nexport const StyledButton = styled.button<StyledButtonProps>`\n background-color: ${({ isSecondary, theme }) => (isSecondary ? theme['202'] : theme['408'])};\n border-radius: 3px;\n box-shadow: 1px 2px 3px rgba(0, 0, 0, 0.2);\n border: none;\n color: ${({ isSecondary, theme }) => (isSecondary ? theme['text'] : 'white')};\n cursor: pointer;\n display: inline-block;\n line-height: 1.15;\n min-height: 30px;\n opacity: ${({ disabled }) => (disabled ? 0.5 : 1)};\n padding: ${({ hasIcon }) => `7px 12px 7px ${hasIcon ? '42px' : '12px'}`};\n position: relative;\n user-select: none;\n transition: opacity 0.3s ease;\n`;\n\nexport const StyledIconWrapper = styled.span`\n align-items: center;\n background-color: rgba(255, 255, 255, 0.2);\n bottom: 0;\n display: flex;\n justify-content: center;\n left: 0;\n position: absolute;\n top: 0;\n width: 30px;\n`;\n"],"file":"Button.styles.js"}
1
+ {"version":3,"file":"Button.styles.js","names":["_styledComponents","_interopRequireDefault","require","obj","__esModule","default","StyledButton","styled","button","_ref","isSecondary","theme","_ref2","text","_ref3","disabled","_ref4","hasIcon","exports","StyledIconWrapper","span"],"sources":["../../../src/components/button/Button.styles.ts"],"sourcesContent":["import styled from 'styled-components';\nimport type { ButtonProps } from './Button';\nimport type { WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\n\ntype StyledButtonProps = ButtonProps &\n WithTheme<{\n hasIcon: boolean;\n }>;\n\nexport const StyledButton = styled.button<StyledButtonProps>`\n background-color: ${({ isSecondary, theme }: StyledButtonProps) =>\n isSecondary ? theme['202'] : theme['408']};\n border-radius: 3px;\n box-shadow: 1px 2px 3px rgba(0, 0, 0, 0.2);\n border: none;\n color: ${({ isSecondary, theme }: StyledButtonProps) => (isSecondary ? theme.text : 'white')};\n cursor: pointer;\n display: inline-block;\n line-height: 1.15;\n min-height: 30px;\n opacity: ${({ disabled }) => (disabled ? 0.5 : 1)};\n padding: ${({ hasIcon }) => `7px 12px 7px ${hasIcon ? '42px' : '12px'}`};\n position: relative;\n user-select: none;\n transition: opacity 0.3s ease;\n`;\n\nexport const StyledIconWrapper = styled.span`\n align-items: center;\n background-color: rgba(255, 255, 255, 0.2);\n bottom: 0;\n display: flex;\n justify-content: center;\n left: 0;\n position: absolute;\n top: 0;\n width: 30px;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAShC,MAAMG,YAAY,GAAGC,yBAAM,CAACC,MAA0B;AAC7D,wBAAwBC,IAAA;EAAA,IAAC;IAAEC,WAAW;IAAEC;EAAyB,CAAC,GAAAF,IAAA;EAAA,OAC1DC,WAAW,GAAGC,KAAK,CAAC,KAAK,CAAC,GAAGA,KAAK,CAAC,KAAK,CAAC;AAAA,CAAC;AAClD;AACA;AACA;AACA,aAAaC,KAAA;EAAA,IAAC;IAAEF,WAAW;IAAEC;EAAyB,CAAC,GAAAC,KAAA;EAAA,OAAMF,WAAW,GAAGC,KAAK,CAACE,IAAI,GAAG,OAAO;AAAA,CAAE;AACjG;AACA;AACA;AACA;AACA,eAAeC,KAAA;EAAA,IAAC;IAAEC;EAAS,CAAC,GAAAD,KAAA;EAAA,OAAMC,QAAQ,GAAG,GAAG,GAAG,CAAC;AAAA,CAAE;AACtD,eAAeC,KAAA;EAAA,IAAC;IAAEC;EAAQ,CAAC,GAAAD,KAAA;EAAA,OAAM,gBAAeC,OAAO,GAAG,MAAM,GAAG,MAAO,EAAC;AAAA,CAAC;AAC5E;AACA;AACA;AACA,CAAC;AAACC,OAAA,CAAAZ,YAAA,GAAAA,YAAA;AAEK,MAAMa,iBAAiB,GAAGZ,yBAAM,CAACa,IAAK;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAACF,OAAA,CAAAC,iBAAA,GAAAA,iBAAA"}
@@ -0,0 +1,25 @@
1
+ import { ChangeEventHandler, FC, ReactNode } from 'react';
2
+ export type CheckboxProps = {
3
+ /**
4
+ * Text for checkbox or switch
5
+ */
6
+ children?: ReactNode;
7
+ /**
8
+ * Indicates whether the checkbox or switch is selected
9
+ */
10
+ isChecked?: boolean;
11
+ /**
12
+ * Disables the checkbox or switch so it cannot be toggled
13
+ */
14
+ isDisabled?: boolean;
15
+ /**
16
+ * Function to be executed if the checked value changes
17
+ */
18
+ onChange?: ChangeEventHandler<HTMLInputElement>;
19
+ /**
20
+ * Changes the design to use switch instead of checkbox
21
+ */
22
+ shouldShowAsSwitch?: boolean;
23
+ };
24
+ declare const Checkbox: FC<CheckboxProps>;
25
+ export default Checkbox;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _uuid = require("../../hooks/uuid");
9
+ var _Checkbox = require("./Checkbox.styles");
10
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
11
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
12
+ const Checkbox = _ref => {
13
+ let {
14
+ children,
15
+ isChecked,
16
+ isDisabled,
17
+ onChange,
18
+ shouldShowAsSwitch
19
+ } = _ref;
20
+ const [isActive, setIsActive] = (0, _react.useState)(isChecked !== null && isChecked !== void 0 ? isChecked : false);
21
+ const handleChange = (0, _react.useCallback)(event => {
22
+ setIsActive(event.target.checked);
23
+ if (typeof onChange === 'function') {
24
+ onChange(event);
25
+ }
26
+ }, [onChange]);
27
+ const uuid = (0, _uuid.useUuid)();
28
+ return /*#__PURE__*/_react.default.createElement(_Checkbox.StyledCheckbox, null, /*#__PURE__*/_react.default.createElement(_Checkbox.StyledCheckboxInput, {
29
+ checked: isChecked,
30
+ disabled: isDisabled,
31
+ id: uuid,
32
+ onChange: handleChange,
33
+ type: "checkbox"
34
+ }), /*#__PURE__*/_react.default.createElement(_Checkbox.StyledCheckboxLabel, {
35
+ htmlFor: uuid,
36
+ isChecked: isChecked !== null && isChecked !== void 0 ? isChecked : isActive,
37
+ isDisabled: isDisabled,
38
+ shouldShowAsSwitch: shouldShowAsSwitch
39
+ }, children));
40
+ };
41
+ Checkbox.displayName = 'Checkbox';
42
+ var _default = Checkbox;
43
+ exports.default = _default;
44
+ //# sourceMappingURL=Checkbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Checkbox.js","names":["_react","_interopRequireWildcard","require","_uuid","_Checkbox","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","Checkbox","_ref","children","isChecked","isDisabled","onChange","shouldShowAsSwitch","isActive","setIsActive","useState","handleChange","useCallback","event","target","checked","uuid","useUuid","createElement","StyledCheckbox","StyledCheckboxInput","disabled","id","type","StyledCheckboxLabel","htmlFor","displayName","_default","exports"],"sources":["../../../src/components/checkbox/Checkbox.tsx"],"sourcesContent":["import React, {\n ChangeEvent,\n ChangeEventHandler,\n FC,\n ReactNode,\n useCallback,\n useState,\n} from 'react';\nimport { useUuid } from '../../hooks/uuid';\nimport { StyledCheckbox, StyledCheckboxInput, StyledCheckboxLabel } from './Checkbox.styles';\n\nexport type CheckboxProps = {\n /**\n * Text for checkbox or switch\n */\n children?: ReactNode;\n /**\n * Indicates whether the checkbox or switch is selected\n */\n isChecked?: boolean;\n /**\n * Disables the checkbox or switch so it cannot be toggled\n */\n isDisabled?: boolean;\n /**\n * Function to be executed if the checked value changes\n */\n onChange?: ChangeEventHandler<HTMLInputElement>;\n /**\n * Changes the design to use switch instead of checkbox\n */\n shouldShowAsSwitch?: boolean;\n};\n\nconst Checkbox: FC<CheckboxProps> = ({\n children,\n isChecked,\n isDisabled,\n onChange,\n shouldShowAsSwitch,\n}) => {\n const [isActive, setIsActive] = useState(isChecked ?? false);\n\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n setIsActive(event.target.checked);\n\n if (typeof onChange === 'function') {\n onChange(event);\n }\n },\n [onChange]\n );\n\n const uuid = useUuid();\n\n return (\n <StyledCheckbox>\n <StyledCheckboxInput\n checked={isChecked}\n disabled={isDisabled}\n id={uuid}\n onChange={handleChange}\n type=\"checkbox\"\n />\n <StyledCheckboxLabel\n htmlFor={uuid}\n isChecked={isChecked ?? isActive}\n isDisabled={isDisabled}\n shouldShowAsSwitch={shouldShowAsSwitch}\n >\n {children}\n </StyledCheckboxLabel>\n </StyledCheckbox>\n );\n};\n\nCheckbox.displayName = 'Checkbox';\n\nexport default Checkbox;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAQA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAA6F,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAA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;EAE5D,MAAMO,YAAY,GAAG,IAAAC,kBAAW,EAC3BC,KAAoC,IAAK;IACtCJ,WAAW,CAACI,KAAK,CAACC,MAAM,CAACC,OAAO,CAAC;IAEjC,IAAI,OAAOT,QAAQ,KAAK,UAAU,EAAE;MAChCA,QAAQ,CAACO,KAAK,CAAC;IACnB;EACJ,CAAC,EACD,CAACP,QAAQ,CAAC,CACb;EAED,MAAMU,IAAI,GAAG,IAAAC,aAAO,GAAE;EAEtB,oBACI3C,MAAA,CAAAY,OAAA,CAAAgC,aAAA,CAACxC,SAAA,CAAAyC,cAAc,qBACX7C,MAAA,CAAAY,OAAA,CAAAgC,aAAA,CAACxC,SAAA,CAAA0C,mBAAmB;IAChBL,OAAO,EAAEX,SAAU;IACnBiB,QAAQ,EAAEhB,UAAW;IACrBiB,EAAE,EAAEN,IAAK;IACTV,QAAQ,EAAEK,YAAa;IACvBY,IAAI,EAAC;EAAU,EACjB,eACFjD,MAAA,CAAAY,OAAA,CAAAgC,aAAA,CAACxC,SAAA,CAAA8C,mBAAmB;IAChBC,OAAO,EAAET,IAAK;IACdZ,SAAS,EAAEA,SAAS,aAATA,SAAS,cAATA,SAAS,GAAII,QAAS;IACjCH,UAAU,EAAEA,UAAW;IACvBE,kBAAkB,EAAEA;EAAmB,GAEtCJ,QAAQ,CACS,CACT;AAEzB,CAAC;AAEDF,QAAQ,CAACyB,WAAW,GAAG,UAAU;AAAC,IAAAC,QAAA,GAEnB1B,QAAQ;AAAA2B,OAAA,CAAA1C,OAAA,GAAAyC,QAAA"}
@@ -0,0 +1,6 @@
1
+ import type { CheckboxProps } from './Checkbox';
2
+ export declare const StyledCheckbox: import("styled-components").StyledComponent<"div", any, {}, never>;
3
+ export declare const StyledCheckboxInput: import("styled-components").StyledComponent<"input", any, {}, never>;
4
+ export declare const StyledCheckboxLabel: import("styled-components").StyledComponent<"label", any, Omit<CheckboxProps, "children" | "onChange"> & {
5
+ theme: import("../color-scheme-provider/ColorSchemeProvider").Theme;
6
+ }, never>;
@@ -0,0 +1,131 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.StyledCheckboxLabel = exports.StyledCheckboxInput = exports.StyledCheckbox = void 0;
7
+ var _styledComponents = _interopRequireWildcard(require("styled-components"));
8
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
9
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
10
+ const StyledCheckbox = _styledComponents.default.div`
11
+ align-items: center;
12
+ display: flex;
13
+ position: relative;
14
+ `;
15
+ exports.StyledCheckbox = StyledCheckbox;
16
+ const StyledCheckboxInput = _styledComponents.default.input`
17
+ display: none;
18
+ `;
19
+ exports.StyledCheckboxInput = StyledCheckboxInput;
20
+ const StyledCheckboxLabel = _styledComponents.default.label`
21
+ color: ${_ref => {
22
+ let {
23
+ theme
24
+ } = _ref;
25
+ return theme.text;
26
+ }};
27
+ cursor: ${_ref2 => {
28
+ let {
29
+ isDisabled
30
+ } = _ref2;
31
+ return isDisabled ? 'default' : 'pointer';
32
+ }};
33
+ opacity: ${_ref3 => {
34
+ let {
35
+ isDisabled
36
+ } = _ref3;
37
+ return isDisabled ? 0.5 : 1;
38
+ }};
39
+ padding-left: ${_ref4 => {
40
+ let {
41
+ shouldShowAsSwitch
42
+ } = _ref4;
43
+ return shouldShowAsSwitch ? '48px' : '20px';
44
+ }};
45
+ transition: opacity 0.2s ease;
46
+ user-select: none;
47
+
48
+ &:after {
49
+ ${_ref5 => {
50
+ let {
51
+ isChecked,
52
+ shouldShowAsSwitch
53
+ } = _ref5;
54
+ return shouldShowAsSwitch ? (0, _styledComponents.css)`
55
+ background-color: white;
56
+ border-radius: 50%;
57
+ box-shadow: 0 1px 4px rgb(0 0 0 / 35%);
58
+ height: 16px;
59
+ left: 7px;
60
+ transform: translateY(-50%) translateX(${isChecked ? '18px' : 0});
61
+ transition: transform 0.2s ease;
62
+ width: 16px;
63
+ ` : (0, _styledComponents.css)`
64
+ border-right: 2px solid #fff;
65
+ border-bottom: 2px solid #fff;
66
+ height: 10px;
67
+ left: 1px;
68
+ opacity: ${isChecked ? 1 : 0};
69
+ transform: translateY(-50%) rotateZ(37deg);
70
+ transition: opacity 0.2s ease;
71
+ width: 5.5px;
72
+ `;
73
+ }}
74
+
75
+ content: ' ';
76
+ position: absolute;
77
+ top: 50%;
78
+ transform-origin: 100% 100%;
79
+ }
80
+
81
+ &:before {
82
+ background-color: ${_ref6 => {
83
+ let {
84
+ isChecked,
85
+ shouldShowAsSwitch,
86
+ theme
87
+ } = _ref6;
88
+ if (shouldShowAsSwitch) {
89
+ return isChecked ? theme.green : theme.red;
90
+ }
91
+ return isChecked ? theme['408'] : theme['403'];
92
+ }};
93
+ border: 1px solid rgba(${_ref7 => {
94
+ let {
95
+ theme
96
+ } = _ref7;
97
+ return theme['409-rgb'];
98
+ }}, 0.5);
99
+ border-radius: ${_ref8 => {
100
+ let {
101
+ shouldShowAsSwitch
102
+ } = _ref8;
103
+ return shouldShowAsSwitch ? '100px' : 0;
104
+ }};
105
+ content: ' ';
106
+ height: ${_ref9 => {
107
+ let {
108
+ shouldShowAsSwitch
109
+ } = _ref9;
110
+ return shouldShowAsSwitch ? '13px' : '15px';
111
+ }};
112
+ left: ${_ref10 => {
113
+ let {
114
+ shouldShowAsSwitch
115
+ } = _ref10;
116
+ return shouldShowAsSwitch ? '10px' : 0;
117
+ }};
118
+ position: absolute;
119
+ top: 50%;
120
+ transform: translateY(-50%);
121
+ transition: background-color 0.2s ease;
122
+ width: ${_ref11 => {
123
+ let {
124
+ shouldShowAsSwitch
125
+ } = _ref11;
126
+ return shouldShowAsSwitch ? '28px' : '15px';
127
+ }};
128
+ }
129
+ `;
130
+ exports.StyledCheckboxLabel = StyledCheckboxLabel;
131
+ //# sourceMappingURL=Checkbox.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Checkbox.styles.js","names":["_styledComponents","_interopRequireWildcard","require","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","StyledCheckbox","styled","div","exports","StyledCheckboxInput","input","StyledCheckboxLabel","label","_ref","theme","text","_ref2","isDisabled","_ref3","_ref4","shouldShowAsSwitch","_ref5","isChecked","css","_ref6","green","red","_ref7","_ref8","_ref9","_ref10","_ref11"],"sources":["../../../src/components/checkbox/Checkbox.styles.ts"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport type { WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\nimport type { CheckboxProps } from './Checkbox';\n\nexport const StyledCheckbox = styled.div`\n align-items: center;\n display: flex;\n position: relative;\n`;\n\nexport const StyledCheckboxInput = styled.input`\n display: none;\n`;\n\ntype StyledCheckboxLabelProps = WithTheme<Omit<CheckboxProps, 'children' | 'onChange'>>;\n\nexport const StyledCheckboxLabel = styled.label<StyledCheckboxLabelProps>`\n color: ${({ theme }: StyledCheckboxLabelProps) => theme.text};\n cursor: ${({ isDisabled }) => (isDisabled ? 'default' : 'pointer')};\n opacity: ${({ isDisabled }) => (isDisabled ? 0.5 : 1)};\n padding-left: ${({ shouldShowAsSwitch }) => (shouldShowAsSwitch ? '48px' : '20px')};\n transition: opacity 0.2s ease;\n user-select: none;\n\n &:after {\n ${({ isChecked, shouldShowAsSwitch }) =>\n shouldShowAsSwitch\n ? css`\n background-color: white;\n border-radius: 50%;\n box-shadow: 0 1px 4px rgb(0 0 0 / 35%);\n height: 16px;\n left: 7px;\n transform: translateY(-50%) translateX(${isChecked ? '18px' : 0});\n transition: transform 0.2s ease;\n width: 16px;\n `\n : css`\n border-right: 2px solid #fff;\n border-bottom: 2px solid #fff;\n height: 10px;\n left: 1px;\n opacity: ${isChecked ? 1 : 0};\n transform: translateY(-50%) rotateZ(37deg);\n transition: opacity 0.2s ease;\n width: 5.5px;\n `}\n\n content: ' ';\n position: absolute;\n top: 50%;\n transform-origin: 100% 100%;\n }\n\n &:before {\n background-color: ${({\n isChecked,\n shouldShowAsSwitch,\n theme,\n }: StyledCheckboxLabelProps) => {\n if (shouldShowAsSwitch) {\n return isChecked ? theme.green : theme.red;\n }\n\n return isChecked ? theme['408'] : theme['403'];\n }};\n border: 1px solid rgba(${({ theme }: StyledCheckboxLabelProps) => theme['409-rgb']}, 0.5);\n border-radius: ${({ shouldShowAsSwitch }) => (shouldShowAsSwitch ? '100px' : 0)};\n content: ' ';\n height: ${({ shouldShowAsSwitch }) => (shouldShowAsSwitch ? '13px' : '15px')};\n left: ${({ shouldShowAsSwitch }) => (shouldShowAsSwitch ? '10px' : 0)};\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n transition: background-color 0.2s ease;\n width: ${({ shouldShowAsSwitch }) => (shouldShowAsSwitch ? '28px' : '15px')};\n }\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAgD,SAAAC,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YA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A,IAAC;IAAEb;EAAgC,CAAC,GAAAa,KAAA;EAAA,OAAKb,KAAK,CAAC,SAAS,CAAC;AAAA,CAAC;AAC3F,yBAAyBc,KAAA;EAAA,IAAC;IAAER;EAAmB,CAAC,GAAAQ,KAAA;EAAA,OAAMR,kBAAkB,GAAG,OAAO,GAAG,CAAC;AAAA,CAAE;AACxF;AACA,kBAAkBS,KAAA;EAAA,IAAC;IAAET;EAAmB,CAAC,GAAAS,KAAA;EAAA,OAAMT,kBAAkB,GAAG,MAAM,GAAG,MAAM;AAAA,CAAE;AACrF,gBAAgBU,MAAA;EAAA,IAAC;IAAEV;EAAmB,CAAC,GAAAU,MAAA;EAAA,OAAMV,kBAAkB,GAAG,MAAM,GAAG,CAAC;AAAA,CAAE;AAC9E;AACA;AACA;AACA;AACA,iBAAiBW,MAAA;EAAA,IAAC;IAAEX;EAAmB,CAAC,GAAAW,MAAA;EAAA,OAAMX,kBAAkB,GAAG,MAAM,GAAG,MAAM;AAAA,CAAE;AACpF;AACA,CAAC;AAACZ,OAAA,CAAAG,mBAAA,GAAAA,mBAAA"}
@@ -4,7 +4,7 @@ declare enum ColorMode {
4
4
  Dark = 1,
5
5
  Light = 2
6
6
  }
7
- declare type ColorSchemeProviderProps = {
7
+ type ColorSchemeProviderProps = {
8
8
  /**
9
9
  * The content of the application or the components for which the styles should be set
10
10
  */
@@ -34,5 +34,11 @@ declare type ColorSchemeProviderProps = {
34
34
  [key: string]: string | number;
35
35
  };
36
36
  };
37
+ export interface Theme {
38
+ [key: string]: string;
39
+ }
40
+ export type WithTheme<T> = T & {
41
+ theme: Theme;
42
+ };
37
43
  declare const ColorSchemeProvider: FC<ColorSchemeProviderProps>;
38
44
  export default ColorSchemeProvider;
@@ -1,98 +1,58 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
6
  exports.default = void 0;
9
-
10
7
  var _colors = require("@chayns/colors");
11
-
12
8
  var _react = _interopRequireWildcard(require("react"));
13
-
14
9
  var _styledComponents = require("styled-components");
15
-
16
- var _templateObject;
17
-
18
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
-
20
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
-
22
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
23
-
24
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
25
-
26
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
27
-
28
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
29
-
30
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
31
-
32
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
33
-
34
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
35
-
36
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
37
-
38
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
39
-
40
- function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
41
-
10
+ var _font = require("./font");
11
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
12
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
42
13
  var ColorMode;
43
-
44
14
  (function (ColorMode) {
45
15
  ColorMode[ColorMode["Classic"] = 0] = "Classic";
46
16
  ColorMode[ColorMode["Dark"] = 1] = "Dark";
47
17
  ColorMode[ColorMode["Light"] = 2] = "Light";
48
18
  })(ColorMode || (ColorMode = {}));
49
-
50
- var GlobalStyle = (0, _styledComponents.createGlobalStyle)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ellipsis {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n"])));
51
-
52
- var ColorSchemeProvider = function ColorSchemeProvider(_ref) {
53
- var children = _ref.children,
54
- _ref$color = _ref.color,
55
- color = _ref$color === void 0 ? '#005EB8' : _ref$color,
56
- _ref$colorMode = _ref.colorMode,
57
- colorMode = _ref$colorMode === void 0 ? ColorMode.Classic : _ref$colorMode,
58
- _ref$cssVariables = _ref.cssVariables,
59
- cssVariables = _ref$cssVariables === void 0 ? {} : _ref$cssVariables,
60
- secondaryColor = _ref.secondaryColor,
61
- _ref$style = _ref.style,
62
- style = _ref$style === void 0 ? {} : _ref$style;
63
-
64
- var _useState = (0, _react.useState)({}),
65
- _useState2 = _slicedToArray(_useState, 2),
66
- colors = _useState2[0],
67
- setColors = _useState2[1];
68
-
69
- var _useState3 = (0, _react.useState)({}),
70
- _useState4 = _slicedToArray(_useState3, 2),
71
- themeColors = _useState4[0],
72
- setThemeColors = _useState4[1];
73
-
74
- (0, _react.useEffect)(function () {
75
- var availableColors = (0, _colors.getAvailableColorList)();
76
- var newColors = {};
77
- var newThemeColors = {};
78
- availableColors.forEach(function (colorName) {
79
- var hexColor = (0, _colors.getColorFromPalette)(colorName, {
80
- color: color,
81
- colorMode: colorMode,
82
- secondaryColor: secondaryColor
19
+ const GlobalStyle = (0, _styledComponents.createGlobalStyle)`
20
+ ${_font.generateFontFaces}
21
+
22
+ .ellipsis {
23
+ overflow: hidden;
24
+ text-overflow: ellipsis;
25
+ white-space: nowrap;
26
+ }
27
+ `;
28
+ const ColorSchemeProvider = _ref => {
29
+ let {
30
+ children,
31
+ color = '#005EB8',
32
+ colorMode = ColorMode.Classic,
33
+ cssVariables = {},
34
+ secondaryColor,
35
+ style = {}
36
+ } = _ref;
37
+ const [colors, setColors] = (0, _react.useState)({});
38
+ const [themeColors, setThemeColors] = (0, _react.useState)({});
39
+ (0, _react.useEffect)(() => {
40
+ const availableColors = (0, _colors.getAvailableColorList)();
41
+ const newColors = {};
42
+ const newThemeColors = {};
43
+ availableColors.forEach(colorName => {
44
+ const hexColor = (0, _colors.getColorFromPalette)(colorName, {
45
+ color,
46
+ colorMode,
47
+ secondaryColor
83
48
  });
84
-
85
- if (colorName === 'text') {// console.debug('textColor', hexColor);
86
- }
87
-
88
49
  if (hexColor) {
89
- var rgbColor = (0, _colors.hexToRgb255)(hexColor);
90
- newColors["--chayns-color--".concat(colorName)] = hexColor;
50
+ const rgbColor = (0, _colors.hexToRgb255)(hexColor);
51
+ newColors[`--chayns-color--${colorName}`] = hexColor;
91
52
  newThemeColors[colorName] = hexColor;
92
-
93
53
  if (rgbColor) {
94
- newColors["--chayns-color-rgb--".concat(colorName)] = "".concat(rgbColor.r, ", ").concat(rgbColor.g, ", ").concat(rgbColor.b);
95
- newThemeColors["".concat(colorName, "-rgb")] = "".concat(rgbColor.r, ", ").concat(rgbColor.g, ", ").concat(rgbColor.b);
54
+ newColors[`--chayns-color-rgb--${colorName}`] = `${rgbColor.r}, ${rgbColor.g}, ${rgbColor.b}`;
55
+ newThemeColors[`${colorName}-rgb`] = `${rgbColor.r}, ${rgbColor.g}, ${rgbColor.b}`;
96
56
  }
97
57
  }
98
58
  });
@@ -102,10 +62,13 @@ var ColorSchemeProvider = function ColorSchemeProvider(_ref) {
102
62
  return /*#__PURE__*/_react.default.createElement(_styledComponents.ThemeProvider, {
103
63
  theme: themeColors
104
64
  }, /*#__PURE__*/_react.default.createElement("div", {
105
- style: _objectSpread(_objectSpread(_objectSpread({}, colors), cssVariables), style)
65
+ style: {
66
+ ...colors,
67
+ ...cssVariables,
68
+ ...style
69
+ }
106
70
  }, children), /*#__PURE__*/_react.default.createElement(GlobalStyle, null));
107
71
  };
108
-
109
72
  ColorSchemeProvider.displayName = 'ColorSchemeProvider';
110
73
  var _default = ColorSchemeProvider;
111
74
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/color-scheme-provider/ColorSchemeProvider.tsx"],"names":["ColorMode","GlobalStyle","createGlobalStyle","ColorSchemeProvider","children","color","colorMode","Classic","cssVariables","secondaryColor","style","colors","setColors","themeColors","setThemeColors","availableColors","newColors","newThemeColors","forEach","colorName","hexColor","rgbColor","r","g","b","displayName"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEKA,S;;WAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;GAAAA,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B,eAEsBD,QAAQ,CAACE,CAF/B,eAEqCF,QAAQ,CAACG,CAF9C;AAGAP,UAAAA,cAAc,WACPE,SADO,UAAd,aAEOE,QAAQ,CAACC,CAFhB,eAEsBD,QAAQ,CAACE,CAF/B,eAEqCF,QAAQ,CAACG,CAF9C;AAGH;AACJ;AACJ,KA1BD;AA4BAZ,IAAAA,SAAS,CAACI,SAAD,CAAT;AACAF,IAAAA,cAAc,CAACG,cAAD,CAAd;AACH,GApCD,EAoCG,CAACZ,KAAD,EAAQC,SAAR,EAAmBG,cAAnB,CApCH;AAsCA,sBACI,6BAAC,+BAAD;AAAe,IAAA,KAAK,EAAEI;AAAtB,kBACI;AAAK,IAAA,KAAK,gDAAOF,MAAP,GAAkBH,YAAlB,GAAmCE,KAAnC;AAAV,KAAuDN,QAAvD,CADJ,eAEI,6BAAC,WAAD,OAFJ,CADJ;AAMH,CAvDD;;AAyDAD,mBAAmB,CAACsB,WAApB,GAAkC,qBAAlC;eAEetB,mB","sourcesContent":["import { getAvailableColorList, getColorFromPalette, hexToRgb255 } from '@chayns/colors';\nimport React, { FC, ReactNode, useEffect, useState } from 'react';\nimport { createGlobalStyle, ThemeProvider } from 'styled-components';\n\nenum ColorMode {\n Classic,\n Dark,\n Light,\n}\n\ntype ColorSchemeProviderProps = {\n /**\n * The content of the application or the components for which the styles should be set\n */\n children: ReactNode;\n /**\n * The hex color to be used for the children\n */\n color?: string;\n /**\n * The color mode to be used for the children\n */\n colorMode?: ColorMode;\n /**\n * Css variables to be added in addition to the chayns variables\n */\n cssVariables?: { [key: string]: string | number };\n /**\n * The secondary hex color to be used for the children\n */\n secondaryColor?: string;\n /**\n * Additional styles set on the root element\n */\n style?: { [key: string]: string | number };\n};\n\ninterface Colors {\n [key: string]: string;\n}\n\nconst GlobalStyle = createGlobalStyle`\n .ellipsis {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n`;\n\nconst ColorSchemeProvider: FC<ColorSchemeProviderProps> = ({\n children,\n color = '#005EB8',\n colorMode = ColorMode.Classic,\n cssVariables = {},\n secondaryColor,\n style = {},\n}) => {\n const [colors, setColors] = useState<Colors>({});\n const [themeColors, setThemeColors] = useState<Colors>({});\n\n useEffect(() => {\n const availableColors = getAvailableColorList();\n\n const newColors: Colors = {};\n const newThemeColors: Colors = {};\n\n availableColors.forEach((colorName: string) => {\n const hexColor = getColorFromPalette(colorName, {\n color,\n colorMode,\n secondaryColor,\n });\n\n if (colorName === 'text') {\n // console.debug('textColor', hexColor);\n }\n\n if (hexColor) {\n const rgbColor = hexToRgb255(hexColor);\n\n newColors[`--chayns-color--${colorName}`] = hexColor;\n newThemeColors[colorName] = hexColor;\n\n if (rgbColor) {\n newColors[\n `--chayns-color-rgb--${colorName}`\n ] = `${rgbColor.r}, ${rgbColor.g}, ${rgbColor.b}`;\n newThemeColors[\n `${colorName}-rgb`\n ] = `${rgbColor.r}, ${rgbColor.g}, ${rgbColor.b}`;\n }\n }\n });\n\n setColors(newColors);\n setThemeColors(newThemeColors);\n }, [color, colorMode, secondaryColor]);\n\n return (\n <ThemeProvider theme={themeColors}>\n <div style={{ ...colors, ...cssVariables, ...style }}>{children}</div>\n <GlobalStyle />\n </ThemeProvider>\n );\n};\n\nColorSchemeProvider.displayName = 'ColorSchemeProvider';\n\nexport default ColorSchemeProvider;\n"],"file":"ColorSchemeProvider.js"}
1
+ {"version":3,"file":"ColorSchemeProvider.js","names":["_colors","require","_react","_interopRequireWildcard","_styledComponents","_font","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","ColorMode","GlobalStyle","createGlobalStyle","generateFontFaces","ColorSchemeProvider","_ref","children","color","colorMode","Classic","cssVariables","secondaryColor","style","colors","setColors","useState","themeColors","setThemeColors","useEffect","availableColors","getAvailableColorList","newColors","newThemeColors","forEach","colorName","hexColor","getColorFromPalette","rgbColor","hexToRgb255","r","g","b","createElement","ThemeProvider","theme","displayName","_default","exports"],"sources":["../../../src/components/color-scheme-provider/ColorSchemeProvider.tsx"],"sourcesContent":["import { getAvailableColorList, getColorFromPalette, hexToRgb255 } from '@chayns/colors';\nimport React, { FC, ReactNode, useEffect, useState } from 'react';\nimport { createGlobalStyle, ThemeProvider } from 'styled-components';\nimport { generateFontFaces } from './font';\n\nenum ColorMode {\n Classic,\n Dark,\n Light,\n}\n\ntype ColorSchemeProviderProps = {\n /**\n * The content of the application or the components for which the styles should be set\n */\n children: ReactNode;\n /**\n * The hex color to be used for the children\n */\n color?: string;\n /**\n * The color mode to be used for the children\n */\n colorMode?: ColorMode;\n /**\n * Css variables to be added in addition to the chayns variables\n */\n cssVariables?: { [key: string]: string | number };\n /**\n * The secondary hex color to be used for the children\n */\n secondaryColor?: string;\n /**\n * Additional styles set on the root element\n */\n style?: { [key: string]: string | number };\n};\n\nexport interface Theme {\n [key: string]: string;\n}\n\nexport type WithTheme<T> = T & {\n theme: Theme;\n};\n\nconst GlobalStyle = createGlobalStyle`\n ${generateFontFaces}\n\n .ellipsis {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n`;\n\nconst ColorSchemeProvider: FC<ColorSchemeProviderProps> = ({\n children,\n color = '#005EB8',\n colorMode = ColorMode.Classic,\n cssVariables = {},\n secondaryColor,\n style = {},\n}) => {\n const [colors, setColors] = useState<Theme>({});\n const [themeColors, setThemeColors] = useState<Theme>({});\n\n useEffect(() => {\n const availableColors = getAvailableColorList();\n\n const newColors: Theme = {};\n const newThemeColors: Theme = {};\n\n availableColors.forEach((colorName: string) => {\n const hexColor = getColorFromPalette(colorName, {\n color,\n colorMode,\n secondaryColor,\n });\n\n if (hexColor) {\n const rgbColor = hexToRgb255(hexColor);\n\n newColors[`--chayns-color--${colorName}`] = hexColor;\n newThemeColors[colorName] = hexColor;\n\n if (rgbColor) {\n newColors[\n `--chayns-color-rgb--${colorName}`\n ] = `${rgbColor.r}, ${rgbColor.g}, ${rgbColor.b}`;\n newThemeColors[\n `${colorName}-rgb`\n ] = `${rgbColor.r}, ${rgbColor.g}, ${rgbColor.b}`;\n }\n }\n });\n\n setColors(newColors);\n setThemeColors(newThemeColors);\n }, [color, colorMode, secondaryColor]);\n\n return (\n <ThemeProvider theme={themeColors}>\n <div style={{ ...colors, ...cssVariables, ...style }}>{children}</div>\n <GlobalStyle />\n </ThemeProvider>\n );\n};\n\nColorSchemeProvider.displayName = 'ColorSchemeProvider';\n\nexport default ColorSchemeProvider;\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAA2C,SAAAK,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAJ,wBAAAQ,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAd,GAAA,EAAAW,GAAA,SAAAI,IAAA,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
@@ -0,0 +1,6 @@
1
+ export interface Font {
2
+ family: string;
3
+ src: string;
4
+ unicodeRange?: string;
5
+ }
6
+ export declare const generateFontFaces: () => string;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.generateFontFaces = void 0;
7
+ const fonts = [{
8
+ family: 'Noto Color Emoji',
9
+ src: 'https://api.chayns-static.space/font/NotoColorEmoji/v24/Yq6P-KqIXTD0t4D9z1ESnKM3-HpFabsE4tq3luCC7p-aXxcn.0.woff2',
10
+ unicodeRange: 'U+1f1e6-1f1ff'
11
+ }, {
12
+ family: 'Noto Color Emoji',
13
+ src: 'https://api.chayns-static.space/font/NotoColorEmoji/v24/Yq6P-KqIXTD0t4D9z1ESnKM3-HpFabsE4tq3luCC7p-aXxcn.1.woff2',
14
+ unicodeRange: 'U+200d, U+2620, U+26a7, U+fe0f, U+1f308, U+1f38c, U+1f3c1, U+1f3f3-1f3f4, U+1f6a9, U+e0062-e0063, U+e0065, U+e0067, U+e006c, U+e006e, U+e0073-e0074, U+e0077, U+e007f'
15
+ }, {
16
+ family: 'Noto Color Emoji',
17
+ src: 'https://api.chayns-static.space/font/NotoColorEmoji/v24/Yq6P-KqIXTD0t4D9z1ESnKM3-HpFabsE4tq3luCC7p-aXxcn.2.woff2',
18
+ unicodeRange: 'U+23, U+2a, U+30-39, U+a9, U+ae, U+200d, U+203c, U+2049, U+20e3, U+2122, U+2139, U+2194-2199, U+21a9-21aa, U+23cf, U+23e9-23ef, U+23f8-23fa, U+24c2, U+25aa-25ab, U+25b6, U+25c0, U+25fb-25fe, U+2611, U+2622-2623, U+2626, U+262a, U+262e-262f, U+2638, U+2640, U+2642, U+2648-2653, U+2660, U+2663, U+2665-2666, U+2668, U+267b, U+267e-267f, U+2695, U+269b-269c, U+26a0, U+26a7, U+26aa-26ab, U+26ce, U+26d4, U+2705, U+2714, U+2716, U+271d, U+2721, U+2733-2734, U+2747, U+274c, U+274e, U+2753-2755, U+2757, U+2764, U+2795-2797, U+27a1, U+27b0, U+27bf, U+2934-2935, U+2b05-2b07, U+2b1b-2b1c, U+2b55, U+3030, U+303d, U+3297, U+3299, U+fe0f, U+1f170-1f171, U+1f17e-1f17f, U+1f18e, U+1f191-1f19a, U+1f201-1f202, U+1f21a, U+1f22f, U+1f232-1f23a, U+1f250-1f251, U+1f310, U+1f3a6, U+1f3b5-1f3b6, U+1f3bc, U+1f3e7, U+1f441, U+1f499-1f49c, U+1f49f-1f4a0, U+1f4a2, U+1f4ac-1f4ad, U+1f4b1-1f4b2, U+1f4b9, U+1f4db, U+1f4f2-1f4f6, U+1f500-1f50a, U+1f515, U+1f518-1f524, U+1f52f-1f53d, U+1f549, U+1f54e, U+1f5a4, U+1f5e8, U+1f5ef, U+1f6ab, U+1f6ad-1f6b1, U+1f6b3, U+1f6b7-1f6bc, U+1f6be, U+1f6c2-1f6c5, U+1f6d0-1f6d1, U+1f6d7, U+1f6dc, U+1f7e0-1f7eb, U+1f7f0, U+1f90d-1f90e, U+1f9e1, U+1fa75-1fa77, U+1faaf'
19
+ }, {
20
+ family: 'Noto Color Emoji',
21
+ src: 'https://api.chayns-static.space/font/NotoColorEmoji/v24/Yq6P-KqIXTD0t4D9z1ESnKM3-HpFabsE4tq3luCC7p-aXxcn.3.woff2',
22
+ unicodeRange: 'U+231a-231b, U+2328, U+23f0-23f3, U+2602, U+260e, U+2692, U+2694, U+2696-2697, U+2699, U+26b0-26b1, U+26cf, U+26d1, U+26d3, U+2702, U+2709, U+270f, U+2712, U+fe0f, U+1f302, U+1f321, U+1f392-1f393, U+1f3a9, U+1f3bd, U+1f3ee, U+1f3f7, U+1f3fa, U+1f451-1f462, U+1f484, U+1f489-1f48a, U+1f48c-1f48e, U+1f4a1, U+1f4a3, U+1f4b0, U+1f4b3-1f4b8, U+1f4bb-1f4da, U+1f4dc-1f4f1, U+1f4ff, U+1f50b-1f514, U+1f516-1f517, U+1f526-1f529, U+1f52c-1f52e, U+1f550-1f567, U+1f56f-1f570, U+1f576, U+1f587, U+1f58a-1f58d, U+1f5a5, U+1f5a8, U+1f5b1-1f5b2, U+1f5c2-1f5c4, U+1f5d1-1f5d3, U+1f5dc-1f5de, U+1f5e1, U+1f5f3, U+1f6aa, U+1f6ac, U+1f6bd, U+1f6bf, U+1f6c1, U+1f6cb, U+1f6cd-1f6cf, U+1f6d2, U+1f6e0-1f6e1, U+1f6f0, U+1f97b-1f97f, U+1f9af, U+1f9ba, U+1f9e2-1f9e6, U+1f9ea-1f9ec, U+1f9ee-1f9f4, U+1f9f7-1f9ff, U+1fa71-1fa74, U+1fa79-1fa7b, U+1fa86, U+1fa91-1fa93, U+1fa96, U+1fa99-1faa0, U+1faa2-1faa7, U+1faaa-1faae'
23
+ }, {
24
+ family: 'Noto Color Emoji',
25
+ src: 'https://api.chayns-static.space/font/NotoColorEmoji/v24/Yq6P-KqIXTD0t4D9z1ESnKM3-HpFabsE4tq3luCC7p-aXxcn.4.woff2',
26
+ unicodeRange: 'U+265f, U+26bd-26be, U+26f3, U+26f8, U+fe0f, U+1f004, U+1f0cf, U+1f380-1f384, U+1f386-1f38b, U+1f38d-1f391, U+1f396-1f397, U+1f399-1f39b, U+1f39e-1f39f, U+1f3a3-1f3a5, U+1f3a7-1f3a9, U+1f3ab-1f3b4, U+1f3b7-1f3bb, U+1f3bd-1f3c0, U+1f3c5-1f3c6, U+1f3c8-1f3c9, U+1f3cf-1f3d3, U+1f3f8-1f3f9, U+1f47e, U+1f4e2, U+1f4f7-1f4fd, U+1f52b, U+1f579, U+1f58c-1f58d, U+1f5bc, U+1f6f7, U+1f6f9, U+1f6fc, U+1f93f, U+1f941, U+1f945, U+1f947-1f94f, U+1f9e7-1f9e9, U+1f9f5-1f9f6, U+1fa70-1fa71, U+1fa80-1fa81, U+1fa83-1fa85, U+1fa87-1fa88, U+1fa94-1fa95, U+1fa97-1fa98, U+1faa1, U+1faa9'
27
+ }, {
28
+ family: 'Noto Color Emoji',
29
+ src: 'https://api.chayns-static.space/font/NotoColorEmoji/v24/Yq6P-KqIXTD0t4D9z1ESnKM3-HpFabsE4tq3luCC7p-aXxcn.5.woff2',
30
+ unicodeRange: 'U+2693, U+26e9-26ea, U+26f1-26f2, U+26f4-26f5, U+26fa, U+26fd, U+2708, U+fe0f, U+1f301, U+1f303, U+1f306-1f307, U+1f309, U+1f310, U+1f3a0-1f3a2, U+1f3aa, U+1f3cd-1f3ce, U+1f3d5, U+1f3d7-1f3db, U+1f3df-1f3e6, U+1f3e8-1f3ed, U+1f3ef-1f3f0, U+1f488, U+1f492, U+1f4ba, U+1f54b-1f54d, U+1f5fa-1f5ff, U+1f680-1f6a2, U+1f6a4-1f6a8, U+1f6b2, U+1f6d1, U+1f6d5-1f6d6, U+1f6dd-1f6df, U+1f6e2-1f6e5, U+1f6e9, U+1f6eb-1f6ec, U+1f6f3-1f6f6, U+1f6f8, U+1f6fa-1f6fb, U+1f9bc-1f9bd, U+1f9ed, U+1f9f3, U+1fa7c'
31
+ }, {
32
+ family: 'Noto Color Emoji',
33
+ src: 'https://api.chayns-static.space/font/NotoColorEmoji/v24/Yq6P-KqIXTD0t4D9z1ESnKM3-HpFabsE4tq3luCC7p-aXxcn.6.woff2',
34
+ unicodeRange: 'U+2615, U+fe0f, U+1f32d-1f330, U+1f336, U+1f33d, U+1f345-1f37f, U+1f382, U+1f52a, U+1f942-1f944, U+1f950-1f96f, U+1f99e, U+1f9aa, U+1f9c0-1f9cb, U+1fad0-1fadb'
35
+ }, {
36
+ family: 'Noto Color Emoji',
37
+ src: 'https://api.chayns-static.space/font/NotoColorEmoji/v24/Yq6P-KqIXTD0t4D9z1ESnKM3-HpFabsE4tq3luCC7p-aXxcn.7.woff2',
38
+ unicodeRange: 'U+200d, U+2600-2601, U+2603-2604, U+2614, U+2618, U+26a1, U+26c4-26c5, U+26c8, U+26f0, U+2728, U+2744, U+2b1b, U+2b50, U+fe0f, U+1f300, U+1f304-1f305, U+1f308, U+1f30a-1f30f, U+1f311-1f321, U+1f324-1f32c, U+1f331-1f335, U+1f337-1f33c, U+1f33e-1f344, U+1f3d4, U+1f3d6, U+1f3dc-1f3de, U+1f3f5, U+1f400-1f43f, U+1f490, U+1f4a7, U+1f4ab, U+1f4ae, U+1f525, U+1f54a, U+1f573, U+1f577-1f578, U+1f648-1f64a, U+1f940, U+1f980-1f9ae, U+1f9ba, U+1fa90, U+1faa8, U+1fab0-1fabd, U+1fabf, U+1face-1facf, U+1fae7'
39
+ }, {
40
+ family: 'Noto Color Emoji',
41
+ src: 'https://api.chayns-static.space/font/NotoColorEmoji/v24/Yq6P-KqIXTD0t4D9z1ESnKM3-HpFabsE4tq3luCC7p-aXxcn.8.woff2',
42
+ unicodeRange: 'U+200d, U+2640, U+2642, U+2695-2696, U+26f7, U+26f9, U+2708, U+2764, U+fe0f, U+1f33e, U+1f373, U+1f37c, U+1f384-1f385, U+1f393, U+1f3a4, U+1f3a8, U+1f3c2-1f3c4, U+1f3c7, U+1f3ca-1f3cc, U+1f3eb, U+1f3ed, U+1f3fb-1f3ff, U+1f466-1f478, U+1f47c, U+1f481-1f483, U+1f486-1f487, U+1f48b, U+1f48f, U+1f491, U+1f4bb-1f4bc, U+1f527, U+1f52c, U+1f574-1f575, U+1f57a, U+1f645-1f647, U+1f64b, U+1f64d-1f64e, U+1f680, U+1f692, U+1f6a3, U+1f6b4-1f6b6, U+1f6c0, U+1f6cc, U+1f91d, U+1f926, U+1f930-1f931, U+1f934-1f93a, U+1f93c-1f93e, U+1f977, U+1f9af-1f9b3, U+1f9b8-1f9b9, U+1f9bc-1f9bd, U+1f9cc-1f9cf, U+1f9d1-1f9df, U+1fa82, U+1fac3-1fac5'
43
+ }, {
44
+ family: 'Noto Color Emoji',
45
+ src: 'https://api.chayns-static.space/font/NotoColorEmoji/v24/Yq6P-KqIXTD0t4D9z1ESnKM3-HpFabsE4tq3luCC7p-aXxcn.9.woff2',
46
+ unicodeRange: 'U+200d, U+261d, U+2620, U+2639-263a, U+2665, U+270a-270d, U+2728, U+2763-2764, U+2b50, U+fe0f, U+1f31a-1f31f, U+1f32b, U+1f383, U+1f389, U+1f3fb-1f3ff, U+1f440-1f450, U+1f463-1f465, U+1f479-1f47b, U+1f47d-1f480, U+1f485, U+1f48b-1f48c, U+1f493-1f49f, U+1f4a4-1f4a6, U+1f4a8-1f4ab, U+1f4af, U+1f525, U+1f573, U+1f590, U+1f595-1f596, U+1f5a4, U+1f5e3, U+1f600-1f644, U+1f648-1f64a, U+1f64c, U+1f64f, U+1f90c-1f925, U+1f927-1f92f, U+1f932-1f933, U+1f970-1f976, U+1f978-1f97a, U+1f9a0, U+1f9b4-1f9b7, U+1f9bb, U+1f9be-1f9bf, U+1f9d0, U+1f9e0-1f9e1, U+1fa75-1fa79, U+1fac0-1fac2, U+1fae0-1fae6, U+1fae8, U+1faf0-1faf8'
47
+ }];
48
+ const generateFontFaces = () => fonts.map(font => `
49
+ @font-face {
50
+ font-display: swap;
51
+ font-family: "${font.family}";
52
+ font-style: normal;
53
+ font-weight: 400;
54
+ src: url("${font.src}") format("woff2");
55
+ ${font.unicodeRange ? `unicode-range: ${font.unicodeRange};` : ''}
56
+ }
57
+ `).join('');
58
+ exports.generateFontFaces = generateFontFaces;
59
+ //# sourceMappingURL=font.js.map