@codelitdev/design-system 0.1.0-alpha.5 → 0.1.0-alpha.7
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 +15 -15
- package/package.json +13 -7
- package/src/assets/logo-codelit.svg +1 -1
- package/src/assets/logo-courselit.svg +1 -1
- package/src/assets/logo-frontlit.svg +1 -1
- package/src/assets/logo-medialit.svg +1 -1
- package/src/assets/logo-sendlit.svg +1 -1
- package/src/components/actions/Button.tsx +12 -2
- package/src/components/actions/IconButton.tsx +11 -2
- package/src/components/display/Badge.tsx +1 -1
- package/src/components/display/Card.tsx +1 -1
- package/src/components/display/Tabs.tsx +23 -3
- package/src/components/feedback/Dialog.tsx +23 -4
- package/src/components/feedback/Loader.tsx +57 -15
- package/src/components/feedback/Toast.tsx +51 -4
- package/src/components/feedback/Tooltip.tsx +7 -1
- package/src/components/forms/Checkbox.tsx +32 -4
- package/src/components/forms/Input.tsx +4 -1
- package/src/components/forms/Radio.tsx +23 -3
- package/src/components/forms/Select.tsx +24 -5
- package/src/components/forms/Switch.tsx +20 -3
- package/src/components.css +489 -134
- package/src/index.ts +1 -1
- package/src/tokens/fonts.css +1 -1
- package/src/tokens/layout.css +4 -4
- package/src/tokens/products.css +8 -4
- package/src/tokens/typography.css +24 -13
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import type React from "react";
|
|
2
4
|
|
|
3
5
|
export interface SelectProps {
|
|
4
6
|
label?: React.ReactNode;
|
|
@@ -19,19 +21,36 @@ export function Select({ label, hint, options = [], style, ...rest }: SelectProp
|
|
|
19
21
|
<select {...rest}>
|
|
20
22
|
{options.map((o) =>
|
|
21
23
|
typeof o === "string" ? (
|
|
22
|
-
<option key={o} value={o}>
|
|
24
|
+
<option key={o} value={o}>
|
|
25
|
+
{o}
|
|
26
|
+
</option>
|
|
23
27
|
) : (
|
|
24
|
-
<option key={o.value} value={o.value}>
|
|
25
|
-
|
|
28
|
+
<option key={o.value} value={o.value}>
|
|
29
|
+
{o.label}
|
|
30
|
+
</option>
|
|
31
|
+
),
|
|
26
32
|
)}
|
|
27
33
|
</select>
|
|
28
34
|
<span className="cl-select__chevron">
|
|
29
|
-
<svg
|
|
35
|
+
<svg
|
|
36
|
+
aria-hidden="true"
|
|
37
|
+
width="14"
|
|
38
|
+
height="14"
|
|
39
|
+
viewBox="0 0 24 24"
|
|
40
|
+
fill="none"
|
|
41
|
+
stroke="currentColor"
|
|
42
|
+
strokeWidth="2"
|
|
43
|
+
strokeLinecap="round"
|
|
44
|
+
strokeLinejoin="round"
|
|
45
|
+
>
|
|
46
|
+
<path d="m6 9 6 6 6-6"></path>
|
|
47
|
+
</svg>
|
|
30
48
|
</span>
|
|
31
49
|
</span>
|
|
32
50
|
);
|
|
33
51
|
if (!label && !hint) return <span style={style}>{control}</span>;
|
|
34
52
|
return (
|
|
53
|
+
/* biome-ignore lint/a11y/noLabelWithoutControl: the select control is rendered inside this label. */
|
|
35
54
|
<label className="cl-field" style={style}>
|
|
36
55
|
{label ? <span className="cl-field__label">{label}</span> : null}
|
|
37
56
|
{control}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import type React from "react";
|
|
2
4
|
|
|
3
5
|
export interface SwitchProps {
|
|
4
6
|
label?: React.ReactNode;
|
|
@@ -10,10 +12,25 @@ export interface SwitchProps {
|
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
/** Toggle switch with trailing label. */
|
|
13
|
-
export function Switch({
|
|
15
|
+
export function Switch({
|
|
16
|
+
label,
|
|
17
|
+
checked,
|
|
18
|
+
defaultChecked,
|
|
19
|
+
disabled,
|
|
20
|
+
onChange,
|
|
21
|
+
style,
|
|
22
|
+
}: SwitchProps) {
|
|
14
23
|
return (
|
|
15
24
|
<label className="cl-switch" style={{ opacity: disabled ? 0.5 : 1, ...style }}>
|
|
16
|
-
<input
|
|
25
|
+
<input
|
|
26
|
+
type="checkbox"
|
|
27
|
+
role="switch"
|
|
28
|
+
aria-checked={checked ?? defaultChecked ?? false}
|
|
29
|
+
checked={checked}
|
|
30
|
+
defaultChecked={defaultChecked}
|
|
31
|
+
disabled={disabled}
|
|
32
|
+
onChange={onChange}
|
|
33
|
+
/>
|
|
17
34
|
<span className="cl-switch__track">
|
|
18
35
|
<span className="cl-switch__thumb"></span>
|
|
19
36
|
</span>
|