@lumx/core 4.23.0 → 4.24.0-next.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.
@@ -7298,7 +7298,7 @@ table {
7298
7298
  .lumx-input-label--is-required::before {
7299
7299
  margin-right: 4px;
7300
7300
  font-weight: 700;
7301
- content: "*";
7301
+ content: "*"/"";
7302
7302
  }
7303
7303
  .lumx-input-label--theme-light {
7304
7304
  display: block;
@@ -7364,6 +7364,31 @@ table {
7364
7364
  text-transform: uppercase;
7365
7365
  }
7366
7366
 
7367
+ /* ==========================================================================
7368
+ Input required legend
7369
+ ========================================================================== */
7370
+ .lumx-input-required-legend__marker {
7371
+ margin-right: 4px;
7372
+ font-weight: 700;
7373
+ }
7374
+ .lumx-input-required-legend--theme-light {
7375
+ display: block;
7376
+ font-size: var(--lumx-material-input-helper-font-size);
7377
+ font-weight: var(--lumx-material-input-helper-font-weight);
7378
+ line-height: var(--lumx-material-input-helper-line-height);
7379
+ color: var(--lumx-color-dark-L2);
7380
+ }
7381
+ .lumx-input-required-legend--theme-light .lumx-input-required-legend__marker {
7382
+ color: var(--lumx-color-red-N);
7383
+ }
7384
+ .lumx-input-required-legend--theme-dark {
7385
+ display: block;
7386
+ font-size: var(--lumx-material-input-helper-font-size);
7387
+ font-weight: var(--lumx-material-input-helper-font-weight);
7388
+ line-height: var(--lumx-material-input-helper-line-height);
7389
+ color: var(--lumx-color-light-L2);
7390
+ }
7391
+
7367
7392
  /* ==========================================================================
7368
7393
  Lightbox
7369
7394
  ========================================================================== */
@@ -8,6 +8,8 @@ export interface ComboboxInputProps extends HasClassName, HasTheme, ComboboxCall
8
8
  listboxId?: string;
9
9
  /** Whether the combobox is open. */
10
10
  isOpen?: boolean;
11
+ /** Whether the field is required. Renders `aria-required` instead of the native `required`. */
12
+ isRequired?: boolean;
11
13
  /** ref to the root element. */
12
14
  ref?: CommonRef;
13
15
  /** Reference to the input element. */
@@ -0,0 +1,27 @@
1
+ import type { SetupStoriesOptions } from '@lumx/core/stories/types';
2
+ /**
3
+ * Setup InputRequiredLegend stories for a specific framework (React or Vue).
4
+ * This function creates all the stories with the appropriate decorators.
5
+ */
6
+ export declare function setup({ component: InputRequiredLegend, decorators: { withCombinations, withThemedBackground }, }: SetupStoriesOptions<{
7
+ decorators: 'withCombinations' | 'withThemedBackground';
8
+ }>): {
9
+ meta: {
10
+ component: any;
11
+ render: (args: any) => import("react").JSX.Element;
12
+ args: {
13
+ label: string;
14
+ };
15
+ };
16
+ /** Default required legend */
17
+ Default: {};
18
+ /** All themes */
19
+ AllThemes: {
20
+ argTypes: {
21
+ theme: {
22
+ control: boolean;
23
+ };
24
+ };
25
+ decorators: ((story: any, context: any) => any)[];
26
+ };
27
+ };
@@ -0,0 +1,13 @@
1
+ import { SetupOptions } from '../../../testing';
2
+ import { InputRequiredLegendProps } from '.';
3
+ type SetupProps = Partial<InputRequiredLegendProps>;
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<InputRequiredLegendProps>) => {
8
+ legend: HTMLElement;
9
+ marker: HTMLElement;
10
+ props: InputRequiredLegendProps;
11
+ };
12
+ declare const _default: (renderOptions: SetupOptions<InputRequiredLegendProps>) => void;
13
+ export default _default;
@@ -0,0 +1,29 @@
1
+ import type { LumxClassName, HasTheme, HasClassName, CommonRef } from '../../types';
2
+ export declare const COMPONENT_NAME = "InputRequiredLegend";
3
+ export declare const InputRequiredLegendClassName: LumxClassName<typeof COMPONENT_NAME>;
4
+ /**
5
+ * Defines the props of the component.
6
+ */
7
+ export interface InputRequiredLegendProps extends HasClassName, HasTheme {
8
+ /**
9
+ * Legend text explaining the required field marker (ex: "Indicates a required field").
10
+ * The marker (`*`) is rendered by the component before this text.
11
+ */
12
+ label: string;
13
+ /** ref to the root element `p` */
14
+ ref?: CommonRef;
15
+ /** id for the legend */
16
+ id?: string;
17
+ }
18
+ /**
19
+ * InputRequiredLegend component.
20
+ *
21
+ * Explains the required field marker (`*`) displayed by `InputLabel` with `isRequired`.
22
+ * Place it at the top of a form that contains required fields.
23
+ */
24
+ export declare function InputRequiredLegend(props: InputRequiredLegendProps): import("react").JSX.Element;
25
+ export declare namespace InputRequiredLegend {
26
+ var displayName: string;
27
+ var className: "lumx-input-required-legend";
28
+ var defaultProps: Partial<InputRequiredLegendProps>;
29
+ }
@@ -216,7 +216,10 @@ export interface BaseSelectTextFieldWrapperProps<O> extends Pick<BaseSelectProps
216
216
  icon?: string;
217
217
  /** Disabled state. */
218
218
  isDisabled?: boolean;
219
- /** Required field indicator. */
219
+ /**
220
+ * Required field indicator. Marks the label and sets `aria-required` on the input.
221
+ * The native `required` attribute is not used: the input text is not the field value.
222
+ */
220
223
  isRequired?: boolean;
221
224
  /** Error state flag. */
222
225
  hasError?: boolean;
package/lumx.css CHANGED
@@ -7979,7 +7979,7 @@ table {
7979
7979
  .lumx-input-label--is-required::before {
7980
7980
  margin-right: 4px;
7981
7981
  font-weight: 700;
7982
- content: "*";
7982
+ content: "*"/"";
7983
7983
  }
7984
7984
  .lumx-input-label--theme-light {
7985
7985
  display: block;
@@ -8045,6 +8045,31 @@ table {
8045
8045
  text-transform: uppercase;
8046
8046
  }
8047
8047
 
8048
+ /* ==========================================================================
8049
+ Input required legend
8050
+ ========================================================================== */
8051
+ .lumx-input-required-legend__marker {
8052
+ margin-right: 4px;
8053
+ font-weight: 700;
8054
+ }
8055
+ .lumx-input-required-legend--theme-light {
8056
+ display: block;
8057
+ font-size: var(--lumx-material-input-helper-font-size);
8058
+ font-weight: var(--lumx-material-input-helper-font-weight);
8059
+ line-height: var(--lumx-material-input-helper-line-height);
8060
+ color: var(--lumx-color-dark-L2);
8061
+ }
8062
+ .lumx-input-required-legend--theme-light .lumx-input-required-legend__marker {
8063
+ color: var(--lumx-color-red-N);
8064
+ }
8065
+ .lumx-input-required-legend--theme-dark {
8066
+ display: block;
8067
+ font-size: var(--lumx-material-input-helper-font-size);
8068
+ font-weight: var(--lumx-material-input-helper-font-weight);
8069
+ line-height: var(--lumx-material-input-helper-line-height);
8070
+ color: var(--lumx-color-light-L2);
8071
+ }
8072
+
8048
8073
  /* ==========================================================================
8049
8074
  Lightbox
8050
8075
  ========================================================================== */
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.23.0",
10
+ "@lumx/icons": "^4.24.0-next.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.23.0",
69
+ "version": "4.24.0-next.0",
70
70
  "devDependencies": {
71
71
  "@rollup/plugin-typescript": "^12.3.0",
72
72
  "@testing-library/dom": "^10.4.1",
@@ -89,5 +89,6 @@
89
89
  "vite": "^7.3.5",
90
90
  "vite-tsconfig-paths": "^5.1.4",
91
91
  "vitest": "^4.1.11"
92
- }
92
+ },
93
+ "stableVersion": "4.23.0"
93
94
  }
@@ -23,6 +23,7 @@
23
23
  @import "./components/inline-list/index";
24
24
  @import "./components/input-helper/index";
25
25
  @import "./components/input-label/index";
26
+ @import "./components/input-required-legend/index";
26
27
  @import "./components/lightbox/index";
27
28
  @import "./components/link/index";
28
29
  @import "./components/link-preview/index";
@@ -6,7 +6,10 @@
6
6
  &--is-required::before {
7
7
  margin-right: $lumx-spacing-unit-tiny;
8
8
  font-weight: 700;
9
- content: "*";
9
+
10
+ // Empty alternative text: hides the marker from assistive technologies
11
+ // (the `required` attribute of the field already carries the state)
12
+ content: "*" / "";
10
13
  }
11
14
 
12
15
  &--theme-light {
@@ -0,0 +1,22 @@
1
+ /* ==========================================================================
2
+ Input required legend
3
+ ========================================================================== */
4
+
5
+ .#{$lumx-base-prefix}-input-required-legend {
6
+ &__marker {
7
+ margin-right: $lumx-spacing-unit-tiny;
8
+ font-weight: 700;
9
+ }
10
+
11
+ &--theme-light {
12
+ @include lumx-input-helper(lumx-base-const("theme", "LIGHT"));
13
+
14
+ .#{$lumx-base-prefix}-input-required-legend__marker {
15
+ color: lumx-color-variant("red", "N");
16
+ }
17
+ }
18
+
19
+ &--theme-dark {
20
+ @include lumx-input-helper(lumx-base-const("theme", "DARK"));
21
+ }
22
+ }