@macive/ui 0.0.9 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@macive/ui",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -1,57 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ConditionalRender = exports.ConditionalWrapper = exports.elementChildren = exports.isElementOfType = exports.wrapWithComponent = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
6
- // Wraps `element` in `Component`, if it is not already an instance of
7
- // `Component`. If `props` is passed, those will be added as props on the
8
- // wrapped component. If `element` is null, the component is not wrapped.
9
- function wrapWithComponent(element, Component, props) {
10
- if (element == null) {
11
- return null;
12
- }
13
- return isElementOfType(element, Component) ? element : (0, jsx_runtime_1.jsx)(Component, { ...props, children: element });
14
- }
15
- exports.wrapWithComponent = wrapWithComponent;
16
- // In development, we compare based on the name of the function because
17
- // React Hot Loader proxies React components in order to make updates. In
18
- // production we can simply compare the components for equality.
19
- const isComponent = process.env.NODE_ENV === 'development'
20
- ? hotReloadComponentCheck
21
- : (AComponent, AnotherComponent) => AComponent === AnotherComponent;
22
- // Checks whether `element` is a React element of type `Component` (or one of
23
- // the passed components, if `Component` is an array of React components).
24
- function isElementOfType(element, Component) {
25
- var _a;
26
- if (element == null || !(0, react_1.isValidElement)(element) || typeof element.type === 'string') {
27
- return false;
28
- }
29
- const { type: defaultType } = element;
30
- // Type override allows components to bypass default wrapping behavior. Ex: Stack, ResourceList...
31
- // See https://github.com/Airsoko/app-extension-libs/issues/996#issuecomment-710437088
32
- const overrideType = (_a = element.props) === null || _a === void 0 ? void 0 : _a.__type__;
33
- const type = overrideType || defaultType;
34
- const Components = Array.isArray(Component) ? Component : [Component];
35
- return Components.some((AComponent) => typeof type !== 'string' && isComponent(AComponent, type));
36
- }
37
- exports.isElementOfType = isElementOfType;
38
- // Returns all children that are valid elements as an array. Can optionally be
39
- // filtered by passing `predicate`.
40
- function elementChildren(children, predicate = () => true) {
41
- return react_1.Children.toArray(children).filter((child) => (0, react_1.isValidElement)(child) && predicate(child));
42
- }
43
- exports.elementChildren = elementChildren;
44
- function ConditionalWrapper({ condition, wrapper, children, }) {
45
- return condition ? wrapper(children) : children;
46
- }
47
- exports.ConditionalWrapper = ConditionalWrapper;
48
- function ConditionalRender({ condition, children }) {
49
- return condition ? children : null;
50
- }
51
- exports.ConditionalRender = ConditionalRender;
52
- function hotReloadComponentCheck(AComponent, AnotherComponent) {
53
- const componentName = AComponent.name;
54
- const anotherComponentName = AnotherComponent.displayName;
55
- return (AComponent === AnotherComponent ||
56
- (Boolean(componentName) && componentName === anotherComponentName));
57
- }
@@ -1,17 +0,0 @@
1
- import React from 'react';
2
- export declare function wrapWithComponent<TProps extends React.PropsWithChildren>(element: React.ReactNode | null | undefined, Component: React.ComponentType<TProps>, props: TProps & JSX.IntrinsicAttributes): React.ReactNode;
3
- export declare function isElementOfType<TProps>(element: React.ReactNode | null | undefined, Component: React.ComponentType<TProps> | React.ComponentType<TProps>[]): boolean;
4
- export declare function elementChildren<T extends React.ReactElement>(children: React.ReactNode, predicate?: (element: T) => boolean): T[];
5
- interface ConditionalWrapperProps {
6
- children: any;
7
- condition: boolean;
8
- wrapper: (children: any) => any;
9
- }
10
- export declare function ConditionalWrapper({ condition, wrapper, children, }: ConditionalWrapperProps): JSX.Element;
11
- interface ConditionalRenderProps {
12
- condition: boolean;
13
- children: any;
14
- }
15
- export declare function ConditionalRender({ condition, children }: ConditionalRenderProps): JSX.Element;
16
- export {};
17
- //# sourceMappingURL=components%20copy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"components copy.d.ts","sourceRoot":"","sources":["../../../../src/utilities/components copy.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmC,MAA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