@balikjs/mobile 0.0.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/README.md +33 -0
- package/dist/mobile.js +3062 -0
- package/dist/styles.css +1 -0
- package/package.json +49 -0
- package/src/Alert/Alert.jsx +67 -0
- package/src/Alert/Alert.module.css +87 -0
- package/src/Alert/index.js +1 -0
- package/src/Avatar/Avatar.jsx +77 -0
- package/src/Avatar/Avatar.module.css +74 -0
- package/src/Avatar/index.js +1 -0
- package/src/Badge/Badge.jsx +83 -0
- package/src/Badge/Badge.module.css +141 -0
- package/src/Badge/index.js +1 -0
- package/src/BottomNavigation/BottomNavigation.jsx +61 -0
- package/src/BottomNavigation/BottomNavigation.module.css +53 -0
- package/src/BottomNavigation/index.js +1 -0
- package/src/BottomSheet/BottomSheet.jsx +51 -0
- package/src/BottomSheet/BottomSheet.module.css +56 -0
- package/src/BottomSheet/index.js +1 -0
- package/src/Button/Button.jsx +77 -0
- package/src/Button/Button.module.css +124 -0
- package/src/Button/index.js +1 -0
- package/src/Card/Card.jsx +31 -0
- package/src/Card/Card.module.css +4 -0
- package/src/Card/index.js +1 -0
- package/src/Checkbox/Checkbox.jsx +64 -0
- package/src/Checkbox/Checkbox.module.css +146 -0
- package/src/Checkbox/index.js +1 -0
- package/src/Clipboard/Clipboard.jsx +82 -0
- package/src/Clipboard/Clipboard.module.css +126 -0
- package/src/Clipboard/index.js +1 -0
- package/src/CloseButton/CloseButton.jsx +51 -0
- package/src/CloseButton/CloseButton.module.css +94 -0
- package/src/Confirm/Confirm.jsx +52 -0
- package/src/Confirm/Confirm.module.css +5 -0
- package/src/Confirm/index.js +1 -0
- package/src/Dialog/Dialog.jsx +63 -0
- package/src/Dialog/Dialog.module.css +111 -0
- package/src/Dialog/index.js +1 -0
- package/src/Divider/Divider.jsx +38 -0
- package/src/Divider/Divider.module.css +16 -0
- package/src/Divider/index.js +1 -0
- package/src/Drawer/Drawer.jsx +55 -0
- package/src/Drawer/Drawer.module.css +68 -0
- package/src/Drawer/index.js +1 -0
- package/src/Empty/Empty.jsx +35 -0
- package/src/Empty/Empty.module.css +17 -0
- package/src/Empty/index.js +1 -0
- package/src/Fab/Fab.jsx +91 -0
- package/src/Fab/Fab.module.css +94 -0
- package/src/Fab/index.js +1 -0
- package/src/Input/Input.jsx +53 -0
- package/src/Input/Input.module.css +97 -0
- package/src/Input/index.js +1 -0
- package/src/Link/Link.jsx +31 -0
- package/src/Link/Link.module.css +18 -0
- package/src/Link/index.js +1 -0
- package/src/Popover/Popover.jsx +162 -0
- package/src/Popover/Popover.module.css +63 -0
- package/src/Popover/index.js +1 -0
- package/src/RadioGroup/Radio.jsx +52 -0
- package/src/RadioGroup/Radio.module.css +133 -0
- package/src/RadioGroup/RadioGroup.jsx +36 -0
- package/src/RadioGroup/RadioGroup.module.css +23 -0
- package/src/RadioGroup/index.js +2 -0
- package/src/SearchInput/SearchInput.jsx +89 -0
- package/src/SearchInput/SearchInput.module.css +169 -0
- package/src/SearchInput/index.js +1 -0
- package/src/Select/Select.jsx +101 -0
- package/src/Select/Select.module.css +174 -0
- package/src/Select/index.js +1 -0
- package/src/SelectPc/Select.jsx +88 -0
- package/src/SelectPc/SelectPc.module.css +132 -0
- package/src/SelectPc/index.js +1 -0
- package/src/Skeleton/Skeleton.jsx +55 -0
- package/src/Skeleton/Skeleton.module.css +33 -0
- package/src/Skeleton/index.js +1 -0
- package/src/Slider/Slider.jsx +50 -0
- package/src/Slider/Slider.module.css +77 -0
- package/src/Slider/index.js +1 -0
- package/src/Spinner/Spinner.jsx +45 -0
- package/src/Spinner/Spinner.module.css +35 -0
- package/src/Spinner/index.js +1 -0
- package/src/Switch/Switch.jsx +51 -0
- package/src/Switch/Switch.module.css +156 -0
- package/src/Switch/index.js +1 -0
- package/src/Tabs/Tabs.jsx +75 -0
- package/src/Tabs/Tabs.module.css +45 -0
- package/src/Tabs/index.js +1 -0
- package/src/Tag/Tag.jsx +74 -0
- package/src/Tag/Tag.module.css +128 -0
- package/src/Tag/index.js +1 -0
- package/src/Textarea/Textarea.jsx +52 -0
- package/src/Textarea/Textarea.module.css +89 -0
- package/src/Textarea/index.js +1 -0
- package/src/Toast/Toast.jsx +169 -0
- package/src/Toast/Toast.module.css +152 -0
- package/src/Toast/index.js +1 -0
- package/src/Tooltip/Tooltip.jsx +42 -0
- package/src/Tooltip/Tooltip.module.css +41 -0
- package/src/Tooltip/index.js +1 -0
- package/src/index.js +34 -0
- package/src/styles/index.css +90 -0
- package/src/styles/tokens.css +227 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
.base {
|
|
2
|
+
--_badge-bg: transparent;
|
|
3
|
+
--_badge-fg: transparent;
|
|
4
|
+
--_badge-border: transparent;
|
|
5
|
+
|
|
6
|
+
display: inline-flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
gap: 4px;
|
|
10
|
+
border: 1px solid var(--_badge-border);
|
|
11
|
+
border-radius: var(--b-radius-round);
|
|
12
|
+
background-color: var(--_badge-bg);
|
|
13
|
+
color: var(--_badge-fg);
|
|
14
|
+
font-family: inherit;
|
|
15
|
+
font-weight: 500;
|
|
16
|
+
line-height: 1;
|
|
17
|
+
white-space: nowrap;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/* ── Size ── */
|
|
21
|
+
|
|
22
|
+
.sizeXs {
|
|
23
|
+
height: var(--b-comp-secondary-height-xs);
|
|
24
|
+
min-width: calc(2 * var(--b-comp-secondary-height-xs));
|
|
25
|
+
padding: 0 6px;
|
|
26
|
+
font-size: 10px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.sizeSm {
|
|
30
|
+
height: var(--b-comp-secondary-height-sm);
|
|
31
|
+
min-width: calc(2 * var(--b-comp-secondary-height-sm));
|
|
32
|
+
padding: 0 7px;
|
|
33
|
+
font-size: 10px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.sizeMd {
|
|
37
|
+
height: var(--b-comp-secondary-height-md);
|
|
38
|
+
min-width: calc(2 * var(--b-comp-secondary-height-md));
|
|
39
|
+
padding: 0 8px;
|
|
40
|
+
font-size: 11px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.sizeLg {
|
|
44
|
+
height: var(--b-comp-secondary-height-lg);
|
|
45
|
+
min-width: calc(2 * var(--b-comp-secondary-height-lg));
|
|
46
|
+
padding: 0 9px;
|
|
47
|
+
font-size: 12px;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.sizeXl {
|
|
51
|
+
height: var(--b-comp-secondary-height-xl);
|
|
52
|
+
min-width: calc(2 * var(--b-comp-secondary-height-xl));
|
|
53
|
+
padding: 0 10px;
|
|
54
|
+
font-size: 13px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.size2xl {
|
|
58
|
+
height: var(--b-comp-secondary-height-2xl);
|
|
59
|
+
min-width: calc(2 * var(--b-comp-secondary-height-2xl));
|
|
60
|
+
padding: 0 14px;
|
|
61
|
+
font-size: 16px;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* ── Intent: solid ── */
|
|
65
|
+
|
|
66
|
+
.solidDefault {
|
|
67
|
+
--_badge-bg: color-mix(in oklch, var(--base-fg) 10%, var(--base-bg));
|
|
68
|
+
--_badge-fg: var(--base-fg);
|
|
69
|
+
--_badge-border: color-mix(in oklch, var(--base-fg) 10%, var(--base-bg));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.solidDanger {
|
|
73
|
+
--_badge-bg: color-mix(in oklch, var(--color-danger) 12%, var(--base-bg));
|
|
74
|
+
--_badge-fg: var(--color-danger);
|
|
75
|
+
--_badge-border: color-mix(in oklch, var(--color-danger) 12%, var(--base-bg));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.solidSuccess {
|
|
79
|
+
--_badge-bg: color-mix(in oklch, var(--color-success) 12%, var(--base-bg));
|
|
80
|
+
--_badge-fg: var(--color-success);
|
|
81
|
+
--_badge-border: color-mix(in oklch, var(--color-success) 12%, var(--base-bg));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.solidWarning {
|
|
85
|
+
--_badge-bg: color-mix(in oklch, var(--color-warning) 12%, var(--base-bg));
|
|
86
|
+
--_badge-fg: var(--color-warning);
|
|
87
|
+
--_badge-border: color-mix(in oklch, var(--color-warning) 12%, var(--base-bg));
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.solidInfo {
|
|
91
|
+
--_badge-bg: color-mix(in oklch, var(--color-info) 12%, var(--base-bg));
|
|
92
|
+
--_badge-fg: var(--color-info);
|
|
93
|
+
--_badge-border: color-mix(in oklch, var(--color-info) 12%, var(--base-bg));
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.solidIntent {
|
|
97
|
+
--_badge-bg: color-mix(in oklch, var(--base-edge) 12%, var(--base-bg));
|
|
98
|
+
--_badge-fg: var(--base-edge);
|
|
99
|
+
--_badge-border: color-mix(in oklch, var(--base-edge) 12%, var(--base-bg));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/* ── Intent: outline ── */
|
|
103
|
+
|
|
104
|
+
.outlineDefault {
|
|
105
|
+
--_badge-fg: color-mix(in oklch, var(--base-fg) 60%, transparent);
|
|
106
|
+
--_badge-border: color-mix(in oklch, var(--base-fg) 16%, var(--base-bg));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.outlineDanger {
|
|
110
|
+
--_badge-fg: var(--color-danger);
|
|
111
|
+
--_badge-border: color-mix(in oklch, var(--color-danger) 25%, var(--base-bg));
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.outlineSuccess {
|
|
115
|
+
--_badge-fg: var(--color-success);
|
|
116
|
+
--_badge-border: color-mix(in oklch, var(--color-success) 25%, var(--base-bg));
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.outlineWarning {
|
|
120
|
+
--_badge-fg: var(--color-warning);
|
|
121
|
+
--_badge-border: color-mix(in oklch, var(--color-warning) 25%, var(--base-bg));
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.outlineInfo {
|
|
125
|
+
--_badge-fg: var(--color-info);
|
|
126
|
+
--_badge-border: color-mix(in oklch, var(--color-info) 25%, var(--base-bg));
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.outlineIntent {
|
|
130
|
+
--_badge-fg: var(--base-edge);
|
|
131
|
+
--_badge-border: color-mix(in oklch, var(--base-edge) 25%, var(--base-bg));
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* ── Dot ── */
|
|
135
|
+
|
|
136
|
+
.dot {
|
|
137
|
+
width: 6px;
|
|
138
|
+
height: 6px;
|
|
139
|
+
border-radius: 50%;
|
|
140
|
+
background-color: currentColor;
|
|
141
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Badge } from './Badge.jsx'
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { splitProps, mergeProps } from 'solid-js'
|
|
2
|
+
import { Dynamic } from 'solid-js/web'
|
|
3
|
+
import styles from './BottomNavigation.module.css'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @param {{
|
|
7
|
+
* icon: import('solid-js').JSX.Element
|
|
8
|
+
* label: string
|
|
9
|
+
* active?: boolean
|
|
10
|
+
* href?: string
|
|
11
|
+
* onClick?: (e: MouseEvent) => void
|
|
12
|
+
* }} props
|
|
13
|
+
*/
|
|
14
|
+
export function BottomNavigationItem(props) {
|
|
15
|
+
const [local] = splitProps(props, ['icon', 'label', 'active', 'href', 'onClick'])
|
|
16
|
+
|
|
17
|
+
const tag = local.href ? 'a' : 'button'
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<Dynamic
|
|
21
|
+
component={tag}
|
|
22
|
+
{...(local.href ? { href: local.href } : { type: 'button' })}
|
|
23
|
+
class={styles.item}
|
|
24
|
+
data-active={local.active ? '' : undefined}
|
|
25
|
+
onClick={local.onClick}
|
|
26
|
+
>
|
|
27
|
+
<span class={styles.icon}>{local.icon}</span>
|
|
28
|
+
<span class={styles.label}>{local.label}</span>
|
|
29
|
+
</Dynamic>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const DEFAULT_PROPS = {}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @param {import('solid-js').JSX.HTMLAttributes<HTMLElement> & {
|
|
37
|
+
* class?: string
|
|
38
|
+
* }} props
|
|
39
|
+
*/
|
|
40
|
+
export function BottomNavigation(props) {
|
|
41
|
+
const [local] = splitProps(
|
|
42
|
+
mergeProps(DEFAULT_PROPS, props),
|
|
43
|
+
['class', 'children'],
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<nav
|
|
48
|
+
class={[
|
|
49
|
+
'balik-bottom-navigation',
|
|
50
|
+
styles.root,
|
|
51
|
+
local.class,
|
|
52
|
+
]
|
|
53
|
+
.filter(Boolean)
|
|
54
|
+
.join(' ')}
|
|
55
|
+
>
|
|
56
|
+
{local.children}
|
|
57
|
+
</nav>
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
BottomNavigation.Item = BottomNavigationItem
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
position: fixed;
|
|
3
|
+
inset-inline: 0;
|
|
4
|
+
bottom: 0;
|
|
5
|
+
display: flex;
|
|
6
|
+
justify-content: space-around;
|
|
7
|
+
align-items: center;
|
|
8
|
+
height: 56px;
|
|
9
|
+
padding-bottom: env(safe-area-inset-bottom);
|
|
10
|
+
background-color: var(--base-bg);
|
|
11
|
+
border-top: 1px solid color-mix(in oklch, var(--base-fg) 8%, var(--base-bg));
|
|
12
|
+
z-index: var(--b-z-index-base);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.item {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
align-items: center;
|
|
19
|
+
gap: 2px;
|
|
20
|
+
padding: 4px 12px;
|
|
21
|
+
border: none;
|
|
22
|
+
background: none;
|
|
23
|
+
font-family: inherit;
|
|
24
|
+
color: color-mix(in oklch, var(--base-fg) 45%, var(--base-bg));
|
|
25
|
+
text-decoration: none;
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
user-select: none;
|
|
28
|
+
touch-action: manipulation;
|
|
29
|
+
transition: color var(--b-transition-fast);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.item[data-active] {
|
|
33
|
+
color: var(--base-edge);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.icon {
|
|
37
|
+
display: flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
justify-content: center;
|
|
40
|
+
width: 24px;
|
|
41
|
+
height: 24px;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.icon svg {
|
|
45
|
+
width: 100%;
|
|
46
|
+
height: 100%;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.label {
|
|
50
|
+
font-size: 11px;
|
|
51
|
+
line-height: 14px;
|
|
52
|
+
font-weight: 500;
|
|
53
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BottomNavigation } from './BottomNavigation.jsx'
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { splitProps, mergeProps } from 'solid-js'
|
|
2
|
+
import { Portal } from 'solid-js/web'
|
|
3
|
+
import styles from './BottomSheet.module.css'
|
|
4
|
+
|
|
5
|
+
const DEFAULT_PROPS = {}
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @param {{
|
|
9
|
+
* open: boolean
|
|
10
|
+
* onOpenChange?: (open: boolean) => void
|
|
11
|
+
* title?: string
|
|
12
|
+
* class?: string
|
|
13
|
+
* children?: import('solid-js').JSX.Element
|
|
14
|
+
* }} props
|
|
15
|
+
*/
|
|
16
|
+
export function BottomSheet(props) {
|
|
17
|
+
const [local] = splitProps(
|
|
18
|
+
mergeProps(DEFAULT_PROPS, props),
|
|
19
|
+
['open', 'onOpenChange', 'title', 'class', 'children'],
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<Portal mount={document.body}>
|
|
24
|
+
<div
|
|
25
|
+
class={styles.backdrop}
|
|
26
|
+
data-open={local.open ? '' : undefined}
|
|
27
|
+
onClick={() => local.onOpenChange?.(false)}
|
|
28
|
+
/>
|
|
29
|
+
<div
|
|
30
|
+
class={[
|
|
31
|
+
'balik-bottom-sheet',
|
|
32
|
+
styles.sheet,
|
|
33
|
+
local.class,
|
|
34
|
+
]
|
|
35
|
+
.filter(Boolean)
|
|
36
|
+
.join(' ')}
|
|
37
|
+
data-open={local.open ? '' : undefined}
|
|
38
|
+
role="dialog"
|
|
39
|
+
aria-modal="true"
|
|
40
|
+
aria-label={local.title || 'BottomSheet'}
|
|
41
|
+
>
|
|
42
|
+
{local.title && (
|
|
43
|
+
<div class={styles.header}>
|
|
44
|
+
<h2 class={styles.title}>{local.title}</h2>
|
|
45
|
+
</div>
|
|
46
|
+
)}
|
|
47
|
+
<div class={styles.body}>{local.children}</div>
|
|
48
|
+
</div>
|
|
49
|
+
</Portal>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
.backdrop {
|
|
2
|
+
position: fixed;
|
|
3
|
+
inset: 0;
|
|
4
|
+
z-index: var(--b-z-index-modal);
|
|
5
|
+
background-color: rgba(0, 0, 0, 0.35);
|
|
6
|
+
opacity: 0;
|
|
7
|
+
pointer-events: none;
|
|
8
|
+
transition: opacity 0.3s ease;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.backdrop[data-open] {
|
|
12
|
+
opacity: 1;
|
|
13
|
+
pointer-events: auto;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.sheet {
|
|
17
|
+
position: fixed;
|
|
18
|
+
inset-inline: 0;
|
|
19
|
+
bottom: 0;
|
|
20
|
+
z-index: var(--b-z-index-modal);
|
|
21
|
+
background-color: var(--base-bg);
|
|
22
|
+
border-radius: 16px 16px 0 0;
|
|
23
|
+
max-height: 70vh;
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
transform: translateY(100%);
|
|
27
|
+
pointer-events: none;
|
|
28
|
+
transition: transform 0.3s ease;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.sheet[data-open] {
|
|
32
|
+
transform: translateY(0);
|
|
33
|
+
pointer-events: auto;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.header {
|
|
37
|
+
display: flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
padding: 16px;
|
|
40
|
+
border-bottom: 1px solid color-mix(in oklch, var(--base-fg) 6%, var(--base-bg));
|
|
41
|
+
flex-shrink: 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.title {
|
|
45
|
+
margin: 0;
|
|
46
|
+
font-size: var(--b-comp-font-size-lg);
|
|
47
|
+
font-weight: 600;
|
|
48
|
+
color: var(--base-fg);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.body {
|
|
52
|
+
overflow-y: auto;
|
|
53
|
+
padding: 16px;
|
|
54
|
+
flex: 1;
|
|
55
|
+
-webkit-overflow-scrolling: touch;
|
|
56
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BottomSheet } from './BottomSheet.jsx'
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { splitProps, mergeProps } from 'solid-js'
|
|
2
|
+
import { ark } from '@ark-ui/solid/factory'
|
|
3
|
+
import { Loader2 } from 'lucide-solid'
|
|
4
|
+
import styles from './Button.module.css'
|
|
5
|
+
|
|
6
|
+
const roles = {
|
|
7
|
+
outline: styles.outline,
|
|
8
|
+
primary: styles.primary,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const intents = {
|
|
12
|
+
default: styles.intentDefault,
|
|
13
|
+
danger: styles.intentDanger,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const sizes = {
|
|
17
|
+
xs: styles.sizeXs,
|
|
18
|
+
sm: styles.sizeSm,
|
|
19
|
+
md: styles.sizeMd,
|
|
20
|
+
lg: styles.sizeLg,
|
|
21
|
+
xl: styles.sizeXl,
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const DEFAULT_PROPS = {
|
|
25
|
+
solid: false,
|
|
26
|
+
danger: false,
|
|
27
|
+
size: 'md',
|
|
28
|
+
disabled: false,
|
|
29
|
+
loading: false,
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @param {import('solid-js').JSX.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
34
|
+
* solid?: boolean
|
|
35
|
+
* danger?: boolean
|
|
36
|
+
* size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'
|
|
37
|
+
* loading?: boolean
|
|
38
|
+
* }} props
|
|
39
|
+
*/
|
|
40
|
+
export function Button(props) {
|
|
41
|
+
const [local, rest] = splitProps(
|
|
42
|
+
mergeProps(DEFAULT_PROPS, props),
|
|
43
|
+
['solid', 'danger', 'size', 'class', 'loading', 'disabled', 'children'],
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
const roleKey = local.solid ? 'primary' : 'outline'
|
|
47
|
+
const intentKey = local.danger ? 'danger' : 'default'
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<ark.button
|
|
51
|
+
{...rest}
|
|
52
|
+
disabled={local.disabled}
|
|
53
|
+
aria-disabled={local.loading || local.disabled}
|
|
54
|
+
class={[
|
|
55
|
+
'balik-button',
|
|
56
|
+
`balik-button--${roleKey}`,
|
|
57
|
+
`balik-button--${intentKey}`,
|
|
58
|
+
`balik-button--${local.size}`,
|
|
59
|
+
styles.base,
|
|
60
|
+
roles[roleKey],
|
|
61
|
+
intents[intentKey],
|
|
62
|
+
sizes[local.size],
|
|
63
|
+
local.loading && styles.loadingButton,
|
|
64
|
+
local.class,
|
|
65
|
+
]
|
|
66
|
+
.filter(Boolean)
|
|
67
|
+
.join(' ')}
|
|
68
|
+
>
|
|
69
|
+
{local.children}
|
|
70
|
+
{local.loading && (
|
|
71
|
+
<span class={styles.loadingOverlay}>
|
|
72
|
+
<Loader2 class={styles.spinner} aria-hidden="true" />
|
|
73
|
+
</span>
|
|
74
|
+
)}
|
|
75
|
+
</ark.button>
|
|
76
|
+
)
|
|
77
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
.base {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: inline-flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
border: 1px solid transparent;
|
|
7
|
+
cursor: pointer;
|
|
8
|
+
font-family: inherit;
|
|
9
|
+
white-space: nowrap;
|
|
10
|
+
user-select: none;
|
|
11
|
+
touch-action: manipulation;
|
|
12
|
+
transition: background-color var(--b-transition-fast),
|
|
13
|
+
border-color var(--b-transition-fast),
|
|
14
|
+
opacity var(--b-transition-fast);
|
|
15
|
+
|
|
16
|
+
--_current-intent: var(--base-edge);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.base:disabled {
|
|
20
|
+
background-color: var(--color-disabled-bg);
|
|
21
|
+
border-color: var(--color-disabled-border);
|
|
22
|
+
color: var(--color-disabled-fg);
|
|
23
|
+
cursor: not-allowed;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.loadingOverlay {
|
|
27
|
+
position: absolute;
|
|
28
|
+
inset: -1px;
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
justify-content: center;
|
|
32
|
+
background-color: color-mix(in oklch, var(--base-bg) 50%, transparent);
|
|
33
|
+
border-radius: inherit;
|
|
34
|
+
pointer-events: none;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.loadingButton {
|
|
38
|
+
pointer-events: none;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.outline {
|
|
42
|
+
background-color: var(--base-bg);
|
|
43
|
+
border-color: var(--_current-intent);
|
|
44
|
+
color: var(--base-fg);
|
|
45
|
+
--_spinner-color: var(--_current-intent);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.outline:active:not(:disabled) {
|
|
49
|
+
background-color: oklch(from var(--_current-intent) 0.96 0.03 h);
|
|
50
|
+
border-color: oklch(from var(--_current-intent) calc(l - 0.08) c h);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.primary {
|
|
54
|
+
background-color: var(--_current-intent);
|
|
55
|
+
border-color: var(--_current-intent);
|
|
56
|
+
color: var(--base-bg);
|
|
57
|
+
--_spinner-color: var(--_current-intent);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.primary:active:not(:disabled) {
|
|
61
|
+
background-color: oklch(from var(--_current-intent) calc(l + 0.08) calc(c - 0.02) h);
|
|
62
|
+
border-color: oklch(from var(--_current-intent) calc(l + 0.08) calc(c - 0.02) h);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.intentDefault {
|
|
66
|
+
--_current-intent: var(--base-edge);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.intentDanger {
|
|
70
|
+
--_current-intent: var(--color-danger);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.sizeXs {
|
|
74
|
+
height: var(--b-comp-height-xs);
|
|
75
|
+
line-height: var(--b-comp-line-height-xs);
|
|
76
|
+
padding: var(--b-comp-padding-y-xs) var(--b-comp-padding-x-xs);
|
|
77
|
+
font-size: var(--b-comp-font-size-xs);
|
|
78
|
+
border-radius: var(--b-radius-l1-xs);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.sizeSm {
|
|
82
|
+
height: var(--b-comp-height-sm);
|
|
83
|
+
line-height: var(--b-comp-line-height-sm);
|
|
84
|
+
padding: var(--b-comp-padding-y-sm) var(--b-comp-padding-x-sm);
|
|
85
|
+
font-size: var(--b-comp-font-size-sm);
|
|
86
|
+
border-radius: var(--b-radius-l1-sm);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.sizeMd {
|
|
90
|
+
height: var(--b-comp-height-md);
|
|
91
|
+
line-height: var(--b-comp-line-height-md);
|
|
92
|
+
padding: var(--b-comp-padding-y-md) var(--b-comp-padding-x-md);
|
|
93
|
+
font-size: var(--b-comp-font-size-md);
|
|
94
|
+
border-radius: var(--b-radius-l1-md);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.sizeLg {
|
|
98
|
+
height: var(--b-comp-height-lg);
|
|
99
|
+
line-height: var(--b-comp-line-height-lg);
|
|
100
|
+
padding: var(--b-comp-padding-y-lg) var(--b-comp-padding-x-lg);
|
|
101
|
+
font-size: var(--b-comp-font-size-lg);
|
|
102
|
+
border-radius: var(--b-radius-l1-lg);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.sizeXl {
|
|
106
|
+
height: var(--b-comp-height-xl);
|
|
107
|
+
line-height: var(--b-comp-line-height-xl);
|
|
108
|
+
padding: var(--b-comp-padding-y-xl) var(--b-comp-padding-x-xl);
|
|
109
|
+
font-size: var(--b-comp-font-size-xl);
|
|
110
|
+
border-radius: var(--b-radius-l1-xl);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.spinner {
|
|
114
|
+
width: 1em;
|
|
115
|
+
height: 1em;
|
|
116
|
+
color: var(--_spinner-color);
|
|
117
|
+
animation: balik-button-spin 0.6s linear infinite;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
@keyframes balik-button-spin {
|
|
121
|
+
to {
|
|
122
|
+
transform: rotate(360deg);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Button } from './Button.jsx'
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { splitProps, mergeProps } from 'solid-js'
|
|
2
|
+
import styles from './Card.module.css'
|
|
3
|
+
|
|
4
|
+
const DEFAULT_PROPS = {}
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @param {import('solid-js').JSX.HTMLAttributes<HTMLDivElement> & {
|
|
8
|
+
* class?: string
|
|
9
|
+
* }} props
|
|
10
|
+
*/
|
|
11
|
+
export function Card(props) {
|
|
12
|
+
const [local, rest] = splitProps(
|
|
13
|
+
mergeProps(DEFAULT_PROPS, props),
|
|
14
|
+
['class', 'children'],
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<div
|
|
19
|
+
{...rest}
|
|
20
|
+
class={[
|
|
21
|
+
'balik-card',
|
|
22
|
+
styles.base,
|
|
23
|
+
local.class,
|
|
24
|
+
]
|
|
25
|
+
.filter(Boolean)
|
|
26
|
+
.join(' ')}
|
|
27
|
+
>
|
|
28
|
+
{local.children}
|
|
29
|
+
</div>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Card } from './Card.jsx'
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { splitProps, mergeProps } from 'solid-js'
|
|
2
|
+
import { Checkbox as ArkCheckbox, useCheckboxContext } from '@ark-ui/solid'
|
|
3
|
+
import { Minus, Check } from 'lucide-solid'
|
|
4
|
+
import styles from './Checkbox.module.css'
|
|
5
|
+
|
|
6
|
+
const sizes = {
|
|
7
|
+
xs: styles.sizeXs,
|
|
8
|
+
sm: styles.sizeSm,
|
|
9
|
+
md: styles.sizeMd,
|
|
10
|
+
lg: styles.sizeLg,
|
|
11
|
+
xl: styles.sizeXl,
|
|
12
|
+
'2xl': styles.size2xl,
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function IndicatorIcon() {
|
|
16
|
+
const api = useCheckboxContext()
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<>
|
|
20
|
+
{api().checked === 'indeterminate'
|
|
21
|
+
? <Minus size="100%" aria-hidden="true" />
|
|
22
|
+
: <Check size="100%" aria-hidden="true" />}
|
|
23
|
+
</>
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @param {import('@ark-ui/solid').CheckboxRootProps & {
|
|
29
|
+
* size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'
|
|
30
|
+
* class?: string
|
|
31
|
+
* }} props
|
|
32
|
+
*/
|
|
33
|
+
export function Checkbox(props) {
|
|
34
|
+
const [local, rest] = splitProps(
|
|
35
|
+
mergeProps({ size: 'md' }, props),
|
|
36
|
+
['class', 'children', 'size'],
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<ArkCheckbox.Root
|
|
41
|
+
{...rest}
|
|
42
|
+
class={[
|
|
43
|
+
'balik-checkbox',
|
|
44
|
+
styles.root,
|
|
45
|
+
sizes[local.size],
|
|
46
|
+
local.class,
|
|
47
|
+
]
|
|
48
|
+
.filter(Boolean)
|
|
49
|
+
.join(' ')}
|
|
50
|
+
>
|
|
51
|
+
<ArkCheckbox.Control class={styles.control}>
|
|
52
|
+
<ArkCheckbox.Indicator indeterminate class={styles.indicator}>
|
|
53
|
+
<IndicatorIcon />
|
|
54
|
+
</ArkCheckbox.Indicator>
|
|
55
|
+
</ArkCheckbox.Control>
|
|
56
|
+
<ArkCheckbox.Label class={styles.label}>
|
|
57
|
+
{local.children}
|
|
58
|
+
</ArkCheckbox.Label>
|
|
59
|
+
<ArkCheckbox.HiddenInput />
|
|
60
|
+
</ArkCheckbox.Root>
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
Checkbox.Original = ArkCheckbox
|