@kcascend/liquid-ui 0.0.1
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/README.md +64 -0
- package/dist/components/Accordion/Accordion.d.ts +3 -0
- package/dist/components/Accordion/Accordion.d.ts.map +1 -0
- package/dist/components/Accordion/Accordion.js +46 -0
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +3 -0
- package/dist/components/Breadcrumb/Breadcrumb.d.ts.map +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.js +34 -0
- package/dist/components/Button/Button.d.ts +3 -0
- package/dist/components/Button/Button.d.ts.map +1 -0
- package/dist/components/Button/Button.js +7 -0
- package/dist/components/Card/Card.d.ts +3 -0
- package/dist/components/Card/Card.d.ts.map +1 -0
- package/dist/components/Card/Card.js +19 -0
- package/dist/components/Checkbox/Checkbox.d.ts +3 -0
- package/dist/components/Checkbox/Checkbox.d.ts.map +1 -0
- package/dist/components/Checkbox/Checkbox.js +17 -0
- package/dist/components/ContainedList/ContainedList.d.ts +3 -0
- package/dist/components/ContainedList/ContainedList.d.ts.map +1 -0
- package/dist/components/ContainedList/ContainedList.js +26 -0
- package/dist/components/DataTable/DataTable.d.ts +3 -0
- package/dist/components/DataTable/DataTable.d.ts.map +1 -0
- package/dist/components/DataTable/DataTable.js +20 -0
- package/dist/components/DescriptionList/DescriptionList.d.ts +3 -0
- package/dist/components/DescriptionList/DescriptionList.d.ts.map +1 -0
- package/dist/components/DescriptionList/DescriptionList.js +14 -0
- package/dist/components/Form/Form.d.ts +5 -0
- package/dist/components/Form/Form.d.ts.map +1 -0
- package/dist/components/Form/Form.js +32 -0
- package/dist/components/GridLayout/GridLayout.d.ts +4 -0
- package/dist/components/GridLayout/GridLayout.d.ts.map +1 -0
- package/dist/components/GridLayout/GridLayout.js +138 -0
- package/dist/components/GridLayout/gridTokens.d.ts +18 -0
- package/dist/components/GridLayout/gridTokens.d.ts.map +1 -0
- package/dist/components/GridLayout/gridTokens.js +91 -0
- package/dist/components/Icon/Icon.d.ts +11 -0
- package/dist/components/Icon/Icon.d.ts.map +1 -0
- package/dist/components/Icon/Icon.js +25 -0
- package/dist/components/Icon/icons.d.ts +21 -0
- package/dist/components/Icon/icons.d.ts.map +1 -0
- package/dist/components/Icon/icons.js +20 -0
- package/dist/components/Icon/index.d.ts +3 -0
- package/dist/components/Icon/index.d.ts.map +1 -0
- package/dist/components/Icon/index.js +1 -0
- package/dist/components/Icons/Icons.d.ts +3 -0
- package/dist/components/Icons/Icons.d.ts.map +1 -0
- package/dist/components/Icons/Icons.js +1 -0
- package/dist/components/Index/Index.d.ts +3 -0
- package/dist/components/Index/Index.d.ts.map +1 -0
- package/dist/components/Index/Index.js +114 -0
- package/dist/components/InlineNotification/InlineNotification.d.ts +3 -0
- package/dist/components/InlineNotification/InlineNotification.d.ts.map +1 -0
- package/dist/components/InlineNotification/InlineNotification.js +47 -0
- package/dist/components/Link/Link.d.ts +3 -0
- package/dist/components/Link/Link.d.ts.map +1 -0
- package/dist/components/Link/Link.js +23 -0
- package/dist/components/Modal/Modal.d.ts +3 -0
- package/dist/components/Modal/Modal.d.ts.map +1 -0
- package/dist/components/Modal/Modal.js +27 -0
- package/dist/components/Pagination/Pagination.d.ts +3 -0
- package/dist/components/Pagination/Pagination.d.ts.map +1 -0
- package/dist/components/Pagination/Pagination.js +34 -0
- package/dist/components/Radio/Radio.d.ts +3 -0
- package/dist/components/Radio/Radio.d.ts.map +1 -0
- package/dist/components/Radio/Radio.js +13 -0
- package/dist/components/SearchInput/SearchInput.d.ts +3 -0
- package/dist/components/SearchInput/SearchInput.d.ts.map +1 -0
- package/dist/components/SearchInput/SearchInput.js +37 -0
- package/dist/components/SelectInput/SelectInput.d.ts +3 -0
- package/dist/components/SelectInput/SelectInput.d.ts.map +1 -0
- package/dist/components/SelectInput/SelectInput.js +14 -0
- package/dist/components/StructuredList/StructuredList.d.ts +3 -0
- package/dist/components/StructuredList/StructuredList.d.ts.map +1 -0
- package/dist/components/StructuredList/StructuredList.js +17 -0
- package/dist/components/Tabs/Tabs.d.ts +3 -0
- package/dist/components/Tabs/Tabs.d.ts.map +1 -0
- package/dist/components/Tabs/Tabs.js +27 -0
- package/dist/components/Tag/Tag.d.ts +3 -0
- package/dist/components/Tag/Tag.d.ts.map +1 -0
- package/dist/components/Tag/Tag.js +8 -0
- package/dist/components/TextArea/TextArea.d.ts +3 -0
- package/dist/components/TextArea/TextArea.d.ts.map +1 -0
- package/dist/components/TextArea/TextArea.js +15 -0
- package/dist/components/TextInput/TextInput.d.ts +3 -0
- package/dist/components/TextInput/TextInput.d.ts.map +1 -0
- package/dist/components/TextInput/TextInput.js +20 -0
- package/dist/components/ToggleInput/ToggleInput.d.ts +3 -0
- package/dist/components/ToggleInput/ToggleInput.d.ts.map +1 -0
- package/dist/components/ToggleInput/ToggleInput.js +10 -0
- package/dist/components/Tooltip/Tooltip.d.ts +3 -0
- package/dist/components/Tooltip/Tooltip.d.ts.map +1 -0
- package/dist/components/Tooltip/Tooltip.js +13 -0
- package/dist/generated/tokens.d.ts +9836 -0
- package/dist/generated/tokens.d.ts.map +1 -0
- package/dist/generated/tokens.js +9834 -0
- package/dist/governance/accordionGovernance.d.ts +3 -0
- package/dist/governance/accordionGovernance.d.ts.map +1 -0
- package/dist/governance/accordionGovernance.js +9 -0
- package/dist/governance/breadcrumbGovernance.d.ts +3 -0
- package/dist/governance/breadcrumbGovernance.d.ts.map +1 -0
- package/dist/governance/breadcrumbGovernance.js +9 -0
- package/dist/governance/buttonGovernance.d.ts +3 -0
- package/dist/governance/buttonGovernance.d.ts.map +1 -0
- package/dist/governance/buttonGovernance.js +9 -0
- package/dist/governance/cardGovernance.d.ts +3 -0
- package/dist/governance/cardGovernance.d.ts.map +1 -0
- package/dist/governance/cardGovernance.js +9 -0
- package/dist/governance/checkboxGovernance.d.ts +3 -0
- package/dist/governance/checkboxGovernance.d.ts.map +1 -0
- package/dist/governance/checkboxGovernance.js +10 -0
- package/dist/governance/containedListGovernance.d.ts +3 -0
- package/dist/governance/containedListGovernance.d.ts.map +1 -0
- package/dist/governance/containedListGovernance.js +9 -0
- package/dist/governance/dataTableGovernance.d.ts +3 -0
- package/dist/governance/dataTableGovernance.d.ts.map +1 -0
- package/dist/governance/dataTableGovernance.js +10 -0
- package/dist/governance/descriptionListGovernance.d.ts +3 -0
- package/dist/governance/descriptionListGovernance.d.ts.map +1 -0
- package/dist/governance/descriptionListGovernance.js +9 -0
- package/dist/governance/formGovernance.d.ts +3 -0
- package/dist/governance/formGovernance.d.ts.map +1 -0
- package/dist/governance/formGovernance.js +9 -0
- package/dist/governance/gridLayoutGovernance.d.ts +3 -0
- package/dist/governance/gridLayoutGovernance.d.ts.map +1 -0
- package/dist/governance/gridLayoutGovernance.js +9 -0
- package/dist/governance/indexGovernance.d.ts +3 -0
- package/dist/governance/indexGovernance.d.ts.map +1 -0
- package/dist/governance/indexGovernance.js +9 -0
- package/dist/governance/inlineNotificationGovernance.d.ts +3 -0
- package/dist/governance/inlineNotificationGovernance.d.ts.map +1 -0
- package/dist/governance/inlineNotificationGovernance.js +9 -0
- package/dist/governance/linkGovernance.d.ts +3 -0
- package/dist/governance/linkGovernance.d.ts.map +1 -0
- package/dist/governance/linkGovernance.js +9 -0
- package/dist/governance/modalGovernance.d.ts +3 -0
- package/dist/governance/modalGovernance.d.ts.map +1 -0
- package/dist/governance/modalGovernance.js +10 -0
- package/dist/governance/paginationGovernance.d.ts +3 -0
- package/dist/governance/paginationGovernance.d.ts.map +1 -0
- package/dist/governance/paginationGovernance.js +10 -0
- package/dist/governance/radioGovernance.d.ts +3 -0
- package/dist/governance/radioGovernance.d.ts.map +1 -0
- package/dist/governance/radioGovernance.js +10 -0
- package/dist/governance/searchInputGovernance.d.ts +3 -0
- package/dist/governance/searchInputGovernance.d.ts.map +1 -0
- package/dist/governance/searchInputGovernance.js +10 -0
- package/dist/governance/selectInputGovernance.d.ts +3 -0
- package/dist/governance/selectInputGovernance.d.ts.map +1 -0
- package/dist/governance/selectInputGovernance.js +10 -0
- package/dist/governance/structuredListGovernance.d.ts +3 -0
- package/dist/governance/structuredListGovernance.d.ts.map +1 -0
- package/dist/governance/structuredListGovernance.js +9 -0
- package/dist/governance/tabsGovernance.d.ts +3 -0
- package/dist/governance/tabsGovernance.d.ts.map +1 -0
- package/dist/governance/tabsGovernance.js +10 -0
- package/dist/governance/tagGovernance.d.ts +3 -0
- package/dist/governance/tagGovernance.d.ts.map +1 -0
- package/dist/governance/tagGovernance.js +10 -0
- package/dist/governance/textAreaGovernance.d.ts +3 -0
- package/dist/governance/textAreaGovernance.d.ts.map +1 -0
- package/dist/governance/textAreaGovernance.js +10 -0
- package/dist/governance/textInputGovernance.d.ts +3 -0
- package/dist/governance/textInputGovernance.d.ts.map +1 -0
- package/dist/governance/textInputGovernance.js +10 -0
- package/dist/governance/toggleInputGovernance.d.ts +3 -0
- package/dist/governance/toggleInputGovernance.d.ts.map +1 -0
- package/dist/governance/toggleInputGovernance.js +10 -0
- package/dist/governance/tooltipGovernance.d.ts +3 -0
- package/dist/governance/tooltipGovernance.d.ts.map +1 -0
- package/dist/governance/tooltipGovernance.js +10 -0
- package/dist/index.d.ts +56 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +52 -0
- package/dist/styles.css +4426 -0
- package/dist/tokens/components.css +559 -0
- package/dist/tokens/primitives.css +179 -0
- package/dist/tokens/semantic.css +376 -0
- package/dist/types.d.ts +336 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/package.json +32 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { tokens } from '../../generated/tokens';
|
|
2
|
+
export const BREAKPOINT_KEYS = [
|
|
3
|
+
'sm',
|
|
4
|
+
'md',
|
|
5
|
+
'lg',
|
|
6
|
+
'xlg',
|
|
7
|
+
'max',
|
|
8
|
+
];
|
|
9
|
+
function getNodePath(path) {
|
|
10
|
+
return path.reduce((acc, segment) => {
|
|
11
|
+
if (!acc || typeof acc !== 'object') {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
return acc[segment];
|
|
15
|
+
}, tokens);
|
|
16
|
+
}
|
|
17
|
+
function resolveTokenValue(value, depth = 0) {
|
|
18
|
+
if (depth > 10) {
|
|
19
|
+
return value;
|
|
20
|
+
}
|
|
21
|
+
if (typeof value !== 'string') {
|
|
22
|
+
return value;
|
|
23
|
+
}
|
|
24
|
+
const match = value.match(/^\{([^}]+)\}$/);
|
|
25
|
+
if (!match) {
|
|
26
|
+
return value;
|
|
27
|
+
}
|
|
28
|
+
const path = match[1].split('.').filter(Boolean);
|
|
29
|
+
const referencedNode = getNodePath(path);
|
|
30
|
+
if (referencedNode &&
|
|
31
|
+
typeof referencedNode === 'object' &&
|
|
32
|
+
'value' in referencedNode) {
|
|
33
|
+
return resolveTokenValue(referencedNode.value, depth + 1);
|
|
34
|
+
}
|
|
35
|
+
return referencedNode;
|
|
36
|
+
}
|
|
37
|
+
function toNumber(value, fallback) {
|
|
38
|
+
const resolved = resolveTokenValue(value);
|
|
39
|
+
if (typeof resolved === 'number' && Number.isFinite(resolved)) {
|
|
40
|
+
return resolved;
|
|
41
|
+
}
|
|
42
|
+
if (typeof resolved === 'string') {
|
|
43
|
+
const parsed = Number.parseFloat(resolved);
|
|
44
|
+
if (Number.isFinite(parsed)) {
|
|
45
|
+
return parsed;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return fallback;
|
|
49
|
+
}
|
|
50
|
+
function getGridLayoutNode() {
|
|
51
|
+
const node = getNodePath(['grid', 'grid', 'layout']);
|
|
52
|
+
return (node ?? {});
|
|
53
|
+
}
|
|
54
|
+
function getGridSystemNode() {
|
|
55
|
+
const node = getNodePath(['grid-system']);
|
|
56
|
+
return (node ?? {});
|
|
57
|
+
}
|
|
58
|
+
export function getGridBreakpointSpec(breakpoint) {
|
|
59
|
+
const layoutNode = getGridLayoutNode();
|
|
60
|
+
const gridSystemNode = getGridSystemNode();
|
|
61
|
+
const breakpointNode = (gridSystemNode.breakpoint ?? {});
|
|
62
|
+
const marginNode = (gridSystemNode.margin ?? {});
|
|
63
|
+
const gutterNode = (gridSystemNode.gutter ?? {});
|
|
64
|
+
const containerHangNode = (gridSystemNode.container ?? {}).hang ?? {};
|
|
65
|
+
const layoutBase = (layoutNode[breakpoint] ?? {});
|
|
66
|
+
const layoutValue = (layoutBase.value ?? {});
|
|
67
|
+
return {
|
|
68
|
+
key: breakpoint,
|
|
69
|
+
width: toNumber(breakpointNode[breakpoint]?.value, breakpoint === 'sm'
|
|
70
|
+
? 320
|
|
71
|
+
: breakpoint === 'md'
|
|
72
|
+
? 672
|
|
73
|
+
: breakpoint === 'lg'
|
|
74
|
+
? 1056
|
|
75
|
+
: breakpoint === 'xlg'
|
|
76
|
+
? 1312
|
|
77
|
+
: 1584),
|
|
78
|
+
columns: toNumber(layoutValue.count, breakpoint === 'sm' ? 4 : breakpoint === 'md' ? 8 : 16),
|
|
79
|
+
margin: toNumber(marginNode[breakpoint]?.value, breakpoint === 'max' ? 24 : 16),
|
|
80
|
+
wideGutter: toNumber(layoutValue['gutter-size'], breakpoint === 'sm' || breakpoint === 'md' ? 16 : 32),
|
|
81
|
+
narrowGutter: toNumber(gutterNode.narrow?.value, 16),
|
|
82
|
+
containerHang: toNumber(containerHangNode.narrow?.value, 16),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
export function getRowRhythms() {
|
|
86
|
+
const rowValues = [8, 16, 24, 32, 48, 64, 80, 96];
|
|
87
|
+
return rowValues.map((value) => ({
|
|
88
|
+
value,
|
|
89
|
+
caption: value === 8 ? '1x mini unit' : `${Math.round(value / 8)}x mini unit`,
|
|
90
|
+
}));
|
|
91
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
import { icons } from './icons';
|
|
3
|
+
export declare const iconNames: Array<keyof typeof icons>;
|
|
4
|
+
export type IconName = keyof typeof icons;
|
|
5
|
+
export interface IconProps extends HTMLAttributes<HTMLSpanElement> {
|
|
6
|
+
name: IconName;
|
|
7
|
+
size?: number;
|
|
8
|
+
color?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function Icon({ name, size, color, style, ...props }: IconProps): import("react/jsx-runtime").JSX.Element | null;
|
|
11
|
+
//# sourceMappingURL=Icon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../../src/components/Icon/Icon.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,eAAO,MAAM,SAAS,EAAyB,KAAK,CAAC,MAAM,OAAO,KAAK,CAAC,CAAC;AACzE,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,KAAK,CAAC;AAE1C,MAAM,WAAW,SAAU,SAAQ,cAAc,CAAC,eAAe,CAAC;IAChE,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,IAAI,CAAC,EACnB,IAAI,EACJ,IAAS,EACT,KAAsB,EACtB,KAAK,EACL,GAAG,KAAK,EACT,EAAE,SAAS,kDA2BX"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { icons } from './icons';
|
|
4
|
+
export const iconNames = Object.keys(icons);
|
|
5
|
+
export function Icon({ name, size = 24, color = 'currentColor', style, ...props }) {
|
|
6
|
+
const SvgIcon = icons[name];
|
|
7
|
+
if (!SvgIcon)
|
|
8
|
+
return null;
|
|
9
|
+
return (_jsx("span", { "aria-hidden": "true", ...props, style: {
|
|
10
|
+
display: 'inline-block',
|
|
11
|
+
width: size,
|
|
12
|
+
height: size,
|
|
13
|
+
color,
|
|
14
|
+
...style,
|
|
15
|
+
}, children: SvgIcon &&
|
|
16
|
+
// Clone the SVG element to inject size and color
|
|
17
|
+
(typeof SvgIcon === 'object' && 'type' in SvgIcon
|
|
18
|
+
? React.cloneElement(SvgIcon, {
|
|
19
|
+
width: size,
|
|
20
|
+
height: size,
|
|
21
|
+
color,
|
|
22
|
+
style: { display: 'block', width: '100%', height: '100%' },
|
|
23
|
+
})
|
|
24
|
+
: SvgIcon) }));
|
|
25
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const icons: {
|
|
2
|
+
search: import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
account: import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
setting: import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
delete: import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
arrow_up: import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
arrow_down: import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
arrow_right: import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
arrow_left: import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
chevron_down: import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
check: import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
dash: import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
close: import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
info: import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
check_circle: import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
error: import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
warning: import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
add: import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
};
|
|
20
|
+
export type IconKey = keyof typeof icons;
|
|
21
|
+
//# sourceMappingURL=icons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../../src/components/Icon/icons.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;CAsNjB,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,MAAM,OAAO,KAAK,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export const icons = {
|
|
3
|
+
search: (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("circle", { cx: "11", cy: "11", r: "7", stroke: "currentColor", strokeWidth: "2", fill: "none" }), _jsx("line", { x1: "16.5", y1: "16.5", x2: "21", y2: "21", stroke: "currentColor", strokeWidth: "2" })] })),
|
|
4
|
+
account: (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("circle", { cx: "12", cy: "8", r: "4", stroke: "currentColor", strokeWidth: "2", fill: "none" }), _jsx("path", { d: "M4 20c0-4 16-4 16 0", stroke: "currentColor", strokeWidth: "2", fill: "none" })] })),
|
|
5
|
+
setting: (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("circle", { cx: "12", cy: "12", r: "3", stroke: "currentColor", strokeWidth: "2", fill: "none" }), _jsx("path", { d: "M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06A1.65 1.65 0 0 0 15 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 8.6 15a1.65 1.65 0 0 0-1.82-.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.6a1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 15 8.6a1.65 1.65 0 0 0 1.82.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 15z", stroke: "currentColor", strokeWidth: "2", fill: "none" })] })),
|
|
6
|
+
delete: (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("rect", { x: "6", y: "7", width: "12", height: "13", rx: "2", stroke: "currentColor", strokeWidth: "2", fill: "none" }), _jsx("path", { d: "M3 7h18", stroke: "currentColor", strokeWidth: "2" }), _jsx("path", { d: "M8 7V5a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", stroke: "currentColor", strokeWidth: "2" })] })),
|
|
7
|
+
arrow_up: (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { d: "M12 19V5", stroke: "currentColor", strokeWidth: "2" }), _jsx("path", { d: "M5 12l7-7 7 7", stroke: "currentColor", strokeWidth: "2", fill: "none" })] })),
|
|
8
|
+
arrow_down: (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { d: "M12 5v14", stroke: "currentColor", strokeWidth: "2" }), _jsx("path", { d: "M19 12l-7 7-7-7", stroke: "currentColor", strokeWidth: "2", fill: "none" })] })),
|
|
9
|
+
arrow_right: (_jsx("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M9.5 17V7L14.5 12L9.5 17Z", fill: "currentColor" }) })),
|
|
10
|
+
arrow_left: (_jsx("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M14.5 17L9.5 12L14.5 7V17Z", fill: "currentColor" }) })),
|
|
11
|
+
chevron_down: (_jsx("svg", { viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M5 8L10 13L15 8", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })),
|
|
12
|
+
check: (_jsx("svg", { viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M2 8.5L6.5 13L14 3.5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })),
|
|
13
|
+
dash: (_jsx("svg", { viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M3 8H13", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) })),
|
|
14
|
+
close: (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18", stroke: "currentColor", strokeWidth: "2" }), _jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18", stroke: "currentColor", strokeWidth: "2" })] })),
|
|
15
|
+
info: (_jsxs("svg", { viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("circle", { cx: "8", cy: "8", r: "7", fill: "currentColor" }), _jsx("rect", { x: "7.25", y: "6.5", width: "1.5", height: "5", rx: "0.75", fill: "#ffffff" }), _jsx("circle", { cx: "8", cy: "4.5", r: "1", fill: "#ffffff" })] })),
|
|
16
|
+
check_circle: (_jsxs("svg", { viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("circle", { cx: "8", cy: "8", r: "7", fill: "currentColor" }), _jsx("path", { d: "M4.25 8.25L6.75 10.75L11.75 5.75", stroke: "#ffffff", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })] })),
|
|
17
|
+
error: (_jsxs("svg", { viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("circle", { cx: "8", cy: "8", r: "7", fill: "currentColor" }), _jsx("rect", { x: "7.25", y: "4", width: "1.5", height: "6", rx: "0.75", fill: "#ffffff" }), _jsx("circle", { cx: "8", cy: "12", r: "1", fill: "#ffffff" })] })),
|
|
18
|
+
warning: (_jsxs("svg", { viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { d: "M8 1.5L15 13.5H1L8 1.5Z", fill: "currentColor" }), _jsx("rect", { x: "7.25", y: "5", width: "1.5", height: "4.75", rx: "0.75", fill: "#ffffff" }), _jsx("circle", { cx: "8", cy: "11.5", r: "1", fill: "#ffffff" })] })),
|
|
19
|
+
add: (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("line", { x1: "12", y1: "5", x2: "12", y2: "19", stroke: "currentColor", strokeWidth: "2" }), _jsx("line", { x1: "5", y1: "12", x2: "19", y2: "12", stroke: "currentColor", strokeWidth: "2" })] })),
|
|
20
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Icon/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACzC,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Icon, iconNames } from './Icon';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Icons.d.ts","sourceRoot":"","sources":["../../../src/components/Icons/Icons.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC/C,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Icon, iconNames } from '../Icon/Icon';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { IndexProps } from '../../types';
|
|
2
|
+
export declare function Index({ activeLetter, className, defaultActiveLetter, items, maxVisiblePages, onLetterChange, showStepControls, style, ...props }: IndexProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
//# sourceMappingURL=Index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Index.d.ts","sourceRoot":"","sources":["../../../src/components/Index/Index.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAa,UAAU,EAAE,MAAM,aAAa,CAAC;AAoDzD,wBAAgB,KAAK,CAAC,EACpB,YAAY,EACZ,SAAS,EACT,mBAAmB,EACnB,KAAK,EACL,eAAmB,EACnB,cAAc,EACd,gBAAwB,EACxB,KAAK,EACL,GAAG,KAAK,EACT,EAAE,UAAU,2CAkLZ"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
+
import { Icon } from '../Icon/Icon';
|
|
4
|
+
const ITEM_WIDTH = 48;
|
|
5
|
+
function getClassName(className) {
|
|
6
|
+
return ['liquid-index', className].filter(Boolean).join(' ');
|
|
7
|
+
}
|
|
8
|
+
function getDefaultItems() {
|
|
9
|
+
return Array.from({ length: 26 }, (_, i) => ({
|
|
10
|
+
letter: String.fromCharCode(65 + i),
|
|
11
|
+
}));
|
|
12
|
+
}
|
|
13
|
+
function normalizeItems(items) {
|
|
14
|
+
const seen = new Set();
|
|
15
|
+
return items.flatMap((item) => {
|
|
16
|
+
const normalized = item.letter.trim().toUpperCase();
|
|
17
|
+
if (!normalized || seen.has(normalized)) {
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
seen.add(normalized);
|
|
21
|
+
return [{ ...item, letter: normalized }];
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function getFirstEnabledLetter(items) {
|
|
25
|
+
return items.find((item) => !item.disabled)?.letter;
|
|
26
|
+
}
|
|
27
|
+
function getVisibleItems(items, activeIndex, maxVisible) {
|
|
28
|
+
if (items.length <= maxVisible) {
|
|
29
|
+
return items;
|
|
30
|
+
}
|
|
31
|
+
const sideCount = Math.floor(maxVisible / 2);
|
|
32
|
+
let start = Math.max(0, activeIndex - sideCount);
|
|
33
|
+
const end = Math.min(items.length - 1, start + maxVisible - 1);
|
|
34
|
+
if (end - start + 1 < maxVisible) {
|
|
35
|
+
start = Math.max(0, end - maxVisible + 1);
|
|
36
|
+
}
|
|
37
|
+
return items.slice(start, end + 1);
|
|
38
|
+
}
|
|
39
|
+
export function Index({ activeLetter, className, defaultActiveLetter, items, maxVisiblePages = 5, onLetterChange, showStepControls = false, style, ...props }) {
|
|
40
|
+
const navRef = useRef(null);
|
|
41
|
+
const resolvedItems = useMemo(() => {
|
|
42
|
+
const source = items?.length ? [...items] : getDefaultItems();
|
|
43
|
+
return normalizeItems(source);
|
|
44
|
+
}, [items]);
|
|
45
|
+
const [responsiveVisiblePages, setResponsiveVisiblePages] = useState(Math.max(1, maxVisiblePages));
|
|
46
|
+
const fallbackActive = getFirstEnabledLetter(resolvedItems);
|
|
47
|
+
const [internalActiveLetter, setInternalActiveLetter] = useState(defaultActiveLetter?.trim().toUpperCase() ?? fallbackActive);
|
|
48
|
+
const requestedActive = activeLetter?.trim().toUpperCase();
|
|
49
|
+
const resolvedActiveLetter = resolvedItems.find((item) => item.letter === (requestedActive ?? internalActiveLetter) &&
|
|
50
|
+
!item.disabled)?.letter ?? fallbackActive;
|
|
51
|
+
const enabledLetters = useMemo(() => resolvedItems.filter((item) => !item.disabled).map((item) => item.letter), [resolvedItems]);
|
|
52
|
+
const maxVisible = Math.max(1, maxVisiblePages);
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
setResponsiveVisiblePages(maxVisible);
|
|
55
|
+
}, [maxVisible]);
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
const navElement = navRef.current;
|
|
58
|
+
if (!navElement || typeof ResizeObserver === 'undefined') {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const controlCount = showStepControls ? 2 : 0;
|
|
62
|
+
const updateVisiblePages = (width) => {
|
|
63
|
+
const availableSlots = Math.floor(width / ITEM_WIDTH) - controlCount;
|
|
64
|
+
const fittedVisible = Math.max(1, availableSlots);
|
|
65
|
+
setResponsiveVisiblePages((current) => current === fittedVisible ? current : fittedVisible);
|
|
66
|
+
};
|
|
67
|
+
const observer = new ResizeObserver((entries) => {
|
|
68
|
+
const entry = entries[0];
|
|
69
|
+
if (!entry) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
updateVisiblePages(entry.contentRect.width);
|
|
73
|
+
});
|
|
74
|
+
observer.observe(navElement);
|
|
75
|
+
updateVisiblePages(navElement.getBoundingClientRect().width);
|
|
76
|
+
return () => {
|
|
77
|
+
observer.disconnect();
|
|
78
|
+
};
|
|
79
|
+
}, [showStepControls]);
|
|
80
|
+
const activeEnabledIndex = enabledLetters.findIndex((letter) => letter === resolvedActiveLetter);
|
|
81
|
+
const activeLetterIndex = resolvedItems.findIndex((item) => item.letter === resolvedActiveLetter);
|
|
82
|
+
const effectiveVisiblePages = Math.min(resolvedItems.length, maxVisible, responsiveVisiblePages);
|
|
83
|
+
const visibleItems = useMemo(() => {
|
|
84
|
+
if (!resolvedItems.length) {
|
|
85
|
+
return [];
|
|
86
|
+
}
|
|
87
|
+
const resolvedActiveIndex = activeLetterIndex < 0 ? 0 : activeLetterIndex;
|
|
88
|
+
return getVisibleItems(resolvedItems, resolvedActiveIndex, Math.max(1, effectiveVisiblePages));
|
|
89
|
+
}, [activeLetterIndex, effectiveVisiblePages, resolvedItems]);
|
|
90
|
+
const activateLetter = (letter) => {
|
|
91
|
+
if (activeLetter === undefined) {
|
|
92
|
+
setInternalActiveLetter(letter);
|
|
93
|
+
}
|
|
94
|
+
onLetterChange?.(letter);
|
|
95
|
+
};
|
|
96
|
+
return (_jsxs("nav", { ...props, "aria-label": "A-Z index", className: getClassName(className), ref: navRef, style: style, children: [showStepControls ? (_jsx("button", { "aria-label": "Previous letter", className: "liquid-index__item liquid-index__item--icon", disabled: activeEnabledIndex <= 0, onClick: () => {
|
|
97
|
+
if (activeEnabledIndex > 0) {
|
|
98
|
+
activateLetter(enabledLetters[activeEnabledIndex - 1]);
|
|
99
|
+
}
|
|
100
|
+
}, type: "button", children: _jsx(Icon, { name: "arrow_left", size: 24 }) })) : null, visibleItems.map((item) => {
|
|
101
|
+
const isSelected = item.letter === resolvedActiveLetter;
|
|
102
|
+
return (_jsxs("button", { "aria-current": isSelected ? 'page' : undefined, "aria-label": `Letter ${item.letter}`, className: "liquid-index__item", "data-selected": isSelected || undefined, disabled: item.disabled, onClick: () => {
|
|
103
|
+
if (!item.disabled) {
|
|
104
|
+
activateLetter(item.letter);
|
|
105
|
+
}
|
|
106
|
+
}, type: "button", children: [_jsx("span", { className: "liquid-index__label", children: item.letter }), isSelected ? _jsx("span", { className: "liquid-index__indicator" }) : null] }, item.letter));
|
|
107
|
+
}), showStepControls ? (_jsx("button", { "aria-label": "Next letter", className: "liquid-index__item liquid-index__item--icon", disabled: activeEnabledIndex < 0 ||
|
|
108
|
+
activeEnabledIndex >= enabledLetters.length - 1, onClick: () => {
|
|
109
|
+
if (activeEnabledIndex >= 0 &&
|
|
110
|
+
activeEnabledIndex < enabledLetters.length - 1) {
|
|
111
|
+
activateLetter(enabledLetters[activeEnabledIndex + 1]);
|
|
112
|
+
}
|
|
113
|
+
}, type: "button", children: _jsx(Icon, { name: "arrow_right", size: 24 }) })) : null] }));
|
|
114
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { InlineNotificationProps } from '../../types';
|
|
2
|
+
export declare function InlineNotification({ actionHref, actionLabel, children, className, dismissLabel, hideDismiss, kind, onAction, onDismiss, role, status, style, title, ...props }: InlineNotificationProps): import("react/jsx-runtime").JSX.Element | null;
|
|
3
|
+
//# sourceMappingURL=InlineNotification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InlineNotification.d.ts","sourceRoot":"","sources":["../../../src/components/InlineNotification/InlineNotification.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,uBAAuB,EAExB,MAAM,aAAa,CAAC;AA+DrB,wBAAgB,kBAAkB,CAAC,EACjC,UAAU,EACV,WAAsB,EACtB,QAAQ,EACR,SAAS,EACT,YAAqC,EACrC,WAAW,EACX,IAAgB,EAChB,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,MAAsB,EACtB,KAAK,EACL,KAAK,EACL,GAAG,KAAK,EACT,EAAE,uBAAuB,kDAwEzB"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Icon } from '../Icon/Icon';
|
|
4
|
+
import { Link } from '../Link/Link';
|
|
5
|
+
const DEFAULT_TITLE = {
|
|
6
|
+
information: 'Information',
|
|
7
|
+
success: 'Success',
|
|
8
|
+
warning: 'Warning',
|
|
9
|
+
error: 'Error',
|
|
10
|
+
};
|
|
11
|
+
const DEFAULT_BODY = {
|
|
12
|
+
information: 'This notification provides additional context for the current workflow.',
|
|
13
|
+
success: 'Your changes were saved and are now available to everyone on the team.',
|
|
14
|
+
warning: 'Review the highlighted details before you continue to the next step.',
|
|
15
|
+
error: 'Something went wrong. Check the details and try the action again.',
|
|
16
|
+
};
|
|
17
|
+
const STATUS_ICON = {
|
|
18
|
+
information: 'info',
|
|
19
|
+
success: 'check_circle',
|
|
20
|
+
warning: 'warning',
|
|
21
|
+
error: 'error',
|
|
22
|
+
};
|
|
23
|
+
function getClassName(className) {
|
|
24
|
+
return ['liquid-inline-notification', className].filter(Boolean).join(' ');
|
|
25
|
+
}
|
|
26
|
+
function renderAction(actionLabel, actionHref, onAction) {
|
|
27
|
+
if (actionHref) {
|
|
28
|
+
return (_jsx(Link, { appearance: "standalone", href: actionHref, showTrailingIcon: false, size: "md", children: actionLabel }));
|
|
29
|
+
}
|
|
30
|
+
return (_jsx(Link, { appearance: "standalone", onClick: onAction, showTrailingIcon: false, size: "md", children: actionLabel }));
|
|
31
|
+
}
|
|
32
|
+
export function InlineNotification({ actionHref, actionLabel = 'Review', children, className, dismissLabel = 'Dismiss notification', hideDismiss, kind = 'default', onAction, onDismiss, role, status = 'information', style, title, ...props }) {
|
|
33
|
+
const [isDismissed, setIsDismissed] = useState(false);
|
|
34
|
+
const resolvedTitle = title ?? DEFAULT_TITLE[status];
|
|
35
|
+
const resolvedBody = children ?? DEFAULT_BODY[status];
|
|
36
|
+
const resolvedRole = role ?? (status === 'error' ? 'alert' : 'status');
|
|
37
|
+
const isActionable = kind === 'actionable';
|
|
38
|
+
const iconName = STATUS_ICON[status];
|
|
39
|
+
const handleDismiss = () => {
|
|
40
|
+
setIsDismissed(true);
|
|
41
|
+
onDismiss?.();
|
|
42
|
+
};
|
|
43
|
+
if (isDismissed) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
return (_jsxs("section", { ...props, "aria-live": status === 'error' ? undefined : 'polite', className: getClassName(className), "data-kind": kind, "data-status": status, role: resolvedRole, style: style, children: [_jsx("div", { className: "liquid-inline-notification__indicator" }), _jsxs("div", { className: "liquid-inline-notification__shell", children: [_jsxs("div", { className: "liquid-inline-notification__details", children: [_jsx("span", { "aria-hidden": "true", className: "liquid-inline-notification__status-icon", children: _jsx(Icon, { name: iconName, size: 24 }) }), _jsxs("div", { className: "liquid-inline-notification__content", children: [_jsxs("div", { className: "liquid-inline-notification__copy", children: [_jsx("p", { className: "liquid-inline-notification__title", children: resolvedTitle }), _jsx("p", { className: "liquid-inline-notification__body", children: resolvedBody })] }), isActionable ? (_jsx("div", { className: "liquid-inline-notification__actions", children: renderAction(actionLabel, actionHref, onAction) })) : null] })] }), !hideDismiss ? (_jsx("button", { "aria-label": dismissLabel, className: "liquid-inline-notification__dismiss", onClick: handleDismiss, type: "button", children: _jsx("span", { "aria-hidden": "true", className: "liquid-inline-notification__dismiss-icon", children: _jsx(Icon, { name: "close", size: 24 }) }) })) : null] })] }));
|
|
47
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../../src/components/Link/Link.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAIV,SAAS,EACV,MAAM,aAAa,CAAC;AAMrB,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,2CA2EpC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Icon } from '../Icon/Icon';
|
|
3
|
+
function getClassName(className) {
|
|
4
|
+
return ['liquid-link', className].filter(Boolean).join(' ');
|
|
5
|
+
}
|
|
6
|
+
export function Link(props) {
|
|
7
|
+
const appearance = props.appearance ?? 'standalone';
|
|
8
|
+
const children = props.children;
|
|
9
|
+
const className = props.className;
|
|
10
|
+
const showTrailingIcon = props.showTrailingIcon ?? true;
|
|
11
|
+
const size = props.size ?? 'md';
|
|
12
|
+
const state = props.state;
|
|
13
|
+
const style = props.style;
|
|
14
|
+
const isStandalone = appearance === 'standalone';
|
|
15
|
+
const showIcon = isStandalone && showTrailingIcon;
|
|
16
|
+
const iconSize = size === 'lg' ? 20 : 16;
|
|
17
|
+
if ('href' in props && props.href) {
|
|
18
|
+
const { appearance: _appearance, children: _children, className: _className, href, showTrailingIcon: _showTrailingIcon, size: _size, state: _state, style: _style, ...anchorProps } = props;
|
|
19
|
+
return (_jsxs("a", { ...anchorProps, className: getClassName(className), "data-appearance": appearance, "data-size": size, "data-state": state, href: href, style: style, children: [_jsx("span", { className: "liquid-link__label", children: children }), showIcon ? (_jsx("span", { "aria-hidden": "true", className: "liquid-link__icon", children: _jsx(Icon, { name: "arrow_right", size: iconSize }) })) : null] }));
|
|
20
|
+
}
|
|
21
|
+
const { appearance: _appearance, children: _children, className: _className, showTrailingIcon: _showTrailingIcon, size: _size, state: _state, style: _style, ...buttonProps } = props;
|
|
22
|
+
return (_jsxs("button", { ...buttonProps, className: getClassName(className), "data-appearance": appearance, "data-size": size, "data-state": state, style: style, type: buttonProps.type ?? 'button', children: [_jsx("span", { className: "liquid-link__label", children: children }), showIcon ? (_jsx("span", { "aria-hidden": "true", className: "liquid-link__icon", children: _jsx(Icon, { name: "arrow_right", size: iconSize }) })) : null] }));
|
|
23
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ModalProps } from '../../types';
|
|
2
|
+
export declare function Modal({ children, className, closeButtonLabel, description, footerLayout, label, onClose, onPrimaryAction, onSecondaryAction, onTertiaryAction, primaryActionLabel, primaryActionVariant, secondaryActionLabel, showCloseButton, showFooter, style, tertiaryActionLabel, title, tone, ...props }: ModalProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
//# sourceMappingURL=Modal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/Modal.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAoC,UAAU,EAAE,MAAM,aAAa,CAAC;AA6BhF,wBAAgB,KAAK,CAAC,EACpB,QAAQ,EACR,SAAS,EACT,gBAAiC,EACjC,WAAuN,EACvN,YAAY,EACZ,KAAwB,EACxB,OAAO,EACP,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,kBAA8B,EAC9B,oBAAoB,EACpB,oBAA+B,EAC/B,eAAsB,EACtB,UAAU,EACV,KAAK,EACL,mBAAqC,EACrC,KAAe,EACf,IAAgB,EAChB,GAAG,KAAK,EACT,EAAE,UAAU,2CAgHZ"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from '../Button/Button';
|
|
3
|
+
import { Icon } from '../Icon/Icon';
|
|
4
|
+
function getClassName(className) {
|
|
5
|
+
return ['liquid-modal', className].filter(Boolean).join(' ');
|
|
6
|
+
}
|
|
7
|
+
function getDefaultFooterLayout(tone) {
|
|
8
|
+
if (tone === 'danger') {
|
|
9
|
+
return 'double';
|
|
10
|
+
}
|
|
11
|
+
if (tone === 'transactional') {
|
|
12
|
+
return 'split';
|
|
13
|
+
}
|
|
14
|
+
return 'single';
|
|
15
|
+
}
|
|
16
|
+
function getPrimaryVariant(tone, primaryActionVariant) {
|
|
17
|
+
if (primaryActionVariant) {
|
|
18
|
+
return primaryActionVariant;
|
|
19
|
+
}
|
|
20
|
+
return tone === 'danger' ? 'danger' : 'primary';
|
|
21
|
+
}
|
|
22
|
+
export function Modal({ children, className, closeButtonLabel = 'Close dialog', description = 'Modals are a type of dialog because it is a conversation between the user and the system. Use a modal to present critical information or request user input that is needed to complete a user workflow.', footerLayout, label = 'Optional label', onClose, onPrimaryAction, onSecondaryAction, onTertiaryAction, primaryActionLabel = 'Confirm', primaryActionVariant, secondaryActionLabel = 'Cancel', showCloseButton = true, showFooter, style, tertiaryActionLabel = 'Save as draft', title = 'Title', tone = 'passive', ...props }) {
|
|
23
|
+
const resolvedFooterLayout = footerLayout ?? getDefaultFooterLayout(tone);
|
|
24
|
+
const resolvedShowFooter = showFooter ?? tone !== 'passive';
|
|
25
|
+
const resolvedPrimaryVariant = getPrimaryVariant(tone, primaryActionVariant);
|
|
26
|
+
return (_jsxs("section", { ...props, className: getClassName(className), "data-footer-layout": resolvedFooterLayout, "data-tone": tone, style: style, children: [_jsxs("header", { className: "liquid-modal__header", children: [_jsxs("div", { className: "liquid-modal__header-content", children: [label ? _jsx("p", { className: "liquid-modal__label", children: label }) : null, _jsx("h2", { className: "liquid-modal__title", children: title })] }), showCloseButton ? (_jsx("button", { "aria-label": closeButtonLabel, className: "liquid-modal__close", onClick: onClose, type: "button", children: _jsx(Icon, { className: "liquid-modal__close-icon", name: "close", size: 24 }) })) : null] }), _jsxs("div", { className: "liquid-modal__content", children: [description ? (_jsx("div", { className: "liquid-modal__description-wrap", children: _jsx("p", { className: "liquid-modal__description", children: description }) })) : null, children ? _jsx("div", { className: "liquid-modal__body", children: children }) : null] }), resolvedShowFooter ? (_jsx("footer", { className: "liquid-modal__footer", children: _jsxs("div", { className: "liquid-modal__actions", children: [resolvedFooterLayout === 'single' ? (_jsx("div", { className: "liquid-modal__actions-single", children: _jsx(Button, { className: "liquid-modal__action liquid-modal__action--single", onClick: onPrimaryAction, size: "lg", variant: resolvedPrimaryVariant, children: primaryActionLabel }) })) : null, resolvedFooterLayout === 'double' ? (_jsxs("div", { className: "liquid-modal__actions-double", children: [_jsx(Button, { className: "liquid-modal__action", onClick: onPrimaryAction, size: "lg", variant: resolvedPrimaryVariant, children: primaryActionLabel }), _jsx(Button, { className: "liquid-modal__action", onClick: onSecondaryAction, size: "lg", variant: "secondary", children: secondaryActionLabel })] })) : null, resolvedFooterLayout === 'split' ? (_jsxs("div", { className: "liquid-modal__actions-split", children: [_jsxs("div", { className: "liquid-modal__actions-left", children: [_jsx(Button, { className: "liquid-modal__action", onClick: onPrimaryAction, size: "lg", variant: resolvedPrimaryVariant, children: primaryActionLabel }), _jsx(Button, { className: "liquid-modal__action", onClick: onSecondaryAction, size: "lg", variant: "secondary", children: secondaryActionLabel })] }), _jsx(Button, { className: "liquid-modal__action liquid-modal__action--option", onClick: onTertiaryAction, size: "lg", variant: "tertiary", children: tertiaryActionLabel })] })) : null] }) })) : null] }));
|
|
27
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { PaginationProps } from '../../types';
|
|
2
|
+
export declare function Pagination({ className, currentPage, maxVisiblePages, onPageChange, style, totalPages, ...props }: PaginationProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
//# sourceMappingURL=Pagination.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Pagination.d.ts","sourceRoot":"","sources":["../../../src/components/Pagination/Pagination.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AA8BnD,wBAAgB,UAAU,CAAC,EACzB,SAAS,EACT,WAAW,EACX,eAAmB,EACnB,YAAY,EACZ,KAAK,EACL,UAAU,EACV,GAAG,KAAK,EACT,EAAE,eAAe,2CAgEjB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Icon } from '../Icon/Icon';
|
|
3
|
+
function getClassName(className) {
|
|
4
|
+
return ['liquid-pagination', className].filter(Boolean).join(' ');
|
|
5
|
+
}
|
|
6
|
+
function clampPage(page, totalPages) {
|
|
7
|
+
return Math.max(1, Math.min(totalPages, page));
|
|
8
|
+
}
|
|
9
|
+
function getVisiblePages(currentPage, totalPages, maxVisible) {
|
|
10
|
+
if (totalPages <= maxVisible) {
|
|
11
|
+
return Array.from({ length: totalPages }, (_, i) => i + 1);
|
|
12
|
+
}
|
|
13
|
+
const sideCount = Math.floor(maxVisible / 2);
|
|
14
|
+
let start = Math.max(1, currentPage - sideCount);
|
|
15
|
+
const end = Math.min(totalPages, start + maxVisible - 1);
|
|
16
|
+
if (end - start + 1 < maxVisible) {
|
|
17
|
+
start = Math.max(1, end - maxVisible + 1);
|
|
18
|
+
}
|
|
19
|
+
return Array.from({ length: end - start + 1 }, (_, i) => start + i);
|
|
20
|
+
}
|
|
21
|
+
export function Pagination({ className, currentPage, maxVisiblePages = 5, onPageChange, style, totalPages, ...props }) {
|
|
22
|
+
const resolvedCurrentPage = clampPage(currentPage, totalPages);
|
|
23
|
+
const visiblePages = getVisiblePages(resolvedCurrentPage, totalPages, Math.max(1, maxVisiblePages));
|
|
24
|
+
const goToPage = (page) => {
|
|
25
|
+
const nextPage = clampPage(page, totalPages);
|
|
26
|
+
if (nextPage !== resolvedCurrentPage) {
|
|
27
|
+
onPageChange?.(nextPage);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
return (_jsxs("nav", { ...props, "aria-label": "Pagination", className: getClassName(className), style: style, children: [_jsx("button", { "aria-label": "Previous page", className: "liquid-pagination__item liquid-pagination__item--icon", disabled: resolvedCurrentPage <= 1, onClick: () => goToPage(resolvedCurrentPage - 1), type: "button", children: _jsx(Icon, { name: "arrow_left", size: 24 }) }), visiblePages.map((page) => {
|
|
31
|
+
const isSelected = page === resolvedCurrentPage;
|
|
32
|
+
return (_jsxs("button", { "aria-current": isSelected ? 'page' : undefined, "aria-label": `Page ${page}`, className: "liquid-pagination__item liquid-pagination__item--number", "data-selected": isSelected || undefined, onClick: () => goToPage(page), type: "button", children: [_jsx("span", { className: "liquid-pagination__label", children: page }), isSelected ? (_jsx("span", { className: "liquid-pagination__indicator" })) : null] }, page));
|
|
33
|
+
}), _jsx("button", { "aria-label": "Next page", className: "liquid-pagination__item liquid-pagination__item--icon", disabled: resolvedCurrentPage >= totalPages, onClick: () => goToPage(resolvedCurrentPage + 1), type: "button", children: _jsx(Icon, { name: "arrow_right", size: 24 }) })] }));
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Radio.d.ts","sourceRoot":"","sources":["../../../src/components/Radio/Radio.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAgB9C,wBAAgB,KAAK,CAAC,EACpB,SAAS,EACT,EAAE,EACF,KAAK,EACL,SAAiB,EACjB,KAAK,EACL,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,UAAU,2CA6BZ"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId } from 'react';
|
|
3
|
+
function getClassName(className) {
|
|
4
|
+
return ['liquid-radio', className].filter(Boolean).join(' ');
|
|
5
|
+
}
|
|
6
|
+
function RadioDot() {
|
|
7
|
+
return (_jsx("span", { "aria-hidden": "true", className: "liquid-radio__dot", children: _jsx("svg", { viewBox: "0 0 16 16", fill: "none", children: _jsx("circle", { cx: "8", cy: "8", r: "4", fill: "currentColor" }) }) }));
|
|
8
|
+
}
|
|
9
|
+
export function Radio({ className, id, label, hideLabel = false, style, disabled, ...props }) {
|
|
10
|
+
const reactId = useId();
|
|
11
|
+
const inputId = id ?? reactId;
|
|
12
|
+
return (_jsxs("label", { className: getClassName(className), style: style, "data-disabled": disabled || undefined, children: [_jsx("input", { ...props, type: "radio", id: inputId, disabled: disabled, className: "liquid-radio__input" }), _jsx("span", { className: "liquid-radio__control", "aria-hidden": "true", children: _jsx(RadioDot, {}) }), label ? (_jsx("span", { className: hideLabel ? 'liquid-sr-only' : 'liquid-radio__label-text', children: label })) : null] }));
|
|
13
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { SearchInputProps } from '../../types';
|
|
2
|
+
export declare function SearchInput({ className, disabled, id, onClear, placeholder, style, onChange, value, defaultValue, ...props }: SearchInputProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
//# sourceMappingURL=SearchInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchInput.d.ts","sourceRoot":"","sources":["../../../src/components/SearchInput/SearchInput.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAMpD,wBAAgB,WAAW,CAAC,EAC1B,SAAS,EACT,QAAQ,EACR,EAAE,EACF,OAAO,EACP,WAAsB,EACtB,KAAK,EACL,QAAQ,EACR,KAAK,EACL,YAAY,EACZ,GAAG,KAAK,EACT,EAAE,gBAAgB,2CA0ElB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useId, useRef, useState } from 'react';
|
|
3
|
+
import { Icon } from '../Icon/Icon';
|
|
4
|
+
function getClassName(className) {
|
|
5
|
+
return ['liquid-search-input', className].filter(Boolean).join(' ');
|
|
6
|
+
}
|
|
7
|
+
export function SearchInput({ className, disabled, id, onClear, placeholder = 'Search', style, onChange, value, defaultValue, ...props }) {
|
|
8
|
+
const reactId = useId();
|
|
9
|
+
const inputId = id ?? reactId;
|
|
10
|
+
const inputRef = useRef(null);
|
|
11
|
+
const isControlled = value !== undefined;
|
|
12
|
+
const [internalHasValue, setInternalHasValue] = useState(() => Boolean(isControlled ? value : defaultValue));
|
|
13
|
+
// Keep internal state in sync with controlled value
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
if (isControlled) {
|
|
16
|
+
setInternalHasValue(Boolean(value));
|
|
17
|
+
}
|
|
18
|
+
}, [isControlled, value]);
|
|
19
|
+
const showClear = isControlled ? Boolean(value) : internalHasValue;
|
|
20
|
+
const handleChange = (e) => {
|
|
21
|
+
if (!isControlled) {
|
|
22
|
+
setInternalHasValue(Boolean(e.target.value));
|
|
23
|
+
}
|
|
24
|
+
onChange?.(e);
|
|
25
|
+
};
|
|
26
|
+
const handleClear = () => {
|
|
27
|
+
if (inputRef.current) {
|
|
28
|
+
inputRef.current.value = '';
|
|
29
|
+
inputRef.current.focus();
|
|
30
|
+
}
|
|
31
|
+
if (!isControlled) {
|
|
32
|
+
setInternalHasValue(false);
|
|
33
|
+
}
|
|
34
|
+
onClear?.();
|
|
35
|
+
};
|
|
36
|
+
return (_jsxs("div", { className: getClassName(className), "data-tone": disabled ? 'disabled' : undefined, style: style, children: [_jsx("label", { className: "liquid-search-input__label", htmlFor: inputId, children: _jsx("span", { className: "liquid-search-input__search-icon", children: _jsx(Icon, { name: "search", size: 24 }) }) }), _jsx("input", { ...props, ref: inputRef, className: "liquid-search-input__input", disabled: disabled, id: inputId, onChange: handleChange, placeholder: placeholder, type: "search", value: value, defaultValue: defaultValue }), showClear && !disabled ? (_jsx("button", { "aria-label": "Clear search", className: "liquid-search-input__clear", onClick: handleClear, type: "button", children: _jsx(Icon, { name: "close", size: 24 }) })) : null] }));
|
|
37
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { SelectInputProps } from '../../types';
|
|
2
|
+
export declare function SelectInput({ children, className, helperText, hideLabel, id, label, options, placeholder, size, tone, style, disabled, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, ...props }: SelectInputProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
//# sourceMappingURL=SelectInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectInput.d.ts","sourceRoot":"","sources":["../../../src/components/SelectInput/SelectInput.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAMpD,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,SAAS,EACT,UAAU,EACV,SAAiB,EACjB,EAAE,EACF,KAAK,EACL,OAAO,EACP,WAAW,EACX,IAAW,EACX,IAAgB,EAChB,KAAK,EACL,QAAQ,EACR,kBAAkB,EAAE,eAAe,EACnC,cAAc,EAAE,WAAW,EAC3B,GAAG,KAAK,EACT,EAAE,gBAAgB,2CAkFlB"}
|