@smart-react-components/ui 2.0.0-alpha-4 → 2.0.0-alpha-6
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/Alert/AlertIcon/index.js +1 -1
- package/Alert/index.d.ts +1 -1
- package/Alert/index.js +38 -11
- package/Badge/BadgeElement.d.ts +1 -1
- package/Badge/BadgeElement.js +2 -2
- package/Badge/BadgeIcon/index.js +4 -2
- package/Badge/BadgeList/index.js +19 -7
- package/Badge/index.d.ts +3 -2
- package/Badge/index.js +38 -9
- package/Checkbox/CheckboxElement.d.ts +11 -0
- package/Checkbox/CheckboxElement.js +79 -0
- package/Checkbox/CheckboxGroup/index.d.ts +21 -0
- package/Checkbox/CheckboxGroup/index.js +17 -0
- package/Checkbox/index.d.ts +25 -0
- package/Checkbox/index.js +72 -0
- package/Dropdown/DropdownCategory/index.d.ts +2 -1
- package/Dropdown/DropdownCategory/index.js +15 -1
- package/Dropdown/DropdownItem/DropdownItemElement.d.ts +1 -1
- package/Dropdown/DropdownItem/DropdownItemElement.js +5 -5
- package/Dropdown/DropdownItem/index.d.ts +10 -1
- package/Dropdown/DropdownItem/index.js +2 -2
- package/Dropdown/DropdownList/DropdownListElement.d.ts +1 -1
- package/Dropdown/DropdownList/DropdownListElement.js +7 -7
- package/Dropdown/DropdownList/index.d.ts +4 -4
- package/Dropdown/DropdownList/index.js +2 -2
- package/Input/InputAddon/InputAddonElement.d.ts +16 -0
- package/Input/InputAddon/InputAddonElement.js +90 -0
- package/Input/InputAddon/index.d.ts +12 -0
- package/Input/InputAddon/index.js +12 -0
- package/Input/InputElement.d.ts +19 -0
- package/Input/InputElement.js +157 -0
- package/Input/InputFile/InputFileTemplate.d.ts +21 -0
- package/Input/InputFile/InputFileTemplate.js +51 -0
- package/Input/InputFile/index.d.ts +23 -0
- package/Input/InputFile/index.js +95 -0
- package/Input/InputNumber/InputNumberTemplate.d.ts +16 -0
- package/Input/InputNumber/InputNumberTemplate.js +62 -0
- package/Input/InputNumber/InputNumberTemplateElement.d.ts +6 -0
- package/Input/InputNumber/InputNumberTemplateElement.js +58 -0
- package/Input/InputNumber/index.d.ts +30 -0
- package/Input/InputNumber/index.js +79 -0
- package/Input/index.d.ts +29 -0
- package/Input/index.js +61 -0
- package/Pagination/PaginationItem/PaginationItemElement.d.ts +13 -0
- package/Pagination/PaginationItem/PaginationItemElement.js +139 -0
- package/Pagination/PaginationItem/index.d.ts +21 -0
- package/Pagination/PaginationItem/index.js +17 -0
- package/Pagination/PaginationLink/index.d.ts +6 -0
- package/Pagination/PaginationLink/index.js +27 -0
- package/Pagination/PaginationList/PaginationListElement.d.ts +3 -0
- package/Pagination/PaginationList/PaginationListElement.js +15 -0
- package/Pagination/PaginationList/index.d.ts +16 -0
- package/Pagination/PaginationList/index.js +29 -0
- package/Pagination/PaginationNextIcon/index.d.ts +2 -0
- package/Pagination/PaginationNextIcon/index.js +7 -0
- package/Pagination/PaginationPrevIcon/index.d.ts +2 -0
- package/Pagination/PaginationPrevIcon/index.js +7 -0
- package/Pagination/index.d.ts +5 -0
- package/Pagination/index.js +16 -0
- package/Popover/PopoverElement.js +18 -18
- package/ProgressBar/ProgressBarElement.js +8 -7
- package/Radio/RadioElement.d.ts +10 -0
- package/Radio/RadioElement.js +74 -0
- package/Radio/RadioGroup/index.d.ts +20 -0
- package/Radio/RadioGroup/index.js +17 -0
- package/Radio/index.d.ts +22 -0
- package/Radio/index.js +46 -0
- package/Select/Option/index.d.ts +22 -0
- package/Select/Option/index.js +30 -0
- package/Select/OptionGroup/index.d.ts +8 -0
- package/Select/OptionGroup/index.js +22 -0
- package/Select/SelectAddon/index.d.ts +2 -0
- package/Select/SelectAddon/index.js +7 -0
- package/Select/SelectBox/index.d.ts +7 -0
- package/Select/SelectBox/index.js +153 -0
- package/Select/SelectElement.d.ts +3 -0
- package/Select/SelectElement.js +20 -0
- package/Select/index.d.ts +5 -0
- package/Select/index.js +56 -0
- package/Switch/SwitchElement.d.ts +3 -0
- package/Switch/SwitchElement.js +71 -0
- package/Switch/SwitchGroup/index.d.ts +6 -0
- package/Switch/SwitchGroup/index.js +11 -0
- package/Switch/index.d.ts +6 -0
- package/Switch/index.js +14 -0
- package/Textarea/TextareaAddon/index.d.ts +2 -0
- package/Textarea/TextareaAddon/index.js +7 -0
- package/Textarea/index.d.ts +10 -0
- package/Textarea/index.js +44 -0
- package/Tooltip/TooltipElement.js +5 -5
- package/components/FormBlockLabel/index.d.ts +8 -0
- package/components/FormBlockLabel/index.js +56 -0
- package/components/FormGroup/index.d.ts +6 -0
- package/components/FormGroup/index.js +17 -0
- package/components/FormInlineLabel/index.d.ts +10 -0
- package/components/FormInlineLabel/index.js +66 -0
- package/components/HiddenInput/index.d.ts +2 -0
- package/components/HiddenInput/index.js +15 -0
- package/hooks/useInputAddons.d.ts +18 -0
- package/hooks/useInputAddons.js +47 -0
- package/hooks/useInputMethods.d.ts +18 -0
- package/hooks/useInputMethods.js +49 -0
- package/icons/ArrowLeft.d.ts +6 -0
- package/icons/ArrowLeft.js +14 -0
- package/icons/ArrowRight.d.ts +6 -0
- package/icons/ArrowRight.js +14 -0
- package/icons/CaretDown.d.ts +6 -0
- package/icons/CaretDown.js +12 -0
- package/icons/CaretUp.d.ts +6 -0
- package/icons/CaretUp.js +12 -0
- package/index.d.ts +16 -0
- package/index.js +32 -1
- package/package.json +7 -7
- package/types/form.d.ts +22 -0
- package/types/form.js +2 -0
- package/types/index.d.ts +10 -0
- package/types/index.js +10 -1
- package/util/css.d.ts +5 -0
- package/util/css.js +7 -1
- package/util/dom.d.ts +1 -0
- package/util/dom.js +2 -1
- package/util/fixed-box.js +1 -1
- package/util/form.d.ts +9 -0
- package/util/form.js +16 -0
- package/util/props.d.ts +13 -11
- package/util/props.js +4 -44
- package/util/radio.d.ts +4 -0
- package/util/radio.js +14 -0
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
const InputAddonElement_1 = __importDefault(require("../InputAddon/InputAddonElement"));
|
|
10
|
+
const InputElement_1 = __importDefault(require("../InputElement"));
|
|
11
|
+
exports.default = (0, styled_components_1.default)(Div_1.default).attrs({
|
|
12
|
+
getInputSize: (v, t) => `
|
|
13
|
+
${InputAddonElement_1.default} {
|
|
14
|
+
padding: 0;
|
|
15
|
+
|
|
16
|
+
> div {
|
|
17
|
+
padding: 0 ${(0, css_1.toCSSValue)(t.$.size.input[v].padding.x)(v => v / 2)};
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
`,
|
|
21
|
+
}) `
|
|
22
|
+
display: flex;
|
|
23
|
+
flex: 1 1 auto;
|
|
24
|
+
|
|
25
|
+
${InputElement_1.default} {
|
|
26
|
+
-moz-appearance: textfield;
|
|
27
|
+
|
|
28
|
+
&::-webkit-inner-spin-button,
|
|
29
|
+
&::-webkit-outer-spin-button {
|
|
30
|
+
margin: 0;
|
|
31
|
+
-webkit-appearance: none;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
${InputAddonElement_1.default} {
|
|
36
|
+
flex-direction: column;
|
|
37
|
+
user-select: none;
|
|
38
|
+
|
|
39
|
+
> div {
|
|
40
|
+
display: flex;
|
|
41
|
+
height: 50%;
|
|
42
|
+
visibility: hidden;
|
|
43
|
+
|
|
44
|
+
> svg {
|
|
45
|
+
height: .65rem;
|
|
46
|
+
width: .65rem;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&:active {
|
|
50
|
+
opacity: .3;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&:hover ${InputAddonElement_1.default} > div {
|
|
56
|
+
visibility: visible;
|
|
57
|
+
}
|
|
58
|
+
`;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ChangeEvents } from '@smart-react-components/core/element-props/change-events';
|
|
2
|
+
import { FocusEvents } from '@smart-react-components/core/element-props/focus-events';
|
|
3
|
+
import { IntrinsicStyledProps } from '@smart-react-components/core/element-props/intrinsic-styled-props';
|
|
4
|
+
import { KeyboardEvents } from '@smart-react-components/core/element-props/keyboard-events';
|
|
5
|
+
import { ContentElement, PaletteProp, Partial, ResponsiveProp, SetState, ShapeProp, SizeProp } from '@smart-react-components/core/types';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
export interface Props extends Partial<ResponsiveProp<'size', SizeProp>>, IntrinsicStyledProps, ChangeEvents, FocusEvents, KeyboardEvents {
|
|
8
|
+
defaultValue?: number;
|
|
9
|
+
hasBorder?: boolean;
|
|
10
|
+
isBlock?: boolean;
|
|
11
|
+
isDisabled?: boolean;
|
|
12
|
+
isOutline?: boolean;
|
|
13
|
+
isReadOnly?: boolean;
|
|
14
|
+
isRequired?: boolean;
|
|
15
|
+
isSoft?: boolean;
|
|
16
|
+
label?: ContentElement;
|
|
17
|
+
leftAddon?: ContentElement;
|
|
18
|
+
max?: number;
|
|
19
|
+
min?: number;
|
|
20
|
+
palette?: PaletteProp;
|
|
21
|
+
placeholder?: string;
|
|
22
|
+
rightAddon?: ContentElement;
|
|
23
|
+
setValue?: SetState<number>;
|
|
24
|
+
shape?: ShapeProp;
|
|
25
|
+
step?: number;
|
|
26
|
+
template?: JSX.Element;
|
|
27
|
+
value?: number;
|
|
28
|
+
}
|
|
29
|
+
declare const InputNumber: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLInputElement>>;
|
|
30
|
+
export default InputNumber;
|
|
@@ -0,0 +1,79 @@
|
|
|
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 element_props_1 = __importDefault(require("@smart-react-components/core/element-props"));
|
|
8
|
+
const change_events_1 = __importDefault(require("@smart-react-components/core/element-props/change-events"));
|
|
9
|
+
const focus_events_1 = __importDefault(require("@smart-react-components/core/element-props/focus-events"));
|
|
10
|
+
const intrinsic_styled_props_1 = __importDefault(require("@smart-react-components/core/element-props/intrinsic-styled-props"));
|
|
11
|
+
const keyboard_events_1 = __importDefault(require("@smart-react-components/core/element-props/keyboard-events"));
|
|
12
|
+
const react_1 = __importDefault(require("react"));
|
|
13
|
+
const FormBlockLabel_1 = __importDefault(require("../../components/FormBlockLabel"));
|
|
14
|
+
const useInputAddons_1 = __importDefault(require("../../hooks/useInputAddons"));
|
|
15
|
+
const useInputMethods_1 = __importDefault(require("../../hooks/useInputMethods"));
|
|
16
|
+
const InputNumberTemplate_1 = __importDefault(require("./InputNumberTemplate"));
|
|
17
|
+
const InputNumber = react_1.default.forwardRef((props, forwardRef) => {
|
|
18
|
+
var _a, _b, _c, _d;
|
|
19
|
+
/**
|
|
20
|
+
* Converts the input string value to number.
|
|
21
|
+
* If value cannot be number, returns the current value.
|
|
22
|
+
*/
|
|
23
|
+
const applyNumberFormat = (value) => {
|
|
24
|
+
if (!value.trim()) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
if (isNaN(Number(value))) {
|
|
28
|
+
return props.value;
|
|
29
|
+
}
|
|
30
|
+
const i = parseInt(value);
|
|
31
|
+
if (typeof props.min !== 'undefined' && i < props.min) {
|
|
32
|
+
return props.value;
|
|
33
|
+
}
|
|
34
|
+
if (typeof props.max !== 'undefined' && i > props.max) {
|
|
35
|
+
return props.value;
|
|
36
|
+
}
|
|
37
|
+
return i;
|
|
38
|
+
};
|
|
39
|
+
const { handleOnBlur, handleOnChange, handleOnFocus, isFocused } = (0, useInputMethods_1.default)({
|
|
40
|
+
isDisabled: props.isDisabled,
|
|
41
|
+
isReadOnly: props.isReadOnly,
|
|
42
|
+
onBlur: props.onBlur,
|
|
43
|
+
onChange: props.onChange,
|
|
44
|
+
onFocus: props.onFocus,
|
|
45
|
+
setValue: value => { var _a; return (_a = props.setValue) === null || _a === void 0 ? void 0 : _a.call(props, applyNumberFormat(value)); },
|
|
46
|
+
});
|
|
47
|
+
const { leftAddon, rightAddon } = (0, useInputAddons_1.default)({
|
|
48
|
+
hasBorder: props.hasBorder,
|
|
49
|
+
isDisabled: props.isDisabled,
|
|
50
|
+
isFocused,
|
|
51
|
+
isOutline: props.isOutline,
|
|
52
|
+
isSoft: props.isSoft,
|
|
53
|
+
leftAddon: props.leftAddon,
|
|
54
|
+
palette: props.palette,
|
|
55
|
+
rightAddon: props.rightAddon,
|
|
56
|
+
shape: props.shape,
|
|
57
|
+
size: props.size,
|
|
58
|
+
sizeSm: props.sizeSm,
|
|
59
|
+
sizeMd: props.sizeMd,
|
|
60
|
+
sizeLg: props.sizeLg,
|
|
61
|
+
sizeXl: props.sizeXl,
|
|
62
|
+
});
|
|
63
|
+
return (react_1.default.createElement(FormBlockLabel_1.default, Object.assign({}, (0, element_props_1.default)(props, [intrinsic_styled_props_1.default]), { formSize: props.size, formSizeSm: props.sizeSm, formSizeMd: props.sizeMd, formSizeLg: props.sizeLg, formSizeXl: props.sizeXl, isBlock: props.isBlock, isDisabled: props.isDisabled }),
|
|
64
|
+
props.label && react_1.default.createElement("span", null, props.label),
|
|
65
|
+
react_1.default.createElement(Div_1.default, { display: "flex", flex: "1 1 auto" },
|
|
66
|
+
leftAddon && leftAddon,
|
|
67
|
+
react_1.default.cloneElement(props.template, Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (0, element_props_1.default)(props, [change_events_1.default, focus_events_1.default, keyboard_events_1.default])), (typeof props.defaultValue !== 'undefined' && { defaultValue: ((_a = props.defaultValue) !== null && _a !== void 0 ? _a : '') })), (props.isDisabled && { disabled: true })), (props.isReadOnly && { readOnly: true })), (props.isRequired && { required: true })), (typeof props.max !== 'undefined' && { max: props.max })), (typeof props.min !== 'undefined' && { min: props.min })), (typeof props.step !== 'undefined' && { step: props.step })), (typeof props.value !== 'undefined' && { value: ((_b = props.value) !== null && _b !== void 0 ? _b : '') })), { hasBorder: props.hasBorder, hasLeftAddon: !!leftAddon, hasRightAddon: !!rightAddon, hasSeparatedLeftAddon: (_c = leftAddon === null || leftAddon === void 0 ? void 0 : leftAddon.props) === null || _c === void 0 ? void 0 : _c.isSeparated, hasSeparatedRightAddon: (_d = rightAddon === null || rightAddon === void 0 ? void 0 : rightAddon.props) === null || _d === void 0 ? void 0 : _d.isSeparated, inputSize: props.size, inputSizeSm: props.sizeSm, inputSizeMd: props.sizeMd, inputSizeLg: props.sizeLg, inputSizeXl: props.sizeXl, isDisabled: props.isDisabled, isFocused, isOutline: props.isOutline, isSoft: props.isSoft, onBlur: handleOnBlur, onChange: handleOnChange, onFocus: handleOnFocus, palette: props.palette, ref: forwardRef, shape: props.shape })),
|
|
68
|
+
rightAddon && rightAddon)));
|
|
69
|
+
});
|
|
70
|
+
InputNumber.defaultProps = {
|
|
71
|
+
hasBorder: true,
|
|
72
|
+
isBlock: true,
|
|
73
|
+
isOutline: true,
|
|
74
|
+
palette: 'primary',
|
|
75
|
+
shape: 'rectangle',
|
|
76
|
+
size: 'medium',
|
|
77
|
+
template: react_1.default.createElement(InputNumberTemplate_1.default, null),
|
|
78
|
+
};
|
|
79
|
+
exports.default = InputNumber;
|
package/Input/index.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ChangeEvents } from '@smart-react-components/core/element-props/change-events';
|
|
2
|
+
import { FocusEvents } from '@smart-react-components/core/element-props/focus-events';
|
|
3
|
+
import { IntrinsicStyledProps } from '@smart-react-components/core/element-props/intrinsic-styled-props';
|
|
4
|
+
import { KeyboardEvents } from '@smart-react-components/core/element-props/keyboard-events';
|
|
5
|
+
import { ContentElement, PaletteProp, Partial, ResponsiveProp, SetState, ShapeProp, SizeProp } from '@smart-react-components/core/types';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { InputType } from '../types';
|
|
8
|
+
export interface Props extends Partial<ResponsiveProp<'size', SizeProp>>, IntrinsicStyledProps, ChangeEvents, FocusEvents, KeyboardEvents {
|
|
9
|
+
defaultValue?: string;
|
|
10
|
+
hasBorder?: boolean;
|
|
11
|
+
isBlock?: boolean;
|
|
12
|
+
isDisabled?: boolean;
|
|
13
|
+
isOutline?: boolean;
|
|
14
|
+
isReadOnly?: boolean;
|
|
15
|
+
isRequired?: boolean;
|
|
16
|
+
isSoft?: boolean;
|
|
17
|
+
label?: ContentElement;
|
|
18
|
+
leftAddon?: ContentElement;
|
|
19
|
+
palette?: PaletteProp;
|
|
20
|
+
placeholder?: string;
|
|
21
|
+
rightAddon?: ContentElement;
|
|
22
|
+
setValue?: SetState<string>;
|
|
23
|
+
shape?: ShapeProp;
|
|
24
|
+
template?: JSX.Element;
|
|
25
|
+
type?: InputType;
|
|
26
|
+
value?: string;
|
|
27
|
+
}
|
|
28
|
+
declare const Input: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLInputElement>>;
|
|
29
|
+
export default Input;
|
package/Input/index.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
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 element_props_1 = __importDefault(require("@smart-react-components/core/element-props"));
|
|
8
|
+
const change_events_1 = __importDefault(require("@smart-react-components/core/element-props/change-events"));
|
|
9
|
+
const focus_events_1 = __importDefault(require("@smart-react-components/core/element-props/focus-events"));
|
|
10
|
+
const intrinsic_styled_props_1 = __importDefault(require("@smart-react-components/core/element-props/intrinsic-styled-props"));
|
|
11
|
+
const keyboard_events_1 = __importDefault(require("@smart-react-components/core/element-props/keyboard-events"));
|
|
12
|
+
const react_1 = __importDefault(require("react"));
|
|
13
|
+
const FormBlockLabel_1 = __importDefault(require("../components/FormBlockLabel"));
|
|
14
|
+
const useInputAddons_1 = __importDefault(require("../hooks/useInputAddons"));
|
|
15
|
+
const useInputMethods_1 = __importDefault(require("../hooks/useInputMethods"));
|
|
16
|
+
const types_1 = require("../types");
|
|
17
|
+
const InputElement_1 = __importDefault(require("./InputElement"));
|
|
18
|
+
const Input = react_1.default.forwardRef((props, forwardRef) => {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
const { handleOnBlur, handleOnChange, handleOnFocus, isFocused } = (0, useInputMethods_1.default)({
|
|
21
|
+
isDisabled: props.isDisabled,
|
|
22
|
+
isReadOnly: props.isReadOnly,
|
|
23
|
+
onBlur: props.onBlur,
|
|
24
|
+
onChange: props.onChange,
|
|
25
|
+
onFocus: props.onFocus,
|
|
26
|
+
setValue: props.setValue,
|
|
27
|
+
});
|
|
28
|
+
const { leftAddon, rightAddon } = (0, useInputAddons_1.default)({
|
|
29
|
+
hasBorder: props.hasBorder,
|
|
30
|
+
isDisabled: props.isDisabled,
|
|
31
|
+
isFocused,
|
|
32
|
+
isOutline: props.isOutline,
|
|
33
|
+
isSoft: props.isSoft,
|
|
34
|
+
leftAddon: props.leftAddon,
|
|
35
|
+
palette: props.palette,
|
|
36
|
+
rightAddon: props.rightAddon,
|
|
37
|
+
shape: props.shape,
|
|
38
|
+
size: props.size,
|
|
39
|
+
sizeSm: props.sizeSm,
|
|
40
|
+
sizeMd: props.sizeMd,
|
|
41
|
+
sizeLg: props.sizeLg,
|
|
42
|
+
sizeXl: props.sizeXl,
|
|
43
|
+
});
|
|
44
|
+
return (react_1.default.createElement(FormBlockLabel_1.default, Object.assign({}, (0, element_props_1.default)(props, [intrinsic_styled_props_1.default]), { formSize: props.size, formSizeSm: props.sizeSm, formSizeMd: props.sizeMd, formSizeLg: props.sizeLg, formSizeXl: props.sizeXl, isBlock: props.isBlock, isDisabled: props.isDisabled }),
|
|
45
|
+
props.label && react_1.default.createElement("span", null, props.label),
|
|
46
|
+
react_1.default.createElement(Div_1.default, { display: "flex", flex: "1 1 auto" },
|
|
47
|
+
leftAddon && leftAddon,
|
|
48
|
+
react_1.default.cloneElement(props.template, Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (0, element_props_1.default)(props, [change_events_1.default, focus_events_1.default, keyboard_events_1.default])), (typeof props.defaultValue !== 'undefined' && { defaultValue: props.defaultValue })), (props.isDisabled && { disabled: true })), (props.isReadOnly && { readOnly: true })), (props.isRequired && { required: true })), (typeof props.placeholder !== 'undefined' && { placeholder: props.placeholder })), (typeof props.value !== 'undefined' && { value: props.value })), { hasBorder: props.hasBorder, hasLeftAddon: !!leftAddon, hasRightAddon: !!rightAddon, hasSeparatedLeftAddon: (_a = leftAddon === null || leftAddon === void 0 ? void 0 : leftAddon.props) === null || _a === void 0 ? void 0 : _a.isSeparated, hasSeparatedRightAddon: (_b = rightAddon === null || rightAddon === void 0 ? void 0 : rightAddon.props) === null || _b === void 0 ? void 0 : _b.isSeparated, inputSize: props.size, inputSizeSm: props.sizeSm, inputSizeMd: props.sizeMd, inputSizeLg: props.sizeLg, inputSizeXl: props.sizeXl, isDisabled: props.isDisabled, isFocused, isOutline: props.isOutline, isSoft: props.isSoft, onBlur: handleOnBlur, onChange: handleOnChange, onFocus: handleOnFocus, palette: props.palette, ref: forwardRef, shape: props.shape, type: props.type })),
|
|
49
|
+
rightAddon && rightAddon)));
|
|
50
|
+
});
|
|
51
|
+
Input.defaultProps = {
|
|
52
|
+
hasBorder: true,
|
|
53
|
+
isBlock: true,
|
|
54
|
+
isOutline: true,
|
|
55
|
+
palette: 'primary',
|
|
56
|
+
shape: 'rectangle',
|
|
57
|
+
size: 'medium',
|
|
58
|
+
template: react_1.default.createElement(InputElement_1.default, null),
|
|
59
|
+
type: types_1.InputType.TEXT,
|
|
60
|
+
};
|
|
61
|
+
exports.default = Input;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { StyledProps } from '@smart-react-components/core/styled-props';
|
|
2
|
+
import { PaletteProp, ShapeProp } from '@smart-react-components/core/types';
|
|
3
|
+
interface Props extends StyledProps {
|
|
4
|
+
isActive: boolean;
|
|
5
|
+
isDisabled: boolean;
|
|
6
|
+
isFixedSize: boolean;
|
|
7
|
+
isOutline: boolean;
|
|
8
|
+
isSoft: boolean;
|
|
9
|
+
palette: PaletteProp;
|
|
10
|
+
shape: ShapeProp;
|
|
11
|
+
}
|
|
12
|
+
declare const _default: import("styled-components").StyledComponent<"li", any, StyledProps & Props, never>;
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,139 @@
|
|
|
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 Li_1 = __importDefault(require("@smart-react-components/core/Element/Li"));
|
|
7
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
8
|
+
exports.default = (0, styled_components_1.default)(Li_1.default)(({ theme, isActive, isDisabled, isFixedSize, isOutline, isSoft, palette, shape }) => `
|
|
9
|
+
flex: 0 0 auto;
|
|
10
|
+
margin: ${theme.$.length.pagination.margin.y} ${theme.$.length.pagination.margin.x};
|
|
11
|
+
|
|
12
|
+
> a {
|
|
13
|
+
align-items: center;
|
|
14
|
+
border: solid 1px;
|
|
15
|
+
border-radius: ${shape === 'rounded' && isFixedSize ? '100%' : theme.$.radius.pagination[shape]};
|
|
16
|
+
cursor: default;
|
|
17
|
+
display: inline-flex;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
text-decoration: none;
|
|
20
|
+
transition: 300ms 0s ease-in-out;
|
|
21
|
+
transition-property: background, border, color, fill;
|
|
22
|
+
|
|
23
|
+
${isFixedSize
|
|
24
|
+
? `
|
|
25
|
+
height: ${theme.$.length.pagination.fixedSize};
|
|
26
|
+
min-width: ${theme.$.length.pagination.fixedSize};
|
|
27
|
+
padding: 0 3px;
|
|
28
|
+
`
|
|
29
|
+
: `
|
|
30
|
+
padding: ${theme.$.length.pagination.padding.y} ${theme.$.length.pagination.padding.x};
|
|
31
|
+
`}
|
|
32
|
+
|
|
33
|
+
${isDisabled
|
|
34
|
+
? `
|
|
35
|
+
opacity: ${theme.$.opacity.paginationDisabled};
|
|
36
|
+
pointer-events: none;
|
|
37
|
+
`
|
|
38
|
+
: ''}
|
|
39
|
+
|
|
40
|
+
${!isOutline
|
|
41
|
+
? `
|
|
42
|
+
${!isSoft
|
|
43
|
+
? `
|
|
44
|
+
color: ${theme.$.palette[palette].font};
|
|
45
|
+
fill: ${theme.$.palette[palette].font};
|
|
46
|
+
|
|
47
|
+
${!isActive
|
|
48
|
+
? `
|
|
49
|
+
background: ${theme.$.palette[palette].main};
|
|
50
|
+
border-color: ${theme.$.palette[palette].dynamic};
|
|
51
|
+
|
|
52
|
+
${!isDisabled
|
|
53
|
+
? `
|
|
54
|
+
&:hover {
|
|
55
|
+
background: ${theme.$.palette[palette].dynamicer};
|
|
56
|
+
border-color: ${theme.$.palette[palette].dynamicest};
|
|
57
|
+
}
|
|
58
|
+
`
|
|
59
|
+
: ''}
|
|
60
|
+
`
|
|
61
|
+
: `
|
|
62
|
+
background: ${theme.$.palette[palette].dynamicer};
|
|
63
|
+
border-color: ${theme.$.palette[palette].dynamicest};
|
|
64
|
+
`}
|
|
65
|
+
|
|
66
|
+
`
|
|
67
|
+
: `
|
|
68
|
+
color: ${theme.$.palette[palette].softFont};
|
|
69
|
+
fill: ${theme.$.palette[palette].softFont};
|
|
70
|
+
|
|
71
|
+
${!isActive
|
|
72
|
+
? `
|
|
73
|
+
background: ${theme.$.palette[palette].soft};
|
|
74
|
+
border-color: ${theme.$.palette[palette].softDark};
|
|
75
|
+
|
|
76
|
+
${!isDisabled
|
|
77
|
+
? `
|
|
78
|
+
&:hover {
|
|
79
|
+
background: ${theme.$.palette[palette].softDarker};
|
|
80
|
+
border-color: ${theme.$.palette[palette].softDarkest};
|
|
81
|
+
}
|
|
82
|
+
`
|
|
83
|
+
: ''}
|
|
84
|
+
`
|
|
85
|
+
: `
|
|
86
|
+
background: ${theme.$.palette[palette].softDarker};
|
|
87
|
+
border-color: ${theme.$.palette[palette].softDarkest};
|
|
88
|
+
`}
|
|
89
|
+
`}
|
|
90
|
+
`
|
|
91
|
+
: `
|
|
92
|
+
${!isActive
|
|
93
|
+
? `
|
|
94
|
+
border-color: ${theme.$.color.dynamic.accent};
|
|
95
|
+
color: ${theme.$.color.dynamic.font};
|
|
96
|
+
fill: ${theme.$.color.dynamic.font};
|
|
97
|
+
|
|
98
|
+
${!isDisabled
|
|
99
|
+
? `
|
|
100
|
+
&:hover {
|
|
101
|
+
${!isSoft
|
|
102
|
+
? `
|
|
103
|
+
background: ${theme.$.palette[palette].main};
|
|
104
|
+
border-color: ${theme.$.palette[palette].main};
|
|
105
|
+
color: ${theme.$.palette[palette].font};
|
|
106
|
+
fill: ${theme.$.palette[palette].font};
|
|
107
|
+
`
|
|
108
|
+
: `
|
|
109
|
+
background: ${theme.$.palette[palette].soft};
|
|
110
|
+
border-color: ${theme.$.palette[palette].soft};
|
|
111
|
+
color: ${theme.$.palette[palette].softFont};
|
|
112
|
+
fill: ${theme.$.palette[palette].softFont};
|
|
113
|
+
`}
|
|
114
|
+
}
|
|
115
|
+
`
|
|
116
|
+
: `
|
|
117
|
+
color: ${theme.$.color.dynamic.accent};
|
|
118
|
+
fill: ${theme.$.color.dynamic.accent};
|
|
119
|
+
`}
|
|
120
|
+
`
|
|
121
|
+
: `
|
|
122
|
+
${!isSoft
|
|
123
|
+
? `
|
|
124
|
+
background: ${theme.$.palette[palette].main};
|
|
125
|
+
border-color: ${theme.$.palette[palette].main};
|
|
126
|
+
color: ${theme.$.palette[palette].font};
|
|
127
|
+
fill: ${theme.$.palette[palette].font};
|
|
128
|
+
`
|
|
129
|
+
: `
|
|
130
|
+
background: ${theme.$.palette[palette].soft};
|
|
131
|
+
border-color: ${theme.$.palette[palette].soft};
|
|
132
|
+
color: ${theme.$.palette[palette].softFont};
|
|
133
|
+
fill: ${theme.$.palette[palette].softFont};
|
|
134
|
+
`}
|
|
135
|
+
`}
|
|
136
|
+
|
|
137
|
+
`}
|
|
138
|
+
}
|
|
139
|
+
`);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ClickEvents } from '@smart-react-components/core/element-props/click-events';
|
|
2
|
+
import { ContentElement, JSXElementProps, PaletteProp, ShapeProp } from '@smart-react-components/core/types';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
export interface Props extends ClickEvents {
|
|
5
|
+
children: ContentElement;
|
|
6
|
+
elementProps?: JSXElementProps;
|
|
7
|
+
href?: string;
|
|
8
|
+
isActive?: boolean;
|
|
9
|
+
isDisabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface PrivateProps {
|
|
12
|
+
hasWaveEffect: boolean;
|
|
13
|
+
isFixedSize: boolean;
|
|
14
|
+
isOutline: boolean;
|
|
15
|
+
isSoft: boolean;
|
|
16
|
+
palette: PaletteProp;
|
|
17
|
+
shape: ShapeProp;
|
|
18
|
+
waveEffectPalette: PaletteProp;
|
|
19
|
+
}
|
|
20
|
+
declare const PaginationItem: React.FC<Props>;
|
|
21
|
+
export default PaginationItem;
|
|
@@ -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 A_1 = __importDefault(require("@smart-react-components/core/Element/A"));
|
|
7
|
+
const element_props_1 = __importDefault(require("@smart-react-components/core/element-props"));
|
|
8
|
+
const click_events_1 = __importDefault(require("@smart-react-components/core/element-props/click-events"));
|
|
9
|
+
const react_1 = __importDefault(require("react"));
|
|
10
|
+
const PaginationItemElement_1 = __importDefault(require("./PaginationItemElement"));
|
|
11
|
+
const WaveEffect_1 = __importDefault(require("../../WaveEffect"));
|
|
12
|
+
const PaginationItem = (props) => {
|
|
13
|
+
const AnchorEl = (react_1.default.createElement(A_1.default, Object.assign({}, (0, element_props_1.default)(props, [click_events_1.default]), props.elementProps), props.children));
|
|
14
|
+
const El = props.hasWaveEffect ? react_1.default.createElement(WaveEffect_1.default, { palette: props.waveEffectPalette }, AnchorEl) : AnchorEl;
|
|
15
|
+
return (react_1.default.createElement(PaginationItemElement_1.default, { isActive: props.isActive, isDisabled: props.isDisabled, isFixedSize: props.isFixedSize, isOutline: props.isOutline, isSoft: props.isSoft, palette: props.palette, shape: props.shape }, El));
|
|
16
|
+
};
|
|
17
|
+
exports.default = PaginationItem;
|
|
@@ -0,0 +1,27 @@
|
|
|
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 A_1 = __importDefault(require("@smart-react-components/core/Element/A"));
|
|
7
|
+
const useLink_1 = __importDefault(require("@smart-react-components/router/hooks/useLink"));
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const WaveEffect_1 = __importDefault(require("../../WaveEffect"));
|
|
10
|
+
const PaginationItemElement_1 = __importDefault(require("../PaginationItem/PaginationItemElement"));
|
|
11
|
+
const PaginationLink = (props) => {
|
|
12
|
+
const { children, handleOnClick, isActive } = (0, useLink_1.default)({
|
|
13
|
+
children: props.children,
|
|
14
|
+
isDisabled: props.isDisabled,
|
|
15
|
+
isExact: props.isExact,
|
|
16
|
+
onClick: null,
|
|
17
|
+
path: props.path,
|
|
18
|
+
to: props.to,
|
|
19
|
+
});
|
|
20
|
+
const AnchorEl = (react_1.default.createElement(A_1.default, Object.assign({}, props.elementProps, { href: props.to, onClick: handleOnClick }), children));
|
|
21
|
+
const El = props.hasWaveEffect ? react_1.default.createElement(WaveEffect_1.default, { palette: props.waveEffectPalette }, AnchorEl) : AnchorEl;
|
|
22
|
+
return (react_1.default.createElement(PaginationItemElement_1.default, { isActive: isActive, isDisabled: props.isDisabled, isFixedSize: props.isFixedSize, isOutline: props.isOutline, isSoft: props.isSoft, palette: props.palette, shape: props.shape }, El));
|
|
23
|
+
};
|
|
24
|
+
PaginationLink.defaultProps = {
|
|
25
|
+
isExact: true,
|
|
26
|
+
};
|
|
27
|
+
exports.default = PaginationLink;
|
|
@@ -0,0 +1,15 @@
|
|
|
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 Ul_1 = __importDefault(require("@smart-react-components/core/Element/Ul"));
|
|
7
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
8
|
+
exports.default = (0, styled_components_1.default)(Ul_1.default)(({ theme }) => `
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-wrap: wrap;
|
|
11
|
+
font-family: ${theme.$.fontFamily.pagination};
|
|
12
|
+
font-size: ${theme.$.fontSize.pagination};
|
|
13
|
+
list-style: none;
|
|
14
|
+
margin: -${theme.$.length.pagination.margin.y} -${theme.$.length.pagination.margin.x};
|
|
15
|
+
`);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IntrinsicStyledProps } from '@smart-react-components/core/element-props/intrinsic-styled-props';
|
|
2
|
+
import { JSXElementProps, PaletteProp, ShapeProp } from '@smart-react-components/core/types';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
export interface Props extends IntrinsicStyledProps {
|
|
5
|
+
children: JSX.Element[];
|
|
6
|
+
elementProps?: JSXElementProps;
|
|
7
|
+
hasWaveEffect?: boolean;
|
|
8
|
+
isFixedSize?: boolean;
|
|
9
|
+
isOutline?: boolean;
|
|
10
|
+
isSoft?: boolean;
|
|
11
|
+
palette?: PaletteProp;
|
|
12
|
+
shape?: ShapeProp;
|
|
13
|
+
waveEffectPalette?: PaletteProp;
|
|
14
|
+
}
|
|
15
|
+
declare const PaginationList: React.FC<Props>;
|
|
16
|
+
export default PaginationList;
|
|
@@ -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 element_props_1 = __importDefault(require("@smart-react-components/core/element-props"));
|
|
7
|
+
const intrinsic_styled_props_1 = __importDefault(require("@smart-react-components/core/element-props/intrinsic-styled-props"));
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const PaginationListElement_1 = __importDefault(require("./PaginationListElement"));
|
|
10
|
+
const PaginationList = props => (react_1.default.createElement(PaginationListElement_1.default, Object.assign({}, (0, element_props_1.default)(props, [intrinsic_styled_props_1.default]), props.elementProps), props.children.map((item, idx) => {
|
|
11
|
+
var _a;
|
|
12
|
+
return react_1.default.cloneElement(item, {
|
|
13
|
+
key: (_a = item.key) !== null && _a !== void 0 ? _a : idx,
|
|
14
|
+
hasWaveEffect: props.hasWaveEffect,
|
|
15
|
+
isFixedSize: props.isFixedSize,
|
|
16
|
+
isOutline: props.isOutline,
|
|
17
|
+
isSoft: props.isSoft,
|
|
18
|
+
palette: props.palette,
|
|
19
|
+
shape: props.shape,
|
|
20
|
+
waveEffectPalette: props.waveEffectPalette,
|
|
21
|
+
});
|
|
22
|
+
})));
|
|
23
|
+
PaginationList.defaultProps = {
|
|
24
|
+
hasWaveEffect: true,
|
|
25
|
+
palette: 'primary',
|
|
26
|
+
shape: 'rectangle',
|
|
27
|
+
waveEffectPalette: 'light',
|
|
28
|
+
};
|
|
29
|
+
exports.default = PaginationList;
|
|
@@ -0,0 +1,7 @@
|
|
|
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 ArrowRight_1 = __importDefault(require("../../icons/ArrowRight"));
|
|
7
|
+
exports.default = ArrowRight_1.default;
|
|
@@ -0,0 +1,7 @@
|
|
|
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 ArrowLeft_1 = __importDefault(require("../../icons/ArrowLeft"));
|
|
7
|
+
exports.default = ArrowLeft_1.default;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as PaginationItem } from './PaginationItem';
|
|
2
|
+
export { default as PaginationLink } from './PaginationLink';
|
|
3
|
+
export { default as PaginationList } from './PaginationList';
|
|
4
|
+
export { default as PaginationNextIcon } from './PaginationNextIcon';
|
|
5
|
+
export { default as PaginationPrevIcon } from './PaginationPrevIcon';
|
|
@@ -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
|
+
exports.PaginationPrevIcon = exports.PaginationNextIcon = exports.PaginationList = exports.PaginationLink = exports.PaginationItem = void 0;
|
|
7
|
+
var PaginationItem_1 = require("./PaginationItem");
|
|
8
|
+
Object.defineProperty(exports, "PaginationItem", { enumerable: true, get: function () { return __importDefault(PaginationItem_1).default; } });
|
|
9
|
+
var PaginationLink_1 = require("./PaginationLink");
|
|
10
|
+
Object.defineProperty(exports, "PaginationLink", { enumerable: true, get: function () { return __importDefault(PaginationLink_1).default; } });
|
|
11
|
+
var PaginationList_1 = require("./PaginationList");
|
|
12
|
+
Object.defineProperty(exports, "PaginationList", { enumerable: true, get: function () { return __importDefault(PaginationList_1).default; } });
|
|
13
|
+
var PaginationNextIcon_1 = require("./PaginationNextIcon");
|
|
14
|
+
Object.defineProperty(exports, "PaginationNextIcon", { enumerable: true, get: function () { return __importDefault(PaginationNextIcon_1).default; } });
|
|
15
|
+
var PaginationPrevIcon_1 = require("./PaginationPrevIcon");
|
|
16
|
+
Object.defineProperty(exports, "PaginationPrevIcon", { enumerable: true, get: function () { return __importDefault(PaginationPrevIcon_1).default; } });
|