@papillonarts/components 0.34.0 → 0.36.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 (124) hide show
  1. package/build/Legacy/Alert/__tests__/{Alert.markdown.docs.md → Alert.doc.md} +12 -12
  2. package/build/Legacy/Blankslate/__tests__/Blankslate.doc.md +57 -0
  3. package/build/Legacy/Breadcrumb/__tests__/Breadcrumb.doc.md +33 -0
  4. package/build/Legacy/Markdown/Markdown.d.ts +3 -0
  5. package/build/Legacy/Markdown/Markdown.d.ts.map +1 -0
  6. package/build/Legacy/{MarkdownDocs/MarkdownDocs.js → Markdown/Markdown.js} +15 -15
  7. package/build/Legacy/Markdown/Markdown.type.d.ts +15 -0
  8. package/build/Legacy/Markdown/Markdown.type.d.ts.map +1 -0
  9. package/build/Legacy/Markdown/Markdown.type.js +14 -0
  10. package/build/Legacy/Markdown/__tests__/Markdown.doc.md +33 -0
  11. package/build/Legacy/Markdown/index.d.ts +2 -0
  12. package/build/Legacy/Markdown/index.d.ts.map +1 -0
  13. package/build/Legacy/Markdown/index.js +12 -0
  14. package/build/Legacy/SyntaxHighlighter/SyntaxHighlighter.d.ts +3 -0
  15. package/build/Legacy/SyntaxHighlighter/SyntaxHighlighter.d.ts.map +1 -0
  16. package/build/Legacy/SyntaxHighlighter/SyntaxHighlighter.js +39 -0
  17. package/build/Legacy/SyntaxHighlighter/SyntaxHighlighter.type.d.ts +32 -0
  18. package/build/Legacy/SyntaxHighlighter/SyntaxHighlighter.type.d.ts.map +1 -0
  19. package/build/Legacy/SyntaxHighlighter/SyntaxHighlighter.type.js +25 -0
  20. package/build/Legacy/SyntaxHighlighter/SyntaxHighlighterHLJS.d.ts +3 -0
  21. package/build/Legacy/SyntaxHighlighter/SyntaxHighlighterHLJS.d.ts.map +1 -0
  22. package/build/Legacy/{PreformattedCode/PreformattedCodeHLJS.js → SyntaxHighlighter/SyntaxHighlighterHLJS.js} +6 -6
  23. package/build/Legacy/SyntaxHighlighter/SyntaxHighlighterPrism.d.ts +3 -0
  24. package/build/Legacy/SyntaxHighlighter/SyntaxHighlighterPrism.d.ts.map +1 -0
  25. package/build/Legacy/{PreformattedCode/PreformattedCodePrism.js → SyntaxHighlighter/SyntaxHighlighterPrism.js} +6 -6
  26. package/build/Legacy/SyntaxHighlighter/__tests__/SyntaxHighlighter.doc.md +61 -0
  27. package/build/Legacy/SyntaxHighlighter/index.d.ts +3 -0
  28. package/build/Legacy/SyntaxHighlighter/index.d.ts.map +1 -0
  29. package/build/Legacy/SyntaxHighlighter/index.js +31 -0
  30. package/build/Legacy/index.d.ts +4 -4
  31. package/build/Legacy/index.d.ts.map +1 -1
  32. package/build/Legacy/index.js +4 -4
  33. package/build/Modern/Flash/Flash.d.ts +1 -2
  34. package/build/Modern/Flash/Flash.d.ts.map +1 -1
  35. package/build/Modern/Flash/Flash.js +3 -4
  36. package/build/Modern/Flash/__tests__/Flash.doc.md +11 -0
  37. package/build/Modern/Flash/index.d.ts +1 -1
  38. package/build/Modern/Flash/index.d.ts.map +1 -1
  39. package/build/Modern/Flash/index.js +3 -4
  40. package/build/Modern/Link/Link.d.ts +19 -0
  41. package/build/Modern/Link/Link.d.ts.map +1 -0
  42. package/build/Modern/Link/Link.docs.json +61 -0
  43. package/build/Modern/Link/Link.js +57 -0
  44. package/build/Modern/Link/Link.module.scss +39 -0
  45. package/build/Modern/Link/__tests__/Link.doc.md +10 -0
  46. package/build/Modern/Link/index.d.ts +3 -0
  47. package/build/Modern/Link/index.d.ts.map +1 -0
  48. package/build/Modern/Link/index.js +12 -0
  49. package/build/Modern/Pagination/Pagination.d.ts +22 -0
  50. package/build/Modern/Pagination/Pagination.d.ts.map +1 -0
  51. package/build/Modern/Pagination/Pagination.docs.json +77 -0
  52. package/build/Modern/Pagination/Pagination.js +132 -0
  53. package/build/Modern/Pagination/Pagination.model.d.ts +26 -0
  54. package/build/Modern/Pagination/Pagination.model.d.ts.map +1 -0
  55. package/build/Modern/Pagination/Pagination.model.js +211 -0
  56. package/build/Modern/Pagination/Pagination.module.scss +141 -0
  57. package/build/Modern/Pagination/__tests__/Pagination.doc.md +12 -0
  58. package/build/Modern/Pagination/index.d.ts +3 -0
  59. package/build/Modern/Pagination/index.d.ts.map +1 -0
  60. package/build/Modern/Pagination/index.js +12 -0
  61. package/build/Modern/hooks/index.d.ts +3 -0
  62. package/build/Modern/hooks/index.d.ts.map +1 -0
  63. package/build/Modern/hooks/index.js +19 -0
  64. package/build/Modern/hooks/useMedia.d.ts +37 -0
  65. package/build/Modern/hooks/useMedia.d.ts.map +1 -0
  66. package/build/Modern/hooks/useMedia.js +141 -0
  67. package/build/Modern/hooks/useRefObjectAsForwardedRef.d.ts +10 -0
  68. package/build/Modern/hooks/useRefObjectAsForwardedRef.d.ts.map +1 -0
  69. package/build/Modern/hooks/useRefObjectAsForwardedRef.hookDocs.json +22 -0
  70. package/build/Modern/hooks/useRefObjectAsForwardedRef.js +19 -0
  71. package/build/Modern/hooks/useResponsiveValue.d.ts +31 -0
  72. package/build/Modern/hooks/useResponsiveValue.d.ts.map +1 -0
  73. package/build/Modern/hooks/useResponsiveValue.js +73 -0
  74. package/build/Modern/index.d.ts +24 -0
  75. package/build/Modern/index.d.ts.map +1 -1
  76. package/build/Modern/index.js +11 -3
  77. package/build/Modern/type.d.ts +4 -0
  78. package/build/Modern/type.d.ts.map +1 -0
  79. package/build/Modern/type.js +5 -0
  80. package/build/Modern/utils/environment.d.ts +11 -0
  81. package/build/Modern/utils/environment.d.ts.map +1 -0
  82. package/build/Modern/utils/environment.js +13 -0
  83. package/build/Modern/utils/modern-polymorphic.d.ts +22 -0
  84. package/build/Modern/utils/modern-polymorphic.d.ts.map +1 -0
  85. package/build/Modern/utils/modern-polymorphic.js +28 -0
  86. package/build/Modern/utils/types/ComponentProps.d.ts +9 -0
  87. package/build/Modern/utils/types/ComponentProps.d.ts.map +1 -0
  88. package/build/Modern/utils/types/ComponentProps.js +5 -0
  89. package/build/Modern/utils/types/index.d.ts +3 -0
  90. package/build/Modern/utils/types/index.d.ts.map +1 -0
  91. package/build/Modern/utils/types/index.js +27 -0
  92. package/build/Modern/utils/warning.d.ts +4 -0
  93. package/build/Modern/utils/warning.d.ts.map +1 -0
  94. package/build/Modern/utils/warning.js +25 -0
  95. package/build/index.d.ts +1 -0
  96. package/build/index.d.ts.map +1 -1
  97. package/package.json +4 -4
  98. package/build/Legacy/MarkdownDocs/MarkdownDocs.d.ts +0 -3
  99. package/build/Legacy/MarkdownDocs/MarkdownDocs.d.ts.map +0 -1
  100. package/build/Legacy/MarkdownDocs/MarkdownDocs.type.d.ts +0 -15
  101. package/build/Legacy/MarkdownDocs/MarkdownDocs.type.d.ts.map +0 -1
  102. package/build/Legacy/MarkdownDocs/MarkdownDocs.type.js +0 -14
  103. package/build/Legacy/MarkdownDocs/__tests__/MarkdownDocs.markdown.docs.md +0 -33
  104. package/build/Legacy/MarkdownDocs/index.d.ts +0 -2
  105. package/build/Legacy/MarkdownDocs/index.d.ts.map +0 -1
  106. package/build/Legacy/MarkdownDocs/index.js +0 -12
  107. package/build/Legacy/PreformattedCode/PreformattedCode.d.ts +0 -3
  108. package/build/Legacy/PreformattedCode/PreformattedCode.d.ts.map +0 -1
  109. package/build/Legacy/PreformattedCode/PreformattedCode.js +0 -39
  110. package/build/Legacy/PreformattedCode/PreformattedCode.type.d.ts +0 -32
  111. package/build/Legacy/PreformattedCode/PreformattedCode.type.d.ts.map +0 -1
  112. package/build/Legacy/PreformattedCode/PreformattedCode.type.js +0 -25
  113. package/build/Legacy/PreformattedCode/PreformattedCodeHLJS.d.ts +0 -3
  114. package/build/Legacy/PreformattedCode/PreformattedCodeHLJS.d.ts.map +0 -1
  115. package/build/Legacy/PreformattedCode/PreformattedCodePrism.d.ts +0 -3
  116. package/build/Legacy/PreformattedCode/PreformattedCodePrism.d.ts.map +0 -1
  117. package/build/Legacy/PreformattedCode/__tests__/PreformattedCode.markdown.docs.md +0 -61
  118. package/build/Legacy/PreformattedCode/index.d.ts +0 -3
  119. package/build/Legacy/PreformattedCode/index.d.ts.map +0 -1
  120. package/build/Legacy/PreformattedCode/index.js +0 -31
  121. package/build/Modern/Typing/index.d.js +0 -1
  122. package/build/Modern/global.d.js +0 -1
  123. /package/build/Modern/Flash/__tests__/{Flash.features.stories.module.scss → Flash.feature.scss} +0 -0
  124. /package/build/{Legacy/Typing → Typing}/index.d.js +0 -0
@@ -0,0 +1,31 @@
1
+ export declare const viewportRanges: {
2
+ narrow: string;
3
+ regular: string;
4
+ wide: string;
5
+ };
6
+ export interface ResponsiveValue<TRegular, TNarrow = TRegular, TWide = TRegular> {
7
+ narrow?: TNarrow;
8
+ regular?: TRegular;
9
+ wide?: TWide;
10
+ }
11
+ /**
12
+ * Flattens all possible value types into single union type
13
+ * For example, if `T` is `'none' | 'line' | Responsive<'none' | 'line' | 'filled'>`,
14
+ * `FlattenResponsiveValue<T>` will be `'none' | 'line' | 'filled'`
15
+ */
16
+ export type FlattenResponsiveValue<T> = (T extends ResponsiveValue<infer TRegular, infer TNarrow, infer TWide> ? TRegular | TNarrow | TWide : never) | Exclude<T, ResponsiveValue<any>>;
17
+ /**
18
+ * Checks if the value is a responsive value.
19
+ * In other words, is it an object with viewport range keys?
20
+ */
21
+ export declare function isResponsiveValue(value: any): value is ResponsiveValue<any>;
22
+ /**
23
+ * Resolves responsive values based on the current viewport width.
24
+ * For example, if the current viewport width is narrow (less than 768px), the value of `{regular: 'foo', narrow: 'bar'}` will resolve to `'bar'`.
25
+ *
26
+ * @example
27
+ * const value = useResponsiveValue({regular: 'foo', narrow: 'bar'})
28
+ * console.log(value) // 'bar'
29
+ */
30
+ export declare function useResponsiveValue<T, F>(value: T, fallback: F): FlattenResponsiveValue<T> | F;
31
+ //# sourceMappingURL=useResponsiveValue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useResponsiveValue.d.ts","sourceRoot":"","sources":["../../../src/Modern/hooks/useResponsiveValue.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,cAAc;;;;CAI1B,CAAA;AAED,MAAM,WAAW,eAAe,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,EAAE,KAAK,GAAG,QAAQ;IAC7E,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,OAAO,CAAC,EAAE,QAAQ,CAAA;IAClB,IAAI,CAAC,EAAE,KAAK,CAAA;CACb;AAED;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,CAAC,CAAC,IAChC,CAAC,CAAC,SAAS,eAAe,CAAC,MAAM,QAAQ,EAAE,MAAM,OAAO,EAAE,MAAM,KAAK,CAAC,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,GAAG,KAAK,CAAC,GAC5G,OAAO,CAAC,CAAC,EAAE,eAAe,CAAC,GAAG,CAAC,CAAC,CAAA;AAEpC;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,eAAe,CAAC,GAAG,CAAC,CAE3E;AAED;;;;;;;GAOG;AAEH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,sBAAsB,CAAC,CAAC,CAAC,GAAG,CAAC,CAuB7F"}
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.isResponsiveValue = isResponsiveValue;
8
+ exports.useResponsiveValue = useResponsiveValue;
9
+ exports.viewportRanges = void 0;
10
+ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
11
+ var _useMedia = require("./useMedia");
12
+ // This file contains utilities for working with responsive values.
13
+
14
+ // The viewport range values from @primer/primtives don't work in Chrome
15
+ // because they use `em` units inside `calc()` (e.g., calc(48em - 0.02px)).
16
+ // As a temporary workaround, we're hardcoding the viewport ranges in `px` units.
17
+ // TODO: Use viewport range tokens from @primer/primitives
18
+ var viewportRanges = exports.viewportRanges = {
19
+ narrow: '(max-width: calc(768px - 0.02px))',
20
+ // < 768px
21
+ regular: '(min-width: 768px)',
22
+ // >= 768px
23
+ wide: '(min-width: 1400px)' // >= 1400px
24
+ };
25
+
26
+ /**
27
+ * Flattens all possible value types into single union type
28
+ * For example, if `T` is `'none' | 'line' | Responsive<'none' | 'line' | 'filled'>`,
29
+ * `FlattenResponsiveValue<T>` will be `'none' | 'line' | 'filled'`
30
+ */
31
+
32
+ /**
33
+ * Checks if the value is a responsive value.
34
+ * In other words, is it an object with viewport range keys?
35
+ */
36
+ function isResponsiveValue(value) {
37
+ return (0, _typeof2["default"])(value) === 'object' && Object.keys(value).some(function (key) {
38
+ return ['narrow', 'regular', 'wide'].includes(key);
39
+ });
40
+ }
41
+
42
+ /**
43
+ * Resolves responsive values based on the current viewport width.
44
+ * For example, if the current viewport width is narrow (less than 768px), the value of `{regular: 'foo', narrow: 'bar'}` will resolve to `'bar'`.
45
+ *
46
+ * @example
47
+ * const value = useResponsiveValue({regular: 'foo', narrow: 'bar'})
48
+ * console.log(value) // 'bar'
49
+ */
50
+ // TODO: Improve SSR support
51
+ function useResponsiveValue(value, fallback) {
52
+ // Check viewport size
53
+ // TODO: What is the performance cost of creating media query listeners in this hook?
54
+ var isNarrowViewport = (0, _useMedia.useMedia)(viewportRanges.narrow, false);
55
+ var isRegularViewport = (0, _useMedia.useMedia)(viewportRanges.regular, false);
56
+ var isWideViewport = (0, _useMedia.useMedia)(viewportRanges.wide, false);
57
+ if (isResponsiveValue(value)) {
58
+ // If we've reached this line, we know that value is a responsive value
59
+ var responsiveValue = value;
60
+ if (isNarrowViewport && 'narrow' in Object(responsiveValue)) {
61
+ return Object(responsiveValue).narrow;
62
+ } else if (isWideViewport && 'wide' in Object(responsiveValue)) {
63
+ return Object(responsiveValue).wide;
64
+ } else if (isRegularViewport && 'regular' in Object(responsiveValue)) {
65
+ return Object(responsiveValue).regular;
66
+ } else {
67
+ return fallback;
68
+ }
69
+ } else {
70
+ // If we've reached this line, we know that value is not a responsive value
71
+ return value;
72
+ }
73
+ }
@@ -1,7 +1,31 @@
1
+ import '@papillonarts/css/build/primer/index.scss';
2
+ import { Pagination } from './Pagination';
1
3
  export type { FlashProps } from './Flash';
4
+ export type { LinkProps } from './Link';
5
+ export type { PaginationProps } from './Pagination';
2
6
  export declare const Modern: {
3
7
  Flash: {
4
8
  Flash: import("./utils/polymorphic").ForwardRefComponent<"div", import("./Flash").FlashProps>;
5
9
  };
10
+ Link: {
11
+ Link: (<As extends import("react").ElementType = "a">(props: (import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "a" : As> & {
12
+ as?: "a";
13
+ hoverColor?: string;
14
+ muted?: boolean;
15
+ inline?: boolean;
16
+ } extends infer T ? T extends import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "a" : As> & {
17
+ as?: "a";
18
+ hoverColor?: string;
19
+ muted?: boolean;
20
+ inline?: boolean;
21
+ } ? T extends unknown ? Omit<T, "as"> : never : never : never) & {
22
+ as?: As;
23
+ } & import("react").RefAttributes<unknown>) => React.ReactNode) & {
24
+ displayName: string;
25
+ };
26
+ };
27
+ Pagination: {
28
+ Pagination: typeof Pagination;
29
+ };
6
30
  };
7
31
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Modern/index.ts"],"names":[],"mappings":"AAEA,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEzC,eAAO,MAAM,MAAM;;;;CAIlB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Modern/index.ts"],"names":[],"mappings":"AAAA,OAAO,2CAA2C,CAAA;AAGlD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACzC,YAAY,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AACvC,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAEnD,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;CAUlB,CAAA"}
@@ -1,13 +1,21 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.Modern = void 0;
8
- var _Flash = _interopRequireDefault(require("./Flash"));
7
+ require("@papillonarts/css/build/primer/index.scss");
8
+ var _Flash = require("./Flash");
9
+ var _Link = require("./Link");
10
+ var _Pagination = require("./Pagination");
9
11
  var Modern = exports.Modern = {
10
12
  Flash: {
11
- Flash: _Flash["default"]
13
+ Flash: _Flash.Flash
14
+ },
15
+ Link: {
16
+ Link: _Link.Link
17
+ },
18
+ Pagination: {
19
+ Pagination: _Pagination.Pagination
12
20
  }
13
21
  };
@@ -0,0 +1,4 @@
1
+ export type { FlashProps } from './Flash';
2
+ export type { LinkProps } from './Link';
3
+ export type { PaginationProps } from './Pagination';
4
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/Modern/type.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACzC,YAAY,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AACvC,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Indicate whether current execution environment can access the DOM.
3
+ *
4
+ * @see https://github.com/facebook/fbjs/blob/4d1751311d3f67af2dcce2e40df8512a23c7b9c6/packages/fbjs/src/core/ExecutionEnvironment.js#L12
5
+ */
6
+ export const canUseDOM: false | {
7
+ <K extends keyof HTMLElementTagNameMap>(tagName: K, options?: ElementCreationOptions): HTMLElementTagNameMap[K];
8
+ <K extends keyof HTMLElementDeprecatedTagNameMap>(tagName: K, options?: ElementCreationOptions): HTMLElementDeprecatedTagNameMap[K];
9
+ (tagName: string, options?: ElementCreationOptions): HTMLElement;
10
+ };
11
+ //# sourceMappingURL=environment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../../src/Modern/utils/environment.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;;;EAAiE"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.canUseDOM = void 0;
7
+ var _window$document$crea, _window;
8
+ /**
9
+ * Indicate whether current execution environment can access the DOM.
10
+ *
11
+ * @see https://github.com/facebook/fbjs/blob/4d1751311d3f67af2dcce2e40df8512a23c7b9c6/packages/fbjs/src/core/ExecutionEnvironment.js#L12
12
+ */
13
+ var canUseDOM = exports.canUseDOM = (_window$document$crea = (_window = window) === null || _window === void 0 || (_window = _window.document) === null || _window === void 0 ? void 0 : _window.createElement) !== null && _window$document$crea !== void 0 ? _window$document$crea : false;
@@ -0,0 +1,22 @@
1
+ import type { ComponentPropsWithRef, ElementType } from 'react';
2
+ /**
3
+ * Distributive Omit utility type that works correctly with union types
4
+ */
5
+ type DistributiveOmit<T, TOmitted extends PropertyKey> = T extends unknown ? Omit<T, TOmitted> : never;
6
+ /**
7
+ * Fixed version of forwardRef that provides better type inference for polymorphic components
8
+ */
9
+ type FixedForwardRef = <T, P = object>(render: (props: P, ref: React.Ref<T>) => React.ReactNode) => (props: P & React.RefAttributes<T>) => React.ReactNode;
10
+ /**
11
+ * Cast forwardRef to the fixed version with better type inference
12
+ */
13
+ export declare const fixedForwardRef: FixedForwardRef;
14
+ /**
15
+ * Simplified polymorphic props type that handles the common pattern of
16
+ * `DistributiveOmit<ComponentPropsWithRef<ElementType extends As ? DefaultElement : As>, 'as'>`
17
+ */
18
+ export type PolymorphicProps<TAs extends ElementType, TDefaultElement extends ElementType = 'div', Props = object> = DistributiveOmit<ComponentPropsWithRef<ElementType extends TAs ? TDefaultElement : TAs> & Props, 'as'> & {
19
+ as?: TAs;
20
+ };
21
+ export {};
22
+ //# sourceMappingURL=modern-polymorphic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modern-polymorphic.d.ts","sourceRoot":"","sources":["../../../src/Modern/utils/modern-polymorphic.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAE/D;;GAEG;AACH,KAAK,gBAAgB,CAAC,CAAC,EAAE,QAAQ,SAAS,WAAW,IAAI,CAAC,SAAS,OAAO,GAAG,IAAI,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAA;AAEtG;;GAEG;AAGH,KAAK,eAAe,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,EACnC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,SAAS,KACrD,CAAC,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,SAAS,CAAA;AAE3D;;GAEG;AACH,eAAO,MAAM,eAAe,EAAiB,eAAe,CAAA;AAE5D;;;GAGG;AACH,MAAM,MAAM,gBAAgB,CAAC,GAAG,SAAS,WAAW,EAAE,eAAe,SAAS,WAAW,GAAG,KAAK,EAAE,KAAK,GAAG,MAAM,IAAI,gBAAgB,CACnI,qBAAqB,CAAC,WAAW,SAAS,GAAG,GAAG,eAAe,GAAG,GAAG,CAAC,GAAG,KAAK,EAC9E,IAAI,CACL,GAAG;IACF,EAAE,CAAC,EAAE,GAAG,CAAA;CACT,CAAA"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.fixedForwardRef = void 0;
7
+ var _react = require("react");
8
+ // Mostly taken from https://github.com/total-typescript/react-typescript-tutorial/blob/main/src/08-advanced-patterns/72-as-prop-with-forward-ref.solution.tsx
9
+
10
+ /**
11
+ * Distributive Omit utility type that works correctly with union types
12
+ */
13
+
14
+ /**
15
+ * Fixed version of forwardRef that provides better type inference for polymorphic components
16
+ */
17
+ // TODO: figure out how to change this type so we can set displayName
18
+ // like this: `ComponentName.displayName = 'DisplayName' instead of using workarounds
19
+
20
+ /**
21
+ * Cast forwardRef to the fixed version with better type inference
22
+ */
23
+ var fixedForwardRef = exports.fixedForwardRef = _react.forwardRef;
24
+
25
+ /**
26
+ * Simplified polymorphic props type that handles the common pattern of
27
+ * `DistributiveOmit<ComponentPropsWithRef<ElementType extends As ? DefaultElement : As>, 'as'>`
28
+ */
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Extract a component's props
3
+ *
4
+ * Source: https://react-typescript-cheatsheet.netlify.app/docs/advanced/patterns_by_usecase#wrappingmirroring-a-component
5
+ *
6
+ * @example ComponentProps<typeof MyComponent>
7
+ */
8
+ export type ComponentProps<T> = T extends React.ComponentType<React.PropsWithChildren<infer Props>> ? (Props extends object ? Props : never) : never;
9
+ //# sourceMappingURL=ComponentProps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComponentProps.d.ts","sourceRoot":"","sources":["../../../../src/Modern/utils/types/ComponentProps.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,IAC1B,CAAC,SAAS,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,iBAAiB,CAAC,MAAM,KAAK,CAAC,CAAC,GAAG,CAAC,KAAK,SAAS,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC,GAAG,KAAK,CAAA"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1,3 @@
1
+ export * from './ComponentProps';
2
+ export * from './Slots';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/Modern/utils/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,SAAS,CAAA"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _ComponentProps = require("./ComponentProps");
7
+ Object.keys(_ComponentProps).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _ComponentProps[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function get() {
13
+ return _ComponentProps[key];
14
+ }
15
+ });
16
+ });
17
+ var _Slots = require("./Slots");
18
+ Object.keys(_Slots).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _Slots[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function get() {
24
+ return _Slots[key];
25
+ }
26
+ });
27
+ });
@@ -0,0 +1,4 @@
1
+ declare const warn: (message: string) => void;
2
+ declare const warning: (condition: any, format: string, ...args: any[]) => void;
3
+ export { warn, warning };
4
+ //# sourceMappingURL=warning.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"warning.d.ts","sourceRoot":"","sources":["../../../src/Modern/utils/warning.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,IAAI,YAEmB,MAAM,SAGhB,CAAA;AAInB,QAAA,MAAM,OAAO,cAEqB,GAAG,UAAU,MAAM,WAAW,GAAG,EAAE,SASlD,CAAA;AAEnB,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAA"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.warning = exports.warn = void 0;
7
+ function emptyFunction() {}
8
+ var warn = exports.warn = process.env.NODE_ENV !== 'production' ? function warn(message) {
9
+ console.warn('Warning:', message);
10
+ } : emptyFunction;
11
+
12
+ // Inspired by warning by fbjs
13
+ // @see https://github.com/facebook/fbjs/blob/main/packages/fbjs/src/__forks__/warning.js
14
+ var warning = exports.warning = process.env.NODE_ENV !== 'production' ? function warning(condition, format) {
15
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
16
+ args[_key - 2] = arguments[_key];
17
+ }
18
+ if (condition) {
19
+ var index = 0;
20
+ var message = format.replace(/%s/g, function () {
21
+ return args[index++];
22
+ });
23
+ warn(message);
24
+ }
25
+ } : emptyFunction;
package/build/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { Legacy } from './Legacy';
2
2
  export type { IAlertConsent, IFlexGridItem } from './Legacy/type';
3
3
  export { Modern } from './Modern';
4
+ export type { FlashProps, LinkProps, PaginationProps } from './Modern/type';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@papillonarts/components",
3
- "version": "0.34.0",
3
+ "version": "0.36.0",
4
4
  "description": "Papillon Arts Components",
5
5
  "homepage": "https://github.com/papillonarts/papillonarts/tree/master/packages/components",
6
6
  "repository": {
@@ -26,8 +26,8 @@
26
26
  "build-release": "npm run build"
27
27
  },
28
28
  "dependencies": {
29
- "@papillonarts/css": "^0.34.0",
30
- "@papillonarts/library": "^0.34.0"
29
+ "@papillonarts/css": "^0.36.0",
30
+ "@papillonarts/library": "^0.36.0"
31
31
  },
32
- "gitHead": "1d84f25ec55009565a268dee39ca2d0ba1cecbbf"
32
+ "gitHead": "8ef38bffed97c329ca6a1f5bacaa938528d256cc"
33
33
  }
@@ -1,3 +0,0 @@
1
- import { IMarkdownDocs } from './MarkdownDocs.type';
2
- export declare function MarkdownDocs({ highlighter, children }: IMarkdownDocs): import("react/jsx-runtime").JSX.Element;
3
- //# sourceMappingURL=MarkdownDocs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MarkdownDocs.d.ts","sourceRoot":"","sources":["../../../src/Legacy/MarkdownDocs/MarkdownDocs.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAgD,MAAM,qBAAqB,CAAA;AAEjG,wBAAgB,YAAY,CAAC,EAAE,WAA6C,EAAE,QAAQ,EAAE,EAAE,aAAa,2CAgDtG"}
@@ -1,15 +0,0 @@
1
- export interface IMarkdownDocsHighlighter {
2
- HLJS: string;
3
- PRISM: string;
4
- }
5
- export declare const MarkdownDocsHighlighter: IMarkdownDocsHighlighter;
6
- export interface IMarkdownDocsDefault {
7
- Highlighter?: string;
8
- Children: string;
9
- }
10
- export declare const MarkdownDocsDefault: IMarkdownDocsDefault;
11
- export interface IMarkdownDocs {
12
- highlighter?: string;
13
- children?: string;
14
- }
15
- //# sourceMappingURL=MarkdownDocs.type.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MarkdownDocs.type.d.ts","sourceRoot":"","sources":["../../../src/Legacy/MarkdownDocs/MarkdownDocs.type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;CACd;AAED,eAAO,MAAM,uBAAuB,EAAE,wBAGrC,CAAA;AAED,MAAM,WAAW,oBAAoB;IACnC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,eAAO,MAAM,mBAAmB,EAAE,oBAGjC,CAAA;AAED,MAAM,WAAW,aAAa;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB"}
@@ -1,14 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.MarkdownDocsHighlighter = exports.MarkdownDocsDefault = void 0;
7
- var MarkdownDocsHighlighter = exports.MarkdownDocsHighlighter = {
8
- HLJS: 'HLJS',
9
- PRISM: 'PRISM'
10
- };
11
- var MarkdownDocsDefault = exports.MarkdownDocsDefault = {
12
- Highlighter: MarkdownDocsHighlighter.PRISM,
13
- Children: ''
14
- };
@@ -1,33 +0,0 @@
1
- # MarkdownDocs
2
-
3
- > MarkdownDocs component all features
4
-
5
- ```
6
- # Features
7
-
8
- > Regular
9
- ```
10
-
11
- ## Regular
12
-
13
- > MarkdownDocs component regular feature
14
-
15
- ```jsx
16
- <MarkdownDocs>{MarkdownDocsUnformattedCode}</MarkdownDocs>
17
- ```
18
-
19
- ## HLJS
20
-
21
- > MarkdownDocs component hljs feature
22
-
23
- ```jsx
24
- <MarkdownDocs highlighter={MarkdownDocsHighlighter.HLJS}>{MarkdownUnformattedCode}</MarkdownDocs>
25
- ```
26
-
27
- ## Prism
28
-
29
- > MarkdownDocs component prism feature
30
-
31
- ```jsx
32
- <MarkdownDocs highlighter={MarkdownDocsHighlighter.PRISM}>{MarkdownUnformattedCode}</MarkdownDocs>
33
- ```
@@ -1,2 +0,0 @@
1
- export { MarkdownDocs } from './MarkdownDocs';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Legacy/MarkdownDocs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA"}
@@ -1,12 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "MarkdownDocs", {
7
- enumerable: true,
8
- get: function get() {
9
- return _MarkdownDocs.MarkdownDocs;
10
- }
11
- });
12
- var _MarkdownDocs = require("./MarkdownDocs");
@@ -1,3 +0,0 @@
1
- import { IPreformattedCode } from './PreformattedCode.type';
2
- export declare function PreformattedCode({ highlighter, language, style, children, }: IPreformattedCode): import("react/jsx-runtime").JSX.Element;
3
- //# sourceMappingURL=PreformattedCode.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PreformattedCode.d.ts","sourceRoot":"","sources":["../../../src/Legacy/PreformattedCode/PreformattedCode.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAwD,MAAM,yBAAyB,CAAA;AAIjH,wBAAgB,gBAAgB,CAAC,EAC/B,WAAiD,EACjD,QAA2C,EAC3C,KAAqC,EACrC,QAAQ,GACT,EAAE,iBAAiB,2CAgBnB"}
@@ -1,39 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.PreformattedCode = PreformattedCode;
7
- var _PreformattedCode = require("./PreformattedCode.type");
8
- var _PreformattedCodeHLJS = require("./PreformattedCodeHLJS");
9
- var _PreformattedCodePrism = require("./PreformattedCodePrism");
10
- var _jsxRuntime = require("react/jsx-runtime");
11
- // https://github.com/react-syntax-highlighter/react-syntax-highlighter
12
- // https://github.com/react-syntax-highlighter/react-syntax-highlighter/blob/master/AVAILABLE_LANGUAGES_HLJS.MD
13
- // https://github.com/react-syntax-highlighter/react-syntax-highlighter/blob/master/AVAILABLE_STYLES_HLJS.MD
14
- // https://github.com/react-syntax-highlighter/react-syntax-highlighter/blob/master/AVAILABLE_LANGUAGES_PRISM.MD
15
- // https://github.com/react-syntax-highlighter/react-syntax-highlighter/blob/master/AVAILABLE_STYLES_PRISM.MD
16
-
17
- function PreformattedCode(_ref) {
18
- var _ref$highlighter = _ref.highlighter,
19
- highlighter = _ref$highlighter === void 0 ? _PreformattedCode.PreformattedCodeDefault.Highlighter : _ref$highlighter,
20
- _ref$language = _ref.language,
21
- language = _ref$language === void 0 ? _PreformattedCode.PreformattedCodeDefault.Language : _ref$language,
22
- _ref$style = _ref.style,
23
- style = _ref$style === void 0 ? _PreformattedCode.PreformattedCodeDefault.Style : _ref$style,
24
- children = _ref.children;
25
- if (highlighter == _PreformattedCode.PreformattedCodeHighlighter.HLJS) {
26
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PreformattedCodeHLJS.PreformattedCodeHLJS, {
27
- language: language,
28
- style: style,
29
- children: children
30
- });
31
- }
32
- if (highlighter == _PreformattedCode.PreformattedCodeHighlighter.PRISM) {
33
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PreformattedCodePrism.PreformattedCodePrism, {
34
- language: language,
35
- style: style,
36
- children: children
37
- });
38
- }
39
- }
@@ -1,32 +0,0 @@
1
- export interface IPreformattedCodeHighlighter {
2
- HLJS: string;
3
- PRISM: string;
4
- }
5
- export declare const PreformattedCodeHighlighter: IPreformattedCodeHighlighter;
6
- export interface IPreformattedCodeLanguage {
7
- TypeScript: string;
8
- JavaScript: string;
9
- Markdown: string;
10
- }
11
- export declare const PreformattedCodeLanguage: IPreformattedCodeLanguage;
12
- export interface IPreformattedCodeStyle {
13
- Ocean: string;
14
- Nord: string;
15
- }
16
- export declare const PreformattedCodeStyle: IPreformattedCodeStyle;
17
- export interface IPreformattedCodeDefault {
18
- Highlighter?: string;
19
- Language: string;
20
- Style: string;
21
- Children: string;
22
- }
23
- export declare const PreformattedCodeDefault: IPreformattedCodeDefault;
24
- export interface IPreformattedCode extends IPreformattedCodeBase {
25
- highlighter?: string;
26
- }
27
- export interface IPreformattedCodeBase {
28
- language?: string;
29
- style?: string;
30
- children?: string;
31
- }
32
- //# sourceMappingURL=PreformattedCode.type.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PreformattedCode.type.d.ts","sourceRoot":"","sources":["../../../src/Legacy/PreformattedCode/PreformattedCode.type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;CACd;AAED,eAAO,MAAM,2BAA2B,EAAE,4BAGzC,CAAA;AAED,MAAM,WAAW,yBAAyB;IACxC,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,eAAO,MAAM,wBAAwB,EAAE,yBAItC,CAAA;AAED,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;CACb;AAED,eAAO,MAAM,qBAAqB,EAAE,sBAGnC,CAAA;AAED,MAAM,WAAW,wBAAwB;IACvC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,eAAO,MAAM,uBAAuB,EAAE,wBAKrC,CAAA;AAED,MAAM,WAAW,iBAAkB,SAAQ,qBAAqB;IAC9D,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB"}
@@ -1,25 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.PreformattedCodeStyle = exports.PreformattedCodeLanguage = exports.PreformattedCodeHighlighter = exports.PreformattedCodeDefault = void 0;
7
- var PreformattedCodeHighlighter = exports.PreformattedCodeHighlighter = {
8
- HLJS: 'HLJS',
9
- PRISM: 'PRISM'
10
- };
11
- var PreformattedCodeLanguage = exports.PreformattedCodeLanguage = {
12
- TypeScript: 'typescript',
13
- JavaScript: 'javascript',
14
- Markdown: 'markdown'
15
- };
16
- var PreformattedCodeStyle = exports.PreformattedCodeStyle = {
17
- Ocean: 'ocean',
18
- Nord: 'nord'
19
- };
20
- var PreformattedCodeDefault = exports.PreformattedCodeDefault = {
21
- Highlighter: PreformattedCodeHighlighter.HLJS,
22
- Language: PreformattedCodeLanguage.TypeScript,
23
- Style: PreformattedCodeStyle.Ocean,
24
- Children: ''
25
- };
@@ -1,3 +0,0 @@
1
- import { IPreformattedCodeBase } from './PreformattedCode.type';
2
- export declare function PreformattedCodeHLJS({ language, style, children, }: IPreformattedCodeBase): import("react/jsx-runtime").JSX.Element;
3
- //# sourceMappingURL=PreformattedCodeHLJS.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PreformattedCodeHLJS.d.ts","sourceRoot":"","sources":["../../../src/Legacy/PreformattedCode/PreformattedCodeHLJS.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAkD,MAAM,yBAAyB,CAAA;AAI/G,wBAAgB,oBAAoB,CAAC,EACnC,QAA2C,EAC3C,KAAqC,EACrC,QAAQ,GACT,EAAE,qBAAqB,2CAYvB"}
@@ -1,3 +0,0 @@
1
- import { IPreformattedCodeBase } from './PreformattedCode.type';
2
- export declare function PreformattedCodePrism({ language, style, children, }: IPreformattedCodeBase): import("react/jsx-runtime").JSX.Element;
3
- //# sourceMappingURL=PreformattedCodePrism.d.ts.map