@g4rcez/components 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +1 -1
- package/dist/index.js +44 -44
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10100 -9939
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +44 -44
- package/dist/index.umd.js.map +1 -1
- package/dist/preset/preset.tailwind.js +14 -14
- package/dist/preset/src/styles/common.d.ts +4 -0
- package/dist/preset/src/styles/common.d.ts.map +1 -1
- package/dist/preset/src/styles/common.js +10 -0
- package/dist/preset/src/styles/dark.d.ts.map +1 -1
- package/dist/preset/src/styles/dark.js +2 -1
- package/dist/preset/src/styles/design-tokens.d.ts +8 -7
- package/dist/preset/src/styles/design-tokens.d.ts.map +1 -1
- package/dist/preset/src/styles/design-tokens.js +16 -12
- package/dist/preset/src/styles/light.d.ts.map +1 -1
- package/dist/preset/src/styles/light.js +6 -5
- package/dist/preset/src/styles/theme.types.d.ts +10 -1
- package/dist/preset/src/styles/theme.types.d.ts.map +1 -1
- package/dist/preset.tailwind.js +14 -14
- package/dist/src/components/core/tag.d.ts +1 -1
- package/dist/src/components/core/tag.js +2 -2
- package/dist/src/components/display/alert.js +1 -1
- package/dist/src/components/display/calendar.d.ts +1 -1
- package/dist/src/components/display/calendar.d.ts.map +1 -1
- package/dist/src/components/display/calendar.js +24 -23
- package/dist/src/components/display/card.js +1 -1
- package/dist/src/components/display/empty.d.ts.map +1 -1
- package/dist/src/components/display/list.js +1 -1
- package/dist/src/components/display/tabs.d.ts.map +1 -1
- package/dist/src/components/display/tabs.js +2 -2
- package/dist/src/components/display/timeline.d.ts +8 -30
- package/dist/src/components/display/timeline.d.ts.map +1 -1
- package/dist/src/components/display/timeline.js +11 -14
- package/dist/src/components/floating/dropdown.js +2 -2
- package/dist/src/components/floating/expand.d.ts +2 -0
- package/dist/src/components/floating/expand.d.ts.map +1 -1
- package/dist/src/components/floating/expand.js +12 -5
- package/dist/src/components/floating/menu.js +2 -2
- package/dist/src/components/floating/modal.d.ts +5 -2
- package/dist/src/components/floating/modal.d.ts.map +1 -1
- package/dist/src/components/floating/modal.js +14 -7
- package/dist/src/components/form/autocomplete.d.ts.map +1 -1
- package/dist/src/components/form/autocomplete.js +27 -22
- package/dist/src/components/form/checkbox.d.ts +1 -0
- package/dist/src/components/form/checkbox.d.ts.map +1 -1
- package/dist/src/components/form/checkbox.js +4 -1
- package/dist/src/components/form/free-text.d.ts.map +1 -1
- package/dist/src/components/form/free-text.js +2 -2
- package/dist/src/components/form/input-field.d.ts +1 -0
- package/dist/src/components/form/input-field.d.ts.map +1 -1
- package/dist/src/components/form/input-field.js +2 -2
- package/dist/src/components/form/input.d.ts.map +1 -1
- package/dist/src/components/form/input.js +3 -1
- package/dist/src/components/form/multi-select.d.ts +19 -0
- package/dist/src/components/form/multi-select.d.ts.map +1 -0
- package/dist/src/components/form/{multi-combobox.js → multi-select.js} +45 -34
- package/dist/src/components/form/select.d.ts.map +1 -1
- package/dist/src/components/form/select.js +2 -2
- package/dist/src/components/form/switch.d.ts +1 -0
- package/dist/src/components/form/switch.d.ts.map +1 -1
- package/dist/src/components/form/switch.js +7 -6
- package/dist/src/components/index.d.ts +2 -1
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +2 -1
- package/dist/src/components/table/filter.d.ts.map +1 -1
- package/dist/src/components/table/filter.js +1 -1
- package/dist/src/components/table/index.d.ts.map +1 -1
- package/dist/src/components/table/index.js +11 -7
- package/dist/src/components/table/pagination.d.ts.map +1 -1
- package/dist/src/components/table/pagination.js +6 -6
- package/dist/src/components/table/table-lib.d.ts +3 -2
- package/dist/src/components/table/table-lib.d.ts.map +1 -1
- package/dist/src/components/table/table-lib.js +16 -0
- package/dist/src/components/table/thead.d.ts.map +1 -1
- package/dist/src/components/table/thead.js +27 -6
- package/dist/src/config/context.d.ts +17 -0
- package/dist/src/config/context.d.ts.map +1 -0
- package/dist/src/config/context.js +10 -0
- package/dist/src/config/default-translations.d.ts +59 -0
- package/dist/src/config/default-translations.d.ts.map +1 -0
- package/dist/src/config/default-translations.js +52 -0
- package/dist/src/config/default-tweaks.d.ts +12 -0
- package/dist/src/config/default-tweaks.d.ts.map +1 -0
- package/dist/src/config/default-tweaks.js +4 -0
- package/dist/src/hooks/use-color-parser.js +1 -1
- package/dist/src/hooks/use-components-provider.d.ts +4 -76
- package/dist/src/hooks/use-components-provider.d.ts.map +1 -1
- package/dist/src/hooks/use-components-provider.js +5 -63
- package/dist/src/hooks/use-debounce.d.ts +1 -0
- package/dist/src/hooks/use-debounce.d.ts.map +1 -1
- package/dist/src/hooks/use-debounce.js +1 -1
- package/dist/src/hooks/use-form.d.ts +1 -1
- package/dist/src/hooks/use-is-coarse-device.d.ts +2 -0
- package/dist/src/hooks/use-is-coarse-device.d.ts.map +1 -0
- package/dist/src/hooks/use-is-coarse-device.js +12 -0
- package/dist/src/hooks/use-locale.d.ts +1 -1
- package/dist/src/hooks/use-locale.d.ts.map +1 -1
- package/dist/src/hooks/use-locale.js +2 -2
- package/dist/src/hooks/use-on-event.js +1 -1
- package/dist/src/hooks/use-reactive.d.ts +1 -1
- package/dist/src/hooks/use-reactive.d.ts.map +1 -1
- package/dist/src/hooks/use-remove-scroll.d.ts.map +1 -1
- package/dist/src/hooks/use-remove-scroll.js +6 -2
- package/dist/src/hooks/use-swipe.d.ts +8 -0
- package/dist/src/hooks/use-swipe.d.ts.map +1 -0
- package/dist/src/hooks/use-swipe.js +16 -0
- package/dist/src/hooks/use-translations.d.ts +2 -2
- package/dist/src/hooks/use-translations.d.ts.map +1 -1
- package/dist/src/hooks/use-translations.js +2 -1
- package/dist/src/hooks/use-tweaks.d.ts +1 -1
- package/dist/src/hooks/use-tweaks.d.ts.map +1 -1
- package/dist/src/hooks/use-tweaks.js +2 -1
- package/dist/src/index.d.ts +10 -7
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +9 -6
- package/dist/src/lib/dict.d.ts +3 -3
- package/dist/src/lib/dict.d.ts.map +1 -1
- package/dist/src/lib/dict.js +9 -7
- package/dist/src/lib/dom.d.ts +3 -3
- package/dist/src/lib/dom.d.ts.map +1 -1
- package/dist/src/lib/dom.js +1 -1
- package/dist/src/lib/fns.d.ts +4 -2
- package/dist/src/lib/fns.d.ts.map +1 -1
- package/dist/src/lib/fns.js +4 -0
- package/dist/src/styles/common.d.ts +4 -0
- package/dist/src/styles/common.d.ts.map +1 -1
- package/dist/src/styles/common.js +10 -0
- package/dist/src/styles/dark.d.ts.map +1 -1
- package/dist/src/styles/dark.js +2 -1
- package/dist/src/styles/design-tokens.d.ts +8 -7
- package/dist/src/styles/design-tokens.d.ts.map +1 -1
- package/dist/src/styles/design-tokens.js +13 -10
- package/dist/src/styles/light.d.ts.map +1 -1
- package/dist/src/styles/light.js +6 -5
- package/dist/src/styles/theme.types.d.ts +10 -1
- package/dist/src/styles/theme.types.d.ts.map +1 -1
- package/dist/src/types.d.ts +2 -1
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/src/components/form/multi-combobox.d.ts +0 -24
- package/dist/src/components/form/multi-combobox.d.ts.map +0 -1
|
@@ -22,41 +22,41 @@ var config = {
|
|
|
22
22
|
DEFAULT: "cubic-bezier(0,0,.58,1)",
|
|
23
23
|
normal: "cubic-bezier(.25,.1,.25,1)",
|
|
24
24
|
},
|
|
25
|
+
width: spacing,
|
|
25
26
|
spacing: spacing,
|
|
26
|
-
transitionDuration: { DEFAULT: "375ms" },
|
|
27
|
-
minWidth: { xs: "20rem", screen: "100vh" },
|
|
28
|
-
borderRadius: createDesignTokens(theme.rounded, parsers.cssVariable),
|
|
29
27
|
fill: COLORS,
|
|
30
28
|
colors: COLORS,
|
|
29
|
+
fontSize: spacing,
|
|
31
30
|
placeholderColor: COLORS,
|
|
31
|
+
transitionDuration: { DEFAULT: "375ms" },
|
|
32
|
+
minWidth: { xs: "20rem", screen: "100vh" },
|
|
32
33
|
borderColors: __assign(__assign({}, COLORS), { DEFAULT: COLORS.card.border }),
|
|
34
|
+
borderRadius: createDesignTokens(theme.rounded, parsers.cssVariable),
|
|
35
|
+
boxShadow: { floating: "rgba(15, 15, 15, 0.1) 0px 0px 0px 1px, rgba(15, 15, 15, 0.1) 0px 3px 6px, rgba(15, 15, 15, 0.2) 0px 5px 12px" },
|
|
33
36
|
zIndex: {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
},
|
|
41
|
-
boxShadow: {
|
|
42
|
-
floating: "rgba(15, 15, 15, 0.1) 0px 0px 0px 1px, rgba(15, 15, 15, 0.1) 0px 3px 6px, rgba(15, 15, 15, 0.2) 0px 5px 12px",
|
|
37
|
+
navbar: "var(--z-navbar)",
|
|
38
|
+
normal: "var(--z-normal)",
|
|
39
|
+
overlay: "var(--z-overlay)",
|
|
40
|
+
tooltip: "var(--z-tooltip)",
|
|
41
|
+
calendar: "var(--z-calendar)",
|
|
42
|
+
floating: "var(--z-floating)",
|
|
43
43
|
},
|
|
44
44
|
},
|
|
45
45
|
},
|
|
46
46
|
plugins: [
|
|
47
47
|
forms({ strategy: "class" }),
|
|
48
48
|
plugin(function (_a) {
|
|
49
|
-
var addVariant = _a.addVariant
|
|
49
|
+
var addVariant = _a.addVariant;
|
|
50
50
|
addVariant("link", ["&:hover", "&:active"]);
|
|
51
51
|
addVariant("hocus", ["&:hover", "&:focus"]);
|
|
52
52
|
addVariant("group-assert", [":merge(.group):valid:has(.input:valid:not(:placeholder-shown)) &"]);
|
|
53
|
+
addVariant("group-checkbox-checked", [":merge(&:has(.form-checkbox[type=checkbox]:checked))"]);
|
|
53
54
|
addVariant("group-error", [
|
|
54
55
|
":merge(.group):invalid:has(.input:not(:focus):invalid[data-initialized=true]) &",
|
|
55
56
|
":merge(.group[data-error=true]:has(.input[data-initialized=true])) &",
|
|
56
57
|
":merge(.group[data-error=true][data-interactive=true]):has(.input) &",
|
|
57
58
|
":merge(.group[data-error=true][data-interactive=true]):has(.input[data-initialized=true]) &",
|
|
58
59
|
]);
|
|
59
|
-
addVariant("group-checkbox-checked", [":merge(&:has(.form-checkbox[type=checkbox]:checked))"]);
|
|
60
60
|
}),
|
|
61
61
|
],
|
|
62
62
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ZIndex } from "./theme.types";
|
|
1
2
|
export declare const rounded: {
|
|
2
3
|
readonly button: "0.4rem";
|
|
3
4
|
readonly pill: "2rem";
|
|
@@ -8,10 +9,13 @@ export declare const spacing: {
|
|
|
8
9
|
readonly base: "1rem";
|
|
9
10
|
readonly lg: "1.5rem";
|
|
10
11
|
readonly sm: "0.75rem";
|
|
12
|
+
readonly "field-height": "1.5rem";
|
|
13
|
+
readonly "field-label": "1.875rem";
|
|
11
14
|
readonly "input-height": "2.5rem";
|
|
12
15
|
readonly "input-x": "0.5rem";
|
|
13
16
|
readonly "input-y": "0.25rem";
|
|
14
17
|
readonly "input-inline": "0.25rem";
|
|
15
18
|
readonly "input-gap": "0.3rem";
|
|
16
19
|
};
|
|
20
|
+
export declare const zIndex: ZIndex;
|
|
17
21
|
//# sourceMappingURL=common.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/styles/common.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO;;;;;CAKV,CAAC;AAEX,eAAO,MAAM,OAAO
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/styles/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,eAAO,MAAM,OAAO;;;;;CAKV,CAAC;AAEX,eAAO,MAAM,OAAO;;;;;;;;;;;CAWV,CAAC;AAEX,eAAO,MAAM,MAAM,EAAE,MAOX,CAAC"}
|
|
@@ -8,9 +8,19 @@ export var spacing = {
|
|
|
8
8
|
base: "1rem",
|
|
9
9
|
lg: "1.5rem",
|
|
10
10
|
sm: "0.75rem",
|
|
11
|
+
"field-height": "1.5rem",
|
|
12
|
+
"field-label": "1.875rem",
|
|
11
13
|
"input-height": "2.5rem",
|
|
12
14
|
"input-x": "0.5rem",
|
|
13
15
|
"input-y": "0.25rem",
|
|
14
16
|
"input-inline": "0.25rem",
|
|
15
17
|
"input-gap": "0.3rem",
|
|
16
18
|
};
|
|
19
|
+
export var zIndex = {
|
|
20
|
+
normal: "1",
|
|
21
|
+
navbar: "19",
|
|
22
|
+
calendar: "2",
|
|
23
|
+
overlay: "20",
|
|
24
|
+
tooltip: "13",
|
|
25
|
+
floating: "21",
|
|
26
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dark.d.ts","sourceRoot":"","sources":["../../../../src/styles/dark.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,eAAO,MAAM,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"dark.d.ts","sourceRoot":"","sources":["../../../../src/styles/dark.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,eAAO,MAAM,UAAU,EAAE,YA0MxB,CAAC"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { CSSProperties } from "react";
|
|
2
2
|
import { DesignTokens, DesignTokensBuilder, DesignTokensParser, GeneralTokens, Token } from "./theme.types";
|
|
3
3
|
export declare const parsers: {
|
|
4
|
-
cssVariable: (_: string, __: string, k: string) => `var(--${string})`;
|
|
5
|
-
rgba: (v: string) => `rgba(${string})`;
|
|
6
|
-
rgb: (v: string) => `rgb(${string})`;
|
|
7
|
-
hsl: (v: string) => `hsl(${string})`;
|
|
8
|
-
hsla: (v: string) => `hsla(${string})`;
|
|
9
4
|
hex: (v: string) => string;
|
|
10
5
|
raw: (v: string) => string;
|
|
6
|
+
hsl: (v: string) => `hsl(${string})`;
|
|
7
|
+
rgb: (v: string) => `rgb(${string})`;
|
|
8
|
+
z: (_: string, __: string, k: string) => `var(--z-${string})`;
|
|
9
|
+
hsla: (v: string) => `hsla(${string})`;
|
|
10
|
+
rgba: (v: string) => `rgba(${string})`;
|
|
11
|
+
cssVariable: (_: string, __: string, k: string) => `var(--${string})`;
|
|
11
12
|
formatWithVar: (format: string) => (_: string, __: string, v: string) => `${string}(var(--${string}), <alpha-value>)`;
|
|
12
13
|
};
|
|
13
14
|
export declare const reduceTokens: <T extends GeneralTokens>(colors: T, parse: DesignTokensBuilder, prefix?: string, append?: string) => Token[];
|
|
@@ -16,8 +17,8 @@ export declare const createStyles: {
|
|
|
16
17
|
default: (tokens: Token[]) => string;
|
|
17
18
|
dark: (tokens: Token[]) => string;
|
|
18
19
|
};
|
|
19
|
-
type TokenParsersType = "colors" | "spacing" | "rounded" | "customTokens";
|
|
20
|
-
type TokenCustomParser = (
|
|
20
|
+
type TokenParsersType = "colors" | "spacing" | "rounded" | "customTokens" | "zIndex";
|
|
21
|
+
type TokenCustomParser = (t: Token) => Token;
|
|
21
22
|
export type TokenRemap = Partial<Record<TokenParsersType, TokenCustomParser> & {
|
|
22
23
|
name: string;
|
|
23
24
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"design-tokens.d.ts","sourceRoot":"","sources":["../../../../src/styles/design-tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE5G,eAAO,MAAM,OAAO
|
|
1
|
+
{"version":3,"file":"design-tokens.d.ts","sourceRoot":"","sources":["../../../../src/styles/design-tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,kBAAkB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
12
12
|
export var parsers = {
|
|
13
|
-
cssVariable: function (_, __, k) { return "var(--".concat(k, ")"); },
|
|
14
|
-
rgba: function (v) { return "rgba(".concat(v, ")"); },
|
|
15
|
-
rgb: function (v) { return "rgb(".concat(v, ")"); },
|
|
16
|
-
hsl: function (v) { return "hsl(".concat(v, ")"); },
|
|
17
|
-
hsla: function (v) { return "hsla(".concat(v, ")"); },
|
|
18
13
|
hex: function (v) { return v; },
|
|
19
14
|
raw: function (v) { return v; },
|
|
15
|
+
hsl: function (v) { return "hsl(".concat(v, ")"); },
|
|
16
|
+
rgb: function (v) { return "rgb(".concat(v, ")"); },
|
|
17
|
+
z: function (_, __, k) { return "var(--z-".concat(k, ")"); },
|
|
18
|
+
hsla: function (v) { return "hsla(".concat(v, ")"); },
|
|
19
|
+
rgba: function (v) { return "rgba(".concat(v, ")"); },
|
|
20
|
+
cssVariable: function (_, __, k) { return "var(--".concat(k, ")"); },
|
|
20
21
|
formatWithVar: function (format) { return function (_, __, v) { return "".concat(format, "(var(--").concat(v, "), <alpha-value>)"); }; },
|
|
21
22
|
};
|
|
22
23
|
export var reduceTokens = function (colors, parse, prefix, append) {
|
|
@@ -59,18 +60,21 @@ export var createStyles = {
|
|
|
59
60
|
default: function (tokens) { return createStyleContent(tokens, { result: modifiers.default }); },
|
|
60
61
|
dark: function (tokens) { return createStyleContent(tokens, { result: modifiers.dark }); },
|
|
61
62
|
};
|
|
62
|
-
var
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return p ? p(r) : r;
|
|
67
|
-
};
|
|
63
|
+
var fn = function (p) {
|
|
64
|
+
return function (value, _, key) {
|
|
65
|
+
var r = { key: "--".concat(key), value: "".concat(value) };
|
|
66
|
+
return p ? p(r) : r;
|
|
68
67
|
};
|
|
68
|
+
};
|
|
69
|
+
var zIndexParser = function (t) { return ({ key: t.key.replace(/^--/, "--z-"), value: t.value }); };
|
|
70
|
+
var createTokens = function (theme, map) {
|
|
71
|
+
var _a;
|
|
69
72
|
var colors = reduceTokens(theme.colors, fn(map === null || map === void 0 ? void 0 : map.colors));
|
|
70
73
|
var spacing = reduceTokens(theme.spacing, fn(map === null || map === void 0 ? void 0 : map.spacing));
|
|
71
74
|
var rounded = reduceTokens(theme.rounded, fn(map === null || map === void 0 ? void 0 : map.rounded));
|
|
75
|
+
var zIndex = reduceTokens(theme.zIndex, fn((_a = map === null || map === void 0 ? void 0 : map.zIndex) !== null && _a !== void 0 ? _a : zIndexParser));
|
|
72
76
|
var customTokens = theme.custom ? reduceTokens(theme.custom, fn(map === null || map === void 0 ? void 0 : map.customTokens)) : [];
|
|
73
|
-
return colors.concat(spacing, rounded, customTokens);
|
|
77
|
+
return colors.concat(spacing, rounded, customTokens, zIndex);
|
|
74
78
|
};
|
|
75
79
|
export var createTheme = function (theme, name) {
|
|
76
80
|
return createStyleContent(createTokens(theme), {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"light.d.ts","sourceRoot":"","sources":["../../../../src/styles/light.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,eAAO,MAAM,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"light.d.ts","sourceRoot":"","sources":["../../../../src/styles/light.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,eAAO,MAAM,WAAW,EAAE,YA0MzB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { rounded, spacing } from "./common";
|
|
1
|
+
import { rounded, spacing, zIndex } from "./common";
|
|
2
2
|
export var LIGHT_THEME = {
|
|
3
3
|
rounded: rounded,
|
|
4
4
|
spacing: spacing,
|
|
@@ -6,6 +6,7 @@ export var LIGHT_THEME = {
|
|
|
6
6
|
shadow: {
|
|
7
7
|
floating: "rgba(50, 50, 50, 0.1) 0px 0px 0px 1px, rgba(50, 50, 50, 0.1) 0px 3px 6px, rgba(50, 50, 50, 0.1) 0px 2px 3px",
|
|
8
8
|
},
|
|
9
|
+
zIndex: zIndex,
|
|
9
10
|
colors: {
|
|
10
11
|
foreground: "hsla(217, 15%, 30%)",
|
|
11
12
|
background: "hsla(210, 34%, 96%)",
|
|
@@ -85,9 +86,9 @@ export var LIGHT_THEME = {
|
|
|
85
86
|
overlay: "hsla(0, 0%, 0%)",
|
|
86
87
|
},
|
|
87
88
|
table: {
|
|
88
|
-
header: "hsla(221,
|
|
89
|
+
header: "hsla(221, 20%, 97%)",
|
|
89
90
|
background: "hsla(0, 0%, 100%)",
|
|
90
|
-
border: "hsla(210,
|
|
91
|
+
border: "hsla(210, 20%, 92%)",
|
|
91
92
|
},
|
|
92
93
|
button: {
|
|
93
94
|
muted: {
|
|
@@ -125,8 +126,8 @@ export var LIGHT_THEME = {
|
|
|
125
126
|
},
|
|
126
127
|
tag: {
|
|
127
128
|
muted: {
|
|
128
|
-
bg: "hsla(210, 30%,
|
|
129
|
-
text: "hsla(210,
|
|
129
|
+
bg: "hsla(210, 30%, 92%)",
|
|
130
|
+
text: "hsla(210, 10%, 25%)",
|
|
130
131
|
},
|
|
131
132
|
primary: {
|
|
132
133
|
text: "hsla(0, 0%, 100%)",
|
|
@@ -15,11 +15,20 @@ type ComponentToken = {
|
|
|
15
15
|
background: string;
|
|
16
16
|
foreground: string;
|
|
17
17
|
};
|
|
18
|
+
export type ZIndex = {
|
|
19
|
+
navbar: `${number}`;
|
|
20
|
+
normal: `${number}`;
|
|
21
|
+
overlay: `${number}`;
|
|
22
|
+
tooltip: `${number}`;
|
|
23
|
+
calendar: `${number}`;
|
|
24
|
+
floating: `${number}`;
|
|
25
|
+
};
|
|
18
26
|
export type DesignTokens = {
|
|
19
27
|
name: string;
|
|
28
|
+
zIndex: ZIndex;
|
|
20
29
|
shadow: Record<"floating", string>;
|
|
21
|
-
rounded: Record<"button" | "full" | "pill" | "card", string>;
|
|
22
30
|
spacing: Record<"base" | "lg" | "sm", string>;
|
|
31
|
+
rounded: Record<"button" | "full" | "pill" | "card", string>;
|
|
23
32
|
custom?: Record<string, string>;
|
|
24
33
|
colors: {
|
|
25
34
|
disabled: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.types.d.ts","sourceRoot":"","sources":["../../../../src/styles/theme.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG;KAAG,CAAC,IAAI,MAAM,GAAG,MAAM,GAAG,aAAa;CAAE,CAAC;AAEtE,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAEhH,KAAK,WAAW,GAAG;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,KAAK,cAAc,GAAG;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"theme.types.d.ts","sourceRoot":"","sources":["../../../../src/styles/theme.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG;KAAG,CAAC,IAAI,MAAM,GAAG,MAAM,GAAG,aAAa;CAAE,CAAC;AAEtE,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAEhH,KAAK,WAAW,GAAG;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACtB,CAA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BAAkB,GACxB,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC,GACzD,CAAC,CAAC,MAAM,EAAE,MAAM,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;AAEpF,MAAM,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,KAAK,CAAC;AAEzF,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;AAE/B,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,aAAa,EAAE,CAAC,SAAS,EAAE,IAAI;KAC1D,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,aAAa,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,UAAU,CAAC,EAAE,CAAC;CACnF,CAAC"}
|
package/dist/preset.tailwind.js
CHANGED
|
@@ -11,40 +11,40 @@ const config = {
|
|
|
11
11
|
DEFAULT: "cubic-bezier(0,0,.58,1)",
|
|
12
12
|
normal: "cubic-bezier(.25,.1,.25,1)",
|
|
13
13
|
},
|
|
14
|
+
width: spacing,
|
|
14
15
|
spacing,
|
|
15
|
-
transitionDuration: { DEFAULT: "375ms" },
|
|
16
|
-
minWidth: { xs: "20rem", screen: "100vh" },
|
|
17
|
-
borderRadius: createDesignTokens(theme.rounded, parsers.cssVariable),
|
|
18
16
|
fill: COLORS,
|
|
19
17
|
colors: COLORS,
|
|
18
|
+
fontSize: spacing,
|
|
20
19
|
placeholderColor: COLORS,
|
|
20
|
+
transitionDuration: { DEFAULT: "375ms" },
|
|
21
|
+
minWidth: { xs: "20rem", screen: "100vh" },
|
|
21
22
|
borderColors: { ...COLORS, DEFAULT: COLORS.card.border },
|
|
23
|
+
borderRadius: createDesignTokens(theme.rounded, parsers.cssVariable),
|
|
24
|
+
boxShadow: { floating: "rgba(15, 15, 15, 0.1) 0px 0px 0px 1px, rgba(15, 15, 15, 0.1) 0px 3px 6px, rgba(15, 15, 15, 0.2) 0px 5px 12px" },
|
|
22
25
|
zIndex: {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
boxShadow: {
|
|
31
|
-
floating: "rgba(15, 15, 15, 0.1) 0px 0px 0px 1px, rgba(15, 15, 15, 0.1) 0px 3px 6px, rgba(15, 15, 15, 0.2) 0px 5px 12px",
|
|
26
|
+
navbar: "var(--z-navbar)",
|
|
27
|
+
normal: "var(--z-normal)",
|
|
28
|
+
overlay: "var(--z-overlay)",
|
|
29
|
+
tooltip: "var(--z-tooltip)",
|
|
30
|
+
calendar: "var(--z-calendar)",
|
|
31
|
+
floating: "var(--z-floating)",
|
|
32
32
|
},
|
|
33
33
|
},
|
|
34
34
|
},
|
|
35
35
|
plugins: [
|
|
36
36
|
forms({ strategy: "class" }),
|
|
37
|
-
plugin(function ({ addVariant
|
|
37
|
+
plugin(function ({ addVariant }) {
|
|
38
38
|
addVariant("link", ["&:hover", "&:active"]);
|
|
39
39
|
addVariant("hocus", ["&:hover", "&:focus"]);
|
|
40
40
|
addVariant("group-assert", [`:merge(.group):valid:has(.input:valid:not(:placeholder-shown)) &`]);
|
|
41
|
+
addVariant("group-checkbox-checked", [`:merge(&:has(.form-checkbox[type=checkbox]:checked))`]);
|
|
41
42
|
addVariant("group-error", [
|
|
42
43
|
`:merge(.group):invalid:has(.input:not(:focus):invalid[data-initialized=true]) &`,
|
|
43
44
|
`:merge(.group[data-error=true]:has(.input[data-initialized=true])) &`,
|
|
44
45
|
`:merge(.group[data-error=true][data-interactive=true]):has(.input) &`,
|
|
45
46
|
`:merge(.group[data-error=true][data-interactive=true]):has(.input[data-initialized=true]) &`,
|
|
46
47
|
]);
|
|
47
|
-
addVariant("group-checkbox-checked", [`:merge(&:has(.form-checkbox[type=checkbox]:checked))`]);
|
|
48
48
|
}),
|
|
49
49
|
],
|
|
50
50
|
};
|
|
@@ -3,7 +3,7 @@ import React from "react";
|
|
|
3
3
|
import { Label } from "../../types";
|
|
4
4
|
import { PolymorphicProps } from "./polymorph";
|
|
5
5
|
declare const indicatorVariant: (props?: ({
|
|
6
|
-
theme?: "
|
|
6
|
+
theme?: "info" | "warn" | "muted" | "danger" | "primary" | "success" | "secondary" | null | undefined;
|
|
7
7
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
8
8
|
declare const tagVariants: (props?: ({
|
|
9
9
|
size?: "big" | "small" | "default" | "icon" | null | undefined;
|
|
@@ -9,7 +9,7 @@ const indicatorVariant = cva("size-2.5 aspect-square rounded-full border-0", {
|
|
|
9
9
|
info: "bg-info",
|
|
10
10
|
warn: "bg-warn",
|
|
11
11
|
muted: "bg-muted",
|
|
12
|
-
|
|
12
|
+
primary: "bg-primary",
|
|
13
13
|
danger: "bg-danger",
|
|
14
14
|
success: "bg-success",
|
|
15
15
|
secondary: "bg-secondary",
|
|
@@ -40,5 +40,5 @@ const tagVariants = cva("inline-flex rounded-pill gap-1.5 border-2 border-transp
|
|
|
40
40
|
defaultVariants: { theme: "primary", size: "default" },
|
|
41
41
|
});
|
|
42
42
|
export const Tag = forwardRef(function Tag({ className, indicator = undefined, icon, loading, theme, size, ...props }, ref) {
|
|
43
|
-
return (_jsxs(Polymorph, { ...props, ref: ref, "data-theme": theme, "data-component": "tag", as: props.as ?? "span", className: css(tagVariants({ size, theme }), className), children: [indicator ? _jsx("span", { className: indicatorVariant({ theme: indicator }) }) : null, icon, props.children] }));
|
|
43
|
+
return (_jsxs(Polymorph, { ...props, ref: ref, "data-theme": theme, "data-component": "tag", as: props.as ?? "span", className: css(tagVariants({ size, theme }), className), children: [indicator ? _jsx("span", { "aria-hidden": "true", className: indicatorVariant({ theme: indicator }) }) : null, icon, props.children] }));
|
|
44
44
|
});
|
|
@@ -32,5 +32,5 @@ const alertVariants = cva("p-4 w-full block border relative rounded-lg text-sm",
|
|
|
32
32
|
});
|
|
33
33
|
export const Alert = forwardRef(function Alert({ className, theme, Icon, onClose, open = true, ...props }, ref) {
|
|
34
34
|
const close = () => onClose?.(false);
|
|
35
|
-
return (_jsx("div", { "data-open": !!open, "aria-hidden": !open, "data-component": "alert", className: css("isolate w-full", open ? "pointer-events-auto" : "pointer-events-none"), children: _jsx(Collapse, { "data-open": !!open, open: !!open, children: _jsxs(Polymorph, { ...props, ref: ref, role: "alert", "data-theme": theme, as: props.as ?? "div", className: css(alertVariants({ theme }), className), children: [_jsxs("h4", { className: "mb-2 flex items-center gap-2", children: [!Icon && theme === "success" ? _jsx(CheckCircleIcon, { size: 20 }) : null, !Icon && theme === "info" ? _jsx(InfoIcon, { size: 20 }) : null, !Icon && theme === "danger" ? _jsx(TriangleAlertIcon, { size: 20 }) : null, Icon, _jsx("span", { className: "tracking-3 text-balance text-lg font-semibold", children: props.title })] }), props.children, onClose !== undefined && open ? (_jsx("button", { type: "button", onClick: close, className: "absolute right-3 top-3 text-foreground transition-colors duration-300 ease-in-out hover:text-danger", children: _jsx(XIcon, { size: 20 }) })) : null] }) }) }));
|
|
35
|
+
return (_jsx("div", { "data-open": !!open, "aria-hidden": !open, "data-component": "alert", className: css("isolate w-full", open ? "pointer-events-auto" : "pointer-events-none"), children: _jsx(Collapse, { "data-open": !!open, open: !!open, children: _jsxs(Polymorph, { ...props, ref: ref, role: "alert", "data-theme": theme, as: props.as ?? "div", className: css(alertVariants({ theme }), className), children: [_jsxs("h4", { className: "mb-2 flex items-center gap-2", children: [!Icon && theme === "success" ? _jsx(CheckCircleIcon, { "aria-hidden": "true", size: 20 }) : null, !Icon && theme === "info" ? _jsx(InfoIcon, { "aria-hidden": "true", size: 20 }) : null, !Icon && theme === "danger" ? _jsx(TriangleAlertIcon, { "aria-hidden": "true", size: 20 }) : null, Icon, _jsx("span", { className: "tracking-3 text-balance text-lg font-semibold", children: props.title })] }), props.children, onClose !== undefined && open ? (_jsx("button", { type: "button", onClick: close, className: "absolute right-3 top-3 text-foreground transition-colors duration-300 ease-in-out hover:text-danger", children: _jsx(XIcon, { size: 20 }) })) : null] }) }) }));
|
|
36
36
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../../../src/components/display/calendar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../../../src/components/display/calendar.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAA4C,MAAM,OAAO,CAAC;AAEjE,OAAqB,EAAE,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAuB5D,KAAK,KAAK,GAAG;IAAE,IAAI,CAAC,EAAE,IAAI,CAAC;IAAC,EAAE,CAAC,EAAE,IAAI,CAAA;CAAE,CAAC;AAExC,KAAK,YAAY,GAAG,CAAC,CAAC,EAAE,IAAI,GAAG,SAAS,KAAK,IAAI,CAAC;AAElD,KAAK,aAAa,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,SAAS,KAAK,IAAI,CAAC;AAEpD,KAAK,SAAS,GAAG,CAAC,CAAC,EAAE,IAAI,KAAK,MAAM,CAAC;AAErC,KAAK,cAAc,GAAG,OAAO,CAAC;IAC1B,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,IAAI,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,MAAM,CAAC,CAAC;IAC1C,QAAQ,EAAE,MAAM,GAAG,CAAC,CAAC,WAAW,EAAE,IAAI,EAAE,KAAK,MAAM,CAAC,CAAC;CACxD,CAAC,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC;IAChC,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,EAAE,KAAK,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,cAAc,CAAC;IACvB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,MAAM,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5B,YAAY,EAAE,CAAC,CAAC,EAAE,IAAI,KAAK,IAAI,CAAC;IAChC,aAAa,EAAE,CAAC,CAAC,EAAE,IAAI,KAAK,IAAI,CAAC;IACjC,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE,CAAC,CAAC;IACtC,YAAY,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC;IACtC,QAAQ,EAAE,aAAa,GAAG,YAAY,CAAC;IACvC,UAAU,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CAC5C,CAAC,CAAC;AA0IH,eAAO,MAAM,QAAQ,GAAI,gKActB,aAAa,4CAkQf,CAAC"}
|
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
import { AnimatePresence, motion, MotionConfig } from "motion/react";
|
|
3
|
+
import { add, eachDayOfInterval, endOfWeek, isAfter, isBefore, isSameMonth, isToday, setYear, startOfDay, startOfMonth, startOfWeek, sub, } from "date-fns";
|
|
5
4
|
import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
|
5
|
+
import { AnimatePresence, motion, MotionConfig } from "motion/react";
|
|
6
6
|
import { useEffect, useRef } from "react";
|
|
7
7
|
import { Is } from "sidekicker";
|
|
8
8
|
import TheMaskInput from "the-mask-input";
|
|
9
9
|
import { useReducer } from "use-typed-reducer";
|
|
10
10
|
import { useDebounce } from "../../hooks/use-debounce";
|
|
11
11
|
import { useLocale } from "../../hooks/use-locale";
|
|
12
|
+
import { useSwipe } from "../../hooks/use-swipe";
|
|
12
13
|
import { useTranslations } from "../../hooks/use-translations";
|
|
13
14
|
import { css } from "../../lib/dom";
|
|
14
15
|
import { splitInto, uuid } from "../../lib/fns";
|
|
15
16
|
const transition = { type: "spring", bounce: 0.3, duration: 0.6 };
|
|
16
17
|
const dir = (mod) => (n = 1) => ({ x: `${100 * mod * n}%`, opacity: 0.25 });
|
|
17
18
|
const variants = {
|
|
18
|
-
middle: { x: "0%", opacity: 1 },
|
|
19
19
|
enter: dir(1),
|
|
20
20
|
exit: dir(-1),
|
|
21
|
+
middle: { x: "0%", opacity: 1 },
|
|
21
22
|
};
|
|
22
23
|
const removeImmediately = { exit: { visibility: "hidden" } };
|
|
23
24
|
const createDays = (month) => {
|
|
24
25
|
const start = startOfWeek(startOfMonth(month));
|
|
25
|
-
return eachDayOfInterval({ start, end:
|
|
26
|
+
return eachDayOfInterval({ start, end: add(start, { days: 41 }) });
|
|
26
27
|
};
|
|
27
28
|
const formatMonth = (d, locale) => d.toLocaleDateString(locale, { month: "long" });
|
|
28
29
|
const getOptionsMonth = (id, date, locale) => Array.from({ length: 12 }).map((_, i) => {
|
|
@@ -31,10 +32,10 @@ const getOptionsMonth = (id, date, locale) => Array.from({ length: 12 }).map((_,
|
|
|
31
32
|
return (_jsx("option", { value: label, "data-index": i, children: label }, `${id}-${label}`));
|
|
32
33
|
});
|
|
33
34
|
const onChangeUsingKeyboard = {
|
|
34
|
-
ArrowLeft: (date, duration) => (duration === "days" ?
|
|
35
|
-
ArrowRight: (date, duration) => (duration === "days" ?
|
|
36
|
-
ArrowUp: (date, duration) => (duration === "days" ?
|
|
37
|
-
ArrowDown: (date, duration) => (duration === "days" ?
|
|
35
|
+
ArrowLeft: (date, duration) => (duration === "days" ? sub(date, { days: 1 }) : sub(date, { months: 1 })),
|
|
36
|
+
ArrowRight: (date, duration) => (duration === "days" ? add(date, { days: 1 }) : add(date, { months: 1 })),
|
|
37
|
+
ArrowUp: (date, duration) => (duration === "days" ? sub(date, { weeks: 1 }) : sub(date, { years: 1 })),
|
|
38
|
+
ArrowDown: (date, duration) => (duration === "days" ? add(date, { weeks: 1 }) : add(date, { years: 1 })),
|
|
38
39
|
};
|
|
39
40
|
const focusDate = (origin, root, next, delay = 0) => {
|
|
40
41
|
const d = next.toISOString();
|
|
@@ -77,6 +78,7 @@ const CalendarBody = (props) => {
|
|
|
77
78
|
}) }, `week-${week.length}-${index}`));
|
|
78
79
|
}) }));
|
|
79
80
|
};
|
|
81
|
+
const setToday = () => startOfDay(new Date());
|
|
80
82
|
export const Calendar = ({ RenderOnDay, changeOnlyOnClick = false, labelRange, disabledDate, locale, markToday = true, onChangeMonth, onChangeYear, rangeMode = false, onChange, styles, markRange = true, ...props }) => {
|
|
81
83
|
const id = useRef(uuid());
|
|
82
84
|
const translations = useTranslations();
|
|
@@ -96,7 +98,6 @@ export const Calendar = ({ RenderOnDay, changeOnlyOnClick = false, labelRange, d
|
|
|
96
98
|
week: eachDayOfInterval({ start: startOfWeek(providedDate), end: endOfWeek(providedDate) }),
|
|
97
99
|
}, (get) => ({
|
|
98
100
|
onChangeYear: (year) => ({ year }),
|
|
99
|
-
setToday: () => ({ date: startOfDay(new Date()) }),
|
|
100
101
|
onExitComplete: () => {
|
|
101
102
|
focusDate(monthClicked.current || null, root, get.state().date, 200);
|
|
102
103
|
monthClicked.current = null;
|
|
@@ -107,19 +108,21 @@ export const Calendar = ({ RenderOnDay, changeOnlyOnClick = false, labelRange, d
|
|
|
107
108
|
return { date: newDate, year: formatYear(newDate) };
|
|
108
109
|
},
|
|
109
110
|
nextMonth: (e) => {
|
|
110
|
-
|
|
111
|
+
if (e)
|
|
112
|
+
monthClicked.current = e.currentTarget;
|
|
111
113
|
const state = get.state();
|
|
112
114
|
if (state.isAnimating)
|
|
113
115
|
return state;
|
|
114
|
-
const date =
|
|
116
|
+
const date = add(state.date, { months: 1 });
|
|
115
117
|
return { date, isAnimating: true, direction: 1, year: formatYear(date) };
|
|
116
118
|
},
|
|
117
119
|
previousMonth: (e) => {
|
|
118
|
-
|
|
120
|
+
if (e)
|
|
121
|
+
monthClicked.current = e.currentTarget;
|
|
119
122
|
const state = get.state();
|
|
120
123
|
if (state.isAnimating)
|
|
121
124
|
return state;
|
|
122
|
-
const date =
|
|
125
|
+
const date = sub(state.date, { months: 1 });
|
|
123
126
|
return { date, isAnimating: true, direction: -1, year: formatYear(date) };
|
|
124
127
|
},
|
|
125
128
|
onSelectDate: (e) => {
|
|
@@ -201,21 +204,19 @@ export const Calendar = ({ RenderOnDay, changeOnlyOnClick = false, labelRange, d
|
|
|
201
204
|
useEffect(() => {
|
|
202
205
|
if (!changeOnlyOnClick)
|
|
203
206
|
onChange?.(state.date);
|
|
204
|
-
}, [currentAsString]);
|
|
205
|
-
const defer = useDebounce((y) =>
|
|
206
|
-
dispatch.date((prev) => {
|
|
207
|
-
const d = new Date(prev);
|
|
208
|
-
d.setFullYear(+y);
|
|
209
|
-
return d;
|
|
210
|
-
});
|
|
211
|
-
}, 1200);
|
|
207
|
+
}, [currentAsString, changeOnlyOnClick]);
|
|
208
|
+
const defer = useDebounce((y) => dispatch.date((prev) => setYear(new Date(prev), +y)), 1200);
|
|
212
209
|
const internalOnChangeYear = (e) => {
|
|
213
210
|
const value = e.currentTarget.value;
|
|
214
211
|
dispatch.onChangeYear(value);
|
|
215
212
|
onChangeYear?.(new Date(value));
|
|
216
213
|
defer(value);
|
|
217
214
|
};
|
|
218
|
-
|
|
215
|
+
const swipe = useSwipe((event, direction) => {
|
|
216
|
+
event.preventDefault();
|
|
217
|
+
return direction === "right" ? dispatch.previousMonth() : dispatch.nextMonth();
|
|
218
|
+
}, 10);
|
|
219
|
+
return (_jsx(MotionConfig, { transition: transition, children: _jsxs("div", { ref: root, "data-component": "calendar", onTouchEnd: swipe.onTouchEnd, onTouchStart: swipe.onTouchStart, className: css("relative overflow-hidden", Is.function(styles?.calendar) ? styles?.calendar(allDaysOfMonth) : styles?.calendar), children: [_jsx("div", { className: "flex flex-col justify-center rounded text-center", children: _jsx(AnimatePresence, { initial: false, mode: "popLayout", custom: state.direction, onExitComplete: dispatch.onExitComplete, children: _jsxs(motion.div, { initial: "enter", animate: "middle", exit: "exit", children: [_jsxs("header", { className: "relative flex justify-between", children: [_jsx(motion.button, { layout: true, type: "button", "data-focustrap": "prev", variants: removeImmediately, onClick: dispatch.previousMonth, title: translations.calendarBackMonth, className: "z-calendar rounded-full p-1.5 hover:bg-primary hover:text-primary-foreground", children: _jsx(ChevronLeftIcon, { className: "h-4 w-4" }) }), _jsx(motion.span, { layout: true, variants: variants, custom: state.direction, className: "absolute inset-0 isolate z-normal flex items-center justify-center font-semibold", children: _jsxs("span", { className: "flex w-fit items-center justify-center gap-0.5 py-1", children: [_jsx("select", { value: monthString, onChange: dispatch.onChangeMonth, "aria-label": translations.calendarMonthLabel, style: { width: `${monthString.length + 1}ch` }, className: "cursor-pointer appearance-none bg-transparent capitalize proportional-nums hover:text-primary", children: state.months }), _jsx(TheMaskInput, { mask: "int", maxLength: 4, placeholder: "YYYY", value: state.year, onChange: internalOnChangeYear, style: { width: `${state.year.length}ch` }, className: "w-16 cursor-pointer appearance-none bg-transparent hover:text-primary" })] }) }), _jsx(motion.button, { layout: true, type: "button", "data-focustrap": "next", variants: removeImmediately, onClick: dispatch.nextMonth, title: translations.calendarNextMonth, className: "z-calendar rounded-full p-1.5 hover:bg-primary hover:text-primary-foreground", children: _jsx(ChevronRightIcon, { className: "h-4 w-4" }) }), _jsx("div", { className: "absolute inset-0", style: {
|
|
219
220
|
backgroundImage: "linear-gradient(to right, hsla(var(--card-background)) 15%, transparent 30%, transparent 70%, hsla(var(--card-background)) 85%)",
|
|
220
|
-
} })] }), _jsxs(motion.table, { className: "mt-2 table min-w-full table-auto border-0", children: [_jsx("thead", { children: _jsx("tr", { children: state.week.map((dayOfWeek) => (_jsx("th", { role: "columnheader", className: css("py-2 text-sm font-medium capitalize", Is.function(styles?.weekDay) ? styles.weekDay(dayOfWeek) : styles?.weekDay), children: dayOfWeek.toLocaleDateString(currentLocale, { weekday: "short" }) }, dayOfWeek.toString()))) }) }), _jsx(CalendarBody, { zip: zip, range: range, styles: styles, date: date || null, dispatch: dispatch, markRange: markRange, markToday: markToday, rangeMode: rangeMode, stateDate: state.date, labelRange: labelRange, stateRange: state.range, RenderOnDay: RenderOnDay, direction: state.direction, disabledDate: disabledDate, onKeyDown: dispatch.onKeyDown })] })] }, monthString) }) }), _jsx("footer", { className: "mt-2 text-center text-primary", children: _jsx("button", { className: "transition-transform duration-300 hover:scale-105",
|
|
221
|
+
} })] }), _jsxs(motion.table, { className: "mt-2 table min-w-full table-auto border-0", children: [_jsx("thead", { children: _jsx("tr", { children: state.week.map((dayOfWeek) => (_jsx("th", { role: "columnheader", className: css("py-2 text-sm font-medium capitalize", Is.function(styles?.weekDay) ? styles.weekDay(dayOfWeek) : styles?.weekDay), children: dayOfWeek.toLocaleDateString(currentLocale, { weekday: "short" }) }, dayOfWeek.toString()))) }) }), _jsx(CalendarBody, { zip: zip, range: range, styles: styles, date: date || null, dispatch: dispatch, markRange: markRange, markToday: markToday, rangeMode: rangeMode, stateDate: state.date, labelRange: labelRange, stateRange: state.range, RenderOnDay: RenderOnDay, direction: state.direction, disabledDate: disabledDate, onKeyDown: dispatch.onKeyDown })] })] }, monthString) }) }), _jsx("footer", { className: "mt-2 text-center text-primary", children: _jsx("button", { type: "button", onClick: () => dispatch.date(setToday), className: "transition-transform duration-300 hover:scale-105", children: translations.calendarToday }) })] }) }));
|
|
221
222
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { css } from "../../lib/dom";
|
|
3
3
|
import { Polymorph } from "../core/polymorph";
|
|
4
|
-
export const Card = ({ children, title, titleClassName = "", as = "div", container = "", header = null, className = "", ...props }) => (_jsxs(Polymorph, { ...props, as: as, "data-componen": "card", className: css("flex flex-col gap-4 rounded-card border border-card-border bg-card-background py-4 pb-8 shadow", container), children: [title ? (_jsx("header", { className: css("mb-2 w-full border-b border-card-border px-8 pb-4 text-xl font-medium", titleClassName), children: title })) : (header), _jsx("div", { className: css("min-w-full px-8", className), children: children })] }));
|
|
4
|
+
export const Card = ({ children, title, titleClassName = "", as = "div", container = "", header = null, className = "", ...props }) => (_jsxs(Polymorph, { ...props, as: as, "data-componen": "card", className: css("flex flex-col gap-4 rounded-card border border-card-border bg-card-background py-4 pb-8 shadow", container), children: [title ? (_jsx("header", { className: css("mb-2 w-full border-b border-card-border lg:px-8 px-4 pb-4 text-xl font-medium", titleClassName), children: title })) : (header), _jsx("div", { className: css("min-w-full lg:px-8 px-4", className), children: children })] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"empty.d.ts","sourceRoot":"","sources":["../../../../src/components/display/empty.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAY,MAAM,cAAc,CAAC;AAC1D,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"empty.d.ts","sourceRoot":"","sources":["../../../../src/components/display/empty.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAY,MAAM,cAAc,CAAC;AAC1D,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,MAAM,UAAU,GAAG;IAAE,IAAI,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAAC,CAAA;CAAE,CAAC;AAE1D,eAAO,MAAM,KAAK,GAAI,OAAO,UAAU,4CAStC,CAAC"}
|
|
@@ -14,7 +14,7 @@ export const AnimatedList = (props) => {
|
|
|
14
14
|
onOpenChange: (open) => (open ? undefined : setSelected(null)),
|
|
15
15
|
});
|
|
16
16
|
const click = useClick(context);
|
|
17
|
-
const role = useRole(context);
|
|
17
|
+
const role = useRole(context, { role: "dialog" });
|
|
18
18
|
const dismiss = useDismiss(context, { escapeKey: true, referencePress: true, outsidePress: true });
|
|
19
19
|
const { getFloatingProps } = useInteractions([click, role, dismiss]);
|
|
20
20
|
const clear = useCallback(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../../../src/components/display/tabs.tsx"],"names":[],"mappings":"AAEA,OAAc,EAA2B,iBAAiB,EAAiC,MAAM,OAAO,CAAC;AAGzG,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../../../src/components/display/tabs.tsx"],"names":[],"mappings":"AAEA,OAAc,EAA2B,iBAAiB,EAAiC,MAAM,OAAO,CAAC;AAGzG,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAIpC,MAAM,MAAM,SAAS,GAAG;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC,CAAC;AAIF,eAAO,MAAM,IAAI,GAAI,OAAO,iBAAiB,CAAC,SAAS,CAAC,4CA2FvD,CAAC;AAIF,MAAM,MAAM,QAAQ,GACd;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,CAAA;CAAE,GAChD;IACI,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;CACjB,CAAC;AAER,eAAO,MAAM,GAAG,GAAI,OAAO,iBAAiB,CAAC,QAAQ,CAAC,4CAGrD,CAAC"}
|
|
@@ -4,6 +4,7 @@ import { useMotionValue } from "motion/react";
|
|
|
4
4
|
import React, { createContext, Fragment, useContext, useEffect, useRef } from "react";
|
|
5
5
|
import { useReactive } from "../../hooks/use-reactive";
|
|
6
6
|
import { useStableRef } from "../../hooks/use-stable-ref";
|
|
7
|
+
import { Polymorph } from "../core/polymorph";
|
|
7
8
|
import { Card } from "./card";
|
|
8
9
|
const Context = createContext("");
|
|
9
10
|
export const Tabs = (props) => {
|
|
@@ -11,7 +12,6 @@ export const Tabs = (props) => {
|
|
|
11
12
|
const left = useMotionValue(0);
|
|
12
13
|
const width = useMotionValue(0);
|
|
13
14
|
const ref = useRef(null);
|
|
14
|
-
const Render = props.useHash ? "a" : "button";
|
|
15
15
|
useEffect(() => {
|
|
16
16
|
const header = ref.current;
|
|
17
17
|
if (header === null)
|
|
@@ -57,7 +57,7 @@ export const Tabs = (props) => {
|
|
|
57
57
|
};
|
|
58
58
|
return (_jsx(Context.Provider, { value: active, children: _jsx(Card, { className: props.className, container: "pt-0 max-w-full w-full min-w-0", header: _jsx("header", { ref: ref, className: "relative mb-2 overflow-x-auto border-b border-card-border", children: _jsx("nav", { className: "min-w-0", children: _jsx("ul", { className: "flex w-0 min-w-full flex-1 justify-start overflow-x-auto", children: items.map((x) => {
|
|
59
59
|
const inner = x.props;
|
|
60
|
-
return (_jsx("li", { "data-id": inner.id, "data-active": active === inner.id, className: "w-full border-b-2 transition-all border-card-border data-[active=true]:border-primary data-[active=true]:text-primary", children: _jsx(
|
|
60
|
+
return (_jsx("li", { "data-id": inner.id, "data-active": active === inner.id, className: "w-full border-b-2 transition-all border-card-border data-[active=true]:border-primary data-[active=true]:text-primary", children: _jsx(Polymorph, { onClick: onClick, "data-id": inner.id, "aria-current": "page", as: props.useHash ? "a" : "button", href: props.useHash ? `#${inner.id}` : undefined, className: "block w-full whitespace-nowrap px-10 py-4", children: inner.title }) }, `tab-header-${inner.id}`));
|
|
61
61
|
}) }) }) }), children: props.children }) }));
|
|
62
62
|
};
|
|
63
63
|
const useTabs = () => useContext(Context);
|