@lism-css/ui 0.2.1 → 0.2.2

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 (56) hide show
  1. package/dist/components/Accordion/astro/index.d.ts +6 -0
  2. package/dist/components/Avatar/astro/index.d.ts +1 -1
  3. package/dist/components/Badge/astro/index.d.ts +1 -1
  4. package/dist/components/Button/astro/index.d.ts +1 -1
  5. package/dist/components/Callout/getProps.d.ts +1 -1
  6. package/dist/components/Chat/astro/index.d.ts +1 -0
  7. package/dist/components/Chat/getProps.d.ts +53 -0
  8. package/dist/components/Chat/react/Chat.d.ts +7 -0
  9. package/dist/components/Chat/react/index.d.ts +1 -0
  10. package/dist/components/Modal/astro/index.d.ts +5 -0
  11. package/dist/components/NavMenu/astro/index.d.ts +11 -0
  12. package/dist/components/NavMenu/getProps.d.ts +32 -0
  13. package/dist/components/NavMenu/react/NavMenu.d.ts +16 -0
  14. package/dist/components/NavMenu/react/index.d.ts +8 -0
  15. package/dist/components/ShapeDivider/astro/index.d.ts +1 -0
  16. package/dist/components/ShapeDivider/getProps.d.ts +11 -0
  17. package/dist/components/ShapeDivider/react/ShapeDivider.d.ts +4 -0
  18. package/dist/components/ShapeDivider/react/index.d.ts +1 -0
  19. package/dist/components/Tabs/astro/index.d.ts +5 -0
  20. package/dist/components/astro.d.ts +3 -0
  21. package/dist/components/react.d.ts +3 -0
  22. package/dist/style.css +1 -1
  23. package/package.json +68 -68
  24. package/src/components/Avatar/astro/Avatar.astro +0 -1
  25. package/src/components/Avatar/react/Avatar.jsx +0 -1
  26. package/src/components/Callout/getProps.ts +1 -1
  27. package/src/components/Chat/_style.css +64 -0
  28. package/src/components/Chat/astro/Chat.astro +41 -0
  29. package/src/components/Chat/astro/index.js +1 -0
  30. package/src/components/Chat/getProps.js +57 -0
  31. package/src/components/Chat/react/Chat.jsx +24 -0
  32. package/src/components/Chat/react/index.js +1 -0
  33. package/src/components/Modal/react/Body.jsx +1 -1
  34. package/src/components/Modal/react/CloseBtn.jsx +1 -2
  35. package/src/components/Modal/react/Inner.jsx +1 -1
  36. package/src/components/Modal/react/Modal.jsx +1 -1
  37. package/src/components/Modal/react/OpenBtn.jsx +1 -1
  38. package/src/components/NavMenu/_style.css +21 -0
  39. package/src/components/NavMenu/astro/Item.astro +8 -0
  40. package/src/components/NavMenu/astro/Link.astro +8 -0
  41. package/src/components/NavMenu/astro/Nest.astro +8 -0
  42. package/src/components/NavMenu/astro/Root.astro +9 -0
  43. package/src/components/NavMenu/astro/index.js +6 -0
  44. package/src/components/NavMenu/getProps.js +65 -0
  45. package/src/components/NavMenu/react/NavMenu.jsx +19 -0
  46. package/src/components/NavMenu/react/index.js +3 -0
  47. package/src/components/ShapeDivider/_style.css +56 -0
  48. package/src/components/ShapeDivider/astro/ShapeDivider.astro +31 -0
  49. package/src/components/ShapeDivider/astro/index.js +1 -0
  50. package/src/components/ShapeDivider/getProps.js +40 -0
  51. package/src/components/ShapeDivider/react/ShapeDivider.jsx +33 -0
  52. package/src/components/ShapeDivider/react/index.js +1 -0
  53. package/src/components/astro.ts +3 -0
  54. package/src/components/react.ts +3 -0
  55. package/src/style.scss +3 -0
  56. package/LICENSE +0 -21
@@ -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 +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 };
@@ -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';
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{.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}}@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,69 +1,69 @@
1
1
  {
2
- "name": "@lism-css/ui",
3
- "version": "0.2.1",
4
- "description": "UI components by lism-css.",
5
- "author": {
6
- "name": "ddryo",
7
- "url": "https://github.com/ddryo"
8
- },
9
- "license": "MIT",
10
- "keywords": [
11
- "css-framework",
12
- "astro-component",
13
- "react-component"
14
- ],
15
- "files": [
16
- "dist",
17
- "src"
18
- ],
19
- "type": "module",
20
- "main": "./dist/index.js",
21
- "exports": {
22
- "./react": {
23
- "import": "./src/components/react.js",
24
- "types": "./dist/components/index.d.ts"
25
- },
26
- "./astro": {
27
- "import": "./src/components/astro.js",
28
- "types": "./dist/components/index.d.ts"
29
- },
30
- "./scripts/*": "./dist/scripts/*.js",
31
- "./style.css": "./dist/style.css"
32
- },
33
- "homepage": "https://www.lism.style",
34
- "repository": {
35
- "type": "git",
36
- "url": "https://github.com/lism-css/lism-css/tree/main/packages/lism-css"
37
- },
38
- "bugs": {
39
- "url": "https://github.com/lism-css/lism-css/issues"
40
- },
41
- "dependencies": {
42
- "lism-css": "0.8.3"
43
- },
44
- "devDependencies": {
45
- "@babel/cli": "^7.27.2",
46
- "@babel/core": "^7.27.3",
47
- "@babel/preset-env": "^7.27.2",
48
- "@babel/preset-react": "^7.27.1",
49
- "@rollup/plugin-babel": "^6.0.4",
50
- "@vitejs/plugin-react-swc": "^3.10.0",
51
- "glob": "^11.0.2",
52
- "rollup": "^4.41.1",
53
- "typescript": "~5.8.3",
54
- "unplugin-dts": "1.0.0-beta.6",
55
- "vite": "^6.3.5"
56
- },
57
- "peerDependencies": {
58
- "@types/react": "*",
59
- "@types/react-dom": "*",
60
- "react": "^18 || ^19",
61
- "react-dom": "^18 || ^19"
62
- },
63
- "sideEffects": false,
64
- "scripts": {
65
- "dev": "vite",
66
- "build": "vite build && pnpm build:css",
67
- "build:css": "node build-css.js"
68
- }
69
- }
2
+ "name": "@lism-css/ui",
3
+ "version": "0.2.2",
4
+ "description": "UI components by lism-css.",
5
+ "author": {
6
+ "name": "ddryo",
7
+ "url": "https://github.com/ddryo"
8
+ },
9
+ "license": "MIT",
10
+ "keywords": [
11
+ "css-framework",
12
+ "astro-component",
13
+ "react-component"
14
+ ],
15
+ "scripts": {
16
+ "dev": "vite",
17
+ "build": "vite build && pnpm build:css",
18
+ "build:css": "node build-css.js"
19
+ },
20
+ "files": [
21
+ "dist",
22
+ "src"
23
+ ],
24
+ "type": "module",
25
+ "main": "./dist/index.js",
26
+ "exports": {
27
+ "./react": {
28
+ "import": "./src/components/react.js",
29
+ "types": "./dist/components/index.d.ts"
30
+ },
31
+ "./astro": {
32
+ "import": "./src/components/astro.js",
33
+ "types": "./dist/components/index.d.ts"
34
+ },
35
+ "./scripts/*": "./dist/scripts/*.js",
36
+ "./style.css": "./dist/style.css"
37
+ },
38
+ "homepage": "https://www.lism.style",
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "https://github.com/lism-css/lism-css/tree/main/packages/lism-css"
42
+ },
43
+ "bugs": {
44
+ "url": "https://github.com/lism-css/lism-css/issues"
45
+ },
46
+ "dependencies": {
47
+ "lism-css": "workspace:*"
48
+ },
49
+ "devDependencies": {
50
+ "@babel/cli": "^7.27.2",
51
+ "@babel/core": "^7.27.3",
52
+ "@babel/preset-env": "^7.27.2",
53
+ "@babel/preset-react": "^7.27.1",
54
+ "@rollup/plugin-babel": "^6.0.4",
55
+ "@vitejs/plugin-react-swc": "^3.10.0",
56
+ "glob": "^11.0.2",
57
+ "rollup": "^4.41.1",
58
+ "typescript": "~5.8.3",
59
+ "unplugin-dts": "1.0.0-beta.6",
60
+ "vite": "^6.3.5"
61
+ },
62
+ "peerDependencies": {
63
+ "@types/react": "*",
64
+ "@types/react-dom": "*",
65
+ "react": "^18 || ^19",
66
+ "react-dom": "^18 || ^19"
67
+ },
68
+ "sideEffects": false
69
+ }
@@ -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';
@@ -1,4 +1,4 @@
1
- import { Lism } from '../../Lism';
1
+ import { Lism } from 'lism-css/react';
2
2
  import { defaultProps } from '../getProps';
3
3
 
4
4
  export default function ModalBody({ children, ...props }) {
@@ -1,5 +1,4 @@
1
- import { Lism } from '../../Lism';
2
- import { Icon } from '../../atomic/Icon';
1
+ import { Lism, Icon } from 'lism-css/react';
3
2
  import { defaultProps } from '../getProps';
4
3
 
5
4
  // duration: [s]
@@ -1,4 +1,4 @@
1
- import { Lism } from '../../Lism';
1
+ import { Lism } from 'lism-css/react';
2
2
  import { getInnerProps } from '../getProps';
3
3
 
4
4
  export default function ModalInner({ children, ...props }) {
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Lism } from '../../Lism';
2
+ import { Lism } from 'lism-css/react';
3
3
  import { setEvent } from '../setModal';
4
4
  import { getProps } from '../getProps';
5
5
 
@@ -1,4 +1,4 @@
1
- import { Lism } from '../../Lism';
1
+ import { Lism } from 'lism-css/react';
2
2
  import { defaultProps } from '../getProps';
3
3
 
4
4
  // duration: [s]
@@ -0,0 +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
+ }
8
+
9
+ .c--navMenu_nest {
10
+ --_item-p: inherit;
11
+ }
12
+
13
+ .c--navMenu_link {
14
+ padding: var(--_item-p);
15
+ }
16
+
17
+ .c--navMenu_nest,
18
+ .c--navMenu_item {
19
+ --bdc: inherit;
20
+ }
21
+ }
@@ -0,0 +1,8 @@
1
+ ---
2
+ import { Lism } from 'lism-css/astro';
3
+ import { getItemProps } from '../getProps';
4
+ ---
5
+
6
+ <Lism {...getItemProps(Astro.props)}>
7
+ <slot />
8
+ </Lism>
@@ -0,0 +1,8 @@
1
+ ---
2
+ import { Flex } from 'lism-css/astro';
3
+ import { getLinkProps } from '../getProps';
4
+ ---
5
+
6
+ <Flex {...getLinkProps(Astro.props)}>
7
+ <slot />
8
+ </Flex>
@@ -0,0 +1,8 @@
1
+ ---
2
+ import { Stack } from 'lism-css/astro';
3
+ import { getNestProps } from '../getProps';
4
+ ---
5
+
6
+ <Stack {...getNestProps(Astro.props)}>
7
+ <slot />
8
+ </Stack>
@@ -0,0 +1,9 @@
1
+ ---
2
+ import { Stack } from 'lism-css/astro';
3
+ import { getRootProps } from '../getProps';
4
+ import '../_style.css';
5
+ ---
6
+
7
+ <Stack {...getRootProps(Astro.props)}>
8
+ <slot />
9
+ </Stack>
@@ -0,0 +1,6 @@
1
+ import Root from './Root.astro';
2
+ import Nest from './Nest.astro';
3
+ import Item from './Item.astro';
4
+ import Link from './Link.astro';
5
+
6
+ export default { Root, Nest, Item, Link };
@@ -0,0 +1,65 @@
1
+ /**
2
+ * NavMenu コンポーネントの共通プロパティ処理
3
+ */
4
+ import getMaybeCssVar from 'lism-css/lib/getMaybeCssVar';
5
+
6
+ /**
7
+ * NavMenu.Root のプロパティを処理
8
+ * @param {object} props - コンポーネントのプロパティ
9
+ * @param {string} [props.hovC] - ホバー時のテキストカラー(--hov-c として出力)
10
+ * @param {string} [props.hovBgc] - ホバー時の背景カラー(--hov-bgc として出力)
11
+ * @param {string} [props.itemP] - 各アイテムのパディング(--_item-p として出力)
12
+ * @param {object} [props.style] - スタイルオブジェクト
13
+ */
14
+ export function getRootProps({ hovC, hovBgc, itemP, style = {}, ...props }) {
15
+ const computedStyle = { ...style };
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');
20
+
21
+ return {
22
+ lismClass: 'c--navMenu',
23
+ tag: 'ul',
24
+ style: computedStyle,
25
+ ...props,
26
+ };
27
+ }
28
+
29
+ /**
30
+ * NavMenu.Nest のプロパティを処理
31
+ */
32
+ export function getNestProps(props) {
33
+ return {
34
+ lismClass: 'c--navMenu_nest',
35
+ tag: 'ul',
36
+ 'px-s': '20',
37
+ ...props,
38
+ };
39
+ }
40
+
41
+ /**
42
+ * NavMenu.Item のプロパティを処理
43
+ */
44
+ export function getItemProps(props) {
45
+ return {
46
+ lismClass: 'c--navMenu_item',
47
+ tag: 'li',
48
+ ...props,
49
+ };
50
+ }
51
+
52
+ /**
53
+ * NavMenu.Link のプロパティを処理
54
+ * @param {string} [props.href] - リンク先URL。指定時は a タグになる
55
+ * @param {string} [props.tag='span'] - HTML タグ
56
+ */
57
+ export function getLinkProps({ href, tag = 'span', ...props }) {
58
+ return {
59
+ lismClass: 'c--navMenu_link',
60
+ tag: href ? 'a' : tag,
61
+ href,
62
+ c: 'inherit',
63
+ ...props,
64
+ };
65
+ }
@@ -0,0 +1,19 @@
1
+ import { Lism, Stack, Flex } from 'lism-css/react';
2
+ import { getRootProps, getNestProps, getItemProps, getLinkProps } from '../getProps';
3
+ import '../_style.css';
4
+
5
+ export function Root({ children, ...props }) {
6
+ return <Stack {...getRootProps(props)}>{children}</Stack>;
7
+ }
8
+
9
+ export function Nest({ children, ...props }) {
10
+ return <Stack {...getNestProps(props)}>{children}</Stack>;
11
+ }
12
+
13
+ export function Item({ children, ...props }) {
14
+ return <Lism {...getItemProps(props)}>{children}</Lism>;
15
+ }
16
+
17
+ export function Link({ children, ...props }) {
18
+ return <Flex {...getLinkProps(props)}>{children}</Flex>;
19
+ }
@@ -0,0 +1,3 @@
1
+ import { Root, Item, Link, Nest } from './NavMenu';
2
+
3
+ export default { Root, Item, Link, Nest };
@@ -0,0 +1,56 @@
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
+ }
47
+ }
48
+
49
+ @keyframes lism--slideShape {
50
+ 0% {
51
+ transform: scaleX(4);
52
+ }
53
+ 100% {
54
+ transform: scaleX(4) translateX(calc(100% - 25%));
55
+ }
56
+ }
@@ -0,0 +1,31 @@
1
+ ---
2
+ import { Lism } from 'lism-css/astro';
3
+ import getProps from '../getProps';
4
+ import '../_style.css';
5
+
6
+ const componentProps = getProps(Astro.props);
7
+ const { viewBox, isAnimation, isEmpty, ...lismProps } = componentProps || {};
8
+ ---
9
+
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
+ )
31
+ }
@@ -0,0 +1 @@
1
+ export { default } from './ShapeDivider.astro';
@@ -0,0 +1,40 @@
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 = 5, stretch, offset, flip, style = {}, ...restProps }) {
12
+ // level が 0 の場合は非表示
13
+ if (level === 0) return null;
14
+
15
+ // CSS変数をセット
16
+ const computedStyle = { ...style };
17
+ computedStyle['--level'] = level || null;
18
+ computedStyle['--_inner-offset'] = offset || null;
19
+ computedStyle['--_inner-stretch'] = stretch || null;
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';
28
+
29
+ return {
30
+ ..._props,
31
+ style: computedStyle,
32
+
33
+ // SVG用のprops
34
+ viewBox,
35
+ isEmpty,
36
+
37
+ // その他のprops
38
+ ...restProps,
39
+ };
40
+ }
@@ -0,0 +1,33 @@
1
+ import { Lism } from 'lism-css/react';
2
+ import getProps from '../getProps';
3
+ import '../_style.css';
4
+
5
+ export default function ShapeDivider({ children, ...props }) {
6
+ const componentProps = getProps(props);
7
+
8
+ // level が 0 の場合は非表示
9
+ if (!componentProps) return null;
10
+
11
+ const { viewBox, isAnimation, isEmpty, ...lismProps } = componentProps;
12
+
13
+ return (
14
+ <Lism {...lismProps}>
15
+ {isEmpty ? null : (
16
+ <div className='c--shapeDivider_inner'>
17
+ <svg
18
+ xmlns='http://www.w3.org/2000/svg'
19
+ className='c--shapeDivider_svg'
20
+ viewBox={viewBox}
21
+ width='100%'
22
+ height='100%'
23
+ fill='currentColor'
24
+ focusable='false'
25
+ preserveAspectRatio='none'
26
+ >
27
+ {children}
28
+ </svg>
29
+ </div>
30
+ )}
31
+ </Lism>
32
+ );
33
+ }
@@ -0,0 +1 @@
1
+ export { default } from './ShapeDivider';
@@ -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';
package/src/style.scss CHANGED
@@ -2,3 +2,6 @@
2
2
  @use './components/Avatar/_style.css' as avatar;
3
3
  @use './components/Badge/_style.css' as badge;
4
4
  @use './components/Button/_style.css' as button;
5
+ @use './components/Chat/_style.css' as chat;
6
+ @use './components/NavMenu/_style.css' as navmenu;
7
+ @use './components/ShapeDivider/_style.css' as shapedivider;
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) Loos, Inc.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.