@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
@@ -8,16 +8,16 @@ import '../_style.css';
8
8
 
9
9
  // duration: [s]
10
10
  const Modal = ({ children, ...props }) => {
11
- const ref = useRef(null);
12
- useEffect(() => {
13
- if (!ref?.current) return;
14
- return setEvent(ref?.current);
15
- }, [ref]);
11
+ const ref = useRef(null);
12
+ useEffect(() => {
13
+ if (!ref?.current) return;
14
+ return setEvent(ref?.current);
15
+ }, [ref]);
16
16
 
17
- return (
18
- <Lism forwardedRef={ref} {...getProps(props)}>
19
- {children}
20
- </Lism>
21
- );
17
+ return (
18
+ <Lism forwardedRef={ref} {...getProps(props)}>
19
+ {children}
20
+ </Lism>
21
+ );
22
22
  };
23
23
  export default Modal;
@@ -3,9 +3,9 @@ import { defaultProps } from '../getProps';
3
3
 
4
4
  // duration: [s]
5
5
  export default function OpenBtn({ children, modalId = '', ...props }) {
6
- return (
7
- <Lism data-modal-open={modalId} {...defaultProps.openBtn} {...props}>
8
- {children}
9
- </Lism>
10
- );
6
+ return (
7
+ <Lism data-modal-open={modalId} {...defaultProps.openBtn} {...props}>
8
+ {children}
9
+ </Lism>
10
+ );
11
11
  }
@@ -2,5 +2,5 @@
2
2
  import setModal from './setModal.ts';
3
3
 
4
4
  document.addEventListener('DOMContentLoaded', function () {
5
- setModal();
5
+ setModal();
6
6
  });
@@ -4,100 +4,100 @@ import { waitAnimation } from '../../helper/animation';
4
4
  * モーダルの開閉イベントを設定する
5
5
  */
6
6
  export function setEvent(modal: HTMLDialogElement): void {
7
- // modalがない、またはidがない場合は処理を終了
8
- if (!modal || !modal.id) return;
9
-
10
- // オープンした時のトリガー要素を記憶する(data属性を戻すため)
11
- let theTrigger: HTMLElement | null = null;
12
-
13
- // モーダルを開くトリガーと閉じるトリガーを取得
14
- const openTriggers = document.querySelectorAll<HTMLElement>(`[data-modal-open="${modal.id}"]`);
15
- const closeTriggers = modal.querySelectorAll<HTMLElement>(`[data-modal-close="${modal.id}"]`);
16
-
17
- /**
18
- * ダイアログを開く処理
19
- * Point: showModal() してから、CSSアニメーション用の data-is-open属性を付与する
20
- */
21
- const openDialog = () => {
22
- // すでに open & data-is-open が付いていれば何もしない(連打防止)
23
- if (modal.open && modal.hasAttribute('data-is-open')) return;
24
-
25
- // showModal() でモーダルを開く( open 属性の付与)
26
- modal.showModal();
27
-
28
- // 次フレームで data-is-open を付与(CSS側でフェードインアニメーション開始)
29
- requestAnimationFrame(() => {
30
- modal.dataset.isOpen = '1';
31
- });
32
- };
33
-
34
- /**
35
- * ダイアログを閉じる処理
36
- * Point: data-is-open属性を削除してCSSアニメーションが終わってから、close() を実行する
37
- */
38
- const closeDialog = async (): Promise<void> => {
39
- // すでに閉じている場合は何もしない
40
- if (!modal.hasAttribute('data-is-open')) {
41
- return;
42
- }
43
-
44
- // data-is-open 属性を削除(CSS側でフェードアウトアニメーション開始)
45
- modal.removeAttribute('data-is-open');
46
-
47
- // アニメーション完了を待機
48
- await waitAnimation(modal);
49
-
50
- // アニメーション終了後、dialog を閉じる(open属性の削除)
51
- modal.close();
52
- };
53
-
54
- // openボタンにイベント登録
55
- openTriggers.forEach((trigger) => {
56
- trigger?.addEventListener('click', () => {
57
- // button側にもdata属性付与
58
- trigger.dataset.targetOpened = '1';
59
- theTrigger = trigger; // close() 時にdata属性削除するために記憶
60
-
61
- // モーダルを開く
62
- openDialog();
63
- });
64
- });
65
-
66
- // closeボタンにイベント登録
67
- closeTriggers.forEach((trigger) => {
68
- trigger?.addEventListener('click', () => {
69
- void closeDialog();
70
- });
71
- });
72
-
73
- // 余白クリックで閉じる
74
- modal.addEventListener('click', (e) => {
75
- if (e.target === modal) {
76
- void closeDialog();
77
- }
78
- });
79
-
80
- // close() 完了時にトリガーのdata属性をリセット
81
- modal.addEventListener('close', () => {
82
- if (theTrigger) {
83
- theTrigger.removeAttribute('data-target-opened');
84
- theTrigger = null;
85
- }
86
- });
87
-
88
- /**
89
- * ESCキーで閉じた時もアニメーションを実行する処理
90
- */
91
- modal.addEventListener('cancel', (e) => {
92
- e.preventDefault(); // デフォルトの即時 close() を防ぐ
93
- void closeDialog(); // 自分で用意したクローズ処理
94
- });
7
+ // modalがない、またはidがない場合は処理を終了
8
+ if (!modal || !modal.id) return;
9
+
10
+ // オープンした時のトリガー要素を記憶する(data属性を戻すため)
11
+ let theTrigger: HTMLElement | null = null;
12
+
13
+ // モーダルを開くトリガーと閉じるトリガーを取得
14
+ const openTriggers = document.querySelectorAll<HTMLElement>(`[data-modal-open="${modal.id}"]`);
15
+ const closeTriggers = modal.querySelectorAll<HTMLElement>(`[data-modal-close="${modal.id}"]`);
16
+
17
+ /**
18
+ * ダイアログを開く処理
19
+ * Point: showModal() してから、CSSアニメーション用の data-is-open属性を付与する
20
+ */
21
+ const openDialog = () => {
22
+ // すでに open & data-is-open が付いていれば何もしない(連打防止)
23
+ if (modal.open && modal.hasAttribute('data-is-open')) return;
24
+
25
+ // showModal() でモーダルを開く( open 属性の付与)
26
+ modal.showModal();
27
+
28
+ // 次フレームで data-is-open を付与(CSS側でフェードインアニメーション開始)
29
+ requestAnimationFrame(() => {
30
+ modal.dataset.isOpen = '1';
31
+ });
32
+ };
33
+
34
+ /**
35
+ * ダイアログを閉じる処理
36
+ * Point: data-is-open属性を削除してCSSアニメーションが終わってから、close() を実行する
37
+ */
38
+ const closeDialog = async (): Promise<void> => {
39
+ // すでに閉じている場合は何もしない
40
+ if (!modal.hasAttribute('data-is-open')) {
41
+ return;
42
+ }
43
+
44
+ // data-is-open 属性を削除(CSS側でフェードアウトアニメーション開始)
45
+ modal.removeAttribute('data-is-open');
46
+
47
+ // アニメーション完了を待機
48
+ await waitAnimation(modal);
49
+
50
+ // アニメーション終了後、dialog を閉じる(open属性の削除)
51
+ modal.close();
52
+ };
53
+
54
+ // openボタンにイベント登録
55
+ openTriggers.forEach((trigger) => {
56
+ trigger?.addEventListener('click', () => {
57
+ // button側にもdata属性付与
58
+ trigger.dataset.targetOpened = '1';
59
+ theTrigger = trigger; // close() 時にdata属性削除するために記憶
60
+
61
+ // モーダルを開く
62
+ openDialog();
63
+ });
64
+ });
65
+
66
+ // closeボタンにイベント登録
67
+ closeTriggers.forEach((trigger) => {
68
+ trigger?.addEventListener('click', () => {
69
+ void closeDialog();
70
+ });
71
+ });
72
+
73
+ // 余白クリックで閉じる
74
+ modal.addEventListener('click', (e) => {
75
+ if (e.target === modal) {
76
+ void closeDialog();
77
+ }
78
+ });
79
+
80
+ // close() 完了時にトリガーのdata属性をリセット
81
+ modal.addEventListener('close', () => {
82
+ if (theTrigger) {
83
+ theTrigger.removeAttribute('data-target-opened');
84
+ theTrigger = null;
85
+ }
86
+ });
87
+
88
+ /**
89
+ * ESCキーで閉じた時もアニメーションを実行する処理
90
+ */
91
+ modal.addEventListener('cancel', (e) => {
92
+ e.preventDefault(); // デフォルトの即時 close() を防ぐ
93
+ void closeDialog(); // 自分で用意したクローズ処理
94
+ });
95
95
  }
96
96
 
97
97
  const setModal = () => {
98
- const modals = document.querySelectorAll('.c--modal');
99
- modals?.forEach((target) => {
100
- setEvent(target as HTMLDialogElement);
101
- });
98
+ const modals = document.querySelectorAll('.c--modal');
99
+ modals?.forEach((target) => {
100
+ setEvent(target as HTMLDialogElement);
101
+ });
102
102
  };
103
103
  export default setModal;
@@ -1,21 +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
- }
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
8
 
9
- .c--navMenu_nest {
10
- --_item-p: inherit;
11
- }
9
+ .c--navMenu_nest {
10
+ --_item-p: inherit;
11
+ }
12
12
 
13
- .c--navMenu_link {
14
- padding: var(--_item-p);
15
- }
13
+ .c--navMenu_link {
14
+ padding: var(--_item-p);
15
+ }
16
16
 
17
- .c--navMenu_nest,
18
- .c--navMenu_item {
19
- --bdc: inherit;
20
- }
17
+ .c--navMenu_nest,
18
+ .c--navMenu_item {
19
+ --bdc: inherit;
20
+ }
21
21
  }
@@ -4,5 +4,5 @@ import { getItemProps } from '../getProps';
4
4
  ---
5
5
 
6
6
  <Lism {...getItemProps(Astro.props)}>
7
- <slot />
7
+ <slot />
8
8
  </Lism>
@@ -4,5 +4,5 @@ import { getLinkProps } from '../getProps';
4
4
  ---
5
5
 
6
6
  <Flex {...getLinkProps(Astro.props)}>
7
- <slot />
7
+ <slot />
8
8
  </Flex>
@@ -4,5 +4,5 @@ import { getNestProps } from '../getProps';
4
4
  ---
5
5
 
6
6
  <Stack {...getNestProps(Astro.props)}>
7
- <slot />
7
+ <slot />
8
8
  </Stack>
@@ -5,5 +5,5 @@ import '../_style.css';
5
5
  ---
6
6
 
7
7
  <Stack {...getRootProps(Astro.props)}>
8
- <slot />
8
+ <slot />
9
9
  </Stack>
@@ -12,41 +12,41 @@ import getMaybeCssVar from 'lism-css/lib/getMaybeCssVar';
12
12
  * @param {object} [props.style] - スタイルオブジェクト
13
13
  */
14
14
  export function getRootProps({ hovC, hovBgc, itemP, style = {}, ...props }) {
15
- const computedStyle = { ...style };
15
+ const computedStyle = { ...style };
16
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');
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
20
 
21
- return {
22
- lismClass: 'c--navMenu',
23
- as: 'ul',
24
- style: computedStyle,
25
- ...props,
26
- };
21
+ return {
22
+ lismClass: 'c--navMenu',
23
+ as: 'ul',
24
+ style: computedStyle,
25
+ ...props,
26
+ };
27
27
  }
28
28
 
29
29
  /**
30
30
  * NavMenu.Nest のプロパティを処理
31
31
  */
32
32
  export function getNestProps(props) {
33
- return {
34
- lismClass: 'c--navMenu_nest',
35
- as: 'ul',
36
- 'px-s': '20',
37
- ...props,
38
- };
33
+ return {
34
+ lismClass: 'c--navMenu_nest',
35
+ as: 'ul',
36
+ 'px-s': '20',
37
+ ...props,
38
+ };
39
39
  }
40
40
 
41
41
  /**
42
42
  * NavMenu.Item のプロパティを処理
43
43
  */
44
44
  export function getItemProps(props) {
45
- return {
46
- lismClass: 'c--navMenu_item',
47
- as: 'li',
48
- ...props,
49
- };
45
+ return {
46
+ lismClass: 'c--navMenu_item',
47
+ as: 'li',
48
+ ...props,
49
+ };
50
50
  }
51
51
 
52
52
  /**
@@ -55,11 +55,11 @@ export function getItemProps(props) {
55
55
  * @param {string} [props.as='span'] - HTML タグ
56
56
  */
57
57
  export function getLinkProps({ href, as = 'span', ...props }) {
58
- return {
59
- lismClass: 'c--navMenu_link',
60
- as: href ? 'a' : as,
61
- href,
62
- c: 'inherit',
63
- ...props,
64
- };
58
+ return {
59
+ lismClass: 'c--navMenu_link',
60
+ as: href ? 'a' : as,
61
+ href,
62
+ c: 'inherit',
63
+ ...props,
64
+ };
65
65
  }
@@ -3,17 +3,17 @@ import { getRootProps, getNestProps, getItemProps, getLinkProps } from '../getPr
3
3
  import '../_style.css';
4
4
 
5
5
  export function Root({ children, ...props }) {
6
- return <Stack {...getRootProps(props)}>{children}</Stack>;
6
+ return <Stack {...getRootProps(props)}>{children}</Stack>;
7
7
  }
8
8
 
9
9
  export function Nest({ children, ...props }) {
10
- return <Stack {...getNestProps(props)}>{children}</Stack>;
10
+ return <Stack {...getNestProps(props)}>{children}</Stack>;
11
11
  }
12
12
 
13
13
  export function Item({ children, ...props }) {
14
- return <Lism {...getItemProps(props)}>{children}</Lism>;
14
+ return <Lism {...getItemProps(props)}>{children}</Lism>;
15
15
  }
16
16
 
17
17
  export function Link({ children, ...props }) {
18
- return <Flex {...getLinkProps(props)}>{children}</Flex>;
18
+ return <Flex {...getLinkProps(props)}>{children}</Flex>;
19
19
  }
@@ -1,56 +1,56 @@
1
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
- }
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
47
  }
48
48
 
49
49
  @keyframes lism--slideShape {
50
- 0% {
51
- transform: scaleX(4);
52
- }
53
- 100% {
54
- transform: scaleX(4) translateX(calc(100% - 25%));
55
- }
50
+ 0% {
51
+ transform: scaleX(4);
52
+ }
53
+ 100% {
54
+ transform: scaleX(4) translateX(calc(100% - 25%));
55
+ }
56
56
  }
@@ -8,24 +8,24 @@ const { viewBox, isAnimation, isEmpty, ...lismProps } = componentProps || {};
8
8
  ---
9
9
 
10
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
- )
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
31
  }
@@ -9,32 +9,32 @@
9
9
  * @param {string} [props.flip] - X/Y/XY で反転方向を指定
10
10
  */
11
11
  export default function getProps({ viewBox, isAnimation, isEmpty, level = 5, stretch, offset, flip, style = {}, ...restProps }) {
12
- // level が 0 の場合は非表示
13
- if (level === 0) return null;
12
+ // level が 0 の場合は非表示
13
+ if (level === 0) return null;
14
14
 
15
- // CSS変数をセット
16
- const computedStyle = { ...style };
17
- computedStyle['--level'] = level || null;
18
- computedStyle['--_inner-offset'] = offset || null;
19
- computedStyle['--_inner-stretch'] = stretch || null;
15
+ // CSS変数をセット
16
+ const computedStyle = { ...style };
17
+ computedStyle['--level'] = level || null;
18
+ computedStyle['--_inner-offset'] = offset || null;
19
+ computedStyle['--_inner-stretch'] = stretch || null;
20
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';
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
28
 
29
- return {
30
- ..._props,
31
- style: computedStyle,
29
+ return {
30
+ ..._props,
31
+ style: computedStyle,
32
32
 
33
- // SVG用のprops
34
- viewBox,
35
- isEmpty,
33
+ // SVG用のprops
34
+ viewBox,
35
+ isEmpty,
36
36
 
37
- // その他のprops
38
- ...restProps,
39
- };
37
+ // その他のprops
38
+ ...restProps,
39
+ };
40
40
  }