lism-css 0.0.2 → 0.0.4

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/README.md +2 -2
  2. package/package.json +5 -6
  3. package/packages/astro/Accordion/AccBody.astro +15 -0
  4. package/packages/astro/Accordion/AccHeader.astro +13 -0
  5. package/packages/astro/Accordion/AccIcon.astro +19 -0
  6. package/packages/astro/Accordion/AccLabel.astro +12 -0
  7. package/packages/astro/Accordion/Accordion.astro +21 -0
  8. package/packages/astro/Accordion/__setEvent.js +2 -0
  9. package/packages/astro/Accordion/index.js +7 -0
  10. package/packages/astro/Box/Box.astro +11 -0
  11. package/packages/astro/Box/index.js +1 -0
  12. package/packages/astro/Center/Center.astro +11 -0
  13. package/packages/astro/Center/index.js +1 -0
  14. package/packages/astro/Columns/Columns.astro +11 -0
  15. package/packages/astro/Columns/index.js +1 -0
  16. package/packages/astro/Container/Container.astro +11 -0
  17. package/packages/astro/Container/index.js +1 -0
  18. package/packages/astro/Decorator/Decorator.astro +13 -0
  19. package/packages/astro/Decorator/index.js +1 -0
  20. package/packages/astro/Divider/Divider.astro +12 -0
  21. package/packages/astro/Divider/index.js +1 -0
  22. package/packages/astro/Dummy/Dummy.astro +12 -0
  23. package/packages/astro/Dummy/index.js +1 -0
  24. package/packages/astro/Flex/Cluster.astro +11 -0
  25. package/packages/astro/Flex/Flex.astro +14 -0
  26. package/packages/astro/Flex/index.js +2 -0
  27. package/packages/astro/Frame/Frame.astro +12 -0
  28. package/packages/astro/Frame/index.js +1 -0
  29. package/packages/astro/Grid/Grid.astro +13 -0
  30. package/packages/astro/Grid/GridItem.astro +15 -0
  31. package/packages/astro/Grid/index.js +2 -0
  32. package/packages/astro/Icon/Icon.astro +25 -0
  33. package/packages/astro/Icon/SVG.astro +30 -0
  34. package/packages/astro/Icon/index.js +2 -0
  35. package/packages/astro/Layer/Layer.astro +15 -0
  36. package/packages/astro/Layer/index.js +1 -0
  37. package/packages/astro/LinkBox/LinkBox.astro +16 -0
  38. package/packages/astro/LinkBox/index.js +1 -0
  39. package/packages/astro/Lism/Link.astro +10 -0
  40. package/packages/astro/Lism/Lism.astro +14 -0
  41. package/packages/astro/Lism/Media.astro +24 -0
  42. package/packages/astro/Lism/Text.astro +10 -0
  43. package/packages/astro/Lism/index.js +4 -0
  44. package/packages/astro/Modal/Body.astro +14 -0
  45. package/packages/astro/Modal/CloseIconBtn.astro +24 -0
  46. package/packages/astro/Modal/Footer.astro +14 -0
  47. package/packages/astro/Modal/Header.astro +14 -0
  48. package/packages/astro/Modal/Inner.astro +13 -0
  49. package/packages/astro/Modal/Modal.astro +20 -0
  50. package/packages/astro/Modal/index.js +8 -0
  51. package/packages/astro/OverlayLink/OverlayLink.astro +10 -0
  52. package/packages/astro/OverlayLink/index.js +1 -0
  53. package/packages/astro/Spacer/Spacer.astro +11 -0
  54. package/packages/astro/Spacer/index.js +1 -0
  55. package/packages/astro/Stack/Stack.astro +7 -0
  56. package/packages/astro/Stack/index.js +1 -0
  57. package/packages/astro/Tabs/Tab.astro +26 -0
  58. package/packages/astro/Tabs/TabItem.astro +8 -0
  59. package/packages/astro/Tabs/TabList.astro +8 -0
  60. package/packages/astro/Tabs/TabPanel.astro +22 -0
  61. package/packages/astro/Tabs/Tabs.astro +60 -0
  62. package/packages/astro/Tabs/index.js +7 -0
  63. package/packages/astro/Tabs/transformTabitems.js +40 -0
  64. package/packages/astro/Test/Test.astro +14 -0
  65. package/packages/astro/Test/TestItem.astro +14 -0
  66. package/packages/astro/Test/index.js +4 -0
  67. package/packages/astro/WithSide/WithSide.astro +12 -0
  68. package/packages/astro/WithSide/index.js +1 -0
  69. package/packages/astro/helper/index.js +6 -0
  70. package/packages/astro/index.js +29 -0
  71. package/packages/astro/types.ts +28 -0
  72. package/packages/next-js/Accordion/Accordion.jsx +19 -0
  73. package/packages/next-js/Accordion/index.js +2 -0
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ## Installation
2
2
 
3
- For details, see [Docs](https://lism-ui.com/)
3
+ For details, see [Docs](https://lism-css.com/)
4
4
 
5
5
  ### 1. Installation
6
6
 
@@ -36,7 +36,7 @@ For HTML sites, you can also load CSS via CDN.
36
36
  import { Box, Text, ... } from 'lism-css/react';
37
37
 
38
38
  // ...
39
- <Box p={20} bgc="base-2">
39
+ <Box p='20' bgc="base-2">
40
40
  <Text fz="l">Lorem ipsum text...</Text>
41
41
  </Box>
42
42
  // ...
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lism-css",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "",
5
5
  "author": {
6
6
  "name": "ddryo",
@@ -22,8 +22,7 @@
22
22
  },
23
23
  "files": [
24
24
  "dist",
25
- "nexe-js",
26
- "astro",
25
+ "packages",
27
26
  "src/scss"
28
27
  ],
29
28
  "type": "module",
@@ -43,8 +42,7 @@
43
42
  "homepage": "https://www.lism.style",
44
43
  "repository": {
45
44
  "type": "git",
46
- "url": "https://github.com/lism-ui/lism-css.git",
47
- "directory": "packages/lism-css"
45
+ "url": "https://github.com/lism-ui/lism-css/tree/main/packages/lism-css"
48
46
  },
49
47
  "bugs": {
50
48
  "url": "https://github.com/lism-ui/lism-css/issues"
@@ -61,7 +59,8 @@
61
59
  "vite": "^6.3.5"
62
60
  },
63
61
  "peerDependencies": {
64
- "react": ">=18.0.0"
62
+ "react": "^18 || ^19",
63
+ "react-dom": "^18 || ^19"
65
64
  },
66
65
  "sideEffects": false
67
66
  }
@@ -0,0 +1,15 @@
1
+ ---
2
+ import type { LismProps } from '../types';
3
+ import { Lism } from '../Lism';
4
+ import { Grid } from '../Grid';
5
+ import { defaultProps } from '../../../dist/components/Accordion/getProps';
6
+
7
+ interface Props extends LismProps {}
8
+ const { isFlow, innerProps, ...props } = Astro.props || {};
9
+ ---
10
+
11
+ <Grid {...defaultProps.body} {...props}>
12
+ <Lism isFlow={isFlow} {...defaultProps.inner} {...innerProps}>
13
+ <slot />
14
+ </Lism>
15
+ </Grid>
@@ -0,0 +1,13 @@
1
+ ---
2
+ import type { LismProps } from '../types';
3
+ import { Flex } from '../Flex';
4
+ import { defaultProps } from '../../../dist/components/Accordion/getProps';
5
+
6
+ interface Props extends LismProps {}
7
+
8
+ const props = Astro.props || {};
9
+ ---
10
+
11
+ <Flex tag='summary' {...defaultProps.header} {...props}>
12
+ <slot />
13
+ </Flex>
@@ -0,0 +1,19 @@
1
+ ---
2
+ import type { LismProps } from '../types';
3
+ import { Lism } from '../Lism';
4
+ import { Icon } from '../Icon';
5
+ import { getAccIconProps } from '../../../dist/components/Accordion/getProps';
6
+
7
+ // Propsの定義
8
+ interface Props extends LismProps {
9
+ icon?: string;
10
+ size?: string;
11
+ iconProps?: Object;
12
+ }
13
+
14
+ const { viewBox, icon = 'caret-down', ...props } = Astro.props || {};
15
+ ---
16
+
17
+ <Lism {...getAccIconProps(props)}>
18
+ {Astro.slots.has('default') ? <slot /> : <Icon viewBox={viewBox} icon={icon} />}
19
+ </Lism>
@@ -0,0 +1,12 @@
1
+ ---
2
+ import type { LismProps } from '../types';
3
+ import { Lism } from '../Lism';
4
+ import { defaultProps } from '../../../dist/components/Accordion/getProps';
5
+
6
+ interface Props extends LismProps {}
7
+ const props = Astro.props || {};
8
+ ---
9
+
10
+ <Lism {...defaultProps.label} {...props}>
11
+ <slot />
12
+ </Lism>
@@ -0,0 +1,21 @@
1
+ ---
2
+ import type { LismProps } from '../types';
3
+ import getLismProps from '../../../dist/lib/getLismProps';
4
+ import { getAccProps } from '../../../dist/components/Accordion/getProps';
5
+
6
+ // Propsの定義
7
+ interface Props extends LismProps {
8
+ duration?: string | number;
9
+ }
10
+ const props = Astro.props || {};
11
+ ---
12
+
13
+ <details {...getLismProps(getAccProps(props))}>
14
+ <slot />
15
+ </details>
16
+
17
+ <script>
18
+ // import setEvent from './setEvent';
19
+ import setAccordion from '../../../dist/components/Accordion/setAccordion';
20
+ setAccordion();
21
+ </script>
@@ -0,0 +1,2 @@
1
+ import setEvent from '@lism-ui/core/components/Accordion/setEvent';
2
+ export default setEvent;
@@ -0,0 +1,7 @@
1
+ import Root from './Accordion.astro';
2
+ import Header from './AccHeader.astro';
3
+ import Label from './AccLabel.astro';
4
+ import Icon from './AccIcon.astro';
5
+ import Body from './AccBody.astro';
6
+
7
+ export default { Root, Header, Body, Icon, Label };
@@ -0,0 +1,11 @@
1
+ ---
2
+ import type { LismProps } from '../types';
3
+ import { Lism } from '../Lism';
4
+ import getProps from '../../../dist/components/Box/getProps';
5
+
6
+ // Propsの定義
7
+ interface Props extends LismProps {}
8
+ const props = Astro.props || {};
9
+ ---
10
+
11
+ <Lism {...getProps(props)}><slot /></Lism>
@@ -0,0 +1 @@
1
+ export { default as Box } from './Box.astro';
@@ -0,0 +1,11 @@
1
+ ---
2
+ import type { LismProps } from '../types';
3
+ import { Grid } from '../Grid';
4
+ // import getProps from '../../../dist/components/Center/getProps';
5
+
6
+ // Propsの定義
7
+ interface Props extends LismProps {}
8
+ const props = Astro.props || {};
9
+ ---
10
+
11
+ <Grid _grid='center' {...props}><slot /></Grid>
@@ -0,0 +1 @@
1
+ export { default as Center } from './Center.astro';
@@ -0,0 +1,11 @@
1
+ ---
2
+ import type { LismProps } from '../types';
3
+ import { Grid } from '../Grid';
4
+ import getProps from '../../../dist/components/Columns/getProps';
5
+
6
+ // Propsの定義
7
+ interface Props extends LismProps {}
8
+ const props = Astro.props || {};
9
+ ---
10
+
11
+ <Grid _grid='columns' {...getProps(props)}><slot /></Grid>
@@ -0,0 +1 @@
1
+ export { default as Columns } from './Columns.astro';
@@ -0,0 +1,11 @@
1
+ ---
2
+ import type { LismProps } from '../types';
3
+ import { Lism } from '../Lism';
4
+
5
+ interface Props extends LismProps {}
6
+
7
+ const { layout, size = true, ...props } = Astro.props || {};
8
+ const Layout = layout || Lism;
9
+ ---
10
+
11
+ <Layout isContainer={size} {...props}><slot /></Layout>
@@ -0,0 +1 @@
1
+ export { default as Container } from './Container.astro';
@@ -0,0 +1,13 @@
1
+ ---
2
+ import type { LismProps } from '../types';
3
+ import { Lism } from '../Lism';
4
+ import getProps from '../../../dist/components/Decorator/getProps';
5
+
6
+ // Propsの定義
7
+ interface Props extends LismProps {}
8
+ const props = Astro.props || {};
9
+ ---
10
+
11
+ <Lism {...getProps(props)}>
12
+ <slot />
13
+ </Lism>
@@ -0,0 +1 @@
1
+ export { default as Decorator } from './Decorator.astro';
@@ -0,0 +1,12 @@
1
+ ---
2
+ import type { LismProps } from '../types';
3
+ import { Lism } from '../Lism';
4
+ import { getDividerProps } from '../../../dist/components/Divider/getProps';
5
+
6
+ // Propsの定義
7
+ interface Props extends LismProps {}
8
+
9
+ const props = Astro.props || {};
10
+ ---
11
+
12
+ <Lism skipState {...getDividerProps(props)} />
@@ -0,0 +1 @@
1
+ export { default as Divider } from './Divider.astro';
@@ -0,0 +1,12 @@
1
+ ---
2
+ import type { LismProps } from '../types';
3
+ import { Lism } from '../Lism';
4
+ import getContent from '../../../dist/components/Dummy/getContent';
5
+
6
+ // Propsの定義
7
+ interface Props extends LismProps {}
8
+ const { tag = 'p', pre = '', length = 'm', lang = 'en', offset = 0, ...props } = Astro.props || {};
9
+ const content = getContent({ tag, pre, lang, length, offset });
10
+ ---
11
+
12
+ <Lism tag={tag} {...props} set:html={content} />
@@ -0,0 +1 @@
1
+ export { default as Dummy } from './Dummy.astro';
@@ -0,0 +1,11 @@
1
+ ---
2
+ import type { LismProps } from '../types';
3
+ import Flex from './Flex.astro';
4
+
5
+ interface Props extends LismProps {}
6
+ const props = Astro.props || {};
7
+ ---
8
+
9
+ <Flex variant='cluster' {...props}>
10
+ <slot />
11
+ </Flex>
@@ -0,0 +1,14 @@
1
+ ---
2
+ import type { LismProps } from '../types';
3
+ import { Lism } from '../Lism';
4
+ import { getFlexProps } from '../../../dist/components/Flex/getProps';
5
+
6
+ // Propsの定義
7
+ interface Props extends LismProps {}
8
+
9
+ let props = Astro.props || {};
10
+ ---
11
+
12
+ <Lism {...getFlexProps(props)}>
13
+ <slot />
14
+ </Lism>
@@ -0,0 +1,2 @@
1
+ export { default as Flex } from './Flex.astro';
2
+ export { default as Cluster } from './Cluster.astro';
@@ -0,0 +1,12 @@
1
+ ---
2
+ import type { LismProps } from '../types';
3
+ import { Lism } from '../Lism';
4
+ import getProps from '../../../dist/components/Frame/getProps';
5
+
6
+ // Propsの定義
7
+ interface Props extends LismProps {}
8
+
9
+ const props = Astro.props || {};
10
+ ---
11
+
12
+ <Lism {...getProps(props)}><slot /></Lism>
@@ -0,0 +1 @@
1
+ export { default as Frame } from './Frame.astro';
@@ -0,0 +1,13 @@
1
+ ---
2
+ import type { LismProps } from '../types';
3
+ import { Lism } from '../Lism';
4
+ import { getGridProps } from '../../../dist/components/Grid/getProps';
5
+
6
+ // Propsの定義
7
+ interface Props extends LismProps {}
8
+ let props = Astro.props;
9
+ ---
10
+
11
+ <Lism {...getGridProps(props)}>
12
+ <slot />
13
+ </Lism>
@@ -0,0 +1,15 @@
1
+ ---
2
+ import type { LismProps } from '../types';
3
+ import { Lism } from '../Lism';
4
+ import { getGridItemProps } from '../../../dist/components/Grid/getProps';
5
+
6
+ // Propsの定義
7
+ interface Props extends LismProps {}
8
+
9
+ let { layout, ...props } = Astro.props;
10
+ const LismComponent = layout || Lism;
11
+ ---
12
+
13
+ <LismComponent {...getGridItemProps(props)}>
14
+ <slot />
15
+ </LismComponent>
@@ -0,0 +1,2 @@
1
+ export { default as Grid } from './Grid.astro';
2
+ export { default as GridItem } from './GridItem.astro';
@@ -0,0 +1,25 @@
1
+ ---
2
+ import type { LismProps } from '../types';
3
+ import getLismProps from '../../../dist/lib/getLismProps';
4
+ import getProps from '../../../dist/components/Icon/getProps';
5
+ import SVG from './SVG.astro';
6
+
7
+ // Propsの定義
8
+ interface Props extends LismProps {}
9
+
10
+ const props = Astro.props || {};
11
+
12
+ // const hasChildren = Astro.slots.has('default');
13
+ // let { IconTag, iconProps, otherProps } = getProps(props, hasChildren);
14
+ // if (IconTag === '_SVG_') IconTag = SVG;
15
+
16
+ let { Component, lismProps, exProps } = getProps(props);
17
+
18
+ if (Component === '_SVG_') {
19
+ Component = SVG;
20
+ }
21
+ ---
22
+
23
+ <Component {...getLismProps(lismProps)} {...exProps}>
24
+ <slot />
25
+ </Component>
@@ -0,0 +1,30 @@
1
+ ---
2
+ // Propsの定義
3
+ interface Props {
4
+ size?: string | number;
5
+ fill?: string;
6
+ viewBox?: string;
7
+ path?: string;
8
+ [key: string]: any;
9
+ }
10
+ let {
11
+ size = '1em',
12
+ fill = 'currentColor',
13
+ viewBox = '0 0 24 24',
14
+ path,
15
+ ...props
16
+ } = Astro.props || {};
17
+ ---
18
+
19
+ <svg
20
+ xmlns='http://www.w3.org/2000/svg'
21
+ viewBox={viewBox}
22
+ width={size}
23
+ height={size}
24
+ fill={fill}
25
+ focusable='false'
26
+ {...props}
27
+ >
28
+ {path && <path d={path} />}
29
+ <slot />
30
+ </svg>
@@ -0,0 +1,2 @@
1
+ export { default as Icon } from './Icon.astro';
2
+ // export { default as SVG } from './SVG.astro';
@@ -0,0 +1,15 @@
1
+ ---
2
+ import type { LismProps } from '../types';
3
+ import { Lism } from '../Lism';
4
+ import { getLayerProps } from '../../../dist/components/Layer/getProps';
5
+
6
+ // Propsの定義
7
+ interface Props extends LismProps {}
8
+
9
+ let { layout, ...props } = Astro.props || {};
10
+ const Layout = layout || Lism;
11
+ ---
12
+
13
+ <Layout isLayer {...getLayerProps(props)}>
14
+ <slot />
15
+ </Layout>
@@ -0,0 +1 @@
1
+ export { default as Layer } from './Layer.astro';
@@ -0,0 +1,16 @@
1
+ ---
2
+ import type { LismProps } from '../types';
3
+ import { Lism } from '../Lism';
4
+ // import getProps from '../../../dist/components/LinkBox/getProps';
5
+
6
+ interface Props extends LismProps {}
7
+ const { layout, ...props } = Astro.props || {};
8
+
9
+ const hasHref = !!props.href;
10
+ const tag = hasHref ? 'a' : 'div';
11
+ const LismComponent = layout || Lism;
12
+ ---
13
+
14
+ <LismComponent isLinkBox hov='fade' tag={tag} {...props}>
15
+ <slot />
16
+ </LismComponent>
@@ -0,0 +1 @@
1
+ export { default as LinkBox } from './LinkBox.astro';
@@ -0,0 +1,10 @@
1
+ ---
2
+ import type { LismProps } from '../types';
3
+ import Lism from './Lism.astro';
4
+
5
+ interface Props extends LismProps {}
6
+ ---
7
+
8
+ <Lism skipState tag='a' {...Astro.props || {}}>
9
+ <slot />
10
+ </Lism>
@@ -0,0 +1,14 @@
1
+ ---
2
+ import type { LismProps } from '../types';
3
+ import getLismProps from '../../../dist/lib/getLismProps';
4
+
5
+ // Propsの定義
6
+ interface Props extends LismProps {}
7
+
8
+ const { as, exProps, tag, ...props } = Astro.props || {};
9
+ const JSX = as || tag || 'div';
10
+ ---
11
+
12
+ <JSX {...getLismProps(props)} {...exProps}>
13
+ <slot />
14
+ </JSX>
@@ -0,0 +1,24 @@
1
+ ---
2
+ import type { LismProps } from '../types';
3
+ import getLismProps from '../../../dist/lib/getLismProps';
4
+ import getMediaProps from '../../../dist/components/getMediaProps';
5
+ import { Image } from 'astro:assets';
6
+
7
+ // Propsの定義
8
+ interface Props extends LismProps {
9
+ // src?: string;
10
+ // alt?: string;
11
+ // width?: string | number;
12
+ // height?: string | number;
13
+ }
14
+ const { as, exProps, tag, ...props } = Astro.props || {};
15
+
16
+ let JSX = as || tag || 'img';
17
+ if (JSX === 'AstroImage') {
18
+ JSX = Image;
19
+ }
20
+ ---
21
+
22
+ <JSX {...getLismProps(getMediaProps(props))} {...exProps}>
23
+ <slot />
24
+ </JSX>
@@ -0,0 +1,10 @@
1
+ ---
2
+ import type { LismProps } from '../types';
3
+ import Lism from './Lism.astro';
4
+
5
+ interface Props extends LismProps {}
6
+ ---
7
+
8
+ <Lism skipState tag='p' {...Astro.props || {}}>
9
+ <slot />
10
+ </Lism>
@@ -0,0 +1,4 @@
1
+ export { default as Lism } from './Lism.astro';
2
+ export { default as Text } from './Text.astro';
3
+ export { default as Media } from './Media.astro';
4
+ export { default as Link } from './Link.astro';
@@ -0,0 +1,14 @@
1
+ ---
2
+ import type { LismProps } from '../types';
3
+ import { defaultProps } from '../../../dist/components/Modal/getProps';
4
+ import { Lism } from '../Lism';
5
+
6
+ // Propsの定義
7
+ interface Props extends LismProps {}
8
+ const { layout, ...props } = Astro.props || {};
9
+ const Layout = layout || Lism;
10
+ ---
11
+
12
+ <Layout {...defaultProps.body} {...props}>
13
+ <slot />
14
+ </Layout>
@@ -0,0 +1,24 @@
1
+ ---
2
+ import type { LismProps } from '../types';
3
+ import { defaultProps } from '../../../dist/components/Modal/getProps';
4
+ import { Lism } from '../Lism';
5
+ import { Icon } from '../Icon';
6
+
7
+ // Propsの定義
8
+ interface Props extends LismProps {}
9
+ const { modalId = '', icon, srText = 'Close', ...props } = Astro.props || {};
10
+ const hasSlot = Astro.slots.has('default');
11
+ ---
12
+
13
+ <Lism data-modal-close={modalId} {...defaultProps.closeBtn} {...props}>
14
+ {
15
+ hasSlot ? (
16
+ <slot />
17
+ ) : (
18
+ <>
19
+ <Icon icon={icon || 'x'} />
20
+ <span class='u--hidden'>{srText || 'Close'}</span>
21
+ </>
22
+ )
23
+ }
24
+ </Lism>
@@ -0,0 +1,14 @@
1
+ ---
2
+ import type { LismProps } from '../types';
3
+ import { defaultProps } from '../../../dist/components/Modal/getProps';
4
+ import { Lism } from '../Lism';
5
+
6
+ // Propsの定義
7
+ interface Props extends LismProps {}
8
+ const { layout, ...props } = Astro.props || {};
9
+ const Layout = layout || Lism;
10
+ ---
11
+
12
+ <Layout {...defaultProps.footer} {...props}>
13
+ <slot />
14
+ </Layout>
@@ -0,0 +1,14 @@
1
+ ---
2
+ import type { LismProps } from '../types';
3
+ import { defaultProps } from '../../../dist/components/Modal/getProps';
4
+ import { Lism } from '../Lism';
5
+
6
+ // Propsの定義
7
+ interface Props extends LismProps {}
8
+ const { layout, ...props } = Astro.props || {};
9
+ const Layout = layout || Lism;
10
+ ---
11
+
12
+ <Layout {...defaultProps.header} {...props}>
13
+ <slot />
14
+ </Layout>
@@ -0,0 +1,13 @@
1
+ ---
2
+ import type { LismProps } from '../types';
3
+ import { defaultProps } from '../../../dist/components/Modal/getProps';
4
+ import { Stack } from '../Stack';
5
+
6
+ // Propsの定義
7
+ interface Props extends LismProps {}
8
+ const props = Astro.props || {};
9
+ ---
10
+
11
+ <Stack {...defaultProps.inner} {...props}>
12
+ <slot />
13
+ </Stack>
@@ -0,0 +1,20 @@
1
+ ---
2
+ import type { LismProps } from '../types';
3
+ import { getProps } from '../../../dist/components/Modal/getProps';
4
+ import { Lism } from '../Lism';
5
+
6
+ // Propsの定義
7
+ interface Props extends LismProps {}
8
+ const { layout, ...props } = Astro.props || {};
9
+ const Layout = layout || Lism;
10
+ ---
11
+
12
+ <Layout tag='dialog' {...getProps(props)}>
13
+ <slot />
14
+ </Layout>
15
+
16
+ <script>
17
+ import setModal from '../../../dist/components/Modal/setModal';
18
+ console.log('modal.astro');
19
+ setModal();
20
+ </script>
@@ -0,0 +1,8 @@
1
+ import Root from './Modal.astro';
2
+ import Inner from './Inner.astro';
3
+ import Body from './Body.astro';
4
+ import CloseIconBtn from './CloseIconBtn.astro';
5
+ import Header from './Header.astro';
6
+ import Footer from './Footer.astro';
7
+
8
+ export default { Root, Inner, Body, CloseIconBtn, Header, Footer };
@@ -0,0 +1,10 @@
1
+ ---
2
+ import type { LismProps } from '../types';
3
+ import { Lism } from '../Lism';
4
+ import getOverlayLinkProps from '../../../dist/components/OverlayLink/getProps';
5
+
6
+ interface Props extends LismProps {}
7
+ const props = Astro.props || {};
8
+ ---
9
+
10
+ <Lism {...getOverlayLinkProps(props)}><slot /></Lism>
@@ -0,0 +1 @@
1
+ export { default as OverlayLink } from './OverlayLink.astro';
@@ -0,0 +1,11 @@
1
+ ---
2
+ import type { LismProps } from '../types';
3
+ import { Lism } from '../Lism';
4
+ import getProps from '../../../dist/components/Spacer/getProps';
5
+
6
+ // Propsの定義
7
+ interface Props extends LismProps {}
8
+ const props = Astro.props || {};
9
+ ---
10
+
11
+ <Lism skipState {...getProps(props)} />
@@ -0,0 +1 @@
1
+ export { default as Spacer } from './Spacer.astro';
@@ -0,0 +1,7 @@
1
+ ---
2
+ import Flex from '../Flex/Flex.astro';
3
+ ---
4
+
5
+ <Flex _flex='stack' {...Astro.props}>
6
+ <slot />
7
+ </Flex>
@@ -0,0 +1 @@
1
+ export { default as Stack } from './Stack.astro';
@@ -0,0 +1,26 @@
1
+ ---
2
+ import type { LismProps } from '../types';
3
+ import { Lism } from '../Lism';
4
+
5
+ export interface Props extends LismProps {
6
+ // controlId: string;
7
+ isActive?: boolean;
8
+ tabId?: string | number;
9
+ index?: number;
10
+ }
11
+ const { tabId = 'tab', index = 0, isActive, ...props } = Astro.props;
12
+ const controlId = `${tabId}-${index}`;
13
+ ---
14
+
15
+ <Lism
16
+ tag='button'
17
+ lismClass='d--tabs__tab'
18
+ className='re--style'
19
+ role='tab'
20
+ aria-controls={controlId}
21
+ aria-selected={isActive ? 'true' : 'false'}
22
+ skipState
23
+ {...props}
24
+ >
25
+ <slot />
26
+ </Lism>
@@ -0,0 +1,8 @@
1
+ ---
2
+ // memo: タブボタンが <button ~ button> で取得できることを前提にして<slot />だけにしている。
3
+ // <slot name='tab' />,<slot name='panel' />に分け、それぞれをカスタムDOMで囲んだ方が確実にそれぞれの内容は取れるが、わざわざslot指定が必要になってしまう。
4
+ ---
5
+
6
+ <lism-placeholder-tabitem>
7
+ <slot />
8
+ </lism-placeholder-tabitem>
@@ -0,0 +1,8 @@
1
+ ---
2
+ // import type { LismProps } from '../types';
3
+ import { Flex } from '../Flex';
4
+ ---
5
+
6
+ <Flex lismClass='d--tabs__list' role='tablist' {...Astro.props}>
7
+ <slot />
8
+ </Flex>
@@ -0,0 +1,22 @@
1
+ ---
2
+ import type { LismProps } from '../types';
3
+ import { GridItem } from '../Grid';
4
+
5
+ export interface Props extends LismProps {
6
+ isActive?: boolean;
7
+ tabId?: string | number;
8
+ index?: number;
9
+ }
10
+ const { tabId = 'tab', index = 0, isActive = false, ...props } = Astro.props;
11
+ const controlId = `${tabId}-${index}`;
12
+ ---
13
+
14
+ <GridItem
15
+ id={controlId}
16
+ role='tabpanel'
17
+ aria-hidden={isActive ? 'false' : 'true'}
18
+ lismClass='d--tabs__panel'
19
+ {...props}
20
+ >
21
+ <slot />
22
+ </GridItem>
@@ -0,0 +1,60 @@
1
+ ---
2
+ import type { LismProps } from '../types';
3
+ import { Grid } from '../Grid';
4
+ // import Tab from './Tab.astro';
5
+ // import TabPanel from './TabPanel.astro';
6
+ import TabList from './TabList.astro';
7
+ import { uuidv4 } from '../helper/index.js';
8
+ import transformTabitems from './transformTabitems.js';
9
+ import getTabsProps from '../../../dist/components/Tabs/getProps';
10
+
11
+ // import TheTab from './TheTab.astro';}
12
+ // slotsについて: https://docs.astro.build/ja/reference/api-reference/#astroslots
13
+
14
+ // Propsの定義
15
+ interface Props extends LismProps {
16
+ uid?: string | number;
17
+ defaultIndex?: string | number;
18
+ }
19
+ // propsの取得
20
+ const { defaultIndex = 1, tabId = '', listProps = {}, ...props } = Astro.props || {};
21
+
22
+ // tabID生成
23
+ const theTabID = tabId ? tabId : uuidv4();
24
+
25
+ // 子要素の方から順番に処理されていくので、文字列処理でデータを抽出
26
+ const { btns, panels } = transformTabitems(
27
+ await Astro.slots.render('default'),
28
+ theTabID,
29
+ defaultIndex
30
+ );
31
+
32
+ const hasItems = btns.length > 0;
33
+ ---
34
+
35
+ <Grid {...getTabsProps(props)}>
36
+ {
37
+ btns && (
38
+ <TabList {...listProps}>
39
+ {btns.map((btn, index) => {
40
+ return <Fragment key={index} set:html={btn} />;
41
+ })}
42
+ </TabList>
43
+ )
44
+ }
45
+ {
46
+ panels.map((panel, index) => {
47
+ return <Fragment key={index} set:html={panel} />;
48
+ })
49
+ }
50
+ {!hasItems && <slot />}
51
+ </Grid>
52
+
53
+ <script>
54
+ // import setEvent from './setEvent';
55
+ import setEvent from '../../../dist/components/Tabs/setEvent';
56
+ const tabsAll = document.querySelectorAll('.d--tabs');
57
+ tabsAll.forEach((tabs) => {
58
+ setEvent(tabs);
59
+ });
60
+ </script>
@@ -0,0 +1,7 @@
1
+ import { default as Root } from './Tabs.astro';
2
+ import { default as Item } from './TabItem.astro';
3
+ import { default as List } from './TabList.astro';
4
+ import { default as Panel } from './TabPanel.astro';
5
+ import { default as Tab } from './Tab.astro';
6
+
7
+ export default { Root, List, Panel, Item, Tab };
@@ -0,0 +1,40 @@
1
+ // <lism-placeholder-tabitem> → div.tabitem へ 変換
2
+ export default function transformHTML(htmlString, tabID, defaultIndex) {
3
+ let index = 1; // 1スタート
4
+ let btns = [];
5
+ let panels = [];
6
+
7
+ // <lism-placeholder-tabitem>でコンテンツを囲んでいるので中身を解析する。
8
+ const regex = /<lism-placeholder-tabitem(.*?)>(.*?)<\/lism-placeholder-tabitem>/gs;
9
+ const matches = [...htmlString.matchAll(regex)];
10
+
11
+ // console.log(matches);
12
+ matches.forEach((match) => {
13
+ // const tabItemAttrs = match[1]; // 使わないがdata-astro-source-file属性が自動でついてきたりするので、属性値があっても問題ないようにしている。
14
+ const tabItemContent = match[2];
15
+
16
+ const controlId = `${tabID}-${index}`;
17
+ const isActive = index === defaultIndex;
18
+ index++;
19
+
20
+ // <lism-placeholder-tabtbn>からタブボタンを生成
21
+ const btnMatch = tabItemContent.match(/<button(.*?)>(.*?)<\/button>(.*)/s);
22
+ if (!btnMatch) return;
23
+ let btnAtts = btnMatch[1];
24
+ let btnContent = btnMatch[2];
25
+ let panel = btnMatch[3];
26
+
27
+ // btnContent = btnContent.replace(` slot="tab"`, '');
28
+ btnAtts = btnAtts.replace(`aria-controls="tab-0"`, `aria-controls="${controlId}"`);
29
+ panel = panel.replace(`id="tab-0"`, `id="${controlId}"`);
30
+ if (isActive) {
31
+ btnAtts = btnAtts.replace(/aria-selected="false"/, 'aria-selected="true"');
32
+ panel = panel.replace(/aria-hidden="true"/, 'aria-hidden="false"');
33
+ }
34
+
35
+ btns.push(`<button${btnAtts}>${btnContent}</button>`);
36
+ panels.push(panel);
37
+ });
38
+
39
+ return { btns, panels };
40
+ }
@@ -0,0 +1,14 @@
1
+ ---
2
+ import type { LismProps } from '../types';
3
+ import { Lism } from '../Lism';
4
+
5
+ // Propsの定義
6
+ interface Props extends LismProps {
7
+ duration?: string | number;
8
+ }
9
+ const props = Astro.props || {};
10
+ ---
11
+
12
+ <Lism data-lism='test' bd p='20' {...props}>
13
+ <slot />
14
+ </Lism>
@@ -0,0 +1,14 @@
1
+ ---
2
+ import type { LismProps } from '../types';
3
+ import { Lism } from '../Lism';
4
+
5
+ // Propsの定義
6
+ interface Props extends LismProps {
7
+ duration?: string | number;
8
+ }
9
+ const props = Astro.props || {};
10
+ ---
11
+
12
+ <Lism data-lism='test-item' bd bds='dashed' {...props}>
13
+ <slot />
14
+ </Lism>
@@ -0,0 +1,4 @@
1
+ import { default as Root } from './Test.astro';
2
+ import { default as Item } from './TestItem.astro';
3
+
4
+ export default { Root, Item };
@@ -0,0 +1,12 @@
1
+ ---
2
+ import type { LismProps } from '../types';
3
+ import { Lism } from '../Lism';
4
+ import { getWithSideProps } from '../../../dist/components/WithSide/getProps';
5
+
6
+ // Propsの定義
7
+ interface Props extends LismProps {}
8
+
9
+ const props = Astro.props || {};
10
+ ---
11
+
12
+ <Lism {...getWithSideProps(props)}><slot /></Lism>
@@ -0,0 +1 @@
1
+ export { default as WithSide } from './WithSide.astro';
@@ -0,0 +1,6 @@
1
+ // https://stackoverflow.com/questions/105034/how-do-i-create-a-guid-uuid
2
+ export function uuidv4() {
3
+ return '10000000-1000-4000-8000-100000000000'.replace(/[018]/g, (c) =>
4
+ (c ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))).toString(16)
5
+ );
6
+ }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * .astro でLismコンポーネントを配布
3
+ */
4
+
5
+ // export { default as Lism } from './Lism/Lism.astro';
6
+ // export { Lism, Text, Media, Link } from './Lism';
7
+ export * from './Lism';
8
+ export * from './Dummy';
9
+ export * from './Box';
10
+ export * from './Flex';
11
+ export * from './Stack';
12
+ export * from './Grid';
13
+ export * from './Columns';
14
+ export * from './Center';
15
+ export * from './WithSide';
16
+ export * from './Frame';
17
+
18
+ export * from './Container';
19
+ export * from './Layer';
20
+ export * from './LinkBox';
21
+
22
+ export * from './Spacer';
23
+ export * from './Decorator';
24
+ export * from './Divider';
25
+ export * from './Icon';
26
+
27
+ export { default as Accordion } from './Accordion';
28
+ export { default as Modal } from './Modal';
29
+ export { default as Tabs } from './Tabs';
@@ -0,0 +1,28 @@
1
+ // export interface LismClass {
2
+ // b?: string;
3
+ // c?: string;
4
+ // l?: string;
5
+ // e?: string;
6
+ // }
7
+ export interface LismStyle {
8
+ [key: string]: number | string; // 任意のプロパティを受け取る
9
+ }
10
+
11
+ export interface exProps {
12
+ [key: string]: any;
13
+ }
14
+
15
+ export interface LismProps {
16
+ lismClass?: string;
17
+ _lismClass?: string[];
18
+ lismStyle?: LismStyle;
19
+ lismState?: string[];
20
+ skipState?: boolean;
21
+ as?: any;
22
+ tag?: string;
23
+ variant?: string;
24
+ // lismState?: ;
25
+ // style
26
+ exProps?: exProps;
27
+ [key: string]: any;
28
+ }
@@ -0,0 +1,19 @@
1
+ 'use client';
2
+ import Accordion from '../../../dist/components/Accordion';
3
+ // import 'style';
4
+
5
+ export function Root(props) {
6
+ return <Accordion.Root {...props} />;
7
+ }
8
+ export function Header(props) {
9
+ return <Accordion.Header {...props} />;
10
+ }
11
+ export function Label(props) {
12
+ return <Accordion.Label {...props} />;
13
+ }
14
+ export function Body(props) {
15
+ return <Accordion.Body {...props} />;
16
+ }
17
+ export function Icon(props) {
18
+ return <Accordion.Icon {...props} />;
19
+ }
@@ -0,0 +1,2 @@
1
+ import { Root, Header, Label, Body, Icon } from './Accordion';
2
+ export default { Root, Header, Label, Body, Icon };