@lism-css/ui 0.9.3 → 0.11.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.
Files changed (127) hide show
  1. package/README.ja.md +137 -0
  2. package/README.md +93 -5
  3. package/dist/components/Callout/getProps.d.ts +0 -1
  4. package/dist/components/Callout/getProps.js +11 -12
  5. package/dist/components/Chat/getProps.js +1 -6
  6. package/dist/components/DummyImage/astro/index.d.ts +1 -0
  7. package/dist/components/DummyImage/react/DummyImage.d.ts +2 -0
  8. package/dist/components/DummyImage/react/DummyImage.js +8 -0
  9. package/dist/components/DummyImage/react/index.d.ts +1 -0
  10. package/dist/components/DummyText/astro/index.d.ts +1 -0
  11. package/dist/components/DummyText/getContent.d.ts +11 -0
  12. package/dist/components/DummyText/getContent.js +9 -0
  13. package/dist/components/DummyText/react/DummyText.d.ts +10 -0
  14. package/dist/components/DummyText/react/DummyText.js +10 -0
  15. package/dist/components/DummyText/react/index.d.ts +1 -0
  16. package/dist/components/DummyText/texts.d.ts +22 -0
  17. package/dist/components/DummyText/texts.js +39 -0
  18. package/dist/components/NavMenu/getProps.js +2 -2
  19. package/dist/components/Tabs/react/Tab.js +1 -12
  20. package/dist/components/Tabs/react/Tabs.js +1 -3
  21. package/dist/components/astro.d.ts +2 -0
  22. package/dist/components/react.d.ts +2 -0
  23. package/dist/components/react.js +20 -16
  24. package/dist/lism-css/dist/components/atomic/Decorator/getProps.js +10 -10
  25. package/dist/lism-css/dist/components/atomic/Icon/getProps.js +28 -27
  26. package/dist/lism-css/dist/config/defaults/props.js +6 -1
  27. package/dist/lism-css/dist/config/defaults/states.js +1 -2
  28. package/dist/lism-css/dist/config/defaults/tokens.js +3 -3
  29. package/dist/lism-css/dist/lib/getMaybeCssVar.js +26 -21
  30. package/dist/style.css +1 -1
  31. package/dist/ui.css +1 -1
  32. package/package.json +5 -4
  33. package/src/components/Accordion/_style.css +69 -69
  34. package/src/components/Accordion/astro/Button.astro +2 -2
  35. package/src/components/Accordion/astro/Heading.astro +1 -1
  36. package/src/components/Accordion/astro/Item.astro +7 -7
  37. package/src/components/Accordion/astro/Panel.astro +3 -3
  38. package/src/components/Accordion/astro/Root.astro +3 -3
  39. package/src/components/Accordion/getProps.js +54 -54
  40. package/src/components/Accordion/react/AccIcon.jsx +1 -1
  41. package/src/components/Accordion/react/Accordion.jsx +34 -34
  42. package/src/components/Accordion/script.js +1 -1
  43. package/src/components/Accordion/setAccordion.js +93 -93
  44. package/src/components/Alert/astro/Alert.astro +6 -6
  45. package/src/components/Alert/getProps.ts +22 -22
  46. package/src/components/Alert/presets.ts +26 -26
  47. package/src/components/Alert/react/Alert.tsx +9 -9
  48. package/src/components/Avatar/astro/Avatar.astro +2 -2
  49. package/src/components/Avatar/react/Avatar.jsx +5 -5
  50. package/src/components/Badge/_style.css +14 -14
  51. package/src/components/Badge/astro/Badge.astro +4 -4
  52. package/src/components/Badge/react/Badge.jsx +6 -6
  53. package/src/components/Button/_style.css +29 -29
  54. package/src/components/Button/astro/Button.astro +4 -4
  55. package/src/components/Button/react/Button.jsx +6 -6
  56. package/src/components/Callout/astro/Callout.astro +13 -13
  57. package/src/components/Callout/getProps.ts +23 -24
  58. package/src/components/Callout/presets.ts +26 -26
  59. package/src/components/Callout/react/Callout.tsx +16 -16
  60. package/src/components/Chat/_style.css +49 -49
  61. package/src/components/Chat/astro/Chat.astro +27 -27
  62. package/src/components/Chat/getProps.js +40 -45
  63. package/src/components/Chat/react/Chat.jsx +17 -17
  64. package/src/components/Details/_style.css +39 -39
  65. package/src/components/Details/astro/Content.astro +3 -3
  66. package/src/components/Details/astro/Details.astro +1 -1
  67. package/src/components/Details/astro/Icon.astro +1 -1
  68. package/src/components/Details/astro/Summary.astro +2 -2
  69. package/src/components/Details/astro/Title.astro +1 -1
  70. package/src/components/Details/getProps.js +7 -7
  71. package/src/components/Details/react/Details.jsx +24 -24
  72. package/src/components/DummyImage/astro/DummyImage.astro +7 -0
  73. package/src/components/DummyImage/astro/index.ts +1 -0
  74. package/src/components/DummyImage/react/DummyImage.tsx +5 -0
  75. package/src/components/DummyImage/react/index.ts +1 -0
  76. package/src/components/DummyText/astro/DummyText.astro +9 -0
  77. package/src/components/DummyText/astro/index.ts +1 -0
  78. package/src/components/DummyText/getContent.ts +39 -0
  79. package/src/components/DummyText/react/DummyText.tsx +15 -0
  80. package/src/components/DummyText/react/index.ts +1 -0
  81. package/src/components/DummyText/texts.ts +39 -0
  82. package/src/components/Modal/_style.css +34 -34
  83. package/src/components/Modal/astro/Body.astro +1 -1
  84. package/src/components/Modal/astro/CloseBtn.astro +10 -10
  85. package/src/components/Modal/astro/Inner.astro +1 -1
  86. package/src/components/Modal/astro/Modal.astro +3 -3
  87. package/src/components/Modal/astro/OpenBtn.astro +1 -1
  88. package/src/components/Modal/getProps.js +19 -19
  89. package/src/components/Modal/react/Body.jsx +5 -5
  90. package/src/components/Modal/react/CloseBtn.jsx +13 -13
  91. package/src/components/Modal/react/Inner.jsx +1 -1
  92. package/src/components/Modal/react/Modal.jsx +10 -10
  93. package/src/components/Modal/react/OpenBtn.jsx +5 -5
  94. package/src/components/Modal/script.js +1 -1
  95. package/src/components/Modal/setModal.ts +92 -92
  96. package/src/components/NavMenu/_style.css +17 -17
  97. package/src/components/NavMenu/astro/Item.astro +1 -1
  98. package/src/components/NavMenu/astro/Link.astro +1 -1
  99. package/src/components/NavMenu/astro/Nest.astro +1 -1
  100. package/src/components/NavMenu/astro/Root.astro +1 -1
  101. package/src/components/NavMenu/getProps.js +28 -28
  102. package/src/components/NavMenu/react/NavMenu.jsx +4 -4
  103. package/src/components/ShapeDivider/_style.css +51 -51
  104. package/src/components/ShapeDivider/astro/ShapeDivider.astro +20 -20
  105. package/src/components/ShapeDivider/getProps.js +23 -23
  106. package/src/components/ShapeDivider/react/ShapeDivider.jsx +24 -24
  107. package/src/components/Tabs/_style.css +29 -29
  108. package/src/components/Tabs/astro/Tab.astro +2 -2
  109. package/src/components/Tabs/astro/TabItem.astro +1 -1
  110. package/src/components/Tabs/astro/TabList.astro +2 -2
  111. package/src/components/Tabs/astro/TabPanel.astro +2 -2
  112. package/src/components/Tabs/astro/Tabs.astro +20 -20
  113. package/src/components/Tabs/astro/transformTabitems.js +30 -30
  114. package/src/components/Tabs/getProps.js +4 -4
  115. package/src/components/Tabs/react/Tab.jsx +4 -12
  116. package/src/components/Tabs/react/TabItem.jsx +1 -1
  117. package/src/components/Tabs/react/TabList.jsx +2 -2
  118. package/src/components/Tabs/react/TabPanel.jsx +2 -2
  119. package/src/components/Tabs/react/Tabs.jsx +44 -46
  120. package/src/components/Tabs/script.js +4 -4
  121. package/src/components/Tabs/setTabs.js +70 -70
  122. package/src/components/astro.ts +2 -0
  123. package/src/components/react.ts +2 -0
  124. package/src/helper/animation.ts +10 -10
  125. package/src/helper/uuid.js +3 -3
  126. package/dist/lism-css/dist/components/getFilterProps.js +0 -23
  127. package/dist/lism-css/dist/components/setMaybeTransformStyles.js +0 -7
@@ -1,34 +1,34 @@
1
- @layer lism.modules {
2
- .c--button {
3
- --c: var(--base);
4
- --bgc: var(--text);
5
- --bdc: var(--bgc);
1
+ @layer lism-modules {
2
+ .c--button {
3
+ --c: var(--base);
4
+ --bgc: var(--text);
5
+ --bdc: var(--bgc);
6
6
 
7
- color: var(--c);
8
- background-color: var(--bgc);
9
- border: solid 1px var(--bdc); /* 異なる variant を並べてもサイズに差が出ないようにborderを常に指定 */
7
+ color: var(--c);
8
+ background-color: var(--bgc);
9
+ border: solid 1px var(--bdc); /* 異なる variant を並べてもサイズに差が出ないようにborderを常に指定 */
10
10
 
11
- gap: var(--s10);
12
- text-decoration: none;
13
- place-content: center;
14
- place-items: center;
15
- }
16
- .c--button--outline {
17
- --c: var(--text);
18
- --bgc: transparent;
19
- --bdc: var(--c);
20
- }
11
+ gap: var(--s10);
12
+ text-decoration: none;
13
+ place-content: center;
14
+ place-items: center;
15
+ }
16
+ .c--button--outline {
17
+ --c: var(--text);
18
+ --bgc: transparent;
19
+ --bdc: var(--c);
20
+ }
21
21
 
22
- :where(.c--button) > .a--icon {
23
- scale: 1.05;
24
- }
22
+ :where(.c--button) > .a--icon {
23
+ scale: 1.05;
24
+ }
25
25
 
26
- /* l--gridを使用する場合の追加スタイル */
27
- .c--button:where(.l--grid) {
28
- grid-template-columns: minmax(1em, auto) 1fr minmax(1em, auto);
29
- justify-items: center;
30
- }
31
- .c--button:where(.l--grid) > :not(.a--icon) {
32
- grid-column: 2;
33
- }
26
+ /* l--gridを使用する場合の追加スタイル */
27
+ .c--button:where(.l--grid) {
28
+ grid-template-columns: minmax(1em, auto) 1fr minmax(1em, auto);
29
+ justify-items: center;
30
+ }
31
+ .c--button:where(.l--grid) > :not(.a--icon) {
32
+ grid-column: 2;
33
+ }
34
34
  }
@@ -6,11 +6,11 @@ const props = Astro.props;
6
6
 
7
7
  // c--button では c, bgc は 変数で受け取る
8
8
  const _propConfig = {
9
- c: { isVar: 1 },
10
- bgc: { isVar: 1 },
9
+ c: { isVar: 1 },
10
+ bgc: { isVar: 1 },
11
11
  };
12
12
  ---
13
13
 
14
- <Flex lismClass='c--button' as='a' lh='s' py='10' px='20' hov='o' _propConfig={_propConfig} {...props}>
15
- <slot />
14
+ <Flex lismClass="c--button" as="a" lh="s" py="10" px="20" hov="o" _propConfig={_propConfig} {...props}>
15
+ <slot />
16
16
  </Flex>
@@ -2,11 +2,11 @@ import { Flex } from 'lism-css/react';
2
2
  import '../_style.css';
3
3
 
4
4
  export default function Button(props) {
5
- // c--button では c, bgc は 変数で受け取る
6
- const _propConfig = {
7
- c: { isVar: 1 },
8
- bgc: { isVar: 1 },
9
- };
5
+ // c--button では c, bgc は 変数で受け取る
6
+ const _propConfig = {
7
+ c: { isVar: 1 },
8
+ bgc: { isVar: 1 },
9
+ };
10
10
 
11
- return <Flex lismClass='c--button' as='a' lh='s' py='10' px='20' hov='o' _propConfig={_propConfig} {...props} />;
11
+ return <Flex lismClass="c--button" as="a" lh="s" py="10" px="20" hov="o" _propConfig={_propConfig} {...props} />;
12
12
  }
@@ -8,17 +8,17 @@ const { icon, title, flow, ...calloutProps } = getCalloutProps(Astro.props);
8
8
  ---
9
9
 
10
10
  <Stack {...calloutProps}>
11
- {
12
- title && (
13
- <Flex class='c--callout_head' c='keycolor' fw='bold' ai='center' g='10'>
14
- <Center class='c--callout_icon' fz='xl'>
15
- <Icon icon={icon} />
16
- </Center>
17
- <span class='c--callout_title'>{title}</span>
18
- </Flex>
19
- )
20
- }
21
- <Flow class='c--callout_body' flow={flow}>
22
- <slot />
23
- </Flow>
11
+ {
12
+ title && (
13
+ <Flex class="c--callout_head" c="keycolor" fw="bold" ai="center" g="10">
14
+ <Center class="c--callout_icon" fz="xl">
15
+ <Icon icon={icon} />
16
+ </Center>
17
+ <span class="c--callout_title">{title}</span>
18
+ </Flex>
19
+ )
20
+ }
21
+ <Flow class="c--callout_body" flow={flow}>
22
+ <slot />
23
+ </Flow>
24
24
  </Stack>
@@ -1,32 +1,31 @@
1
1
  import PRESETS from './presets';
2
2
 
3
3
  export type CalloutProps = {
4
- type?: string;
5
- keycolor?: string;
6
- icon?: string;
7
- title?: string;
8
- flow?: string;
9
- [key: string]: unknown;
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
- const presetData = type ? PRESETS[type] : null;
14
- const _icon = icon || presetData?.icon || 'note';
15
- const _keycolor = keycolor || presetData?.color || null;
13
+ const presetData = type ? PRESETS[type] : null;
14
+ const _icon = icon || presetData?.icon || 'note';
15
+ const _keycolor = keycolor || presetData?.color || null;
16
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': '-',
27
- bdw: '4px',
28
- bxsh: '10',
29
- bdrs: '5',
30
- ...props,
31
- };
17
+ return {
18
+ icon: _icon,
19
+ title,
20
+ flow,
21
+ lismClass: 'c--callout u--cbox set--shadow',
22
+ keycolor: _keycolor,
23
+ p: '20',
24
+ g: '10',
25
+ bdc: 'keycolor',
26
+ 'bd-x-s': '-',
27
+ bdw: '3px',
28
+ bxsh: '10',
29
+ ...props,
30
+ };
32
31
  }
@@ -1,33 +1,33 @@
1
1
  type PresetData = {
2
- icon: string;
3
- color: string;
2
+ icon: string;
3
+ color: string;
4
4
  };
5
5
 
6
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
- },
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
- const { icon, title, flow, ...calloutProps } = getCalloutProps(inputProps);
6
+ const { icon, title, flow, ...calloutProps } = getCalloutProps(inputProps);
7
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
- );
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.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;
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
- gap: 0 calc(var(--_deco-size) + 1px);
15
- }
14
+ gap: 0 calc(var(--_deco-size) + 1px);
15
+ }
16
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
- }
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
- .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
- }
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
- [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
- }
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
- border-start-start-radius: 0;
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
- border-start-end-radius: 0;
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
- 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;
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
- 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>
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
- 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
- },
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
- 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
- };
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
- const { 'data-chat-dir': direction, ...chatProps } = getChatProps(props);
6
+ const { 'data-chat-dir': direction, ...chatProps } = getChatProps(props);
7
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
- );
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
  }