@stokelp/styled-system 1.7.0 → 1.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stokelp/styled-system",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "Stokelp UI styled-system",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -37,6 +37,10 @@
37
37
  "paddingInline]___[value:space-8",
38
38
  "textAlign]___[value:center",
39
39
  "display]___[value:flex",
40
+ "alignItems]___[value:center",
41
+ "justifyContent]___[value:center",
42
+ "flex]___[value:0 0 auto",
43
+ "borderRadius]___[value:9999px",
40
44
  "alignItems]___[value:flex-start",
41
45
  "gap]___[value:0",
42
46
  "flexDirection]___[value:column",
@@ -44,7 +48,6 @@
44
48
  "gap]___[value:space-16",
45
49
  "borderColor]___[value:primary.100",
46
50
  "marginBlock]___[value:space-24",
47
- "alignItems]___[value:center",
48
51
  "gap]___[value:10px"
49
52
  ],
50
53
  "recipes": {
@@ -69,6 +72,13 @@
69
72
  "switchRecipe": [
70
73
  "size]___[value:md]___[recipe:switchRecipe"
71
74
  ],
75
+ "tag": [
76
+ "size]___[value:md]___[recipe:tag",
77
+ "severity]___[value:neutral]___[recipe:tag",
78
+ "severity]___[value:success]___[recipe:tag",
79
+ "severity]___[value:warning]___[recipe:tag",
80
+ "severity]___[value:error]___[recipe:tag"
81
+ ],
72
82
  "heading": [
73
83
  "size]___[value:h2]___[recipe:heading"
74
84
  ],
@@ -14,4 +14,5 @@ export * from './accordion';
14
14
  export * from './form-label';
15
15
  export * from './checkbox';
16
16
  export * from './tabs';
17
+ export * from './tag';
17
18
  export * from './select';
package/recipes/index.mjs CHANGED
@@ -13,4 +13,5 @@ export * from './accordion.mjs';
13
13
  export * from './form-label.mjs';
14
14
  export * from './checkbox.mjs';
15
15
  export * from './tabs.mjs';
16
+ export * from './tag.mjs';
16
17
  export * from './select.mjs';
@@ -0,0 +1,29 @@
1
+ /* eslint-disable */
2
+ import type { ConditionalValue } from '../types/index';
3
+ import type { DistributiveOmit, Pretty } from '../types/system-types';
4
+
5
+ interface TagVariant {
6
+ size: "lg" | "md" | "sm"
7
+ severity: "success" | "warning" | "error" | "neutral"
8
+ }
9
+
10
+ type TagVariantMap = {
11
+ [key in keyof TagVariant]: Array<TagVariant[key]>
12
+ }
13
+
14
+ export type TagVariantProps = {
15
+ [key in keyof TagVariant]?: ConditionalValue<TagVariant[key]> | undefined
16
+ }
17
+
18
+ export interface TagRecipe {
19
+ __type: TagVariantProps
20
+ (props?: TagVariantProps): Pretty<Record<"root" | "badge", string>>
21
+ raw: (props?: TagVariantProps) => TagVariantProps
22
+ variantMap: TagVariantMap
23
+ variantKeys: Array<keyof TagVariant>
24
+ splitVariantProps<Props extends TagVariantProps>(props: Props): [TagVariantProps, Pretty<DistributiveOmit<Props, keyof TagVariantProps>>]
25
+ getVariantProps: (props?: TagVariantProps) => TagVariantProps
26
+ }
27
+
28
+ /** The styles for the Tag component */
29
+ export declare const tag: TagRecipe
@@ -0,0 +1,54 @@
1
+ import { compact, getSlotCompoundVariant, memo, splitProps } from '../helpers.mjs';
2
+ import { createRecipe } from './create-recipe.mjs';
3
+
4
+ const tagDefaultVariants = {
5
+ "size": "md",
6
+ "severity": "neutral"
7
+ }
8
+ const tagCompoundVariants = []
9
+
10
+ const tagSlotNames = [
11
+ [
12
+ "root",
13
+ "tag__root"
14
+ ],
15
+ [
16
+ "badge",
17
+ "tag__badge"
18
+ ]
19
+ ]
20
+ const tagSlotFns = /* @__PURE__ */ tagSlotNames.map(([slotName, slotKey]) => [slotName, createRecipe(slotKey, tagDefaultVariants, getSlotCompoundVariant(tagCompoundVariants, slotName))])
21
+
22
+ const tagFn = memo((props = {}) => {
23
+ return Object.fromEntries(tagSlotFns.map(([slotName, slotFn]) => [slotName, slotFn.recipeFn(props)]))
24
+ })
25
+
26
+ const tagVariantKeys = [
27
+ "size",
28
+ "severity"
29
+ ]
30
+ const getVariantProps = (variants) => ({ ...tagDefaultVariants, ...compact(variants) })
31
+
32
+ export const tag = /* @__PURE__ */ Object.assign(tagFn, {
33
+ __recipe__: false,
34
+ __name__: 'tag',
35
+ raw: (props) => props,
36
+ variantKeys: tagVariantKeys,
37
+ variantMap: {
38
+ "size": [
39
+ "lg",
40
+ "md",
41
+ "sm"
42
+ ],
43
+ "severity": [
44
+ "success",
45
+ "warning",
46
+ "error",
47
+ "neutral"
48
+ ]
49
+ },
50
+ splitVariantProps(props) {
51
+ return splitProps(props, tagVariantKeys)
52
+ },
53
+ getVariantProps
54
+ })