@ebrains/react 0.9.2-beta → 1.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 (172) hide show
  1. package/README.md +3 -3
  2. package/analytics-d99780e3.esm.js +55 -0
  3. package/arrow-diagonal-black-8f0494c3.esm.js +3 -0
  4. package/arrow-right-9322ba8a.esm.js +5 -0
  5. package/bluesky-cc5edd2d.esm.js +14 -0
  6. package/bookmark-c200037c.esm.js +16 -0
  7. package/chevron-down-6144c823.esm.js +12 -0
  8. package/chevron-left-ca6c66e1.esm.js +11 -0
  9. package/chevron-right-b88ed2d4.esm.js +5 -0
  10. package/chevron-up-c66bd477.esm.js +12 -0
  11. package/close-87fc0d63.esm.js +5 -0
  12. package/color-primary-palette_6.entry.esm.js +778 -0
  13. package/components-section.entry.esm.js +171 -0
  14. package/copy-03b72cb6.esm.js +5 -0
  15. package/correct-use-of-colors.entry.esm.js +243 -0
  16. package/docs-palettes.entry.esm.js +29 -0
  17. package/docs-tokens.entry.esm.js +45 -0
  18. package/eds-accordion.entry.esm.js +132 -0
  19. package/eds-alert.entry.esm.js +112 -0
  20. package/eds-app-root.entry.esm.js +53 -0
  21. package/eds-avatar_34.entry.esm.js +3594 -0
  22. package/eds-card-project.entry.esm.js +210 -0
  23. package/eds-card-section.entry.esm.js +56 -0
  24. package/eds-card-tags.entry.esm.js +27 -0
  25. package/eds-card-tool.entry.esm.js +105 -0
  26. package/eds-code-block.entry.esm.js +2290 -0
  27. package/eds-cookies-preference.entry.esm.js +47 -0
  28. package/eds-feedback.entry.esm.js +87 -0
  29. package/eds-frame.entry.esm.js +112 -0
  30. package/eds-icon-arrow-diagonal.entry.esm.js +21 -0
  31. package/eds-icon-arrow-right.entry.esm.js +21 -0
  32. package/eds-icon-bluesky.entry.esm.js +21 -0
  33. package/eds-icon-bookmark.entry.esm.js +21 -0
  34. package/eds-icon-chevron-down.entry.esm.js +21 -0
  35. package/eds-icon-chevron-left.entry.esm.js +21 -0
  36. package/eds-icon-chevron-right.entry.esm.js +21 -0
  37. package/eds-icon-chevron-up.entry.esm.js +21 -0
  38. package/eds-icon-close.entry.esm.js +21 -0
  39. package/eds-icon-copy.entry.esm.js +21 -0
  40. package/eds-icon-eu.entry.esm.js +21 -0
  41. package/eds-icon-external.entry.esm.js +21 -0
  42. package/eds-icon-facebook.entry.esm.js +21 -0
  43. package/eds-icon-gitlab.entry.esm.js +21 -0
  44. package/eds-icon-linkedin.entry.esm.js +21 -0
  45. package/eds-icon-loader.entry.esm.js +21 -0
  46. package/eds-icon-mastodon.entry.esm.js +21 -0
  47. package/eds-icon-menu.entry.esm.js +21 -0
  48. package/eds-icon-minus.entry.esm.js +21 -0
  49. package/eds-icon-more.entry.esm.js +21 -0
  50. package/eds-icon-paper.entry.esm.js +21 -0
  51. package/eds-icon-plus.entry.esm.js +21 -0
  52. package/eds-icon-portal.entry.esm.js +21 -0
  53. package/eds-icon-private.entry.esm.js +21 -0
  54. package/eds-icon-public.entry.esm.js +21 -0
  55. package/eds-icon-search.entry.esm.js +21 -0
  56. package/eds-icon-star.entry.esm.js +21 -0
  57. package/eds-icon-success.entry.esm.js +21 -0
  58. package/eds-icon-thumbs-down.entry.esm.js +21 -0
  59. package/eds-icon-thumbs-up.entry.esm.js +21 -0
  60. package/eds-icon-tutorial.entry.esm.js +21 -0
  61. package/eds-icon-twitter.entry.esm.js +21 -0
  62. package/eds-icon-unknown.entry.esm.js +21 -0
  63. package/eds-icon-updown.entry.esm.js +21 -0
  64. package/eds-icon-user.entry.esm.js +21 -0
  65. package/eds-icon-youtube.entry.esm.js +21 -0
  66. package/eds-matomo-notice.entry.esm.js +159 -0
  67. package/eds-pagination_2.entry.esm.js +493 -0
  68. package/eds-progress-bar.entry.esm.js +52 -0
  69. package/eds-rating.entry.esm.js +79 -0
  70. package/eds-section-core_2.entry.esm.js +69 -0
  71. package/eds-spinner.entry.esm.js +67 -0
  72. package/eds-splash-screen.entry.esm.js +87 -0
  73. package/eds-switch.entry.esm.js +68 -0
  74. package/eds-timeline.entry.esm.js +117 -0
  75. package/eds-toast-manager.entry.esm.js +93 -0
  76. package/eds-toast.entry.esm.js +93 -0
  77. package/eds-trl.entry.esm.js +68 -0
  78. package/eu-9ddde93a.esm.js +30 -0
  79. package/facebook-9cb5c17f.esm.js +14 -0
  80. package/incorrect-use-of-colors.entry.esm.js +74 -0
  81. package/index-39c58238.esm.js +58 -0
  82. package/index.esm.d.ts +1 -0
  83. package/index.esm.js +4 -0
  84. package/index.esm2.js +4558 -0
  85. package/linkedin-e8650abb.esm.js +28 -0
  86. package/loader-c9628637.esm.js +30 -0
  87. package/logo-color-7f1fd803.esm.js +115 -0
  88. package/logo-color-margins-ff8ce71b.esm.js +118 -0
  89. package/logo-space.entry.esm.js +48 -0
  90. package/logo-variations-horizontal_2.entry.esm.js +123 -0
  91. package/logo-variations-tabs.entry.esm.js +29 -0
  92. package/logo-white-no-bg-f382f86f.esm.js +1021 -0
  93. package/logo-wrong-usage.entry.esm.js +101 -0
  94. package/mastodon-3703ec61.esm.js +14 -0
  95. package/menu-340ea948.esm.js +11 -0
  96. package/minus-b30a7c71.esm.js +11 -0
  97. package/mono-53f70232.esm.js +11 -0
  98. package/more-4449d549.esm.js +13 -0
  99. package/package.json +6 -2
  100. package/paper-8e74ea31.esm.js +15 -0
  101. package/plus-89c07be2.esm.js +12 -0
  102. package/portal-d6c8ce56.esm.js +18 -0
  103. package/private-1c25ff8e.esm.js +25 -0
  104. package/public-d4d8c585.esm.js +16 -0
  105. package/search-fbcd79c2.esm.js +12 -0
  106. package/sharedUtils-a550989c.esm.js +17 -0
  107. package/src/components.d.ts +40 -0
  108. package/src/generated/components.d.ts +38 -0
  109. package/src/generated/react-component-lib/attachProps.d.ts +16 -0
  110. package/src/generated/react-component-lib/case.d.ts +2 -0
  111. package/src/generated/react-component-lib/createComponent.d.ts +10 -0
  112. package/src/generated/react-component-lib/createOverlayComponent.d.ts +21 -0
  113. package/src/generated/react-component-lib/dev.d.ts +2 -0
  114. package/src/generated/react-component-lib/interfaces.d.ts +29 -0
  115. package/src/generated/react-component-lib/utils/attachProps.d.ts +16 -0
  116. package/src/generated/react-component-lib/utils/case.d.ts +2 -0
  117. package/src/generated/react-component-lib/utils/dev.d.ts +2 -0
  118. package/src/generated/react-component-lib/utils/index.d.ts +10 -0
  119. package/src/react-component-lib/attachProps.d.ts +16 -0
  120. package/src/react-component-lib/case.d.ts +2 -0
  121. package/src/react-component-lib/createComponent.d.ts +10 -0
  122. package/src/react-component-lib/createOverlayComponent.d.ts +21 -0
  123. package/src/react-component-lib/dev.d.ts +2 -0
  124. package/src/react-component-lib/interfaces.d.ts +29 -0
  125. package/src/react-component-lib/utils/attachProps.d.ts +16 -0
  126. package/src/react-component-lib/utils/case.d.ts +2 -0
  127. package/src/react-component-lib/utils/index.d.ts +10 -0
  128. package/star-0da9b5e9.esm.js +5 -0
  129. package/success-443809da.esm.js +18 -0
  130. package/svg-repository.entry.esm.js +337 -0
  131. package/thumbs-down-a18fd049.esm.js +5 -0
  132. package/thumbs-up-c19a71bc.esm.js +6 -0
  133. package/token-list_3.entry.esm.js +385 -0
  134. package/token-ratios.entry.esm.js +49 -0
  135. package/token-typography.entry.esm.js +267 -0
  136. package/tutotial-150ee1fd.esm.js +27 -0
  137. package/twitter-ac21b505.esm.js +14 -0
  138. package/unknown-ed01a24c.esm.js +22 -0
  139. package/up-and-down-d747abee.esm.js +12 -0
  140. package/user-71ebdc15.esm.js +16 -0
  141. package/youtube-efbfbdc4.esm.js +14 -0
  142. package/.babelrc +0 -12
  143. package/project.json +0 -10
  144. package/rollup.config.js +0 -43
  145. package/src/components.ts +0 -49
  146. package/src/generated/components.ts +0 -47
  147. package/src/generated/react-component-lib/attachProps.ts +0 -125
  148. package/src/generated/react-component-lib/case.ts +0 -7
  149. package/src/generated/react-component-lib/createComponent.tsx +0 -106
  150. package/src/generated/react-component-lib/createOverlayComponent.tsx +0 -142
  151. package/src/generated/react-component-lib/dev.ts +0 -14
  152. package/src/generated/react-component-lib/index.tsx +0 -50
  153. package/src/generated/react-component-lib/interfaces.ts +0 -34
  154. package/src/generated/react-component-lib/utils/attachProps.ts +0 -125
  155. package/src/generated/react-component-lib/utils/case.ts +0 -7
  156. package/src/generated/react-component-lib/utils/dev.ts +0 -14
  157. package/src/generated/react-component-lib/utils/index.tsx +0 -50
  158. package/src/react-component-lib/attachProps.ts +0 -125
  159. package/src/react-component-lib/case.ts +0 -7
  160. package/src/react-component-lib/createComponent.tsx +0 -106
  161. package/src/react-component-lib/createOverlayComponent.tsx +0 -142
  162. package/src/react-component-lib/dev.ts +0 -14
  163. package/src/react-component-lib/index.tsx +0 -50
  164. package/src/react-component-lib/interfaces.ts +0 -34
  165. package/src/react-component-lib/utils/attachProps.ts +0 -125
  166. package/src/react-component-lib/utils/case.ts +0 -7
  167. package/src/react-component-lib/utils/index.tsx +0 -50
  168. package/tsconfig.json +0 -17
  169. package/tsconfig.lib.json +0 -23
  170. /package/src/generated/react-component-lib/{index.ts → index.d.ts} +0 -0
  171. /package/src/{index.ts → index.d.ts} +0 -0
  172. /package/src/react-component-lib/{index.ts → index.d.ts} +0 -0
@@ -1,142 +0,0 @@
1
- import React from 'react';
2
- import ReactDOM from 'react-dom';
3
-
4
- import { OverlayEventDetail } from './interfaces';
5
- import { StencilReactForwardedRef, attachProps, dashToPascalCase, defineCustomElement, setRef } from './utils';
6
-
7
- interface OverlayElement extends HTMLElement {
8
- present: () => Promise<void>;
9
- dismiss: (data?: any, role?: string | undefined) => Promise<boolean>;
10
- }
11
-
12
- export interface ReactOverlayProps {
13
- children?: React.ReactNode;
14
- isOpen: boolean;
15
- onDidDismiss?: (event: CustomEvent<OverlayEventDetail>) => void;
16
- onDidPresent?: (event: CustomEvent<OverlayEventDetail>) => void;
17
- onWillDismiss?: (event: CustomEvent<OverlayEventDetail>) => void;
18
- onWillPresent?: (event: CustomEvent<OverlayEventDetail>) => void;
19
- }
20
-
21
- export const createOverlayComponent = <OverlayComponent extends object, OverlayType extends OverlayElement>(
22
- tagName: string,
23
- controller: { create: (options: any) => Promise<OverlayType> },
24
- customElement?: any
25
- ) => {
26
- defineCustomElement(tagName, customElement);
27
-
28
- const displayName = dashToPascalCase(tagName);
29
- const didDismissEventName = `on${displayName}DidDismiss`;
30
- const didPresentEventName = `on${displayName}DidPresent`;
31
- const willDismissEventName = `on${displayName}WillDismiss`;
32
- const willPresentEventName = `on${displayName}WillPresent`;
33
-
34
- type Props = OverlayComponent &
35
- ReactOverlayProps & {
36
- forwardedRef?: StencilReactForwardedRef<OverlayType>;
37
- };
38
-
39
- let isDismissing = false;
40
-
41
- class Overlay extends React.Component<Props> {
42
- overlay?: OverlayType;
43
- el!: HTMLDivElement;
44
-
45
- constructor(props: Props) {
46
- super(props);
47
- if (typeof document !== 'undefined') {
48
- this.el = document.createElement('div');
49
- }
50
- this.handleDismiss = this.handleDismiss.bind(this);
51
- }
52
-
53
- static get displayName() {
54
- return displayName;
55
- }
56
-
57
- componentDidMount() {
58
- if (this.props.isOpen) {
59
- this.present();
60
- }
61
- }
62
-
63
- componentWillUnmount() {
64
- if (this.overlay) {
65
- this.overlay.dismiss();
66
- }
67
- }
68
-
69
- handleDismiss(event: CustomEvent<OverlayEventDetail<any>>) {
70
- if (this.props.onDidDismiss) {
71
- this.props.onDidDismiss(event);
72
- }
73
- setRef(this.props.forwardedRef, null);
74
- }
75
-
76
- shouldComponentUpdate(nextProps: Props) {
77
- // Check if the overlay component is about to dismiss
78
- if (this.overlay && nextProps.isOpen !== this.props.isOpen && nextProps.isOpen === false) {
79
- isDismissing = true;
80
- }
81
-
82
- return true;
83
- }
84
-
85
- async componentDidUpdate(prevProps: Props) {
86
- if (this.overlay) {
87
- attachProps(this.overlay, this.props, prevProps);
88
- }
89
-
90
- if (prevProps.isOpen !== this.props.isOpen && this.props.isOpen === true) {
91
- this.present(prevProps);
92
- }
93
- if (this.overlay && prevProps.isOpen !== this.props.isOpen && this.props.isOpen === false) {
94
- await this.overlay.dismiss();
95
- isDismissing = false;
96
-
97
- /**
98
- * Now that the overlay is dismissed
99
- * we need to render again so that any
100
- * inner components will be unmounted
101
- */
102
- this.forceUpdate();
103
- }
104
- }
105
-
106
- async present(prevProps?: Props) {
107
- const { children, isOpen, onDidDismiss, onDidPresent, onWillDismiss, onWillPresent, ...cProps } = this.props;
108
- const elementProps = {
109
- ...cProps,
110
- ref: this.props.forwardedRef,
111
- [didDismissEventName]: this.handleDismiss,
112
- [didPresentEventName]: (e: CustomEvent) => this.props.onDidPresent && this.props.onDidPresent(e),
113
- [willDismissEventName]: (e: CustomEvent) => this.props.onWillDismiss && this.props.onWillDismiss(e),
114
- [willPresentEventName]: (e: CustomEvent) => this.props.onWillPresent && this.props.onWillPresent(e),
115
- };
116
-
117
- this.overlay = await controller.create({
118
- ...elementProps,
119
- component: this.el,
120
- componentProps: {},
121
- });
122
-
123
- setRef(this.props.forwardedRef, this.overlay);
124
- attachProps(this.overlay, elementProps, prevProps);
125
-
126
- await this.overlay.present();
127
- }
128
-
129
- render() {
130
- /**
131
- * Continue to render the component even when
132
- * overlay is dismissing otherwise component
133
- * will be hidden before animation is done.
134
- */
135
- return ReactDOM.createPortal(this.props.isOpen || isDismissing ? this.props.children : null, this.el);
136
- }
137
- }
138
-
139
- return React.forwardRef<OverlayType, Props>((props, ref) => {
140
- return <Overlay {...props} forwardedRef={ref} />;
141
- });
142
- };
@@ -1,14 +0,0 @@
1
- export const isDevMode = () => {
2
- return process && process.env && process.env.NODE_ENV === 'development';
3
- };
4
-
5
- const warnings: { [key: string]: boolean } = {};
6
-
7
- export const deprecationWarning = (key: string, message: string) => {
8
- if (isDevMode()) {
9
- if (!warnings[key]) {
10
- console.warn(message);
11
- warnings[key] = true;
12
- }
13
- }
14
- };
@@ -1,50 +0,0 @@
1
- import React from 'react';
2
-
3
- import type { StyleReactProps } from '../interfaces';
4
-
5
- export type StencilReactExternalProps<PropType, ElementType> = PropType &
6
- Omit<React.HTMLAttributes<ElementType>, 'style'> &
7
- StyleReactProps;
8
-
9
- // This will be replaced with React.ForwardedRef when react-output-target is upgraded to React v17
10
- export type StencilReactForwardedRef<T> = ((instance: T | null) => void) | React.MutableRefObject<T | null> | null;
11
-
12
- export const setRef = (ref: StencilReactForwardedRef<any> | React.Ref<any> | undefined, value: any) => {
13
- if (typeof ref === 'function') {
14
- ref(value);
15
- } else if (ref != null) {
16
- // Cast as a MutableRef so we can assign current
17
- (ref as React.MutableRefObject<any>).current = value;
18
- }
19
- };
20
-
21
- export const mergeRefs = (
22
- ...refs: (StencilReactForwardedRef<any> | React.Ref<any> | undefined)[]
23
- ): React.RefCallback<any> => {
24
- return (value: any) => {
25
- refs.forEach((ref) => {
26
- setRef(ref, value);
27
- });
28
- };
29
- };
30
-
31
- export const createForwardRef = <PropType, ElementType>(ReactComponent: any, displayName: string) => {
32
- const forwardRef = (
33
- props: StencilReactExternalProps<PropType, ElementType>,
34
- ref: StencilReactForwardedRef<ElementType>
35
- ) => {
36
- return <ReactComponent {...props} forwardedRef={ref} />;
37
- };
38
- forwardRef.displayName = displayName;
39
-
40
- return React.forwardRef(forwardRef);
41
- };
42
-
43
- export const defineCustomElement = (tagName: string, customElement: any) => {
44
- if (customElement !== undefined && typeof customElements !== 'undefined' && !customElements.get(tagName)) {
45
- customElements.define(tagName, customElement);
46
- }
47
- };
48
-
49
- export * from './attachProps';
50
- export * from './case';
@@ -1,34 +0,0 @@
1
- // General types important to applications using stencil built components
2
- export interface EventEmitter<T = any> {
3
- emit: (data?: T) => CustomEvent<T>;
4
- }
5
-
6
- export interface StyleReactProps {
7
- class?: string;
8
- className?: string;
9
- style?: { [key: string]: any };
10
- }
11
-
12
- export interface OverlayEventDetail<T = any> {
13
- data?: T;
14
- role?: string;
15
- }
16
-
17
- export interface OverlayInterface {
18
- el: HTMLElement;
19
- animated: boolean;
20
- keyboardClose: boolean;
21
- overlayIndex: number;
22
- presented: boolean;
23
-
24
- enterAnimation?: any;
25
- leaveAnimation?: any;
26
-
27
- didPresent: EventEmitter<void>;
28
- willPresent: EventEmitter<void>;
29
- willDismiss: EventEmitter<OverlayEventDetail>;
30
- didDismiss: EventEmitter<OverlayEventDetail>;
31
-
32
- present(): Promise<void>;
33
- dismiss(data?: any, role?: string): Promise<boolean>;
34
- }
@@ -1,125 +0,0 @@
1
- import { camelToDashCase } from './case';
2
-
3
- export const attachProps = (node: HTMLElement, newProps: any, oldProps: any = {}) => {
4
- // some test frameworks don't render DOM elements, so we test here to make sure we are dealing with DOM first
5
- if (node instanceof Element) {
6
- // add any classes in className to the class list
7
- const className = getClassName(node.classList, newProps, oldProps);
8
- if (className !== '') {
9
- node.className = className;
10
- }
11
-
12
- Object.keys(newProps).forEach((name) => {
13
- if (
14
- name === 'children' ||
15
- name === 'style' ||
16
- name === 'ref' ||
17
- name === 'class' ||
18
- name === 'className' ||
19
- name === 'forwardedRef'
20
- ) {
21
- return;
22
- }
23
- if (name.indexOf('on') === 0 && name[2] === name[2].toUpperCase()) {
24
- const eventName = name.substring(2);
25
- const eventNameLc = eventName[0].toLowerCase() + eventName.substring(1);
26
-
27
- if (!isCoveredByReact(eventNameLc)) {
28
- syncEvent(node, eventNameLc, newProps[name]);
29
- }
30
- } else {
31
- (node as any)[name] = newProps[name];
32
- const propType = typeof newProps[name];
33
- if (propType === 'string') {
34
- node.setAttribute(camelToDashCase(name), newProps[name]);
35
- }
36
- }
37
- });
38
- }
39
- };
40
-
41
- export const getClassName = (classList: DOMTokenList, newProps: any, oldProps: any) => {
42
- const newClassProp: string = newProps.className || newProps.class;
43
- const oldClassProp: string = oldProps.className || oldProps.class;
44
- // map the classes to Maps for performance
45
- const currentClasses = arrayToMap(classList);
46
- const incomingPropClasses = arrayToMap(newClassProp ? newClassProp.split(' ') : []);
47
- const oldPropClasses = arrayToMap(oldClassProp ? oldClassProp.split(' ') : []);
48
- const finalClassNames: string[] = [];
49
- // loop through each of the current classes on the component
50
- // to see if it should be a part of the classNames added
51
- currentClasses.forEach((currentClass) => {
52
- if (incomingPropClasses.has(currentClass)) {
53
- // add it as its already included in classnames coming in from newProps
54
- finalClassNames.push(currentClass);
55
- incomingPropClasses.delete(currentClass);
56
- } else if (!oldPropClasses.has(currentClass)) {
57
- // add it as it has NOT been removed by user
58
- finalClassNames.push(currentClass);
59
- }
60
- });
61
- incomingPropClasses.forEach((s) => finalClassNames.push(s));
62
- return finalClassNames.join(' ');
63
- };
64
-
65
- /**
66
- * Transforms a React event name to a browser event name.
67
- */
68
- export const transformReactEventName = (eventNameSuffix: string) => {
69
- switch (eventNameSuffix) {
70
- case 'doubleclick':
71
- return 'dblclick';
72
- }
73
- return eventNameSuffix;
74
- };
75
-
76
- /**
77
- * Checks if an event is supported in the current execution environment.
78
- * @license Modernizr 3.0.0pre (Custom Build) | MIT
79
- */
80
- export const isCoveredByReact = (eventNameSuffix: string) => {
81
- if (typeof document === 'undefined') {
82
- return true;
83
- } else {
84
- const eventName = 'on' + transformReactEventName(eventNameSuffix);
85
- let isSupported = eventName in document;
86
-
87
- if (!isSupported) {
88
- const element = document.createElement('div');
89
- element.setAttribute(eventName, 'return;');
90
- isSupported = typeof (element as any)[eventName] === 'function';
91
- }
92
-
93
- return isSupported;
94
- }
95
- };
96
-
97
- export const syncEvent = (
98
- node: Element & { __events?: { [key: string]: ((e: Event) => any) | undefined } },
99
- eventName: string,
100
- newEventHandler?: (e: Event) => any
101
- ) => {
102
- const eventStore = node.__events || (node.__events = {});
103
- const oldEventHandler = eventStore[eventName];
104
-
105
- // Remove old listener so they don't double up.
106
- if (oldEventHandler) {
107
- node.removeEventListener(eventName, oldEventHandler);
108
- }
109
-
110
- // Bind new listener.
111
- node.addEventListener(
112
- eventName,
113
- (eventStore[eventName] = function handler(e: Event) {
114
- if (newEventHandler) {
115
- newEventHandler.call(this, e);
116
- }
117
- })
118
- );
119
- };
120
-
121
- const arrayToMap = (arr: string[] | DOMTokenList) => {
122
- const map = new Map<string, string>();
123
- (arr as string[]).forEach((s: string) => map.set(s, s));
124
- return map;
125
- };
@@ -1,7 +0,0 @@
1
- export const dashToPascalCase = (str: string) =>
2
- str
3
- .toLowerCase()
4
- .split('-')
5
- .map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1))
6
- .join('');
7
- export const camelToDashCase = (str: string) => str.replace(/([A-Z])/g, (m: string) => `-${m[0].toLowerCase()}`);
@@ -1,50 +0,0 @@
1
- import React from 'react';
2
-
3
- import type { StyleReactProps } from '../interfaces';
4
-
5
- export type StencilReactExternalProps<PropType, ElementType> = PropType &
6
- Omit<React.HTMLAttributes<ElementType>, 'style'> &
7
- StyleReactProps;
8
-
9
- // This will be replaced with React.ForwardedRef when react-output-target is upgraded to React v17
10
- export type StencilReactForwardedRef<T> = ((instance: T | null) => void) | React.MutableRefObject<T | null> | null;
11
-
12
- export const setRef = (ref: StencilReactForwardedRef<any> | React.Ref<any> | undefined, value: any) => {
13
- if (typeof ref === 'function') {
14
- ref(value);
15
- } else if (ref != null) {
16
- // Cast as a MutableRef so we can assign current
17
- (ref as React.MutableRefObject<any>).current = value;
18
- }
19
- };
20
-
21
- export const mergeRefs = (
22
- ...refs: (StencilReactForwardedRef<any> | React.Ref<any> | undefined)[]
23
- ): React.RefCallback<any> => {
24
- return (value: any) => {
25
- refs.forEach((ref) => {
26
- setRef(ref, value);
27
- });
28
- };
29
- };
30
-
31
- export const createForwardRef = <PropType, ElementType>(ReactComponent: any, displayName: string) => {
32
- const forwardRef = (
33
- props: StencilReactExternalProps<PropType, ElementType>,
34
- ref: StencilReactForwardedRef<ElementType>
35
- ) => {
36
- return <ReactComponent {...props} forwardedRef={ref} />;
37
- };
38
- forwardRef.displayName = displayName;
39
-
40
- return React.forwardRef(forwardRef);
41
- };
42
-
43
- export const defineCustomElement = (tagName: string, customElement: any) => {
44
- if (customElement !== undefined && typeof customElements !== 'undefined' && !customElements.get(tagName)) {
45
- customElements.define(tagName, customElement);
46
- }
47
- };
48
-
49
- export * from './attachProps';
50
- export * from './case';
package/tsconfig.json DELETED
@@ -1,17 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "jsx": "react-jsx",
4
- "allowJs": false,
5
- "esModuleInterop": false,
6
- "allowSyntheticDefaultImports": true,
7
- "strict": true
8
- },
9
- "files": [],
10
- "include": [],
11
- "references": [
12
- {
13
- "path": "./tsconfig.lib.json"
14
- }
15
- ],
16
- "extends": "../../tsconfig.base.json"
17
- }
package/tsconfig.lib.json DELETED
@@ -1,23 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "../../dist/out-tsc",
5
- "types": [
6
- "node",
7
- "@nx/react/typings/cssmodule.d.ts",
8
- "@nx/react/typings/image.d.ts"
9
- ]
10
- },
11
- "exclude": [
12
- "jest.config.ts",
13
- "src/**/*.spec.ts",
14
- "src/**/*.test.ts",
15
- "src/**/*.spec.tsx",
16
- "src/**/*.test.tsx",
17
- "src/**/*.spec.js",
18
- "src/**/*.test.js",
19
- "src/**/*.spec.jsx",
20
- "src/**/*.test.jsx"
21
- ],
22
- "include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"]
23
- }
File without changes