polpo 0.1.16 → 0.1.18
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.
- package/package.json +7 -14
- package/.turbo/cache/eslint/.cache_16wwsjl +0 -1
- package/.turbo/cache/eslint/.cache_rpznjo +0 -1
- package/.turbo/turbo-build$colon$code.log +0 -49
- package/.turbo/turbo-build$colon$css.log +0 -2
- package/.turbo/turbo-build.log +0 -43
- package/.turbo/turbo-lint.log +0 -2
- package/eslint.config.js +0 -4
- package/postcss.config.js +0 -3
- package/src/components/accordion/accordion-item.tsx +0 -123
- package/src/components/accordion/accordion.component.tsx +0 -80
- package/src/components/accordion/accordion.styles.css +0 -41
- package/src/components/accordion/index.ts +0 -2
- package/src/components/button/button.component.tsx +0 -50
- package/src/components/button/button.styles.css +0 -317
- package/src/components/button/index.ts +0 -1
- package/src/components/cards/flip-card/flip-card.component.tsx +0 -66
- package/src/components/cards/flip-card/flip-card.styles.css +0 -50
- package/src/components/cards/flip-card/index.ts +0 -1
- package/src/components/cards/hover-card/hover-card.component.tsx +0 -76
- package/src/components/cards/hover-card/hover-card.styles.css +0 -13
- package/src/components/cards/hover-card/index.ts +0 -1
- package/src/components/cards/index.ts +0 -3
- package/src/components/cards/slide-card/index.ts +0 -1
- package/src/components/cards/slide-card/slide-card.component.tsx +0 -27
- package/src/components/component.types.ts +0 -31
- package/src/components/cursor/cursor.component.tsx +0 -49
- package/src/components/cursor/cursor.styles.css +0 -73
- package/src/components/cursor/index.ts +0 -1
- package/src/components/form/checkbox/checkbox.component.tsx +0 -95
- package/src/components/form/checkbox/checkbox.styles.css +0 -162
- package/src/components/form/checkbox/index.ts +0 -1
- package/src/components/form/controller/controller.component.tsx +0 -42
- package/src/components/form/controller/index.ts +0 -1
- package/src/components/form/date-picker/date-picker.component.tsx +0 -66
- package/src/components/form/date-picker/index.ts +0 -1
- package/src/components/form/field/field.component.tsx +0 -84
- package/src/components/form/field/field.styles.css +0 -98
- package/src/components/form/field/field.types.ts +0 -34
- package/src/components/form/field/index.ts +0 -2
- package/src/components/form/form.types.ts +0 -37
- package/src/components/form/index.ts +0 -14
- package/src/components/form/input/index.ts +0 -1
- package/src/components/form/input/input.component.tsx +0 -75
- package/src/components/form/input-color/index.ts +0 -1
- package/src/components/form/input-color/input-color.component.tsx +0 -170
- package/src/components/form/input-color/input-color.styles.css +0 -92
- package/src/components/form/input-file/index.ts +0 -1
- package/src/components/form/input-file/input-file.component.tsx +0 -221
- package/src/components/form/input-file/input-file.styles.css +0 -143
- package/src/components/form/input-number/index.ts +0 -1
- package/src/components/form/input-number/input-number.component.tsx +0 -144
- package/src/components/form/input-password/index.ts +0 -1
- package/src/components/form/input-password/input-password.component.tsx +0 -77
- package/src/components/form/radio/index.ts +0 -1
- package/src/components/form/radio/radio.component.tsx +0 -92
- package/src/components/form/radio/radio.styles.css +0 -117
- package/src/components/form/select/index.ts +0 -1
- package/src/components/form/select/option.tsx +0 -101
- package/src/components/form/select/options.tsx +0 -165
- package/src/components/form/select/select.component.tsx +0 -317
- package/src/components/form/select/select.styles.css +0 -115
- package/src/components/form/select/select.types.ts +0 -97
- package/src/components/form/slider/index.ts +0 -1
- package/src/components/form/slider/slider.component.tsx +0 -117
- package/src/components/form/slider/slider.styles.css +0 -94
- package/src/components/form/switch/index.ts +0 -1
- package/src/components/form/switch/switch.component.tsx +0 -166
- package/src/components/form/switch/switch.styles.css +0 -165
- package/src/components/form/textarea/index.ts +0 -1
- package/src/components/form/textarea/textarea.component.tsx +0 -80
- package/src/components/form/textarea/textarea.styles.css +0 -7
- package/src/components/image/image.tsx +0 -7
- package/src/components/image/index.ts +0 -1
- package/src/components/index.ts +0 -15
- package/src/components/infinity-scroll/index.ts +0 -1
- package/src/components/infinity-scroll/infinity-scroll.component.tsx +0 -51
- package/src/components/infinity-scroll/infinity-scroll.styles.css +0 -25
- package/src/components/line/index.ts +0 -1
- package/src/components/line/line.component.tsx +0 -77
- package/src/components/line/line.styles.css +0 -61
- package/src/components/modals/action-modal/action-modal.component.tsx +0 -150
- package/src/components/modals/action-modal/action-modal.styles.css +0 -115
- package/src/components/modals/action-modal/index.ts +0 -1
- package/src/components/modals/aside-modal/aside-modal.component.tsx +0 -63
- package/src/components/modals/aside-modal/aside-modal.styles.css +0 -86
- package/src/components/modals/aside-modal/index.ts +0 -1
- package/src/components/modals/confirmation-modal/confirmation-modal.component.tsx +0 -43
- package/src/components/modals/confirmation-modal/confirmation-modal.styles.css +0 -17
- package/src/components/modals/confirmation-modal/index.ts +0 -1
- package/src/components/modals/index.ts +0 -6
- package/src/components/modals/menu/index.ts +0 -1
- package/src/components/modals/menu/menu.component.tsx +0 -194
- package/src/components/modals/menu/menu.styles.css +0 -101
- package/src/components/modals/modal/index.ts +0 -2
- package/src/components/modals/modal/modal.backdrop.tsx +0 -67
- package/src/components/modals/modal/modal.component.tsx +0 -104
- package/src/components/modals/modal/modal.styles.css +0 -70
- package/src/components/modals/portal/index.ts +0 -1
- package/src/components/modals/portal/portal.component.tsx +0 -19
- package/src/components/ripple/index.ts +0 -1
- package/src/components/ripple/ripple.component.tsx +0 -70
- package/src/components/ripple/ripple.styles.css +0 -33
- package/src/components/smart-table/index.ts +0 -2
- package/src/components/smart-table/smart-table.column.tsx +0 -62
- package/src/components/smart-table/smart-table.component.tsx +0 -116
- package/src/components/smart-table/smart-table.helpers.tsx +0 -58
- package/src/components/smart-table/smart-table.hooks.ts +0 -27
- package/src/components/smart-table/smart-table.row.tsx +0 -28
- package/src/components/smart-table/smart-table.styles.css +0 -102
- package/src/components/smart-table/smart-table.types.ts +0 -42
- package/src/components/tabs/index.ts +0 -1
- package/src/components/tabs/tabs-list.tsx +0 -120
- package/src/components/tabs/tabs.styles.css +0 -164
- package/src/components/tabs/tabs.tsx +0 -119
- package/src/components/tag/index.ts +0 -1
- package/src/components/tag/tag.component.tsx +0 -34
- package/src/components/tag/tag.styles.css +0 -50
- package/src/components/tooltips/click-to-copy/click-to-copy.component.tsx +0 -41
- package/src/components/tooltips/click-to-copy/index.ts +0 -1
- package/src/components/tooltips/index.ts +0 -2
- package/src/components/tooltips/tooltip/index.ts +0 -1
- package/src/components/tooltips/tooltip/tooltip.component.tsx +0 -64
- package/src/components/tooltips/tooltip/tooltip.styles.css +0 -91
- package/src/components/typography/index.ts +0 -1
- package/src/components/typography/typography.component.tsx +0 -81
- package/src/components/typography/typography.constants.ts +0 -53
- package/src/components/typography/typography.styles.css +0 -122
- package/src/helpers/cn.ts +0 -6
- package/src/helpers/format-bytes.ts +0 -11
- package/src/helpers/format-dates.ts +0 -47
- package/src/helpers/get-modal-position-relative-to-screen.ts +0 -86
- package/src/helpers/get-modal-position.ts +0 -211
- package/src/helpers/index.ts +0 -6
- package/src/helpers/text/index.ts +0 -1
- package/src/helpers/text/to-capitalize.ts +0 -17
- package/src/hooks/index.ts +0 -30
- package/src/hooks/use-async.ts +0 -88
- package/src/hooks/use-classnames.ts +0 -13
- package/src/hooks/use-click-outside.ts +0 -32
- package/src/hooks/use-constant.ts +0 -3
- package/src/hooks/use-cookie.ts +0 -124
- package/src/hooks/use-debounce-state.ts +0 -13
- package/src/hooks/use-debounce.ts +0 -15
- package/src/hooks/use-dimensions.ts +0 -19
- package/src/hooks/use-dom-container.ts +0 -35
- package/src/hooks/use-event-listener.ts +0 -71
- package/src/hooks/use-file-reader.ts +0 -69
- package/src/hooks/use-geolocation.ts +0 -63
- package/src/hooks/use-hover.ts +0 -17
- package/src/hooks/use-in-view.ts +0 -18
- package/src/hooks/use-input-handlers.ts +0 -52
- package/src/hooks/use-intersection-observer.ts +0 -19
- package/src/hooks/use-media-query.ts +0 -25
- package/src/hooks/use-modal-in-container.ts +0 -85
- package/src/hooks/use-modal-transition.ts +0 -64
- package/src/hooks/use-modal.ts +0 -21
- package/src/hooks/use-mouse-position.ts +0 -64
- package/src/hooks/use-online-status.ts +0 -12
- package/src/hooks/use-render-count.ts +0 -11
- package/src/hooks/use-resize-observer.ts +0 -18
- package/src/hooks/use-safe-dispatch.ts +0 -22
- package/src/hooks/use-scroll.ts +0 -31
- package/src/hooks/use-state-history.ts +0 -22
- package/src/hooks/use-toggle-values.ts +0 -14
- package/src/hooks/use-toggle.ts +0 -11
- package/src/hooks/use-viewport.ts +0 -38
- package/src/index.ts +0 -5
- package/src/layouts/flex/flex.component.tsx +0 -75
- package/src/layouts/flex/index.ts +0 -1
- package/src/layouts/grid/grid.component.tsx +0 -89
- package/src/layouts/grid/grid.styles.css +0 -5
- package/src/layouts/grid/index.ts +0 -1
- package/src/layouts/index.ts +0 -2
- package/src/types/generics.ts +0 -68
- package/src/types/index.ts +0 -1
- package/tsconfig.json +0 -10
- package/tsup.config.cjs +0 -36
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
[2m$ pnpm clean && tsup[22m
|
|
3
|
-
[2m$ rm -rf ./dist[22m
|
|
4
|
-
[34mCLI[39m Building entry: {"components":"./src/components/index.ts","hooks":"./src/hooks/index.ts","layouts":"./src/layouts/index.ts","types":"./src/types/index.ts","helpers":"./src/helpers/index.ts"}
|
|
5
|
-
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
6
|
-
[34mCLI[39m tsup v8.5.1
|
|
7
|
-
[34mCLI[39m Using tsup config: /Users/juanmsl/Code/personal/polpo-monorepo/packages/polpo/tsup.config.cjs
|
|
8
|
-
[34mCLI[39m Target: node24
|
|
9
|
-
[34mCLI[39m Cleaning output folder
|
|
10
|
-
[34mCJS[39m Build start
|
|
11
|
-
[34mESM[39m Build start
|
|
12
|
-
[32mESM[39m [1mdist/hooks.js [22m[32m28.60 KB[39m
|
|
13
|
-
[32mESM[39m [1mdist/components.js [22m[32m109.33 KB[39m
|
|
14
|
-
[32mESM[39m [1mdist/types.js [22m[32m47.00 B[39m
|
|
15
|
-
[32mESM[39m [1mdist/layouts.js [22m[32m2.47 KB[39m
|
|
16
|
-
[32mESM[39m [1mdist/helpers.js [22m[32m8.49 KB[39m
|
|
17
|
-
[32mESM[39m [1mdist/hooks.js.map [22m[32m58.95 KB[39m
|
|
18
|
-
[32mESM[39m [1mdist/types.js.map [22m[32m71.00 B[39m
|
|
19
|
-
[32mESM[39m [1mdist/layouts.js.map [22m[32m7.06 KB[39m
|
|
20
|
-
[32mESM[39m [1mdist/helpers.js.map [22m[32m15.46 KB[39m
|
|
21
|
-
[32mESM[39m [1mdist/components.js.map [22m[32m213.96 KB[39m
|
|
22
|
-
[32mESM[39m ⚡️ Build success in 67ms
|
|
23
|
-
[32mCJS[39m [1mdist/layouts.cjs [22m[32m3.51 KB[39m
|
|
24
|
-
[32mCJS[39m [1mdist/hooks.cjs [22m[32m31.73 KB[39m
|
|
25
|
-
[32mCJS[39m [1mdist/helpers.cjs [22m[32m9.94 KB[39m
|
|
26
|
-
[32mCJS[39m [1mdist/types.cjs [22m[32m812.00 B[39m
|
|
27
|
-
[32mCJS[39m [1mdist/components.cjs [22m[32m118.79 KB[39m
|
|
28
|
-
[32mCJS[39m [1mdist/hooks.cjs.map [22m[32m59.32 KB[39m
|
|
29
|
-
[32mCJS[39m [1mdist/types.cjs.map [22m[32m152.00 B[39m
|
|
30
|
-
[32mCJS[39m [1mdist/layouts.cjs.map [22m[32m7.15 KB[39m
|
|
31
|
-
[32mCJS[39m [1mdist/helpers.cjs.map [22m[32m15.76 KB[39m
|
|
32
|
-
[32mCJS[39m [1mdist/components.cjs.map [22m[32m211.08 KB[39m
|
|
33
|
-
[32mCJS[39m ⚡️ Build success in 68ms
|
|
34
|
-
DTS Build start
|
|
35
|
-
DTS ⚡️ Build success in 5444ms
|
|
36
|
-
DTS dist/layouts.d.cts 149.67 KB
|
|
37
|
-
DTS dist/helpers.d.cts 1.14 KB
|
|
38
|
-
DTS dist/hooks.d.cts 6.69 KB
|
|
39
|
-
DTS dist/components.d.cts 114.15 KB
|
|
40
|
-
DTS dist/types.d.cts 228.00 B
|
|
41
|
-
DTS dist/get-modal-position-C5jQsaGx.d.cts 1.71 KB
|
|
42
|
-
DTS dist/use-modal-transition-C7DzbnY5.d.cts 1.16 KB
|
|
43
|
-
DTS dist/layouts.d.ts 149.67 KB
|
|
44
|
-
DTS dist/helpers.d.ts 1.14 KB
|
|
45
|
-
DTS dist/hooks.d.ts 6.69 KB
|
|
46
|
-
DTS dist/components.d.ts 114.15 KB
|
|
47
|
-
DTS dist/types.d.ts 228.00 B
|
|
48
|
-
DTS dist/get-modal-position-C5jQsaGx.d.ts 1.71 KB
|
|
49
|
-
DTS dist/use-modal-transition-C0lyjvkD.d.ts 1.16 KB
|
package/.turbo/turbo-build.log
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
[2m$ pnpm clean && tsup[22m
|
|
3
|
-
[2m$ rm -rf ./dist[22m
|
|
4
|
-
[34mCLI[39m Building entry: {"components":"./src/components/index.ts","hooks":"./src/hooks/index.ts","layouts":"./src/layouts/index.ts","types":"./src/types/index.ts","helpers":"./src/helpers/index.ts"}
|
|
5
|
-
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
6
|
-
[34mCLI[39m tsup v8.5.1
|
|
7
|
-
[34mCLI[39m Using tsup config: /Users/juanmsl/Code/personal/polpo-monorepo/packages/polpo/tsup.config.cjs
|
|
8
|
-
[34mCLI[39m Target: node24
|
|
9
|
-
[34mCLI[39m Cleaning output folder
|
|
10
|
-
[34mCJS[39m Build start
|
|
11
|
-
[34mESM[39m Build start
|
|
12
|
-
DTS Build start
|
|
13
|
-
[32mCJS[39m [1mdist/components.css [22m[32m42.06 KB[39m
|
|
14
|
-
[32mCJS[39m [1mdist/layouts.cjs [22m[32m1.84 KB[39m
|
|
15
|
-
[32mCJS[39m [1mdist/layouts.css [22m[32m87.00 B[39m
|
|
16
|
-
[32mCJS[39m [1mdist/components.cjs [22m[32m52.90 KB[39m
|
|
17
|
-
[32mCJS[39m [1mdist/hooks.cjs [22m[32m13.36 KB[39m
|
|
18
|
-
[32mCJS[39m [1mdist/helpers.cjs [22m[32m4.47 KB[39m
|
|
19
|
-
[32mCJS[39m [1mdist/types.cjs [22m[32m411.00 B[39m
|
|
20
|
-
[32mCJS[39m ⚡️ Build success in 300ms
|
|
21
|
-
[32mESM[39m [1mdist/components.css [22m[32m42.06 KB[39m
|
|
22
|
-
[32mESM[39m [1mdist/components.js [22m[32m50.63 KB[39m
|
|
23
|
-
[32mESM[39m [1mdist/layouts.js [22m[32m1.37 KB[39m
|
|
24
|
-
[32mESM[39m [1mdist/layouts.css [22m[32m87.00 B[39m
|
|
25
|
-
[32mESM[39m [1mdist/helpers.js [22m[32m3.82 KB[39m
|
|
26
|
-
[32mESM[39m [1mdist/types.js [22m[32m14.00 B[39m
|
|
27
|
-
[32mESM[39m [1mdist/hooks.js [22m[32m12.17 KB[39m
|
|
28
|
-
[32mESM[39m ⚡️ Build success in 301ms
|
|
29
|
-
DTS ⚡️ Build success in 5081ms
|
|
30
|
-
DTS dist/layouts.d.cts 149.67 KB
|
|
31
|
-
DTS dist/helpers.d.cts 1.14 KB
|
|
32
|
-
DTS dist/hooks.d.cts 6.69 KB
|
|
33
|
-
DTS dist/components.d.cts 114.15 KB
|
|
34
|
-
DTS dist/types.d.cts 228.00 B
|
|
35
|
-
DTS dist/get-modal-position-C5jQsaGx.d.cts 1.71 KB
|
|
36
|
-
DTS dist/use-modal-transition-C7DzbnY5.d.cts 1.16 KB
|
|
37
|
-
DTS dist/layouts.d.ts 149.67 KB
|
|
38
|
-
DTS dist/helpers.d.ts 1.14 KB
|
|
39
|
-
DTS dist/hooks.d.ts 6.69 KB
|
|
40
|
-
DTS dist/components.d.ts 114.15 KB
|
|
41
|
-
DTS dist/types.d.ts 228.00 B
|
|
42
|
-
DTS dist/get-modal-position-C5jQsaGx.d.ts 1.71 KB
|
|
43
|
-
DTS dist/use-modal-transition-C0lyjvkD.d.ts 1.16 KB
|
package/.turbo/turbo-lint.log
DELETED
package/eslint.config.js
DELETED
package/postcss.config.js
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,80 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
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
|
-
};
|