@ghub/identity-chrome 0.3.0 → 0.4.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/README.md +11 -4
- package/dist/elements/account.d.ts +2 -0
- package/dist/elements/account.js +36 -0
- package/dist/react.d.ts +3 -1
- package/dist/react.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -104,7 +104,13 @@ Every word can be replaced through `labels`; the rest stay English.
|
|
|
104
104
|
|
|
105
105
|
```html
|
|
106
106
|
<div style="display: flex; align-items: center">
|
|
107
|
-
<gp-account
|
|
107
|
+
<gp-account
|
|
108
|
+
layout="row"
|
|
109
|
+
density="compact"
|
|
110
|
+
placement="top"
|
|
111
|
+
align="start"
|
|
112
|
+
style="flex: 1"
|
|
113
|
+
></gp-account>
|
|
108
114
|
<gp-apps placement="top" align="start"></gp-apps>
|
|
109
115
|
</div>
|
|
110
116
|
```
|
|
@@ -114,13 +120,14 @@ account.labels = { organisations: "Groups" };
|
|
|
114
120
|
account.items = [
|
|
115
121
|
{ id: "profile", label: "Profile", href: "/settings/profile", icon: userSvg },
|
|
116
122
|
{ id: "account", label: "Account", href: "/settings/account", icon: settingsSvg },
|
|
117
|
-
{ id: "
|
|
123
|
+
{ id: "shortcuts", label: "Keyboard shortcuts", onSelect: () => openShortcuts(), icon: keysSvg },
|
|
118
124
|
];
|
|
119
125
|
```
|
|
120
126
|
|
|
121
127
|
`layout="row"` draws the trigger as a full width row, the picture with the name over the
|
|
122
|
-
address; `
|
|
123
|
-
|
|
128
|
+
address; `density="compact"` draws the account popup a step smaller (320 wide, tighter rows),
|
|
129
|
+
so it does not cover the rail and half the page; `placement="top"` opens both popups upward.
|
|
130
|
+
Your items follow the organisations under your product's name, as links or as buttons; on a link, `onSelect` may call
|
|
124
131
|
`preventDefault()` and navigate with your own router. An icon is SVG markup on a 24 grid and
|
|
125
132
|
is kept to its shapes. Until you sign in through Identity, Sign out is the last row of your
|
|
126
133
|
items' group; with `viaIdentity` it ends both sessions and stands on its own.
|
|
@@ -35,6 +35,8 @@
|
|
|
35
35
|
* **In a sidebar** (`layout="row"`, `placement="top"`): the trigger is a full
|
|
36
36
|
* width row, the picture with the name over the address, and the popup opens
|
|
37
37
|
* upward from it. A product with a sidebar puts `<gp-apps>` at the row's end.
|
|
38
|
+
* `density="compact"` draws the popup a step smaller (320 wide, tighter rows),
|
|
39
|
+
* so it does not cover the rail and half the page.
|
|
38
40
|
*
|
|
39
41
|
* **The product's own items** (`items`) sit after the organisations, as a group
|
|
40
42
|
* headed with the product's name. Until the product signs in through Identity,
|
package/dist/elements/account.js
CHANGED
|
@@ -36,6 +36,8 @@
|
|
|
36
36
|
* **In a sidebar** (`layout="row"`, `placement="top"`): the trigger is a full
|
|
37
37
|
* width row, the picture with the name over the address, and the popup opens
|
|
38
38
|
* upward from it. A product with a sidebar puts `<gp-apps>` at the row's end.
|
|
39
|
+
* `density="compact"` draws the popup a step smaller (320 wide, tighter rows),
|
|
40
|
+
* so it does not cover the rail and half the page.
|
|
39
41
|
*
|
|
40
42
|
* **The product's own items** (`items`) sit after the organisations, as a group
|
|
41
43
|
* headed with the product's name. Until the product signs in through Identity,
|
|
@@ -258,6 +260,40 @@ exports.ACCOUNT_CSS = `${contract_js_1.CONTRACT_CSS}
|
|
|
258
260
|
.legal a:hover { text-decoration: underline; }
|
|
259
261
|
.legal a:focus-visible { outline: 2px solid var(--_ring); outline-offset: 2px; }
|
|
260
262
|
|
|
263
|
+
/* density="compact": the same popup a step smaller, for a sidebar, where the
|
|
264
|
+
full one covers the rail and half the page. Below 600 it is the same sheet. */
|
|
265
|
+
:host([density="compact"]) .popup:not(.sheet) { width: 320px; padding: 6px 6px 8px; border-radius: 22px; }
|
|
266
|
+
:host([density="compact"]) .top { min-height: 32px; padding-left: 36px; }
|
|
267
|
+
:host([density="compact"]) .context { font-size: 12px; line-height: 16px; }
|
|
268
|
+
:host([density="compact"]) .close { width: 32px; height: 32px; }
|
|
269
|
+
:host([density="compact"]) .card { padding: 14px 14px 14px; border-radius: 18px; gap: 1px; }
|
|
270
|
+
:host([density="compact"]) .portrait { width: 52px; height: 52px; margin-bottom: 8px; }
|
|
271
|
+
:host([density="compact"]) .s72 { width: 52px; height: 52px; font-size: 22px; }
|
|
272
|
+
:host([density="compact"]) .pencil { width: 24px; height: 24px; right: -5px; bottom: -3px; }
|
|
273
|
+
:host([density="compact"]) .name { font-size: 16px; line-height: 21px; }
|
|
274
|
+
:host([density="compact"]) .email { font-size: 13px; line-height: 18px; }
|
|
275
|
+
:host([density="compact"]) .pill {
|
|
276
|
+
min-height: 34px; margin-top: 10px; padding: 0 14px 0 10px; gap: 8px; font-size: 13px; line-height: 18px;
|
|
277
|
+
}
|
|
278
|
+
:host([density="compact"]) .pill img { width: 18px; height: 18px; }
|
|
279
|
+
:host([density="compact"]) .section { margin-top: 4px; }
|
|
280
|
+
:host([density="compact"]) .heading { padding: 6px 12px 2px; font-size: 12px; line-height: 16px; }
|
|
281
|
+
:host([density="compact"]) .heading img { width: 14px; height: 14px; }
|
|
282
|
+
:host([density="compact"]) .stack > :first-child { border-top-left-radius: 14px; border-top-right-radius: 14px; }
|
|
283
|
+
:host([density="compact"]) .stack > :last-child { border-bottom-left-radius: 14px; border-bottom-right-radius: 14px; }
|
|
284
|
+
:host([density="compact"]) .item { min-height: 38px; padding: 0 12px; gap: 10px; font-size: 13px; line-height: 18px; }
|
|
285
|
+
:host([density="compact"]) .item svg, :host([density="compact"]) .signout svg { width: 16px; height: 16px; }
|
|
286
|
+
:host([density="compact"]) .org { min-height: 44px; padding: 5px 12px; gap: 10px; }
|
|
287
|
+
:host([density="compact"]) .wrap > .radios:last-child > .org:last-child { border-radius: 4px 4px 14px 14px; }
|
|
288
|
+
:host([density="compact"]) .org-mark { width: 28px; height: 28px; border-radius: 8px; font-size: 12.5px; }
|
|
289
|
+
:host([density="compact"]) .org-name { font-size: 13px; line-height: 18px; }
|
|
290
|
+
:host([density="compact"]) .org-role { font-size: 11.5px; line-height: 15px; }
|
|
291
|
+
:host([density="compact"]) .active { font-size: 12px; gap: 5px; }
|
|
292
|
+
:host([density="compact"]) .more { min-height: 38px; padding: 0 12px; font-size: 13px; border-radius: 4px 4px 14px 14px; }
|
|
293
|
+
:host([density="compact"]) .signout { min-height: 40px; padding: 0 12px; gap: 10px; font-size: 13px; }
|
|
294
|
+
:host([density="compact"]) .error { padding: 4px 12px 2px; font-size: 12px; line-height: 17px; }
|
|
295
|
+
:host([density="compact"]) .legal { padding: 8px 0 2px; font-size: 11.5px; line-height: 16px; }
|
|
296
|
+
|
|
261
297
|
@media (prefers-reduced-motion: reduce) {
|
|
262
298
|
.popup, .popup.sheet { animation: none; }
|
|
263
299
|
.spinner { animation-duration: 2400ms; }
|
package/dist/react.d.ts
CHANGED
|
@@ -39,11 +39,13 @@ export interface GpAccountProps {
|
|
|
39
39
|
labels?: Partial<AccountLabels>;
|
|
40
40
|
/** `row` for the bottom of a sidebar: the picture with the name over the address, full width. */
|
|
41
41
|
layout?: "button" | "row";
|
|
42
|
+
/** `compact` for a sidebar: the popup a step smaller. */
|
|
43
|
+
density?: "regular" | "compact";
|
|
42
44
|
align?: Align;
|
|
43
45
|
placement?: Placement;
|
|
44
46
|
className?: string;
|
|
45
47
|
}
|
|
46
48
|
/** `<gp-account>`, the account popup. */
|
|
47
|
-
export declare function GpAccount({ core, person, organisations, product, viaIdentity, onSignOut, onSwitch, items, labels, layout, align, placement, className, }: GpAccountProps): ReactElement;
|
|
49
|
+
export declare function GpAccount({ core, person, organisations, product, viaIdentity, onSignOut, onSwitch, items, labels, layout, density, align, placement, className, }: GpAccountProps): ReactElement;
|
|
48
50
|
export {};
|
|
49
51
|
//# sourceMappingURL=react.d.ts.map
|
package/dist/react.js
CHANGED
|
@@ -31,7 +31,7 @@ function GpApps({ core, labels, align, placement, className }) {
|
|
|
31
31
|
return (0, react_1.createElement)("gp-apps", { ref, className, align, placement });
|
|
32
32
|
}
|
|
33
33
|
/** `<gp-account>`, the account popup. */
|
|
34
|
-
function GpAccount({ core, person, organisations = null, product = null, viaIdentity = false, onSignOut = null, onSwitch = null, items = null, labels, layout, align, placement, className, }) {
|
|
34
|
+
function GpAccount({ core, person, organisations = null, product = null, viaIdentity = false, onSignOut = null, onSwitch = null, items = null, labels, layout, density, align, placement, className, }) {
|
|
35
35
|
const ref = (0, react_1.useRef)(null);
|
|
36
36
|
(0, react_1.useEffect)(() => {
|
|
37
37
|
(0, index_js_1.defineChromeElements)();
|
|
@@ -72,6 +72,6 @@ function GpAccount({ core, person, organisations = null, product = null, viaIden
|
|
|
72
72
|
if (ref.current !== null && labels !== undefined)
|
|
73
73
|
ref.current.labels = labels;
|
|
74
74
|
}, [labels]);
|
|
75
|
-
return (0, react_1.createElement)("gp-account", { ref, className, layout, align, placement });
|
|
75
|
+
return (0, react_1.createElement)("gp-account", { ref, className, layout, density, align, placement });
|
|
76
76
|
}
|
|
77
77
|
//# sourceMappingURL=react.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ghub/identity-chrome",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "The shared header controls of the Gelhaus Solutions products: the apps picker and the account popup, as custom elements with shadow DOM and as React wrappers. The browser half (state, cache, the last list held for an outage) and the server half (the token calls and a route handler). No dependencies.",
|
|
5
5
|
"author": "Gelhaus Solutions (Enno Gelhaus) <egelhaus@ennogelhaus.de> (https://ennogelhaus.de)",
|
|
6
6
|
"homepage": "https://ennogelhaus.de",
|