@lism-css/ui 0.9.3 → 0.10.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.ja.md +137 -0
- package/README.md +93 -5
- package/dist/components/Chat/getProps.js +1 -6
- package/dist/components/DummyImage/astro/index.d.ts +1 -0
- package/dist/components/DummyImage/react/DummyImage.d.ts +2 -0
- package/dist/components/DummyImage/react/DummyImage.js +8 -0
- package/dist/components/DummyImage/react/index.d.ts +1 -0
- package/dist/components/DummyText/astro/index.d.ts +1 -0
- package/dist/components/DummyText/getContent.d.ts +11 -0
- package/dist/components/DummyText/getContent.js +9 -0
- package/dist/components/DummyText/react/DummyText.d.ts +10 -0
- package/dist/components/DummyText/react/DummyText.js +10 -0
- package/dist/components/DummyText/react/index.d.ts +1 -0
- package/dist/components/DummyText/texts.d.ts +22 -0
- package/dist/components/DummyText/texts.js +39 -0
- package/dist/components/NavMenu/getProps.js +2 -2
- package/dist/components/Tabs/react/Tab.js +1 -12
- package/dist/components/Tabs/react/Tabs.js +1 -3
- package/dist/components/astro.d.ts +2 -0
- package/dist/components/react.d.ts +2 -0
- package/dist/components/react.js +20 -16
- package/dist/lism-css/dist/components/atomic/Decorator/getProps.js +10 -10
- package/dist/lism-css/dist/components/atomic/Icon/getProps.js +28 -27
- package/dist/lism-css/dist/config/defaults/props.js +6 -1
- package/dist/lism-css/dist/config/defaults/tokens.js +1 -1
- package/dist/lism-css/dist/lib/getMaybeCssVar.js +26 -21
- package/dist/style.css +1 -1
- package/dist/ui.css +1 -1
- package/package.json +5 -4
- package/src/components/Accordion/_style.css +69 -69
- package/src/components/Accordion/astro/Button.astro +2 -2
- package/src/components/Accordion/astro/Heading.astro +1 -1
- package/src/components/Accordion/astro/Item.astro +7 -7
- package/src/components/Accordion/astro/Panel.astro +3 -3
- package/src/components/Accordion/astro/Root.astro +3 -3
- package/src/components/Accordion/getProps.js +54 -54
- package/src/components/Accordion/react/AccIcon.jsx +1 -1
- package/src/components/Accordion/react/Accordion.jsx +34 -34
- package/src/components/Accordion/script.js +1 -1
- package/src/components/Accordion/setAccordion.js +93 -93
- package/src/components/Alert/astro/Alert.astro +6 -6
- package/src/components/Alert/getProps.ts +22 -22
- package/src/components/Alert/presets.ts +26 -26
- package/src/components/Alert/react/Alert.tsx +9 -9
- package/src/components/Avatar/astro/Avatar.astro +2 -2
- package/src/components/Avatar/react/Avatar.jsx +5 -5
- package/src/components/Badge/_style.css +14 -14
- package/src/components/Badge/astro/Badge.astro +4 -4
- package/src/components/Badge/react/Badge.jsx +6 -6
- package/src/components/Button/_style.css +29 -29
- package/src/components/Button/astro/Button.astro +4 -4
- package/src/components/Button/react/Button.jsx +6 -6
- package/src/components/Callout/astro/Callout.astro +13 -13
- package/src/components/Callout/getProps.ts +24 -24
- package/src/components/Callout/presets.ts +26 -26
- package/src/components/Callout/react/Callout.tsx +16 -16
- package/src/components/Chat/_style.css +49 -49
- package/src/components/Chat/astro/Chat.astro +27 -27
- package/src/components/Chat/getProps.js +40 -45
- package/src/components/Chat/react/Chat.jsx +17 -17
- package/src/components/Details/_style.css +39 -39
- package/src/components/Details/astro/Content.astro +3 -3
- package/src/components/Details/astro/Details.astro +1 -1
- package/src/components/Details/astro/Icon.astro +1 -1
- package/src/components/Details/astro/Summary.astro +2 -2
- package/src/components/Details/astro/Title.astro +1 -1
- package/src/components/Details/getProps.js +7 -7
- package/src/components/Details/react/Details.jsx +24 -24
- package/src/components/DummyImage/astro/DummyImage.astro +7 -0
- package/src/components/DummyImage/astro/index.ts +1 -0
- package/src/components/DummyImage/react/DummyImage.tsx +5 -0
- package/src/components/DummyImage/react/index.ts +1 -0
- package/src/components/DummyText/astro/DummyText.astro +9 -0
- package/src/components/DummyText/astro/index.ts +1 -0
- package/src/components/DummyText/getContent.ts +39 -0
- package/src/components/DummyText/react/DummyText.tsx +15 -0
- package/src/components/DummyText/react/index.ts +1 -0
- package/src/components/DummyText/texts.ts +39 -0
- package/src/components/Modal/_style.css +34 -34
- package/src/components/Modal/astro/Body.astro +1 -1
- package/src/components/Modal/astro/CloseBtn.astro +10 -10
- package/src/components/Modal/astro/Inner.astro +1 -1
- package/src/components/Modal/astro/Modal.astro +3 -3
- package/src/components/Modal/astro/OpenBtn.astro +1 -1
- package/src/components/Modal/getProps.js +19 -19
- package/src/components/Modal/react/Body.jsx +5 -5
- package/src/components/Modal/react/CloseBtn.jsx +13 -13
- package/src/components/Modal/react/Inner.jsx +1 -1
- package/src/components/Modal/react/Modal.jsx +10 -10
- package/src/components/Modal/react/OpenBtn.jsx +5 -5
- package/src/components/Modal/script.js +1 -1
- package/src/components/Modal/setModal.ts +92 -92
- package/src/components/NavMenu/_style.css +17 -17
- package/src/components/NavMenu/astro/Item.astro +1 -1
- package/src/components/NavMenu/astro/Link.astro +1 -1
- package/src/components/NavMenu/astro/Nest.astro +1 -1
- package/src/components/NavMenu/astro/Root.astro +1 -1
- package/src/components/NavMenu/getProps.js +28 -28
- package/src/components/NavMenu/react/NavMenu.jsx +4 -4
- package/src/components/ShapeDivider/_style.css +51 -51
- package/src/components/ShapeDivider/astro/ShapeDivider.astro +20 -20
- package/src/components/ShapeDivider/getProps.js +23 -23
- package/src/components/ShapeDivider/react/ShapeDivider.jsx +24 -24
- package/src/components/Tabs/_style.css +29 -29
- package/src/components/Tabs/astro/Tab.astro +2 -2
- package/src/components/Tabs/astro/TabItem.astro +1 -1
- package/src/components/Tabs/astro/TabList.astro +2 -2
- package/src/components/Tabs/astro/TabPanel.astro +2 -2
- package/src/components/Tabs/astro/Tabs.astro +20 -20
- package/src/components/Tabs/astro/transformTabitems.js +30 -30
- package/src/components/Tabs/getProps.js +4 -4
- package/src/components/Tabs/react/Tab.jsx +4 -12
- package/src/components/Tabs/react/TabItem.jsx +1 -1
- package/src/components/Tabs/react/TabList.jsx +2 -2
- package/src/components/Tabs/react/TabPanel.jsx +2 -2
- package/src/components/Tabs/react/Tabs.jsx +44 -46
- package/src/components/Tabs/script.js +4 -4
- package/src/components/Tabs/setTabs.js +70 -70
- package/src/components/astro.ts +2 -0
- package/src/components/react.ts +2 -0
- package/src/helper/animation.ts +10 -10
- package/src/helper/uuid.js +3 -3
- package/dist/lism-css/dist/components/getFilterProps.js +0 -23
- package/dist/lism-css/dist/components/setMaybeTransformStyles.js +0 -7
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import PRESETS from './presets';
|
|
2
2
|
|
|
3
3
|
export type CalloutProps = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
type?: string;
|
|
5
|
+
keycolor?: string;
|
|
6
|
+
icon?: string;
|
|
7
|
+
title?: string;
|
|
8
|
+
flow?: string;
|
|
9
|
+
[key: string]: unknown;
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
export default function getCalloutProps({ type = 'note', keycolor, icon, title, flow = 's', ...props }: CalloutProps) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
const presetData = type ? PRESETS[type] : null;
|
|
14
|
+
const _icon = icon || presetData?.icon || 'note';
|
|
15
|
+
const _keycolor = keycolor || presetData?.color || null;
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
17
|
+
return {
|
|
18
|
+
icon: _icon,
|
|
19
|
+
title,
|
|
20
|
+
flow,
|
|
21
|
+
lismClass: 'c--callout u--cbox',
|
|
22
|
+
keycolor: _keycolor,
|
|
23
|
+
p: '20',
|
|
24
|
+
g: '10',
|
|
25
|
+
bdc: 'keycolor',
|
|
26
|
+
'bd-x-s': '-',
|
|
27
|
+
bdw: '4px',
|
|
28
|
+
bxsh: '10',
|
|
29
|
+
bdrs: '5',
|
|
30
|
+
...props,
|
|
31
|
+
};
|
|
32
32
|
}
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
type PresetData = {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
icon: string;
|
|
3
|
+
color: string;
|
|
4
4
|
};
|
|
5
5
|
|
|
6
6
|
const PRESETS: Record<string, PresetData> = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
7
|
+
alert: {
|
|
8
|
+
icon: 'alert',
|
|
9
|
+
color: 'red',
|
|
10
|
+
},
|
|
11
|
+
point: {
|
|
12
|
+
icon: 'lightbulb',
|
|
13
|
+
color: 'orange',
|
|
14
|
+
},
|
|
15
|
+
warning: {
|
|
16
|
+
icon: 'warning',
|
|
17
|
+
color: 'yellow',
|
|
18
|
+
},
|
|
19
|
+
check: {
|
|
20
|
+
icon: 'check-circle',
|
|
21
|
+
color: 'green',
|
|
22
|
+
},
|
|
23
|
+
help: {
|
|
24
|
+
icon: 'question',
|
|
25
|
+
color: 'purple',
|
|
26
|
+
},
|
|
27
|
+
note: {
|
|
28
|
+
icon: 'note',
|
|
29
|
+
color: 'blue',
|
|
30
|
+
},
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
export default PRESETS;
|
|
@@ -3,21 +3,21 @@ import { Flow, Flex, Stack, Icon, Center } from 'lism-css/react';
|
|
|
3
3
|
import getCalloutProps, { type CalloutProps } from '../getProps';
|
|
4
4
|
|
|
5
5
|
export default function Callout({ children, ...inputProps }: CalloutProps & { children?: ReactNode }) {
|
|
6
|
-
|
|
6
|
+
const { icon, title, flow, ...calloutProps } = getCalloutProps(inputProps);
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
8
|
+
return (
|
|
9
|
+
<Stack {...calloutProps}>
|
|
10
|
+
{title && (
|
|
11
|
+
<Flex className="c--callout_head" c="keycolor" fw="bold" ai="center" g="10">
|
|
12
|
+
<Center className="c--callout_icon" fz="xl">
|
|
13
|
+
<Icon icon={icon} />
|
|
14
|
+
</Center>
|
|
15
|
+
<span className="c--callout_title">{title}</span>
|
|
16
|
+
</Flex>
|
|
17
|
+
)}
|
|
18
|
+
<Flow className="c--callout_body" flow={flow}>
|
|
19
|
+
{children}
|
|
20
|
+
</Flow>
|
|
21
|
+
</Stack>
|
|
22
|
+
);
|
|
23
23
|
}
|
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
@layer lism
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
@layer lism-modules {
|
|
2
|
+
.c--chat {
|
|
3
|
+
--cbox-bgPct: 8%;
|
|
4
|
+
--gta: 'avatar name' 'avatar body';
|
|
5
|
+
--gtc: auto 1fr;
|
|
6
|
+
--gtr: minmax(1.5rem, auto) auto;
|
|
7
|
+
--_avator-size: clamp(48px, 32px + 5cqw, 64px); /* @320px:40px ~ @640:64px */
|
|
8
|
+
--_deco-size: calc(min(var(--_avator-size), 80px) / 4 + 0.25rem);
|
|
9
|
+
--_deco-mask: none;
|
|
10
|
+
--_deco-t: 0;
|
|
11
|
+
--_deco-scale: 1;
|
|
12
|
+
--_deco-inset-x: 0;
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
gap: 0 calc(var(--_deco-size) + 1px);
|
|
15
|
+
}
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
17
|
+
.c--chat_avatar {
|
|
18
|
+
grid-area: avatar;
|
|
19
|
+
width: var(--_avator-size);
|
|
20
|
+
}
|
|
21
|
+
.c--chat_name {
|
|
22
|
+
grid-area: name;
|
|
23
|
+
}
|
|
24
|
+
.c--chat_body {
|
|
25
|
+
grid-area: body;
|
|
26
|
+
}
|
|
27
|
+
.c--chat_content {
|
|
28
|
+
max-width: var(--sz--s);
|
|
29
|
+
}
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
31
|
+
.c--chat_deco {
|
|
32
|
+
top: var(--_deco-t);
|
|
33
|
+
inset-inline: var(--_deco-inset-x);
|
|
34
|
+
width: var(--_deco-size);
|
|
35
|
+
height: var(--_deco-size);
|
|
36
|
+
scale: var(--_deco-scale);
|
|
37
|
+
mask: var(--_deco-mask) center / contain no-repeat;
|
|
38
|
+
}
|
|
39
|
+
.c--chat--speak {
|
|
40
|
+
--_deco-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8"><path d="M8,8L8,8C7.4,4.8,5.4,2,2.6,0.4L2,0h6V8z"/></svg>');
|
|
41
|
+
}
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
43
|
+
[data-chat-dir='start'] {
|
|
44
|
+
--_deco-inset-x: auto calc(100% - 1px);
|
|
45
|
+
}
|
|
46
|
+
[data-chat-dir='end'] {
|
|
47
|
+
--_deco-scale: -1 1;
|
|
48
|
+
--_deco-inset-x: calc(100% - 1px) auto;
|
|
49
|
+
--gta: 'name avatar' 'body avatar';
|
|
50
|
+
--gtc: 1fr auto;
|
|
51
|
+
}
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
/* NOTE: 以下は @layer 外に配置(セレクタの詳細度を確保するため) */
|
|
55
55
|
|
|
56
56
|
/* speak バリアントの角丸調整: 左側 */
|
|
57
57
|
.c--chat--speak[data-chat-dir='start'] > div > .c--chat_content {
|
|
58
|
-
|
|
58
|
+
border-start-start-radius: 0;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
/* speak バリアントの角丸調整: 右側 */
|
|
62
62
|
.c--chat--speak[data-chat-dir='end'] > div > .c--chat_content {
|
|
63
|
-
|
|
63
|
+
border-start-end-radius: 0;
|
|
64
64
|
}
|
|
@@ -4,19 +4,19 @@ import getChatProps, { defaultProps } from '../getProps';
|
|
|
4
4
|
import '../_style.css';
|
|
5
5
|
|
|
6
6
|
interface Props {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
/** 吹き出しスタイル */
|
|
8
|
+
variant?: 'speak' | 'think';
|
|
9
|
+
/** 吹き出しの方向 */
|
|
10
|
+
direction?: 'start' | 'end';
|
|
11
|
+
/** 発言者名 */
|
|
12
|
+
name?: string;
|
|
13
|
+
/** アバター画像URL */
|
|
14
|
+
avatar?: string;
|
|
15
|
+
/** キーカラー */
|
|
16
|
+
keycolor?: string;
|
|
17
|
+
/** コンテンツのフロー間隔 */
|
|
18
|
+
flow?: string;
|
|
19
|
+
[key: string]: unknown;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
const { name, avatar, flow = 's', ...inputProps } = Astro.props;
|
|
@@ -24,18 +24,18 @@ const { 'data-chat-dir': direction, ...chatProps } = getChatProps(inputProps);
|
|
|
24
24
|
---
|
|
25
25
|
|
|
26
26
|
<Grid data-chat-dir={direction} {...chatProps}>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
27
|
+
{
|
|
28
|
+
avatar && (
|
|
29
|
+
<Frame {...defaultProps.avatar} src={avatar} alt="">
|
|
30
|
+
<img src={avatar} alt="" width="60" height="60" decoding="async" />
|
|
31
|
+
</Frame>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
{name && <Lism {...defaultProps.name}>{name}</Lism>}
|
|
35
|
+
<Lism {...defaultProps.body}>
|
|
36
|
+
<Decorator {...defaultProps.deco} class="u--cbox is--skipFlow" />
|
|
37
|
+
<Flow {...defaultProps.content} class="u--cbox" flow={flow} jslf={direction}>
|
|
38
|
+
<slot />
|
|
39
|
+
</Flow>
|
|
40
|
+
</Lism>
|
|
41
41
|
</Grid>
|
|
@@ -4,54 +4,49 @@
|
|
|
4
4
|
|
|
5
5
|
// 各サブ要素のデフォルトプロパティ
|
|
6
6
|
export const defaultProps = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
7
|
+
avatar: {
|
|
8
|
+
lismClass: 'c--chat_avatar',
|
|
9
|
+
bgc: 'base',
|
|
10
|
+
ar: '1/1',
|
|
11
|
+
bdrs: '99',
|
|
12
|
+
'aria-hidden': 'true',
|
|
13
|
+
},
|
|
14
|
+
name: {
|
|
15
|
+
lismClass: 'c--chat_name',
|
|
16
|
+
c: 'text-2',
|
|
17
|
+
fs: 'italic',
|
|
18
|
+
fz: '2xs',
|
|
19
|
+
lh: '1',
|
|
20
|
+
py: '5',
|
|
21
|
+
px: '10',
|
|
22
|
+
aslf: 'end',
|
|
23
|
+
},
|
|
24
|
+
body: {
|
|
25
|
+
lismClass: 'c--chat_body',
|
|
26
|
+
pos: 'rel',
|
|
27
|
+
},
|
|
28
|
+
deco: {
|
|
29
|
+
lismClass: 'c--chat_deco',
|
|
30
|
+
pos: 'abs',
|
|
31
|
+
},
|
|
32
|
+
content: {
|
|
33
|
+
lismClass: 'c--chat_content',
|
|
34
|
+
bdrs: '30',
|
|
35
|
+
p: '20',
|
|
36
|
+
lh: 's',
|
|
37
|
+
},
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* Chat コンポーネントのルートプロパティを生成
|
|
42
42
|
*/
|
|
43
|
-
export default function getChatProps({
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
keycolor,
|
|
53
|
-
'data-chat-dir': direction,
|
|
54
|
-
ji: direction,
|
|
55
|
-
...props,
|
|
56
|
-
};
|
|
43
|
+
export default function getChatProps({ variant = 'speak', direction = 'start', keycolor = 'gray', ...props }) {
|
|
44
|
+
return {
|
|
45
|
+
lismClass: 'c--chat',
|
|
46
|
+
variant,
|
|
47
|
+
keycolor,
|
|
48
|
+
'data-chat-dir': direction,
|
|
49
|
+
ji: direction,
|
|
50
|
+
...props,
|
|
51
|
+
};
|
|
57
52
|
}
|
|
@@ -3,22 +3,22 @@ import getChatProps, { defaultProps } from '../getProps';
|
|
|
3
3
|
import '../_style.css';
|
|
4
4
|
|
|
5
5
|
export default function Chat({ name, avatar, flow = 's', children, ...props }) {
|
|
6
|
-
|
|
6
|
+
const { 'data-chat-dir': direction, ...chatProps } = getChatProps(props);
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
8
|
+
return (
|
|
9
|
+
<Grid data-chat-dir={direction} {...chatProps}>
|
|
10
|
+
{avatar && (
|
|
11
|
+
<Frame {...defaultProps.avatar} src={avatar} alt="">
|
|
12
|
+
<img src={avatar} alt="" width="60" height="60" decoding="async" />
|
|
13
|
+
</Frame>
|
|
14
|
+
)}
|
|
15
|
+
{name && <Lism {...defaultProps.name}>{name}</Lism>}
|
|
16
|
+
<Lism {...defaultProps.body}>
|
|
17
|
+
<Decorator {...defaultProps.deco} className="u--cbox is--skipFlow" />
|
|
18
|
+
<Flow {...defaultProps.content} className="u--cbox" flow={flow} jslf={direction}>
|
|
19
|
+
{children}
|
|
20
|
+
</Flow>
|
|
21
|
+
</Lism>
|
|
22
|
+
</Grid>
|
|
23
|
+
);
|
|
24
24
|
}
|
|
@@ -1,48 +1,48 @@
|
|
|
1
1
|
/* Details コンポーネント用スタイル */
|
|
2
2
|
/* ::details-content と grid-template-rows: 0fr → 1fr のトランジションでアニメーション */
|
|
3
|
-
@layer lism
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
@layer lism-modules {
|
|
4
|
+
.c--details {
|
|
5
|
+
--duration: var(--acc-duration, 0.25s); /* transition時間 */
|
|
6
|
+
--_icon-scale: 1.1;
|
|
7
|
+
--_icon-transform: rotate(0deg); /* icon操作用 */
|
|
8
|
+
--_content-gtr: 0fr; /* 開閉操作用 */
|
|
9
|
+
}
|
|
10
|
+
.c--details[open] {
|
|
11
|
+
--_icon-transform: scaleY(-1);
|
|
12
|
+
--_content-gtr: 1fr;
|
|
13
|
+
}
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
/* Safariで表示されるデフォルトの三角形アイコンを削除 */
|
|
16
|
+
.c--details_summary::-webkit-details-marker {
|
|
17
|
+
display: none;
|
|
18
|
+
}
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
/* 見出しタグでもフォントを揃える */
|
|
21
|
+
/* .c--details_title {} */
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
/* アイコン */
|
|
24
|
+
.c--details_icon {
|
|
25
|
+
--svg: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" width="1em" height="1em" fill="currentColor"><path d="M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z"></path></svg>');
|
|
26
|
+
display: inline-grid;
|
|
27
|
+
background-color: currentColor;
|
|
28
|
+
mask: var(--svg) no-repeat center center / contain;
|
|
29
|
+
scale: var(--_icon-scale);
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
transition: transform var(--duration);
|
|
32
|
+
transform: var(--_icon-transform);
|
|
33
|
+
}
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
/* ::details-content 擬似要素を使ったアニメーション */
|
|
36
|
+
.c--details::details-content {
|
|
37
|
+
display: grid;
|
|
38
|
+
grid-template-rows: var(--_content-gtr);
|
|
39
|
+
transition-duration: var(--duration);
|
|
40
|
+
transition-property: content-visibility, grid-template;
|
|
41
|
+
transition-behavior: allow-discrete;
|
|
42
|
+
}
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
/* コンテンツ内部のラッパー(grid-template-rows: 0frのアニメーションに必須) */
|
|
45
|
+
.c--details_body {
|
|
46
|
+
overflow: hidden;
|
|
47
|
+
}
|
|
48
48
|
}
|
|
@@ -7,17 +7,17 @@ import atts from 'lism-css/lib/helper/atts';
|
|
|
7
7
|
* @returns {Object} 処理済みプロパティ
|
|
8
8
|
*/
|
|
9
9
|
export function getDetailsProps({ lismClass, ...props }) {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
props.lismClass = atts(lismClass, 'c--details');
|
|
11
|
+
return props;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* 各サブコンポーネント用のデフォルトプロパティ
|
|
16
16
|
*/
|
|
17
17
|
export const defaultProps = {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
summary: { lismClass: 'c--details_summary', layout: 'flex', g: '10', ai: 'center' },
|
|
19
|
+
title: { lismClass: 'c--details_title', as: 'span', fx: '1', setPlain: 1 },
|
|
20
|
+
icon: { lismClass: 'c--details_icon a--icon', as: 'span', 'aria-hidden': 'true' },
|
|
21
|
+
body: { lismClass: 'c--details_body' },
|
|
22
|
+
content: { lismClass: 'c--details_content', layout: 'flow', flow: 's' },
|
|
23
23
|
};
|