@instructure/emotion 10.26.1 → 11.0.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 (38) hide show
  1. package/CHANGELOG.md +23 -2
  2. package/es/InstUISettingsProvider/index.js +3 -15
  3. package/es/getTheme.js +2 -4
  4. package/es/index.js +1 -1
  5. package/es/styleUtils/index.js +0 -1
  6. package/es/useTheme.js +1 -7
  7. package/es/withStyle.js +1 -7
  8. package/lib/InstUISettingsProvider/index.js +3 -16
  9. package/lib/getTheme.js +2 -4
  10. package/lib/index.js +0 -7
  11. package/lib/styleUtils/index.js +0 -7
  12. package/lib/useTheme.js +1 -7
  13. package/lib/withStyle.js +1 -7
  14. package/package.json +13 -15
  15. package/src/InstUISettingsProvider/index.tsx +11 -46
  16. package/src/getTheme.ts +2 -5
  17. package/src/index.ts +0 -1
  18. package/src/styleUtils/index.ts +0 -1
  19. package/src/useTheme.ts +1 -9
  20. package/src/withStyle.tsx +2 -6
  21. package/tsconfig.build.json +0 -3
  22. package/tsconfig.build.tsbuildinfo +1 -1
  23. package/types/InstUISettingsProvider/index.d.ts +3 -29
  24. package/types/InstUISettingsProvider/index.d.ts.map +1 -1
  25. package/types/getTheme.d.ts.map +1 -1
  26. package/types/index.d.ts +1 -1
  27. package/types/index.d.ts.map +1 -1
  28. package/types/styleUtils/index.d.ts +0 -1
  29. package/types/styleUtils/index.d.ts.map +1 -1
  30. package/types/useTheme.d.ts +1 -2
  31. package/types/useTheme.d.ts.map +1 -1
  32. package/types/withStyle.d.ts +1 -1
  33. package/types/withStyle.d.ts.map +1 -1
  34. package/es/styleUtils/ThemeablePropTypes.js +0 -74
  35. package/lib/styleUtils/ThemeablePropTypes.js +0 -81
  36. package/src/styleUtils/ThemeablePropTypes.ts +0 -121
  37. package/types/styleUtils/ThemeablePropTypes.d.ts +0 -22
  38. package/types/styleUtils/ThemeablePropTypes.d.ts.map +0 -1
@@ -1,7 +1,5 @@
1
- import PropTypes from 'prop-types';
2
1
  import type { ThemeOrOverride } from '../EmotionTypes';
3
2
  import type { DeterministicIdProviderValue } from '@instructure/ui-react-utils';
4
- import type { AsElementType } from '@instructure/shared-types';
5
3
  type InstUIProviderProps = {
6
4
  children?: React.ReactNode;
7
5
  /**
@@ -16,45 +14,21 @@ type InstUIProviderProps = {
16
14
  * specific InstUI components. (generally this is used for deterministic id generation for [SSR](/#server-side-rendering))
17
15
  */
18
16
  instanceCounterMap?: DeterministicIdProviderValue;
19
- } & ({
20
17
  /**
21
18
  * The text direction to use in the descendants. If not provided, it uses the following in this priority order:
22
19
  * - The value given in a parent `TextDirectionContext`
23
20
  * - The `dir` prop of `document.documentElement` or its `direction` CSS prop
24
21
  * - The default `ltr`
25
22
  */
26
- dir: 'ltr' | 'rtl';
27
- /**
28
- * @deprecated This prop will be removed in InstUI v11
29
- *
30
- * The element type to render as
31
- */
32
- as?: AsElementType;
33
- } | {
34
- dir?: never;
35
- /**
36
- * @deprecated This prop will be removed in InstUI v11
37
- *
38
- * The element type to render as
39
- */
40
- as?: never;
41
- });
23
+ dir?: 'ltr' | 'rtl';
24
+ };
42
25
  /**
43
26
  * ---
44
27
  * category: components/utilities
45
28
  * ---
46
29
  * @module InstUISettingsProvider
47
30
  */
48
- declare function InstUISettingsProvider({ children, theme, dir, instanceCounterMap, as }: InstUIProviderProps): import("@emotion/react/jsx-runtime").JSX.Element;
49
- declare namespace InstUISettingsProvider {
50
- var propTypes: {
51
- children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
52
- theme: PropTypes.Requireable<object>;
53
- dir: PropTypes.Requireable<string>;
54
- instanceCounterMap: PropTypes.Requireable<Map<unknown, unknown>>;
55
- as: PropTypes.Requireable<string>;
56
- };
57
- }
31
+ declare function InstUISettingsProvider({ children, theme, dir, instanceCounterMap }: InstUIProviderProps): import("@emotion/react/jsx-runtime").JSX.Element;
58
32
  export default InstUISettingsProvider;
59
33
  export { InstUISettingsProvider };
60
34
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/InstUISettingsProvider/index.tsx"],"names":[],"mappings":"AAyBA,OAAO,SAAS,MAAM,YAAY,CAAA;AAQlC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAA;AAC/E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAE9D,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;CAClD,GAAG,CACA;IACE;;;;;OAKG;IACH,GAAG,EAAE,KAAK,GAAG,KAAK,CAAA;IAClB;;;;OAIG;IACH,EAAE,CAAC,EAAE,aAAa,CAAA;CACnB,GACD;IACE,GAAG,CAAC,EAAE,KAAK,CAAA;IACX;;;;OAIG;IACH,EAAE,CAAC,EAAE,KAAK,CAAA;CACX,CACJ,CAAA;AAED;;;;;GAKG;AACH,iBAAS,sBAAsB,CAAC,EAC9B,QAAQ,EACR,KAAU,EACV,GAAG,EACH,kBAAkB,EAClB,EAAE,EACH,EAAE,mBAAmB,oDA6BrB;kBAnCQ,sBAAsB;;;;;;;;;AA+C/B,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,oDAwBrB;AAED,eAAe,sBAAsB,CAAA;AACrC,OAAO,EAAE,sBAAsB,EAAE,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"getTheme.d.ts","sourceRoot":"","sources":["../src/getTheme.ts"],"names":[],"mappings":"AA2BA,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,oCAsD/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,oCAoD/B,CAAA;AAEH,eAAe,QAAQ,CAAA;AACvB,OAAO,EAAE,QAAQ,EAAE,CAAA"}
package/types/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export * from '@emotion/react';
2
2
  export { InstUISettingsProvider } from './InstUISettingsProvider';
3
3
  export { withStyle } from './withStyle';
4
- export { ThemeablePropValues, ThemeablePropTypes, makeThemeVars, getShorthandPropValue, mirrorShorthandCorners, mirrorShorthandEdges, mapSpacingToShorthand } from './styleUtils';
4
+ export { ThemeablePropValues, makeThemeVars, getShorthandPropValue, mirrorShorthandCorners, mirrorShorthandEdges, mapSpacingToShorthand } from './styleUtils';
5
5
  export { useStyle } from './useStyle';
6
6
  export type { ComponentStyle, StyleObject, Overrides } from './EmotionTypes';
7
7
  export type { WithStyleProps } from './withStyle';
@@ -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,kBAAkB,EAClB,aAAa,EACb,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,cAAc,CAAA;AAErB,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,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;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,5 +1,4 @@
1
1
  export { ThemeablePropValues } from './ThemeablePropValues';
2
- export { ThemeablePropTypes } from './ThemeablePropTypes';
3
2
  export { makeThemeVars } from './makeThemeVars';
4
3
  export { getShorthandPropValue } from './getShorthandPropValue';
5
4
  export { mirrorShorthandCorners } from './mirrorShorthandCorners';
@@ -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,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,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,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"}
@@ -4,8 +4,7 @@ import type { BaseThemeOrOverride } from './EmotionTypes';
4
4
  * private: true
5
5
  * ---
6
6
  * A hook that will return the currently applied theme object from the nearest Context.
7
- * If there is no Context, then it tries to get the current theme from the global ThemeRegistry.
8
- * If there is no theme provided to the Context and ThemeRegistry it will return the default `canvas` theme.
7
+ * If there is no theme provided to the Context, it will return the default `canvas` theme.
9
8
  * @returns The theme object
10
9
  */
11
10
  declare const useTheme: () => BaseThemeOrOverride;
@@ -1 +1 @@
1
- {"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../src/useTheme.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAEzD;;;;;;;;GAQG;AACH,QAAA,MAAM,QAAQ,2BAkBb,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,2BAYb,CAAA;AAED,eAAe,QAAQ,CAAA;AACvB,OAAO,EAAE,QAAQ,EAAE,CAAA"}
@@ -36,7 +36,7 @@ type WithStyleProps<Theme extends ComponentTheme | null = ComponentTheme, Style
36
36
  * [InstUISettingsProvider](#InstUISettingsProvider) component, and/or set
37
37
  * explicitly via its `themeOverride` prop.
38
38
  *
39
- * InstUISettingsProvider provides a theme object with global theme variables (e.g. the [canvas theme](/#canvas)).
39
+ * InstUISettingsProvider provides a theme object (e.g. the [canvas theme](/#canvas)).
40
40
  * These variables are mapped to the component's own variables in `theme.js` (see [theming](#theming-basics) for more info).
41
41
  *
42
42
  * With the `themeOverride` prop you can directly set/override the component theme variables declared in theme.js. It accepts an object or a function. The function has the component's theme and the currently active main theme as its parameter.
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0EG;AACH,QAAA,MAAM,SAAS,yFAkHd,CAAA;AAED,eAAe,SAAS,CAAA;AACxB,OAAO,EAAE,SAAS,EAAE,CAAA;AACpB,YAAY,EAAE,cAAc,EAAE,CAAA"}
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0EG;AACH,QAAA,MAAM,SAAS,yFA8Gd,CAAA;AAED,eAAe,SAAS,CAAA;AACxB,OAAO,EAAE,SAAS,EAAE,CAAA;AACpB,YAAY,EAAE,cAAc,EAAE,CAAA"}
@@ -1,74 +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
- import PropTypes from 'prop-types';
26
- import { ThemeablePropValues } from './ThemeablePropValues';
27
- const SHADOW_TYPES = ThemeablePropValues.SHADOW_TYPES,
28
- STACKING_TYPES = ThemeablePropValues.STACKING_TYPES,
29
- BORDER_WIDTHS = ThemeablePropValues.BORDER_WIDTHS,
30
- BORDER_RADII = ThemeablePropValues.BORDER_RADII,
31
- BACKGROUNDS = ThemeablePropValues.BACKGROUNDS,
32
- SIZES = ThemeablePropValues.SIZES;
33
-
34
- /**
35
- * ---
36
- * category: utilities/themes
37
- * ---
38
- * Custom prop types for themeable React components.
39
- * @module ThemeablePropTypes
40
- */
41
- const ThemeablePropTypes = {
42
- shadow: PropTypes.oneOf(Object.values(SHADOW_TYPES)),
43
- stacking: PropTypes.oneOf(Object.values(STACKING_TYPES)),
44
- borderWidth: shorthandPropType(Object.values(BORDER_WIDTHS)),
45
- borderRadius: shorthandPropType(Object.values(BORDER_RADII)),
46
- background: PropTypes.oneOf(Object.values(BACKGROUNDS)),
47
- size: PropTypes.oneOf(Object.values(SIZES))
48
- };
49
- function shorthandPropType(validValues) {
50
- return function (props, propName, componentName, location) {
51
- const propValue = props[propName];
52
- if (typeof propValue === 'undefined') {
53
- return null;
54
- }
55
- if (typeof propValue !== 'string') {
56
- return new Error(`Invalid ${location} \`${propName}\` of type \`${typeof propValue}\` supplied to \`${componentName}\`, expected ` + `a string.`);
57
- }
58
- const propValues = propValue.split(' ');
59
- const valuesLength = propValues.length;
60
- if (valuesLength > 0 && valuesLength < 5) {
61
- for (let i = 0; i < valuesLength; i++) {
62
- const valueIndex = validValues.indexOf(propValues[i]);
63
- if (valueIndex === -1) {
64
- return new Error(`Invalid ${location} \`${propName}\` \`${propValues[i]}\` supplied to \`${componentName}\`, expected ` + `a one of \`${validValues.join(', ')}\`.`);
65
- }
66
- }
67
- } else {
68
- return new Error(`Invalid ${location} \`${propName}\` \`${propValue}\` supplied to \`${componentName}\`, expected ` + `between one and four of the following valid values: \`${validValues.join(', ')}\`.`);
69
- }
70
- return null;
71
- };
72
- }
73
- export default ThemeablePropTypes;
74
- export { ThemeablePropTypes, shorthandPropType };
@@ -1,81 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = exports.ThemeablePropTypes = void 0;
8
- exports.shorthandPropType = shorthandPropType;
9
- var _propTypes = _interopRequireDefault(require("prop-types"));
10
- var _ThemeablePropValues = require("./ThemeablePropValues");
11
- /*
12
- * The MIT License (MIT)
13
- *
14
- * Copyright (c) 2015 - present Instructure, Inc.
15
- *
16
- * Permission is hereby granted, free of charge, to any person obtaining a copy
17
- * of this software and associated documentation files (the "Software"), to deal
18
- * in the Software without restriction, including without limitation the rights
19
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
20
- * copies of the Software, and to permit persons to whom the Software is
21
- * furnished to do so, subject to the following conditions:
22
- *
23
- * The above copyright notice and this permission notice shall be included in all
24
- * copies or substantial portions of the Software.
25
- *
26
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
29
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
30
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
31
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32
- * SOFTWARE.
33
- */
34
-
35
- const SHADOW_TYPES = _ThemeablePropValues.ThemeablePropValues.SHADOW_TYPES,
36
- STACKING_TYPES = _ThemeablePropValues.ThemeablePropValues.STACKING_TYPES,
37
- BORDER_WIDTHS = _ThemeablePropValues.ThemeablePropValues.BORDER_WIDTHS,
38
- BORDER_RADII = _ThemeablePropValues.ThemeablePropValues.BORDER_RADII,
39
- BACKGROUNDS = _ThemeablePropValues.ThemeablePropValues.BACKGROUNDS,
40
- SIZES = _ThemeablePropValues.ThemeablePropValues.SIZES;
41
-
42
- /**
43
- * ---
44
- * category: utilities/themes
45
- * ---
46
- * Custom prop types for themeable React components.
47
- * @module ThemeablePropTypes
48
- */
49
- const ThemeablePropTypes = exports.ThemeablePropTypes = {
50
- shadow: _propTypes.default.oneOf(Object.values(SHADOW_TYPES)),
51
- stacking: _propTypes.default.oneOf(Object.values(STACKING_TYPES)),
52
- borderWidth: shorthandPropType(Object.values(BORDER_WIDTHS)),
53
- borderRadius: shorthandPropType(Object.values(BORDER_RADII)),
54
- background: _propTypes.default.oneOf(Object.values(BACKGROUNDS)),
55
- size: _propTypes.default.oneOf(Object.values(SIZES))
56
- };
57
- function shorthandPropType(validValues) {
58
- return function (props, propName, componentName, location) {
59
- const propValue = props[propName];
60
- if (typeof propValue === 'undefined') {
61
- return null;
62
- }
63
- if (typeof propValue !== 'string') {
64
- return new Error(`Invalid ${location} \`${propName}\` of type \`${typeof propValue}\` supplied to \`${componentName}\`, expected ` + `a string.`);
65
- }
66
- const propValues = propValue.split(' ');
67
- const valuesLength = propValues.length;
68
- if (valuesLength > 0 && valuesLength < 5) {
69
- for (let i = 0; i < valuesLength; i++) {
70
- const valueIndex = validValues.indexOf(propValues[i]);
71
- if (valueIndex === -1) {
72
- return new Error(`Invalid ${location} \`${propName}\` \`${propValues[i]}\` supplied to \`${componentName}\`, expected ` + `a one of \`${validValues.join(', ')}\`.`);
73
- }
74
- }
75
- } else {
76
- return new Error(`Invalid ${location} \`${propName}\` \`${propValue}\` supplied to \`${componentName}\`, expected ` + `between one and four of the following valid values: \`${validValues.join(', ')}\`.`);
77
- }
78
- return null;
79
- };
80
- }
81
- var _default = exports.default = ThemeablePropTypes;
@@ -1,121 +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
- import PropTypes from 'prop-types'
26
-
27
- import { ThemeablePropValues } from './ThemeablePropValues'
28
- import type {
29
- BorderRadiiValues,
30
- BorderRadii,
31
- BorderWidthValues,
32
- BorderWidth,
33
- SpacingValues
34
- } from './ThemeablePropValues'
35
-
36
- const {
37
- SHADOW_TYPES,
38
- STACKING_TYPES,
39
- BORDER_WIDTHS,
40
- BORDER_RADII,
41
- BACKGROUNDS,
42
- SIZES
43
- } = ThemeablePropValues
44
-
45
- /**
46
- * ---
47
- * category: utilities/themes
48
- * ---
49
- * Custom prop types for themeable React components.
50
- * @module ThemeablePropTypes
51
- */
52
- const ThemeablePropTypes = {
53
- shadow: PropTypes.oneOf(Object.values(SHADOW_TYPES)),
54
- stacking: PropTypes.oneOf(Object.values(STACKING_TYPES)),
55
- borderWidth: shorthandPropType(Object.values(BORDER_WIDTHS)),
56
- borderRadius: shorthandPropType(Object.values(BORDER_RADII)),
57
- background: PropTypes.oneOf(Object.values(BACKGROUNDS)),
58
- size: PropTypes.oneOf(Object.values(SIZES))
59
- }
60
-
61
- type ValueKeys =
62
- | BorderWidthValues[]
63
- | BorderRadiiValues[]
64
- | SpacingValues[]
65
- | string[]
66
-
67
- function shorthandPropType<V extends ValueKeys>(
68
- validValues: V
69
- ): PropTypes.Validator<
70
- V extends BorderWidthValues[]
71
- ? BorderWidth
72
- : V extends BorderRadiiValues[]
73
- ? BorderRadii
74
- : string[]
75
- > {
76
- return function (
77
- props: Record<string, unknown>,
78
- propName: string,
79
- componentName: string,
80
- location: string
81
- ) {
82
- const propValue = props[propName]
83
-
84
- if (typeof propValue === 'undefined') {
85
- return null
86
- }
87
-
88
- if (typeof propValue !== 'string') {
89
- return new Error(
90
- `Invalid ${location} \`${propName}\` of type \`${typeof propValue}\` supplied to \`${componentName}\`, expected ` +
91
- `a string.`
92
- )
93
- }
94
-
95
- const propValues = propValue.split(' ')
96
- const valuesLength = propValues.length
97
- if (valuesLength > 0 && valuesLength < 5) {
98
- for (let i = 0; i < valuesLength; i++) {
99
- const valueIndex = (validValues as string[]).indexOf(propValues[i])
100
- if (valueIndex === -1) {
101
- return new Error(
102
- `Invalid ${location} \`${propName}\` \`${propValues[i]}\` supplied to \`${componentName}\`, expected ` +
103
- `a one of \`${validValues.join(', ')}\`.`
104
- )
105
- }
106
- }
107
- } else {
108
- return new Error(
109
- `Invalid ${location} \`${propName}\` \`${propValue}\` supplied to \`${componentName}\`, expected ` +
110
- `between one and four of the following valid values: \`${validValues.join(
111
- ', '
112
- )}\`.`
113
- )
114
- }
115
-
116
- return null
117
- }
118
- }
119
-
120
- export default ThemeablePropTypes
121
- export { ThemeablePropTypes, shorthandPropType }
@@ -1,22 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- import type { BorderRadiiValues, BorderRadii, BorderWidthValues, BorderWidth, SpacingValues } from './ThemeablePropValues';
3
- /**
4
- * ---
5
- * category: utilities/themes
6
- * ---
7
- * Custom prop types for themeable React components.
8
- * @module ThemeablePropTypes
9
- */
10
- declare const ThemeablePropTypes: {
11
- shadow: PropTypes.Requireable<"resting" | "above" | "topmost" | "none">;
12
- stacking: PropTypes.Requireable<"resting" | "above" | "topmost" | "below" | "deepest">;
13
- borderWidth: PropTypes.Validator<BorderWidth>;
14
- borderRadius: PropTypes.Validator<string>;
15
- background: PropTypes.Requireable<"default" | "inverse" | "transparent">;
16
- size: PropTypes.Requireable<"small" | "medium" | "large" | "x-small" | "x-large">;
17
- };
18
- type ValueKeys = BorderWidthValues[] | BorderRadiiValues[] | SpacingValues[] | string[];
19
- declare function shorthandPropType<V extends ValueKeys>(validValues: V): PropTypes.Validator<V extends BorderWidthValues[] ? BorderWidth : V extends BorderRadiiValues[] ? BorderRadii : string[]>;
20
- export default ThemeablePropTypes;
21
- export { ThemeablePropTypes, shorthandPropType };
22
- //# sourceMappingURL=ThemeablePropTypes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ThemeablePropTypes.d.ts","sourceRoot":"","sources":["../../src/styleUtils/ThemeablePropTypes.ts"],"names":[],"mappings":"AAwBA,OAAO,SAAS,MAAM,YAAY,CAAA;AAGlC,OAAO,KAAK,EACV,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,aAAa,EACd,MAAM,uBAAuB,CAAA;AAW9B;;;;;;GAMG;AACH,QAAA,MAAM,kBAAkB;;;;;;;CAOvB,CAAA;AAED,KAAK,SAAS,GACV,iBAAiB,EAAE,GACnB,iBAAiB,EAAE,GACnB,aAAa,EAAE,GACf,MAAM,EAAE,CAAA;AAEZ,iBAAS,iBAAiB,CAAC,CAAC,SAAS,SAAS,EAC5C,WAAW,EAAE,CAAC,GACb,SAAS,CAAC,SAAS,CACpB,CAAC,SAAS,iBAAiB,EAAE,GACzB,WAAW,GACX,CAAC,SAAS,iBAAiB,EAAE,GAC7B,WAAW,GACX,MAAM,EAAE,CACb,CA2CA;AAED,eAAe,kBAAkB,CAAA;AACjC,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,CAAA"}