@rark-ui/themes 1.2.0 → 1.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/.tsbuildinfo +1 -1
- package/dist/default/crafts/message.js +1 -1
- package/dist/default/crafts/toast.js +1 -1
- package/dist/default/index.css +0 -239
- package/dist/razer/index.css +4 -329
- package/package.json +11 -8
- package/src/default/crafts/badge.ts +56 -56
- package/src/default/crafts/button.ts +68 -68
- package/src/default/crafts/checkbox.ts +75 -75
- package/src/default/crafts/collapsible.ts +61 -61
- package/src/default/crafts/date-picker.ts +261 -261
- package/src/default/crafts/dialog.ts +103 -103
- package/src/default/crafts/editable.ts +108 -108
- package/src/default/crafts/floating-panel.ts +71 -71
- package/src/default/crafts/hotkey.ts +24 -24
- package/src/default/crafts/hover-card.ts +83 -83
- package/src/default/crafts/icon.ts +15 -15
- package/src/default/crafts/index.ts +62 -62
- package/src/default/crafts/input.ts +50 -50
- package/src/default/crafts/menu.ts +118 -118
- package/src/default/crafts/message.ts +66 -66
- package/src/default/crafts/number-input.ts +51 -51
- package/src/default/crafts/pagination.ts +120 -120
- package/src/default/crafts/popover.ts +74 -74
- package/src/default/crafts/progress.ts +131 -131
- package/src/default/crafts/radio-group.ts +100 -100
- package/src/default/crafts/rating-group.ts +46 -46
- package/src/default/crafts/scroll-area.ts +116 -116
- package/src/default/crafts/select.ts +122 -122
- package/src/default/crafts/skeleton.ts +23 -23
- package/src/default/crafts/slider.ts +93 -93
- package/src/default/crafts/spin.ts +64 -64
- package/src/default/crafts/switch.ts +71 -71
- package/src/default/crafts/tabs.ts +122 -122
- package/src/default/crafts/tags-input.ts +81 -81
- package/src/default/crafts/toast.ts +70 -70
- package/src/default/crafts/toggle-group.ts +57 -57
- package/src/default/crafts/toggle.ts +34 -34
- package/src/default/crafts/tooltip.ts +63 -63
- package/src/default/crafts/tree.ts +165 -165
- package/src/default/index.ts +4 -4
- package/src/default/tailwind.config.ts +2 -0
- package/src/razer/components/arrow.css +19 -19
- package/src/razer/components/badge.css +12 -12
- package/src/razer/components/button.css +39 -39
- package/src/razer/components/checkbox.css +39 -39
- package/src/razer/components/collapsible.css +16 -16
- package/src/razer/components/date-picker.css +46 -46
- package/src/razer/components/dialog.css +28 -28
- package/src/razer/components/editable.css +26 -26
- package/src/razer/components/floating-panel.css +10 -10
- package/src/razer/components/hotkey.css +4 -4
- package/src/razer/components/hover-card.css +14 -14
- package/src/razer/components/input.css +29 -29
- package/src/razer/components/menu.css +47 -47
- package/src/razer/components/message.css +41 -41
- package/src/razer/components/number-input.css +8 -8
- package/src/razer/components/pagination.css +13 -13
- package/src/razer/components/popover.css +19 -19
- package/src/razer/components/progress.css +78 -78
- package/src/razer/components/radio-group.css +44 -44
- package/src/razer/components/rating-group.css +26 -26
- package/src/razer/components/scroll-area.css +13 -13
- package/src/razer/components/select.css +31 -31
- package/src/razer/components/skeleton.css +10 -10
- package/src/razer/components/slider.css +27 -27
- package/src/razer/components/spin.css +14 -14
- package/src/razer/components/switch.css +24 -24
- package/src/razer/components/tabs.css +10 -10
- package/src/razer/components/tags-input.css +16 -16
- package/src/razer/components/toast.css +41 -41
- package/src/razer/components/toggle-group.css +19 -19
- package/src/razer/components/toggle.css +16 -16
- package/src/razer/components/tooltip.css +16 -16
- package/src/razer/components/tree.css +18 -18
- package/src/razer/components/virtual.css +16 -16
- package/src/razer/crafts/index.ts +16 -16
- package/src/razer/index.ts +4 -4
- package/src/razer/preset.css +261 -261
- package/src/razer/tailwind.config.ts +2 -0
- package/src/shared/css/animation-easing.css +21 -21
- package/src/shared/css/animations.css +252 -252
- package/src/shared/css/index.css +2 -2
- package/src/shared/css/static.css +31 -31
- package/src/shared/utils/tv.ts +91 -91
package/src/shared/utils/tv.ts
CHANGED
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
ClassValue,
|
|
3
|
-
TVCompoundSlots,
|
|
4
|
-
TVCompoundVariants,
|
|
5
|
-
TVDefaultVariants,
|
|
6
|
-
TVReturnType,
|
|
7
|
-
TVVariants,
|
|
8
|
-
} from 'tailwind-variants'
|
|
9
|
-
import { tv as originTv } from 'tailwind-variants'
|
|
10
|
-
|
|
11
|
-
type TVSlots = Record<string, ClassValue> | undefined
|
|
12
|
-
export type { VariantProps } from 'tailwind-variants'
|
|
13
|
-
|
|
14
|
-
export function tv<
|
|
15
|
-
V extends TVVariants<S, B, EV>,
|
|
16
|
-
CV extends TVCompoundVariants<V, S, B, EV, ES>,
|
|
17
|
-
DV extends TVDefaultVariants<V, S, EV, ES>,
|
|
18
|
-
B extends ClassValue = undefined,
|
|
19
|
-
S extends TVSlots = undefined,
|
|
20
|
-
// @ts-expect-error error in tailwind-variants
|
|
21
|
-
E extends TVReturnType = TVReturnType<
|
|
22
|
-
V,
|
|
23
|
-
S,
|
|
24
|
-
B,
|
|
25
|
-
// @ts-expect-error error in tailwind-variants
|
|
26
|
-
EV extends undefined ? {} : EV,
|
|
27
|
-
// @ts-expect-error error in tailwind-variants
|
|
28
|
-
ES extends undefined ? {} : ES
|
|
29
|
-
>,
|
|
30
|
-
EV extends TVVariants<ES, B, E['variants'], ES> = E['variants'],
|
|
31
|
-
ES extends TVSlots = E['slots'] extends TVSlots ? E['slots'] : undefined,
|
|
32
|
-
>(
|
|
33
|
-
options: {
|
|
34
|
-
extend?: E
|
|
35
|
-
base?: B
|
|
36
|
-
slots?: S
|
|
37
|
-
variants?: V
|
|
38
|
-
compoundVariants?: CV
|
|
39
|
-
compoundSlots?: TVCompoundSlots<V & { unstyled: { true: ClassValue, false: ClassValue } }, S, B>
|
|
40
|
-
defaultVariants?: DV
|
|
41
|
-
},
|
|
42
|
-
ruiConfig?: {
|
|
43
|
-
class?: ClassValue
|
|
44
|
-
className?: ClassValue
|
|
45
|
-
slots?: Record<keyof S, ClassValue>
|
|
46
|
-
},
|
|
47
|
-
config?: any,
|
|
48
|
-
) {
|
|
49
|
-
type mergedV = V & { unstyled: { true: ClassValue, false: ClassValue } }
|
|
50
|
-
|
|
51
|
-
// fix: extend时, ruiConfig丢失
|
|
52
|
-
const _ruiConfig = ruiConfig ?? options.extend?._ruiConfig
|
|
53
|
-
const variants = {
|
|
54
|
-
...(options.variants ?? {}),
|
|
55
|
-
unstyled: {
|
|
56
|
-
true: '',
|
|
57
|
-
false: _ruiConfig?.class ?? _ruiConfig?.className ?? '',
|
|
58
|
-
},
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const unstyledCompoundSlots: any[] = []
|
|
62
|
-
for (const key in _ruiConfig?.slots) {
|
|
63
|
-
unstyledCompoundSlots.push({
|
|
64
|
-
slots: [key],
|
|
65
|
-
unstyled: false,
|
|
66
|
-
class: _ruiConfig?.slots[key],
|
|
67
|
-
})
|
|
68
|
-
}
|
|
69
|
-
options.variants = variants as V
|
|
70
|
-
options.defaultVariants = {
|
|
71
|
-
...(options.defaultVariants ?? {}),
|
|
72
|
-
unstyled: false,
|
|
73
|
-
} as unknown as DV
|
|
74
|
-
|
|
75
|
-
options.compoundSlots = (options.compoundSlots ?? []).concat(unstyledCompoundSlots)
|
|
76
|
-
|
|
77
|
-
const result: any = originTv(options as any, config)
|
|
78
|
-
result._ruiConfig = ruiConfig
|
|
79
|
-
return result as ReturnType<
|
|
80
|
-
typeof originTv<
|
|
81
|
-
mergedV,
|
|
82
|
-
TVCompoundVariants<mergedV, S, B, EV, ES>,
|
|
83
|
-
TVDefaultVariants<mergedV, S, EV, ES>,
|
|
84
|
-
B,
|
|
85
|
-
S,
|
|
86
|
-
E,
|
|
87
|
-
EV,
|
|
88
|
-
ES
|
|
89
|
-
>
|
|
90
|
-
>
|
|
91
|
-
}
|
|
1
|
+
import type {
|
|
2
|
+
ClassValue,
|
|
3
|
+
TVCompoundSlots,
|
|
4
|
+
TVCompoundVariants,
|
|
5
|
+
TVDefaultVariants,
|
|
6
|
+
TVReturnType,
|
|
7
|
+
TVVariants,
|
|
8
|
+
} from 'tailwind-variants'
|
|
9
|
+
import { tv as originTv } from 'tailwind-variants'
|
|
10
|
+
|
|
11
|
+
type TVSlots = Record<string, ClassValue> | undefined
|
|
12
|
+
export type { VariantProps } from 'tailwind-variants'
|
|
13
|
+
|
|
14
|
+
export function tv<
|
|
15
|
+
V extends TVVariants<S, B, EV>,
|
|
16
|
+
CV extends TVCompoundVariants<V, S, B, EV, ES>,
|
|
17
|
+
DV extends TVDefaultVariants<V, S, EV, ES>,
|
|
18
|
+
B extends ClassValue = undefined,
|
|
19
|
+
S extends TVSlots = undefined,
|
|
20
|
+
// @ts-expect-error error in tailwind-variants
|
|
21
|
+
E extends TVReturnType = TVReturnType<
|
|
22
|
+
V,
|
|
23
|
+
S,
|
|
24
|
+
B,
|
|
25
|
+
// @ts-expect-error error in tailwind-variants
|
|
26
|
+
EV extends undefined ? {} : EV,
|
|
27
|
+
// @ts-expect-error error in tailwind-variants
|
|
28
|
+
ES extends undefined ? {} : ES
|
|
29
|
+
>,
|
|
30
|
+
EV extends TVVariants<ES, B, E['variants'], ES> = E['variants'],
|
|
31
|
+
ES extends TVSlots = E['slots'] extends TVSlots ? E['slots'] : undefined,
|
|
32
|
+
>(
|
|
33
|
+
options: {
|
|
34
|
+
extend?: E
|
|
35
|
+
base?: B
|
|
36
|
+
slots?: S
|
|
37
|
+
variants?: V
|
|
38
|
+
compoundVariants?: CV
|
|
39
|
+
compoundSlots?: TVCompoundSlots<V & { unstyled: { true: ClassValue, false: ClassValue } }, S, B>
|
|
40
|
+
defaultVariants?: DV
|
|
41
|
+
},
|
|
42
|
+
ruiConfig?: {
|
|
43
|
+
class?: ClassValue
|
|
44
|
+
className?: ClassValue
|
|
45
|
+
slots?: Record<keyof S, ClassValue>
|
|
46
|
+
},
|
|
47
|
+
config?: any,
|
|
48
|
+
) {
|
|
49
|
+
type mergedV = V & { unstyled: { true: ClassValue, false: ClassValue } }
|
|
50
|
+
|
|
51
|
+
// fix: extend时, ruiConfig丢失
|
|
52
|
+
const _ruiConfig = ruiConfig ?? options.extend?._ruiConfig
|
|
53
|
+
const variants = {
|
|
54
|
+
...(options.variants ?? {}),
|
|
55
|
+
unstyled: {
|
|
56
|
+
true: '',
|
|
57
|
+
false: _ruiConfig?.class ?? _ruiConfig?.className ?? '',
|
|
58
|
+
},
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const unstyledCompoundSlots: any[] = []
|
|
62
|
+
for (const key in _ruiConfig?.slots) {
|
|
63
|
+
unstyledCompoundSlots.push({
|
|
64
|
+
slots: [key],
|
|
65
|
+
unstyled: false,
|
|
66
|
+
class: _ruiConfig?.slots[key],
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
options.variants = variants as V
|
|
70
|
+
options.defaultVariants = {
|
|
71
|
+
...(options.defaultVariants ?? {}),
|
|
72
|
+
unstyled: false,
|
|
73
|
+
} as unknown as DV
|
|
74
|
+
|
|
75
|
+
options.compoundSlots = (options.compoundSlots ?? []).concat(unstyledCompoundSlots)
|
|
76
|
+
|
|
77
|
+
const result: any = originTv(options as any, config)
|
|
78
|
+
result._ruiConfig = ruiConfig
|
|
79
|
+
return result as ReturnType<
|
|
80
|
+
typeof originTv<
|
|
81
|
+
mergedV,
|
|
82
|
+
TVCompoundVariants<mergedV, S, B, EV, ES>,
|
|
83
|
+
TVDefaultVariants<mergedV, S, EV, ES>,
|
|
84
|
+
B,
|
|
85
|
+
S,
|
|
86
|
+
E,
|
|
87
|
+
EV,
|
|
88
|
+
ES
|
|
89
|
+
>
|
|
90
|
+
>
|
|
91
|
+
}
|