@jobber/components 4.26.3 → 4.26.5-pre.33
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/DataList.d.ts +1 -0
- package/DataList.js +17 -0
- package/dist/DataList/DataList.const.d.ts +13 -0
- package/dist/DataList/DataList.d.ts +5 -18
- package/dist/DataList/DataList.stories.d.ts +1 -0
- package/dist/DataList/DataList.types.d.ts +67 -0
- package/dist/DataList/DataList.utils.d.ts +31 -0
- package/dist/DataList/components/DataListLayout/DataListLayout.d.ts +11 -0
- package/dist/DataList/components/DataListLayout/index.d.ts +1 -0
- package/dist/DataList/components/DataListLayoutInternal/DataListHeader.d.ts +12 -0
- package/dist/DataList/components/DataListLayoutInternal/DataListItems.d.ts +11 -0
- package/dist/DataList/components/DataListLayoutInternal/DataListLayoutInternal.d.ts +11 -0
- package/dist/DataList/components/DataListLayoutInternal/index.d.ts +2 -0
- package/dist/DataList/components/DataListTags/DataListTags.d.ts +6 -0
- package/dist/DataList/components/DataListTags/index.d.ts +1 -0
- package/dist/DataList/components/DataListTotalCount/DataListTotalCount.d.ts +8 -0
- package/dist/DataList/components/DataListTotalCount/index.d.ts +1 -0
- package/dist/DataList/hooks/useLayoutMediaQueries.d.ts +1 -0
- package/dist/DataList/index.d.ts +1 -0
- package/dist/DataList/index.js +324 -0
- package/dist/DataList/storyUtils.d.ts +38 -0
- package/dist/FormatDate/index.js +4 -29
- package/dist/FormatDate-70ea5b43.js +34 -0
- package/dist/InlineLabel/index.js +6 -23
- package/dist/InlineLabel-afd5fc6f.js +28 -0
- package/package.json +4 -3
package/DataList.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./dist/DataList";
|
package/DataList.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true,
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var DataList = require("./dist/DataList");
|
|
8
|
+
|
|
9
|
+
Object.keys(DataList).forEach(function(key) {
|
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
Object.defineProperty(exports, key, {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function get() {
|
|
14
|
+
return DataList[key];
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Grab the type from breakpoints const
|
|
3
|
+
*/
|
|
4
|
+
type ValuesOf<T extends readonly unknown[]> = T[number];
|
|
5
|
+
export type Breakpoints = ValuesOf<typeof BREAKPOINTS>;
|
|
6
|
+
export declare const EMPTY_FILTER_RESULTS_MESSAGE = "No Results for Selected Filters";
|
|
7
|
+
export declare const EMPTY_FILTER_RESULTS_ACTION_LABEL = "Clear Filters";
|
|
8
|
+
/**
|
|
9
|
+
* Breakpoints that we support
|
|
10
|
+
*/
|
|
11
|
+
export declare const BREAKPOINTS: readonly ["xs", "sm", "md", "lg", "xl"];
|
|
12
|
+
export declare const BREAKPOINT_SIZES: Record<Breakpoints, number>;
|
|
13
|
+
export {};
|
|
@@ -1,21 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* @default false
|
|
6
|
-
*/
|
|
7
|
-
loading?: boolean;
|
|
8
|
-
items: any[];
|
|
9
|
-
/**
|
|
10
|
-
* Temporary prop for setting default state for if filters are applied
|
|
11
|
-
* @default false
|
|
12
|
-
*/
|
|
13
|
-
filterApplied?: boolean;
|
|
14
|
-
children?: React.ReactElement | React.ReactElement[];
|
|
15
|
-
}
|
|
16
|
-
export declare const EMPTY_FILTER_RESULTS_MESSAGE = "No Results for Selected Filters";
|
|
17
|
-
export declare const EMPTY_FILTER_RESULTS_ACTION_LABEL = "Clear Filters";
|
|
18
|
-
export declare function DataList({ loading, items, filterApplied, children, }: DataListProps): JSX.Element;
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DataListLayout } from "./components/DataListLayout";
|
|
3
|
+
import { DataListObject, DataListProps } from "./DataList.types";
|
|
4
|
+
export declare function DataList<T extends DataListObject>({ data, headers, loading, filterApplied, children, title, totalCount, headerVisibility, }: DataListProps<T>): JSX.Element;
|
|
19
5
|
export declare namespace DataList {
|
|
6
|
+
var Layout: typeof DataListLayout;
|
|
20
7
|
var EmptyState: typeof import("./components/EmptyState").EmptyState;
|
|
21
8
|
}
|
|
@@ -4,3 +4,4 @@ declare const _default: ComponentMeta<typeof DataList>;
|
|
|
4
4
|
export default _default;
|
|
5
5
|
export declare const Basic: ComponentStory<typeof DataList>;
|
|
6
6
|
export declare const EmptyState: ComponentStory<typeof DataList>;
|
|
7
|
+
export declare const Breakpoints: ComponentStory<typeof DataList>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { ReactElement, ReactNode } from "react";
|
|
2
|
+
import { Breakpoints } from "./DataList.const";
|
|
3
|
+
export { Breakpoints } from "./DataList.const";
|
|
4
|
+
export type DataListItemType<T extends DataListObject[]> = Record<keyof T[number], ReactElement>;
|
|
5
|
+
export type DataListItemTypeFromHeader<TData extends DataListObject, THeader extends DataListHeader<TData>> = Record<keyof THeader, ReactElement>;
|
|
6
|
+
export interface DataListObject {
|
|
7
|
+
/**
|
|
8
|
+
* The ID of the data.
|
|
9
|
+
*
|
|
10
|
+
* This is used as a key when looping through the data to prevent accidental
|
|
11
|
+
* rerender when the order of data changes.
|
|
12
|
+
*/
|
|
13
|
+
readonly id: string | number;
|
|
14
|
+
/**
|
|
15
|
+
* Styles the string as an emphasized text that differs from other keys.
|
|
16
|
+
*/
|
|
17
|
+
readonly label?: string | ReactElement;
|
|
18
|
+
/**
|
|
19
|
+
* Creates a styled list of tags that overflows and is truncated with a +N.
|
|
20
|
+
*/
|
|
21
|
+
readonly tags?: string[];
|
|
22
|
+
/**
|
|
23
|
+
* Support any key. The keys in this object are used as way to determine the
|
|
24
|
+
* keys you can use on the DataList header, layout, etc.
|
|
25
|
+
*/
|
|
26
|
+
readonly [key: string]: ReactNode | Date;
|
|
27
|
+
}
|
|
28
|
+
export type DataListHeader<T extends DataListObject> = {
|
|
29
|
+
readonly [K in keyof T]?: string;
|
|
30
|
+
};
|
|
31
|
+
export interface DataListProps<T extends DataListObject> {
|
|
32
|
+
readonly data: T[];
|
|
33
|
+
readonly headers: DataListHeader<T>;
|
|
34
|
+
/**
|
|
35
|
+
* Shows the loading state of the DataList.
|
|
36
|
+
*
|
|
37
|
+
* @default false
|
|
38
|
+
*/
|
|
39
|
+
readonly loading?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Temporary prop for setting default state for if filters are applied
|
|
42
|
+
*
|
|
43
|
+
* @default false
|
|
44
|
+
*/
|
|
45
|
+
readonly filterApplied?: boolean;
|
|
46
|
+
readonly children: ReactElement | ReactElement[];
|
|
47
|
+
/**
|
|
48
|
+
* The title of the DataList.
|
|
49
|
+
*/
|
|
50
|
+
readonly title?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Total number of items in the DataList.
|
|
53
|
+
*
|
|
54
|
+
* This renders an "N result" text with the DataList
|
|
55
|
+
* that helps users know how many items they have
|
|
56
|
+
* in the list
|
|
57
|
+
*/
|
|
58
|
+
readonly totalCount?: number | null;
|
|
59
|
+
/**
|
|
60
|
+
* Determine if the header is visible at a given breakpoint. If one isn't provided,
|
|
61
|
+
* it will use the value from the next smallest breakpoint that has a value.
|
|
62
|
+
* @default { xs: true, sm: true, md: true, lg: true, xl: true }
|
|
63
|
+
*/
|
|
64
|
+
readonly headerVisibility?: {
|
|
65
|
+
[Breakpoint in Breakpoints]?: boolean;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React, { ReactElement } from "react";
|
|
2
|
+
import { DataListHeader, DataListItemType, DataListItemTypeFromHeader, DataListObject } from "./DataList.types";
|
|
3
|
+
import { EmptyStateProps } from "./components/EmptyState";
|
|
4
|
+
import { Breakpoints } from "./DataList.const";
|
|
5
|
+
/**
|
|
6
|
+
* Return the child component that matches the `type` provided
|
|
7
|
+
*/
|
|
8
|
+
export declare function getCompoundComponent<T>(children: ReactElement | ReactElement[], type: ReactElement<T>["type"]): ReactElement<T> | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Return all instances child component that matches the `type` provided
|
|
11
|
+
*/
|
|
12
|
+
export declare function getCompoundComponents<T>(children: ReactElement | ReactElement[], type: ReactElement<T>["type"]): ReactElement<T>[];
|
|
13
|
+
/**
|
|
14
|
+
* Generate the default elements the DataList would use on the data provided.
|
|
15
|
+
*/
|
|
16
|
+
export declare function generateListItemElements<T extends DataListObject>(data: T[]): DataListItemType<T[]>[];
|
|
17
|
+
/**
|
|
18
|
+
* Generate the header elements with the default styling
|
|
19
|
+
*/
|
|
20
|
+
export declare function generateHeaderElements<T extends DataListObject>(headers: DataListHeader<T>): DataListItemTypeFromHeader<T, DataListHeader<T>> | undefined;
|
|
21
|
+
interface UseDataListEmptyStateProps {
|
|
22
|
+
readonly children?: ReactElement | ReactElement[];
|
|
23
|
+
readonly isFilterApplied: boolean;
|
|
24
|
+
readonly setIsFilterApplied: (isFilterApplied: boolean) => void;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Modify EmptyState to include an empty filter results when filtering happens
|
|
28
|
+
*/
|
|
29
|
+
export declare function generateDataListEmptyState({ children, isFilterApplied, setIsFilterApplied, }: UseDataListEmptyStateProps): React.ReactElement<EmptyStateProps> | undefined;
|
|
30
|
+
export declare function sortSizeProp(sizeProp: Breakpoints[]): ("xs" | "sm" | "md" | "lg" | "xl")[];
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Breakpoints, DataListItemType, DataListObject } from "../../DataList.types";
|
|
3
|
+
export interface DataListLayoutProps<T extends DataListObject> {
|
|
4
|
+
readonly children: (item: DataListItemType<T[]>) => JSX.Element;
|
|
5
|
+
/**
|
|
6
|
+
* The breakpoint at which the layout should be displayed. It will be rendered until a layout with a larger breakpoint is found.
|
|
7
|
+
* @default "xs"
|
|
8
|
+
*/
|
|
9
|
+
readonly size?: Breakpoints;
|
|
10
|
+
}
|
|
11
|
+
export declare function DataListLayout<T extends DataListObject>(_: DataListLayoutProps<T>): JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./DataListLayout";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Breakpoints } from "../../DataList.const";
|
|
3
|
+
import { DataListHeader as DataListHeaderType, DataListItemTypeFromHeader, DataListObject, DataListProps } from "../../DataList.types";
|
|
4
|
+
import { DataListLayoutProps } from "../DataListLayout/DataListLayout";
|
|
5
|
+
interface DataListHeaderProps<T extends DataListObject> {
|
|
6
|
+
readonly layouts: React.ReactElement<DataListLayoutProps<T>>[] | undefined;
|
|
7
|
+
readonly mediaMatches?: Record<Breakpoints, boolean>;
|
|
8
|
+
readonly headerData?: DataListItemTypeFromHeader<T, DataListHeaderType<T>>;
|
|
9
|
+
readonly headerVisibility: NonNullable<DataListProps<T>["headerVisibility"]>;
|
|
10
|
+
}
|
|
11
|
+
export declare function DataListHeader<T extends DataListObject>({ layouts, mediaMatches, headerData, headerVisibility, }: DataListHeaderProps<T>): JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Breakpoints } from "../../DataList.const";
|
|
3
|
+
import { DataListObject } from "../../DataList.types";
|
|
4
|
+
import { DataListLayoutProps } from "../DataListLayout/DataListLayout";
|
|
5
|
+
interface DataListItemsProps<T extends DataListObject> {
|
|
6
|
+
layouts: React.ReactElement<DataListLayoutProps<T>>[] | undefined;
|
|
7
|
+
mediaMatches?: Record<Breakpoints, boolean>;
|
|
8
|
+
data: T[];
|
|
9
|
+
}
|
|
10
|
+
export declare function DataListItems<T extends DataListObject>({ layouts, mediaMatches, data, }: DataListItemsProps<T>): JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Breakpoints } from "../../DataList.const";
|
|
3
|
+
import { DataListObject } from "../../DataList.types";
|
|
4
|
+
import { DataListLayoutProps } from "../DataListLayout/DataListLayout";
|
|
5
|
+
interface DataListLayoutInternalProps<T extends DataListObject> {
|
|
6
|
+
layouts: React.ReactElement<DataListLayoutProps<T>>[] | undefined;
|
|
7
|
+
renderLayout: (layout: React.ReactElement<DataListLayoutProps<T>>) => JSX.Element;
|
|
8
|
+
mediaMatches?: Record<Breakpoints, boolean>;
|
|
9
|
+
}
|
|
10
|
+
export declare function DataListLayoutInternal<T extends DataListObject>({ layouts, renderLayout, mediaMatches, }: DataListLayoutInternalProps<T>): JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./DataListTags";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const DATALIST_TOTALCOUNT_TEST_ID = "ATL-DataList-TotalCount";
|
|
3
|
+
interface DataListTotalCountProps {
|
|
4
|
+
totalCount?: number | null;
|
|
5
|
+
loading?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function DataListTotalCount({ totalCount, loading, }: DataListTotalCountProps): JSX.Element | null;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./DataListTotalCount";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useLayoutMediaQueries(): Record<"xs" | "sm" | "md" | "lg" | "xl", boolean>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./DataList";
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var styleInject_es = require('../style-inject.es-9d2f5f4e.js');
|
|
7
|
+
var Button = require('../Button-7698424c.js');
|
|
8
|
+
var Text = require('../Text-e7ed0974.js');
|
|
9
|
+
var isEmpty = require('lodash/isEmpty');
|
|
10
|
+
var InlineLabel = require('../InlineLabel-afd5fc6f.js');
|
|
11
|
+
var FormatDate = require('../FormatDate-70ea5b43.js');
|
|
12
|
+
var Glimmer = require('../Glimmer-a14ad7fd.js');
|
|
13
|
+
var Heading = require('../Heading-a1191b15.js');
|
|
14
|
+
require('classnames');
|
|
15
|
+
require('react-router-dom');
|
|
16
|
+
require('../Icon-405a216c.js');
|
|
17
|
+
require('@jobber/design');
|
|
18
|
+
require('../Typography-fd6f932a.js');
|
|
19
|
+
require('../tslib.es6-5b8768b7.js');
|
|
20
|
+
require('../Content-a6590328.js');
|
|
21
|
+
|
|
22
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
23
|
+
|
|
24
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
25
|
+
var isEmpty__default = /*#__PURE__*/_interopDefaultLegacy(isEmpty);
|
|
26
|
+
|
|
27
|
+
var css_248z$3 = ".TkdrExYnvcY- {\n -ms-flex: 1;\n flex: 1;\n}\n\n.IcAlZHoB4LI- {\n display: -ms-flexbox;\n display: flex;\n -ms-flex-align: center;\n align-items: center;\n margin-bottom: calc(16px / 2);\n margin-bottom: var(--space-small);\n}\n\n.Z8C7qJtq5Xc- {\n position: sticky;\n top: 0;\n z-index: 1;\n z-index: var(--elevation-base);\n padding: calc(16px / 2);\n padding: var(--space-small);\n border-bottom: calc(16px / 8) solid rgb(225, 225, 225);\n border-bottom: var(--border-thick) solid var(--color-border);\n background-color: rgba(255, 255, 255, 1);\n background-color: var(--color-surface);\n}\n\n.Gj9kAGnfKco- > * {\n font-weight: 500;\n}\n\n.ise8kHCfhCY- {\n padding: calc(16px / 2);\n padding: var(--space-small);\n border-bottom: calc(16px / 16) solid rgb(225, 225, 225);\n border-bottom: var(--border-base) solid var(--color-border);\n}\n";
|
|
28
|
+
var styles$3 = {"wrapper":"TkdrExYnvcY-","titleContainer":"IcAlZHoB4LI-","header":"Z8C7qJtq5Xc-","headerLabel":"Gj9kAGnfKco-","listItem":"ise8kHCfhCY-"};
|
|
29
|
+
styleInject_es.styleInject(css_248z$3);
|
|
30
|
+
|
|
31
|
+
var css_248z$2 = "._--dXJma0jX0- {\n display: -ms-flexbox;\n display: flex;\n -ms-flex-pack: center;\n justify-content: center;\n -ms-flex-direction: column;\n flex-direction: column;\n row-gap: calc(16px * 1);\n row-gap: var(--space-base);\n -ms-flex-align: center;\n align-items: center;\n height: 100%;\n}\n";
|
|
32
|
+
var styles$2 = {"emptyStateWrapper":"_--dXJma0jX0-"};
|
|
33
|
+
styleInject_es.styleInject(css_248z$2);
|
|
34
|
+
|
|
35
|
+
function DataListEmptyState({ message, action }) {
|
|
36
|
+
return (React__default["default"].createElement("div", { className: styles$2.emptyStateWrapper },
|
|
37
|
+
React__default["default"].createElement(Text.Text, { align: "center" }, message),
|
|
38
|
+
action && (React__default["default"].createElement(Button.Button, Object.assign({}, Object.assign(Object.assign({}, action), { type: "secondary", variation: "subtle" }))))));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function DataListLayout(
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
43
|
+
_) {
|
|
44
|
+
return React__default["default"].createElement(React__default["default"].Fragment, null);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const EMPTY_FILTER_RESULTS_MESSAGE = "No Results for Selected Filters";
|
|
48
|
+
const EMPTY_FILTER_RESULTS_ACTION_LABEL = "Clear Filters";
|
|
49
|
+
/**
|
|
50
|
+
* Breakpoints that we support
|
|
51
|
+
*/
|
|
52
|
+
const BREAKPOINTS = ["xs", "sm", "md", "lg", "xl"];
|
|
53
|
+
const BREAKPOINT_SIZES = {
|
|
54
|
+
xs: 0,
|
|
55
|
+
sm: 490,
|
|
56
|
+
md: 768,
|
|
57
|
+
lg: 1080,
|
|
58
|
+
xl: 1440,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
var css_248z$1 = ".WRV-UmQmPzo- {\n display: -ms-flexbox;\n display: flex;\n position: relative;\n z-index: 0;\n z-index: var(--elevation-default);\n overflow: hidden;\n gap: calc(16px / 2);\n gap: var(--space-small);\n}\n\n.liQeWCMenD0- {\n --overflow-bg: var(--color-white);\n\n display: -ms-flexbox;\n\n display: flex;\n position: absolute;\n top: 0;\n right: 0;\n height: 100%;\n padding-left: calc(16px * 1);\n padding-left: var(--space-base);\n background-image: linear-gradient(\n 90deg,\n transparent 0,\n rgba(255, 255, 255, 1) calc(16px * 1),\n rgba(255, 255, 255, 1) 100%\n );\n background-image: linear-gradient(\n 90deg,\n transparent 0,\n var(--overflow-bg) var(--space-base),\n var(--overflow-bg) 100%\n );\n -ms-flex-align: center;\n align-items: center;\n}\n";
|
|
62
|
+
var styles$1 = {"tags":"WRV-UmQmPzo-","tagCount":"liQeWCMenD0-"};
|
|
63
|
+
styleInject_es.styleInject(css_248z$1);
|
|
64
|
+
|
|
65
|
+
function DataListTags({ items }) {
|
|
66
|
+
const ref = React.useRef(null);
|
|
67
|
+
const [visibleIndex, setVisibleIndex] = React.useState([]);
|
|
68
|
+
const visibleItems = visibleIndex.filter(Boolean).length;
|
|
69
|
+
React.useEffect(() => {
|
|
70
|
+
var _a;
|
|
71
|
+
if (!window.IntersectionObserver)
|
|
72
|
+
return;
|
|
73
|
+
// Reset counter every time the items change
|
|
74
|
+
setVisibleIndex([]);
|
|
75
|
+
const observer = new IntersectionObserver(handleIntersection, {
|
|
76
|
+
root: ref.current,
|
|
77
|
+
threshold: buildIntersectionThreshold(items),
|
|
78
|
+
});
|
|
79
|
+
const elements = (_a = ref.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll("[data-tag-element]");
|
|
80
|
+
elements === null || elements === void 0 ? void 0 : elements.forEach(element => observer.observe(element));
|
|
81
|
+
return () => {
|
|
82
|
+
elements === null || elements === void 0 ? void 0 : elements.forEach(element => observer.unobserve(element));
|
|
83
|
+
};
|
|
84
|
+
}, [items]);
|
|
85
|
+
return (React__default["default"].createElement("div", { className: styles$1.tags, ref: ref },
|
|
86
|
+
items.filter(Boolean).map((tag, index) => (React__default["default"].createElement("div", { key: tag, "data-tag-element": index },
|
|
87
|
+
React__default["default"].createElement(InlineLabel.InlineLabel, null, tag)))),
|
|
88
|
+
Boolean(visibleItems) && (React__default["default"].createElement("div", { className: styles$1.tagCount },
|
|
89
|
+
React__default["default"].createElement(Text.Text, null,
|
|
90
|
+
"+",
|
|
91
|
+
visibleItems)))));
|
|
92
|
+
function handleIntersection(...[entries]) {
|
|
93
|
+
entries.forEach(entry => {
|
|
94
|
+
const index = entry.target.getAttribute("data-tag-element");
|
|
95
|
+
const indexNumber = Number(index);
|
|
96
|
+
if (!index || isNaN(indexNumber))
|
|
97
|
+
return;
|
|
98
|
+
setVisibleIndex(prevState => {
|
|
99
|
+
const newState = [...prevState];
|
|
100
|
+
newState[indexNumber] = entry.intersectionRatio !== 1;
|
|
101
|
+
return newState;
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
function buildIntersectionThreshold(items) {
|
|
107
|
+
const thresholds = [];
|
|
108
|
+
const totalItems = items.length;
|
|
109
|
+
for (let i = 1.0; i <= totalItems; i++) {
|
|
110
|
+
const ratio = i / totalItems;
|
|
111
|
+
thresholds.push(ratio);
|
|
112
|
+
}
|
|
113
|
+
thresholds.push(0);
|
|
114
|
+
return thresholds;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Return the child component that matches the `type` provided
|
|
119
|
+
*/
|
|
120
|
+
function getCompoundComponent(children, type) {
|
|
121
|
+
const childrenArray = React.Children.toArray(children);
|
|
122
|
+
const element = childrenArray.find(child => React.isValidElement(child) && child.type === type);
|
|
123
|
+
// Comply with the return type without casting it
|
|
124
|
+
return React.isValidElement(element) ? element : undefined;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Return all instances child component that matches the `type` provided
|
|
128
|
+
*/
|
|
129
|
+
function getCompoundComponents(children, type) {
|
|
130
|
+
const childrenArray = React.Children.toArray(children);
|
|
131
|
+
const elements = childrenArray.filter((child) => React.isValidElement(child) && child.type === type);
|
|
132
|
+
// Comply with the return type without casting it
|
|
133
|
+
return elements;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Generate the default elements the DataList would use on the data provided.
|
|
137
|
+
*/
|
|
138
|
+
function generateListItemElements(data) {
|
|
139
|
+
return data.map(item => Object.keys(item).reduce((acc, key) => {
|
|
140
|
+
const currentItem = item[key];
|
|
141
|
+
if (!currentItem) {
|
|
142
|
+
return acc;
|
|
143
|
+
}
|
|
144
|
+
if (key === "tags" && Array.isArray(currentItem)) {
|
|
145
|
+
acc[key] = React__default["default"].createElement(DataListTags, { items: currentItem });
|
|
146
|
+
}
|
|
147
|
+
else if (key === "label" && typeof currentItem === "string") {
|
|
148
|
+
acc[key] = React__default["default"].createElement(Text.Text, null, currentItem);
|
|
149
|
+
}
|
|
150
|
+
else if (React.isValidElement(currentItem)) {
|
|
151
|
+
acc[key] = currentItem;
|
|
152
|
+
}
|
|
153
|
+
else if (currentItem instanceof Date) {
|
|
154
|
+
acc[key] = (React__default["default"].createElement(Text.Text, { variation: "subdued" },
|
|
155
|
+
React__default["default"].createElement(FormatDate.FormatDate, { date: currentItem })));
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
acc[key] = React__default["default"].createElement(Text.Text, { variation: "subdued" }, currentItem);
|
|
159
|
+
}
|
|
160
|
+
return acc;
|
|
161
|
+
}, {}));
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Generate the header elements with the default styling
|
|
165
|
+
*/
|
|
166
|
+
function generateHeaderElements(headers) {
|
|
167
|
+
const headerElements = Object.keys(headers).reduce((acc, key) => (Object.assign(Object.assign({}, acc), { [key]: (React__default["default"].createElement("div", { className: styles$3.headerLabel },
|
|
168
|
+
React__default["default"].createElement(Text.Text, { variation: "subdued", maxLines: "single", size: "small" }, headers[key]))) })), {});
|
|
169
|
+
return isEmpty__default["default"](headerElements) ? undefined : headerElements;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Modify EmptyState to include an empty filter results when filtering happens
|
|
173
|
+
*/
|
|
174
|
+
function generateDataListEmptyState({ children, isFilterApplied, setIsFilterApplied, }) {
|
|
175
|
+
if (!children)
|
|
176
|
+
return;
|
|
177
|
+
const EmptyStateComponent = getCompoundComponent(children, DataListEmptyState);
|
|
178
|
+
if (isFilterApplied && React.isValidElement(EmptyStateComponent)) {
|
|
179
|
+
let overrideEmptyStateProps;
|
|
180
|
+
if (isFilterApplied) {
|
|
181
|
+
overrideEmptyStateProps = {
|
|
182
|
+
message: EMPTY_FILTER_RESULTS_MESSAGE,
|
|
183
|
+
action: {
|
|
184
|
+
label: EMPTY_FILTER_RESULTS_ACTION_LABEL,
|
|
185
|
+
onClick: () => {
|
|
186
|
+
setIsFilterApplied(false);
|
|
187
|
+
alert("Filters Cleared");
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
return React__default["default"].cloneElement(EmptyStateComponent, overrideEmptyStateProps);
|
|
193
|
+
}
|
|
194
|
+
return EmptyStateComponent;
|
|
195
|
+
}
|
|
196
|
+
function sortSizeProp(sizeProp) {
|
|
197
|
+
return sizeProp.sort((a, b) => BREAKPOINTS.indexOf(a) - BREAKPOINTS.indexOf(b));
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
var css_248z = ".F56prQsXm3A- {\n min-width: 80px;\n margin-left: calc(16px / 2);\n margin-left: var(--space-small);\n}\n";
|
|
201
|
+
var styles = {"results":"F56prQsXm3A-"};
|
|
202
|
+
styleInject_es.styleInject(css_248z);
|
|
203
|
+
|
|
204
|
+
const DATALIST_TOTALCOUNT_TEST_ID = "ATL-DataList-TotalCount";
|
|
205
|
+
function DataListTotalCount({ totalCount, loading, }) {
|
|
206
|
+
if (totalCount === undefined)
|
|
207
|
+
return null;
|
|
208
|
+
let output = null;
|
|
209
|
+
if (totalCount === null && loading) {
|
|
210
|
+
output = React__default["default"].createElement(Glimmer.Glimmer, { size: "auto", shape: "rectangle" });
|
|
211
|
+
}
|
|
212
|
+
if (typeof totalCount === "number") {
|
|
213
|
+
output = (React__default["default"].createElement(Text.Text, { variation: "subdued" },
|
|
214
|
+
"(",
|
|
215
|
+
totalCount.toLocaleString(),
|
|
216
|
+
" results)"));
|
|
217
|
+
}
|
|
218
|
+
return (React__default["default"].createElement("div", { className: styles.results, "data-testid": DATALIST_TOTALCOUNT_TEST_ID }, output));
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function DataListLayoutInternal({ layouts, renderLayout, mediaMatches, }) {
|
|
222
|
+
const sizePropsOfLayouts = layouts === null || layouts === void 0 ? void 0 : layouts.map(layout => layout.props.size || "xs");
|
|
223
|
+
const layoutToRender = layouts === null || layouts === void 0 ? void 0 : layouts.find(layout => {
|
|
224
|
+
const layoutSize = layout.props.size || "xs";
|
|
225
|
+
const isVisible = isLayoutVisible({
|
|
226
|
+
layoutSize,
|
|
227
|
+
mediaMatches,
|
|
228
|
+
sizePropsOfLayouts,
|
|
229
|
+
});
|
|
230
|
+
return isVisible;
|
|
231
|
+
});
|
|
232
|
+
return (layoutToRender && renderLayout(layoutToRender)) || React__default["default"].createElement(React__default["default"].Fragment, null);
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Determine is layout is visible by checking a media query matches for the
|
|
236
|
+
* visible sizes of the layout and there isn't a larger layout that should be rendered
|
|
237
|
+
*/
|
|
238
|
+
function isLayoutVisible({ layoutSize, mediaMatches, sizePropsOfLayouts, }) {
|
|
239
|
+
const largerBreakpointsToHide = sizePropsOfLayouts === null || sizePropsOfLayouts === void 0 ? void 0 : sizePropsOfLayouts.filter(size => BREAKPOINTS.indexOf(size) > BREAKPOINTS.indexOf(layoutSize));
|
|
240
|
+
const sortedLargerBreakpoints = sortSizeProp(largerBreakpointsToHide || []);
|
|
241
|
+
const visibleBreakpoints = BREAKPOINTS.slice(BREAKPOINTS.indexOf(layoutSize), sortedLargerBreakpoints[0]
|
|
242
|
+
? BREAKPOINTS.indexOf(sortedLargerBreakpoints[0])
|
|
243
|
+
: undefined);
|
|
244
|
+
const isVisibleBreakpoint = visibleBreakpoints.some(breakpoint => {
|
|
245
|
+
return Boolean(mediaMatches === null || mediaMatches === void 0 ? void 0 : mediaMatches[breakpoint]);
|
|
246
|
+
});
|
|
247
|
+
const largerLayoutIsNotVisible = largerBreakpointsToHide === null || largerBreakpointsToHide === void 0 ? void 0 : largerBreakpointsToHide.reduce((acc, breakpoint) => {
|
|
248
|
+
return acc && !(mediaMatches === null || mediaMatches === void 0 ? void 0 : mediaMatches[breakpoint]);
|
|
249
|
+
}, true);
|
|
250
|
+
return isVisibleBreakpoint && largerLayoutIsNotVisible;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function DataListItems({ layouts, mediaMatches, data, }) {
|
|
254
|
+
const elementData = generateListItemElements(data);
|
|
255
|
+
return (React__default["default"].createElement(DataListLayoutInternal, { layouts: layouts, mediaMatches: mediaMatches, renderLayout: layout => {
|
|
256
|
+
return (React__default["default"].createElement(React__default["default"].Fragment, null, elementData.map((child, i) => {
|
|
257
|
+
return (React__default["default"].createElement("div", { className: styles$3.listItem, key: `${data[i].id}` }, layout.props.children(child)));
|
|
258
|
+
})));
|
|
259
|
+
} }));
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
function DataListHeader({ layouts, mediaMatches, headerData, headerVisibility, }) {
|
|
263
|
+
const matchingMediaQueries = Object.keys(mediaMatches || {}).filter((key) => !!(mediaMatches === null || mediaMatches === void 0 ? void 0 : mediaMatches[key]));
|
|
264
|
+
const sortedVisibleBreakpoints = sortSizeProp(matchingMediaQueries);
|
|
265
|
+
// Determines if the header should be visible based on the headerVisibility
|
|
266
|
+
const showHeader = sortedVisibleBreakpoints.reduce((previousVisibility, breakpoint) => {
|
|
267
|
+
var _a;
|
|
268
|
+
return (_a = headerVisibility[breakpoint]) !== null && _a !== void 0 ? _a : previousVisibility;
|
|
269
|
+
}, true);
|
|
270
|
+
if (!showHeader || !headerData)
|
|
271
|
+
return React__default["default"].createElement(React__default["default"].Fragment, null);
|
|
272
|
+
return (React__default["default"].createElement(DataListLayoutInternal, { layouts: layouts, renderLayout: layout => {
|
|
273
|
+
return (React__default["default"].createElement("div", { className: styles$3.header }, layout.props.children(headerData)));
|
|
274
|
+
}, mediaMatches: mediaMatches }));
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
function useLayoutMediaQueries() {
|
|
278
|
+
const mediaQueries = BREAKPOINTS.reduce((previous, breakpoint) => (Object.assign(Object.assign({}, previous), { [breakpoint]: window.matchMedia(breakpointToMediaQuery(breakpoint)) })), {});
|
|
279
|
+
const initialMatches = BREAKPOINTS.reduce((previous, breakpoint) => (Object.assign(Object.assign({}, previous), { [breakpoint]: mediaQueries[breakpoint].matches })), {});
|
|
280
|
+
const [matches, setMatches] = React.useState(initialMatches);
|
|
281
|
+
const handlers = BREAKPOINTS.reduce((previous, breakpoint) => {
|
|
282
|
+
const handler = (e) => setMatches(previousMatches => (Object.assign(Object.assign({}, previousMatches), { [breakpoint]: e.matches })));
|
|
283
|
+
return Object.assign(Object.assign({}, previous), { [breakpoint]: handler });
|
|
284
|
+
}, {});
|
|
285
|
+
// Set up mediaQuery event handlers
|
|
286
|
+
React.useEffect(() => {
|
|
287
|
+
BREAKPOINTS.forEach(breakpoint => {
|
|
288
|
+
mediaQueries[breakpoint].addEventListener("change", handlers[breakpoint]);
|
|
289
|
+
});
|
|
290
|
+
return () => {
|
|
291
|
+
BREAKPOINTS.forEach(breakpoint => {
|
|
292
|
+
mediaQueries[breakpoint].removeEventListener("change", handlers[breakpoint]);
|
|
293
|
+
});
|
|
294
|
+
};
|
|
295
|
+
}, [mediaQueries]);
|
|
296
|
+
return matches;
|
|
297
|
+
}
|
|
298
|
+
function breakpointToMediaQuery(breakpoint) {
|
|
299
|
+
return `(min-width: ${BREAKPOINT_SIZES[breakpoint]}px)`;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
function DataList({ data, headers, loading = false, filterApplied = false, children, title, totalCount, headerVisibility = { xs: true, sm: true, md: true, lg: true, xl: true }, }) {
|
|
303
|
+
const allLayouts = getCompoundComponents(children, DataListLayout);
|
|
304
|
+
const headerData = generateHeaderElements(headers);
|
|
305
|
+
const mediaMatches = useLayoutMediaQueries();
|
|
306
|
+
const showEmptyState = !loading && data.length === 0;
|
|
307
|
+
const [isFilterApplied, setIsFilterApplied] = React.useState(filterApplied);
|
|
308
|
+
const EmptyStateComponent = generateDataListEmptyState({
|
|
309
|
+
children,
|
|
310
|
+
isFilterApplied,
|
|
311
|
+
setIsFilterApplied,
|
|
312
|
+
});
|
|
313
|
+
return (React__default["default"].createElement("div", { className: styles$3.wrapper },
|
|
314
|
+
React__default["default"].createElement("div", { className: styles$3.titleContainer },
|
|
315
|
+
title && React__default["default"].createElement(Heading.Heading, { level: 3 }, title),
|
|
316
|
+
React__default["default"].createElement(DataListTotalCount, { totalCount: totalCount, loading: loading })),
|
|
317
|
+
headerData && (React__default["default"].createElement(DataListHeader, { layouts: allLayouts, headerData: headerData, headerVisibility: headerVisibility, mediaMatches: mediaMatches })),
|
|
318
|
+
React__default["default"].createElement(DataListItems, { data: data, layouts: allLayouts, mediaMatches: mediaMatches }),
|
|
319
|
+
showEmptyState && EmptyStateComponent));
|
|
320
|
+
}
|
|
321
|
+
DataList.Layout = DataListLayout;
|
|
322
|
+
DataList.EmptyState = DataListEmptyState;
|
|
323
|
+
|
|
324
|
+
exports.DataList = DataList;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ApolloClient } from "@apollo/client";
|
|
2
|
+
export interface ListQueryType {
|
|
3
|
+
allPeople: {
|
|
4
|
+
__typename?: "PeopleConnection";
|
|
5
|
+
pageInfo: {
|
|
6
|
+
hasNextPage: boolean;
|
|
7
|
+
endCursor: string;
|
|
8
|
+
};
|
|
9
|
+
edges: Array<{
|
|
10
|
+
__typename?: "PeopleEdge";
|
|
11
|
+
node: {
|
|
12
|
+
created: string;
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
gender: string;
|
|
16
|
+
hairColor: string;
|
|
17
|
+
skinColor: string;
|
|
18
|
+
homeworld: {
|
|
19
|
+
name: string;
|
|
20
|
+
id: string;
|
|
21
|
+
population: number;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
cursor: string;
|
|
25
|
+
}>;
|
|
26
|
+
totalCount?: number;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export type ListEdges = ListQueryType["allPeople"]["edges"];
|
|
30
|
+
export type ListNode = ListEdges[number]["node"];
|
|
31
|
+
export declare const LIST_QUERY: import("@apollo/client").DocumentNode;
|
|
32
|
+
export declare const apolloClient: ApolloClient<import("@apollo/client").NormalizedCacheObject>;
|
|
33
|
+
interface LoadingState {
|
|
34
|
+
loadingStatus: string;
|
|
35
|
+
loading: boolean;
|
|
36
|
+
}
|
|
37
|
+
export declare function getLoadingState(loadingInitialContent: boolean, loadingRefresh: boolean, loadingNextPage: boolean): LoadingState;
|
|
38
|
+
export {};
|
package/dist/FormatDate/index.js
CHANGED
|
@@ -2,35 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var FormatDate = require('../FormatDate-70ea5b43.js');
|
|
6
|
+
require('react');
|
|
6
7
|
|
|
7
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
9
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (inputDate instanceof Date) {
|
|
14
|
-
dateObject = inputDate;
|
|
15
|
-
}
|
|
16
|
-
else if (typeof inputDate === "string") {
|
|
17
|
-
dateObject = new Date(inputDate);
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
dateObject = new Date(inputDate.year, inputDate.month - 1, inputDate.day);
|
|
21
|
-
}
|
|
22
|
-
return React__default["default"].createElement(React__default["default"].Fragment, null, strFormatDate(dateObject, showYear));
|
|
23
|
-
}
|
|
24
|
-
function strFormatDate(date, showYear = true) {
|
|
25
|
-
let formatOptions = {
|
|
26
|
-
month: "short",
|
|
27
|
-
day: "numeric",
|
|
28
|
-
};
|
|
29
|
-
if (showYear) {
|
|
30
|
-
formatOptions = Object.assign(Object.assign({}, formatOptions), { year: "numeric" });
|
|
31
|
-
}
|
|
32
|
-
return date.toLocaleDateString(undefined, formatOptions);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
exports.FormatDate = FormatDate;
|
|
36
|
-
exports.strFormatDate = strFormatDate;
|
|
10
|
+
exports.FormatDate = FormatDate.FormatDate;
|
|
11
|
+
exports.strFormatDate = FormatDate.strFormatDate;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
|
|
5
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
6
|
+
|
|
7
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
8
|
+
|
|
9
|
+
function FormatDate({ date: inputDate, showYear = true, }) {
|
|
10
|
+
let dateObject;
|
|
11
|
+
if (inputDate instanceof Date) {
|
|
12
|
+
dateObject = inputDate;
|
|
13
|
+
}
|
|
14
|
+
else if (typeof inputDate === "string") {
|
|
15
|
+
dateObject = new Date(inputDate);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
dateObject = new Date(inputDate.year, inputDate.month - 1, inputDate.day);
|
|
19
|
+
}
|
|
20
|
+
return React__default["default"].createElement(React__default["default"].Fragment, null, strFormatDate(dateObject, showYear));
|
|
21
|
+
}
|
|
22
|
+
function strFormatDate(date, showYear = true) {
|
|
23
|
+
let formatOptions = {
|
|
24
|
+
month: "short",
|
|
25
|
+
day: "numeric",
|
|
26
|
+
};
|
|
27
|
+
if (showYear) {
|
|
28
|
+
formatOptions = Object.assign(Object.assign({}, formatOptions), { year: "numeric" });
|
|
29
|
+
}
|
|
30
|
+
return date.toLocaleDateString(undefined, formatOptions);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
exports.FormatDate = FormatDate;
|
|
34
|
+
exports.strFormatDate = strFormatDate;
|
|
@@ -2,29 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
var InlineLabel = require('../InlineLabel-afd5fc6f.js');
|
|
6
|
+
require('react');
|
|
7
|
+
require('classnames');
|
|
8
|
+
require('../style-inject.es-9d2f5f4e.js');
|
|
9
|
+
require('../Typography-fd6f932a.js');
|
|
9
10
|
|
|
10
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
11
|
|
|
12
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
13
|
-
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
var styles = {"inlineLabel":"S72WkdRbhc0-","base":"bMWuAXJHkbw-","large":"ui07veHjPII-","larger":"WIXhLSQ7z8A-","greyBlue":"_8RuKvOhj-Ro-","red":"_2vEF1nvVWm8-","orange":"Wt305sIAeoE-","green":"F8KkNxz8W3A-","blue":"URZZoKSX4So-","navy":"OeLBV-9i0Rs-","yellow":"_2Xwx5tarf1w-","lime":"iCqIjI7GkEk-","purple":"_4iEIjiZj9oA-","pink":"JRW9QFSjLTA-","teal":"fbhprd-Gl8k-","yellowGreen":"yrF9aZSaTdw-","blueDark":"RPvjah0FdjI-","lightBlue":"apwauWJ6ITc-","indigo":"n8qJynvE-n0-"};
|
|
17
|
-
styleInject_es.styleInject(css_248z);
|
|
18
|
-
|
|
19
|
-
function InlineLabel({ size = "base", color = "greyBlue", children, }) {
|
|
20
|
-
const className = classnames__default["default"](styles.inlineLabel, styles[size], styles[color]);
|
|
21
|
-
const sizeMapper = {
|
|
22
|
-
base: "small",
|
|
23
|
-
large: "large",
|
|
24
|
-
larger: "large",
|
|
25
|
-
};
|
|
26
|
-
return (React__default["default"].createElement("span", { className: className },
|
|
27
|
-
React__default["default"].createElement(Typography.Typography, { element: "span", size: sizeMapper[size] }, children)));
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
exports.InlineLabel = InlineLabel;
|
|
13
|
+
exports.InlineLabel = InlineLabel.InlineLabel;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var classnames = require('classnames');
|
|
5
|
+
var styleInject_es = require('./style-inject.es-9d2f5f4e.js');
|
|
6
|
+
var Typography = require('./Typography-fd6f932a.js');
|
|
7
|
+
|
|
8
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
|
+
|
|
10
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
11
|
+
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
12
|
+
|
|
13
|
+
var css_248z = ".S72WkdRbhc0- {\n display: -ms-inline-flexbox;\n display: inline-flex;\n border-radius: calc(16px / 4);\n border-radius: var(--radius-large);\n}\n\n.bMWuAXJHkbw- {\n padding: calc((16px / 4) * 1.5) calc((16px / 2) * 1.25);\n padding: calc(calc(16px / 4) * 1.5) calc(calc(16px / 2) * 1.25);\n padding: calc(var(--space-smaller) * 1.5) calc(var(--space-small) * 1.25);\n}\n\n.ui07veHjPII- {\n padding: calc((16px / 4) * 1.5) calc((16px / 2) * 1.25);\n padding: calc(calc(16px / 4) * 1.5) calc(calc(16px / 2) * 1.25);\n padding: calc(var(--space-smaller) * 1.5) calc(var(--space-small) * 1.25);\n}\n\n.WIXhLSQ7z8A- {\n padding: calc((16px / 2) * 1.25) calc((16px / 4) * 3.5);\n padding: calc(calc(16px / 2) * 1.25) calc(calc(16px / 4) * 3.5);\n padding: calc(var(--space-small) * 1.25) calc(var(--space-smaller) * 3.5);\n}\n\n._8RuKvOhj-Ro- {\n color: rgb(66, 78, 86);\n color: var(--color-greyBlue--dark);\n background-color: rgb(232, 235, 237);\n background-color: var(--color-greyBlue--lightest);\n}\n\n._2vEF1nvVWm8- {\n color: rgb(128, 25, 0);\n color: var(--color-red--dark);\n background-color: rgb(255, 226, 219);\n background-color: var(--color-red--lightest);\n}\n\n.Wt305sIAeoE- {\n color: rgb(158, 98, 23);\n color: var(--color-orange--dark);\n background-color: rgb(253, 239, 222);\n background-color: var(--color-orange--lightest);\n}\n\n.F8KkNxz8W3A- {\n color: rgb(81, 114, 9);\n color: var(--color-green--dark);\n background-color: rgb(236, 243, 219);\n background-color: var(--color-green--lightest);\n}\n\n.URZZoKSX4So- {\n color: rgb(1, 27, 37);\n color: var(--color-blue--dark);\n background-color: rgb(217, 223, 225);\n background-color: var(--color-blue--lightest);\n}\n\n.OeLBV-9i0Rs- {\n color: rgb(49, 69, 98);\n color: var(--color-navy--dark);\n background-color: rgb(228, 233, 239);\n background-color: var(--color-navy--lightest);\n}\n\n._2Xwx5tarf1w- {\n color: rgb(144, 127, 10);\n color: var(--color-yellow--dark);\n background-color: rgb(250, 246, 219);\n background-color: var(--color-yellow--lightest);\n}\n\n.iCqIjI7GkEk- {\n color: rgb(99, 125, 46);\n color: var(--color-lime--dark);\n background-color: rgb(240, 246, 227);\n background-color: var(--color-lime--lightest);\n}\n\n._4iEIjiZj9oA- {\n color: rgb(88, 73, 127);\n color: var(--color-purple--dark);\n background-color: rgb(237, 234, 246);\n background-color: var(--color-purple--lightest);\n}\n\n.JRW9QFSjLTA- {\n color: rgb(116, 62, 98);\n color: var(--color-pink--dark);\n background-color: rgb(244, 231, 239);\n background-color: var(--color-pink--lightest);\n}\n\n.fbhprd-Gl8k- {\n color: rgb(40, 112, 95);\n color: var(--color-teal--dark);\n background-color: rgb(226, 243, 239);\n background-color: var(--color-teal--lightest);\n}\n\n.yrF9aZSaTdw- {\n color: rgb(122, 128, 21);\n color: var(--color-yellowGreen--dark);\n background-color: rgb(245, 246, 222);\n background-color: var(--color-yellowGreen--lightest);\n}\n\n.RPvjah0FdjI- {\n color: rgba(255, 255, 255, 1);\n color: var(--color-white);\n background-color: rgb(77, 105, 116);\n background-color: var(--color-blue--light);\n}\n\n.apwauWJ6ITc- {\n color: rgb(39, 105, 146);\n color: var(--color-lightBlue--dark);\n background-color: rgb(226, 241, 250);\n background-color: var(--color-lightBlue--lightest);\n}\n\n.n8qJynvE-n0- {\n color: rgb(55, 69, 132);\n color: var(--color-indigo--dark);\n background-color: rgb(230, 233, 247);\n background-color: var(--color-indigo--lightest);\n}\n";
|
|
14
|
+
var styles = {"inlineLabel":"S72WkdRbhc0-","base":"bMWuAXJHkbw-","large":"ui07veHjPII-","larger":"WIXhLSQ7z8A-","greyBlue":"_8RuKvOhj-Ro-","red":"_2vEF1nvVWm8-","orange":"Wt305sIAeoE-","green":"F8KkNxz8W3A-","blue":"URZZoKSX4So-","navy":"OeLBV-9i0Rs-","yellow":"_2Xwx5tarf1w-","lime":"iCqIjI7GkEk-","purple":"_4iEIjiZj9oA-","pink":"JRW9QFSjLTA-","teal":"fbhprd-Gl8k-","yellowGreen":"yrF9aZSaTdw-","blueDark":"RPvjah0FdjI-","lightBlue":"apwauWJ6ITc-","indigo":"n8qJynvE-n0-"};
|
|
15
|
+
styleInject_es.styleInject(css_248z);
|
|
16
|
+
|
|
17
|
+
function InlineLabel({ size = "base", color = "greyBlue", children, }) {
|
|
18
|
+
const className = classnames__default["default"](styles.inlineLabel, styles[size], styles[color]);
|
|
19
|
+
const sizeMapper = {
|
|
20
|
+
base: "small",
|
|
21
|
+
large: "large",
|
|
22
|
+
larger: "large",
|
|
23
|
+
};
|
|
24
|
+
return (React__default["default"].createElement("span", { className: className },
|
|
25
|
+
React__default["default"].createElement(Typography.Typography, { element: "span", size: sizeMapper[size] }, children)));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
exports.InlineLabel = InlineLabel;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "4.26.
|
|
3
|
+
"version": "4.26.5-pre.33+26d435f3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@jobber/design": "^0.44.4",
|
|
23
|
-
"@jobber/formatters": "
|
|
23
|
+
"@jobber/formatters": "^0.2.2",
|
|
24
24
|
"@jobber/hooks": "^2.1.5",
|
|
25
25
|
"@popperjs/core": "^2.0.6",
|
|
26
26
|
"@std-proposal/temporal": "0.0.1",
|
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
"autoprefixer": "^9.5.1",
|
|
65
65
|
"copyfiles": "^2.4.1",
|
|
66
66
|
"glob": "^7.1.4",
|
|
67
|
+
"jsdom-testing-mocks": "^1.9.0",
|
|
67
68
|
"postcss": "^8.4.21",
|
|
68
69
|
"postcss-import": "^12.0.1",
|
|
69
70
|
"postcss-preset-env": "^8.3.0",
|
|
@@ -83,5 +84,5 @@
|
|
|
83
84
|
"> 1%",
|
|
84
85
|
"IE 10"
|
|
85
86
|
],
|
|
86
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "26d435f3e7458095842a4cd11f312deffd1d4547"
|
|
87
88
|
}
|