@lism-css/ui 0.1.2 → 0.2.1
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.
- package/dist/components/Alert/astro/index.d.ts +1 -0
- package/dist/components/Alert/getProps.d.ts +20 -0
- package/dist/components/Alert/presets.d.ts +6 -0
- package/dist/components/Alert/react/Alert.d.ts +5 -0
- package/dist/components/Alert/react/index.d.ts +1 -0
- package/dist/components/Callout/astro/index.d.ts +1 -0
- package/dist/components/Callout/getProps.d.ts +22 -0
- package/dist/components/Callout/presets.d.ts +6 -0
- package/dist/components/Callout/react/Callout.d.ts +5 -0
- package/dist/components/Callout/react/index.d.ts +1 -0
- package/dist/components/astro.d.ts +2 -0
- package/dist/components/react.d.ts +2 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/Alert/_style.css +1 -0
- package/src/components/Alert/astro/Alert.astro +17 -0
- package/src/components/Alert/astro/index.ts +1 -0
- package/src/components/Alert/getProps.ts +37 -0
- package/src/components/Alert/presets.ts +33 -0
- package/src/components/Alert/react/Alert.tsx +16 -0
- package/src/components/Alert/react/index.ts +1 -0
- package/src/components/Button/_style.css +0 -20
- package/src/components/Callout/_style.css +1 -0
- package/src/components/Callout/astro/Callout.astro +24 -0
- package/src/components/Callout/astro/index.ts +1 -0
- package/src/components/Callout/getProps.ts +32 -0
- package/src/components/Callout/presets.ts +33 -0
- package/src/components/Callout/react/Callout.tsx +23 -0
- package/src/components/Callout/react/index.ts +1 -0
- package/src/components/astro.ts +2 -0
- package/src/components/react.ts +2 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Alert.astro';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type AlertProps = {
|
|
2
|
+
type?: string;
|
|
3
|
+
keycolor?: string;
|
|
4
|
+
layout?: string;
|
|
5
|
+
icon?: string;
|
|
6
|
+
flow?: string;
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
};
|
|
9
|
+
export default function getAlertProps({ type, keycolor, layout, icon, flow, ...props }: AlertProps): {
|
|
10
|
+
icon: string;
|
|
11
|
+
layout: string;
|
|
12
|
+
flow: string;
|
|
13
|
+
lismClass: string;
|
|
14
|
+
keycolor: string;
|
|
15
|
+
ai: string;
|
|
16
|
+
p: string;
|
|
17
|
+
g: string;
|
|
18
|
+
bd: boolean;
|
|
19
|
+
bdrs: string;
|
|
20
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Alert';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Callout.astro';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type CalloutProps = {
|
|
2
|
+
type?: string;
|
|
3
|
+
keycolor?: string;
|
|
4
|
+
icon?: string;
|
|
5
|
+
title?: string;
|
|
6
|
+
flow?: string;
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
};
|
|
9
|
+
export default function getCalloutProps({ type, keycolor, icon, title, flow, ...props }: CalloutProps): {
|
|
10
|
+
icon: string | null;
|
|
11
|
+
title: string | undefined;
|
|
12
|
+
flow: string;
|
|
13
|
+
lismClass: string;
|
|
14
|
+
keycolor: string | null;
|
|
15
|
+
p: string;
|
|
16
|
+
g: string;
|
|
17
|
+
bdc: string;
|
|
18
|
+
'bd-x-s': boolean;
|
|
19
|
+
bdw: string;
|
|
20
|
+
bxsh: string;
|
|
21
|
+
bdrs: string;
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Callout';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { default as Accordion } from './Accordion/astro';
|
|
2
|
+
export { default as Alert } from './Alert/astro';
|
|
2
3
|
export { default as Avatar } from './Avatar/astro';
|
|
3
4
|
export { default as Badge } from './Badge/astro';
|
|
4
5
|
export { default as Button } from './Button/astro';
|
|
6
|
+
export { default as Callout } from './Callout/astro';
|
|
5
7
|
export { default as Modal } from './Modal/astro';
|
|
6
8
|
export { default as Tabs } from './Tabs/astro';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { default as Accordion } from './Accordion/react';
|
|
2
|
+
export { default as Alert } from './Alert/react';
|
|
2
3
|
export { default as Avatar } from './Avatar/react';
|
|
3
4
|
export { default as Badge } from './Badge/react';
|
|
4
5
|
export { default as Button } from './Button/react';
|
|
6
|
+
export { default as Callout } from './Callout/react';
|
|
5
7
|
export { default as Modal } from './Modal/react';
|
|
6
8
|
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}}
|
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/* Alert component styles */
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { Flow, Lism, Center, Icon } from 'lism-css/astro';
|
|
3
|
+
import getAlertProps, { type AlertProps } from '../getProps';
|
|
4
|
+
|
|
5
|
+
type Props = AlertProps;
|
|
6
|
+
|
|
7
|
+
const { icon, layout, flow, ...alertProps } = getAlertProps(Astro.props);
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
<Lism layout={layout} {...alertProps}>
|
|
11
|
+
<Center isSide={layout === 'sideMain'} c='keycolor' fz='xl' fxsh='0'>
|
|
12
|
+
<Icon icon={icon} />
|
|
13
|
+
</Center>
|
|
14
|
+
<Flow flow={flow}>
|
|
15
|
+
<slot />
|
|
16
|
+
</Flow>
|
|
17
|
+
</Lism>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Alert.astro';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import PRESETS from './presets';
|
|
2
|
+
|
|
3
|
+
export type AlertProps = {
|
|
4
|
+
type?: string;
|
|
5
|
+
keycolor?: string;
|
|
6
|
+
layout?: string;
|
|
7
|
+
icon?: string;
|
|
8
|
+
flow?: string;
|
|
9
|
+
[key: string]: unknown;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default function getAlertProps({
|
|
13
|
+
type = 'alert',
|
|
14
|
+
keycolor,
|
|
15
|
+
layout = 'flex',
|
|
16
|
+
icon,
|
|
17
|
+
flow = 's',
|
|
18
|
+
...props
|
|
19
|
+
}: AlertProps) {
|
|
20
|
+
const presetData = type ? PRESETS[type] : null;
|
|
21
|
+
const _icon = icon || presetData?.icon || 'info';
|
|
22
|
+
const _color = keycolor || presetData?.color || 'currentColor';
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
icon: _icon,
|
|
26
|
+
layout,
|
|
27
|
+
flow,
|
|
28
|
+
lismClass: 'c--alert u-cbox',
|
|
29
|
+
keycolor: _color,
|
|
30
|
+
ai: 'center',
|
|
31
|
+
p: '15',
|
|
32
|
+
g: '15',
|
|
33
|
+
bd: true,
|
|
34
|
+
bdrs: '10',
|
|
35
|
+
...props,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
type PresetData = {
|
|
2
|
+
icon: string;
|
|
3
|
+
color: string;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
const PRESETS: Record<string, PresetData> = {
|
|
7
|
+
alert: {
|
|
8
|
+
icon: 'alert',
|
|
9
|
+
color: 'red',
|
|
10
|
+
},
|
|
11
|
+
point: {
|
|
12
|
+
icon: 'lightbulb',
|
|
13
|
+
color: 'orange',
|
|
14
|
+
},
|
|
15
|
+
warning: {
|
|
16
|
+
icon: 'warning',
|
|
17
|
+
color: 'yellow',
|
|
18
|
+
},
|
|
19
|
+
check: {
|
|
20
|
+
icon: 'check-circle',
|
|
21
|
+
color: 'green',
|
|
22
|
+
},
|
|
23
|
+
help: {
|
|
24
|
+
icon: 'question',
|
|
25
|
+
color: 'purple',
|
|
26
|
+
},
|
|
27
|
+
info: {
|
|
28
|
+
icon: 'info',
|
|
29
|
+
color: 'blue',
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export default PRESETS;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { Flow, Lism, Center, Icon } from 'lism-css/react';
|
|
3
|
+
import getAlertProps, { type AlertProps } from '../getProps';
|
|
4
|
+
|
|
5
|
+
export default function Alert({ children, ...inputProps }: AlertProps & { children?: ReactNode }) {
|
|
6
|
+
const { icon, layout, flow, ...alertProps } = getAlertProps(inputProps);
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<Lism layout={layout} {...alertProps}>
|
|
10
|
+
<Center isSide={layout === 'sideMain'} c='keycolor' fz='xl' fxsh='0'>
|
|
11
|
+
<Icon icon={icon} />
|
|
12
|
+
</Center>
|
|
13
|
+
<Flow flow={flow}>{children}</Flow>
|
|
14
|
+
</Lism>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Alert';
|
|
@@ -32,23 +32,3 @@
|
|
|
32
32
|
grid-column: 2;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
/* --------------------
|
|
37
|
-
reverse
|
|
38
|
-
-------------------- */
|
|
39
|
-
.-hov\:reverse {
|
|
40
|
-
--hov-c: var(--bgc);
|
|
41
|
-
--hov-bgc: var(--c);
|
|
42
|
-
}
|
|
43
|
-
.-hov\:reverse:where(.c--button--fill) {
|
|
44
|
-
--hov-bgc: transparent;
|
|
45
|
-
}
|
|
46
|
-
.-hov\:reverse:where(.c--button--outline) {
|
|
47
|
-
--hov-c: var(--base);
|
|
48
|
-
}
|
|
49
|
-
@media (any-hover: hover) {
|
|
50
|
-
.-hov\:reverse:hover {
|
|
51
|
-
background-color: var(--hov-bgc) !important;
|
|
52
|
-
color: var(--hov-c) !important;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/* Callout component styles */
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { Flow, Flex, Stack, Icon, Center } from 'lism-css/astro';
|
|
3
|
+
import getCalloutProps, { type CalloutProps } from '../getProps';
|
|
4
|
+
|
|
5
|
+
type Props = CalloutProps;
|
|
6
|
+
|
|
7
|
+
const { icon, title, flow, ...calloutProps } = getCalloutProps(Astro.props);
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
<Stack {...calloutProps}>
|
|
11
|
+
{
|
|
12
|
+
title && (
|
|
13
|
+
<Flex class='c--callout_head' c='keycolor' fw='bold' ai='center' g='10'>
|
|
14
|
+
<Center class='c--callout_icon' fz='xl'>
|
|
15
|
+
<Icon icon={icon} />
|
|
16
|
+
</Center>
|
|
17
|
+
<span class='c--callout_title'>{title}</span>
|
|
18
|
+
</Flex>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
<Flow class='c--callout_body' flow={flow}>
|
|
22
|
+
<slot />
|
|
23
|
+
</Flow>
|
|
24
|
+
</Stack>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Callout.astro';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import PRESETS from './presets';
|
|
2
|
+
|
|
3
|
+
export type CalloutProps = {
|
|
4
|
+
type?: string;
|
|
5
|
+
keycolor?: string;
|
|
6
|
+
icon?: string;
|
|
7
|
+
title?: string;
|
|
8
|
+
flow?: string;
|
|
9
|
+
[key: string]: unknown;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default function getCalloutProps({ type = 'note', keycolor, icon, title, flow = 's', ...props }: CalloutProps) {
|
|
13
|
+
const presetData = type ? PRESETS[type] : null;
|
|
14
|
+
const _icon = icon || presetData?.icon || null;
|
|
15
|
+
const _keycolor = keycolor || presetData?.color || null;
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
icon: _icon,
|
|
19
|
+
title,
|
|
20
|
+
flow,
|
|
21
|
+
lismClass: 'c--callout u-cbox',
|
|
22
|
+
keycolor: _keycolor,
|
|
23
|
+
p: '20',
|
|
24
|
+
g: '10',
|
|
25
|
+
bdc: 'keycolor',
|
|
26
|
+
'bd-x-s': true,
|
|
27
|
+
bdw: '4px',
|
|
28
|
+
bxsh: '10',
|
|
29
|
+
bdrs: '5',
|
|
30
|
+
...props,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
type PresetData = {
|
|
2
|
+
icon: string;
|
|
3
|
+
color: string;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
const PRESETS: Record<string, PresetData> = {
|
|
7
|
+
alert: {
|
|
8
|
+
icon: 'alert',
|
|
9
|
+
color: 'red',
|
|
10
|
+
},
|
|
11
|
+
point: {
|
|
12
|
+
icon: 'lightbulb',
|
|
13
|
+
color: 'orange',
|
|
14
|
+
},
|
|
15
|
+
warning: {
|
|
16
|
+
icon: 'warning',
|
|
17
|
+
color: 'yellow',
|
|
18
|
+
},
|
|
19
|
+
check: {
|
|
20
|
+
icon: 'check-circle',
|
|
21
|
+
color: 'green',
|
|
22
|
+
},
|
|
23
|
+
help: {
|
|
24
|
+
icon: 'question',
|
|
25
|
+
color: 'purple',
|
|
26
|
+
},
|
|
27
|
+
note: {
|
|
28
|
+
icon: 'note',
|
|
29
|
+
color: 'blue',
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export default PRESETS;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { Flow, Flex, Stack, Icon, Center } from 'lism-css/react';
|
|
3
|
+
import getCalloutProps, { type CalloutProps } from '../getProps';
|
|
4
|
+
|
|
5
|
+
export default function Callout({ children, ...inputProps }: CalloutProps & { children?: ReactNode }) {
|
|
6
|
+
const { icon, title, flow, ...calloutProps } = getCalloutProps(inputProps);
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<Stack {...calloutProps}>
|
|
10
|
+
{title && (
|
|
11
|
+
<Flex className='c--callout_head' c='keycolor' fw='bold' ai='center' g='10'>
|
|
12
|
+
<Center className='c--callout_icon' fz='xl'>
|
|
13
|
+
<Icon icon={icon} />
|
|
14
|
+
</Center>
|
|
15
|
+
<span className='c--callout_title'>{title}</span>
|
|
16
|
+
</Flex>
|
|
17
|
+
)}
|
|
18
|
+
<Flow className='c--callout_body' flow={flow}>
|
|
19
|
+
{children}
|
|
20
|
+
</Flow>
|
|
21
|
+
</Stack>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Callout';
|
package/src/components/astro.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { default as Accordion } from './Accordion/astro';
|
|
2
|
+
export { default as Alert } from './Alert/astro';
|
|
2
3
|
export { default as Avatar } from './Avatar/astro';
|
|
3
4
|
export { default as Badge } from './Badge/astro';
|
|
4
5
|
export { default as Button } from './Button/astro';
|
|
6
|
+
export { default as Callout } from './Callout/astro';
|
|
5
7
|
export { default as Modal } from './Modal/astro';
|
|
6
8
|
export { default as Tabs } from './Tabs/astro';
|
package/src/components/react.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { default as Accordion } from './Accordion/react';
|
|
2
|
+
export { default as Alert } from './Alert/react';
|
|
2
3
|
export { default as Avatar } from './Avatar/react';
|
|
3
4
|
export { default as Badge } from './Badge/react';
|
|
4
5
|
export { default as Button } from './Button/react';
|
|
6
|
+
export { default as Callout } from './Callout/react';
|
|
5
7
|
export { default as Modal } from './Modal/react';
|
|
6
8
|
export { default as Tabs } from './Tabs/react';
|