@tuuject/koi-react 0.0.0-stage → 0.1.0
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/LICENSE +21 -0
- package/README.md +73 -2
- package/dist/alert/Alert.d.ts +13 -0
- package/dist/alert/Alert.js +16 -0
- package/dist/avatar/Avatar.d.ts +7 -0
- package/dist/avatar/Avatar.js +10 -0
- package/dist/badge/Badge.d.ts +7 -0
- package/dist/badge/Badge.js +8 -0
- package/dist/button/Button.d.ts +22 -0
- package/dist/button/Button.js +28 -0
- package/dist/card/Card.d.ts +9 -0
- package/dist/card/Card.js +8 -0
- package/dist/chat-bubble/ChatBubble.d.ts +7 -0
- package/dist/chat-bubble/ChatBubble.js +7 -0
- package/dist/checkbox/Checkbox.d.ts +18 -0
- package/dist/checkbox/Checkbox.js +25 -0
- package/dist/dialog/Dialog.d.ts +13 -0
- package/dist/dialog/Dialog.js +38 -0
- package/dist/divider/Divider.d.ts +6 -0
- package/dist/divider/Divider.js +17 -0
- package/dist/field/Field.d.ts +14 -0
- package/dist/field/Field.js +19 -0
- package/dist/field/context.d.ts +5 -0
- package/dist/field/context.js +2 -0
- package/dist/icons.d.ts +26 -0
- package/dist/icons.js +46 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +30 -0
- package/dist/input/Input.d.ts +9 -0
- package/dist/input/Input.js +15 -0
- package/dist/link/Link.d.ts +11 -0
- package/dist/link/Link.js +17 -0
- package/dist/pagination/Pagination.d.ts +7 -0
- package/dist/pagination/Pagination.js +26 -0
- package/dist/panda/buildinfo.json +10442 -0
- package/dist/panda/lib.json +18 -0
- package/dist/panda/preset.mjs +3907 -0
- package/dist/progress/Progress.d.ts +7 -0
- package/dist/progress/Progress.js +17 -0
- package/dist/prose/Prose.d.ts +10 -0
- package/dist/prose/Prose.js +10 -0
- package/dist/radio-group/RadioGroup.d.ts +15 -0
- package/dist/radio-group/RadioGroup.js +26 -0
- package/dist/select/Select.d.ts +11 -0
- package/dist/select/Select.js +21 -0
- package/dist/select/SelectPanel.d.ts +24 -0
- package/dist/select/SelectPanel.js +105 -0
- package/dist/shape.d.ts +16 -0
- package/dist/shape.js +17 -0
- package/dist/skeleton/Skeleton.d.ts +8 -0
- package/dist/skeleton/Skeleton.js +8 -0
- package/dist/spinner/Spinner.d.ts +7 -0
- package/dist/spinner/Spinner.js +13 -0
- package/dist/switch/Switch.d.ts +22 -0
- package/dist/switch/Switch.js +23 -0
- package/dist/table/DataTable.d.ts +12 -0
- package/dist/table/DataTable.js +12 -0
- package/dist/table/Table.d.ts +38 -0
- package/dist/table/Table.js +45 -0
- package/dist/tabs/Tabs.d.ts +11 -0
- package/dist/tabs/Tabs.js +20 -0
- package/dist/tag/Tag.d.ts +6 -0
- package/dist/tag/Tag.js +15 -0
- package/dist/textarea/Textarea.d.ts +9 -0
- package/dist/textarea/Textarea.js +14 -0
- package/dist/toast/Toast.d.ts +23 -0
- package/dist/toast/Toast.js +80 -0
- package/dist/tooltip/Tooltip.d.ts +9 -0
- package/dist/tooltip/Tooltip.js +29 -0
- package/dist/types.d.ts +11 -0
- package/dist/types.js +1 -0
- package/package.json +218 -3
- package/styled-system/css/conditions.d.ts +7 -0
- package/styled-system/css/conditions.js +32 -0
- package/styled-system/css/css.d.ts +22 -0
- package/styled-system/css/css.js +63 -0
- package/styled-system/css/cva.d.ts +5 -0
- package/styled-system/css/cva.js +51 -0
- package/styled-system/css/cx.d.ts +6 -0
- package/styled-system/css/cx.js +16 -0
- package/styled-system/css/first-that-works.d.ts +22 -0
- package/styled-system/css/first-that-works.js +1 -0
- package/styled-system/css/index.d.ts +8 -0
- package/styled-system/css/index.js +8 -0
- package/styled-system/css/keyframes.d.ts +5 -0
- package/styled-system/css/keyframes.js +8 -0
- package/styled-system/css/position-try.d.ts +5 -0
- package/styled-system/css/position-try.js +11 -0
- package/styled-system/css/sva.d.ts +3 -0
- package/styled-system/css/sva.js +49 -0
- package/styled-system/css/view-transition.d.ts +7 -0
- package/styled-system/css/view-transition.js +18 -0
- package/styled-system/helpers.d.ts +67 -0
- package/styled-system/helpers.js +624 -0
- package/styled-system/jsx/aspect-ratio.d.ts +7 -0
- package/styled-system/jsx/aspect-ratio.js +11 -0
- package/styled-system/jsx/bleed.d.ts +7 -0
- package/styled-system/jsx/bleed.js +11 -0
- package/styled-system/jsx/box.d.ts +7 -0
- package/styled-system/jsx/box.js +11 -0
- package/styled-system/jsx/center.d.ts +7 -0
- package/styled-system/jsx/center.js +11 -0
- package/styled-system/jsx/circle.d.ts +7 -0
- package/styled-system/jsx/circle.js +11 -0
- package/styled-system/jsx/container.d.ts +7 -0
- package/styled-system/jsx/container.js +11 -0
- package/styled-system/jsx/cq.d.ts +7 -0
- package/styled-system/jsx/cq.js +11 -0
- package/styled-system/jsx/create-recipe-context.d.ts +32 -0
- package/styled-system/jsx/create-recipe-context.js +38 -0
- package/styled-system/jsx/create-slot-recipe-context.d.ts +48 -0
- package/styled-system/jsx/create-slot-recipe-context.js +116 -0
- package/styled-system/jsx/divider.d.ts +7 -0
- package/styled-system/jsx/divider.js +11 -0
- package/styled-system/jsx/factory.d.ts +3 -0
- package/styled-system/jsx/factory.js +91 -0
- package/styled-system/jsx/flex.d.ts +7 -0
- package/styled-system/jsx/flex.js +11 -0
- package/styled-system/jsx/float.d.ts +7 -0
- package/styled-system/jsx/float.js +11 -0
- package/styled-system/jsx/grid-item.d.ts +7 -0
- package/styled-system/jsx/grid-item.js +11 -0
- package/styled-system/jsx/grid.d.ts +7 -0
- package/styled-system/jsx/grid.js +11 -0
- package/styled-system/jsx/helper.d.ts +34 -0
- package/styled-system/jsx/helper.js +83 -0
- package/styled-system/jsx/hstack.d.ts +7 -0
- package/styled-system/jsx/hstack.js +11 -0
- package/styled-system/jsx/index.d.ts +25 -0
- package/styled-system/jsx/index.js +24 -0
- package/styled-system/jsx/is-valid-prop.d.ts +7 -0
- package/styled-system/jsx/is-valid-prop.js +12 -0
- package/styled-system/jsx/link-overlay.d.ts +7 -0
- package/styled-system/jsx/link-overlay.js +11 -0
- package/styled-system/jsx/spacer.d.ts +7 -0
- package/styled-system/jsx/spacer.js +11 -0
- package/styled-system/jsx/square.d.ts +7 -0
- package/styled-system/jsx/square.js +11 -0
- package/styled-system/jsx/stack.d.ts +7 -0
- package/styled-system/jsx/stack.js +11 -0
- package/styled-system/jsx/visually-hidden.d.ts +7 -0
- package/styled-system/jsx/visually-hidden.js +11 -0
- package/styled-system/jsx/vstack.d.ts +7 -0
- package/styled-system/jsx/vstack.js +11 -0
- package/styled-system/jsx/wrap.d.ts +7 -0
- package/styled-system/jsx/wrap.js +11 -0
- package/styled-system/patterns/aspect-ratio.d.ts +19 -0
- package/styled-system/patterns/aspect-ratio.js +37 -0
- package/styled-system/patterns/bleed.d.ts +20 -0
- package/styled-system/patterns/bleed.js +30 -0
- package/styled-system/patterns/box.d.ts +17 -0
- package/styled-system/patterns/box.js +16 -0
- package/styled-system/patterns/center.d.ts +19 -0
- package/styled-system/patterns/center.js +22 -0
- package/styled-system/patterns/circle.d.ts +19 -0
- package/styled-system/patterns/circle.js +26 -0
- package/styled-system/patterns/container.d.ts +17 -0
- package/styled-system/patterns/container.js +26 -0
- package/styled-system/patterns/cq.d.ts +21 -0
- package/styled-system/patterns/cq.js +24 -0
- package/styled-system/patterns/divider.d.ts +22 -0
- package/styled-system/patterns/divider.js +31 -0
- package/styled-system/patterns/flex.d.ts +25 -0
- package/styled-system/patterns/flex.js +27 -0
- package/styled-system/patterns/float.d.ts +23 -0
- package/styled-system/patterns/float.js +84 -0
- package/styled-system/patterns/grid-item.d.ts +24 -0
- package/styled-system/patterns/grid-item.js +26 -0
- package/styled-system/patterns/grid.d.ts +24 -0
- package/styled-system/patterns/grid.js +30 -0
- package/styled-system/patterns/hstack.d.ts +20 -0
- package/styled-system/patterns/hstack.js +27 -0
- package/styled-system/patterns/index.d.ts +20 -0
- package/styled-system/patterns/index.js +20 -0
- package/styled-system/patterns/link-overlay.d.ts +17 -0
- package/styled-system/patterns/link-overlay.js +25 -0
- package/styled-system/patterns/runtime.js +25 -0
- package/styled-system/patterns/spacer.d.ts +20 -0
- package/styled-system/patterns/spacer.js +26 -0
- package/styled-system/patterns/square.d.ts +19 -0
- package/styled-system/patterns/square.js +25 -0
- package/styled-system/patterns/stack.d.ts +22 -0
- package/styled-system/patterns/stack.js +30 -0
- package/styled-system/patterns/visually-hidden.d.ts +17 -0
- package/styled-system/patterns/visually-hidden.js +19 -0
- package/styled-system/patterns/vstack.d.ts +20 -0
- package/styled-system/patterns/vstack.js +27 -0
- package/styled-system/patterns/wrap.d.ts +23 -0
- package/styled-system/patterns/wrap.js +26 -0
- package/styled-system/recipes/alert.d.ts +19 -0
- package/styled-system/recipes/alert.js +5 -0
- package/styled-system/recipes/avatar.d.ts +19 -0
- package/styled-system/recipes/avatar.js +5 -0
- package/styled-system/recipes/badge.d.ts +18 -0
- package/styled-system/recipes/badge.js +5 -0
- package/styled-system/recipes/button.d.ts +20 -0
- package/styled-system/recipes/button.js +5 -0
- package/styled-system/recipes/card.d.ts +19 -0
- package/styled-system/recipes/card.js +5 -0
- package/styled-system/recipes/chat-bubble.d.ts +16 -0
- package/styled-system/recipes/chat-bubble.js +5 -0
- package/styled-system/recipes/checkbox.d.ts +16 -0
- package/styled-system/recipes/checkbox.js +5 -0
- package/styled-system/recipes/dialog.d.ts +18 -0
- package/styled-system/recipes/dialog.js +5 -0
- package/styled-system/recipes/field.d.ts +16 -0
- package/styled-system/recipes/field.js +5 -0
- package/styled-system/recipes/index.d.ts +27 -0
- package/styled-system/recipes/index.js +27 -0
- package/styled-system/recipes/input.d.ts +18 -0
- package/styled-system/recipes/input.js +5 -0
- package/styled-system/recipes/link.d.ts +18 -0
- package/styled-system/recipes/link.js +5 -0
- package/styled-system/recipes/pagination.d.ts +19 -0
- package/styled-system/recipes/pagination.js +5 -0
- package/styled-system/recipes/progress.d.ts +18 -0
- package/styled-system/recipes/progress.js +5 -0
- package/styled-system/recipes/prose.d.ts +16 -0
- package/styled-system/recipes/prose.js +5 -0
- package/styled-system/recipes/radio-group.d.ts +18 -0
- package/styled-system/recipes/radio-group.js +5 -0
- package/styled-system/recipes/runtime.js +133 -0
- package/styled-system/recipes/select-panel.d.ts +18 -0
- package/styled-system/recipes/select-panel.js +5 -0
- package/styled-system/recipes/select.d.ts +18 -0
- package/styled-system/recipes/select.js +5 -0
- package/styled-system/recipes/separator.d.ts +16 -0
- package/styled-system/recipes/separator.js +5 -0
- package/styled-system/recipes/skeleton.d.ts +14 -0
- package/styled-system/recipes/skeleton.js +5 -0
- package/styled-system/recipes/spinner.d.ts +16 -0
- package/styled-system/recipes/spinner.js +5 -0
- package/styled-system/recipes/switch-recipe.d.ts +16 -0
- package/styled-system/recipes/switch-recipe.js +5 -0
- package/styled-system/recipes/table.d.ts +20 -0
- package/styled-system/recipes/table.js +5 -0
- package/styled-system/recipes/tabs.d.ts +18 -0
- package/styled-system/recipes/tabs.js +5 -0
- package/styled-system/recipes/tag.d.ts +18 -0
- package/styled-system/recipes/tag.js +5 -0
- package/styled-system/recipes/textarea.d.ts +14 -0
- package/styled-system/recipes/textarea.js +5 -0
- package/styled-system/recipes/toast.d.ts +20 -0
- package/styled-system/recipes/toast.js +5 -0
- package/styled-system/recipes/tooltip.d.ts +16 -0
- package/styled-system/recipes/tooltip.js +5 -0
- package/styled-system/tokens/index.d.ts +8 -0
- package/styled-system/tokens/index.js +18 -0
- package/styled-system/types/index.d.ts +5 -0
- package/styled-system/types/jsx.d.ts +80 -0
- package/styled-system/types/pattern.d.ts +26 -0
- package/styled-system/types/recipe.d.ts +77 -0
- package/styled-system/types/system.d.ts +1645 -0
- package/styled-system/types/tokens.d.ts +47 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { getPatternStyles, patternFns } from './runtime';
|
|
2
|
+
import { memo } from '../helpers';
|
|
3
|
+
import { css } from '../css/index';
|
|
4
|
+
|
|
5
|
+
const wrapConfig = { transform(props) {
|
|
6
|
+
const { columnGap, rowGap, gap = columnGap || rowGap ? void 0 : "8px", align, justify, ...rest } = props;
|
|
7
|
+
return {
|
|
8
|
+
display: "flex",
|
|
9
|
+
flexWrap: "wrap",
|
|
10
|
+
alignItems: align,
|
|
11
|
+
justifyContent: justify,
|
|
12
|
+
gap,
|
|
13
|
+
columnGap,
|
|
14
|
+
rowGap,
|
|
15
|
+
...rest
|
|
16
|
+
};
|
|
17
|
+
} }
|
|
18
|
+
|
|
19
|
+
export function wrapRaw(styles) {
|
|
20
|
+
const s = getPatternStyles(wrapConfig, styles || {})
|
|
21
|
+
return wrapConfig.transform(s, patternFns)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const wrap = /* @__PURE__ */ Object.assign(/* @__PURE__ */ memo(function wrap(styles = {}) {
|
|
25
|
+
return css(wrapRaw(styles))
|
|
26
|
+
}), { raw: wrapRaw, propKeys: ["align","columnGap","gap","justify","rowGap"] })
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ConditionalValue } from '../types/system';
|
|
2
|
+
import type { SlotRecipeRuntimeFn, RecipeVariantMap } from '../types/recipe';
|
|
3
|
+
|
|
4
|
+
export type AlertVariant = {
|
|
5
|
+
closable?: boolean
|
|
6
|
+
tone?: "error" | "info" | "warning"
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export type AlertVariantProps = {
|
|
10
|
+
[K in keyof AlertVariant]?: ConditionalValue<AlertVariant[K]>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type AlertVariantMap = RecipeVariantMap<AlertVariant>
|
|
14
|
+
|
|
15
|
+
export type AlertSlot = "root" | "icon" | "content" | "title" | "body" | "action" | "close"
|
|
16
|
+
|
|
17
|
+
export type AlertRecipe = SlotRecipeRuntimeFn<AlertSlot, AlertVariantProps, AlertVariantMap>
|
|
18
|
+
|
|
19
|
+
export declare const alert: AlertRecipe;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createSlotRecipe } from './runtime';
|
|
2
|
+
|
|
3
|
+
const alertConfig = {"name":"alert","className":"koi-alert","slots":["root","icon","content","title","body","action","close"],"defaultVariants":{"closable":false,"tone":"info"},"variantMap":{"closable":["false","true"],"tone":["error","info","warning"]}}
|
|
4
|
+
|
|
5
|
+
export const alert = /* @__PURE__ */ createSlotRecipe(alertConfig)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ConditionalValue } from '../types/system';
|
|
2
|
+
import type { SlotRecipeRuntimeFn, RecipeVariantMap } from '../types/recipe';
|
|
3
|
+
|
|
4
|
+
export type AvatarVariant = {
|
|
5
|
+
shape?: "circle" | "square"
|
|
6
|
+
size?: "lg" | "md" | "sm" | "xl"
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export type AvatarVariantProps = {
|
|
10
|
+
[K in keyof AvatarVariant]?: ConditionalValue<AvatarVariant[K]>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type AvatarVariantMap = RecipeVariantMap<AvatarVariant>
|
|
14
|
+
|
|
15
|
+
export type AvatarSlot = "root" | "image" | "fallback"
|
|
16
|
+
|
|
17
|
+
export type AvatarRecipe = SlotRecipeRuntimeFn<AvatarSlot, AvatarVariantProps, AvatarVariantMap>
|
|
18
|
+
|
|
19
|
+
export declare const avatar: AvatarRecipe;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createSlotRecipe } from './runtime';
|
|
2
|
+
|
|
3
|
+
const avatarConfig = {"name":"avatar","className":"koi-avatar","slots":["root","image","fallback"],"defaultVariants":{"shape":"circle","size":"md"},"variantMap":{"shape":["circle","square"],"size":["lg","md","sm","xl"]}}
|
|
4
|
+
|
|
5
|
+
export const avatar = /* @__PURE__ */ createSlotRecipe(avatarConfig)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ConditionalValue } from '../types/system';
|
|
2
|
+
import type { SlotRecipeRuntimeFn, RecipeVariantMap } from '../types/recipe';
|
|
3
|
+
|
|
4
|
+
export type BadgeVariant = {
|
|
5
|
+
tone?: "accent" | "error" | "neutral" | "primary" | "solid" | "warning"
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type BadgeVariantProps = {
|
|
9
|
+
[K in keyof BadgeVariant]?: ConditionalValue<BadgeVariant[K]>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type BadgeVariantMap = RecipeVariantMap<BadgeVariant>
|
|
13
|
+
|
|
14
|
+
export type BadgeSlot = "root" | "dot"
|
|
15
|
+
|
|
16
|
+
export type BadgeRecipe = SlotRecipeRuntimeFn<BadgeSlot, BadgeVariantProps, BadgeVariantMap>
|
|
17
|
+
|
|
18
|
+
export declare const badge: BadgeRecipe;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createSlotRecipe } from './runtime';
|
|
2
|
+
|
|
3
|
+
const badgeConfig = {"name":"badge","className":"koi-badge","slots":["root","dot"],"defaultVariants":{"tone":"neutral"},"variantMap":{"tone":["accent","error","neutral","primary","solid","warning"]}}
|
|
4
|
+
|
|
5
|
+
export const badge = /* @__PURE__ */ createSlotRecipe(badgeConfig)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { RecipeRuntimeFn, RecipeVariantMap } from '../types/recipe';
|
|
2
|
+
|
|
3
|
+
export type ButtonVariant = {
|
|
4
|
+
color?: "accent" | "error" | "primary" | "secondary" | "warning"
|
|
5
|
+
fullWidth?: boolean
|
|
6
|
+
iconOnly?: boolean
|
|
7
|
+
shape?: "pill" | "rounded"
|
|
8
|
+
size?: "lg" | "md" | "sm"
|
|
9
|
+
variant?: "ghost" | "outline" | "soft" | "solid"
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type ButtonVariantProps = {
|
|
13
|
+
[K in keyof ButtonVariant]?: ButtonVariant[K] | undefined
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type ButtonVariantMap = RecipeVariantMap<ButtonVariant>
|
|
17
|
+
|
|
18
|
+
export type ButtonRecipe = RecipeRuntimeFn<ButtonVariantProps, ButtonVariantMap>
|
|
19
|
+
|
|
20
|
+
export declare const button: ButtonRecipe;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createRecipe } from './runtime';
|
|
2
|
+
|
|
3
|
+
const buttonConfig = {"name":"button","className":"koi-btn","defaultVariants":{"color":"primary","iconOnly":false,"shape":"rounded","size":"md","variant":"solid"},"compoundVariants":[{"color":"primary","variant":"solid","className":"koi-btn--compound__color_primary__variant_solid"},{"color":"primary","variant":"soft","className":"koi-btn--compound__color_primary__variant_soft"},{"color":"primary","variant":"outline","className":"koi-btn--compound__color_primary__variant_outline"},{"color":"primary","variant":"ghost","className":"koi-btn--compound__color_primary__variant_ghost"},{"color":"accent","variant":"solid","className":"koi-btn--compound__color_accent__variant_solid"},{"color":"accent","variant":"soft","className":"koi-btn--compound__color_accent__variant_soft"},{"color":"accent","variant":"outline","className":"koi-btn--compound__color_accent__variant_outline"},{"color":"accent","variant":"ghost","className":"koi-btn--compound__color_accent__variant_ghost"},{"color":"secondary","variant":"solid","className":"koi-btn--compound__color_secondary__variant_solid"},{"color":"secondary","variant":"soft","className":"koi-btn--compound__color_secondary__variant_soft"},{"color":"secondary","variant":"outline","className":"koi-btn--compound__color_secondary__variant_outline"},{"color":"secondary","variant":"ghost","className":"koi-btn--compound__color_secondary__variant_ghost"},{"color":"warning","variant":"solid","className":"koi-btn--compound__color_warning__variant_solid"},{"color":"warning","variant":"soft","className":"koi-btn--compound__color_warning__variant_soft"},{"color":"warning","variant":"outline","className":"koi-btn--compound__color_warning__variant_outline"},{"color":"warning","variant":"ghost","className":"koi-btn--compound__color_warning__variant_ghost"},{"color":"error","variant":"solid","className":"koi-btn--compound__color_error__variant_solid"},{"color":"error","variant":"soft","className":"koi-btn--compound__color_error__variant_soft"},{"color":"error","variant":"outline","className":"koi-btn--compound__color_error__variant_outline"},{"color":"error","variant":"ghost","className":"koi-btn--compound__color_error__variant_ghost"},{"iconOnly":false,"shape":"rounded","size":"sm","className":"koi-btn--compound__iconOnly_false__shape_rounded__size_sm"},{"iconOnly":true,"className":"koi-btn--compound__iconOnly_true"}],"variantMap":{"color":["accent","error","primary","secondary","warning"],"fullWidth":["true"],"iconOnly":["false","true"],"shape":["pill","rounded"],"size":["lg","md","sm"],"variant":["ghost","outline","soft","solid"]}}
|
|
4
|
+
|
|
5
|
+
export const button = /* @__PURE__ */ createRecipe(buttonConfig)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ConditionalValue } from '../types/system';
|
|
2
|
+
import type { SlotRecipeRuntimeFn, RecipeVariantMap } from '../types/recipe';
|
|
3
|
+
|
|
4
|
+
export type CardVariant = {
|
|
5
|
+
padding?: "default" | "none"
|
|
6
|
+
variant?: "filled" | "glass" | "outlined"
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export type CardVariantProps = {
|
|
10
|
+
[K in keyof CardVariant]?: ConditionalValue<CardVariant[K]>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type CardVariantMap = RecipeVariantMap<CardVariant>
|
|
14
|
+
|
|
15
|
+
export type CardSlot = "root" | "media" | "head" | "title" | "description" | "body" | "footer"
|
|
16
|
+
|
|
17
|
+
export type CardRecipe = SlotRecipeRuntimeFn<CardSlot, CardVariantProps, CardVariantMap>
|
|
18
|
+
|
|
19
|
+
export declare const card: CardRecipe;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createSlotRecipe } from './runtime';
|
|
2
|
+
|
|
3
|
+
const cardConfig = {"name":"card","className":"koi-card","slots":["root","media","head","title","description","body","footer"],"defaultVariants":{"padding":"default","variant":"outlined"},"variantMap":{"padding":["default","none"],"variant":["filled","glass","outlined"]}}
|
|
4
|
+
|
|
5
|
+
export const card = /* @__PURE__ */ createSlotRecipe(cardConfig)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ConditionalValue } from '../types/system';
|
|
2
|
+
import type { RecipeRuntimeFn, RecipeVariantMap } from '../types/recipe';
|
|
3
|
+
|
|
4
|
+
export type ChatBubbleVariant = {
|
|
5
|
+
side?: "received" | "sent"
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type ChatBubbleVariantProps = {
|
|
9
|
+
[K in keyof ChatBubbleVariant]?: ConditionalValue<ChatBubbleVariant[K]>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type ChatBubbleVariantMap = RecipeVariantMap<ChatBubbleVariant>
|
|
13
|
+
|
|
14
|
+
export type ChatBubbleRecipe = RecipeRuntimeFn<ChatBubbleVariantProps, ChatBubbleVariantMap>
|
|
15
|
+
|
|
16
|
+
export declare const chatBubble: ChatBubbleRecipe;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createRecipe } from './runtime';
|
|
2
|
+
|
|
3
|
+
const chatBubbleConfig = {"name":"chatBubble","className":"koi-chat-bubble","defaultVariants":{"side":"received"},"variantMap":{"side":["received","sent"]}}
|
|
4
|
+
|
|
5
|
+
export const chatBubble = /* @__PURE__ */ createRecipe(chatBubbleConfig)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ConditionalValue } from '../types/system';
|
|
2
|
+
import type { SlotRecipeRuntimeFn, RecipeVariantMap } from '../types/recipe';
|
|
3
|
+
|
|
4
|
+
export type CheckboxVariant = {}
|
|
5
|
+
|
|
6
|
+
export type CheckboxVariantProps = {
|
|
7
|
+
[K in keyof CheckboxVariant]?: ConditionalValue<CheckboxVariant[K]>
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type CheckboxVariantMap = RecipeVariantMap<CheckboxVariant>
|
|
11
|
+
|
|
12
|
+
export type CheckboxSlot = "root" | "control" | "indicator" | "text" | "label" | "description"
|
|
13
|
+
|
|
14
|
+
export type CheckboxRecipe = SlotRecipeRuntimeFn<CheckboxSlot, CheckboxVariantProps, CheckboxVariantMap>
|
|
15
|
+
|
|
16
|
+
export declare const checkbox: CheckboxRecipe;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ConditionalValue } from '../types/system';
|
|
2
|
+
import type { SlotRecipeRuntimeFn, RecipeVariantMap } from '../types/recipe';
|
|
3
|
+
|
|
4
|
+
export type DialogVariant = {
|
|
5
|
+
size?: "lg" | "md" | "sm"
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type DialogVariantProps = {
|
|
9
|
+
[K in keyof DialogVariant]?: ConditionalValue<DialogVariant[K]>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type DialogVariantMap = RecipeVariantMap<DialogVariant>
|
|
13
|
+
|
|
14
|
+
export type DialogSlot = "backdrop" | "viewport" | "popup" | "title" | "description" | "body" | "footer" | "close"
|
|
15
|
+
|
|
16
|
+
export type DialogRecipe = SlotRecipeRuntimeFn<DialogSlot, DialogVariantProps, DialogVariantMap>
|
|
17
|
+
|
|
18
|
+
export declare const dialog: DialogRecipe;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createSlotRecipe } from './runtime';
|
|
2
|
+
|
|
3
|
+
const dialogConfig = {"name":"dialog","className":"koi-dialog","slots":["backdrop","viewport","popup","title","description","body","footer","close"],"defaultVariants":{"size":"md"},"variantMap":{"size":["lg","md","sm"]}}
|
|
4
|
+
|
|
5
|
+
export const dialog = /* @__PURE__ */ createSlotRecipe(dialogConfig)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ConditionalValue } from '../types/system';
|
|
2
|
+
import type { SlotRecipeRuntimeFn, RecipeVariantMap } from '../types/recipe';
|
|
3
|
+
|
|
4
|
+
export type FieldVariant = {}
|
|
5
|
+
|
|
6
|
+
export type FieldVariantProps = {
|
|
7
|
+
[K in keyof FieldVariant]?: ConditionalValue<FieldVariant[K]>
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type FieldVariantMap = RecipeVariantMap<FieldVariant>
|
|
11
|
+
|
|
12
|
+
export type FieldSlot = "root" | "label" | "required" | "optional" | "error" | "help"
|
|
13
|
+
|
|
14
|
+
export type FieldRecipe = SlotRecipeRuntimeFn<FieldSlot, FieldVariantProps, FieldVariantMap>
|
|
15
|
+
|
|
16
|
+
export declare const field: FieldRecipe;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export * from './button';
|
|
2
|
+
export * from './chat-bubble';
|
|
3
|
+
export * from './prose';
|
|
4
|
+
export * from './separator';
|
|
5
|
+
export * from './skeleton';
|
|
6
|
+
export * from './textarea';
|
|
7
|
+
export * from './alert';
|
|
8
|
+
export * from './avatar';
|
|
9
|
+
export * from './badge';
|
|
10
|
+
export * from './card';
|
|
11
|
+
export * from './checkbox';
|
|
12
|
+
export * from './dialog';
|
|
13
|
+
export * from './field';
|
|
14
|
+
export * from './input';
|
|
15
|
+
export * from './link';
|
|
16
|
+
export * from './pagination';
|
|
17
|
+
export * from './progress';
|
|
18
|
+
export * from './radio-group';
|
|
19
|
+
export * from './select';
|
|
20
|
+
export * from './select-panel';
|
|
21
|
+
export * from './spinner';
|
|
22
|
+
export * from './switch-recipe';
|
|
23
|
+
export * from './table';
|
|
24
|
+
export * from './tabs';
|
|
25
|
+
export * from './tag';
|
|
26
|
+
export * from './toast';
|
|
27
|
+
export * from './tooltip';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export * from './button';
|
|
2
|
+
export * from './chat-bubble';
|
|
3
|
+
export * from './prose';
|
|
4
|
+
export * from './separator';
|
|
5
|
+
export * from './skeleton';
|
|
6
|
+
export * from './textarea';
|
|
7
|
+
export * from './alert';
|
|
8
|
+
export * from './avatar';
|
|
9
|
+
export * from './badge';
|
|
10
|
+
export * from './card';
|
|
11
|
+
export * from './checkbox';
|
|
12
|
+
export * from './dialog';
|
|
13
|
+
export * from './field';
|
|
14
|
+
export * from './input';
|
|
15
|
+
export * from './link';
|
|
16
|
+
export * from './pagination';
|
|
17
|
+
export * from './progress';
|
|
18
|
+
export * from './radio-group';
|
|
19
|
+
export * from './select';
|
|
20
|
+
export * from './select-panel';
|
|
21
|
+
export * from './spinner';
|
|
22
|
+
export * from './switch-recipe';
|
|
23
|
+
export * from './table';
|
|
24
|
+
export * from './tabs';
|
|
25
|
+
export * from './tag';
|
|
26
|
+
export * from './toast';
|
|
27
|
+
export * from './tooltip';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ConditionalValue } from '../types/system';
|
|
2
|
+
import type { SlotRecipeRuntimeFn, RecipeVariantMap } from '../types/recipe';
|
|
3
|
+
|
|
4
|
+
export type InputVariant = {
|
|
5
|
+
size?: "lg" | "md" | "sm"
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type InputVariantProps = {
|
|
9
|
+
[K in keyof InputVariant]?: ConditionalValue<InputVariant[K]>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type InputVariantMap = RecipeVariantMap<InputVariant>
|
|
13
|
+
|
|
14
|
+
export type InputSlot = "root" | "el" | "icon"
|
|
15
|
+
|
|
16
|
+
export type InputRecipe = SlotRecipeRuntimeFn<InputSlot, InputVariantProps, InputVariantMap>
|
|
17
|
+
|
|
18
|
+
export declare const input: InputRecipe;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createSlotRecipe } from './runtime';
|
|
2
|
+
|
|
3
|
+
const inputConfig = {"name":"input","className":"koi-input","slots":["root","el","icon"],"defaultVariants":{"size":"md"},"variantMap":{"size":["lg","md","sm"]}}
|
|
4
|
+
|
|
5
|
+
export const input = /* @__PURE__ */ createSlotRecipe(inputConfig)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ConditionalValue } from '../types/system';
|
|
2
|
+
import type { SlotRecipeRuntimeFn, RecipeVariantMap } from '../types/recipe';
|
|
3
|
+
|
|
4
|
+
export type LinkVariant = {
|
|
5
|
+
variant?: "plain" | "underline"
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type LinkVariantProps = {
|
|
9
|
+
[K in keyof LinkVariant]?: ConditionalValue<LinkVariant[K]>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type LinkVariantMap = RecipeVariantMap<LinkVariant>
|
|
13
|
+
|
|
14
|
+
export type LinkSlot = "root" | "external" | "srOnly"
|
|
15
|
+
|
|
16
|
+
export type LinkRecipe = SlotRecipeRuntimeFn<LinkSlot, LinkVariantProps, LinkVariantMap>
|
|
17
|
+
|
|
18
|
+
export declare const link: LinkRecipe;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createSlotRecipe } from './runtime';
|
|
2
|
+
|
|
3
|
+
const linkConfig = {"name":"link","className":"koi-link","slots":["root","external","srOnly"],"defaultVariants":{"variant":"underline"},"variantMap":{"variant":["plain","underline"]}}
|
|
4
|
+
|
|
5
|
+
export const link = /* @__PURE__ */ createSlotRecipe(linkConfig)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ConditionalValue } from '../types/system';
|
|
2
|
+
import type { SlotRecipeRuntimeFn, RecipeVariantMap } from '../types/recipe';
|
|
3
|
+
|
|
4
|
+
export type PaginationVariant = {
|
|
5
|
+
compact?: boolean
|
|
6
|
+
shape?: "pill" | "rounded"
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export type PaginationVariantProps = {
|
|
10
|
+
[K in keyof PaginationVariant]?: ConditionalValue<PaginationVariant[K]>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type PaginationVariantMap = RecipeVariantMap<PaginationVariant>
|
|
14
|
+
|
|
15
|
+
export type PaginationSlot = "root" | "pages" | "page" | "gap" | "count"
|
|
16
|
+
|
|
17
|
+
export type PaginationRecipe = SlotRecipeRuntimeFn<PaginationSlot, PaginationVariantProps, PaginationVariantMap>
|
|
18
|
+
|
|
19
|
+
export declare const pagination: PaginationRecipe;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createSlotRecipe } from './runtime';
|
|
2
|
+
|
|
3
|
+
const paginationConfig = {"name":"pagination","className":"koi-pagination","slots":["root","pages","page","gap","count"],"defaultVariants":{"compact":false,"shape":"rounded"},"variantMap":{"compact":["false","true"],"shape":["pill","rounded"]}}
|
|
4
|
+
|
|
5
|
+
export const pagination = /* @__PURE__ */ createSlotRecipe(paginationConfig)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ConditionalValue } from '../types/system';
|
|
2
|
+
import type { SlotRecipeRuntimeFn, RecipeVariantMap } from '../types/recipe';
|
|
3
|
+
|
|
4
|
+
export type ProgressVariant = {
|
|
5
|
+
size?: "lg" | "md" | "sm"
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type ProgressVariantProps = {
|
|
9
|
+
[K in keyof ProgressVariant]?: ConditionalValue<ProgressVariant[K]>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type ProgressVariantMap = RecipeVariantMap<ProgressVariant>
|
|
13
|
+
|
|
14
|
+
export type ProgressSlot = "root" | "head" | "label" | "value" | "track" | "indicator"
|
|
15
|
+
|
|
16
|
+
export type ProgressRecipe = SlotRecipeRuntimeFn<ProgressSlot, ProgressVariantProps, ProgressVariantMap>
|
|
17
|
+
|
|
18
|
+
export declare const progress: ProgressRecipe;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createSlotRecipe } from './runtime';
|
|
2
|
+
|
|
3
|
+
const progressConfig = {"name":"progress","className":"koi-progress","slots":["root","head","label","value","track","indicator"],"defaultVariants":{"size":"md"},"variantMap":{"size":["lg","md","sm"]}}
|
|
4
|
+
|
|
5
|
+
export const progress = /* @__PURE__ */ createSlotRecipe(progressConfig)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ConditionalValue } from '../types/system';
|
|
2
|
+
import type { RecipeRuntimeFn, RecipeVariantMap } from '../types/recipe';
|
|
3
|
+
|
|
4
|
+
export type ProseVariant = {
|
|
5
|
+
size?: "md" | "sm"
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type ProseVariantProps = {
|
|
9
|
+
[K in keyof ProseVariant]?: ConditionalValue<ProseVariant[K]>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type ProseVariantMap = RecipeVariantMap<ProseVariant>
|
|
13
|
+
|
|
14
|
+
export type ProseRecipe = RecipeRuntimeFn<ProseVariantProps, ProseVariantMap>
|
|
15
|
+
|
|
16
|
+
export declare const prose: ProseRecipe;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ConditionalValue } from '../types/system';
|
|
2
|
+
import type { SlotRecipeRuntimeFn, RecipeVariantMap } from '../types/recipe';
|
|
3
|
+
|
|
4
|
+
export type RadioGroupVariant = {
|
|
5
|
+
orientation?: "horizontal" | "vertical"
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type RadioGroupVariantProps = {
|
|
9
|
+
[K in keyof RadioGroupVariant]?: ConditionalValue<RadioGroupVariant[K]>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type RadioGroupVariantMap = RecipeVariantMap<RadioGroupVariant>
|
|
13
|
+
|
|
14
|
+
export type RadioGroupSlot = "root" | "item" | "control" | "indicator" | "text" | "label" | "description"
|
|
15
|
+
|
|
16
|
+
export type RadioGroupRecipe = SlotRecipeRuntimeFn<RadioGroupSlot, RadioGroupVariantProps, RadioGroupVariantMap>
|
|
17
|
+
|
|
18
|
+
export declare const radioGroup: RadioGroupRecipe;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createSlotRecipe } from './runtime';
|
|
2
|
+
|
|
3
|
+
const radioGroupConfig = {"name":"radioGroup","className":"koi-radio-group","slots":["root","item","control","indicator","text","label","description"],"defaultVariants":{"orientation":"vertical"},"variantMap":{"orientation":["horizontal","vertical"]}}
|
|
4
|
+
|
|
5
|
+
export const radioGroup = /* @__PURE__ */ createSlotRecipe(radioGroupConfig)
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { createSerializeCss, getCompoundVariantClassNames, getSlotCompoundVariant, memo, splitProps, toHash, uniq, withDefaults, withoutSpace } from '../helpers';
|
|
2
|
+
import { breakpointKeys, finalizeConditions, sortConditions } from '../css/conditions';
|
|
3
|
+
import { cx } from '../css/cx';
|
|
4
|
+
|
|
5
|
+
function normalize(config) {
|
|
6
|
+
const variantMap = config.variantMap ?? {}
|
|
7
|
+
return {
|
|
8
|
+
name: config.name,
|
|
9
|
+
className: config.className ?? config.name,
|
|
10
|
+
slots: config.slots ?? [],
|
|
11
|
+
variantMap,
|
|
12
|
+
variantKeys: Object.keys(variantMap),
|
|
13
|
+
defaults: config.defaultVariants ?? {},
|
|
14
|
+
compounds: config.compoundVariants ?? [],
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function createRecipe(config) {
|
|
19
|
+
const { name, className, variantMap, variantKeys, defaults, compounds } = normalize(config)
|
|
20
|
+
const classPrefix = null
|
|
21
|
+
|
|
22
|
+
const recipeCss = /* @__PURE__ */ createSerializeCss({
|
|
23
|
+
hash: false,
|
|
24
|
+
conditions: {
|
|
25
|
+
shift: sortConditions,
|
|
26
|
+
finalize: finalizeConditions,
|
|
27
|
+
breakpoints: { keys: breakpointKeys },
|
|
28
|
+
},
|
|
29
|
+
utility: {
|
|
30
|
+
prefix: classPrefix,
|
|
31
|
+
toHash(path, hashFn) {
|
|
32
|
+
return hashFn(path.join(":"))
|
|
33
|
+
},
|
|
34
|
+
transform(prop, value) {
|
|
35
|
+
return { className: value === "__ignore__" ? className : `${className}--${prop}_${withoutSpace(value)}` }
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
})
|
|
39
|
+
const formatClassName = (name) => {
|
|
40
|
+
const next = false ? toHash(name) : name
|
|
41
|
+
return classPrefix ? `${classPrefix}-${next}` : next
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function resolve(props = {}) {
|
|
45
|
+
return { [className]: "__ignore__", ...withDefaults(defaults, props) }
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function assertNoConditions(props) {
|
|
49
|
+
if (compounds.length === 0) return
|
|
50
|
+
for (const key of variantKeys) {
|
|
51
|
+
const value = props[key]
|
|
52
|
+
if (value != null && typeof value === "object") {
|
|
53
|
+
throw new Error(`[recipe:${className}:${key}] Conditions are not supported when using compound variants.`)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function compoundClasses(props) {
|
|
59
|
+
return getCompoundVariantClassNames(compounds, resolve(props), formatClassName)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const recipe = attach(memo(function recipeFn(props = {}, withCompoundVariants = true) {
|
|
63
|
+
assertNoConditions(props)
|
|
64
|
+
const recipeClass = recipeCss(resolve(props))
|
|
65
|
+
if (!withCompoundVariants) return recipeClass
|
|
66
|
+
const compoundsClass = compoundClasses(props)
|
|
67
|
+
return cx(recipeClass, compoundsClass)
|
|
68
|
+
}), name, variantKeys, variantMap, resolve)
|
|
69
|
+
recipe.__recipe__ = true
|
|
70
|
+
recipe.__getCompoundVariantClasses__ = compoundClasses
|
|
71
|
+
recipe.merge = function merge(other) {
|
|
72
|
+
return mergeRecipes(recipe, other)
|
|
73
|
+
}
|
|
74
|
+
return recipe
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function createSlotRecipe(config) {
|
|
78
|
+
const { name, className, slots, variantMap, variantKeys, defaults, compounds } = normalize(config)
|
|
79
|
+
|
|
80
|
+
const slotFns = slots.map(function toSlotRecipe(slot) {
|
|
81
|
+
return [slot, createRecipe({
|
|
82
|
+
name,
|
|
83
|
+
className: `${className}__${slot}`,
|
|
84
|
+
variantMap,
|
|
85
|
+
defaultVariants: defaults,
|
|
86
|
+
compoundVariants: getSlotCompoundVariant(compounds, slot),
|
|
87
|
+
})]
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
const recipe = memo(function slotRecipeFn(props = {}) {
|
|
91
|
+
const result = {}
|
|
92
|
+
for (const [slot, slotFn] of slotFns) result[slot] = slotFn(props)
|
|
93
|
+
return result
|
|
94
|
+
})
|
|
95
|
+
attach(recipe, name, variantKeys, variantMap, function getVariantProps(props = {}) {
|
|
96
|
+
return withDefaults(defaults, props)
|
|
97
|
+
})
|
|
98
|
+
recipe.__recipe__ = false
|
|
99
|
+
recipe.classNameMap = {}
|
|
100
|
+
return recipe
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function mergeRecipes(recipeA, recipeB) {
|
|
104
|
+
if (recipeA && !recipeB) return recipeA
|
|
105
|
+
if (!recipeA && recipeB) return recipeB
|
|
106
|
+
function merged(...args) {
|
|
107
|
+
const classA = recipeA(...args)
|
|
108
|
+
const classB = recipeB(...args)
|
|
109
|
+
return classA && classB ? `${classA} ${classB}` : classA || classB
|
|
110
|
+
}
|
|
111
|
+
const variantKeys = uniq(recipeA.variantKeys, recipeB.variantKeys)
|
|
112
|
+
const variantMap = {}
|
|
113
|
+
for (const key of variantKeys) variantMap[key] = uniq(recipeA.variantMap[key], recipeB.variantMap[key])
|
|
114
|
+
attach(merged, `${recipeA.__name__} ${recipeB.__name__}`, variantKeys, variantMap, function getVariantProps(props) {
|
|
115
|
+
return props
|
|
116
|
+
})
|
|
117
|
+
merged.__recipe__ = true
|
|
118
|
+
return merged
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function attach(recipe, name, variantKeys, variantMap, getVariantProps) {
|
|
122
|
+
recipe.__name__ = name
|
|
123
|
+
recipe.raw = function raw(props) {
|
|
124
|
+
return props
|
|
125
|
+
}
|
|
126
|
+
recipe.variantKeys = variantKeys
|
|
127
|
+
recipe.variantMap = variantMap
|
|
128
|
+
recipe.splitVariantProps = function splitVariantProps(props) {
|
|
129
|
+
return splitProps(props, variantKeys)
|
|
130
|
+
}
|
|
131
|
+
recipe.getVariantProps = getVariantProps
|
|
132
|
+
return recipe
|
|
133
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ConditionalValue } from '../types/system';
|
|
2
|
+
import type { SlotRecipeRuntimeFn, RecipeVariantMap } from '../types/recipe';
|
|
3
|
+
|
|
4
|
+
export type SelectPanelVariant = {
|
|
5
|
+
size?: "lg" | "md" | "sm"
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type SelectPanelVariantProps = {
|
|
9
|
+
[K in keyof SelectPanelVariant]?: ConditionalValue<SelectPanelVariant[K]>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type SelectPanelVariantMap = RecipeVariantMap<SelectPanelVariant>
|
|
13
|
+
|
|
14
|
+
export type SelectPanelSlot = "trigger" | "value" | "icon" | "positioner" | "popup" | "search" | "searchInput" | "list" | "empty" | "item" | "itemText" | "itemIndicator" | "group" | "groupLabel" | "separator"
|
|
15
|
+
|
|
16
|
+
export type SelectPanelRecipe = SlotRecipeRuntimeFn<SelectPanelSlot, SelectPanelVariantProps, SelectPanelVariantMap>
|
|
17
|
+
|
|
18
|
+
export declare const selectPanel: SelectPanelRecipe;
|