ux4g-components-web 1.0.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.
@@ -0,0 +1,144 @@
1
+ export type ButtonVariant = 'primary' | 'outline-primary' | 'text-primary' | 'tonal-primary' | 'danger' | 'outline-danger' | 'text-danger' | 'tonal-danger';
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;
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "ux4g-components-web",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "description": "UX4G Design System — CSS bundle, design tokens, utilities, and shared Class_Builder types",
6
+ "scripts": {
7
+ "build:css": "node scripts/build-css.mjs",
8
+ "build:types": "rollup -c rollup.config.mjs",
9
+ "build": "npm run build:css && npm run build:types",
10
+ "prepublishOnly": "npm run build",
11
+ "test": "jest"
12
+ },
13
+ "exports": {
14
+ "./styles.css": {
15
+ "default": "./styles/ux4g.css"
16
+ },
17
+ "./types": {
18
+ "types": "./dist/types/index.d.ts",
19
+ "import": "./dist/types/index.mjs",
20
+ "require": "./dist/types/index.cjs",
21
+ "default": "./dist/types/index.mjs"
22
+ }
23
+ },
24
+ "typesVersions": {
25
+ "*": {
26
+ "types": [
27
+ "./dist/types/index.d.ts"
28
+ ]
29
+ }
30
+ },
31
+ "files": [
32
+ "styles/ux4g.css",
33
+ "styles/cascade-fixes.css",
34
+ "dist/"
35
+ ],
36
+ "devDependencies": {
37
+ "@rollup/plugin-typescript": "^12.0.0",
38
+ "@types/jest": "^29.5.14",
39
+ "cssnano": "^7.0.0",
40
+ "fast-check": "^3.23.2",
41
+ "jest": "^29.7.0",
42
+ "postcss": "^8.4.0",
43
+ "postcss-import": "^16.1.1",
44
+ "postcss-url": "^10.1.3",
45
+ "rollup": "^4.0.0",
46
+ "ts-jest": "^29.4.9",
47
+ "tslib": "^2.8.1",
48
+ "typescript": "^5.6.3"
49
+ }
50
+ }
@@ -0,0 +1,52 @@
1
+ /*
2
+ * UX4G Cascade Fixes
3
+ * ─────────────────────────────────────────────────────────────────────────────
4
+ * Single file for ALL vendor CSS source-order conflicts.
5
+ * Imported LAST in build-css.mjs — after all vendor component CSS.
6
+ *
7
+ * WHY THIS EXISTS
8
+ * ───────────────
9
+ * The vendor CSS sometimes declares dimensional properties (min-height, width,
10
+ * padding) on variant/color classes that appear AFTER size classes in source
11
+ * order. Since all are single-class selectors with equal specificity (0,1,0),
12
+ * the variant rule wins via cascade — overriding the size class.
13
+ *
14
+ * FIX PATTERN
15
+ * ───────────
16
+ * Re-declare the size values here using a doubled selector (0,2,0 specificity)
17
+ * so they always beat any single-class variant rule, regardless of source order.
18
+ *
19
+ * .ux4g-btn-sm.ux4g-btn-sm { min-height: 32px; }
20
+ *
21
+ * RULES
22
+ * ─────
23
+ * 1. Never modify vendor CSS directly
24
+ * 2. All cascade conflict fixes go HERE — not in per-component files
25
+ * 3. When adding a new component, audit its CSS for this pattern and add fixes here
26
+ * 4. Document each fix with the component name and the conflicting selectors
27
+ *
28
+ * ─────────────────────────────────────────────────────────────────────────────
29
+ */
30
+
31
+
32
+ /* ── BUTTON ──────────────────────────────────────────────────────────────────
33
+ * Conflict: .ux4g-btn-primary / .ux4g-btn-danger etc. declare min-height: 40px
34
+ * and appear AFTER .ux4g-btn-sm / .ux4g-btn-xs in button.css source order.
35
+ * Result: size classes lose — all buttons render at 40px regardless of size.
36
+ * Fix: doubled selector (0,2,0) beats variant (0,1,0).
37
+ */
38
+ .ux4g-btn-xl.ux4g-btn-xl { min-height: 56px; }
39
+ .ux4g-btn-lg.ux4g-btn-lg { min-height: 48px; }
40
+ .ux4g-btn-md.ux4g-btn-md { min-height: 40px; }
41
+ .ux4g-btn-sm.ux4g-btn-sm { min-height: 32px; }
42
+ .ux4g-btn-xs.ux4g-btn-xs { min-height: 24px; }
43
+
44
+ /*
45
+ * ── ADD NEW COMPONENT FIXES BELOW ────────────────────────────────────────────
46
+ * Format:
47
+ *
48
+ * // ── COMPONENT_NAME ────────────────────────────────────────────────────────
49
+ * // Conflict: .ux4g-xxx-variant declares YYY after .ux4g-xxx-size in source
50
+ * // Fix: doubled selector
51
+ * .ux4g-xxx-sm.ux4g-xxx-sm { property: value; }
52
+ */