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
package/dist/layouts.cjs CHANGED
@@ -1,147 +1,2 @@
1
1
  "use client";
2
- "use strict";
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
-
21
- // src/layouts/index.ts
22
- var layouts_exports = {};
23
- __export(layouts_exports, {
24
- Flex: () => Flex,
25
- Grid: () => Grid
26
- });
27
- module.exports = __toCommonJS(layouts_exports);
28
-
29
- // src/layouts/flex/flex.component.tsx
30
- var import_react = require("react");
31
- var Flex = ({
32
- tag = "section",
33
- children,
34
- className,
35
- style,
36
- direction,
37
- wrap,
38
- basis,
39
- grow,
40
- shrink,
41
- flow,
42
- pc,
43
- pi,
44
- ps,
45
- jc,
46
- ji,
47
- js,
48
- ac,
49
- ai,
50
- as,
51
- gap
52
- }) => {
53
- return (0, import_react.createElement)(
54
- tag,
55
- {
56
- className,
57
- style: {
58
- ...style,
59
- ...direction ? { flexDirection: direction } : {},
60
- ...wrap ? { flexWrap: wrap } : {},
61
- ...basis ? { flexBasis: basis } : {},
62
- ...grow ? { flexGrow: grow } : {},
63
- ...shrink ? { flexShrink: shrink } : {},
64
- ...flow ? { flexFlow: flow } : {},
65
- ...pc ? { placeContent: pc } : {},
66
- ...pi ? { placeItems: pi } : {},
67
- ...ps ? { placeSelf: ps } : {},
68
- ...jc ? { justifyContent: jc } : {},
69
- ...ji ? { justifyItems: ji } : {},
70
- ...js ? { justifySelf: js } : {},
71
- ...ac ? { alignContent: ac } : {},
72
- ...ai ? { alignItems: ai } : {},
73
- ...as ? { alignSelf: as } : {},
74
- ...gap ? { gap } : {},
75
- display: "flex"
76
- }
77
- },
78
- children
79
- );
80
- };
81
-
82
- // src/layouts/grid/grid.component.tsx
83
- var import_react2 = require("react");
84
- var Grid = ({
85
- tag = "section",
86
- children,
87
- className,
88
- style,
89
- flow,
90
- columnSize,
91
- rowSize,
92
- column,
93
- row,
94
- pc,
95
- pi,
96
- ps,
97
- jc,
98
- ji,
99
- js,
100
- ac,
101
- ai,
102
- as,
103
- gtc,
104
- gtr,
105
- gta,
106
- gt,
107
- gap,
108
- ...props
109
- }) => {
110
- return (0, import_react2.createElement)(
111
- tag,
112
- {
113
- className,
114
- ...props,
115
- style: {
116
- ...style,
117
- ...flow ? { gridAutoFlow: flow } : {},
118
- ...columnSize ? { gridAutoColumns: columnSize } : {},
119
- ...rowSize ? { gridAutoRows: rowSize } : {},
120
- ...column ? { gridColumn: column } : {},
121
- ...row ? { gridRow: row } : {},
122
- ...pc ? { placeContent: pc } : {},
123
- ...pi ? { placeItems: pi } : {},
124
- ...ps ? { placeSelf: ps } : {},
125
- ...jc ? { justifyContent: jc } : {},
126
- ...ji ? { justifyItems: ji } : {},
127
- ...js ? { justifySelf: js } : {},
128
- ...ac ? { alignContent: ac } : {},
129
- ...ai ? { alignItems: ai } : {},
130
- ...as ? { alignSelf: as } : {},
131
- ...gtc ? { gridTemplateColumns: gtc } : {},
132
- ...gtr ? { gridTemplateRows: gtr } : {},
133
- ...gta ? { gridTemplateAreas: gta } : {},
134
- ...gt ? { gridTemplate: gt } : {},
135
- ...gap ? { gap } : {},
136
- display: "grid"
137
- }
138
- },
139
- children
140
- );
141
- };
142
- // Annotate the CommonJS export names for ESM import in node:
143
- 0 && (module.exports = {
144
- Flex,
145
- Grid
146
- });
147
- //# sourceMappingURL=layouts.cjs.map
2
+ "use strict";var y=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var L=Object.prototype.hasOwnProperty;var M=(t,e)=>{for(var i in e)y(t,i,{get:e[i],enumerable:!0})},h=(t,e,i,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of E(e))!L.call(t,r)&&r!==i&&y(t,r,{get:()=>e[r],enumerable:!(a=F(e,r))||a.enumerable});return t};var G=t=>h(y({},"__esModule",{value:!0}),t);var D={};M(D,{Flex:()=>H,Grid:()=>N});module.exports=G(D);var I=require("react"),H=({tag:t="section",children:e,className:i,style:a,direction:r,wrap:s,basis:o,grow:l,shrink:S,flow:p,pc:c,pi:n,ps:C,jc:R,ji:f,js:m,ac:g,ai:P,as:d,gap:u})=>(0,I.createElement)(t,{className:i,style:{...a,...r?{flexDirection:r}:{},...s?{flexWrap:s}:{},...o?{flexBasis:o}:{},...l?{flexGrow:l}:{},...S?{flexShrink:S}:{},...p?{flexFlow:p}:{},...c?{placeContent:c}:{},...n?{placeItems:n}:{},...C?{placeSelf:C}:{},...R?{justifyContent:R}:{},...f?{justifyItems:f}:{},...m?{justifySelf:m}:{},...g?{alignContent:g}:{},...P?{alignItems:P}:{},...d?{alignSelf:d}:{},...u?{gap:u}:{},display:"flex"}},e);var j=require("react");var N=({tag:t="section",children:e,className:i,style:a,flow:r,columnSize:s,rowSize:o,column:l,row:S,pc:p,pi:c,ps:n,jc:C,ji:R,js:f,ac:m,ai:g,as:P,gtc:d,gtr:u,gta:x,gt:T,gap:w,...A})=>(0,j.createElement)(t,{className:i,...A,style:{...a,...r?{gridAutoFlow:r}:{},...s?{gridAutoColumns:s}:{},...o?{gridAutoRows:o}:{},...l?{gridColumn:l}:{},...S?{gridRow:S}:{},...p?{placeContent:p}:{},...c?{placeItems:c}:{},...n?{placeSelf:n}:{},...C?{justifyContent:C}:{},...R?{justifyItems:R}:{},...f?{justifySelf:f}:{},...m?{alignContent:m}:{},...g?{alignItems:g}:{},...P?{alignSelf:P}:{},...d?{gridTemplateColumns:d}:{},...u?{gridTemplateRows:u}:{},...x?{gridTemplateAreas:x}:{},...T?{gridTemplate:T}:{},...w?{gap:w}:{},display:"grid"}},e);0&&(module.exports={Flex,Grid});
package/dist/layouts.css CHANGED
@@ -1,5 +1,2 @@
1
- /* src/layouts/grid/grid.styles.css */
2
- .grida {
3
- display: grid;
4
- }
5
- /*# sourceMappingURL=layouts.css.map */
1
+ .grida{display:grid}
2
+ /*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
package/dist/layouts.js CHANGED
@@ -1,120 +1,2 @@
1
1
  "use client";
2
-
3
- // src/layouts/flex/flex.component.tsx
4
- import { createElement } from "react";
5
- var Flex = ({
6
- tag = "section",
7
- children,
8
- className,
9
- style,
10
- direction,
11
- wrap,
12
- basis,
13
- grow,
14
- shrink,
15
- flow,
16
- pc,
17
- pi,
18
- ps,
19
- jc,
20
- ji,
21
- js,
22
- ac,
23
- ai,
24
- as,
25
- gap
26
- }) => {
27
- return createElement(
28
- tag,
29
- {
30
- className,
31
- style: {
32
- ...style,
33
- ...direction ? { flexDirection: direction } : {},
34
- ...wrap ? { flexWrap: wrap } : {},
35
- ...basis ? { flexBasis: basis } : {},
36
- ...grow ? { flexGrow: grow } : {},
37
- ...shrink ? { flexShrink: shrink } : {},
38
- ...flow ? { flexFlow: flow } : {},
39
- ...pc ? { placeContent: pc } : {},
40
- ...pi ? { placeItems: pi } : {},
41
- ...ps ? { placeSelf: ps } : {},
42
- ...jc ? { justifyContent: jc } : {},
43
- ...ji ? { justifyItems: ji } : {},
44
- ...js ? { justifySelf: js } : {},
45
- ...ac ? { alignContent: ac } : {},
46
- ...ai ? { alignItems: ai } : {},
47
- ...as ? { alignSelf: as } : {},
48
- ...gap ? { gap } : {},
49
- display: "flex"
50
- }
51
- },
52
- children
53
- );
54
- };
55
-
56
- // src/layouts/grid/grid.component.tsx
57
- import { createElement as createElement2 } from "react";
58
- var Grid = ({
59
- tag = "section",
60
- children,
61
- className,
62
- style,
63
- flow,
64
- columnSize,
65
- rowSize,
66
- column,
67
- row,
68
- pc,
69
- pi,
70
- ps,
71
- jc,
72
- ji,
73
- js,
74
- ac,
75
- ai,
76
- as,
77
- gtc,
78
- gtr,
79
- gta,
80
- gt,
81
- gap,
82
- ...props
83
- }) => {
84
- return createElement2(
85
- tag,
86
- {
87
- className,
88
- ...props,
89
- style: {
90
- ...style,
91
- ...flow ? { gridAutoFlow: flow } : {},
92
- ...columnSize ? { gridAutoColumns: columnSize } : {},
93
- ...rowSize ? { gridAutoRows: rowSize } : {},
94
- ...column ? { gridColumn: column } : {},
95
- ...row ? { gridRow: row } : {},
96
- ...pc ? { placeContent: pc } : {},
97
- ...pi ? { placeItems: pi } : {},
98
- ...ps ? { placeSelf: ps } : {},
99
- ...jc ? { justifyContent: jc } : {},
100
- ...ji ? { justifyItems: ji } : {},
101
- ...js ? { justifySelf: js } : {},
102
- ...ac ? { alignContent: ac } : {},
103
- ...ai ? { alignItems: ai } : {},
104
- ...as ? { alignSelf: as } : {},
105
- ...gtc ? { gridTemplateColumns: gtc } : {},
106
- ...gtr ? { gridTemplateRows: gtr } : {},
107
- ...gta ? { gridTemplateAreas: gta } : {},
108
- ...gt ? { gridTemplate: gt } : {},
109
- ...gap ? { gap } : {},
110
- display: "grid"
111
- }
112
- },
113
- children
114
- );
115
- };
116
- export {
117
- Flex,
118
- Grid
119
- };
120
- //# sourceMappingURL=layouts.js.map
2
+ import{createElement as I}from"react";var E=({tag:g="section",children:P,className:d,style:u,direction:e,wrap:t,basis:r,grow:i,shrink:a,flow:s,pc:o,pi:l,ps:S,jc:p,ji:c,js:n,ac:C,ai:R,as:f,gap:m})=>I(g,{className:d,style:{...u,...e?{flexDirection:e}:{},...t?{flexWrap:t}:{},...r?{flexBasis:r}:{},...i?{flexGrow:i}:{},...a?{flexShrink:a}:{},...s?{flexFlow:s}:{},...o?{placeContent:o}:{},...l?{placeItems:l}:{},...S?{placeSelf:S}:{},...p?{justifyContent:p}:{},...c?{justifyItems:c}:{},...n?{justifySelf:n}:{},...C?{alignContent:C}:{},...R?{alignItems:R}:{},...f?{alignSelf:f}:{},...m?{gap:m}:{},display:"flex"}},P);import{createElement as j}from"react";var v=({tag:g="section",children:P,className:d,style:u,flow:e,columnSize:t,rowSize:r,column:i,row:a,pc:s,pi:o,ps:l,jc:S,ji:p,js:c,ac:n,ai:C,as:R,gtc:f,gtr:m,gta:y,gt:x,gap:T,...w})=>j(g,{className:d,...w,style:{...u,...e?{gridAutoFlow:e}:{},...t?{gridAutoColumns:t}:{},...r?{gridAutoRows:r}:{},...i?{gridColumn:i}:{},...a?{gridRow:a}:{},...s?{placeContent:s}:{},...o?{placeItems:o}:{},...l?{placeSelf:l}:{},...S?{justifyContent:S}:{},...p?{justifyItems:p}:{},...c?{justifySelf:c}:{},...n?{alignContent:n}:{},...C?{alignItems:C}:{},...R?{alignSelf:R}:{},...f?{gridTemplateColumns:f}:{},...m?{gridTemplateRows:m}:{},...y?{gridTemplateAreas:y}:{},...x?{gridTemplate:x}:{},...T?{gap:T}:{},display:"grid"}},P);export{E as Flex,v as Grid};
package/dist/types.cjs CHANGED
@@ -1,20 +1,2 @@
1
1
  "use client";
2
- "use strict";
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __copyProps = (to, from, except, desc) => {
8
- if (from && typeof from === "object" || typeof from === "function") {
9
- for (let key of __getOwnPropNames(from))
10
- if (!__hasOwnProp.call(to, key) && key !== except)
11
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
- }
13
- return to;
14
- };
15
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
-
17
- // src/types/index.ts
18
- var types_exports = {};
19
- module.exports = __toCommonJS(types_exports);
20
- //# sourceMappingURL=types.cjs.map
2
+ "use strict";var m=Object.defineProperty;var t=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var b=(r,o,p,f)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of x(o))!a.call(r,e)&&e!==p&&m(r,e,{get:()=>o[e],enumerable:!(f=t(o,e))||f.enumerable});return r};var c=r=>b(m({},"__esModule",{value:!0}),r);var d={};module.exports=c(d);
package/dist/types.js CHANGED
@@ -1,2 +1 @@
1
1
  "use client";
2
- //# sourceMappingURL=types.js.map
@@ -0,0 +1,4 @@
1
+ import EslintConfig from 'polpo-eslint-config/react';
2
+ import { defineConfig } from 'eslint/config';
3
+
4
+ export default defineConfig([...EslintConfig]);
package/package.json CHANGED
@@ -1,17 +1,21 @@
1
1
  {
2
2
  "name": "polpo",
3
- "version": "0.1.13",
4
- "sideEffects": [
5
- "*.css"
6
- ],
3
+ "version": "0.1.16",
7
4
  "license": "MIT",
8
5
  "type": "module",
9
6
  "publishConfig": {
10
- "access": "public"
7
+ "access": "public",
8
+ "dependencies": {
9
+ "polpo-tailwind-config": "0.0.1",
10
+ "class-variance-authority": "^0.7.1",
11
+ "clsx": "^2.1.1",
12
+ "color": "^5.0.3",
13
+ "react-colorful": "^5.7.0",
14
+ "react-hook-form": "7.75.0",
15
+ "react-icons": "*",
16
+ "use-eye-dropper": "^1.7.2"
17
+ }
11
18
  },
12
- "files": [
13
- "dist"
14
- ],
15
19
  "exports": {
16
20
  ".": null,
17
21
  "./components.css": {
@@ -82,11 +86,11 @@
82
86
  "@types/react-dom": "*",
83
87
  "esbuild-postcss": "^0.0.4",
84
88
  "eslint": "*",
89
+ "postcss": "^8.5.15",
85
90
  "tsup": "*",
86
91
  "typescript": "*",
87
- "polpo-eslint-config": "1.0.1",
88
92
  "polpo-typescript-config": "1.0.1",
89
- "@polpo/tailwind-config": "0.0.0"
93
+ "polpo-eslint-config": "1.0.1"
90
94
  },
91
95
  "peerDependencies": {
92
96
  "react": "*",
@@ -101,7 +105,8 @@
101
105
  "react-colorful": "^5.7.0",
102
106
  "react-hook-form": "7.75.0",
103
107
  "react-icons": "*",
104
- "use-eye-dropper": "^1.7.2"
108
+ "use-eye-dropper": "^1.7.2",
109
+ "polpo-tailwind-config": "0.0.1"
105
110
  },
106
111
  "scripts": {
107
112
  "lint": "eslint src",
@@ -0,0 +1,3 @@
1
+ import { postcssConfig } from 'polpo-tailwind-config/postcss';
2
+
3
+ export default postcssConfig;
@@ -0,0 +1,123 @@
1
+ import React, { useMemo } from 'react';
2
+ import { IconType } from 'react-icons';
3
+ import { FaCaretLeft } from 'react-icons/fa';
4
+
5
+ import { useClassNames } from '../../hooks';
6
+ import { SlideCard } from '../cards';
7
+ import { Typography } from '../typography';
8
+
9
+ import { useAccordionItem } from './accordion.component';
10
+
11
+ type NodeFunction = (isOpen: boolean) => React.ReactNode;
12
+
13
+ type ContentType = React.ReactNode | NodeFunction;
14
+
15
+ type AccordionItemCommonProps = {
16
+ icon?: IconType;
17
+ children: React.ReactNode;
18
+ startContent?: ContentType;
19
+ endContent?: ContentType;
20
+ className?: string;
21
+ style?: React.CSSProperties;
22
+ classNames?: {
23
+ header?: string;
24
+ headerContent?: string;
25
+ title?: string;
26
+ subtitle?: string;
27
+ toggleIcon?: string;
28
+ body?: string;
29
+ };
30
+ };
31
+
32
+ type AccordionItemTitleProps = AccordionItemCommonProps & {
33
+ title?: ContentType;
34
+ subtitle?: ContentType;
35
+ content?: never;
36
+ };
37
+
38
+ type AccordionItemContentProps = AccordionItemCommonProps & {
39
+ title?: never;
40
+ subtitle?: never;
41
+ content?: ContentType;
42
+ };
43
+
44
+ type AccordionItemProps = AccordionItemTitleProps | AccordionItemContentProps;
45
+
46
+ const getContent = (content: ContentType | undefined, isOpen: boolean): React.ReactNode | undefined => {
47
+ if (typeof content === 'function') {
48
+ return content(isOpen);
49
+ }
50
+
51
+ return content;
52
+ };
53
+
54
+ export const AccordionItem: React.FC<AccordionItemProps> = ({
55
+ title,
56
+ subtitle,
57
+ children,
58
+ icon: Icon = FaCaretLeft,
59
+ startContent,
60
+ content,
61
+ endContent,
62
+ classNames = {},
63
+ className = '',
64
+ style = {},
65
+ }: AccordionItemProps) => {
66
+ const id = useMemo(() => crypto.randomUUID(), []);
67
+ const [isOpen, toggle] = useAccordionItem(id);
68
+ const headerClassName = useClassNames({
69
+ 'accordion-header': true,
70
+ 'has-start-content': !!startContent,
71
+ [classNames?.header ?? '']: !!classNames?.header,
72
+ 'is-open': isOpen,
73
+ });
74
+
75
+ const headerContentClassName = useClassNames({
76
+ 'accordion-header-content': true,
77
+ [classNames?.headerContent ?? '']: !!classNames?.headerContent,
78
+ });
79
+
80
+ const toggleIconClassName = useClassNames({
81
+ 'accordion-toggle-icon': true,
82
+ isOpen: isOpen,
83
+ [classNames?.toggleIcon ?? '']: !!classNames?.toggleIcon,
84
+ });
85
+
86
+ const bodyContentClassName = useClassNames({
87
+ 'accordion-body': true,
88
+ [classNames?.body ?? '']: !!classNames?.body,
89
+ });
90
+
91
+ const titleContent = getContent(title, isOpen);
92
+ const subtitleContent = getContent(subtitle, isOpen);
93
+ const headerStart = getContent(startContent, isOpen);
94
+ const headerMiddle = getContent(content, isOpen) ?? (
95
+ <section className={headerContentClassName}>
96
+ <Typography className={classNames?.title} variant='body' noPadding weight='bold'>
97
+ {titleContent}
98
+ </Typography>
99
+ <Typography className={classNames?.subtitle} variant='label' noPadding weight='light'>
100
+ {subtitleContent}
101
+ </Typography>
102
+ </section>
103
+ );
104
+ const headerEnd = getContent(endContent, isOpen) ?? <Icon className={toggleIconClassName} />;
105
+
106
+ const accordionItemClassName = useClassNames({
107
+ 'accordion-item': true,
108
+ [className]: Boolean(className),
109
+ });
110
+
111
+ return (
112
+ <section className={accordionItemClassName} style={style}>
113
+ <section className={headerClassName} onClick={toggle}>
114
+ {headerStart}
115
+ {headerMiddle}
116
+ {headerEnd}
117
+ </section>
118
+ <SlideCard isOpen={isOpen}>
119
+ <section className={bodyContentClassName}>{children}</section>
120
+ </SlideCard>
121
+ </section>
122
+ );
123
+ };
@@ -0,0 +1,80 @@
1
+ import React, { createContext, useCallback, useContext, useMemo, useState } from 'react';
2
+
3
+ import { useClassNames } from '../../hooks';
4
+ import { Line } from '../line';
5
+
6
+ import './accordion.styles.css';
7
+
8
+ type AccordionContextState = {
9
+ toggleItem: (id: string) => void;
10
+ openedItems: Array<string>;
11
+ };
12
+
13
+ const AccordionContext = createContext<AccordionContextState | null>(null);
14
+
15
+ export const useAccordionItem = (id: string): [boolean, () => void] => {
16
+ const context = useContext(AccordionContext);
17
+
18
+ if (!context) {
19
+ throw new Error('You cant use this component out off an Accordion component');
20
+ }
21
+
22
+ const { toggleItem, openedItems } = context;
23
+
24
+ const toggle = () => toggleItem(id);
25
+
26
+ return [openedItems.includes(id), toggle];
27
+ };
28
+
29
+ type AccordionProps = {
30
+ children: React.ReactNode;
31
+ className?: string;
32
+ style?: React.CSSProperties;
33
+ noSeparators?: boolean;
34
+ multiple?: boolean;
35
+ defaultOpened?: Array<string> | string;
36
+ };
37
+
38
+ export const Accordion = ({
39
+ children,
40
+ className = '',
41
+ noSeparators,
42
+ multiple,
43
+ style = {},
44
+ defaultOpened = [],
45
+ }: AccordionProps) => {
46
+ const [openedItems, setOpenedItems] = useState<{ [index: string]: boolean }>(() => {
47
+ return (Array.isArray(defaultOpened) ? defaultOpened : [defaultOpened]).reduce((acc, id) => {
48
+ return typeof id === 'string' ? { ...acc, [id]: true } : acc;
49
+ }, {});
50
+ });
51
+
52
+ const toggleItem = useCallback(
53
+ (id: string) => {
54
+ setOpenedItems(prev => ({ ...(multiple ? prev : {}), [id]: !prev[id] }));
55
+ },
56
+ [multiple],
57
+ );
58
+
59
+ const openedItemsIDs = useMemo(() => Object.keys(openedItems).filter(id => openedItems[id]), [openedItems]);
60
+
61
+ const accordionClassName = useClassNames({
62
+ accordion: true,
63
+ [className]: Boolean(className),
64
+ });
65
+
66
+ return (
67
+ <AccordionContext.Provider
68
+ value={{
69
+ toggleItem,
70
+ openedItems: openedItemsIDs,
71
+ }}
72
+ >
73
+ <section className={accordionClassName} style={style}>
74
+ {(Array.isArray(children) ? children : [children]).flatMap((child, key) => {
75
+ return key === 0 ? child : [noSeparators ? null : <Line orientation='horizontal' key={`${key}.5`} />, child];
76
+ })}
77
+ </section>
78
+ </AccordionContext.Provider>
79
+ );
80
+ };
@@ -0,0 +1,41 @@
1
+ @reference "polpo-tailwind-config/styles";
2
+
3
+ .accordion {
4
+ display: grid;
5
+ }
6
+
7
+ .accordion-item {
8
+ display: grid;
9
+ position: relative;
10
+
11
+ .accordion-header {
12
+ display: grid;
13
+ grid-template-columns: 1fr auto;
14
+ align-items: center;
15
+ gap: 20px;
16
+ cursor: pointer;
17
+ position: sticky;
18
+ top: 0;
19
+ padding: 20px 0;
20
+
21
+ &.has-start-content {
22
+ grid-template-columns: auto 1fr auto;
23
+ }
24
+ }
25
+
26
+ .accordion-header-content {
27
+ display: grid;
28
+ }
29
+
30
+ .accordion-toggle-icon {
31
+ transition: all 300ms ease;
32
+
33
+ &.isOpen {
34
+ transform: rotate(-90deg);
35
+ }
36
+ }
37
+
38
+ .accordion-body {
39
+ padding: 10px 0 20px;
40
+ }
41
+ }
@@ -0,0 +1,2 @@
1
+ export * from './accordion.component';
2
+ export * from './accordion-item';
@@ -0,0 +1,50 @@
1
+ import type { ButtonHTMLAttributes } from 'react';
2
+
3
+ import { cn } from '../../helpers';
4
+ import { ColorTypes, RadiusTypes, SizeTypes, VariantTypes } from '../component.types';
5
+ import { Ripple } from '../ripple';
6
+
7
+ import './button.styles.css';
8
+
9
+ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
10
+ children: React.ReactNode;
11
+ color?: `${ColorTypes}`;
12
+ variant?: `${VariantTypes}`;
13
+ radius?: `${RadiusTypes}`;
14
+ size?: `${SizeTypes}`;
15
+ noWrap?: boolean;
16
+ ref?: React.Ref<HTMLButtonElement>;
17
+ forIcon?: boolean;
18
+ isLoading?: boolean;
19
+ }
20
+
21
+ export const Button = ({
22
+ children,
23
+ color = ColorTypes.DEFAULT,
24
+ variant = VariantTypes.SOLID,
25
+ radius = RadiusTypes.MEDIUM,
26
+ size = SizeTypes.REGULAR,
27
+ noWrap = false,
28
+ forIcon = false,
29
+ className = '',
30
+ ...props
31
+ }: ButtonProps) => {
32
+ return (
33
+ <button
34
+ {...props}
35
+ className={cn(
36
+ 'button',
37
+ color,
38
+ variant,
39
+ radius && `radius-${radius}`,
40
+ size && `size-${size}`,
41
+ noWrap && 'no-wrap',
42
+ forIcon && 'icon',
43
+ className,
44
+ )}
45
+ >
46
+ {children}
47
+ <Ripple />
48
+ </button>
49
+ );
50
+ };