@lism-css/ui 0.2.1 → 0.2.3

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 (74) hide show
  1. package/dist/components/Accordion/astro/index.d.ts +6 -0
  2. package/dist/components/Accordion/setAccordion.js +7 -7
  3. package/dist/components/Avatar/astro/index.d.ts +1 -1
  4. package/dist/components/Badge/astro/index.d.ts +1 -1
  5. package/dist/components/Button/astro/index.d.ts +1 -1
  6. package/dist/components/Callout/getProps.d.ts +1 -1
  7. package/dist/components/Chat/astro/index.d.ts +1 -0
  8. package/dist/components/Chat/getProps.d.ts +53 -0
  9. package/dist/components/Chat/react/Chat.d.ts +7 -0
  10. package/dist/components/Chat/react/index.d.ts +1 -0
  11. package/dist/components/Modal/astro/index.d.ts +5 -0
  12. package/dist/components/Modal/setModal.js +1 -1
  13. package/dist/components/NavMenu/astro/index.d.ts +11 -0
  14. package/dist/components/NavMenu/getProps.d.ts +32 -0
  15. package/dist/components/NavMenu/react/NavMenu.d.ts +16 -0
  16. package/dist/components/NavMenu/react/index.d.ts +8 -0
  17. package/dist/components/ShapeDivider/astro/index.d.ts +1 -0
  18. package/dist/components/ShapeDivider/getProps.d.ts +11 -0
  19. package/dist/components/ShapeDivider/react/ShapeDivider.d.ts +4 -0
  20. package/dist/components/ShapeDivider/react/index.d.ts +1 -0
  21. package/dist/components/Tabs/astro/index.d.ts +5 -0
  22. package/dist/components/astro.d.ts +3 -0
  23. package/dist/components/react.d.ts +3 -0
  24. package/dist/scripts/tabs.js +1 -1
  25. package/dist/style.css +1 -1
  26. package/package.json +1 -1
  27. package/src/components/Accordion/_style.css +10 -10
  28. package/src/components/Accordion/getProps.js +6 -6
  29. package/src/components/Accordion/setAccordion.js +2 -2
  30. package/src/components/Avatar/astro/Avatar.astro +0 -1
  31. package/src/components/Avatar/react/Avatar.jsx +0 -1
  32. package/src/components/Callout/getProps.ts +1 -1
  33. package/src/components/Chat/_style.css +64 -0
  34. package/src/components/Chat/astro/Chat.astro +41 -0
  35. package/src/components/Chat/astro/index.js +1 -0
  36. package/src/components/Chat/getProps.js +57 -0
  37. package/src/components/Chat/react/Chat.jsx +24 -0
  38. package/src/components/Chat/react/index.js +1 -0
  39. package/src/components/Modal/_style.css +7 -7
  40. package/src/components/Modal/getProps.js +3 -3
  41. package/src/components/Modal/react/Body.jsx +1 -1
  42. package/src/components/Modal/react/CloseBtn.jsx +1 -2
  43. package/src/components/Modal/react/Inner.jsx +1 -1
  44. package/src/components/Modal/react/Modal.jsx +1 -1
  45. package/src/components/Modal/react/OpenBtn.jsx +1 -1
  46. package/src/components/Modal/setModal.ts +1 -1
  47. package/src/components/NavMenu/_style.css +21 -0
  48. package/src/components/NavMenu/astro/Item.astro +8 -0
  49. package/src/components/NavMenu/astro/Link.astro +8 -0
  50. package/src/components/NavMenu/astro/Nest.astro +8 -0
  51. package/src/components/NavMenu/astro/Root.astro +9 -0
  52. package/src/components/NavMenu/astro/index.js +6 -0
  53. package/src/components/NavMenu/getProps.js +65 -0
  54. package/src/components/NavMenu/react/NavMenu.jsx +19 -0
  55. package/src/components/NavMenu/react/index.js +3 -0
  56. package/src/components/ShapeDivider/_style.css +56 -0
  57. package/src/components/ShapeDivider/astro/ShapeDivider.astro +31 -0
  58. package/src/components/ShapeDivider/astro/index.js +1 -0
  59. package/src/components/ShapeDivider/getProps.js +40 -0
  60. package/src/components/ShapeDivider/react/ShapeDivider.jsx +33 -0
  61. package/src/components/ShapeDivider/react/index.js +1 -0
  62. package/src/components/Tabs/_style.css +4 -4
  63. package/src/components/Tabs/astro/Tab.astro +1 -1
  64. package/src/components/Tabs/astro/TabList.astro +1 -1
  65. package/src/components/Tabs/astro/TabPanel.astro +1 -1
  66. package/src/components/Tabs/astro/Tabs.astro +1 -1
  67. package/src/components/Tabs/getProps.js +1 -1
  68. package/src/components/Tabs/react/Tab.jsx +1 -1
  69. package/src/components/Tabs/react/TabList.jsx +1 -1
  70. package/src/components/Tabs/react/TabPanel.jsx +1 -1
  71. package/src/components/Tabs/script.js +1 -1
  72. package/src/components/astro.ts +3 -0
  73. package/src/components/react.ts +3 -0
  74. package/src/style.scss +3 -0
@@ -1,3 +1,9 @@
1
+ import { default as Root } from './Accordion.astro';
2
+ import { default as Header } from './AccHeader.astro';
3
+ import { default as HeaderLabel } from './AccHeaderLabel.astro';
4
+ import { default as Body } from './AccBody.astro';
5
+ import { default as Icon } from './AccIcon.astro';
6
+ import { default as Label } from './AccLabel.astro';
1
7
  declare namespace _default {
2
8
  export { Root };
3
9
  export { Header };
@@ -1,5 +1,5 @@
1
1
  const l = (e) => {
2
- const t = e.querySelector(".d--accordion_body"), n = t ? t.getAnimations() : [];
2
+ const t = e.querySelector(".c--accordion_body"), n = t ? t.getAnimations() : [];
3
3
  return Promise.allSettled(n.map((o) => o.finished));
4
4
  }, s = async (e) => {
5
5
  e.open && e.hasAttribute("data-opened") || (e.open = !0, requestAnimationFrame(() => {
@@ -26,7 +26,7 @@ const l = (e) => {
26
26
  }, u = (e) => {
27
27
  const t = e.open, n = e.hasAttribute("data-opened");
28
28
  t && !n && e.setAttribute("data-opened", ""), !t && n && e.removeAttribute("data-opened");
29
- }, d = (e) => {
29
+ }, m = (e) => {
30
30
  const t = i(e), n = e.querySelector("summary");
31
31
  if (!n) return;
32
32
  const o = (c) => {
@@ -37,12 +37,12 @@ const l = (e) => {
37
37
  return n.addEventListener("click", o), e.addEventListener("toggle", r), () => {
38
38
  n.removeEventListener("click", o), e.removeEventListener("toggle", r);
39
39
  };
40
- }, m = () => {
41
- document.querySelectorAll(".d--accordion").forEach((t) => {
42
- d(t);
40
+ }, d = () => {
41
+ document.querySelectorAll(".c--accordion").forEach((t) => {
42
+ m(t);
43
43
  });
44
44
  };
45
45
  export {
46
- m as default,
47
- d as setEvent
46
+ d as default,
47
+ m as setEvent
48
48
  };
@@ -1 +1 @@
1
- export {};
1
+ export { default } from './Avatar.astro';
@@ -1 +1 @@
1
- export {};
1
+ export { default } from './Badge.astro';
@@ -1 +1 @@
1
- export {};
1
+ export { default } from './Button.astro';
@@ -7,7 +7,7 @@ export type CalloutProps = {
7
7
  [key: string]: unknown;
8
8
  };
9
9
  export default function getCalloutProps({ type, keycolor, icon, title, flow, ...props }: CalloutProps): {
10
- icon: string | null;
10
+ icon: string;
11
11
  title: string | undefined;
12
12
  flow: string;
13
13
  lismClass: string;
@@ -0,0 +1 @@
1
+ export { default } from './Chat.astro';
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Chat コンポーネントのルートプロパティを生成
3
+ */
4
+ export default function getChatProps({ variant, direction, keycolor, ...props }: {
5
+ [x: string]: any;
6
+ variant?: string | undefined;
7
+ direction?: string | undefined;
8
+ keycolor?: string | undefined;
9
+ }): {
10
+ lismClass: string;
11
+ variant: string;
12
+ keycolor: string;
13
+ 'data-chat-dir': string;
14
+ ji: string;
15
+ };
16
+ export namespace defaultProps {
17
+ let avatar: {
18
+ lismClass: string;
19
+ bgc: string;
20
+ ar: string;
21
+ bdrs: string;
22
+ 'aria-hidden': string;
23
+ };
24
+ namespace name {
25
+ let lismClass: string;
26
+ let c: string;
27
+ let fs: string;
28
+ let fz: string;
29
+ let lh: string;
30
+ let py: string;
31
+ let px: string;
32
+ let aslf: string;
33
+ }
34
+ namespace body {
35
+ let lismClass_1: string;
36
+ export { lismClass_1 as lismClass };
37
+ export let pos: string;
38
+ }
39
+ namespace deco {
40
+ let lismClass_2: string;
41
+ export { lismClass_2 as lismClass };
42
+ let pos_1: string;
43
+ export { pos_1 as pos };
44
+ }
45
+ namespace content {
46
+ let lismClass_3: string;
47
+ export { lismClass_3 as lismClass };
48
+ export let bdrs: string;
49
+ export let p: string;
50
+ let lh_1: string;
51
+ export { lh_1 as lh };
52
+ }
53
+ }
@@ -0,0 +1,7 @@
1
+ export default function Chat({ name, avatar, flow, children, ...props }: {
2
+ [x: string]: any;
3
+ name: any;
4
+ avatar: any;
5
+ flow?: string | undefined;
6
+ children: any;
7
+ }): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ export { default } from './Chat';
@@ -1,3 +1,8 @@
1
+ import { default as Root } from './Modal.astro';
2
+ import { default as Inner } from './Inner.astro';
3
+ import { default as Body } from './Body.astro';
4
+ import { default as CloseBtn } from './CloseBtn.astro';
5
+ import { default as OpenBtn } from './OpenBtn.astro';
1
6
  declare namespace _default {
2
7
  export { Root };
3
8
  export { Inner };
@@ -31,7 +31,7 @@ function l(e) {
31
31
  });
32
32
  }
33
33
  const u = () => {
34
- const e = document.querySelectorAll(".d--modal");
34
+ const e = document.querySelectorAll(".c--modal");
35
35
  e == null || e.forEach((n) => {
36
36
  l(n);
37
37
  });
@@ -0,0 +1,11 @@
1
+ import { default as Root } from './Root.astro';
2
+ import { default as Nest } from './Nest.astro';
3
+ import { default as Item } from './Item.astro';
4
+ import { default as Link } from './Link.astro';
5
+ declare namespace _default {
6
+ export { Root };
7
+ export { Nest };
8
+ export { Item };
9
+ export { Link };
10
+ }
11
+ export default _default;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * NavMenu.Root のプロパティを処理
3
+ * @param {object} props - コンポーネントのプロパティ
4
+ * @param {string} [props.hovC] - ホバー時のテキストカラー(--hov-c として出力)
5
+ * @param {string} [props.hovBgc] - ホバー時の背景カラー(--hov-bgc として出力)
6
+ * @param {string} [props.itemP] - 各アイテムのパディング(--_item-p として出力)
7
+ * @param {object} [props.style] - スタイルオブジェクト
8
+ */
9
+ export function getRootProps({ hovC, hovBgc, itemP, style, ...props }: {
10
+ hovC?: string | undefined;
11
+ hovBgc?: string | undefined;
12
+ itemP?: string | undefined;
13
+ style?: object | undefined;
14
+ }): {
15
+ lismClass: string;
16
+ tag: string;
17
+ style: {};
18
+ };
19
+ /**
20
+ * NavMenu.Nest のプロパティを処理
21
+ */
22
+ export function getNestProps(props: any): any;
23
+ /**
24
+ * NavMenu.Item のプロパティを処理
25
+ */
26
+ export function getItemProps(props: any): any;
27
+ /**
28
+ * NavMenu.Link のプロパティを処理
29
+ * @param {string} [props.href] - リンク先URL。指定時は a タグになる
30
+ * @param {string} [props.tag='span'] - HTML タグ
31
+ */
32
+ export function getLinkProps({ href, tag, ...props }?: string): any;
@@ -0,0 +1,16 @@
1
+ export function Root({ children, ...props }: {
2
+ [x: string]: any;
3
+ children: any;
4
+ }): import("react").JSX.Element;
5
+ export function Nest({ children, ...props }: {
6
+ [x: string]: any;
7
+ children: any;
8
+ }): import("react").JSX.Element;
9
+ export function Item({ children, ...props }: {
10
+ [x: string]: any;
11
+ children: any;
12
+ }): import("react").JSX.Element;
13
+ export function Link({ children, ...props }: {
14
+ [x: string]: any;
15
+ children: any;
16
+ }): import("react").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { Root, Item, Link, Nest } from './NavMenu';
2
+ declare namespace _default {
3
+ export { Root };
4
+ export { Item };
5
+ export { Link };
6
+ export { Nest };
7
+ }
8
+ export default _default;
@@ -0,0 +1 @@
1
+ export { default } from './ShapeDivider.astro';
@@ -0,0 +1,11 @@
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, stretch, offset, flip, style, ...restProps }?: string): any;
@@ -0,0 +1,4 @@
1
+ export default function ShapeDivider({ children, ...props }: {
2
+ [x: string]: any;
3
+ children: any;
4
+ }): import("react").JSX.Element | null;
@@ -0,0 +1 @@
1
+ export { default } from './ShapeDivider';
@@ -1,3 +1,8 @@
1
+ import { default as Root } from './Tabs.astro';
2
+ import { default as List } from './TabList.astro';
3
+ import { default as Panel } from './TabPanel.astro';
4
+ import { default as Item } from './TabItem.astro';
5
+ import { default as Tab } from './Tab.astro';
1
6
  declare namespace _default {
2
7
  export { Root };
3
8
  export { List };
@@ -4,5 +4,8 @@ export { default as Avatar } from './Avatar/astro';
4
4
  export { default as Badge } from './Badge/astro';
5
5
  export { default as Button } from './Button/astro';
6
6
  export { default as Callout } from './Callout/astro';
7
+ export { default as Chat } from './Chat/astro';
7
8
  export { default as Modal } from './Modal/astro';
9
+ export { default as NavMenu } from './NavMenu/astro';
10
+ export { default as ShapeDivider } from './ShapeDivider/astro';
8
11
  export { default as Tabs } from './Tabs/astro';
@@ -4,5 +4,8 @@ export { default as Avatar } from './Avatar/react';
4
4
  export { default as Badge } from './Badge/react';
5
5
  export { default as Button } from './Button/react';
6
6
  export { default as Callout } from './Callout/react';
7
+ export { default as Chat } from './Chat/react';
7
8
  export { default as Modal } from './Modal/react';
9
+ export { default as NavMenu } from './NavMenu/react';
10
+ export { default as ShapeDivider } from './ShapeDivider/react';
8
11
  export { default as Tabs } from './Tabs/react';
@@ -1,6 +1,6 @@
1
1
  import e from "../components/Tabs/setTabs.js";
2
2
  document.addEventListener("DOMContentLoaded", function() {
3
- document.querySelectorAll(".d--tabs").forEach((t) => {
3
+ document.querySelectorAll(".c--tabs").forEach((t) => {
4
4
  e(t);
5
5
  });
6
6
  });
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- @layer lism.modules{.d--accordion{--duration:var(--acc-duration,0.25s)}.d--accordion[data-opened]{--_notOpen: }.d--accordion:not([data-opened]){--_isOpen: }.d--accordion_header{align-items:center;display:grid;gap:.5em;grid:auto/1fr auto;--focus-offset:-1px;&::-webkit-details-marker{display:none}}.d--accordion_body{display:grid;grid:1fr/auto;transition-duration:var(--duration);transition-property:margin-block,padding-block,opacity,grid-template}.d--accordion_inner{overflow:hidden}.d--accordion:not([data-opened])>.d--accordion_body{grid:0fr/auto;margin-block:0!important;padding-block:0!important}.d--accordion_icon{display:grid}.d--accordion_icon>.a--icon{transform:var(--_isOpen,scaleY(-1));transition:transform var(--duration)}.c--badge{--c:var(--base);--bgc:var(--text);--bdc:transparent;background-color:var(--bgc);border:1px solid var(--bdc);color:var(--c)}.c--badge--outline{--c:var(--text);--bgc:transparent;--bdc:currentColor}.c--button{--c:var(--base);--bgc:var(--text);--bdc:var(--bgc);background-color:var(--bgc);border:1px solid var(--bdc);color:var(--c);gap:var(--s10);place-content:center;place-items:center;text-decoration:none}.c--button--outline{--c:var(--text);--bgc:transparent;--bdc:var(--c)}}@layer lism.modules{}@layer lism.modules{:where(.c--button)>.a--icon{scale:1.05}.c--button:where(.l--grid){grid-template-columns:minmax(1em,auto) 1fr minmax(1em,auto);justify-items:center}.c--button:where(.l--grid)>:not(.a--icon){grid-column:2}}
1
+ @layer lism.modules{.c--accordion{--duration:var(--acc-duration,0.25s)}.c--accordion[data-opened]{--_notOpen: }.c--accordion:not([data-opened]){--_isOpen: }.c--accordion_header{align-items:center;display:grid;gap:.5em;grid:auto/1fr auto;--focus-offset:-1px;&::-webkit-details-marker{display:none}}.c--accordion_body{display:grid;grid:1fr/auto;transition-duration:var(--duration);transition-property:margin-block,padding-block,opacity,grid-template}.c--accordion_inner{overflow:hidden}.c--accordion:not([data-opened])>.c--accordion_body{grid:0fr/auto;margin-block:0!important;padding-block:0!important}.c--accordion_icon{display:grid}.c--accordion_icon>.a--icon{transform:var(--_isOpen,scaleY(-1));transition:transform var(--duration)}.c--badge{--c:var(--base);--bgc:var(--text);--bdc:transparent;background-color:var(--bgc);border:1px solid var(--bdc);color:var(--c)}.c--badge--outline{--c:var(--text);--bgc:transparent;--bdc:currentColor}.c--button{--c:var(--base);--bgc:var(--text);--bdc:var(--bgc);background-color:var(--bgc);border:1px solid var(--bdc);color:var(--c);gap:var(--s10);place-content:center;place-items:center;text-decoration:none}.c--button--outline{--c:var(--text);--bgc:transparent;--bdc:var(--c)}}@layer lism.modules{}@layer lism.modules{:where(.c--button)>.a--icon{scale:1.05}.c--button:where(.l--grid){grid-template-columns:minmax(1em,auto) 1fr minmax(1em,auto);justify-items:center}.c--button:where(.l--grid)>:not(.a--icon){grid-column:2}}@layer lism.modules{.c--chat{--cbox-bgPct:8%;--gta:"avatar name" "avatar body";--gtc:auto 1fr;--gtr:minmax(1.5rem,auto) auto;--_avator-size:clamp(48px,32px + 5cqw,64px);--_deco-size:calc(min(var(--_avator-size), 80px)/4 + 0.25rem);--_deco-mask:none;--_deco-t:0;--_deco-scale:1;--_deco-inset-x:0;gap:0 calc(var(--_deco-size) + 1px)}.c--chat_avatar{grid-area:avatar;width:var(--_avator-size)}.c--chat_name{grid-area:name}.c--chat_body{grid-area:body}.c--chat_content{max-width:var(--sz--s)}.c--chat_deco{height:var(--_deco-size);top:var(--_deco-t);inset-inline:var(--_deco-inset-x);-webkit-mask:var(--_deco-mask) center/contain no-repeat;mask:var(--_deco-mask) center/contain no-repeat;scale:var(--_deco-scale);width:var(--_deco-size)}.c--chat--speak{--_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>')}[data-chat-dir=start]{--_deco-inset-x:auto calc(100% - 1px)}[data-chat-dir=end]{--_deco-scale:-1 1;--_deco-inset-x:calc(100% - 1px) auto;--gta:"name avatar" "body avatar";--gtc:1fr auto}}.c--chat--speak[data-chat-dir=start]>div>.c--chat_content{border-start-start-radius:0}.c--chat--speak[data-chat-dir=end]>div>.c--chat_content{border-start-end-radius:0}@layer lism.modules{.c--navMenu{--link-td:none;--hl:var(--hl--s);--_item-p:var(--s20);--focus-offset:-1px}.c--navMenu_nest{--_item-p:inherit}.c--navMenu_link{padding:var(--_item-p)}.c--navMenu_item,.c--navMenu_nest{--bdc:inherit}.c--shapeDivider{--level:0;--_inner-offset:0px;--_inner-stretch:1;--_flipX:1;--_flipY:1;height:clamp(5px * var(--level),1cqw * var(--level),12px * var(--level));overflow:visible}}@layer lism.modules{.c--shapeDivider:where([data-flip^=X]){--_flipX:-1}.c--shapeDivider:where([data-flip$=Y]){--_flipY:-1}.c--shapeDivider_inner{--offsetY:0.5px;--offsetX:-0.5px;height:100%;scale:calc(var(--_flipX)*var(--_inner-stretch)) var(--_flipY);translate:calc(var(--offsetX) + var(--_inner-offset)) calc(var(--offsetY)*var(--_flipY));width:calc(100% + 1px)}.c--shapeDivider_svg{display:block}:where([data-has-animation=true]) .c--shapeDivider_svg{animation:lism--slideShape 12s linear infinite alternate;transform-origin:100% 0}}@keyframes lism--slideShape{0%{transform:scaleX(4)}to{transform:scaleX(4) translateX(75%)}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lism-css/ui",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "UI components by lism-css.",
5
5
  "author": {
6
6
  "name": "ddryo",
@@ -1,15 +1,15 @@
1
1
  @layer lism.modules {
2
- .d--accordion {
2
+ .c--accordion {
3
3
  --duration: var(--acc-duration, 0.25s);
4
4
  }
5
- .d--accordion[data-opened] {
5
+ .c--accordion[data-opened] {
6
6
  --_notOpen: ;
7
7
  }
8
- .d--accordion:not([data-opened]) {
8
+ .c--accordion:not([data-opened]) {
9
9
  --_isOpen: ;
10
10
  }
11
11
 
12
- .d--accordion_header {
12
+ .c--accordion_header {
13
13
  display: grid;
14
14
  grid: auto / 1fr auto;
15
15
  gap: 0.5em;
@@ -22,7 +22,7 @@
22
22
  }
23
23
  }
24
24
 
25
- .d--accordion_body {
25
+ .c--accordion_body {
26
26
  display: grid;
27
27
  grid: 1fr / auto;
28
28
  transition-property: margin-block, padding-block, opacity, grid-template;
@@ -30,24 +30,24 @@
30
30
  }
31
31
 
32
32
  /* ※ 正常な animation には必須 */
33
- .d--accordion_inner {
33
+ .c--accordion_inner {
34
34
  overflow: hidden;
35
35
  }
36
36
 
37
37
  /* 閉じている時 */
38
- .d--accordion:not([data-opened]) > .d--accordion_body {
38
+ .c--accordion:not([data-opened]) > .c--accordion_body {
39
39
  grid: 0fr / auto;
40
40
  padding-block: 0 !important;
41
41
  margin-block: 0 !important;
42
42
  }
43
43
 
44
44
  /* アコーディオンブロックのネスト時、別のアイコンタイプにすると表示が崩れるがそこまでは考慮しない。 */
45
- .d--accordion_icon {
45
+ .c--accordion_icon {
46
46
  display: grid;
47
47
  }
48
48
 
49
- /* .d--accordion_icon 自体にborderつけたりすると回転が見えてしまうので、中にある .a--icon を回転させる。 */
50
- .d--accordion_icon > .a--icon {
49
+ /* .c--accordion_icon 自体にborderつけたりすると回転が見えてしまうので、中にある .a--icon を回転させる。 */
50
+ .c--accordion_icon > .a--icon {
51
51
  transition: transform var(--duration);
52
52
  transform: var(--_isOpen, scaleY(-1));
53
53
  }
@@ -2,13 +2,13 @@ import atts from 'lism-css/lib/helper/atts';
2
2
 
3
3
  // duration: [s]
4
4
  export function getAccProps({ lismClass, ...props }) {
5
- props.lismClass = atts(lismClass, 'd--accordion');
5
+ props.lismClass = atts(lismClass, 'c--accordion');
6
6
  return props;
7
7
  }
8
8
 
9
9
  export function getAccIconProps({ isTrigger, ...props }) {
10
10
  const defaultProps = {
11
- lismClass: 'd--accordion_icon',
11
+ lismClass: 'c--accordion_icon',
12
12
  tag: 'span',
13
13
  };
14
14
  // isTrigger なら、buttun にする
@@ -21,12 +21,12 @@ export function getAccIconProps({ isTrigger, ...props }) {
21
21
  }
22
22
 
23
23
  export const defaultProps = {
24
- header: { lismClass: 'd--accordion_header' },
25
- label: { lismClass: 'd--accordion_label', tag: 'span' },
24
+ header: { lismClass: 'c--accordion_header' },
25
+ label: { lismClass: 'c--accordion_label', tag: 'span' },
26
26
  body: {
27
- lismClass: 'd--accordion_body',
27
+ lismClass: 'c--accordion_body',
28
28
  },
29
29
  inner: {
30
- lismClass: 'd--accordion_inner',
30
+ lismClass: 'c--accordion_inner',
31
31
  },
32
32
  };
@@ -1,7 +1,7 @@
1
1
  // アニメーションが完了するのを待つ
2
2
  const waitAnimation = (details) => {
3
3
  // アニメーション対象の要素を直接取得.(getAnimations({subtree: true}) は iOS Safari で動作しない場合があるので __body を直接監視)
4
- const body = details.querySelector('.d--accordion_body');
4
+ const body = details.querySelector('.c--accordion_body');
5
5
  const animations = body ? body.getAnimations() : [];
6
6
 
7
7
  // allSettled を使うことで、キャンセル時も reject せずに完了する
@@ -112,7 +112,7 @@ export const setEvent = (details) => {
112
112
  };
113
113
 
114
114
  const setAccordion = () => {
115
- const detailsAll = document.querySelectorAll('.d--accordion');
115
+ const detailsAll = document.querySelectorAll('.c--accordion');
116
116
  detailsAll.forEach((details) => {
117
117
  setEvent(details);
118
118
  });
@@ -1,6 +1,5 @@
1
1
  ---
2
2
  import { Frame } from 'lism-css/astro';
3
- // import '../_style.css';
4
3
 
5
4
  const { size = '1.5em', src = '', alt = '', ...props } = Astro.props;
6
5
  ---
@@ -1,5 +1,4 @@
1
1
  import { Frame } from 'lism-css/react';
2
- // import '../_style.css';
3
2
 
4
3
  export default function Avatar({ size = '1.5em', src = '', alt = '', ...props }) {
5
4
  return (
@@ -11,7 +11,7 @@ export type CalloutProps = {
11
11
 
12
12
  export default function getCalloutProps({ type = 'note', keycolor, icon, title, flow = 's', ...props }: CalloutProps) {
13
13
  const presetData = type ? PRESETS[type] : null;
14
- const _icon = icon || presetData?.icon || null;
14
+ const _icon = icon || presetData?.icon || 'note';
15
15
  const _keycolor = keycolor || presetData?.color || null;
16
16
 
17
17
  return {
@@ -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';