polpo 0.1.13 → 0.1.16

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 (204) hide show
  1. package/.turbo/cache/eslint/.cache_16wwsjl +1 -0
  2. package/.turbo/cache/eslint/.cache_rpznjo +1 -0
  3. package/.turbo/turbo-build$colon$code.log +49 -0
  4. package/.turbo/turbo-build$colon$css.log +2 -0
  5. package/.turbo/turbo-build.log +43 -0
  6. package/.turbo/turbo-lint.log +2 -0
  7. package/dist/components.cjs +1 -3655
  8. package/dist/components.css +2 -2173
  9. package/dist/components.js +1 -3576
  10. package/dist/helpers.cjs +1 -311
  11. package/dist/helpers.d.cts +4 -1
  12. package/dist/helpers.d.ts +4 -1
  13. package/dist/helpers.js +1 -276
  14. package/dist/hooks.cjs +1 -1065
  15. package/dist/hooks.js +1 -998
  16. package/dist/layouts.cjs +1 -146
  17. package/dist/layouts.css +2 -5
  18. package/dist/layouts.js +1 -119
  19. package/dist/types.cjs +1 -19
  20. package/dist/types.js +0 -1
  21. package/eslint.config.js +4 -0
  22. package/package.json +16 -11
  23. package/postcss.config.js +3 -0
  24. package/src/components/accordion/accordion-item.tsx +123 -0
  25. package/src/components/accordion/accordion.component.tsx +80 -0
  26. package/src/components/accordion/accordion.styles.css +41 -0
  27. package/src/components/accordion/index.ts +2 -0
  28. package/src/components/button/button.component.tsx +50 -0
  29. package/src/components/button/button.styles.css +317 -0
  30. package/src/components/button/index.ts +1 -0
  31. package/src/components/cards/flip-card/flip-card.component.tsx +66 -0
  32. package/src/components/cards/flip-card/flip-card.styles.css +50 -0
  33. package/src/components/cards/flip-card/index.ts +1 -0
  34. package/src/components/cards/hover-card/hover-card.component.tsx +76 -0
  35. package/src/components/cards/hover-card/hover-card.styles.css +13 -0
  36. package/src/components/cards/hover-card/index.ts +1 -0
  37. package/src/components/cards/index.ts +3 -0
  38. package/src/components/cards/slide-card/index.ts +1 -0
  39. package/src/components/cards/slide-card/slide-card.component.tsx +27 -0
  40. package/src/components/component.types.ts +31 -0
  41. package/src/components/cursor/cursor.component.tsx +49 -0
  42. package/src/components/cursor/cursor.styles.css +73 -0
  43. package/src/components/cursor/index.ts +1 -0
  44. package/src/components/form/checkbox/checkbox.component.tsx +95 -0
  45. package/src/components/form/checkbox/checkbox.styles.css +162 -0
  46. package/src/components/form/checkbox/index.ts +1 -0
  47. package/src/components/form/controller/controller.component.tsx +42 -0
  48. package/src/components/form/controller/index.ts +1 -0
  49. package/src/components/form/date-picker/date-picker.component.tsx +66 -0
  50. package/src/components/form/date-picker/index.ts +1 -0
  51. package/src/components/form/field/field.component.tsx +84 -0
  52. package/src/components/form/field/field.styles.css +98 -0
  53. package/src/components/form/field/field.types.ts +34 -0
  54. package/src/components/form/field/index.ts +2 -0
  55. package/src/components/form/form.types.ts +37 -0
  56. package/src/components/form/index.ts +14 -0
  57. package/src/components/form/input/index.ts +1 -0
  58. package/src/components/form/input/input.component.tsx +75 -0
  59. package/src/components/form/input-color/index.ts +1 -0
  60. package/src/components/form/input-color/input-color.component.tsx +170 -0
  61. package/src/components/form/input-color/input-color.styles.css +92 -0
  62. package/src/components/form/input-file/index.ts +1 -0
  63. package/src/components/form/input-file/input-file.component.tsx +221 -0
  64. package/src/components/form/input-file/input-file.styles.css +143 -0
  65. package/src/components/form/input-number/index.ts +1 -0
  66. package/src/components/form/input-number/input-number.component.tsx +144 -0
  67. package/src/components/form/input-password/index.ts +1 -0
  68. package/src/components/form/input-password/input-password.component.tsx +77 -0
  69. package/src/components/form/radio/index.ts +1 -0
  70. package/src/components/form/radio/radio.component.tsx +92 -0
  71. package/src/components/form/radio/radio.styles.css +117 -0
  72. package/src/components/form/select/index.ts +1 -0
  73. package/src/components/form/select/option.tsx +101 -0
  74. package/src/components/form/select/options.tsx +165 -0
  75. package/src/components/form/select/select.component.tsx +317 -0
  76. package/src/components/form/select/select.styles.css +115 -0
  77. package/src/components/form/select/select.types.ts +97 -0
  78. package/src/components/form/slider/index.ts +1 -0
  79. package/src/components/form/slider/slider.component.tsx +117 -0
  80. package/src/components/form/slider/slider.styles.css +94 -0
  81. package/src/components/form/switch/index.ts +1 -0
  82. package/src/components/form/switch/switch.component.tsx +166 -0
  83. package/src/components/form/switch/switch.styles.css +165 -0
  84. package/src/components/form/textarea/index.ts +1 -0
  85. package/src/components/form/textarea/textarea.component.tsx +80 -0
  86. package/src/components/form/textarea/textarea.styles.css +7 -0
  87. package/src/components/image/image.tsx +7 -0
  88. package/src/components/image/index.ts +1 -0
  89. package/src/components/index.ts +15 -0
  90. package/src/components/infinity-scroll/index.ts +1 -0
  91. package/src/components/infinity-scroll/infinity-scroll.component.tsx +51 -0
  92. package/src/components/infinity-scroll/infinity-scroll.styles.css +25 -0
  93. package/src/components/line/index.ts +1 -0
  94. package/src/components/line/line.component.tsx +77 -0
  95. package/src/components/line/line.styles.css +61 -0
  96. package/src/components/modals/action-modal/action-modal.component.tsx +150 -0
  97. package/src/components/modals/action-modal/action-modal.styles.css +115 -0
  98. package/src/components/modals/action-modal/index.ts +1 -0
  99. package/src/components/modals/aside-modal/aside-modal.component.tsx +63 -0
  100. package/src/components/modals/aside-modal/aside-modal.styles.css +86 -0
  101. package/src/components/modals/aside-modal/index.ts +1 -0
  102. package/src/components/modals/confirmation-modal/confirmation-modal.component.tsx +43 -0
  103. package/src/components/modals/confirmation-modal/confirmation-modal.styles.css +17 -0
  104. package/src/components/modals/confirmation-modal/index.ts +1 -0
  105. package/src/components/modals/index.ts +6 -0
  106. package/src/components/modals/menu/index.ts +1 -0
  107. package/src/components/modals/menu/menu.component.tsx +194 -0
  108. package/src/components/modals/menu/menu.styles.css +101 -0
  109. package/src/components/modals/modal/index.ts +2 -0
  110. package/src/components/modals/modal/modal.backdrop.tsx +67 -0
  111. package/src/components/modals/modal/modal.component.tsx +104 -0
  112. package/src/components/modals/modal/modal.styles.css +70 -0
  113. package/src/components/modals/portal/index.ts +1 -0
  114. package/src/components/modals/portal/portal.component.tsx +19 -0
  115. package/src/components/ripple/index.ts +1 -0
  116. package/src/components/ripple/ripple.component.tsx +70 -0
  117. package/src/components/ripple/ripple.styles.css +33 -0
  118. package/src/components/smart-table/index.ts +2 -0
  119. package/src/components/smart-table/smart-table.column.tsx +62 -0
  120. package/src/components/smart-table/smart-table.component.tsx +116 -0
  121. package/src/components/smart-table/smart-table.helpers.tsx +58 -0
  122. package/src/components/smart-table/smart-table.hooks.ts +27 -0
  123. package/src/components/smart-table/smart-table.row.tsx +28 -0
  124. package/src/components/smart-table/smart-table.styles.css +102 -0
  125. package/src/components/smart-table/smart-table.types.ts +42 -0
  126. package/src/components/tabs/index.ts +1 -0
  127. package/src/components/tabs/tabs-list.tsx +120 -0
  128. package/src/components/tabs/tabs.styles.css +164 -0
  129. package/src/components/tabs/tabs.tsx +119 -0
  130. package/src/components/tag/index.ts +1 -0
  131. package/src/components/tag/tag.component.tsx +34 -0
  132. package/src/components/tag/tag.styles.css +50 -0
  133. package/src/components/tooltips/click-to-copy/click-to-copy.component.tsx +41 -0
  134. package/src/components/tooltips/click-to-copy/index.ts +1 -0
  135. package/src/components/tooltips/index.ts +2 -0
  136. package/src/components/tooltips/tooltip/index.ts +1 -0
  137. package/src/components/tooltips/tooltip/tooltip.component.tsx +64 -0
  138. package/src/components/tooltips/tooltip/tooltip.styles.css +91 -0
  139. package/src/components/typography/index.ts +1 -0
  140. package/src/components/typography/typography.component.tsx +81 -0
  141. package/src/components/typography/typography.constants.ts +53 -0
  142. package/src/components/typography/typography.styles.css +122 -0
  143. package/src/helpers/cn.ts +6 -0
  144. package/src/helpers/format-bytes.ts +11 -0
  145. package/src/helpers/format-dates.ts +47 -0
  146. package/src/helpers/get-modal-position-relative-to-screen.ts +86 -0
  147. package/src/helpers/get-modal-position.ts +211 -0
  148. package/src/helpers/index.ts +6 -0
  149. package/src/helpers/text/index.ts +1 -0
  150. package/src/helpers/text/to-capitalize.ts +17 -0
  151. package/src/hooks/index.ts +30 -0
  152. package/src/hooks/use-async.ts +88 -0
  153. package/src/hooks/use-classnames.ts +13 -0
  154. package/src/hooks/use-click-outside.ts +32 -0
  155. package/src/hooks/use-constant.ts +3 -0
  156. package/src/hooks/use-cookie.ts +124 -0
  157. package/src/hooks/use-debounce-state.ts +13 -0
  158. package/src/hooks/use-debounce.ts +15 -0
  159. package/src/hooks/use-dimensions.ts +19 -0
  160. package/src/hooks/use-dom-container.ts +35 -0
  161. package/src/hooks/use-event-listener.ts +71 -0
  162. package/src/hooks/use-file-reader.ts +69 -0
  163. package/src/hooks/use-geolocation.ts +63 -0
  164. package/src/hooks/use-hover.ts +17 -0
  165. package/src/hooks/use-in-view.ts +18 -0
  166. package/src/hooks/use-input-handlers.ts +52 -0
  167. package/src/hooks/use-intersection-observer.ts +19 -0
  168. package/src/hooks/use-media-query.ts +25 -0
  169. package/src/hooks/use-modal-in-container.ts +85 -0
  170. package/src/hooks/use-modal-transition.ts +64 -0
  171. package/src/hooks/use-modal.ts +21 -0
  172. package/src/hooks/use-mouse-position.ts +64 -0
  173. package/src/hooks/use-online-status.ts +12 -0
  174. package/src/hooks/use-render-count.ts +11 -0
  175. package/src/hooks/use-resize-observer.ts +18 -0
  176. package/src/hooks/use-safe-dispatch.ts +22 -0
  177. package/src/hooks/use-scroll.ts +31 -0
  178. package/src/hooks/use-state-history.ts +22 -0
  179. package/src/hooks/use-toggle-values.ts +14 -0
  180. package/src/hooks/use-toggle.ts +11 -0
  181. package/src/hooks/use-viewport.ts +38 -0
  182. package/src/index.ts +5 -0
  183. package/src/layouts/flex/flex.component.tsx +75 -0
  184. package/src/layouts/flex/index.ts +1 -0
  185. package/src/layouts/grid/grid.component.tsx +89 -0
  186. package/src/layouts/grid/grid.styles.css +5 -0
  187. package/src/layouts/grid/index.ts +1 -0
  188. package/src/layouts/index.ts +2 -0
  189. package/src/types/generics.ts +68 -0
  190. package/src/types/index.ts +1 -0
  191. package/tsconfig.json +10 -0
  192. package/tsup.config.cjs +36 -0
  193. package/dist/components.cjs.map +0 -1
  194. package/dist/components.css.map +0 -1
  195. package/dist/components.js.map +0 -1
  196. package/dist/helpers.cjs.map +0 -1
  197. package/dist/helpers.js.map +0 -1
  198. package/dist/hooks.cjs.map +0 -1
  199. package/dist/hooks.js.map +0 -1
  200. package/dist/layouts.cjs.map +0 -1
  201. package/dist/layouts.css.map +0 -1
  202. package/dist/layouts.js.map +0 -1
  203. package/dist/types.cjs.map +0 -1
  204. package/dist/types.js.map +0 -1
@@ -0,0 +1,317 @@
1
+ @reference "polpo-tailwind-config/styles";
2
+
3
+ @layer components {
4
+ .button {
5
+ --button-blur: 2px;
6
+
7
+ --color: var(--color-gray-800);
8
+ --solid-background: var(--color-gray-900);
9
+ --solid-text: var(--color-gray-50);
10
+ --solid-hover-background: var(--color-gray-800);
11
+ --solid-active-background: var(--color-gray-900);
12
+ --flat-background: hsl(from var(--color-gray-100) h s l / 80%);
13
+ --flat-hover-background: var(--color-gray-50);
14
+ --flat-active-background: var(--color-gray-100);
15
+ --outlined-hover-background: hsl(from var(--color-gray-100) h s l / 20%);
16
+ --outlined-active-background: hsl(from var(--color-gray-100) h s l / 50%);
17
+ --text-hover-background: hsl(from var(--color-gray-100) h s l / 20%);
18
+ --text-active-background: hsl(from var(--color-gray-100) h s l / 50%);
19
+ --shadow-color: hsl(from var(--color-gray-800) h s l / 20%);
20
+ --focus-background: hsl(from var(--color-gray-100) h s l / 20%);
21
+
22
+ display: flex;
23
+ flex-direction: row;
24
+ justify-content: center;
25
+ align-items: center;
26
+ padding: 0.625em 2.1875em;
27
+ gap: 0.625em;
28
+ width: auto;
29
+ border-radius: 0.5em;
30
+ font-weight: bold;
31
+ @apply text-label;
32
+ cursor: pointer;
33
+ outline: none;
34
+ transition: all 150ms ease;
35
+ user-select: none;
36
+
37
+ &.icon {
38
+ padding: 0.625em;
39
+ }
40
+
41
+ &.full {
42
+ width: 100%;
43
+ }
44
+
45
+ &.no-wrap {
46
+ white-space: nowrap;
47
+ overflow: hidden;
48
+ text-overflow: ellipsis;
49
+ }
50
+
51
+ &.size-small {
52
+ @apply text-small;
53
+ }
54
+
55
+ &.size-regular {
56
+ @apply text-label;
57
+ }
58
+
59
+ &.size-large {
60
+ @apply text-body;
61
+ }
62
+
63
+ &.radius-none {
64
+ border-radius: 0;
65
+ }
66
+
67
+ &.radius-small {
68
+ border-radius: 0.25em;
69
+ }
70
+
71
+ &.radius-medium {
72
+ border-radius: 0.5em;
73
+ }
74
+
75
+ &.radius-large {
76
+ border-radius: 1em;
77
+ }
78
+
79
+ &.radius-full {
80
+ border-radius: 100rem;
81
+ }
82
+
83
+ &:not(:disabled) {
84
+ &:hover,
85
+ &:active,
86
+ &:focus-visible {
87
+ backdrop-filter: blur(var(--button-blur));
88
+ }
89
+
90
+ &:hover {
91
+ transform: scale(1.01);
92
+ box-shadow: 0 1.4em 0.5em -1em hsl(from var(--color-black) h s l / 20%),
93
+ 0 0.7em 1em -0.5em hsl(from var(--color-black) h s l / 20%);
94
+ }
95
+
96
+ &:active {
97
+ transform: scale(0.98);
98
+ box-shadow: 0 0.3em 0.4em -0.2em hsl(from var(--color-black) h s l / 20%),
99
+ 0 0.2em 0.8em -0.1em hsl(from var(--color-black) h s l / 20%);
100
+ }
101
+ }
102
+
103
+ /*----------------------------------------------------------------------------------------------*/
104
+
105
+ color: var(--color);
106
+
107
+ .ripple-effect {
108
+ background: var(--color);
109
+ }
110
+
111
+ &.solid {
112
+ background: var(--solid-background);
113
+ color: var(--solid-text);
114
+ backdrop-filter: blur(var(--button-blur));
115
+
116
+ .ripple-effect {
117
+ background: var(--solid-text);
118
+ }
119
+
120
+ &:focus-visible {
121
+ box-shadow: 0 0 0 0.3125em var(--shadow-color);
122
+ background: var(--solid-background);
123
+ }
124
+
125
+ &:hover {
126
+ background: var(--solid-hover-background);
127
+ }
128
+
129
+ &:active {
130
+ background: var(--solid-active-background);
131
+ }
132
+ }
133
+
134
+ &.flat {
135
+ background: var(--flat-background);
136
+ backdrop-filter: blur(var(--button-blur));
137
+
138
+ &:hover {
139
+ background: var(--flat-hover-background);
140
+ }
141
+
142
+ &:active {
143
+ background: var(--flat-active-background);
144
+ }
145
+ }
146
+
147
+ &.outlined {
148
+ background: transparent;
149
+ border: 1px solid;
150
+
151
+ &:hover {
152
+ background: var(--outlined-hover-background);
153
+ }
154
+
155
+ &:active {
156
+ background: var(--outlined-active-background);
157
+ }
158
+ }
159
+
160
+ &.text {
161
+ background: transparent;
162
+
163
+ &:hover {
164
+ background: var(--text-hover-background);
165
+ }
166
+
167
+ &:active {
168
+ background: var(--text-active-background);
169
+ }
170
+ }
171
+
172
+ &:focus-visible {
173
+ box-shadow: 0 0 0 0.3125em var(--shadow-color);
174
+ background: var(--focus-background);
175
+ }
176
+
177
+ /*----------------------------------------------------------------------------------------------*/
178
+
179
+ &.primary {
180
+ --color: var(--color-primary-500);
181
+ --solid-background: var(--color-primary-500);
182
+ --solid-text: var(--color-primary-50);
183
+ --solid-hover-background: var(--color-primary-400);
184
+ --solid-active-background: var(--color-primary-600);
185
+ --flat-background: hsl(from var(--color-primary-100) h s l / 80%);
186
+ --flat-hover-background: var(--color-primary-50);
187
+ --flat-active-background: var(--color-primary-100);
188
+ --outlined-hover-background: hsl(from var(--color-primary-100) h s l / 20%);
189
+ --outlined-active-background: hsl(from var(--color-primary-100) h s l / 50%);
190
+ --text-hover-background: hsl(from var(--color-primary-100) h s l / 20%);
191
+ --text-active-background: hsl(from var(--color-primary-100) h s l / 50%);
192
+ --shadow-color: hsl(from var(--color-primary-500) h s l / 20%);
193
+ --focus-background: hsl(from var(--color-primary-100) h s l / 20%);
194
+ }
195
+
196
+ &.secondary {
197
+ --color: var(--color-secondary-500);
198
+ --solid-background: var(--color-secondary-500);
199
+ --solid-text: var(--color-secondary-50);
200
+ --solid-hover-background: var(--color-secondary-400);
201
+ --solid-active-background: var(--color-secondary-600);
202
+ --flat-background: hsl(from var(--color-secondary-100) h s l / 80%);
203
+ --flat-hover-background: var(--color-secondary-50);
204
+ --flat-active-background: var(--color-secondary-100);
205
+ --outlined-hover-background: hsl(from var(--color-secondary-100) h s l / 20%);
206
+ --outlined-active-background: hsl(from var(--color-secondary-100) h s l / 50%);
207
+ --text-hover-background: hsl(from var(--color-secondary-100) h s l / 20%);
208
+ --text-active-background: hsl(from var(--color-secondary-100) h s l / 50%);
209
+ --shadow-color: hsl(from var(--color-secondary-500) h s l / 20%);
210
+ --focus-background: hsl(from var(--color-secondary-100) h s l / 20%);
211
+ }
212
+
213
+ &.tertiary {
214
+ --color: var(--color-tertiary-500);
215
+ --solid-background: var(--color-tertiary-500);
216
+ --solid-text: var(--color-tertiary-50);
217
+ --solid-hover-background: var(--color-tertiary-400);
218
+ --solid-active-background: var(--color-tertiary-600);
219
+ --flat-background: hsl(from var(--color-tertiary-100) h s l / 80%);
220
+ --flat-hover-background: var(--color-tertiary-50);
221
+ --flat-active-background: var(--color-tertiary-100);
222
+ --outlined-hover-background: hsl(from var(--color-tertiary-100) h s l / 20%);
223
+ --outlined-active-background: hsl(from var(--color-tertiary-100) h s l / 50%);
224
+ --text-hover-background: hsl(from var(--color-tertiary-100) h s l / 20%);
225
+ --text-active-background: hsl(from var(--color-tertiary-100) h s l / 50%);
226
+ --shadow-color: hsl(from var(--color-tertiary-500) h s l / 20%);
227
+ --focus-background: hsl(from var(--color-tertiary-100) h s l / 20%);
228
+ }
229
+
230
+ &.active {
231
+ --color: var(--color-active-500);
232
+ --solid-background: var(--color-active-500);
233
+ --solid-text: var(--color-active-50);
234
+ --solid-hover-background: var(--color-active-400);
235
+ --solid-active-background: var(--color-active-600);
236
+ --flat-background: hsl(from var(--color-active-100) h s l / 80%);
237
+ --flat-hover-background: var(--color-active-50);
238
+ --flat-active-background: var(--color-active-100);
239
+ --outlined-hover-background: hsl(from var(--color-active-100) h s l / 20%);
240
+ --outlined-active-background: hsl(from var(--color-active-100) h s l / 50%);
241
+ --text-hover-background: hsl(from var(--color-active-100) h s l / 20%);
242
+ --text-active-background: hsl(from var(--color-active-100) h s l / 50%);
243
+ --shadow-color: hsl(from var(--color-active-500) h s l / 20%);
244
+ --focus-background: hsl(from var(--color-active-100) h s l / 20%);
245
+ }
246
+
247
+ &.warning {
248
+ --color: var(--color-warning-500);
249
+ --solid-background: var(--color-warning-500);
250
+ --solid-text: var(--color-warning-50);
251
+ --solid-hover-background: var(--color-warning-400);
252
+ --solid-active-background: var(--color-warning-600);
253
+ --flat-background: hsl(from var(--color-warning-100) h s l / 80%);
254
+ --flat-hover-background: var(--color-warning-50);
255
+ --flat-active-background: var(--color-warning-100);
256
+ --outlined-hover-background: hsl(from var(--color-warning-100) h s l / 20%);
257
+ --outlined-active-background: hsl(from var(--color-warning-100) h s l / 50%);
258
+ --text-hover-background: hsl(from var(--color-warning-100) h s l / 20%);
259
+ --text-active-background: hsl(from var(--color-warning-100) h s l / 50%);
260
+ --shadow-color: hsl(from var(--color-warning-500) h s l / 20%);
261
+ --focus-background: hsl(from var(--color-warning-100) h s l / 20%);
262
+ }
263
+
264
+ &.alert {
265
+ --color: var(--color-alert-500);
266
+ --solid-background: var(--color-alert-500);
267
+ --solid-text: var(--color-alert-50);
268
+ --solid-hover-background: var(--color-alert-400);
269
+ --solid-active-background: var(--color-alert-600);
270
+ --flat-background: hsl(from var(--color-alert-100) h s l / 80%);
271
+ --flat-hover-background: var(--color-alert-50);
272
+ --flat-active-background: var(--color-alert-100);
273
+ --outlined-hover-background: hsl(from var(--color-alert-100) h s l / 20%);
274
+ --outlined-active-background: hsl(from var(--color-alert-100) h s l / 50%);
275
+ --text-hover-background: hsl(from var(--color-alert-100) h s l / 20%);
276
+ --text-active-background: hsl(from var(--color-alert-100) h s l / 50%);
277
+ --shadow-color: hsl(from var(--color-alert-500) h s l / 20%);
278
+ --focus-background: hsl(from var(--color-alert-100) h s l / 20%);
279
+ }
280
+
281
+ &.info {
282
+ --color: var(--color-info-500);
283
+ --solid-background: var(--color-info-500);
284
+ --solid-text: var(--color-info-50);
285
+ --solid-hover-background: var(--color-info-400);
286
+ --solid-active-background: var(--color-info-600);
287
+ --flat-background: hsl(from var(--color-info-100) h s l / 80%);
288
+ --flat-hover-background: var(--color-info-50);
289
+ --flat-active-background: var(--color-info-100);
290
+ --outlined-hover-background: hsl(from var(--color-info-100) h s l / 20%);
291
+ --outlined-active-background: hsl(from var(--color-info-100) h s l / 50%);
292
+ --text-hover-background: hsl(from var(--color-info-100) h s l / 20%);
293
+ --text-active-background: hsl(from var(--color-info-100) h s l / 50%);
294
+ --shadow-color: hsl(from var(--color-info-500) h s l / 20%);
295
+ --focus-background: hsl(from var(--color-info-100) h s l / 20%);
296
+ }
297
+
298
+ &:disabled {
299
+ color: var(--color-gray-200);
300
+ pointer-events: none;
301
+ }
302
+
303
+ &.solid:disabled {
304
+ background: var(--color-gray-200);
305
+ color: var(--color-gray-50);
306
+ }
307
+
308
+ &.flat:disabled {
309
+ background: hsl(from var(--color-gray-50) h s l / 80%);
310
+ }
311
+
312
+ &.outlined:disabled,
313
+ &.text:disabled {
314
+ background: transparent;
315
+ }
316
+ }
317
+ }
@@ -0,0 +1 @@
1
+ export * from './button.component';
@@ -0,0 +1,66 @@
1
+ import { CSSProperties, useMemo } from 'react';
2
+
3
+ import { useClassNames } from '../../../hooks';
4
+
5
+ import './flip-card.styles.css';
6
+
7
+ type FlipCardProps = {
8
+ cardZIndex?: CSSProperties['zIndex'];
9
+ isFlipped?: boolean;
10
+ flipSpeed?: number;
11
+ flipDirection?: 'horizontal' | 'vertical';
12
+ children: [React.ReactNode, React.ReactNode];
13
+ };
14
+
15
+ export const FlipCard = ({
16
+ cardZIndex = 'auto',
17
+ flipDirection = 'vertical',
18
+ flipSpeed = 500,
19
+ isFlipped = false,
20
+ children,
21
+ }: FlipCardProps) => {
22
+ const getComponent = (key: 0 | 1): React.ReactNode => {
23
+ if (children.length !== 2) {
24
+ throw new Error('Component FlipCard requires 2 children');
25
+ }
26
+
27
+ return children[key] as React.ReactNode;
28
+ };
29
+
30
+ const frontRotate = useMemo(() => {
31
+ const deg = isFlipped ? 180 : 0;
32
+
33
+ return `rotate${flipDirection === 'horizontal' ? 'Y' : 'X'}(${deg}deg)`;
34
+ }, [flipDirection, isFlipped]);
35
+
36
+ const backRotate = useMemo(() => {
37
+ const deg = isFlipped ? 0 : -180;
38
+
39
+ return `rotate${flipDirection === 'horizontal' ? 'Y' : 'X'}(${deg}deg)`;
40
+ }, [flipDirection, isFlipped]);
41
+
42
+ const className = useClassNames({
43
+ 'flip-card': true,
44
+ 'is-flipped': isFlipped,
45
+ });
46
+
47
+ return (
48
+ <section
49
+ className={className}
50
+ style={
51
+ {
52
+ '--cardZIndex': cardZIndex,
53
+ '--flipSpeed': `${flipSpeed}ms`,
54
+ '--frontRotate': frontRotate,
55
+ '--backRotate': backRotate,
56
+ } as React.CSSProperties
57
+ }
58
+ >
59
+ <section className='flipper'>
60
+ <section className='front'>{getComponent(0)}</section>
61
+
62
+ <section className='back'>{getComponent(1)}</section>
63
+ </section>
64
+ </section>
65
+ );
66
+ };
@@ -0,0 +1,50 @@
1
+ @reference "polpo-tailwind-config/styles";
2
+
3
+ .flip-card {
4
+ --cardZIndex: attr(data-zIndex);
5
+ --flipSpeed: attr(data-flipSpeed, 500ms);
6
+ --frontRotate: attr(data-frontRotate);
7
+ --backRotate: attr(data-backRotate);
8
+
9
+ perspective: 1000px;
10
+ z-index: var(--cardZIndex);
11
+
12
+ .flipper {
13
+ height: 100%;
14
+ position: relative;
15
+ width: 100%;
16
+ transform-style: preserve-3d;
17
+ }
18
+
19
+ .front,
20
+ .back {
21
+ -webkit-backface-visibility: hidden;
22
+ backface-visibility: hidden;
23
+ transform-style: preserve-3d;
24
+ transition: var(--flipSpeed);
25
+ height: 100%;
26
+ left: 0;
27
+ top: 0;
28
+ width: 100%;
29
+ }
30
+
31
+ .front {
32
+ position: relative;
33
+ transform: var(--frontRotate);
34
+ z-index: 2;
35
+ }
36
+
37
+ .back {
38
+ position: absolute;
39
+ transform: var(--backRotate);
40
+ }
41
+
42
+ .is-flipped {
43
+ .front {
44
+ position: absolute;
45
+ }
46
+ .back {
47
+ position: relative;
48
+ }
49
+ }
50
+ }
@@ -0,0 +1 @@
1
+ export * from './flip-card.component';
@@ -0,0 +1,76 @@
1
+ import { MouseEvent, MouseEventHandler, useCallback, useRef } from 'react';
2
+
3
+ import { useClassNames, useEventListener } from '../../../hooks';
4
+
5
+ import './hover-card.styles.css';
6
+
7
+ type HoverCardProps = {
8
+ children: React.ReactNode;
9
+ threshold?: number;
10
+ translationZ?: number;
11
+ width?: 'fit-content' | '100%';
12
+ className?: string;
13
+ };
14
+
15
+ export const HoverCard = ({
16
+ children,
17
+ threshold = 5,
18
+ translationZ = 25,
19
+ width = 'fit-content',
20
+ className = '',
21
+ }: HoverCardProps) => {
22
+ const refCard = useRef<HTMLElement>(null);
23
+ const refLayer = useRef<HTMLElement>(null);
24
+
25
+ const mouseMoveCallback = useCallback(
26
+ (e: MouseEvent) => {
27
+ const card = refCard.current;
28
+ const layer = refLayer.current;
29
+
30
+ if (!card || !layer) return;
31
+
32
+ const { clientX, clientY, currentTarget } = e;
33
+ const { clientWidth, clientHeight } = currentTarget;
34
+ const { top, left } = card.getBoundingClientRect();
35
+
36
+ const horizontal = (clientX - left) / clientWidth;
37
+ const vertical = (clientY - top) / clientHeight;
38
+
39
+ const relativePercentageX = horizontal * 2 - 1;
40
+ const relativePercentageY = vertical * 2 - 1;
41
+
42
+ const rotateY = (relativePercentageY * threshold).toFixed(2);
43
+ const rotateX = (relativePercentageX * threshold).toFixed(2);
44
+
45
+ layer.style.transform = `perspective(${clientWidth}px) rotateX(${-rotateY}deg) rotateY(${rotateX}deg)`;
46
+ card.style.transform = `perspective(${clientWidth}px) translateZ(${translationZ}px)`;
47
+ },
48
+ [threshold, translationZ],
49
+ );
50
+
51
+ const mouseLeaveCallback = useCallback<MouseEventHandler>(e => {
52
+ const card = refCard.current;
53
+ const layer = refLayer.current;
54
+
55
+ if (!card || !layer) return;
56
+
57
+ layer.style.transform = `perspective(${e.currentTarget.clientWidth}px) rotateX(0) rotateY(0)`;
58
+ card.style.transform = `perspective(${e.currentTarget.clientWidth}px) translateZ(0)`;
59
+ }, []);
60
+
61
+ useEventListener('mousemove', mouseMoveCallback as unknown as EventListener, refCard);
62
+ useEventListener('mouseleave', mouseLeaveCallback as unknown as EventListener, refCard);
63
+
64
+ const cardClassName = useClassNames({
65
+ 'hover-card': true,
66
+ [className]: Boolean(className),
67
+ });
68
+
69
+ return (
70
+ <span ref={refCard} style={{ width }} className={cardClassName}>
71
+ <span className='card-hover-layer' ref={refLayer}>
72
+ {children}
73
+ </span>
74
+ </span>
75
+ );
76
+ };
@@ -0,0 +1,13 @@
1
+ @reference "polpo-tailwind-config/styles";
2
+
3
+ .hover-card {
4
+ display: inline-block;
5
+ transition: all 300ms ease;
6
+
7
+ .card-hover-layer {
8
+ transition: all 100ms ease;
9
+ width: 100%;
10
+ height: 100%;
11
+ display: grid;
12
+ }
13
+ }
@@ -0,0 +1 @@
1
+ export * from './hover-card.component';
@@ -0,0 +1,3 @@
1
+ export * from './slide-card';
2
+ export * from './flip-card';
3
+ export * from './hover-card';
@@ -0,0 +1 @@
1
+ export * from './slide-card.component';
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+
3
+ type SlideCardProps = {
4
+ children: React.ReactNode;
5
+ isOpen: boolean;
6
+ className?: string;
7
+ style?: React.CSSProperties;
8
+ };
9
+
10
+ export const SlideCard = ({ children, isOpen, className = '', style = {} }: SlideCardProps) => {
11
+ return (
12
+ <section
13
+ className={className}
14
+ style={
15
+ {
16
+ overflow: 'hidden',
17
+ height: isOpen ? 'auto' : 0,
18
+ transition: 'height 300ms ease',
19
+ interpolateSize: 'allow-keywords',
20
+ ...style,
21
+ } as React.CSSProperties
22
+ }
23
+ >
24
+ {children}
25
+ </section>
26
+ );
27
+ };
@@ -0,0 +1,31 @@
1
+ export enum ColorTypes {
2
+ DEFAULT = 'default',
3
+ PRIMARY = 'primary',
4
+ SECONDARY = 'secondary',
5
+ TERTIARY = 'tertiary',
6
+ ACTIVE = 'active',
7
+ WARNING = 'warning',
8
+ ALERT = 'alert',
9
+ INFO = 'info',
10
+ }
11
+
12
+ export enum SizeTypes {
13
+ SMALL = 'small',
14
+ REGULAR = 'regular',
15
+ LARGE = 'large',
16
+ }
17
+
18
+ export enum VariantTypes {
19
+ SOLID = 'solid',
20
+ FLAT = 'flat',
21
+ OUTLINED = 'outlined',
22
+ TEXT = 'text',
23
+ }
24
+
25
+ export enum RadiusTypes {
26
+ NONE = 'none',
27
+ SMALL = 'small',
28
+ MEDIUM = 'medium',
29
+ LARGE = 'large',
30
+ FULL = 'full',
31
+ }
@@ -0,0 +1,49 @@
1
+ import { useEffect, useState } from 'react';
2
+
3
+ import { useEventListener, useMousePosition } from '../../hooks';
4
+
5
+ import './cursor.styles.css';
6
+
7
+ export const Cursor = () => {
8
+ const { x, y, elementX, elementY, ref } = useMousePosition();
9
+ const [isCursorHover, setIsCursorHover] = useState(false);
10
+
11
+ useEventListener('mouseover', e => {
12
+ const computedCursor = getComputedStyle(e.target as HTMLElement).cursor;
13
+
14
+ setIsCursorHover(computedCursor === 'pointer');
15
+ });
16
+
17
+ useEffect(() => {
18
+ if (!('ontouchstart' in window || navigator.maxTouchPoints)) {
19
+ document.body.style.cursor = 'none';
20
+ }
21
+
22
+ return () => {
23
+ document.body.style.cursor = 'auto';
24
+ };
25
+ }, []);
26
+
27
+ if (x === null || y === null || 'ontouchstart' in window || navigator.maxTouchPoints) {
28
+ return null;
29
+ }
30
+
31
+ const translate3d = `translate3d(${elementX}px, ${elementY}px, 0)`;
32
+
33
+ return (
34
+ <section className='cursor-overlay' ref={ref}>
35
+ <span
36
+ className={`cursor outer-circle ${isCursorHover ? 'cursor-hover' : ''}`}
37
+ style={{
38
+ transform: translate3d,
39
+ }}
40
+ />
41
+ <span
42
+ className={`cursor inner-circle ${isCursorHover ? 'cursor-hover' : ''}`}
43
+ style={{
44
+ transform: translate3d,
45
+ }}
46
+ />
47
+ </section>
48
+ );
49
+ };