@skbkontur/react-ui 5.5.1 → 5.6.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/CHANGELOG.md +22 -0
- package/cjs/components/Calendar/MonthView.js +1 -2
- package/cjs/components/Calendar/MonthView.js.map +1 -1
- package/cjs/components/FileUploader/FileUploader.styles.js +4 -5
- package/cjs/components/FileUploader/FileUploader.styles.js.map +1 -1
- package/cjs/components/Modal/Modal.d.ts +25 -22
- package/cjs/components/Modal/Modal.js +10 -7
- package/cjs/components/Modal/Modal.js.map +1 -1
- package/cjs/components/Modal/ModalBody.d.ts +1 -1
- package/cjs/components/Modal/ModalBody.js +1 -1
- package/cjs/components/Modal/ModalBody.js.map +1 -1
- package/cjs/components/Modal/ModalFooter.d.ts +5 -5
- package/cjs/components/Modal/ModalFooter.js +1 -1
- package/cjs/components/Modal/ModalFooter.js.map +1 -1
- package/cjs/components/Modal/ModalHeader.d.ts +3 -3
- package/cjs/components/Modal/ModalHeader.js +1 -1
- package/cjs/components/Modal/ModalHeader.js.map +1 -1
- package/cjs/components/Radio/Radio.d.ts +11 -10
- package/cjs/components/Radio/Radio.js +5 -4
- package/cjs/components/Radio/Radio.js.map +1 -1
- package/cjs/components/RadioGroup/RadioGroup.d.ts +21 -28
- package/cjs/components/RadioGroup/RadioGroup.js +2 -9
- package/cjs/components/RadioGroup/RadioGroup.js.map +1 -1
- package/cjs/components/Tabs/Tab.styles.js +3 -9
- package/cjs/components/Tabs/Tab.styles.js.map +1 -1
- package/cjs/components/Textarea/Textarea.d.ts +5 -1
- package/cjs/components/Textarea/Textarea.js +10 -1
- package/cjs/components/Textarea/Textarea.js.map +1 -1
- package/cjs/internal/CustomComboBox/CustomComboBoxReducer.js +5 -0
- package/cjs/internal/CustomComboBox/CustomComboBoxReducer.js.map +1 -1
- package/cjs/internal/InternalTextareaWithLayout/InternalTextareaWithLayout.d.ts +1 -0
- package/cjs/internal/InternalTextareaWithLayout/InternalTextareaWithLayout.js +4 -1
- package/cjs/internal/InternalTextareaWithLayout/InternalTextareaWithLayout.js.map +1 -1
- package/cjs/internal/RenderContainer/RenderInnerContainer.d.ts +4 -0
- package/cjs/internal/RenderContainer/RenderInnerContainer.js +29 -2
- package/cjs/internal/RenderContainer/RenderInnerContainer.js.map +1 -1
- package/cjs/internal/ThemePlayground/Playground.styles.js +2 -1
- package/cjs/internal/ThemePlayground/Playground.styles.js.map +1 -1
- package/cjs/internal/ThemePlayground/ThemeContextPlayground.d.ts +1 -35
- package/cjs/internal/ThemePlayground/ThemeContextPlayground.js +32 -5
- package/cjs/internal/ThemePlayground/ThemeContextPlayground.js.map +1 -1
- package/cjs/internal/themes/DarkTheme5_5.js +3 -8
- package/cjs/internal/themes/DarkTheme5_5.js.map +1 -1
- package/cjs/internal/themes/DarkTheme5_6.d.ts +1 -0
- package/cjs/internal/themes/DarkTheme5_6.js +753 -0
- package/cjs/internal/themes/DarkTheme5_6.js.map +1 -0
- package/cjs/internal/themes/LightTheme5_6.d.ts +1 -0
- package/cjs/internal/themes/LightTheme5_6.js +753 -0
- package/cjs/internal/themes/LightTheme5_6.js.map +1 -0
- package/cjs/lib/theming/ThemeVersions.d.ts +1 -1
- package/cjs/lib/theming/ThemeVersions.js.map +1 -1
- package/cjs/lib/theming/themes/DarkTheme.d.ts +1 -0
- package/cjs/lib/theming/themes/DarkTheme.js +4 -2
- package/cjs/lib/theming/themes/DarkTheme.js.map +1 -1
- package/cjs/lib/theming/themes/LightTheme.d.ts +1 -0
- package/cjs/lib/theming/themes/LightTheme.js +4 -2
- package/cjs/lib/theming/themes/LightTheme.js.map +1 -1
- package/components/Calendar/MonthView/MonthView.js +1 -2
- package/components/Calendar/MonthView/MonthView.js.map +1 -1
- package/components/FileUploader/FileUploader.styles/FileUploader.styles.js +1 -2
- package/components/FileUploader/FileUploader.styles/FileUploader.styles.js.map +1 -1
- package/components/Modal/Modal/Modal.js +5 -7
- package/components/Modal/Modal/Modal.js.map +1 -1
- package/components/Modal/Modal.d.ts +25 -22
- package/components/Modal/ModalBody/ModalBody.js +1 -1
- package/components/Modal/ModalBody/ModalBody.js.map +1 -1
- package/components/Modal/ModalBody.d.ts +1 -1
- package/components/Modal/ModalFooter/ModalFooter.js +1 -1
- package/components/Modal/ModalFooter/ModalFooter.js.map +1 -1
- package/components/Modal/ModalFooter.d.ts +5 -5
- package/components/Modal/ModalHeader/ModalHeader.js +1 -1
- package/components/Modal/ModalHeader/ModalHeader.js.map +1 -1
- package/components/Modal/ModalHeader.d.ts +3 -3
- package/components/Radio/Radio/Radio.js +5 -4
- package/components/Radio/Radio/Radio.js.map +1 -1
- package/components/Radio/Radio.d.ts +11 -10
- package/components/RadioGroup/RadioGroup/RadioGroup.js +2 -9
- package/components/RadioGroup/RadioGroup/RadioGroup.js.map +1 -1
- package/components/RadioGroup/RadioGroup.d.ts +21 -28
- package/components/Tabs/Tab.styles/Tab.styles.js +1 -2
- package/components/Tabs/Tab.styles/Tab.styles.js.map +1 -1
- package/components/Textarea/Textarea/Textarea.js +5 -0
- package/components/Textarea/Textarea/Textarea.js.map +1 -1
- package/components/Textarea/Textarea.d.ts +5 -1
- package/internal/CustomComboBox/CustomComboBoxReducer/CustomComboBoxReducer.js +5 -0
- package/internal/CustomComboBox/CustomComboBoxReducer/CustomComboBoxReducer.js.map +1 -1
- package/internal/InternalTextareaWithLayout/InternalTextareaWithLayout/InternalTextareaWithLayout.js +4 -0
- package/internal/InternalTextareaWithLayout/InternalTextareaWithLayout/InternalTextareaWithLayout.js.map +1 -1
- package/internal/InternalTextareaWithLayout/InternalTextareaWithLayout.d.ts +1 -0
- package/internal/RenderContainer/RenderInnerContainer/RenderInnerContainer.js +35 -2
- package/internal/RenderContainer/RenderInnerContainer/RenderInnerContainer.js.map +1 -1
- package/internal/RenderContainer/RenderInnerContainer.d.ts +4 -0
- package/internal/ThemePlayground/Playground.styles/Playground.styles.js +1 -1
- package/internal/ThemePlayground/Playground.styles/Playground.styles.js.map +1 -1
- package/internal/ThemePlayground/ThemeContextPlayground/ThemeContextPlayground.js +28 -9
- package/internal/ThemePlayground/ThemeContextPlayground/ThemeContextPlayground.js.map +1 -1
- package/internal/ThemePlayground/ThemeContextPlayground.d.ts +1 -35
- package/internal/themes/DarkTheme5_5/DarkTheme5_5.js +4 -7
- package/internal/themes/DarkTheme5_5/DarkTheme5_5.js.map +1 -1
- package/internal/themes/DarkTheme5_6/DarkTheme5_6.js +768 -0
- package/internal/themes/DarkTheme5_6/DarkTheme5_6.js.map +1 -0
- package/internal/themes/DarkTheme5_6/package.json +6 -0
- package/internal/themes/DarkTheme5_6.d.ts +1 -0
- package/internal/themes/LightTheme5_6/LightTheme5_6.js +768 -0
- package/internal/themes/LightTheme5_6/LightTheme5_6.js.map +1 -0
- package/internal/themes/LightTheme5_6/package.json +6 -0
- package/internal/themes/LightTheme5_6.d.ts +1 -0
- package/lib/theming/ThemeVersions/ThemeVersions.js.map +1 -1
- package/lib/theming/ThemeVersions.d.ts +1 -1
- package/lib/theming/themes/DarkTheme/DarkTheme.js +3 -1
- package/lib/theming/themes/DarkTheme/DarkTheme.js.map +1 -1
- package/lib/theming/themes/DarkTheme.d.ts +1 -0
- package/lib/theming/themes/LightTheme/LightTheme.js +3 -1
- package/lib/theming/themes/LightTheme/LightTheme.js.map +1 -1
- package/lib/theming/themes/LightTheme.d.ts +1 -0
- package/package.json +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["css","memoizeStyle","styles","playground","_templateObject","_taggedTemplateLiteralLoose","title","t","_templateObject2","textColorDefault","componentsGroup","_templateObject3","sidePageBody","_templateObject4","variable","_templateObject5","borderColorFocus","variableName","_templateObject6","deprecated","_templateObject7","colorIcon","_templateObject8","baseLinkWrapper","_templateObject9","linkRoot","_templateObject10","baseVariableRoot","_templateObject11","loaderWrapper","_templateObject12","loader","_templateObject13","tabsWrapper","_templateObject14","tooltipContent","_templateObject15","stickyTabsWrapper","_templateObject16","tabsInnerWrapper","_templateObject17","playgroundWrapper","_templateObject18","bgDefault","editorHeaderWrapper","_templateObject19","editorGroupHeader","_templateObject20"],"sources":["Playground.styles.ts"],"sourcesContent":["import { css, memoizeStyle } from '../../lib/theming/Emotion';\nimport type { Theme } from '../../lib/theming/Theme';\n\nexport const styles = memoizeStyle({\n playground() {\n return css`\n margin: 0 -24px;\n padding: 0 24px;\n border-radius: 8px;\n `;\n },\n\n title(t: Theme) {\n return css`\n width: 110px;\n color: ${t.textColorDefault};\n `;\n },\n\n componentsGroup(t: Theme) {\n return css`\n max-width: 700px;\n color: ${t.textColorDefault};\n `;\n },\n\n sidePageBody() {\n return css`\n padding: 0 30px 30px;\n `;\n },\n\n variable(t: Theme) {\n return css`\n display: flex;\n align-items: center;\n margin-bottom: 16px;\n\n &:focus {\n outline: 1px solid ${t.borderColorFocus};\n outline-offset: 8px;\n }\n `;\n },\n\n variableName(t: Theme) {\n return css`\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n width: 250px;\n position: relative;\n z-index: 1;\n line-height: 34px;\n color: ${t.textColorDefault};\n flex: 1 1 auto;\n `;\n },\n\n deprecated() {\n return css`\n text-decoration: line-through;\n `;\n },\n\n colorIcon() {\n return css`\n height: 16px;\n width: 16px;\n `;\n },\n\n baseLinkWrapper() {\n return css`\n margin-left: auto;\n `;\n },\n\n linkRoot() {\n return css`\n position: relative;\n z-index: 1;\n `;\n },\n\n baseVariableRoot() {\n return css`\n position: relative;\n z-index: 1;\n width: 240px;\n display: flex;\n `;\n },\n\n loaderWrapper() {\n return css`\n width: 500px;\n `;\n },\n\n loader() {\n return css`\n height: 300px;\n margin: auto;\n `;\n },\n\n tabsWrapper(t: Theme) {\n return css`\n position: relative;\n color: ${t.textColorDefault};\n\n &::after {\n content: '';\n position: absolute;\n bottom: 0;\n left: 0;\n height: 1px;\n width: 100%;\n z-index: -1;\n }\n `;\n },\n\n tooltipContent() {\n return css`\n width: 210px;\n `;\n },\n\n stickyTabsWrapper(t: Theme) {\n return css`\n &:after {\n box-shadow: 0 2px 10px 0px ${t.textColorDefault};\n }\n `;\n },\n tabsInnerWrapper(t: Theme) {\n return css`\n color: ${t.textColorDefault};\n `;\n },\n playgroundWrapper(t: Theme) {\n return css`\n background: ${t.bgDefault};\n `;\n },\n editorHeaderWrapper(t: Theme) {\n return css`\n color: ${t.textColorDefault};\n `;\n },\n editorGroupHeader(t: Theme) {\n return css`\n color: ${t.textColorDefault};\n `;\n },\n});\n"],"mappings":"qdAAA,SAASA,GAAG,EAAEC,YAAY,QAAQ,2BAA2B;;;AAG7D,OAAO,IAAMC,MAAM,GAAGD,YAAY,CAAC;EACjCE,UAAU,WAAAA,WAAA,EAAG;IACX,OAAOH,GAAG,CAAAI,eAAA,KAAAA,eAAA,GAAAC,2BAAA;;;;;EAKZ,CAAC;;EAEDC,KAAK,WAAAA,MAACC,CAAQ,EAAE;IACd,OAAOP,GAAG,CAAAQ,gBAAA,KAAAA,gBAAA,GAAAH,2BAAA;;IAECE,CAAC,CAACE,gBAAgB;;EAE/B,CAAC;;EAEDC,eAAe,WAAAA,gBAACH,CAAQ,EAAE;IACxB,OAAOP,GAAG,CAAAW,gBAAA,KAAAA,gBAAA,GAAAN,2BAAA;;IAECE,CAAC,CAACE,gBAAgB;;EAE/B,CAAC;;EAEDG,YAAY,WAAAA,aAAA,EAAG;IACb,OAAOZ,GAAG,CAAAa,gBAAA,KAAAA,gBAAA,GAAAR,2BAAA
|
|
1
|
+
{"version":3,"names":["css","memoizeStyle","styles","playground","_templateObject","_taggedTemplateLiteralLoose","title","t","_templateObject2","textColorDefault","componentsGroup","_templateObject3","sidePageBody","_templateObject4","variable","_templateObject5","borderColorFocus","variableName","_templateObject6","deprecated","_templateObject7","colorIcon","_templateObject8","baseLinkWrapper","_templateObject9","linkRoot","_templateObject10","baseVariableRoot","_templateObject11","loaderWrapper","_templateObject12","loader","_templateObject13","tabsWrapper","_templateObject14","tooltipContent","_templateObject15","stickyTabsWrapper","_templateObject16","tabsInnerWrapper","_templateObject17","playgroundWrapper","_templateObject18","bgDefault","editorHeaderWrapper","_templateObject19","editorGroupHeader","_templateObject20"],"sources":["Playground.styles.ts"],"sourcesContent":["import { css, memoizeStyle } from '../../lib/theming/Emotion';\nimport type { Theme } from '../../lib/theming/Theme';\n\nexport const styles = memoizeStyle({\n playground() {\n return css`\n margin: 0 -24px;\n padding: 0 24px;\n border-radius: 8px;\n `;\n },\n\n title(t: Theme) {\n return css`\n width: 110px;\n color: ${t.textColorDefault};\n `;\n },\n\n componentsGroup(t: Theme) {\n return css`\n max-width: 700px;\n color: ${t.textColorDefault};\n `;\n },\n\n sidePageBody() {\n return css`\n padding: 0 30px 30px;\n overflow-x: hidden;\n `;\n },\n\n variable(t: Theme) {\n return css`\n display: flex;\n align-items: center;\n margin-bottom: 16px;\n\n &:focus {\n outline: 1px solid ${t.borderColorFocus};\n outline-offset: 8px;\n }\n `;\n },\n\n variableName(t: Theme) {\n return css`\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n width: 250px;\n position: relative;\n z-index: 1;\n line-height: 34px;\n color: ${t.textColorDefault};\n flex: 1 1 auto;\n `;\n },\n\n deprecated() {\n return css`\n text-decoration: line-through;\n `;\n },\n\n colorIcon() {\n return css`\n height: 16px;\n width: 16px;\n `;\n },\n\n baseLinkWrapper() {\n return css`\n margin-left: auto;\n `;\n },\n\n linkRoot() {\n return css`\n position: relative;\n z-index: 1;\n `;\n },\n\n baseVariableRoot() {\n return css`\n position: relative;\n z-index: 1;\n width: 240px;\n display: flex;\n `;\n },\n\n loaderWrapper() {\n return css`\n width: 500px;\n `;\n },\n\n loader() {\n return css`\n height: 300px;\n margin: auto;\n `;\n },\n\n tabsWrapper(t: Theme) {\n return css`\n position: relative;\n color: ${t.textColorDefault};\n\n &::after {\n content: '';\n position: absolute;\n bottom: 0;\n left: 0;\n height: 1px;\n width: 100%;\n z-index: -1;\n }\n `;\n },\n\n tooltipContent() {\n return css`\n width: 210px;\n `;\n },\n\n stickyTabsWrapper(t: Theme) {\n return css`\n &:after {\n box-shadow: 0 2px 10px 0px ${t.textColorDefault};\n }\n `;\n },\n tabsInnerWrapper(t: Theme) {\n return css`\n color: ${t.textColorDefault};\n `;\n },\n playgroundWrapper(t: Theme) {\n return css`\n background: ${t.bgDefault};\n `;\n },\n editorHeaderWrapper(t: Theme) {\n return css`\n color: ${t.textColorDefault};\n `;\n },\n editorGroupHeader(t: Theme) {\n return css`\n color: ${t.textColorDefault};\n `;\n },\n});\n"],"mappings":"qdAAA,SAASA,GAAG,EAAEC,YAAY,QAAQ,2BAA2B;;;AAG7D,OAAO,IAAMC,MAAM,GAAGD,YAAY,CAAC;EACjCE,UAAU,WAAAA,WAAA,EAAG;IACX,OAAOH,GAAG,CAAAI,eAAA,KAAAA,eAAA,GAAAC,2BAAA;;;;;EAKZ,CAAC;;EAEDC,KAAK,WAAAA,MAACC,CAAQ,EAAE;IACd,OAAOP,GAAG,CAAAQ,gBAAA,KAAAA,gBAAA,GAAAH,2BAAA;;IAECE,CAAC,CAACE,gBAAgB;;EAE/B,CAAC;;EAEDC,eAAe,WAAAA,gBAACH,CAAQ,EAAE;IACxB,OAAOP,GAAG,CAAAW,gBAAA,KAAAA,gBAAA,GAAAN,2BAAA;;IAECE,CAAC,CAACE,gBAAgB;;EAE/B,CAAC;;EAEDG,YAAY,WAAAA,aAAA,EAAG;IACb,OAAOZ,GAAG,CAAAa,gBAAA,KAAAA,gBAAA,GAAAR,2BAAA;;;;EAIZ,CAAC;;EAEDS,QAAQ,WAAAA,SAACP,CAAQ,EAAE;IACjB,OAAOP,GAAG,CAAAe,gBAAA,KAAAA,gBAAA,GAAAV,2BAAA;;;;;;IAMeE,CAAC,CAACS,gBAAgB;;;;EAI7C,CAAC;;EAEDC,YAAY,WAAAA,aAACV,CAAQ,EAAE;IACrB,OAAOP,GAAG,CAAAkB,gBAAA,KAAAA,gBAAA,GAAAb,2BAAA;;;;;;;;IAQCE,CAAC,CAACE,gBAAgB;;;EAG/B,CAAC;;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BAAgB;;;EAGrD,CAAC;EACD8B,gBAAgB,WAAAA,iBAAChC,CAAQ,EAAE;IACzB,OAAOP,GAAG,CAAAwC,iBAAA,KAAAA,iBAAA,GAAAnC,2BAAA;IACCE,CAAC,CAACE,gBAAgB;;EAE/B,CAAC;EACDgC,iBAAiB,WAAAA,kBAAClC,CAAQ,EAAE;IAC1B,OAAOP,GAAG,CAAA0C,iBAAA,KAAAA,iBAAA,GAAArC,2BAAA;IACME,CAAC,CAACoC,SAAS;;EAE7B,CAAC;EACDC,mBAAmB,WAAAA,oBAACrC,CAAQ,EAAE;IAC5B,OAAOP,GAAG,CAAA6C,iBAAA,KAAAA,iBAAA,GAAAxC,2BAAA;IACCE,CAAC,CAACE,gBAAgB;;EAE/B,CAAC;EACDqC,iBAAiB,WAAAA,kBAACvC,CAAQ,EAAE;IAC1B,OAAOP,GAAG,CAAA+C,iBAAA,KAAAA,iBAAA,GAAA1C,2BAAA;IACCE,CAAC,CAACE,gBAAgB;;EAE/B;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
|
|
3
|
-
import React from 'react';
|
|
3
|
+
import React, { useContext } from 'react';
|
|
4
|
+
import { DocsContext } from '@storybook/addon-docs';
|
|
4
5
|
import { ThemeContext } from "../../../lib/theming/ThemeContext";
|
|
5
6
|
import { ThemeFactory } from "../../../lib/theming/ThemeFactory";
|
|
6
7
|
import { SidePage } from "../../../components/SidePage";
|
|
@@ -21,8 +22,8 @@ var getEditingThemeType = function getEditingThemeType(editingThemeItem) {
|
|
|
21
22
|
}
|
|
22
23
|
return 'lightTheme';
|
|
23
24
|
};
|
|
24
|
-
|
|
25
|
-
function
|
|
25
|
+
var ThemeContextPlaygroundInternal = /*#__PURE__*/function (_React$Component) {
|
|
26
|
+
function ThemeContextPlaygroundInternal(props) {
|
|
26
27
|
var _this;
|
|
27
28
|
_this = _React$Component.call(this, props) || this;
|
|
28
29
|
_this.editableThemesItems = [{
|
|
@@ -44,7 +45,6 @@ export var ThemeContextPlayground = /*#__PURE__*/function (_React$Component) {
|
|
|
44
45
|
React.createElement(SidePage, {
|
|
45
46
|
disableAnimations: true,
|
|
46
47
|
ignoreBackgroundClick: true,
|
|
47
|
-
blockBackground: true,
|
|
48
48
|
width: 600,
|
|
49
49
|
onClose: _this.handleClose
|
|
50
50
|
}, /*#__PURE__*/
|
|
@@ -186,20 +186,39 @@ export var ThemeContextPlayground = /*#__PURE__*/function (_React$Component) {
|
|
|
186
186
|
};
|
|
187
187
|
return _this;
|
|
188
188
|
}
|
|
189
|
-
_inheritsLoose(
|
|
190
|
-
var _proto =
|
|
189
|
+
_inheritsLoose(ThemeContextPlaygroundInternal, _React$Component);
|
|
190
|
+
var _proto = ThemeContextPlaygroundInternal.prototype;
|
|
191
191
|
_proto.render = function render() {
|
|
192
192
|
var _this$state3 = this.state,
|
|
193
193
|
currentTheme = _this$state3.currentTheme,
|
|
194
194
|
editorOpened = _this$state3.editorOpened,
|
|
195
195
|
currentThemeType = _this$state3.currentThemeType;
|
|
196
|
+
var _this$props = this.props,
|
|
197
|
+
globalBrand = _this$props.globalBrand,
|
|
198
|
+
globalAccent = _this$props.globalAccent;
|
|
199
|
+
var themeAttribute = currentThemeType === ThemeType.DarkTheme ? 'dark' : 'light';
|
|
196
200
|
return /*#__PURE__*/React.createElement(ThemeContext.Provider, {
|
|
197
201
|
value: currentTheme
|
|
202
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
203
|
+
"data-k-brand": globalBrand,
|
|
204
|
+
"data-k-accent": globalAccent,
|
|
205
|
+
"data-k-theme": themeAttribute
|
|
198
206
|
}, editorOpened && this.renderSidePage(), /*#__PURE__*/React.createElement(Playground, {
|
|
199
207
|
onThemeChange: this.handleThemeChange,
|
|
200
208
|
currentThemeType: currentThemeType,
|
|
201
209
|
onEditLinkClick: this.handleOpen
|
|
202
|
-
}));
|
|
210
|
+
})));
|
|
203
211
|
};
|
|
204
|
-
return
|
|
205
|
-
}(React.Component);
|
|
212
|
+
return ThemeContextPlaygroundInternal;
|
|
213
|
+
}(React.Component);
|
|
214
|
+
export var ThemeContextPlayground = function ThemeContextPlayground(props) {
|
|
215
|
+
var _context$store$userGl;
|
|
216
|
+
var context = useContext(DocsContext);
|
|
217
|
+
var globals = (context == null || (_context$store$userGl = context.store.userGlobals) == null ? void 0 : _context$store$userGl.globals) || {};
|
|
218
|
+
var brand = globals.brand || 'red';
|
|
219
|
+
var accent = globals.accent || 'gray';
|
|
220
|
+
return /*#__PURE__*/React.createElement(ThemeContextPlaygroundInternal, _extends({}, props, {
|
|
221
|
+
globalBrand: brand,
|
|
222
|
+
globalAccent: accent
|
|
223
|
+
}));
|
|
224
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","ThemeContext","ThemeFactory","SidePage","Gapped","ComboBox","Link","ColorFunctions","findPropertyDescriptor","LIGHT_THEME","DARK_THEME","ThemeEditor","styles","Playground","ThemeType","getEditingThemeType","editingThemeItem","value","ThemeContextPlayground","_React$Component","props","_this","call","editableThemesItems","LightTheme","label","DarkTheme","renderSidePage","_this$state","state","currentTheme","themesErrors","themes","editingThemeType","themeErrors","createElement","disableAnimations","ignoreBackgroundClick","blockBackground","width","onClose","handleClose","Header","className","editorHeaderWrapper","wrap","verticalAlign","getItems","getEditableThemesItems","onValueChange","handleEditingThemeSwitch","style","fontSize","marginTop","onClick","handleGetTheme","Body","sidePageBody","editingTheme","currentErrors","handleThemeVariableChange","themeObject","getKeys","forEach","key","descriptor","Object","getOwnPropertyDescriptor","get","console","log","JSON","stringify","handleOpen","setState","editorOpened","find","i","currentThemeType","handleThemeChange","themeType","variable","_this$state2","theme","currentValue","canSetVariable","isValid","nextThemeErrors","_extends","stateUpdate","result","changeThemeVariable","query","Promise","resolve","filter","toLowerCase","includes","item","variableName","variableValue","enumerable","configurable","set","defineProperty","create","lightTheme","darkTheme","_inheritsLoose","_proto","prototype","render","_this$state3","Provider","onThemeChange","onEditLinkClick","Component"],"sources":["ThemeContextPlayground.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport React from 'react';\n\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport type { Theme, ThemeIn } from '../../lib/theming/Theme';\nimport { ThemeFactory } from '../../lib/theming/ThemeFactory';\nimport { SidePage } from '../../components/SidePage';\nimport { Gapped } from '../../components/Gapped';\nimport { ComboBox } from '../../components/ComboBox';\nimport { Link } from '../../components/Link';\nimport * as ColorFunctions from '../../lib/styles/ColorFunctions';\nimport type { Writeable } from '../../typings/utility-types';\nimport { findPropertyDescriptor } from '../../lib/theming/ThemeHelpers';\nimport { LIGHT_THEME } from '../../lib/theming/themes/LightTheme';\nimport { DARK_THEME } from '../../lib/theming/themes/DarkTheme';\n\nimport { ThemeEditor } from './ThemeEditor';\nimport { styles } from './Playground.styles';\nimport { Playground } from './Playground';\nimport { ThemeType } from './constants';\n\ninterface PlaygroundState {\n editorOpened: boolean;\n editingThemeItem?: EditingThemeItem;\n themes: Themes;\n themesErrors: ThemesErrors;\n currentTheme: Theme;\n currentThemeType: ThemeType;\n}\ninterface Themes {\n lightTheme: Theme;\n darkTheme: Theme;\n}\ninterface ThemesErrors {\n lightTheme: ThemeErrorsType;\n darkTheme: ThemeErrorsType;\n}\ninterface EditingThemeItem {\n value: ThemeType;\n label: string;\n}\ninterface PlaygroundProps {\n children?: ReactNode;\n}\nexport type ThemeErrorsType = Writeable<{ [key in keyof Theme]?: boolean }>;\n\nconst getEditingThemeType = (editingThemeItem: PlaygroundState['editingThemeItem']) => {\n if (editingThemeItem) {\n return editingThemeItem.value;\n }\n\n return 'lightTheme';\n};\nexport class ThemeContextPlayground extends React.Component<PlaygroundProps, PlaygroundState> {\n private readonly editableThemesItems = [\n { value: ThemeType.LightTheme, label: 'Светлая тема' },\n { value: ThemeType.DarkTheme, label: 'Тёмная тема' },\n ];\n\n constructor(props: PlaygroundProps) {\n super(props);\n this.state = {\n currentTheme: LIGHT_THEME,\n currentThemeType: ThemeType.LightTheme,\n editorOpened: false,\n themes: {\n lightTheme: LIGHT_THEME,\n darkTheme: DARK_THEME,\n },\n themesErrors: {\n lightTheme: {},\n darkTheme: {},\n },\n };\n }\n\n public render() {\n const { currentTheme, editorOpened, currentThemeType } = this.state;\n return (\n <ThemeContext.Provider value={currentTheme}>\n {editorOpened && this.renderSidePage()}\n {\n <Playground\n onThemeChange={this.handleThemeChange}\n currentThemeType={currentThemeType}\n onEditLinkClick={this.handleOpen}\n />\n }\n </ThemeContext.Provider>\n );\n }\n\n private renderSidePage = () => {\n const { currentTheme, themesErrors, editingThemeItem, themes } = this.state;\n\n const editingThemeType = getEditingThemeType(editingThemeItem);\n const themeErrors = themesErrors[editingThemeType];\n\n return (\n <SidePage disableAnimations ignoreBackgroundClick blockBackground width={600} onClose={this.handleClose}>\n <SidePage.Header>\n <div className={styles.editorHeaderWrapper(currentTheme)}>\n <Gapped wrap verticalAlign=\"middle\">\n <span>Тема для редактирования:</span>\n <ComboBox\n getItems={this.getEditableThemesItems}\n value={editingThemeItem}\n onValueChange={this.handleEditingThemeSwitch}\n />\n </Gapped>\n </div>\n <div style={{ fontSize: 14, marginTop: 8 }}>\n <Link onClick={this.handleGetTheme}>Вывести тему в консоль</Link>\n </div>\n </SidePage.Header>\n <SidePage.Body>\n <div className={styles.sidePageBody()}>\n <ThemeEditor\n editingTheme={themes[editingThemeType]}\n currentTheme={currentTheme}\n currentErrors={themeErrors}\n onValueChange={this.handleThemeVariableChange}\n />\n </div>\n </SidePage.Body>\n </SidePage>\n );\n };\n\n private handleGetTheme = () => {\n const currentTheme = this.state.currentTheme;\n const themeObject: Writeable<ThemeIn> = {};\n ThemeFactory.getKeys(currentTheme).forEach((key) => {\n const descriptor = Object.getOwnPropertyDescriptor(currentTheme, key);\n if (descriptor && !descriptor.get && LIGHT_THEME[key] && currentTheme[key] !== LIGHT_THEME[key]) {\n themeObject[key] = currentTheme[key] as keyof Theme;\n }\n });\n\n console.log(JSON.stringify(themeObject));\n };\n\n private handleOpen = () => {\n this.setState((state) => ({\n editorOpened: true,\n editingThemeItem: this.editableThemesItems.find((i) => i.value === state.currentThemeType),\n }));\n };\n\n private handleClose = () => {\n this.setState({\n editorOpened: false,\n });\n };\n\n private handleThemeChange = (value: string) => {\n const themeType = value as ThemeType;\n this.setState({\n currentThemeType: themeType,\n currentTheme: this.state.themes[themeType],\n });\n };\n\n private handleThemeVariableChange = (variable: keyof Theme, value: string) => {\n const { editingThemeItem, currentTheme, themes, themesErrors } = this.state;\n const editingThemeType = getEditingThemeType(editingThemeItem);\n\n const theme = themes[editingThemeType];\n const currentValue = theme[variable] as string;\n\n let canSetVariable = true;\n if (ColorFunctions.isValid(currentValue)) {\n canSetVariable = ColorFunctions.isValid(value);\n themesErrors[editingThemeType][variable] = !canSetVariable;\n }\n\n const nextThemeErrors: ThemesErrors = { ...themesErrors };\n nextThemeErrors[editingThemeType][variable] = !canSetVariable;\n const stateUpdate = { themes, currentTheme, themesErrors: nextThemeErrors };\n\n if (canSetVariable) {\n const result = this.changeThemeVariable(theme, variable, value);\n stateUpdate.themes[editingThemeType] = result;\n if (this.state.currentThemeType === editingThemeType) {\n stateUpdate.currentTheme = result;\n }\n }\n\n this.setState(stateUpdate);\n };\n\n private getEditableThemesItems = (query: string) => {\n return Promise.resolve(this.editableThemesItems.filter((i) => i.label.toLowerCase().includes(query.toLowerCase())));\n };\n\n private handleEditingThemeSwitch = (item: EditingThemeItem) => {\n this.setState({ editingThemeItem: item });\n };\n\n private changeThemeVariable = (theme: Theme, variableName: keyof Theme, variableValue: string): Theme => {\n const result: ThemeIn = {};\n ThemeFactory.getKeys(theme).forEach((key) => {\n const descriptor = findPropertyDescriptor(theme, key);\n descriptor.enumerable = true;\n descriptor.configurable = true;\n if (key === variableName) {\n delete descriptor.get;\n delete descriptor.set;\n descriptor.value = variableValue;\n }\n Object.defineProperty(result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AU,IACTqG,aAAa,EAAE,IAAI,CAACnC,iBAAkB,EACtCD,gBAAgB,EAAEA,gBAAiB,EACnCqC,eAAe,EAAE,IAAI,CAAC1C,UAAW,EAClC,CAEkB,CAAC,CAE5B,CAAC,QAAAvD,sBAAA,GArCyClB,KAAK,CAACoH,SAAS","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","useContext","DocsContext","ThemeContext","ThemeFactory","SidePage","Gapped","ComboBox","Link","ColorFunctions","findPropertyDescriptor","LIGHT_THEME","DARK_THEME","ThemeEditor","styles","Playground","ThemeType","getEditingThemeType","editingThemeItem","value","ThemeContextPlaygroundInternal","_React$Component","props","_this","call","editableThemesItems","LightTheme","label","DarkTheme","renderSidePage","_this$state","state","currentTheme","themesErrors","themes","editingThemeType","themeErrors","createElement","disableAnimations","ignoreBackgroundClick","width","onClose","handleClose","Header","className","editorHeaderWrapper","wrap","verticalAlign","getItems","getEditableThemesItems","onValueChange","handleEditingThemeSwitch","style","fontSize","marginTop","onClick","handleGetTheme","Body","sidePageBody","editingTheme","currentErrors","handleThemeVariableChange","themeObject","getKeys","forEach","key","descriptor","Object","getOwnPropertyDescriptor","get","console","log","JSON","stringify","handleOpen","setState","editorOpened","find","i","currentThemeType","handleThemeChange","themeType","variable","_this$state2","theme","currentValue","canSetVariable","isValid","nextThemeErrors","_extends","stateUpdate","result","changeThemeVariable","query","Promise","resolve","filter","toLowerCase","includes","item","variableName","variableValue","enumerable","configurable","set","defineProperty","create","lightTheme","darkTheme","_inheritsLoose","_proto","prototype","render","_this$state3","_this$props","globalBrand","globalAccent","themeAttribute","Provider","onThemeChange","onEditLinkClick","Component","ThemeContextPlayground","_context$store$userGl","context","globals","store","userGlobals","brand","accent"],"sources":["ThemeContextPlayground.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport React, { useContext } from 'react';\nimport { DocsContext } from '@storybook/addon-docs';\n\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport type { Theme, ThemeIn } from '../../lib/theming/Theme';\nimport { ThemeFactory } from '../../lib/theming/ThemeFactory';\nimport { SidePage } from '../../components/SidePage';\nimport { Gapped } from '../../components/Gapped';\nimport { ComboBox } from '../../components/ComboBox';\nimport { Link } from '../../components/Link';\nimport * as ColorFunctions from '../../lib/styles/ColorFunctions';\nimport type { Writeable } from '../../typings/utility-types';\nimport { findPropertyDescriptor } from '../../lib/theming/ThemeHelpers';\nimport { LIGHT_THEME } from '../../lib/theming/themes/LightTheme';\nimport { DARK_THEME } from '../../lib/theming/themes/DarkTheme';\n\nimport { ThemeEditor } from './ThemeEditor';\nimport { styles } from './Playground.styles';\nimport { Playground } from './Playground';\nimport { ThemeType } from './constants';\n\ninterface PlaygroundState {\n editorOpened: boolean;\n editingThemeItem?: EditingThemeItem;\n themes: Themes;\n themesErrors: ThemesErrors;\n currentTheme: Theme;\n currentThemeType: ThemeType;\n}\ninterface Themes {\n lightTheme: Theme;\n darkTheme: Theme;\n}\ninterface ThemesErrors {\n lightTheme: ThemeErrorsType;\n darkTheme: ThemeErrorsType;\n}\ninterface EditingThemeItem {\n value: ThemeType;\n label: string;\n}\ninterface PlaygroundProps {\n children?: ReactNode;\n}\n\ninterface PlaygroundWrapperProps {\n globalBrand: string;\n globalAccent: string;\n}\n\nexport type ThemeErrorsType = Writeable<{ [key in keyof Theme]?: boolean }>;\n\nconst getEditingThemeType = (editingThemeItem: PlaygroundState['editingThemeItem']) => {\n if (editingThemeItem) {\n return editingThemeItem.value;\n }\n\n return 'lightTheme';\n};\n\nclass ThemeContextPlaygroundInternal extends React.Component<\n PlaygroundProps & PlaygroundWrapperProps,\n PlaygroundState\n> {\n private readonly editableThemesItems = [\n { value: ThemeType.LightTheme, label: 'Светлая тема' },\n { value: ThemeType.DarkTheme, label: 'Тёмная тема' },\n ];\n\n constructor(props: PlaygroundProps & PlaygroundWrapperProps) {\n super(props);\n this.state = {\n currentTheme: LIGHT_THEME,\n currentThemeType: ThemeType.LightTheme,\n editorOpened: false,\n themes: {\n lightTheme: LIGHT_THEME,\n darkTheme: DARK_THEME,\n },\n themesErrors: {\n lightTheme: {},\n darkTheme: {},\n },\n };\n }\n\n public render() {\n const { currentTheme, editorOpened, currentThemeType } = this.state;\n const { globalBrand, globalAccent } = this.props;\n\n const themeAttribute = currentThemeType === ThemeType.DarkTheme ? 'dark' : 'light';\n\n return (\n <ThemeContext.Provider value={currentTheme}>\n <div data-k-brand={globalBrand} data-k-accent={globalAccent} data-k-theme={themeAttribute}>\n {editorOpened && this.renderSidePage()}\n {\n <Playground\n onThemeChange={this.handleThemeChange}\n currentThemeType={currentThemeType}\n onEditLinkClick={this.handleOpen}\n />\n }\n </div>\n </ThemeContext.Provider>\n );\n }\n\n private renderSidePage = () => {\n const { currentTheme, themesErrors, editingThemeItem, themes } = this.state;\n\n const editingThemeType = getEditingThemeType(editingThemeItem);\n const themeErrors = themesErrors[editingThemeType];\n\n return (\n <SidePage disableAnimations ignoreBackgroundClick width={600} onClose={this.handleClose}>\n <SidePage.Header>\n <div className={styles.editorHeaderWrapper(currentTheme)}>\n <Gapped wrap verticalAlign=\"middle\">\n <span>Тема для редактирования:</span>\n <ComboBox\n getItems={this.getEditableThemesItems}\n value={editingThemeItem}\n onValueChange={this.handleEditingThemeSwitch}\n />\n </Gapped>\n </div>\n <div style={{ fontSize: 14, marginTop: 8 }}>\n <Link onClick={this.handleGetTheme}>Вывести тему в консоль</Link>\n </div>\n </SidePage.Header>\n <SidePage.Body>\n <div className={styles.sidePageBody()}>\n <ThemeEditor\n editingTheme={themes[editingThemeType]}\n currentTheme={currentTheme}\n currentErrors={themeErrors}\n onValueChange={this.handleThemeVariableChange}\n />\n </div>\n </SidePage.Body>\n </SidePage>\n );\n };\n\n private handleGetTheme = () => {\n const currentTheme = this.state.currentTheme;\n const themeObject: Writeable<ThemeIn> = {};\n ThemeFactory.getKeys(currentTheme).forEach((key) => {\n const descriptor = Object.getOwnPropertyDescriptor(currentTheme, key);\n if (descriptor && !descriptor.get && LIGHT_THEME[key] && currentTheme[key] !== LIGHT_THEME[key]) {\n themeObject[key] = currentTheme[key] as keyof Theme;\n }\n });\n\n console.log(JSON.stringify(themeObject));\n };\n\n private handleOpen = () => {\n this.setState((state) => ({\n editorOpened: true,\n editingThemeItem: this.editableThemesItems.find((i) => i.value === state.currentThemeType),\n }));\n };\n\n private handleClose = () => {\n this.setState({\n editorOpened: false,\n });\n };\n\n private handleThemeChange = (value: string) => {\n const themeType = value as ThemeType;\n this.setState({\n currentThemeType: themeType,\n currentTheme: this.state.themes[themeType],\n });\n };\n\n private handleThemeVariableChange = (variable: keyof Theme, value: string) => {\n const { editingThemeItem, currentTheme, themes, themesErrors } = this.state;\n const editingThemeType = getEditingThemeType(editingThemeItem);\n\n const theme = themes[editingThemeType];\n const currentValue = theme[variable] as string;\n\n let canSetVariable = true;\n if (ColorFunctions.isValid(currentValue)) {\n canSetVariable = ColorFunctions.isValid(value);\n themesErrors[editingThemeType][variable] = !canSetVariable;\n }\n\n const nextThemeErrors: ThemesErrors = { ...themesErrors };\n nextThemeErrors[editingThemeType][variable] = !canSetVariable;\n const stateUpdate = { themes, currentTheme, themesErrors: nextThemeErrors };\n\n if (canSetVariable) {\n const result = this.changeThemeVariable(theme, variable, value);\n stateUpdate.themes[editingThemeType] = result;\n if (this.state.currentThemeType === editingThemeType) {\n stateUpdate.currentTheme = result;\n }\n }\n\n this.setState(stateUpdate);\n };\n\n private getEditableThemesItems = (query: string) => {\n return Promise.resolve(this.editableThemesItems.filter((i) => i.label.toLowerCase().includes(query.toLowerCase())));\n };\n\n private handleEditingThemeSwitch = (item: EditingThemeItem) => {\n this.setState({ editingThemeItem: item });\n };\n\n private changeThemeVariable = (theme: Theme, variableName: keyof Theme, variableValue: string): Theme => {\n const result: ThemeIn = {};\n ThemeFactory.getKeys(theme).forEach((key) => {\n const descriptor = findPropertyDescriptor(theme, key);\n descriptor.enumerable = true;\n descriptor.configurable = true;\n if (key === variableName) {\n delete descriptor.get;\n delete descriptor.set;\n descriptor.value = variableValue;\n }\n Object.defineProperty(result, key, descriptor);\n });\n\n return ThemeFactory.create<ThemeIn>(result);\n };\n}\n\nexport const ThemeContextPlayground = (props: PlaygroundProps) => {\n const context = useContext(DocsContext) as any;\n const globals = context?.store.userGlobals?.globals || {};\n const brand = globals.brand || 'red';\n const accent = globals.accent || 'gray';\n\n return <ThemeContextPlaygroundInternal {...props} globalBrand={brand} globalAccent={accent} />;\n};\n"],"mappings":";AACA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,SAASC,WAAW,QAAQ,uBAAuB;;AAEnD,SAASC,YAAY,QAAQ,gCAAgC;;AAE7D,SAASC,YAAY,QAAQ,gCAAgC;AAC7D,SAASC,QAAQ,QAAQ,2BAA2B;AACpD,SAASC,MAAM,QAAQ,yBAAyB;AAChD,SAASC,QAAQ,QAAQ,2BAA2B;AACpD,SAASC,IAAI,QAAQ,uBAAuB;AAC5C,OAAO,KAAKC,cAAc,MAAM,iCAAiC;;AAEjE,SAASC,sBAAsB,QAAQ,gCAAgC;AACvE,SAASC,WAAW,QAAQ,qCAAqC;AACjE,SAASC,UAAU,QAAQ,oCAAoC;;AAE/D,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,MAAM,QAAQ,qBAAqB;AAC5C,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,SAAS,QAAQ,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCvC,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAIC,gBAAqD,EAAK;EACrF,IAAIA,gBAAgB,EAAE;IACpB,OAAOA,gBAAgB,CAACC,KAAK;EAC/B;;EAEA,OAAO,YAAY;AACrB,CAAC,CAAC;;AAEIC,8BAA8B,0BAAAC,gBAAA;;;;;;;;;EASlC,SAAAD,+BAAYE,KAA+C,EAAE,KAAAC,KAAA;IAC3DA,KAAA,GAAAF,gBAAA,CAAAG,IAAA,OAAMF,KAAK,CAAC,SAACC,KAAA,CANEE,mBAAmB,GAAG,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AAAqE,QAAA,KAAKnE,KAAK,IAAE6F,WAAW,EAAEa,KAAM,EAACZ,YAAY,EAAEa,MAAO,GAAE,CAAC;AAChG,CAAC","ignoreList":[]}
|
|
@@ -2,45 +2,11 @@ import type { ReactNode } from 'react';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import type { Theme } from '../../lib/theming/Theme';
|
|
4
4
|
import type { Writeable } from '../../typings/utility-types';
|
|
5
|
-
import { ThemeType } from './constants';
|
|
6
|
-
interface PlaygroundState {
|
|
7
|
-
editorOpened: boolean;
|
|
8
|
-
editingThemeItem?: EditingThemeItem;
|
|
9
|
-
themes: Themes;
|
|
10
|
-
themesErrors: ThemesErrors;
|
|
11
|
-
currentTheme: Theme;
|
|
12
|
-
currentThemeType: ThemeType;
|
|
13
|
-
}
|
|
14
|
-
interface Themes {
|
|
15
|
-
lightTheme: Theme;
|
|
16
|
-
darkTheme: Theme;
|
|
17
|
-
}
|
|
18
|
-
interface ThemesErrors {
|
|
19
|
-
lightTheme: ThemeErrorsType;
|
|
20
|
-
darkTheme: ThemeErrorsType;
|
|
21
|
-
}
|
|
22
|
-
interface EditingThemeItem {
|
|
23
|
-
value: ThemeType;
|
|
24
|
-
label: string;
|
|
25
|
-
}
|
|
26
5
|
interface PlaygroundProps {
|
|
27
6
|
children?: ReactNode;
|
|
28
7
|
}
|
|
29
8
|
export type ThemeErrorsType = Writeable<{
|
|
30
9
|
[key in keyof Theme]?: boolean;
|
|
31
10
|
}>;
|
|
32
|
-
export declare
|
|
33
|
-
private readonly editableThemesItems;
|
|
34
|
-
constructor(props: PlaygroundProps);
|
|
35
|
-
render(): React.JSX.Element;
|
|
36
|
-
private renderSidePage;
|
|
37
|
-
private handleGetTheme;
|
|
38
|
-
private handleOpen;
|
|
39
|
-
private handleClose;
|
|
40
|
-
private handleThemeChange;
|
|
41
|
-
private handleThemeVariableChange;
|
|
42
|
-
private getEditableThemesItems;
|
|
43
|
-
private handleEditingThemeSwitch;
|
|
44
|
-
private changeThemeVariable;
|
|
45
|
-
}
|
|
11
|
+
export declare const ThemeContextPlayground: (props: PlaygroundProps) => React.JSX.Element;
|
|
46
12
|
export {};
|
|
@@ -11,13 +11,10 @@ export var DarkTheme5_5 = createTheme({
|
|
|
11
11
|
}
|
|
12
12
|
_inheritsLoose(DarkTheme5_5, _BasicThemeClassForEx);
|
|
13
13
|
return _createClass(DarkTheme5_5, null, [{
|
|
14
|
-
key: "fileUploaderIconHoverColorForValidation",
|
|
15
|
-
get: function get() {
|
|
16
|
-
return this.bgSecondary;
|
|
17
|
-
}
|
|
18
|
-
}, {
|
|
19
14
|
key: "fileUploaderErrorColor",
|
|
20
|
-
get:
|
|
15
|
+
get:
|
|
16
|
+
//#region FileUploader
|
|
17
|
+
function get() {
|
|
21
18
|
return this.textColorDisabled;
|
|
22
19
|
}
|
|
23
20
|
}, {
|
|
@@ -52,7 +49,7 @@ export var DarkTheme5_5 = createTheme({
|
|
|
52
49
|
}
|
|
53
50
|
//#endregion FileUploader
|
|
54
51
|
}]);
|
|
55
|
-
}(BasicThemeClassForExtension), _DarkTheme5_.
|
|
52
|
+
}(BasicThemeClassForExtension), _DarkTheme5_.fileUploaderFileTypeUnknownIconColor = '#676767', _DarkTheme5_.fileUploaderPaddingXSmall = '7px', _DarkTheme5_.fileUploaderPaddingXMedium = '9px', _DarkTheme5_.fileUploaderPaddingXLarge = '11px', _DarkTheme5_.fileUploaderErrorBgColor = '#4F2421', _DarkTheme5_.fileUploaderErrorBgHoverColor = '#612A29', _DarkTheme5_.fileUploaderWarningBgColor = '#3F2F1E', _DarkTheme5_.fileUploaderWarningBgHoverColor = '#4C3923', _DarkTheme5_.fileUploaderWarningTextColor = '#FDD481', _DarkTheme5_.fileUploaderDisabledColor = 'rgba(255, 255, 255, 0.54)', _DarkTheme5_.fileUploaderDisabledIconColor = 'rgba(255, 255, 255, 0.32)', _DarkTheme5_),
|
|
56
53
|
prototypeTheme: DarkTheme5_4,
|
|
57
54
|
themeMarkers: [markThemeVersion('5.5')]
|
|
58
55
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createTheme","markThemeVersion","BasicThemeClassForExtension","DarkTheme5_4","DarkTheme5_5","themeClass","_DarkTheme5_","_BasicThemeClassForEx","apply","arguments","_inheritsLoose","_createClass","key","get","
|
|
1
|
+
{"version":3,"names":["createTheme","markThemeVersion","BasicThemeClassForExtension","DarkTheme5_4","DarkTheme5_5","themeClass","_DarkTheme5_","_BasicThemeClassForEx","apply","arguments","_inheritsLoose","_createClass","key","get","textColorDisabled","errorText","fileUploaderTextColorDefault","gray","borderColorGrayLight","fileUploaderDisabledColor","fileUploaderDisabledIconColor","fileUploaderFileTypeUnknownIconColor","fileUploaderPaddingXSmall","fileUploaderPaddingXMedium","fileUploaderPaddingXLarge","fileUploaderErrorBgColor","fileUploaderErrorBgHoverColor","fileUploaderWarningBgColor","fileUploaderWarningBgHoverColor","fileUploaderWarningTextColor","prototypeTheme","themeMarkers"],"sources":["DarkTheme5_5.ts"],"sourcesContent":["import { createTheme, markThemeVersion } from '../../lib/theming/ThemeHelpers';\n\nimport { BasicThemeClassForExtension } from './BasicTheme';\nimport { DarkTheme5_4 } from './DarkTheme5_4';\n\nexport const DarkTheme5_5 = createTheme({\n themeClass: class DarkTheme5_5 extends BasicThemeClassForExtension {\n //#region FileUploader\n public static get fileUploaderErrorColor() {\n return this.textColorDisabled;\n }\n\n public static fileUploaderFileTypeUnknownIconColor = '#676767';\n public static fileUploaderPaddingXSmall = '7px';\n public static fileUploaderPaddingXMedium = '9px';\n public static fileUploaderPaddingXLarge = '11px';\n\n public static fileUploaderErrorBgColor = '#4F2421';\n public static fileUploaderErrorBgHoverColor = '#612A29';\n public static get fileUploaderErrorTextColor() {\n return this.errorText;\n }\n public static fileUploaderWarningBgColor = '#3F2F1E';\n public static fileUploaderWarningBgHoverColor = '#4C3923';\n public static fileUploaderWarningTextColor = '#FDD481';\n\n public static get fileUploaderValidationTextColor() {\n return this.fileUploaderTextColorDefault;\n }\n public static get fileUploaderAfterLinkColor() {\n return this.gray;\n }\n public static get fileUploaderBorderColor() {\n return this.borderColorGrayLight;\n }\n public static fileUploaderDisabledColor = 'rgba(255, 255, 255, 0.54)';\n public static fileUploaderDisabledIconColor = 'rgba(255, 255, 255, 0.32)';\n public static get fileUploaderDisabledTextColor() {\n return this.fileUploaderDisabledColor;\n }\n public static get fileUploaderDisabledFileTypeIcon() {\n return this.fileUploaderDisabledIconColor;\n }\n //#endregion FileUploader\n },\n prototypeTheme: DarkTheme5_4,\n themeMarkers: [markThemeVersion('5.5')],\n});\n"],"mappings":"yJAAA,SAASA,WAAW,EAAEC,gBAAgB,QAAQ,gCAAgC;;AAE9E,SAASC,2BAA2B,QAAQ,cAAc;AAC1D,SAASC,YAAY,QAAQ,gBAAgB;;AAE7C,OAAO,IAAMC,YAAY,GAAGJ,WAAW,CAAC;EACtCK,UAAU,GAAAC,YAAA,0BAAAC,qBAAA,YAAAH,aAAA,UAAAG,qBAAA,CAAAC,KAAA,OAAAC,SAAA,WAAAC,cAAA,CAAAN,YAAA,EAAAG,qBAAA,SAAAI,YAAA,CAAAP,YAAA,WAAAQ,GAAA,4BAAAC,GAAA;MACR;MACA,SAAAA,IAAA,EAA2C;QACzC,OAAO,IAAI,CAACC,iBAAiB;MAC/B,CAAC,MAAAF,GAAA,gCAAAC,GAAA;;;;;;;;;MASD,SAAAA,IAAA,EAA+C;QAC7C,OAAO,IAAI,CAACE,SAAS;MACvB,CAAC,MAAAH,GAAA,qCAAAC,GAAA;;;;;MAKD,SAAAA,IAAA,EAAoD;QAClD,OAAO,IAAI,CAACG,4BAA4B;MAC1C,CAAC,MAAAJ,GAAA,gCAAAC,GAAA;MACD,SAAAA,IAAA,EAA+C;QAC7C,OAAO,IAAI,CAACI,IAAI;MAClB,CAAC,MAAAL,GAAA,6BAAAC,GAAA;MACD,SAAAA,IAAA,EAA4C;QAC1C,OAAO,IAAI,CAACK,oBAAoB;MAClC,CAAC,MAAAN,GAAA,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