ag-common 0.0.620 → 0.0.622
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/Icon/index.js +1 -0
- package/dist/ui/components/Sidebar/index.d.ts +6 -1
- package/dist/ui/components/Sidebar/index.js +69 -29
- package/dist/ui/icons/Cog.d.ts +2 -0
- package/dist/ui/icons/Cog.js +12 -0
- package/dist/ui/icons/House.d.ts +2 -0
- package/dist/ui/icons/House.js +10 -0
- package/dist/ui/icons/index.d.ts +5 -1
- package/dist/ui/icons/index.js +7 -1
- package/package.json +1 -1
|
@@ -2,5 +2,10 @@ import React from 'react';
|
|
|
2
2
|
export interface ISidebar {
|
|
3
3
|
children: React.ReactNode;
|
|
4
4
|
className?: string;
|
|
5
|
+
/** default:defaultClosed
|
|
6
|
+
* defaultClosed: always closed by default.
|
|
7
|
+
* fixedOpen: always open on bigscreen. cant close if bigscreen
|
|
8
|
+
*/
|
|
9
|
+
mode?: 'defaultClosed' | 'fixedOpen';
|
|
5
10
|
}
|
|
6
|
-
export declare const Sidebar: ({ children, className }: ISidebar) => React.JSX.Element;
|
|
11
|
+
export declare const Sidebar: ({ children, className, mode, }: ISidebar) => React.JSX.Element;
|
|
@@ -28,60 +28,83 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
};
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
30
|
exports.Sidebar = void 0;
|
|
31
|
+
const react_1 = require("@emotion/react");
|
|
31
32
|
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
32
|
-
const
|
|
33
|
+
const react_2 = __importStar(require("react"));
|
|
33
34
|
const helpers_1 = require("../../helpers");
|
|
34
35
|
const Hamburger_1 = require("../../icons/Hamburger");
|
|
35
36
|
const common_1 = require("../../styles/common");
|
|
36
37
|
const media_1 = require("../../styles/media");
|
|
37
38
|
const Chevron_1 = require("../Chevron");
|
|
39
|
+
const closedSidebarHover = (0, react_1.css) `
|
|
40
|
+
padding-left: 0.5rem;
|
|
41
|
+
width: 0.5rem;
|
|
42
|
+
background-color: rgba(0, 0, 0, 0.1);
|
|
43
|
+
cursor: pointer;
|
|
44
|
+
&:hover,
|
|
45
|
+
&:hover [data-hover='true'] {
|
|
46
|
+
background-color: #ccc;
|
|
47
|
+
}
|
|
48
|
+
&:hover {
|
|
49
|
+
border-right: solid 1px #999;
|
|
50
|
+
}
|
|
51
|
+
`;
|
|
38
52
|
const Base = styled_1.default.div `
|
|
39
53
|
position: relative;
|
|
40
54
|
transition: all 200ms;
|
|
41
55
|
border-right: solid 1px #ccc;
|
|
42
|
-
padding-left: 0.5rem;
|
|
43
56
|
height: 100vh;
|
|
44
57
|
|
|
58
|
+
${common_1.NoTextSelect};
|
|
59
|
+
&:hover {
|
|
60
|
+
[data-type='content-block'] {
|
|
61
|
+
left: 1rem;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
45
65
|
&[data-open='true'] {
|
|
46
|
-
width:
|
|
47
|
-
|
|
66
|
+
width: fit-content;
|
|
67
|
+
|
|
48
68
|
@media ${media_1.smallScreen} {
|
|
49
69
|
max-width: unset;
|
|
50
70
|
position: fixed;
|
|
51
71
|
top: 0;
|
|
52
72
|
left: 0;
|
|
73
|
+
z-index: 1;
|
|
53
74
|
}
|
|
54
75
|
}
|
|
55
76
|
&[data-open='false'] {
|
|
56
|
-
|
|
57
|
-
background-color: rgba(0, 0, 0, 0.1);
|
|
58
|
-
cursor: pointer;
|
|
59
|
-
&:hover,
|
|
60
|
-
&:hover [data-hover='true'] {
|
|
61
|
-
background-color: #ccc;
|
|
62
|
-
}
|
|
63
|
-
&:hover {
|
|
64
|
-
border-right: solid 1px #999;
|
|
65
|
-
}
|
|
77
|
+
${closedSidebarHover};
|
|
66
78
|
}
|
|
67
|
-
${common_1.NoTextSelect};
|
|
68
79
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
80
|
+
:not([data-open]) {
|
|
81
|
+
@media ${media_1.smallScreen} {
|
|
82
|
+
${closedSidebarHover};
|
|
83
|
+
}
|
|
84
|
+
@media ${media_1.bigScreen} {
|
|
85
|
+
width: fit-content;
|
|
72
86
|
}
|
|
73
87
|
}
|
|
74
88
|
`;
|
|
75
|
-
const
|
|
76
|
-
left: -
|
|
89
|
+
const closedContentBlockOffScreen = (0, react_1.css) `
|
|
90
|
+
left: -100vw;
|
|
77
91
|
transition: left 200ms;
|
|
78
92
|
height: 100%;
|
|
93
|
+
`;
|
|
94
|
+
const ContentBlock = styled_1.default.div `
|
|
95
|
+
${closedContentBlockOffScreen};
|
|
79
96
|
&[data-open='false'] {
|
|
80
97
|
position: absolute;
|
|
81
98
|
top: 0;
|
|
82
99
|
z-index: 1;
|
|
83
|
-
width:
|
|
84
|
-
|
|
100
|
+
width: fit-content;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
:not([data-open]) {
|
|
104
|
+
@media ${media_1.smallScreen} {
|
|
105
|
+
position: absolute;
|
|
106
|
+
${closedContentBlockOffScreen};
|
|
107
|
+
}
|
|
85
108
|
}
|
|
86
109
|
`;
|
|
87
110
|
const Content = styled_1.default.div `
|
|
@@ -100,10 +123,24 @@ const HamburgerB = styled_1.default.div `
|
|
|
100
123
|
position: absolute;
|
|
101
124
|
transition: all 200ms;
|
|
102
125
|
z-index: 2;
|
|
126
|
+
|
|
127
|
+
&[data-hide-on-big='true'] {
|
|
128
|
+
@media ${media_1.bigScreen} {
|
|
129
|
+
display: none;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
103
133
|
&[data-open='false'] {
|
|
104
134
|
top: 0.5rem;
|
|
105
135
|
left: 0.25rem;
|
|
106
136
|
}
|
|
137
|
+
|
|
138
|
+
:not([data-open]) {
|
|
139
|
+
@media ${media_1.bigScreen} {
|
|
140
|
+
top: 0.5rem;
|
|
141
|
+
right: -0.75rem;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
107
144
|
&[data-open='true'] {
|
|
108
145
|
top: 0.5rem;
|
|
109
146
|
right: -0.75rem;
|
|
@@ -127,19 +164,22 @@ const ChevronStyled = (0, styled_1.default)(Chevron_1.Chevron) `
|
|
|
127
164
|
fill: #555;
|
|
128
165
|
}
|
|
129
166
|
`;
|
|
130
|
-
const Sidebar = ({ children, className }) => {
|
|
131
|
-
const ref = (0,
|
|
132
|
-
const [open, setOpen] = (0,
|
|
167
|
+
const Sidebar = ({ children, className, mode = 'defaultClosed', }) => {
|
|
168
|
+
const ref = (0, react_2.useRef)(null);
|
|
169
|
+
const [open, setOpen] = (0, react_2.useState)(mode === 'defaultClosed' ? false : null);
|
|
133
170
|
(0, helpers_1.useOnClickOutside)({ ref }, () => {
|
|
134
171
|
if (!open || window.innerWidth > media_1.smallScreenPx) {
|
|
135
172
|
return;
|
|
136
173
|
}
|
|
137
174
|
setOpen(false);
|
|
138
175
|
});
|
|
139
|
-
return (
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
176
|
+
return (react_2.default.createElement(Base, { "data-type": "sidebar", className: className, "data-open": open, onClick: () => !open && setOpen(true), "data-hover": true, ref: ref },
|
|
177
|
+
react_2.default.createElement(HamburgerB, { "data-hide-on-big": mode === 'fixedOpen', "data-open": open, onClick: (e) => {
|
|
178
|
+
e.stopPropagation();
|
|
179
|
+
setOpen(!open);
|
|
180
|
+
}, "data-hover": true }, open ? react_2.default.createElement(ChevronStyled, { point: "left", width: "100%" }) : react_2.default.createElement(Hamburger_1.Hamburger, null)),
|
|
181
|
+
react_2.default.createElement(ContentBlock, { "data-type": "content-block", "data-open": open },
|
|
182
|
+
react_2.default.createElement(Content, { "data-type": "content", "data-open": open, onClick: (e) => {
|
|
143
183
|
e.stopPropagation();
|
|
144
184
|
} }, children))));
|
|
145
185
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Cog = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const Cog = () => (react_1.default.createElement("svg", { viewBox: "0 0 16 16" },
|
|
9
|
+
react_1.default.createElement("path", { d: "M.63 11.08zm.21.41v-.1zm.23.38L1 11.68zM1 11.68l-.11-.19zm-.21-.29c-.06-.1-.11-.21-.16-.31.05.1.1.21.16.31zm.32.54v-.06z" }),
|
|
10
|
+
react_1.default.createElement("path", { d: "m11.26 12.63 1.83 1.09a7.34 7.34 0 0 0 1-.94 7.48 7.48 0 0 0 1.56-2.86l-1.74-1A5.29 5.29 0 0 0 14 8a5.29 5.29 0 0 0-.08-.9l1.74-1a7.45 7.45 0 0 0-1.33-2.58 7.54 7.54 0 0 0-1.24-1.22l-1.83 1.04a6 6 0 0 0-1.11-.53v-2A8.55 8.55 0 0 0 7.94.53a8.39 8.39 0 0 0-2.26.3v2a7.23 7.23 0 0 0-1.12.54L2.78 2.28A7.46 7.46 0 0 0 .2 6.06l1.72 1a5.29 5.29 0 0 0-.08.9 5.29 5.29 0 0 0 .08.9l-1.73 1a8 8 0 0 0 .43 1.15c.05.1.1.21.16.31v.1l.11.19.12.19v.06a7.69 7.69 0 0 0 1.64 1.78l1.81-1.08a7.23 7.23 0 0 0 1.12.54v2a8.39 8.39 0 0 0 2.26.31 8.56 8.56 0 0 0 2.22-.3v-2a6 6 0 0 0 1.2-.48zm-2.39 1.52a7.57 7.57 0 0 1-.95.06 7.73 7.73 0 0 1-1-.06v-1.69a4.92 4.92 0 0 1-2.53-1.27l-1.54.92a6.22 6.22 0 0 1-1.08-1.61l1.56-.93a4.27 4.27 0 0 1 0-3.17l-1.56-.92a6.11 6.11 0 0 1 1.12-1.62l1.56.93A5 5 0 0 1 7 3.53V1.82a7.73 7.73 0 0 1 1-.06 7.57 7.57 0 0 1 .95.06v1.72a4.9 4.9 0 0 1 2.4 1.26l1.59-.94a6.31 6.31 0 0 1 1.11 1.62l-1.6.94a4.35 4.35 0 0 1 .3 1.58 4.44 4.44 0 0 1-.29 1.55l1.56.93a6.43 6.43 0 0 1-1.11 1.61l-1.58-.93a5 5 0 0 1-2.49 1.28z" }),
|
|
11
|
+
react_1.default.createElement("path", { d: "M7.92 5.49A2.59 2.59 0 0 0 5.25 8a2.59 2.59 0 0 0 2.67 2.51A2.6 2.6 0 0 0 10.6 8a2.6 2.6 0 0 0-2.68-2.51zM8 9.2A1.35 1.35 0 0 1 6.55 8 1.35 1.35 0 0 1 8 6.7 1.35 1.35 0 0 1 9.39 8 1.35 1.35 0 0 1 8 9.2z" })));
|
|
12
|
+
exports.Cog = Cog;
|
|
@@ -0,0 +1,10 @@
|
|
|
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.House = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const House = () => (react_1.default.createElement("svg", { fill: "none", viewBox: "5 5 35 35" },
|
|
9
|
+
react_1.default.createElement("path", { d: "m24.155 8.781.175.164 13.072 12.842L36 23.213l-1.8-1.768L34.201 35a2 2 0 0 1-1.851 1.994l-.149.006h-20a2.001 2.001 0 0 1-1.995-1.851L10.201 35 10.2 21.446l-1.798 1.767L7 21.787 20.058 8.958a3 3 0 0 1 4.097-.177Zm-2.586 1.504-.096.087-9.273 9.109L12.201 35l4.999-.001.001-9.999c0-1.054.816-1.918 1.851-1.995l.149-.005h6c1.054 0 1.918.816 1.995 1.851l.005.149-.001 9.999 5.001.001-.001-15.52-9.299-9.136a1.001 1.001 0 0 0-1.332-.059ZM25.201 25h-6l-.001 9.999h6L25.201 25Z" })));
|
|
10
|
+
exports.House = House;
|
package/dist/ui/icons/index.d.ts
CHANGED
|
@@ -3,11 +3,13 @@ import { Checkmark } from './Checkmark';
|
|
|
3
3
|
import { ChevronRight } from './ChevronRight';
|
|
4
4
|
import { Circle } from './Circle';
|
|
5
5
|
import { CircleDot } from './CircleDot';
|
|
6
|
+
import { Cog } from './Cog';
|
|
6
7
|
import { Computer } from './Computer';
|
|
7
8
|
import { CrossIcon } from './CrossIcon';
|
|
8
9
|
import { Door } from './Door';
|
|
9
10
|
import { Hamburger } from './Hamburger';
|
|
10
11
|
import { HorizontalDots } from './HorizontalDots';
|
|
12
|
+
import { House } from './House';
|
|
11
13
|
import { Magnify } from './Magnify';
|
|
12
14
|
import { Moon } from './Moon';
|
|
13
15
|
import { Pencil } from './Pencil';
|
|
@@ -17,6 +19,7 @@ import { Undo } from './Undo';
|
|
|
17
19
|
import { UserOutline } from './UserOutline';
|
|
18
20
|
import { Warning } from './Warning';
|
|
19
21
|
declare const icons: {
|
|
22
|
+
Cog: () => import("react").JSX.Element;
|
|
20
23
|
Checkmark: ({ style, }: {
|
|
21
24
|
style?: ({
|
|
22
25
|
fill?: string | undefined;
|
|
@@ -45,6 +48,7 @@ declare const icons: {
|
|
|
45
48
|
Hamburger: ({ className }: {
|
|
46
49
|
className?: string | undefined;
|
|
47
50
|
}) => import("react").JSX.Element;
|
|
51
|
+
House: () => import("react").JSX.Element;
|
|
48
52
|
HorizontalDots: import("react").JSX.Element;
|
|
49
53
|
Magnify: ({ style, }: {
|
|
50
54
|
style?: ({
|
|
@@ -69,4 +73,4 @@ declare const icons: {
|
|
|
69
73
|
className?: string | undefined;
|
|
70
74
|
}) => import("react").JSX.Element;
|
|
71
75
|
};
|
|
72
|
-
export { Checkmark, ChevronRight, Circle, CircleDot, Computer, CrossIcon, Door, Hamburger, HorizontalDots, icons, Magnify, Moon, Pencil, Save, Sun, Undo, UserOutline, Warning, };
|
|
76
|
+
export { Checkmark, ChevronRight, Circle, CircleDot, Cog, Computer, CrossIcon, Door, Hamburger, HorizontalDots, House, icons, Magnify, Moon, Pencil, Save, Sun, Undo, UserOutline, Warning, };
|
package/dist/ui/icons/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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;
|
|
3
|
+
exports.Warning = exports.UserOutline = exports.Undo = exports.Sun = exports.Save = exports.Pencil = exports.Moon = exports.Magnify = exports.icons = exports.House = exports.HorizontalDots = exports.Hamburger = exports.Door = exports.CrossIcon = exports.Computer = exports.Cog = exports.CircleDot = exports.Circle = exports.ChevronRight = exports.Checkmark = void 0;
|
|
4
4
|
const Checkmark_1 = require("./Checkmark");
|
|
5
5
|
Object.defineProperty(exports, "Checkmark", { enumerable: true, get: function () { return Checkmark_1.Checkmark; } });
|
|
6
6
|
const ChevronRight_1 = require("./ChevronRight");
|
|
@@ -9,6 +9,8 @@ const Circle_1 = require("./Circle");
|
|
|
9
9
|
Object.defineProperty(exports, "Circle", { enumerable: true, get: function () { return Circle_1.Circle; } });
|
|
10
10
|
const CircleDot_1 = require("./CircleDot");
|
|
11
11
|
Object.defineProperty(exports, "CircleDot", { enumerable: true, get: function () { return CircleDot_1.CircleDot; } });
|
|
12
|
+
const Cog_1 = require("./Cog");
|
|
13
|
+
Object.defineProperty(exports, "Cog", { enumerable: true, get: function () { return Cog_1.Cog; } });
|
|
12
14
|
const Computer_1 = require("./Computer");
|
|
13
15
|
Object.defineProperty(exports, "Computer", { enumerable: true, get: function () { return Computer_1.Computer; } });
|
|
14
16
|
const CrossIcon_1 = require("./CrossIcon");
|
|
@@ -19,6 +21,8 @@ const Hamburger_1 = require("./Hamburger");
|
|
|
19
21
|
Object.defineProperty(exports, "Hamburger", { enumerable: true, get: function () { return Hamburger_1.Hamburger; } });
|
|
20
22
|
const HorizontalDots_1 = require("./HorizontalDots");
|
|
21
23
|
Object.defineProperty(exports, "HorizontalDots", { enumerable: true, get: function () { return HorizontalDots_1.HorizontalDots; } });
|
|
24
|
+
const House_1 = require("./House");
|
|
25
|
+
Object.defineProperty(exports, "House", { enumerable: true, get: function () { return House_1.House; } });
|
|
22
26
|
const Magnify_1 = require("./Magnify");
|
|
23
27
|
Object.defineProperty(exports, "Magnify", { enumerable: true, get: function () { return Magnify_1.Magnify; } });
|
|
24
28
|
const Moon_1 = require("./Moon");
|
|
@@ -36,6 +40,7 @@ Object.defineProperty(exports, "UserOutline", { enumerable: true, get: function
|
|
|
36
40
|
const Warning_1 = require("./Warning");
|
|
37
41
|
Object.defineProperty(exports, "Warning", { enumerable: true, get: function () { return Warning_1.Warning; } });
|
|
38
42
|
const icons = {
|
|
43
|
+
Cog: Cog_1.Cog,
|
|
39
44
|
Checkmark: Checkmark_1.Checkmark,
|
|
40
45
|
ChevronRight: ChevronRight_1.ChevronRight,
|
|
41
46
|
Circle: Circle_1.Circle,
|
|
@@ -44,6 +49,7 @@ const icons = {
|
|
|
44
49
|
CrossIcon: CrossIcon_1.CrossIcon,
|
|
45
50
|
Door: Door_1.Door,
|
|
46
51
|
Hamburger: Hamburger_1.Hamburger,
|
|
52
|
+
House: House_1.House,
|
|
47
53
|
HorizontalDots: HorizontalDots_1.HorizontalDots,
|
|
48
54
|
Magnify: Magnify_1.Magnify,
|
|
49
55
|
Moon: Moon_1.Moon,
|
package/package.json
CHANGED