@lumx/core 4.20.0-next.5 → 4.20.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components-and-utils.css +24 -0
- package/js/components/Card/Stories.d.ts +41 -0
- package/js/components/Card/Tests.d.ts +12 -0
- package/js/components/Card/index.d.ts +37 -0
- package/js/components/Popover/types.d.ts +1 -4
- package/js/types/Elevation.d.ts +4 -0
- package/js/types/index.d.ts +1 -0
- package/js/utils/ClickAway/TestStories.d.ts +3 -0
- package/js/utils/ClickAway/index.d.ts +12 -3
- package/lumx.css +24 -0
- package/package.json +4 -4
- package/scss/_components_classes.scss +1 -0
- package/scss/components/card/_index.scss +15 -0
package/components-and-utils.css
CHANGED
|
@@ -4436,6 +4436,30 @@ table {
|
|
|
4436
4436
|
width: 100%;
|
|
4437
4437
|
}
|
|
4438
4438
|
|
|
4439
|
+
/* ==========================================================================
|
|
4440
|
+
Card
|
|
4441
|
+
========================================================================== */
|
|
4442
|
+
.lumx-card {
|
|
4443
|
+
background-color: rgb(255, 255, 255);
|
|
4444
|
+
border-radius: var(--lumx-border-radius);
|
|
4445
|
+
padding: 24px;
|
|
4446
|
+
}
|
|
4447
|
+
.lumx-card--elevation-1 {
|
|
4448
|
+
box-shadow: 0 0 2px 0 var(--lumx-color-dark-L4);
|
|
4449
|
+
}
|
|
4450
|
+
.lumx-card--elevation-2 {
|
|
4451
|
+
box-shadow: 0 1px 4px 0 var(--lumx-color-dark-L4);
|
|
4452
|
+
}
|
|
4453
|
+
.lumx-card--elevation-3 {
|
|
4454
|
+
box-shadow: 0 2px 8px 0 var(--lumx-color-dark-L4);
|
|
4455
|
+
}
|
|
4456
|
+
.lumx-card--elevation-4 {
|
|
4457
|
+
box-shadow: 0 4px 16px 0 var(--lumx-color-dark-L4);
|
|
4458
|
+
}
|
|
4459
|
+
.lumx-card--elevation-5 {
|
|
4460
|
+
box-shadow: 0 8px 32px 0 var(--lumx-color-dark-L4);
|
|
4461
|
+
}
|
|
4462
|
+
|
|
4439
4463
|
/* ==========================================================================
|
|
4440
4464
|
Checkbox
|
|
4441
4465
|
========================================================================== */
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { SetupStoriesOptions } from '@lumx/core/stories/types';
|
|
2
|
+
import { Elevation } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Setup Card stories for a specific framework (React or Vue).
|
|
5
|
+
* This function creates all the stories with the appropriate decorators.
|
|
6
|
+
* Framework-specific render functions or args can be injected via `overrides`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function setup({ component: Card, }: SetupStoriesOptions<{
|
|
9
|
+
decorators?: never;
|
|
10
|
+
}>): {
|
|
11
|
+
meta: {
|
|
12
|
+
component: any;
|
|
13
|
+
render: (args: any) => import("react").JSX.Element;
|
|
14
|
+
args: {
|
|
15
|
+
readonly as: "div";
|
|
16
|
+
};
|
|
17
|
+
argTypes: {
|
|
18
|
+
elevation: {
|
|
19
|
+
control: {
|
|
20
|
+
type: "select" | "inline-radio";
|
|
21
|
+
};
|
|
22
|
+
options: Elevation[];
|
|
23
|
+
mapping: Record<string, Elevation> | undefined;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
/** Default card */
|
|
28
|
+
Default: {};
|
|
29
|
+
/** Elevated card */
|
|
30
|
+
Elevation: {
|
|
31
|
+
args: {
|
|
32
|
+
elevation: number;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
/** Card rendered as a custom element */
|
|
36
|
+
AsElement: {
|
|
37
|
+
args: {
|
|
38
|
+
as: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SetupOptions } from '../../../testing';
|
|
2
|
+
import { CardProps } from '.';
|
|
3
|
+
type SetupProps = Partial<CardProps>;
|
|
4
|
+
/**
|
|
5
|
+
* Mounts the component and returns common DOM elements / data needed in multiple tests further down.
|
|
6
|
+
*/
|
|
7
|
+
export declare const setup: (propsOverride: SetupProps | undefined, { render, ...options }: SetupOptions<CardProps>) => {
|
|
8
|
+
card: HTMLElement;
|
|
9
|
+
props: CardProps;
|
|
10
|
+
};
|
|
11
|
+
declare const _default: (renderOptions: SetupOptions<CardProps>) => void;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { LumxClassName, HasClassName, CommonRef, JSXElement, Elevation } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Defines the props of the component.
|
|
4
|
+
*/
|
|
5
|
+
export interface CardProps extends HasClassName {
|
|
6
|
+
/** Customize the rendered root element (e.g. `div`, `article`, `section`, `li`, `aside`), defaults to `div`. */
|
|
7
|
+
as?: any;
|
|
8
|
+
/** Content of the card. */
|
|
9
|
+
children?: JSXElement;
|
|
10
|
+
/** Elevation depth of the card, defaults to no elevation. */
|
|
11
|
+
elevation?: Elevation;
|
|
12
|
+
/** reference to the root element */
|
|
13
|
+
ref?: CommonRef;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Component display name.
|
|
17
|
+
*/
|
|
18
|
+
export declare const COMPONENT_NAME = "Card";
|
|
19
|
+
/**
|
|
20
|
+
* Component default class name and class prefix.
|
|
21
|
+
*/
|
|
22
|
+
export declare const CLASSNAME: LumxClassName<typeof COMPONENT_NAME>;
|
|
23
|
+
/**
|
|
24
|
+
* Component default props.
|
|
25
|
+
*/
|
|
26
|
+
export declare const DEFAULT_PROPS: {
|
|
27
|
+
readonly as: "div";
|
|
28
|
+
};
|
|
29
|
+
/** Root element rendered when no `as` prop is provided. */
|
|
30
|
+
export type DefaultCardTag = typeof DEFAULT_PROPS.as;
|
|
31
|
+
/**
|
|
32
|
+
* Card component.
|
|
33
|
+
*
|
|
34
|
+
* @param props Component props.
|
|
35
|
+
* @return JSX element.
|
|
36
|
+
*/
|
|
37
|
+
export declare const Card: (props: CardProps) => import("react").JSX.Element;
|
|
@@ -9,10 +9,7 @@ export interface Offset {
|
|
|
9
9
|
/** Offset size away from the reference. */
|
|
10
10
|
away?: number;
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
* Popover elevation index.
|
|
14
|
-
*/
|
|
15
|
-
export type Elevation = 1 | 2 | 3 | 4 | 5;
|
|
12
|
+
export type { Elevation } from '../../types';
|
|
16
13
|
/** Popover size value — pixel value, or "t-shirt" size token. */
|
|
17
14
|
export type PopoverSize = PXSize | (typeof POPOVER_SIZES)[number];
|
|
18
15
|
/** Popover height value — extends PopoverSize with viewport-relative unit. */
|
package/js/types/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export type { TextElement } from './TextElement';
|
|
|
14
14
|
export type { ValueOf } from './ValueOf';
|
|
15
15
|
export type { LumxClassName } from './LumxClassName';
|
|
16
16
|
export type { Direction } from './Direction';
|
|
17
|
+
export type { Elevation } from './Elevation';
|
|
17
18
|
export type { Spacing } from './Spacing';
|
|
18
19
|
export type { NestedComponents, ComponentLike } from './NestedComponents';
|
|
19
20
|
export type { ObjectValues } from './ObjectValues';
|
|
@@ -25,6 +25,9 @@ export declare function setup({ component: ClickAwayProvider, components: { Port
|
|
|
25
25
|
InShadowDOM: {
|
|
26
26
|
render: () => import("react").JSX.Element;
|
|
27
27
|
};
|
|
28
|
+
ScrollableClickAway: {
|
|
29
|
+
render: () => import("react").JSX.Element;
|
|
30
|
+
};
|
|
28
31
|
TestClickAwayCloses: {
|
|
29
32
|
render: () => import("react").JSX.Element;
|
|
30
33
|
play(): Promise<void>;
|
|
@@ -7,8 +7,17 @@
|
|
|
7
7
|
* (React context, Vue provide/inject) are implemented in each framework package.
|
|
8
8
|
*/
|
|
9
9
|
import type { Falsy } from '@lumx/core/js/types';
|
|
10
|
-
/**
|
|
11
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Event types that trigger click away detection.
|
|
12
|
+
*
|
|
13
|
+
* `click` rather than `mousedown`: pressing a scrollbar dispatches a `mousedown` on the scrolling
|
|
14
|
+
* element, which is an ancestor of any popover it holds, but never dispatches a `click`. Scrolling
|
|
15
|
+
* therefore cannot be mistaken for a click away.
|
|
16
|
+
*
|
|
17
|
+
* `touchstart` is kept because iOS Safari does not dispatch `click` for taps on non-interactive
|
|
18
|
+
* elements, which would leave popovers open on tap away.
|
|
19
|
+
*/
|
|
20
|
+
export declare const CLICK_AWAY_EVENT_TYPES: readonly ["click", "touchstart"];
|
|
12
21
|
/** Callback triggered when a click away is detected. */
|
|
13
22
|
export type ClickAwayCallback = EventListener | Falsy;
|
|
14
23
|
/**
|
|
@@ -21,7 +30,7 @@ export type ClickAwayCallback = EventListener | Falsy;
|
|
|
21
30
|
export declare function isClickAway(targets: HTMLElement[], elements: HTMLElement[]): boolean;
|
|
22
31
|
/**
|
|
23
32
|
* Imperative setup for click away detection.
|
|
24
|
-
* Adds
|
|
33
|
+
* Adds click/touchstart listeners on `document` and calls the callback when a click
|
|
25
34
|
* occurs outside the elements returned by `getElements`.
|
|
26
35
|
*
|
|
27
36
|
* Note: when `getElements` returns an empty array, any click is considered a click away.
|
package/lumx.css
CHANGED
|
@@ -5117,6 +5117,30 @@ table {
|
|
|
5117
5117
|
width: 100%;
|
|
5118
5118
|
}
|
|
5119
5119
|
|
|
5120
|
+
/* ==========================================================================
|
|
5121
|
+
Card
|
|
5122
|
+
========================================================================== */
|
|
5123
|
+
.lumx-card {
|
|
5124
|
+
background-color: rgb(255, 255, 255);
|
|
5125
|
+
border-radius: var(--lumx-border-radius);
|
|
5126
|
+
padding: 24px;
|
|
5127
|
+
}
|
|
5128
|
+
.lumx-card--elevation-1 {
|
|
5129
|
+
box-shadow: 0 0 2px 0 var(--lumx-color-dark-L4);
|
|
5130
|
+
}
|
|
5131
|
+
.lumx-card--elevation-2 {
|
|
5132
|
+
box-shadow: 0 1px 4px 0 var(--lumx-color-dark-L4);
|
|
5133
|
+
}
|
|
5134
|
+
.lumx-card--elevation-3 {
|
|
5135
|
+
box-shadow: 0 2px 8px 0 var(--lumx-color-dark-L4);
|
|
5136
|
+
}
|
|
5137
|
+
.lumx-card--elevation-4 {
|
|
5138
|
+
box-shadow: 0 4px 16px 0 var(--lumx-color-dark-L4);
|
|
5139
|
+
}
|
|
5140
|
+
.lumx-card--elevation-5 {
|
|
5141
|
+
box-shadow: 0 8px 32px 0 var(--lumx-color-dark-L4);
|
|
5142
|
+
}
|
|
5143
|
+
|
|
5120
5144
|
/* ==========================================================================
|
|
5121
5145
|
Checkbox
|
|
5122
5146
|
========================================================================== */
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@floating-ui/dom": "^1.7.5",
|
|
10
|
-
"@lumx/icons": "^4.20.
|
|
10
|
+
"@lumx/icons": "^4.20.1-alpha.0",
|
|
11
11
|
"classnames": "^2.3.2",
|
|
12
12
|
"focus-visible": "^5.0.2",
|
|
13
13
|
"lodash": "4.18.1",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"update-version-changelog": "yarn version-changelog ../../CHANGELOG.md"
|
|
67
67
|
},
|
|
68
68
|
"sideEffects": false,
|
|
69
|
-
"version": "4.20.
|
|
69
|
+
"version": "4.20.1-alpha.0",
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
72
72
|
"@testing-library/dom": "^10.4.1",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"autoprefixer": "^9.7.4",
|
|
77
77
|
"glob": "^7.1.6",
|
|
78
78
|
"jsdom": "^27.2.0",
|
|
79
|
-
"postcss": "^8.5.
|
|
79
|
+
"postcss": "^8.5.23",
|
|
80
80
|
"rollup": "^4.59.0",
|
|
81
81
|
"rollup-plugin-cleaner": "^1.0.0",
|
|
82
82
|
"rollup-plugin-copy": "^3.5.0",
|
|
@@ -90,5 +90,5 @@
|
|
|
90
90
|
"vite-tsconfig-paths": "^5.1.4",
|
|
91
91
|
"vitest": "^4.1.10"
|
|
92
92
|
},
|
|
93
|
-
"stableVersion": "4.
|
|
93
|
+
"stableVersion": "4.20.0"
|
|
94
94
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
@import "./components/avatar/index";
|
|
2
2
|
@import "./components/badge/index";
|
|
3
3
|
@import "./components/button/index";
|
|
4
|
+
@import "./components/card/index";
|
|
4
5
|
@import "./components/checkbox/index";
|
|
5
6
|
@import "./components/chip/index";
|
|
6
7
|
@import "./components/combobox/index";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/* ==========================================================================
|
|
2
|
+
Card
|
|
3
|
+
========================================================================== */
|
|
4
|
+
|
|
5
|
+
.#{$lumx-base-prefix}-card {
|
|
6
|
+
background-color: $lumx-color-light-N;
|
|
7
|
+
border-radius: var(--lumx-border-radius);
|
|
8
|
+
padding: $lumx-spacing-unit-huge;
|
|
9
|
+
|
|
10
|
+
@each $depth, $shadow in $lumx-elevation-shadows {
|
|
11
|
+
&--elevation-#{$depth} {
|
|
12
|
+
@include lumx-elevation($depth);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|