@ttoss/components 1.16.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/README.md CHANGED
@@ -1,15 +1,15 @@
1
1
  # @ttoss/components
2
2
 
3
- ## 📚 About
3
+ ## About
4
4
 
5
- <strong>@ttoss/components</strong> is a set of React components that you can use to build your apps.
5
+ <strong>@ttoss/components</strong> is a set of React components that you can use to build your apps using ttoss technologies.
6
6
 
7
- ## 🚀 Getting Started
7
+ ## Getting Started
8
8
 
9
9
  ### Install @ttoss/components
10
10
 
11
11
  ```shell
12
- $ yarn add @ttoss/components
12
+ $ yarn add @ttoss/{components,ui}
13
13
  # or
14
- $ npm install @ttoss/components
14
+ $ npm install @ttoss/{components,ui}
15
15
  ```
package/dist/esm/index.js CHANGED
@@ -1,6 +1,56 @@
1
+ "use strict";
2
+
1
3
  // tsup.inject.js
2
4
  import * as React from "react";
3
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
+
4
54
  // src/components/InstallPwa/InstallPwa.tsx
5
55
  import * as React2 from "react";
6
56
 
@@ -58,6 +108,61 @@ var InstallPwa = () => {
58
108
  onInstall
59
109
  });
60
110
  };
111
+
112
+ // src/components/Modal/Modal.tsx
113
+ import { useResponsiveValue, useTheme } from "@ttoss/ui";
114
+ import ReactModal from "react-modal";
115
+ ReactModal.defaultStyles = {
116
+ overlay: {},
117
+ content: {}
118
+ };
119
+ var Modal = (props) => {
120
+ var _a, _b, _c, _d, _e, _f, _g;
121
+ const { theme } = useTheme();
122
+ const padding = useResponsiveValue([
123
+ (_a = theme.space) == null ? void 0 : _a[2],
124
+ (_b = theme.space) == null ? void 0 : _b[3],
125
+ (_c = theme.space) == null ? void 0 : _c[4]
126
+ ]) || 0;
127
+ const style = {
128
+ overlay: {
129
+ position: "fixed",
130
+ top: 0,
131
+ left: 0,
132
+ right: 0,
133
+ bottom: 0,
134
+ backgroundColor: "rgba(255, 255, 255, 0.5)",
135
+ display: "flex",
136
+ justifyContent: "center",
137
+ alignItems: "center",
138
+ padding,
139
+ ...(_d = props.style) == null ? void 0 : _d.overlay
140
+ },
141
+ content: {
142
+ background: ((_f = (_e = theme.rawColors) == null ? void 0 : _e.background) == null ? void 0 : _f.toString()) || "#fff",
143
+ padding,
144
+ WebkitOverflowScrolling: "touch",
145
+ overflow: "auto",
146
+ position: "relative",
147
+ top: "0px",
148
+ left: "0px",
149
+ right: "0px",
150
+ bottom: "0px",
151
+ border: "1px solid #ccc",
152
+ display: "flex",
153
+ flexDirection: "column",
154
+ alignItems: "center",
155
+ ...(_g = props.style) == null ? void 0 : _g.content
156
+ }
157
+ };
158
+ return /* @__PURE__ */ React.createElement(ReactModal, {
159
+ ...props,
160
+ style
161
+ });
162
+ };
163
+ Modal.setAppElement = ReactModal.setAppElement;
61
164
  export {
62
- InstallPwa
165
+ Accordion,
166
+ InstallPwa,
167
+ Modal
63
168
  };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,295 @@
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';
7
+ import ReactModal from 'react-modal';
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
+
1
287
  declare const InstallPwa: () => JSX.Element | null;
2
288
 
3
- export { InstallPwa };
289
+ declare type ModalProps = ReactModal.Props;
290
+ declare const Modal: {
291
+ (props: ModalProps): JSX.Element;
292
+ setAppElement: typeof ReactModal.setAppElement;
293
+ };
294
+
295
+ export { Accordion, AccordionProps, InstallPwa, Modal, ModalProps };
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -22,27 +23,71 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
22
23
  // src/index.ts
23
24
  var src_exports = {};
24
25
  __export(src_exports, {
25
- InstallPwa: () => InstallPwa
26
+ Accordion: () => Accordion,
27
+ InstallPwa: () => InstallPwa,
28
+ Modal: () => Modal
26
29
  });
27
30
  module.exports = __toCommonJS(src_exports);
28
31
 
29
32
  // tsup.inject.js
30
33
  var React = __toESM(require("react"));
31
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
+
32
77
  // src/components/InstallPwa/InstallPwa.tsx
33
78
  var React2 = __toESM(require("react"));
34
79
 
35
80
  // src/components/InstallPwa/InstallPwaUi.tsx
36
- var import_ui = require("@ttoss/ui");
81
+ var import_ui2 = require("@ttoss/ui");
37
82
  var InstallPwaUi = ({ onInstall }) => {
38
- return /* @__PURE__ */ React.createElement(import_ui.Flex, {
83
+ return /* @__PURE__ */ React.createElement(import_ui2.Flex, {
39
84
  sx: {
40
85
  position: "absolute",
41
86
  bottom: 4,
42
87
  width: "100%",
43
88
  justifyContent: "center"
44
89
  }
45
- }, /* @__PURE__ */ React.createElement(import_ui.Flex, {
90
+ }, /* @__PURE__ */ React.createElement(import_ui2.Flex, {
46
91
  sx: {
47
92
  backgroundColor: "background",
48
93
  justifyContent: "center",
@@ -54,7 +99,7 @@ var InstallPwaUi = ({ onInstall }) => {
54
99
  borderRadius: 1,
55
100
  padding: 4
56
101
  }
57
- }, /* @__PURE__ */ React.createElement(import_ui.Text, null, "Deseja instalar o nosso aplicativo?"), /* @__PURE__ */ React.createElement(import_ui.Button, {
102
+ }, /* @__PURE__ */ React.createElement(import_ui2.Text, null, "Deseja instalar o nosso aplicativo?"), /* @__PURE__ */ React.createElement(import_ui2.Button, {
58
103
  onClick: onInstall
59
104
  }, "Instalar")));
60
105
  };
@@ -86,7 +131,62 @@ var InstallPwa = () => {
86
131
  onInstall
87
132
  });
88
133
  };
134
+
135
+ // src/components/Modal/Modal.tsx
136
+ var import_ui3 = require("@ttoss/ui");
137
+ var import_react_modal = __toESM(require("react-modal"));
138
+ import_react_modal.default.defaultStyles = {
139
+ overlay: {},
140
+ content: {}
141
+ };
142
+ var Modal = (props) => {
143
+ var _a, _b, _c, _d, _e, _f, _g;
144
+ const { theme } = (0, import_ui3.useTheme)();
145
+ const padding = (0, import_ui3.useResponsiveValue)([
146
+ (_a = theme.space) == null ? void 0 : _a[2],
147
+ (_b = theme.space) == null ? void 0 : _b[3],
148
+ (_c = theme.space) == null ? void 0 : _c[4]
149
+ ]) || 0;
150
+ const style = {
151
+ overlay: {
152
+ position: "fixed",
153
+ top: 0,
154
+ left: 0,
155
+ right: 0,
156
+ bottom: 0,
157
+ backgroundColor: "rgba(255, 255, 255, 0.5)",
158
+ display: "flex",
159
+ justifyContent: "center",
160
+ alignItems: "center",
161
+ padding,
162
+ ...(_d = props.style) == null ? void 0 : _d.overlay
163
+ },
164
+ content: {
165
+ background: ((_f = (_e = theme.rawColors) == null ? void 0 : _e.background) == null ? void 0 : _f.toString()) || "#fff",
166
+ padding,
167
+ WebkitOverflowScrolling: "touch",
168
+ overflow: "auto",
169
+ position: "relative",
170
+ top: "0px",
171
+ left: "0px",
172
+ right: "0px",
173
+ bottom: "0px",
174
+ border: "1px solid #ccc",
175
+ display: "flex",
176
+ flexDirection: "column",
177
+ alignItems: "center",
178
+ ...(_g = props.style) == null ? void 0 : _g.content
179
+ }
180
+ };
181
+ return /* @__PURE__ */ React.createElement(import_react_modal.default, {
182
+ ...props,
183
+ style
184
+ });
185
+ };
186
+ Modal.setAppElement = import_react_modal.default.setAppElement;
89
187
  // Annotate the CommonJS export names for ESM import in node:
90
188
  0 && (module.exports = {
91
- InstallPwa
189
+ Accordion,
190
+ InstallPwa,
191
+ Modal
92
192
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/components",
3
- "version": "1.16.0",
3
+ "version": "1.19.0",
4
4
  "description": "React components.",
5
5
  "license": "UNLICENSED",
6
6
  "publishConfig": {
@@ -31,14 +31,20 @@
31
31
  "dev": "yarn workspace @docs/storybook run dev"
32
32
  },
33
33
  "dependencies": {
34
- "@ttoss/ui": "^1.16.0"
34
+ "@types/react-modal": "^3.13.1",
35
+ "react-accessible-accordion": "^5.0.0",
36
+ "react-modal": "^3.15.1"
35
37
  },
36
38
  "peerDependencies": {
39
+ "@ttoss/ui": "^1.16.5",
37
40
  "react": ">=16.8.0"
38
41
  },
39
42
  "devDependencies": {
40
- "@ttoss/config": "^1.16.0",
41
- "@ttoss/test-utils": "^1.16.0"
43
+ "@ttoss/config": "^1.15.2",
44
+ "@ttoss/test-utils": "^1.15.2",
45
+ "@ttoss/ui": "^1.18.0",
46
+ "@types/jest": "^28.1.5",
47
+ "jest": "^28.1.3"
42
48
  },
43
- "gitHead": "0412266ba0223a5b42904254a13d96473006e0a3"
49
+ "gitHead": "2727f2809df7ce542f0fd3b953163a300e60cb68"
44
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;
@@ -0,0 +1,56 @@
1
+ # Modal
2
+
3
+ This components uses [react-modal package](http://reactcommunity.org/react-modal) 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-modal)
8
+
9
+ ## Example
10
+
11
+ ```jsx
12
+ import { Modal } from "@ttoss/components";
13
+ import { Box, Flex, Text } from "@ttoss/ui";
14
+
15
+ const Component = () => {
16
+ const [isOpen, setIsOpen] = React.useState(false);
17
+
18
+ return (
19
+ <Box>
20
+ <Modal
21
+ isOpen={isOpen}
22
+ onRequestClose={() => {
23
+ setIsOpen(false);
24
+ }}
25
+ >
26
+ <Flex
27
+ sx={{
28
+ flexDirection: "column",
29
+ alignItems: "center",
30
+ }}
31
+ >
32
+ <Text>This is a modal.</Text>
33
+ <Button
34
+ onClick={() => {
35
+ setIsOpen(false);
36
+ }}
37
+ >
38
+ Close Modal
39
+ </Button>
40
+ </Flex>
41
+ </Modal>
42
+ <Button
43
+ onClick={() => {
44
+ setIsOpen(true);
45
+ }}
46
+ >
47
+ Open Modal
48
+ </Button>
49
+ </Box>
50
+ );
51
+ };
52
+ ```
53
+
54
+ ## API
55
+
56
+ This components extends the API of [react-modal package](http://reactcommunity.org/react-modal/#usage).
@@ -0,0 +1,62 @@
1
+ import { useResponsiveValue, useTheme } from '@ttoss/ui';
2
+ import ReactModal from 'react-modal';
3
+
4
+ ReactModal.defaultStyles = {
5
+ overlay: {},
6
+ content: {},
7
+ };
8
+
9
+ export type ModalProps = ReactModal.Props;
10
+
11
+ export const Modal = (props: ModalProps) => {
12
+ const { theme } = useTheme();
13
+
14
+ const padding =
15
+ useResponsiveValue([
16
+ theme.space?.[2],
17
+ theme.space?.[3],
18
+ theme.space?.[4],
19
+ ]) || 0;
20
+
21
+ const style: ReactModal.Styles = {
22
+ overlay: {
23
+ position: 'fixed',
24
+ top: 0,
25
+ left: 0,
26
+ right: 0,
27
+ bottom: 0,
28
+ backgroundColor: 'rgba(255, 255, 255, 0.5)',
29
+ display: 'flex',
30
+ justifyContent: 'center',
31
+ alignItems: 'center',
32
+ padding,
33
+ ...props.style?.overlay,
34
+ },
35
+ content: {
36
+ /**
37
+ * Theme
38
+ */
39
+ background: theme.rawColors?.background?.toString() || '#fff',
40
+ padding,
41
+ /**
42
+ * General
43
+ */
44
+ WebkitOverflowScrolling: 'touch',
45
+ overflow: 'auto',
46
+ position: 'relative',
47
+ top: '0px',
48
+ left: '0px',
49
+ right: '0px',
50
+ bottom: '0px',
51
+ border: '1px solid #ccc',
52
+ display: 'flex',
53
+ flexDirection: 'column',
54
+ alignItems: 'center',
55
+ ...props.style?.content,
56
+ },
57
+ };
58
+
59
+ return <ReactModal {...props} style={style} />;
60
+ };
61
+
62
+ Modal.setAppElement = ReactModal.setAppElement;
@@ -1,5 +1,9 @@
1
1
  import * as componentsModule from './index';
2
2
 
3
- test('should export components', () => {
4
- expect(componentsModule.InstallPwa).toBeDefined();
3
+ test.each([
4
+ componentsModule.Accordion,
5
+ componentsModule.InstallPwa,
6
+ componentsModule.Modal,
7
+ ])('should export components %#', (Component) => {
8
+ expect(Component).toBeDefined();
5
9
  });
package/src/index.ts CHANGED
@@ -1 +1,3 @@
1
- export { InstallPwa } from './components/InstallPwa/InstallPwa';
1
+ export * from './components/Accordion/Accordion';
2
+ export * from './components/InstallPwa/InstallPwa';
3
+ export * from './components/Modal/Modal';