@skbkontur/react-ui 1.6.9 → 1.6.11
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 +135 -135
- package/components/Autocomplete/Autocomplete.adapter.js.flow +4 -4
- package/components/Autocomplete/Autocomplete.js.flow +37 -37
- package/components/Autocomplete/README.md +7 -7
- package/components/Autocomplete/index.js.flow +2 -2
- package/components/Button/Button.adapter.js.flow +4 -4
- package/components/Button/Button.js.flow +58 -58
- package/components/Button/Corners.js.flow +12 -12
- package/components/Button/README.md +85 -85
- package/components/Button/index.js.flow +2 -2
- package/components/Calendar/Animation.js.flow +7 -7
- package/components/Calendar/Calendar.js.flow +33 -33
- package/components/Calendar/CalendarDateShape.js.flow +26 -26
- package/components/Calendar/CalendarScrollEvents.js.flow +15 -15
- package/components/Calendar/CalendarUtils.js.flow +35 -35
- package/components/Calendar/DayCellView.js.flow +16 -16
- package/components/Calendar/DayCellViewModel.js.flow +9 -9
- package/components/Calendar/Month.js.flow +23 -23
- package/components/Calendar/MonthView.js.flow +24 -24
- package/components/Calendar/MonthViewModel.js.flow +16 -16
- package/components/Calendar/config.js.flow +11 -11
- package/components/Calendar/index.js.flow +2 -2
- package/components/Calendar/presets.js.flow +21 -21
- package/components/Calendar/stepper.js.flow +2 -2
- package/components/Calendar/utils.js.flow +2 -2
- package/components/Center/Center.js.flow +15 -15
- package/components/Center/README.md +5 -5
- package/components/Center/index.js.flow +2 -2
- package/components/Checkbox/Checkbox.adapter.js.flow +4 -4
- package/components/Checkbox/Checkbox.js.flow +27 -27
- package/components/Checkbox/README.md +61 -61
- package/components/Checkbox/index.js.flow +2 -2
- package/components/ComboBox/ComboBox.js.flow +58 -58
- package/components/ComboBox/README.md +423 -423
- package/components/ComboBox/__mocks__/getCities.js.map +1 -1
- package/components/ComboBox/__mocks__/kladr.json +20002 -20002
- package/components/ComboBox/index.js.flow +2 -2
- package/components/ComboBoxOld/ComboBoxOld.adapter.js.map +1 -1
- package/components/ComboBoxOld/ComboBoxOld.d.ts +120 -120
- package/components/ComboBoxOld/ComboBoxOld.js +45 -45
- package/components/ComboBoxOld/ComboBoxOld.js.map +1 -1
- package/components/ComboBoxOld/ComboBoxRenderer.js.map +1 -1
- package/components/ComboBoxOld/README.md +83 -83
- package/components/ComboBoxOld/index.d.ts +1 -1
- package/components/ComboBoxOld/index.js.map +1 -1
- package/components/CurrencyInput/CurrencyHelper.js.flow +44 -44
- package/components/CurrencyInput/CurrencyInput.js.flow +30 -30
- package/components/CurrencyInput/CurrencyInputHelper.js.flow +38 -38
- package/components/CurrencyInput/CurrencyInputKeyboardActions.js.flow +19 -19
- package/components/CurrencyInput/CursorHelper.js.flow +15 -15
- package/components/CurrencyInput/README.md +19 -19
- package/components/CurrencyInput/SelectionHelper.js.flow +16 -16
- package/components/CurrencyInput/index.js.flow +2 -2
- package/components/CurrencyLabel/CurrencyLabel.js.flow +10 -10
- package/components/CurrencyLabel/README.md +23 -23
- package/components/CurrencyLabel/index.js.flow +2 -2
- package/components/CustomComboBox/ComboBoxMenu.js.flow +22 -22
- package/components/CustomComboBox/ComboBoxView.js.flow +52 -52
- package/components/CustomComboBox/CustomComboBox.js.flow +130 -130
- package/components/CustomComboBox/index.js.flow +2 -2
- package/components/DateInput/DateInput.js.flow +60 -60
- package/components/DateInput/README.md +104 -104
- package/components/DateInput/helpers/DateInputKeyboardActions.js.flow +17 -17
- package/components/DateInput/helpers/SelectionHelpers.js.flow +3 -3
- package/components/DateInput/helpers/inputNumber.js.flow +4 -4
- package/components/DateInput/index.js.flow +2 -2
- package/components/DatePicker/DatePicker.js.flow +45 -45
- package/components/DatePicker/DatePickerHelpers.js.flow +7 -7
- package/components/DatePicker/DateShape.js.flow +11 -11
- package/components/DatePicker/Picker.js.flow +23 -23
- package/components/DatePicker/README.md +307 -307
- package/components/DatePicker/index.js.flow +2 -2
- package/components/DatePickerOld/Calendar.js.map +1 -1
- package/components/DatePickerOld/CalendarCell.js.map +1 -1
- package/components/DatePickerOld/DateInput.js +2 -2
- package/components/DatePickerOld/DateInput.js.map +1 -1
- package/components/DatePickerOld/DatePicker.adapter.js.map +1 -1
- package/components/DatePickerOld/DatePickerOld.d.ts +35 -35
- package/components/DatePickerOld/DatePickerOld.js +16 -16
- package/components/DatePickerOld/DatePickerOld.js.map +1 -1
- package/components/DatePickerOld/Picker.js.map +1 -1
- package/components/DatePickerOld/README.md +7 -7
- package/components/DatePickerOld/dateParser.js.map +1 -1
- package/components/DatePickerOld/index.d.ts +1 -1
- package/components/DatePickerOld/index.js.map +1 -1
- package/components/DateSelect/DateSelect.js.flow +30 -30
- package/components/DateSelect/index.js.flow +2 -2
- package/components/Dropdown/Dropdown.js.flow +41 -41
- package/components/Dropdown/README.md +14 -14
- package/components/Dropdown/index.js.flow +2 -2
- package/components/DropdownContainer/DropdownContainer.js.flow +29 -29
- package/components/DropdownMenu/DropdownMenu.js.flow +20 -20
- package/components/DropdownMenu/README.md +66 -66
- package/components/DropdownMenu/index.js.flow +2 -2
- package/components/Fias/Fias.js.flow +37 -37
- package/components/Fias/FiasModal.js.flow +12 -12
- package/components/Fias/FiasSearch/FiasSearch.js.flow +32 -32
- package/components/Fias/FiasSearch/README.md +78 -78
- package/components/Fias/Form/FiasComboBox.js.flow +25 -25
- package/components/Fias/Form/FiasForm.js.flow +21 -21
- package/components/Fias/README.md +436 -436
- package/components/Fias/api/APIResultFactory.js.flow +7 -7
- package/components/Fias/api/FiasAPI.js.flow +13 -13
- package/components/Fias/api/MockAPI.js.flow +13 -13
- package/components/Fias/api/data.json +285 -285
- package/components/Fias/constants/abbreviations.js.flow +7 -7
- package/components/Fias/index.js.flow +5 -5
- package/components/Fias/locale/types.js.flow +71 -71
- package/components/Fias/logger/Logger.js.flow +13 -13
- package/components/Fias/models/Address.js.flow +57 -57
- package/components/Fias/models/AddressElement.js.flow +15 -15
- package/components/Fias/models/FiasData.js.flow +10 -10
- package/components/Fias/types.js.flow +133 -133
- package/components/FxInput/FxInput.adapter.js.flow +4 -4
- package/components/FxInput/FxInput.js.flow +24 -24
- package/components/FxInput/README.md +13 -13
- package/components/FxInput/index.js.flow +2 -2
- package/components/Gapped/Gapped.js.flow +13 -13
- package/components/Gapped/README.md +6 -6
- package/components/Gapped/index.js.flow +2 -2
- package/components/Group/Group.js.flow +14 -14
- package/components/Group/README.md +27 -27
- package/components/Group/index.js.flow +2 -2
- package/components/HideBodyVerticalScroll/HideBodyVerticalScroll.js.flow +7 -7
- package/components/HideBodyVerticalScroll/index.js.flow +2 -2
- package/components/Hint/Hint.js.flow +37 -37
- package/components/Hint/README.md +3 -3
- package/components/Hint/index.js.flow +2 -2
- package/components/Icon/20px/Icon.js.flow +27 -27
- package/components/Icon/20px/index.js.flow +2 -2
- package/components/Icon/README.md +64 -64
- package/components/IgnoreLayerClick/IgnoreLayerClick.js.flow +12 -12
- package/components/IgnoreLayerClick/index.js.flow +2 -2
- package/components/Input/Input.adapter.js.flow +9 -9
- package/components/Input/Input.js.flow +55 -55
- package/components/Input/README.md +13 -13
- package/components/Input/index.js.flow +2 -2
- package/components/Kebab/Kebab.js.flow +23 -23
- package/components/Kebab/README.md +44 -44
- package/components/Kebab/index.js.flow +2 -2
- package/components/Kladr/AddressModal.d.ts +39 -39
- package/components/Kladr/AddressModal.js.flow +20 -20
- package/components/Kladr/AddressModal.js.map +1 -1
- package/components/Kladr/Kladr.d.ts +39 -39
- package/components/Kladr/Kladr.js +2 -2
- package/components/Kladr/Kladr.js.flow +27 -27
- package/components/Kladr/Kladr.js.map +1 -1
- package/components/Kladr/KladrAPI.d.ts +8 -8
- package/components/Kladr/KladrAPI.js +7 -2
- package/components/Kladr/KladrAPI.js.flow +8 -8
- package/components/Kladr/KladrAPI.js.map +1 -1
- package/components/Kladr/README.md +3 -3
- package/components/Kladr/Types.d.ts +40 -40
- package/components/Kladr/Types.js.flow +39 -39
- package/components/Kladr/index.d.ts +1 -1
- package/components/Kladr/index.js.flow +2 -2
- package/components/Kladr/index.js.map +1 -1
- package/components/Kladr/util.js.map +1 -1
- package/components/Kladr/utils.d.ts +4 -4
- package/components/Kladr/utils.js.flow +4 -4
- package/components/Link/Link.adapter.js.flow +4 -4
- package/components/Link/Link.js.flow +25 -25
- package/components/Link/README.md +11 -11
- package/components/Link/index.js.flow +2 -2
- package/components/Loader/Loader.js.flow +20 -20
- package/components/Loader/README.md +25 -25
- package/components/Loader/index.js.flow +2 -2
- package/components/Logotype/Logotype.js.flow +21 -21
- package/components/Logotype/ProductWidget.js.flow +7 -7
- package/components/Logotype/README.md +32 -32
- package/components/Logotype/index.js.flow +2 -2
- package/components/Menu/Menu.js.flow +24 -24
- package/components/Menu/isActiveElement.js.flow +7 -7
- package/components/MenuHeader/MenuHeader.js.flow +11 -11
- package/components/MenuHeader/index.js.flow +2 -2
- package/components/MenuItem/MenuItem.js.flow +33 -33
- package/components/MenuItem/README.md +5 -5
- package/components/MenuItem/index.js.flow +2 -2
- package/components/MenuSeparator/MenuSeparator.js.flow +7 -7
- package/components/MenuSeparator/index.js.flow +2 -2
- package/components/Modal/Modal.adapter.js.flow +4 -4
- package/components/Modal/Modal.js.flow +30 -30
- package/components/Modal/Modal.js.map +1 -1
- package/components/Modal/ModalBody.js.flow +7 -7
- package/components/Modal/ModalClose.js.flow +6 -6
- package/components/Modal/ModalContext.js.flow +15 -15
- package/components/Modal/ModalFooter.js.flow +11 -11
- package/components/Modal/ModalHeader.js.flow +11 -11
- package/components/Modal/README.md +38 -38
- package/components/Modal/index.js.flow +2 -2
- package/components/ModalStack/ModalStack.d.ts +4 -2
- package/components/ModalStack/ModalStack.js +13 -2
- package/components/ModalStack/ModalStack.js.flow +10 -10
- package/components/ModalStack/ModalStack.js.map +1 -1
- package/components/ModalStack/index.js.flow +2 -2
- package/components/Paging/NavigationHelper.js.flow +13 -13
- package/components/Paging/Paging.js.flow +38 -38
- package/components/Paging/PagingHelper.js.flow +10 -10
- package/components/Paging/README.md +43 -43
- package/components/Paging/index.js.flow +2 -2
- package/components/PasswordInput/PasswordInput.js.flow +26 -26
- package/components/PasswordInput/PasswordInputFallback.js.flow +13 -13
- package/components/PasswordInput/getCharHelper.js.flow +4 -4
- package/components/PasswordInput/index.js.flow +2 -2
- package/components/PhoneInput/PhoneInput.js +2 -2
- package/components/PhoneInput/PhoneInput.js.map +1 -1
- package/components/PhoneInput/index.js.map +1 -1
- package/components/Popup/Popup.js.flow +60 -60
- package/components/Popup/PopupHelper.js.flow +29 -29
- package/components/Popup/PopupPin.js.flow +15 -15
- package/components/Popup/index.js.flow +2 -2
- package/components/Radio/README.md +14 -14
- package/components/Radio/Radio.js.flow +33 -33
- package/components/Radio/index.js.flow +2 -2
- package/components/RadioGroup/Prevent.js.flow +9 -9
- package/components/RadioGroup/README.md +44 -44
- package/components/RadioGroup/RadioGroup.adapter.js.flow +4 -4
- package/components/RadioGroup/RadioGroup.js +1 -1
- package/components/RadioGroup/RadioGroup.js.flow +42 -42
- package/components/RadioGroup/RadioGroup.js.map +1 -1
- package/components/RadioGroup/index.js.flow +2 -2
- package/components/RenderContainer/RenderContainer.js.flow +11 -11
- package/components/RenderContainer/index.js.flow +2 -2
- package/components/RenderLayer/RenderLayer.js.flow +12 -12
- package/components/RenderLayer/index.js.flow +2 -2
- package/components/ScrollContainer/README.md +60 -60
- package/components/ScrollContainer/ScrollContainer.js.flow +24 -24
- package/components/ScrollContainer/index.js.flow +2 -2
- package/components/Select/Item.js.flow +7 -7
- package/components/Select/README.md +23 -23
- package/components/Select/Select.adapter.js.flow +4 -4
- package/components/Select/Select.js.flow +81 -81
- package/components/Select/index.js.flow +2 -2
- package/components/SidePage/README.md +46 -46
- package/components/SidePage/SidePage.js.flow +34 -34
- package/components/SidePage/SidePage.js.map +1 -1
- package/components/SidePage/SidePageBody.js.flow +13 -13
- package/components/SidePage/SidePageContainer.js.flow +9 -9
- package/components/SidePage/SidePageContext.js.flow +15 -15
- package/components/SidePage/SidePageFooter.js.flow +16 -16
- package/components/SidePage/SidePageHeader.js.flow +11 -11
- package/components/SidePage/index.js.flow +2 -2
- package/components/Spinner/README.md +33 -33
- package/components/Spinner/Spinner.js.flow +20 -20
- package/components/Spinner/SpinnerFallback.js.flow +15 -15
- package/components/Spinner/index.js.flow +2 -2
- package/components/Spinner/settings.js.flow +48 -48
- package/components/Sticky/README.md +27 -27
- package/components/Sticky/Sticky.js.flow +22 -22
- package/components/Sticky/index.js.flow +2 -2
- package/components/Switcher/README.md +10 -10
- package/components/Switcher/Switcher.js.flow +26 -26
- package/components/Switcher/index.js.flow +2 -2
- package/components/Tabs/Indicator.js.flow +21 -21
- package/components/Tabs/README.md +28 -28
- package/components/Tabs/Tab.js.flow +48 -48
- package/components/Tabs/Tabs.js.flow +28 -28
- package/components/Tabs/index.js.flow +2 -2
- package/components/Textarea/README.md +9 -9
- package/components/Textarea/Textarea.adapter.js.flow +11 -11
- package/components/Textarea/Textarea.js.flow +33 -33
- package/components/Textarea/TextareaHelpers.js.flow +6 -6
- package/components/Textarea/index.js.flow +2 -2
- package/components/ThemeProvider/Playground/README.md +7 -7
- package/components/ThemeProvider/README.md +172 -172
- package/components/ThemeShowcase/README.md +13 -13
- package/components/Toast/README.md +39 -39
- package/components/Toast/Toast.js.flow +29 -29
- package/components/Toast/ToastStatic.js.flow +10 -10
- package/components/Toast/ToastView.js.flow +16 -16
- package/components/Toast/index.js.flow +2 -2
- package/components/Toggle/README.md +9 -9
- package/components/Toggle/Toggle.js.flow +28 -28
- package/components/Toggle/index.js.flow +2 -2
- package/components/Token/README.md +109 -109
- package/components/Token/Token.js.flow +25 -25
- package/components/Token/TokenRemoveIcon.js.flow +11 -11
- package/components/Token/index.js.flow +2 -2
- package/components/TokenInput/README.md +82 -82
- package/components/TokenInput/TextWidthHelper.js.flow +10 -10
- package/components/TokenInput/TokenInput.js.flow +39 -39
- package/components/TokenInput/TokenInputMenu.js.flow +17 -17
- package/components/TokenInput/TokenInputReducer.js.flow +63 -63
- package/components/TokenInput/index.js.flow +2 -2
- package/components/Tooltip/README.md +207 -207
- package/components/Tooltip/Tooltip.js.flow +33 -33
- package/components/Tooltip/index.js.flow +2 -2
- package/components/TooltipMenu/README.md +106 -106
- package/components/TooltipMenu/TooltipMenu.js.flow +19 -19
- package/components/TooltipMenu/index.js.flow +2 -2
- package/components/TopBar/ButtonItem.js.flow +22 -22
- package/components/TopBar/Divider.js.flow +5 -5
- package/components/TopBar/Item.js.flow +19 -19
- package/components/TopBar/Organizations.js.flow +16 -16
- package/components/TopBar/README.md +112 -112
- package/components/TopBar/TopBar.js.flow +53 -53
- package/components/TopBar/TopBarDropdown.js.flow +23 -23
- package/components/TopBar/TopBarEnd.js.flow +4 -4
- package/components/TopBar/TopBarLogout.js.flow +6 -6
- package/components/TopBar/TopBarStart.js.flow +4 -4
- package/components/TopBar/User.js.flow +9 -9
- package/components/TopBar/index.js.flow +2 -2
- package/components/ZIndex/ZIndex.js.flow +11 -11
- package/components/ZIndex/index.js.flow +2 -2
- package/components/__mocks__/react-addons-css-transition-group.js.map +1 -1
- package/components/all.js.flow +36 -36
- package/components/ensureOldIEClassName.js.flow +6 -6
- package/components/eventHandlers.js.flow +9 -9
- package/components/index.js.flow +2 -2
- package/components/internal/InputLikeText/InputLikeText.js.flow +24 -24
- package/components/internal/InputLikeText/index.js.flow +2 -2
- package/components/internal/InternalMenu/InternalMenu.js.flow +23 -23
- package/components/internal/InternalMenu/isActiveElement.js.flow +7 -7
- package/components/internal/MaskedInput/MaskedInput.js.flow +24 -24
- package/components/internal/MaskedInput/index.js.flow +2 -2
- package/components/internal/MockDate.js.flow +9 -9
- package/components/internal/PopupMenu/PopupMenu.js.flow +40 -40
- package/components/internal/PopupMenu/PopupMenuPositions.js.flow +4 -4
- package/components/internal/PopupMenu/index.js.flow +2 -2
- package/components/internal/PopupMenu/validatePositions.js.flow +4 -4
- package/components/internal/ResizeDetector/ResizeDetector.js.flow +8 -8
- package/components/internal/ResizeDetector/index.js.flow +2 -2
- package/components/internal/createPropsGetter.js.flow +8 -8
- package/components/internal/cross.js.flow +4 -4
- package/components/internal/currentEnvironment.js.flow +4 -4
- package/components/internal/extractKeyboardAction.js.flow +12 -12
- package/components/polyfillPlaceholder.js.flow +4 -4
- package/package.json +1 -4
- package/typings/console.d.ts +3 -3
- package/typings/event-types.d.ts +4 -4
- package/typings/fbjs.d.ts +4 -4
- package/typings/global.d.ts +6 -6
- package/typings/images.d.ts +1 -1
- package/typings/less.d.ts +4 -4
- package/typings/mocha/index.d.ts +2 -2
- package/typings/mockdate.d.ts +1 -1
- package/typings/normalize-wheel.d.ts +1 -1
- package/typings/raf.d.ts +1 -1
- package/typings/react-addons-css-transition-group.d.ts +1 -1
- package/typings/react-testing/index.d.ts +4 -4
- package/typings/react-testing/window.d.ts +5 -5
- package/typings/react.d.ts +8 -8
- package/typings/utility-types.d.ts +17 -17
|
@@ -1,172 +1,172 @@
|
|
|
1
|
-
Кастомизация компонентов с помощью библиотеки [`emotion`](https://github.com/emotion-js/emotion)
|
|
2
|
-
|
|
3
|
-
ThemeProvider - компонент, передающий объект темы вниз по дереву с помощью полифила [`create-react-context.`](https://github.com/jamiebuilds/create-react-context)
|
|
4
|
-
|
|
5
|
-
Принимает в качестве пропов `children: React.ReactNode` и `value` типа `IThemeIn`:
|
|
6
|
-
|
|
7
|
-
```typescript
|
|
8
|
-
import defaultThemeVariables from './components/variables.less';
|
|
9
|
-
import flatThemeVariables from './components/variables.flat.less';
|
|
10
|
-
|
|
11
|
-
type ThemeType = typeof defaultThemeVariables & typeof flatThemeVariables;
|
|
12
|
-
type ThemeInType = Partial<ThemeType>;
|
|
13
|
-
|
|
14
|
-
interface IThemeIn extends ThemeInType {}
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
В качестве базовой темы выступает объект, полученный из переменных `variables.less`. Объект, переданный в `value` будет смерджен с объектом базовой темой.
|
|
18
|
-
|
|
19
|
-
Помимо базовой темы, есть плоская тема, собранная из переменных `variables.flat.less`.
|
|
20
|
-
Объект плоской темы можно импортировать и передавать в ThemeProvider:
|
|
21
|
-
|
|
22
|
-
```jsx
|
|
23
|
-
const { default: ThemeProvider } = require('./ThemeProvider');
|
|
24
|
-
const { default: flatTheme } = require('../../lib/theming/themes/FlatTheme');
|
|
25
|
-
const { ShowcaseGroup } = require('./Playground/ShowcaseGroup');
|
|
26
|
-
|
|
27
|
-
const FlatComponents = () => (
|
|
28
|
-
<ThemeProvider value={flatTheme}>
|
|
29
|
-
<ShowcaseGroup />
|
|
30
|
-
</ThemeProvider>
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
<FlatComponents />;
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
### Варианты кастомизации:
|
|
37
|
-
|
|
38
|
-
Несколько тем одновременно:
|
|
39
|
-
<br/>
|
|
40
|
-
|
|
41
|
-
```jsx
|
|
42
|
-
const { default: ThemeProvider } = require('./ThemeProvider');
|
|
43
|
-
const { default: flatTheme } = require('../../lib/theming/themes/FlatTheme');
|
|
44
|
-
const { ShowcaseGroup } = require('./Playground/ShowcaseGroup');
|
|
45
|
-
|
|
46
|
-
const CombinedComponents = () => (
|
|
47
|
-
<>
|
|
48
|
-
<ShowcaseGroup title="Default" />
|
|
49
|
-
<ThemeProvider value={flatTheme}>
|
|
50
|
-
<div>
|
|
51
|
-
<ShowcaseGroup title="Flat" />
|
|
52
|
-
</div>
|
|
53
|
-
</ThemeProvider>
|
|
54
|
-
</>
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
<CombinedComponents />;
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
Вложенные темы:
|
|
61
|
-
<br/>
|
|
62
|
-
|
|
63
|
-
```jsx
|
|
64
|
-
const { default: ThemeProvider } = require('./ThemeProvider');
|
|
65
|
-
const { default: flatTheme } = require('../../lib/theming/themes/FlatTheme');
|
|
66
|
-
const { default: defaultTheme } = require('../../lib/theming/themes/DefaultTheme');
|
|
67
|
-
const { default: darkTheme } = require('./Playground/darkTheme');
|
|
68
|
-
const { ShowcaseGroup } = require('./Playground/ShowcaseGroup');
|
|
69
|
-
|
|
70
|
-
const wrapperStyles = {
|
|
71
|
-
border: '1px solid rgb(188, 187, 187)',
|
|
72
|
-
padding: '0 15px 15px',
|
|
73
|
-
marginTop: 25,
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const NestedThemes = () => (
|
|
77
|
-
<ThemeProvider value={flatTheme}>
|
|
78
|
-
<div style={{ ...wrapperStyles, width: 750 }}>
|
|
79
|
-
<ShowcaseGroup title="Flat Theme" />
|
|
80
|
-
<ThemeProvider value={defaultTheme}>
|
|
81
|
-
<div style={wrapperStyles}>
|
|
82
|
-
<ShowcaseGroup title="Default Theme" />
|
|
83
|
-
<ThemeProvider value={darkTheme}>
|
|
84
|
-
<div style={{ ...wrapperStyles, background: '#000', color: '#fff' }}>
|
|
85
|
-
<ShowcaseGroup title="Dark Theme" />
|
|
86
|
-
</div>
|
|
87
|
-
</ThemeProvider>
|
|
88
|
-
</div>
|
|
89
|
-
</ThemeProvider>
|
|
90
|
-
</div>
|
|
91
|
-
</ThemeProvider>
|
|
92
|
-
);
|
|
93
|
-
|
|
94
|
-
<NestedThemes />;
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
### Переход с кастомизации с помощью `less`
|
|
98
|
-
|
|
99
|
-
Для перехода с кастомизации посредстовом переопределения less-переменных, необходимо превратить less-переменные в объект темы.
|
|
100
|
-
Это можно сделать с помощью <a target="_blank" href="https://raw.githubusercontent.com/skbkontur/retail-ui/master/packages/react-ui-codemodes/customization/variablesConverter.js">скрипта</a>
|
|
101
|
-
|
|
102
|
-
Скрипту необходимо передать два параметра: `variables` - путь до файла с перменными и `output` - путь до файла, в который нужно записать объект темы. Если по пути, переданному в `output`, файла не существует, файл будет создан. В противном случае, он будет перезаписан.
|
|
103
|
-
|
|
104
|
-
Перед запуском скрипт необходимо скачать и положить в папку с проектом. В процессе конвертации используется пакет [less.js](https://www.npmjs.com/package/less), который скрипт возьмет из зависимостей проекта.
|
|
105
|
-
|
|
106
|
-
Пример использования:
|
|
107
|
-
|
|
108
|
-
```shell
|
|
109
|
-
node variablesConverter.js variables=../../less/myVariables.less output=../theme/theme.js
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
Для следующего содержимого myVariables.less:
|
|
113
|
-
|
|
114
|
-
```less
|
|
115
|
-
@btn-danger-bg: #e14c30;
|
|
116
|
-
@warning-main: #f69c00;
|
|
117
|
-
@error-main: #d70c17;
|
|
118
|
-
@border-color-gray-dark: rgba(0, 0, 0, 0.28);
|
|
119
|
-
@border-color-gray-light: rgba(0, 0, 0, 0.15);
|
|
120
|
-
@tab-color-hover-error: lighten(@btn-danger-bg, 20%);
|
|
121
|
-
@toggle-bg-warning: @warning-main;
|
|
122
|
-
@toggle-bg-error: @error-main;
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
Сгенерируется файл theme.js:
|
|
126
|
-
|
|
127
|
-
```typescript
|
|
128
|
-
export default {
|
|
129
|
-
btnDangerBg: '#e14c30',
|
|
130
|
-
warningMain: '#f69c00',
|
|
131
|
-
errorMain: '#d70c17',
|
|
132
|
-
borderColorGrayDark: 'rgba(0, 0, 0, 0.28)',
|
|
133
|
-
borderColorGrayLight: 'rgba(0, 0, 0, 0.15)',
|
|
134
|
-
tabColorHoverError: '#ee9989',
|
|
135
|
-
toggleBgWarning: '#f69c00',
|
|
136
|
-
toggleBgError: '#d70c17',
|
|
137
|
-
};
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
Далее объект из theme.js можно передавать в ThemeProvider:
|
|
141
|
-
|
|
142
|
-
```typescript
|
|
143
|
-
import ReactDOM from 'react-dom';
|
|
144
|
-
import React from 'react';
|
|
145
|
-
import ThemeProvider from '${retail-ui|@skbkontur/react-ui}/components/ThemeProvider';
|
|
146
|
-
|
|
147
|
-
import App from './components/App';
|
|
148
|
-
import theme from './theme/theme';
|
|
149
|
-
|
|
150
|
-
ReactDOM.render(
|
|
151
|
-
<ThemeProvider value={theme}>
|
|
152
|
-
<App />
|
|
153
|
-
</ThemeProvider>,
|
|
154
|
-
document.getElementById('app'),
|
|
155
|
-
);
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
В случае, если приложение не является полноценным React-приложением, и тему нужно переопределить единоразово, то можно воспользоваться методом `overrideDefaultTheme` в `ThemeFactory`:
|
|
159
|
-
|
|
160
|
-
```typescript
|
|
161
|
-
// точка входа в приложение
|
|
162
|
-
...
|
|
163
|
-
import theme from './theme/theme';
|
|
164
|
-
import ThemeFactory from '${retail-ui|@skbkontur/react-ui}/lib/theming/ThemeFactory';
|
|
165
|
-
|
|
166
|
-
ThemeFactory.overrideDefaultTheme(theme);
|
|
167
|
-
...
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
### Список кастомизируемых компонентов
|
|
171
|
-
|
|
172
|
-
Посмотреть, какие компоненты можно кастомизировать, а также увидеть, какие переменные используются в каждом из них, можно в [таблице](#/Customization/ThemeShowcase)
|
|
1
|
+
Кастомизация компонентов с помощью библиотеки [`emotion`](https://github.com/emotion-js/emotion)
|
|
2
|
+
|
|
3
|
+
ThemeProvider - компонент, передающий объект темы вниз по дереву с помощью полифила [`create-react-context.`](https://github.com/jamiebuilds/create-react-context)
|
|
4
|
+
|
|
5
|
+
Принимает в качестве пропов `children: React.ReactNode` и `value` типа `IThemeIn`:
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import defaultThemeVariables from './components/variables.less';
|
|
9
|
+
import flatThemeVariables from './components/variables.flat.less';
|
|
10
|
+
|
|
11
|
+
type ThemeType = typeof defaultThemeVariables & typeof flatThemeVariables;
|
|
12
|
+
type ThemeInType = Partial<ThemeType>;
|
|
13
|
+
|
|
14
|
+
interface IThemeIn extends ThemeInType {}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
В качестве базовой темы выступает объект, полученный из переменных `variables.less`. Объект, переданный в `value` будет смерджен с объектом базовой темой.
|
|
18
|
+
|
|
19
|
+
Помимо базовой темы, есть плоская тема, собранная из переменных `variables.flat.less`.
|
|
20
|
+
Объект плоской темы можно импортировать и передавать в ThemeProvider:
|
|
21
|
+
|
|
22
|
+
```jsx
|
|
23
|
+
const { default: ThemeProvider } = require('./ThemeProvider');
|
|
24
|
+
const { default: flatTheme } = require('../../lib/theming/themes/FlatTheme');
|
|
25
|
+
const { ShowcaseGroup } = require('./Playground/ShowcaseGroup');
|
|
26
|
+
|
|
27
|
+
const FlatComponents = () => (
|
|
28
|
+
<ThemeProvider value={flatTheme}>
|
|
29
|
+
<ShowcaseGroup />
|
|
30
|
+
</ThemeProvider>
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
<FlatComponents />;
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Варианты кастомизации:
|
|
37
|
+
|
|
38
|
+
Несколько тем одновременно:
|
|
39
|
+
<br/>
|
|
40
|
+
|
|
41
|
+
```jsx
|
|
42
|
+
const { default: ThemeProvider } = require('./ThemeProvider');
|
|
43
|
+
const { default: flatTheme } = require('../../lib/theming/themes/FlatTheme');
|
|
44
|
+
const { ShowcaseGroup } = require('./Playground/ShowcaseGroup');
|
|
45
|
+
|
|
46
|
+
const CombinedComponents = () => (
|
|
47
|
+
<>
|
|
48
|
+
<ShowcaseGroup title="Default" />
|
|
49
|
+
<ThemeProvider value={flatTheme}>
|
|
50
|
+
<div>
|
|
51
|
+
<ShowcaseGroup title="Flat" />
|
|
52
|
+
</div>
|
|
53
|
+
</ThemeProvider>
|
|
54
|
+
</>
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
<CombinedComponents />;
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Вложенные темы:
|
|
61
|
+
<br/>
|
|
62
|
+
|
|
63
|
+
```jsx
|
|
64
|
+
const { default: ThemeProvider } = require('./ThemeProvider');
|
|
65
|
+
const { default: flatTheme } = require('../../lib/theming/themes/FlatTheme');
|
|
66
|
+
const { default: defaultTheme } = require('../../lib/theming/themes/DefaultTheme');
|
|
67
|
+
const { default: darkTheme } = require('./Playground/darkTheme');
|
|
68
|
+
const { ShowcaseGroup } = require('./Playground/ShowcaseGroup');
|
|
69
|
+
|
|
70
|
+
const wrapperStyles = {
|
|
71
|
+
border: '1px solid rgb(188, 187, 187)',
|
|
72
|
+
padding: '0 15px 15px',
|
|
73
|
+
marginTop: 25,
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const NestedThemes = () => (
|
|
77
|
+
<ThemeProvider value={flatTheme}>
|
|
78
|
+
<div style={{ ...wrapperStyles, width: 750 }}>
|
|
79
|
+
<ShowcaseGroup title="Flat Theme" />
|
|
80
|
+
<ThemeProvider value={defaultTheme}>
|
|
81
|
+
<div style={wrapperStyles}>
|
|
82
|
+
<ShowcaseGroup title="Default Theme" />
|
|
83
|
+
<ThemeProvider value={darkTheme}>
|
|
84
|
+
<div style={{ ...wrapperStyles, background: '#000', color: '#fff' }}>
|
|
85
|
+
<ShowcaseGroup title="Dark Theme" />
|
|
86
|
+
</div>
|
|
87
|
+
</ThemeProvider>
|
|
88
|
+
</div>
|
|
89
|
+
</ThemeProvider>
|
|
90
|
+
</div>
|
|
91
|
+
</ThemeProvider>
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
<NestedThemes />;
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Переход с кастомизации с помощью `less`
|
|
98
|
+
|
|
99
|
+
Для перехода с кастомизации посредстовом переопределения less-переменных, необходимо превратить less-переменные в объект темы.
|
|
100
|
+
Это можно сделать с помощью <a target="_blank" href="https://raw.githubusercontent.com/skbkontur/retail-ui/master/packages/react-ui-codemodes/customization/variablesConverter.js">скрипта</a>
|
|
101
|
+
|
|
102
|
+
Скрипту необходимо передать два параметра: `variables` - путь до файла с перменными и `output` - путь до файла, в который нужно записать объект темы. Если по пути, переданному в `output`, файла не существует, файл будет создан. В противном случае, он будет перезаписан.
|
|
103
|
+
|
|
104
|
+
Перед запуском скрипт необходимо скачать и положить в папку с проектом. В процессе конвертации используется пакет [less.js](https://www.npmjs.com/package/less), который скрипт возьмет из зависимостей проекта.
|
|
105
|
+
|
|
106
|
+
Пример использования:
|
|
107
|
+
|
|
108
|
+
```shell
|
|
109
|
+
node variablesConverter.js variables=../../less/myVariables.less output=../theme/theme.js
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Для следующего содержимого myVariables.less:
|
|
113
|
+
|
|
114
|
+
```less
|
|
115
|
+
@btn-danger-bg: #e14c30;
|
|
116
|
+
@warning-main: #f69c00;
|
|
117
|
+
@error-main: #d70c17;
|
|
118
|
+
@border-color-gray-dark: rgba(0, 0, 0, 0.28);
|
|
119
|
+
@border-color-gray-light: rgba(0, 0, 0, 0.15);
|
|
120
|
+
@tab-color-hover-error: lighten(@btn-danger-bg, 20%);
|
|
121
|
+
@toggle-bg-warning: @warning-main;
|
|
122
|
+
@toggle-bg-error: @error-main;
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Сгенерируется файл theme.js:
|
|
126
|
+
|
|
127
|
+
```typescript
|
|
128
|
+
export default {
|
|
129
|
+
btnDangerBg: '#e14c30',
|
|
130
|
+
warningMain: '#f69c00',
|
|
131
|
+
errorMain: '#d70c17',
|
|
132
|
+
borderColorGrayDark: 'rgba(0, 0, 0, 0.28)',
|
|
133
|
+
borderColorGrayLight: 'rgba(0, 0, 0, 0.15)',
|
|
134
|
+
tabColorHoverError: '#ee9989',
|
|
135
|
+
toggleBgWarning: '#f69c00',
|
|
136
|
+
toggleBgError: '#d70c17',
|
|
137
|
+
};
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Далее объект из theme.js можно передавать в ThemeProvider:
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
import ReactDOM from 'react-dom';
|
|
144
|
+
import React from 'react';
|
|
145
|
+
import ThemeProvider from '${retail-ui|@skbkontur/react-ui}/components/ThemeProvider';
|
|
146
|
+
|
|
147
|
+
import App from './components/App';
|
|
148
|
+
import theme from './theme/theme';
|
|
149
|
+
|
|
150
|
+
ReactDOM.render(
|
|
151
|
+
<ThemeProvider value={theme}>
|
|
152
|
+
<App />
|
|
153
|
+
</ThemeProvider>,
|
|
154
|
+
document.getElementById('app'),
|
|
155
|
+
);
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
В случае, если приложение не является полноценным React-приложением, и тему нужно переопределить единоразово, то можно воспользоваться методом `overrideDefaultTheme` в `ThemeFactory`:
|
|
159
|
+
|
|
160
|
+
```typescript
|
|
161
|
+
// точка входа в приложение
|
|
162
|
+
...
|
|
163
|
+
import theme from './theme/theme';
|
|
164
|
+
import ThemeFactory from '${retail-ui|@skbkontur/react-ui}/lib/theming/ThemeFactory';
|
|
165
|
+
|
|
166
|
+
ThemeFactory.overrideDefaultTheme(theme);
|
|
167
|
+
...
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Список кастомизируемых компонентов
|
|
171
|
+
|
|
172
|
+
Посмотреть, какие компоненты можно кастомизировать, а также увидеть, какие переменные используются в каждом из них, можно в [таблице](#/Customization/ThemeShowcase)
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
### Таблица переменных
|
|
2
|
-
|
|
3
|
-
Список использующихся переменных для каждого кастомизируемого компонента.
|
|
4
|
-
<br/>
|
|
5
|
-
Таблица фильтруется по названию переменной.
|
|
6
|
-
<br/>
|
|
7
|
-
Значения в колонке `Variable name` кликабельны.
|
|
8
|
-
|
|
9
|
-
```jsx
|
|
10
|
-
const { default: ThemeShowcase } = require('./ThemeShowcase');
|
|
11
|
-
|
|
12
|
-
<ThemeShowcase />;
|
|
13
|
-
```
|
|
1
|
+
### Таблица переменных
|
|
2
|
+
|
|
3
|
+
Список использующихся переменных для каждого кастомизируемого компонента.
|
|
4
|
+
<br/>
|
|
5
|
+
Таблица фильтруется по названию переменной.
|
|
6
|
+
<br/>
|
|
7
|
+
Значения в колонке `Variable name` кликабельны.
|
|
8
|
+
|
|
9
|
+
```jsx
|
|
10
|
+
const { default: ThemeShowcase } = require('./ThemeShowcase');
|
|
11
|
+
|
|
12
|
+
<ThemeShowcase />;
|
|
13
|
+
```
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
Вызов статических методов
|
|
2
|
-
|
|
3
|
-
```js
|
|
4
|
-
const { default: Button } = require('../Button');
|
|
5
|
-
|
|
6
|
-
function showComplexNotification() {
|
|
7
|
-
Toast.push('Successfully saved', {
|
|
8
|
-
label: 'Cancel',
|
|
9
|
-
handler: () => Toast.push('Canceled'),
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
<Button onClick={showComplexNotification}>Show notification</Button>;
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
Использование `ref`
|
|
17
|
-
|
|
18
|
-
```js
|
|
19
|
-
class Toaster extends React.Component {
|
|
20
|
-
showNotification() {
|
|
21
|
-
this.notifier.push('Successfully');
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
render() {
|
|
25
|
-
return (
|
|
26
|
-
<div>
|
|
27
|
-
<Toast
|
|
28
|
-
ref={el => {
|
|
29
|
-
this.notifier = el;
|
|
30
|
-
}}
|
|
31
|
-
/>
|
|
32
|
-
<Button onClick={() => this.showNotification()}>Show notification</Button>
|
|
33
|
-
</div>
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
<Toaster />;
|
|
39
|
-
```
|
|
1
|
+
Вызов статических методов
|
|
2
|
+
|
|
3
|
+
```js
|
|
4
|
+
const { default: Button } = require('../Button');
|
|
5
|
+
|
|
6
|
+
function showComplexNotification() {
|
|
7
|
+
Toast.push('Successfully saved', {
|
|
8
|
+
label: 'Cancel',
|
|
9
|
+
handler: () => Toast.push('Canceled'),
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
<Button onClick={showComplexNotification}>Show notification</Button>;
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Использование `ref`
|
|
17
|
+
|
|
18
|
+
```js
|
|
19
|
+
class Toaster extends React.Component {
|
|
20
|
+
showNotification() {
|
|
21
|
+
this.notifier.push('Successfully');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
render() {
|
|
25
|
+
return (
|
|
26
|
+
<div>
|
|
27
|
+
<Toast
|
|
28
|
+
ref={el => {
|
|
29
|
+
this.notifier = el;
|
|
30
|
+
}}
|
|
31
|
+
/>
|
|
32
|
+
<Button onClick={() => this.showNotification()}>Show notification</Button>
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
<Toaster />;
|
|
39
|
+
```
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
/* @flow */
|
|
2
|
-
import ToastView from './ToastView';
|
|
3
|
-
|
|
4
|
-
export type Action = {|
|
|
5
|
-
label: string,
|
|
6
|
-
handler: () => void,
|
|
7
|
-
|};
|
|
8
|
-
|
|
9
|
-
export type ToastState = {|
|
|
10
|
-
notification: ?string,
|
|
11
|
-
action: ?Action,
|
|
12
|
-
id: number,
|
|
13
|
-
|};
|
|
14
|
-
|
|
15
|
-
export type ToastProps = {|
|
|
16
|
-
onPush?: (notification: string, action?: Action) => void,
|
|
17
|
-
onClose?: (notification: string, action?: Action) => void,
|
|
18
|
-
|};
|
|
19
|
-
|
|
20
|
-
declare class Toast extends React$Component<ToastProps, ToastState> {
|
|
21
|
-
static push(notification: string, action?: Action): void,
|
|
22
|
-
static close(): void,
|
|
23
|
-
|
|
24
|
-
_toast: ?ToastView,
|
|
25
|
-
push(notification: string, action?: Action): void,
|
|
26
|
-
close: () => void,
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export default Toast;
|
|
1
|
+
/* @flow */
|
|
2
|
+
import ToastView from './ToastView';
|
|
3
|
+
|
|
4
|
+
export type Action = {|
|
|
5
|
+
label: string,
|
|
6
|
+
handler: () => void,
|
|
7
|
+
|};
|
|
8
|
+
|
|
9
|
+
export type ToastState = {|
|
|
10
|
+
notification: ?string,
|
|
11
|
+
action: ?Action,
|
|
12
|
+
id: number,
|
|
13
|
+
|};
|
|
14
|
+
|
|
15
|
+
export type ToastProps = {|
|
|
16
|
+
onPush?: (notification: string, action?: Action) => void,
|
|
17
|
+
onClose?: (notification: string, action?: Action) => void,
|
|
18
|
+
|};
|
|
19
|
+
|
|
20
|
+
declare class Toast extends React$Component<ToastProps, ToastState> {
|
|
21
|
+
static push(notification: string, action?: Action): void,
|
|
22
|
+
static close(): void,
|
|
23
|
+
|
|
24
|
+
_toast: ?ToastView,
|
|
25
|
+
push(notification: string, action?: Action): void,
|
|
26
|
+
close: () => void,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default Toast;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/* @flow */
|
|
2
|
-
import type { Action } from './Toast';
|
|
3
|
-
|
|
4
|
-
declare class ToastStatic {
|
|
5
|
-
static push: (notification: string, action?: Action | void) => void,
|
|
6
|
-
static _push: (notification: string, action?: Action | void) => void,
|
|
7
|
-
static close: () => void,
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export default ToastStatic;
|
|
1
|
+
/* @flow */
|
|
2
|
+
import type { Action } from './Toast';
|
|
3
|
+
|
|
4
|
+
declare class ToastStatic {
|
|
5
|
+
static push: (notification: string, action?: Action | void) => void,
|
|
6
|
+
static _push: (notification: string, action?: Action | void) => void,
|
|
7
|
+
static close: () => void,
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default ToastStatic;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
/* @flow */
|
|
2
|
-
|
|
3
|
-
export type ToastViewProps = {|
|
|
4
|
-
children?: string,
|
|
5
|
-
action?: ?{|
|
|
6
|
-
label: string,
|
|
7
|
-
handler: () => void,
|
|
8
|
-
|},
|
|
9
|
-
onClose?: () => void,
|
|
10
|
-
onMouseEnter?: () => void,
|
|
11
|
-
onMouseLeave?: () => void,
|
|
12
|
-
|};
|
|
13
|
-
|
|
14
|
-
declare class ToastView extends React$Component<ToastViewProps> {}
|
|
15
|
-
|
|
16
|
-
export default ToastView;
|
|
1
|
+
/* @flow */
|
|
2
|
+
|
|
3
|
+
export type ToastViewProps = {|
|
|
4
|
+
children?: string,
|
|
5
|
+
action?: ?{|
|
|
6
|
+
label: string,
|
|
7
|
+
handler: () => void,
|
|
8
|
+
|},
|
|
9
|
+
onClose?: () => void,
|
|
10
|
+
onMouseEnter?: () => void,
|
|
11
|
+
onMouseLeave?: () => void,
|
|
12
|
+
|};
|
|
13
|
+
|
|
14
|
+
declare class ToastView extends React$Component<ToastViewProps> {}
|
|
15
|
+
|
|
16
|
+
export default ToastView;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* @flow */
|
|
2
|
-
export { default, ToastProps, ToastState } from './Toast';
|
|
1
|
+
/* @flow */
|
|
2
|
+
export { default, ToastProps, ToastState } from './Toast';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
```js
|
|
2
|
-
let initialState = { checked: false };
|
|
3
|
-
|
|
4
|
-
let toggle = () => setState(state => ({ checked: !state.checked }));
|
|
5
|
-
|
|
6
|
-
<div>
|
|
7
|
-
<Toggle checked={state.checked} onChange={toggle} /> {state.checked ? 'On' : 'Off'}
|
|
8
|
-
</div>;
|
|
9
|
-
```
|
|
1
|
+
```js
|
|
2
|
+
let initialState = { checked: false };
|
|
3
|
+
|
|
4
|
+
let toggle = () => setState(state => ({ checked: !state.checked }));
|
|
5
|
+
|
|
6
|
+
<div>
|
|
7
|
+
<Toggle checked={state.checked} onChange={toggle} /> {state.checked ? 'On' : 'Off'}
|
|
8
|
+
</div>;
|
|
9
|
+
```
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
/* @flow */
|
|
2
|
-
import type { InputEventHandler, FocusEventHandler } from '../eventHandlers';
|
|
3
|
-
|
|
4
|
-
export type ToggleProps = {|
|
|
5
|
-
checked?: boolean,
|
|
6
|
-
defaultChecked?: boolean,
|
|
7
|
-
disabled?: boolean,
|
|
8
|
-
onChange?: (value: boolean) => void,
|
|
9
|
-
changeEventHandler?: InputEventHandler<HTMLInputElement>,
|
|
10
|
-
warning?: boolean,
|
|
11
|
-
error?: boolean,
|
|
12
|
-
loading?: boolean,
|
|
13
|
-
autoFocus?: boolean,
|
|
14
|
-
onFocus?: FocusEventHandler<HTMLInputElement>,
|
|
15
|
-
onBlur?: FocusEventHandler<HTMLInputElement>,
|
|
16
|
-
color?: string,
|
|
17
|
-
|};
|
|
18
|
-
|
|
19
|
-
export type ToggleState = {|
|
|
20
|
-
checked?: boolean,
|
|
21
|
-
focusByTab?: boolean,
|
|
22
|
-
|};
|
|
23
|
-
|
|
24
|
-
declare class Toggle extends React$Component<ToggleProps, ToggleState> {
|
|
25
|
-
focus: () => void;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export default Toggle;
|
|
1
|
+
/* @flow */
|
|
2
|
+
import type { InputEventHandler, FocusEventHandler } from '../eventHandlers';
|
|
3
|
+
|
|
4
|
+
export type ToggleProps = {|
|
|
5
|
+
checked?: boolean,
|
|
6
|
+
defaultChecked?: boolean,
|
|
7
|
+
disabled?: boolean,
|
|
8
|
+
onChange?: (value: boolean) => void,
|
|
9
|
+
changeEventHandler?: InputEventHandler<HTMLInputElement>,
|
|
10
|
+
warning?: boolean,
|
|
11
|
+
error?: boolean,
|
|
12
|
+
loading?: boolean,
|
|
13
|
+
autoFocus?: boolean,
|
|
14
|
+
onFocus?: FocusEventHandler<HTMLInputElement>,
|
|
15
|
+
onBlur?: FocusEventHandler<HTMLInputElement>,
|
|
16
|
+
color?: string,
|
|
17
|
+
|};
|
|
18
|
+
|
|
19
|
+
export type ToggleState = {|
|
|
20
|
+
checked?: boolean,
|
|
21
|
+
focusByTab?: boolean,
|
|
22
|
+
|};
|
|
23
|
+
|
|
24
|
+
declare class Toggle extends React$Component<ToggleProps, ToggleState> {
|
|
25
|
+
focus: () => void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default Toggle;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* @flow */
|
|
2
|
-
export { default, ToggleProps } from './Toggle';
|
|
1
|
+
/* @flow */
|
|
2
|
+
export { default, ToggleProps } from './Toggle';
|