@pyck/styled-system 0.0.1

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.
Files changed (238) hide show
  1. package/dist/css/conditions.mjs +36 -0
  2. package/dist/css/css.d.ts +22 -0
  3. package/dist/css/css.mjs +45 -0
  4. package/dist/css/cva.d.ts +6 -0
  5. package/dist/css/cva.mjs +87 -0
  6. package/dist/css/cx.d.ts +5 -0
  7. package/dist/css/cx.mjs +15 -0
  8. package/dist/css/index.d.ts +5 -0
  9. package/dist/css/index.mjs +4 -0
  10. package/dist/css/sva.d.ts +4 -0
  11. package/dist/css/sva.mjs +46 -0
  12. package/dist/helpers.mjs +328 -0
  13. package/dist/jsx/aspect-ratio.d.ts +10 -0
  14. package/dist/jsx/aspect-ratio.mjs +14 -0
  15. package/dist/jsx/bleed.d.ts +10 -0
  16. package/dist/jsx/bleed.mjs +14 -0
  17. package/dist/jsx/box.d.ts +10 -0
  18. package/dist/jsx/box.mjs +14 -0
  19. package/dist/jsx/center.d.ts +10 -0
  20. package/dist/jsx/center.mjs +14 -0
  21. package/dist/jsx/circle.d.ts +10 -0
  22. package/dist/jsx/circle.mjs +14 -0
  23. package/dist/jsx/container.d.ts +10 -0
  24. package/dist/jsx/container.mjs +14 -0
  25. package/dist/jsx/cq.d.ts +10 -0
  26. package/dist/jsx/cq.mjs +14 -0
  27. package/dist/jsx/create-style-context.d.ts +54 -0
  28. package/dist/jsx/create-style-context.mjs +118 -0
  29. package/dist/jsx/divider.d.ts +10 -0
  30. package/dist/jsx/divider.mjs +14 -0
  31. package/dist/jsx/factory-helper.mjs +22 -0
  32. package/dist/jsx/factory.d.ts +3 -0
  33. package/dist/jsx/factory.mjs +89 -0
  34. package/dist/jsx/flex.d.ts +10 -0
  35. package/dist/jsx/flex.mjs +14 -0
  36. package/dist/jsx/float.d.ts +10 -0
  37. package/dist/jsx/float.mjs +14 -0
  38. package/dist/jsx/grid-item.d.ts +10 -0
  39. package/dist/jsx/grid-item.mjs +14 -0
  40. package/dist/jsx/grid.d.ts +10 -0
  41. package/dist/jsx/grid.mjs +14 -0
  42. package/dist/jsx/hstack.d.ts +10 -0
  43. package/dist/jsx/hstack.mjs +14 -0
  44. package/dist/jsx/index.d.ts +25 -0
  45. package/dist/jsx/index.mjs +23 -0
  46. package/dist/jsx/is-valid-prop.d.ts +11 -0
  47. package/dist/jsx/is-valid-prop.mjs +17 -0
  48. package/dist/jsx/link-overlay.d.ts +10 -0
  49. package/dist/jsx/link-overlay.mjs +14 -0
  50. package/dist/jsx/spacer.d.ts +10 -0
  51. package/dist/jsx/spacer.mjs +14 -0
  52. package/dist/jsx/square.d.ts +10 -0
  53. package/dist/jsx/square.mjs +14 -0
  54. package/dist/jsx/stack.d.ts +10 -0
  55. package/dist/jsx/stack.mjs +14 -0
  56. package/dist/jsx/visually-hidden.d.ts +10 -0
  57. package/dist/jsx/visually-hidden.mjs +14 -0
  58. package/dist/jsx/vstack.d.ts +10 -0
  59. package/dist/jsx/vstack.mjs +14 -0
  60. package/dist/jsx/wrap.d.ts +10 -0
  61. package/dist/jsx/wrap.mjs +14 -0
  62. package/dist/patterns/aspect-ratio.d.ts +20 -0
  63. package/dist/patterns/aspect-ratio.mjs +38 -0
  64. package/dist/patterns/bleed.d.ts +21 -0
  65. package/dist/patterns/bleed.mjs +24 -0
  66. package/dist/patterns/box.d.ts +20 -0
  67. package/dist/patterns/box.mjs +15 -0
  68. package/dist/patterns/center.d.ts +20 -0
  69. package/dist/patterns/center.mjs +21 -0
  70. package/dist/patterns/circle.d.ts +20 -0
  71. package/dist/patterns/circle.mjs +25 -0
  72. package/dist/patterns/container.d.ts +20 -0
  73. package/dist/patterns/container.mjs +22 -0
  74. package/dist/patterns/cq.d.ts +21 -0
  75. package/dist/patterns/cq.mjs +21 -0
  76. package/dist/patterns/divider.d.ts +22 -0
  77. package/dist/patterns/divider.mjs +25 -0
  78. package/dist/patterns/flex.d.ts +26 -0
  79. package/dist/patterns/flex.mjs +26 -0
  80. package/dist/patterns/float.d.ts +23 -0
  81. package/dist/patterns/float.mjs +52 -0
  82. package/dist/patterns/grid-item.d.ts +25 -0
  83. package/dist/patterns/grid-item.mjs +25 -0
  84. package/dist/patterns/grid.d.ts +24 -0
  85. package/dist/patterns/grid.mjs +25 -0
  86. package/dist/patterns/hstack.d.ts +21 -0
  87. package/dist/patterns/hstack.mjs +24 -0
  88. package/dist/patterns/index.d.ts +21 -0
  89. package/dist/patterns/index.mjs +20 -0
  90. package/dist/patterns/link-overlay.d.ts +20 -0
  91. package/dist/patterns/link-overlay.mjs +24 -0
  92. package/dist/patterns/spacer.d.ts +20 -0
  93. package/dist/patterns/spacer.mjs +21 -0
  94. package/dist/patterns/square.d.ts +20 -0
  95. package/dist/patterns/square.mjs +24 -0
  96. package/dist/patterns/stack.d.ts +23 -0
  97. package/dist/patterns/stack.mjs +24 -0
  98. package/dist/patterns/visually-hidden.d.ts +20 -0
  99. package/dist/patterns/visually-hidden.mjs +18 -0
  100. package/dist/patterns/vstack.d.ts +21 -0
  101. package/dist/patterns/vstack.mjs +24 -0
  102. package/dist/patterns/wrap.d.ts +24 -0
  103. package/dist/patterns/wrap.mjs +25 -0
  104. package/dist/recipes/absolute-center.d.ts +34 -0
  105. package/dist/recipes/absolute-center.mjs +32 -0
  106. package/dist/recipes/action-bar.d.ts +31 -0
  107. package/dist/recipes/action-bar.mjs +49 -0
  108. package/dist/recipes/avatar.d.ts +43 -0
  109. package/dist/recipes/avatar.mjs +75 -0
  110. package/dist/recipes/badge.d.ts +38 -0
  111. package/dist/recipes/badge.mjs +40 -0
  112. package/dist/recipes/breadcrumb.d.ts +38 -0
  113. package/dist/recipes/breadcrumb.mjs +70 -0
  114. package/dist/recipes/button.d.ts +38 -0
  115. package/dist/recipes/button.mjs +44 -0
  116. package/dist/recipes/card.d.ts +34 -0
  117. package/dist/recipes/card.mjs +63 -0
  118. package/dist/recipes/carousel.d.ts +35 -0
  119. package/dist/recipes/carousel.mjs +93 -0
  120. package/dist/recipes/checkbox.d.ts +38 -0
  121. package/dist/recipes/checkbox.mjs +67 -0
  122. package/dist/recipes/checkmark.d.ts +38 -0
  123. package/dist/recipes/checkmark.mjs +39 -0
  124. package/dist/recipes/clipboard.d.ts +31 -0
  125. package/dist/recipes/clipboard.mjs +53 -0
  126. package/dist/recipes/collapsible.d.ts +34 -0
  127. package/dist/recipes/collapsible.mjs +54 -0
  128. package/dist/recipes/combobox.d.ts +38 -0
  129. package/dist/recipes/combobox.mjs +112 -0
  130. package/dist/recipes/create-recipe.mjs +82 -0
  131. package/dist/recipes/data-list.d.ts +31 -0
  132. package/dist/recipes/data-list.mjs +53 -0
  133. package/dist/recipes/date-picker.d.ts +31 -0
  134. package/dist/recipes/date-picker.mjs +133 -0
  135. package/dist/recipes/dialog.d.ts +46 -0
  136. package/dist/recipes/dialog.mjs +106 -0
  137. package/dist/recipes/drawer.d.ts +38 -0
  138. package/dist/recipes/drawer.mjs +90 -0
  139. package/dist/recipes/drilldown-menu.d.ts +31 -0
  140. package/dist/recipes/drilldown-menu.mjs +53 -0
  141. package/dist/recipes/field.d.ts +31 -0
  142. package/dist/recipes/field.mjs +61 -0
  143. package/dist/recipes/fieldset.d.ts +31 -0
  144. package/dist/recipes/fieldset.mjs +73 -0
  145. package/dist/recipes/floating-panel.d.ts +31 -0
  146. package/dist/recipes/floating-panel.mjs +73 -0
  147. package/dist/recipes/form.d.ts +31 -0
  148. package/dist/recipes/form.mjs +24 -0
  149. package/dist/recipes/group.d.ts +36 -0
  150. package/dist/recipes/group.mjs +72 -0
  151. package/dist/recipes/heading.d.ts +31 -0
  152. package/dist/recipes/heading.mjs +38 -0
  153. package/dist/recipes/icon.d.ts +34 -0
  154. package/dist/recipes/icon.mjs +36 -0
  155. package/dist/recipes/index.d.ts +58 -0
  156. package/dist/recipes/index.mjs +57 -0
  157. package/dist/recipes/input-addon.d.ts +38 -0
  158. package/dist/recipes/input-addon.mjs +39 -0
  159. package/dist/recipes/input-group.d.ts +34 -0
  160. package/dist/recipes/input-group.mjs +49 -0
  161. package/dist/recipes/input.d.ts +38 -0
  162. package/dist/recipes/input.mjs +42 -0
  163. package/dist/recipes/kbd.d.ts +38 -0
  164. package/dist/recipes/kbd.mjs +42 -0
  165. package/dist/recipes/link.d.ts +34 -0
  166. package/dist/recipes/link.mjs +30 -0
  167. package/dist/recipes/mark.d.ts +34 -0
  168. package/dist/recipes/mark.mjs +32 -0
  169. package/dist/recipes/menu.d.ts +34 -0
  170. package/dist/recipes/menu.mjs +97 -0
  171. package/dist/recipes/number-input.d.ts +38 -0
  172. package/dist/recipes/number-input.mjs +78 -0
  173. package/dist/recipes/pagination.d.ts +31 -0
  174. package/dist/recipes/pagination.mjs +57 -0
  175. package/dist/recipes/popover.d.ts +31 -0
  176. package/dist/recipes/popover.mjs +81 -0
  177. package/dist/recipes/progress-circle.d.ts +34 -0
  178. package/dist/recipes/progress-circle.mjs +75 -0
  179. package/dist/recipes/progress.d.ts +44 -0
  180. package/dist/recipes/progress.mjs +98 -0
  181. package/dist/recipes/radio-card-group.d.ts +38 -0
  182. package/dist/recipes/radio-card-group.mjs +69 -0
  183. package/dist/recipes/radio-group.d.ts +38 -0
  184. package/dist/recipes/radio-group.mjs +68 -0
  185. package/dist/recipes/scroll-area.d.ts +38 -0
  186. package/dist/recipes/scroll-area.mjs +70 -0
  187. package/dist/recipes/segment-group.d.ts +35 -0
  188. package/dist/recipes/segment-group.mjs +69 -0
  189. package/dist/recipes/select.d.ts +38 -0
  190. package/dist/recipes/select.mjs +111 -0
  191. package/dist/recipes/skeleton.d.ts +39 -0
  192. package/dist/recipes/skeleton.mjs +40 -0
  193. package/dist/recipes/slider.d.ts +42 -0
  194. package/dist/recipes/slider.mjs +94 -0
  195. package/dist/recipes/spinner.d.ts +34 -0
  196. package/dist/recipes/spinner.mjs +36 -0
  197. package/dist/recipes/stat.d.ts +31 -0
  198. package/dist/recipes/stat.mjs +41 -0
  199. package/dist/recipes/steps.d.ts +42 -0
  200. package/dist/recipes/steps.mjs +97 -0
  201. package/dist/recipes/switch-recipe.d.ts +38 -0
  202. package/dist/recipes/switch-recipe.mjs +65 -0
  203. package/dist/recipes/table.d.ts +40 -0
  204. package/dist/recipes/table.mjs +83 -0
  205. package/dist/recipes/tabs.d.ts +39 -0
  206. package/dist/recipes/tabs.mjs +72 -0
  207. package/dist/recipes/tags-input.d.ts +38 -0
  208. package/dist/recipes/tags-input.mjs +86 -0
  209. package/dist/recipes/text.d.ts +31 -0
  210. package/dist/recipes/text.mjs +38 -0
  211. package/dist/recipes/textarea.d.ts +38 -0
  212. package/dist/recipes/textarea.mjs +41 -0
  213. package/dist/recipes/toast.d.ts +31 -0
  214. package/dist/recipes/toast.mjs +53 -0
  215. package/dist/recipes/toggle-group.d.ts +31 -0
  216. package/dist/recipes/toggle-group.mjs +44 -0
  217. package/dist/recipes/tooltip.d.ts +34 -0
  218. package/dist/recipes/tooltip.mjs +57 -0
  219. package/dist/recipes/tree-view.d.ts +34 -0
  220. package/dist/recipes/tree-view.mjs +97 -0
  221. package/dist/tokens/index.d.ts +9 -0
  222. package/dist/tokens/index.mjs +3060 -0
  223. package/dist/tokens/tokens.d.ts +63 -0
  224. package/dist/types/composition.d.ts +227 -0
  225. package/dist/types/conditions.d.ts +314 -0
  226. package/dist/types/csstype.d.ts +22570 -0
  227. package/dist/types/global.d.ts +20 -0
  228. package/dist/types/index.d.ts +8 -0
  229. package/dist/types/jsx.d.ts +69 -0
  230. package/dist/types/parts.d.ts +8 -0
  231. package/dist/types/pattern.d.ts +78 -0
  232. package/dist/types/prop-type.d.ts +253 -0
  233. package/dist/types/recipe.d.ts +181 -0
  234. package/dist/types/selectors.d.ts +59 -0
  235. package/dist/types/static-css.d.ts +56 -0
  236. package/dist/types/style-props.d.ts +8091 -0
  237. package/dist/types/system-types.d.ts +151 -0
  238. package/package.json +76 -0
@@ -0,0 +1,14 @@
1
+ import { createElement, forwardRef } from 'react'
2
+
3
+ import { splitProps } from '../helpers.mjs';
4
+ import { getBleedStyle } from '../patterns/bleed.mjs';
5
+ import { styled } from './factory.mjs';
6
+
7
+ export const Bleed = /* @__PURE__ */ forwardRef(function Bleed(props, ref) {
8
+ const [patternProps, restProps] = splitProps(props, ["inline","block"])
9
+
10
+ const styleProps = getBleedStyle(patternProps)
11
+ const mergedProps = { ref, ...styleProps, ...restProps }
12
+
13
+ return createElement(styled.div, mergedProps)
14
+ })
@@ -0,0 +1,10 @@
1
+ /* eslint-disable */
2
+ import type { FunctionComponent } from 'react'
3
+ import type { BoxProperties } from '../patterns/box';
4
+ import type { HTMLStyledProps } from '../types/jsx';
5
+ import type { DistributiveOmit } from '../types/system-types';
6
+
7
+ export interface BoxProps extends BoxProperties, DistributiveOmit<HTMLStyledProps<'div'>, keyof BoxProperties > {}
8
+
9
+
10
+ export declare const Box: FunctionComponent<BoxProps>
@@ -0,0 +1,14 @@
1
+ import { createElement, forwardRef } from 'react'
2
+
3
+ import { splitProps } from '../helpers.mjs';
4
+ import { getBoxStyle } from '../patterns/box.mjs';
5
+ import { styled } from './factory.mjs';
6
+
7
+ export const Box = /* @__PURE__ */ forwardRef(function Box(props, ref) {
8
+ const [patternProps, restProps] = splitProps(props, [])
9
+
10
+ const styleProps = getBoxStyle(patternProps)
11
+ const mergedProps = { ref, ...styleProps, ...restProps }
12
+
13
+ return createElement(styled.div, mergedProps)
14
+ })
@@ -0,0 +1,10 @@
1
+ /* eslint-disable */
2
+ import type { FunctionComponent } from 'react'
3
+ import type { CenterProperties } from '../patterns/center';
4
+ import type { HTMLStyledProps } from '../types/jsx';
5
+ import type { DistributiveOmit } from '../types/system-types';
6
+
7
+ export interface CenterProps extends CenterProperties, DistributiveOmit<HTMLStyledProps<'div'>, keyof CenterProperties > {}
8
+
9
+
10
+ export declare const Center: FunctionComponent<CenterProps>
@@ -0,0 +1,14 @@
1
+ import { createElement, forwardRef } from 'react'
2
+
3
+ import { splitProps } from '../helpers.mjs';
4
+ import { getCenterStyle } from '../patterns/center.mjs';
5
+ import { styled } from './factory.mjs';
6
+
7
+ export const Center = /* @__PURE__ */ forwardRef(function Center(props, ref) {
8
+ const [patternProps, restProps] = splitProps(props, ["inline"])
9
+
10
+ const styleProps = getCenterStyle(patternProps)
11
+ const mergedProps = { ref, ...styleProps, ...restProps }
12
+
13
+ return createElement(styled.div, mergedProps)
14
+ })
@@ -0,0 +1,10 @@
1
+ /* eslint-disable */
2
+ import type { FunctionComponent } from 'react'
3
+ import type { CircleProperties } from '../patterns/circle';
4
+ import type { HTMLStyledProps } from '../types/jsx';
5
+ import type { DistributiveOmit } from '../types/system-types';
6
+
7
+ export interface CircleProps extends CircleProperties, DistributiveOmit<HTMLStyledProps<'div'>, keyof CircleProperties > {}
8
+
9
+
10
+ export declare const Circle: FunctionComponent<CircleProps>
@@ -0,0 +1,14 @@
1
+ import { createElement, forwardRef } from 'react'
2
+
3
+ import { splitProps } from '../helpers.mjs';
4
+ import { getCircleStyle } from '../patterns/circle.mjs';
5
+ import { styled } from './factory.mjs';
6
+
7
+ export const Circle = /* @__PURE__ */ forwardRef(function Circle(props, ref) {
8
+ const [patternProps, restProps] = splitProps(props, ["size"])
9
+
10
+ const styleProps = getCircleStyle(patternProps)
11
+ const mergedProps = { ref, ...styleProps, ...restProps }
12
+
13
+ return createElement(styled.div, mergedProps)
14
+ })
@@ -0,0 +1,10 @@
1
+ /* eslint-disable */
2
+ import type { FunctionComponent } from 'react'
3
+ import type { ContainerProperties } from '../patterns/container';
4
+ import type { HTMLStyledProps } from '../types/jsx';
5
+ import type { DistributiveOmit } from '../types/system-types';
6
+
7
+ export interface ContainerProps extends ContainerProperties, DistributiveOmit<HTMLStyledProps<'div'>, keyof ContainerProperties > {}
8
+
9
+
10
+ export declare const Container: FunctionComponent<ContainerProps>
@@ -0,0 +1,14 @@
1
+ import { createElement, forwardRef } from 'react'
2
+
3
+ import { splitProps } from '../helpers.mjs';
4
+ import { getContainerStyle } from '../patterns/container.mjs';
5
+ import { styled } from './factory.mjs';
6
+
7
+ export const Container = /* @__PURE__ */ forwardRef(function Container(props, ref) {
8
+ const [patternProps, restProps] = splitProps(props, [])
9
+
10
+ const styleProps = getContainerStyle(patternProps)
11
+ const mergedProps = { ref, ...styleProps, ...restProps }
12
+
13
+ return createElement(styled.div, mergedProps)
14
+ })
@@ -0,0 +1,10 @@
1
+ /* eslint-disable */
2
+ import type { FunctionComponent } from 'react'
3
+ import type { CqProperties } from '../patterns/cq';
4
+ import type { HTMLStyledProps } from '../types/jsx';
5
+ import type { DistributiveOmit } from '../types/system-types';
6
+
7
+ export interface CqProps extends CqProperties, DistributiveOmit<HTMLStyledProps<'div'>, keyof CqProperties > {}
8
+
9
+
10
+ export declare const Cq: FunctionComponent<CqProps>
@@ -0,0 +1,14 @@
1
+ import { createElement, forwardRef } from 'react'
2
+
3
+ import { splitProps } from '../helpers.mjs';
4
+ import { getCqStyle } from '../patterns/cq.mjs';
5
+ import { styled } from './factory.mjs';
6
+
7
+ export const Cq = /* @__PURE__ */ forwardRef(function Cq(props, ref) {
8
+ const [patternProps, restProps] = splitProps(props, ["name","type"])
9
+
10
+ const styleProps = getCqStyle(patternProps)
11
+ const mergedProps = { ref, ...styleProps, ...restProps }
12
+
13
+ return createElement(styled.div, mergedProps)
14
+ })
@@ -0,0 +1,54 @@
1
+ /* eslint-disable */
2
+ import type { SlotRecipeRuntimeFn, RecipeVariantProps } from '../types/recipe';
3
+ import type { JsxHTMLProps, JsxStyleProps, Assign } from '../types/system-types';
4
+ import type { JsxFactoryOptions, ComponentProps, DataAttrs, AsProps } from '../types/jsx';
5
+ import type { ComponentType, ElementType } from 'react'
6
+
7
+ interface UnstyledProps {
8
+ unstyled?: boolean | undefined
9
+ }
10
+
11
+ type SvaFn<S extends string = any> = SlotRecipeRuntimeFn<S, any>
12
+ interface SlotRecipeFn {
13
+ __type: any
14
+ __slot: string
15
+ (props?: any): any
16
+ }
17
+ type SlotRecipe = SvaFn | SlotRecipeFn
18
+
19
+ type InferSlot<R extends SlotRecipe> = R extends SlotRecipeFn ? R['__slot'] : R extends SvaFn<infer S> ? S : never
20
+
21
+ interface WithProviderOptions<P = {}> {
22
+ defaultProps?: (Partial<P> & DataAttrs) | undefined
23
+ }
24
+
25
+ type StyleContextProvider<T extends ElementType, R extends SlotRecipe> = ComponentType<
26
+ JsxHTMLProps<ComponentProps<T> & UnstyledProps & AsProps, Assign<RecipeVariantProps<R>, JsxStyleProps>>
27
+ >
28
+
29
+ type StyleContextRootProvider<T extends ElementType, R extends SlotRecipe> = ComponentType<
30
+ ComponentProps<T> & UnstyledProps & RecipeVariantProps<R>
31
+ >
32
+
33
+ type StyleContextConsumer<T extends ElementType> = ComponentType<
34
+ JsxHTMLProps<ComponentProps<T> & UnstyledProps & AsProps, JsxStyleProps>
35
+ >
36
+
37
+ export interface StyleContext<R extends SlotRecipe> {
38
+ withRootProvider: <T extends ElementType>(
39
+ Component: T,
40
+ options?: WithProviderOptions<ComponentProps<T>> | undefined
41
+ ) => StyleContextRootProvider<T, R>
42
+ withProvider: <T extends ElementType>(
43
+ Component: T,
44
+ slot: InferSlot<R>,
45
+ options?: JsxFactoryOptions<ComponentProps<T>> | undefined
46
+ ) => StyleContextProvider<T, R>
47
+ withContext: <T extends ElementType>(
48
+ Component: T,
49
+ slot: InferSlot<R>,
50
+ options?: JsxFactoryOptions<ComponentProps<T>> | undefined
51
+ ) => StyleContextConsumer<T>
52
+ }
53
+
54
+ export declare function createStyleContext<R extends SlotRecipe>(recipe: R): StyleContext<R>
@@ -0,0 +1,118 @@
1
+ 'use client'
2
+
3
+ import { cx, css, sva } from '../css/index.mjs';
4
+ import { styled } from './factory.mjs';
5
+ import { getDisplayName } from './factory-helper.mjs';
6
+ import { createContext, useContext, createElement, forwardRef } from 'react'
7
+
8
+ function createSafeContext(contextName) {
9
+ const Context = createContext(undefined)
10
+ const useStyleContext = (componentName, slot) => {
11
+ const context = useContext(Context)
12
+ if (context === undefined) {
13
+ const componentInfo = componentName ? `Component "${componentName}"` : 'A component'
14
+ const slotInfo = slot ? ` (slot: "${slot}")` : ''
15
+
16
+ throw new Error(
17
+ `${componentInfo}${slotInfo} cannot access ${contextName} because it's missing its Provider.`
18
+ )
19
+ }
20
+ return context
21
+ }
22
+ return [Context, useStyleContext]
23
+ }
24
+
25
+ export function createStyleContext(recipe) {
26
+ const isConfigRecipe = '__recipe__' in recipe
27
+ const recipeName = isConfigRecipe && recipe.__name__ ? recipe.__name__ : undefined
28
+ const contextName = recipeName ? `createStyleContext("${recipeName}")` : 'createStyleContext'
29
+
30
+ const [StyleContext, useStyleContext] = createSafeContext(contextName)
31
+ const svaFn = isConfigRecipe ? recipe : sva(recipe.config)
32
+
33
+ const getResolvedProps = (props, slotStyles) => {
34
+ const { unstyled, ...restProps } = props
35
+ if (unstyled) return restProps
36
+ if (isConfigRecipe) {
37
+ return { ...restProps, className: cx(slotStyles, restProps.className) }
38
+ }
39
+ return { ...slotStyles, ...restProps }
40
+ }
41
+
42
+ const withRootProvider = (Component, options) => {
43
+ const WithRootProvider = (props) => {
44
+ const [variantProps, otherProps] = svaFn.splitVariantProps(props)
45
+
46
+ const slotStyles = isConfigRecipe ? svaFn(variantProps) : svaFn.raw(variantProps)
47
+ slotStyles._classNameMap = svaFn.classNameMap
48
+
49
+ const mergedProps = options?.defaultProps
50
+ ? { ...options.defaultProps, ...otherProps }
51
+ : otherProps
52
+
53
+ return createElement(StyleContext.Provider, {
54
+ value: slotStyles,
55
+ children: createElement(Component, mergedProps)
56
+ })
57
+ }
58
+
59
+ const componentName = getDisplayName(Component)
60
+ WithRootProvider.displayName = `withRootProvider(${componentName})`
61
+
62
+ return WithRootProvider
63
+ }
64
+
65
+ const withProvider = (Component, slot, options) => {
66
+ const StyledComponent = styled(Component, {}, options)
67
+
68
+ const WithProvider = forwardRef((props, ref) => {
69
+ const [variantProps, restProps] = svaFn.splitVariantProps(props)
70
+
71
+ const slotStyles = isConfigRecipe ? svaFn(variantProps) : svaFn.raw(variantProps)
72
+ slotStyles._classNameMap = svaFn.classNameMap
73
+
74
+ const propsWithClass = { ...restProps, className: restProps.className ?? options?.defaultProps?.className }
75
+ const resolvedProps = getResolvedProps(propsWithClass, slotStyles[slot])
76
+ return createElement(StyleContext.Provider, {
77
+ value: slotStyles,
78
+ children: createElement(StyledComponent, {
79
+ ...resolvedProps,
80
+ className: cx(resolvedProps.className, slotStyles._classNameMap[slot]),
81
+ ref,
82
+ })
83
+ })
84
+ })
85
+
86
+ const componentName = getDisplayName(Component)
87
+ WithProvider.displayName = `withProvider(${componentName})`
88
+
89
+ return WithProvider
90
+ }
91
+
92
+ const withContext = (Component, slot, options) => {
93
+ const StyledComponent = styled(Component, {}, options)
94
+ const componentName = getDisplayName(Component)
95
+
96
+ const WithContext = forwardRef((props, ref) => {
97
+ const slotStyles = useStyleContext(componentName, slot)
98
+
99
+ const propsWithClass = { ...props, className: props.className ?? options?.defaultProps?.className }
100
+ const resolvedProps = getResolvedProps(propsWithClass, slotStyles[slot])
101
+ return createElement(StyledComponent, {
102
+ ...resolvedProps,
103
+ className: cx(resolvedProps.className, slotStyles._classNameMap[slot]),
104
+ ref,
105
+ })
106
+ })
107
+
108
+ WithContext.displayName = `withContext(${componentName})`
109
+
110
+ return WithContext
111
+ }
112
+
113
+ return {
114
+ withRootProvider,
115
+ withProvider,
116
+ withContext,
117
+ }
118
+ }
@@ -0,0 +1,10 @@
1
+ /* eslint-disable */
2
+ import type { FunctionComponent } from 'react'
3
+ import type { DividerProperties } from '../patterns/divider';
4
+ import type { HTMLStyledProps } from '../types/jsx';
5
+ import type { DistributiveOmit } from '../types/system-types';
6
+
7
+ export interface DividerProps extends DividerProperties, DistributiveOmit<HTMLStyledProps<'div'>, keyof DividerProperties > {}
8
+
9
+
10
+ export declare const Divider: FunctionComponent<DividerProps>
@@ -0,0 +1,14 @@
1
+ import { createElement, forwardRef } from 'react'
2
+
3
+ import { splitProps } from '../helpers.mjs';
4
+ import { getDividerStyle } from '../patterns/divider.mjs';
5
+ import { styled } from './factory.mjs';
6
+
7
+ export const Divider = /* @__PURE__ */ forwardRef(function Divider(props, ref) {
8
+ const [patternProps, restProps] = splitProps(props, ["orientation","thickness","color"])
9
+
10
+ const styleProps = getDividerStyle(patternProps)
11
+ const mergedProps = { ref, ...styleProps, ...restProps }
12
+
13
+ return createElement(styled.div, mergedProps)
14
+ })
@@ -0,0 +1,22 @@
1
+ import { isCssProperty } from './is-valid-prop.mjs';
2
+
3
+ export const defaultShouldForwardProp = (prop, variantKeys) => !variantKeys.includes(prop) && !isCssProperty(prop)
4
+
5
+ export const composeShouldForwardProps = (tag, shouldForwardProp) =>
6
+ tag.__shouldForwardProps__ && shouldForwardProp
7
+ ? (propName) => tag.__shouldForwardProps__(propName) && shouldForwardProp(propName)
8
+ : shouldForwardProp
9
+
10
+ export const composeCvaFn = (cvaA, cvaB) => {
11
+ if (cvaA && !cvaB) return cvaA
12
+ if (!cvaA && cvaB) return cvaB
13
+ if ((cvaA.__cva__ && cvaB.__cva__) || (cvaA.__recipe__ && cvaB.__recipe__)) return cvaA.merge(cvaB)
14
+ const error = new TypeError('Cannot merge cva with recipe. Please use either cva or recipe.')
15
+ TypeError.captureStackTrace?.(error)
16
+ throw error
17
+ }
18
+
19
+ export const getDisplayName = (Component) => {
20
+ if (typeof Component === 'string') return Component
21
+ return Component?.displayName || Component?.name || 'Component'
22
+ }
@@ -0,0 +1,3 @@
1
+ /* eslint-disable */
2
+ import type { Styled } from '../types/jsx';
3
+ export declare const styled: Styled
@@ -0,0 +1,89 @@
1
+ import { createElement, forwardRef, useMemo } from 'react'
2
+ import { css, cx, cva } from '../css/index.mjs';
3
+ import { defaultShouldForwardProp, composeShouldForwardProps, composeCvaFn, getDisplayName } from './factory-helper.mjs';
4
+ import { splitProps, normalizeHTMLProps } from '../helpers.mjs';
5
+ import { isCssProperty } from './is-valid-prop.mjs';
6
+
7
+ function styledFn(Dynamic, configOrCva = {}, options = {}) {
8
+ const cvaFn = configOrCva.__cva__ || configOrCva.__recipe__ ? configOrCva : cva(configOrCva)
9
+
10
+ const forwardFn = options.shouldForwardProp || defaultShouldForwardProp
11
+ const shouldForwardProp = (prop) => {
12
+ if (options.forwardProps?.includes(prop)) return true
13
+ return forwardFn(prop, cvaFn.variantKeys)
14
+ }
15
+
16
+ const defaultProps = Object.assign(
17
+ options.dataAttr && configOrCva.__name__ ? { 'data-recipe': configOrCva.__name__ } : {},
18
+ options.defaultProps,
19
+ )
20
+
21
+ const __cvaFn__ = composeCvaFn(Dynamic.__cva__, cvaFn)
22
+ const __shouldForwardProps__ = composeShouldForwardProps(Dynamic, shouldForwardProp)
23
+ const __base__ = Dynamic.__base__ || Dynamic
24
+
25
+ const StyledComponent = /* @__PURE__ */ forwardRef(function StyledComponent(props, ref) {
26
+ const { as: Element = __base__, unstyled, children, ...restProps } = props
27
+
28
+ const combinedProps = useMemo(() => Object.assign({}, defaultProps, restProps), [restProps])
29
+
30
+ const [htmlProps, forwardedProps, variantProps, styleProps, elementProps] = useMemo(() => {
31
+ return splitProps(combinedProps, normalizeHTMLProps.keys, __shouldForwardProps__, __cvaFn__.variantKeys, isCssProperty)
32
+ }, [combinedProps])
33
+
34
+ function recipeClass() {
35
+ const { css: cssStyles, ...propStyles } = styleProps
36
+ const compoundVariantStyles = __cvaFn__.__getCompoundVariantCss__?.(variantProps)
37
+ return cx(__cvaFn__(variantProps, false), css(compoundVariantStyles, propStyles, cssStyles), combinedProps.className)
38
+ }
39
+
40
+ function cvaClass() {
41
+ const { css: cssStyles, ...propStyles } = styleProps
42
+ const cvaStyles = __cvaFn__.raw(variantProps)
43
+ return cx(css(cvaStyles, propStyles, cssStyles), combinedProps.className)
44
+ }
45
+
46
+ const classes = () => {
47
+ if (unstyled) {
48
+ const { css: cssStyles, ...propStyles } = styleProps
49
+ return cx(css(propStyles, cssStyles), combinedProps.className)
50
+ }
51
+ return configOrCva.__recipe__ ? recipeClass() : cvaClass()
52
+ }
53
+
54
+ return createElement(Element, {
55
+ ref,
56
+ ...forwardedProps,
57
+ ...elementProps,
58
+ ...normalizeHTMLProps(htmlProps),
59
+ className: classes(),
60
+ }, children ?? combinedProps.children)
61
+ })
62
+
63
+ const name = getDisplayName(__base__)
64
+
65
+ StyledComponent.displayName = `styled.${name}`
66
+ StyledComponent.__cva__ = __cvaFn__
67
+ StyledComponent.__base__ = __base__
68
+ StyledComponent.__shouldForwardProps__ = shouldForwardProp
69
+
70
+ return StyledComponent
71
+ }
72
+
73
+ function createJsxFactory() {
74
+ const cache = new Map()
75
+
76
+ return new Proxy(styledFn, {
77
+ apply(_, __, args) {
78
+ return styledFn(...args)
79
+ },
80
+ get(_, el) {
81
+ if (!cache.has(el)) {
82
+ cache.set(el, styledFn(el))
83
+ }
84
+ return cache.get(el)
85
+ },
86
+ })
87
+ }
88
+
89
+ export const styled = /* @__PURE__ */ createJsxFactory()
@@ -0,0 +1,10 @@
1
+ /* eslint-disable */
2
+ import type { FunctionComponent } from 'react'
3
+ import type { FlexProperties } from '../patterns/flex';
4
+ import type { HTMLStyledProps } from '../types/jsx';
5
+ import type { DistributiveOmit } from '../types/system-types';
6
+
7
+ export interface FlexProps extends FlexProperties, DistributiveOmit<HTMLStyledProps<'div'>, keyof FlexProperties > {}
8
+
9
+
10
+ export declare const Flex: FunctionComponent<FlexProps>
@@ -0,0 +1,14 @@
1
+ import { createElement, forwardRef } from 'react'
2
+
3
+ import { splitProps } from '../helpers.mjs';
4
+ import { getFlexStyle } from '../patterns/flex.mjs';
5
+ import { styled } from './factory.mjs';
6
+
7
+ export const Flex = /* @__PURE__ */ forwardRef(function Flex(props, ref) {
8
+ const [patternProps, restProps] = splitProps(props, ["align","justify","direction","wrap","basis","grow","shrink"])
9
+
10
+ const styleProps = getFlexStyle(patternProps)
11
+ const mergedProps = { ref, ...styleProps, ...restProps }
12
+
13
+ return createElement(styled.div, mergedProps)
14
+ })
@@ -0,0 +1,10 @@
1
+ /* eslint-disable */
2
+ import type { FunctionComponent } from 'react'
3
+ import type { FloatProperties } from '../patterns/float';
4
+ import type { HTMLStyledProps } from '../types/jsx';
5
+ import type { DistributiveOmit } from '../types/system-types';
6
+
7
+ export interface FloatProps extends FloatProperties, DistributiveOmit<HTMLStyledProps<'div'>, keyof FloatProperties > {}
8
+
9
+
10
+ export declare const Float: FunctionComponent<FloatProps>
@@ -0,0 +1,14 @@
1
+ import { createElement, forwardRef } from 'react'
2
+
3
+ import { splitProps } from '../helpers.mjs';
4
+ import { getFloatStyle } from '../patterns/float.mjs';
5
+ import { styled } from './factory.mjs';
6
+
7
+ export const Float = /* @__PURE__ */ forwardRef(function Float(props, ref) {
8
+ const [patternProps, restProps] = splitProps(props, ["offsetX","offsetY","offset","placement"])
9
+
10
+ const styleProps = getFloatStyle(patternProps)
11
+ const mergedProps = { ref, ...styleProps, ...restProps }
12
+
13
+ return createElement(styled.div, mergedProps)
14
+ })
@@ -0,0 +1,10 @@
1
+ /* eslint-disable */
2
+ import type { FunctionComponent } from 'react'
3
+ import type { GridItemProperties } from '../patterns/grid-item';
4
+ import type { HTMLStyledProps } from '../types/jsx';
5
+ import type { DistributiveOmit } from '../types/system-types';
6
+
7
+ export interface GridItemProps extends GridItemProperties, DistributiveOmit<HTMLStyledProps<'div'>, keyof GridItemProperties > {}
8
+
9
+
10
+ export declare const GridItem: FunctionComponent<GridItemProps>
@@ -0,0 +1,14 @@
1
+ import { createElement, forwardRef } from 'react'
2
+
3
+ import { splitProps } from '../helpers.mjs';
4
+ import { getGridItemStyle } from '../patterns/grid-item.mjs';
5
+ import { styled } from './factory.mjs';
6
+
7
+ export const GridItem = /* @__PURE__ */ forwardRef(function GridItem(props, ref) {
8
+ const [patternProps, restProps] = splitProps(props, ["colSpan","rowSpan","colStart","rowStart","colEnd","rowEnd"])
9
+
10
+ const styleProps = getGridItemStyle(patternProps)
11
+ const mergedProps = { ref, ...styleProps, ...restProps }
12
+
13
+ return createElement(styled.div, mergedProps)
14
+ })
@@ -0,0 +1,10 @@
1
+ /* eslint-disable */
2
+ import type { FunctionComponent } from 'react'
3
+ import type { GridProperties } from '../patterns/grid';
4
+ import type { HTMLStyledProps } from '../types/jsx';
5
+ import type { DistributiveOmit } from '../types/system-types';
6
+
7
+ export interface GridProps extends GridProperties, DistributiveOmit<HTMLStyledProps<'div'>, keyof GridProperties > {}
8
+
9
+
10
+ export declare const Grid: FunctionComponent<GridProps>
@@ -0,0 +1,14 @@
1
+ import { createElement, forwardRef } from 'react'
2
+
3
+ import { splitProps } from '../helpers.mjs';
4
+ import { getGridStyle } from '../patterns/grid.mjs';
5
+ import { styled } from './factory.mjs';
6
+
7
+ export const Grid = /* @__PURE__ */ forwardRef(function Grid(props, ref) {
8
+ const [patternProps, restProps] = splitProps(props, ["gap","columnGap","rowGap","columns","minChildWidth"])
9
+
10
+ const styleProps = getGridStyle(patternProps)
11
+ const mergedProps = { ref, ...styleProps, ...restProps }
12
+
13
+ return createElement(styled.div, mergedProps)
14
+ })
@@ -0,0 +1,10 @@
1
+ /* eslint-disable */
2
+ import type { FunctionComponent } from 'react'
3
+ import type { HstackProperties } from '../patterns/hstack';
4
+ import type { HTMLStyledProps } from '../types/jsx';
5
+ import type { DistributiveOmit } from '../types/system-types';
6
+
7
+ export interface HstackProps extends HstackProperties, DistributiveOmit<HTMLStyledProps<'div'>, keyof HstackProperties > {}
8
+
9
+
10
+ export declare const HStack: FunctionComponent<HstackProps>
@@ -0,0 +1,14 @@
1
+ import { createElement, forwardRef } from 'react'
2
+
3
+ import { splitProps } from '../helpers.mjs';
4
+ import { getHstackStyle } from '../patterns/hstack.mjs';
5
+ import { styled } from './factory.mjs';
6
+
7
+ export const HStack = /* @__PURE__ */ forwardRef(function HStack(props, ref) {
8
+ const [patternProps, restProps] = splitProps(props, ["justify","gap"])
9
+
10
+ const styleProps = getHstackStyle(patternProps)
11
+ const mergedProps = { ref, ...styleProps, ...restProps }
12
+
13
+ return createElement(styled.div, mergedProps)
14
+ })
@@ -0,0 +1,25 @@
1
+ /* eslint-disable */
2
+ export * from './factory';
3
+ export * from './is-valid-prop';
4
+ export * from './create-style-context';
5
+ export * from './box';
6
+ export * from './flex';
7
+ export * from './stack';
8
+ export * from './vstack';
9
+ export * from './hstack';
10
+ export * from './spacer';
11
+ export * from './square';
12
+ export * from './circle';
13
+ export * from './center';
14
+ export * from './link-overlay';
15
+ export * from './aspect-ratio';
16
+ export * from './grid';
17
+ export * from './grid-item';
18
+ export * from './wrap';
19
+ export * from './container';
20
+ export * from './divider';
21
+ export * from './float';
22
+ export * from './bleed';
23
+ export * from './visually-hidden';
24
+ export * from './cq';
25
+ export type { HTMLStyledProps, StyledComponent } from '../types/jsx';
@@ -0,0 +1,23 @@
1
+ export * from './factory.mjs';
2
+ export * from './is-valid-prop.mjs';
3
+ export * from './create-style-context.mjs';
4
+ export * from './box.mjs';
5
+ export * from './flex.mjs';
6
+ export * from './stack.mjs';
7
+ export * from './vstack.mjs';
8
+ export * from './hstack.mjs';
9
+ export * from './spacer.mjs';
10
+ export * from './square.mjs';
11
+ export * from './circle.mjs';
12
+ export * from './center.mjs';
13
+ export * from './link-overlay.mjs';
14
+ export * from './aspect-ratio.mjs';
15
+ export * from './grid.mjs';
16
+ export * from './grid-item.mjs';
17
+ export * from './wrap.mjs';
18
+ export * from './container.mjs';
19
+ export * from './divider.mjs';
20
+ export * from './float.mjs';
21
+ export * from './bleed.mjs';
22
+ export * from './visually-hidden.mjs';
23
+ export * from './cq.mjs';