oolib 2.163.3 → 2.164.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/dist/stories/v2/components/Switches.stories.d.ts +106 -0
- package/dist/stories/v2/components/Switches.stories.js +136 -0
- package/dist/stories/v2/components/TagClear.stories.d.ts +28 -0
- package/dist/stories/v2/components/TagClear.stories.js +78 -0
- package/dist/stories/v2/components/TagDisplay.stories.js +1 -1
- package/dist/v2/components/Buttons/derivedComps/ButtonPrimaryCompact.js +1 -1
- package/dist/v2/components/Buttons/derivedComps/ButtonSecondaryCompact.js +1 -1
- package/dist/v2/components/Buttons/derivedComps/ButtonTertiaryCompact.js +1 -1
- package/dist/v2/components/Buttons/index.js +1 -1
- package/dist/v2/components/Buttons/styled.js +1 -1
- package/dist/v2/components/Switches/index.d.ts +19 -0
- package/dist/v2/components/Switches/index.js +134 -0
- package/dist/v2/components/Switches/styled.d.ts +5 -0
- package/dist/v2/components/Switches/styled.js +62 -0
- package/dist/v2/components/Tags/Comps/TagClear/index.d.ts +26 -0
- package/dist/v2/components/Tags/Comps/TagClear/index.js +57 -0
- package/dist/v2/components/Tags/Comps/TagClear/styled.d.ts +15 -0
- package/dist/v2/components/Tags/Comps/TagClear/styled.js +21 -0
- package/dist/v2/components/Tags/index.d.ts +1 -0
- package/dist/v2/components/Tags/index.js +3 -1
- package/dist/v2/themes/colors.d.ts +4 -0
- package/dist/v2/themes/colors.js +5 -11
- package/package.json +1 -1
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
let title: string;
|
|
3
|
+
let argTypes: {};
|
|
4
|
+
}
|
|
5
|
+
export default _default;
|
|
6
|
+
export function SwitchDouble(args: any): React.JSX.Element;
|
|
7
|
+
export namespace SwitchDouble {
|
|
8
|
+
export namespace args {
|
|
9
|
+
let rightOption: string;
|
|
10
|
+
let leftOption: string;
|
|
11
|
+
let disabled: boolean;
|
|
12
|
+
let invert: boolean;
|
|
13
|
+
let saveValueAsString: boolean;
|
|
14
|
+
}
|
|
15
|
+
export namespace argTypes_1 {
|
|
16
|
+
export namespace layoutStyle {
|
|
17
|
+
let options: string[];
|
|
18
|
+
namespace control {
|
|
19
|
+
let type: string;
|
|
20
|
+
}
|
|
21
|
+
let defaultValue: string;
|
|
22
|
+
}
|
|
23
|
+
export namespace rightOption_1 {
|
|
24
|
+
let name: string;
|
|
25
|
+
}
|
|
26
|
+
export { rightOption_1 as rightOption };
|
|
27
|
+
export namespace leftOption_1 {
|
|
28
|
+
let name_1: string;
|
|
29
|
+
export { name_1 as name };
|
|
30
|
+
}
|
|
31
|
+
export { leftOption_1 as leftOption };
|
|
32
|
+
export namespace invert_1 {
|
|
33
|
+
let name_2: string;
|
|
34
|
+
export { name_2 as name };
|
|
35
|
+
}
|
|
36
|
+
export { invert_1 as invert };
|
|
37
|
+
export namespace disabled_1 {
|
|
38
|
+
let name_3: string;
|
|
39
|
+
export { name_3 as name };
|
|
40
|
+
}
|
|
41
|
+
export { disabled_1 as disabled };
|
|
42
|
+
}
|
|
43
|
+
export { argTypes_1 as argTypes };
|
|
44
|
+
export namespace parameters {
|
|
45
|
+
namespace controls {
|
|
46
|
+
let exclude: string[];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
export function SwitchSingle(args: any): React.JSX.Element;
|
|
51
|
+
export namespace SwitchSingle {
|
|
52
|
+
export namespace parameters_1 {
|
|
53
|
+
export namespace controls_1 {
|
|
54
|
+
let exclude_1: string[];
|
|
55
|
+
export { exclude_1 as exclude };
|
|
56
|
+
}
|
|
57
|
+
export { controls_1 as controls };
|
|
58
|
+
}
|
|
59
|
+
export { parameters_1 as parameters };
|
|
60
|
+
export namespace args_1 {
|
|
61
|
+
let rightOption_2: string;
|
|
62
|
+
export { rightOption_2 as rightOption };
|
|
63
|
+
let layoutStyle_1: string;
|
|
64
|
+
export { layoutStyle_1 as layoutStyle };
|
|
65
|
+
let disabled_2: boolean;
|
|
66
|
+
export { disabled_2 as disabled };
|
|
67
|
+
let invert_2: boolean;
|
|
68
|
+
export { invert_2 as invert };
|
|
69
|
+
let saveValueAsString_1: boolean;
|
|
70
|
+
export { saveValueAsString_1 as saveValueAsString };
|
|
71
|
+
}
|
|
72
|
+
export { args_1 as args };
|
|
73
|
+
export namespace argTypes_2 {
|
|
74
|
+
export namespace layoutStyle_2 {
|
|
75
|
+
let name_4: string;
|
|
76
|
+
export { name_4 as name };
|
|
77
|
+
let options_1: string[];
|
|
78
|
+
export { options_1 as options };
|
|
79
|
+
export namespace control_1 {
|
|
80
|
+
let type_1: string;
|
|
81
|
+
export { type_1 as type };
|
|
82
|
+
}
|
|
83
|
+
export { control_1 as control };
|
|
84
|
+
let defaultValue_1: string;
|
|
85
|
+
export { defaultValue_1 as defaultValue };
|
|
86
|
+
}
|
|
87
|
+
export { layoutStyle_2 as layoutStyle };
|
|
88
|
+
export namespace rightOption_3 {
|
|
89
|
+
let name_5: string;
|
|
90
|
+
export { name_5 as name };
|
|
91
|
+
}
|
|
92
|
+
export { rightOption_3 as rightOption };
|
|
93
|
+
export namespace invert_3 {
|
|
94
|
+
let name_6: string;
|
|
95
|
+
export { name_6 as name };
|
|
96
|
+
}
|
|
97
|
+
export { invert_3 as invert };
|
|
98
|
+
export namespace disabled_3 {
|
|
99
|
+
let name_7: string;
|
|
100
|
+
export { name_7 as name };
|
|
101
|
+
}
|
|
102
|
+
export { disabled_3 as disabled };
|
|
103
|
+
}
|
|
104
|
+
export { argTypes_2 as argTypes };
|
|
105
|
+
}
|
|
106
|
+
import React from 'react';
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.SwitchSingle = exports.SwitchDouble = void 0;
|
|
30
|
+
var react_1 = __importStar(require("react"));
|
|
31
|
+
var react_json_view_1 = __importDefault(require("react-json-view"));
|
|
32
|
+
var Switches_1 = require("../../../v2/components/Switches");
|
|
33
|
+
var themes_1 = require("../../../themes");
|
|
34
|
+
exports.default = {
|
|
35
|
+
title: 'Oolib V 2.0/components/Switches',
|
|
36
|
+
argTypes: {
|
|
37
|
+
// shape: {
|
|
38
|
+
// name: "Shape",
|
|
39
|
+
// options: ['circle', 'square'],
|
|
40
|
+
// control: { type: 'inline-radio' },
|
|
41
|
+
// defaultValue: 'circle'
|
|
42
|
+
// },
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
var showJSON = function (display, data) {
|
|
46
|
+
return react_1.default.createElement(react_json_view_1.default
|
|
47
|
+
// theme="monokai"
|
|
48
|
+
, {
|
|
49
|
+
// theme="monokai"
|
|
50
|
+
name: display, src: data, displayDataTypes: false, enableClipboard: false, quotesOnKeys: false });
|
|
51
|
+
};
|
|
52
|
+
var SwitchDouble = function (args) {
|
|
53
|
+
var options = [
|
|
54
|
+
{ display: args.leftOption, value: 1 },
|
|
55
|
+
{ display: args.rightOption, value: 2 }
|
|
56
|
+
];
|
|
57
|
+
var _a = (0, react_1.useState)(args.saveValueAsString ? options[0].value : options[0]), value = _a[0], setValue = _a[1];
|
|
58
|
+
(0, react_1.useEffect)(function () {
|
|
59
|
+
setValue(args.saveValueAsString ? options[0].value : options[0]);
|
|
60
|
+
}, [args.saveValueAsString]);
|
|
61
|
+
return (react_1.default.createElement("div", { style: { background: args.invert ? '#383838' : '', padding: '4rem 4rem' } },
|
|
62
|
+
react_1.default.createElement(Switches_1.SwitchDouble, { invert: args.invert, shape: args.shape, saveValueAsString: args.saveValueAsString, disabled: args.disabled, options: options, value: value, onChange: function (id, newVal) { return setValue(newVal); } }),
|
|
63
|
+
react_1.default.createElement("div", { style: { padding: '2rem', position: 'fixed', top: 0, right: 0 } },
|
|
64
|
+
showJSON('VALUE', { value: value }),
|
|
65
|
+
showJSON('OPTIONS', options))));
|
|
66
|
+
};
|
|
67
|
+
exports.SwitchDouble = SwitchDouble;
|
|
68
|
+
exports.SwitchDouble.args = {
|
|
69
|
+
rightOption: 'right option',
|
|
70
|
+
leftOption: 'left Option',
|
|
71
|
+
disabled: false,
|
|
72
|
+
invert: false,
|
|
73
|
+
saveValueAsString: true,
|
|
74
|
+
};
|
|
75
|
+
exports.SwitchDouble.argTypes = {
|
|
76
|
+
layoutStyle: {
|
|
77
|
+
options: ['style1', 'style2'],
|
|
78
|
+
control: { type: 'inline-radio' },
|
|
79
|
+
defaultValue: 'style1'
|
|
80
|
+
},
|
|
81
|
+
rightOption: {
|
|
82
|
+
name: 'Right option'
|
|
83
|
+
},
|
|
84
|
+
leftOption: {
|
|
85
|
+
name: "Left Option"
|
|
86
|
+
},
|
|
87
|
+
invert: {
|
|
88
|
+
name: "Invert"
|
|
89
|
+
},
|
|
90
|
+
disabled: {
|
|
91
|
+
name: "Disabled"
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
exports.SwitchDouble.parameters = {
|
|
95
|
+
controls: { exclude: ['layoutStyle'] }
|
|
96
|
+
};
|
|
97
|
+
var SwitchSingle = function (args) {
|
|
98
|
+
var option = { display: args.rightOption, value: 1 };
|
|
99
|
+
var _a = (0, react_1.useState)(args.saveValueAsString ? option.value : option), value = _a[0], setValue = _a[1];
|
|
100
|
+
(0, react_1.useEffect)(function () {
|
|
101
|
+
setValue(args.saveValueAsString ? option.value : option);
|
|
102
|
+
}, [args.saveValueAsString]);
|
|
103
|
+
return (react_1.default.createElement("div", { style: { background: args.invert ? '#383838' : '', padding: '4rem 4rem' } },
|
|
104
|
+
react_1.default.createElement(Switches_1.SwitchSingle, { invert: args.invert, shape: args.shape, layoutStyle: args.layoutStyle, saveValueAsString: args.saveValueAsString, disabled: args.disabled, option: option, value: value, onChange: function (id, newVal) { return setValue(newVal); } }),
|
|
105
|
+
react_1.default.createElement("div", { style: { padding: '2rem', paddingTop: '3rem', marginTop: '3rem', borderTop: "1px solid ".concat(themes_1.colors.greyColor15) } },
|
|
106
|
+
showJSON('VALUE', { value: value }),
|
|
107
|
+
showJSON('OPTIONS', option))));
|
|
108
|
+
};
|
|
109
|
+
exports.SwitchSingle = SwitchSingle;
|
|
110
|
+
exports.SwitchSingle.parameters = {
|
|
111
|
+
controls: { exclude: ['leftOption'] }
|
|
112
|
+
};
|
|
113
|
+
exports.SwitchSingle.args = {
|
|
114
|
+
rightOption: 'right option',
|
|
115
|
+
layoutStyle: 'style1',
|
|
116
|
+
disabled: false,
|
|
117
|
+
invert: false,
|
|
118
|
+
saveValueAsString: true,
|
|
119
|
+
};
|
|
120
|
+
exports.SwitchSingle.argTypes = {
|
|
121
|
+
layoutStyle: {
|
|
122
|
+
name: "Layout Style",
|
|
123
|
+
options: ['style1', 'style2'],
|
|
124
|
+
control: { type: 'select' },
|
|
125
|
+
defaultValue: 'style1'
|
|
126
|
+
},
|
|
127
|
+
rightOption: {
|
|
128
|
+
name: 'Text'
|
|
129
|
+
},
|
|
130
|
+
invert: {
|
|
131
|
+
name: "Invert"
|
|
132
|
+
},
|
|
133
|
+
disabled: {
|
|
134
|
+
name: "Disabled"
|
|
135
|
+
}
|
|
136
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
let title: string;
|
|
3
|
+
namespace argTypes {
|
|
4
|
+
namespace display {
|
|
5
|
+
let name: string;
|
|
6
|
+
}
|
|
7
|
+
namespace value {
|
|
8
|
+
let name_1: string;
|
|
9
|
+
export { name_1 as name };
|
|
10
|
+
}
|
|
11
|
+
namespace id {
|
|
12
|
+
let name_2: string;
|
|
13
|
+
export { name_2 as name };
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
namespace args {
|
|
17
|
+
let display_1: string;
|
|
18
|
+
export { display_1 as display };
|
|
19
|
+
let value_1: string;
|
|
20
|
+
export { value_1 as value };
|
|
21
|
+
let id_1: string;
|
|
22
|
+
export { id_1 as id };
|
|
23
|
+
export let textColor: string;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export default _default;
|
|
27
|
+
export function Playground(args: any): import("react").JSX.Element;
|
|
28
|
+
export function Tag_Clear(args: any): import("react").JSX.Element;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.Tag_Clear = exports.Playground = void 0;
|
|
15
|
+
var Tags_1 = require("../../../v2/components/Tags");
|
|
16
|
+
var Typo2_1 = require("../../../v2/components/Typo2");
|
|
17
|
+
var themes_1 = require("../../../v2/themes");
|
|
18
|
+
exports.default = {
|
|
19
|
+
title: "Oolib V 2.0/Components/Tags/Tag Clear",
|
|
20
|
+
argTypes: {
|
|
21
|
+
display: {
|
|
22
|
+
name: "Text",
|
|
23
|
+
},
|
|
24
|
+
// size: {
|
|
25
|
+
// name: "Size",
|
|
26
|
+
// options: ["ExtraSmall", "Small", "Medium"],
|
|
27
|
+
// mapping: {
|
|
28
|
+
// ExtraSmall: "XS",
|
|
29
|
+
// Small: "S",
|
|
30
|
+
// Medium: "M",
|
|
31
|
+
// },
|
|
32
|
+
// control: { type: "inline-radio" },
|
|
33
|
+
// },
|
|
34
|
+
// tagColor: {
|
|
35
|
+
// name: "Tag Color",
|
|
36
|
+
// options: availableColors,
|
|
37
|
+
// control: { type: "select" },
|
|
38
|
+
// },
|
|
39
|
+
// textColor: {
|
|
40
|
+
// name: "Text Color",
|
|
41
|
+
// options: availableTextColors,
|
|
42
|
+
// control: { type: "select" },
|
|
43
|
+
// },
|
|
44
|
+
value: {
|
|
45
|
+
name: "Value"
|
|
46
|
+
},
|
|
47
|
+
id: {
|
|
48
|
+
name: "Id"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
args: {
|
|
52
|
+
display: "Tag Display",
|
|
53
|
+
// size: "ExtraSmall",
|
|
54
|
+
value: "text",
|
|
55
|
+
id: "tags",
|
|
56
|
+
// tagColor: "",
|
|
57
|
+
textColor: "",
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
var GenTag = function (_a) {
|
|
61
|
+
var args = _a.args, Comp = _a.Comp, variant = _a.variant;
|
|
62
|
+
args[args["size"]] = true;
|
|
63
|
+
args.tagColor = themes_1.colors[args.tagColor];
|
|
64
|
+
args.textColor = themes_1.colors[args.textColor];
|
|
65
|
+
return (React.createElement("div", { style: { margin: "2rem 10rem" } },
|
|
66
|
+
React.createElement(Comp, __assign({}, args, { variant: variant }))));
|
|
67
|
+
};
|
|
68
|
+
var Playground = function (args) {
|
|
69
|
+
return (React.createElement("div", { style: { display: 'flex', flexDirection: "column", gap: '3rem', margin: '2rem 10rem' } },
|
|
70
|
+
React.createElement("div", null,
|
|
71
|
+
React.createElement(Typo2_1.UI_BODY_SEMIBOLD_SM, null, "Tag Clear"),
|
|
72
|
+
React.createElement(GenTag, { args: args, Comp: Tags_1.TagClear }))));
|
|
73
|
+
};
|
|
74
|
+
exports.Playground = Playground;
|
|
75
|
+
var Tag_Clear = function (args) {
|
|
76
|
+
return React.createElement(GenTag, { args: args, Comp: Tags_1.TagClear });
|
|
77
|
+
};
|
|
78
|
+
exports.Tag_Clear = Tag_Clear;
|
|
@@ -27,7 +27,7 @@ var themes_1 = require("../../../v2/themes");
|
|
|
27
27
|
var availableColors = __spreadArray([], Object.keys(themes_1.colors).sort(), true);
|
|
28
28
|
var availableTextColors = __spreadArray([], Object.keys(themes_1.colors).sort(), true);
|
|
29
29
|
exports.default = {
|
|
30
|
-
title: "Oolib V 2.0/Components/Tag Display",
|
|
30
|
+
title: "Oolib V 2.0/Components/Tags/Tag Display",
|
|
31
31
|
argTypes: {
|
|
32
32
|
display: {
|
|
33
33
|
name: "Text",
|
|
@@ -41,6 +41,6 @@ var generateCompactButtonStyles = function (responsive, icon) {
|
|
|
41
41
|
exports.generateCompactButtonStyles = generateCompactButtonStyles;
|
|
42
42
|
var ButtonPrimaryCompact = function (props) {
|
|
43
43
|
var responsive = (0, mixins_1.useResponsiveMobileStyles)(props.responsive);
|
|
44
|
-
return (react_1.default.createElement(__1.ButtonPrimary, __assign({}, props, { typo: "
|
|
44
|
+
return (react_1.default.createElement(__1.ButtonPrimary, __assign({}, props, { typo: "UI_CAPTION_SEMIBOLD_DF", iconSize: responsive ? 16 : 14, style: (0, exports.generateCompactButtonStyles)(responsive, props.icon) })));
|
|
45
45
|
};
|
|
46
46
|
exports.ButtonPrimaryCompact = ButtonPrimaryCompact;
|
|
@@ -21,6 +21,6 @@ var ButtonPrimaryCompact_1 = require("./ButtonPrimaryCompact");
|
|
|
21
21
|
var mixins_1 = require("../../../../themes/mixins");
|
|
22
22
|
var ButtonSecondaryCompact = function (props) {
|
|
23
23
|
var responsive = (0, mixins_1.useResponsiveMobileStyles)(props.responsive);
|
|
24
|
-
return (react_1.default.createElement(__1.ButtonSecondary, __assign({}, props, { typo: "
|
|
24
|
+
return (react_1.default.createElement(__1.ButtonSecondary, __assign({}, props, { typo: "UI_CAPTION_SEMIBOLD_DF", iconSize: responsive ? 16 : 14, style: (0, ButtonPrimaryCompact_1.generateCompactButtonStyles)(responsive, props.icon) })));
|
|
25
25
|
};
|
|
26
26
|
exports.ButtonSecondaryCompact = ButtonSecondaryCompact;
|
|
@@ -21,6 +21,6 @@ var ButtonPrimaryCompact_1 = require("./ButtonPrimaryCompact");
|
|
|
21
21
|
var mixins_1 = require("../../../../themes/mixins");
|
|
22
22
|
var ButtonTertiaryCompact = function (props) {
|
|
23
23
|
var responsive = (0, mixins_1.useResponsiveMobileStyles)(props.responsive);
|
|
24
|
-
return (react_1.default.createElement(__1.ButtonTertiary, __assign({}, props, { typo: "
|
|
24
|
+
return (react_1.default.createElement(__1.ButtonTertiary, __assign({}, props, { typo: "UI_CAPTION_SEMIBOLD_DF", iconSize: responsive ? 16 : 14, style: (0, ButtonPrimaryCompact_1.generateCompactButtonStyles)(responsive, props.icon) })));
|
|
25
25
|
};
|
|
26
26
|
exports.ButtonTertiaryCompact = ButtonTertiaryCompact;
|
|
@@ -30,7 +30,7 @@ var DisplayIcon = function (_a) {
|
|
|
30
30
|
};
|
|
31
31
|
var Typos = {
|
|
32
32
|
UI_BODY_SEMIBOLD_SM_DF: Typo2_1.UI_BODY_SEMIBOLD_SM_DF,
|
|
33
|
-
|
|
33
|
+
UI_CAPTION_SEMIBOLD_DF: Typo2_1.UI_CAPTION_SEMIBOLD_DF
|
|
34
34
|
};
|
|
35
35
|
var ButtonStyledWrapper = function (_a) {
|
|
36
36
|
var props = _a.props, variant = _a.variant;
|
|
@@ -80,7 +80,7 @@ var variants = {
|
|
|
80
80
|
var forceHover = _a.forceHover;
|
|
81
81
|
return forceHover && createHoverEffect();
|
|
82
82
|
}, createHoverEffect()),
|
|
83
|
-
tertiary: (0, styled_components_1.css)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n background-color: transparent;\n color: ", ";\n border: 1px solid ", ";\n
|
|
83
|
+
tertiary: (0, styled_components_1.css)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n background-color: transparent;\n color: ", ";\n /* border: 1px solid ", "; */\n box-sizing: border-box;\n outline: 1px solid ", ";\n ", "\n\n ", "\n\n @media (hover: hover) {\n &:hover {\n ", "\n }\n }\n "], ["\n background-color: transparent;\n color: ", ";\n /* border: 1px solid ", "; */\n box-sizing: border-box;\n outline: 1px solid ", ";\n ", "\n\n ", "\n\n @media (hover: hover) {\n &:hover {\n ", "\n }\n }\n "])), colors_1.colors.grey80, colors_1.colors.grey10, colors_1.colors.grey10, function (_a) {
|
|
84
84
|
var disabled = _a.disabled;
|
|
85
85
|
return disabled && (0, styled_components_1.css)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n color: ", ";\n pointer-events: none;\n "], ["\n color: ", ";\n pointer-events: none;\n "])), colors_1.colors.grey80);
|
|
86
86
|
}, function (_a) {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function SwitchDouble({ id, value: valueProp, options, onChange, saveValueAsString, disabled, }: {
|
|
2
|
+
id: any;
|
|
3
|
+
value: any;
|
|
4
|
+
options: any;
|
|
5
|
+
onChange: any;
|
|
6
|
+
saveValueAsString: any;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}, ...args: any[]): React.JSX.Element;
|
|
9
|
+
export function SwitchSingle({ id, value, option, onChange, disabled, saveValueAsString, layoutStyle, infoTooltip, }: {
|
|
10
|
+
id: any;
|
|
11
|
+
value: any;
|
|
12
|
+
option: any;
|
|
13
|
+
onChange: any;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
saveValueAsString: any;
|
|
16
|
+
layoutStyle?: string;
|
|
17
|
+
infoTooltip: any;
|
|
18
|
+
}, ...args: any[]): React.JSX.Element;
|
|
19
|
+
import React from "react";
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.SwitchSingle = exports.SwitchDouble = void 0;
|
|
38
|
+
var react_1 = __importStar(require("react"));
|
|
39
|
+
var _EXPORTS_1 = require("../../../utils/_EXPORTS");
|
|
40
|
+
var BlockLabel_1 = require("../BlockLabel");
|
|
41
|
+
var styled_1 = require("./styled");
|
|
42
|
+
var Tooltip_1 = require("../../../components/Tooltip");
|
|
43
|
+
var utilsOolib_1 = require("../../../utilsOolib");
|
|
44
|
+
function SwitchDouble(_a) {
|
|
45
|
+
var id = _a.id, valueProp = _a.value, options = _a.options, onChange = _a.onChange, saveValueAsString = _a.saveValueAsString, _b = _a.disabled, disabled = _b === void 0 ? false : _b;
|
|
46
|
+
var value = saveValueAsString
|
|
47
|
+
? options.find(function (d) { return d.value === valueProp; })
|
|
48
|
+
: valueProp;
|
|
49
|
+
var handleClick = function () {
|
|
50
|
+
var otherOption = options.find(function (op) { return op.value !== value.value; });
|
|
51
|
+
!disabled &&
|
|
52
|
+
onChange &&
|
|
53
|
+
onChange(id, saveValueAsString ? otherOption.value : otherOption);
|
|
54
|
+
};
|
|
55
|
+
var props = arguments[0];
|
|
56
|
+
var isLeftOptionActive = value === undefined || options[0].value === (value === null || value === void 0 ? void 0 : value.value);
|
|
57
|
+
if (value === undefined)
|
|
58
|
+
throw new Error("You need to pass a value prop to make SwitchDouble work");
|
|
59
|
+
return (react_1.default.createElement("div", null,
|
|
60
|
+
react_1.default.createElement(BlockLabel_1.BlockLabel, __assign({}, (0, _EXPORTS_1.getBlockLabelProps)(props))),
|
|
61
|
+
react_1.default.createElement(styled_1.StyledSwitchWrapperStyle1, null,
|
|
62
|
+
react_1.default.createElement(styled_1.STYLED_UI_BODY_SM, { lineHeight: 1,
|
|
63
|
+
semibold: isLeftOptionActive ? true : false }, options[0].display),
|
|
64
|
+
react_1.default.createElement(styled_1.StyledButtonSlider, { disabled: disabled, onClick: handleClick },
|
|
65
|
+
react_1.default.createElement(styled_1.StyledSwitch, { className: "StyledSwitch" //read in styled.js why we are using an okf-anti-pattern
|
|
66
|
+
, disabled: disabled, direction: isLeftOptionActive ? "left" : "right" })),
|
|
67
|
+
react_1.default.createElement(styled_1.STYLED_UI_BODY_SM, { semibold: isLeftOptionActive ? false : true,
|
|
68
|
+
lineHeight: 1 }, options[1].display))));
|
|
69
|
+
}
|
|
70
|
+
exports.SwitchDouble = SwitchDouble;
|
|
71
|
+
function SwitchSingle(_a) {
|
|
72
|
+
var id = _a.id, value = _a.value, option = _a.option, onChange = _a.onChange, _b = _a.disabled, disabled = _b === void 0 ? false : _b, saveValueAsString = _a.saveValueAsString, _c = _a.layoutStyle, layoutStyle = _c === void 0 ? "style1" : _c, infoTooltip = _a.infoTooltip;
|
|
73
|
+
var props = arguments[0];
|
|
74
|
+
var localize = (0, utilsOolib_1.useLocale)();
|
|
75
|
+
/**
|
|
76
|
+
* very important that we check this way,
|
|
77
|
+
* as opposed to checking as 'value === undefined'
|
|
78
|
+
*
|
|
79
|
+
* because in some cases in the TCI, the initial value
|
|
80
|
+
* is not equal to undefined. it is equal to 'false' or something else
|
|
81
|
+
*/
|
|
82
|
+
var isInactive = saveValueAsString
|
|
83
|
+
? value !== option.value
|
|
84
|
+
: (value === null || value === void 0 ? void 0 : value.value) !== option.value;
|
|
85
|
+
var _d = (0, react_1.useState)(isInactive ? "left" : "right"), currentDirection = _d[0], setCurrentDirection = _d[1];
|
|
86
|
+
(0, react_1.useEffect)(function () {
|
|
87
|
+
if (!disabled) {
|
|
88
|
+
setCurrentDirection(isInactive ? "left" : "right");
|
|
89
|
+
}
|
|
90
|
+
}, [isInactive, disabled]);
|
|
91
|
+
var handleClick = function (v) {
|
|
92
|
+
!disabled &&
|
|
93
|
+
onChange &&
|
|
94
|
+
onChange(id, isInactive ? (saveValueAsString ? option.value : option) : undefined);
|
|
95
|
+
};
|
|
96
|
+
var genSwitch = function () {
|
|
97
|
+
console.log("Rendering genSwitch:", {
|
|
98
|
+
currentDirection: currentDirection,
|
|
99
|
+
isInactive: isInactive,
|
|
100
|
+
disabled: disabled,
|
|
101
|
+
});
|
|
102
|
+
return (react_1.default.createElement(styled_1.StyledButtonSlider, { inactive: isInactive, disabled: disabled, onClick: handleClick },
|
|
103
|
+
react_1.default.createElement(styled_1.StyledSwitch, { className: "StyledSwitch" //read in styled.js why we are using an okf-anti-pattern
|
|
104
|
+
, direction: currentDirection, inactive: isInactive, disabled: disabled })));
|
|
105
|
+
};
|
|
106
|
+
var injectOptionalLabelIntoDisplayText = function (_a) {
|
|
107
|
+
var label = _a.label, display = _a.display, isRequired = _a.isRequired;
|
|
108
|
+
if (!!label)
|
|
109
|
+
return display; //if label exists, we do nothing, cuz optional label in that case, would be shown next to the label
|
|
110
|
+
//else
|
|
111
|
+
if (isRequired === false)
|
|
112
|
+
return display + " (".concat(localize("optional"), ")");
|
|
113
|
+
//else
|
|
114
|
+
return display; //cuz ofcourse its not optional, so no need to show optional label
|
|
115
|
+
};
|
|
116
|
+
var genDisplayText = function () { return (react_1.default.createElement(styled_1.STYLED_UI_BODY_SM, { lineHeight: 1, semibold: isInactive ? false : true, disabled: disabled }, injectOptionalLabelIntoDisplayText({
|
|
117
|
+
display: option.display,
|
|
118
|
+
label: props.label,
|
|
119
|
+
isRequired: props.isRequired
|
|
120
|
+
}))); };
|
|
121
|
+
var genSwitchDisplay = function () {
|
|
122
|
+
return infoTooltip ? (react_1.default.createElement("div", { style: { display: "flex", gap: ".5rem", alignItems: "center" } },
|
|
123
|
+
genDisplayText(),
|
|
124
|
+
react_1.default.createElement(Tooltip_1.Tooltip, __assign({ presetTarget: "infoIcon" }, infoTooltip)))) : (genDisplayText());
|
|
125
|
+
};
|
|
126
|
+
return (react_1.default.createElement("div", null,
|
|
127
|
+
react_1.default.createElement(BlockLabel_1.BlockLabel, __assign({ hideOptionalLabel: !!props.label === false }, (0, _EXPORTS_1.getBlockLabelProps)(props))),
|
|
128
|
+
layoutStyle === "style1" ? (react_1.default.createElement(styled_1.StyledSwitchWrapperStyle1, null,
|
|
129
|
+
genSwitch(),
|
|
130
|
+
genSwitchDisplay())) : (layoutStyle === "style2" && (react_1.default.createElement(styled_1.StyledSwitchWrapperStyle2, null,
|
|
131
|
+
genSwitchDisplay(),
|
|
132
|
+
genSwitch())))));
|
|
133
|
+
}
|
|
134
|
+
exports.SwitchSingle = SwitchSingle;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export const StyledSwitchWrapperStyle1: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
|
+
export const StyledSwitchWrapperStyle2: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
|
+
export const StyledButtonSlider: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
|
+
export const StyledSwitch: import("styled-components").StyledComponent<"button", any, {}, never>;
|
|
5
|
+
export const STYLED_UI_BODY_SM: import("styled-components").StyledComponent<import("react").FunctionComponent<import("../Typo2").TypoCompProps>, any, {}, never>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
+
return cooked;
|
|
5
|
+
};
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.STYLED_UI_BODY_SM = exports.StyledSwitch = exports.StyledButtonSlider = exports.StyledSwitchWrapperStyle2 = exports.StyledSwitchWrapperStyle1 = void 0;
|
|
11
|
+
var styled_components_1 = __importDefault(require("styled-components"));
|
|
12
|
+
var themes_1 = require("../../themes");
|
|
13
|
+
var mixins_1 = require("../../../themes/mixins");
|
|
14
|
+
var utils_1 = require("../../themes/utils");
|
|
15
|
+
var Typo2_1 = require("../Typo2");
|
|
16
|
+
var white = themes_1.colors.white, grey5 = themes_1.colors.grey5, grey10 = themes_1.colors.grey10, grey20 = themes_1.colors.grey20, grey40 = themes_1.colors.grey40, grey70 = themes_1.colors.grey70, grey80 = themes_1.colors.grey80;
|
|
17
|
+
exports.StyledSwitchWrapperStyle1 = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n width: auto; \n height: 18px; \n left: 22px;\n top: 20px;\n display: flex;\n align-items: center;\n gap: 6px;\n border-radius: 37px;\n transition: all 0.5s ease;\n \n"], ["\n position: relative;\n width: auto; \n height: 18px; \n left: 22px;\n top: 20px;\n display: flex;\n align-items: center;\n gap: 6px;\n border-radius: 37px;\n transition: all 0.5s ease;\n \n"])));
|
|
18
|
+
exports.StyledSwitchWrapperStyle2 = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: relative;\n width: auto; \n height: 18px; \n left: 22px;\n top: 20px;\n display: flex;\n align-items: center;\n gap: 6px;\n border-radius: 37px;\n transition: all 0.5s ease;\n \n"], ["\n position: relative;\n width: auto; \n height: 18px; \n left: 22px;\n top: 20px;\n display: flex;\n align-items: center;\n gap: 6px;\n border-radius: 37px;\n transition: all 0.5s ease;\n \n"])));
|
|
19
|
+
exports.StyledButtonSlider = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n width: 28px;\n height: 18px;\n user-select: none;\n position: relative;\n border-radius: 1rem;\n cursor: ", ";\n background-color: ", ";\n \n &:hover {\n background-color: ", ";\n\n & > .StyledSwitch {\n border-color: ", ";\n }\n }\n\n ", "\n"], ["\n width: 28px;\n height: 18px;\n user-select: none;\n position: relative;\n border-radius: 1rem;\n cursor: ", ";\n background-color: ", ";\n \n &:hover {\n background-color: ", ";\n\n & > .StyledSwitch {\n border-color: ", ";\n }\n }\n\n ", "\n"])), function (_a) {
|
|
20
|
+
var disabled = _a.disabled;
|
|
21
|
+
return (disabled ? 'not-allowed' : 'pointer');
|
|
22
|
+
}, function (_a) {
|
|
23
|
+
var disabled = _a.disabled, inactive = _a.inactive, colors = _a.theme.colors;
|
|
24
|
+
if (disabled)
|
|
25
|
+
return grey5;
|
|
26
|
+
return inactive ? grey10 : (0, utils_1.getSecondaryContainer)(colors);
|
|
27
|
+
}, function (_a) {
|
|
28
|
+
var colors = _a.theme.colors, inactive = _a.inactive, disabled = _a.disabled;
|
|
29
|
+
return !disabled && (inactive ? grey40 : (0, utils_1.getOnPrimary)(colors));
|
|
30
|
+
}, function (_a) {
|
|
31
|
+
var colors = _a.theme.colors, inactive = _a.inactive, disabled = _a.disabled;
|
|
32
|
+
return !disabled && (inactive ? grey40 : (0, utils_1.getOnPrimary)(colors));
|
|
33
|
+
}, (0, mixins_1.transition)('background-color'));
|
|
34
|
+
exports.StyledSwitch = styled_components_1.default.button(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n width: 12px; /* Updated based on Figma */\n height: 12px; /* Updated based on Figma */\n background-color: ", "; \n outline: none;\n ", "; \n border-radius: 50%; \n cursor: ", "; \n border: 1px solid; /* Updated based on Figma */\n border-color: ", ";\n position: absolute;\n top: calc(50% - 6px); /* Updated for vertical centering */\n left: ", "; \n box-shadow: ", ";\n transition: all 0.3s ease;\n\n /**\n this is the styled comps way of dealing with child hover.\n But it is a buggy functionality. Probably an issue at\n the styled-components package level. Should report on their github\n\n Instead we use the oldschool class approach for child hover (line 40)\n */\n /* ", ":hover & {\n border-color: ", "; \n } */\n"], ["\n width: 12px; /* Updated based on Figma */\n height: 12px; /* Updated based on Figma */\n background-color: ", "; \n outline: none;\n ", "; \n border-radius: 50%; \n cursor: ", "; \n border: 1px solid; /* Updated based on Figma */\n border-color: ", ";\n position: absolute;\n top: calc(50% - 6px); /* Updated for vertical centering */\n left: ", "; \n box-shadow: ", ";\n transition: all 0.3s ease;\n\n /**\n this is the styled comps way of dealing with child hover.\n But it is a buggy functionality. Probably an issue at\n the styled-components package level. Should report on their github\n\n Instead we use the oldschool class approach for child hover (line 40)\n */\n /* ", ":hover & {\n border-color: ", "; \n } */\n"])), function (_a) {
|
|
35
|
+
var disabled = _a.disabled;
|
|
36
|
+
return (disabled ? "" : white);
|
|
37
|
+
}, (0, mixins_1.transition)('border-color', 'left 0.2s'), function (_a) {
|
|
38
|
+
var disabled = _a.disabled;
|
|
39
|
+
return disabled ? 'not-allowed' : 'pointer';
|
|
40
|
+
}, function (_a) {
|
|
41
|
+
var colors = _a.theme.colors, inactive = _a.inactive, disabled = _a.disabled;
|
|
42
|
+
disabled ? grey20 : (0, utils_1.getSecondaryContainer)(colors);
|
|
43
|
+
if (inactive && !disabled)
|
|
44
|
+
return grey70;
|
|
45
|
+
}, function (_a) {
|
|
46
|
+
var direction = _a.direction;
|
|
47
|
+
return direction === 'left' ? '3px' : 'calc(100% - 15px)';
|
|
48
|
+
}, function (_a) {
|
|
49
|
+
var disabled = _a.disabled;
|
|
50
|
+
return (disabled ? "" : "0px 4px 6px rgba(0, 0, 0, 0.25)");
|
|
51
|
+
}, exports.StyledButtonSlider, function (_a) {
|
|
52
|
+
var colors = _a.theme.colors, inactive = _a.inactive, disabled = _a.disabled;
|
|
53
|
+
return !disabled && (inactive ? grey40 : (0, utils_1.getOnPrimary)(colors));
|
|
54
|
+
});
|
|
55
|
+
exports.STYLED_UI_BODY_SM = (0, styled_components_1.default)(Typo2_1.UI_BODY_SM)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n color: ", ";\n line-height: ", ";\n ", ";\n"], ["\n color: ", ";\n line-height: ", ";\n ", ";\n"])), function (_a) {
|
|
56
|
+
var disabled = _a.disabled;
|
|
57
|
+
return (disabled ? grey40 : grey80);
|
|
58
|
+
}, function (_a) {
|
|
59
|
+
var lineHeight = _a.lineHeight;
|
|
60
|
+
return lineHeight;
|
|
61
|
+
}, (0, mixins_1.transition)('color'));
|
|
62
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { FunctionComponent } from "react";
|
|
2
|
+
export interface TagClearProps {
|
|
3
|
+
id: string;
|
|
4
|
+
display: string;
|
|
5
|
+
M?: boolean;
|
|
6
|
+
XS?: boolean;
|
|
7
|
+
invert?: boolean;
|
|
8
|
+
onClick?: () => void;
|
|
9
|
+
variant?: 'primary' | 'ghost';
|
|
10
|
+
grey?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @component Renders a TagClear component with customizable text, style and onClick handler.
|
|
14
|
+
*
|
|
15
|
+
* - The props object containing the following properties:
|
|
16
|
+
* @prop {string} id: The id of the component.
|
|
17
|
+
* @prop {string} display: The text to be displayed inside the TagClear component.
|
|
18
|
+
* @prop {boolean} [M] : A boolean indicating whether the component should render at the large size. Defaults to false.
|
|
19
|
+
* @prop {boolean} [XS] : A boolean indicating whether the component should render at the extra small size. Defaults to false.
|
|
20
|
+
* @prop {boolean} [invert] : A boolean indicating whether to invert the colors of the component. Defaults to false.
|
|
21
|
+
* @prop {() => void} [onClick] : A function to be called when the component is clicked. Defaults to an empty function.
|
|
22
|
+
* @prop {('primary' | 'ghost')} [variant] : A string indicating the variant of the component. Defaults to "primary".
|
|
23
|
+
* @prop {boolean} [grey] : A boolean indicating whether to render the component in the grey variant. Defaults to false.
|
|
24
|
+
* @return {ReactElement} The rendered TagClear component.
|
|
25
|
+
*/
|
|
26
|
+
export declare const TagClear: FunctionComponent<TagClearProps>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.TagClear = void 0;
|
|
27
|
+
var react_1 = __importStar(require("react"));
|
|
28
|
+
var icons_1 = require("../../../../../icons");
|
|
29
|
+
var getTypoComp_1 = require("../../utils/getTypoComp");
|
|
30
|
+
var styled_1 = require("./styled");
|
|
31
|
+
/**
|
|
32
|
+
* @component Renders a TagClear component with customizable text, style and onClick handler.
|
|
33
|
+
*
|
|
34
|
+
* - The props object containing the following properties:
|
|
35
|
+
* @prop {string} id: The id of the component.
|
|
36
|
+
* @prop {string} display: The text to be displayed inside the TagClear component.
|
|
37
|
+
* @prop {boolean} [M] : A boolean indicating whether the component should render at the large size. Defaults to false.
|
|
38
|
+
* @prop {boolean} [XS] : A boolean indicating whether the component should render at the extra small size. Defaults to false.
|
|
39
|
+
* @prop {boolean} [invert] : A boolean indicating whether to invert the colors of the component. Defaults to false.
|
|
40
|
+
* @prop {() => void} [onClick] : A function to be called when the component is clicked. Defaults to an empty function.
|
|
41
|
+
* @prop {('primary' | 'ghost')} [variant] : A string indicating the variant of the component. Defaults to "primary".
|
|
42
|
+
* @prop {boolean} [grey] : A boolean indicating whether to render the component in the grey variant. Defaults to false.
|
|
43
|
+
* @return {ReactElement} The rendered TagClear component.
|
|
44
|
+
*/
|
|
45
|
+
var TagClear = function (_a) {
|
|
46
|
+
var id = _a.id, display = _a.display, M = _a.M, XS = _a.XS, invert = _a.invert, _b = _a.onClick, onClick = _b === void 0 ? function () { } : _b, _c = _a.variant, variant = _c === void 0 ? 'primary' : _c, grey = _a.grey;
|
|
47
|
+
var XIconCom = icons_1.icons['X'];
|
|
48
|
+
var size = M ? 'M' : XS ? 'XS' : 'S';
|
|
49
|
+
var TYPO_COMP = (0, getTypoComp_1.getTypoComp)({ typo: "caption" });
|
|
50
|
+
var _d = (0, react_1.useState)(false), hoverTag = _d[0], setHoverOnTag = _d[1];
|
|
51
|
+
return (react_1.default.createElement(styled_1.StyledTagClear, { invert: invert, size: size, grey: grey, variant: variant, onMouseEnter: function () { return setHoverOnTag(true); }, onMouseLeave: function () { return setHoverOnTag(false); } },
|
|
52
|
+
react_1.default.createElement(TYPO_COMP, null, display),
|
|
53
|
+
hoverTag &&
|
|
54
|
+
react_1.default.createElement(styled_1.StyledTagClearIconWrapper, { invert: invert, grey: grey, variant: variant, onClick: onClick },
|
|
55
|
+
react_1.default.createElement(XIconCom, { style: { marginRight: '-0.3rem' }, size: size === 'XS' ? '10' : '14', weight: 'bold' }))));
|
|
56
|
+
};
|
|
57
|
+
exports.TagClear = TagClear;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SIZES } from "../styled";
|
|
2
|
+
export interface StyledTagClearProps {
|
|
3
|
+
variant: 'primary' | 'ghost';
|
|
4
|
+
size: keyof typeof SIZES;
|
|
5
|
+
invert?: boolean;
|
|
6
|
+
grey?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const StyledTagClear: import("styled-components").StyledComponent<"div", any, StyledTagClearProps, never>;
|
|
9
|
+
export interface StyledTagClearIconWrapperProps {
|
|
10
|
+
invert?: boolean;
|
|
11
|
+
grey?: boolean;
|
|
12
|
+
variant: 'primary' | 'ghost';
|
|
13
|
+
onClick?: () => void;
|
|
14
|
+
}
|
|
15
|
+
export declare const StyledTagClearIconWrapper: import("styled-components").StyledComponent<"button", any, StyledTagClearIconWrapperProps, never>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
+
return cooked;
|
|
5
|
+
};
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.StyledTagClearIconWrapper = exports.StyledTagClear = void 0;
|
|
11
|
+
var styled_components_1 = __importDefault(require("styled-components"));
|
|
12
|
+
var styled_1 = require("../styled");
|
|
13
|
+
var themes_1 = require("../../../../themes");
|
|
14
|
+
var mixins_1 = require("../../../../../themes/mixins");
|
|
15
|
+
var grey5 = themes_1.colors.grey5, grey60 = themes_1.colors.grey60, redBG = themes_1.colors.redBG, red = themes_1.colors.red;
|
|
16
|
+
exports.StyledTagClear = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", " // size wont get applied here because of css specificity, there is no different size design yet \n padding: 0.1rem 0.5rem;\n background-color: ", ";\n color: ", ";\n cursor: pointer;\n position: relative;\n border-radius: 0.4rem;\n\n &:hover{\n background-color: ", ";\n color: ", ";\n }\n"], ["\n ", " // size wont get applied here because of css specificity, there is no different size design yet \n padding: 0.1rem 0.5rem;\n background-color: ", ";\n color: ", ";\n cursor: pointer;\n position: relative;\n border-radius: 0.4rem;\n\n &:hover{\n background-color: ", ";\n color: ", ";\n }\n"])), function (_a) {
|
|
17
|
+
var size = _a.size;
|
|
18
|
+
return (0, styled_1.commonStyle)({ size: size });
|
|
19
|
+
}, grey5, grey60, redBG, red);
|
|
20
|
+
exports.StyledTagClearIconWrapper = styled_components_1.default.button(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n border: none;\n display: flex;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n height: 100%;\n padding: 0 0.5rem;\n border-radius: 0.4rem;\n position: absolute;\n right: 0;\n background: linear-gradient(90deg, rgba(255, 227, 227, 0.00) 0%, ", " 28.76%);\n color: ", ";\n ", ";\n"], ["\n border: none;\n display: flex;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n height: 100%;\n padding: 0 0.5rem;\n border-radius: 0.4rem;\n position: absolute;\n right: 0;\n background: linear-gradient(90deg, rgba(255, 227, 227, 0.00) 0%, ", " 28.76%);\n color: ", ";\n ", ";\n"])), redBG, red, (0, mixins_1.transition)('color', 'background-color'));
|
|
21
|
+
var templateObject_1, templateObject_2;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TagDisplay = void 0;
|
|
3
|
+
exports.TagClear = exports.TagDisplay = void 0;
|
|
4
4
|
var TagDisplay_1 = require("./Comps/TagDisplay");
|
|
5
5
|
Object.defineProperty(exports, "TagDisplay", { enumerable: true, get: function () { return TagDisplay_1.TagDisplay; } });
|
|
6
|
+
var TagClear_1 = require("./Comps/TagClear");
|
|
7
|
+
Object.defineProperty(exports, "TagClear", { enumerable: true, get: function () { return TagClear_1.TagClear; } });
|
|
@@ -38,6 +38,8 @@ export declare const colors: {
|
|
|
38
38
|
green: string;
|
|
39
39
|
greenBG: string;
|
|
40
40
|
greenStroke: string;
|
|
41
|
+
redBG: string;
|
|
42
|
+
red: string;
|
|
41
43
|
};
|
|
42
44
|
export interface Colors2Type {
|
|
43
45
|
primary: string;
|
|
@@ -69,4 +71,6 @@ export interface Colors2Type {
|
|
|
69
71
|
green: string;
|
|
70
72
|
greenBG: string;
|
|
71
73
|
greenStroke: string;
|
|
74
|
+
redBG: string;
|
|
75
|
+
red: string;
|
|
72
76
|
}
|
package/dist/v2/themes/colors.js
CHANGED
|
@@ -31,6 +31,8 @@ var blue = "#2F55FF";
|
|
|
31
31
|
var yellow = "#DA9A0F";
|
|
32
32
|
var yellowBG = "#FFF7DC";
|
|
33
33
|
var yellowStroke = "#FFE09A";
|
|
34
|
+
var redBG = "#FFE3E3";
|
|
35
|
+
var red = "#800";
|
|
34
36
|
// const green = "#159300";
|
|
35
37
|
var purple = "#9D13E8";
|
|
36
38
|
var error = "#C41717";
|
|
@@ -42,16 +44,6 @@ var hint = "#B77222";
|
|
|
42
44
|
var green = '#53AC00';
|
|
43
45
|
var greenBG = '#E8F6DA';
|
|
44
46
|
var greenStroke = '#C4DAAF';
|
|
45
|
-
var greyColor100 = '#383838';
|
|
46
|
-
var greyColor90 = '#4c4c4c';
|
|
47
|
-
var greyColor80 = '#606060';
|
|
48
|
-
var greyColor70 = '#747474';
|
|
49
|
-
var greyColor50 = '#9B9B9B';
|
|
50
|
-
var greyColor40 = '#afafaf';
|
|
51
|
-
var greyColor15 = '#e1e1e1';
|
|
52
|
-
var greyColor10 = '#EBEBEB';
|
|
53
|
-
var greyColor5 = '#f5f5f5';
|
|
54
|
-
var greyColor3 = '#f9f9f9';
|
|
55
47
|
exports.dataVizColors = [
|
|
56
48
|
"#FF665D",
|
|
57
49
|
"#4DBC5D",
|
|
@@ -109,5 +101,7 @@ exports.colors = {
|
|
|
109
101
|
shadowHover: shadowHover,
|
|
110
102
|
green: green,
|
|
111
103
|
greenBG: greenBG,
|
|
112
|
-
greenStroke: greenStroke
|
|
104
|
+
greenStroke: greenStroke,
|
|
105
|
+
redBG: redBG,
|
|
106
|
+
red: red
|
|
113
107
|
};
|