@ainias42/react-bootstrap-mobile 0.1.7
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/.eslintrc.json +189 -0
- package/.prettierrc +5 -0
- package/LICENSE +21 -0
- package/README.md +1 -0
- package/babel.config.js +22 -0
- package/bin/build.js +60 -0
- package/bin/release.sh +35 -0
- package/bin/updateCopies.js +86 -0
- package/bootstrapReactMobile.ts +87 -0
- package/dist/bootstrapReactMobile.d.ts +87 -0
- package/dist/bootstrapReactMobile.js +6275 -0
- package/dist/src/Components/ActionSheet/ActionSheet.d.ts +21 -0
- package/dist/src/Components/Card/Card.d.ts +13 -0
- package/dist/src/Components/Clickable/Clickable.d.ts +14 -0
- package/dist/src/Components/Dialog/AlertDialog.d.ts +10 -0
- package/dist/src/Components/Dialog/ButtonDialog.d.ts +13 -0
- package/dist/src/Components/Dialog/ConfirmDialog.d.ts +11 -0
- package/dist/src/Components/Dialog/Dialog.d.ts +14 -0
- package/dist/src/Components/Dialog/DialogBackground.d.ts +7 -0
- package/dist/src/Components/Dialog/DialogContainer.d.ts +6 -0
- package/dist/src/Components/Dialog/DialogContext.d.ts +9 -0
- package/dist/src/Components/Dialog/useAlertDialog.d.ts +1 -0
- package/dist/src/Components/Dialog/useConfirmDialog.d.ts +1 -0
- package/dist/src/Components/DragAndDrop/DragItem.d.ts +7 -0
- package/dist/src/Components/DragAndDrop/DropArea.d.ts +7 -0
- package/dist/src/Components/DragAndDrop/useStrictEnabled.d.ts +1 -0
- package/dist/src/Components/FormElements/Button/Button.d.ts +8 -0
- package/dist/src/Components/FormElements/CheckBox/Checkbox.d.ts +10 -0
- package/dist/src/Components/FormElements/ColorInput/ColorInput.d.ts +17 -0
- package/dist/src/Components/FormElements/ColorInput/sharedSelectedColor.d.ts +4 -0
- package/dist/src/Components/FormElements/ImageInput/ImageInput.d.ts +17 -0
- package/dist/src/Components/FormElements/Input/HiddenInput.d.ts +8 -0
- package/dist/src/Components/FormElements/Input/Input.d.ts +10 -0
- package/dist/src/Components/FormElements/Input/PasswordInput/PasswordInput.d.ts +4 -0
- package/dist/src/Components/FormElements/SearchSelectInput/SearchSelectInput.d.ts +10 -0
- package/dist/src/Components/FormElements/Select/Select.d.ts +16 -0
- package/dist/src/Components/FormElements/Slider/Slider.d.ts +8 -0
- package/dist/src/Components/FormElements/Switch/Switch.d.ts +12 -0
- package/dist/src/Components/FormElements/Textarea/Textarea.d.ts +12 -0
- package/dist/src/Components/FormElements/hooks/useOnChangeDone.d.ts +2 -0
- package/dist/src/Components/FullScreen/FullScreen.d.ts +14 -0
- package/dist/src/Components/Hooks/useBreakpoint.d.ts +11 -0
- package/dist/src/Components/Hooks/useComposedRef.d.ts +2 -0
- package/dist/src/Components/Hooks/useDebounced.d.ts +1 -0
- package/dist/src/Components/Hooks/useDelayed.d.ts +1 -0
- package/dist/src/Components/Hooks/useInViewport.d.ts +2 -0
- package/dist/src/Components/Hooks/useKeyListener.d.ts +3 -0
- package/dist/src/Components/Hooks/useListener.d.ts +18 -0
- package/dist/src/Components/Hooks/useOnMount.d.ts +1 -0
- package/dist/src/Components/Hooks/useOnce.d.ts +1 -0
- package/dist/src/Components/Icon/Icon.d.ts +13 -0
- package/dist/src/Components/Image/Image.d.ts +12 -0
- package/dist/src/Components/InViewport/InViewport.d.ts +11 -0
- package/dist/src/Components/Layout/Block.d.ts +7 -0
- package/dist/src/Components/Layout/Container.d.ts +15 -0
- package/dist/src/Components/Layout/Flex.d.ts +10 -0
- package/dist/src/Components/Layout/Grid/Grid.d.ts +9 -0
- package/dist/src/Components/Layout/Grid/GridItem.d.ts +25 -0
- package/dist/src/Components/Layout/Grow.d.ts +9 -0
- package/dist/src/Components/Layout/Inline.d.ts +7 -0
- package/dist/src/Components/Layout/InlineBlock.d.ts +7 -0
- package/dist/src/Components/Layout/View.d.ts +9 -0
- package/dist/src/Components/Layout/ViewWithoutListeners.d.ts +8 -0
- package/dist/src/Components/List/BulletList/BulletList.d.ts +8 -0
- package/dist/src/Components/List/BulletList/ListItem.d.ts +7 -0
- package/dist/src/Components/List/List.d.ts +10 -0
- package/dist/src/Components/LoadingArea/LoadingArea.d.ts +12 -0
- package/dist/src/Components/LoadingCircle/LoadingCircle.d.ts +8 -0
- package/dist/src/Components/Menu/Menu.d.ts +16 -0
- package/dist/src/Components/Menu/useMenu.d.ts +3 -0
- package/dist/src/Components/RbmComponentProps.d.ts +31 -0
- package/dist/src/Components/SizeCalculator/SizeCalculator.d.ts +9 -0
- package/dist/src/Components/SpoilerList/Spoiler/Spoiler.d.ts +15 -0
- package/dist/src/Components/SpoilerList/SpoilerList.d.ts +15 -0
- package/dist/src/Components/SpoilerList/useSpoilerGroup.d.ts +12 -0
- package/dist/src/Components/TabBar/TabBar.d.ts +30 -0
- package/dist/src/Components/TabBar/TabBarButton.d.ts +9 -0
- package/dist/src/Components/Table/Table.d.ts +36 -0
- package/dist/src/Components/Text/Heading.d.ts +7 -0
- package/dist/src/Components/Text/Text.d.ts +26 -0
- package/dist/src/Components/Toast/Toast.d.ts +13 -0
- package/dist/src/Components/Toast/ToastContainer.d.ts +7 -0
- package/dist/src/Components/TopBar/MoreButton.d.ts +9 -0
- package/dist/src/Components/TopBar/TopBar.d.ts +25 -0
- package/dist/src/Components/TopBar/TopBarButton.d.ts +9 -0
- package/dist/src/StyleProvider.d.ts +2 -0
- package/dist/src/TypeHelpers.d.ts +4 -0
- package/dist/src/WindowContext/WindowContext.d.ts +3 -0
- package/dist/src/WrongChildError.d.ts +4 -0
- package/dist/src/helper/Characters.d.ts +5 -0
- package/dist/src/helper/DistributiveOmit.d.ts +1 -0
- package/dist/src/helper/EmptyProps.d.ts +1 -0
- package/dist/src/helper/memoComparator.d.ts +1 -0
- package/dist/src/helper/nonEmptyString.d.ts +1 -0
- package/dist/src/helper/withForwardRef.d.ts +7 -0
- package/dist/src/helper/withMemo.d.ts +3 -0
- package/dist/src/helper/withRenderBrowserOnly.d.ts +2 -0
- package/dist/src/helper/withRestrictedChildren.d.ts +6 -0
- package/package.json +92 -0
- package/react-bootstrap-mobile.scss +6 -0
- package/scripts/getPackageJson.js +25 -0
- package/src/Components/ActionSheet/ActionSheet.tsx +115 -0
- package/src/Components/ActionSheet/actionSheet.scss +153 -0
- package/src/Components/Card/Card.tsx +46 -0
- package/src/Components/Card/card.scss +76 -0
- package/src/Components/Clickable/Clickable.tsx +174 -0
- package/src/Components/Clickable/clickable.scss +3 -0
- package/src/Components/Dialog/AlertDialog.tsx +44 -0
- package/src/Components/Dialog/ButtonDialog.tsx +57 -0
- package/src/Components/Dialog/ConfirmDialog.tsx +46 -0
- package/src/Components/Dialog/Dialog.tsx +82 -0
- package/src/Components/Dialog/DialogBackground.tsx +38 -0
- package/src/Components/Dialog/DialogContainer.tsx +77 -0
- package/src/Components/Dialog/DialogContext.ts +21 -0
- package/src/Components/Dialog/buttonDialog.scss +114 -0
- package/src/Components/Dialog/dialog.scss +30 -0
- package/src/Components/Dialog/dialogBackground.scss +4 -0
- package/src/Components/Dialog/useAlertDialog.ts +13 -0
- package/src/Components/Dialog/useConfirmDialog.ts +13 -0
- package/src/Components/DragAndDrop/DragItem.tsx +38 -0
- package/src/Components/DragAndDrop/DropArea.tsx +43 -0
- package/src/Components/DragAndDrop/useStrictEnabled.ts +20 -0
- package/src/Components/FormElements/Button/Button.tsx +25 -0
- package/src/Components/FormElements/Button/button.scss +39 -0
- package/src/Components/FormElements/CheckBox/Checkbox.tsx +61 -0
- package/src/Components/FormElements/CheckBox/checkbox.scss +107 -0
- package/src/Components/FormElements/ColorInput/ColorInput.tsx +139 -0
- package/src/Components/FormElements/ColorInput/colorInput.scss +35 -0
- package/src/Components/FormElements/ColorInput/sharedSelectedColor.ts +40 -0
- package/src/Components/FormElements/ImageInput/ImageInput.tsx +97 -0
- package/src/Components/FormElements/ImageInput/imageInput.scss +24 -0
- package/src/Components/FormElements/Input/HiddenInput.tsx +43 -0
- package/src/Components/FormElements/Input/Input.tsx +102 -0
- package/src/Components/FormElements/Input/PasswordInput/PasswordInput.tsx +55 -0
- package/src/Components/FormElements/Input/PasswordInput/passwordInput.scss +7 -0
- package/src/Components/FormElements/Input/input.scss +57 -0
- package/src/Components/FormElements/SearchSelectInput/SearchSelectInput.tsx +162 -0
- package/src/Components/FormElements/SearchSelectInput/seachSelectInput.scss +90 -0
- package/src/Components/FormElements/Select/Select.tsx +77 -0
- package/src/Components/FormElements/Select/select.scss +51 -0
- package/src/Components/FormElements/Slider/Slider.tsx +80 -0
- package/src/Components/FormElements/Slider/slider.scss +92 -0
- package/src/Components/FormElements/Switch/Switch.tsx +82 -0
- package/src/Components/FormElements/Switch/switch.scss +149 -0
- package/src/Components/FormElements/Textarea/Textarea.tsx +77 -0
- package/src/Components/FormElements/Textarea/textarea.scss +22 -0
- package/src/Components/FormElements/hooks/useOnChangeDone.ts +16 -0
- package/src/Components/FullScreen/FullScreen.tsx +89 -0
- package/src/Components/Hooks/useBreakpoint.ts +66 -0
- package/src/Components/Hooks/useComposedRef.ts +17 -0
- package/src/Components/Hooks/useDebounced.ts +22 -0
- package/src/Components/Hooks/useDelayed.ts +46 -0
- package/src/Components/Hooks/useInViewport.ts +23 -0
- package/src/Components/Hooks/useKeyListener.ts +77 -0
- package/src/Components/Hooks/useListener.ts +73 -0
- package/src/Components/Hooks/useOnMount.ts +12 -0
- package/src/Components/Hooks/useOnce.ts +11 -0
- package/src/Components/Icon/Icon.tsx +45 -0
- package/src/Components/Image/Image.tsx +44 -0
- package/src/Components/Image/image.scss +3 -0
- package/src/Components/InViewport/InViewport.tsx +71 -0
- package/src/Components/InViewport/inViewport.scss +3 -0
- package/src/Components/Layout/Block.tsx +48 -0
- package/src/Components/Layout/Container.tsx +57 -0
- package/src/Components/Layout/Flex.tsx +51 -0
- package/src/Components/Layout/Grid/Grid.tsx +53 -0
- package/src/Components/Layout/Grid/GridItem.tsx +138 -0
- package/src/Components/Layout/Grid/grid.scss +43 -0
- package/src/Components/Layout/Grow.tsx +51 -0
- package/src/Components/Layout/Inline.tsx +48 -0
- package/src/Components/Layout/InlineBlock.tsx +48 -0
- package/src/Components/Layout/View.tsx +40 -0
- package/src/Components/Layout/ViewWithoutListeners.tsx +40 -0
- package/src/Components/Layout/container.scss +12 -0
- package/src/Components/Layout/layout.scss +56 -0
- package/src/Components/List/BulletList/BulletList.tsx +33 -0
- package/src/Components/List/BulletList/ListItem.tsx +34 -0
- package/src/Components/List/List.tsx +88 -0
- package/src/Components/List/list.scss +30 -0
- package/src/Components/LoadingArea/LoadingArea.tsx +64 -0
- package/src/Components/LoadingArea/loadingArea.scss +19 -0
- package/src/Components/LoadingCircle/LoadingCircle.tsx +41 -0
- package/src/Components/LoadingCircle/loadingCircle.scss +42 -0
- package/src/Components/Menu/Menu.tsx +113 -0
- package/src/Components/Menu/menu.scss +21 -0
- package/src/Components/Menu/useMenu.ts +20 -0
- package/src/Components/RbmComponentProps.ts +40 -0
- package/src/Components/SizeCalculator/SizeCalculator.tsx +45 -0
- package/src/Components/SpoilerList/Spoiler/Spoiler.tsx +106 -0
- package/src/Components/SpoilerList/Spoiler/spoiler.scss +120 -0
- package/src/Components/SpoilerList/SpoilerList.tsx +63 -0
- package/src/Components/SpoilerList/useSpoilerGroup.ts +39 -0
- package/src/Components/TabBar/TabBar.tsx +117 -0
- package/src/Components/TabBar/TabBarButton.tsx +44 -0
- package/src/Components/TabBar/tabBar.scss +108 -0
- package/src/Components/Table/Table.tsx +182 -0
- package/src/Components/Text/Heading.tsx +44 -0
- package/src/Components/Text/Text.tsx +79 -0
- package/src/Components/Text/heading.scss +3 -0
- package/src/Components/Text/text.scss +60 -0
- package/src/Components/Toast/Toast.tsx +107 -0
- package/src/Components/Toast/ToastContainer.tsx +35 -0
- package/src/Components/Toast/toast.scss +52 -0
- package/src/Components/TopBar/MoreButton.tsx +38 -0
- package/src/Components/TopBar/TopBar.tsx +176 -0
- package/src/Components/TopBar/TopBarButton.tsx +29 -0
- package/src/Components/TopBar/topBar.scss +124 -0
- package/src/StyleProvider.ts +4 -0
- package/src/TypeHelpers.ts +4 -0
- package/src/WindowContext/WindowContext.ts +8 -0
- package/src/WrongChildError.ts +19 -0
- package/src/env.d.ts +1 -0
- package/src/helper/Characters.ts +5 -0
- package/src/helper/DistributiveOmit.ts +1 -0
- package/src/helper/EmptyProps.ts +2 -0
- package/src/helper/memoComparator.ts +18 -0
- package/src/helper/nonEmptyString.ts +8 -0
- package/src/helper/withForwardRef.ts +28 -0
- package/src/helper/withMemo.ts +16 -0
- package/src/helper/withRenderBrowserOnly.tsx +30 -0
- package/src/helper/withRestrictedChildren.tsx +57 -0
- package/src/scss/_animations.scss +46 -0
- package/src/scss/_baseClasses.scss +27 -0
- package/src/scss/_colors.scss +13 -0
- package/src/scss/_default.scss +17 -0
- package/src/scss/_designMixin.scss +13 -0
- package/src/scss/_mobileMixin.scss +35 -0
- package/src/scss/_variables.scss +22 -0
- package/src/types/isomorphic-style-loader.d.ts +3 -0
- package/src/types/react-table-config.d.ts +120 -0
- package/src/types/scss-module.d.ts +7 -0
- package/tsconfig.json +57 -0
- package/webpack.config.js +85 -0
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { OptionalListener } from '../../Hooks/useListener';
|
|
3
|
+
import { SelectOption } from '../Select/Select';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import { ChangeEventHandler, KeyboardEvent, useCallback, useMemo, useRef, useState } from 'react';
|
|
6
|
+
import { ArrayHelper } from '@ainias42/js-helper';
|
|
7
|
+
import { RbmComponentProps } from '../../RbmComponentProps';
|
|
8
|
+
import { withMemo } from '../../../helper/withMemo';
|
|
9
|
+
import { InlineBlock } from '../../Layout/InlineBlock';
|
|
10
|
+
import { Text, TEXT_SIZE } from '../../Text/Text';
|
|
11
|
+
import { Block } from '../../Layout/Block';
|
|
12
|
+
|
|
13
|
+
import styles from './seachSelectInput.scss';
|
|
14
|
+
import { Flex } from '../../Layout/Flex';
|
|
15
|
+
import { Grow } from '../../Layout/Grow';
|
|
16
|
+
import { Clickable } from '../../Clickable/Clickable';
|
|
17
|
+
import { useWindow } from '../../../WindowContext/WindowContext';
|
|
18
|
+
|
|
19
|
+
export type SearchSelectInputProps<OnChangeData> = RbmComponentProps<
|
|
20
|
+
{
|
|
21
|
+
label?: string;
|
|
22
|
+
options: SelectOption[];
|
|
23
|
+
onChangeValue?: (newValues: string[]) => void;
|
|
24
|
+
values: string[];
|
|
25
|
+
} & OptionalListener<'onChange', OnChangeData>
|
|
26
|
+
>;
|
|
27
|
+
|
|
28
|
+
export const SearchSelectInput = withMemo(function SearchSelectInput<OnChangeData>({
|
|
29
|
+
label,
|
|
30
|
+
options,
|
|
31
|
+
values,
|
|
32
|
+
onChangeValue,
|
|
33
|
+
className,
|
|
34
|
+
style,
|
|
35
|
+
}: SearchSelectInputProps<OnChangeData>) {
|
|
36
|
+
// Variables
|
|
37
|
+
const indexedOptions = useMemo(() => ArrayHelper.arrayToObject(options, (opt) => opt.value), [options]);
|
|
38
|
+
|
|
39
|
+
// Refs
|
|
40
|
+
const containerRef = useRef<HTMLLabelElement>(null);
|
|
41
|
+
const window = useWindow();
|
|
42
|
+
|
|
43
|
+
// States
|
|
44
|
+
const [searchText, setSearchText] = useState('');
|
|
45
|
+
const [suggestionsPosition, setSuggestionsPosition] = useState<
|
|
46
|
+
{ top: number; left: number; right: number } | undefined
|
|
47
|
+
>(undefined);
|
|
48
|
+
|
|
49
|
+
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
50
|
+
|
|
51
|
+
const selectableOptions = useMemo(() => {
|
|
52
|
+
if (!suggestionsPosition) {
|
|
53
|
+
return [];
|
|
54
|
+
}
|
|
55
|
+
return options.filter(
|
|
56
|
+
(option) => !values.includes(option.value) && option.label.toLowerCase().includes(searchText.toLowerCase())
|
|
57
|
+
);
|
|
58
|
+
}, [suggestionsPosition, options, searchText, values]);
|
|
59
|
+
|
|
60
|
+
// Selectors
|
|
61
|
+
|
|
62
|
+
// Callbacks
|
|
63
|
+
const updateSuggestionPosition = useCallback(() => {
|
|
64
|
+
if (!containerRef.current) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const { left, right, bottom: top } = containerRef.current.getBoundingClientRect();
|
|
68
|
+
setSuggestionsPosition({ top, left, right: (window?.innerWidth ?? 0) - right });
|
|
69
|
+
}, [window?.innerWidth]);
|
|
70
|
+
|
|
71
|
+
const onChange = useCallback<ChangeEventHandler<HTMLInputElement>>((ev) => {
|
|
72
|
+
setSearchText(ev.target.value);
|
|
73
|
+
setSelectedIndex(0);
|
|
74
|
+
}, []);
|
|
75
|
+
const onFocus = useCallback(() => updateSuggestionPosition(), [updateSuggestionPosition]);
|
|
76
|
+
|
|
77
|
+
const toggleOption = useCallback(
|
|
78
|
+
(_: any, value: string) => {
|
|
79
|
+
const newValues = [...values];
|
|
80
|
+
const index = values.indexOf(value);
|
|
81
|
+
if (index === -1) {
|
|
82
|
+
newValues.push(value);
|
|
83
|
+
} else {
|
|
84
|
+
newValues.splice(index, 1);
|
|
85
|
+
}
|
|
86
|
+
setSearchText('');
|
|
87
|
+
setSelectedIndex(0);
|
|
88
|
+
onChangeValue?.(newValues);
|
|
89
|
+
},
|
|
90
|
+
[onChangeValue, values]
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
const onKeyPress = useCallback(
|
|
94
|
+
(e: KeyboardEvent<HTMLInputElement>) => {
|
|
95
|
+
console.log('Keypress', e.key);
|
|
96
|
+
|
|
97
|
+
if (e.key === 'Enter' && !e.defaultPrevented) {
|
|
98
|
+
if (selectedIndex < selectableOptions.length) {
|
|
99
|
+
toggleOption(undefined, selectableOptions[selectedIndex].value);
|
|
100
|
+
}
|
|
101
|
+
} else if (e.key === 'ArrowDown') {
|
|
102
|
+
setSelectedIndex((old) => {
|
|
103
|
+
if (old + 1 >= selectableOptions.length) {
|
|
104
|
+
return 0;
|
|
105
|
+
}
|
|
106
|
+
return old + 1;
|
|
107
|
+
});
|
|
108
|
+
} else if (e.key === 'ArrowUp') {
|
|
109
|
+
setSelectedIndex((old) => {
|
|
110
|
+
if (old - 1 < 0) {
|
|
111
|
+
return Math.max(selectableOptions.length - 1, 0);
|
|
112
|
+
}
|
|
113
|
+
return old - 1;
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
[toggleOption, selectableOptions, selectedIndex]
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
// Effects
|
|
121
|
+
|
|
122
|
+
// Other
|
|
123
|
+
|
|
124
|
+
// Render Functions
|
|
125
|
+
const renderOption = (value: string) => (
|
|
126
|
+
<Clickable onClick={toggleOption} onClickData={value} key={indexedOptions[value].key}>
|
|
127
|
+
<InlineBlock className={styles.tag}>
|
|
128
|
+
<Text size={TEXT_SIZE.xSmall}>{indexedOptions[value].label}</Text>
|
|
129
|
+
</InlineBlock>
|
|
130
|
+
</Clickable>
|
|
131
|
+
);
|
|
132
|
+
const renderSelectableOption = (opt: SelectOption, index: number) => (
|
|
133
|
+
<Clickable onClick={toggleOption} onClickData={opt.value} key={opt.key}>
|
|
134
|
+
<Block className={classNames(styles.selectableOption, { [styles.active]: index === selectedIndex })}>
|
|
135
|
+
<Text>{opt.label}</Text>
|
|
136
|
+
</Block>
|
|
137
|
+
</Clickable>
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
return (
|
|
141
|
+
// eslint-disable-next-line jsx-a11y/label-has-associated-control
|
|
142
|
+
<label className={classNames(styles.input, className)} style={style} ref={containerRef}>
|
|
143
|
+
{label ? <span className={styles.label}>{label}</span> : null}
|
|
144
|
+
<Flex className={styles.inputContainer} horizontal={true}>
|
|
145
|
+
<InlineBlock>{values.map(renderOption)}</InlineBlock>
|
|
146
|
+
<Grow __allowChildren="html">
|
|
147
|
+
<input
|
|
148
|
+
className={styles.text}
|
|
149
|
+
value={searchText}
|
|
150
|
+
onChange={onChange}
|
|
151
|
+
onKeyDown={onKeyPress}
|
|
152
|
+
onFocus={onFocus}
|
|
153
|
+
/>
|
|
154
|
+
</Grow>
|
|
155
|
+
</Flex>
|
|
156
|
+
<InlineBlock className={styles.selectableOptionContainer} style={suggestionsPosition}>
|
|
157
|
+
{selectableOptions.map(renderSelectableOption)}
|
|
158
|
+
</InlineBlock>
|
|
159
|
+
</label>
|
|
160
|
+
);
|
|
161
|
+
},
|
|
162
|
+
styles);
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
@import "../../../scss/variables";
|
|
2
|
+
@import "../../../scss/designMixin";
|
|
3
|
+
|
|
4
|
+
.input {
|
|
5
|
+
display: inline-block;
|
|
6
|
+
width: 100%;
|
|
7
|
+
position: relative;
|
|
8
|
+
padding-bottom: 0.1rem;
|
|
9
|
+
|
|
10
|
+
&:focus-within {
|
|
11
|
+
.selectableOptionContainer {
|
|
12
|
+
display: inherit;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@include design($material) {
|
|
17
|
+
background-image: linear-gradient(to top, transparent 1px, #afafaf 1px);
|
|
18
|
+
background-size: 100% 2px;
|
|
19
|
+
background-repeat: no-repeat;
|
|
20
|
+
background-position: center bottom;
|
|
21
|
+
padding-bottom: 2px;
|
|
22
|
+
|
|
23
|
+
&:focus {
|
|
24
|
+
background-image: linear-gradient(var(--flavor-focus), var(--flavor-focus)),
|
|
25
|
+
linear-gradient(to top, transparent 1px, #afafaf 1px);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@include design($flat) {
|
|
30
|
+
&, &:focus {
|
|
31
|
+
border-bottom: 1px solid var(--border-light);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.label {
|
|
36
|
+
display: block;
|
|
37
|
+
font-weight: bold;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.text {
|
|
41
|
+
width: 100%;
|
|
42
|
+
background-color: transparent;
|
|
43
|
+
border: 0;
|
|
44
|
+
outline: none;
|
|
45
|
+
padding: 0;
|
|
46
|
+
background-image: none;
|
|
47
|
+
|
|
48
|
+
@include design($material) {
|
|
49
|
+
color: #212121;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@include design($flat) {
|
|
53
|
+
color: #1f1f21;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.inputContainer {
|
|
59
|
+
display: flex;
|
|
60
|
+
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.tag {
|
|
64
|
+
color: white;
|
|
65
|
+
background-color: var(--flavor-accent);
|
|
66
|
+
padding: 0.1rem 0.2rem;
|
|
67
|
+
margin-right: 0.1rem;
|
|
68
|
+
margin-bottom: 0.1rem;
|
|
69
|
+
border-radius: 4px;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.selectableOptionContainer {
|
|
73
|
+
display: none;
|
|
74
|
+
position: fixed;
|
|
75
|
+
background-color: white;
|
|
76
|
+
z-index: 1100;
|
|
77
|
+
border: 1px solid var(--border-light);
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
.selectableOption {
|
|
81
|
+
padding-left: 0.2rem;
|
|
82
|
+
padding-right: 0.2rem;
|
|
83
|
+
cursor: pointer;
|
|
84
|
+
|
|
85
|
+
&.active {
|
|
86
|
+
color: white;
|
|
87
|
+
background-color: var(--flavor-accent);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { RbmComponentProps } from '../../RbmComponentProps';
|
|
3
|
+
import { Override } from '../../../TypeHelpers';
|
|
4
|
+
import { ChangeEventHandler, SelectHTMLAttributes, useCallback } from 'react';
|
|
5
|
+
import { OptionalListener, useListener } from '../../Hooks/useListener';
|
|
6
|
+
|
|
7
|
+
import styles from './select.scss';
|
|
8
|
+
import { withMemo } from '../../../helper/withMemo';
|
|
9
|
+
import classNames from 'classnames';
|
|
10
|
+
|
|
11
|
+
export type SelectOption = {
|
|
12
|
+
label: string;
|
|
13
|
+
value: string;
|
|
14
|
+
key?: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type SelectProps<OnChangeData> = RbmComponentProps<
|
|
18
|
+
Override<
|
|
19
|
+
SelectHTMLAttributes<HTMLSelectElement>,
|
|
20
|
+
{
|
|
21
|
+
label?: string;
|
|
22
|
+
options: SelectOption[];
|
|
23
|
+
onChangeValue?: (newValue: string) => void;
|
|
24
|
+
inline?: boolean;
|
|
25
|
+
} & OptionalListener<'onChange', OnChangeData>
|
|
26
|
+
>
|
|
27
|
+
>;
|
|
28
|
+
|
|
29
|
+
export const Select = withMemo(function Select<OnChangeData>({
|
|
30
|
+
label,
|
|
31
|
+
options,
|
|
32
|
+
className,
|
|
33
|
+
style,
|
|
34
|
+
onChangeValue,
|
|
35
|
+
inline = false,
|
|
36
|
+
...otherProps
|
|
37
|
+
}: SelectProps<OnChangeData>) {
|
|
38
|
+
// Variables
|
|
39
|
+
console.log('LOG-d inline', inline);
|
|
40
|
+
|
|
41
|
+
// Refs
|
|
42
|
+
|
|
43
|
+
// States
|
|
44
|
+
|
|
45
|
+
// Selectors
|
|
46
|
+
|
|
47
|
+
// Callbacks
|
|
48
|
+
const onChangeWithData = useListener<'onChange', OnChangeData>('onChange', otherProps);
|
|
49
|
+
const onChange = useCallback<ChangeEventHandler<HTMLSelectElement>>(
|
|
50
|
+
(e) => {
|
|
51
|
+
onChangeValue?.(e.target.value);
|
|
52
|
+
onChangeWithData(e);
|
|
53
|
+
},
|
|
54
|
+
[onChangeWithData, onChangeValue]
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
// Effects
|
|
58
|
+
|
|
59
|
+
// Other
|
|
60
|
+
|
|
61
|
+
// Render Functions
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
// eslint-disable-next-line jsx-a11y/label-has-associated-control
|
|
65
|
+
<label className={classNames(styles.select, { [styles.inline]: inline }, className)} style={style}>
|
|
66
|
+
{label ? <span className={styles.label}>{label}</span> : null}
|
|
67
|
+
<select {...otherProps} className={styles.input} onChange={onChange}>
|
|
68
|
+
{options.map((option) => (
|
|
69
|
+
<option value={option.value} key={option.key ?? option.value}>
|
|
70
|
+
{option.label}
|
|
71
|
+
</option>
|
|
72
|
+
))}
|
|
73
|
+
</select>
|
|
74
|
+
</label>
|
|
75
|
+
);
|
|
76
|
+
},
|
|
77
|
+
styles);
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
@import "../../../scss/variables";
|
|
2
|
+
@import "../../../scss/designMixin";
|
|
3
|
+
|
|
4
|
+
.select {
|
|
5
|
+
width: 100%;
|
|
6
|
+
|
|
7
|
+
.label {
|
|
8
|
+
font-weight: bold;
|
|
9
|
+
display: block;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.input {
|
|
13
|
+
outline: none;
|
|
14
|
+
background-color: transparent;
|
|
15
|
+
height: 2rem;
|
|
16
|
+
line-height: 2rem;
|
|
17
|
+
color: #1f1f21;
|
|
18
|
+
appearance: none;
|
|
19
|
+
border: none;
|
|
20
|
+
border-radius: 0;
|
|
21
|
+
padding: 0 20px 0 0;
|
|
22
|
+
background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMTBweCIgaGVpZ2h0PSI1cHgiIHZpZXdCb3g9IjAgMCAxMCA1IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPCEtLSBHZW5lcmF0b3I6IFNrZXRjaCA0My4yICgzOTA2OSkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+c2VsZWN0LWFsbG93PC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+PC9kZWZzPgogICAgPGcgaWQ9InNlbGVjdCIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgaWQ9Imlvcy1zZWxlY3QiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0xOTguMDAwMDAwLCAtMTE0LjAwMDAwMCkiIGZpbGw9IiM3NTc1NzUiPgogICAgICAgICAgICA8ZyBpZD0ibWVudS1iYXItKy1vcGVuLW1lbnUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEyMy4wMDAwMDAsIDEwMC4wMDAwMDApIj4KICAgICAgICAgICAgICAgIDxnIGlkPSJtZW51LWJhciI+CiAgICAgICAgICAgICAgICAgICAgPHBvbHlnb24gaWQ9InNlbGVjdC1hbGxvdyIgcG9pbnRzPSI3NSAxNCA4MCAxOSA4NSAxNCI+PC9wb2x5Z29uPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICA8L2c+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=');
|
|
23
|
+
background-repeat: no-repeat;
|
|
24
|
+
|
|
25
|
+
&:focus {
|
|
26
|
+
outline: none;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@include design($material) {
|
|
30
|
+
-webkit-font-smoothing: antialiased;
|
|
31
|
+
font-size: 15px;
|
|
32
|
+
background-size: auto, 100% 1px;
|
|
33
|
+
background-position: right center, left bottom;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@include design($flat) {
|
|
37
|
+
font-size: 17px;
|
|
38
|
+
background-position: right center;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&.inline {
|
|
43
|
+
display: flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
|
|
46
|
+
.label {
|
|
47
|
+
padding-right: 4px;
|
|
48
|
+
flex: 1;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { RbmComponentProps } from '../../RbmComponentProps';
|
|
3
|
+
import { withMemo } from '../../../helper/withMemo';
|
|
4
|
+
import { ChangeEventHandler, InputHTMLAttributes, useCallback } from 'react';
|
|
5
|
+
|
|
6
|
+
import styles from './slider.scss';
|
|
7
|
+
import classNames from 'classnames';
|
|
8
|
+
import { Override } from '../../../TypeHelpers';
|
|
9
|
+
import { OptionalListener, useListenerWithExtractedProps } from '../../Hooks/useListener';
|
|
10
|
+
import { useOnChangeDone } from '../hooks/useOnChangeDone';
|
|
11
|
+
|
|
12
|
+
export type SliderProps<OnChangeData, OnChangeValueData, OnChangeDoneData> = RbmComponentProps<
|
|
13
|
+
Override<
|
|
14
|
+
Omit<InputHTMLAttributes<HTMLInputElement>, 'type'>,
|
|
15
|
+
{
|
|
16
|
+
value?: number;
|
|
17
|
+
} & OptionalListener<'onChange', OnChangeData> &
|
|
18
|
+
OptionalListener<'onChangeValue', OnChangeValueData, number> &
|
|
19
|
+
OptionalListener<'onChangeDone', OnChangeDoneData>
|
|
20
|
+
>
|
|
21
|
+
>;
|
|
22
|
+
|
|
23
|
+
export const Slider = withMemo(function Slider<OnChangeData, OnChangeValueData, OnChangeDoneData>({
|
|
24
|
+
className,
|
|
25
|
+
style,
|
|
26
|
+
...props
|
|
27
|
+
}: SliderProps<OnChangeData, OnChangeValueData, OnChangeDoneData>) {
|
|
28
|
+
// Variables
|
|
29
|
+
|
|
30
|
+
// Refs
|
|
31
|
+
|
|
32
|
+
// States
|
|
33
|
+
|
|
34
|
+
// Selectors
|
|
35
|
+
|
|
36
|
+
// Callbacks
|
|
37
|
+
const [onChange, otherPropsWithoutOnchange] = useListenerWithExtractedProps<'onChange', OnChangeData>(
|
|
38
|
+
'onChange',
|
|
39
|
+
props
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
const [onChangeValue, otherPropsWithoutOnChangeValue] = useListenerWithExtractedProps<
|
|
43
|
+
'onChangeValue',
|
|
44
|
+
OnChangeValueData
|
|
45
|
+
>('onChangeValue', otherPropsWithoutOnchange);
|
|
46
|
+
|
|
47
|
+
const [onChangeDone, otherPropsWithoutData] = useListenerWithExtractedProps<'onChangeDone', OnChangeDoneData>(
|
|
48
|
+
'onChangeDone',
|
|
49
|
+
otherPropsWithoutOnChangeValue
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
const innerOnChange = useCallback<ChangeEventHandler<HTMLInputElement>>(
|
|
53
|
+
(e) => {
|
|
54
|
+
onChangeValue(Number(e.target.value));
|
|
55
|
+
onChange(e);
|
|
56
|
+
},
|
|
57
|
+
[onChange, onChangeValue]
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
// Effects
|
|
61
|
+
const innerRef = useOnChangeDone(onChangeDone);
|
|
62
|
+
|
|
63
|
+
// Other
|
|
64
|
+
|
|
65
|
+
// Render Functions
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
// eslint-disable-next-line jsx-a11y/label-has-associated-control
|
|
69
|
+
<label className={classNames(styles.slider, className)} style={style}>
|
|
70
|
+
<input
|
|
71
|
+
type="range"
|
|
72
|
+
{...otherPropsWithoutData}
|
|
73
|
+
className={styles.input}
|
|
74
|
+
onChange={innerOnChange}
|
|
75
|
+
ref={innerRef}
|
|
76
|
+
/>
|
|
77
|
+
</label>
|
|
78
|
+
);
|
|
79
|
+
},
|
|
80
|
+
styles);
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
$thumbWidth: 16;
|
|
2
|
+
$thumbHeight: 16;
|
|
3
|
+
$trackHeight: calc($thumbHeight / 4);
|
|
4
|
+
$maxScreenSize: 10000;
|
|
5
|
+
|
|
6
|
+
.slider {
|
|
7
|
+
--thumb-height: #{$thumbHeight}px;
|
|
8
|
+
--thumb-width: #{$thumbWidth}px;
|
|
9
|
+
--track-height: #{$trackHeight}px;
|
|
10
|
+
--clip-edges: 0.125rem;
|
|
11
|
+
|
|
12
|
+
width: 100%;
|
|
13
|
+
|
|
14
|
+
.input {
|
|
15
|
+
position: relative;
|
|
16
|
+
cursor: pointer;
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
-webkit-appearance: none;
|
|
19
|
+
appearance: none;
|
|
20
|
+
width: 100%;
|
|
21
|
+
background: transparent;
|
|
22
|
+
|
|
23
|
+
transition: all ease 100ms;
|
|
24
|
+
height: var(--thumb-height);
|
|
25
|
+
|
|
26
|
+
&:active {
|
|
27
|
+
cursor: grabbing;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@mixin track {
|
|
31
|
+
-webkit-appearance: none;
|
|
32
|
+
appearance: none;
|
|
33
|
+
transition: all ease 100ms;
|
|
34
|
+
height: var(--thumb-height);
|
|
35
|
+
position: relative;
|
|
36
|
+
width: 100%;
|
|
37
|
+
border-radius: var(--track-height);
|
|
38
|
+
background: linear-gradient(var(--border-light) 0 0) scroll no-repeat center /
|
|
39
|
+
100% calc(var(--track-height) + 1px);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@mixin thumb {
|
|
43
|
+
-webkit-appearance: none;
|
|
44
|
+
appearance: none;
|
|
45
|
+
width: var(--thumb-width);
|
|
46
|
+
transition: all ease 100ms;
|
|
47
|
+
height: var(--thumb-height);
|
|
48
|
+
background: var(--flavor-accent);
|
|
49
|
+
position: relative;
|
|
50
|
+
border: 0;
|
|
51
|
+
border-radius: var(--thumb-width);
|
|
52
|
+
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&::-webkit-slider-runnable-track {
|
|
56
|
+
@include track;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&::-webkit-slider-thumb {
|
|
60
|
+
@include thumb;
|
|
61
|
+
|
|
62
|
+
box-shadow: calc(-100vmax - (var(--thumb-width, var(--thumb-height)) / 2)) 0 0 100vmax var(--flavor-accent);
|
|
63
|
+
$clipTop: calc(($thumbHeight - $trackHeight) / 2);
|
|
64
|
+
$clipBottom: $thumbHeight - $clipTop;
|
|
65
|
+
clip-path: path("M 0, #{0.5*$thumbHeight} \
|
|
66
|
+
a #{0.5*$thumbWidth} #{0.5*$thumbHeight}, 0 1 0, #{$thumbWidth} 0 \
|
|
67
|
+
a #{0.5*$thumbWidth} #{0.5*$thumbHeight}, 0 1 0, #{-1*$thumbWidth} 0 \
|
|
68
|
+
L #{0.5*$thumbWidth} #{$clipTop} \
|
|
69
|
+
L #{-1*$maxScreenSize} #{$clipTop} \
|
|
70
|
+
L #{-1*$maxScreenSize} #{$clipBottom} \
|
|
71
|
+
L #{0.5*$thumbWidth} #{$clipBottom} \
|
|
72
|
+
z");
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&::-moz-range-thumb {
|
|
76
|
+
@include thumb;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&::-moz-range-track {
|
|
80
|
+
@include track;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
&::-moz-range-progress {
|
|
84
|
+
background: transparent;
|
|
85
|
+
appearance: none;
|
|
86
|
+
background: var(--flavor-accent);
|
|
87
|
+
transition-delay: 30ms;
|
|
88
|
+
height: var(--track-height);
|
|
89
|
+
border-radius: var(--track-height);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ChangeEventHandler, InputHTMLAttributes, useCallback } from 'react';
|
|
3
|
+
import { RbmComponentProps } from '../../RbmComponentProps';
|
|
4
|
+
import { Override } from '../../../TypeHelpers';
|
|
5
|
+
import classNames from 'classnames';
|
|
6
|
+
|
|
7
|
+
import styles from './switch.scss';
|
|
8
|
+
import { withMemo } from '../../../helper/withMemo';
|
|
9
|
+
|
|
10
|
+
export type SwitchProps = RbmComponentProps<
|
|
11
|
+
Override<
|
|
12
|
+
InputHTMLAttributes<HTMLInputElement>,
|
|
13
|
+
{
|
|
14
|
+
preLabel?: string;
|
|
15
|
+
label?: string;
|
|
16
|
+
children?: string;
|
|
17
|
+
isLabelBeforeSwitch?: boolean;
|
|
18
|
+
isDual?: boolean;
|
|
19
|
+
onChangeChecked?(isChecked: boolean): void;
|
|
20
|
+
}
|
|
21
|
+
>
|
|
22
|
+
>;
|
|
23
|
+
|
|
24
|
+
export const Switch = withMemo(function Switch({
|
|
25
|
+
children,
|
|
26
|
+
label = '',
|
|
27
|
+
preLabel = '',
|
|
28
|
+
isLabelBeforeSwitch = false,
|
|
29
|
+
isDual = undefined,
|
|
30
|
+
id,
|
|
31
|
+
className,
|
|
32
|
+
style,
|
|
33
|
+
onChange,
|
|
34
|
+
onChangeChecked,
|
|
35
|
+
...props
|
|
36
|
+
}: SwitchProps) {
|
|
37
|
+
// Variables
|
|
38
|
+
|
|
39
|
+
// States
|
|
40
|
+
|
|
41
|
+
// Refs
|
|
42
|
+
|
|
43
|
+
// Callbacks
|
|
44
|
+
const realOnChange = useCallback<ChangeEventHandler<HTMLInputElement>>(
|
|
45
|
+
(e) => {
|
|
46
|
+
onChange?.(e);
|
|
47
|
+
onChangeChecked?.(e.target.checked);
|
|
48
|
+
},
|
|
49
|
+
[onChange, onChangeChecked]
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
// Effects
|
|
53
|
+
|
|
54
|
+
// Other
|
|
55
|
+
|
|
56
|
+
// Render Functions
|
|
57
|
+
|
|
58
|
+
if (React.Children.count(children) === 1 && typeof children === 'string') {
|
|
59
|
+
label = children;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (isLabelBeforeSwitch) {
|
|
63
|
+
[label, preLabel] = [preLabel, label];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (label && preLabel && isDual === undefined) {
|
|
67
|
+
isDual = true;
|
|
68
|
+
}
|
|
69
|
+
return (
|
|
70
|
+
<span className={classNames(styles.switch, { [styles.dual]: isDual }, className)} style={style}>
|
|
71
|
+
<label htmlFor={id} key={id}>
|
|
72
|
+
<span className={styles.label}>{preLabel}</span>
|
|
73
|
+
<input {...props} type="checkbox" id={id} onChange={realOnChange} />
|
|
74
|
+
<div className={styles.toggle}>
|
|
75
|
+
<span className={styles.handle} />
|
|
76
|
+
</div>
|
|
77
|
+
<span className={styles.label}>{label}</span>
|
|
78
|
+
</label>
|
|
79
|
+
</span>
|
|
80
|
+
);
|
|
81
|
+
},
|
|
82
|
+
styles);
|