ag-common 0.0.563 → 0.0.565
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/ui/components/{RadioGroup/DarkMode.d.ts → DarkMode/Base.d.ts} +2 -0
- package/dist/ui/components/{RadioGroup/DarkMode.js → DarkMode/Base.js} +54 -11
- package/dist/ui/components/DarkMode/index.d.ts +2 -0
- package/dist/ui/components/DarkMode/index.js +18 -0
- package/dist/ui/components/RadioGroup/index.d.ts +16 -2
- package/dist/ui/components/RadioGroup/index.js +57 -4
- package/dist/ui/components/RowOrColumn/index.d.ts +1 -0
- package/dist/ui/components/TabBar/index.d.ts +27 -0
- package/dist/ui/components/TabBar/index.js +90 -0
- package/dist/ui/components/TextEdit/CheckboxEdit.js +1 -1
- package/dist/ui/components/index.d.ts +2 -0
- package/dist/ui/components/index.js +2 -0
- package/dist/ui/icons/Sun.d.ts +4 -3
- package/dist/ui/icons/index.d.ts +72 -17
- package/dist/ui/icons/index.js +55 -31
- package/package.json +3 -3
- package/dist/ui/components/RadioGroup/Base.d.ts +0 -16
- package/dist/ui/components/RadioGroup/Base.js +0 -71
- /package/dist/ui/components/{RadioGroup → DarkMode}/types.d.ts +0 -0
- /package/dist/ui/components/{RadioGroup → DarkMode}/types.js +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { TDarkMode } from './types';
|
|
3
4
|
export interface IDarkMode {
|
|
@@ -7,6 +8,7 @@ export interface IDarkMode {
|
|
|
7
8
|
/** default 2.5rem */
|
|
8
9
|
iconSize?: string;
|
|
9
10
|
className?: string;
|
|
11
|
+
style?: CSSProperties;
|
|
10
12
|
cookieDocument: string;
|
|
11
13
|
}
|
|
12
14
|
/** shows darkmode toggle. Persists to cookie, and modifies html classList with either dark-mode or light-mode */
|
|
@@ -1,18 +1,50 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
'use client';
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
+
if (mod && mod.__esModule) return mod;
|
|
21
|
+
var result = {};
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
+
__setModuleDefault(result, mod);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
3
26
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
27
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
28
|
};
|
|
6
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
30
|
exports.DarkMode = void 0;
|
|
8
31
|
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
9
|
-
const react_1 =
|
|
32
|
+
const react_1 = __importStar(require("react"));
|
|
10
33
|
const use_1 = require("../../helpers/cookie/use");
|
|
11
34
|
const icons_1 = require("../../icons");
|
|
12
35
|
const FlexColumn_1 = require("../FlexColumn");
|
|
13
36
|
const Icon_1 = require("../Icon");
|
|
14
|
-
const Base_1 = require("./Base");
|
|
15
37
|
const types_1 = require("./types");
|
|
38
|
+
const Base = styled_1.default.div `
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-flow: row;
|
|
41
|
+
&[data-mode='vert'] {
|
|
42
|
+
flex-flow: column;
|
|
43
|
+
}
|
|
44
|
+
overflow: hidden;
|
|
45
|
+
justify-content: space-between;
|
|
46
|
+
border-radius: 2rem;
|
|
47
|
+
`;
|
|
16
48
|
const IconStyled = (0, styled_1.default)(Icon_1.Icon) `
|
|
17
49
|
> svg {
|
|
18
50
|
height: 60%;
|
|
@@ -21,8 +53,11 @@ const IconStyled = (0, styled_1.default)(Icon_1.Icon) `
|
|
|
21
53
|
const Label = (0, styled_1.default)(FlexColumn_1.FlexColumn) `
|
|
22
54
|
border-radius: 50%;
|
|
23
55
|
overflow: hidden;
|
|
56
|
+
cursor: pointer;
|
|
57
|
+
|
|
24
58
|
&[data-selected='true'] {
|
|
25
59
|
background-color: white;
|
|
60
|
+
cursor: default;
|
|
26
61
|
}
|
|
27
62
|
`;
|
|
28
63
|
const getColours = (p, vert) => {
|
|
@@ -50,6 +85,7 @@ const modes = [
|
|
|
50
85
|
];
|
|
51
86
|
/** shows darkmode toggle. Persists to cookie, and modifies html classList with either dark-mode or light-mode */
|
|
52
87
|
const DarkMode = (p) => {
|
|
88
|
+
var _a, _b;
|
|
53
89
|
const { iconSize = '2.5rem' } = p;
|
|
54
90
|
const [darkmode, setDarkmodeRaw] = (0, use_1.useCookie)({
|
|
55
91
|
defaultValue: types_1.TDarkMode.system,
|
|
@@ -58,9 +94,9 @@ const DarkMode = (p) => {
|
|
|
58
94
|
parse: (v) => Number(v),
|
|
59
95
|
stringify: (v) => v.toString(),
|
|
60
96
|
});
|
|
61
|
-
const index = modes.findIndex((d) => d.mode === darkmode);
|
|
97
|
+
const [index, setIndex] = (0, react_1.useState)((_a = modes.findIndex((d) => d.mode === darkmode)) !== null && _a !== void 0 ? _a : 0);
|
|
62
98
|
const [fill, background] = getColours(modes[index].mode, p.mode === 'vert');
|
|
63
|
-
const twCalc = `calc(${iconSize} + ${iconSize} + ${iconSize}
|
|
99
|
+
const twCalc = `calc(${iconSize} + ${iconSize} + ${iconSize} )`;
|
|
64
100
|
const setDarkmode = (newDarkMode) => {
|
|
65
101
|
var _a;
|
|
66
102
|
let className = '';
|
|
@@ -81,14 +117,21 @@ const DarkMode = (p) => {
|
|
|
81
117
|
setDarkmodeRaw(newDarkMode);
|
|
82
118
|
(_a = p.onSubmit) === null || _a === void 0 ? void 0 : _a.call(p, newDarkMode);
|
|
83
119
|
};
|
|
84
|
-
return (react_1.default.createElement(
|
|
85
|
-
setDarkmode(mode);
|
|
86
|
-
}, style: Object.assign({ background, border: `solid 2px ${fill}`, width: twCalc, height: iconSize }, (p.mode === 'vert' && {
|
|
120
|
+
return (react_1.default.createElement(Base, { className: p.className, "data-mode": (_b = p.mode) !== null && _b !== void 0 ? _b : 'horiz', style: Object.assign(Object.assign(Object.assign({}, p.style), { background, border: `solid 2px ${fill}`, width: twCalc, height: iconSize }), (p.mode === 'vert' && {
|
|
87
121
|
width: iconSize,
|
|
88
122
|
height: twCalc,
|
|
89
|
-
})),
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
123
|
+
})) }, modes.map((v, i) => {
|
|
124
|
+
const selected = index === i;
|
|
125
|
+
return (react_1.default.createElement(Label, { "data-selected": selected, style: { width: iconSize, height: iconSize },
|
|
126
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
127
|
+
key: i.toString(), onClick: () => {
|
|
128
|
+
if (index === i) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
setIndex(i);
|
|
132
|
+
setDarkmode(v.mode);
|
|
133
|
+
} },
|
|
134
|
+
react_1.default.createElement(IconStyled, null, v.icon({ style: { fill: selected ? fill : 'white' } }))));
|
|
135
|
+
})));
|
|
93
136
|
};
|
|
94
137
|
exports.DarkMode = DarkMode;
|
|
@@ -0,0 +1,18 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Base"), exports);
|
|
18
|
+
__exportStar(require("./types"), exports);
|
|
@@ -1,2 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export interface IRadioGroup<T> {
|
|
4
|
+
/**
|
|
5
|
+
* can overload the render of the label. defaults to toString
|
|
6
|
+
*/
|
|
7
|
+
renderLabel?: (a: T, selected: boolean) => JSX.Element;
|
|
8
|
+
defaultIndex: number;
|
|
9
|
+
onSubmit: (val: T, index: number) => void;
|
|
10
|
+
values: T[];
|
|
11
|
+
className?: string;
|
|
12
|
+
style?: CSSProperties;
|
|
13
|
+
/** default horiz */
|
|
14
|
+
mode?: 'vert' | 'horiz';
|
|
15
|
+
}
|
|
16
|
+
export declare const RadioGroup: <T>(p: IRadioGroup<T>) => React.JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
'use client';
|
|
2
3
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
4
|
if (k2 === undefined) k2 = k;
|
|
4
5
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -10,9 +11,61 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
10
11
|
if (k2 === undefined) k2 = k;
|
|
11
12
|
o[k2] = m[k];
|
|
12
13
|
}));
|
|
13
|
-
var
|
|
14
|
-
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
+
if (mod && mod.__esModule) return mod;
|
|
21
|
+
var result = {};
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
+
__setModuleDefault(result, mod);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
28
|
};
|
|
16
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
18
|
-
|
|
30
|
+
exports.RadioGroup = void 0;
|
|
31
|
+
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
32
|
+
const react_1 = __importStar(require("react"));
|
|
33
|
+
const Base = styled_1.default.div `
|
|
34
|
+
display: flex;
|
|
35
|
+
flex-flow: row;
|
|
36
|
+
&[data-mode='vert'] {
|
|
37
|
+
flex-flow: column;
|
|
38
|
+
}
|
|
39
|
+
overflow: hidden;
|
|
40
|
+
justify-content: space-between;
|
|
41
|
+
`;
|
|
42
|
+
const Label = styled_1.default.label `
|
|
43
|
+
text-align: center;
|
|
44
|
+
display: flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
|
|
47
|
+
&[data-selected='true'] {
|
|
48
|
+
cursor: default;
|
|
49
|
+
}
|
|
50
|
+
&[data-selected='false'] {
|
|
51
|
+
cursor: pointer;
|
|
52
|
+
}
|
|
53
|
+
`;
|
|
54
|
+
const RadioGroup = (p) => {
|
|
55
|
+
var _a, _b;
|
|
56
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
57
|
+
const { renderLabel = (x) => x.toString() } = p;
|
|
58
|
+
const [index, setIndex] = (0, react_1.useState)((_a = p.defaultIndex) !== null && _a !== void 0 ? _a : 0);
|
|
59
|
+
return (react_1.default.createElement(Base, { className: p.className, style: p.style, "data-mode": (_b = p.mode) !== null && _b !== void 0 ? _b : 'horiz' }, p.values.map((v, i) => (react_1.default.createElement(Label
|
|
60
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
61
|
+
, {
|
|
62
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
63
|
+
key: i.toString(), "data-selected": index === i, onClick: () => {
|
|
64
|
+
if (index === i) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
setIndex(i);
|
|
68
|
+
p.onSubmit(v, i);
|
|
69
|
+
} }, renderLabel(v, index === i))))));
|
|
70
|
+
};
|
|
71
|
+
exports.RadioGroup = RadioGroup;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export interface ITabBar {
|
|
4
|
+
onChangeIndex: (i: number) => void;
|
|
5
|
+
className?: string;
|
|
6
|
+
cookieDocument: string;
|
|
7
|
+
style?: CSSProperties;
|
|
8
|
+
items: {
|
|
9
|
+
text: string;
|
|
10
|
+
icon: (p: {
|
|
11
|
+
style: {
|
|
12
|
+
fill?: string;
|
|
13
|
+
};
|
|
14
|
+
}) => JSX.Element;
|
|
15
|
+
}[];
|
|
16
|
+
theme?: {
|
|
17
|
+
/** default black */
|
|
18
|
+
front?: string;
|
|
19
|
+
/** default blue */
|
|
20
|
+
frontSelected?: string;
|
|
21
|
+
/** default #eee */
|
|
22
|
+
back?: string;
|
|
23
|
+
};
|
|
24
|
+
/** default 0 */
|
|
25
|
+
defaultSelectedIndex?: number;
|
|
26
|
+
}
|
|
27
|
+
export declare const TabBar: (p: ITabBar) => React.JSX.Element;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
+
if (mod && mod.__esModule) return mod;
|
|
21
|
+
var result = {};
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
+
__setModuleDefault(result, mod);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.TabBar = void 0;
|
|
31
|
+
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
32
|
+
const react_1 = __importStar(require("react"));
|
|
33
|
+
const Icon_1 = require("../Icon");
|
|
34
|
+
const Base = styled_1.default.div `
|
|
35
|
+
display: flex;
|
|
36
|
+
flex-flow: row;
|
|
37
|
+
&[data-mode='vert'] {
|
|
38
|
+
flex-flow: column;
|
|
39
|
+
}
|
|
40
|
+
overflow: hidden;
|
|
41
|
+
justify-content: space-around;
|
|
42
|
+
width: 100%;
|
|
43
|
+
margin: auto;
|
|
44
|
+
`;
|
|
45
|
+
const Item = styled_1.default.div `
|
|
46
|
+
display: flex;
|
|
47
|
+
flex-flow: column;
|
|
48
|
+
align-items: center;
|
|
49
|
+
border-radius: 2rem;
|
|
50
|
+
justify-content: center;
|
|
51
|
+
height: calc(100% - 1rem);
|
|
52
|
+
padding-left: 1rem;
|
|
53
|
+
padding-right: 1rem;
|
|
54
|
+
width: 10rem;
|
|
55
|
+
&[data-selected='false'] {
|
|
56
|
+
opacity: 0.8;
|
|
57
|
+
cursor: pointer;
|
|
58
|
+
}
|
|
59
|
+
`;
|
|
60
|
+
const IconStyled = (0, styled_1.default)(Icon_1.Icon) `
|
|
61
|
+
height: 1.5rem;
|
|
62
|
+
max-height: 80%;
|
|
63
|
+
max-width: fit-content;
|
|
64
|
+
`;
|
|
65
|
+
const Text = styled_1.default.div `
|
|
66
|
+
max-height: 50%;
|
|
67
|
+
overflow: hidden;
|
|
68
|
+
`;
|
|
69
|
+
const TabBar = (p) => {
|
|
70
|
+
var _a;
|
|
71
|
+
const { defaultSelectedIndex = 0, theme: { back = '#eee', frontSelected = '#4d76ff', front = 'black' }, } = Object.assign(Object.assign({}, p), { theme: (_a = p.theme) !== null && _a !== void 0 ? _a : {} });
|
|
72
|
+
const [index, setIndex] = (0, react_1.useState)(defaultSelectedIndex);
|
|
73
|
+
return (react_1.default.createElement(Base, { className: p.className, style: p.style }, p.items.map((v, i) => {
|
|
74
|
+
const selected = index === i;
|
|
75
|
+
return (react_1.default.createElement(Item, { style: Object.assign(Object.assign({ backgroundColor: back, color: front }, (selected && { color: frontSelected })), { maxWidth: `${100 / p.items.length}%` }), "data-selected": selected,
|
|
76
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
77
|
+
key: i.toString(), onClick: () => {
|
|
78
|
+
if (index === i) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
setIndex(i);
|
|
82
|
+
p.onChangeIndex(i);
|
|
83
|
+
} },
|
|
84
|
+
react_1.default.createElement(IconStyled, { style: { width: '50%' } }, v.icon({
|
|
85
|
+
style: Object.assign({}, (selected && { fill: frontSelected })),
|
|
86
|
+
})),
|
|
87
|
+
react_1.default.createElement(Text, { "data-type": "text" }, v.text)));
|
|
88
|
+
})));
|
|
89
|
+
};
|
|
90
|
+
exports.TabBar = TabBar;
|
|
@@ -53,7 +53,7 @@ const CheckboxEdit = ({ defaultValue, onSubmit, noGrow = false, allowUndo = fals
|
|
|
53
53
|
onSubmit(value);
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
|
-
return (react_1.default.createElement(common_2.ValueBox, Object.assign({}, common_1.noDrag, { className: className, style: { cursor: 'pointer' }, ref: ref, "data-nogrow": noGrow, onClick: (e) => {
|
|
56
|
+
return (react_1.default.createElement(common_2.ValueBox, Object.assign({}, common_1.noDrag, { className: className, style: { cursor: 'pointer', width: 'fit-content', flexGrow: 0 }, ref: ref, "data-nogrow": noGrow, onClick: (e) => {
|
|
57
57
|
if (allowUndo) {
|
|
58
58
|
setValue(!value);
|
|
59
59
|
}
|
|
@@ -4,6 +4,7 @@ export * from './Button';
|
|
|
4
4
|
export * from './Chevron';
|
|
5
5
|
export * from './Close';
|
|
6
6
|
export * from './Confirm';
|
|
7
|
+
export * from './DarkMode';
|
|
7
8
|
export * from './DropdownList';
|
|
8
9
|
export * from './FlexColumn';
|
|
9
10
|
export * from './FlexRow';
|
|
@@ -24,6 +25,7 @@ export * from './RowOrColumn';
|
|
|
24
25
|
export * from './Search';
|
|
25
26
|
export * from './Sidebar';
|
|
26
27
|
export * from './SparkLine';
|
|
28
|
+
export * from './TabBar';
|
|
27
29
|
export * from './Table';
|
|
28
30
|
export * from './TextEdit';
|
|
29
31
|
export * from './TextWithButton';
|
|
@@ -20,6 +20,7 @@ __exportStar(require("./Button"), exports);
|
|
|
20
20
|
__exportStar(require("./Chevron"), exports);
|
|
21
21
|
__exportStar(require("./Close"), exports);
|
|
22
22
|
__exportStar(require("./Confirm"), exports);
|
|
23
|
+
__exportStar(require("./DarkMode"), exports);
|
|
23
24
|
__exportStar(require("./DropdownList"), exports);
|
|
24
25
|
__exportStar(require("./FlexColumn"), exports);
|
|
25
26
|
__exportStar(require("./FlexRow"), exports);
|
|
@@ -40,6 +41,7 @@ __exportStar(require("./RowOrColumn"), exports);
|
|
|
40
41
|
__exportStar(require("./Search"), exports);
|
|
41
42
|
__exportStar(require("./Sidebar"), exports);
|
|
42
43
|
__exportStar(require("./SparkLine"), exports);
|
|
44
|
+
__exportStar(require("./TabBar"), exports);
|
|
43
45
|
__exportStar(require("./Table"), exports);
|
|
44
46
|
__exportStar(require("./TextEdit"), exports);
|
|
45
47
|
__exportStar(require("./TextWithButton"), exports);
|
package/dist/ui/icons/Sun.d.ts
CHANGED
package/dist/ui/icons/index.d.ts
CHANGED
|
@@ -1,17 +1,72 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Checkmark } from './Checkmark';
|
|
3
|
+
import { ChevronRight } from './ChevronRight';
|
|
4
|
+
import { Circle } from './Circle';
|
|
5
|
+
import { CircleDot } from './CircleDot';
|
|
6
|
+
import { Computer } from './Computer';
|
|
7
|
+
import { CrossIcon } from './CrossIcon';
|
|
8
|
+
import { Door } from './Door';
|
|
9
|
+
import { Hamburger } from './Hamburger';
|
|
10
|
+
import { HorizontalDots } from './HorizontalDots';
|
|
11
|
+
import { Magnify } from './Magnify';
|
|
12
|
+
import { Moon } from './Moon';
|
|
13
|
+
import { Pencil } from './Pencil';
|
|
14
|
+
import { Save } from './Save';
|
|
15
|
+
import { Sun } from './Sun';
|
|
16
|
+
import { Undo } from './Undo';
|
|
17
|
+
import { UserOutline } from './UserOutline';
|
|
18
|
+
import { Warning } from './Warning';
|
|
19
|
+
declare const icons: {
|
|
20
|
+
Checkmark: ({ style, }: {
|
|
21
|
+
style?: ({
|
|
22
|
+
fill?: string | undefined;
|
|
23
|
+
} & import("react").CSSProperties) | undefined;
|
|
24
|
+
}) => import("react").JSX.Element;
|
|
25
|
+
ChevronRight: import("react").JSX.Element;
|
|
26
|
+
Circle: ({ style, dotted, }: {
|
|
27
|
+
style?: ({
|
|
28
|
+
fill?: string | undefined;
|
|
29
|
+
} & import("react").CSSProperties) | undefined;
|
|
30
|
+
dotted?: boolean | undefined;
|
|
31
|
+
}) => import("react").JSX.Element;
|
|
32
|
+
CircleDot: ({ style }: {
|
|
33
|
+
style?: import("react").CSSProperties | undefined;
|
|
34
|
+
}) => import("react").JSX.Element;
|
|
35
|
+
Computer: ({ style, }: {
|
|
36
|
+
style?: ({
|
|
37
|
+
fill?: string | undefined;
|
|
38
|
+
} & import("react").CSSProperties) | undefined;
|
|
39
|
+
}) => import("react").JSX.Element;
|
|
40
|
+
CrossIcon: ({ className, onClick, }: {
|
|
41
|
+
className?: string | undefined;
|
|
42
|
+
onClick?: (() => void) | undefined;
|
|
43
|
+
}) => import("react").JSX.Element;
|
|
44
|
+
Door: import("react").JSX.Element;
|
|
45
|
+
Hamburger: ({ className }: {
|
|
46
|
+
className?: string | undefined;
|
|
47
|
+
}) => import("react").JSX.Element;
|
|
48
|
+
HorizontalDots: import("react").JSX.Element;
|
|
49
|
+
Magnify: ({ style, }: {
|
|
50
|
+
style?: ({
|
|
51
|
+
fill?: string | undefined;
|
|
52
|
+
} & import("react").CSSProperties) | undefined;
|
|
53
|
+
}) => import("react").JSX.Element;
|
|
54
|
+
Moon: ({ style, }: {
|
|
55
|
+
style?: ({
|
|
56
|
+
fill?: string | undefined;
|
|
57
|
+
} & import("react").CSSProperties) | undefined;
|
|
58
|
+
}) => import("react").JSX.Element;
|
|
59
|
+
Pencil: () => import("react").JSX.Element;
|
|
60
|
+
Save: () => import("react").JSX.Element;
|
|
61
|
+
Sun: (p?: {
|
|
62
|
+
style?: {
|
|
63
|
+
fill?: string | undefined;
|
|
64
|
+
} | undefined;
|
|
65
|
+
} | undefined) => import("react").JSX.Element;
|
|
66
|
+
Undo: () => import("react").JSX.Element;
|
|
67
|
+
UserOutline: import("react").JSX.Element;
|
|
68
|
+
Warning: ({ className }: {
|
|
69
|
+
className?: string | undefined;
|
|
70
|
+
}) => import("react").JSX.Element;
|
|
71
|
+
};
|
|
72
|
+
export { Checkmark, ChevronRight, Circle, CircleDot, Computer, CrossIcon, Door, Hamburger, HorizontalDots, icons, Magnify, Moon, Pencil, Save, Sun, Undo, UserOutline, Warning, };
|
package/dist/ui/icons/index.js
CHANGED
|
@@ -1,33 +1,57 @@
|
|
|
1
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
3
|
+
exports.Warning = exports.UserOutline = exports.Undo = exports.Sun = exports.Save = exports.Pencil = exports.Moon = exports.Magnify = exports.icons = exports.HorizontalDots = exports.Hamburger = exports.Door = exports.CrossIcon = exports.Computer = exports.CircleDot = exports.Circle = exports.ChevronRight = exports.Checkmark = void 0;
|
|
4
|
+
const Checkmark_1 = require("./Checkmark");
|
|
5
|
+
Object.defineProperty(exports, "Checkmark", { enumerable: true, get: function () { return Checkmark_1.Checkmark; } });
|
|
6
|
+
const ChevronRight_1 = require("./ChevronRight");
|
|
7
|
+
Object.defineProperty(exports, "ChevronRight", { enumerable: true, get: function () { return ChevronRight_1.ChevronRight; } });
|
|
8
|
+
const Circle_1 = require("./Circle");
|
|
9
|
+
Object.defineProperty(exports, "Circle", { enumerable: true, get: function () { return Circle_1.Circle; } });
|
|
10
|
+
const CircleDot_1 = require("./CircleDot");
|
|
11
|
+
Object.defineProperty(exports, "CircleDot", { enumerable: true, get: function () { return CircleDot_1.CircleDot; } });
|
|
12
|
+
const Computer_1 = require("./Computer");
|
|
13
|
+
Object.defineProperty(exports, "Computer", { enumerable: true, get: function () { return Computer_1.Computer; } });
|
|
14
|
+
const CrossIcon_1 = require("./CrossIcon");
|
|
15
|
+
Object.defineProperty(exports, "CrossIcon", { enumerable: true, get: function () { return CrossIcon_1.CrossIcon; } });
|
|
16
|
+
const Door_1 = require("./Door");
|
|
17
|
+
Object.defineProperty(exports, "Door", { enumerable: true, get: function () { return Door_1.Door; } });
|
|
18
|
+
const Hamburger_1 = require("./Hamburger");
|
|
19
|
+
Object.defineProperty(exports, "Hamburger", { enumerable: true, get: function () { return Hamburger_1.Hamburger; } });
|
|
20
|
+
const HorizontalDots_1 = require("./HorizontalDots");
|
|
21
|
+
Object.defineProperty(exports, "HorizontalDots", { enumerable: true, get: function () { return HorizontalDots_1.HorizontalDots; } });
|
|
22
|
+
const Magnify_1 = require("./Magnify");
|
|
23
|
+
Object.defineProperty(exports, "Magnify", { enumerable: true, get: function () { return Magnify_1.Magnify; } });
|
|
24
|
+
const Moon_1 = require("./Moon");
|
|
25
|
+
Object.defineProperty(exports, "Moon", { enumerable: true, get: function () { return Moon_1.Moon; } });
|
|
26
|
+
const Pencil_1 = require("./Pencil");
|
|
27
|
+
Object.defineProperty(exports, "Pencil", { enumerable: true, get: function () { return Pencil_1.Pencil; } });
|
|
28
|
+
const Save_1 = require("./Save");
|
|
29
|
+
Object.defineProperty(exports, "Save", { enumerable: true, get: function () { return Save_1.Save; } });
|
|
30
|
+
const Sun_1 = require("./Sun");
|
|
31
|
+
Object.defineProperty(exports, "Sun", { enumerable: true, get: function () { return Sun_1.Sun; } });
|
|
32
|
+
const Undo_1 = require("./Undo");
|
|
33
|
+
Object.defineProperty(exports, "Undo", { enumerable: true, get: function () { return Undo_1.Undo; } });
|
|
34
|
+
const UserOutline_1 = require("./UserOutline");
|
|
35
|
+
Object.defineProperty(exports, "UserOutline", { enumerable: true, get: function () { return UserOutline_1.UserOutline; } });
|
|
36
|
+
const Warning_1 = require("./Warning");
|
|
37
|
+
Object.defineProperty(exports, "Warning", { enumerable: true, get: function () { return Warning_1.Warning; } });
|
|
38
|
+
const icons = {
|
|
39
|
+
Checkmark: Checkmark_1.Checkmark,
|
|
40
|
+
ChevronRight: ChevronRight_1.ChevronRight,
|
|
41
|
+
Circle: Circle_1.Circle,
|
|
42
|
+
CircleDot: CircleDot_1.CircleDot,
|
|
43
|
+
Computer: Computer_1.Computer,
|
|
44
|
+
CrossIcon: CrossIcon_1.CrossIcon,
|
|
45
|
+
Door: Door_1.Door,
|
|
46
|
+
Hamburger: Hamburger_1.Hamburger,
|
|
47
|
+
HorizontalDots: HorizontalDots_1.HorizontalDots,
|
|
48
|
+
Magnify: Magnify_1.Magnify,
|
|
49
|
+
Moon: Moon_1.Moon,
|
|
50
|
+
Pencil: Pencil_1.Pencil,
|
|
51
|
+
Save: Save_1.Save,
|
|
52
|
+
Sun: Sun_1.Sun,
|
|
53
|
+
Undo: Undo_1.Undo,
|
|
54
|
+
UserOutline: UserOutline_1.UserOutline,
|
|
55
|
+
Warning: Warning_1.Warning,
|
|
56
|
+
};
|
|
57
|
+
exports.icons = icons;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.0.
|
|
2
|
+
"version": "0.0.565",
|
|
3
3
|
"name": "ag-common",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@babel/types": "7.23.3",
|
|
43
43
|
"@emotion/react": "11.11.1",
|
|
44
44
|
"@emotion/styled": "11.11.0",
|
|
45
|
-
"@smithy/types": "2.
|
|
45
|
+
"@smithy/types": "2.5.0",
|
|
46
46
|
"@storybook/addon-actions": "7.5.3",
|
|
47
47
|
"@storybook/addon-docs": "7.5.3",
|
|
48
48
|
"@storybook/addon-essentials": "7.5.3",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"@types/react": "18.2.37",
|
|
59
59
|
"@types/react-dom": "18.2.15",
|
|
60
60
|
"cross-env": "7.0.3",
|
|
61
|
-
"eslint-config-e7npm": "0.0.
|
|
61
|
+
"eslint-config-e7npm": "0.0.54",
|
|
62
62
|
"jest": "29.7.0",
|
|
63
63
|
"rimraf": "5.0.5",
|
|
64
64
|
"storybook": "7.5.3",
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { CSSProperties } from 'react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
export interface IRadioGroup<T> {
|
|
4
|
-
/**
|
|
5
|
-
* can overload the render of the label. defaults to toString
|
|
6
|
-
*/
|
|
7
|
-
renderLabel?: (a: T, selected: boolean) => JSX.Element;
|
|
8
|
-
defaultIndex: number;
|
|
9
|
-
onSubmit: (val: T, index: number) => void;
|
|
10
|
-
values: T[];
|
|
11
|
-
className?: string;
|
|
12
|
-
style?: CSSProperties;
|
|
13
|
-
/** default horiz */
|
|
14
|
-
mode?: 'vert' | 'horiz';
|
|
15
|
-
}
|
|
16
|
-
export declare const RadioGroup: <T>(p: IRadioGroup<T>) => React.JSX.Element;
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
'use client';
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
-
if (mod && mod.__esModule) return mod;
|
|
21
|
-
var result = {};
|
|
22
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
-
__setModuleDefault(result, mod);
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
-
};
|
|
29
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.RadioGroup = void 0;
|
|
31
|
-
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
32
|
-
const react_1 = __importStar(require("react"));
|
|
33
|
-
const Base = styled_1.default.div `
|
|
34
|
-
display: flex;
|
|
35
|
-
flex-flow: row;
|
|
36
|
-
&[data-mode='vert'] {
|
|
37
|
-
flex-flow: column;
|
|
38
|
-
}
|
|
39
|
-
border-radius: 2rem;
|
|
40
|
-
overflow: hidden;
|
|
41
|
-
justify-content: space-between;
|
|
42
|
-
`;
|
|
43
|
-
const Label = styled_1.default.label `
|
|
44
|
-
text-align: center;
|
|
45
|
-
overflow: hidden;
|
|
46
|
-
|
|
47
|
-
&[data-selected='true'] {
|
|
48
|
-
cursor: default;
|
|
49
|
-
}
|
|
50
|
-
&[data-selected='false'] {
|
|
51
|
-
cursor: pointer;
|
|
52
|
-
}
|
|
53
|
-
`;
|
|
54
|
-
const RadioGroup = (p) => {
|
|
55
|
-
var _a, _b;
|
|
56
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
57
|
-
const { renderLabel = (x) => x.toString() } = p;
|
|
58
|
-
const [index, setIndex] = (0, react_1.useState)((_a = p.defaultIndex) !== null && _a !== void 0 ? _a : 0);
|
|
59
|
-
return (react_1.default.createElement(Base, { className: p.className, style: p.style, "data-mode": (_b = p.mode) !== null && _b !== void 0 ? _b : 'horiz' }, p.values.map((v, i) => (react_1.default.createElement(Label
|
|
60
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
61
|
-
, {
|
|
62
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
63
|
-
key: i.toString(), "data-selected": index === i, onClick: () => {
|
|
64
|
-
if (index === i) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
setIndex(i);
|
|
68
|
-
p.onSubmit(v, i);
|
|
69
|
-
} }, renderLabel(v, index === i))))));
|
|
70
|
-
};
|
|
71
|
-
exports.RadioGroup = RadioGroup;
|
|
File without changes
|
|
File without changes
|