@ttoss/components 1.18.0 → 1.19.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.
- package/dist/esm/index.js +49 -0
- package/dist/index.d.ts +285 -1
- package/dist/index.js +51 -7
- package/package.json +3 -2
- package/src/components/Accordion/Accordion.docs.md +57 -0
- package/src/components/Accordion/Accordion.tsx +67 -0
- package/src/components/Modal/Modal.docs.md +1 -1
- package/src/index.spec.tsx +7 -6
- package/src/index.ts +3 -2
package/dist/esm/index.js
CHANGED
|
@@ -3,6 +3,54 @@
|
|
|
3
3
|
// tsup.inject.js
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
|
|
6
|
+
// src/components/Accordion/Accordion.tsx
|
|
7
|
+
import {
|
|
8
|
+
AccordionItem,
|
|
9
|
+
AccordionItemButton,
|
|
10
|
+
AccordionItemHeading,
|
|
11
|
+
AccordionItemPanel,
|
|
12
|
+
Accordion as ReactAccessibleAccordion
|
|
13
|
+
} from "react-accessible-accordion";
|
|
14
|
+
import { Box } from "@ttoss/ui";
|
|
15
|
+
var Accordion = ({
|
|
16
|
+
children,
|
|
17
|
+
allowMultipleExpanded,
|
|
18
|
+
allowZeroExpanded,
|
|
19
|
+
preExpanded,
|
|
20
|
+
onChange,
|
|
21
|
+
...boxProps
|
|
22
|
+
}) => {
|
|
23
|
+
return /* @__PURE__ */ React.createElement(Box, {
|
|
24
|
+
...boxProps,
|
|
25
|
+
sx: {
|
|
26
|
+
".accordion__item": {
|
|
27
|
+
marginBottom: 3
|
|
28
|
+
},
|
|
29
|
+
".accordion__heading": {
|
|
30
|
+
padding: 2,
|
|
31
|
+
border: "1px solid",
|
|
32
|
+
borderColor: "black"
|
|
33
|
+
},
|
|
34
|
+
".accordion__button": {},
|
|
35
|
+
".accordion__panel": {
|
|
36
|
+
padding: 2
|
|
37
|
+
},
|
|
38
|
+
...boxProps.sx
|
|
39
|
+
}
|
|
40
|
+
}, /* @__PURE__ */ React.createElement(ReactAccessibleAccordion, {
|
|
41
|
+
...{
|
|
42
|
+
allowMultipleExpanded,
|
|
43
|
+
allowZeroExpanded,
|
|
44
|
+
preExpanded,
|
|
45
|
+
onChange
|
|
46
|
+
}
|
|
47
|
+
}, children));
|
|
48
|
+
};
|
|
49
|
+
Accordion.Item = AccordionItem;
|
|
50
|
+
Accordion.ItemButton = AccordionItemButton;
|
|
51
|
+
Accordion.ItemHeading = AccordionItemHeading;
|
|
52
|
+
Accordion.ItemPanel = AccordionItemPanel;
|
|
53
|
+
|
|
6
54
|
// src/components/InstallPwa/InstallPwa.tsx
|
|
7
55
|
import * as React2 from "react";
|
|
8
56
|
|
|
@@ -114,6 +162,7 @@ var Modal = (props) => {
|
|
|
114
162
|
};
|
|
115
163
|
Modal.setAppElement = ReactModal.setAppElement;
|
|
116
164
|
export {
|
|
165
|
+
Accordion,
|
|
117
166
|
InstallPwa,
|
|
118
167
|
Modal
|
|
119
168
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,289 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import * as react_accessible_accordion_dist_types_helpers_DisplayName from 'react-accessible-accordion/dist/types/helpers/DisplayName';
|
|
3
|
+
import * as react_accessible_accordion_dist_types_components_ItemContext from 'react-accessible-accordion/dist/types/components/ItemContext';
|
|
4
|
+
import * as react_accessible_accordion_dist_types_helpers_types from 'react-accessible-accordion/dist/types/helpers/types';
|
|
5
|
+
import * as theme_ui_jsx_runtime from 'theme-ui/jsx-runtime';
|
|
6
|
+
import { BoxProps } from '@ttoss/ui';
|
|
1
7
|
import ReactModal from 'react-modal';
|
|
2
8
|
|
|
9
|
+
declare type AccordionProps = BoxProps & {
|
|
10
|
+
allowMultipleExpanded?: boolean;
|
|
11
|
+
allowZeroExpanded?: boolean;
|
|
12
|
+
preExpanded?: string[];
|
|
13
|
+
/**
|
|
14
|
+
* Callback which is invoked when items are expanded or collapsed. Gets passed uuids of the currently expanded AccordionItems.
|
|
15
|
+
*/
|
|
16
|
+
onChange?: (args: string[]) => void;
|
|
17
|
+
};
|
|
18
|
+
declare const Accordion: {
|
|
19
|
+
({ children, allowMultipleExpanded, allowZeroExpanded, preExpanded, onChange, ...boxProps }: AccordionProps): theme_ui_jsx_runtime.JSX.Element;
|
|
20
|
+
Item: {
|
|
21
|
+
({ uuid: customUuid, dangerouslySetExpanded, className, activeClassName, ...rest }: react_accessible_accordion_dist_types_helpers_types.DivAttributes & {
|
|
22
|
+
uuid?: react_accessible_accordion_dist_types_components_ItemContext.ID | undefined;
|
|
23
|
+
activeClassName?: string | undefined;
|
|
24
|
+
dangerouslySetExpanded?: boolean | undefined;
|
|
25
|
+
}): JSX.Element;
|
|
26
|
+
displayName: react_accessible_accordion_dist_types_helpers_DisplayName.default;
|
|
27
|
+
};
|
|
28
|
+
ItemButton: react.FC<{
|
|
29
|
+
children?: react.ReactNode;
|
|
30
|
+
slot?: string | undefined;
|
|
31
|
+
style?: react.CSSProperties | undefined;
|
|
32
|
+
title?: string | undefined;
|
|
33
|
+
defaultChecked?: boolean | undefined;
|
|
34
|
+
defaultValue?: string | number | readonly string[] | undefined;
|
|
35
|
+
suppressContentEditableWarning?: boolean | undefined;
|
|
36
|
+
suppressHydrationWarning?: boolean | undefined;
|
|
37
|
+
accessKey?: string | undefined;
|
|
38
|
+
className?: string | undefined;
|
|
39
|
+
contentEditable?: (boolean | "true" | "false") | "inherit" | undefined;
|
|
40
|
+
contextMenu?: string | undefined;
|
|
41
|
+
dir?: string | undefined;
|
|
42
|
+
draggable?: (boolean | "true" | "false") | undefined;
|
|
43
|
+
hidden?: boolean | undefined;
|
|
44
|
+
lang?: string | undefined;
|
|
45
|
+
placeholder?: string | undefined;
|
|
46
|
+
spellCheck?: (boolean | "true" | "false") | undefined;
|
|
47
|
+
translate?: "yes" | "no" | undefined;
|
|
48
|
+
radioGroup?: string | undefined;
|
|
49
|
+
about?: string | undefined;
|
|
50
|
+
datatype?: string | undefined;
|
|
51
|
+
inlist?: any;
|
|
52
|
+
prefix?: string | undefined;
|
|
53
|
+
property?: string | undefined;
|
|
54
|
+
resource?: string | undefined;
|
|
55
|
+
typeof?: string | undefined;
|
|
56
|
+
vocab?: string | undefined;
|
|
57
|
+
autoCapitalize?: string | undefined;
|
|
58
|
+
autoCorrect?: string | undefined;
|
|
59
|
+
autoSave?: string | undefined;
|
|
60
|
+
color?: string | undefined;
|
|
61
|
+
itemProp?: string | undefined;
|
|
62
|
+
itemScope?: boolean | undefined;
|
|
63
|
+
itemType?: string | undefined;
|
|
64
|
+
itemID?: string | undefined;
|
|
65
|
+
itemRef?: string | undefined;
|
|
66
|
+
results?: number | undefined;
|
|
67
|
+
security?: string | undefined;
|
|
68
|
+
unselectable?: "on" | "off" | undefined;
|
|
69
|
+
inputMode?: "text" | "none" | "search" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
|
|
70
|
+
is?: string | undefined;
|
|
71
|
+
'aria-activedescendant'?: string | undefined;
|
|
72
|
+
'aria-atomic'?: (boolean | "true" | "false") | undefined;
|
|
73
|
+
'aria-autocomplete'?: "list" | "none" | "inline" | "both" | undefined;
|
|
74
|
+
'aria-busy'?: (boolean | "true" | "false") | undefined;
|
|
75
|
+
'aria-checked'?: boolean | "true" | "false" | "mixed" | undefined;
|
|
76
|
+
'aria-colcount'?: number | undefined;
|
|
77
|
+
'aria-colindex'?: number | undefined;
|
|
78
|
+
'aria-colspan'?: number | undefined;
|
|
79
|
+
'aria-current'?: boolean | "time" | "true" | "false" | "page" | "step" | "location" | "date" | undefined;
|
|
80
|
+
'aria-describedby'?: string | undefined;
|
|
81
|
+
'aria-details'?: string | undefined;
|
|
82
|
+
'aria-dropeffect'?: "link" | "none" | "copy" | "execute" | "move" | "popup" | undefined;
|
|
83
|
+
'aria-errormessage'?: string | undefined;
|
|
84
|
+
'aria-flowto'?: string | undefined;
|
|
85
|
+
'aria-grabbed'?: (boolean | "true" | "false") | undefined;
|
|
86
|
+
'aria-haspopup'?: boolean | "dialog" | "menu" | "true" | "false" | "grid" | "listbox" | "tree" | undefined;
|
|
87
|
+
'aria-hidden'?: (boolean | "true" | "false") | undefined;
|
|
88
|
+
'aria-invalid'?: boolean | "true" | "false" | "grammar" | "spelling" | undefined;
|
|
89
|
+
'aria-keyshortcuts'?: string | undefined;
|
|
90
|
+
'aria-label'?: string | undefined;
|
|
91
|
+
'aria-labelledby'?: string | undefined;
|
|
92
|
+
'aria-level'?: number | undefined;
|
|
93
|
+
'aria-live'?: "off" | "assertive" | "polite" | undefined;
|
|
94
|
+
'aria-modal'?: (boolean | "true" | "false") | undefined;
|
|
95
|
+
'aria-multiline'?: (boolean | "true" | "false") | undefined;
|
|
96
|
+
'aria-multiselectable'?: (boolean | "true" | "false") | undefined;
|
|
97
|
+
'aria-orientation'?: "horizontal" | "vertical" | undefined;
|
|
98
|
+
'aria-owns'?: string | undefined;
|
|
99
|
+
'aria-placeholder'?: string | undefined;
|
|
100
|
+
'aria-posinset'?: number | undefined;
|
|
101
|
+
'aria-pressed'?: boolean | "true" | "false" | "mixed" | undefined;
|
|
102
|
+
'aria-readonly'?: (boolean | "true" | "false") | undefined;
|
|
103
|
+
'aria-relevant'?: "text" | "all" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefined;
|
|
104
|
+
'aria-required'?: (boolean | "true" | "false") | undefined;
|
|
105
|
+
'aria-roledescription'?: string | undefined;
|
|
106
|
+
'aria-rowcount'?: number | undefined;
|
|
107
|
+
'aria-rowindex'?: number | undefined;
|
|
108
|
+
'aria-rowspan'?: number | undefined;
|
|
109
|
+
'aria-selected'?: (boolean | "true" | "false") | undefined;
|
|
110
|
+
'aria-setsize'?: number | undefined;
|
|
111
|
+
'aria-sort'?: "none" | "ascending" | "descending" | "other" | undefined;
|
|
112
|
+
'aria-valuemax'?: number | undefined;
|
|
113
|
+
'aria-valuemin'?: number | undefined;
|
|
114
|
+
'aria-valuenow'?: number | undefined;
|
|
115
|
+
'aria-valuetext'?: string | undefined;
|
|
116
|
+
dangerouslySetInnerHTML?: {
|
|
117
|
+
__html: string;
|
|
118
|
+
} | undefined;
|
|
119
|
+
onCopy?: react.ClipboardEventHandler<HTMLDivElement> | undefined;
|
|
120
|
+
onCopyCapture?: react.ClipboardEventHandler<HTMLDivElement> | undefined;
|
|
121
|
+
onCut?: react.ClipboardEventHandler<HTMLDivElement> | undefined;
|
|
122
|
+
onCutCapture?: react.ClipboardEventHandler<HTMLDivElement> | undefined;
|
|
123
|
+
onPaste?: react.ClipboardEventHandler<HTMLDivElement> | undefined;
|
|
124
|
+
onPasteCapture?: react.ClipboardEventHandler<HTMLDivElement> | undefined;
|
|
125
|
+
onCompositionEnd?: react.CompositionEventHandler<HTMLDivElement> | undefined;
|
|
126
|
+
onCompositionEndCapture?: react.CompositionEventHandler<HTMLDivElement> | undefined;
|
|
127
|
+
onCompositionStart?: react.CompositionEventHandler<HTMLDivElement> | undefined;
|
|
128
|
+
onCompositionStartCapture?: react.CompositionEventHandler<HTMLDivElement> | undefined;
|
|
129
|
+
onCompositionUpdate?: react.CompositionEventHandler<HTMLDivElement> | undefined;
|
|
130
|
+
onCompositionUpdateCapture?: react.CompositionEventHandler<HTMLDivElement> | undefined;
|
|
131
|
+
onFocus?: react.FocusEventHandler<HTMLDivElement> | undefined;
|
|
132
|
+
onFocusCapture?: react.FocusEventHandler<HTMLDivElement> | undefined;
|
|
133
|
+
onBlur?: react.FocusEventHandler<HTMLDivElement> | undefined;
|
|
134
|
+
onBlurCapture?: react.FocusEventHandler<HTMLDivElement> | undefined;
|
|
135
|
+
onChange?: react.FormEventHandler<HTMLDivElement> | undefined;
|
|
136
|
+
onChangeCapture?: react.FormEventHandler<HTMLDivElement> | undefined;
|
|
137
|
+
onBeforeInput?: react.FormEventHandler<HTMLDivElement> | undefined;
|
|
138
|
+
onBeforeInputCapture?: react.FormEventHandler<HTMLDivElement> | undefined;
|
|
139
|
+
onInput?: react.FormEventHandler<HTMLDivElement> | undefined;
|
|
140
|
+
onInputCapture?: react.FormEventHandler<HTMLDivElement> | undefined;
|
|
141
|
+
onReset?: react.FormEventHandler<HTMLDivElement> | undefined;
|
|
142
|
+
onResetCapture?: react.FormEventHandler<HTMLDivElement> | undefined;
|
|
143
|
+
onSubmit?: react.FormEventHandler<HTMLDivElement> | undefined;
|
|
144
|
+
onSubmitCapture?: react.FormEventHandler<HTMLDivElement> | undefined;
|
|
145
|
+
onInvalid?: react.FormEventHandler<HTMLDivElement> | undefined;
|
|
146
|
+
onInvalidCapture?: react.FormEventHandler<HTMLDivElement> | undefined;
|
|
147
|
+
onLoad?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
148
|
+
onLoadCapture?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
149
|
+
onError?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
150
|
+
onErrorCapture?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
151
|
+
onKeyDown?: react.KeyboardEventHandler<HTMLDivElement> | undefined;
|
|
152
|
+
onKeyDownCapture?: react.KeyboardEventHandler<HTMLDivElement> | undefined;
|
|
153
|
+
onKeyPress?: react.KeyboardEventHandler<HTMLDivElement> | undefined;
|
|
154
|
+
onKeyPressCapture?: react.KeyboardEventHandler<HTMLDivElement> | undefined;
|
|
155
|
+
onKeyUp?: react.KeyboardEventHandler<HTMLDivElement> | undefined;
|
|
156
|
+
onKeyUpCapture?: react.KeyboardEventHandler<HTMLDivElement> | undefined;
|
|
157
|
+
onAbort?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
158
|
+
onAbortCapture?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
159
|
+
onCanPlay?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
160
|
+
onCanPlayCapture?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
161
|
+
onCanPlayThrough?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
162
|
+
onCanPlayThroughCapture?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
163
|
+
onDurationChange?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
164
|
+
onDurationChangeCapture?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
165
|
+
onEmptied?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
166
|
+
onEmptiedCapture?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
167
|
+
onEncrypted?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
168
|
+
onEncryptedCapture?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
169
|
+
onEnded?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
170
|
+
onEndedCapture?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
171
|
+
onLoadedData?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
172
|
+
onLoadedDataCapture?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
173
|
+
onLoadedMetadata?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
174
|
+
onLoadedMetadataCapture?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
175
|
+
onLoadStart?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
176
|
+
onLoadStartCapture?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
177
|
+
onPause?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
178
|
+
onPauseCapture?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
179
|
+
onPlay?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
180
|
+
onPlayCapture?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
181
|
+
onPlaying?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
182
|
+
onPlayingCapture?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
183
|
+
onProgress?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
184
|
+
onProgressCapture?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
185
|
+
onRateChange?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
186
|
+
onRateChangeCapture?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
187
|
+
onSeeked?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
188
|
+
onSeekedCapture?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
189
|
+
onSeeking?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
190
|
+
onSeekingCapture?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
191
|
+
onStalled?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
192
|
+
onStalledCapture?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
193
|
+
onSuspend?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
194
|
+
onSuspendCapture?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
195
|
+
onTimeUpdate?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
196
|
+
onTimeUpdateCapture?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
197
|
+
onVolumeChange?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
198
|
+
onVolumeChangeCapture?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
199
|
+
onWaiting?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
200
|
+
onWaitingCapture?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
201
|
+
onAuxClick?: react.MouseEventHandler<HTMLDivElement> | undefined;
|
|
202
|
+
onAuxClickCapture?: react.MouseEventHandler<HTMLDivElement> | undefined;
|
|
203
|
+
onClick?: react.MouseEventHandler<HTMLDivElement> | undefined;
|
|
204
|
+
onClickCapture?: react.MouseEventHandler<HTMLDivElement> | undefined;
|
|
205
|
+
onContextMenu?: react.MouseEventHandler<HTMLDivElement> | undefined;
|
|
206
|
+
onContextMenuCapture?: react.MouseEventHandler<HTMLDivElement> | undefined;
|
|
207
|
+
onDoubleClick?: react.MouseEventHandler<HTMLDivElement> | undefined;
|
|
208
|
+
onDoubleClickCapture?: react.MouseEventHandler<HTMLDivElement> | undefined;
|
|
209
|
+
onDrag?: react.DragEventHandler<HTMLDivElement> | undefined;
|
|
210
|
+
onDragCapture?: react.DragEventHandler<HTMLDivElement> | undefined;
|
|
211
|
+
onDragEnd?: react.DragEventHandler<HTMLDivElement> | undefined;
|
|
212
|
+
onDragEndCapture?: react.DragEventHandler<HTMLDivElement> | undefined;
|
|
213
|
+
onDragEnter?: react.DragEventHandler<HTMLDivElement> | undefined;
|
|
214
|
+
onDragEnterCapture?: react.DragEventHandler<HTMLDivElement> | undefined;
|
|
215
|
+
onDragExit?: react.DragEventHandler<HTMLDivElement> | undefined;
|
|
216
|
+
onDragExitCapture?: react.DragEventHandler<HTMLDivElement> | undefined;
|
|
217
|
+
onDragLeave?: react.DragEventHandler<HTMLDivElement> | undefined;
|
|
218
|
+
onDragLeaveCapture?: react.DragEventHandler<HTMLDivElement> | undefined;
|
|
219
|
+
onDragOver?: react.DragEventHandler<HTMLDivElement> | undefined;
|
|
220
|
+
onDragOverCapture?: react.DragEventHandler<HTMLDivElement> | undefined;
|
|
221
|
+
onDragStart?: react.DragEventHandler<HTMLDivElement> | undefined;
|
|
222
|
+
onDragStartCapture?: react.DragEventHandler<HTMLDivElement> | undefined;
|
|
223
|
+
onDrop?: react.DragEventHandler<HTMLDivElement> | undefined;
|
|
224
|
+
onDropCapture?: react.DragEventHandler<HTMLDivElement> | undefined;
|
|
225
|
+
onMouseDown?: react.MouseEventHandler<HTMLDivElement> | undefined;
|
|
226
|
+
onMouseDownCapture?: react.MouseEventHandler<HTMLDivElement> | undefined;
|
|
227
|
+
onMouseEnter?: react.MouseEventHandler<HTMLDivElement> | undefined;
|
|
228
|
+
onMouseLeave?: react.MouseEventHandler<HTMLDivElement> | undefined;
|
|
229
|
+
onMouseMove?: react.MouseEventHandler<HTMLDivElement> | undefined;
|
|
230
|
+
onMouseMoveCapture?: react.MouseEventHandler<HTMLDivElement> | undefined;
|
|
231
|
+
onMouseOut?: react.MouseEventHandler<HTMLDivElement> | undefined;
|
|
232
|
+
onMouseOutCapture?: react.MouseEventHandler<HTMLDivElement> | undefined;
|
|
233
|
+
onMouseOver?: react.MouseEventHandler<HTMLDivElement> | undefined;
|
|
234
|
+
onMouseOverCapture?: react.MouseEventHandler<HTMLDivElement> | undefined;
|
|
235
|
+
onMouseUp?: react.MouseEventHandler<HTMLDivElement> | undefined;
|
|
236
|
+
onMouseUpCapture?: react.MouseEventHandler<HTMLDivElement> | undefined;
|
|
237
|
+
onSelect?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
238
|
+
onSelectCapture?: react.ReactEventHandler<HTMLDivElement> | undefined;
|
|
239
|
+
onTouchCancel?: react.TouchEventHandler<HTMLDivElement> | undefined;
|
|
240
|
+
onTouchCancelCapture?: react.TouchEventHandler<HTMLDivElement> | undefined;
|
|
241
|
+
onTouchEnd?: react.TouchEventHandler<HTMLDivElement> | undefined;
|
|
242
|
+
onTouchEndCapture?: react.TouchEventHandler<HTMLDivElement> | undefined;
|
|
243
|
+
onTouchMove?: react.TouchEventHandler<HTMLDivElement> | undefined;
|
|
244
|
+
onTouchMoveCapture?: react.TouchEventHandler<HTMLDivElement> | undefined;
|
|
245
|
+
onTouchStart?: react.TouchEventHandler<HTMLDivElement> | undefined;
|
|
246
|
+
onTouchStartCapture?: react.TouchEventHandler<HTMLDivElement> | undefined;
|
|
247
|
+
onPointerDown?: react.PointerEventHandler<HTMLDivElement> | undefined;
|
|
248
|
+
onPointerDownCapture?: react.PointerEventHandler<HTMLDivElement> | undefined;
|
|
249
|
+
onPointerMove?: react.PointerEventHandler<HTMLDivElement> | undefined;
|
|
250
|
+
onPointerMoveCapture?: react.PointerEventHandler<HTMLDivElement> | undefined;
|
|
251
|
+
onPointerUp?: react.PointerEventHandler<HTMLDivElement> | undefined;
|
|
252
|
+
onPointerUpCapture?: react.PointerEventHandler<HTMLDivElement> | undefined;
|
|
253
|
+
onPointerCancel?: react.PointerEventHandler<HTMLDivElement> | undefined;
|
|
254
|
+
onPointerCancelCapture?: react.PointerEventHandler<HTMLDivElement> | undefined;
|
|
255
|
+
onPointerEnter?: react.PointerEventHandler<HTMLDivElement> | undefined;
|
|
256
|
+
onPointerEnterCapture?: react.PointerEventHandler<HTMLDivElement> | undefined;
|
|
257
|
+
onPointerLeave?: react.PointerEventHandler<HTMLDivElement> | undefined;
|
|
258
|
+
onPointerLeaveCapture?: react.PointerEventHandler<HTMLDivElement> | undefined;
|
|
259
|
+
onPointerOver?: react.PointerEventHandler<HTMLDivElement> | undefined;
|
|
260
|
+
onPointerOverCapture?: react.PointerEventHandler<HTMLDivElement> | undefined;
|
|
261
|
+
onPointerOut?: react.PointerEventHandler<HTMLDivElement> | undefined;
|
|
262
|
+
onPointerOutCapture?: react.PointerEventHandler<HTMLDivElement> | undefined;
|
|
263
|
+
onGotPointerCapture?: react.PointerEventHandler<HTMLDivElement> | undefined;
|
|
264
|
+
onGotPointerCaptureCapture?: react.PointerEventHandler<HTMLDivElement> | undefined;
|
|
265
|
+
onLostPointerCapture?: react.PointerEventHandler<HTMLDivElement> | undefined;
|
|
266
|
+
onLostPointerCaptureCapture?: react.PointerEventHandler<HTMLDivElement> | undefined;
|
|
267
|
+
onScroll?: react.UIEventHandler<HTMLDivElement> | undefined;
|
|
268
|
+
onScrollCapture?: react.UIEventHandler<HTMLDivElement> | undefined;
|
|
269
|
+
onWheel?: react.WheelEventHandler<HTMLDivElement> | undefined;
|
|
270
|
+
onWheelCapture?: react.WheelEventHandler<HTMLDivElement> | undefined;
|
|
271
|
+
onAnimationStart?: react.AnimationEventHandler<HTMLDivElement> | undefined;
|
|
272
|
+
onAnimationStartCapture?: react.AnimationEventHandler<HTMLDivElement> | undefined;
|
|
273
|
+
onAnimationEnd?: react.AnimationEventHandler<HTMLDivElement> | undefined;
|
|
274
|
+
onAnimationEndCapture?: react.AnimationEventHandler<HTMLDivElement> | undefined;
|
|
275
|
+
onAnimationIteration?: react.AnimationEventHandler<HTMLDivElement> | undefined;
|
|
276
|
+
onAnimationIterationCapture?: react.AnimationEventHandler<HTMLDivElement> | undefined;
|
|
277
|
+
onTransitionEnd?: react.TransitionEventHandler<HTMLDivElement> | undefined;
|
|
278
|
+
onTransitionEndCapture?: react.TransitionEventHandler<HTMLDivElement> | undefined;
|
|
279
|
+
}>;
|
|
280
|
+
ItemHeading: react.FC<react_accessible_accordion_dist_types_helpers_types.DivAttributes>;
|
|
281
|
+
ItemPanel: ({ className, region, id, ...rest }: react_accessible_accordion_dist_types_helpers_types.DivAttributes & {
|
|
282
|
+
region?: boolean | undefined;
|
|
283
|
+
className?: string | undefined;
|
|
284
|
+
}) => JSX.Element;
|
|
285
|
+
};
|
|
286
|
+
|
|
3
287
|
declare const InstallPwa: () => JSX.Element | null;
|
|
4
288
|
|
|
5
289
|
declare type ModalProps = ReactModal.Props;
|
|
@@ -8,4 +292,4 @@ declare const Modal: {
|
|
|
8
292
|
setAppElement: typeof ReactModal.setAppElement;
|
|
9
293
|
};
|
|
10
294
|
|
|
11
|
-
export { InstallPwa, Modal, ModalProps };
|
|
295
|
+
export { Accordion, AccordionProps, InstallPwa, Modal, ModalProps };
|
package/dist/index.js
CHANGED
|
@@ -23,6 +23,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
23
23
|
// src/index.ts
|
|
24
24
|
var src_exports = {};
|
|
25
25
|
__export(src_exports, {
|
|
26
|
+
Accordion: () => Accordion,
|
|
26
27
|
InstallPwa: () => InstallPwa,
|
|
27
28
|
Modal: () => Modal
|
|
28
29
|
});
|
|
@@ -31,20 +32,62 @@ module.exports = __toCommonJS(src_exports);
|
|
|
31
32
|
// tsup.inject.js
|
|
32
33
|
var React = __toESM(require("react"));
|
|
33
34
|
|
|
35
|
+
// src/components/Accordion/Accordion.tsx
|
|
36
|
+
var import_react_accessible_accordion = require("react-accessible-accordion");
|
|
37
|
+
var import_ui = require("@ttoss/ui");
|
|
38
|
+
var Accordion = ({
|
|
39
|
+
children,
|
|
40
|
+
allowMultipleExpanded,
|
|
41
|
+
allowZeroExpanded,
|
|
42
|
+
preExpanded,
|
|
43
|
+
onChange,
|
|
44
|
+
...boxProps
|
|
45
|
+
}) => {
|
|
46
|
+
return /* @__PURE__ */ React.createElement(import_ui.Box, {
|
|
47
|
+
...boxProps,
|
|
48
|
+
sx: {
|
|
49
|
+
".accordion__item": {
|
|
50
|
+
marginBottom: 3
|
|
51
|
+
},
|
|
52
|
+
".accordion__heading": {
|
|
53
|
+
padding: 2,
|
|
54
|
+
border: "1px solid",
|
|
55
|
+
borderColor: "black"
|
|
56
|
+
},
|
|
57
|
+
".accordion__button": {},
|
|
58
|
+
".accordion__panel": {
|
|
59
|
+
padding: 2
|
|
60
|
+
},
|
|
61
|
+
...boxProps.sx
|
|
62
|
+
}
|
|
63
|
+
}, /* @__PURE__ */ React.createElement(import_react_accessible_accordion.Accordion, {
|
|
64
|
+
...{
|
|
65
|
+
allowMultipleExpanded,
|
|
66
|
+
allowZeroExpanded,
|
|
67
|
+
preExpanded,
|
|
68
|
+
onChange
|
|
69
|
+
}
|
|
70
|
+
}, children));
|
|
71
|
+
};
|
|
72
|
+
Accordion.Item = import_react_accessible_accordion.AccordionItem;
|
|
73
|
+
Accordion.ItemButton = import_react_accessible_accordion.AccordionItemButton;
|
|
74
|
+
Accordion.ItemHeading = import_react_accessible_accordion.AccordionItemHeading;
|
|
75
|
+
Accordion.ItemPanel = import_react_accessible_accordion.AccordionItemPanel;
|
|
76
|
+
|
|
34
77
|
// src/components/InstallPwa/InstallPwa.tsx
|
|
35
78
|
var React2 = __toESM(require("react"));
|
|
36
79
|
|
|
37
80
|
// src/components/InstallPwa/InstallPwaUi.tsx
|
|
38
|
-
var
|
|
81
|
+
var import_ui2 = require("@ttoss/ui");
|
|
39
82
|
var InstallPwaUi = ({ onInstall }) => {
|
|
40
|
-
return /* @__PURE__ */ React.createElement(
|
|
83
|
+
return /* @__PURE__ */ React.createElement(import_ui2.Flex, {
|
|
41
84
|
sx: {
|
|
42
85
|
position: "absolute",
|
|
43
86
|
bottom: 4,
|
|
44
87
|
width: "100%",
|
|
45
88
|
justifyContent: "center"
|
|
46
89
|
}
|
|
47
|
-
}, /* @__PURE__ */ React.createElement(
|
|
90
|
+
}, /* @__PURE__ */ React.createElement(import_ui2.Flex, {
|
|
48
91
|
sx: {
|
|
49
92
|
backgroundColor: "background",
|
|
50
93
|
justifyContent: "center",
|
|
@@ -56,7 +99,7 @@ var InstallPwaUi = ({ onInstall }) => {
|
|
|
56
99
|
borderRadius: 1,
|
|
57
100
|
padding: 4
|
|
58
101
|
}
|
|
59
|
-
}, /* @__PURE__ */ React.createElement(
|
|
102
|
+
}, /* @__PURE__ */ React.createElement(import_ui2.Text, null, "Deseja instalar o nosso aplicativo?"), /* @__PURE__ */ React.createElement(import_ui2.Button, {
|
|
60
103
|
onClick: onInstall
|
|
61
104
|
}, "Instalar")));
|
|
62
105
|
};
|
|
@@ -90,7 +133,7 @@ var InstallPwa = () => {
|
|
|
90
133
|
};
|
|
91
134
|
|
|
92
135
|
// src/components/Modal/Modal.tsx
|
|
93
|
-
var
|
|
136
|
+
var import_ui3 = require("@ttoss/ui");
|
|
94
137
|
var import_react_modal = __toESM(require("react-modal"));
|
|
95
138
|
import_react_modal.default.defaultStyles = {
|
|
96
139
|
overlay: {},
|
|
@@ -98,8 +141,8 @@ import_react_modal.default.defaultStyles = {
|
|
|
98
141
|
};
|
|
99
142
|
var Modal = (props) => {
|
|
100
143
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
101
|
-
const { theme } = (0,
|
|
102
|
-
const padding = (0,
|
|
144
|
+
const { theme } = (0, import_ui3.useTheme)();
|
|
145
|
+
const padding = (0, import_ui3.useResponsiveValue)([
|
|
103
146
|
(_a = theme.space) == null ? void 0 : _a[2],
|
|
104
147
|
(_b = theme.space) == null ? void 0 : _b[3],
|
|
105
148
|
(_c = theme.space) == null ? void 0 : _c[4]
|
|
@@ -143,6 +186,7 @@ var Modal = (props) => {
|
|
|
143
186
|
Modal.setAppElement = import_react_modal.default.setAppElement;
|
|
144
187
|
// Annotate the CommonJS export names for ESM import in node:
|
|
145
188
|
0 && (module.exports = {
|
|
189
|
+
Accordion,
|
|
146
190
|
InstallPwa,
|
|
147
191
|
Modal
|
|
148
192
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.0",
|
|
4
4
|
"description": "React components.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"publishConfig": {
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@types/react-modal": "^3.13.1",
|
|
35
|
+
"react-accessible-accordion": "^5.0.0",
|
|
35
36
|
"react-modal": "^3.15.1"
|
|
36
37
|
},
|
|
37
38
|
"peerDependencies": {
|
|
@@ -45,5 +46,5 @@
|
|
|
45
46
|
"@types/jest": "^28.1.5",
|
|
46
47
|
"jest": "^28.1.3"
|
|
47
48
|
},
|
|
48
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "2727f2809df7ce542f0fd3b953163a300e60cb68"
|
|
49
50
|
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Accordion
|
|
2
|
+
|
|
3
|
+
This components uses [react-accessible-accordion package](https://react-accessible-accordion.springload.co.nz/) as a base and apply [@ttoss/ui](/docs/modules/packages/ui/) styles.
|
|
4
|
+
|
|
5
|
+
## Storybook
|
|
6
|
+
|
|
7
|
+
[Stories](https://storybook.ttoss.dev/?path=/story/components-accordion)
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
```jsx
|
|
12
|
+
import { Accordion } from "@ttoss/components";
|
|
13
|
+
import { Text } from "@ttoss/ui";
|
|
14
|
+
|
|
15
|
+
const MyAccordion = () => {
|
|
16
|
+
return (
|
|
17
|
+
<Accordion>
|
|
18
|
+
<Accordion.Item>
|
|
19
|
+
<Accordion.ItemHeading>
|
|
20
|
+
<Accordion.ItemButton>
|
|
21
|
+
What harsh truths do you prefer to ignore?
|
|
22
|
+
</Accordion.ItemButton>
|
|
23
|
+
</Accordion.ItemHeading>
|
|
24
|
+
<Accordion.ItemPanel>
|
|
25
|
+
<Text>
|
|
26
|
+
Exercitation in fugiat est ut ad ea cupidatat ut in cupidatat
|
|
27
|
+
occaecat ut occaecat consequat est minim minim esse tempor laborum
|
|
28
|
+
consequat esse adipisicing eu reprehenderit enim.
|
|
29
|
+
</Text>
|
|
30
|
+
</Accordion.ItemPanel>
|
|
31
|
+
</Accordion.Item>
|
|
32
|
+
<Accordion.Item>
|
|
33
|
+
<Accordion.ItemHeading>
|
|
34
|
+
<Accordion.ItemButton>
|
|
35
|
+
Is free will real or just an illusion?
|
|
36
|
+
</Accordion.ItemButton>
|
|
37
|
+
</Accordion.ItemHeading>
|
|
38
|
+
<Accordion.ItemPanel>
|
|
39
|
+
<Text>
|
|
40
|
+
In ad velit in ex nostrud dolore cupidatat consectetur ea in ut
|
|
41
|
+
nostrud velit in irure cillum tempor laboris sed adipisicing eu esse
|
|
42
|
+
duis nulla non.
|
|
43
|
+
</Text>
|
|
44
|
+
</Accordion.ItemPanel>
|
|
45
|
+
</Accordion.Item>
|
|
46
|
+
</Accordion>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## API
|
|
52
|
+
|
|
53
|
+
TODO
|
|
54
|
+
|
|
55
|
+
## Styles
|
|
56
|
+
|
|
57
|
+
TODO
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/** @jsxImportSource theme-ui */
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
AccordionItem,
|
|
5
|
+
AccordionItemButton,
|
|
6
|
+
AccordionItemHeading,
|
|
7
|
+
AccordionItemPanel,
|
|
8
|
+
Accordion as ReactAccessibleAccordion,
|
|
9
|
+
} from 'react-accessible-accordion';
|
|
10
|
+
import { Box, BoxProps } from '@ttoss/ui';
|
|
11
|
+
|
|
12
|
+
export type AccordionProps = BoxProps & {
|
|
13
|
+
// https://github.com/springload/react-accessible-accordion#accordion
|
|
14
|
+
allowMultipleExpanded?: boolean;
|
|
15
|
+
allowZeroExpanded?: boolean;
|
|
16
|
+
preExpanded?: string[];
|
|
17
|
+
/**
|
|
18
|
+
* Callback which is invoked when items are expanded or collapsed. Gets passed uuids of the currently expanded AccordionItems.
|
|
19
|
+
*/
|
|
20
|
+
onChange?: (args: string[]) => void;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const Accordion = ({
|
|
24
|
+
children,
|
|
25
|
+
allowMultipleExpanded,
|
|
26
|
+
allowZeroExpanded,
|
|
27
|
+
preExpanded,
|
|
28
|
+
onChange,
|
|
29
|
+
...boxProps
|
|
30
|
+
}: AccordionProps) => {
|
|
31
|
+
return (
|
|
32
|
+
<Box
|
|
33
|
+
{...boxProps}
|
|
34
|
+
sx={{
|
|
35
|
+
'.accordion__item': {
|
|
36
|
+
marginBottom: 3,
|
|
37
|
+
},
|
|
38
|
+
'.accordion__heading': {
|
|
39
|
+
padding: 2,
|
|
40
|
+
border: '1px solid',
|
|
41
|
+
borderColor: 'black',
|
|
42
|
+
},
|
|
43
|
+
'.accordion__button': {},
|
|
44
|
+
'.accordion__panel': {
|
|
45
|
+
padding: 2,
|
|
46
|
+
},
|
|
47
|
+
...boxProps.sx,
|
|
48
|
+
}}
|
|
49
|
+
>
|
|
50
|
+
<ReactAccessibleAccordion
|
|
51
|
+
{...{
|
|
52
|
+
allowMultipleExpanded,
|
|
53
|
+
allowZeroExpanded,
|
|
54
|
+
preExpanded,
|
|
55
|
+
onChange,
|
|
56
|
+
}}
|
|
57
|
+
>
|
|
58
|
+
{children}
|
|
59
|
+
</ReactAccessibleAccordion>
|
|
60
|
+
</Box>
|
|
61
|
+
);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
Accordion.Item = AccordionItem;
|
|
65
|
+
Accordion.ItemButton = AccordionItemButton;
|
|
66
|
+
Accordion.ItemHeading = AccordionItemHeading;
|
|
67
|
+
Accordion.ItemPanel = AccordionItemPanel;
|
package/src/index.spec.tsx
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as componentsModule from './index';
|
|
2
2
|
|
|
3
|
-
test.each([
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
);
|
|
3
|
+
test.each([
|
|
4
|
+
componentsModule.Accordion,
|
|
5
|
+
componentsModule.InstallPwa,
|
|
6
|
+
componentsModule.Modal,
|
|
7
|
+
])('should export components %#', (Component) => {
|
|
8
|
+
expect(Component).toBeDefined();
|
|
9
|
+
});
|
package/src/index.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export * from './components/Accordion/Accordion';
|
|
2
|
+
export * from './components/InstallPwa/InstallPwa';
|
|
3
|
+
export * from './components/Modal/Modal';
|