ux4g-components-web 1.4.1 → 1.5.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/README.md +76 -0
- package/dist/__tests__/css-bundle.integration.test.d.ts +11 -0
- package/dist/__tests__/css-bundle.integration.test.js +1102 -0
- package/dist/__tests__/css-bundle.phase10.property.test.d.ts +9 -0
- package/dist/__tests__/css-bundle.phase10.property.test.js +64 -0
- package/dist/__tests__/css-bundle.phase5.property.test.d.ts +9 -0
- package/dist/__tests__/css-bundle.phase5.property.test.js +126 -0
- package/dist/__tests__/css-bundle.phase6.property.test.d.ts +9 -0
- package/dist/__tests__/css-bundle.phase6.property.test.js +73 -0
- package/dist/__tests__/css-bundle.phase7.property.test.d.ts +9 -0
- package/dist/__tests__/css-bundle.phase7.property.test.js +76 -0
- package/dist/__tests__/css-bundle.phase8.property.test.d.ts +9 -0
- package/dist/__tests__/css-bundle.phase8.property.test.js +67 -0
- package/dist/__tests__/css-bundle.phase9.property.test.d.ts +9 -0
- package/dist/__tests__/css-bundle.phase9.property.test.js +93 -0
- package/dist/__tests__/css-bundle.property.test.d.ts +14 -0
- package/dist/__tests__/css-bundle.property.test.js +393 -0
- package/dist/__tests__/dom-generators.determinism.property.test.d.ts +1 -0
- package/dist/__tests__/dom-generators.determinism.property.test.js +71 -0
- package/dist/__tests__/dom-generators.id.property.test.d.ts +1 -0
- package/dist/__tests__/dom-generators.id.property.test.js +99 -0
- package/dist/__tests__/dom-generators.otp.property.test.d.ts +1 -0
- package/dist/__tests__/dom-generators.property.test.d.ts +1 -0
- package/dist/__tests__/dom-generators.property.test.js +205 -0
- package/dist/__tests__/dom-generators.states.property.test.d.ts +1 -0
- package/dist/__tests__/dom-generators.table.property.test.d.ts +1 -0
- package/dist/__tests__/dom-generators.tier1.property.test.d.ts +1 -0
- package/dist/__tests__/dom-generators.tier1.property.test.js +403 -0
- package/dist/__tests__/dom-generators.validation.property.test.d.ts +1 -0
- package/dist/__tests__/dom-generators.validation.property.test.js +327 -0
- package/dist/__tests__/megamenu.classbuilder.property.test.d.ts +1 -0
- package/dist/__tests__/megamenu.classbuilder.property.test.js +88 -0
- package/dist/__tests__/smoke.test.d.ts +1 -0
- package/dist/__tests__/smoke.test.js +65 -0
- package/dist/__tests__/types.phase10.property.test.d.ts +1 -0
- package/dist/__tests__/types.phase10.property.test.js +166 -0
- package/dist/__tests__/types.phase10.test.d.ts +1 -0
- package/dist/__tests__/types.phase10.test.js +76 -0
- package/dist/__tests__/types.phase3.property.test.d.ts +1 -0
- package/dist/__tests__/types.phase3.property.test.js +83 -0
- package/dist/__tests__/types.phase3.test.d.ts +1 -0
- package/dist/__tests__/types.phase3.test.js +76 -0
- package/dist/__tests__/types.phase4.property.test.d.ts +1 -0
- package/dist/__tests__/types.phase4.property.test.js +119 -0
- package/dist/__tests__/types.phase4.test.d.ts +1 -0
- package/dist/__tests__/types.phase4.test.js +70 -0
- package/dist/__tests__/types.phase5.property.test.d.ts +1 -0
- package/dist/__tests__/types.phase5.property.test.js +120 -0
- package/dist/__tests__/types.phase5.test.d.ts +1 -0
- package/dist/__tests__/types.phase5.test.js +64 -0
- package/dist/__tests__/types.phase6.property.test.d.ts +1 -0
- package/dist/__tests__/types.phase6.property.test.js +189 -0
- package/dist/__tests__/types.phase6.test.d.ts +1 -0
- package/dist/__tests__/types.phase6.test.js +121 -0
- package/dist/__tests__/types.phase7.property.test.d.ts +1 -0
- package/dist/__tests__/types.phase7.property.test.js +217 -0
- package/dist/__tests__/types.phase7.test.d.ts +1 -0
- package/dist/__tests__/types.phase7.test.js +106 -0
- package/dist/__tests__/types.phase8.property.test.d.ts +1 -0
- package/dist/__tests__/types.phase8.property.test.js +224 -0
- package/dist/__tests__/types.phase8.test.d.ts +1 -0
- package/dist/__tests__/types.phase8.test.js +114 -0
- package/dist/__tests__/types.phase9.property.test.d.ts +1 -0
- package/dist/__tests__/types.phase9.property.test.js +347 -0
- package/dist/__tests__/types.phase9.test.d.ts +1 -0
- package/dist/__tests__/types.phase9.test.js +226 -0
- package/dist/__tests__/types.restructure.property.test.d.ts +1 -0
- package/dist/__tests__/types.restructure.property.test.js +76 -0
- package/dist/__tests__/types.test.d.ts +1 -0
- package/dist/__tests__/types.test.js +175 -0
- package/dist/dom-generators/accordion.d.ts +23 -0
- package/dist/dom-generators/avatar.d.ts +19 -0
- package/dist/dom-generators/carousel.d.ts +20 -0
- package/dist/dom-generators/chip.d.ts +18 -0
- package/dist/dom-generators/combobox.d.ts +28 -0
- package/dist/dom-generators/date-picker.d.ts +19 -0
- package/dist/dom-generators/dom-generators/accordion.d.ts +21 -0
- package/dist/dom-generators/dom-generators/avatar.d.ts +17 -0
- package/dist/dom-generators/dom-generators/carousel.d.ts +19 -0
- package/dist/dom-generators/dom-generators/chip.d.ts +16 -0
- package/dist/dom-generators/dom-generators/combobox.d.ts +26 -0
- package/dist/dom-generators/dom-generators/date-picker.d.ts +18 -0
- package/dist/dom-generators/dom-generators/drawer.d.ts +17 -0
- package/dist/dom-generators/dom-generators/dropdown.d.ts +26 -0
- package/dist/dom-generators/dom-generators/file-upload.d.ts +20 -0
- package/dist/dom-generators/dom-generators/id-generator.d.ts +9 -0
- package/dist/dom-generators/dom-generators/index.d.ts +27 -0
- package/dist/dom-generators/dom-generators/modal.d.ts +19 -0
- package/dist/dom-generators/dom-generators/otp.d.ts +16 -0
- package/dist/dom-generators/dom-generators/popover.d.ts +17 -0
- package/dist/dom-generators/dom-generators/progress.d.ts +16 -0
- package/dist/dom-generators/dom-generators/search.d.ts +20 -0
- package/dist/dom-generators/dom-generators/stepper.d.ts +21 -0
- package/dist/dom-generators/dom-generators/table.d.ts +23 -0
- package/dist/dom-generators/dom-generators/tabs.d.ts +21 -0
- package/dist/dom-generators/dom-generators/time-picker.d.ts +18 -0
- package/dist/dom-generators/dom-generators/tooltip.d.ts +17 -0
- package/dist/dom-generators/dom-generators/types.d.ts +27 -0
- package/dist/dom-generators/dom-generators/validate.d.ts +20 -0
- package/dist/dom-generators/drawer.d.ts +19 -0
- package/dist/dom-generators/dropdown.d.ts +28 -0
- package/dist/dom-generators/file-upload.d.ts +22 -0
- package/dist/dom-generators/id-generator.d.ts +9 -0
- package/dist/dom-generators/index.bundled.d.ts +654 -0
- package/dist/dom-generators/index.cjs +2029 -0
- package/dist/dom-generators/index.d.ts +27 -0
- package/dist/dom-generators/index.mjs +2001 -0
- package/dist/dom-generators/modal.d.ts +21 -0
- package/dist/dom-generators/otp.d.ts +18 -0
- package/dist/dom-generators/popover.d.ts +19 -0
- package/dist/dom-generators/progress.d.ts +18 -0
- package/dist/dom-generators/search.d.ts +22 -0
- package/dist/dom-generators/stepper.d.ts +23 -0
- package/dist/dom-generators/table.d.ts +25 -0
- package/dist/dom-generators/tabs.d.ts +23 -0
- package/dist/dom-generators/time-picker.d.ts +19 -0
- package/dist/dom-generators/tooltip.d.ts +19 -0
- package/dist/dom-generators/types.d.ts +155 -0
- package/dist/dom-generators/validate.d.ts +20 -0
- package/dist/runtime/bootstrap.js +59 -0
- package/dist/runtime/index.js +55 -0
- package/dist/types.d.ts +155 -0
- package/dist/types.js +552 -0
- package/package.json +12 -2
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { NodeDescriptor } from './types';
|
|
2
|
+
import { ModalSize, ModalOpacity } from '../types.js';
|
|
3
|
+
export interface ModalGeneratorProps {
|
|
4
|
+
open?: boolean;
|
|
5
|
+
size?: ModalSize;
|
|
6
|
+
title?: string;
|
|
7
|
+
closable?: boolean;
|
|
8
|
+
backdropOpacity?: ModalOpacity;
|
|
9
|
+
backdropBlur?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Generates a complete Modal DOM descriptor tree.
|
|
13
|
+
*
|
|
14
|
+
* Produces a backdrop element and a modal dialog box with `role="dialog"`,
|
|
15
|
+
* `aria-modal="true"`, an optional close button with `data-ux4g-modal-close`,
|
|
16
|
+
* and an optional title heading. Compatible with Runtime_JS
|
|
17
|
+
* MutationObserver-based initialization.
|
|
18
|
+
*/
|
|
19
|
+
export declare function generateModalDOM(props: ModalGeneratorProps): NodeDescriptor;
|
|
20
|
+
|
|
21
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { NodeDescriptor } from './types';
|
|
2
|
+
import { OtpInputState } from '../types.js';
|
|
3
|
+
export interface OtpGeneratorProps {
|
|
4
|
+
length: number;
|
|
5
|
+
values?: string[];
|
|
6
|
+
state?: OtpInputState;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Generates a complete OTP Input DOM descriptor tree.
|
|
11
|
+
*
|
|
12
|
+
* Produces individual `<input>` cells each accepting a single character,
|
|
13
|
+
* with maxLength=1. The root container gets CSS classes from `buildOtpInputClasses(state)`.
|
|
14
|
+
* When disabled, each cell receives `aria-disabled="true"` and `disabled=true`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function generateOtpDOM(props: OtpGeneratorProps): NodeDescriptor;
|
|
17
|
+
|
|
18
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { NodeDescriptor } from './types';
|
|
2
|
+
import { PopoverPlacement } from '../types.js';
|
|
3
|
+
export interface PopoverGeneratorProps {
|
|
4
|
+
placement?: PopoverPlacement;
|
|
5
|
+
show?: boolean;
|
|
6
|
+
triggerId?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Generates a complete Popover DOM descriptor tree.
|
|
10
|
+
*
|
|
11
|
+
* Produces a trigger wrapper element with `data-ux4g-popover` and
|
|
12
|
+
* `aria-describedby` referencing the popover content container.
|
|
13
|
+
* The popover container uses CSS classes from `buildPopoverClasses()`
|
|
14
|
+
* for placement and visibility. Compatible with Runtime_JS
|
|
15
|
+
* MutationObserver-based initialization.
|
|
16
|
+
*/
|
|
17
|
+
export declare function generatePopoverDOM(props: PopoverGeneratorProps): NodeDescriptor;
|
|
18
|
+
|
|
19
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { NodeDescriptor } from './types';
|
|
2
|
+
import { ProgressIndicatorType, ProgressIndicatorSize } from '../types.js';
|
|
3
|
+
export interface ProgressGeneratorProps {
|
|
4
|
+
value: number;
|
|
5
|
+
type?: ProgressIndicatorType;
|
|
6
|
+
size?: ProgressIndicatorSize;
|
|
7
|
+
label?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Generates a complete Progress Indicator DOM descriptor tree.
|
|
11
|
+
*
|
|
12
|
+
* Produces a progress element with `role="progressbar"`,
|
|
13
|
+
* `aria-valuenow`, `aria-valuemin`, and `aria-valuemax`.
|
|
14
|
+
* Supports both 'bar' and 'circle' visualization types.
|
|
15
|
+
*/
|
|
16
|
+
export declare function generateProgressDOM(props: ProgressGeneratorProps): NodeDescriptor;
|
|
17
|
+
|
|
18
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { NodeDescriptor } from './types';
|
|
2
|
+
import { SearchSize } from '../types.js';
|
|
3
|
+
export interface SearchGeneratorProps {
|
|
4
|
+
value?: string;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
suggestions?: Array<{
|
|
7
|
+
label: string;
|
|
8
|
+
value: string;
|
|
9
|
+
}>;
|
|
10
|
+
showSuggestions?: boolean;
|
|
11
|
+
size?: SearchSize;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Generates a complete Search DOM descriptor tree.
|
|
15
|
+
*
|
|
16
|
+
* Produces a search input with `role="searchbox"`, a clear button visible when
|
|
17
|
+
* there is a value, and a suggestions listbox with `role="listbox"`.
|
|
18
|
+
* Compatible with Runtime_JS MutationObserver-based initialization.
|
|
19
|
+
*/
|
|
20
|
+
export declare function generateSearchDOM(props: SearchGeneratorProps): NodeDescriptor;
|
|
21
|
+
|
|
22
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { NodeDescriptor } from './types';
|
|
2
|
+
import { StepperOrientation, StepperVariant, StepperSize } from '../types.js';
|
|
3
|
+
export interface StepperGeneratorProps {
|
|
4
|
+
steps: Array<{
|
|
5
|
+
label: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
}>;
|
|
8
|
+
activeStep: number;
|
|
9
|
+
orientation?: StepperOrientation;
|
|
10
|
+
variant?: StepperVariant;
|
|
11
|
+
size?: StepperSize;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Generates a complete Stepper DOM descriptor tree.
|
|
15
|
+
*
|
|
16
|
+
* Produces step indicators with completed/current/pending states.
|
|
17
|
+
* Steps before `activeStep` are marked as completed, the step at
|
|
18
|
+
* `activeStep` has `aria-current="step"`, and subsequent steps
|
|
19
|
+
* are marked as pending.
|
|
20
|
+
*/
|
|
21
|
+
export declare function generateStepperDOM(props: StepperGeneratorProps): NodeDescriptor;
|
|
22
|
+
|
|
23
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { NodeDescriptor } from './types';
|
|
2
|
+
import { TableSize, TableDivider, TableZebra } from '../types.js';
|
|
3
|
+
export interface TableGeneratorProps {
|
|
4
|
+
columns: Array<{
|
|
5
|
+
key: string;
|
|
6
|
+
label: string;
|
|
7
|
+
sortable?: boolean;
|
|
8
|
+
width?: string;
|
|
9
|
+
}>;
|
|
10
|
+
data: Array<Record<string, unknown>>;
|
|
11
|
+
size?: TableSize;
|
|
12
|
+
divider?: TableDivider;
|
|
13
|
+
zebra?: TableZebra;
|
|
14
|
+
interactive?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Generates a complete Table DOM descriptor tree.
|
|
18
|
+
*
|
|
19
|
+
* Produces a `<table>` with `<thead>` containing one `<th>` per column
|
|
20
|
+
* and `<tbody>` containing one `<tr>` per data row, each with one `<td>` per column.
|
|
21
|
+
* Sortable columns receive `aria-sort="none"` on their `<th>`.
|
|
22
|
+
*/
|
|
23
|
+
export declare function generateTableDOM(props: TableGeneratorProps): NodeDescriptor;
|
|
24
|
+
|
|
25
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { NodeDescriptor } from './types';
|
|
2
|
+
import { TabVariant, TabSize } from '../types.js';
|
|
3
|
+
export interface TabsGeneratorProps {
|
|
4
|
+
tabs: Array<{
|
|
5
|
+
label: string;
|
|
6
|
+
content: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}>;
|
|
9
|
+
activeIndex?: number;
|
|
10
|
+
variant?: TabVariant;
|
|
11
|
+
size?: TabSize;
|
|
12
|
+
vertical?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Generates a complete Tabs DOM descriptor tree.
|
|
16
|
+
*
|
|
17
|
+
* Produces a tablist container with `role="tablist"`, individual tabs with
|
|
18
|
+
* `role="tab"` and `aria-selected`, and corresponding panels with
|
|
19
|
+
* `role="tabpanel"` and `aria-labelledby`.
|
|
20
|
+
*/
|
|
21
|
+
export declare function generateTabsDOM(props: TabsGeneratorProps): NodeDescriptor;
|
|
22
|
+
|
|
23
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { NodeDescriptor } from './types';
|
|
2
|
+
export interface TimePickerGeneratorProps {
|
|
3
|
+
value?: string;
|
|
4
|
+
min?: string;
|
|
5
|
+
max?: string;
|
|
6
|
+
step?: number;
|
|
7
|
+
format?: '12h' | '24h';
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Generates a complete TimePicker DOM descriptor tree.
|
|
11
|
+
*
|
|
12
|
+
* Produces hour, minute, and (for 12h format) period spinbutton elements
|
|
13
|
+
* with appropriate ARIA attributes: `role="spinbutton"`, `aria-valuemin`,
|
|
14
|
+
* `aria-valuemax`, `aria-valuenow`, and `aria-label`.
|
|
15
|
+
*
|
|
16
|
+
* The root element uses CSS classes from `buildDateTimePickerClasses('time')`.
|
|
17
|
+
*/
|
|
18
|
+
export declare function generateTimePickerDOM(props: TimePickerGeneratorProps): NodeDescriptor;
|
|
19
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { NodeDescriptor } from './types';
|
|
2
|
+
import { TooltipPlacement, TooltipSize } from '../types.js';
|
|
3
|
+
export interface TooltipGeneratorProps {
|
|
4
|
+
text: string;
|
|
5
|
+
placement?: TooltipPlacement;
|
|
6
|
+
size?: TooltipSize;
|
|
7
|
+
triggerId?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Generates a complete Tooltip DOM descriptor tree.
|
|
11
|
+
*
|
|
12
|
+
* Produces a tooltip container with `role="tooltip"`, an arrow element,
|
|
13
|
+
* `data-ux4g-tooltip` on the trigger element, `data-placement` for positioning,
|
|
14
|
+
* and `aria-describedby` on the trigger referencing the tooltip ID.
|
|
15
|
+
* Compatible with Runtime_JS MutationObserver-based initialization.
|
|
16
|
+
*/
|
|
17
|
+
export declare function generateTooltipDOM(props: TooltipGeneratorProps): NodeDescriptor;
|
|
18
|
+
|
|
19
|
+
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
export type ButtonVariant = 'primary' | 'outline-primary' | 'text-primary' | 'tonal-primary' | 'danger' | 'outline-danger' | 'text-danger' | 'tonal-danger' | 'outline-neutral' | 'text-neutral';
|
|
2
|
+
export type ButtonSize = 'xl' | 'lg' | 'md' | 'sm' | 'xs';
|
|
3
|
+
export type ButtonShape = 'rectangle' | 'pill';
|
|
4
|
+
export declare const VARIANT_CLASS_MAP: Record<ButtonVariant, string>;
|
|
5
|
+
export declare const SIZE_CLASS_MAP: Record<ButtonSize, string | null>;
|
|
6
|
+
export declare function buildButtonClasses(variant: ButtonVariant, size: ButtonSize, disabled: boolean, loading: boolean, shape?: ButtonShape, extra?: string): string;
|
|
7
|
+
export type SpinnerVariant = 'primary' | 'inverse' | 'danger';
|
|
8
|
+
export type SpinnerSize = 'xl' | 'lg' | 'md' | 'sm' | 'xs';
|
|
9
|
+
export type SpinnerType = 'full' | 'split' | 'partial';
|
|
10
|
+
export declare const SPINNER_VARIANT_CLASS_PART: Record<SpinnerVariant, string>;
|
|
11
|
+
export declare const SPINNER_SIZE_CLASS_PART: Record<SpinnerSize, string>;
|
|
12
|
+
export declare const SPINNER_TYPE_CLASS_PART: Record<SpinnerType, string>;
|
|
13
|
+
/** Returns the CSS class(es) for a spinner.
|
|
14
|
+
* Base class: `ux4g-spinner-{variant}-{type}` (always present)
|
|
15
|
+
* Size class: `ux4g-spinner-{size}` (omitted when size is 'md' — the default)
|
|
16
|
+
* e.g. `ux4g-spinner-primary-full` (md default)
|
|
17
|
+
* `ux4g-spinner-primary-full ux4g-spinner-xl` (xl size)
|
|
18
|
+
*/
|
|
19
|
+
export declare function buildSpinnerClasses(variant: SpinnerVariant, size: SpinnerSize, type: SpinnerType, extra?: string): string;
|
|
20
|
+
export type LinkVariant = 'default' | 'neutral';
|
|
21
|
+
export type LinkSize = 'sm' | 'md';
|
|
22
|
+
export declare function buildLinkClasses(variant: LinkVariant, size: LinkSize, extra?: string): string;
|
|
23
|
+
export type BadgeType = 'dot' | 'icon' | 'digit';
|
|
24
|
+
export type BadgeColor = 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'secondary' | 'tertiary' | 'neutral';
|
|
25
|
+
export type BadgeSize = 's' | 'm' | 'l' | 'profile-l' | 'profile-xl' | 'profile-2xl' | 'profile-3xl';
|
|
26
|
+
export declare function buildBadgeClasses(type: BadgeType, color: BadgeColor, size?: BadgeSize, extra?: string): string;
|
|
27
|
+
export type AvatarType = 'status' | 'profile' | 'group';
|
|
28
|
+
export type AvatarSize = 'xs' | 's' | 'm' | 'l' | 'xl' | '2xl' | '3xl';
|
|
29
|
+
export declare function buildAvatarClasses(avatarType: AvatarType, size?: AvatarSize, extra?: string): string;
|
|
30
|
+
export type ImageRatio = '1-1' | '4-3' | '3-2' | '16-10' | '16-9' | '2-1' | '5-2' | '3-1' | '1-16' | '2-3' | '3-4';
|
|
31
|
+
export type ImageOverlayPosition = 'bottom' | 'top';
|
|
32
|
+
export declare function buildImageContainerClasses(ratio?: ImageRatio, rounded?: boolean, overlay?: boolean, extra?: string): string;
|
|
33
|
+
export type ChipType = 'filter' | 'choice' | 'input';
|
|
34
|
+
export type ChipSize = 'md' | 'sm' | 'xs';
|
|
35
|
+
export declare function buildChipClasses(chipType: ChipType, size: ChipSize, active?: boolean, extra?: string): string;
|
|
36
|
+
export type TagVariant = 'tonal' | 'filled' | 'outline' | 'text';
|
|
37
|
+
export type TagColor = 'neutral' | 'brand' | 'success' | 'warning' | 'error' | 'info';
|
|
38
|
+
export declare function buildTagClasses(variant: TagVariant, color: TagColor, small?: boolean, extra?: string): string;
|
|
39
|
+
export type DividerOrientation = 'horizontal' | 'vertical';
|
|
40
|
+
export declare function buildDividerClasses(orientation: DividerOrientation, extra?: string): string;
|
|
41
|
+
export type BreadcrumbSeparator = 'divider' | 'icon';
|
|
42
|
+
export declare function buildBreadcrumbClasses(separator: BreadcrumbSeparator, extra?: string): string;
|
|
43
|
+
export type CheckboxSize = 'sm' | 'md' | 'lg';
|
|
44
|
+
export declare function buildCheckboxClasses(size: CheckboxSize, error?: boolean, extra?: string): string;
|
|
45
|
+
export type RadioSize = 'sm' | 'md' | 'lg';
|
|
46
|
+
export declare function buildRadioClasses(size: RadioSize, error?: boolean, extra?: string): string;
|
|
47
|
+
export type SwitchSize = 'sm' | 'md' | 'lg';
|
|
48
|
+
export declare function buildSwitchClasses(size: SwitchSize, extra?: string): string;
|
|
49
|
+
export type CardVariant = 'solid' | 'outline' | 'no-fill';
|
|
50
|
+
export type CardLayout = 'vertical' | 'horizontal';
|
|
51
|
+
export declare function buildCardClasses(variant: CardVariant, layout: CardLayout, extra?: string): string;
|
|
52
|
+
export type InputSize = 'sm' | 'md' | 'lg' | 'xl';
|
|
53
|
+
export type InputState = 'default' | 'error' | 'success' | 'warning';
|
|
54
|
+
export declare function buildInputContainerClasses(size: InputSize, state: InputState, extra?: string): string;
|
|
55
|
+
export type ListVariant = 'default' | 'error' | 'success' | 'warning';
|
|
56
|
+
export type ListSize = 's' | 'm' | 'l' | 'xl';
|
|
57
|
+
export declare function buildListClasses(variant: ListVariant, size: ListSize, extra?: string): string;
|
|
58
|
+
export type DropdownType = 'selection' | 'button' | 'overflow';
|
|
59
|
+
export type DropdownMode = 'single' | 'multi';
|
|
60
|
+
export type DropdownSize = 'sm' | 'md' | 'lg';
|
|
61
|
+
export type DropdownState = 'default' | 'error' | 'success' | 'warning';
|
|
62
|
+
export declare function buildDropdownClasses(type: DropdownType, mode: DropdownMode, size: DropdownSize, state: DropdownState, open?: boolean, extra?: string): string;
|
|
63
|
+
export type ComboboxType = 'single' | 'multi';
|
|
64
|
+
export type ComboboxSize = 'sm' | 'md' | 'lg';
|
|
65
|
+
export type ComboboxState = 'default' | 'error' | 'success' | 'warning';
|
|
66
|
+
export declare function buildComboboxClasses(type: ComboboxType, size: ComboboxSize, state: ComboboxState, open?: boolean, extra?: string): string;
|
|
67
|
+
export type ModalSize = 's' | 'm' | 'l';
|
|
68
|
+
export type ModalOpacity = '25' | '50' | '75';
|
|
69
|
+
export declare function buildModalBackdropClasses(opacity: ModalOpacity, blur?: boolean, open?: boolean, extra?: string): string;
|
|
70
|
+
export declare function buildModalBoxClasses(size: ModalSize, centerContent?: boolean, extra?: string): string;
|
|
71
|
+
export type AlertVariant = 'info' | 'success' | 'warning' | 'error';
|
|
72
|
+
export type AlertLayout = 'fluid' | 'center' | 'wide';
|
|
73
|
+
export type AlertPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
74
|
+
export declare function buildAlertClasses(variant: AlertVariant, layout?: AlertLayout, extra?: string): string;
|
|
75
|
+
export declare function buildContextAlertClasses(variant: AlertVariant, extra?: string): string;
|
|
76
|
+
export declare function buildAlertContainerClasses(position: AlertPosition, extra?: string): string;
|
|
77
|
+
export type SearchSize = 's' | 'm' | 'lg';
|
|
78
|
+
export declare function buildSearchContainerClasses(size: SearchSize, extra?: string): string;
|
|
79
|
+
export type PaginationVariant = 'default' | 'dotted';
|
|
80
|
+
export type PaginationStyle = 'default' | 'solid' | 'translucent';
|
|
81
|
+
export declare function buildPaginationClasses(variant: PaginationVariant, paginationStyle?: PaginationStyle, extra?: string): string;
|
|
82
|
+
export type TableSize = 's' | 'm' | 'lg';
|
|
83
|
+
export type TableDivider = 'row' | 'column' | 'none';
|
|
84
|
+
export type TableZebra = 'none' | 'rows' | 'cols';
|
|
85
|
+
export declare function buildTableClasses(size: TableSize, divider?: TableDivider, zebra?: TableZebra, interactive?: boolean, sortable?: boolean, resizable?: boolean, headerBrand?: boolean, extra?: string): string;
|
|
86
|
+
export type PopoverPlacement = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end';
|
|
87
|
+
export declare function buildPopoverClasses(placement: PopoverPlacement, show?: boolean, extra?: string): string;
|
|
88
|
+
export type TooltipPlacement = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right' | 'left-center' | 'right-center';
|
|
89
|
+
export type TooltipSize = 's' | 'xs';
|
|
90
|
+
export declare function buildTooltipClasses(placement: TooltipPlacement, size: TooltipSize, extra?: string): string;
|
|
91
|
+
export type TabVariant = 'underline' | 'pill';
|
|
92
|
+
export type TabSize = 'sm' | 'md' | 'lg';
|
|
93
|
+
export declare function buildTabClasses(variant: TabVariant, size: TabSize, vertical?: boolean, extra?: string): string;
|
|
94
|
+
export type IconButtonVariant = 'primary' | 'outline-primary' | 'tonal-primary' | 'text-primary';
|
|
95
|
+
export type IconButtonSize = 'xl' | 'lg' | 'md' | 'sm' | 'xs';
|
|
96
|
+
export declare function buildIconButtonClasses(variant: IconButtonVariant, size: IconButtonSize, pill?: boolean, extra?: string): string;
|
|
97
|
+
export declare function buildAccessibilityBarClasses(extra?: string): string;
|
|
98
|
+
export type AccordionArrowPosition = 'right' | 'left';
|
|
99
|
+
export type AccordionVariant = 'default' | 'bordered';
|
|
100
|
+
export declare function buildAccordionClasses(arrowPosition?: AccordionArrowPosition, variant?: AccordionVariant, extra?: string): string;
|
|
101
|
+
export type StepperOrientation = 'horizontal' | 'vertical';
|
|
102
|
+
export type StepperAlignment = 'default' | 'center' | 'left';
|
|
103
|
+
export type StepperVariant = 'default' | 'bottom-line' | 'bottom-line-fill' | 'mobile' | 'progress';
|
|
104
|
+
export type StepperSize = 'default' | 's';
|
|
105
|
+
export declare function buildStepperClasses(orientation?: StepperOrientation, alignment?: StepperAlignment, variant?: StepperVariant, size?: StepperSize, extra?: string): string;
|
|
106
|
+
export type SliderSize = 'sm' | 'md';
|
|
107
|
+
export declare function buildSliderFieldClasses(size?: SliderSize, extra?: string): string;
|
|
108
|
+
export type DrawerPlacement = 'right' | 'left' | 'top' | 'bottom';
|
|
109
|
+
export declare function buildDrawerClasses(placement: DrawerPlacement, open?: boolean, extra?: string): string;
|
|
110
|
+
export type DateTimePickerMode = 'date' | 'time';
|
|
111
|
+
export declare function buildDateTimePickerClasses(mode: DateTimePickerMode, extra?: string): string;
|
|
112
|
+
export type StatusPipelineOrientation = 'horizontal' | 'vertical';
|
|
113
|
+
export type StatusPipelineAlignment = 'default' | 'center' | 'left';
|
|
114
|
+
export type StatusPipelineVariant = 'default' | 'bottom-line' | 'bottom-line-fill' | 'mobile' | 'progress';
|
|
115
|
+
export type StatusPipelineSize = 'default' | 's';
|
|
116
|
+
export declare function buildStatusPipelineClasses(orientation?: StatusPipelineOrientation, alignment?: StatusPipelineAlignment, variant?: StatusPipelineVariant, size?: StatusPipelineSize, extra?: string): string;
|
|
117
|
+
export type JourneyTimelineOrientation = 'vertical' | 'horizontal';
|
|
118
|
+
export declare function buildJourneyTimelineClasses(orientation?: JourneyTimelineOrientation, extra?: string): string;
|
|
119
|
+
export declare function buildFormFieldGroupClasses(extra?: string): string;
|
|
120
|
+
export type OtpInputState = 'default' | 'success' | 'error' | 'locked';
|
|
121
|
+
export declare function buildOtpInputClasses(state?: OtpInputState, extra?: string): string;
|
|
122
|
+
export type FileUploadState = 'default' | 'default-vle' | 'selecting' | 'scanning' | 'uploaded' | 'uploaded-vle' | 'error';
|
|
123
|
+
export declare function buildFileUploadClasses(state?: FileUploadState, extra?: string): string;
|
|
124
|
+
export type ProgressIndicatorType = 'bar' | 'circle';
|
|
125
|
+
export type ProgressIndicatorSize = 'xs' | 's' | 'm' | 'l' | 'xl' | '2xl' | '3xl';
|
|
126
|
+
export declare function buildProgressIndicatorClasses(type: ProgressIndicatorType, extra?: string): string;
|
|
127
|
+
export declare function buildFeedbackClasses(extra?: string): string;
|
|
128
|
+
export type DraftStatusBannerVariant = 'default' | 'auto' | 'success';
|
|
129
|
+
export declare function buildDraftStatusBannerClasses(variant?: DraftStatusBannerVariant, extra?: string): string;
|
|
130
|
+
export type SlaProgressIndicatorType = 'circle' | 'linear' | 'badge';
|
|
131
|
+
export declare function buildSlaProgressIndicatorClasses(type: SlaProgressIndicatorType, extra?: string): string;
|
|
132
|
+
export declare function buildCarouselClasses(extra?: string): string;
|
|
133
|
+
export declare function buildEmptyStateClasses(extra?: string): string;
|
|
134
|
+
export type ChipGroupVariant = 'filter' | 'choice';
|
|
135
|
+
export declare function buildChipGroupClasses(variant?: ChipGroupVariant, active?: boolean, extra?: string): string;
|
|
136
|
+
export declare function buildNavbarClasses(extra?: string): string;
|
|
137
|
+
export type SocialLinksSize = 'sm' | 'md' | 'lg';
|
|
138
|
+
export declare function buildSocialLinksClasses(size?: SocialLinksSize, extra?: string): string;
|
|
139
|
+
export type SlotGridVariant = 'weekly' | 'compact';
|
|
140
|
+
export declare function buildSlotGridClasses(variant?: SlotGridVariant, extra?: string): string;
|
|
141
|
+
export type FooterTheme = 'default' | 'primary' | 'dark';
|
|
142
|
+
export declare function buildFooterClasses(theme?: FooterTheme, extra?: string): string;
|
|
143
|
+
export type ResultListRowVariation = 'default' | 'v1' | 'v2' | 'v3' | 'v4' | 'v5';
|
|
144
|
+
export declare function buildResultListRowClasses(variation?: ResultListRowVariation, extra?: string): string;
|
|
145
|
+
/** Returns the CSS class string for the mega-menu root element.
|
|
146
|
+
* Base class: `ux4g-mega-menu` (always present)
|
|
147
|
+
* Dropdown: `ux4g-mega-menu--dropdown` (when dropdown is true)
|
|
148
|
+
* Right: `ux4g-mega-menu--dropdown-right` (only when BOTH dropdown AND dropdownRight are true)
|
|
149
|
+
*/
|
|
150
|
+
export declare function buildMegaMenuClasses(dropdown?: boolean, dropdownRight?: boolean, extra?: string): string;
|
|
151
|
+
/** Returns the CSS class string for the mega-menu wrapper element (dropdown positioning context).
|
|
152
|
+
* Base class: `ux4g-mega-menu-wrapper` (always present)
|
|
153
|
+
* Active: `ux4g-mega-menu-wrapper--active` (when active is true)
|
|
154
|
+
*/
|
|
155
|
+
export declare function buildMegaMenuWrapperClasses(active?: boolean, extra?: string): string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Throws if the value is null or undefined.
|
|
3
|
+
*/
|
|
4
|
+
export declare function validateRequired(componentName: string, propName: string, value: unknown): void;
|
|
5
|
+
/**
|
|
6
|
+
* Throws if typeof value does not match the expected type string.
|
|
7
|
+
*/
|
|
8
|
+
export declare function validateType(componentName: string, propName: string, value: unknown, expectedType: string): void;
|
|
9
|
+
/**
|
|
10
|
+
* Throws if the value is not a member of the allowed values set.
|
|
11
|
+
*/
|
|
12
|
+
export declare function validateEnum(componentName: string, propName: string, value: unknown, allowedValues: readonly unknown[]): void;
|
|
13
|
+
/**
|
|
14
|
+
* Throws if the numeric value is outside the given [min, max] range (inclusive).
|
|
15
|
+
*/
|
|
16
|
+
export declare function validateRange(componentName: string, propName: string, value: unknown, min: number, max: number): void;
|
|
17
|
+
/**
|
|
18
|
+
* Throws if the value is not an array.
|
|
19
|
+
*/
|
|
20
|
+
export declare function validateArray(componentName: string, propName: string, value: unknown): void;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UX4G Runtime Auto-Bootstrap
|
|
3
|
+
*
|
|
4
|
+
* Side-effect-only module that triggers runtime initialization on import.
|
|
5
|
+
* Framework packages use this as:
|
|
6
|
+
* import 'ux4g-components-web/runtime/bootstrap';
|
|
7
|
+
*
|
|
8
|
+
* Safe to import multiple times — initRuntime() uses a singleton guard
|
|
9
|
+
* (window.__UX4G_RUNTIME_INITIALIZED__) to ensure initialization happens
|
|
10
|
+
* exactly once.
|
|
11
|
+
*
|
|
12
|
+
* Also sets up a MutationObserver that automatically re-runs ux4g.init()
|
|
13
|
+
* when new elements are added to the DOM. This handles frameworks like
|
|
14
|
+
* React and Angular that render components AFTER DOMContentLoaded.
|
|
15
|
+
*/
|
|
16
|
+
import { initRuntime } from './index.js';
|
|
17
|
+
initRuntime();
|
|
18
|
+
// Auto-reinit: watch for new DOM elements and re-run ux4g.init()
|
|
19
|
+
// This fixes the timing issue where Angular/React render after DOMContentLoaded
|
|
20
|
+
if (typeof window !== 'undefined' && typeof MutationObserver !== 'undefined') {
|
|
21
|
+
let reinitTimer = null;
|
|
22
|
+
const observer = new MutationObserver((mutations) => {
|
|
23
|
+
// Check if any added nodes contain UX4G-relevant elements
|
|
24
|
+
let hasNewElements = false;
|
|
25
|
+
for (const mutation of mutations) {
|
|
26
|
+
if (mutation.addedNodes.length > 0) {
|
|
27
|
+
hasNewElements = true;
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (!hasNewElements)
|
|
32
|
+
return;
|
|
33
|
+
// Debounce: wait 50ms after the last mutation before re-initializing
|
|
34
|
+
// This batches rapid DOM changes (e.g., Angular rendering a full template)
|
|
35
|
+
if (reinitTimer)
|
|
36
|
+
clearTimeout(reinitTimer);
|
|
37
|
+
reinitTimer = setTimeout(() => {
|
|
38
|
+
if (window.ux4g?.init) {
|
|
39
|
+
window.ux4g.init(document);
|
|
40
|
+
}
|
|
41
|
+
}, 50);
|
|
42
|
+
});
|
|
43
|
+
// Start observing once the body is available
|
|
44
|
+
const startObserving = () => {
|
|
45
|
+
if (document.body) {
|
|
46
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
// Body not ready yet — wait for it
|
|
50
|
+
setTimeout(startObserving, 10);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
if (document.readyState === 'loading') {
|
|
54
|
+
document.addEventListener('DOMContentLoaded', startObserving);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
startObserving();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UX4G Runtime Module
|
|
3
|
+
*
|
|
4
|
+
* Injects the vendor JS (ux4g.js + ux4g-custom.js) into the page as inline scripts.
|
|
5
|
+
* These files handle all interactive behaviors: dropdowns, modals, tooltips,
|
|
6
|
+
* accordions, carousels, drawers, tabs, popovers, toasts, scrollspy, etc.
|
|
7
|
+
*
|
|
8
|
+
* The vendor JS is inlined at build time by the Rollup virtual plugin.
|
|
9
|
+
* At runtime, initRuntime() creates <script> elements with the inlined code.
|
|
10
|
+
*
|
|
11
|
+
* Uses a singleton guard (window.__UX4G_RUNTIME_INITIALIZED__) to ensure
|
|
12
|
+
* the scripts are injected exactly once.
|
|
13
|
+
*/
|
|
14
|
+
const isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
15
|
+
/**
|
|
16
|
+
* Initialize the UX4G runtime by injecting the vendor JS scripts into the page.
|
|
17
|
+
*
|
|
18
|
+
* - Safe for SSR — no-ops when window/document are unavailable.
|
|
19
|
+
* - Singleton guard prevents double-injection.
|
|
20
|
+
* - The vendor JS handles its own DOMContentLoaded timing internally.
|
|
21
|
+
* - MutationObserver in the vendor JS auto-initializes dynamically added elements.
|
|
22
|
+
*/
|
|
23
|
+
export function initRuntime() {
|
|
24
|
+
if (!isBrowser)
|
|
25
|
+
return;
|
|
26
|
+
if (window.__UX4G_RUNTIME_INITIALIZED__)
|
|
27
|
+
return;
|
|
28
|
+
window.__UX4G_RUNTIME_INITIALIZED__ = true;
|
|
29
|
+
// Inject ux4g.js (sets up window.ux4g with all core components)
|
|
30
|
+
const script1 = document.createElement('script');
|
|
31
|
+
script1.setAttribute('data-ux4g-runtime', 'main');
|
|
32
|
+
script1.textContent = __UX4G_VENDOR_MAIN__;
|
|
33
|
+
document.head.appendChild(script1);
|
|
34
|
+
// Inject ux4g-custom.js (extends window.ux4g with custom behaviors)
|
|
35
|
+
const script2 = document.createElement('script');
|
|
36
|
+
script2.setAttribute('data-ux4g-runtime', 'custom');
|
|
37
|
+
script2.textContent = __UX4G_VENDOR_CUSTOM__;
|
|
38
|
+
document.head.appendChild(script2);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Destroy the UX4G runtime.
|
|
42
|
+
* Removes injected scripts and resets the singleton guard.
|
|
43
|
+
*/
|
|
44
|
+
export function destroyRuntime() {
|
|
45
|
+
if (!isBrowser)
|
|
46
|
+
return;
|
|
47
|
+
// Remove injected scripts
|
|
48
|
+
document.querySelectorAll('script[data-ux4g-runtime]').forEach(el => el.remove());
|
|
49
|
+
// Reset singleton guard
|
|
50
|
+
window.__UX4G_RUNTIME_INITIALIZED__ = undefined;
|
|
51
|
+
// Clear the global ux4g object
|
|
52
|
+
if (window.ux4g) {
|
|
53
|
+
delete window.ux4g;
|
|
54
|
+
}
|
|
55
|
+
}
|