@mekari/pixel3-styled-system 0.1.6 → 0.1.7-dev.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.
Files changed (143) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/css/conditions.mjs +1 -1
  3. package/css/css.mjs +1 -1
  4. package/css/sva.mjs +9 -4
  5. package/helpers.mjs +11 -22
  6. package/jsx/create-style-context.d.ts +58 -0
  7. package/jsx/create-style-context.mjs +116 -0
  8. package/jsx/factory.mjs +13 -2
  9. package/jsx/index.d.ts +1 -0
  10. package/jsx/index.mjs +1 -0
  11. package/jsx/is-valid-prop.mjs +1 -1
  12. package/package.json +1 -1
  13. package/recipes/accordion-slot-recipe.d.ts +4 -1
  14. package/recipes/accordion-slot-recipe.mjs +1 -0
  15. package/recipes/airene-bubble-slot-recipe.d.ts +4 -1
  16. package/recipes/airene-bubble-slot-recipe.mjs +1 -0
  17. package/recipes/airene-button-slot-recipe.d.ts +4 -1
  18. package/recipes/airene-button-slot-recipe.mjs +1 -0
  19. package/recipes/airene-input-slot-recipe.d.ts +4 -1
  20. package/recipes/airene-input-slot-recipe.mjs +1 -0
  21. package/recipes/autocomplete-slot-recipe.d.ts +4 -1
  22. package/recipes/autocomplete-slot-recipe.mjs +1 -0
  23. package/recipes/avatar-group-slot-recipe.d.ts +4 -1
  24. package/recipes/avatar-group-slot-recipe.mjs +1 -0
  25. package/recipes/avatar-slot-recipe.d.ts +4 -1
  26. package/recipes/avatar-slot-recipe.mjs +1 -0
  27. package/recipes/badge-recipe.d.ts +3 -0
  28. package/recipes/banner-close-button-recipe.d.ts +3 -0
  29. package/recipes/banner-description-recipe.d.ts +3 -0
  30. package/recipes/banner-icon-slot-recipe.d.ts +4 -1
  31. package/recipes/banner-icon-slot-recipe.mjs +1 -0
  32. package/recipes/banner-link-recipe.d.ts +3 -0
  33. package/recipes/banner-slot-recipe.d.ts +4 -1
  34. package/recipes/banner-slot-recipe.mjs +1 -0
  35. package/recipes/banner-title-recipe.d.ts +3 -0
  36. package/recipes/broadcast-slot-recipe.d.ts +4 -1
  37. package/recipes/broadcast-slot-recipe.mjs +1 -0
  38. package/recipes/button-group-recipe.d.ts +3 -0
  39. package/recipes/button-recipe.d.ts +3 -0
  40. package/recipes/calendar-panel-range-recipe.d.ts +3 -0
  41. package/recipes/carousel-slot-recipe.d.ts +4 -1
  42. package/recipes/carousel-slot-recipe.mjs +1 -0
  43. package/recipes/chart-slot-recipe.d.ts +4 -1
  44. package/recipes/chart-slot-recipe.mjs +1 -0
  45. package/recipes/checkbox-slot-recipe.d.ts +4 -1
  46. package/recipes/checkbox-slot-recipe.mjs +1 -0
  47. package/recipes/color-picker-slot-recipe.d.ts +4 -1
  48. package/recipes/color-picker-slot-recipe.mjs +1 -0
  49. package/recipes/date-item-recipe.d.ts +3 -0
  50. package/recipes/date-picker-slot-recipe.d.ts +4 -1
  51. package/recipes/date-picker-slot-recipe.mjs +1 -0
  52. package/recipes/day-item-recipe.d.ts +3 -0
  53. package/recipes/divider-slot-recipe.d.ts +4 -1
  54. package/recipes/divider-slot-recipe.mjs +1 -0
  55. package/recipes/dropzone-slot-recipe.d.ts +4 -1
  56. package/recipes/dropzone-slot-recipe.mjs +1 -0
  57. package/recipes/form-control-slot-recipe.d.ts +4 -1
  58. package/recipes/form-control-slot-recipe.mjs +1 -0
  59. package/recipes/icon-recipe.d.ts +3 -0
  60. package/recipes/input-addon-slot-recipe.d.ts +4 -1
  61. package/recipes/input-addon-slot-recipe.mjs +1 -0
  62. package/recipes/input-group-slot-recipe.d.ts +4 -1
  63. package/recipes/input-group-slot-recipe.mjs +1 -0
  64. package/recipes/input-slot-recipe.d.ts +4 -1
  65. package/recipes/input-slot-recipe.mjs +1 -0
  66. package/recipes/input-tag-slot-recipe.d.ts +4 -1
  67. package/recipes/input-tag-slot-recipe.mjs +1 -0
  68. package/recipes/modal-slot-recipe.d.ts +4 -1
  69. package/recipes/modal-slot-recipe.mjs +1 -0
  70. package/recipes/month-item-recipe.d.ts +3 -0
  71. package/recipes/pinbar-slot-recipe.d.ts +4 -1
  72. package/recipes/pinbar-slot-recipe.mjs +1 -0
  73. package/recipes/popover-content-recipe.d.ts +3 -0
  74. package/recipes/popover-list-item-recipe.d.ts +3 -0
  75. package/recipes/popover-list-recipe.d.ts +3 -0
  76. package/recipes/progress-slot-recipe.d.ts +4 -1
  77. package/recipes/progress-slot-recipe.mjs +1 -0
  78. package/recipes/radio-slot-recipe.d.ts +4 -1
  79. package/recipes/radio-slot-recipe.mjs +1 -0
  80. package/recipes/rating-slot-recipe.d.ts +4 -1
  81. package/recipes/rating-slot-recipe.mjs +1 -0
  82. package/recipes/rich-text-editor-slot-recipe.d.ts +4 -1
  83. package/recipes/rich-text-editor-slot-recipe.mjs +1 -0
  84. package/recipes/rtestyle-provider-recipe.d.ts +3 -0
  85. package/recipes/scrollbar-recipe.d.ts +3 -0
  86. package/recipes/segmented-control-slot-recipe.d.ts +4 -1
  87. package/recipes/segmented-control-slot-recipe.mjs +1 -0
  88. package/recipes/select-slot-recipe.d.ts +4 -1
  89. package/recipes/select-slot-recipe.mjs +1 -0
  90. package/recipes/shared-slot-recipe.d.ts +4 -1
  91. package/recipes/shared-slot-recipe.mjs +1 -0
  92. package/recipes/skeleton-recipe.d.ts +3 -0
  93. package/recipes/slider-slot-recipe.d.ts +4 -1
  94. package/recipes/slider-slot-recipe.mjs +1 -0
  95. package/recipes/spinner-recipe.d.ts +3 -0
  96. package/recipes/tab-list-slot-recipe.d.ts +4 -1
  97. package/recipes/tab-list-slot-recipe.mjs +1 -0
  98. package/recipes/tab-recipe.d.ts +3 -0
  99. package/recipes/tab-selected-border-recipe.d.ts +3 -0
  100. package/recipes/table-container-recipe.d.ts +3 -0
  101. package/recipes/table-date-slot-recipe.d.ts +4 -1
  102. package/recipes/table-date-slot-recipe.mjs +1 -0
  103. package/recipes/table-month-slot-recipe.d.ts +4 -1
  104. package/recipes/table-month-slot-recipe.mjs +1 -0
  105. package/recipes/table-recipe.d.ts +3 -0
  106. package/recipes/table-year-slot-recipe.d.ts +4 -1
  107. package/recipes/table-year-slot-recipe.mjs +1 -0
  108. package/recipes/tag-slot-recipe.d.ts +4 -1
  109. package/recipes/tag-slot-recipe.mjs +1 -0
  110. package/recipes/text-recipe.d.ts +3 -0
  111. package/recipes/textarea-recipe.d.ts +3 -0
  112. package/recipes/textlink-recipe.d.ts +3 -0
  113. package/recipes/time-item-recipe.d.ts +3 -0
  114. package/recipes/time-panel-slot-recipe.d.ts +4 -1
  115. package/recipes/time-panel-slot-recipe.mjs +1 -0
  116. package/recipes/timeline-accordion-slot-recipe.d.ts +4 -1
  117. package/recipes/timeline-accordion-slot-recipe.mjs +1 -0
  118. package/recipes/timeline-document-slot-recipe.d.ts +4 -1
  119. package/recipes/timeline-document-slot-recipe.mjs +1 -0
  120. package/recipes/timeline-log-slot-recipe.d.ts +4 -1
  121. package/recipes/timeline-log-slot-recipe.mjs +1 -0
  122. package/recipes/timeline-separator-slot-recipe.d.ts +4 -1
  123. package/recipes/timeline-separator-slot-recipe.mjs +1 -0
  124. package/recipes/timeline-slot-recipe.d.ts +4 -1
  125. package/recipes/timeline-slot-recipe.mjs +1 -0
  126. package/recipes/toast-slot-recipe.d.ts +4 -1
  127. package/recipes/toast-slot-recipe.mjs +1 -0
  128. package/recipes/toggle-slot-recipe.d.ts +4 -1
  129. package/recipes/toggle-slot-recipe.mjs +1 -0
  130. package/recipes/tooltip-recipe.d.ts +3 -0
  131. package/recipes/tour-slot-recipe.d.ts +4 -1
  132. package/recipes/tour-slot-recipe.mjs +1 -0
  133. package/recipes/upload-list-slot-recipe.d.ts +4 -1
  134. package/recipes/upload-list-slot-recipe.mjs +1 -0
  135. package/recipes/upload-slot-recipe.d.ts +4 -1
  136. package/recipes/upload-slot-recipe.mjs +1 -0
  137. package/recipes/year-item-recipe.d.ts +3 -0
  138. package/types/composition.d.ts +83 -23
  139. package/types/conditions.d.ts +7 -3
  140. package/types/jsx.d.ts +24 -5
  141. package/types/prop-type.d.ts +10 -1
  142. package/types/style-props.d.ts +14 -1
  143. package/types/system-types.d.ts +76 -0
package/types/jsx.d.ts CHANGED
@@ -14,8 +14,26 @@ export type ComponentProps<T extends ElementType> = T extends IntrinsicElement
14
14
  ? Props
15
15
  : never
16
16
 
17
+ interface Dict {
18
+ [k: string]: unknown
19
+ }
20
+
21
+ export interface UnstyledProps {
22
+ /**
23
+ * Whether to remove recipe styles
24
+ */
25
+ unstyled?: boolean | undefined
26
+ }
27
+
28
+ export interface AsProps {
29
+ /**
30
+ * The element to render as
31
+ */
32
+ as?: ElementType | undefined
33
+ }
34
+
17
35
  export interface PixelComponent<T extends ElementType, P extends Dict = {}> extends FunctionalComponent<
18
- JsxHTMLProps<ComponentProps<T>, Assign<JsxStyleProps, P>>
36
+ JsxHTMLProps<ComponentProps<T> & UnstyledProps & AsProps, Assign<JsxStyleProps, P>>
19
37
  > {}
20
38
 
21
39
  interface RecipeFn {
@@ -24,11 +42,12 @@ interface RecipeFn {
24
42
 
25
43
  export interface JsxFactoryOptions<TProps extends Dict> {
26
44
  dataAttr?: boolean
27
- defaultProps?: TProps
28
- shouldForwardProp?(prop: string, variantKeys: string[]): boolean
45
+ defaultProps?: Partial<TProps>
46
+ shouldForwardProp?: (prop: string, variantKeys: string[]) => boolean
47
+ forwardProps?: string[]
29
48
  }
30
49
 
31
- export type JsxRecipeProps<T extends ElementType, P extends RecipeFn> = JsxHTMLProps<ComponentProps<T>, Assign<JsxStyleProps, P['__type']>>;
50
+ export type JsxRecipeProps<T extends ElementType, P extends RecipeFn> = JsxHTMLProps<ComponentProps<T> & UnstyledProps & AsProps, Assign<JsxStyleProps, P['__type']>>;
32
51
 
33
52
  export type JsxElement<T extends ElementType, P> = T extends PixelComponent<infer A, infer B>
34
53
  ? PixelComponent<A, Pretty<DistributiveUnion<P, B>>>
@@ -49,6 +68,6 @@ export type JsxElements = {
49
68
 
50
69
  export type Pixel = JsxFactory & JsxElements
51
70
 
52
- export type HTMLPixelProps<T extends ElementType> = JsxHTMLProps<ComponentProps<T>, JsxStyleProps>
71
+ export type HTMLPixelProps<T extends ElementType> = JsxHTMLProps<ComponentProps<T> & UnstyledProps & AsProps, JsxStyleProps>
53
72
 
54
73
  export type PixelVariantProps<T extends PixelComponent<any, any>> = T extends PixelComponent<any, infer Props> ? Props : never
@@ -60,6 +60,12 @@ export interface UtilityValues {
60
60
  outlineWidth: Tokens["borderWidths"];
61
61
  outlineColor: Tokens["colors"];
62
62
  outlineOffset: Tokens["spacing"];
63
+ focusRing: "outside" | "inside" | "mixed" | "none";
64
+ focusVisibleRing: "outside" | "inside" | "mixed" | "none";
65
+ focusRingColor: Tokens["colors"];
66
+ focusRingOffset: Tokens["spacing"];
67
+ focusRingWidth: Tokens["borderWidths"] | CssProperties["outlineWidth"];
68
+ focusRingStyle: CssProperties["outlineStyle"];
63
69
  divideX: Tokens["borderWidths"];
64
70
  divideY: Tokens["borderWidths"];
65
71
  divideColor: Tokens["colors"];
@@ -76,6 +82,7 @@ export interface UtilityValues {
76
82
  minBlockSize: "auto" | Tokens["sizes"] | "svh" | "lvh" | "dvh" | "screen" | "1/2" | "1/3" | "2/3" | "1/4" | "2/4" | "3/4" | "1/5" | "2/5" | "3/5" | "4/5" | "1/6" | "2/6" | "3/6" | "4/6" | "5/6";
77
83
  maxHeight: "auto" | Tokens["sizes"] | "svh" | "lvh" | "dvh" | "screen" | "1/2" | "1/3" | "2/3" | "1/4" | "2/4" | "3/4" | "1/5" | "2/5" | "3/5" | "4/5" | "1/6" | "2/6" | "3/6" | "4/6" | "5/6";
78
84
  maxBlockSize: "auto" | Tokens["sizes"] | "svh" | "lvh" | "dvh" | "screen" | "1/2" | "1/3" | "2/3" | "1/4" | "2/4" | "3/4" | "1/5" | "2/5" | "3/5" | "4/5" | "1/6" | "2/6" | "3/6" | "4/6" | "5/6";
85
+ boxSize: "auto" | Tokens["sizes"] | "1/2" | "1/3" | "2/3" | "1/4" | "2/4" | "3/4" | "1/5" | "2/5" | "3/5" | "4/5" | "1/6" | "2/6" | "3/6" | "4/6" | "5/6" | "1/12" | "2/12" | "3/12" | "4/12" | "5/12" | "6/12" | "7/12" | "8/12" | "9/12" | "10/12" | "11/12" | "screen";
79
86
  color: Tokens["colors"];
80
87
  fontFamily: Tokens["fonts"] | "Inter";
81
88
  fontSize: Tokens["fontSizes"];
@@ -93,6 +100,7 @@ export interface UtilityValues {
93
100
  background: Tokens["colors"];
94
101
  backgroundColor: Tokens["colors"];
95
102
  backgroundGradient: "to-t" | "to-tr" | "to-r" | "to-br" | "to-b" | "to-bl" | "to-l" | "to-tl";
103
+ backgroundLinear: "to-t" | "to-tr" | "to-r" | "to-br" | "to-b" | "to-bl" | "to-l" | "to-tl";
96
104
  textGradient: "to-t" | "to-tr" | "to-r" | "to-br" | "to-b" | "to-bl" | "to-l" | "to-tl";
97
105
  gradientFrom: Tokens["colors"];
98
106
  gradientTo: Tokens["colors"];
@@ -144,7 +152,8 @@ export interface UtilityValues {
144
152
  borderSpacingY: Tokens["spacing"];
145
153
  transitionDelay: Tokens["durations"];
146
154
  transitionDuration: Tokens["durations"];
147
- transition: "all" | "common" | "background" | "colors" | "opacity" | "shadow" | "transform";
155
+ transitionProperty: "common" | "colors" | "size" | "position" | "background";
156
+ transition: "all" | "common" | "size" | "position" | "background" | "colors" | "opacity" | "shadow" | "transform";
148
157
  animationName: "fade-in" | "fade-out" | "spin" | "border-shine" | "shimmer";
149
158
  animationDuration: Tokens["durations"];
150
159
  animationDelay: Tokens["durations"];
@@ -5907,7 +5907,7 @@ transitionDuration?: ConditionalValue<UtilityValues["transitionDuration"] | CssV
5907
5907
  *
5908
5908
  * @see https://developer.mozilla.org/docs/Web/CSS/transition-property
5909
5909
  */
5910
- transitionProperty?: ConditionalValue<CssProperties["transitionProperty"] | AnyString>
5910
+ transitionProperty?: ConditionalValue<UtilityValues["transitionProperty"] | CssVars | CssProperties["transitionProperty"] | AnyString>
5911
5911
  /**
5912
5912
  * The **`transition-timing-function`** CSS property sets how intermediate values are calculated for CSS properties being affected by a transition effect.
5913
5913
  *
@@ -6992,6 +6992,9 @@ bgBlendMode?: ConditionalValue<CssProperties["backgroundBlendMode"] | AnyString>
6992
6992
  */
6993
6993
  bgSize?: ConditionalValue<CssProperties["backgroundSize"] | AnyString>
6994
6994
  bgGradient?: ConditionalValue<UtilityValues["backgroundGradient"] | CssVars | AnyString>
6995
+ bgLinear?: ConditionalValue<UtilityValues["backgroundLinear"] | CssVars | AnyString>
6996
+ bgRadial?: ConditionalValue<string | number | AnyString>
6997
+ bgConic?: ConditionalValue<string | number | AnyString>
6995
6998
  /**
6996
6999
  * The **`border-radius`** CSS property rounds the corners of an element's outer border edge. You can set a single radius to make circular corners, or two radii to make elliptical corners.
6997
7000
  *
@@ -7359,13 +7362,23 @@ scrollPaddingX?: ConditionalValue<UtilityValues["scrollPaddingInline"] | CssVars
7359
7362
  hideBelow?: ConditionalValue<UtilityValues["hideBelow"] | CssVars | AnyString>
7360
7363
  spaceX?: ConditionalValue<UtilityValues["spaceX"] | CssVars | AnyString>
7361
7364
  spaceY?: ConditionalValue<UtilityValues["spaceY"] | CssVars | AnyString>
7365
+ focusRing?: ConditionalValue<UtilityValues["focusRing"] | CssVars | AnyString>
7366
+ focusVisibleRing?: ConditionalValue<UtilityValues["focusVisibleRing"] | CssVars | AnyString>
7367
+ focusRingColor?: ConditionalValue<UtilityValues["focusRingColor"] | CssVars | AnyString>
7368
+ focusRingOffset?: ConditionalValue<UtilityValues["focusRingOffset"] | CssVars | AnyString>
7369
+ focusRingWidth?: ConditionalValue<UtilityValues["focusRingWidth"] | CssVars | AnyString>
7370
+ focusRingStyle?: ConditionalValue<UtilityValues["focusRingStyle"] | CssVars | AnyString>
7362
7371
  divideX?: ConditionalValue<UtilityValues["divideX"] | CssVars | AnyString>
7363
7372
  divideY?: ConditionalValue<UtilityValues["divideY"] | CssVars | AnyString>
7364
7373
  divideColor?: ConditionalValue<UtilityValues["divideColor"] | CssVars | AnyString>
7365
7374
  divideStyle?: ConditionalValue<UtilityValues["divideStyle"] | CssVars | AnyString>
7375
+ boxSize?: ConditionalValue<UtilityValues["boxSize"] | CssVars | AnyString>
7366
7376
  fontSmoothing?: ConditionalValue<UtilityValues["fontSmoothing"] | CssVars | AnyString>
7367
7377
  truncate?: ConditionalValue<UtilityValues["truncate"] | CssVars | AnyString>
7368
7378
  backgroundGradient?: ConditionalValue<UtilityValues["backgroundGradient"] | CssVars | AnyString>
7379
+ backgroundLinear?: ConditionalValue<UtilityValues["backgroundLinear"] | CssVars | AnyString>
7380
+ backgroundRadial?: ConditionalValue<string | number | AnyString>
7381
+ backgroundConic?: ConditionalValue<string | number | AnyString>
7369
7382
  textGradient?: ConditionalValue<UtilityValues["textGradient"] | CssVars | AnyString>
7370
7383
  gradientFromPosition?: ConditionalValue<string | number | AnyString>
7371
7384
  gradientToPosition?: ConditionalValue<string | number | AnyString>
@@ -91,19 +91,95 @@ type PositionTry =
91
91
  | DashedIdent
92
92
 
93
93
  export interface ModernCssProperties {
94
+ /**
95
+ * Defines a name for the anchor element that can be referenced by positioned elements.
96
+ */
94
97
  anchorName?: Globals | 'none' | DashedIdent | StringToMultiple<DashedIdent>
98
+
99
+ /**
100
+ * Defines the scope of anchor names within the element.
101
+ */
95
102
  anchorScope?: Globals | 'none' | 'all' | DashedIdent | StringToMultiple<DashedIdent>
103
+
104
+ /**
105
+ * Controls how form elements size themselves.
106
+ */
96
107
  fieldSizing?: Globals | 'fixed' | 'content'
108
+
109
+ /**
110
+ * Controls whether interpolation of size values should allow keywords.
111
+ */
97
112
  interpolateSize?: Globals | 'allow-keywords' | 'numeric-only'
113
+
114
+ /**
115
+ * Specifies the anchor element that this positioned element should be positioned relative to.
116
+ */
98
117
  positionAnchor?: Globals | 'auto' | DashedIdent
118
+
119
+ /**
120
+ * Specifies the area within the anchor element where this positioned element should be placed.
121
+ */
99
122
  positionArea?: Globals | 'auto' | PositionAreaAxis | `${PositionAreaAxis} ${PositionAreaAxis}` | String
123
+
124
+ /**
125
+ * Specifies the position try options for the element.
126
+ */
100
127
  positionTry?: Globals | StringToMultiple<PositionTry> | String
128
+
129
+ /**
130
+ * Specifies fallback position try options when the primary position fails.
131
+ */
101
132
  positionTryFallback?: Globals | 'none' | StringToMultiple<PositionTry> | String
133
+
134
+ /**
135
+ * Specifies the order in which position try options should be attempted.
136
+ */
102
137
  positionTryOrder?: Globals | 'normal' | 'most-width' | 'most-height' | 'most-block-size' | 'most-inline-size'
138
+
139
+ /**
140
+ * Controls when the positioned element should be visible.
141
+ */
103
142
  positionVisibility?: Globals | 'always' | 'anchors-visible' | 'no-overflow'
143
+
144
+ /**
145
+ * Controls whether text should wrap or not.
146
+ */
104
147
  textWrapMode?: Globals | 'wrap' | 'nowrap'
148
+
149
+ /**
150
+ * Controls trimming of spacing in text.
151
+ */
105
152
  textSpacingTrim?: Globals | 'normal' | 'space-all' | 'space-first' | 'trim-start'
153
+
154
+ /**
155
+ * Controls the style of text wrapping.
156
+ */
106
157
  textWrapStyle?: Globals | 'auto' | 'balance' | 'pretty' | 'stable'
158
+
159
+ /**
160
+ * Controls whether the entire element should be draggable instead of its contents.
161
+ */
162
+ WebkitUserDrag?: Globals | 'auto' | 'element' | 'none'
163
+
164
+ /**
165
+ * Specifies whether an element can be used to drag the entire app window (Electron).
166
+ */
167
+ WebkitAppRegion?: Globals | 'drag' | 'no-drag'
168
+
169
+ /**
170
+ * Sets the horizontal spacing between table borders.
171
+ */
172
+ WebkitBorderHorizontalSpacing?: Globals | String | Number
173
+
174
+ /**
175
+ * Sets the vertical spacing between table borders.
176
+ */
177
+ WebkitBorderVerticalSpacing?: Globals | String | Number
178
+
179
+ /**
180
+ * Controls the display of text content for security purposes (e.g., password fields).
181
+ */
182
+ WebkitTextSecurity?: Globals | 'none' | 'circle' | 'disc' | 'square'
107
183
  }
108
184
 
109
185
  export type CssProperty = keyof PropertiesFallback