@smart-react-components/ui 2.0.0-alpha-9 → 2.0.0-alpha-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/ColorPicker/index.d.ts +28 -0
- package/ColorPicker/index.js +83 -0
- package/Grid/Container.js +1 -1
- package/Input/InputAddon.d.ts +3 -2
- package/Input/InputAddon.js +4 -1
- package/Input/InputColorPicker.d.ts +20 -0
- package/Input/InputColorPicker.js +135 -0
- package/Modal/index.d.ts +1 -0
- package/Modal/index.js +2 -2
- package/Select/SelectBox.js +1 -1
- package/Table/TableContainer.d.ts +10 -0
- package/Table/TableContainer.js +78 -0
- package/Table/Tbody.d.ts +2 -0
- package/Table/Tbody.js +7 -0
- package/Table/Td.d.ts +2 -0
- package/Table/Td.js +7 -0
- package/Table/Tfoot.d.ts +2 -0
- package/Table/Tfoot.js +7 -0
- package/Table/Th.d.ts +2 -0
- package/Table/Th.js +7 -0
- package/Table/Thead.d.ts +2 -0
- package/Table/Thead.js +7 -0
- package/Table/Tr.d.ts +11 -0
- package/Table/Tr.js +34 -0
- package/Table/index.d.ts +22 -0
- package/Table/index.js +26 -0
- package/components/ColorPicker/ButtonsSection/index.d.ts +12 -0
- package/components/ColorPicker/ButtonsSection/index.js +27 -0
- package/components/ColorPicker/ColorPickerElement.d.ts +7 -0
- package/components/ColorPicker/ColorPickerElement.js +26 -0
- package/components/ColorPicker/ConsoleSection/ConsoleSectionElement.d.ts +6 -0
- package/components/ColorPicker/ConsoleSection/ConsoleSectionElement.js +31 -0
- package/components/ColorPicker/ConsoleSection/index.d.ts +10 -0
- package/components/ColorPicker/ConsoleSection/index.js +59 -0
- package/components/ColorPicker/PaletteSection/PaletteItemElement.d.ts +7 -0
- package/components/ColorPicker/PaletteSection/PaletteItemElement.js +43 -0
- package/components/ColorPicker/PaletteSection/PaletteList.d.ts +11 -0
- package/components/ColorPicker/PaletteSection/PaletteList.js +38 -0
- package/components/ColorPicker/PaletteSection/PaletteListContainerElement.d.ts +2 -0
- package/components/ColorPicker/PaletteSection/PaletteListContainerElement.js +26 -0
- package/components/ColorPicker/PaletteSection/index.d.ts +11 -0
- package/components/ColorPicker/PaletteSection/index.js +24 -0
- package/components/ColorPicker/PickerSection/DraggerElement.d.ts +6 -0
- package/components/ColorPicker/PickerSection/DraggerElement.js +24 -0
- package/components/ColorPicker/PickerSection/MajorDraggerElement.d.ts +3 -0
- package/components/ColorPicker/PickerSection/MajorDraggerElement.js +26 -0
- package/components/ColorPicker/PickerSection/MajorPicker.d.ts +4 -0
- package/components/ColorPicker/PickerSection/MajorPicker.js +117 -0
- package/components/ColorPicker/PickerSection/MajorPickerElement.d.ts +8 -0
- package/components/ColorPicker/PickerSection/MajorPickerElement.js +18 -0
- package/components/ColorPicker/PickerSection/MinorDraggerElement.d.ts +3 -0
- package/components/ColorPicker/PickerSection/MinorDraggerElement.js +13 -0
- package/components/ColorPicker/PickerSection/MinorPicker.d.ts +4 -0
- package/components/ColorPicker/PickerSection/MinorPicker.js +64 -0
- package/components/ColorPicker/PickerSection/MinorPickerElement.d.ts +3 -0
- package/components/ColorPicker/PickerSection/MinorPickerElement.js +16 -0
- package/components/ColorPicker/PickerSection/OpacityPicker.d.ts +4 -0
- package/components/ColorPicker/PickerSection/OpacityPicker.js +82 -0
- package/components/ColorPicker/PickerSection/OpacityPickerElement.d.ts +8 -0
- package/components/ColorPicker/PickerSection/OpacityPickerElement.js +17 -0
- package/components/ColorPicker/PickerSection/PickerElement.d.ts +6 -0
- package/components/ColorPicker/PickerSection/PickerElement.js +29 -0
- package/components/ColorPicker/PickerSection/index.d.ts +8 -0
- package/components/ColorPicker/PickerSection/index.js +66 -0
- package/components/Input/InputAddonElement.js +8 -11
- package/components/Input/InputElement.js +1 -0
- package/components/Modal/ModalElement.d.ts +1 -0
- package/components/Modal/ModalElement.js +17 -2
- package/components/Table/TableContainerElement.d.ts +6 -0
- package/components/Table/TableContainerElement.js +12 -0
- package/components/Table/TableElement.d.ts +16 -0
- package/components/Table/TableElement.js +153 -0
- package/constants/color-picker.d.ts +1 -0
- package/constants/color-picker.js +4 -0
- package/context/ColorPickerProps.d.ts +10 -0
- package/context/ColorPickerProps.js +4 -0
- package/index.d.ts +2 -0
- package/index.js +6 -2
- package/package.json +7 -7
- package/types/color-picker.d.ts +16 -0
- package/util/color-picker.d.ts +4 -0
- package/util/color-picker.js +17 -1
- package/util/dom.d.ts +0 -6
- package/util/dom.js +1 -21
- package/util/props.d.ts +18 -14
- package/util/props.js +24 -4
- package/util/table.d.ts +9 -0
- package/util/table.js +32 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const color_1 = require("@smart-react-components/core/util/color");
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const ColorPickerProps_1 = __importDefault(require("../../../context/ColorPickerProps"));
|
|
9
|
+
const color_picker_1 = require("../../../util/color-picker");
|
|
10
|
+
const MinorDraggerElement_1 = __importDefault(require("./MinorDraggerElement"));
|
|
11
|
+
const MinorPickerElement_1 = __importDefault(require("./MinorPickerElement"));
|
|
12
|
+
const MinorPicker = ({ color, onDrag, onEnd, onRef, onStart }) => {
|
|
13
|
+
const props = react_1.default.useContext(ColorPickerProps_1.default);
|
|
14
|
+
const pickerEl = react_1.default.useRef(null);
|
|
15
|
+
const draggerEl = react_1.default.useRef(null);
|
|
16
|
+
const handleChange = () => {
|
|
17
|
+
if (!pickerEl.current) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const pickerWidth = pickerEl.current.offsetWidth;
|
|
21
|
+
const draggerHalfSize = draggerEl.current.offsetWidth / 2;
|
|
22
|
+
const left = (pickerWidth / 2) - draggerHalfSize;
|
|
23
|
+
let top;
|
|
24
|
+
if (!color.current) {
|
|
25
|
+
top = draggerHalfSize * -1;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
const pickerHeight = pickerEl.current.offsetHeight;
|
|
29
|
+
const [h] = color.current.hsl().color;
|
|
30
|
+
top = Math.round((pickerHeight / 360) * h) - draggerHalfSize;
|
|
31
|
+
}
|
|
32
|
+
draggerEl.current.setAttribute('style', `left: ${left}px; top: ${top}px;`);
|
|
33
|
+
};
|
|
34
|
+
const handleDrag = (e) => {
|
|
35
|
+
const { left, top, y } = (0, color_picker_1.calculateDraggerPosition)(e, pickerEl.current, draggerEl.current.offsetWidth);
|
|
36
|
+
draggerEl.current.style.left = `${left}px`;
|
|
37
|
+
draggerEl.current.style.top = `${top}px`;
|
|
38
|
+
const pickerHeight = pickerEl.current.offsetHeight;
|
|
39
|
+
const h = Math.round(y * (360 / pickerHeight));
|
|
40
|
+
color.current = (0, color_1.getColor)(`hsl(${h}, 100%, 50%)`);
|
|
41
|
+
onDrag();
|
|
42
|
+
};
|
|
43
|
+
const handleEnd = () => {
|
|
44
|
+
onEnd(handleMove, handleEnd);
|
|
45
|
+
};
|
|
46
|
+
const handleMove = (e) => {
|
|
47
|
+
handleDrag(e);
|
|
48
|
+
};
|
|
49
|
+
const handleStart = (e) => {
|
|
50
|
+
onStart(handleMove, handleEnd);
|
|
51
|
+
handleDrag(e);
|
|
52
|
+
};
|
|
53
|
+
react_1.default.useEffect(() => {
|
|
54
|
+
onRef({
|
|
55
|
+
onChange: handleChange,
|
|
56
|
+
});
|
|
57
|
+
}, []);
|
|
58
|
+
return (react_1.default.createElement(MinorPickerElement_1.default, Object.assign({}, props, { ref: pickerEl }, (!props.isDisabled && {
|
|
59
|
+
onMouseDown: handleStart,
|
|
60
|
+
onTouchStart: handleStart,
|
|
61
|
+
})),
|
|
62
|
+
react_1.default.createElement(MinorDraggerElement_1.default, Object.assign({}, props, { ref: draggerEl }))));
|
|
63
|
+
};
|
|
64
|
+
exports.default = MinorPicker;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
7
|
+
const PickerElement_1 = __importDefault(require("./PickerElement"));
|
|
8
|
+
exports.default = (0, styled_components_1.default)(PickerElement_1.default).attrs({
|
|
9
|
+
getColorPickerSize: (v, t) => `
|
|
10
|
+
height: ${t.$.size.colorPicker[v].majorPickerSize};
|
|
11
|
+
width: ${t.$.size.colorPicker[v].minorPickerWidth};
|
|
12
|
+
`,
|
|
13
|
+
}) `
|
|
14
|
+
background: linear-gradient(to bottom, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
|
|
15
|
+
box-shadow: 0 0 3px rgba(0,0,0,.3) inset;
|
|
16
|
+
`;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const color_1 = require("@smart-react-components/core/util/color");
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const ColorPickerProps_1 = __importDefault(require("../../../context/ColorPickerProps"));
|
|
9
|
+
const color_picker_1 = require("../../../util/color-picker");
|
|
10
|
+
const MinorDraggerElement_1 = __importDefault(require("./MinorDraggerElement"));
|
|
11
|
+
const OpacityPickerElement_1 = __importDefault(require("./OpacityPickerElement"));
|
|
12
|
+
const OpacityPicker = ({ color, onDrag, onEnd, onRef, onStart }) => {
|
|
13
|
+
const props = react_1.default.useContext(ColorPickerProps_1.default);
|
|
14
|
+
const pickerEl = react_1.default.useRef(null);
|
|
15
|
+
const bgEl = react_1.default.useRef(null);
|
|
16
|
+
const draggerEl = react_1.default.useRef(null);
|
|
17
|
+
const handleChange = () => {
|
|
18
|
+
if (!pickerEl.current) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const pickerHeight = pickerEl.current.offsetHeight;
|
|
22
|
+
const pickerWidth = pickerEl.current.offsetWidth;
|
|
23
|
+
const draggerHalfSize = draggerEl.current.offsetWidth / 2;
|
|
24
|
+
const left = (pickerWidth / 2) - draggerHalfSize;
|
|
25
|
+
let background;
|
|
26
|
+
let isDark;
|
|
27
|
+
let top;
|
|
28
|
+
if (!color.current) {
|
|
29
|
+
background = (0, color_1.getColor)('#FFF');
|
|
30
|
+
isDark = true;
|
|
31
|
+
top = pickerHeight - draggerHalfSize;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
const a = color.current.valpha;
|
|
35
|
+
background = color.current;
|
|
36
|
+
isDark = (0, color_picker_1.isLight)(color.current, true);
|
|
37
|
+
top = Math.round((pickerHeight / 100) * (a * 100)) - draggerHalfSize;
|
|
38
|
+
}
|
|
39
|
+
draggerEl.current.setAttribute('data-src-is-dark', String(isDark));
|
|
40
|
+
draggerEl.current.setAttribute('style', `left: ${left}px; top: ${top}px;`);
|
|
41
|
+
const [r, g, b] = background.rgb().color;
|
|
42
|
+
bgEl.current.style.background = `linear-gradient(to top, rgba(${r}, ${g}, ${b}, 1), rgba(${r}, ${g}, ${b}, 0))`;
|
|
43
|
+
};
|
|
44
|
+
const handleDrag = (e) => {
|
|
45
|
+
var _a, _b;
|
|
46
|
+
const { left, top, y } = (0, color_picker_1.calculateDraggerPosition)(e, pickerEl.current, draggerEl.current.offsetWidth);
|
|
47
|
+
draggerEl.current.style.left = `${left}px`;
|
|
48
|
+
draggerEl.current.style.top = `${top}px`;
|
|
49
|
+
const pickerHeight = pickerEl.current.offsetHeight;
|
|
50
|
+
const alpha = Math.round((100 / pickerHeight) * y) / 100;
|
|
51
|
+
color.current = (_b = (_a = color.current) === null || _a === void 0 ? void 0 : _a.alpha(alpha)) !== null && _b !== void 0 ? _b : (0, color_1.getColor)(`rgba(255, 255, 255, ${alpha})`);
|
|
52
|
+
draggerEl.current.setAttribute('data-src-is-dark', String((0, color_picker_1.isLight)(color.current, true)));
|
|
53
|
+
onDrag();
|
|
54
|
+
};
|
|
55
|
+
const handleExternalDrag = () => {
|
|
56
|
+
const [r, g, b] = color.current.rgb().color;
|
|
57
|
+
bgEl.current.style.background = `linear-gradient(to top, rgba(${r}, ${g}, ${b}, 1), rgba(${r}, ${g}, ${b}, 0))`;
|
|
58
|
+
draggerEl.current.setAttribute('data-src-is-dark', String((0, color_picker_1.isLight)(color.current, true)));
|
|
59
|
+
};
|
|
60
|
+
const handleEnd = () => {
|
|
61
|
+
onEnd(handleMove, handleEnd);
|
|
62
|
+
};
|
|
63
|
+
const handleMove = (e) => {
|
|
64
|
+
handleDrag(e);
|
|
65
|
+
};
|
|
66
|
+
const handleStart = (e) => {
|
|
67
|
+
onStart(handleMove, handleEnd);
|
|
68
|
+
handleDrag(e);
|
|
69
|
+
};
|
|
70
|
+
react_1.default.useEffect(() => {
|
|
71
|
+
onRef({
|
|
72
|
+
onChange: handleChange,
|
|
73
|
+
onExternalDrag: handleExternalDrag,
|
|
74
|
+
});
|
|
75
|
+
}, []);
|
|
76
|
+
return (react_1.default.createElement(OpacityPickerElement_1.default, Object.assign({}, props, { bgElRef: bgEl, ref: pickerEl }, (!props.isDisabled && {
|
|
77
|
+
onMouseDown: handleStart,
|
|
78
|
+
onTouchStart: handleStart,
|
|
79
|
+
})),
|
|
80
|
+
react_1.default.createElement(MinorDraggerElement_1.default, Object.assign({}, props, { ref: draggerEl }))));
|
|
81
|
+
};
|
|
82
|
+
exports.default = OpacityPicker;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Props as PickerElementProps } from './PickerElement';
|
|
3
|
+
interface Props extends PickerElementProps {
|
|
4
|
+
bgElRef: React.MutableRefObject<HTMLDivElement>;
|
|
5
|
+
children: JSX.Element;
|
|
6
|
+
}
|
|
7
|
+
declare const _default: import("styled-components").StyledComponent<"div", any, import("@smart-react-components/core").StyledProps & PickerElementProps & Props, never>;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const Div_1 = __importDefault(require("@smart-react-components/core/Element/Div"));
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
const PickerElement_1 = __importDefault(require("./PickerElement"));
|
|
10
|
+
exports.default = (0, styled_components_1.default)(PickerElement_1.default).attrs(({ bgElRef, children }) => ({
|
|
11
|
+
children: (react_1.default.createElement(Div_1.default, { background: "url('{media.opacityBackground}')" },
|
|
12
|
+
react_1.default.createElement(Div_1.default, { boxShadow: "0 0 3px rgba(0,0,0,.3) inset", ref: bgElRef }, children))),
|
|
13
|
+
getColorPickerSize: (v, t) => `
|
|
14
|
+
height: ${t.$.size.colorPicker[v].majorPickerSize};
|
|
15
|
+
width: ${t.$.size.colorPicker[v].minorPickerWidth};
|
|
16
|
+
`,
|
|
17
|
+
})) ``;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { StyledProps } from '@smart-react-components/core/styled-props';
|
|
2
|
+
import { Props as ColorPickerProps } from '../../../context/ColorPickerProps';
|
|
3
|
+
export interface Props extends StyledProps, ColorPickerProps {
|
|
4
|
+
}
|
|
5
|
+
declare const _default: import("styled-components").StyledComponent<"div", any, StyledProps & Props, never>;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const Div_1 = __importDefault(require("@smart-react-components/core/Element/Div"));
|
|
7
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
8
|
+
const css_1 = require("../../../util/css");
|
|
9
|
+
exports.default = (0, styled_components_1.default)(Div_1.default)(({ theme, isDisabled }) => `
|
|
10
|
+
flex: 0 0 auto;
|
|
11
|
+
overflow: hidden;
|
|
12
|
+
position: relative;
|
|
13
|
+
touch-action: none;
|
|
14
|
+
|
|
15
|
+
&,
|
|
16
|
+
div {
|
|
17
|
+
border-radius: ${(0, css_1.toCSSValue)(theme.$.radius.colorPicker)(v => v * 2)};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
div {
|
|
21
|
+
height: 100%;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
${!isDisabled
|
|
25
|
+
? `
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
`
|
|
28
|
+
: ''}
|
|
29
|
+
`);
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const Section_1 = __importDefault(require("@smart-react-components/core/Element/Section"));
|
|
7
|
+
const dom_1 = require("@smart-react-components/core/util/dom");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const ColorPickerProps_1 = __importDefault(require("../../../context/ColorPickerProps"));
|
|
10
|
+
const color_picker_1 = require("../../../util/color-picker");
|
|
11
|
+
const MajorPicker_1 = __importDefault(require("./MajorPicker"));
|
|
12
|
+
const MinorPicker_1 = __importDefault(require("./MinorPicker"));
|
|
13
|
+
const OpacityPicker_1 = __importDefault(require("./OpacityPicker"));
|
|
14
|
+
const PickerSection = ({ hasOpacityPicker, onDrag }) => {
|
|
15
|
+
const { updateValue, value } = react_1.default.useContext(ColorPickerProps_1.default);
|
|
16
|
+
const color = react_1.default.useRef(undefined);
|
|
17
|
+
const majorPicker = react_1.default.useRef(null);
|
|
18
|
+
const minorPicker = react_1.default.useRef(null);
|
|
19
|
+
const opacityPicker = react_1.default.useRef(null);
|
|
20
|
+
const handleStart = (onMove, onEnd) => {
|
|
21
|
+
(0, dom_1.addEventListener)(document, ['mousemove', 'touchmove'], onMove);
|
|
22
|
+
(0, dom_1.addEventListener)(document, ['mouseup', 'touchend'], onEnd);
|
|
23
|
+
document.body.style.userSelect = 'none';
|
|
24
|
+
};
|
|
25
|
+
const handleEnd = (onMove, onEnd) => {
|
|
26
|
+
(0, dom_1.removeEventListener)(document, ['mousemove', 'touchmove'], onMove);
|
|
27
|
+
(0, dom_1.removeEventListener)(document, ['mouseup', 'touchend'], onEnd);
|
|
28
|
+
document.body.style.userSelect = 'initial';
|
|
29
|
+
updateValue(color.current);
|
|
30
|
+
};
|
|
31
|
+
const handleMajorPickerDrag = () => {
|
|
32
|
+
var _a;
|
|
33
|
+
(_a = opacityPicker.current) === null || _a === void 0 ? void 0 : _a.onExternalDrag();
|
|
34
|
+
handleDrag();
|
|
35
|
+
};
|
|
36
|
+
const handleMinorPickerDrag = () => {
|
|
37
|
+
majorPicker.current.onExternalDrag();
|
|
38
|
+
};
|
|
39
|
+
const handleDrag = () => onDrag(color.current);
|
|
40
|
+
const handleResize = () => {
|
|
41
|
+
var _a;
|
|
42
|
+
majorPicker.current.onChange();
|
|
43
|
+
minorPicker.current.onChange();
|
|
44
|
+
(_a = opacityPicker.current) === null || _a === void 0 ? void 0 : _a.onChange();
|
|
45
|
+
};
|
|
46
|
+
react_1.default.useEffect(() => {
|
|
47
|
+
(0, dom_1.addEventListener)(window, ['resize'], handleResize);
|
|
48
|
+
return () => {
|
|
49
|
+
(0, dom_1.removeEventListener)(window, ['resize'], handleResize);
|
|
50
|
+
};
|
|
51
|
+
}, []);
|
|
52
|
+
react_1.default.useEffect(() => {
|
|
53
|
+
var _a;
|
|
54
|
+
if (typeof color.current === 'undefined' || !(0, color_picker_1.isEqual)(color.current, value)) {
|
|
55
|
+
color.current = value;
|
|
56
|
+
majorPicker.current.onChange();
|
|
57
|
+
minorPicker.current.onChange();
|
|
58
|
+
(_a = opacityPicker.current) === null || _a === void 0 ? void 0 : _a.onChange();
|
|
59
|
+
}
|
|
60
|
+
}, [value]);
|
|
61
|
+
return (react_1.default.createElement(Section_1.default, { display: "flex", justifyContent: "space-between" },
|
|
62
|
+
react_1.default.createElement(MajorPicker_1.default, { color: color, onEnd: handleEnd, onDrag: handleMajorPickerDrag, onRef: v => { majorPicker.current = v; }, onStart: handleStart }),
|
|
63
|
+
react_1.default.createElement(MinorPicker_1.default, { color: color, onEnd: handleEnd, onDrag: handleMinorPickerDrag, onRef: v => { minorPicker.current = v; }, onStart: handleStart }),
|
|
64
|
+
hasOpacityPicker && (react_1.default.createElement(OpacityPicker_1.default, { color: color, onEnd: handleEnd, onDrag: handleDrag, onRef: v => { opacityPicker.current = v; }, onStart: handleStart }))));
|
|
65
|
+
};
|
|
66
|
+
exports.default = PickerSection;
|
|
@@ -4,31 +4,31 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const Div_1 = __importDefault(require("@smart-react-components/core/Element/Div"));
|
|
7
|
-
const
|
|
7
|
+
const Svg_1 = __importDefault(require("@smart-react-components/core/Element/Svg"));
|
|
8
8
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
9
|
const types_1 = require("../../types");
|
|
10
10
|
const css_1 = require("../../util/css");
|
|
11
11
|
const props_1 = require("../../util/props");
|
|
12
|
-
exports.default = (0, styled_components_1.default)(Div_1.default).attrs(({ isSeparated }) => (Object.assign(Object.assign({}, (isSeparated && { as:
|
|
12
|
+
exports.default = (0, styled_components_1.default)(Div_1.default).attrs(({ isSeparated }) => (Object.assign(Object.assign({}, (isSeparated && { as: 'label' })), { getInputSize: (v, t) => `
|
|
13
13
|
font-size: ${t.$.size.form.blockLabel[v].fontSize};
|
|
14
14
|
padding: ${isSeparated ? t.$.size.input[v].padding.y : 0} ${(0, css_1.toCSSValue)(t.$.size.input[v].padding.x)(v => v / 2)};
|
|
15
|
+
|
|
16
|
+
${Svg_1.default} {
|
|
17
|
+
height: ${t.$.size.icon[v]};
|
|
18
|
+
width: ${t.$.size.icon[v]};
|
|
19
|
+
}
|
|
15
20
|
` })))(({ theme, addonPosition, hasBorder, isDisabled, isFocused, isOutline, isSeparated, isSoft, palette, shape }) => `
|
|
16
21
|
align-items: center;
|
|
17
22
|
border-bottom-${types_1.OrderPosition[addonPosition].toLowerCase()}-radius: ${theme.$.radius.input[shape]};
|
|
18
23
|
border-top-${types_1.OrderPosition[addonPosition].toLowerCase()}-radius: ${theme.$.radius.input[shape]};
|
|
19
24
|
box-sizing: border-box;
|
|
20
25
|
display: inline-flex;
|
|
26
|
+
fill: currentcolor;
|
|
21
27
|
flex: 0 0 auto;
|
|
22
28
|
justify-content: center;
|
|
23
29
|
transition: 200ms 0s ease-in-out;
|
|
24
30
|
transition-property: background, border, color, fill;
|
|
25
31
|
|
|
26
|
-
${isSeparated
|
|
27
|
-
? `
|
|
28
|
-
align-self: flex-start;
|
|
29
|
-
`
|
|
30
|
-
: ''}
|
|
31
|
-
|
|
32
32
|
${hasBorder
|
|
33
33
|
? `
|
|
34
34
|
border: solid 1px;
|
|
@@ -41,7 +41,6 @@ exports.default = (0, styled_components_1.default)(Div_1.default).attrs(({ isSep
|
|
|
41
41
|
${!isSoft
|
|
42
42
|
? `
|
|
43
43
|
color: ${theme.$.palette[palette].font};
|
|
44
|
-
fill: ${theme.$.palette[palette].font};
|
|
45
44
|
|
|
46
45
|
${(isSeparated || !isFocused)
|
|
47
46
|
? `
|
|
@@ -55,7 +54,6 @@ exports.default = (0, styled_components_1.default)(Div_1.default).attrs(({ isSep
|
|
|
55
54
|
`
|
|
56
55
|
: `
|
|
57
56
|
color: ${theme.$.palette[palette].softFont};
|
|
58
|
-
fill: ${theme.$.palette[palette].softFont};
|
|
59
57
|
|
|
60
58
|
${(isSeparated || !isFocused)
|
|
61
59
|
? `
|
|
@@ -72,7 +70,6 @@ exports.default = (0, styled_components_1.default)(Div_1.default).attrs(({ isSep
|
|
|
72
70
|
background: ${theme.$.color.dynamic.background};
|
|
73
71
|
border-color ${(isSeparated || !isFocused) ? theme.$.color.dynamic.accent : theme.$.palette[palette].main};
|
|
74
72
|
color: ${theme.$.color.dynamic.font};
|
|
75
|
-
fill: ${theme.$.color.dynamic.font};
|
|
76
73
|
`}
|
|
77
74
|
|
|
78
75
|
${(!isSeparated && isDisabled)
|
|
@@ -32,6 +32,7 @@ exports.default = (0, styled_components_1.default)(Input_1.default).attrs(({ has
|
|
|
32
32
|
border-radius: ${theme.$.radius.input[shape]};
|
|
33
33
|
flex: 1 1 auto;
|
|
34
34
|
font-family: ${theme.$.fontFamily.input};
|
|
35
|
+
min-width: 1px;
|
|
35
36
|
transition: 200ms 0s ease-in-out;
|
|
36
37
|
transition-property: background, border, color, fill;
|
|
37
38
|
-webkit-appearance: none;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { StyledProps } from '@smart-react-components/core/styled-props';
|
|
2
2
|
import { ResponsiveProp, ShapeProp, SizeProp } from '@smart-react-components/core/types';
|
|
3
3
|
interface Props extends StyledProps, ResponsiveProp<'modalSize', SizeProp> {
|
|
4
|
+
hasBorder: boolean;
|
|
4
5
|
isBlock: boolean;
|
|
5
6
|
isCentered: boolean;
|
|
6
7
|
isFullScreen: boolean;
|
|
@@ -33,7 +33,7 @@ exports.default = (0, styled_components_1.default)(Div_1.default).attrs(({ isBlo
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
`,
|
|
36
|
-
}))(({ theme, isBlock, isCentered, isFullScreen, isStretched, shape }) => `
|
|
36
|
+
}))(({ theme, hasBorder, isBlock, isCentered, isFullScreen, isStretched, shape }) => `
|
|
37
37
|
background: ${theme.$.color.dynamic.background};
|
|
38
38
|
box-sizing: border-box;
|
|
39
39
|
color: ${theme.$.color.dynamic.font};
|
|
@@ -58,8 +58,23 @@ exports.default = (0, styled_components_1.default)(Div_1.default).attrs(({ isBlo
|
|
|
58
58
|
|
|
59
59
|
${!isFullScreen
|
|
60
60
|
? `
|
|
61
|
-
border: solid 1px ${theme.$.color.dynamic.accent};
|
|
62
61
|
border-radius: ${theme.$.radius.modal[shape]};
|
|
62
|
+
|
|
63
|
+
${hasBorder
|
|
64
|
+
? `
|
|
65
|
+
border: solid 1px ${theme.$.color.dynamic.accent};
|
|
66
|
+
`
|
|
67
|
+
: ''}
|
|
68
|
+
|
|
69
|
+
> *:first-child {
|
|
70
|
+
border-top-left-radius: ${theme.$.radius.modal[shape]};
|
|
71
|
+
border-top-right-radius: ${theme.$.radius.modal[shape]};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
> *:last-child {
|
|
75
|
+
border-bottom-left-radius: ${theme.$.radius.modal[shape]};
|
|
76
|
+
border-bottom-right-radius: ${theme.$.radius.modal[shape]};
|
|
77
|
+
}
|
|
63
78
|
`
|
|
64
79
|
: ''}
|
|
65
80
|
`);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { StyledProps } from '@smart-react-components/core/styled-props';
|
|
2
|
+
interface Props extends StyledProps {
|
|
3
|
+
styled: string;
|
|
4
|
+
}
|
|
5
|
+
declare const _default: import("styled-components").StyledComponent<"div", any, StyledProps & Props, never>;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const Div_1 = __importDefault(require("@smart-react-components/core/Element/Div"));
|
|
7
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
8
|
+
exports.default = (0, styled_components_1.default)(Div_1.default)(({ styled }) => `
|
|
9
|
+
position: relative;
|
|
10
|
+
|
|
11
|
+
${styled}
|
|
12
|
+
`);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { StyledProps } from '@smart-react-components/core/styled-props';
|
|
2
|
+
import { PaletteProp, ResponsiveProp, ShapeProp, SizeProp, TableStripedOrientation } from '@smart-react-components/core/types';
|
|
3
|
+
export interface Props extends StyledProps, Partial<ResponsiveProp<'tableSize', SizeProp>> {
|
|
4
|
+
hasBorderX: boolean;
|
|
5
|
+
hasBorderY: boolean;
|
|
6
|
+
hasHeadBackground: boolean;
|
|
7
|
+
hasHover: boolean;
|
|
8
|
+
isBlock: boolean;
|
|
9
|
+
isSoft: boolean;
|
|
10
|
+
isStriped: boolean;
|
|
11
|
+
palette: PaletteProp;
|
|
12
|
+
shape: ShapeProp;
|
|
13
|
+
stripedOrientation: TableStripedOrientation;
|
|
14
|
+
}
|
|
15
|
+
declare const _default: import("styled-components").StyledComponent<"table", any, StyledProps & Props, never>;
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const Table_1 = __importDefault(require("@smart-react-components/core/Element/Table"));
|
|
7
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
8
|
+
exports.default = (0, styled_components_1.default)(Table_1.default).attrs({
|
|
9
|
+
getTableSize: (v, t) => `
|
|
10
|
+
font-size: ${t.$.size.table[v].fontSize};
|
|
11
|
+
|
|
12
|
+
> * > tr > * {
|
|
13
|
+
padding: ${t.$.size.table[v].padding.y} ${t.$.size.table[v].padding.x};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
> thead {
|
|
17
|
+
font-size: ${t.$.size.table[v].headFontSize};
|
|
18
|
+
}
|
|
19
|
+
`,
|
|
20
|
+
})(({ theme, hasBorderX, hasBorderY, hasHeadBackground, hasHover, isBlock, isSoft, isStriped, palette, shape, stripedOrientation }) => `
|
|
21
|
+
border-collapse: separate;
|
|
22
|
+
border-spacing: 0;
|
|
23
|
+
empty-cells: hide;
|
|
24
|
+
font-family: ${theme.$.fontFamily.table};
|
|
25
|
+
|
|
26
|
+
> thead {
|
|
27
|
+
font-family: ${theme.$.fontFamily.tableHead};
|
|
28
|
+
font-weight: ${theme.$.fontWeight.tableHead};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
${isBlock
|
|
32
|
+
? `
|
|
33
|
+
width: 100%;
|
|
34
|
+
`
|
|
35
|
+
: ''}
|
|
36
|
+
|
|
37
|
+
> * > tr > * {
|
|
38
|
+
border: solid 0;
|
|
39
|
+
box-sizing: border-box;
|
|
40
|
+
fill: currentcolor;
|
|
41
|
+
transition: background 150ms 0s ease-in-out;
|
|
42
|
+
word-break: break-word;
|
|
43
|
+
word-wrap: break-word;
|
|
44
|
+
|
|
45
|
+
${hasBorderX
|
|
46
|
+
? `
|
|
47
|
+
border-right-width: ${theme.$.length.table.border};
|
|
48
|
+
|
|
49
|
+
&:first-child {
|
|
50
|
+
border-left-width: ${theme.$.length.table.border};
|
|
51
|
+
}
|
|
52
|
+
`
|
|
53
|
+
: ''}
|
|
54
|
+
|
|
55
|
+
${hasBorderY
|
|
56
|
+
? `
|
|
57
|
+
border-bottom-width: ${theme.$.length.table.border};
|
|
58
|
+
`
|
|
59
|
+
: ''}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
${hasBorderY
|
|
63
|
+
? `
|
|
64
|
+
> thead > tr > * {
|
|
65
|
+
border-bottom-width: ${theme.$.length.table.headBorder};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
> *:first-child > tr:first-child > * {
|
|
69
|
+
border-top-width: ${theme.$.length.table.border};
|
|
70
|
+
}
|
|
71
|
+
`
|
|
72
|
+
: ''}
|
|
73
|
+
|
|
74
|
+
> *:first-child > tr:first-child > * {
|
|
75
|
+
border-top-left-radius: ${theme.$.radius.table[shape]};
|
|
76
|
+
border-top-right-radius: ${theme.$.radius.table[shape]};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
> *:last-child > tr:last-child > * {
|
|
80
|
+
border-bottom-left-radius: ${theme.$.radius.table[shape]};
|
|
81
|
+
border-bottom-right-radius: ${theme.$.radius.table[shape]};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
${!isSoft
|
|
85
|
+
? `
|
|
86
|
+
> * > tr > * {
|
|
87
|
+
background: ${theme.$.palette[palette].background};
|
|
88
|
+
border-color: ${theme.$.palette[palette].dynamicest};
|
|
89
|
+
color: ${theme.$.palette[palette].font};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
${hasHeadBackground
|
|
93
|
+
? `
|
|
94
|
+
> thead > tr > * {
|
|
95
|
+
background: ${theme.$.palette[palette].dynamic};
|
|
96
|
+
}
|
|
97
|
+
`
|
|
98
|
+
: ''}
|
|
99
|
+
|
|
100
|
+
${isStriped
|
|
101
|
+
? `
|
|
102
|
+
> tbody > tr:nth-child(${stripedOrientation}) > * {
|
|
103
|
+
background: ${theme.$.palette[palette].dynamic};
|
|
104
|
+
}
|
|
105
|
+
`
|
|
106
|
+
: ''}
|
|
107
|
+
|
|
108
|
+
${hasHover
|
|
109
|
+
? `
|
|
110
|
+
> tbody > tr {
|
|
111
|
+
> * {
|
|
112
|
+
transition: background 150ms 0 ease-in-out;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&:hover > * {
|
|
116
|
+
background: ${theme.$.palette[palette].dynamicer};
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
`
|
|
120
|
+
: ''}
|
|
121
|
+
`
|
|
122
|
+
: `
|
|
123
|
+
> * > tr > * {
|
|
124
|
+
background: ${theme.$.palette[palette].softBackground};
|
|
125
|
+
border-color: ${theme.$.palette[palette].softDarkest};
|
|
126
|
+
color: ${theme.$.palette[palette].softFont};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
${hasHeadBackground
|
|
130
|
+
? `
|
|
131
|
+
> thead > tr > * {
|
|
132
|
+
background: ${theme.$.palette[palette].softDark};
|
|
133
|
+
}
|
|
134
|
+
`
|
|
135
|
+
: ''}
|
|
136
|
+
|
|
137
|
+
${isStriped
|
|
138
|
+
? `
|
|
139
|
+
> tbody > tr:nth-child(${stripedOrientation}) > * {
|
|
140
|
+
background: ${theme.$.palette[palette].softDark};
|
|
141
|
+
}
|
|
142
|
+
`
|
|
143
|
+
: ''}
|
|
144
|
+
|
|
145
|
+
${hasHover
|
|
146
|
+
? `
|
|
147
|
+
> tbody > tr:hover > * {
|
|
148
|
+
background: ${theme.$.palette[palette].softDarker};
|
|
149
|
+
}
|
|
150
|
+
`
|
|
151
|
+
: ''}
|
|
152
|
+
`}
|
|
153
|
+
`);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const defaultPaletteColors: string[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Color, Nullable, PaletteProp, ResponsiveProp, SizeProp } from '@smart-react-components/core/types';
|
|
3
|
+
export interface Props extends ResponsiveProp<'colorPickerSize', SizeProp> {
|
|
4
|
+
isDisabled: boolean;
|
|
5
|
+
palette: PaletteProp;
|
|
6
|
+
updateValue: (color: Nullable<string | Color>) => void;
|
|
7
|
+
value: Color;
|
|
8
|
+
}
|
|
9
|
+
declare const _default: import("react").Context<Props>;
|
|
10
|
+
export default _default;
|