@pega/cosmos-react-core 3.0.0-dev.1.0 → 3.0.0-dev.4.0

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 (120) hide show
  1. package/lib/components/AppShell/AppShell.d.ts.map +1 -1
  2. package/lib/components/AppShell/AppShell.js +59 -41
  3. package/lib/components/AppShell/AppShell.js.map +1 -1
  4. package/lib/components/AppShell/AppShell.styles.d.ts +1 -3
  5. package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
  6. package/lib/components/AppShell/AppShell.styles.js +11 -4
  7. package/lib/components/AppShell/AppShell.styles.js.map +1 -1
  8. package/lib/components/AppShell/AppShell.types.d.ts +5 -1
  9. package/lib/components/AppShell/AppShell.types.d.ts.map +1 -1
  10. package/lib/components/AppShell/AppShell.types.js.map +1 -1
  11. package/lib/components/AppShell/SkipNavigation.d.ts.map +1 -1
  12. package/lib/components/AppShell/SkipNavigation.js +24 -15
  13. package/lib/components/AppShell/SkipNavigation.js.map +1 -1
  14. package/lib/components/ComboBox/ComboBox.styles.d.ts.map +1 -1
  15. package/lib/components/ComboBox/ComboBox.styles.js +1 -0
  16. package/lib/components/ComboBox/ComboBox.styles.js.map +1 -1
  17. package/lib/components/Configuration/Configuration.d.ts.map +1 -1
  18. package/lib/components/Configuration/Configuration.js +2 -1
  19. package/lib/components/Configuration/Configuration.js.map +1 -1
  20. package/lib/components/Currency/CurrencyDisplay.d.ts +20 -11
  21. package/lib/components/Currency/CurrencyDisplay.d.ts.map +1 -1
  22. package/lib/components/Currency/CurrencyDisplay.js +25 -14
  23. package/lib/components/Currency/CurrencyDisplay.js.map +1 -1
  24. package/lib/components/FieldGroup/FieldGroup.d.ts +2 -0
  25. package/lib/components/FieldGroup/FieldGroup.d.ts.map +1 -1
  26. package/lib/components/FieldGroup/FieldGroup.js +8 -5
  27. package/lib/components/FieldGroup/FieldGroup.js.map +1 -1
  28. package/lib/components/File/FileUploadItem.js +1 -1
  29. package/lib/components/File/FileUploadItem.js.map +1 -1
  30. package/lib/components/Form/Form.d.ts.map +1 -1
  31. package/lib/components/Form/Form.js +2 -1
  32. package/lib/components/Form/Form.js.map +1 -1
  33. package/lib/components/HTML/HTML.d.ts +13 -0
  34. package/lib/components/HTML/HTML.d.ts.map +1 -0
  35. package/lib/components/HTML/HTML.js +148 -0
  36. package/lib/components/HTML/HTML.js.map +1 -0
  37. package/lib/components/HTML/index.d.ts +2 -0
  38. package/lib/components/HTML/index.d.ts.map +1 -0
  39. package/lib/components/HTML/index.js +2 -0
  40. package/lib/components/HTML/index.js.map +1 -0
  41. package/lib/components/Icon/iconNames.d.ts +1 -1
  42. package/lib/components/Icon/iconNames.d.ts.map +1 -1
  43. package/lib/components/Icon/iconNames.js +1 -0
  44. package/lib/components/Icon/iconNames.js.map +1 -1
  45. package/lib/components/Icon/icons/ai-assist.icon.d.ts +4 -0
  46. package/lib/components/Icon/icons/ai-assist.icon.d.ts.map +1 -0
  47. package/lib/components/Icon/icons/ai-assist.icon.js +6 -0
  48. package/lib/components/Icon/icons/ai-assist.icon.js.map +1 -0
  49. package/lib/components/Icon/icons/help-solid.icon.js +1 -1
  50. package/lib/components/Icon/icons/help-solid.icon.js.map +1 -1
  51. package/lib/components/Icon/icons/help.icon.js +1 -1
  52. package/lib/components/Icon/icons/help.icon.js.map +1 -1
  53. package/lib/components/Icon/icons/information-solid.icon.d.ts.map +1 -1
  54. package/lib/components/Icon/icons/information-solid.icon.js +1 -1
  55. package/lib/components/Icon/icons/information-solid.icon.js.map +1 -1
  56. package/lib/components/Icon/icons/information.icon.js +1 -1
  57. package/lib/components/Icon/icons/information.icon.js.map +1 -1
  58. package/lib/components/Icon/icons/minus.icon.js +1 -1
  59. package/lib/components/Icon/icons/minus.icon.js.map +1 -1
  60. package/lib/components/Menu/MenuItem.d.ts.map +1 -1
  61. package/lib/components/Menu/MenuItem.js +2 -1
  62. package/lib/components/Menu/MenuItem.js.map +1 -1
  63. package/lib/components/Menu/MenuListHeader.d.ts.map +1 -1
  64. package/lib/components/Menu/MenuListHeader.js +4 -1
  65. package/lib/components/Menu/MenuListHeader.js.map +1 -1
  66. package/lib/components/MultiStep/MultiStep.d.ts.map +1 -1
  67. package/lib/components/MultiStep/MultiStep.js +1 -1
  68. package/lib/components/MultiStep/MultiStep.js.map +1 -1
  69. package/lib/components/Number/NumberDisplay.d.ts +14 -10
  70. package/lib/components/Number/NumberDisplay.d.ts.map +1 -1
  71. package/lib/components/Number/NumberDisplay.js +10 -5
  72. package/lib/components/Number/NumberDisplay.js.map +1 -1
  73. package/lib/components/Number/NumberInput.types.d.ts +9 -4
  74. package/lib/components/Number/NumberInput.types.d.ts.map +1 -1
  75. package/lib/components/Number/NumberInput.types.js +2 -1
  76. package/lib/components/Number/NumberInput.types.js.map +1 -1
  77. package/lib/components/PageTemplates/DashboardPage.d.ts +7 -2
  78. package/lib/components/PageTemplates/DashboardPage.d.ts.map +1 -1
  79. package/lib/components/PageTemplates/PageTemplates.d.ts +7 -2
  80. package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -1
  81. package/lib/components/PageTemplates/PageTemplates.js +69 -19
  82. package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
  83. package/lib/components/Popover/Popover.styles.d.ts.map +1 -1
  84. package/lib/components/Popover/Popover.styles.js +44 -19
  85. package/lib/components/Popover/Popover.styles.js.map +1 -1
  86. package/lib/components/Table/Table.d.ts +1 -0
  87. package/lib/components/Table/Table.d.ts.map +1 -1
  88. package/lib/components/Table/Table.js +1 -1
  89. package/lib/components/Table/Table.js.map +1 -1
  90. package/lib/components/Tabs/TabPanel.d.ts.map +1 -1
  91. package/lib/components/Tabs/TabPanel.js +1 -0
  92. package/lib/components/Tabs/TabPanel.js.map +1 -1
  93. package/lib/components/TextArea/TextArea.styles.d.ts.map +1 -1
  94. package/lib/components/TextArea/TextArea.styles.js +1 -0
  95. package/lib/components/TextArea/TextArea.styles.js.map +1 -1
  96. package/lib/hooks/useI18n.d.ts +20 -0
  97. package/lib/hooks/useI18n.d.ts.map +1 -1
  98. package/lib/i18n/default.d.ts +20 -0
  99. package/lib/i18n/default.d.ts.map +1 -1
  100. package/lib/i18n/default.js +26 -5
  101. package/lib/i18n/default.js.map +1 -1
  102. package/lib/i18n/i18n.d.ts +40 -0
  103. package/lib/i18n/i18n.d.ts.map +1 -1
  104. package/lib/index.d.ts +2 -0
  105. package/lib/index.d.ts.map +1 -1
  106. package/lib/index.js +2 -0
  107. package/lib/index.js.map +1 -1
  108. package/lib/styles/gradients.d.ts +102 -0
  109. package/lib/styles/gradients.d.ts.map +1 -0
  110. package/lib/styles/gradients.js +232 -0
  111. package/lib/styles/gradients.js.map +1 -0
  112. package/lib/styles/index.d.ts +1 -0
  113. package/lib/styles/index.d.ts.map +1 -1
  114. package/lib/styles/index.js +1 -0
  115. package/lib/styles/index.js.map +1 -1
  116. package/lib/theme/theme.d.ts +439 -439
  117. package/lib/theme/themeDefinition.json +243 -243
  118. package/lib/utils/utils.js +1 -1
  119. package/lib/utils/utils.js.map +1 -1
  120. package/package.json +10 -8
@@ -0,0 +1,102 @@
1
+ interface ColorStop {
2
+ /** CSS color string. */
3
+ color: string;
4
+ /** Position along the gradient expressed as a number from 0 to 1. */
5
+ position: number;
6
+ }
7
+ declare type LinearGradient = ColorStop[];
8
+ export declare const gradientMap: {
9
+ grayscale: {
10
+ color: string;
11
+ position: number;
12
+ }[];
13
+ 'persian-blue': {
14
+ color: string;
15
+ position: number;
16
+ }[];
17
+ 'persian-green': {
18
+ color: string;
19
+ position: number;
20
+ }[];
21
+ 'pastel-orange': {
22
+ color: string;
23
+ position: number;
24
+ }[];
25
+ 'japanese-laurel': {
26
+ color: string;
27
+ position: number;
28
+ }[];
29
+ 'mango-tango': {
30
+ color: string;
31
+ position: number;
32
+ }[];
33
+ valencia: {
34
+ color: string;
35
+ position: number;
36
+ }[];
37
+ 'fuchsia-blue': {
38
+ color: string;
39
+ position: number;
40
+ }[];
41
+ 'faded-red': {
42
+ color: string;
43
+ position: number;
44
+ }[];
45
+ rope: {
46
+ color: string;
47
+ position: number;
48
+ }[];
49
+ silver: {
50
+ color: string;
51
+ position: number;
52
+ }[];
53
+ 'blue-yellow': {
54
+ color: string;
55
+ position: number;
56
+ }[];
57
+ 'green-yellow': {
58
+ color: string;
59
+ position: number;
60
+ }[];
61
+ 'ruby-yellow': {
62
+ color: string;
63
+ position: number;
64
+ }[];
65
+ 'purple-blue': {
66
+ color: string;
67
+ position: number;
68
+ }[];
69
+ 'violet-rose': {
70
+ color: string;
71
+ position: number;
72
+ }[];
73
+ 'negative-attention-positive': {
74
+ color: string;
75
+ position: number;
76
+ }[];
77
+ 'negative-attention-positive-protan': {
78
+ color: string;
79
+ position: number;
80
+ }[];
81
+ 'negative-attention-positive-deutan': {
82
+ color: string;
83
+ position: number;
84
+ }[];
85
+ 'hot-cold': {
86
+ color: string;
87
+ position: number;
88
+ }[];
89
+ 'two-extremes': {
90
+ color: string;
91
+ position: number;
92
+ }[];
93
+ };
94
+ export declare const colorInGradient: ([...gradient]: LinearGradient, targetPosition: number) => string;
95
+ export declare const colorInGradientByName: (name: keyof typeof gradientMap, targetPosition: number) => string;
96
+ export declare const colorsForCategories: (count: number, { gradients, steps }?: {
97
+ gradients?: LinearGradient[] | undefined;
98
+ steps?: number[] | undefined;
99
+ }) => string[];
100
+ export declare const toLinearGradient: (gradient: LinearGradient) => string;
101
+ export {};
102
+ //# sourceMappingURL=gradients.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gradients.d.ts","sourceRoot":"","sources":["../../src/styles/gradients.ts"],"names":[],"mappings":"AAEA,UAAU,SAAS;IACjB,wBAAwB;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,aAAK,cAAc,GAAG,SAAS,EAAE,CAAC;AAElC,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4JvB,CAAC;AAEF,eAAO,MAAM,eAAe,kDAAmD,MAAM,KAAG,MA0CvF,CAAC;AAEF,eAAO,MAAM,qBAAqB,SAC1B,MAAM,kBAAkB,kBACd,MAAM,KACrB,MAEF,CAAC;AAEF,eAAO,MAAM,mBAAmB,UACvB,MAAM;;;MAkBZ,MAAM,EAgBR,CAAC;AAEF,eAAO,MAAM,gBAAgB,gCAA+B,MAO3D,CAAC"}
@@ -0,0 +1,232 @@
1
+ import { mix } from 'polished';
2
+ export const gradientMap = {
3
+ grayscale: [
4
+ { color: 'hsl(0, 100%, 100%)', position: 0 },
5
+ { color: 'hsl(0, 100%, 0%)', position: 1 }
6
+ ],
7
+ 'persian-blue': [
8
+ { color: 'hsl(210, 50%, 94%)', position: 0 },
9
+ { color: 'hsl(210, 46%, 63%)', position: 1 / 3 },
10
+ { color: 'hsl(206, 100%, 33%)', position: 2 / 3 },
11
+ { color: 'hsl(210, 100%, 27%)', position: 1 }
12
+ ],
13
+ 'persian-green': [
14
+ { color: 'hsl(175, 35%, 94%)', position: 0 },
15
+ { color: 'hsl(175, 42%, 65%)', position: 1 / 3 },
16
+ { color: 'hsl(175, 100%, 33%)', position: 2 / 3 },
17
+ { color: 'hsl(175, 100%, 27%)', position: 1 }
18
+ ],
19
+ 'pastel-orange': [
20
+ { color: 'hsl(36, 100%, 97%)', position: 0 },
21
+ { color: 'hsl(36, 100%, 79%)', position: 1 / 3 },
22
+ { color: 'hsl(36, 100%, 64%)', position: 2 / 3 },
23
+ { color: 'hsl(36, 99%, 61%)', position: 1 }
24
+ ],
25
+ 'japanese-laurel': [
26
+ { color: 'hsl(135, 21%, 94%)', position: 0 },
27
+ { color: 'hsl(135, 24%, 61%)', position: 1 / 3 },
28
+ { color: 'hsl(135, 54%, 33%)', position: 2 / 3 },
29
+ { color: 'hsl(135, 60%, 26%)', position: 1 }
30
+ ],
31
+ 'mango-tango': [
32
+ { color: 'hsl(23, 100%, 96%)', position: 0 },
33
+ { color: 'hsl(23, 100%, 78%)', position: 1 / 3 },
34
+ { color: 'hsl(23, 100%, 62%)', position: 2 / 3 },
35
+ { color: 'hsl(23, 100%, 53%)', position: 1 }
36
+ ],
37
+ valencia: [
38
+ { color: 'hsl(1, 87%, 96%)', position: 0 },
39
+ { color: 'hsl(1, 72%, 75%)', position: 1 / 3 },
40
+ { color: 'hsl(1, 67%, 56%)', position: 2 / 3 },
41
+ { color: 'hsl(1, 82%, 41%)', position: 1 }
42
+ ],
43
+ 'fuchsia-blue': [
44
+ { color: 'hsl(259, 45%, 96%)', position: 0 },
45
+ { color: 'hsl(259, 45%, 78%)', position: 1 / 3 },
46
+ { color: 'hsl(259, 43%, 56%)', position: 2 / 3 },
47
+ { color: 'hsl(259, 40%, 49%)', position: 1 }
48
+ ],
49
+ 'faded-red': [
50
+ { color: 'hsl(360, 100%, 95%)', position: 0 },
51
+ { color: 'hsl(360, 100%, 85%)', position: 1 / 3 },
52
+ { color: 'hsl(360, 100%, 75%)', position: 2 / 3 },
53
+ { color: 'hsl(360, 100%, 70%)', position: 1 }
54
+ ],
55
+ rope: [
56
+ { color: 'hsl(25, 31%, 93%)', position: 0 },
57
+ { color: 'hsl(25, 32%, 62%)', position: 1 / 3 },
58
+ { color: 'hsl(25, 59%, 35%)', position: 2 / 3 },
59
+ { color: 'hsl(25, 64%, 30%)', position: 1 }
60
+ ],
61
+ silver: [
62
+ { color: 'hsl(15, 18%, 97%)', position: 0 },
63
+ { color: 'hsl(15, 9%, 79%)', position: 1 / 3 },
64
+ { color: 'hsl(15, 11%, 65%)', position: 2 / 3 },
65
+ { color: 'hsl(15, 9%, 58%)', position: 1 }
66
+ ],
67
+ 'blue-yellow': [
68
+ { color: 'hsl(56, 100%, 93%)', position: 0 },
69
+ { color: 'hsl(144, 46%, 79%)', position: 2 / 10 },
70
+ { color: 'hsl(185, 53%, 58%)', position: 4 / 10 },
71
+ { color: 'hsl(191, 56%, 52%)', position: 5 / 10 },
72
+ { color: 'hsl(195, 62%, 48%)', position: 6 / 10 },
73
+ { color: 'hsl(206, 67%, 37%)', position: 8 / 10 },
74
+ { color: 'hsl(215, 62%, 30%)', position: 1 }
75
+ ],
76
+ 'green-yellow': [
77
+ { color: 'hsl(56, 100%, 93%)', position: 0 },
78
+ { color: 'hsl(88, 61%, 85%)', position: 2 / 10 },
79
+ { color: 'hsl(125, 47%, 78%)', position: 4 / 10 },
80
+ { color: 'hsl(148, 45%, 65%)', position: 5 / 10 },
81
+ { color: 'hsl(159, 47%, 50%)', position: 6 / 10 },
82
+ { color: 'hsl(173, 80%, 30%)', position: 8 / 10 },
83
+ { color: 'hsl(178, 73%, 22%)', position: 1 }
84
+ ],
85
+ 'ruby-yellow': [
86
+ { color: 'hsl(56, 100%, 93%)', position: 0 },
87
+ { color: 'hsl(40, 100%, 83%)', position: 2 / 10 },
88
+ { color: 'hsl(19, 100%, 75%)', position: 4 / 10 },
89
+ { color: 'hsl(3, 100%, 73%)', position: 5 / 10 },
90
+ { color: 'hsl(350, 81%, 62%)', position: 6 / 10 },
91
+ { color: 'hsl(343, 54%, 55%)', position: 8 / 10 },
92
+ { color: 'hsl(330, 40%, 36%)', position: 1 }
93
+ ],
94
+ 'purple-blue': [
95
+ { color: 'hsl(190, 42%, 97%)', position: 0 },
96
+ { color: 'hsl(205, 51%, 84%)', position: 2 / 10 },
97
+ { color: 'hsl(212, 47%, 73%)', position: 4 / 10 },
98
+ { color: 'hsl(219, 41%, 70%)', position: 5 / 10 },
99
+ { color: 'hsl(253, 32%, 66%)', position: 6 / 10 },
100
+ { color: 'hsl(272, 27%, 49%)', position: 8 / 10 },
101
+ { color: 'hsl(272, 37%, 32%)', position: 1 }
102
+ ],
103
+ 'violet-rose': [
104
+ { color: 'hsl(18, 100%, 98%)', position: 0 },
105
+ { color: 'hsl(359, 100%, 91%)', position: 2 / 10 },
106
+ { color: 'hsl(336, 96%, 77%)', position: 4 / 10 },
107
+ { color: 'hsl(325, 73%, 65%)', position: 5 / 10 },
108
+ { color: 'hsl(319, 58%, 58%)', position: 6 / 10 },
109
+ { color: 'hsl(287, 38%, 45%)', position: 8 / 10 },
110
+ { color: 'hsl(259, 43%, 35%)', position: 1 }
111
+ ],
112
+ 'negative-attention-positive': [
113
+ { color: 'hsl(2, 67%, 56%)', position: 0 },
114
+ { color: 'hsl(21, 87%, 60%)', position: 2 / 10 },
115
+ { color: 'hsl(36, 100%, 64%)', position: 4 / 10 },
116
+ { color: 'hsl(50, 95%, 75%)', position: 5 / 10 },
117
+ { color: 'hsl(85, 72%, 67%)', position: 6 / 10 },
118
+ { color: 'hsl(120, 49%, 60%)', position: 8 / 10 },
119
+ { color: 'hsl(135, 53%, 33%)', position: 1 }
120
+ ],
121
+ 'negative-attention-positive-protan': [
122
+ { color: 'hsl(344, 67%, 44%)', position: 0 },
123
+ { color: 'hsl(351, 66%, 59%)', position: 2 / 10 },
124
+ { color: 'hsl(360, 100%, 84%)', position: 4 / 10 },
125
+ { color: 'hsl(0, 0%, 89%)', position: 5 / 10 },
126
+ { color: 'hsl(110, 46%, 80%)', position: 6 / 10 },
127
+ { color: 'hsl(120, 49%, 60%)', position: 8 / 10 },
128
+ { color: 'hsl(135, 53%, 33%)', position: 1 }
129
+ ],
130
+ // cspell:disable-next-line
131
+ 'negative-attention-positive-deutan': [
132
+ { color: 'hsl(315, 64%, 45%)', position: 0 },
133
+ { color: 'hsl(313, 83%, 62%)', position: 2 / 10 },
134
+ { color: 'hsl(313, 100%, 80%)', position: 4 / 10 },
135
+ { color: 'hsl(0, 0%, 89%)', position: 5 / 10 },
136
+ { color: 'hsl(110, 46%, 80%)', position: 6 / 10 },
137
+ { color: 'hsl(120, 49%, 60%)', position: 8 / 10 },
138
+ { color: 'hsl(135, 53%, 33%)', position: 1 }
139
+ ],
140
+ 'hot-cold': [
141
+ { color: 'hsl(212, 100%, 27%)', position: 0 },
142
+ { color: 'hsl(213, 40%, 49%)', position: 2 / 10 },
143
+ { color: 'hsl(210, 45%, 69%)', position: 4 / 10 },
144
+ { color: 'hsl(0, 0%, 89%)', position: 5 / 10 },
145
+ { color: 'hsl(360, 100%, 84%)', position: 6 / 10 },
146
+ { color: 'hsl(351, 66%, 59%)', position: 8 / 10 },
147
+ { color: 'hsl(344, 67%, 44%)', position: 1 }
148
+ ],
149
+ 'two-extremes': [
150
+ { color: 'hsl(240, 30%, 39%)', position: 0 },
151
+ { color: 'hsl(271, 27%, 63%)', position: 2 / 10 },
152
+ { color: 'hsl(293, 25%, 87%)', position: 4 / 10 },
153
+ { color: 'hsl(0, 0%, 89%)', position: 5 / 10 },
154
+ { color: 'hsl(171, 37%, 86%)', position: 6 / 10 },
155
+ { color: 'hsl(167, 41%, 51%)', position: 8 / 10 },
156
+ { color: 'hsl(163, 44%, 16%)', position: 1 }
157
+ ]
158
+ };
159
+ export const colorInGradient = ([...gradient], targetPosition) => {
160
+ // Return transparent for an empty gradient.
161
+ if (gradient.length === 0)
162
+ return 'transparent';
163
+ // Return the color for single element gradient.
164
+ if (gradient.length === 1)
165
+ return gradient[0].color;
166
+ // Clamp position to interval from 0 to 1.
167
+ targetPosition = Math.min(Math.max(targetPosition, 0), 1);
168
+ // Extend the the start of the gradient to 0 if necessary.
169
+ if (gradient[0].position !== 0)
170
+ gradient.unshift({ color: gradient[0].color, position: 0 });
171
+ // Extend the the end of the gradient to 1 if necessary.
172
+ if (gradient[gradient.length - 1].position !== 1)
173
+ gradient.push({ color: gradient[gradient.length - 1].color, position: 1 });
174
+ for (let i = 0; i < gradient.length; i += 1) {
175
+ const current = gradient[i];
176
+ // If target position is the same as the current position, return the color at the current position.
177
+ if (targetPosition === current.position)
178
+ return current.color;
179
+ // If target position is less than the current position, it must be between the previous position and current position.
180
+ if (targetPosition < current.position) {
181
+ const previous = gradient[i - 1];
182
+ // Calculate how far the targetPosition is between the previousPosition and the currentPosition.
183
+ const percentage = (targetPosition - previous.position) / (current.position - previous.position);
184
+ try {
185
+ return mix(percentage, current.color, previous.color);
186
+ }
187
+ catch {
188
+ // Polished mix throws on invalid color.
189
+ return 'transparent';
190
+ }
191
+ }
192
+ }
193
+ // Failsafe return.
194
+ return 'transparent';
195
+ };
196
+ export const colorInGradientByName = (name, targetPosition) => {
197
+ return colorInGradient(gradientMap[name] ?? [], targetPosition);
198
+ };
199
+ export const colorsForCategories = (count, { gradients = [
200
+ 'persian-blue',
201
+ 'persian-green',
202
+ 'pastel-orange',
203
+ 'japanese-laurel',
204
+ 'mango-tango',
205
+ 'valencia',
206
+ 'fuchsia-blue',
207
+ 'faded-red',
208
+ 'rope',
209
+ 'silver'
210
+ ].map(name => gradientMap[name]), steps = [2 / 3, 1 / 3, 1, 0, 1 / 2] } = {}) => {
211
+ // Colors per gradient
212
+ const perGradient = Math.floor(count / gradients.length);
213
+ // Number of gradients with 1 extra color
214
+ const extra = count % gradients.length;
215
+ const colors = [];
216
+ for (let i = 0; i < gradients.length; i += 1) {
217
+ for (let j = 0; j < (i < extra ? perGradient + 1 : perGradient); j += 1) {
218
+ colors.push(colorInGradient(gradients[i], steps[j % steps.length]));
219
+ }
220
+ }
221
+ return colors;
222
+ };
223
+ export const toLinearGradient = (gradient) => {
224
+ if (gradient.length === 0)
225
+ return 'transparent';
226
+ if (gradient.length === 1)
227
+ return gradient[0].color;
228
+ return `linear-gradient(${gradient
229
+ .map(({ color, position }) => `${color} ${position * 100}%`)
230
+ .join(', ')})`;
231
+ };
232
+ //# sourceMappingURL=gradients.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gradients.js","sourceRoot":"","sources":["../../src/styles/gradients.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAW/B,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,SAAS,EAAE;QACT,EAAE,KAAK,EAAE,oBAAoB,EAAE,QAAQ,EAAE,CAAC,EAAE;QAC5C,EAAE,KAAK,EAAE,kBAAkB,EAAE,QAAQ,EAAE,CAAC,EAAE;KAC3C;I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,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE;YACvE,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;SACrE;KACF;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,QAAwB,EAAU,EAAE;IACnE,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,aAAa,CAAC;IAChD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAEpD,OAAO,mBAAmB,QAAQ;SAC/B,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,GAAG,KAAK,IAAI,QAAQ,GAAG,GAAG,GAAG,CAAC;SAC3D,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;AACnB,CAAC,CAAC","sourcesContent":["import { mix } from 'polished';\n\ninterface ColorStop {\n /** CSS color string. */\n color: string;\n /** Position along the gradient expressed as a number from 0 to 1. */\n position: number;\n}\n\ntype LinearGradient = ColorStop[];\n\nexport const gradientMap = {\n grayscale: [\n { color: 'hsl(0, 100%, 100%)', position: 0 },\n { color: 'hsl(0, 100%, 0%)', position: 1 }\n ],\n 'persian-blue': [\n { color: 'hsl(210, 50%, 94%)', position: 0 },\n { color: 'hsl(210, 46%, 63%)', position: 1 / 3 },\n { color: 'hsl(206, 100%, 33%)', position: 2 / 3 },\n { color: 'hsl(210, 100%, 27%)', position: 1 }\n ],\n 'persian-green': [\n { color: 'hsl(175, 35%, 94%)', position: 0 },\n { color: 'hsl(175, 42%, 65%)', position: 1 / 3 },\n { color: 'hsl(175, 100%, 33%)', position: 2 / 3 },\n { color: 'hsl(175, 100%, 27%)', position: 1 }\n ],\n 'pastel-orange': [\n { color: 'hsl(36, 100%, 97%)', position: 0 },\n { color: 'hsl(36, 100%, 79%)', position: 1 / 3 },\n { color: 'hsl(36, 100%, 64%)', position: 2 / 3 },\n { color: 'hsl(36, 99%, 61%)', position: 1 }\n ],\n 'japanese-laurel': [\n { color: 'hsl(135, 21%, 94%)', position: 0 },\n { color: 'hsl(135, 24%, 61%)', position: 1 / 3 },\n { color: 'hsl(135, 54%, 33%)', position: 2 / 3 },\n { color: 'hsl(135, 60%, 26%)', position: 1 }\n ],\n 'mango-tango': [\n { color: 'hsl(23, 100%, 96%)', position: 0 },\n { color: 'hsl(23, 100%, 78%)', position: 1 / 3 },\n { color: 'hsl(23, 100%, 62%)', position: 2 / 3 },\n { color: 'hsl(23, 100%, 53%)', position: 1 }\n ],\n valencia: [\n { color: 'hsl(1, 87%, 96%)', position: 0 },\n { color: 'hsl(1, 72%, 75%)', position: 1 / 3 },\n { color: 'hsl(1, 67%, 56%)', position: 2 / 3 },\n { color: 'hsl(1, 82%, 41%)', position: 1 }\n ],\n 'fuchsia-blue': [\n { color: 'hsl(259, 45%, 96%)', position: 0 },\n { color: 'hsl(259, 45%, 78%)', position: 1 / 3 },\n { color: 'hsl(259, 43%, 56%)', position: 2 / 3 },\n { color: 'hsl(259, 40%, 49%)', position: 1 }\n ],\n 'faded-red': [\n { color: 'hsl(360, 100%, 95%)', position: 0 },\n { color: 'hsl(360, 100%, 85%)', position: 1 / 3 },\n { color: 'hsl(360, 100%, 75%)', position: 2 / 3 },\n { color: 'hsl(360, 100%, 70%)', position: 1 }\n ],\n rope: [\n { color: 'hsl(25, 31%, 93%)', position: 0 },\n { color: 'hsl(25, 32%, 62%)', position: 1 / 3 },\n { color: 'hsl(25, 59%, 35%)', position: 2 / 3 },\n { color: 'hsl(25, 64%, 30%)', position: 1 }\n ],\n silver: [\n { color: 'hsl(15, 18%, 97%)', position: 0 },\n { color: 'hsl(15, 9%, 79%)', position: 1 / 3 },\n { color: 'hsl(15, 11%, 65%)', position: 2 / 3 },\n { color: 'hsl(15, 9%, 58%)', position: 1 }\n ],\n 'blue-yellow': [\n { color: 'hsl(56, 100%, 93%)', position: 0 },\n { color: 'hsl(144, 46%, 79%)', position: 2 / 10 },\n { color: 'hsl(185, 53%, 58%)', position: 4 / 10 },\n { color: 'hsl(191, 56%, 52%)', position: 5 / 10 },\n { color: 'hsl(195, 62%, 48%)', position: 6 / 10 },\n { color: 'hsl(206, 67%, 37%)', position: 8 / 10 },\n { color: 'hsl(215, 62%, 30%)', position: 1 }\n ],\n 'green-yellow': [\n { color: 'hsl(56, 100%, 93%)', position: 0 },\n { color: 'hsl(88, 61%, 85%)', position: 2 / 10 },\n { color: 'hsl(125, 47%, 78%)', position: 4 / 10 },\n { color: 'hsl(148, 45%, 65%)', position: 5 / 10 },\n { color: 'hsl(159, 47%, 50%)', position: 6 / 10 },\n { color: 'hsl(173, 80%, 30%)', position: 8 / 10 },\n { color: 'hsl(178, 73%, 22%)', position: 1 }\n ],\n 'ruby-yellow': [\n { color: 'hsl(56, 100%, 93%)', position: 0 },\n { color: 'hsl(40, 100%, 83%)', position: 2 / 10 },\n { color: 'hsl(19, 100%, 75%)', position: 4 / 10 },\n { color: 'hsl(3, 100%, 73%)', position: 5 / 10 },\n { color: 'hsl(350, 81%, 62%)', position: 6 / 10 },\n { color: 'hsl(343, 54%, 55%)', position: 8 / 10 },\n { color: 'hsl(330, 40%, 36%)', position: 1 }\n ],\n 'purple-blue': [\n { color: 'hsl(190, 42%, 97%)', position: 0 },\n { color: 'hsl(205, 51%, 84%)', position: 2 / 10 },\n { color: 'hsl(212, 47%, 73%)', position: 4 / 10 },\n { color: 'hsl(219, 41%, 70%)', position: 5 / 10 },\n { color: 'hsl(253, 32%, 66%)', position: 6 / 10 },\n { color: 'hsl(272, 27%, 49%)', position: 8 / 10 },\n { color: 'hsl(272, 37%, 32%)', position: 1 }\n ],\n 'violet-rose': [\n { color: 'hsl(18, 100%, 98%)', position: 0 },\n { color: 'hsl(359, 100%, 91%)', position: 2 / 10 },\n { color: 'hsl(336, 96%, 77%)', position: 4 / 10 },\n { color: 'hsl(325, 73%, 65%)', position: 5 / 10 },\n { color: 'hsl(319, 58%, 58%)', position: 6 / 10 },\n { color: 'hsl(287, 38%, 45%)', position: 8 / 10 },\n { color: 'hsl(259, 43%, 35%)', position: 1 }\n ],\n 'negative-attention-positive': [\n { color: 'hsl(2, 67%, 56%)', position: 0 },\n { color: 'hsl(21, 87%, 60%)', position: 2 / 10 },\n { color: 'hsl(36, 100%, 64%)', position: 4 / 10 },\n { color: 'hsl(50, 95%, 75%)', position: 5 / 10 },\n { color: 'hsl(85, 72%, 67%)', position: 6 / 10 },\n { color: 'hsl(120, 49%, 60%)', position: 8 / 10 },\n { color: 'hsl(135, 53%, 33%)', position: 1 }\n ],\n 'negative-attention-positive-protan': [\n { color: 'hsl(344, 67%, 44%)', position: 0 },\n { color: 'hsl(351, 66%, 59%)', position: 2 / 10 },\n { color: 'hsl(360, 100%, 84%)', position: 4 / 10 },\n { color: 'hsl(0, 0%, 89%)', position: 5 / 10 },\n { color: 'hsl(110, 46%, 80%)', position: 6 / 10 },\n { color: 'hsl(120, 49%, 60%)', position: 8 / 10 },\n { color: 'hsl(135, 53%, 33%)', position: 1 }\n ],\n // cspell:disable-next-line\n 'negative-attention-positive-deutan': [\n { color: 'hsl(315, 64%, 45%)', position: 0 },\n { color: 'hsl(313, 83%, 62%)', position: 2 / 10 },\n { color: 'hsl(313, 100%, 80%)', position: 4 / 10 },\n { color: 'hsl(0, 0%, 89%)', position: 5 / 10 },\n { color: 'hsl(110, 46%, 80%)', position: 6 / 10 },\n { color: 'hsl(120, 49%, 60%)', position: 8 / 10 },\n { color: 'hsl(135, 53%, 33%)', position: 1 }\n ],\n 'hot-cold': [\n { color: 'hsl(212, 100%, 27%)', position: 0 },\n { color: 'hsl(213, 40%, 49%)', position: 2 / 10 },\n { color: 'hsl(210, 45%, 69%)', position: 4 / 10 },\n { color: 'hsl(0, 0%, 89%)', position: 5 / 10 },\n { color: 'hsl(360, 100%, 84%)', position: 6 / 10 },\n { color: 'hsl(351, 66%, 59%)', position: 8 / 10 },\n { color: 'hsl(344, 67%, 44%)', position: 1 }\n ],\n 'two-extremes': [\n { color: 'hsl(240, 30%, 39%)', position: 0 },\n { color: 'hsl(271, 27%, 63%)', position: 2 / 10 },\n { color: 'hsl(293, 25%, 87%)', position: 4 / 10 },\n { color: 'hsl(0, 0%, 89%)', position: 5 / 10 },\n { color: 'hsl(171, 37%, 86%)', position: 6 / 10 },\n { color: 'hsl(167, 41%, 51%)', position: 8 / 10 },\n { color: 'hsl(163, 44%, 16%)', position: 1 }\n ]\n};\n\nexport const colorInGradient = ([...gradient]: LinearGradient, targetPosition: number): string => {\n // Return transparent for an empty gradient.\n if (gradient.length === 0) return 'transparent';\n\n // Return the color for single element gradient.\n if (gradient.length === 1) return gradient[0].color;\n\n // Clamp position to interval from 0 to 1.\n targetPosition = Math.min(Math.max(targetPosition, 0), 1);\n\n // Extend the the start of the gradient to 0 if necessary.\n if (gradient[0].position !== 0) gradient.unshift({ color: gradient[0].color, position: 0 });\n\n // Extend the the end of the gradient to 1 if necessary.\n if (gradient[gradient.length - 1].position !== 1)\n gradient.push({ color: gradient[gradient.length - 1].color, position: 1 });\n\n for (let i = 0; i < gradient.length; i += 1) {\n const current = gradient[i];\n\n // If target position is the same as the current position, return the color at the current position.\n if (targetPosition === current.position) return current.color;\n\n // If target position is less than the current position, it must be between the previous position and current position.\n if (targetPosition < current.position) {\n const previous = gradient[i - 1];\n\n // Calculate how far the targetPosition is between the previousPosition and the currentPosition.\n const percentage =\n (targetPosition - previous.position) / (current.position - previous.position);\n\n try {\n return mix(percentage, current.color, previous.color);\n } catch {\n // Polished mix throws on invalid color.\n return 'transparent';\n }\n }\n }\n\n // Failsafe return.\n return 'transparent';\n};\n\nexport const colorInGradientByName = (\n name: keyof typeof gradientMap,\n targetPosition: number\n): string => {\n return colorInGradient(gradientMap[name] ?? [], targetPosition);\n};\n\nexport const colorsForCategories = (\n count: number,\n {\n gradients = (\n [\n 'persian-blue',\n 'persian-green',\n 'pastel-orange',\n 'japanese-laurel',\n 'mango-tango',\n 'valencia',\n 'fuchsia-blue',\n 'faded-red',\n 'rope',\n 'silver'\n ] as const\n ).map(name => gradientMap[name]),\n steps = [2 / 3, 1 / 3, 1, 0, 1 / 2]\n }: { gradients?: LinearGradient[]; steps?: number[] } = {}\n): string[] => {\n // Colors per gradient\n const perGradient = Math.floor(count / gradients.length);\n\n // Number of gradients with 1 extra color\n const extra = count % gradients.length;\n\n const colors: string[] = [];\n\n for (let i = 0; i < gradients.length; i += 1) {\n for (let j = 0; j < (i < extra ? perGradient + 1 : perGradient); j += 1) {\n colors.push(colorInGradient(gradients[i], steps[j % steps.length]));\n }\n }\n\n return colors;\n};\n\nexport const toLinearGradient = (gradient: LinearGradient): string => {\n if (gradient.length === 0) return 'transparent';\n if (gradient.length === 1) return gradient[0].color;\n\n return `linear-gradient(${gradient\n .map(({ color, position }) => `${color} ${position * 100}%`)\n .join(', ')})`;\n};\n"]}
@@ -1,3 +1,4 @@
1
1
  export * from './utils';
2
+ export * from './gradients';
2
3
  export { default as GlobalStyle } from './GlobalStyle';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/styles/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/styles/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export * from './utils';
2
+ export * from './gradients';
2
3
  export { default as GlobalStyle } from './GlobalStyle';
3
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/styles/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC","sourcesContent":["export * from './utils';\nexport { default as GlobalStyle } from './GlobalStyle';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/styles/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC","sourcesContent":["export * from './utils';\nexport * from './gradients';\nexport { default as GlobalStyle } from './GlobalStyle';\n"]}