@lism-css/ui 0.2.2 → 0.8.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 (73) hide show
  1. package/LICENSE +21 -0
  2. package/dist/components/Accordion/astro/index.d.ts +10 -10
  3. package/dist/components/Accordion/getProps.d.ts +40 -19
  4. package/dist/components/Accordion/react/AccIcon.d.ts +1 -6
  5. package/dist/components/Accordion/react/Accordion.d.ts +23 -7
  6. package/dist/components/Accordion/react/index.d.ts +6 -4
  7. package/dist/components/Accordion/setAccordion.d.ts +4 -1
  8. package/dist/components/Accordion/setAccordion.js +39 -42
  9. package/dist/components/Callout/getProps.d.ts +1 -1
  10. package/dist/components/Details/astro/index.d.ts +13 -0
  11. package/dist/components/Details/getProps.d.ts +40 -0
  12. package/dist/components/Details/react/Details.d.ts +37 -0
  13. package/dist/components/Details/react/index.d.ts +9 -0
  14. package/dist/components/Modal/getProps.d.ts +2 -2
  15. package/dist/components/Modal/setModal.d.ts +3 -0
  16. package/dist/components/Modal/setModal.js +25 -30
  17. package/dist/components/Tabs/getProps.d.ts +1 -1
  18. package/dist/components/astro.d.ts +1 -0
  19. package/dist/components/react.d.ts +1 -0
  20. package/dist/helper/animation.d.ts +18 -0
  21. package/dist/helper/animation.js +12 -0
  22. package/dist/helper/uuid.d.ts +1 -0
  23. package/dist/scripts/tabs.js +1 -1
  24. package/dist/style.css +1 -1
  25. package/package.json +68 -68
  26. package/src/components/Accordion/_style.css +61 -36
  27. package/src/components/Accordion/astro/Button.astro +13 -0
  28. package/src/components/Accordion/astro/Heading.astro +10 -0
  29. package/src/components/Accordion/astro/Icon.astro +15 -0
  30. package/src/components/Accordion/astro/Item.astro +31 -0
  31. package/src/components/Accordion/astro/Panel.astro +14 -0
  32. package/src/components/Accordion/astro/Root.astro +17 -0
  33. package/src/components/Accordion/astro/index.js +10 -7
  34. package/src/components/Accordion/getProps.js +61 -16
  35. package/src/components/Accordion/react/AccIcon.jsx +5 -4
  36. package/src/components/Accordion/react/Accordion.jsx +56 -28
  37. package/src/components/Accordion/react/index.js +6 -3
  38. package/src/components/Accordion/setAccordion.js +114 -88
  39. package/src/components/Callout/getProps.ts +1 -1
  40. package/src/components/Details/_style.css +48 -0
  41. package/src/components/Details/astro/Content.astro +17 -0
  42. package/src/components/Details/astro/Details.astro +18 -0
  43. package/src/components/Details/astro/Icon.astro +14 -0
  44. package/src/components/{Accordion/astro/AccLabel.astro → Details/astro/Summary.astro} +1 -2
  45. package/src/components/Details/astro/Title.astro +10 -0
  46. package/src/components/Details/astro/index.js +10 -0
  47. package/src/components/Details/getProps.js +23 -0
  48. package/src/components/Details/react/Details.jsx +66 -0
  49. package/src/components/Details/react/index.js +6 -0
  50. package/src/components/Modal/_style.css +7 -7
  51. package/src/components/Modal/getProps.js +3 -3
  52. package/src/components/Modal/script.js +1 -0
  53. package/src/components/Modal/setModal.ts +65 -69
  54. package/src/components/Tabs/_style.css +4 -4
  55. package/src/components/Tabs/astro/Tab.astro +1 -1
  56. package/src/components/Tabs/astro/TabList.astro +1 -1
  57. package/src/components/Tabs/astro/TabPanel.astro +1 -1
  58. package/src/components/Tabs/astro/Tabs.astro +4 -3
  59. package/src/components/Tabs/getProps.js +1 -1
  60. package/src/components/Tabs/react/Tab.jsx +1 -1
  61. package/src/components/Tabs/react/TabList.jsx +1 -1
  62. package/src/components/Tabs/react/TabPanel.jsx +1 -1
  63. package/src/components/Tabs/script.js +1 -1
  64. package/src/components/astro.ts +1 -0
  65. package/src/components/react.ts +1 -0
  66. package/src/helper/animation.ts +36 -0
  67. package/src/{components/Tabs/astro/helper.js → helper/uuid.js} +1 -1
  68. package/dist/components/Tabs/astro/helper.d.ts +0 -1
  69. package/src/components/Accordion/astro/AccBody.astro +0 -13
  70. package/src/components/Accordion/astro/AccHeader.astro +0 -13
  71. package/src/components/Accordion/astro/AccHeaderLabel.astro +0 -12
  72. package/src/components/Accordion/astro/AccIcon.astro +0 -17
  73. package/src/components/Accordion/astro/Accordion.astro +0 -22
@@ -1,120 +1,146 @@
1
- // アニメーションが完了するのを待つ
2
- const waitAnimation = (details) => {
3
- // アニメーション対象の要素を直接取得.(getAnimations({subtree: true}) は iOS Safari で動作しない場合があるので __body を直接監視)
4
- const body = details.querySelector('.d--accordion_body');
5
- const animations = body ? body.getAnimations() : [];
6
-
7
- // allSettled を使うことで、キャンセル時も reject せずに完了する
8
- return Promise.allSettled(animations.map((a) => a.finished));
1
+ import { waitFrame, waitAnimation, maybePauseAnimation } from '../../helper/animation';
2
+
3
+ // hidden を付け外しする時の値
4
+ let ACCORDION_HIDDEN_VALUE = 'until-found';
5
+
6
+ // アコーディオン要素から必要な要素を取得
7
+ const getAccordionElements = (accordionItem) => {
8
+ const heading = accordionItem.querySelector('.c--accordion_heading');
9
+ const panel = accordionItem.querySelector('.c--accordion_panel');
10
+ return {
11
+ heading,
12
+ button: heading.querySelector('button'),
13
+ panel,
14
+ content: panel.querySelector('.c--accordion_content'),
15
+ };
9
16
  };
10
17
 
11
- // animationTime: [ms]
12
- const open = async (details) => {
13
- // すでに開いている場合は何もしない
14
- if (details.open && details.hasAttribute('data-opened')) return;
18
+ // 親に data-allow-multiple がついていなければ、展開中のアコーディオンを閉じる
19
+ // Memo: 自身の除外処理はしていない( 開く動作の前に呼び出す & もし自分が含まれていても連打可能なため )
20
+ const maybeCloseOpenedItems = (accordionItem) => {
21
+ const parent = accordionItem.parentNode;
22
+ if (!parent) return;
15
23
 
16
- // open属性をセット
17
- details.open = true;
24
+ // 親の data-allow-multiple 属性の有無をチェック
25
+ if (parent.hasAttribute('data-allow-multiple')) return;
18
26
 
19
- // 次フレームで data-opened 属性を付与(CSS側でフェードインアニメーション開始)
20
- requestAnimationFrame(() => {
21
- details.setAttribute('data-opened', ''); // 属性の追加
22
- });
27
+ // 開いているアコーディオンを取得して閉じる
28
+ parent.querySelectorAll(':scope > [data-opened]').forEach((_a) => closeAccordion(_a));
23
29
  };
24
30
 
25
- const close = async (details) => {
26
- // すでに閉じている場合は何もしない
27
- if (!details.open && !details.hasAttribute('data-opened')) return;
31
+ async function openAccordion(accordionItem) {
32
+ const { panel, content, button } = getAccordionElements(accordionItem);
28
33
 
29
- details.removeAttribute('data-opened'); // 属性を削除
34
+ // アニメーションがあれば一時停止
35
+ maybePauseAnimation(panel);
30
36
 
31
- // アニメーションを待つ
32
- await waitAnimation(details);
37
+ // hidden を削除
38
+ panel.removeAttribute('hidden');
33
39
 
34
- // アニメーション完了後にopen属性 を除去。
35
- details.open = false;
36
- };
40
+ // 1フレーム待機
41
+ await waitFrame();
37
42
 
38
- // 複数展開を許可するかどうかを、親要素の [data-multiple] でチェック.
39
- const getAllowMultiple = (details) => {
40
- let allowMultiple = false;
41
- const parent = details.parentNode;
42
- if (null != parent) {
43
- const dataMultiple = parent.dataset.multiple;
44
- allowMultiple = 'disallow' !== dataMultiple;
45
- }
46
- return allowMultiple;
47
- };
43
+ // 次フレームで高さセット( 目標の高さ = content の高さ )
44
+ accordionItem.style.setProperty('--_panel-h', `${content.offsetHeight}px`);
48
45
 
49
- const onClick = (details, allowMultiple) => {
50
- if (!details.open) {
51
- if (!allowMultiple) {
52
- // (複数展開が禁止されている場合)他の開いているアイテムがあるかどうかを先に探して閉じる
53
- const parent = details.parentNode;
54
- const openedItem = parent.querySelector(`[data-opened]`);
55
- requestAnimationFrame(() => {
56
- // 1フレーム待機(safariでは requestAnimationFrame() がないと動かなかった)
57
- if (null != openedItem) close(openedItem);
58
- });
59
- }
60
-
61
- // 開く処理
62
- open(details);
63
- } else if (details.open) {
64
- // 閉じる処理
65
- close(details);
46
+ // さらに1フレーム待機
47
+ await waitFrame();
48
+
49
+ // アニメーション開始
50
+ accordionItem.setAttribute('data-opened', '');
51
+ button.setAttribute('aria-expanded', 'true');
52
+
53
+ // アニメーションを待つ
54
+ const status = await waitAnimation(panel);
55
+
56
+ // アニメーションが最後まで完了した時、--_panel-h削除(高さセットしたままだとリサイズできない)
57
+ if ('canceled' !== status) {
58
+ accordionItem.style.removeProperty('--_panel-h');
66
59
  }
67
- };
60
+ }
68
61
 
69
- const onToggle = (details) => {
70
- const hasOpen = details.open;
71
- const hasDataOpen = details.hasAttribute('data-opened');
62
+ async function closeAccordion(accordionItem) {
63
+ const { panel, button } = getAccordionElements(accordionItem);
72
64
 
73
- // open はセットされたのに data-opened 属性がついてない時
74
- if (hasOpen && !hasDataOpen) {
75
- details.setAttribute('data-opened', '');
65
+ // アニメーションがあれば一時停止
66
+ maybePauseAnimation(panel);
67
+
68
+ // 現在の高さを一旦セットする
69
+ accordionItem.style.setProperty('--_panel-h', `${panel.offsetHeight}px`);
70
+
71
+ // 1フレーム待機
72
+ await waitFrame();
73
+
74
+ // 次フレームで属性を削除
75
+ accordionItem.removeAttribute('data-opened');
76
+ button.setAttribute('aria-expanded', 'false');
77
+
78
+ // 変数削除して 0px へ向けてアニメーション開始
79
+ accordionItem.style.removeProperty('--_panel-h');
80
+
81
+ // アニメーションを待つ
82
+ const status = await waitAnimation(panel);
83
+
84
+ // アニメーションが最後まで完了したら、hidden付与
85
+ if ('canceled' !== status) {
86
+ panel.setAttribute('hidden', ACCORDION_HIDDEN_VALUE);
76
87
  }
77
- // open は削除されたのに data-opened 属性がまだついている時
78
- if (!hasOpen && hasDataOpen) {
79
- details.removeAttribute('data-opened');
88
+ }
89
+
90
+ // アコーディオンのトグル処理
91
+ function toggleAccordion(accordionItem) {
92
+ if (accordionItem.hasAttribute('data-opened')) {
93
+ // 自身を閉じる
94
+ closeAccordion(accordionItem);
95
+ } else {
96
+ // 親に data-allow-multiple がついていなければ、他のアコーディオンを閉じる
97
+ maybeCloseOpenedItems(accordionItem);
98
+
99
+ // 自身を開く
100
+ openAccordion(accordionItem);
80
101
  }
81
- };
102
+ }
82
103
 
83
- export const setEvent = (details) => {
84
- // 複数展開を制限するかどうか
85
- const allowMultiple = getAllowMultiple(details);
104
+ /**
105
+ * 個別のアコーディオンにイベントをセット(React用にクリーンアップ関数を返す)
106
+ */
107
+ export const setEvent = (accordionItem) => {
108
+ const { button, panel } = getAccordionElements(accordionItem);
86
109
 
87
- // <summary> 要素をトリガーとする
88
- const summary = details.querySelector('summary');
89
- if (!summary) return;
110
+ // until-found のオン・オフが使い分けれるように、最初に初期値を取得
111
+ if (panel.hasAttribute('hidden')) {
112
+ ACCORDION_HIDDEN_VALUE = panel.getAttribute('hidden');
113
+ }
90
114
 
115
+ // clickイベント登録
91
116
  const _clickEvent = (e) => {
92
- // すぐに open 属性が切り替わらないようにする
93
- e.preventDefault();
94
- onClick(details, allowMultiple);
95
- };
96
- const _toggleEvent = () => {
97
- onToggle(details);
117
+ e.preventDefault(); // hidden="until-found" の自動付け外しを無効化
118
+ toggleAccordion(accordionItem);
98
119
  };
99
120
 
100
- // <summary> 'click' イベント
101
- summary.addEventListener('click', _clickEvent);
121
+ // beforematchイベント登録 (ページ検索時などはこっちが発火する)
122
+ const _beforematchEvent = (e) => {
123
+ e.preventDefault(); // hidden="until-found" の自動付け外しを無効化
124
+ toggleAccordion(accordionItem);
125
+ };
102
126
 
103
- // <details> の'toggle' イベントで、ページ内検索時にも開閉されるようにする
104
- details.addEventListener('toggle', _toggleEvent);
127
+ button.addEventListener('click', _clickEvent);
128
+ panel.addEventListener('beforematch', _beforematchEvent);
105
129
 
106
- // react
130
+ // react用: useEffect でアンマウントされた時にremoveEventListenerしないと2重でイベントが登録してしまう
107
131
  return () => {
108
- // useEffect でアンマウントされた時にremoveEventListenerしないと2重でイベントが登録してしまう。
109
- summary.removeEventListener('click', _clickEvent);
110
- details.removeEventListener('toggle', _toggleEvent);
132
+ button.removeEventListener('click', _clickEvent);
133
+ panel.removeEventListener('beforematch', _beforematchEvent);
111
134
  };
112
135
  };
113
136
 
137
+ /**
138
+ * ページ内の全アコーディオンにイベントをセット(Astro用)
139
+ */
114
140
  const setAccordion = () => {
115
- const detailsAll = document.querySelectorAll('.d--accordion');
116
- detailsAll.forEach((details) => {
117
- setEvent(details);
141
+ const accordionAll = document.querySelectorAll('.c--accordion_item');
142
+ accordionAll.forEach((accordionItem) => {
143
+ setEvent(accordionItem);
118
144
  });
119
145
  };
120
146
  export default setAccordion;
@@ -23,7 +23,7 @@ export default function getCalloutProps({ type = 'note', keycolor, icon, title,
23
23
  p: '20',
24
24
  g: '10',
25
25
  bdc: 'keycolor',
26
- 'bd-x-s': true,
26
+ 'bd-x-s': '-',
27
27
  bdw: '4px',
28
28
  bxsh: '10',
29
29
  bdrs: '5',
@@ -0,0 +1,48 @@
1
+ /* Details コンポーネント用スタイル */
2
+ /* ::details-content と grid-template-rows: 0fr → 1fr のトランジションでアニメーション */
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
+
15
+ /* Safariで表示されるデフォルトの三角形アイコンを削除 */
16
+ .c--details_summary::-webkit-details-marker {
17
+ display: none;
18
+ }
19
+
20
+ /* 見出しタグでもフォントを揃える */
21
+ /* .c--details_title {} */
22
+
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
+
31
+ transition: transform var(--duration);
32
+ transform: var(--_icon-transform);
33
+ }
34
+
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
+
44
+ /* コンテンツ内部のラッパー(grid-template-rows: 0frのアニメーションに必須) */
45
+ .c--details_body {
46
+ overflow: hidden;
47
+ }
48
+ }
@@ -0,0 +1,17 @@
1
+ ---
2
+ /**
3
+ * Content - コンテンツコンポーネント
4
+ * details要素の開閉されるコンテンツ部分のラッパー
5
+ * grid-template-rows: 0fr → 1fr のアニメーションに必要
6
+ */
7
+ import { Lism } from 'lism-css/astro';
8
+ import { defaultProps } from '../getProps';
9
+
10
+ const props = Astro.props || {};
11
+ ---
12
+
13
+ <Lism {...defaultProps.body}>
14
+ <Lism {...defaultProps.content} {...props}>
15
+ <slot />
16
+ </Lism>
17
+ </Lism>
@@ -0,0 +1,18 @@
1
+ ---
2
+ /**
3
+ * Details - ルートコンポーネント
4
+ * details要素をレンダリングし、CSSのみでアニメーションを実装
5
+ * スクリプト不要で::details-contentを使用
6
+ */
7
+ import getLismProps from 'lism-css/lib/getLismProps';
8
+ import { getDetailsProps } from '../getProps';
9
+
10
+ // スタイルのインポート
11
+ import '../_style.css';
12
+
13
+ const props = Astro.props || {};
14
+ ---
15
+
16
+ <details {...getLismProps(getDetailsProps(props))}>
17
+ <slot />
18
+ </details>
@@ -0,0 +1,14 @@
1
+ ---
2
+ /**
3
+ * Icon - アイコンコンポーネント
4
+ * 開閉状態を示すアイコン(開いた時に回転)
5
+ */
6
+ import { Lism } from 'lism-css/astro';
7
+ import { defaultProps } from '../getProps';
8
+
9
+ const props = Astro.props || {};
10
+ ---
11
+
12
+ <Lism {...defaultProps.icon} {...props}>
13
+ <slot />
14
+ </Lism>
@@ -1,11 +1,10 @@
1
1
  ---
2
- // import type { LismProps } from 'lism-css/types';
3
2
  import { Lism } from 'lism-css/astro';
4
3
  import { defaultProps } from '../getProps';
5
4
 
6
5
  const props = Astro.props || {};
7
6
  ---
8
7
 
9
- <Lism {...defaultProps.label} {...props}>
8
+ <Lism tag='summary' {...defaultProps.summary} {...props}>
10
9
  <slot />
11
10
  </Lism>
@@ -0,0 +1,10 @@
1
+ ---
2
+ import { Lism } from 'lism-css/astro';
3
+ import { defaultProps } from '../getProps';
4
+
5
+ const props = Astro.props || {};
6
+ ---
7
+
8
+ <Lism {...defaultProps.title} {...props}>
9
+ <slot />
10
+ </Lism>
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Astro版Detailsコンポーネントのエクスポート
3
+ */
4
+ import Root from './Details.astro';
5
+ import Summary from './Summary.astro';
6
+ import Title from './Title.astro';
7
+ import Icon from './Icon.astro';
8
+ import Content from './Content.astro';
9
+
10
+ export default { Root, Summary, Title, Content, Icon };
@@ -0,0 +1,23 @@
1
+ import atts from 'lism-css/lib/helper/atts';
2
+
3
+ /**
4
+ * Detailsコンポーネントのルート要素用プロパティを生成
5
+ * @param {Object} props - コンポーネントのプロパティ
6
+ * @param {string} props.lismClass - 追加のLismクラス
7
+ * @returns {Object} 処理済みプロパティ
8
+ */
9
+ export function getDetailsProps({ lismClass, ...props }) {
10
+ props.lismClass = atts(lismClass, 'c--details');
11
+ return props;
12
+ }
13
+
14
+ /**
15
+ * 各サブコンポーネント用のデフォルトプロパティ
16
+ */
17
+ export const defaultProps = {
18
+ summary: { lismClass: 'c--details_summary', layout: 'flex', g: '10', ai: 'center' },
19
+ title: { lismClass: 'c--details_title', tag: 'span', fx: '1', setPlain: 1 },
20
+ icon: { lismClass: 'c--details_icon a--icon', tag: 'span', 'aria-hidden': 'true' },
21
+ body: { lismClass: 'c--details_body' },
22
+ content: { lismClass: 'c--details_content', layout: 'flow', flow: 's' },
23
+ };
@@ -0,0 +1,66 @@
1
+ /**
2
+ * React版 Detailsコンポーネント
3
+ */
4
+ import getLismProps from 'lism-css/lib/getLismProps';
5
+ import { Lism } from 'lism-css/react';
6
+ import { getDetailsProps, defaultProps } from '../getProps';
7
+
8
+ // スタイルのインポート
9
+ import '../_style.css';
10
+
11
+ /**
12
+ * Details - ルートコンポーネント
13
+ * details要素をレンダリング
14
+ */
15
+ export function Details({ children, ...props }) {
16
+ const lismProps = getLismProps(getDetailsProps(props));
17
+
18
+ return <details {...lismProps}>{children}</details>;
19
+ }
20
+
21
+ /**
22
+ * Summary - サマリーコンポーネント
23
+ * details要素のsummary部分
24
+ */
25
+ export function Summary({ children, ...props }) {
26
+ return (
27
+ <Lism tag='summary' {...defaultProps.summary} {...props}>
28
+ {children}
29
+ </Lism>
30
+ );
31
+ }
32
+
33
+ /**
34
+ * Title - タイトルコンポーネント
35
+ */
36
+ export function Title({ children, ...props }) {
37
+ return (
38
+ <Lism {...defaultProps.title} {...props}>
39
+ {children}
40
+ </Lism>
41
+ );
42
+ }
43
+
44
+ /**
45
+ * Icon - アイコンコンポーネント
46
+ */
47
+ export function Icon({ children, ...props }) {
48
+ return (
49
+ <Lism {...defaultProps.icon} {...props}>
50
+ {children}
51
+ </Lism>
52
+ );
53
+ }
54
+
55
+ /**
56
+ * Content - コンテンツコンポーネント
57
+ */
58
+ export function Content({ children, ...props }) {
59
+ return (
60
+ <Lism {...defaultProps.body}>
61
+ <Lism {...defaultProps.content} {...props}>
62
+ {children}
63
+ </Lism>
64
+ </Lism>
65
+ );
66
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * React版Detailsコンポーネントのエクスポート
3
+ */
4
+ import { Details as Root, Summary, Title, Icon, Content } from './Details';
5
+
6
+ export default { Root, Summary, Title, Icon, Content };
@@ -3,7 +3,7 @@
3
3
  * Memo: ::backdrop のアニメーションはFirefoxで動かない
4
4
  */
5
5
  @layer lism.modules {
6
- .d--modal {
6
+ .c--modal {
7
7
  --flow: 0; /* flow直下にきても影響しないように */
8
8
  --duration: var(--modal-duration, 0.4s);
9
9
  width: 100%;
@@ -15,30 +15,30 @@
15
15
  transition-duration: var(--duration);
16
16
  transition-property: opacity;
17
17
  }
18
- .d--modal::backdrop {
18
+ .c--modal::backdrop {
19
19
  background: none;
20
20
  }
21
- .d--modal[open] {
21
+ .c--modal[open] {
22
22
  display: flex;
23
23
  flex-direction: column;
24
24
  justify-content: center;
25
25
  }
26
26
 
27
- .d--modal_inner {
27
+ .c--modal_inner {
28
28
  --offset: 0 0; /* アニメーション用 */
29
29
  background-color: var(--base);
30
30
  transition: translate var(--duration);
31
31
  max-height: 100%;
32
32
  }
33
33
 
34
- /* .d--modal_body {
34
+ /* .c--modal_body {
35
35
  overscroll-behavior: contain;
36
36
  } */
37
37
 
38
- .d--modal:not([data-is-open]) {
38
+ .c--modal:not([data-is-open]) {
39
39
  opacity: 0;
40
40
  }
41
- .d--modal:not([data-is-open]) > .d--modal_inner {
41
+ .c--modal:not([data-is-open]) > .c--modal_inner {
42
42
  translate: var(--offset);
43
43
  }
44
44
  }
@@ -2,7 +2,7 @@ import atts from 'lism-css/lib/helper/atts';
2
2
 
3
3
  export function getProps({ lismClass = '', duration, style = {}, ...props }) {
4
4
  const theProps = {
5
- lismClass: atts(lismClass, 'd--modal'),
5
+ lismClass: atts(lismClass, 'c--modal'),
6
6
  setPlain: true,
7
7
  };
8
8
  if (duration) {
@@ -17,14 +17,14 @@ export function getInnerProps({ lismClass = '', offset, style = {}, ...props })
17
17
  style['--offset'] = offset;
18
18
  }
19
19
  return {
20
- lismClass: atts(lismClass, 'd--modal_inner'),
20
+ lismClass: atts(lismClass, 'c--modal_inner'),
21
21
  style,
22
22
  ...props,
23
23
  };
24
24
  }
25
25
 
26
26
  export const defaultProps = {
27
- body: { lismClass: 'd--modal_body' },
27
+ body: { lismClass: 'c--modal_body' },
28
28
  closeBtn: { tag: 'button', setPlain: true, hov: 'o', d: 'in-flex' },
29
29
  openBtn: { tag: 'button', setPlain: true, hov: 'o', d: 'in-flex' },
30
30
  };
@@ -1,3 +1,4 @@
1
+ /* Memo: この script は defer をつけて読み込む (DOMパース後に読み込まれます) */
1
2
  import setModal from './setModal.ts';
2
3
 
3
4
  document.addEventListener('DOMContentLoaded', function () {