@jakubmazanec/ui 0.4.2 → 0.5.0-unstable.5f3ffbeb
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/build/components/Button.js +8 -5
- package/build/components/Button.js.map +2 -2
- package/build/components/Checkbox.js +2 -2
- package/build/components/Checkbox.js.map +1 -1
- package/build/components/Combobox.js +1 -1
- package/build/components/Combobox.js.map +1 -1
- package/build/components/DialogPanel.js +1 -1
- package/build/components/DialogPanel.js.map +1 -1
- package/build/components/DialogTitle.js +1 -1
- package/build/components/DialogTitle.js.map +1 -1
- package/build/components/Heading.d.ts +21 -0
- package/build/components/Heading.js +48 -0
- package/build/components/Heading.js.map +7 -0
- package/build/components/Icon.js +1 -1
- package/build/components/Icon.js.map +1 -1
- package/build/components/Input.js +4 -4
- package/build/components/Input.js.map +2 -2
- package/build/components/Legend.js +1 -1
- package/build/components/Legend.js.map +1 -1
- package/build/components/ListboxOption.js +1 -1
- package/build/components/ListboxOption.js.map +1 -1
- package/build/components/Spinner.js +1 -1
- package/build/components/Spinner.js.map +1 -1
- package/build/components/TableHead.js +1 -1
- package/build/components/TableHead.js.map +1 -1
- package/build/components/TableHeader.js +1 -1
- package/build/components/TableHeader.js.map +2 -2
- package/build/components/Textarea.js +2 -2
- package/build/components/Textarea.js.map +1 -1
- package/build/components/data-table/DataTable.d.ts +2 -1
- package/build/components/data-table/DataTable.js +115 -110
- package/build/components/data-table/DataTable.js.map +2 -2
- package/build/components/data-table/internals/DataTableFilter.d.ts +12 -0
- package/build/components/data-table/internals/DataTableFilter.js +275 -0
- package/build/components/data-table/internals/DataTableFilter.js.map +7 -0
- package/build/components/data-table/internals/DataTableFilters.d.ts +11 -0
- package/build/components/data-table/internals/DataTableFilters.js +40 -0
- package/build/components/data-table/internals/DataTableFilters.js.map +7 -0
- package/build/components/data-table/internals/DataTableHeader.d.ts +2 -11
- package/build/components/data-table/internals/DataTableHeader.js +18 -112
- package/build/components/data-table/internals/DataTableHeader.js.map +2 -2
- package/build/components/data-table/internals/DataTableMenu.d.ts +11 -0
- package/build/components/data-table/internals/DataTableMenu.js +35 -0
- package/build/components/data-table/internals/DataTableMenu.js.map +7 -0
- package/build/components/data-table/internals/DataTableRow.d.ts +6 -0
- package/build/components/data-table/internals/DataTableRow.js +26 -0
- package/build/components/data-table/internals/DataTableRow.js.map +7 -0
- package/build/components/data-table/internals/DataTableSetting.d.ts +10 -0
- package/build/components/data-table/internals/DataTableSetting.js +111 -0
- package/build/components/data-table/internals/DataTableSetting.js.map +7 -0
- package/build/components/data-table/internals/DataTableSettings.d.ts +9 -0
- package/build/components/data-table/internals/DataTableSettings.js +71 -0
- package/build/components/data-table/internals/DataTableSettings.js.map +7 -0
- package/build/components/data-table/internals/constants.d.ts +1 -1
- package/build/components/data-table/internals/constants.js +1 -1
- package/build/components/data-table/internals/constants.js.map +2 -2
- package/build/components/data-table/internals.d.ts +5 -0
- package/build/components/data-table/internals.js +5 -0
- package/build/components/data-table/internals.js.map +2 -2
- package/build/components.d.ts +1 -0
- package/build/components.js +1 -0
- package/build/components.js.map +2 -2
- package/build/development/createTailwindConfig.d.ts +79 -2
- package/build/development/createTailwindConfig.js +10 -55
- package/build/development/createTailwindConfig.js.map +2 -2
- package/build/development/internals/createTailwindThemeColors.d.ts +2 -0
- package/build/development/internals/createTailwindThemeColors.js +51 -0
- package/build/development/internals/createTailwindThemeColors.js.map +7 -0
- package/build/development/internals.d.ts +1 -0
- package/build/development/internals.js +1 -0
- package/build/development/internals.js.map +2 -2
- package/build/styles.css +15 -1
- package/build/styles.css.map +2 -2
- package/build/theme/Theme.d.ts +3 -0
- package/build/theme/defaultTheme.js +2 -0
- package/build/theme/defaultTheme.js.map +2 -2
- package/build/theme/internals/themeContext.d.ts +10 -0
- package/build/theme/internals/useTheme.d.ts +10 -0
- package/package.json +1 -1
- package/source/components/Button.tsx +12 -5
- package/source/components/Checkbox.tsx +2 -2
- package/source/components/Combobox.tsx +1 -1
- package/source/components/DialogPanel.tsx +1 -1
- package/source/components/DialogTitle.tsx +1 -1
- package/source/components/Heading.ts +69 -0
- package/source/components/Icon.tsx +1 -1
- package/source/components/Input.tsx +5 -5
- package/source/components/Legend.tsx +1 -1
- package/source/components/ListboxOption.tsx +1 -1
- package/source/components/Spinner.tsx +1 -1
- package/source/components/TableHead.ts +1 -1
- package/source/components/TableHeader.ts +2 -1
- package/source/components/Textarea.tsx +2 -2
- package/source/components/data-table/DataTable.tsx +154 -136
- package/source/components/data-table/internals/DataTableFilter.tsx +354 -0
- package/source/components/data-table/internals/DataTableFilters.tsx +56 -0
- package/source/components/data-table/internals/DataTableHeader.tsx +7 -145
- package/source/components/data-table/internals/DataTableMenu.tsx +62 -0
- package/source/components/data-table/internals/DataTableRow.tsx +38 -0
- package/source/components/data-table/internals/DataTableSetting.tsx +142 -0
- package/source/components/data-table/internals/DataTableSettings.tsx +91 -0
- package/source/components/data-table/internals/constants.ts +1 -1
- package/source/components/data-table/internals.ts +5 -0
- package/source/components.ts +1 -0
- package/source/development/createTailwindConfig.ts +11 -57
- package/source/development/internals/createTailwindThemeColors.ts +53 -0
- package/source/development/internals.ts +1 -0
- package/source/styles.css +19 -3
- package/source/theme/Theme.ts +2 -0
- package/source/theme/defaultTheme.ts +2 -0
|
@@ -1,7 +1,84 @@
|
|
|
1
1
|
import { type Config as BaseTailwindConfig } from 'tailwindcss';
|
|
2
2
|
import { type DEFAULT_STOPS } from './internals/constants.js';
|
|
3
|
+
export declare const defaultCreateTailwindConfigOptions: {
|
|
4
|
+
colors: {
|
|
5
|
+
gray: string;
|
|
6
|
+
neutral: string;
|
|
7
|
+
red: string;
|
|
8
|
+
danger: string;
|
|
9
|
+
orange: {
|
|
10
|
+
hex: string;
|
|
11
|
+
hueShift: number;
|
|
12
|
+
};
|
|
13
|
+
warning: {
|
|
14
|
+
hex: string;
|
|
15
|
+
hueShift: number;
|
|
16
|
+
};
|
|
17
|
+
yellow: {
|
|
18
|
+
swatches: ({
|
|
19
|
+
hex: string;
|
|
20
|
+
stop: 10;
|
|
21
|
+
} | {
|
|
22
|
+
hex: string;
|
|
23
|
+
stop: 25;
|
|
24
|
+
} | {
|
|
25
|
+
hex: string;
|
|
26
|
+
stop: 50;
|
|
27
|
+
} | {
|
|
28
|
+
hex: string;
|
|
29
|
+
stop: 100;
|
|
30
|
+
} | {
|
|
31
|
+
hex: string;
|
|
32
|
+
stop: 200;
|
|
33
|
+
} | {
|
|
34
|
+
hex: string;
|
|
35
|
+
stop: 300;
|
|
36
|
+
} | {
|
|
37
|
+
hex: string;
|
|
38
|
+
stop: 400;
|
|
39
|
+
} | {
|
|
40
|
+
hex: string;
|
|
41
|
+
stop: 500;
|
|
42
|
+
} | {
|
|
43
|
+
hex: string;
|
|
44
|
+
stop: 600;
|
|
45
|
+
} | {
|
|
46
|
+
hex: string;
|
|
47
|
+
stop: 700;
|
|
48
|
+
} | {
|
|
49
|
+
hex: string;
|
|
50
|
+
stop: 800;
|
|
51
|
+
} | {
|
|
52
|
+
hex: string;
|
|
53
|
+
stop: 900;
|
|
54
|
+
} | {
|
|
55
|
+
hex: string;
|
|
56
|
+
stop: 950;
|
|
57
|
+
} | {
|
|
58
|
+
hex: string;
|
|
59
|
+
stop: 975;
|
|
60
|
+
} | {
|
|
61
|
+
hex: string;
|
|
62
|
+
stop: 990;
|
|
63
|
+
})[];
|
|
64
|
+
hex: string;
|
|
65
|
+
hueShift: number;
|
|
66
|
+
};
|
|
67
|
+
green: string;
|
|
68
|
+
teal: {
|
|
69
|
+
hex: string;
|
|
70
|
+
hueShift: number;
|
|
71
|
+
};
|
|
72
|
+
blue: string;
|
|
73
|
+
primary: string;
|
|
74
|
+
violet: string;
|
|
75
|
+
pink: {
|
|
76
|
+
hex: string;
|
|
77
|
+
hueShift: number;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
};
|
|
3
81
|
export type CreateTailwindConfigOptions = {
|
|
4
|
-
content?: string[] | undefined;
|
|
5
82
|
colors?: Record<string, {
|
|
6
83
|
hex: string;
|
|
7
84
|
hueShift?: number;
|
|
@@ -19,4 +96,4 @@ export type TailwindConfig = {
|
|
|
19
96
|
theme: BaseTailwindConfig['theme'];
|
|
20
97
|
plugins: BaseTailwindConfig['plugins'];
|
|
21
98
|
};
|
|
22
|
-
export declare function createTailwindConfig({
|
|
99
|
+
export declare function createTailwindConfig({ colors, }?: CreateTailwindConfigOptions): TailwindConfig;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import plugin from "tailwindcss/plugin";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
let defaultCreateTailwindConfigOptions = {
|
|
3
|
+
import { createTailwindThemeColors } from "./internals.js";
|
|
4
|
+
export const defaultCreateTailwindConfigOptions = {
|
|
6
5
|
colors: {
|
|
7
6
|
gray: "#6c6e79",
|
|
8
7
|
neutral: "#6c6e79",
|
|
@@ -56,62 +55,18 @@ let defaultCreateTailwindConfigOptions = {
|
|
|
56
55
|
}
|
|
57
56
|
};
|
|
58
57
|
export function createTailwindConfig({
|
|
59
|
-
content,
|
|
60
58
|
colors
|
|
61
59
|
} = defaultCreateTailwindConfigOptions) {
|
|
62
|
-
let themeColors =
|
|
63
|
-
transparent: "transparent",
|
|
64
|
-
current: "currentColor",
|
|
65
|
-
white: "#fff",
|
|
66
|
-
black: "#000"
|
|
67
|
-
};
|
|
68
|
-
for (let [name, color] of Object.entries(colors ?? {})) {
|
|
69
|
-
if (typeof color === "string") {
|
|
70
|
-
themeColors = {
|
|
71
|
-
...themeColors,
|
|
72
|
-
...createPalette({
|
|
73
|
-
name,
|
|
74
|
-
swatches: [
|
|
75
|
-
{
|
|
76
|
-
hex: color,
|
|
77
|
-
stop: DEFAULT_STOP
|
|
78
|
-
}
|
|
79
|
-
],
|
|
80
|
-
hueShift: 0,
|
|
81
|
-
saturationShift: 0
|
|
82
|
-
})
|
|
83
|
-
};
|
|
84
|
-
} else if ("swatches" in color) {
|
|
85
|
-
themeColors = {
|
|
86
|
-
...themeColors,
|
|
87
|
-
...createPalette({
|
|
88
|
-
name,
|
|
89
|
-
swatches: color.swatches,
|
|
90
|
-
hueShift: color.hueShift ?? 0,
|
|
91
|
-
saturationShift: color.saturationShift ?? 0
|
|
92
|
-
})
|
|
93
|
-
};
|
|
94
|
-
} else if ("hex" in color) {
|
|
95
|
-
themeColors = {
|
|
96
|
-
...themeColors,
|
|
97
|
-
...createPalette({
|
|
98
|
-
name,
|
|
99
|
-
swatches: [{ hex: color.hex, stop: DEFAULT_STOP }],
|
|
100
|
-
hueShift: color.hueShift ?? 0,
|
|
101
|
-
saturationShift: color.saturationShift ?? 0
|
|
102
|
-
})
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
}
|
|
60
|
+
let themeColors = createTailwindThemeColors(colors);
|
|
106
61
|
let root = {
|
|
107
62
|
"--radius-none": "0",
|
|
108
|
-
"--radius-0_5": "
|
|
109
|
-
"--radius-1": "
|
|
110
|
-
"--radius-1_5": "
|
|
111
|
-
"--radius-2": "
|
|
112
|
-
"--radius-2_5": "
|
|
113
|
-
"--radius-3": "
|
|
114
|
-
"--radius-4": "
|
|
63
|
+
"--radius-0_5": "2px",
|
|
64
|
+
"--radius-1": "4px",
|
|
65
|
+
"--radius-1_5": "6px",
|
|
66
|
+
"--radius-2": "8px",
|
|
67
|
+
"--radius-2_5": "10px",
|
|
68
|
+
"--radius-3": "12px",
|
|
69
|
+
"--radius-4": "16px",
|
|
115
70
|
"--radius-full": "9999px",
|
|
116
71
|
"--font-sans": 'InterVariable, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"'
|
|
117
72
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../source/development/createTailwindConfig.ts"],
|
|
4
|
-
"sourcesContent": ["import {type Config as BaseTailwindConfig} from 'tailwindcss';\nimport plugin from 'tailwindcss/plugin';\n\nimport {
|
|
5
|
-
"mappings": ";AACA,OAAO,YAAY;AAEnB,SAAQ,
|
|
4
|
+
"sourcesContent": ["import {type Config as BaseTailwindConfig} from 'tailwindcss';\nimport plugin from 'tailwindcss/plugin';\n\nimport {createTailwindThemeColors} from './internals.js';\nimport {type DEFAULT_STOPS} from './internals/constants.js';\n\nexport const defaultCreateTailwindConfigOptions = {\n colors: {\n gray: '#6c6e79',\n neutral: '#6c6e79', // copy of \"gray\"\n red: '#d1002f',\n danger: '#d1002f', // copy of \"red\"\n orange: {\n hex: '#c33909',\n hueShift: 1,\n },\n warning: {\n hex: '#c33909',\n hueShift: 1,\n }, // copy of \"orange\"\n yellow: {\n swatches: [\n {hex: '#fffffa', stop: 10},\n {hex: '#fffef0', stop: 25},\n {hex: '#fffbdb', stop: 50},\n {hex: '#fff3b8', stop: 100},\n {hex: '#ffe06f', stop: 200},\n {hex: '#ffc72d', stop: 300},\n {hex: '#e69d00', stop: 400},\n {hex: '#9e6300', stop: 500},\n {hex: '#805701', stop: 600},\n {hex: '#614700', stop: 700},\n {hex: '#3d3000', stop: 800},\n {hex: '#1f1a00', stop: 900},\n {hex: '#0f0e00', stop: 950},\n {hex: '#0a0a00', stop: 975},\n {hex: '#050500', stop: 990},\n ],\n hex: '#9e6300',\n hueShift: 3,\n },\n green: '#0a7e22',\n teal: {\n hex: '#007c65',\n hueShift: 5,\n },\n blue: '#006dca',\n primary: '#006dca', // copy of \"blue\"\n violet: '#8649e1',\n pink: {\n hex: '#b229b9',\n hueShift: 10,\n },\n },\n} satisfies CreateTailwindConfigOptions;\n\nexport type CreateTailwindConfigOptions = {\n colors?: Record<\n string,\n | {hex: string; hueShift?: number; saturationShift?: number}\n | {\n swatches: Array<{hex: string; stop: (typeof DEFAULT_STOPS)[number]}>;\n hueShift?: number;\n saturationShift?: number;\n }\n | string\n >;\n};\n\nexport type TailwindConfig = {\n theme: BaseTailwindConfig['theme'];\n // TODO: find another solution; following is needed because of this: https://github.com/tailwindlabs/tailwindcss/issues/18237\n plugins: BaseTailwindConfig['plugins'];\n};\n\nexport function createTailwindConfig({\n colors,\n}: CreateTailwindConfigOptions = defaultCreateTailwindConfigOptions): TailwindConfig {\n let themeColors = createTailwindThemeColors(colors);\n\n // TODO: find another solution; following is needed because of this: https://github.com/tailwindlabs/tailwindcss/issues/18237\n let root: Record<string, Record<string, string> | string> = {\n '--radius-none': '0',\n '--radius-0_5': '2px',\n '--radius-1': '4px',\n '--radius-1_5': '6px',\n '--radius-2': '8px',\n '--radius-2_5': '10px',\n '--radius-3': '12px',\n '--radius-4': '16px',\n '--radius-full': '9999px',\n '--font-sans':\n 'InterVariable, ui-sans-serif, system-ui, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"',\n };\n\n for (let [colorName, colorValue] of Object.entries(themeColors)) {\n if (typeof colorValue === 'string') {\n let variableName = `--color-${colorName}`;\n let variableValue = colorValue;\n\n root[variableName] = variableValue;\n themeColors[colorName] = `var(${variableName})`;\n } else if (typeof colorValue === 'object') {\n for (let [shadeName, shadeValue] of Object.entries(colorValue)) {\n let variableName = `--color-${colorName}-${shadeName}`;\n let variableValue = shadeValue;\n\n root[variableName] = variableValue;\n (themeColors[colorName] as Record<string, string>)[shadeName] = `var(${variableName})`; // type assertion is ok, we know the shape of `themeColors`\n }\n }\n }\n\n return {\n theme: {\n colors: themeColors,\n radius: {\n none: 'var(--radius-none)',\n '0.5': 'var(--radius-0_5)',\n '1': 'var(--radius-1)',\n '1.5': 'var(--radius-1_5)',\n '2': 'var(--radius-2)',\n '2.5': 'var(--radius-2_5)',\n '3': 'var(--radius-3)',\n '4': 'var(--radius-4)',\n full: 'var(--radius-full)',\n },\n font: {\n sans: 'var(--font-sans)',\n },\n },\n // TODO: find another solution; following is needed because of this: https://github.com/tailwindlabs/tailwindcss/issues/18237\n plugins: [\n plugin(({addBase}) => {\n addBase({\n ':root': root,\n });\n }),\n ],\n };\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { DEFAULT_STOP } from "./constants.js";
|
|
3
|
+
import { createPalette } from "./createPalette.js";
|
|
4
|
+
export function createTailwindThemeColors(colors) {
|
|
5
|
+
let themeColors = {
|
|
6
|
+
transparent: "transparent",
|
|
7
|
+
current: "currentColor",
|
|
8
|
+
white: "#fff",
|
|
9
|
+
black: "#000"
|
|
10
|
+
};
|
|
11
|
+
for (let [name, color] of Object.entries(colors ?? {})) {
|
|
12
|
+
if (typeof color === "string") {
|
|
13
|
+
themeColors = {
|
|
14
|
+
...themeColors,
|
|
15
|
+
...createPalette({
|
|
16
|
+
name,
|
|
17
|
+
swatches: [
|
|
18
|
+
{
|
|
19
|
+
hex: color,
|
|
20
|
+
stop: DEFAULT_STOP
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
hueShift: 0,
|
|
24
|
+
saturationShift: 0
|
|
25
|
+
})
|
|
26
|
+
};
|
|
27
|
+
} else if ("swatches" in color) {
|
|
28
|
+
themeColors = {
|
|
29
|
+
...themeColors,
|
|
30
|
+
...createPalette({
|
|
31
|
+
name,
|
|
32
|
+
swatches: color.swatches,
|
|
33
|
+
hueShift: color.hueShift ?? 0,
|
|
34
|
+
saturationShift: color.saturationShift ?? 0
|
|
35
|
+
})
|
|
36
|
+
};
|
|
37
|
+
} else if ("hex" in color) {
|
|
38
|
+
themeColors = {
|
|
39
|
+
...themeColors,
|
|
40
|
+
...createPalette({
|
|
41
|
+
name,
|
|
42
|
+
swatches: [{ hex: color.hex, stop: DEFAULT_STOP }],
|
|
43
|
+
hueShift: color.hueShift ?? 0,
|
|
44
|
+
saturationShift: color.saturationShift ?? 0
|
|
45
|
+
})
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return themeColors;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=createTailwindThemeColors.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../source/development/internals/createTailwindThemeColors.ts"],
|
|
4
|
+
"sourcesContent": ["import {type CreateTailwindConfigOptions} from '../createTailwindConfig.js';\nimport {DEFAULT_STOP} from './constants.js';\nimport {createPalette} from './createPalette.js';\n\nexport function createTailwindThemeColors(colors: CreateTailwindConfigOptions['colors']) {\n let themeColors: Record<string, Record<string, string> | string> = {\n transparent: 'transparent',\n current: 'currentColor',\n white: '#fff',\n black: '#000',\n };\n\n for (let [name, color] of Object.entries(colors ?? {})) {\n if (typeof color === 'string') {\n themeColors = {\n ...themeColors,\n ...createPalette({\n name,\n swatches: [\n {\n hex: color,\n stop: DEFAULT_STOP,\n },\n ],\n hueShift: 0,\n saturationShift: 0,\n }),\n };\n } else if ('swatches' in color) {\n themeColors = {\n ...themeColors,\n ...createPalette({\n name,\n swatches: color.swatches,\n hueShift: color.hueShift ?? 0,\n saturationShift: color.saturationShift ?? 0,\n }),\n };\n } else if ('hex' in color) {\n themeColors = {\n ...themeColors,\n ...createPalette({\n name,\n swatches: [{hex: color.hex, stop: DEFAULT_STOP}],\n hueShift: color.hueShift ?? 0,\n saturationShift: color.saturationShift ?? 0,\n }),\n };\n }\n }\n\n return themeColors;\n}\n"],
|
|
5
|
+
"mappings": ";AACA,SAAQ,oBAAmB;AAC3B,SAAQ,qBAAoB;AAErB,gBAAS,0BAA0B,QAA+C;AACvF,MAAI,cAA+D;AAAA,IACjE,aAAa;AAAA,IACb,SAAS;AAAA,IACT,OAAO;AAAA,IACP,OAAO;AAAA,EACT;AAEA,WAAS,CAAC,MAAM,KAAK,KAAK,OAAO,QAAQ,UAAU,CAAC,CAAC,GAAG;AACtD,QAAI,OAAO,UAAU,UAAU;AAC7B,oBAAc;AAAA,QACZ,GAAG;AAAA,QACH,GAAG,cAAc;AAAA,UACf;AAAA,UACA,UAAU;AAAA,YACR;AAAA,cACE,KAAK;AAAA,cACL,MAAM;AAAA,YACR;AAAA,UACF;AAAA,UACA,UAAU;AAAA,UACV,iBAAiB;AAAA,QACnB,CAAC;AAAA,MACH;AAAA,IACF,WAAW,cAAc,OAAO;AAC9B,oBAAc;AAAA,QACZ,GAAG;AAAA,QACH,GAAG,cAAc;AAAA,UACf;AAAA,UACA,UAAU,MAAM;AAAA,UAChB,UAAU,MAAM,YAAY;AAAA,UAC5B,iBAAiB,MAAM,mBAAmB;AAAA,QAC5C,CAAC;AAAA,MACH;AAAA,IACF,WAAW,SAAS,OAAO;AACzB,oBAAc;AAAA,QACZ,GAAG;AAAA,QACH,GAAG,cAAc;AAAA,UACf;AAAA,UACA,UAAU,CAAC,EAAC,KAAK,MAAM,KAAK,MAAM,aAAY,CAAC;AAAA,UAC/C,UAAU,MAAM,YAAY;AAAA,UAC5B,iBAAiB,MAAM,mBAAmB;AAAA,QAC5C,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -6,6 +6,7 @@ export * from './internals/createHueScale.js';
|
|
|
6
6
|
export * from './internals/createPalette.js';
|
|
7
7
|
export * from './internals/createSaturationScale.js';
|
|
8
8
|
export * from './internals/createSwatches.js';
|
|
9
|
+
export * from './internals/createTailwindThemeColors.js';
|
|
9
10
|
export * from './internals/hexToHsl.js';
|
|
10
11
|
export * from './internals/hexToRgb.js';
|
|
11
12
|
export * from './internals/hslToHex.js';
|
|
@@ -7,6 +7,7 @@ export * from "./internals/createHueScale.js";
|
|
|
7
7
|
export * from "./internals/createPalette.js";
|
|
8
8
|
export * from "./internals/createSaturationScale.js";
|
|
9
9
|
export * from "./internals/createSwatches.js";
|
|
10
|
+
export * from "./internals/createTailwindThemeColors.js";
|
|
10
11
|
export * from "./internals/hexToHsl.js";
|
|
11
12
|
export * from "./internals/hexToRgb.js";
|
|
12
13
|
export * from "./internals/hslToHex.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../source/development/internals.ts"],
|
|
4
|
-
"sourcesContent": ["export * from './internals/clamp.js';\nexport * from './internals/constants.js';\nexport * from './internals/createDisplayColor.js';\nexport * from './internals/createDistributionValues.js';\nexport * from './internals/createHueScale.js';\nexport * from './internals/createPalette.js';\nexport * from './internals/createSaturationScale.js';\nexport * from './internals/createSwatches.js';\nexport * from './internals/hexToHsl.js';\nexport * from './internals/hexToRgb.js';\nexport * from './internals/hslToHex.js';\nexport * from './internals/hslToRgb.js';\nexport * from './internals/isHex.js';\nexport type * from './internals/PaletteConfig.js';\nexport * from './internals/round.js';\nexport type * from './internals/SwatchValue.js';\nexport * from './internals/unsignedModulo.js';\n"],
|
|
5
|
-
"mappings": ";AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AAEd,cAAc;",
|
|
4
|
+
"sourcesContent": ["export * from './internals/clamp.js';\nexport * from './internals/constants.js';\nexport * from './internals/createDisplayColor.js';\nexport * from './internals/createDistributionValues.js';\nexport * from './internals/createHueScale.js';\nexport * from './internals/createPalette.js';\nexport * from './internals/createSaturationScale.js';\nexport * from './internals/createSwatches.js';\nexport * from './internals/createTailwindThemeColors.js';\nexport * from './internals/hexToHsl.js';\nexport * from './internals/hexToRgb.js';\nexport * from './internals/hslToHex.js';\nexport * from './internals/hslToRgb.js';\nexport * from './internals/isHex.js';\nexport type * from './internals/PaletteConfig.js';\nexport * from './internals/round.js';\nexport type * from './internals/SwatchValue.js';\nexport * from './internals/unsignedModulo.js';\n"],
|
|
5
|
+
"mappings": ";AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AAEd,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build/styles.css
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
font-display: swap;
|
|
13
13
|
src: url(./inter-variable-italic.woff2) format("woff2");
|
|
14
14
|
}
|
|
15
|
+
@theme { --spacing: 4px; }
|
|
15
16
|
@layer base {
|
|
16
17
|
html {
|
|
17
18
|
font-family: var(--font-sans);
|
|
@@ -19,8 +20,21 @@
|
|
|
19
20
|
}
|
|
20
21
|
* {
|
|
21
22
|
scrollbar-color: var(--color-neutral-200) var(--color-transparent);
|
|
23
|
+
outline-color: transparent;
|
|
24
|
+
}
|
|
25
|
+
*:focus {
|
|
26
|
+
outline-style: none;
|
|
27
|
+
outline-width: 0;
|
|
28
|
+
}
|
|
29
|
+
*:focus-visible {
|
|
30
|
+
outline-style: solid;
|
|
31
|
+
outline-width: 2px;
|
|
32
|
+
outline-offset: calc(var(--spacing) * 0.5);
|
|
33
|
+
outline-color: color-mix(in oklab, var(--color-blue-400) 50%, transparent);
|
|
34
|
+
transition-property: outline-color;
|
|
35
|
+
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
|
|
36
|
+
transition-duration: var(--tw-duration, var(--default-transition-duration));
|
|
22
37
|
}
|
|
23
38
|
}
|
|
24
|
-
@theme { --spacing: 4px; }
|
|
25
39
|
@source "./";
|
|
26
40
|
/*# sourceMappingURL=styles.css.map */
|
package/build/styles.css.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../source/styles.css"],
|
|
4
|
-
"sourcesContent": ["@font-face {\n font-family: InterVariable;\n font-style: normal;\n font-weight: 100 900;\n font-display: swap;\n src: url('./inter-variable.woff2') format('woff2');\n}\n\n@font-face {\n font-family: InterVariable;\n font-style: italic;\n font-weight: 100 900;\n font-display: swap;\n src: url('./inter-variable-italic.woff2') format('woff2');\n}\n\n@layer base {\n html {\n font-family: var(--font-sans);\n color: var(--color-neutral-550);\n }\n\n * {\n scrollbar-color: var(--color-neutral-200) var(--color-transparent);\n }\n}\n\n
|
|
5
|
-
"mappings": "AAAA;AACE,eAAa;AACb,cAAY;AACZ,eAAa,IAAI;AACjB,gBAAc;AACd,OAAK,4BAA8B,OAAO;AAC5C;AAEA;AACE,eAAa;AACb,cAAY;AACZ,eAAa,IAAI;AACjB,gBAAc;AACd,OAAK,mCAAqC,OAAO;AACnD;AAEA;AACE;AACE,iBAAa,IAAI;AACjB,WAAO,IAAI;AACb;AAEA;AACE,qBAAiB,IAAI,qBAAqB,IAAI;
|
|
4
|
+
"sourcesContent": ["@font-face {\n font-family: InterVariable;\n font-style: normal;\n font-weight: 100 900;\n font-display: swap;\n src: url('./inter-variable.woff2') format('woff2');\n}\n\n@font-face {\n font-family: InterVariable;\n font-style: italic;\n font-weight: 100 900;\n font-display: swap;\n src: url('./inter-variable-italic.woff2') format('woff2');\n}\n\n@theme {\n --spacing: 4px;\n}\n\n@layer base {\n html {\n font-family: var(--font-sans);\n color: var(--color-neutral-550);\n }\n\n * {\n scrollbar-color: var(--color-neutral-200) var(--color-transparent);\n outline-color: transparent;\n }\n\n *:focus {\n outline-style: none;\n outline-width: 0;\n }\n\n *:focus-visible {\n outline-style: solid;\n outline-width: 2px;\n outline-offset: calc(var(--spacing) * 0.5);\n outline-color: color-mix(in oklab, var(--color-blue-400) 50%, transparent);\n transition-property: outline-color;\n transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));\n transition-duration: var(--tw-duration, var(--default-transition-duration));\n }\n}\n\n@source \"./\";\n"],
|
|
5
|
+
"mappings": "AAAA;AACE,eAAa;AACb,cAAY;AACZ,eAAa,IAAI;AACjB,gBAAc;AACd,OAAK,4BAA8B,OAAO;AAC5C;AAEA;AACE,eAAa;AACb,cAAY;AACZ,eAAa,IAAI;AACjB,gBAAc;AACd,OAAK,mCAAqC,OAAO;AACnD;AAEA,OAAO,EACL,SAAS,EAAE,GAAG;AAGhB;AACE;AACE,iBAAa,IAAI;AACjB,WAAO,IAAI;AACb;AAEA;AACE,qBAAiB,IAAI,qBAAqB,IAAI;AAC9C,mBAAe;AACjB;AAEA,GAAC;AACC,mBAAe;AACf,mBAAe;AACjB;AAEA,GAAC;AACC,mBAAe;AACf,mBAAe;AACf,oBAAgB,KAAK,IAAI,WAAW,EAAE;AACtC,mBAAe,UAAU,GAAG,KAAK,EAAE,IAAI,kBAAkB,GAAG,EAAE;AAC9D,yBAAqB;AACrB,gCAA4B,IAAI,SAAS,EAAE,IAAI;AAC/C,yBAAqB,IAAI,aAAa,EAAE,IAAI;AAC9C;AACF;AAEA,QAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build/theme/Theme.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { type useErrorTheme } from '../components/Error.js';
|
|
|
14
14
|
import { type useFieldTheme } from '../components/Field.js';
|
|
15
15
|
import { type useFieldsetTheme } from '../components/Fieldset.js';
|
|
16
16
|
import { type useFormTheme } from '../components/Form.js';
|
|
17
|
+
import { type useHeadingTheme } from '../components/Heading.js';
|
|
17
18
|
import { type useIconTheme } from '../components/Icon.js';
|
|
18
19
|
import { type useInputTheme } from '../components/Input.js';
|
|
19
20
|
import { type useLabelTheme } from '../components/Label.js';
|
|
@@ -77,6 +78,8 @@ export type Theme = Simplify<ComponentTheme<typeof useButtonTheme, {
|
|
|
77
78
|
outputComponentName: true;
|
|
78
79
|
}> & ComponentTheme<typeof useFormTheme, {
|
|
79
80
|
outputComponentName: true;
|
|
81
|
+
}> & ComponentTheme<typeof useHeadingTheme, {
|
|
82
|
+
outputComponentName: true;
|
|
80
83
|
}> & ComponentTheme<typeof useIconTheme, {
|
|
81
84
|
outputComponentName: true;
|
|
82
85
|
}> & ComponentTheme<typeof useInputTheme, {
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
fieldsetnTheme,
|
|
16
16
|
fieldTheme,
|
|
17
17
|
formTheme,
|
|
18
|
+
headingTheme,
|
|
18
19
|
iconTheme,
|
|
19
20
|
inputTheme,
|
|
20
21
|
labelTheme,
|
|
@@ -65,6 +66,7 @@ export const defaultTheme = {
|
|
|
65
66
|
Field: fieldTheme,
|
|
66
67
|
Fieldset: fieldsetnTheme,
|
|
67
68
|
Form: formTheme,
|
|
69
|
+
Heading: headingTheme,
|
|
68
70
|
Icon: iconTheme,
|
|
69
71
|
Input: inputTheme,
|
|
70
72
|
Label: labelTheme,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../source/theme/defaultTheme.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n buttonTheme,\n cardTheme,\n checkboxFieldTheme,\n checkboxTheme,\n comboboxOptionTheme,\n comboboxTheme,\n containerTheme,\n descriptionTheme,\n dialogPanelTheme,\n dialogTheme,\n dialogTitleTheme,\n errorTheme,\n fieldsetnTheme,\n fieldTheme,\n formTheme,\n iconTheme,\n inputTheme,\n labelTheme,\n legendTheme,\n listboxOptionTheme,\n listboxTheme,\n menuButtonTheme,\n menuHeadingTheme,\n menuItemsTheme,\n menuItemTheme,\n menuSectionTheme,\n menuSeparatorTheme,\n menuTheme,\n popoverBackdropTheme,\n popoverButtonTheme,\n popoverGroupTheme,\n popoverPanelTheme,\n popoverTheme,\n radioFieldTheme,\n radioGroupTheme,\n radioTheme,\n spinnerTheme,\n tableBodyTheme,\n tableCaptionTheme,\n tableCellTheme,\n tableFootTheme,\n tableHeaderTheme,\n tableHeadTheme,\n tableRowTheme,\n tableTheme,\n textareaTheme,\n textTheme,\n} from '../components.js';\nimport {createTailwindConfig, createTailwindMerge} from '../development.js';\nimport {type Theme} from './Theme.js';\n\nexport const defaultTheme: Theme = {\n Button: buttonTheme,\n Card: cardTheme,\n Checkbox: checkboxTheme,\n CheckboxField: checkboxFieldTheme,\n Combobox: comboboxTheme,\n ComboboxOption: comboboxOptionTheme,\n Container: containerTheme,\n Description: descriptionTheme,\n Dialog: dialogTheme,\n DialogPanel: dialogPanelTheme,\n DialogTitle: dialogTitleTheme,\n Error: errorTheme,\n Field: fieldTheme,\n Fieldset: fieldsetnTheme,\n Form: formTheme,\n Icon: iconTheme,\n Input: inputTheme,\n Label: labelTheme,\n Legend: legendTheme,\n Listbox: listboxTheme,\n ListboxOption: listboxOptionTheme,\n Menu: menuTheme,\n MenuButton: menuButtonTheme,\n MenuHeading: menuHeadingTheme,\n MenuItem: menuItemTheme,\n MenuItems: menuItemsTheme,\n MenuSection: menuSectionTheme,\n MenuSeparator: menuSeparatorTheme,\n Popover: popoverTheme,\n PopoverBackdrop: popoverBackdropTheme,\n PopoverButton: popoverButtonTheme,\n PopoverGroup: popoverGroupTheme,\n PopoverPanel: popoverPanelTheme,\n Radio: radioTheme,\n RadioField: radioFieldTheme,\n RadioGroup: radioGroupTheme,\n Spinner: spinnerTheme,\n Table: tableTheme,\n TableBody: tableBodyTheme,\n TableCaption: tableCaptionTheme,\n TableCell: tableCellTheme,\n TableFoot: tableFootTheme,\n TableHead: tableHeadTheme,\n TableHeader: tableHeaderTheme,\n TableRow: tableRowTheme,\n Text: textTheme,\n Textarea: textareaTheme,\n\n merge: createTailwindMerge(createTailwindConfig()),\n};\n"],
|
|
5
|
-
"mappings": ";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAQ,sBAAsB,2BAA0B;AAGjD,aAAM,eAAsB;AAAA,EACjC,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,UAAU;AAAA,EACV,eAAe;AAAA,EACf,UAAU;AAAA,EACV,gBAAgB;AAAA,EAChB,WAAW;AAAA,EACX,aAAa;AAAA,EACb,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,aAAa;AAAA,EACb,OAAO;AAAA,EACP,OAAO;AAAA,EACP,UAAU;AAAA,EACV,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,eAAe;AAAA,EACf,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,UAAU;AAAA,EACV,WAAW;AAAA,EACX,aAAa;AAAA,EACb,eAAe;AAAA,EACf,SAAS;AAAA,EACT,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,cAAc;AAAA,EACd,cAAc;AAAA,EACd,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,OAAO;AAAA,EACP,WAAW;AAAA,EACX,cAAc;AAAA,EACd,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,aAAa;AAAA,EACb,UAAU;AAAA,EACV,MAAM;AAAA,EACN,UAAU;AAAA,EAEV,OAAO,oBAAoB,qBAAqB,CAAC;AACnD;",
|
|
4
|
+
"sourcesContent": ["import {\n buttonTheme,\n cardTheme,\n checkboxFieldTheme,\n checkboxTheme,\n comboboxOptionTheme,\n comboboxTheme,\n containerTheme,\n descriptionTheme,\n dialogPanelTheme,\n dialogTheme,\n dialogTitleTheme,\n errorTheme,\n fieldsetnTheme,\n fieldTheme,\n formTheme,\n headingTheme,\n iconTheme,\n inputTheme,\n labelTheme,\n legendTheme,\n listboxOptionTheme,\n listboxTheme,\n menuButtonTheme,\n menuHeadingTheme,\n menuItemsTheme,\n menuItemTheme,\n menuSectionTheme,\n menuSeparatorTheme,\n menuTheme,\n popoverBackdropTheme,\n popoverButtonTheme,\n popoverGroupTheme,\n popoverPanelTheme,\n popoverTheme,\n radioFieldTheme,\n radioGroupTheme,\n radioTheme,\n spinnerTheme,\n tableBodyTheme,\n tableCaptionTheme,\n tableCellTheme,\n tableFootTheme,\n tableHeaderTheme,\n tableHeadTheme,\n tableRowTheme,\n tableTheme,\n textareaTheme,\n textTheme,\n} from '../components.js';\nimport {createTailwindConfig, createTailwindMerge} from '../development.js';\nimport {type Theme} from './Theme.js';\n\nexport const defaultTheme: Theme = {\n Button: buttonTheme,\n Card: cardTheme,\n Checkbox: checkboxTheme,\n CheckboxField: checkboxFieldTheme,\n Combobox: comboboxTheme,\n ComboboxOption: comboboxOptionTheme,\n Container: containerTheme,\n Description: descriptionTheme,\n Dialog: dialogTheme,\n DialogPanel: dialogPanelTheme,\n DialogTitle: dialogTitleTheme,\n Error: errorTheme,\n Field: fieldTheme,\n Fieldset: fieldsetnTheme,\n Form: formTheme,\n Heading: headingTheme,\n Icon: iconTheme,\n Input: inputTheme,\n Label: labelTheme,\n Legend: legendTheme,\n Listbox: listboxTheme,\n ListboxOption: listboxOptionTheme,\n Menu: menuTheme,\n MenuButton: menuButtonTheme,\n MenuHeading: menuHeadingTheme,\n MenuItem: menuItemTheme,\n MenuItems: menuItemsTheme,\n MenuSection: menuSectionTheme,\n MenuSeparator: menuSeparatorTheme,\n Popover: popoverTheme,\n PopoverBackdrop: popoverBackdropTheme,\n PopoverButton: popoverButtonTheme,\n PopoverGroup: popoverGroupTheme,\n PopoverPanel: popoverPanelTheme,\n Radio: radioTheme,\n RadioField: radioFieldTheme,\n RadioGroup: radioGroupTheme,\n Spinner: spinnerTheme,\n Table: tableTheme,\n TableBody: tableBodyTheme,\n TableCaption: tableCaptionTheme,\n TableCell: tableCellTheme,\n TableFoot: tableFootTheme,\n TableHead: tableHeadTheme,\n TableHeader: tableHeaderTheme,\n TableRow: tableRowTheme,\n Text: textTheme,\n Textarea: textareaTheme,\n\n merge: createTailwindMerge(createTailwindConfig()),\n};\n"],
|
|
5
|
+
"mappings": ";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAQ,sBAAsB,2BAA0B;AAGjD,aAAM,eAAsB;AAAA,EACjC,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,UAAU;AAAA,EACV,eAAe;AAAA,EACf,UAAU;AAAA,EACV,gBAAgB;AAAA,EAChB,WAAW;AAAA,EACX,aAAa;AAAA,EACb,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,aAAa;AAAA,EACb,OAAO;AAAA,EACP,OAAO;AAAA,EACP,UAAU;AAAA,EACV,MAAM;AAAA,EACN,SAAS;AAAA,EACT,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,eAAe;AAAA,EACf,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,UAAU;AAAA,EACV,WAAW;AAAA,EACX,aAAa;AAAA,EACb,eAAe;AAAA,EACf,SAAS;AAAA,EACT,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,cAAc;AAAA,EACd,cAAc;AAAA,EACd,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,OAAO;AAAA,EACP,WAAW;AAAA,EACX,cAAc;AAAA,EACd,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,aAAa;AAAA,EACb,UAAU;AAAA,EACV,MAAM;AAAA,EACN,UAAU;AAAA,EAEV,OAAO,oBAAoB,qBAAqB,CAAC;AACnD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -120,6 +120,16 @@ export declare const themeContext: import("react").Context<import("@jakubmazanec
|
|
|
120
120
|
Form: {
|
|
121
121
|
className: import("./ClassName.js").ClassName;
|
|
122
122
|
};
|
|
123
|
+
} & {
|
|
124
|
+
Heading: {
|
|
125
|
+
className?: import("./ClassName.js").ClassName;
|
|
126
|
+
variants: import("./ComponentThemeVariants.js").ComponentThemeVariants<{
|
|
127
|
+
readonly size: ["small", "medium", "large"];
|
|
128
|
+
}, undefined>;
|
|
129
|
+
compoundVariants?: import("./ComponentThemeCompoundVariants.js").ComponentThemeCompoundVariants<{
|
|
130
|
+
readonly size: ["small", "medium", "large"];
|
|
131
|
+
}, undefined> | undefined;
|
|
132
|
+
};
|
|
123
133
|
} & {
|
|
124
134
|
Icon: {
|
|
125
135
|
className?: import("./ClassName.js").ClassName;
|
|
@@ -120,6 +120,16 @@ export declare function useTheme(): import("@jakubmazanec/ts-utils").Simplify<{
|
|
|
120
120
|
Form: {
|
|
121
121
|
className: import("./ClassName.js").ClassName;
|
|
122
122
|
};
|
|
123
|
+
} & {
|
|
124
|
+
Heading: {
|
|
125
|
+
className?: import("./ClassName.js").ClassName;
|
|
126
|
+
variants: import("./ComponentThemeVariants.js").ComponentThemeVariants<{
|
|
127
|
+
readonly size: ["small", "medium", "large"];
|
|
128
|
+
}, undefined>;
|
|
129
|
+
compoundVariants?: import("./ComponentThemeCompoundVariants.js").ComponentThemeCompoundVariants<{
|
|
130
|
+
readonly size: ["small", "medium", "large"];
|
|
131
|
+
}, undefined> | undefined;
|
|
132
|
+
};
|
|
123
133
|
} & {
|
|
124
134
|
Icon: {
|
|
125
135
|
className?: import("./ClassName.js").ClassName;
|
package/package.json
CHANGED
|
@@ -78,7 +78,11 @@ export function Button<T extends ElementType = typeof BUTTON_ELEMENT>({
|
|
|
78
78
|
let enhancedChildren = Children.map(children, (child) => {
|
|
79
79
|
if (isValidElement(child) && (child.type === Icon || child.type === Spinner)) {
|
|
80
80
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- needed
|
|
81
|
-
return cloneElement<any>(child, {'data-
|
|
81
|
+
return cloneElement<any>(child, {'data-slot': 'icon'});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (!isValidElement(child) && typeof child === 'string') {
|
|
85
|
+
return <span data-slot="text">{child}</span>;
|
|
82
86
|
}
|
|
83
87
|
|
|
84
88
|
return child;
|
|
@@ -96,7 +100,7 @@ export function Button<T extends ElementType = typeof BUTTON_ELEMENT>({
|
|
|
96
100
|
|
|
97
101
|
export const buttonTheme: ComponentTheme<typeof useButtonTheme> = {
|
|
98
102
|
className:
|
|
99
|
-
'rounded-2 flex items-center justify-center text-nowrap font-sans font-medium text-sm transition-colors',
|
|
103
|
+
'rounded-2 inline-flex items-center justify-center text-nowrap font-sans font-medium text-sm transition-colors',
|
|
100
104
|
variants: {
|
|
101
105
|
variant: {
|
|
102
106
|
solid: 'text-white bg-neutral-900 hover:bg-neutral-800',
|
|
@@ -105,9 +109,12 @@ export const buttonTheme: ComponentTheme<typeof useButtonTheme> = {
|
|
|
105
109
|
invisible: 'cursor-default text-neutral-200 hover:text-neutral-600 select-none',
|
|
106
110
|
},
|
|
107
111
|
size: {
|
|
108
|
-
small:
|
|
109
|
-
|
|
110
|
-
|
|
112
|
+
small:
|
|
113
|
+
'text-sm leading-6 px-2.5 h-8 min-w-8 gap-x-1 *:first:data-[slot=icon]:-ml-2 *:last:data-[slot=icon]:-mr-2',
|
|
114
|
+
medium:
|
|
115
|
+
'leading-6 px-2.5 h-9 min-w-9 gap-x-1 *:first:data-[slot=icon]:-ml-1.5 *:last:data-[slot=icon]:-mr-1.5',
|
|
116
|
+
large:
|
|
117
|
+
'text-lg leading-6 px-3 h-10 min-w-10 gap-x-1 *:first:data-[slot=icon]:-ml-1 *:last:data-[slot=icon]:-mr-1',
|
|
111
118
|
},
|
|
112
119
|
disabled: {
|
|
113
120
|
true: '',
|
|
@@ -106,13 +106,13 @@ export function Checkbox<T extends ElementType = typeof CHECKBOX_ELEMENT>({
|
|
|
106
106
|
export const checkboxTheme: ComponentTheme<typeof useCheckboxTheme> = {
|
|
107
107
|
classNames: {
|
|
108
108
|
root: 'group/checkbox inline-block size-5 cursor-pointer',
|
|
109
|
-
icon: 'flex justify-content justify-item size-5 *:rounded-2 *:bg-white *:border-2 *:border-neutral-100 *:hover:border-neutral-200 *:shadow-inner *:transition-colors *:text-transparent *:hover:text-neutral-100 group-data-[checked]/checkbox:*:bg-neutral-950 group-data-[checked]/checkbox:*:border-neutral-950 group-data-[checked]/checkbox:*:text-white',
|
|
109
|
+
icon: 'flex justify-content justify-item size-5 *:rounded-2 *:bg-white *:border-2 *:border-neutral-100 *:hover:border-neutral-200 *:shadow-inner *:transition-colors *:text-transparent *:hover:text-neutral-100 group-data-[checked]/checkbox:*:bg-neutral-950 group-data-[checked]/checkbox:*:border-neutral-950 group-data-[checked]/checkbox:*:text-white hover:group-data-[checked]/checkbox:*:border-neutral-950 hover:group-data-[checked]/checkbox:*:text-white',
|
|
110
110
|
},
|
|
111
111
|
variants: {
|
|
112
112
|
disabled: {
|
|
113
113
|
true: {
|
|
114
114
|
root: 'cursor-not-allowed',
|
|
115
|
-
icon: '*:hover:text-transparent *:border-neutral-50 *:hover:border-neutral-50 group-data-[checked]/checkbox:*:bg-neutral-100 group-data-[checked]/checkbox:*:border-neutral-100 group-data-[checked]/checkbox:*:text-white',
|
|
115
|
+
icon: '*:hover:text-transparent *:border-neutral-50 *:hover:border-neutral-50 group-data-[checked]/checkbox:*:bg-neutral-100 group-data-[checked]/checkbox:*:border-neutral-100 group-data-[checked]/checkbox:*:text-white hover:group-data-[checked]/checkbox:*:border-neutral-100 hover:group-data-[checked]/checkbox:*:text-white',
|
|
116
116
|
},
|
|
117
117
|
false: {
|
|
118
118
|
root: '',
|
|
@@ -260,7 +260,7 @@ export const comboboxTheme: ComponentTheme<typeof useComboboxTheme> = {
|
|
|
260
260
|
'flex w-full items-center rounded-2 border-2 border-neutral-100 hover:border-neutral-200 bg-white px-2.5 h-9 pr-9 gap-x-2 transition-colors shadow-inner font-sans text-sm',
|
|
261
261
|
icon: 'text-neutral-500 size-5 top-2 right-2 cursor-pointer',
|
|
262
262
|
options:
|
|
263
|
-
'flex flex-col gap-y-1 shadow p-1 z-30 rounded-2 border-2 border-neutral-100 hover:border-neutral-200 bg-white text-left w-[var(--input-width)] [--anchor-gap:
|
|
263
|
+
'flex flex-col gap-y-1 shadow p-1 z-30 rounded-2 border-2 border-neutral-100 hover:border-neutral-200 bg-white text-left w-[var(--input-width)] [--anchor-gap:var(--spacing)] [--anchor-padding:calc(var(--spacing)*2)] [scrollbar-width:thin] empty:invisible transition-colors',
|
|
264
264
|
},
|
|
265
265
|
variants: {
|
|
266
266
|
disabled: {
|
|
@@ -47,5 +47,5 @@ export function DialogPanel<T extends ElementType = typeof DIALOG_PANEL_ELEMENT>
|
|
|
47
47
|
|
|
48
48
|
export const dialogPanelTheme: ComponentTheme<typeof useDialogPanelTheme> = {
|
|
49
49
|
className:
|
|
50
|
-
'shadow-1 relative
|
|
50
|
+
'shadow-1 relative w-full min-w-[300px] max-w-[900px] gap-y-6 rounded-4 bg-white p-6 max-h-[calc(100vh-var(--spacing)*2)] overflow-hidden overflow-y-auto',
|
|
51
51
|
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type ComponentPropsWithoutRef,
|
|
3
|
+
createElement,
|
|
4
|
+
type ElementType,
|
|
5
|
+
type PropsWithChildren,
|
|
6
|
+
} from 'react';
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
type ComponentProps,
|
|
10
|
+
type ComponentTheme,
|
|
11
|
+
createComponentTheme,
|
|
12
|
+
} from '../theme/internals.js';
|
|
13
|
+
import {type ComponentRef} from './ComponentRef.js';
|
|
14
|
+
|
|
15
|
+
export const useHeadingTheme = createComponentTheme('Heading', {
|
|
16
|
+
variants: {
|
|
17
|
+
size: ['small', 'medium', 'large'],
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const HEADING_ELEMENT = 'h1';
|
|
22
|
+
|
|
23
|
+
export type HeadingProps<T extends ElementType> = ComponentProps<typeof useHeadingTheme> &
|
|
24
|
+
ComponentPropsWithoutRef<T> &
|
|
25
|
+
ComponentRef<T> &
|
|
26
|
+
PropsWithChildren & {
|
|
27
|
+
as?: T | undefined;
|
|
28
|
+
className?: string;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export function Heading<T extends ElementType = typeof HEADING_ELEMENT>({
|
|
32
|
+
size = 'medium',
|
|
33
|
+
as: Component,
|
|
34
|
+
className,
|
|
35
|
+
ref,
|
|
36
|
+
children,
|
|
37
|
+
...rest
|
|
38
|
+
}: HeadingProps<T>) {
|
|
39
|
+
let theme = useHeadingTheme({size});
|
|
40
|
+
let props = {
|
|
41
|
+
ref,
|
|
42
|
+
className: theme(null, className),
|
|
43
|
+
'data-component': 'heading',
|
|
44
|
+
...rest,
|
|
45
|
+
};
|
|
46
|
+
// TODO: is this ok typings-wise? Are types for <h1> and <h2> different?
|
|
47
|
+
let DefaultComponent = HEADING_ELEMENT;
|
|
48
|
+
|
|
49
|
+
if (size === 'small') {
|
|
50
|
+
DefaultComponent = 'h3';
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (size === 'medium') {
|
|
54
|
+
DefaultComponent = 'h2';
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return createElement(Component ?? DefaultComponent, props, children);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export const headingTheme: ComponentTheme<typeof useHeadingTheme> = {
|
|
61
|
+
className: 'm-0',
|
|
62
|
+
variants: {
|
|
63
|
+
size: {
|
|
64
|
+
small: 'text-lg font-medium',
|
|
65
|
+
medium: 'text-xl font-medium',
|
|
66
|
+
large: 'text-2xl font-medium',
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
};
|
|
@@ -82,7 +82,7 @@ export function Icon<T extends ElementType = typeof ICON_ELEMENT>({
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
export const iconTheme: ComponentTheme<typeof useIconTheme> = {
|
|
85
|
-
className: 'inline-block shrink-0 *:w-full *:h-full
|
|
85
|
+
className: 'inline-block shrink-0 *:w-full *:h-full select-none',
|
|
86
86
|
variants: {
|
|
87
87
|
size: {
|
|
88
88
|
small: 'size-4',
|