@lumx/core 4.21.1-alpha.0 → 4.21.1-alpha.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.
@@ -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
  ========================================================================== */
@@ -58,6 +58,9 @@ export declare function setup({ component: AlertDialog, render, components: { Li
58
58
  pauseAnimationAtEnd: boolean;
59
59
  delay: number;
60
60
  };
61
+ snapshot: {
62
+ subject: string;
63
+ };
61
64
  };
62
65
  decorators: ((story: any, context: any) => any)[];
63
66
  };
@@ -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;
@@ -17,6 +17,9 @@ export declare function setup({ component: Dialog, render, decorators: { withChr
17
17
  pauseAnimationAtEnd: boolean;
18
18
  delay: number;
19
19
  };
20
+ snapshot: {
21
+ subject: string;
22
+ };
20
23
  };
21
24
  decorators: ((story: any, context: any) => any)[];
22
25
  args: Partial<Pick<import("./DialogShell").DialogShellProps, "size">>;
@@ -1,7 +1,7 @@
1
1
  import type { HasClassName, JSXElement, LumxClassName } from '../../types';
2
2
  import { PopoverProps } from '../Popover';
3
3
  /** MenuPopover props. */
4
- export interface MenuPopoverProps extends HasClassName, Pick<PopoverProps, 'placement' | 'anchorRef' | 'isOpen' | 'handleClose'> {
4
+ export interface MenuPopoverProps extends HasClassName, Pick<PopoverProps, 'placement' | 'anchorRef' | 'isOpen' | 'handleClose' | 'fitToAnchorWidth'> {
5
5
  /** Popover content (a `Menu`). */
6
6
  children?: JSXElement;
7
7
  }
@@ -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. */
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Elevation index, used to derive a box-shadow depth.
3
+ */
4
+ export type Elevation = 1 | 2 | 3 | 4 | 5;
@@ -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,9 +25,6 @@ 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
- };
31
28
  TestClickAwayCloses: {
32
29
  render: () => import("react").JSX.Element;
33
30
  play(): Promise<void>;
@@ -12,14 +12,13 @@ export declare const CLICK_AWAY_EVENT_TYPES: readonly ["mousedown", "touchstart"
12
12
  /** Callback triggered when a click away is detected. */
13
13
  export type ClickAwayCallback = EventListener | Falsy;
14
14
  /**
15
- * Check if a press event is a click away from all the given elements.
15
+ * Check if the click event targets are outside all the given elements.
16
16
  *
17
- * @param event - The press event.
18
17
  * @param targets - The event target elements (from `event.target` and `event.composedPath()`).
19
18
  * @param elements - The elements considered "inside" the click away context.
20
- * @returns `true` if the press is a click away.
19
+ * @returns `true` if the click is outside all elements (i.e. a click away).
21
20
  */
22
- export declare function isClickAway(event: Event, targets: HTMLElement[], elements: HTMLElement[]): boolean;
21
+ export declare function isClickAway(targets: HTMLElement[], elements: HTMLElement[]): boolean;
23
22
  /**
24
23
  * Imperative setup for click away detection.
25
24
  * Adds mousedown/touchstart listeners on `document` and calls the callback when a click
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.21.1-alpha.0",
10
+ "@lumx/icons": "^4.21.1-alpha.1",
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.21.1-alpha.0",
69
+ "version": "4.21.1-alpha.1",
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.11",
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.20.0"
93
+ "stableVersion": "4.21.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
+ }
@@ -1,13 +0,0 @@
1
- /**
2
- * Check if a mouse press landed in the scrollbar gutter of the element it targets.
3
- *
4
- * A browser dispatches a `mousedown` on the scrolling element when you press its scrollbar, and that
5
- * element is an ancestor of any popover it holds, so click away detection has to ignore the press.
6
- *
7
- * Touch is out of scope: a touch has no scrollbar to hit, and `TouchEvent` carries no coordinates.
8
- *
9
- * @param event - The press event.
10
- * @param target - The element the press landed on.
11
- * @returns `true` if the press landed on a scrollbar of `target`.
12
- */
13
- export declare function isScrollbarPress(event: Event, target: EventTarget | null): boolean;