@openameba/spindle-ui 0.45.0 → 0.46.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/CHANGELOG.md +20 -0
- package/DropdownMenu/DropdownMenu.css +1 -0
- package/DropdownMenu/DropdownMenu.d.ts +27 -0
- package/DropdownMenu/DropdownMenu.d.ts.map +1 -0
- package/DropdownMenu/DropdownMenu.js +119 -0
- package/DropdownMenu/DropdownMenu.js.map +1 -0
- package/DropdownMenu/DropdownMenu.mjs +82 -0
- package/DropdownMenu/index.d.ts +2 -0
- package/DropdownMenu/index.d.ts.map +1 -0
- package/DropdownMenu/index.js +6 -0
- package/DropdownMenu/index.js.map +1 -0
- package/DropdownMenu/index.mjs +1 -0
- package/HeroCarousel/HeroCarousel.js +3 -3
- package/HeroCarousel/HeroCarousel.js.map +1 -1
- package/HeroCarousel/HeroCarousel.mjs +3 -3
- package/SnackBar/SnackBar.css +1 -1
- package/SnackBar/SnackBar.d.ts +6 -11
- package/SnackBar/SnackBar.d.ts.map +1 -1
- package/SnackBar/SnackBar.js +43 -20
- package/SnackBar/SnackBar.js.map +1 -1
- package/SnackBar/SnackBar.mjs +40 -18
- package/StackNotificationManager/StackNotificationManager.d.ts +34 -0
- package/StackNotificationManager/StackNotificationManager.d.ts.map +1 -0
- package/StackNotificationManager/StackNotificationManager.js +50 -0
- package/StackNotificationManager/StackNotificationManager.js.map +1 -0
- package/StackNotificationManager/StackNotificationManager.mjs +20 -0
- package/StackNotificationManager/hooks.d.ts +44 -0
- package/StackNotificationManager/hooks.d.ts.map +1 -0
- package/StackNotificationManager/hooks.js +247 -0
- package/StackNotificationManager/hooks.js.map +1 -0
- package/StackNotificationManager/hooks.mjs +220 -0
- package/StackNotificationManager/index.d.ts +3 -0
- package/StackNotificationManager/index.d.ts.map +1 -0
- package/StackNotificationManager/index.js +10 -0
- package/StackNotificationManager/index.js.map +1 -0
- package/StackNotificationManager/index.mjs +2 -0
- package/Toast/Toast.css +1 -1
- package/Toast/Toast.d.ts +7 -5
- package/Toast/Toast.d.ts.map +1 -1
- package/Toast/Toast.js +34 -11
- package/Toast/Toast.js.map +1 -1
- package/Toast/Toast.mjs +31 -9
- package/index.css +1 -1
- package/index.d.ts +2 -1
- package/index.d.ts.map +1 -1
- package/index.js +3 -1
- package/index.js.map +1 -1
- package/index.mjs +2 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,26 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [0.46.0](https://github.com/openameba/spindle/compare/@openameba/spindle-ui@0.45.0...@openameba/spindle-ui@0.46.0) (2022-08-25)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **spindle-ui:** fix SnackBar component interface for stacking feature ([412930e](https://github.com/openameba/spindle/commit/412930e551e167b3f7673089f45c13b7be031621))
|
|
12
|
+
* **spindle-ui:** fix Toast component interface for stacking feature ([1682a0b](https://github.com/openameba/spindle/commit/1682a0b1fcb06f26a92806d3b1b7112b1a009d85))
|
|
13
|
+
* do hooks called by every render to resolve error of react-hooks/rules-of-hooks ([d1b3eea](https://github.com/openameba/spindle/commit/d1b3eea6a7bf3be8549e3b48020b2b5062228955))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* **spindle-ui:** add DropdownMenu component ([70f8a73](https://github.com/openameba/spindle/commit/70f8a730a044c528f85dd70223ed8f0e98345419))
|
|
19
|
+
* **spindle-ui:** add StackNotificationManager for stacking notification components ([e3a6128](https://github.com/openameba/spindle/commit/e3a61284ba8c91285d1148a470e6ee5e0e911f12))
|
|
20
|
+
* **spindle-ui:** update TextButton docs ([5bad71b](https://github.com/openameba/spindle/commit/5bad71bc10f8da467eda755a8f8bf724172a0d6d))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
6
26
|
# [0.45.0](https://github.com/openameba/spindle/compare/@openameba/spindle-ui@0.44.0...@openameba/spindle-ui@0.45.0) (2022-08-18)
|
|
7
27
|
|
|
8
28
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:root{--DropdownMenu-z-index:1;--DropdownMenu-onFocus-outlineColor:var(--color-focus-clarity)}.spui-DropdownMenu{position:relative;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}.spui-DropdownMenu-menu{-webkit-animation:spui-DropdownMenu-fade-in .3s;animation:spui-DropdownMenu-fade-in .3s;background-color:var(--color-surface-primary);border-radius:12px;box-shadow:0 11px 28px rgba(8,18,26,.12);box-sizing:border-box;left:-256px;list-style:none;margin:0;padding:12px 0;position:absolute;top:0;width:256px;z-index:var(--DropdownMenu-z-index)}.spui-DropdownMenu-menu.is-fade-out{-webkit-animation:spui-DropdownMenu-fade-out .3s;animation:spui-DropdownMenu-fade-out .3s;opacity:0}.spui-DropdownMenu-menu--right{left:auto;right:-256px;width:256px}.spui-DropdownMenu-menuButton{align-items:center;background-color:var(--color-surface-primary);border:none;display:flex;font-size:1em;position:relative;transition:background-color .3s;width:100%}.spui-DropdownMenu-menu--text .spui-DropdownMenu-menuButton,.spui-DropdownMenu-menu--textWithIcon .spui-DropdownMenu-menuButton{padding:10px 16px}.spui-DropdownMenu-menu--headWithIcon .spui-DropdownMenu-menuButton{padding:16px}.spui-DropdownMenu-menu--headWithIconAndCaption .spui-DropdownMenu-menuButton{padding:14px 16px}.spui-DropdownMenu-menuButton:hover{background-color:var(--color-surface-secondary)}.spui-DropdownMenu-menuButton:focus-visible{outline:2px solid var(--DropdownMenu-onFocus-outlineColor);z-index:var(--DropdownMenu-z-index)}.spui-DropdownMenu-menuItem .spui-DropdownMenu-menuButton:before{background-color:var(--color-border-low-emphasis);content:"";height:1px;position:absolute;top:0;width:calc(100% - 32px)}.spui-DropdownMenu-menuItem:first-child .spui-DropdownMenu-menuButton:before{height:0}.spui-DropdownMenu-iconContainer{color:var(--color-object-high-emphasis);display:flex;font-size:1.5em;margin-right:16px}.spui-DropdownMenu-textContainer{text-align:left}.spui-DropdownMenu-title{color:var(--color-text-high-emphasis);font-size:1em;line-height:1.3;margin:0}.spui-DropdownMenu-caption{color:var(--color-text-low-emphasis);font-size:.75em;line-height:1.4;margin:4px 0 0}@-webkit-keyframes spui-DropdownMenu-fade-in{0%{opacity:0}to{opacity:1}}@keyframes spui-DropdownMenu-fade-in{0%{opacity:0}to{opacity:1}}@-webkit-keyframes spui-DropdownMenu-fade-out{0%{opacity:1}to{opacity:0}}@keyframes spui-DropdownMenu-fade-out{0%{opacity:1}to{opacity:0}}@media screen and (max-width:768px){.spui-DropdownMenu-menu{left:auto;right:0;top:auto}.spui-DropdownMenu-menu--right{left:0;top:auto}}@media (prefers-reduced-motion:reduce){.spui-DropdownMenu-menu{-webkit-animation:spui-DropdownMenu-fade-in 0s;animation:spui-DropdownMenu-fade-in 0s}.spui-DropdownMenu-menu.is-fade-out{-webkit-animation:spui-DropdownMenu-fade-out 0s;animation:spui-DropdownMenu-fade-out 0s}}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare type Variant = 'text' | 'textWithIcon' | 'headWithIcon' | 'headWithIconAndCaption';
|
|
3
|
+
interface DefaultProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
}
|
|
6
|
+
interface ListItemProps extends DefaultProps {
|
|
7
|
+
icon?: React.ReactNode;
|
|
8
|
+
onClick: () => void;
|
|
9
|
+
}
|
|
10
|
+
interface ListProps extends DefaultProps {
|
|
11
|
+
id?: string;
|
|
12
|
+
onClose: () => void;
|
|
13
|
+
open: boolean;
|
|
14
|
+
position?: 'left' | 'right';
|
|
15
|
+
triggerRef: React.RefObject<HTMLButtonElement>;
|
|
16
|
+
variant?: Variant;
|
|
17
|
+
}
|
|
18
|
+
export declare const BLOCK_NAME = "spui-DropdownMenu";
|
|
19
|
+
export declare const DropdownMenu: {
|
|
20
|
+
Caption: ({ children }: DefaultProps) => JSX.Element;
|
|
21
|
+
Frame: ({ children }: DefaultProps) => JSX.Element;
|
|
22
|
+
List: ({ children, id, onClose, open, position, triggerRef, variant, }: ListProps) => JSX.Element;
|
|
23
|
+
ListItem: ({ children, icon, onClick }: ListItemProps) => JSX.Element;
|
|
24
|
+
Title: ({ children }: DefaultProps) => JSX.Element;
|
|
25
|
+
};
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=DropdownMenu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DropdownMenu.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/DropdownMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAExE,aAAK,OAAO,GACR,MAAM,GACN,cAAc,GACd,cAAc,GACd,wBAAwB,CAAC;AAE7B,UAAU,YAAY;IACpB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,UAAU,aAAc,SAAQ,YAAY;IAC1C,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,UAAU,SAAU,SAAQ,YAAY;IACtC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;IAC/C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,UAAU,sBAAsB,CAAC;AA+H9C,eAAO,MAAM,YAAY;4BA5HM,YAAY;0BAId,YAAY;4EAYtC,SAAS;4CA6FmC,aAAa;0BAW/B,YAAY;CAUxC,CAAC"}
|
|
@@ -0,0 +1,119 @@
|
|
|
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.DropdownMenu = exports.BLOCK_NAME = void 0;
|
|
27
|
+
var react_1 = __importStar(require("react"));
|
|
28
|
+
exports.BLOCK_NAME = 'spui-DropdownMenu';
|
|
29
|
+
var FADE_IN_ANIMATION = 'spui-DropdownMenu-fade-in';
|
|
30
|
+
var Caption = function (_a) {
|
|
31
|
+
var children = _a.children;
|
|
32
|
+
return react_1.default.createElement("p", { className: "".concat(exports.BLOCK_NAME, "-caption") }, children);
|
|
33
|
+
};
|
|
34
|
+
var Frame = function (_a) {
|
|
35
|
+
var children = _a.children;
|
|
36
|
+
return react_1.default.createElement("div", { className: "".concat(exports.BLOCK_NAME) }, children);
|
|
37
|
+
};
|
|
38
|
+
var List = function (_a) {
|
|
39
|
+
var children = _a.children, id = _a.id, onClose = _a.onClose, open = _a.open, _b = _a.position, position = _b === void 0 ? 'left' : _b, triggerRef = _a.triggerRef, _c = _a.variant, variant = _c === void 0 ? 'text' : _c;
|
|
40
|
+
var CLOSE_KEY_LIST = ['Escape', 'Esc'];
|
|
41
|
+
var menuEl = (0, react_1.useRef)(null);
|
|
42
|
+
var _d = (0, react_1.useState)(false), fadeOut = _d[0], setFadeOut = _d[1];
|
|
43
|
+
var onClickBody = (0, react_1.useCallback)(function (e) {
|
|
44
|
+
if (!open)
|
|
45
|
+
return;
|
|
46
|
+
if (triggerRef.current && e.composedPath().includes(triggerRef.current))
|
|
47
|
+
return;
|
|
48
|
+
var menuEl = document.querySelector(".".concat(exports.BLOCK_NAME, "-menu"));
|
|
49
|
+
if (menuEl && e.composedPath().includes(menuEl))
|
|
50
|
+
return;
|
|
51
|
+
setFadeOut(true);
|
|
52
|
+
}, [open, setFadeOut, triggerRef]);
|
|
53
|
+
var onClickCloser = (0, react_1.useCallback)(function () {
|
|
54
|
+
var _a;
|
|
55
|
+
setFadeOut(true);
|
|
56
|
+
(_a = triggerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
57
|
+
}, [setFadeOut, triggerRef]);
|
|
58
|
+
var handleKeyDown = (0, react_1.useCallback)(function (e) {
|
|
59
|
+
if (CLOSE_KEY_LIST.includes(e.key)) {
|
|
60
|
+
onClickCloser();
|
|
61
|
+
}
|
|
62
|
+
}, [onClickCloser]);
|
|
63
|
+
var handleAnimationEnd = (0, react_1.useCallback)(function (event) {
|
|
64
|
+
if (event.animationName === FADE_IN_ANIMATION)
|
|
65
|
+
return;
|
|
66
|
+
onClose();
|
|
67
|
+
setFadeOut(false);
|
|
68
|
+
}, [onClose, setFadeOut]);
|
|
69
|
+
(0, react_1.useEffect)(function () {
|
|
70
|
+
var _a;
|
|
71
|
+
(_a = menuEl.current) === null || _a === void 0 ? void 0 : _a.addEventListener('animationend', handleAnimationEnd, false);
|
|
72
|
+
return function () {
|
|
73
|
+
var _a;
|
|
74
|
+
return (_a = menuEl.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('animationend', handleAnimationEnd, false);
|
|
75
|
+
};
|
|
76
|
+
}, [menuEl, handleAnimationEnd]);
|
|
77
|
+
(0, react_1.useEffect)(function () {
|
|
78
|
+
window.addEventListener('click', onClickBody, false);
|
|
79
|
+
return function () {
|
|
80
|
+
window.removeEventListener('click', onClickBody, false);
|
|
81
|
+
};
|
|
82
|
+
}, [onClickBody]);
|
|
83
|
+
(0, react_1.useEffect)(function () {
|
|
84
|
+
window.addEventListener('keydown', handleKeyDown);
|
|
85
|
+
return function () {
|
|
86
|
+
window.removeEventListener('keydown', handleKeyDown);
|
|
87
|
+
};
|
|
88
|
+
}, [handleKeyDown]);
|
|
89
|
+
if (!open) {
|
|
90
|
+
return react_1.default.createElement(react_1.default.Fragment, null);
|
|
91
|
+
}
|
|
92
|
+
return (react_1.default.createElement("ul", { id: id, onClick: onClickCloser, className: [
|
|
93
|
+
"".concat(exports.BLOCK_NAME, "-menu"),
|
|
94
|
+
"".concat(exports.BLOCK_NAME, "-menu--").concat(variant),
|
|
95
|
+
position === 'right' && "".concat(exports.BLOCK_NAME, "-menu--right"),
|
|
96
|
+
fadeOut && 'is-fade-out',
|
|
97
|
+
]
|
|
98
|
+
.filter(Boolean)
|
|
99
|
+
.join(' '), ref: menuEl, role: "menu" }, children));
|
|
100
|
+
};
|
|
101
|
+
var ListItem = function (_a) {
|
|
102
|
+
var children = _a.children, icon = _a.icon, onClick = _a.onClick;
|
|
103
|
+
return (react_1.default.createElement("li", { className: "".concat(exports.BLOCK_NAME, "-menuItem"), role: "menuItem" },
|
|
104
|
+
react_1.default.createElement("button", { className: "".concat(exports.BLOCK_NAME, "-menuButton"), onClick: onClick },
|
|
105
|
+
icon && react_1.default.createElement("div", { className: "".concat(exports.BLOCK_NAME, "-iconContainer") }, icon),
|
|
106
|
+
react_1.default.createElement("div", { className: "".concat(exports.BLOCK_NAME, "-textContainer") }, children))));
|
|
107
|
+
};
|
|
108
|
+
var Title = function (_a) {
|
|
109
|
+
var children = _a.children;
|
|
110
|
+
return react_1.default.createElement("p", { className: "".concat(exports.BLOCK_NAME, "-title") }, children);
|
|
111
|
+
};
|
|
112
|
+
exports.DropdownMenu = {
|
|
113
|
+
Caption: Caption,
|
|
114
|
+
Frame: Frame,
|
|
115
|
+
List: List,
|
|
116
|
+
ListItem: ListItem,
|
|
117
|
+
Title: Title,
|
|
118
|
+
};
|
|
119
|
+
//# sourceMappingURL=DropdownMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DropdownMenu.js","sourceRoot":"","sources":["../../src/DropdownMenu/DropdownMenu.tsx"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React, { useEffect, useCallback, useRef, useState } from 'react';
|
|
2
|
+
export const BLOCK_NAME = 'spui-DropdownMenu';
|
|
3
|
+
const FADE_IN_ANIMATION = 'spui-DropdownMenu-fade-in';
|
|
4
|
+
const Caption = ({ children }) => {
|
|
5
|
+
return React.createElement("p", { className: `${BLOCK_NAME}-caption` }, children);
|
|
6
|
+
};
|
|
7
|
+
const Frame = ({ children }) => {
|
|
8
|
+
return React.createElement("div", { className: `${BLOCK_NAME}` }, children);
|
|
9
|
+
};
|
|
10
|
+
const List = ({ children, id, onClose, open, position = 'left', triggerRef, variant = 'text', }) => {
|
|
11
|
+
const CLOSE_KEY_LIST = ['Escape', 'Esc'];
|
|
12
|
+
const menuEl = useRef(null);
|
|
13
|
+
const [fadeOut, setFadeOut] = useState(false);
|
|
14
|
+
const onClickBody = useCallback((e) => {
|
|
15
|
+
if (!open)
|
|
16
|
+
return;
|
|
17
|
+
if (triggerRef.current && e.composedPath().includes(triggerRef.current))
|
|
18
|
+
return;
|
|
19
|
+
const menuEl = document.querySelector(`.${BLOCK_NAME}-menu`);
|
|
20
|
+
if (menuEl && e.composedPath().includes(menuEl))
|
|
21
|
+
return;
|
|
22
|
+
setFadeOut(true);
|
|
23
|
+
}, [open, setFadeOut, triggerRef]);
|
|
24
|
+
const onClickCloser = useCallback(() => {
|
|
25
|
+
setFadeOut(true);
|
|
26
|
+
triggerRef.current?.focus();
|
|
27
|
+
}, [setFadeOut, triggerRef]);
|
|
28
|
+
const handleKeyDown = useCallback((e) => {
|
|
29
|
+
if (CLOSE_KEY_LIST.includes(e.key)) {
|
|
30
|
+
onClickCloser();
|
|
31
|
+
}
|
|
32
|
+
}, [onClickCloser]);
|
|
33
|
+
const handleAnimationEnd = useCallback((event) => {
|
|
34
|
+
if (event.animationName === FADE_IN_ANIMATION)
|
|
35
|
+
return;
|
|
36
|
+
onClose();
|
|
37
|
+
setFadeOut(false);
|
|
38
|
+
}, [onClose, setFadeOut]);
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
menuEl.current?.addEventListener('animationend', handleAnimationEnd, false);
|
|
41
|
+
return () => menuEl.current?.removeEventListener('animationend', handleAnimationEnd, false);
|
|
42
|
+
}, [menuEl, handleAnimationEnd]);
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
window.addEventListener('click', onClickBody, false);
|
|
45
|
+
return () => {
|
|
46
|
+
window.removeEventListener('click', onClickBody, false);
|
|
47
|
+
};
|
|
48
|
+
}, [onClickBody]);
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
window.addEventListener('keydown', handleKeyDown);
|
|
51
|
+
return () => {
|
|
52
|
+
window.removeEventListener('keydown', handleKeyDown);
|
|
53
|
+
};
|
|
54
|
+
}, [handleKeyDown]);
|
|
55
|
+
if (!open) {
|
|
56
|
+
return React.createElement(React.Fragment, null);
|
|
57
|
+
}
|
|
58
|
+
return (React.createElement("ul", { id: id, onClick: onClickCloser, className: [
|
|
59
|
+
`${BLOCK_NAME}-menu`,
|
|
60
|
+
`${BLOCK_NAME}-menu--${variant}`,
|
|
61
|
+
position === 'right' && `${BLOCK_NAME}-menu--right`,
|
|
62
|
+
fadeOut && 'is-fade-out',
|
|
63
|
+
]
|
|
64
|
+
.filter(Boolean)
|
|
65
|
+
.join(' '), ref: menuEl, role: "menu" }, children));
|
|
66
|
+
};
|
|
67
|
+
const ListItem = ({ children, icon, onClick }) => {
|
|
68
|
+
return (React.createElement("li", { className: `${BLOCK_NAME}-menuItem`, role: "menuItem" },
|
|
69
|
+
React.createElement("button", { className: `${BLOCK_NAME}-menuButton`, onClick: onClick },
|
|
70
|
+
icon && React.createElement("div", { className: `${BLOCK_NAME}-iconContainer` }, icon),
|
|
71
|
+
React.createElement("div", { className: `${BLOCK_NAME}-textContainer` }, children))));
|
|
72
|
+
};
|
|
73
|
+
const Title = ({ children }) => {
|
|
74
|
+
return React.createElement("p", { className: `${BLOCK_NAME}-title` }, children);
|
|
75
|
+
};
|
|
76
|
+
export const DropdownMenu = {
|
|
77
|
+
Caption,
|
|
78
|
+
Frame,
|
|
79
|
+
List,
|
|
80
|
+
ListItem,
|
|
81
|
+
Title,
|
|
82
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DropdownMenu = void 0;
|
|
4
|
+
var DropdownMenu_1 = require("./DropdownMenu");
|
|
5
|
+
Object.defineProperty(exports, "DropdownMenu", { enumerable: true, get: function () { return DropdownMenu_1.DropdownMenu; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/DropdownMenu/index.ts"],"names":[],"mappings":";;;AAAA,+CAA8C;AAArC,4GAAA,YAAY,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DropdownMenu } from './DropdownMenu';
|
|
@@ -15,13 +15,13 @@ var BLOCK_NAME = 'spui-HeroCarousel';
|
|
|
15
15
|
var ITEM_LINK_CLASS_NAME = 'js-auto-play-carousel-item-link';
|
|
16
16
|
exports.HeroCarousel = react_1.default.memo(function HeroCarousel(_a) {
|
|
17
17
|
var carouselList = _a.carouselList;
|
|
18
|
-
if (carouselList.length === 0) {
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
18
|
var _b = (0, useAutoPlayCarousel_1.useAutoPlayCarousel)({
|
|
22
19
|
items: carouselList,
|
|
23
20
|
itemLinkClassName: ITEM_LINK_CLASS_NAME,
|
|
24
21
|
}), handleSlideToPrev = _b.handleSlideToPrev, handleSlideToNext = _b.handleSlideToNext, handleMouseEnter = _b.handleMouseEnter, handleMouseDown = _b.handleMouseDown, handleMouseLeave = _b.handleMouseLeave, handleTouchStart = _b.handleTouchStart, handleTransitionEnd = _b.handleTransitionEnd, isAutoPlaying = _b.isAutoPlaying, isLinkClicked = _b.isLinkClicked, itemsToRender = _b.itemsToRender, listRef = _b.listRef, listStyles = _b.listStyles, toggleAutoPlay = _b.toggleAutoPlay, handleFocus = _b.handleFocus, handleBlur = _b.handleBlur;
|
|
22
|
+
if (carouselList.length === 0) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
25
|
return (react_1.default.createElement("div", null,
|
|
26
26
|
react_1.default.createElement("div", { className: "".concat(BLOCK_NAME, "-container"), onBlur: handleBlur, onFocus: handleFocus, onMouseDown: handleMouseDown, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onTouchStart: handleTouchStart, onTransitionEnd: handleTransitionEnd },
|
|
27
27
|
react_1.default.createElement("ul", { "aria-roledescription": "\u30AB\u30EB\u30FC\u30BB\u30EB", className: "".concat(BLOCK_NAME, "-list"), ref: listRef, role: "group", style: listStyles }, itemsToRender.map(function (item, index) { return (react_1.default.createElement(HeroCarouselItem_1.default, { carouselItem: item, isLinkClicked: isLinkClicked, itemLinkClassName: ITEM_LINK_CLASS_NAME, key: "hero-carousel-".concat(index) })); }))),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeroCarousel.js","sourceRoot":"","sources":["../../src/HeroCarousel/HeroCarousel.tsx"],"names":[],"mappings":";;;;;;AAAA,gDAAkC;AAClC,4EAAsD;AACtD,8EAAwD;AACxD,wDAAkC;AAClC,8DAAwC;AAExC,wEAAkD;AAClD,mEAAkE;AAMlE,IAAM,UAAU,GAAG,mBAAmB,CAAC;AACvC,IAAM,oBAAoB,GAAG,iCAAiC,CAAC;AAElD,QAAA,YAAY,GAAc,eAAK,CAAC,IAAI,CAAC,SAAS,YAAY,CAAC,EAEvE;QADC,YAAY,kBAAA;
|
|
1
|
+
{"version":3,"file":"HeroCarousel.js","sourceRoot":"","sources":["../../src/HeroCarousel/HeroCarousel.tsx"],"names":[],"mappings":";;;;;;AAAA,gDAAkC;AAClC,4EAAsD;AACtD,8EAAwD;AACxD,wDAAkC;AAClC,8DAAwC;AAExC,wEAAkD;AAClD,mEAAkE;AAMlE,IAAM,UAAU,GAAG,mBAAmB,CAAC;AACvC,IAAM,oBAAoB,GAAG,iCAAiC,CAAC;AAElD,QAAA,YAAY,GAAc,eAAK,CAAC,IAAI,CAAC,SAAS,YAAY,CAAC,EAEvE;QADC,YAAY,kBAAA;IAEN,IAAA,KAgBF,IAAA,yCAAmB,EAAC;QACtB,KAAK,EAAE,YAAY;QACnB,iBAAiB,EAAE,oBAAoB;KACxC,CAAC,EAlBA,iBAAiB,uBAAA,EACjB,iBAAiB,uBAAA,EACjB,gBAAgB,sBAAA,EAChB,eAAe,qBAAA,EACf,gBAAgB,sBAAA,EAChB,gBAAgB,sBAAA,EAChB,mBAAmB,yBAAA,EACnB,aAAa,mBAAA,EACb,aAAa,mBAAA,EACb,aAAa,mBAAA,EACb,OAAO,aAAA,EACP,UAAU,gBAAA,EACV,cAAc,oBAAA,EACd,WAAW,iBAAA,EACX,UAAU,gBAIV,CAAC;IAEH,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE;QAC7B,OAAO,IAAI,CAAC;KACb;IAED,OAAO,CACL;QACE,uCACE,SAAS,EAAE,UAAG,UAAU,eAAY,EACpC,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,WAAW,EACpB,WAAW,EAAE,eAAe,EAC5B,YAAY,EAAE,gBAAgB,EAC9B,YAAY,EAAE,gBAAgB,EAC9B,YAAY,EAAE,gBAAgB,EAC9B,eAAe,EAAE,mBAAmB;YAEpC,8DACuB,gCAAO,EAC5B,SAAS,EAAE,UAAG,UAAU,UAAO,EAC/B,GAAG,EAAE,OAAO,EACZ,IAAI,EAAC,OAAO,EACZ,KAAK,EAAE,UAAU,IAEhB,aAAa,CAAC,GAAG,CAAC,UAAC,IAAkB,EAAE,KAAa,IAAK,OAAA,CACxD,8BAAC,0BAAgB,IACf,YAAY,EAAE,IAAI,EAClB,aAAa,EAAE,aAAa,EAC5B,iBAAiB,EAAE,oBAAoB,EACvC,GAAG,EAAE,wBAAiB,KAAK,CAAE,GAC7B,CACH,EAPyD,CAOzD,CAAC,CACC,CACD;QAEN,uCAAK,SAAS,EAAE,UAAG,UAAU,cAAW;YACtC,wDACa,+DAAa,EACxB,SAAS,EAAE,UAAG,UAAU,sBAAY,UAAU,mBAAgB,EAC9D,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,iBAAiB;gBAE1B,8BAAC,yBAAe,mBAAc,IAAI,GAAI,CAC/B;YACT,wDACc,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EACjD,SAAS,EAAE,UAAG,UAAU,aAAU,EAClC,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,cAAc,IAEtB,aAAa,CAAC,CAAC,CAAC,CACf,8BAAC,eAAK,mBAAc,IAAI,GAAI,CAC7B,CAAC,CAAC,CAAC,CACF,8BAAC,kBAAQ,mBAAc,IAAI,GAAI,CAChC,CACM;YACT,wDACa,qEAAc,EACzB,SAAS,EAAE,UAAG,UAAU,sBAAY,UAAU,mBAAgB,EAC9D,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,iBAAiB;gBAE1B,8BAAC,0BAAgB,mBAAc,IAAI,GAAI,CAChC,CACL,CACF,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -8,13 +8,13 @@ import { useAutoPlayCarousel } from './hooks/useAutoPlayCarousel';
|
|
|
8
8
|
const BLOCK_NAME = 'spui-HeroCarousel';
|
|
9
9
|
const ITEM_LINK_CLASS_NAME = 'js-auto-play-carousel-item-link';
|
|
10
10
|
export const HeroCarousel = React.memo(function HeroCarousel({ carouselList, }) {
|
|
11
|
-
if (carouselList.length === 0) {
|
|
12
|
-
return null;
|
|
13
|
-
}
|
|
14
11
|
const { handleSlideToPrev, handleSlideToNext, handleMouseEnter, handleMouseDown, handleMouseLeave, handleTouchStart, handleTransitionEnd, isAutoPlaying, isLinkClicked, itemsToRender, listRef, listStyles, toggleAutoPlay, handleFocus, handleBlur, } = useAutoPlayCarousel({
|
|
15
12
|
items: carouselList,
|
|
16
13
|
itemLinkClassName: ITEM_LINK_CLASS_NAME,
|
|
17
14
|
});
|
|
15
|
+
if (carouselList.length === 0) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
18
|
return (React.createElement("div", null,
|
|
19
19
|
React.createElement("div", { className: `${BLOCK_NAME}-container`, onBlur: handleBlur, onFocus: handleFocus, onMouseDown: handleMouseDown, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onTouchStart: handleTouchStart, onTransitionEnd: handleTransitionEnd },
|
|
20
20
|
React.createElement("ul", { "aria-roledescription": "\u30AB\u30EB\u30FC\u30BB\u30EB", className: `${BLOCK_NAME}-list`, ref: listRef, role: "group", style: listStyles }, itemsToRender.map((item, index) => (React.createElement(HeroCarouselItem, { carouselItem: item, isLinkClicked: isLinkClicked, itemLinkClassName: ITEM_LINK_CLASS_NAME, key: `hero-carousel-${index}` }))))),
|
package/SnackBar/SnackBar.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{--IconButton-tapHighlightColor:var(--gray-5-alpha);--IconButton-onFocus-outlineColor:var(--color-focus-clarity);--IconButton--contained-backgroundColor:var(--color-surface-accent-primary);--IconButton--contained-color:var(--color-object-high-emphasis-inverse);--IconButton--contained-onActive-backgroundColor:var(--primary-green-100);--IconButton--contained-onHover-backgroundColor:var(--primary-green-100);--IconButton--outlined-borderColor:var(--color-border-accent-primary);--IconButton--outlined-color:var(--color-object-accent-primary);--IconButton--outlined-onActive-backgroundColor:var(--primary-green-5);--IconButton--outlined-onHover-backgroundColor:var(--primary-green-5);--IconButton--lighted-backgroundColor:var(--color-surface-accent-primary-light);--IconButton--lighted-color:var(--color-object-accent-primary);--IconButton--lighted-onActive-backgroundColor:var(--primary-green-10);--IconButton--lighted-onHover-backgroundColor:var(--primary-green-10);--IconButton--neutral-backgroundColor:var(--color-surface-tertiary);--IconButton--neutral-color:var(--color-object-medium-emphasis);--IconButton--neutral-onActive-backgroundColor:var(--gray-20-alpha);--IconButton--neutral-onHover-backgroundColor:var(--gray-20-alpha);--IconButton--danger-borderColor:var(--color-border-caution);--IconButton--danger-color:var(--color-object-caution);--IconButton--danger-onActive-backgroundColor:var(--caution-red-5-alpha);--IconButton--danger-onHover-backgroundColor:var(--caution-red-5-alpha)}.spui-IconButton{align-items:center;border-radius:100%;box-sizing:border-box;display:inline-flex;justify-content:center;margin:0;padding:0;-webkit-tap-highlight-color:var(--IconButton-tapHighlightColor);text-align:center;transition:background-color .3s}.spui-IconButton:disabled{opacity:.3}.spui-IconButton:focus{outline:2px solid var(--IconButton-onFocus-outlineColor);outline-offset:1px}.spui-IconButton:focus:not(:focus-visible){outline:none}.spui-IconButton--large{font-size:1.375em;height:48px;width:48px}.spui-IconButton--medium{font-size:1.25em;height:40px;width:40px}.spui-IconButton--small{font-size:1em;height:32px;width:32px}.spui-IconButton--exSmall{font-size:1em;height:24px;width:24px}.spui-IconButton--contained{background-color:var(--IconButton--contained-backgroundColor);border:none;color:var(--IconButton--contained-color)}.spui-IconButton--contained:active{background-color:var(--IconButton--contained-onActive-backgroundColor)}@media (hover:hover){.spui-IconButton--contained:not([disabled]):hover{background-color:var(--IconButton--contained-onHover-backgroundColor)}}.spui-IconButton--outlined{background-color:transparent;border:2px solid var(--IconButton--outlined-borderColor);color:var(--IconButton--outlined-color)}.spui-IconButton--outlined:active{background-color:var(--IconButton--outlined-onActive-backgroundColor)}@media (hover:hover){.spui-IconButton--outlined:not([disabled]):hover{background-color:var(--IconButton--outlined-onHover-backgroundColor)}}.spui-IconButton--lighted{background-color:var(--IconButton--lighted-backgroundColor);border:none;color:var(--IconButton--lighted-color);padding-bottom:8px;padding-top:8px}.spui-IconButton--lighted:active{background-color:var(--IconButton--lighted-onActive-backgroundColor)}@media (hover:hover){.spui-IconButton--lighted:not([disabled]):hover{background-color:var(--IconButton--lighted-onHover-backgroundColor)}}.spui-IconButton--neutral{background-color:var(--IconButton--neutral-backgroundColor);border:none;color:var(--IconButton--neutral-color)}.spui-IconButton--neutral:active{background-color:var(--IconButton--neutral-onActive-backgroundColor)}@media (hover:hover){.spui-IconButton--neutral:not([disabled]):hover{background-color:var(--IconButton--neutral-onHover-backgroundColor)}}.spui-IconButton--danger{background-color:transparent;border:2px solid var(--IconButton--danger-borderColor);color:var(--IconButton--danger-color)}.spui-IconButton--danger:active{background-color:var(--IconButton--danger-onActive-backgroundColor)}@media (hover:hover){.spui-IconButton--danger:hover{background-color:var(--IconButton--danger-onHover-backgroundColor)}}:root{--TextLink-tapHighlightColor:var(--white-60-alpha);--TextLink-onFocus-outlineColor:var(--color-focus-clarity);--TextLink-color:var(--color-text-accent-primary);--TextLink-icon-color:var(--color-object-accent-primary);--TextLink-fontWeight:bold;--TextLink--subtle-color:var(--color-text-low-emphasis);--TextLink--subtle-icon-color:var(--color-object-low-emphasis)}.spui-TextLink{border-radius:4px;color:var(--TextLink-color);font-family:inherit;font-weight:var(--TextLink-fontWeight);-webkit-tap-highlight-color:var(--TextLink-tapHighlightColor)}.spui-TextLink:focus{outline:2px solid var(--TextLink-onFocus-outlineColor);outline-offset:1px}.spui-TextLink:focus:not(:focus-visible){outline:none}.spui-TextLink--subtle{color:var(--TextLink--subtle-color)}.spui-TextLink--hasIcon{align-items:center;display:inline-flex}.spui-TextLink-icon{line-height:0}.spui-TextLink--iconstart .spui-TextLink-icon{margin-right:4px}.spui-TextLink--iconend{flex-direction:row-reverse}.spui-TextLink--iconend .spui-TextLink-icon{margin-left:4px}.spui-TextLink{text-decoration:underline}.spui-TextLink--hasIcon,.spui-TextLink--underlinehover{text-decoration:none}@media (hover:hover){.spui-TextLink:hover{text-decoration:none}:is(.spui-TextLink--hasIcon,.spui-TextLink--underlinehover):hover{text-decoration:underline}}:root{--TextButton-tapHighlightColor:var(--white-60-alpha);--TextButton-onFocus-outlineColor:var(--color-focus-clarity);--TextButton-color:var(--color-text-accent-primary);--TextButton-icon-color:var(--color-object-accent-primary);--TextButton-fontWeight:bold;--TextButton--subtle-color:var(--color-text-low-emphasis);--TextButton--subtle-icon-color:var(--color-object-low-emphasis)}.spui-TextButton{background:none;border:none;border-radius:4px;color:var(--TextButton-color);font-family:inherit;font-size:1em;font-weight:var(--TextButton-fontWeight);margin:0;padding:0;-webkit-tap-highlight-color:var(--TextButton-tapHighlightColor)}.spui-TextButton:focus{outline:2px solid var(--TextButton-onFocus-outlineColor);outline-offset:1px}.spui-TextButton:focus:not(:focus-visible){outline:none}.spui-TextButton--subtle{color:var(--TextButton--subtle-color)}.spui-TextButton--hasIcon{align-items:center;display:inline-flex}.spui-TextButton-icon{line-height:0}.spui-TextButton--iconstart .spui-TextButton-icon{margin-right:4px}.spui-TextButton--iconend{flex-direction:row-reverse}.spui-TextButton--iconend .spui-TextButton-icon{margin-left:4px}.spui-TextButton{text-decoration:underline}.spui-TextButton--hasIcon,.spui-TextButton--underlinehover{text-decoration:none}@media (hover:hover){.spui-TextButton:hover{text-decoration:none}:is(.spui-TextButton--hasIcon,.spui-TextButton--underlinehover):hover{text-decoration:underline}}:root{--SnackBar-z-index:1;--SnackBar-onFocus-outlineColor:var(--color-focus-clarity)}.spui-SnackBar{box-sizing:border-box;left:0;padding:0 var(--SnackBar--offset-right) 0 var(--SnackBar--offset-left);position:fixed;right:0;text-align:var(--SnackBar--text-align);z-index:var(--SnackBar-z-index)}.spui-SnackBar-content{align-items:center;border-radius:16px;box-shadow:0 11px 28px rgba(8,18,26,.24);box-sizing:border-box;display:inline-grid;grid-template:"Icon Text Button IconButton" auto/auto 1fr auto auto;max-width:440px;min-height:52px;min-width:360px;padding:14px 16px 14px 20px}.spui-SnackBar-icon{flex-shrink:0;font-size:1.375rem;grid-area:Icon;line-height:0;margin-right:12px}.spui-SnackBar-text{--SnackBar-max-lines:3;font-family:inherit;font-size:.875rem;font-weight:700;grid-area:Text;line-height:1.6;max-height:calc(1.6em*var(--SnackBar-max-lines));overflow:hidden;text-align:left}.spui-SnackBar-button{font-size:.875rem;grid-area:Button;margin-left:16px;margin-right:13px;position:relative}.spui-SnackBar-button:after{bottom:0;content:"";display:inline-block;position:absolute;right:-12px;top:0;width:1px}.spui-SnackBar--top{top:0;transform:translateY(calc(var(--SnackBar--initial-height-top) - var(--SnackBar--offset-top)))}.spui-SnackBar--bottom{bottom:0;transform:translateY(calc(var(--SnackBar--initial-height-bottom)*-1 - var(--SnackBar--offset-bottom)*-1))}.spui-SnackBar--slide{opacity:0;transition:transform .3s ease,opacity .3s ease}.spui-SnackBar--hidden{visibility:hidden}.spui-SnackBar-slide--in{opacity:1;transition:transform .5s ease,opacity .5s ease}.spui-SnackBar-slide--in.spui-SnackBar--top{transform:translateY(var(--SnackBar--order-offset-top))}.spui-SnackBar-slide--in.spui-SnackBar--bottom{transform:translateY(var(--SnackBar--order-offset-bottom))}.spui-SnackBar-iconButton{--IconButton--neutral-backgroundColor:transparent;grid-area:IconButton;margin-left:12px}.spui-SnackBar-content--information{background-color:var(--gray-80);color:var(--color-text-high-emphasis-inverse)}.spui-SnackBar-iconButton--information{--IconButton--neutral-onActive-backgroundColor:var(--white-20-alpha);--IconButton--neutral-onHover-backgroundColor:var(--white-20-alpha);--IconButton--neutral-color:var(--color-object-high-emphasis-inverse)}.spui-SnackBar-button--information{--TextLink-color:var(--color-text-high-emphasis-inverse);--TextLink-icon-color:var(--color-object-high-emphasis-inverse);--TextButton-color:var(--color-text-high-emphasis-inverse);--TextButton-icon-color:var(--color-object-high-emphasis-inverse)}.spui-SnackBar-button--information:after{background:var(--white-20-alpha)}.spui-SnackBar-content--confirmation{background-color:var(--color-surface-primary);border:2px solid var(--color-border-low-emphasis);color:var(--color-text-accent-primary)}.spui-SnackBar-iconButton--confirmation{--IconButton--neutral-onActive-backgroundColor:var(--gray-20-alpha);--IconButton--neutral-onHover-backgroundColor:var(--gray-20-alpha);--IconButton--neutral-color:var(--color-object-low-emphasis)}.spui-SnackBar-button--confirmation{--TextLink-color:var(--color-text-low-emphasis);--TextLink-icon-color:var(--color-object-low-emphasis);--TextButton-color:var(--color-text-low-emphasis);--TextButton-icon-color:var(--color-object-low-emphasis)}.spui-SnackBar-button--confirmation:after{background:var(--color-border-low-emphasis)}.spui-SnackBar-content--error{background-color:var(--color-surface-caution);color:var(--color-text-high-emphasis-inverse)}.spui-SnackBar-iconButton--error{--IconButton--neutral-onActive-backgroundColor:var(--white-20-alpha);--IconButton--neutral-onHover-backgroundColor:var(--white-20-alpha);--IconButton--neutral-color:var(--color-object-high-emphasis-inverse)}.spui-SnackBar-button--error{--TextLink-color:var(--color-text-high-emphasis-inverse);--TextLink-icon-color:var(--color-object-high-emphasis-inverse);--TextButton-color:var(--color-text-high-emphasis-inverse);--TextButton-icon-color:var(--color-object-high-emphasis-inverse)}.spui-SnackBar-button--error:after{background:var(--white-20-alpha)}@media (prefers-reduced-motion:reduce){.spui-SnackBar--slide,.spui-SnackBar-slide--in{transition-duration:.1ms}}@media (max-width:464px){.spui-SnackBar{padding:0 12px;text-align:center;bottom:0;top:unset;transform:translateY(calc(var(--SnackBar--initial-height-bottom)*-1 - var(--SnackBar--offset-bottom)*-1))}.spui-SnackBar-slide--in.spui-SnackBar--top{transform:translateY(var(--SnackBar--order-offset-bottom))}.spui-SnackBar-content{border-radius:82px;max-width:400px;min-width:calc(100% - 24px);padding:14px 16px 14px 20px}}@media (max-width:320px){.spui-SnackBar-text{--SnackBar-max-lines:4}}
|
|
1
|
+
:root{--IconButton-tapHighlightColor:var(--gray-5-alpha);--IconButton-onFocus-outlineColor:var(--color-focus-clarity);--IconButton--contained-backgroundColor:var(--color-surface-accent-primary);--IconButton--contained-color:var(--color-object-high-emphasis-inverse);--IconButton--contained-onActive-backgroundColor:var(--primary-green-100);--IconButton--contained-onHover-backgroundColor:var(--primary-green-100);--IconButton--outlined-borderColor:var(--color-border-accent-primary);--IconButton--outlined-color:var(--color-object-accent-primary);--IconButton--outlined-onActive-backgroundColor:var(--primary-green-5);--IconButton--outlined-onHover-backgroundColor:var(--primary-green-5);--IconButton--lighted-backgroundColor:var(--color-surface-accent-primary-light);--IconButton--lighted-color:var(--color-object-accent-primary);--IconButton--lighted-onActive-backgroundColor:var(--primary-green-10);--IconButton--lighted-onHover-backgroundColor:var(--primary-green-10);--IconButton--neutral-backgroundColor:var(--color-surface-tertiary);--IconButton--neutral-color:var(--color-object-medium-emphasis);--IconButton--neutral-onActive-backgroundColor:var(--gray-20-alpha);--IconButton--neutral-onHover-backgroundColor:var(--gray-20-alpha);--IconButton--danger-borderColor:var(--color-border-caution);--IconButton--danger-color:var(--color-object-caution);--IconButton--danger-onActive-backgroundColor:var(--caution-red-5-alpha);--IconButton--danger-onHover-backgroundColor:var(--caution-red-5-alpha)}.spui-IconButton{align-items:center;border-radius:100%;box-sizing:border-box;display:inline-flex;justify-content:center;margin:0;padding:0;-webkit-tap-highlight-color:var(--IconButton-tapHighlightColor);text-align:center;transition:background-color .3s}.spui-IconButton:disabled{opacity:.3}.spui-IconButton:focus{outline:2px solid var(--IconButton-onFocus-outlineColor);outline-offset:1px}.spui-IconButton:focus:not(:focus-visible){outline:none}.spui-IconButton--large{font-size:1.375em;height:48px;width:48px}.spui-IconButton--medium{font-size:1.25em;height:40px;width:40px}.spui-IconButton--small{font-size:1em;height:32px;width:32px}.spui-IconButton--exSmall{font-size:1em;height:24px;width:24px}.spui-IconButton--contained{background-color:var(--IconButton--contained-backgroundColor);border:none;color:var(--IconButton--contained-color)}.spui-IconButton--contained:active{background-color:var(--IconButton--contained-onActive-backgroundColor)}@media (hover:hover){.spui-IconButton--contained:not([disabled]):hover{background-color:var(--IconButton--contained-onHover-backgroundColor)}}.spui-IconButton--outlined{background-color:transparent;border:2px solid var(--IconButton--outlined-borderColor);color:var(--IconButton--outlined-color)}.spui-IconButton--outlined:active{background-color:var(--IconButton--outlined-onActive-backgroundColor)}@media (hover:hover){.spui-IconButton--outlined:not([disabled]):hover{background-color:var(--IconButton--outlined-onHover-backgroundColor)}}.spui-IconButton--lighted{background-color:var(--IconButton--lighted-backgroundColor);border:none;color:var(--IconButton--lighted-color);padding-bottom:8px;padding-top:8px}.spui-IconButton--lighted:active{background-color:var(--IconButton--lighted-onActive-backgroundColor)}@media (hover:hover){.spui-IconButton--lighted:not([disabled]):hover{background-color:var(--IconButton--lighted-onHover-backgroundColor)}}.spui-IconButton--neutral{background-color:var(--IconButton--neutral-backgroundColor);border:none;color:var(--IconButton--neutral-color)}.spui-IconButton--neutral:active{background-color:var(--IconButton--neutral-onActive-backgroundColor)}@media (hover:hover){.spui-IconButton--neutral:not([disabled]):hover{background-color:var(--IconButton--neutral-onHover-backgroundColor)}}.spui-IconButton--danger{background-color:transparent;border:2px solid var(--IconButton--danger-borderColor);color:var(--IconButton--danger-color)}.spui-IconButton--danger:active{background-color:var(--IconButton--danger-onActive-backgroundColor)}@media (hover:hover){.spui-IconButton--danger:hover{background-color:var(--IconButton--danger-onHover-backgroundColor)}}:root{--TextLink-tapHighlightColor:var(--white-60-alpha);--TextLink-onFocus-outlineColor:var(--color-focus-clarity);--TextLink-color:var(--color-text-accent-primary);--TextLink-icon-color:var(--color-object-accent-primary);--TextLink-fontWeight:bold;--TextLink--subtle-color:var(--color-text-low-emphasis);--TextLink--subtle-icon-color:var(--color-object-low-emphasis)}.spui-TextLink{border-radius:4px;color:var(--TextLink-color);font-family:inherit;font-weight:var(--TextLink-fontWeight);-webkit-tap-highlight-color:var(--TextLink-tapHighlightColor)}.spui-TextLink:focus{outline:2px solid var(--TextLink-onFocus-outlineColor);outline-offset:1px}.spui-TextLink:focus:not(:focus-visible){outline:none}.spui-TextLink--subtle{color:var(--TextLink--subtle-color)}.spui-TextLink--hasIcon{align-items:center;display:inline-flex}.spui-TextLink-icon{line-height:0}.spui-TextLink--iconstart .spui-TextLink-icon{margin-right:4px}.spui-TextLink--iconend{flex-direction:row-reverse}.spui-TextLink--iconend .spui-TextLink-icon{margin-left:4px}.spui-TextLink{text-decoration:underline}.spui-TextLink--hasIcon,.spui-TextLink--underlinehover{text-decoration:none}@media (hover:hover){.spui-TextLink:hover{text-decoration:none}:is(.spui-TextLink--hasIcon,.spui-TextLink--underlinehover):hover{text-decoration:underline}}:root{--TextButton-tapHighlightColor:var(--white-60-alpha);--TextButton-onFocus-outlineColor:var(--color-focus-clarity);--TextButton-color:var(--color-text-accent-primary);--TextButton-icon-color:var(--color-object-accent-primary);--TextButton-fontWeight:bold;--TextButton--subtle-color:var(--color-text-low-emphasis);--TextButton--subtle-icon-color:var(--color-object-low-emphasis)}.spui-TextButton{background:none;border:none;border-radius:4px;color:var(--TextButton-color);font-family:inherit;font-size:1em;font-weight:var(--TextButton-fontWeight);margin:0;padding:0;-webkit-tap-highlight-color:var(--TextButton-tapHighlightColor)}.spui-TextButton:focus{outline:2px solid var(--TextButton-onFocus-outlineColor);outline-offset:1px}.spui-TextButton:focus:not(:focus-visible){outline:none}.spui-TextButton--subtle{color:var(--TextButton--subtle-color)}.spui-TextButton--hasIcon{align-items:center;display:inline-flex}.spui-TextButton-icon{line-height:0}.spui-TextButton--iconstart .spui-TextButton-icon{margin-right:4px}.spui-TextButton--iconend{flex-direction:row-reverse}.spui-TextButton--iconend .spui-TextButton-icon{margin-left:4px}.spui-TextButton{text-decoration:underline}.spui-TextButton--hasIcon,.spui-TextButton--underlinehover{text-decoration:none}@media (hover:hover){.spui-TextButton:hover{text-decoration:none}:is(.spui-TextButton--hasIcon,.spui-TextButton--underlinehover):hover{text-decoration:underline}}:root{--SnackBar-z-index:1;--SnackBar-onFocus-outlineColor:var(--color-focus-clarity)}.spui-SnackBar{box-sizing:border-box;left:0;opacity:0;padding:0 var(--SnackBar--offset-right) 0 var(--SnackBar--offset-left);pointer-events:none;position:fixed;right:0;text-align:var(--SnackBar--text-align);z-index:var(--SnackBar-z-index)}.spui-SnackBar-content{align-items:center;border-radius:16px;box-shadow:0 11px 28px rgba(8,18,26,.24);box-sizing:border-box;display:inline-grid;grid-template:"Icon Text Button IconButton" auto/auto 1fr auto auto;max-width:440px;min-height:52px;min-width:360px;padding:14px 16px 14px 20px;pointer-events:auto}.spui-SnackBar-icon{flex-shrink:0;font-size:1.375rem;grid-area:Icon;line-height:0;margin-right:12px}.spui-SnackBar-text{--SnackBar-max-lines:3;font-family:inherit;font-size:.875rem;font-weight:700;grid-area:Text;line-height:1.6;max-height:calc(1.6em*var(--SnackBar-max-lines));overflow:hidden;text-align:left}.spui-SnackBar-button{font-size:.875rem;grid-area:Button;margin-left:16px;margin-right:13px;position:relative}.spui-SnackBar-button:after{bottom:0;content:"";display:inline-block;position:absolute;right:-12px;top:0;width:1px}.spui-SnackBar--top{top:0;transform:translateY(calc(var(--SnackBar--initial-height-top) - var(--SnackBar--offset-top)))}.spui-SnackBar--bottom{bottom:0;transform:translateY(calc(var(--SnackBar--initial-height-bottom)*-1 - var(--SnackBar--offset-bottom)*-1))}.spui-SnackBar--slide{transition:transform .3s ease,opacity .3s ease}.spui-SnackBar--hidden{visibility:hidden}.spui-SnackBar-slide--in{opacity:1;transition:transform .5s ease,opacity .5s ease}.spui-SnackBar-slide--in.spui-SnackBar--top{transform:translateY(var(--SnackBar--order-offset-top))}.spui-SnackBar-slide--in.spui-SnackBar--bottom{transform:translateY(var(--SnackBar--order-offset-bottom))}.spui-SnackBar-iconButton{--IconButton--neutral-backgroundColor:transparent;grid-area:IconButton;margin-left:12px}.spui-SnackBar-content--information{background-color:var(--gray-80);color:var(--color-text-high-emphasis-inverse)}.spui-SnackBar-iconButton--information{--IconButton--neutral-onActive-backgroundColor:var(--white-20-alpha);--IconButton--neutral-onHover-backgroundColor:var(--white-20-alpha);--IconButton--neutral-color:var(--color-object-high-emphasis-inverse)}.spui-SnackBar-button--information{--TextLink-color:var(--color-text-high-emphasis-inverse);--TextLink-icon-color:var(--color-object-high-emphasis-inverse);--TextButton-color:var(--color-text-high-emphasis-inverse);--TextButton-icon-color:var(--color-object-high-emphasis-inverse)}.spui-SnackBar-button--information:after{background:var(--white-20-alpha)}.spui-SnackBar-content--confirmation{background-color:var(--color-surface-primary);border:2px solid var(--color-border-low-emphasis);color:var(--color-text-accent-primary)}.spui-SnackBar-iconButton--confirmation{--IconButton--neutral-onActive-backgroundColor:var(--gray-20-alpha);--IconButton--neutral-onHover-backgroundColor:var(--gray-20-alpha);--IconButton--neutral-color:var(--color-object-low-emphasis)}.spui-SnackBar-button--confirmation{--TextLink-color:var(--color-text-low-emphasis);--TextLink-icon-color:var(--color-object-low-emphasis);--TextButton-color:var(--color-text-low-emphasis);--TextButton-icon-color:var(--color-object-low-emphasis)}.spui-SnackBar-button--confirmation:after{background:var(--color-border-low-emphasis)}.spui-SnackBar-content--error{background-color:var(--color-surface-caution);color:var(--color-text-high-emphasis-inverse)}.spui-SnackBar-iconButton--error{--IconButton--neutral-onActive-backgroundColor:var(--white-20-alpha);--IconButton--neutral-onHover-backgroundColor:var(--white-20-alpha);--IconButton--neutral-color:var(--color-object-high-emphasis-inverse)}.spui-SnackBar-button--error{--TextLink-color:var(--color-text-high-emphasis-inverse);--TextLink-icon-color:var(--color-object-high-emphasis-inverse);--TextButton-color:var(--color-text-high-emphasis-inverse);--TextButton-icon-color:var(--color-object-high-emphasis-inverse)}.spui-SnackBar-button--error:after{background:var(--white-20-alpha)}@media (prefers-reduced-motion:reduce){.spui-SnackBar--slide,.spui-SnackBar-slide--in{transition-duration:.1ms}}@media (max-width:464px){.spui-SnackBar{padding:0 12px;text-align:center;bottom:0;top:unset;transform:translateY(calc(var(--SnackBar--initial-height-bottom)*-1 - var(--SnackBar--offset-bottom)*-1))}.spui-SnackBar-slide--in.spui-SnackBar--top{transform:translateY(var(--SnackBar--order-offset-bottom))}.spui-SnackBar-content{border-radius:82px;max-width:400px;min-width:calc(100% - 24px);padding:14px 16px 14px 20px}}@media (max-width:320px){.spui-SnackBar-text{--SnackBar-max-lines:4}}
|
package/SnackBar/SnackBar.d.ts
CHANGED
|
@@ -1,29 +1,24 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
declare type PositionOffset = {
|
|
4
|
-
top: number;
|
|
5
|
-
right: number;
|
|
6
|
-
left: number;
|
|
7
|
-
bottom: number;
|
|
8
|
-
};
|
|
2
|
+
import { StackPosition, StackPositionOffset } from '../StackNotificationManager';
|
|
9
3
|
declare type Variant = 'information' | 'confirmation' | 'error';
|
|
10
4
|
declare type Props = {
|
|
11
5
|
children?: React.ReactElement;
|
|
12
6
|
active?: boolean;
|
|
13
|
-
order?: number;
|
|
14
7
|
offset?: {
|
|
15
|
-
[K in keyof
|
|
8
|
+
[K in keyof StackPositionOffset]?: StackPositionOffset[K];
|
|
16
9
|
};
|
|
17
10
|
duration?: number;
|
|
18
11
|
onHide?: () => void;
|
|
19
|
-
position?:
|
|
12
|
+
position?: StackPosition;
|
|
20
13
|
variant?: Variant;
|
|
14
|
+
setContentHeight?: (height: number) => void;
|
|
15
|
+
stackPosition?: number;
|
|
21
16
|
};
|
|
22
17
|
export declare const BLOCK_NAME = "spui-SnackBar";
|
|
23
18
|
export declare const ANIMATION_DURATION = 300;
|
|
24
19
|
export declare const MAX_DURATION = 10000;
|
|
25
20
|
export declare const SnackBar: {
|
|
26
|
-
Frame: ({ children, active, position,
|
|
21
|
+
Frame: ({ children, active: _active, position, offset: _offset, onHide, variant, stackPosition, setContentHeight, }: Props) => React.ReactElement;
|
|
27
22
|
Icon: React.FC<{
|
|
28
23
|
children: ReactNode;
|
|
29
24
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SnackBar.d.ts","sourceRoot":"","sources":["../../src/SnackBar/SnackBar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAOZ,SAAS,EAOV,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"SnackBar.d.ts","sourceRoot":"","sources":["../../src/SnackBar/SnackBar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAOZ,SAAS,EAOV,MAAM,OAAO,CAAC;AACf,OAAO,EACL,aAAa,EACb,mBAAmB,EACpB,MAAM,6BAA6B,CAAC;AAMrC,aAAK,OAAO,GAAG,aAAa,GAAG,cAAc,GAAG,OAAO,CAAC;AAExD,aAAK,KAAK,GAAG;IACX,QAAQ,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;IAC9B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE;SAAG,CAAC,IAAI,MAAM,mBAAmB,CAAC,CAAC,EAAE,mBAAmB,CAAC,CAAC,CAAC;KAAE,CAAC;IAEvE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,UAAU,kBAAkB,CAAC;AAG1C,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAEtC,eAAO,MAAM,YAAY,QAAQ,CAAC;AAwOlC,eAAO,MAAM,QAAQ;yHAtNlB,KAAK,KAAG,MAAM,YAAY;;kBAqKF,SAAS;;;kBAGT,SAAS;;;eAIzB,SAAS;kBAAY,SAAS;;;eAqB9B,SAAS;kBAAY,SAAS;;CA2BxC,CAAC"}
|
package/SnackBar/SnackBar.js
CHANGED
|
@@ -59,18 +59,21 @@ var VERTICAL_GAP = 20;
|
|
|
59
59
|
var DEFAULT_VARIANT = 'information';
|
|
60
60
|
var Frame = function (_a) {
|
|
61
61
|
var _b;
|
|
62
|
-
var
|
|
63
|
-
var
|
|
62
|
+
var _c, _d, _e, _f;
|
|
63
|
+
var children = _a.children, _active = _a.active, _g = _a.position, position = _g === void 0 ? 'topCenter' : _g, _h = _a.offset, _offset = _h === void 0 ? {} : _h, onHide = _a.onHide, _j = _a.variant, variant = _j === void 0 ? DEFAULT_VARIANT : _j, _k = _a.stackPosition, stackPosition = _k === void 0 ? 0 : _k, setContentHeight = _a.setContentHeight;
|
|
64
|
+
var _l = (0, react_1.useState)(false), isShow = _l[0], setIsShow = _l[1];
|
|
64
65
|
var offset = {
|
|
65
|
-
top: _offset.top
|
|
66
|
+
top: (_c = _offset.top) !== null && _c !== void 0 ? _c : 24,
|
|
66
67
|
// If position is top or bottom, then horizontal offset is not needed.
|
|
67
|
-
left: position.endsWith('Left') ? _offset.left
|
|
68
|
-
right: position.endsWith('Right') ? _offset.right
|
|
69
|
-
bottom: _offset.bottom
|
|
68
|
+
left: position.endsWith('Left') ? (_d = _offset.left) !== null && _d !== void 0 ? _d : 32 : 0,
|
|
69
|
+
right: position.endsWith('Right') ? (_e = _offset.right) !== null && _e !== void 0 ? _e : 32 : 0,
|
|
70
|
+
bottom: (_f = _offset.bottom) !== null && _f !== void 0 ? _f : 24,
|
|
70
71
|
};
|
|
71
72
|
var formattedDuration = exports.MAX_DURATION - exports.ANIMATION_DURATION;
|
|
72
73
|
var timeoutID = (0, react_1.useRef)(null);
|
|
73
|
-
var
|
|
74
|
+
var _m = (0, react_1.useState)(0), clientHeight = _m[0], setClientHeight = _m[1];
|
|
75
|
+
var _o = (0, react_1.useState)(false), shouldAnimation = _o[0], setShouldAnimation = _o[1];
|
|
76
|
+
var _p = (0, react_1.useState)(false), active = _p[0], setActive = _p[1];
|
|
74
77
|
var setIsShowWithTimeout = (0, react_1.useCallback)(function () {
|
|
75
78
|
// Out animation is executed after `formattedDuration` seconds.
|
|
76
79
|
if (timeoutID.current === null && isShow) {
|
|
@@ -88,6 +91,7 @@ var Frame = function (_a) {
|
|
|
88
91
|
var handleTransitionEnd = (0, react_1.useCallback)(function () {
|
|
89
92
|
if (onHide && !isShow) {
|
|
90
93
|
onHide();
|
|
94
|
+
setActive(false);
|
|
91
95
|
timeoutID.current = null;
|
|
92
96
|
}
|
|
93
97
|
}, [isShow, setIsShow, onHide]);
|
|
@@ -97,21 +101,36 @@ var Frame = function (_a) {
|
|
|
97
101
|
(0, react_1.useEffect)(function () {
|
|
98
102
|
// Animation is not stopped even if `active` props is changed while running animation.
|
|
99
103
|
if (active && timeoutID.current === null) {
|
|
104
|
+
// Wait for applying transition until style is determined.
|
|
105
|
+
setShouldAnimation(true);
|
|
100
106
|
setIsShow(true);
|
|
101
107
|
}
|
|
108
|
+
if (!active) {
|
|
109
|
+
setShouldAnimation(false);
|
|
110
|
+
}
|
|
102
111
|
}, [active]);
|
|
103
112
|
(0, react_1.useEffect)(function () {
|
|
104
113
|
setIsShowWithTimeout();
|
|
105
114
|
return resetTimeout;
|
|
106
115
|
}, [setIsShowWithTimeout, resetTimeout]);
|
|
107
|
-
|
|
116
|
+
(0, react_1.useEffect)(function () {
|
|
117
|
+
if (_active) {
|
|
118
|
+
setActive(true);
|
|
119
|
+
}
|
|
120
|
+
if (!_active && isShow) {
|
|
121
|
+
setIsShow(false);
|
|
122
|
+
}
|
|
123
|
+
}, [_active, isShow]);
|
|
124
|
+
(0, react_1.useEffect)(function () {
|
|
125
|
+
setContentHeight === null || setContentHeight === void 0 ? void 0 : setContentHeight(clientHeight + VERTICAL_GAP);
|
|
126
|
+
}, [clientHeight]);
|
|
108
127
|
var positionPrefix = position.startsWith('top') ? 'top' : 'bottom';
|
|
109
128
|
var positionSuffix = position.slice(positionPrefix.length).toLowerCase();
|
|
110
|
-
var orderOffsetTop =
|
|
111
|
-
var orderOffsetBottom =
|
|
129
|
+
var orderOffsetTop = stackPosition + offset.top;
|
|
130
|
+
var orderOffsetBottom = stackPosition + offset.bottom;
|
|
112
131
|
return (react_1.default.createElement("div", { style: (_b = {},
|
|
113
|
-
_b['--SnackBar--initial-height-top'] = "".concat(orderOffsetTop -
|
|
114
|
-
_b['--SnackBar--initial-height-bottom'] = "".concat(orderOffsetBottom -
|
|
132
|
+
_b['--SnackBar--initial-height-top'] = "".concat(orderOffsetTop - clientHeight + offset.top, "px"),
|
|
133
|
+
_b['--SnackBar--initial-height-bottom'] = "".concat(orderOffsetBottom - clientHeight + offset.bottom, "px"),
|
|
115
134
|
_b['--SnackBar--order-offset-top'] = "".concat(orderOffsetTop, "px"),
|
|
116
135
|
_b['--SnackBar--order-offset-bottom'] = "".concat(-orderOffsetBottom, "px"),
|
|
117
136
|
_b['--SnackBar--offset-top'] = "".concat(offset.top, "px"),
|
|
@@ -122,7 +141,7 @@ var Frame = function (_a) {
|
|
|
122
141
|
_b), className: [
|
|
123
142
|
exports.BLOCK_NAME,
|
|
124
143
|
"".concat(exports.BLOCK_NAME, "--").concat(positionPrefix),
|
|
125
|
-
"".concat(exports.BLOCK_NAME, "--slide"),
|
|
144
|
+
shouldAnimation && "".concat(exports.BLOCK_NAME, "--slide"),
|
|
126
145
|
isShow && "".concat(exports.BLOCK_NAME, "-slide--in"),
|
|
127
146
|
!active && "".concat(exports.BLOCK_NAME, "--hidden"),
|
|
128
147
|
]
|
|
@@ -136,18 +155,22 @@ var Frame = function (_a) {
|
|
|
136
155
|
react_1.default.createElement(IconButton_1.IconButton, { size: "exSmall", variant: "neutral", onClick: handleOnClickCloseButton },
|
|
137
156
|
react_1.default.createElement(Icon_1.CrossBold, { "aria-label": "\u9589\u3058\u308B" }))))));
|
|
138
157
|
};
|
|
139
|
-
var
|
|
158
|
+
var convertInternalChildProps = function (props) {
|
|
140
159
|
var hasInternalChildProps = function (props) {
|
|
141
160
|
return ({}.hasOwnProperty.call(props, 'setIsShow') ||
|
|
142
161
|
{}.hasOwnProperty.call(props, 'variant'));
|
|
143
162
|
};
|
|
144
163
|
if (hasInternalChildProps(props)) {
|
|
145
|
-
|
|
164
|
+
var result = {
|
|
146
165
|
setIsShow: props.setIsShow,
|
|
147
166
|
variant: props.variant,
|
|
148
167
|
};
|
|
168
|
+
// Remove unnecessary props.
|
|
169
|
+
delete props.setIsShow;
|
|
170
|
+
delete props.variant;
|
|
171
|
+
return [props, result];
|
|
149
172
|
}
|
|
150
|
-
return {};
|
|
173
|
+
return [props, {}];
|
|
151
174
|
};
|
|
152
175
|
var Icon = function (_a) {
|
|
153
176
|
var children = _a.children;
|
|
@@ -159,7 +182,7 @@ var Text = function (_a) {
|
|
|
159
182
|
};
|
|
160
183
|
var TextButton = function (_a) {
|
|
161
184
|
var icon = _a.icon, children = _a.children, onClick = _a.onClick, rest = __rest(_a, ["icon", "children", "onClick"]);
|
|
162
|
-
var
|
|
185
|
+
var _b = (0, react_1.useMemo)(function () { return convertInternalChildProps(rest); }, []), props = _b[0], internalProps = _b[1];
|
|
163
186
|
var variant = internalProps.variant || DEFAULT_VARIANT;
|
|
164
187
|
var setIsShow = internalProps.setIsShow;
|
|
165
188
|
var handleOnClick = function (e) {
|
|
@@ -167,11 +190,11 @@ var TextButton = function (_a) {
|
|
|
167
190
|
setIsShow === null || setIsShow === void 0 ? void 0 : setIsShow(false);
|
|
168
191
|
};
|
|
169
192
|
return (react_1.default.createElement("div", { className: "".concat(exports.BLOCK_NAME, "-button ").concat(exports.BLOCK_NAME, "-button--").concat(variant) },
|
|
170
|
-
react_1.default.createElement(TextButton_1.TextButton, __assign({ icon: icon, onClick: handleOnClick },
|
|
193
|
+
react_1.default.createElement(TextButton_1.TextButton, __assign({ icon: icon, onClick: handleOnClick }, props), children)));
|
|
171
194
|
};
|
|
172
195
|
var TextLink = function (_a) {
|
|
173
196
|
var icon = _a.icon, children = _a.children, onClick = _a.onClick, rest = __rest(_a, ["icon", "children", "onClick"]);
|
|
174
|
-
var
|
|
197
|
+
var _b = (0, react_1.useMemo)(function () { return convertInternalChildProps(rest); }, []), props = _b[0], internalProps = _b[1];
|
|
175
198
|
var variant = internalProps.variant || DEFAULT_VARIANT;
|
|
176
199
|
var setIsShow = internalProps.setIsShow;
|
|
177
200
|
var handleOnClick = function (e) {
|
|
@@ -179,7 +202,7 @@ var TextLink = function (_a) {
|
|
|
179
202
|
setIsShow === null || setIsShow === void 0 ? void 0 : setIsShow(false);
|
|
180
203
|
};
|
|
181
204
|
return (react_1.default.createElement("div", { className: "".concat(exports.BLOCK_NAME, "-button ").concat(exports.BLOCK_NAME, "-button--").concat(variant) },
|
|
182
|
-
react_1.default.createElement(TextLink_1.TextLink, __assign({ icon: icon, onClick: handleOnClick },
|
|
205
|
+
react_1.default.createElement(TextLink_1.TextLink, __assign({ icon: icon, onClick: handleOnClick }, props), children)));
|
|
183
206
|
};
|
|
184
207
|
exports.SnackBar = {
|
|
185
208
|
Frame: Frame,
|