grevlingui 0.1.44 → 0.2.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/LICENSE +21 -0
- package/README.md +204 -72
- package/dist/Buttons/MenuButton.d.ts +12 -0
- package/dist/Buttons/ResetButton.d.ts +6 -0
- package/dist/Buttons/SettingsButton.d.ts +13 -0
- package/dist/CheckBox.d.ts +10 -0
- package/dist/Loader/Loader.d.ts +6 -0
- package/dist/Menu/Menu.d.ts +19 -0
- package/dist/NumberSelect/NumberSelect.d.ts +16 -0
- package/dist/PaneView/PaneView.d.ts +7 -0
- package/dist/Radio/RadioButton.d.ts +8 -0
- package/dist/Radio/RadioGroup.d.ts +12 -0
- package/dist/Radio/index.d.ts +4 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +583 -0
- package/package.json +47 -15
- package/Buttons/Buttons.css +0 -64
- package/Buttons/MenuButton.js +0 -78
- package/Buttons/ResetButton.js +0 -56
- package/Buttons/SettingsButton.js +0 -97
- package/CheckBox.js +0 -143
- package/Dots/Dots.css +0 -27
- package/Dots/Dots.js +0 -34
- package/Loader/Loader.css +0 -26
- package/Loader/Loader.js +0 -67
- package/Menu/Menu.css +0 -91
- package/Menu/Menu.js +0 -103
- package/NumberSelect/NumberSelect.css +0 -107
- package/NumberSelect/NumberSelect.js +0 -268
- package/NumberSliderSelect/NumberSliderSelect.css +0 -110
- package/NumberSliderSelect/NumberSliderSelect.js +0 -199
- package/PaneView/PaneView.css +0 -31
- package/PaneView/PaneView.js +0 -36
- package/Radio/RadioButton.js +0 -53
- package/Radio/RadioGroup.js +0 -32
- package/Radio/index.js +0 -19
- package/SunMoon.js +0 -57
- package/ToggleSwitch.js +0 -55
- package/index.js +0 -117
- package/utils/UseEffectOnce.js +0 -12
- package/utils/UseEffectPartialDeps.js +0 -12
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022-2026 Sigve Grevling
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,81 +1,213 @@
|
|
|
1
|
-
#
|
|
1
|
+
# grevlingui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Animated GUI elements for basic mobile web app stuff. Written in TypeScript, for React 18 and 19.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
```sh
|
|
6
|
+
npm install grevlingui
|
|
7
|
+
```
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
- MenuButton
|
|
10
|
-
- RadioButton
|
|
11
|
-
- RadioGroup
|
|
12
|
-
- CheckBox
|
|
13
|
-
- ToggleSwitch
|
|
9
|
+
```tsx
|
|
10
|
+
import {CheckBox} from 'grevlingui';
|
|
14
11
|
|
|
15
|
-
|
|
12
|
+
const [checked, setChecked] = useState(false);
|
|
16
13
|
|
|
17
|
-
|
|
14
|
+
<CheckBox checked={checked} setChecked={setChecked} label="Dark mode"/>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Styles are included automatically when you import a component, so there is no stylesheet to import. Every props type is exported too (`CheckBoxProps`, `MenuProps`, ...).
|
|
18
|
+
|
|
19
|
+
## Components
|
|
20
|
+
|
|
21
|
+
- [Menu](#menu)
|
|
22
|
+
- [MenuButton](#menubutton)
|
|
23
|
+
- [SettingsButton](#settingsbutton)
|
|
24
|
+
- [ResetButton](#resetbutton)
|
|
25
|
+
- [CheckBox](#checkbox)
|
|
26
|
+
- [RadioGroup](#radiogroup)
|
|
27
|
+
- [RadioButton](#radiobutton)
|
|
28
|
+
- [NumberSelect](#numberselect)
|
|
29
|
+
- [PaneView](#paneview)
|
|
30
|
+
- [Loader](#loader)
|
|
31
|
+
|
|
32
|
+
Most components default to `white` and are meant for dark backgrounds.
|
|
18
33
|
|
|
19
34
|
### Menu
|
|
20
|
-
- onCloseClickOverride
|
|
21
|
-
- callback function allowing reuse of close menu button
|
|
22
|
-
- shouldCloseOnClick
|
|
23
|
-
- callback function to "validate" whether the click should cause the menu to close
|
|
24
|
-
- transitionTime
|
|
25
|
-
- default 400
|
|
26
|
-
- zIndex
|
|
27
|
-
- the lowest z-index, there are different levels
|
|
28
|
-
- default 2
|
|
29
|
-
- color
|
|
30
|
-
- bgColor
|
|
31
|
-
- menuBgColor
|
|
32
|
-
- overrides bgColor
|
|
33
|
-
- backdropColor
|
|
34
|
-
- color for the backdrop on partial slider menu
|
|
35
|
-
- default #e3e6e850
|
|
36
|
-
- settings
|
|
37
|
-
- boolean, whether to use settings icon
|
|
38
|
-
- default falsy
|
|
39
|
-
- renderButton
|
|
40
|
-
- render function for custom button
|
|
41
|
-
- className
|
|
42
|
-
- extra class names for the menu
|
|
43
|
-
- fullSlider
|
|
44
|
-
- boolean, whether the slider menu should cover the entire available width
|
|
45
|
-
- default falsy
|
|
46
|
-
- fader
|
|
47
|
-
- boolean, whether the menu should fade instead of sliding in from the side
|
|
48
|
-
- left
|
|
49
|
-
- boolean, makes the menu slide in from the left instead of the right
|
|
50
|
-
- default falsy
|
|
51
|
-
|
|
52
|
-
### SettingsButton / MenuButton
|
|
53
|
-
- open
|
|
54
|
-
- boolean, whether to display as a close button
|
|
55
|
-
- setOpen
|
|
56
|
-
- callback function to set the open state
|
|
57
|
-
- transitionTime
|
|
58
|
-
- in ms
|
|
59
|
-
- default 300
|
|
60
|
-
- stageDelay
|
|
61
|
-
- delay between the 2 "stages" in the animation
|
|
62
|
-
- default 100
|
|
63
|
-
- color
|
|
64
|
-
- default 'white'
|
|
65
|
-
- backgroundColor
|
|
66
|
-
- styles
|
|
67
|
-
- style override for the button
|
|
68
|
-
- className
|
|
69
|
-
- extra class names for the button
|
|
70
|
-
- rounding
|
|
71
|
-
- SettingsButton only
|
|
72
|
-
- how rounded the icon should be
|
|
73
35
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
36
|
+
A drawer that slides in from the side, with its own toggle button. It manages its own open state.
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
<Menu>
|
|
40
|
+
<a href="/">Home</a>
|
|
41
|
+
<a href="/settings">Settings</a>
|
|
42
|
+
</Menu>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
| Prop | Type | Default | Description |
|
|
46
|
+
|---|---|---|---|
|
|
47
|
+
| `children` | `ReactNode` | | Menu content |
|
|
48
|
+
| `transitionTime` | `number` | `300` | Open/close animation in ms |
|
|
49
|
+
| `zIndex` | `number` | `2` | Lowest z-index used. The menu and button stack above it |
|
|
50
|
+
| `color` | `string` | `'white'` | Text and button icon color |
|
|
51
|
+
| `bgColor` | `string` | `'#333'` | Button background, and menu background unless `menuBgColor` is set |
|
|
52
|
+
| `menuBgColor` | `string` | `bgColor` | Menu background |
|
|
53
|
+
| `backdropColor` | `string` | `'#22222266'` | Backdrop behind a partial slider |
|
|
54
|
+
| `left` | `boolean` | | Slide in from the left instead of the right |
|
|
55
|
+
| `fullSlider` | `boolean` | | Cover the whole screen instead of part of it |
|
|
56
|
+
| `fader` | `boolean` | | Fade in instead of sliding |
|
|
57
|
+
| `settings` | `boolean` | | Use a gear (`SettingsButton`) instead of a burger (`MenuButton`) |
|
|
58
|
+
| `shouldCloseOnClick` | `(e) => boolean` | | Called on clicks inside the menu. Return `true` to close it |
|
|
59
|
+
| `onCloseClickOverride` | `() => void` | | If set, the button shows as "close" and calls this instead of toggling the menu. Useful for reusing the close button, for example in a sub-page |
|
|
60
|
+
| `renderButton` | `(show, setShow, transitionTime, color, bgColor) => ReactNode` | | Render your own toggle button |
|
|
61
|
+
| `className` | `string` | | Extra class on the menu container |
|
|
62
|
+
|
|
63
|
+
### MenuButton
|
|
64
|
+
|
|
65
|
+
An animated burger button that morphs into an X. Used by `Menu`, but works on its own.
|
|
66
|
+
|
|
67
|
+
| Prop | Type | Default | Description |
|
|
68
|
+
|---|---|---|---|
|
|
69
|
+
| `open` | `boolean` | | Required |
|
|
70
|
+
| `setOpen` | `(open: boolean) => void` | | Required |
|
|
71
|
+
| `transitionTime` | `number` | `300` | Animation per stage in ms |
|
|
72
|
+
| `stageDelay` | `number` | `100` | Delay between animation stages in ms |
|
|
73
|
+
| `color` | `string` | | Icon color |
|
|
74
|
+
| `backgroundColor` | `string` | | |
|
|
75
|
+
| `styles` | `CSSProperties` | | Inline styles for the button |
|
|
76
|
+
| `className` | `string` | | |
|
|
77
|
+
|
|
78
|
+
### SettingsButton
|
|
79
|
+
|
|
80
|
+
An animated gear button that morphs into an X. Same props as `MenuButton`, plus:
|
|
81
|
+
|
|
82
|
+
| Prop | Type | Default | Description |
|
|
83
|
+
|---|---|---|---|
|
|
84
|
+
| `color` | `string` | `'white'` | Icon color |
|
|
85
|
+
| `rounding` | `number` | `7` | Corner radius of the gear teeth |
|
|
86
|
+
|
|
87
|
+
### ResetButton
|
|
88
|
+
|
|
89
|
+
A reset arrow that spins when clicked.
|
|
90
|
+
|
|
91
|
+
| Prop | Type | Default | Description |
|
|
92
|
+
|---|---|---|---|
|
|
93
|
+
| `onClick` | `() => void` | | |
|
|
94
|
+
| `color` | `string` | `'white'` | Icon color |
|
|
95
|
+
| `backgroundColor` | `string` | | |
|
|
96
|
+
|
|
78
97
|
### CheckBox
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
98
|
+
|
|
99
|
+
An animated checkbox with an optional label.
|
|
100
|
+
|
|
101
|
+
| Prop | Type | Default | Description |
|
|
102
|
+
|---|---|---|---|
|
|
103
|
+
| `checked` | `boolean` | | Required |
|
|
104
|
+
| `setChecked` | `(checked: boolean) => void` | | Required |
|
|
105
|
+
| `label` | `ReactNode` | | |
|
|
106
|
+
| `color` | `string` | `'white'` | |
|
|
107
|
+
| `v2` | `boolean` | | Alternative style where the box morphs into a check mark |
|
|
108
|
+
| `time` | `number` | `200` | Animation time in ms |
|
|
109
|
+
|
|
110
|
+
### RadioGroup
|
|
111
|
+
|
|
112
|
+
A list of radio buttons. The key type is generic, so `onSelect` gets the same type as your option keys.
|
|
113
|
+
|
|
114
|
+
```tsx
|
|
115
|
+
const [size, setSize] = useState<'s' | 'm' | 'l'>('m');
|
|
116
|
+
|
|
117
|
+
<RadioGroup
|
|
118
|
+
options={[
|
|
119
|
+
{key: 's', label: 'Small'},
|
|
120
|
+
{key: 'm', label: 'Medium'},
|
|
121
|
+
{key: 'l', label: 'Large'},
|
|
122
|
+
]}
|
|
123
|
+
selected={size}
|
|
124
|
+
onSelect={setSize}
|
|
125
|
+
/>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
| Prop | Type | Default | Description |
|
|
129
|
+
|---|---|---|---|
|
|
130
|
+
| `options` | `RadioOption<K>[]` | | Required. `{key: K, label: ReactNode}` where `K` is `string \| number` |
|
|
131
|
+
| `selected` | `K` | | Key of the selected option |
|
|
132
|
+
| `onSelect` | `(key: K) => void` | | Required |
|
|
133
|
+
| `color` | `string` | | |
|
|
134
|
+
|
|
135
|
+
### RadioButton
|
|
136
|
+
|
|
137
|
+
A single radio button, as used by `RadioGroup`. It has no click handler of its own, so wrap it in something clickable.
|
|
138
|
+
|
|
139
|
+
| Prop | Type | Default | Description |
|
|
140
|
+
|---|---|---|---|
|
|
141
|
+
| `active` | `boolean` | | Required |
|
|
142
|
+
| `text` | `ReactNode` | | Label |
|
|
143
|
+
| `color` | `string` | | |
|
|
144
|
+
| `className` | `string` | | Class on the svg |
|
|
145
|
+
|
|
146
|
+
### NumberSelect
|
|
147
|
+
|
|
148
|
+
A round number picker for touch screens. By default you swipe up or down on it to change the value. With `noFlick`, tapping opens + and − buttons instead.
|
|
149
|
+
|
|
150
|
+
```tsx
|
|
151
|
+
const [players, setPlayers] = useState(2);
|
|
152
|
+
|
|
153
|
+
<NumberSelect value={players} setValue={setPlayers} min={1} max={8}/>
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
| Prop | Type | Default | Description |
|
|
157
|
+
|---|---|---|---|
|
|
158
|
+
| `value` | `number` | | Required |
|
|
159
|
+
| `setValue` | `(value: number) => void` | | Required |
|
|
160
|
+
| `min` | `number` | `1` | |
|
|
161
|
+
| `max` | `number` | `10` | |
|
|
162
|
+
| `size` | `number` | `5` | Diameter in rem |
|
|
163
|
+
| `color` | `string` | `'white'` | Number and icon color |
|
|
164
|
+
| `numberBgColor` | `string` | `'#663399'` | Circle color. Use a 6-digit hex, because transparency is appended to it |
|
|
165
|
+
| `selectorColor` | `string` | `'#1E90FF'` | Color of the +/− buttons |
|
|
166
|
+
| `noFlick` | `boolean` | `false` | Turn off swiping and use tap-to-open +/− buttons instead |
|
|
167
|
+
| `timeout` | `number` | `1000` | Close the +/− buttons after this many ms without input. `0` keeps them open |
|
|
168
|
+
| `closed` | `boolean` | | Close the +/− buttons when this becomes `true` |
|
|
169
|
+
| `onOpenInput` | `() => void` | | Called when the +/− buttons open |
|
|
170
|
+
| `invert` | `boolean` | `false` | Reverse the direction of the buttons and swipes |
|
|
171
|
+
|
|
172
|
+
### PaneView
|
|
173
|
+
|
|
174
|
+
Full-size panes that you swipe between horizontally, with scroll snapping. It fills its nearest positioned ancestor, so give the parent `position: relative` and a size.
|
|
175
|
+
|
|
176
|
+
```tsx
|
|
177
|
+
<div style={{position: 'relative', height: '100vh'}}>
|
|
178
|
+
<PaneView startOnPane={1}>
|
|
179
|
+
<div>Left</div>
|
|
180
|
+
<div>Middle</div>
|
|
181
|
+
<div>Right</div>
|
|
182
|
+
</PaneView>
|
|
183
|
+
</div>
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
| Prop | Type | Default | Description |
|
|
187
|
+
|---|---|---|---|
|
|
188
|
+
| `children` | `ReactNode` | | Each child becomes a pane |
|
|
189
|
+
| `startOnPane` | `number` | `0` | Index of the pane shown on mount |
|
|
190
|
+
| `styleOverride` | `CSSProperties` | | Inline styles for the scroll container |
|
|
191
|
+
|
|
192
|
+
### Loader
|
|
193
|
+
|
|
194
|
+
A spinning loading indicator.
|
|
195
|
+
|
|
196
|
+
| Prop | Type | Default | Description |
|
|
197
|
+
|---|---|---|---|
|
|
198
|
+
| `color` | `string` | `'black'` | |
|
|
199
|
+
| `size` | `string \| number` | `'10rem'` | Width and height |
|
|
200
|
+
| `speed` | `number` | `5000` | Time for one rotation in ms |
|
|
201
|
+
|
|
202
|
+
## Development
|
|
203
|
+
|
|
204
|
+
```sh
|
|
205
|
+
npm run dev # demo app (src/App.tsx) with all the components
|
|
206
|
+
npm run build # build the library into dist/
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
The library source lives in `src/Library`, and `src/Library/index.ts` is the package entry point.
|
|
210
|
+
|
|
211
|
+
## License
|
|
212
|
+
|
|
213
|
+
MIT
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CSSProperties } from "react";
|
|
2
|
+
export type MenuButtonProps = {
|
|
3
|
+
open: boolean;
|
|
4
|
+
setOpen: (open: boolean) => void;
|
|
5
|
+
transitionTime?: number;
|
|
6
|
+
stageDelay?: number;
|
|
7
|
+
color?: string;
|
|
8
|
+
backgroundColor?: string;
|
|
9
|
+
styles?: CSSProperties;
|
|
10
|
+
className?: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const MenuButton: ({ open, setOpen, transitionTime, stageDelay, color, backgroundColor, styles, className }: MenuButtonProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
export type SettingsButtonProps = {
|
|
3
|
+
open: boolean;
|
|
4
|
+
setOpen: (open: boolean) => void;
|
|
5
|
+
transitionTime?: number;
|
|
6
|
+
stageDelay?: number;
|
|
7
|
+
color?: string;
|
|
8
|
+
backgroundColor?: string;
|
|
9
|
+
styles?: CSSProperties;
|
|
10
|
+
className?: string;
|
|
11
|
+
rounding?: number;
|
|
12
|
+
};
|
|
13
|
+
export declare const SettingsButton: ({ open, setOpen, transitionTime, stageDelay, color, backgroundColor, styles, className, rounding }: SettingsButtonProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export type CheckBoxProps = {
|
|
3
|
+
checked: boolean;
|
|
4
|
+
setChecked: (checked: boolean) => void;
|
|
5
|
+
label?: ReactNode;
|
|
6
|
+
color?: string;
|
|
7
|
+
v2?: boolean;
|
|
8
|
+
time?: number;
|
|
9
|
+
};
|
|
10
|
+
export declare const CheckBox: ({ checked, setChecked, label, color, v2, time }: CheckBoxProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Dispatch, MouseEvent, ReactNode, SetStateAction } from 'react';
|
|
2
|
+
export type MenuProps = {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
onCloseClickOverride?: () => void;
|
|
5
|
+
shouldCloseOnClick?: (e: MouseEvent<HTMLDivElement>) => boolean;
|
|
6
|
+
transitionTime?: number;
|
|
7
|
+
zIndex?: number;
|
|
8
|
+
color?: string;
|
|
9
|
+
bgColor?: string;
|
|
10
|
+
menuBgColor?: string;
|
|
11
|
+
backdropColor?: string;
|
|
12
|
+
settings?: boolean;
|
|
13
|
+
renderButton?: (show: boolean, setShow: Dispatch<SetStateAction<boolean>>, transitionTime: number, color?: string, bgColor?: string) => ReactNode;
|
|
14
|
+
className?: string;
|
|
15
|
+
fullSlider?: boolean;
|
|
16
|
+
fader?: boolean;
|
|
17
|
+
left?: boolean;
|
|
18
|
+
};
|
|
19
|
+
export declare const Menu: ({ children, onCloseClickOverride, shouldCloseOnClick, transitionTime, zIndex, color, bgColor, menuBgColor, backdropColor, settings, renderButton, className, fullSlider, fader, left }: MenuProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type NumberSelectProps = {
|
|
2
|
+
value: number;
|
|
3
|
+
setValue: (value: number) => void;
|
|
4
|
+
min?: number;
|
|
5
|
+
max?: number;
|
|
6
|
+
size?: number;
|
|
7
|
+
color?: string;
|
|
8
|
+
numberBgColor?: string;
|
|
9
|
+
selectorColor?: string;
|
|
10
|
+
timeout?: number;
|
|
11
|
+
onOpenInput?: () => void;
|
|
12
|
+
closed?: boolean;
|
|
13
|
+
invert?: boolean;
|
|
14
|
+
noFlick?: boolean;
|
|
15
|
+
};
|
|
16
|
+
export declare const NumberSelect: ({ value, setValue, min, max, size, color, numberBgColor, selectorColor, timeout, onOpenInput, closed, invert, noFlick }: NumberSelectProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
export type PaneViewProps = {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
styleOverride?: CSSProperties;
|
|
5
|
+
startOnPane?: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const PaneView: ({ children, styleOverride, startOnPane }: PaneViewProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export type RadioButtonProps = {
|
|
3
|
+
active: boolean;
|
|
4
|
+
text?: ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
color?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const RadioButton: ({ active, text, className, color }: RadioButtonProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Key, ReactNode } from 'react';
|
|
2
|
+
export type RadioOption<K extends Key = string> = {
|
|
3
|
+
key: K;
|
|
4
|
+
label: ReactNode;
|
|
5
|
+
};
|
|
6
|
+
export type RadioGroupProps<K extends Key = string> = {
|
|
7
|
+
options: RadioOption<K>[];
|
|
8
|
+
selected?: K;
|
|
9
|
+
onSelect: (key: K) => void;
|
|
10
|
+
color?: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const RadioGroup: <K extends Key = string>({ options, selected, onSelect, color }: RadioGroupProps<K>) => import("react").JSX.Element;
|
package/dist/index.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.xburgerMenuButton{cursor:pointer;-webkit-tap-highlight-color:#fff0;border:none;border-radius:.5rem;outline:none;justify-content:center;align-items:center;width:50px;height:50px;padding:0;font-size:1.3em;display:flex}.xburgerMenu{padding-top:80px;position:fixed;top:0;bottom:0}.xburgerMenu.fader{left:0;right:0}.slider.xburgerMenu{left:calc(100vw + 20px);right:calc(-80vw - 20px)}.left.slider.xburgerMenu{left:calc(-80vw - 20px);right:calc(100vw + 20px)}.button{position:absolute;top:1rem}.button:not(.left){right:1rem}.left.button{left:1rem}.xburgerTouchOutsideSensor{opacity:0;pointer-events:none;position:absolute;inset:0}.xburgerTouchOutsideSensor.show{opacity:1;pointer-events:unset}.slider.xburgerMenu.show{left:0;right:0}.partial.slider.xburgerMenu.show:not(.left){left:20vw}.partial.left.slider.xburgerMenu.show{right:20vw}.xburgerMenu a *{pointer-events:none}.fader.xburgerMenu{opacity:1}.fader.xburgerMenu:not(.show){opacity:0;pointer-events:none}.settingsButton,.resetButton{background:0 0;border:none;outline:none}.resetButton,.settingsButton{border-radius:10px;width:50px;height:50px;padding:10px}.settingsButton svg{width:100%;height:100%}.resetButton{padding:5px}.resetButton svg{width:40px;height:40px}@-moz-keyframes spinCC{0%{-moz-transform:rotate(0)}to{-moz-transform:rotate(-360deg)}}@-webkit-keyframes spinCC{0%{-webkit-transform:rotate(0)}to{-webkit-transform:rotate(-360deg)}}@keyframes spinCC{0%{transform:rotate(0)}to{transform:rotate(-360deg)}}.numberSelect{z-index:2;position:relative}.swipeBlobContainer{position:absolute;inset:0}.swipeBlobContainer .swipeBlob{clip-path:polygon(15% 20%,50% 0,85% 20%,100% 50%,80% 85%,50% 100%,20% 85%,0 50%);position:absolute}.plusMinus{text-align:center;z-index:3;color:#fff;justify-content:center;align-items:center;display:flex;position:absolute;left:0;right:0}.plusMinus svg{margin:0}.numberSelect_doneClosing{z-index:1}.numberSelect_value{z-index:2;border-radius:100%;justify-content:center;align-items:center;display:flex;position:relative}.numberSelect_input{opacity:1;z-index:1;transition:opacity .2s linear}.numberSelect_input-hidden{opacity:0;pointer-events:none}.numberSelect_increment{z-index:2;border-radius:100%;transition:top .2s linear,bottom .2s linear;position:absolute}.numberSelect_blur{pointer-events:none;z-index:1;opacity:1;transition:opacity .2s linear;position:absolute}.numberSelect_input-hidden .numberSelect_blur{opacity:0}.numberSelect_add svg path{translate:0 -2rem}.numberSelect_subtract svg path{translate:0 2rem}.grevlingPaneView{scroll-snap-type:x mandatory;-ms-overflow-style:none;scrollbar-width:none;position:absolute;inset:0;overflow:auto scroll}.grevlingPaneView::-webkit-scrollbar{display:none}.grevlingPaneViewScrollyContent{width:100%;height:100%;display:flex}.grevlingPaneViewPane{scroll-snap-align:start;scroll-snap-stop:always;min-width:100%;max-height:100%}@-moz-keyframes spin{to{-moz-transform:rotate(360deg)}}@-webkit-keyframes spin{to{-webkit-transform:rotate(360deg)}}@keyframes spin{to{transform:rotate(360deg)}}@-moz-keyframes spinCC{to{-moz-transform:rotate(-360deg)}}@-webkit-keyframes spinCC{to{-webkit-transform:rotate(-360deg)}}@keyframes spinCC{to{transform:rotate(-360deg)}}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export { Menu } from './Menu/Menu';
|
|
2
|
+
export type { MenuProps } from './Menu/Menu';
|
|
3
|
+
export { MenuButton } from './Buttons/MenuButton';
|
|
4
|
+
export type { MenuButtonProps } from './Buttons/MenuButton';
|
|
5
|
+
export { SettingsButton } from './Buttons/SettingsButton';
|
|
6
|
+
export type { SettingsButtonProps } from './Buttons/SettingsButton';
|
|
7
|
+
export { ResetButton } from './Buttons/ResetButton';
|
|
8
|
+
export type { ResetButtonProps } from './Buttons/ResetButton';
|
|
9
|
+
export { CheckBox } from './CheckBox';
|
|
10
|
+
export type { CheckBoxProps } from './CheckBox';
|
|
11
|
+
export { RadioButton, RadioGroup } from './Radio';
|
|
12
|
+
export type { RadioButtonProps, RadioGroupProps, RadioOption } from './Radio';
|
|
13
|
+
export { NumberSelect } from './NumberSelect/NumberSelect';
|
|
14
|
+
export type { NumberSelectProps } from './NumberSelect/NumberSelect';
|
|
15
|
+
export { PaneView } from './PaneView/PaneView';
|
|
16
|
+
export type { PaneViewProps } from './PaneView/PaneView';
|
|
17
|
+
export { Loader } from './Loader/Loader';
|
|
18
|
+
export type { LoaderProps } from './Loader/Loader';
|