react-restyle-components 0.2.23 → 0.2.24
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 +0 -6
- package/lib/package.json +15 -4
- package/lib/src/App.js +12 -1
- package/lib/src/assets/styles/colors.css +217 -0
- package/lib/src/assets/styles/decorations.css +15 -0
- package/lib/src/assets/styles/fontface.css +17 -0
- package/lib/src/assets/styles/scrollbars.css +70 -0
- package/lib/src/assets/styles/typography.css +3 -0
- package/lib/src/core-components/atoms/button/Button.stories.d.ts +320 -0
- package/lib/src/core-components/atoms/button/Button.stories.js +66 -0
- package/lib/src/core-components/atoms/button/Button.test.d.ts +1 -0
- package/lib/src/core-components/atoms/button/Button.test.js +31 -0
- package/lib/src/core-components/atoms/button/Button.types.d.ts +36 -0
- package/lib/src/core-components/atoms/button/Button.types.js +1 -0
- package/lib/src/core-components/atoms/button/LinkButton.stories.d.ts +302 -0
- package/lib/src/core-components/atoms/button/LinkButton.stories.js +52 -0
- package/lib/src/core-components/atoms/button/ToggleButton.stories.d.ts +337 -0
- package/lib/src/core-components/atoms/button/ToggleButton.stories.js +62 -0
- package/lib/src/core-components/atoms/button/button.component.d.ts +6 -0
- package/lib/src/core-components/atoms/button/button.component.js +19 -0
- package/lib/src/core-components/atoms/button/button.module.css +477 -0
- package/lib/src/core-components/atoms/button/buttonGroup/ButtonGroup.stories.d.ts +53 -0
- package/lib/src/core-components/atoms/button/buttonGroup/ButtonGroup.stories.js +271 -0
- package/lib/src/core-components/atoms/button/buttonGroup/buttonGroup.component.d.ts +9 -0
- package/lib/src/core-components/atoms/button/buttonGroup/buttonGroup.component.js +4 -0
- package/lib/src/core-components/atoms/button/linkButton.component.d.ts +9 -0
- package/lib/src/core-components/atoms/button/linkButton.component.js +20 -0
- package/lib/src/core-components/atoms/button/toggleButton.component.d.ts +10 -0
- package/lib/src/core-components/atoms/button/toggleButton.component.js +21 -0
- package/lib/src/core-components/atoms/icons/icons.component.js +1 -1
- package/lib/src/core-components/atoms/tabs/tabs.component.d.ts +9 -2
- package/lib/src/core-components/atoms/tabs/tabs.component.js +14 -9
- package/lib/src/core-components/atoms/tooltip/Tooltip.module.css +44 -0
- package/lib/src/core-components/atoms/tooltip/Tooltip.stories.d.ts +31 -0
- package/lib/src/core-components/atoms/tooltip/Tooltip.stories.js +100 -0
- package/lib/src/core-components/atoms/tooltip/Tooltip.types.d.ts +23 -0
- package/lib/src/core-components/atoms/tooltip/Tooltip.types.js +1 -0
- package/lib/src/core-components/atoms/tooltip/tooltip.component.d.ts +16 -9
- package/lib/src/core-components/atoms/tooltip/tooltip.component.js +26 -24
- package/lib/src/core-components/index.d.ts +4 -1
- package/lib/src/core-components/index.js +4 -1
- package/lib/tc.css +1 -1
- package/package.json +15 -4
- package/lib/src/core-components/atoms/buttons/button.stories.d.ts +0 -6
- package/lib/src/core-components/atoms/buttons/button.stories.js +0 -36
- package/lib/src/core-components/atoms/buttons/buttons.component.d.ts +0 -11
- package/lib/src/core-components/atoms/buttons/buttons.component.js +0 -8
- package/lib/src/core-components/atoms/tooltip/tooltip.stories.d.ts +0 -6
- package/lib/src/core-components/atoms/tooltip/tooltip.stories.js +0 -13
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { StoryObj } from '@storybook/react';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: React.ForwardRefExoticComponent<import("./Button.types").ButtonProps & React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
|
|
6
|
+
tags: string[];
|
|
7
|
+
argTypes: {
|
|
8
|
+
disabled: {
|
|
9
|
+
control: "boolean";
|
|
10
|
+
};
|
|
11
|
+
onClick: {
|
|
12
|
+
action: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
decorators: ((Story: import("@storybook/csf").PartialStoryFn<import("@storybook/react/dist/types-a5624094").R, {
|
|
16
|
+
tooltip?: string | undefined;
|
|
17
|
+
level?: "primary" | "secondary" | undefined;
|
|
18
|
+
variant?: "brand" | "danger" | "accent" | "neutral" | undefined;
|
|
19
|
+
scale?: "s" | "xl" | "l" | "m" | "xs" | "xxs" | undefined;
|
|
20
|
+
iconOnly?: boolean | undefined;
|
|
21
|
+
focus?: "none" | "visible" | "focus" | undefined;
|
|
22
|
+
loading?: boolean | undefined;
|
|
23
|
+
className?: string | undefined;
|
|
24
|
+
disabled?: boolean | undefined;
|
|
25
|
+
form?: string | undefined;
|
|
26
|
+
formAction?: string | undefined;
|
|
27
|
+
formEncType?: string | undefined;
|
|
28
|
+
formMethod?: string | undefined;
|
|
29
|
+
formNoValidate?: boolean | undefined;
|
|
30
|
+
formTarget?: string | undefined;
|
|
31
|
+
name?: string | undefined;
|
|
32
|
+
type?: "button" | "reset" | "submit" | undefined;
|
|
33
|
+
value?: string | number | readonly string[] | undefined;
|
|
34
|
+
defaultChecked?: boolean | undefined;
|
|
35
|
+
defaultValue?: string | number | readonly string[] | undefined;
|
|
36
|
+
suppressContentEditableWarning?: boolean | undefined;
|
|
37
|
+
suppressHydrationWarning?: boolean | undefined;
|
|
38
|
+
accessKey?: string | undefined;
|
|
39
|
+
autoCapitalize?: (string & {}) | "off" | "on" | "none" | "sentences" | "words" | "characters" | undefined;
|
|
40
|
+
autoFocus?: boolean | undefined;
|
|
41
|
+
contentEditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
|
|
42
|
+
contextMenu?: string | undefined;
|
|
43
|
+
dir?: string | undefined;
|
|
44
|
+
draggable?: (boolean | "true" | "false") | undefined;
|
|
45
|
+
enterKeyHint?: "search" | "enter" | "done" | "go" | "next" | "previous" | "send" | undefined;
|
|
46
|
+
hidden?: boolean | undefined;
|
|
47
|
+
id?: string | undefined;
|
|
48
|
+
lang?: string | undefined;
|
|
49
|
+
nonce?: string | undefined;
|
|
50
|
+
slot?: string | undefined;
|
|
51
|
+
spellCheck?: (boolean | "true" | "false") | undefined;
|
|
52
|
+
style?: React.CSSProperties | undefined;
|
|
53
|
+
tabIndex?: number | undefined;
|
|
54
|
+
title?: string | undefined;
|
|
55
|
+
translate?: "yes" | "no" | undefined;
|
|
56
|
+
radioGroup?: string | undefined;
|
|
57
|
+
role?: React.AriaRole | undefined;
|
|
58
|
+
about?: string | undefined;
|
|
59
|
+
content?: string | undefined;
|
|
60
|
+
datatype?: string | undefined;
|
|
61
|
+
inlist?: any;
|
|
62
|
+
prefix?: string | undefined;
|
|
63
|
+
property?: string | undefined;
|
|
64
|
+
rel?: string | undefined;
|
|
65
|
+
resource?: string | undefined;
|
|
66
|
+
rev?: string | undefined;
|
|
67
|
+
typeof?: string | undefined;
|
|
68
|
+
vocab?: string | undefined;
|
|
69
|
+
autoCorrect?: string | undefined;
|
|
70
|
+
autoSave?: string | undefined;
|
|
71
|
+
color?: string | undefined;
|
|
72
|
+
itemProp?: string | undefined;
|
|
73
|
+
itemScope?: boolean | undefined;
|
|
74
|
+
itemType?: string | undefined;
|
|
75
|
+
itemID?: string | undefined;
|
|
76
|
+
itemRef?: string | undefined;
|
|
77
|
+
results?: number | undefined;
|
|
78
|
+
security?: string | undefined;
|
|
79
|
+
unselectable?: "off" | "on" | undefined;
|
|
80
|
+
inputMode?: "search" | "text" | "email" | "tel" | "url" | "none" | "numeric" | "decimal" | undefined;
|
|
81
|
+
is?: string | undefined;
|
|
82
|
+
"aria-activedescendant"?: string | undefined;
|
|
83
|
+
"aria-atomic"?: (boolean | "true" | "false") | undefined;
|
|
84
|
+
"aria-autocomplete"?: "none" | "list" | "inline" | "both" | undefined;
|
|
85
|
+
"aria-braillelabel"?: string | undefined;
|
|
86
|
+
"aria-brailleroledescription"?: string | undefined;
|
|
87
|
+
"aria-busy"?: (boolean | "true" | "false") | undefined;
|
|
88
|
+
"aria-checked"?: boolean | "true" | "false" | "mixed" | undefined;
|
|
89
|
+
"aria-colcount"?: number | undefined;
|
|
90
|
+
"aria-colindex"?: number | undefined;
|
|
91
|
+
"aria-colindextext"?: string | undefined;
|
|
92
|
+
"aria-colspan"?: number | undefined;
|
|
93
|
+
"aria-controls"?: string | undefined;
|
|
94
|
+
"aria-current"?: boolean | "time" | "date" | "true" | "false" | "page" | "step" | "location" | undefined;
|
|
95
|
+
"aria-describedby"?: string | undefined;
|
|
96
|
+
"aria-description"?: string | undefined;
|
|
97
|
+
"aria-details"?: string | undefined;
|
|
98
|
+
"aria-disabled"?: (boolean | "true" | "false") | undefined;
|
|
99
|
+
"aria-dropeffect"?: "link" | "none" | "copy" | "execute" | "move" | "popup" | undefined;
|
|
100
|
+
"aria-errormessage"?: string | undefined;
|
|
101
|
+
"aria-expanded"?: (boolean | "true" | "false") | undefined;
|
|
102
|
+
"aria-flowto"?: string | undefined;
|
|
103
|
+
"aria-grabbed"?: (boolean | "true" | "false") | undefined;
|
|
104
|
+
"aria-haspopup"?: boolean | "dialog" | "menu" | "true" | "false" | "grid" | "listbox" | "tree" | undefined;
|
|
105
|
+
"aria-hidden"?: (boolean | "true" | "false") | undefined;
|
|
106
|
+
"aria-invalid"?: boolean | "true" | "false" | "grammar" | "spelling" | undefined;
|
|
107
|
+
"aria-keyshortcuts"?: string | undefined;
|
|
108
|
+
"aria-label"?: string | undefined;
|
|
109
|
+
"aria-labelledby"?: string | undefined;
|
|
110
|
+
"aria-level"?: number | undefined;
|
|
111
|
+
"aria-live"?: "off" | "assertive" | "polite" | undefined;
|
|
112
|
+
"aria-modal"?: (boolean | "true" | "false") | undefined;
|
|
113
|
+
"aria-multiline"?: (boolean | "true" | "false") | undefined;
|
|
114
|
+
"aria-multiselectable"?: (boolean | "true" | "false") | undefined;
|
|
115
|
+
"aria-orientation"?: "horizontal" | "vertical" | undefined;
|
|
116
|
+
"aria-owns"?: string | undefined;
|
|
117
|
+
"aria-placeholder"?: string | undefined;
|
|
118
|
+
"aria-posinset"?: number | undefined;
|
|
119
|
+
"aria-pressed"?: boolean | "true" | "false" | "mixed" | undefined;
|
|
120
|
+
"aria-readonly"?: (boolean | "true" | "false") | undefined;
|
|
121
|
+
"aria-relevant"?: "text" | "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefined;
|
|
122
|
+
"aria-required"?: (boolean | "true" | "false") | undefined;
|
|
123
|
+
"aria-roledescription"?: string | undefined;
|
|
124
|
+
"aria-rowcount"?: number | undefined;
|
|
125
|
+
"aria-rowindex"?: number | undefined;
|
|
126
|
+
"aria-rowindextext"?: string | undefined;
|
|
127
|
+
"aria-rowspan"?: number | undefined;
|
|
128
|
+
"aria-selected"?: (boolean | "true" | "false") | undefined;
|
|
129
|
+
"aria-setsize"?: number | undefined;
|
|
130
|
+
"aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined;
|
|
131
|
+
"aria-valuemax"?: number | undefined;
|
|
132
|
+
"aria-valuemin"?: number | undefined;
|
|
133
|
+
"aria-valuenow"?: number | undefined;
|
|
134
|
+
"aria-valuetext"?: string | undefined;
|
|
135
|
+
children?: React.ReactNode;
|
|
136
|
+
dangerouslySetInnerHTML?: {
|
|
137
|
+
__html: string | TrustedHTML;
|
|
138
|
+
} | undefined;
|
|
139
|
+
onCopy?: React.ClipboardEventHandler<HTMLButtonElement> | undefined;
|
|
140
|
+
onCopyCapture?: React.ClipboardEventHandler<HTMLButtonElement> | undefined;
|
|
141
|
+
onCut?: React.ClipboardEventHandler<HTMLButtonElement> | undefined;
|
|
142
|
+
onCutCapture?: React.ClipboardEventHandler<HTMLButtonElement> | undefined;
|
|
143
|
+
onPaste?: React.ClipboardEventHandler<HTMLButtonElement> | undefined;
|
|
144
|
+
onPasteCapture?: React.ClipboardEventHandler<HTMLButtonElement> | undefined;
|
|
145
|
+
onCompositionEnd?: React.CompositionEventHandler<HTMLButtonElement> | undefined;
|
|
146
|
+
onCompositionEndCapture?: React.CompositionEventHandler<HTMLButtonElement> | undefined;
|
|
147
|
+
onCompositionStart?: React.CompositionEventHandler<HTMLButtonElement> | undefined;
|
|
148
|
+
onCompositionStartCapture?: React.CompositionEventHandler<HTMLButtonElement> | undefined;
|
|
149
|
+
onCompositionUpdate?: React.CompositionEventHandler<HTMLButtonElement> | undefined;
|
|
150
|
+
onCompositionUpdateCapture?: React.CompositionEventHandler<HTMLButtonElement> | undefined;
|
|
151
|
+
onFocus?: React.FocusEventHandler<HTMLButtonElement> | undefined;
|
|
152
|
+
onFocusCapture?: React.FocusEventHandler<HTMLButtonElement> | undefined;
|
|
153
|
+
onBlur?: React.FocusEventHandler<HTMLButtonElement> | undefined;
|
|
154
|
+
onBlurCapture?: React.FocusEventHandler<HTMLButtonElement> | undefined;
|
|
155
|
+
onChange?: React.FormEventHandler<HTMLButtonElement> | undefined;
|
|
156
|
+
onChangeCapture?: React.FormEventHandler<HTMLButtonElement> | undefined;
|
|
157
|
+
onBeforeInput?: React.FormEventHandler<HTMLButtonElement> | undefined;
|
|
158
|
+
onBeforeInputCapture?: React.FormEventHandler<HTMLButtonElement> | undefined;
|
|
159
|
+
onInput?: React.FormEventHandler<HTMLButtonElement> | undefined;
|
|
160
|
+
onInputCapture?: React.FormEventHandler<HTMLButtonElement> | undefined;
|
|
161
|
+
onReset?: React.FormEventHandler<HTMLButtonElement> | undefined;
|
|
162
|
+
onResetCapture?: React.FormEventHandler<HTMLButtonElement> | undefined;
|
|
163
|
+
onSubmit?: React.FormEventHandler<HTMLButtonElement> | undefined;
|
|
164
|
+
onSubmitCapture?: React.FormEventHandler<HTMLButtonElement> | undefined;
|
|
165
|
+
onInvalid?: React.FormEventHandler<HTMLButtonElement> | undefined;
|
|
166
|
+
onInvalidCapture?: React.FormEventHandler<HTMLButtonElement> | undefined;
|
|
167
|
+
onLoad?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
168
|
+
onLoadCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
169
|
+
onError?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
170
|
+
onErrorCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
171
|
+
onKeyDown?: React.KeyboardEventHandler<HTMLButtonElement> | undefined;
|
|
172
|
+
onKeyDownCapture?: React.KeyboardEventHandler<HTMLButtonElement> | undefined;
|
|
173
|
+
onKeyPress?: React.KeyboardEventHandler<HTMLButtonElement> | undefined;
|
|
174
|
+
onKeyPressCapture?: React.KeyboardEventHandler<HTMLButtonElement> | undefined;
|
|
175
|
+
onKeyUp?: React.KeyboardEventHandler<HTMLButtonElement> | undefined;
|
|
176
|
+
onKeyUpCapture?: React.KeyboardEventHandler<HTMLButtonElement> | undefined;
|
|
177
|
+
onAbort?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
178
|
+
onAbortCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
179
|
+
onCanPlay?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
180
|
+
onCanPlayCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
181
|
+
onCanPlayThrough?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
182
|
+
onCanPlayThroughCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
183
|
+
onDurationChange?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
184
|
+
onDurationChangeCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
185
|
+
onEmptied?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
186
|
+
onEmptiedCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
187
|
+
onEncrypted?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
188
|
+
onEncryptedCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
189
|
+
onEnded?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
190
|
+
onEndedCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
191
|
+
onLoadedData?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
192
|
+
onLoadedDataCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
193
|
+
onLoadedMetadata?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
194
|
+
onLoadedMetadataCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
195
|
+
onLoadStart?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
196
|
+
onLoadStartCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
197
|
+
onPause?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
198
|
+
onPauseCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
199
|
+
onPlay?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
200
|
+
onPlayCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
201
|
+
onPlaying?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
202
|
+
onPlayingCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
203
|
+
onProgress?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
204
|
+
onProgressCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
205
|
+
onRateChange?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
206
|
+
onRateChangeCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
207
|
+
onResize?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
208
|
+
onResizeCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
209
|
+
onSeeked?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
210
|
+
onSeekedCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
211
|
+
onSeeking?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
212
|
+
onSeekingCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
213
|
+
onStalled?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
214
|
+
onStalledCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
215
|
+
onSuspend?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
216
|
+
onSuspendCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
217
|
+
onTimeUpdate?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
218
|
+
onTimeUpdateCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
219
|
+
onVolumeChange?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
220
|
+
onVolumeChangeCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
221
|
+
onWaiting?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
222
|
+
onWaitingCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
223
|
+
onAuxClick?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
224
|
+
onAuxClickCapture?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
225
|
+
onClick?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
226
|
+
onClickCapture?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
227
|
+
onContextMenu?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
228
|
+
onContextMenuCapture?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
229
|
+
onDoubleClick?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
230
|
+
onDoubleClickCapture?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
231
|
+
onDrag?: React.DragEventHandler<HTMLButtonElement> | undefined;
|
|
232
|
+
onDragCapture?: React.DragEventHandler<HTMLButtonElement> | undefined;
|
|
233
|
+
onDragEnd?: React.DragEventHandler<HTMLButtonElement> | undefined;
|
|
234
|
+
onDragEndCapture?: React.DragEventHandler<HTMLButtonElement> | undefined;
|
|
235
|
+
onDragEnter?: React.DragEventHandler<HTMLButtonElement> | undefined;
|
|
236
|
+
onDragEnterCapture?: React.DragEventHandler<HTMLButtonElement> | undefined;
|
|
237
|
+
onDragExit?: React.DragEventHandler<HTMLButtonElement> | undefined;
|
|
238
|
+
onDragExitCapture?: React.DragEventHandler<HTMLButtonElement> | undefined;
|
|
239
|
+
onDragLeave?: React.DragEventHandler<HTMLButtonElement> | undefined;
|
|
240
|
+
onDragLeaveCapture?: React.DragEventHandler<HTMLButtonElement> | undefined;
|
|
241
|
+
onDragOver?: React.DragEventHandler<HTMLButtonElement> | undefined;
|
|
242
|
+
onDragOverCapture?: React.DragEventHandler<HTMLButtonElement> | undefined;
|
|
243
|
+
onDragStart?: React.DragEventHandler<HTMLButtonElement> | undefined;
|
|
244
|
+
onDragStartCapture?: React.DragEventHandler<HTMLButtonElement> | undefined;
|
|
245
|
+
onDrop?: React.DragEventHandler<HTMLButtonElement> | undefined;
|
|
246
|
+
onDropCapture?: React.DragEventHandler<HTMLButtonElement> | undefined;
|
|
247
|
+
onMouseDown?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
248
|
+
onMouseDownCapture?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
249
|
+
onMouseEnter?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
250
|
+
onMouseLeave?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
251
|
+
onMouseMove?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
252
|
+
onMouseMoveCapture?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
253
|
+
onMouseOut?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
254
|
+
onMouseOutCapture?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
255
|
+
onMouseOver?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
256
|
+
onMouseOverCapture?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
257
|
+
onMouseUp?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
258
|
+
onMouseUpCapture?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
259
|
+
onSelect?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
260
|
+
onSelectCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
261
|
+
onTouchCancel?: React.TouchEventHandler<HTMLButtonElement> | undefined;
|
|
262
|
+
onTouchCancelCapture?: React.TouchEventHandler<HTMLButtonElement> | undefined;
|
|
263
|
+
onTouchEnd?: React.TouchEventHandler<HTMLButtonElement> | undefined;
|
|
264
|
+
onTouchEndCapture?: React.TouchEventHandler<HTMLButtonElement> | undefined;
|
|
265
|
+
onTouchMove?: React.TouchEventHandler<HTMLButtonElement> | undefined;
|
|
266
|
+
onTouchMoveCapture?: React.TouchEventHandler<HTMLButtonElement> | undefined;
|
|
267
|
+
onTouchStart?: React.TouchEventHandler<HTMLButtonElement> | undefined;
|
|
268
|
+
onTouchStartCapture?: React.TouchEventHandler<HTMLButtonElement> | undefined;
|
|
269
|
+
onPointerDown?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
270
|
+
onPointerDownCapture?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
271
|
+
onPointerMove?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
272
|
+
onPointerMoveCapture?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
273
|
+
onPointerUp?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
274
|
+
onPointerUpCapture?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
275
|
+
onPointerCancel?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
276
|
+
onPointerCancelCapture?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
277
|
+
onPointerEnter?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
278
|
+
onPointerLeave?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
279
|
+
onPointerOver?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
280
|
+
onPointerOverCapture?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
281
|
+
onPointerOut?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
282
|
+
onPointerOutCapture?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
283
|
+
onGotPointerCapture?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
284
|
+
onGotPointerCaptureCapture?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
285
|
+
onLostPointerCapture?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
286
|
+
onLostPointerCaptureCapture?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
287
|
+
onScroll?: React.UIEventHandler<HTMLButtonElement> | undefined;
|
|
288
|
+
onScrollCapture?: React.UIEventHandler<HTMLButtonElement> | undefined;
|
|
289
|
+
onWheel?: React.WheelEventHandler<HTMLButtonElement> | undefined;
|
|
290
|
+
onWheelCapture?: React.WheelEventHandler<HTMLButtonElement> | undefined;
|
|
291
|
+
onAnimationStart?: React.AnimationEventHandler<HTMLButtonElement> | undefined;
|
|
292
|
+
onAnimationStartCapture?: React.AnimationEventHandler<HTMLButtonElement> | undefined;
|
|
293
|
+
onAnimationEnd?: React.AnimationEventHandler<HTMLButtonElement> | undefined;
|
|
294
|
+
onAnimationEndCapture?: React.AnimationEventHandler<HTMLButtonElement> | undefined;
|
|
295
|
+
onAnimationIteration?: React.AnimationEventHandler<HTMLButtonElement> | undefined;
|
|
296
|
+
onAnimationIterationCapture?: React.AnimationEventHandler<HTMLButtonElement> | undefined;
|
|
297
|
+
onTransitionEnd?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
298
|
+
onTransitionEndCapture?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
299
|
+
ref?: React.LegacyRef<HTMLButtonElement> | undefined;
|
|
300
|
+
key?: React.Key | null | undefined;
|
|
301
|
+
}>) => React.JSX.Element)[];
|
|
302
|
+
};
|
|
303
|
+
export default meta;
|
|
304
|
+
type Story = StoryObj<typeof meta>;
|
|
305
|
+
/**
|
|
306
|
+
* The component contains styles that will automatically adjust the size of any svg you add as a child.
|
|
307
|
+
* However the Design System uses a different size for icons if they are the _only_ thing in the button.
|
|
308
|
+
* To handle this we add the prop `iconOnly`.
|
|
309
|
+
*/
|
|
310
|
+
export declare const IconOnly: Story;
|
|
311
|
+
export declare const TextOnly: Story;
|
|
312
|
+
/**
|
|
313
|
+
* The Button doesn't technically have any controls to position the icon. The Button can accept any content as its children, so if you want to add an icon at the end of text, you simply add both as children in that order:
|
|
314
|
+
*/
|
|
315
|
+
export declare const TextWithIconAtEnd: Story;
|
|
316
|
+
/**
|
|
317
|
+
* Or to put it at the start you just... put it at the start:
|
|
318
|
+
*/
|
|
319
|
+
export declare const TextWithIconAtStart: Story;
|
|
320
|
+
export declare const Loading: Story;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Attach from '../../../assets/icons/attach.svg';
|
|
3
|
+
import { TooltipProvider } from '../tooltip/tooltip.component';
|
|
4
|
+
import { Button } from './button.component';
|
|
5
|
+
import { useState } from 'react';
|
|
6
|
+
// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction
|
|
7
|
+
const meta = {
|
|
8
|
+
title: 'Design System/Atoms/Button',
|
|
9
|
+
component: Button,
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
argTypes: {
|
|
12
|
+
disabled: { control: 'boolean' },
|
|
13
|
+
onClick: { action: 'clicked' },
|
|
14
|
+
},
|
|
15
|
+
decorators: [
|
|
16
|
+
(Story) => (React.createElement(React.Fragment, null,
|
|
17
|
+
React.createElement(TooltipProvider, null,
|
|
18
|
+
React.createElement(Story, null)))),
|
|
19
|
+
],
|
|
20
|
+
};
|
|
21
|
+
export default meta;
|
|
22
|
+
/**
|
|
23
|
+
* The component contains styles that will automatically adjust the size of any svg you add as a child.
|
|
24
|
+
* However the Design System uses a different size for icons if they are the _only_ thing in the button.
|
|
25
|
+
* To handle this we add the prop `iconOnly`.
|
|
26
|
+
*/
|
|
27
|
+
export const IconOnly = {
|
|
28
|
+
render: (args) => (React.createElement(Button, { ...args },
|
|
29
|
+
React.createElement(Attach, null))),
|
|
30
|
+
args: {
|
|
31
|
+
iconOnly: true,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
export const TextOnly = {
|
|
35
|
+
args: {
|
|
36
|
+
children: 'Button',
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* The Button doesn't technically have any controls to position the icon. The Button can accept any content as its children, so if you want to add an icon at the end of text, you simply add both as children in that order:
|
|
41
|
+
*/
|
|
42
|
+
export const TextWithIconAtEnd = {
|
|
43
|
+
render: (args) => (React.createElement(Button, { ...args },
|
|
44
|
+
"Attach ",
|
|
45
|
+
React.createElement(Attach, null))),
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Or to put it at the start you just... put it at the start:
|
|
49
|
+
*/
|
|
50
|
+
export const TextWithIconAtStart = {
|
|
51
|
+
render: (args) => (React.createElement(Button, { ...args },
|
|
52
|
+
React.createElement(Attach, null),
|
|
53
|
+
" Attach")),
|
|
54
|
+
};
|
|
55
|
+
export const Loading = {
|
|
56
|
+
render: function Render(args) {
|
|
57
|
+
const [loading, setLoading] = useState(false);
|
|
58
|
+
const handleClick = () => {
|
|
59
|
+
setLoading(true);
|
|
60
|
+
setTimeout(() => {
|
|
61
|
+
setLoading(false);
|
|
62
|
+
}, 2000);
|
|
63
|
+
};
|
|
64
|
+
return (React.createElement(Button, { ...args, loading: loading, onClick: handleClick }, args.children || 'Slow loading button'));
|
|
65
|
+
},
|
|
66
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Questionable whether these tests are even useful.
|
|
2
|
+
// Included as wanted to have test file for a component to show preferred architecture of UI library.
|
|
3
|
+
// Maybe we will remove this in a future update and only include tests that are genuinely useful.
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { describe, it, expect } from 'vitest';
|
|
6
|
+
import { render, screen, fireEvent } from '@testing-library/react';
|
|
7
|
+
import { Button } from './button.component';
|
|
8
|
+
import { TooltipProvider } from '../tooltip/tooltip.component';
|
|
9
|
+
describe('Renders a button', async () => {
|
|
10
|
+
it('Renders the supplied children', async () => {
|
|
11
|
+
render(React.createElement(Button, null, "Hello"));
|
|
12
|
+
const b = await screen.queryByText('Hello');
|
|
13
|
+
expect(b).toBeInTheDocument();
|
|
14
|
+
});
|
|
15
|
+
it('Renders as a button', async () => {
|
|
16
|
+
render(React.createElement(Button, null, "Hello"));
|
|
17
|
+
const b = await screen.queryByText('Hello');
|
|
18
|
+
expect(b?.tagName.toLowerCase()).toBe('button');
|
|
19
|
+
});
|
|
20
|
+
it('Includes the tooltip when specified', async () => {
|
|
21
|
+
render(React.createElement(TooltipProvider, null,
|
|
22
|
+
React.createElement(Button, { "data-testid": "btn", tooltip: "bye" }, "Hello")));
|
|
23
|
+
const button = await screen.getByTestId('btn');
|
|
24
|
+
fireEvent.mouseOver(button);
|
|
25
|
+
setTimeout(async () => {
|
|
26
|
+
//delay for tooltip to be available in DOM
|
|
27
|
+
const t = await screen.queryByText('bye');
|
|
28
|
+
expect(t).toBeInTheDocument();
|
|
29
|
+
}, 1000);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
2
|
+
import { LinkProps } from 'react-router-dom';
|
|
3
|
+
export type ButtonProps = {
|
|
4
|
+
/** Optional tooltip content */
|
|
5
|
+
tooltip?: string;
|
|
6
|
+
/** What level of button? Defaults to 'primary' */
|
|
7
|
+
level?: 'primary' | 'secondary';
|
|
8
|
+
/** What variant of button? Defaults to 'brand' */
|
|
9
|
+
variant?: 'brand' | 'danger' | 'accent' | 'neutral';
|
|
10
|
+
/** What size of button? Defaults to 'm' */
|
|
11
|
+
scale?: 'xl' | 'l' | 'm' | 's' | 'xs' | 'xxs';
|
|
12
|
+
/** Does the button only include a single SVG? If so we will tweak styles. Defaults to false. */
|
|
13
|
+
iconOnly?: boolean;
|
|
14
|
+
/** What kind of focus of button? Defaults to 'visible' */
|
|
15
|
+
focus?: 'visible' | 'focus' | 'none';
|
|
16
|
+
/** should we replace content with a loading indicator */
|
|
17
|
+
loading?: boolean;
|
|
18
|
+
/** ClassName to add so you can add additional styling */
|
|
19
|
+
className?: string;
|
|
20
|
+
};
|
|
21
|
+
export type LinkButtonProps = Omit<ButtonProps, 'loading'> & {
|
|
22
|
+
/** The location the link will take you to */
|
|
23
|
+
to: string;
|
|
24
|
+
/** The underlaying UI component to use */
|
|
25
|
+
Component: ForwardRefExoticComponent<LinkProps & RefAttributes<HTMLAnchorElement>>;
|
|
26
|
+
};
|
|
27
|
+
export type ToggleButtonProps = Omit<ButtonProps, 'variant'> & {
|
|
28
|
+
/** Optionally pass an extra classname to the label wrapper */
|
|
29
|
+
labelClassName?: string;
|
|
30
|
+
/** Optionally pass an extra classname to the content wrapper */
|
|
31
|
+
contentClassName?: string;
|
|
32
|
+
/** Optionally pass an active state. If not passed the component will be uncontrolled. */
|
|
33
|
+
active?: boolean;
|
|
34
|
+
/** What variant of button? Defaults to 'brand' */
|
|
35
|
+
variant?: 'brand' | 'accent';
|
|
36
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|