@lism-css/ui 0.2.0 → 0.2.2
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/components/Accordion/astro/index.d.ts +6 -0
- package/dist/components/Alert/astro/index.d.ts +1 -0
- package/dist/components/Alert/getProps.d.ts +20 -0
- package/dist/components/Alert/presets.d.ts +6 -0
- package/dist/components/Alert/react/Alert.d.ts +5 -0
- package/dist/components/Alert/react/index.d.ts +1 -0
- package/dist/components/Avatar/astro/index.d.ts +1 -1
- package/dist/components/Badge/astro/index.d.ts +1 -1
- package/dist/components/Button/astro/index.d.ts +1 -1
- package/dist/components/Callout/astro/index.d.ts +1 -0
- package/dist/components/Callout/getProps.d.ts +22 -0
- package/dist/components/Callout/presets.d.ts +6 -0
- package/dist/components/Callout/react/Callout.d.ts +5 -0
- package/dist/components/Callout/react/index.d.ts +1 -0
- package/dist/components/Chat/astro/index.d.ts +1 -0
- package/dist/components/Chat/getProps.d.ts +53 -0
- package/dist/components/Chat/react/Chat.d.ts +7 -0
- package/dist/components/Chat/react/index.d.ts +1 -0
- package/dist/components/Modal/astro/index.d.ts +5 -0
- package/dist/components/NavMenu/astro/index.d.ts +11 -0
- package/dist/components/NavMenu/getProps.d.ts +32 -0
- package/dist/components/NavMenu/react/NavMenu.d.ts +16 -0
- package/dist/components/NavMenu/react/index.d.ts +8 -0
- package/dist/components/ShapeDivider/astro/index.d.ts +1 -0
- package/dist/components/ShapeDivider/getProps.d.ts +11 -0
- package/dist/components/ShapeDivider/react/ShapeDivider.d.ts +4 -0
- package/dist/components/ShapeDivider/react/index.d.ts +1 -0
- package/dist/components/Tabs/astro/index.d.ts +5 -0
- package/dist/components/astro.d.ts +5 -0
- package/dist/components/react.d.ts +5 -0
- package/dist/style.css +1 -1
- package/package.json +68 -68
- package/src/components/Alert/_style.css +1 -0
- package/src/components/Alert/astro/Alert.astro +17 -0
- package/src/components/Alert/astro/index.ts +1 -0
- package/src/components/Alert/getProps.ts +37 -0
- package/src/components/Alert/presets.ts +33 -0
- package/src/components/Alert/react/Alert.tsx +16 -0
- package/src/components/Alert/react/index.ts +1 -0
- package/src/components/Avatar/astro/Avatar.astro +0 -1
- package/src/components/Avatar/react/Avatar.jsx +0 -1
- package/src/components/Callout/_style.css +1 -0
- package/src/components/Callout/astro/Callout.astro +24 -0
- package/src/components/Callout/astro/index.ts +1 -0
- package/src/components/Callout/getProps.ts +32 -0
- package/src/components/Callout/presets.ts +33 -0
- package/src/components/Callout/react/Callout.tsx +23 -0
- package/src/components/Callout/react/index.ts +1 -0
- package/src/components/Chat/_style.css +64 -0
- package/src/components/Chat/astro/Chat.astro +41 -0
- package/src/components/Chat/astro/index.js +1 -0
- package/src/components/Chat/getProps.js +57 -0
- package/src/components/Chat/react/Chat.jsx +24 -0
- package/src/components/Chat/react/index.js +1 -0
- package/src/components/Modal/react/Body.jsx +1 -1
- package/src/components/Modal/react/CloseBtn.jsx +1 -2
- package/src/components/Modal/react/Inner.jsx +1 -1
- package/src/components/Modal/react/Modal.jsx +1 -1
- package/src/components/Modal/react/OpenBtn.jsx +1 -1
- package/src/components/NavMenu/_style.css +21 -0
- package/src/components/NavMenu/astro/Item.astro +8 -0
- package/src/components/NavMenu/astro/Link.astro +8 -0
- package/src/components/NavMenu/astro/Nest.astro +8 -0
- package/src/components/NavMenu/astro/Root.astro +9 -0
- package/src/components/NavMenu/astro/index.js +6 -0
- package/src/components/NavMenu/getProps.js +65 -0
- package/src/components/NavMenu/react/NavMenu.jsx +19 -0
- package/src/components/NavMenu/react/index.js +3 -0
- package/src/components/ShapeDivider/_style.css +56 -0
- package/src/components/ShapeDivider/astro/ShapeDivider.astro +31 -0
- package/src/components/ShapeDivider/astro/index.js +1 -0
- package/src/components/ShapeDivider/getProps.js +40 -0
- package/src/components/ShapeDivider/react/ShapeDivider.jsx +33 -0
- package/src/components/ShapeDivider/react/index.js +1 -0
- package/src/components/astro.ts +5 -0
- package/src/components/react.ts +5 -0
- package/src/style.scss +3 -0
- package/LICENSE +0 -21
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Callout.astro';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import PRESETS from './presets';
|
|
2
|
+
|
|
3
|
+
export type CalloutProps = {
|
|
4
|
+
type?: string;
|
|
5
|
+
keycolor?: string;
|
|
6
|
+
icon?: string;
|
|
7
|
+
title?: string;
|
|
8
|
+
flow?: string;
|
|
9
|
+
[key: string]: unknown;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default function getCalloutProps({ type = 'note', keycolor, icon, title, flow = 's', ...props }: CalloutProps) {
|
|
13
|
+
const presetData = type ? PRESETS[type] : null;
|
|
14
|
+
const _icon = icon || presetData?.icon || 'note';
|
|
15
|
+
const _keycolor = keycolor || presetData?.color || null;
|
|
16
|
+
|
|
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': true,
|
|
27
|
+
bdw: '4px',
|
|
28
|
+
bxsh: '10',
|
|
29
|
+
bdrs: '5',
|
|
30
|
+
...props,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
type PresetData = {
|
|
2
|
+
icon: string;
|
|
3
|
+
color: string;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
const PRESETS: Record<string, PresetData> = {
|
|
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
|
+
};
|
|
32
|
+
|
|
33
|
+
export default PRESETS;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { Flow, Flex, Stack, Icon, Center } from 'lism-css/react';
|
|
3
|
+
import getCalloutProps, { type CalloutProps } from '../getProps';
|
|
4
|
+
|
|
5
|
+
export default function Callout({ children, ...inputProps }: CalloutProps & { children?: ReactNode }) {
|
|
6
|
+
const { icon, title, flow, ...calloutProps } = getCalloutProps(inputProps);
|
|
7
|
+
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Callout';
|
|
@@ -0,0 +1,64 @@
|
|
|
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
|
+
|
|
14
|
+
gap: 0 calc(var(--_deco-size) + 1px);
|
|
15
|
+
}
|
|
16
|
+
|
|
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
|
+
|
|
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
|
+
|
|
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
|
+
}
|
|
53
|
+
|
|
54
|
+
/* NOTE: 以下は @layer 外に配置(セレクタの詳細度を確保するため) */
|
|
55
|
+
|
|
56
|
+
/* speak バリアントの角丸調整: 左側 */
|
|
57
|
+
.c--chat--speak[data-chat-dir='start'] > div > .c--chat_content {
|
|
58
|
+
border-start-start-radius: 0;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/* speak バリアントの角丸調整: 右側 */
|
|
62
|
+
.c--chat--speak[data-chat-dir='end'] > div > .c--chat_content {
|
|
63
|
+
border-start-end-radius: 0;
|
|
64
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { Lism, Flow, Grid, Frame, Decorator } from 'lism-css/astro';
|
|
3
|
+
import getChatProps, { defaultProps } from '../getProps';
|
|
4
|
+
import '../_style.css';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
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
|
+
}
|
|
21
|
+
|
|
22
|
+
const { name, avatar, flow = 's', ...inputProps } = Astro.props;
|
|
23
|
+
const { 'data-chat-dir': direction, ...chatProps } = getChatProps(inputProps);
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
<Grid data-chat-dir={direction} {...chatProps}>
|
|
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
|
+
</Grid>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Chat.astro';
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chat コンポーネントの共通プロパティ処理
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
// 各サブ要素のデフォルトプロパティ
|
|
6
|
+
export const defaultProps = {
|
|
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
|
+
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Chat コンポーネントのルートプロパティを生成
|
|
42
|
+
*/
|
|
43
|
+
export default function getChatProps({
|
|
44
|
+
variant = 'speak',
|
|
45
|
+
direction = 'start',
|
|
46
|
+
keycolor = 'gray',
|
|
47
|
+
...props
|
|
48
|
+
}) {
|
|
49
|
+
return {
|
|
50
|
+
lismClass: 'c--chat',
|
|
51
|
+
variant,
|
|
52
|
+
keycolor,
|
|
53
|
+
'data-chat-dir': direction,
|
|
54
|
+
ji: direction,
|
|
55
|
+
...props,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Lism, Flow, Grid, Frame, Decorator } from 'lism-css/react';
|
|
2
|
+
import getChatProps, { defaultProps } from '../getProps';
|
|
3
|
+
import '../_style.css';
|
|
4
|
+
|
|
5
|
+
export default function Chat({ name, avatar, flow = 's', children, ...props }) {
|
|
6
|
+
const { 'data-chat-dir': direction, ...chatProps } = getChatProps(props);
|
|
7
|
+
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Chat';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
@layer lism.modules {
|
|
2
|
+
.c--navMenu {
|
|
3
|
+
--link-td: none;
|
|
4
|
+
--hl: var(--hl--s);
|
|
5
|
+
--_item-p: var(--s20);
|
|
6
|
+
--focus-offset: -1px; /* アコーディオン化した時にoutlineが一部見えなくなるのを防ぐ */
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.c--navMenu_nest {
|
|
10
|
+
--_item-p: inherit;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.c--navMenu_link {
|
|
14
|
+
padding: var(--_item-p);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.c--navMenu_nest,
|
|
18
|
+
.c--navMenu_item {
|
|
19
|
+
--bdc: inherit;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NavMenu コンポーネントの共通プロパティ処理
|
|
3
|
+
*/
|
|
4
|
+
import getMaybeCssVar from 'lism-css/lib/getMaybeCssVar';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* NavMenu.Root のプロパティを処理
|
|
8
|
+
* @param {object} props - コンポーネントのプロパティ
|
|
9
|
+
* @param {string} [props.hovC] - ホバー時のテキストカラー(--hov-c として出力)
|
|
10
|
+
* @param {string} [props.hovBgc] - ホバー時の背景カラー(--hov-bgc として出力)
|
|
11
|
+
* @param {string} [props.itemP] - 各アイテムのパディング(--_item-p として出力)
|
|
12
|
+
* @param {object} [props.style] - スタイルオブジェクト
|
|
13
|
+
*/
|
|
14
|
+
export function getRootProps({ hovC, hovBgc, itemP, style = {}, ...props }) {
|
|
15
|
+
const computedStyle = { ...style };
|
|
16
|
+
|
|
17
|
+
if (hovBgc) computedStyle['--hov-bgc'] = getMaybeCssVar(hovBgc, 'color');
|
|
18
|
+
if (hovC) computedStyle['--hov-c'] = getMaybeCssVar(hovC, 'color');
|
|
19
|
+
if (itemP) computedStyle['--_item-p'] = getMaybeCssVar(itemP, 'space');
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
lismClass: 'c--navMenu',
|
|
23
|
+
tag: 'ul',
|
|
24
|
+
style: computedStyle,
|
|
25
|
+
...props,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* NavMenu.Nest のプロパティを処理
|
|
31
|
+
*/
|
|
32
|
+
export function getNestProps(props) {
|
|
33
|
+
return {
|
|
34
|
+
lismClass: 'c--navMenu_nest',
|
|
35
|
+
tag: 'ul',
|
|
36
|
+
'px-s': '20',
|
|
37
|
+
...props,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* NavMenu.Item のプロパティを処理
|
|
43
|
+
*/
|
|
44
|
+
export function getItemProps(props) {
|
|
45
|
+
return {
|
|
46
|
+
lismClass: 'c--navMenu_item',
|
|
47
|
+
tag: 'li',
|
|
48
|
+
...props,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* NavMenu.Link のプロパティを処理
|
|
54
|
+
* @param {string} [props.href] - リンク先URL。指定時は a タグになる
|
|
55
|
+
* @param {string} [props.tag='span'] - HTML タグ
|
|
56
|
+
*/
|
|
57
|
+
export function getLinkProps({ href, tag = 'span', ...props }) {
|
|
58
|
+
return {
|
|
59
|
+
lismClass: 'c--navMenu_link',
|
|
60
|
+
tag: href ? 'a' : tag,
|
|
61
|
+
href,
|
|
62
|
+
c: 'inherit',
|
|
63
|
+
...props,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Lism, Stack, Flex } from 'lism-css/react';
|
|
2
|
+
import { getRootProps, getNestProps, getItemProps, getLinkProps } from '../getProps';
|
|
3
|
+
import '../_style.css';
|
|
4
|
+
|
|
5
|
+
export function Root({ children, ...props }) {
|
|
6
|
+
return <Stack {...getRootProps(props)}>{children}</Stack>;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function Nest({ children, ...props }) {
|
|
10
|
+
return <Stack {...getNestProps(props)}>{children}</Stack>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function Item({ children, ...props }) {
|
|
14
|
+
return <Lism {...getItemProps(props)}>{children}</Lism>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function Link({ children, ...props }) {
|
|
18
|
+
return <Flex {...getLinkProps(props)}>{children}</Flex>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/* Note: scale 反転は、__inner に対して行う。shapeDivider自身を反転させると、X方向に隙間ができてしまう。 */
|
|
2
|
+
@layer lism.modules {
|
|
3
|
+
.c--shapeDivider {
|
|
4
|
+
--level: 0;
|
|
5
|
+
|
|
6
|
+
/* svg配置調整用 */
|
|
7
|
+
--_inner-offset: 0px;
|
|
8
|
+
--_inner-stretch: 1;
|
|
9
|
+
|
|
10
|
+
/* flip がオンなら -1 にセット */
|
|
11
|
+
--_flipX: 1;
|
|
12
|
+
--_flipY: 1;
|
|
13
|
+
|
|
14
|
+
/* 500px時点を最小値, 1200px時点を最大値にして、clampで高さを変動させる */
|
|
15
|
+
height: clamp(calc(5px * var(--level)), calc(1cqw * var(--level)), calc(12px * var(--level)));
|
|
16
|
+
overflow: visible;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.c--shapeDivider:where([data-flip^='X']) {
|
|
20
|
+
--_flipX: -1;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.c--shapeDivider:where([data-flip$='Y']) {
|
|
24
|
+
--_flipY: -1;
|
|
25
|
+
}
|
|
26
|
+
.c--shapeDivider_inner {
|
|
27
|
+
/* 隙間ができるのを防ぐ */
|
|
28
|
+
--offsetY: 0.5px;
|
|
29
|
+
--offsetX: -0.5px;
|
|
30
|
+
height: 100%;
|
|
31
|
+
width: calc(100% + 1px);
|
|
32
|
+
scale: calc(var(--_flipX) * var(--_inner-stretch)) var(--_flipY);
|
|
33
|
+
translate: calc(var(--offsetX) + var(--_inner-offset)) calc(var(--offsetY) * var(--_flipY));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.c--shapeDivider_svg {
|
|
37
|
+
/* 位置ずれ防止 */
|
|
38
|
+
display: block;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* 左右にスライドするアニメーション */
|
|
42
|
+
:where([data-has-animation='true']) .c--shapeDivider_svg {
|
|
43
|
+
/* ↓ X 100% にしてるのは translateXのcalc計算で * -1 をしなくていいように。*/
|
|
44
|
+
transform-origin: 100% 0;
|
|
45
|
+
animation: lism--slideShape 12s infinite alternate linear;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@keyframes lism--slideShape {
|
|
50
|
+
0% {
|
|
51
|
+
transform: scaleX(4);
|
|
52
|
+
}
|
|
53
|
+
100% {
|
|
54
|
+
transform: scaleX(4) translateX(calc(100% - 25%));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { Lism } from 'lism-css/astro';
|
|
3
|
+
import getProps from '../getProps';
|
|
4
|
+
import '../_style.css';
|
|
5
|
+
|
|
6
|
+
const componentProps = getProps(Astro.props);
|
|
7
|
+
const { viewBox, isAnimation, isEmpty, ...lismProps } = componentProps || {};
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
{
|
|
11
|
+
componentProps && (
|
|
12
|
+
<Lism {...lismProps}>
|
|
13
|
+
{isEmpty ? null : (
|
|
14
|
+
<div class='c--shapeDivider_inner'>
|
|
15
|
+
<svg
|
|
16
|
+
xmlns='http://www.w3.org/2000/svg'
|
|
17
|
+
class='c--shapeDivider_svg'
|
|
18
|
+
viewBox={viewBox}
|
|
19
|
+
width='100%'
|
|
20
|
+
height='100%'
|
|
21
|
+
fill='currentColor'
|
|
22
|
+
focusable='false'
|
|
23
|
+
preserveAspectRatio='none'
|
|
24
|
+
>
|
|
25
|
+
<slot />
|
|
26
|
+
</svg>
|
|
27
|
+
</div>
|
|
28
|
+
)}
|
|
29
|
+
</Lism>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ShapeDivider.astro';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ShapeDivider コンポーネントの共通プロパティ処理
|
|
3
|
+
* @param {string} [props.viewBox] - SVG の viewBox
|
|
4
|
+
* @param {boolean} [props.isAnimation] - アニメーションを有効にするか
|
|
5
|
+
* @param {boolean} [props.isEmpty] - シェイプを非表示にしてスペーサーとして使用
|
|
6
|
+
* @param {number} [props.level=5] - シェイプの高さレベル
|
|
7
|
+
* @param {string} [props.stretch] - 水平方向の引き伸ばし量
|
|
8
|
+
* @param {string} [props.offset] - 水平方向のオフセット
|
|
9
|
+
* @param {string} [props.flip] - X/Y/XY で反転方向を指定
|
|
10
|
+
*/
|
|
11
|
+
export default function getProps({ viewBox, isAnimation, isEmpty, level = 5, stretch, offset, flip, style = {}, ...restProps }) {
|
|
12
|
+
// level が 0 の場合は非表示
|
|
13
|
+
if (level === 0) return null;
|
|
14
|
+
|
|
15
|
+
// CSS変数をセット
|
|
16
|
+
const computedStyle = { ...style };
|
|
17
|
+
computedStyle['--level'] = level || null;
|
|
18
|
+
computedStyle['--_inner-offset'] = offset || null;
|
|
19
|
+
computedStyle['--_inner-stretch'] = stretch || null;
|
|
20
|
+
|
|
21
|
+
const _props = {
|
|
22
|
+
lismClass: 'c--shapeDivider',
|
|
23
|
+
'max-sz': 'full',
|
|
24
|
+
'aria-hidden': 'true',
|
|
25
|
+
};
|
|
26
|
+
if (flip) _props['data-flip'] = flip;
|
|
27
|
+
if (isAnimation) _props['data-has-animation'] = 'true';
|
|
28
|
+
|
|
29
|
+
return {
|
|
30
|
+
..._props,
|
|
31
|
+
style: computedStyle,
|
|
32
|
+
|
|
33
|
+
// SVG用のprops
|
|
34
|
+
viewBox,
|
|
35
|
+
isEmpty,
|
|
36
|
+
|
|
37
|
+
// その他のprops
|
|
38
|
+
...restProps,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Lism } from 'lism-css/react';
|
|
2
|
+
import getProps from '../getProps';
|
|
3
|
+
import '../_style.css';
|
|
4
|
+
|
|
5
|
+
export default function ShapeDivider({ children, ...props }) {
|
|
6
|
+
const componentProps = getProps(props);
|
|
7
|
+
|
|
8
|
+
// level が 0 の場合は非表示
|
|
9
|
+
if (!componentProps) return null;
|
|
10
|
+
|
|
11
|
+
const { viewBox, isAnimation, isEmpty, ...lismProps } = componentProps;
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<Lism {...lismProps}>
|
|
15
|
+
{isEmpty ? null : (
|
|
16
|
+
<div className='c--shapeDivider_inner'>
|
|
17
|
+
<svg
|
|
18
|
+
xmlns='http://www.w3.org/2000/svg'
|
|
19
|
+
className='c--shapeDivider_svg'
|
|
20
|
+
viewBox={viewBox}
|
|
21
|
+
width='100%'
|
|
22
|
+
height='100%'
|
|
23
|
+
fill='currentColor'
|
|
24
|
+
focusable='false'
|
|
25
|
+
preserveAspectRatio='none'
|
|
26
|
+
>
|
|
27
|
+
{children}
|
|
28
|
+
</svg>
|
|
29
|
+
</div>
|
|
30
|
+
)}
|
|
31
|
+
</Lism>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ShapeDivider';
|
package/src/components/astro.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
export { default as Accordion } from './Accordion/astro';
|
|
2
|
+
export { default as Alert } from './Alert/astro';
|
|
2
3
|
export { default as Avatar } from './Avatar/astro';
|
|
3
4
|
export { default as Badge } from './Badge/astro';
|
|
4
5
|
export { default as Button } from './Button/astro';
|
|
6
|
+
export { default as Callout } from './Callout/astro';
|
|
7
|
+
export { default as Chat } from './Chat/astro';
|
|
5
8
|
export { default as Modal } from './Modal/astro';
|
|
9
|
+
export { default as NavMenu } from './NavMenu/astro';
|
|
10
|
+
export { default as ShapeDivider } from './ShapeDivider/astro';
|
|
6
11
|
export { default as Tabs } from './Tabs/astro';
|