@discourser/design-system 0.1.6 → 0.2.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 (108) hide show
  1. package/README.md +411 -16
  2. package/dist/index.cjs +1881 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.d.cts +22098 -0
  5. package/dist/index.d.ts +22098 -0
  6. package/dist/index.js +1845 -0
  7. package/dist/index.js.map +1 -0
  8. package/package.json +10 -7
  9. package/styled-system/css/conditions.mjs +1 -1
  10. package/styled-system/css/css.mjs +1 -1
  11. package/styled-system/css/sva.mjs +9 -4
  12. package/styled-system/helpers.mjs +12 -20
  13. package/styled-system/jsx/create-style-context.d.ts +54 -0
  14. package/styled-system/jsx/create-style-context.mjs +118 -0
  15. package/styled-system/jsx/factory.mjs +14 -5
  16. package/styled-system/jsx/index.d.ts +1 -0
  17. package/styled-system/jsx/index.mjs +1 -0
  18. package/styled-system/jsx/is-valid-prop.mjs +2 -2
  19. package/styled-system/patterns/aspect-ratio.d.ts +0 -1
  20. package/styled-system/patterns/bleed.d.ts +0 -1
  21. package/styled-system/patterns/box.d.ts +0 -1
  22. package/styled-system/patterns/center.d.ts +0 -1
  23. package/styled-system/patterns/circle.d.ts +0 -1
  24. package/styled-system/patterns/container.d.ts +0 -1
  25. package/styled-system/patterns/cq.d.ts +0 -1
  26. package/styled-system/patterns/divider.d.ts +1 -2
  27. package/styled-system/patterns/flex.d.ts +0 -1
  28. package/styled-system/patterns/float.d.ts +1 -2
  29. package/styled-system/patterns/grid-item.d.ts +0 -1
  30. package/styled-system/patterns/grid.d.ts +0 -1
  31. package/styled-system/patterns/grid.mjs +1 -1
  32. package/styled-system/patterns/hstack.d.ts +0 -1
  33. package/styled-system/patterns/hstack.mjs +1 -1
  34. package/styled-system/patterns/link-overlay.d.ts +0 -1
  35. package/styled-system/patterns/spacer.d.ts +0 -1
  36. package/styled-system/patterns/square.d.ts +0 -1
  37. package/styled-system/patterns/stack.d.ts +0 -1
  38. package/styled-system/patterns/stack.mjs +1 -1
  39. package/styled-system/patterns/visually-hidden.d.ts +0 -1
  40. package/styled-system/patterns/vstack.d.ts +0 -1
  41. package/styled-system/patterns/vstack.mjs +1 -1
  42. package/styled-system/patterns/wrap.d.ts +0 -1
  43. package/styled-system/patterns/wrap.mjs +1 -1
  44. package/styled-system/recipes/absolute-center.d.ts +34 -0
  45. package/styled-system/recipes/absolute-center.mjs +32 -0
  46. package/styled-system/recipes/accordion.d.ts +38 -0
  47. package/styled-system/recipes/accordion.mjs +67 -0
  48. package/styled-system/recipes/avatar.d.ts +42 -0
  49. package/styled-system/recipes/avatar.mjs +71 -0
  50. package/styled-system/recipes/badge.d.ts +38 -0
  51. package/styled-system/recipes/badge.mjs +41 -0
  52. package/styled-system/recipes/button.d.ts +6 -7
  53. package/styled-system/recipes/button.mjs +11 -7
  54. package/styled-system/recipes/card.d.ts +6 -11
  55. package/styled-system/recipes/card.mjs +50 -23
  56. package/styled-system/recipes/checkbox.d.ts +38 -0
  57. package/styled-system/recipes/checkbox.mjs +68 -0
  58. package/styled-system/recipes/dialog.d.ts +13 -6
  59. package/styled-system/recipes/dialog.mjs +35 -3
  60. package/styled-system/recipes/drawer.d.ts +38 -0
  61. package/styled-system/recipes/drawer.mjs +90 -0
  62. package/styled-system/recipes/field.d.ts +31 -0
  63. package/styled-system/recipes/field.mjs +61 -0
  64. package/styled-system/recipes/group.d.ts +36 -0
  65. package/styled-system/recipes/group.mjs +72 -0
  66. package/styled-system/recipes/index.d.ts +21 -3
  67. package/styled-system/recipes/index.mjs +21 -3
  68. package/styled-system/recipes/input.d.ts +6 -8
  69. package/styled-system/recipes/input.mjs +12 -9
  70. package/styled-system/recipes/popover.d.ts +31 -0
  71. package/styled-system/recipes/popover.mjs +81 -0
  72. package/styled-system/recipes/progress.d.ts +44 -0
  73. package/styled-system/recipes/progress.mjs +98 -0
  74. package/styled-system/recipes/radio-group.d.ts +38 -0
  75. package/styled-system/recipes/radio-group.mjs +68 -0
  76. package/styled-system/recipes/select.d.ts +38 -0
  77. package/styled-system/recipes/select.mjs +111 -0
  78. package/styled-system/recipes/skeleton.d.ts +39 -0
  79. package/styled-system/recipes/skeleton.mjs +40 -0
  80. package/styled-system/recipes/slider.d.ts +42 -0
  81. package/styled-system/recipes/slider.mjs +94 -0
  82. package/styled-system/recipes/spinner.d.ts +34 -0
  83. package/styled-system/recipes/spinner.mjs +36 -0
  84. package/styled-system/recipes/switch-component.d.ts +38 -0
  85. package/styled-system/recipes/switch-component.mjs +65 -0
  86. package/styled-system/recipes/tabs.d.ts +39 -0
  87. package/styled-system/recipes/tabs.mjs +71 -0
  88. package/styled-system/recipes/textarea.d.ts +38 -0
  89. package/styled-system/recipes/textarea.mjs +41 -0
  90. package/styled-system/recipes/toast.d.ts +31 -0
  91. package/styled-system/recipes/toast.mjs +53 -0
  92. package/styled-system/recipes/tooltip.d.ts +31 -0
  93. package/styled-system/recipes/tooltip.mjs +49 -0
  94. package/styled-system/tokens/index.mjs +3483 -635
  95. package/styled-system/tokens/tokens.d.ts +31 -19
  96. package/styled-system/types/composition.d.ts +83 -23
  97. package/styled-system/types/conditions.d.ts +15 -11
  98. package/styled-system/types/jsx.d.ts +27 -10
  99. package/styled-system/types/pattern.d.ts +4 -4
  100. package/styled-system/types/prop-type.d.ts +30 -3
  101. package/styled-system/types/style-props.d.ts +262 -225
  102. package/styled-system/types/system-types.d.ts +162 -2
  103. package/styled-system/recipes/icon-button.d.ts +0 -39
  104. package/styled-system/recipes/icon-button.mjs +0 -39
  105. package/styled-system/recipes/switch-control.d.ts +0 -35
  106. package/styled-system/recipes/switch-control.mjs +0 -53
  107. package/styled-system/recipes/switch.d.ts +0 -35
  108. package/styled-system/recipes/switch.mjs +0 -53
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable */
2
2
  import type { ConditionalValue, Nested } from './conditions';
3
- import type { AtRule, PropertiesFallback } from './csstype';
3
+ import type { AtRule, Globals, PropertiesFallback } from './csstype';
4
4
  import type { SystemProperties, CssVarProperties } from './style-props';
5
5
 
6
6
  type String = string & {}
@@ -22,9 +22,169 @@ export type Assign<T, U> = {
22
22
  * Native css properties
23
23
  * -----------------------------------------------------------------------------*/
24
24
 
25
+ type DashedIdent = `--${string}`
26
+
27
+ type StringToMultiple<T extends string> = T | `${T}, ${T}`
28
+
29
+ export type PositionAreaAxis =
30
+ | 'left'
31
+ | 'center'
32
+ | 'right'
33
+ | 'x-start'
34
+ | 'x-end'
35
+ | 'span-x-start'
36
+ | 'span-x-end'
37
+ | 'x-self-start'
38
+ | 'x-self-end'
39
+ | 'span-x-self-start'
40
+ | 'span-x-self-end'
41
+ | 'span-all'
42
+ | 'top'
43
+ | 'bottom'
44
+ | 'span-top'
45
+ | 'span-bottom'
46
+ | 'y-start'
47
+ | 'y-end'
48
+ | 'span-y-start'
49
+ | 'span-y-end'
50
+ | 'y-self-start'
51
+ | 'y-self-end'
52
+ | 'span-y-self-start'
53
+ | 'span-y-self-end'
54
+ | 'block-start'
55
+ | 'block-end'
56
+ | 'span-block-start'
57
+ | 'span-block-end'
58
+ | 'inline-start'
59
+ | 'inline-end'
60
+ | 'span-inline-start'
61
+ | 'span-inline-end'
62
+ | 'self-block-start'
63
+ | 'self-block-end'
64
+ | 'span-self-block-start'
65
+ | 'span-self-block-end'
66
+ | 'self-inline-start'
67
+ | 'self-inline-end'
68
+ | 'span-self-inline-start'
69
+ | 'span-self-inline-end'
70
+ | 'start'
71
+ | 'end'
72
+ | 'span-start'
73
+ | 'span-end'
74
+ | 'self-start'
75
+ | 'self-end'
76
+ | 'span-self-start'
77
+ | 'span-self-end'
78
+
79
+ type PositionTry =
80
+ | 'normal'
81
+ | 'flip-block'
82
+ | 'flip-inline'
83
+ | 'top'
84
+ | 'bottom'
85
+ | 'left'
86
+ | 'right'
87
+ | 'block-start'
88
+ | 'block-end'
89
+ | 'inline-start'
90
+ | 'inline-end'
91
+ | DashedIdent
92
+
93
+ export interface ModernCssProperties {
94
+ /**
95
+ * Defines a name for the anchor element that can be referenced by positioned elements.
96
+ */
97
+ anchorName?: Globals | 'none' | DashedIdent | StringToMultiple<DashedIdent>
98
+
99
+ /**
100
+ * Defines the scope of anchor names within the element.
101
+ */
102
+ anchorScope?: Globals | 'none' | 'all' | DashedIdent | StringToMultiple<DashedIdent>
103
+
104
+ /**
105
+ * Controls how form elements size themselves.
106
+ */
107
+ fieldSizing?: Globals | 'fixed' | 'content'
108
+
109
+ /**
110
+ * Controls whether interpolation of size values should allow keywords.
111
+ */
112
+ interpolateSize?: Globals | 'allow-keywords' | 'numeric-only'
113
+
114
+ /**
115
+ * Specifies the anchor element that this positioned element should be positioned relative to.
116
+ */
117
+ positionAnchor?: Globals | 'auto' | DashedIdent
118
+
119
+ /**
120
+ * Specifies the area within the anchor element where this positioned element should be placed.
121
+ */
122
+ positionArea?: Globals | 'auto' | PositionAreaAxis | `${PositionAreaAxis} ${PositionAreaAxis}` | String
123
+
124
+ /**
125
+ * Specifies the position try options for the element.
126
+ */
127
+ positionTry?: Globals | StringToMultiple<PositionTry> | String
128
+
129
+ /**
130
+ * Specifies fallback position try options when the primary position fails.
131
+ */
132
+ positionTryFallback?: Globals | 'none' | StringToMultiple<PositionTry> | String
133
+
134
+ /**
135
+ * Specifies the order in which position try options should be attempted.
136
+ */
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
+ */
142
+ positionVisibility?: Globals | 'always' | 'anchors-visible' | 'no-overflow'
143
+
144
+ /**
145
+ * Controls whether text should wrap or not.
146
+ */
147
+ textWrapMode?: Globals | 'wrap' | 'nowrap'
148
+
149
+ /**
150
+ * Controls trimming of spacing in text.
151
+ */
152
+ textSpacingTrim?: Globals | 'normal' | 'space-all' | 'space-first' | 'trim-start'
153
+
154
+ /**
155
+ * Controls the style of text wrapping.
156
+ */
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'
183
+ }
184
+
25
185
  export type CssProperty = keyof PropertiesFallback
26
186
 
27
- export interface CssProperties extends PropertiesFallback<String | Number>, CssVarProperties {}
187
+ export interface CssProperties extends PropertiesFallback<String | Number>, CssVarProperties, ModernCssProperties {}
28
188
 
29
189
  export interface CssKeyframes {
30
190
  [name: string]: {
@@ -1,39 +0,0 @@
1
- /* eslint-disable */
2
- import type { ConditionalValue } from '../types/index';
3
- import type { DistributiveOmit, Pretty } from '../types/system-types';
4
-
5
- interface IconButtonVariant {
6
- /**
7
- * @default "standard"
8
- */
9
- variant: "standard" | "filled" | "tonal" | "outlined"
10
- /**
11
- * @default "md"
12
- */
13
- size: "sm" | "md" | "lg"
14
- }
15
-
16
- type IconButtonVariantMap = {
17
- [key in keyof IconButtonVariant]: Array<IconButtonVariant[key]>
18
- }
19
-
20
- export type IconButtonVariantProps = {
21
- [key in keyof IconButtonVariant]?: ConditionalValue<IconButtonVariant[key]> | undefined
22
- }
23
-
24
- export interface IconButtonRecipe {
25
- __type: IconButtonVariantProps
26
- (props?: IconButtonVariantProps): string
27
- raw: (props?: IconButtonVariantProps) => IconButtonVariantProps
28
- variantMap: IconButtonVariantMap
29
- variantKeys: Array<keyof IconButtonVariant>
30
- splitVariantProps<Props extends IconButtonVariantProps>(props: Props): [IconButtonVariantProps, Pretty<DistributiveOmit<Props, keyof IconButtonVariantProps>>]
31
- getVariantProps: (props?: IconButtonVariantProps) => IconButtonVariantProps
32
- }
33
-
34
- /**
35
- * Material Design 3 icon button component
36
-
37
-
38
- */
39
- export declare const iconButton: IconButtonRecipe
@@ -1,39 +0,0 @@
1
- import { memo, splitProps } from '../helpers.mjs';
2
- import { createRecipe, mergeRecipes } from './create-recipe.mjs';
3
-
4
- const iconButtonFn = /* @__PURE__ */ createRecipe('icon-button', {
5
- "variant": "standard",
6
- "size": "md"
7
- }, [])
8
-
9
- const iconButtonVariantMap = {
10
- "variant": [
11
- "standard",
12
- "filled",
13
- "tonal",
14
- "outlined"
15
- ],
16
- "size": [
17
- "sm",
18
- "md",
19
- "lg"
20
- ]
21
- }
22
-
23
- const iconButtonVariantKeys = Object.keys(iconButtonVariantMap)
24
-
25
- export const iconButton = /* @__PURE__ */ Object.assign(memo(iconButtonFn.recipeFn), {
26
- __recipe__: true,
27
- __name__: 'iconButton',
28
- __getCompoundVariantCss__: iconButtonFn.__getCompoundVariantCss__,
29
- raw: (props) => props,
30
- variantKeys: iconButtonVariantKeys,
31
- variantMap: iconButtonVariantMap,
32
- merge(recipe) {
33
- return mergeRecipes(this, recipe)
34
- },
35
- splitVariantProps(props) {
36
- return splitProps(props, iconButtonVariantKeys)
37
- },
38
- getVariantProps: iconButtonFn.getVariantProps,
39
- })
@@ -1,35 +0,0 @@
1
- /* eslint-disable */
2
- import type { ConditionalValue } from '../types/index';
3
- import type { DistributiveOmit, Pretty } from '../types/system-types';
4
-
5
- interface SwitchControlVariant {
6
- /**
7
- * @default "md"
8
- */
9
- size: "sm" | "md"
10
- }
11
-
12
- type SwitchControlVariantMap = {
13
- [key in keyof SwitchControlVariant]: Array<SwitchControlVariant[key]>
14
- }
15
-
16
- export type SwitchControlVariantProps = {
17
- [key in keyof SwitchControlVariant]?: ConditionalValue<SwitchControlVariant[key]> | undefined
18
- }
19
-
20
- export interface SwitchControlRecipe {
21
- __type: SwitchControlVariantProps
22
- (props?: SwitchControlVariantProps): Pretty<Record<"root" | "control" | "thumb" | "label", string>>
23
- raw: (props?: SwitchControlVariantProps) => SwitchControlVariantProps
24
- variantMap: SwitchControlVariantMap
25
- variantKeys: Array<keyof SwitchControlVariant>
26
- splitVariantProps<Props extends SwitchControlVariantProps>(props: Props): [SwitchControlVariantProps, Pretty<DistributiveOmit<Props, keyof SwitchControlVariantProps>>]
27
- getVariantProps: (props?: SwitchControlVariantProps) => SwitchControlVariantProps
28
- }
29
-
30
- /**
31
- * Material Design 3 switch component
32
-
33
-
34
- */
35
- export declare const switchControl: SwitchControlRecipe
@@ -1,53 +0,0 @@
1
- import { compact, getSlotCompoundVariant, memo, splitProps } from '../helpers.mjs';
2
- import { createRecipe } from './create-recipe.mjs';
3
-
4
- const switchControlDefaultVariants = {
5
- "size": "md"
6
- }
7
- const switchControlCompoundVariants = []
8
-
9
- const switchControlSlotNames = [
10
- [
11
- "root",
12
- "switchControl__root"
13
- ],
14
- [
15
- "control",
16
- "switchControl__control"
17
- ],
18
- [
19
- "thumb",
20
- "switchControl__thumb"
21
- ],
22
- [
23
- "label",
24
- "switchControl__label"
25
- ]
26
- ]
27
- const switchControlSlotFns = /* @__PURE__ */ switchControlSlotNames.map(([slotName, slotKey]) => [slotName, createRecipe(slotKey, switchControlDefaultVariants, getSlotCompoundVariant(switchControlCompoundVariants, slotName))])
28
-
29
- const switchControlFn = memo((props = {}) => {
30
- return Object.fromEntries(switchControlSlotFns.map(([slotName, slotFn]) => [slotName, slotFn.recipeFn(props)]))
31
- })
32
-
33
- const switchControlVariantKeys = [
34
- "size"
35
- ]
36
- const getVariantProps = (variants) => ({ ...switchControlDefaultVariants, ...compact(variants) })
37
-
38
- export const switchControl = /* @__PURE__ */ Object.assign(switchControlFn, {
39
- __recipe__: false,
40
- __name__: 'switchControl',
41
- raw: (props) => props,
42
- variantKeys: switchControlVariantKeys,
43
- variantMap: {
44
- "size": [
45
- "sm",
46
- "md"
47
- ]
48
- },
49
- splitVariantProps(props) {
50
- return splitProps(props, switchControlVariantKeys)
51
- },
52
- getVariantProps
53
- })
@@ -1,35 +0,0 @@
1
- /* eslint-disable */
2
- import type { ConditionalValue } from '../types/index';
3
- import type { DistributiveOmit, Pretty } from '../types/system-types';
4
-
5
- interface SwitchVariant {
6
- /**
7
- * @default "md"
8
- */
9
- size: "sm" | "md"
10
- }
11
-
12
- type SwitchVariantMap = {
13
- [key in keyof SwitchVariant]: Array<SwitchVariant[key]>
14
- }
15
-
16
- export type SwitchVariantProps = {
17
- [key in keyof SwitchVariant]?: ConditionalValue<SwitchVariant[key]> | undefined
18
- }
19
-
20
- export interface SwitchRecipe {
21
- __type: SwitchVariantProps
22
- (props?: SwitchVariantProps): Pretty<Record<"root" | "control" | "thumb" | "label", string>>
23
- raw: (props?: SwitchVariantProps) => SwitchVariantProps
24
- variantMap: SwitchVariantMap
25
- variantKeys: Array<keyof SwitchVariant>
26
- splitVariantProps<Props extends SwitchVariantProps>(props: Props): [SwitchVariantProps, Pretty<DistributiveOmit<Props, keyof SwitchVariantProps>>]
27
- getVariantProps: (props?: SwitchVariantProps) => SwitchVariantProps
28
- }
29
-
30
- /**
31
- * Material Design 3 switch component
32
-
33
-
34
- */
35
- export declare const switch: SwitchRecipe
@@ -1,53 +0,0 @@
1
- import { compact, getSlotCompoundVariant, memo, splitProps } from '../helpers.mjs';
2
- import { createRecipe } from './create-recipe.mjs';
3
-
4
- const switchDefaultVariants = {
5
- "size": "md"
6
- }
7
- const switchCompoundVariants = []
8
-
9
- const switchSlotNames = [
10
- [
11
- "root",
12
- "switchControl__root"
13
- ],
14
- [
15
- "control",
16
- "switchControl__control"
17
- ],
18
- [
19
- "thumb",
20
- "switchControl__thumb"
21
- ],
22
- [
23
- "label",
24
- "switchControl__label"
25
- ]
26
- ]
27
- const switchSlotFns = /* @__PURE__ */ switchSlotNames.map(([slotName, slotKey]) => [slotName, createRecipe(slotKey, switchDefaultVariants, getSlotCompoundVariant(switchCompoundVariants, slotName))])
28
-
29
- const switchFn = memo((props = {}) => {
30
- return Object.fromEntries(switchSlotFns.map(([slotName, slotFn]) => [slotName, slotFn.recipeFn(props)]))
31
- })
32
-
33
- const switchVariantKeys = [
34
- "size"
35
- ]
36
- const getVariantProps = (variants) => ({ ...switchDefaultVariants, ...compact(variants) })
37
-
38
- export const switch = /* @__PURE__ */ Object.assign(switchFn, {
39
- __recipe__: false,
40
- __name__: 'switch',
41
- raw: (props) => props,
42
- variantKeys: switchVariantKeys,
43
- variantMap: {
44
- "size": [
45
- "sm",
46
- "md"
47
- ]
48
- },
49
- splitVariantProps(props) {
50
- return splitProps(props, switchVariantKeys)
51
- },
52
- getVariantProps
53
- })