@instructure/emotion 11.6.0 → 11.6.1-snapshot-129

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 (69) hide show
  1. package/CHANGELOG.md +51 -303
  2. package/es/InstUISettingsProvider/index.js +1 -1
  3. package/es/getComponentThemeOverride.js +5 -4
  4. package/es/getTheme.js +2 -2
  5. package/es/index.js +4 -1
  6. package/es/styleUtils/calcFocusOutlineStyles.js +71 -0
  7. package/es/styleUtils/calcSpacingFromShorthand.js +112 -0
  8. package/es/styleUtils/index.js +2 -1
  9. package/es/useStyle.js +27 -6
  10. package/es/useStyleLegacy.js +49 -0
  11. package/es/useTheme.js +1 -1
  12. package/es/withStyle.js +13 -31
  13. package/es/withStyleLegacy.js +116 -0
  14. package/lib/InstUISettingsProvider/index.js +1 -1
  15. package/lib/getComponentThemeOverride.js +5 -4
  16. package/lib/getTheme.js +2 -2
  17. package/lib/index.js +38 -7
  18. package/lib/styleUtils/calcFocusOutlineStyles.js +78 -0
  19. package/lib/styleUtils/calcSpacingFromShorthand.js +118 -0
  20. package/lib/styleUtils/index.js +14 -7
  21. package/lib/useStyle.js +28 -6
  22. package/lib/useStyleLegacy.js +59 -0
  23. package/lib/useTheme.js +1 -1
  24. package/lib/withStyle.js +13 -31
  25. package/lib/withStyleLegacy.js +125 -0
  26. package/package.json +11 -9
  27. package/src/EmotionTypes.ts +10 -1
  28. package/src/InstUISettingsProvider/index.tsx +5 -1
  29. package/src/getComponentThemeOverride.ts +9 -8
  30. package/src/getTheme.ts +8 -2
  31. package/src/index.ts +7 -2
  32. package/src/styleUtils/calcFocusOutlineStyles.ts +106 -0
  33. package/src/styleUtils/calcSpacingFromShorthand.ts +127 -0
  34. package/src/styleUtils/index.ts +2 -1
  35. package/src/useStyle.ts +63 -32
  36. package/src/useStyleLegacy.ts +92 -0
  37. package/src/useTheme.ts +4 -1
  38. package/src/withStyle.tsx +29 -39
  39. package/src/withStyleLegacy.tsx +212 -0
  40. package/tsconfig.build.json +3 -0
  41. package/tsconfig.build.tsbuildinfo +1 -1
  42. package/types/EmotionTypes.d.ts +4 -2
  43. package/types/EmotionTypes.d.ts.map +1 -1
  44. package/types/InstUISettingsProvider/index.d.ts.map +1 -1
  45. package/types/getComponentThemeOverride.d.ts +4 -5
  46. package/types/getComponentThemeOverride.d.ts.map +1 -1
  47. package/types/getTheme.d.ts.map +1 -1
  48. package/types/index.d.ts +6 -2
  49. package/types/index.d.ts.map +1 -1
  50. package/types/styleUtils/calcFocusOutlineStyles.d.ts +51 -0
  51. package/types/styleUtils/calcFocusOutlineStyles.d.ts.map +1 -0
  52. package/types/styleUtils/calcSpacingFromShorthand.d.ts +33 -0
  53. package/types/styleUtils/calcSpacingFromShorthand.d.ts.map +1 -0
  54. package/types/styleUtils/index.d.ts +2 -1
  55. package/types/styleUtils/index.d.ts.map +1 -1
  56. package/types/useStyle.d.ts +15 -13
  57. package/types/useStyle.d.ts.map +1 -1
  58. package/types/useStyleLegacy.d.ts +22 -0
  59. package/types/useStyleLegacy.d.ts.map +1 -0
  60. package/types/useTheme.d.ts.map +1 -1
  61. package/types/withStyle.d.ts +2 -22
  62. package/types/withStyle.d.ts.map +1 -1
  63. package/types/withStyleLegacy.d.ts +22 -0
  64. package/types/withStyleLegacy.d.ts.map +1 -0
  65. package/es/styleUtils/mapSpacingToShorthand.js +0 -29
  66. package/lib/styleUtils/mapSpacingToShorthand.js +0 -35
  67. package/src/styleUtils/mapSpacingToShorthand.ts +0 -35
  68. package/types/styleUtils/mapSpacingToShorthand.d.ts +0 -5
  69. package/types/styleUtils/mapSpacingToShorthand.d.ts.map +0 -1
@@ -1,4 +1,5 @@
1
1
  import type { BaseTheme, ComponentTheme, ComponentThemeMap, DeepPartial } from '@instructure/shared-types';
2
+ import type { Theme, SharedTokens } from '@instructure/ui-themes';
2
3
  /**
3
4
  * A theme object where every prop is optional
4
5
  */
@@ -65,12 +66,13 @@ type Overrides = {
65
66
  */
66
67
  componentOverrides?: ComponentOverride;
67
68
  };
68
- type BaseThemeOrOverride = BaseTheme | PartialTheme | Overrides;
69
+ type BaseThemeOrOverride = Theme | PartialTheme | Overrides;
69
70
  type ThemeOrOverride = BaseThemeOrOverride | ((theme: BaseTheme) => BaseThemeOrOverride);
70
71
  type Props = Record<string, unknown>;
71
72
  type State = Record<string, unknown>;
72
73
  type GenerateComponentTheme = (theme: BaseTheme | PartialTheme) => ComponentTheme;
73
74
  type GenerateStyle = (componentTheme: ComponentTheme, props: Props, state?: State) => StyleObject;
75
+ type GenerateStyleRework = (componentTheme: ComponentTheme, props: Props, sharedTokens: SharedTokens, state?: State) => StyleObject;
74
76
  type GenerateStyleFunctional = (componentTheme: ComponentTheme, params: Record<string, unknown>) => StyleObject;
75
77
  type ComponentStyle<Keys extends string = string> = Record<Keys, StyleObject | string | number | undefined>;
76
78
  /**
@@ -79,5 +81,5 @@ type ComponentStyle<Keys extends string = string> = Record<Keys, StyleObject | s
79
81
  export interface StyleObject {
80
82
  [key: string]: StyleObject | string | number | undefined;
81
83
  }
82
- export type { BaseThemeOrOverride, ThemeOrOverride, Overrides, ComponentOverride, SpecificThemeOverride, ThemeOverride, PartialTheme, Props, State, GenerateComponentTheme, GenerateStyle, GenerateStyleFunctional, ComponentStyle };
84
+ export type { BaseThemeOrOverride, ThemeOrOverride, Overrides, ComponentOverride, SpecificThemeOverride, ThemeOverride, PartialTheme, Props, State, GenerateComponentTheme, GenerateStyle, GenerateStyleRework, GenerateStyleFunctional, ComponentStyle };
83
85
  //# sourceMappingURL=EmotionTypes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EmotionTypes.d.ts","sourceRoot":"","sources":["../src/EmotionTypes.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EACV,SAAS,EACT,cAAc,EACd,iBAAiB,EACjB,WAAW,EACZ,MAAM,2BAA2B,CAAA;AAElC;;GAEG;AACH,KAAK,YAAY,GAAG,WAAW,CAAC,IAAI,CAAC,SAAS,EAAE,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,EACV,mBAAmB,EACnB,eAAe,EACf,SAAS,EACT,iBAAiB,EACjB,qBAAqB,EACrB,aAAa,EACb,YAAY,EACZ,KAAK,EACL,KAAK,EACL,sBAAsB,EACtB,aAAa,EACb,mBAAmB,EACnB,uBAAuB,EACvB,cAAc,EACf,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/InstUISettingsProvider/index.tsx"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAA;AAE/E,KAAK,mBAAmB,GAAG;IACzB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAE1B;;OAEG;IACH,KAAK,CAAC,EAAE,eAAe,CAAA;IAEvB;;;;;;OAMG;IACH,kBAAkB,CAAC,EAAE,4BAA4B,CAAA;IAEjD;;;;;OAKG;IACH,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAA;CACpB,CAAA;AAED;;;;;GAKG;AACH,iBAAS,sBAAsB,CAAC,EAC9B,QAAQ,EACR,KAAU,EACV,GAAG,EACH,kBAAkB,EACnB,EAAE,mBAAmB,oDAwBrB;AAED,eAAe,sBAAsB,CAAA;AACrC,OAAO,EAAE,sBAAsB,EAAE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/InstUISettingsProvider/index.tsx"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAA;AAE/E,KAAK,mBAAmB,GAAG;IACzB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAE1B;;OAEG;IACH,KAAK,CAAC,EAAE,eAAe,CAAA;IAEvB;;;;;;OAMG;IACH,kBAAkB,CAAC,EAAE,4BAA4B,CAAA;IAEjD;;;;;OAKG;IACH,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAA;CACpB,CAAA;AAED;;;;;GAKG;AACH,iBAAS,sBAAsB,CAAC,EAC9B,QAAQ,EACR,KAAU,EACV,GAAG,EACH,kBAAkB,EACnB,EAAE,mBAAmB,oDA4BrB;AAED,eAAe,sBAAsB,CAAA;AACrC,OAAO,EAAE,sBAAsB,EAAE,CAAA"}
@@ -1,6 +1,7 @@
1
1
  import type { ThemeOrOverride } from './EmotionTypes';
2
2
  import type { ComponentTheme } from '@instructure/shared-types';
3
- import type { WithStyleProps } from './withStyle';
3
+ import { ThemeOverrideProp } from './withStyle';
4
+ import { ThemeOverrideValue } from './useStyle';
4
5
  /**
5
6
  * ---
6
7
  * private: true
@@ -11,13 +12,11 @@ import type { WithStyleProps } from './withStyle';
11
12
  * @param theme - Theme object
12
13
  * @param displayName - Name of the component
13
14
  * @param componentId - componentId of the component
14
- * @param props - The component's props object
15
+ * @param themeOverride - The theme override object
15
16
  * @param componentTheme - The component's default theme
16
17
  * @returns The calculated theme override object
17
18
  */
18
- declare const getComponentThemeOverride: (theme: ThemeOrOverride, displayName: string, componentId?: string, props?: {
19
- [k: string]: unknown;
20
- } & WithStyleProps, componentTheme?: ComponentTheme) => Partial<ComponentTheme>;
19
+ declare const getComponentThemeOverride: (theme: ThemeOrOverride, displayName: string, componentId?: string, themeOverride?: ThemeOverrideProp["themeOverride"] | ThemeOverrideValue, componentTheme?: ComponentTheme) => Partial<ComponentTheme>;
21
20
  export default getComponentThemeOverride;
22
21
  export { getComponentThemeOverride };
23
22
  //# sourceMappingURL=getComponentThemeOverride.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getComponentThemeOverride.d.ts","sourceRoot":"","sources":["../src/getComponentThemeOverride.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EACV,eAAe,EAGhB,MAAM,gBAAgB,CAAA;AACvB,OAAO,KAAK,EAAa,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAIjD;;;;;;;;;;;;;GAaG;AACH,QAAA,MAAM,yBAAyB,GAC7B,OAAO,eAAe,EACtB,aAAa,MAAM,EACnB,cAAc,MAAM,EACpB,QAAQ;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,GAAG,cAAc,EACjD,iBAAiB,cAAc,KAC9B,OAAO,CAAC,cAAc,CAiCxB,CAAA;AAED,eAAe,yBAAyB,CAAA;AACxC,OAAO,EAAE,yBAAyB,EAAE,CAAA"}
1
+ {"version":3,"file":"getComponentThemeOverride.d.ts","sourceRoot":"","sources":["../src/getComponentThemeOverride.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EACV,eAAe,EAGhB,MAAM,gBAAgB,CAAA;AACvB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAI/C;;;;;;;;;;;;;GAaG;AACH,QAAA,MAAM,yBAAyB,GAC7B,OAAO,eAAe,EACtB,aAAa,MAAM,EACnB,cAAc,MAAM,EAEpB,gBAAgB,iBAAiB,CAAC,eAAe,CAAC,GAAG,kBAAkB,EACvE,iBAAiB,cAAc,KAC9B,OAAO,CAAC,cAAc,CAgCxB,CAAA;AAED,eAAe,yBAAyB,CAAA;AACxC,OAAO,EAAE,yBAAyB,EAAE,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"getTheme.d.ts","sourceRoot":"","sources":["../src/getTheme.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAE1D,OAAO,KAAK,EAEV,eAAe,EAEhB,MAAM,gBAAgB,CAAA;AAEvB;;;;;;;;;;;;;;;GAeG;AACH,QAAA,MAAM,QAAQ,GACX,iBAAiB,eAAe,MAChC,gBAAsB,SAAS,oCAoD/B,CAAA;AAEH,eAAe,QAAQ,CAAA;AACvB,OAAO,EAAE,QAAQ,EAAE,CAAA"}
1
+ {"version":3,"file":"getTheme.d.ts","sourceRoot":"","sources":["../src/getTheme.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAE1D,OAAO,KAAK,EAEV,eAAe,EAEhB,MAAM,gBAAgB,CAAA;AAEvB;;;;;;;;;;;;;;;GAeG;AACH,QAAA,MAAM,QAAQ,GACX,iBAAiB,eAAe,MAChC,gBAAsB,SAAS,oCA0D/B,CAAA;AAEH,eAAe,QAAQ,CAAA;AACvB,OAAO,EAAE,QAAQ,EAAE,CAAA"}
package/types/index.d.ts CHANGED
@@ -1,10 +1,14 @@
1
1
  export * from '@emotion/react';
2
2
  export { InstUISettingsProvider } from './InstUISettingsProvider';
3
+ export { withStyleLegacy } from './withStyleLegacy';
4
+ export { getComponentThemeOverride } from './getComponentThemeOverride';
3
5
  export { withStyle } from './withStyle';
4
- export { ThemeablePropValues, makeThemeVars, getShorthandPropValue, mirrorShorthandCorners, mirrorShorthandEdges, mapSpacingToShorthand } from './styleUtils';
6
+ export { ThemeablePropValues, makeThemeVars, getShorthandPropValue, mirrorShorthandCorners, mirrorShorthandEdges, calcSpacingFromShorthand, calcFocusOutlineStyles } from './styleUtils';
7
+ export { useStyleLegacy } from './useStyleLegacy';
5
8
  export { useStyle } from './useStyle';
6
9
  export { useTheme } from './useTheme';
7
10
  export type { ComponentStyle, StyleObject, Overrides } from './EmotionTypes';
8
- export type { WithStyleProps } from './withStyle';
11
+ export type { WithStyleProps } from './withStyleLegacy';
12
+ export type { ThemeOverrideValue } from './useStyle';
9
13
  export type { SpacingValues, Spacing, Shadow, Stacking, Background, BorderRadiiValues, BorderRadii, BorderWidthValues, BorderWidth } from './styleUtils';
10
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAyBA,cAAc,gBAAgB,CAAA;AAE9B,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC5E,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,YAAY,EACV,aAAa,EACb,OAAO,EACP,MAAM,EACN,QAAQ,EACR,UAAU,EACV,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,WAAW,EACZ,MAAM,cAAc,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAyBA,cAAc,gBAAgB,CAAA;AAE9B,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,wBAAwB,EACxB,sBAAsB,EACvB,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC5E,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACvD,YAAY,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AACpD,YAAY,EACV,aAAa,EACb,OAAO,EACP,MAAM,EACN,QAAQ,EACR,UAAU,EACV,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,WAAW,EACZ,MAAM,cAAc,CAAA"}
@@ -0,0 +1,51 @@
1
+ import type { SharedTokens } from '@instructure/ui-themes';
2
+ /**
3
+ * This function creates CSS-in-JS styles for focus indicators.
4
+ *
5
+ * @returns CSS-in-JS style object containing focus outline styles ready for use with emotion or similar libraries.
6
+ */
7
+ declare const calcFocusOutlineStyles: (
8
+ /**
9
+ * The focus outline theme configuration object containing color and sizing tokens.
10
+ */
11
+ theme: SharedTokens["focusOutline"], params?: {
12
+ /**
13
+ * The color variant to use for the focus outline
14
+ */
15
+ focusColor?: "info" | "inverse" | "success" | "danger";
16
+ /**
17
+ * Whether to position the outline outside ('offset') or inside ('inset') the element.
18
+ */
19
+ focusPosition?: "offset" | "inset";
20
+ /**
21
+ * Whether to include smooth transition animations for focus changes.
22
+ */
23
+ shouldAnimateFocus?: boolean;
24
+ /**
25
+ * Whether to apply focus styles to :focus-within pseudo-class for container elements.
26
+ */
27
+ focusWithin?: boolean;
28
+ /**
29
+ * Whether to force showing the focus outline.
30
+ */
31
+ withFocusOutline?: boolean;
32
+ /**
33
+ * What CSS selector to use to display the focus ring, `:focus` by default.
34
+ */
35
+ customCSSSelector?: string;
36
+ }) => {
37
+ '&:focus-within'?: {
38
+ outlineColor: string;
39
+ outlineStyle: string;
40
+ outlineWidth: string;
41
+ outlineOffset: string;
42
+ } | undefined;
43
+ outlineColor: string;
44
+ outlineStyle: string;
45
+ outlineWidth?: string | undefined;
46
+ outlineOffset: string;
47
+ transition?: string | undefined;
48
+ };
49
+ export default calcFocusOutlineStyles;
50
+ export { calcFocusOutlineStyles };
51
+ //# sourceMappingURL=calcFocusOutlineStyles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calcFocusOutlineStyles.d.ts","sourceRoot":"","sources":["../../src/styleUtils/calcFocusOutlineStyles.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAE1D;;;;GAIG;AACH,QAAA,MAAM,sBAAsB;AAC1B;;GAEG;AACH,OAAO,YAAY,CAAC,cAAc,CAAC,EACnC,SAAS;IACP;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAA;IACtD;;OAEG;IACH,aAAa,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAA;IAClC;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B;;;;;;;;;;;;CAyCF,CAAA;AAED,eAAe,sBAAsB,CAAA;AACrC,OAAO,EAAE,sBAAsB,EAAE,CAAA"}
@@ -0,0 +1,33 @@
1
+ import type { Spacing } from './ThemeablePropValues';
2
+ type DeepStringRecord = {
3
+ [key: string]: string | DeepStringRecord;
4
+ };
5
+ /**
6
+ * Converts shorthand spacing values into CSS strings using theme spacing tokens.
7
+ *
8
+ * This function parses space-separated spacing values (margin, padding) and resolves theme
9
+ * tokens to their actual CSS values. It supports CSS shorthand syntax (1-4 values), nested
10
+ * theme token paths using dot notation, and automatically converts hyphen-case tokens to camelCase.
11
+ *
12
+ * @param {Spacing | undefined} value - The shorthand spacing value string containing space-separated tokens or CSS values.
13
+ * Tokens can be in camelCase (mediumSmall) or hyphen-case (medium-small).
14
+ * Can be undefined, in which case '0' is returned.
15
+ * @param {Record<string, string>} spacingMap - The spacing theme object containing spacing tokens and nested values.
16
+ * Typically comes from `sharedTokens.margin.spacing` or `sharedTokens.padding.spacing` in the component theme.
17
+ *
18
+ * @returns {string} The resolved CSS spacing string ready to be used in styles.
19
+ *
20
+ * @example
21
+ * // Hyphen-case tokens are converted to camelCase
22
+ * calcSpacingFromShorthand('medium-small', spacingMap) // resolves to spacingMap.mediumSmall
23
+ * calcSpacingFromShorthand('x-large small', spacingMap) // resolves to spacingMap.xLarge + spacingMap.small
24
+ *
25
+ * // Dot notation paths are NOT converted
26
+ * calcSpacingFromShorthand('gap.nested-value', spacingMap) // resolves to spacingMap.gap['nested-value']
27
+ *
28
+ * // CSS values like 'none', 'auto', '10px' are returned as-is
29
+ * calcSpacingFromShorthand('none', spacingMap) // returns 'none'
30
+ */
31
+ export declare function calcSpacingFromShorthand(value: Spacing | undefined, spacingMap: DeepStringRecord): string | undefined;
32
+ export {};
33
+ //# sourceMappingURL=calcSpacingFromShorthand.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calcSpacingFromShorthand.d.ts","sourceRoot":"","sources":["../../src/styleUtils/calcSpacingFromShorthand.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAEpD,KAAK,gBAAgB,GAAG;IACtB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,gBAAgB,CAAA;CACzC,CAAA;AAUD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,OAAO,GAAG,SAAS,EAC1B,UAAU,EAAE,gBAAgB,sBA6D7B"}
@@ -3,6 +3,7 @@ export { makeThemeVars } from './makeThemeVars';
3
3
  export { getShorthandPropValue } from './getShorthandPropValue';
4
4
  export { mirrorShorthandCorners } from './mirrorShorthandCorners';
5
5
  export { mirrorShorthandEdges } from './mirrorShorthandEdges';
6
- export { mapSpacingToShorthand } from './mapSpacingToShorthand';
6
+ export { calcSpacingFromShorthand } from './calcSpacingFromShorthand';
7
+ export { calcFocusOutlineStyles } from './calcFocusOutlineStyles';
7
8
  export type { SpacingValues, Spacing, Shadow, Stacking, Background, BorderRadiiValues, BorderRadii, BorderWidthValues, BorderWidth } from './ThemeablePropValues';
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/styleUtils/index.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAE/D,YAAY,EACV,aAAa,EACb,OAAO,EACP,MAAM,EACN,QAAQ,EACR,UAAU,EACV,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,WAAW,EACZ,MAAM,uBAAuB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/styleUtils/index.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AAEjE,YAAY,EACV,aAAa,EACb,OAAO,EACP,MAAM,EACN,QAAQ,EACR,UAAU,EACV,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,WAAW,EACZ,MAAM,uBAAuB,CAAA"}
@@ -1,20 +1,22 @@
1
- import type { BaseTheme, ComponentTheme } from '@instructure/shared-types';
1
+ import type { SharedTokens, NewComponentTypes, Theme } from '@instructure/ui-themes';
2
2
  type SecondParameter<T extends (...args: any) => any> = Parameters<T>[1] extends undefined ? never : Parameters<T>[1];
3
- type UseStyleParamsWithTheme<P extends (theme: any, params: any) => any> = {
3
+ type GenerateStyleParams = ((componentTheme: any, params: any, sharedTokens: SharedTokens) => any) | ((componentTheme: any, params: any) => any) | ((componentTheme: any) => any);
4
+ /**
5
+ * Type for a theme override
6
+ */
7
+ type ThemeOverrideValue = Partial<Theme> | ((componentTheme: Theme, currentTheme: NewComponentTypes[keyof NewComponentTypes]) => Partial<Theme>);
8
+ /**
9
+ * new useStyle syntax, use this with v12 themes
10
+ */
11
+ declare const useStyle: <P extends GenerateStyleParams>(useStyleParams: {
4
12
  generateStyle: P;
5
13
  params?: SecondParameter<P>;
6
- generateComponentTheme: (theme: BaseTheme) => ComponentTheme;
7
- componentId: string;
14
+ componentId: keyof NewComponentTypes | string;
15
+ themeOverride: ThemeOverrideValue | undefined;
8
16
  displayName?: string;
9
- };
10
- type UseStyleParamsWithoutTheme<P extends (theme: any, params: any) => any> = {
11
- generateStyle: P;
12
- params?: SecondParameter<P>;
13
- generateComponentTheme?: undefined;
14
- componentId?: undefined;
15
- displayName?: undefined;
16
- };
17
- declare const useStyle: <P extends (theme: any, params: any) => any>(useStyleParams: UseStyleParamsWithTheme<P> | UseStyleParamsWithoutTheme<P>) => ReturnType<P>;
17
+ useTokensFrom?: keyof NewComponentTypes;
18
+ }) => ReturnType<P>;
18
19
  export default useStyle;
19
20
  export { useStyle };
21
+ export type { ThemeOverrideValue };
20
22
  //# sourceMappingURL=useStyle.d.ts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AU,CAAC,CAAC,CAiCf,CAAA;AAED,eAAe,QAAQ,CAAA;AACvB,OAAO,EAAE,QAAQ,EAAE,CAAA;AACnB,YAAY,EAAE,kBAAkB,EAAE,CAAA"}
@@ -0,0 +1,22 @@
1
+ import type { ComponentTheme } from '@instructure/shared-types';
2
+ import type { Theme } from '@instructure/ui-themes';
3
+ type SecondParameter<T extends (...args: any) => any> = Parameters<T>[1] extends undefined ? never : Parameters<T>[1];
4
+ type GenerateComponentTheme = (theme: Theme) => ComponentTheme;
5
+ type UseStyleParamsWithTheme<P extends (componentTheme: any, params: any, theme: any) => any> = {
6
+ generateStyle: P;
7
+ params?: SecondParameter<P>;
8
+ generateComponentTheme: GenerateComponentTheme;
9
+ componentId: string;
10
+ displayName?: string;
11
+ };
12
+ type UseStyleParamsWithoutTheme<P extends (componentTheme: any, params: any, theme: any) => any> = {
13
+ generateStyle: P;
14
+ params?: SecondParameter<P>;
15
+ generateComponentTheme?: undefined;
16
+ componentId?: undefined;
17
+ displayName?: undefined;
18
+ };
19
+ declare const useStyleLegacy: <P extends (componentTheme: any, params: any, theme: any) => any>(useStyleParams: UseStyleParamsWithTheme<P> | UseStyleParamsWithoutTheme<P>) => ReturnType<P>;
20
+ export default useStyleLegacy;
21
+ export { useStyleLegacy };
22
+ //# sourceMappingURL=useStyleLegacy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useStyleLegacy.d.ts","sourceRoot":"","sources":["../src/useStyleLegacy.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAGnD,KAAK,eAAe,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG,IAClD,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,C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MAAM,QAAQ,2BAYb,CAAA;AAED,eAAe,QAAQ,CAAA;AACvB,OAAO,EAAE,QAAQ,EAAE,CAAA"}
1
+ {"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../src/useTheme.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAEzD;;;;;;;GAOG;AACH,QAAA,MAAM,QAAQ,2BAeb,CAAA;AAED,eAAe,QAAQ,CAAA;AACvB,OAAO,EAAE,QAAQ,EAAE,CAAA"}
@@ -22,9 +22,8 @@ type WithStyleProps<Theme extends ComponentTheme | null = ComponentTheme, Style
22
22
  * ```js-code
23
23
  * import { withStyle } from '@instructure/emotion'
24
24
  * import generateStyle from './styles'
25
- * import generateComponentTheme from './theme'
26
25
  *
27
- * export default withStyle(generateStyle, generateComponentTheme)(ExampleComponent)
26
+ * export default withStyle(generateStyle)(ExampleComponent)
28
27
  * ```
29
28
  *
30
29
  * Themeable components inject their themed styles into the document
@@ -43,24 +42,6 @@ type WithStyleProps<Theme extends ComponentTheme | null = ComponentTheme, Style
43
42
  *
44
43
  * See more about the overrides on the [Using theme overrides](/#using-theme-overrides) docs page.
45
44
  *
46
- * ```js-code
47
- * // ExampleComponent/theme.js
48
- * const generateComponentTheme = (theme) => {
49
- * const { colors } = theme
50
- *
51
- * const componentVariables = {
52
- * background: colors?.backgroundMedium,
53
- * color: colors?.textDarkest,
54
- *
55
- * hoverColor: colors?.textLightest,
56
- * hoverBackground: colors?.backgroundDarkest
57
- * }
58
- *
59
- * return componentVariables
60
- * }
61
- * export default generateComponentTheme
62
- * ```
63
- *
64
45
  * ```jsx-code
65
46
  * {// global theme override}
66
47
  * <InstUISettingsProvider theme={{
@@ -80,11 +61,10 @@ type WithStyleProps<Theme extends ComponentTheme | null = ComponentTheme, Style
80
61
  * @module withStyle
81
62
  *
82
63
  * @param {function} generateStyle - The function that returns the component's style object
83
- * @param {function} generateComponentTheme - The function that returns the component's theme variables object
84
64
  * @returns {ReactElement} The decorated WithStyle Component
85
65
  */
86
66
  declare const withStyle: (...args: unknown[]) => (ComposedComponent: import("react").ComponentClass<any>) => any;
87
67
  export default withStyle;
88
68
  export { withStyle };
89
- export type { WithStyleProps };
69
+ export type { WithStyleProps, ThemeOverrideProp };
90
70
  //# sourceMappingURL=withStyle.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"withStyle.d.ts","sourceRoot":"","sources":["../src/withStyle.tsx"],"names":[],"mappings":"AAwCA,OAAO,KAAK,EACV,SAAS,EACT,cAAc,EAEf,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EACV,cAAc,EAKf,MAAM,gBAAgB,CAAA;AAYvB,KAAK,qBAAqB,CACxB,KAAK,SAAS,cAAc,GAAG,IAAI,GAAG,cAAc,IAClD,KAAK,SAAS,IAAI,GAClB,MAAM,GACN;IACE,MAAM,CAAC,EAAE,KAAK,CAAA;IACd,UAAU,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAA;CAC3D,CAAA;AAEL,KAAK,iBAAiB,CAAC,KAAK,SAAS,cAAc,GAAG,IAAI,GAAG,cAAc,IAAI;IAC7E,aAAa,CAAC,EACV,OAAO,CAAC,KAAK,CAAC,GACd,CAAC,CAAC,cAAc,EAAE,KAAK,EAAE,YAAY,EAAE,SAAS,KAAK,OAAO,CAAC,KAAK,CAAC,CAAC,CAAA;CACzE,CAAA;AAED,KAAK,cAAc,CACjB,KAAK,SAAS,cAAc,GAAG,IAAI,GAAG,cAAc,EACpD,KAAK,SAAS,cAAc,GAAG,IAAI,GAAG,cAAc,IAClD,KAAK,SAAS,IAAI,GAClB,qBAAqB,CAAC,KAAK,CAAC,GAC5B,qBAAqB,CAAC,KAAK,CAAC,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAA;AAO3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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e,SAAS,CAAA;AACxB,OAAO,EAAE,SAAS,EAAE,CAAA;AACpB,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,CAAA"}
@@ -0,0 +1,22 @@
1
+ import type { BaseTheme, ComponentTheme } from '@instructure/shared-types';
2
+ import type { ComponentStyle } from './EmotionTypes';
3
+ type WithStylePrivateProps<Style extends ComponentStyle | null = ComponentStyle> = Style extends null ? object : {
4
+ styles?: Style;
5
+ makeStyles?: (extraArgs?: Record<string, unknown>) => void;
6
+ };
7
+ type ThemeOverrideProp<Theme extends ComponentTheme | null = ComponentTheme> = {
8
+ themeOverride?: Partial<Theme> | ((componentTheme: Theme, currentTheme: BaseTheme) => Partial<Theme>);
9
+ };
10
+ type WithStyleProps<Theme extends ComponentTheme | null = ComponentTheme, Style extends ComponentStyle | null = ComponentStyle> = Theme extends null ? WithStylePrivateProps<Style> : WithStylePrivateProps<Style> & ThemeOverrideProp<Theme>;
11
+ /**
12
+ * ---
13
+ * category: utilities/themes
14
+ * ---
15
+ * used for old (v11 and eariler) theming system
16
+ * TODO delete when the theme migration is complete
17
+ */
18
+ declare const withStyleLegacy: (...args: unknown[]) => (ComposedComponent: import("react").ComponentClass<any>) => any;
19
+ export default withStyleLegacy;
20
+ export { withStyleLegacy };
21
+ export type { WithStyleProps };
22
+ //# sourceMappingURL=withStyleLegacy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withStyleLegacy.d.ts","sourceRoot":"","sources":["../src/withStyleLegacy.tsx"],"names":[],"mappings":"AAwCA,OAAO,KAAK,EACV,SAAS,EACT,cAAc,EAEf,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EACV,cAAc,EAKf,MAAM,gBAAgB,CAAA;AAYvB,KAAK,qBAAqB,CACxB,KAAK,SAAS,cAAc,GAAG,IAAI,GAAG,cAAc,IAClD,KAAK,SAAS,IAAI,GAClB,MAAM,GACN;IACE,MAAM,CAAC,EAAE,KAAK,CAAA;IACd,UAAU,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAA;CAC3D,CAAA;AAEL,KAAK,iBAAiB,CAAC,KAAK,SAAS,cAAc,GAAG,IAAI,GAAG,cAAc,IAAI;IAC7E,aAAa,CAAC,EACV,OAAO,CAAC,KAAK,CAAC,GACd,CAAC,CAAC,cAAc,EAAE,KAAK,EAAE,YAAY,EAAE,SAAS,KAAK,OAAO,CAAC,KAAK,CAAC,CAAC,CAAA;CACzE,CAAA;AAED,KAAK,cAAc,CACjB,KAAK,SAAS,cAAc,GAAG,IAAI,GAAG,cAAc,EACpD,KAAK,SAAS,cAAc,GAAG,IAAI,GAAG,cAAc,IAClD,KAAK,SAAS,IAAI,GAClB,qBAAqB,CAAC,KAAK,CAAC,GAC5B,qBAAqB,CAAC,KAAK,CAAC,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAA;AAO3D;;;;;;GAMG;AACH,QAAA,MAAM,eAAe,yFA8GpB,CAAA;AAED,eAAe,eAAe,CAAA;AAC9B,OAAO,EAAE,eAAe,EAAE,CAAA;AAC1B,YAAY,EAAE,cAAc,EAAE,CAAA"}
@@ -1,29 +0,0 @@
1
- /*
2
- * The MIT License (MIT)
3
- *
4
- * Copyright (c) 2015 - present Instructure, Inc.
5
- *
6
- * Permission is hereby granted, free of charge, to any person obtaining a copy
7
- * of this software and associated documentation files (the "Software"), to deal
8
- * in the Software without restriction, including without limitation the rights
9
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- * copies of the Software, and to permit persons to whom the Software is
11
- * furnished to do so, subject to the following conditions:
12
- *
13
- * The above copyright notice and this permission notice shall be included in all
14
- * copies or substantial portions of the Software.
15
- *
16
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- * SOFTWARE.
23
- */
24
-
25
- export function mapSpacingToShorthand(value, spacingMap) {
26
- const splitMargin = value === null || value === void 0 ? void 0 : value.split(' ');
27
- const cssMargin = splitMargin ? splitMargin.map(m => spacingMap[m] || m).join(' ') : '0';
28
- return cssMargin;
29
- }
@@ -1,35 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.mapSpacingToShorthand = mapSpacingToShorthand;
7
- /*
8
- * The MIT License (MIT)
9
- *
10
- * Copyright (c) 2015 - present Instructure, Inc.
11
- *
12
- * Permission is hereby granted, free of charge, to any person obtaining a copy
13
- * of this software and associated documentation files (the "Software"), to deal
14
- * in the Software without restriction, including without limitation the rights
15
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
- * copies of the Software, and to permit persons to whom the Software is
17
- * furnished to do so, subject to the following conditions:
18
- *
19
- * The above copyright notice and this permission notice shall be included in all
20
- * copies or substantial portions of the Software.
21
- *
22
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
- * SOFTWARE.
29
- */
30
-
31
- function mapSpacingToShorthand(value, spacingMap) {
32
- const splitMargin = value === null || value === void 0 ? void 0 : value.split(' ');
33
- const cssMargin = splitMargin ? splitMargin.map(m => spacingMap[m] || m).join(' ') : '0';
34
- return cssMargin;
35
- }
@@ -1,35 +0,0 @@
1
- /*
2
- * The MIT License (MIT)
3
- *
4
- * Copyright (c) 2015 - present Instructure, Inc.
5
- *
6
- * Permission is hereby granted, free of charge, to any person obtaining a copy
7
- * of this software and associated documentation files (the "Software"), to deal
8
- * in the Software without restriction, including without limitation the rights
9
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- * copies of the Software, and to permit persons to whom the Software is
11
- * furnished to do so, subject to the following conditions:
12
- *
13
- * The above copyright notice and this permission notice shall be included in all
14
- * copies or substantial portions of the Software.
15
- *
16
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- * SOFTWARE.
23
- */
24
- import type { Spacing } from './ThemeablePropValues'
25
-
26
- export function mapSpacingToShorthand(
27
- value: Spacing | undefined,
28
- spacingMap: { [key: string]: string }
29
- ) {
30
- const splitMargin = value?.split(' ')
31
- const cssMargin = splitMargin
32
- ? splitMargin.map((m: string) => spacingMap[m] || m).join(' ')
33
- : '0'
34
- return cssMargin
35
- }
@@ -1,5 +0,0 @@
1
- import type { Spacing } from './ThemeablePropValues';
2
- export declare function mapSpacingToShorthand(value: Spacing | undefined, spacingMap: {
3
- [key: string]: string;
4
- }): string;
5
- //# sourceMappingURL=mapSpacingToShorthand.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mapSpacingToShorthand.d.ts","sourceRoot":"","sources":["../../src/styleUtils/mapSpacingToShorthand.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAEpD,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,OAAO,GAAG,SAAS,EAC1B,UAAU,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,UAOtC"}