@lablup/ui-common 0.1.0-alpha.2 → 0.1.0-alpha.21
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 +1 -1
- package/dist/assets/components/BaseCard/BaseCard.css +1 -1
- package/dist/assets/components/Button/Button.css +1 -1
- package/dist/assets/components/DataTable/DataTable.css +1 -1
- package/dist/assets/components/Drawer/Drawer.css +1 -1
- package/dist/assets/components/EmptyState/EmptyState.css +1 -1
- package/dist/assets/components/ErrorState/ErrorState.css +1 -1
- package/dist/assets/components/PageHeader/PageHeader.css +1 -1
- package/dist/assets/components/Select/Select.css +1 -0
- package/dist/assets/components/StatCard/StatCard.css +1 -1
- package/dist/assets/components/Tabs/Tabs.css +1 -1
- package/dist/assets/components/Tooltip/Tooltip.css +1 -1
- package/dist/components/DataTable/DataTable.d.ts +50 -6
- package/dist/components/DataTable/DataTable2.js +205 -133
- package/dist/components/DataTable/DataTable2.js.map +1 -1
- package/dist/components/Drawer/Drawer.d.ts +12 -1
- package/dist/components/Drawer/Drawer2.js +69 -51
- package/dist/components/Drawer/Drawer2.js.map +1 -1
- package/dist/components/EmptyState/EmptyState.d.ts +10 -3
- package/dist/components/EmptyState/EmptyState2.js +31 -48
- package/dist/components/EmptyState/EmptyState2.js.map +1 -1
- package/dist/components/EmptyState/index.d.ts +6 -1
- package/dist/components/ErrorState/ErrorState.d.ts +17 -4
- package/dist/components/ErrorState/ErrorState2.js +20 -23
- package/dist/components/ErrorState/ErrorState2.js.map +1 -1
- package/dist/components/ErrorState/index.d.ts +1 -1
- package/dist/components/PageHeader/PageHeader.d.ts +14 -1
- package/dist/components/PageHeader/PageHeader2.js +40 -24
- package/dist/components/PageHeader/PageHeader2.js.map +1 -1
- package/dist/components/Select/Select.d.ts +38 -0
- package/dist/components/Select/Select2.js +313 -0
- package/dist/components/Select/Select2.js.map +1 -0
- package/dist/components/Select/index.d.ts +2 -0
- package/dist/components/Select/index.js +2 -0
- package/dist/components/Skeleton/Skeleton.d.ts +11 -1
- package/dist/components/Skeleton/Skeleton2.js +8 -6
- package/dist/components/Skeleton/Skeleton2.js.map +1 -1
- package/dist/components/Skeleton/SkeletonCard.d.ts +3 -1
- package/dist/components/Skeleton/SkeletonCard2.js +13 -3
- package/dist/components/Skeleton/SkeletonCard2.js.map +1 -1
- package/dist/components/Skeleton/SkeletonChart2.js +5 -0
- package/dist/components/Skeleton/SkeletonChart2.js.map +1 -1
- package/dist/components/Skeleton/SkeletonRow.d.ts +3 -1
- package/dist/components/Skeleton/SkeletonRow2.js +9 -3
- package/dist/components/Skeleton/SkeletonRow2.js.map +1 -1
- package/dist/components/Skeleton/SkeletonText.d.ts +3 -1
- package/dist/components/Skeleton/SkeletonText2.js +7 -5
- package/dist/components/Skeleton/SkeletonText2.js.map +1 -1
- package/dist/components/StatCard/StatCard.d.ts +10 -1
- package/dist/components/StatCard/StatCard2.js +30 -30
- package/dist/components/StatCard/StatCard2.js.map +1 -1
- package/dist/components/Tabs/Tabs.d.ts +10 -23
- package/dist/components/Tabs/Tabs2.js +127 -146
- package/dist/components/Tabs/Tabs2.js.map +1 -1
- package/dist/components/Tabs/index.d.ts +2 -2
- package/dist/components/Tabs/index.js +2 -3
- package/dist/components/Tooltip/Tooltip.d.ts +15 -1
- package/dist/components/Tooltip/Tooltip2.js +77 -47
- package/dist/components/Tooltip/Tooltip2.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6 -6
- package/dist/styles/base.css +101 -10
- package/dist/styles/themes/orange-dark.css +3 -0
- package/dist/styles/themes/orange-light.css +6 -1
- package/package.json +1 -1
- package/dist/components/EmptyState/illustrations.d.ts +0 -51
- package/dist/components/EmptyState/illustrations.js +0 -571
- package/dist/components/EmptyState/illustrations.js.map +0 -1
- package/dist/components/Tabs/tabTags.d.ts +0 -9
- package/dist/components/Tabs/tabTags.js +0 -11
- package/dist/components/Tabs/tabTags.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Select2.js","names":[],"sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["/**\n * Select Component\n *\n * Single-select listbox with an optional search filter, icons, descriptions and\n * a disabled-but-visible option state. The listbox is portalled, so a select\n * near the bottom of a scrolling panel is not clipped by it.\n *\n * Every string it renders arrives as a prop with an English default, so the\n * component resolves no locale key of its own.\n */\n\nimport { useState, useRef, useEffect, useCallback, useId, useMemo } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport \"./Select.css\";\n\nexport interface SelectOption<T extends string = string> {\n value: T;\n label: string;\n description?: string;\n icon?: ReactNode;\n /** Keep an unavailable choice visible while preventing its selection. */\n disabled?: boolean;\n}\n\nexport interface SelectProps<T extends string = string> {\n value: T;\n onChange: (value: T) => void;\n onBlur?: () => void;\n options: SelectOption<T>[];\n /**\n * Field label rendered above the trigger, the way `TextInput` renders its\n * own. Names the trigger and the listbox through `aria-labelledby`, so a\n * caller that supplies it does not also need `aria-label`.\n */\n label?: ReactNode;\n placeholder?: string;\n disabled?: boolean;\n size?: \"small\" | \"default\" | \"medium\" | \"large\";\n fullWidth?: boolean;\n className?: string;\n searchable?: boolean;\n searchPlaceholder?: string;\n \"aria-label\"?: string;\n \"aria-describedby\"?: string;\n invalid?: boolean;\n /**\n * Shown in place of the list when a search matches nothing. English default,\n * because this package cannot resolve a consumer's locale key: a product that\n * localises passes its own words.\n */\n noOptionsLabel?: string;\n}\n\nexport function Select<T extends string = string>({\n value,\n onChange,\n onBlur,\n options,\n label,\n placeholder = \"Select...\",\n disabled = false,\n size = \"default\",\n fullWidth = false,\n className = \"\",\n searchable = false,\n searchPlaceholder,\n \"aria-label\": ariaLabel,\n \"aria-describedby\": ariaDescribedBy,\n invalid = false,\n noOptionsLabel = \"No options\",\n}: SelectProps<T>) {\n const [isOpen, setIsOpen] = useState(false);\n const [focusedIndex, setFocusedIndex] = useState(-1);\n const [searchQuery, setSearchQuery] = useState(\"\");\n const [dropdownPosition, setDropdownPosition] = useState({\n top: 0,\n left: 0,\n width: 0,\n });\n\n const containerRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const dropdownRef = useRef<HTMLDivElement>(null);\n const searchInputRef = useRef<HTMLInputElement>(null);\n const optionsRef = useRef<(HTMLDivElement | null)[]>([]);\n const listboxId = useId();\n const optionIdPrefix = useId();\n const labelId = useId();\n const hasLabel = label !== undefined && label !== null && label !== false;\n\n // Find selected option\n const selectedOption = options.find((opt) => opt.value === value);\n const visibleOptions = useMemo(() => {\n const normalizedQuery = searchQuery.trim().toLowerCase();\n if (!searchable || normalizedQuery.length === 0) return options;\n return options.filter((option) =>\n [option.label, option.value, option.description ?? \"\"].some((candidate) =>\n candidate.toLowerCase().includes(normalizedQuery),\n ),\n );\n }, [options, searchQuery, searchable]);\n\n const findEnabledIndex = useCallback(\n (start: number, step: 1 | -1): number => {\n for (\n let index = start;\n index >= 0 && index < visibleOptions.length;\n index += step\n ) {\n const option = visibleOptions[index];\n if (option && !option.disabled) return index;\n }\n return -1;\n },\n [visibleOptions],\n );\n\n // Generate unique option ID\n const getOptionId = (index: number) => `${optionIdPrefix}-option-${String(index)}`;\n\n // Get active descendant ID for screen readers\n const activeDescendantId = focusedIndex >= 0 ? getOptionId(focusedIndex) : undefined;\n\n // Calculate dropdown position\n const updateDropdownPosition = useCallback(() => {\n if (!triggerRef.current) return;\n\n const rect = triggerRef.current.getBoundingClientRect();\n setDropdownPosition({\n top: rect.bottom + 4,\n left: rect.left,\n width: rect.width, // Use trigger width as minimum, but allow expansion\n });\n }, []);\n\n // Open dropdown\n const openDropdown = useCallback(() => {\n if (disabled) return;\n updateDropdownPosition();\n setIsOpen(true);\n const selectedIndex = visibleOptions.findIndex(\n (opt) => opt.value === value && !opt.disabled,\n );\n setFocusedIndex(selectedIndex !== -1 ? selectedIndex : findEnabledIndex(0, 1));\n }, [disabled, visibleOptions, value, updateDropdownPosition, findEnabledIndex]);\n\n // Close dropdown\n const closeDropdown = useCallback(() => {\n setIsOpen(false);\n setFocusedIndex(-1);\n setSearchQuery(\"\");\n triggerRef.current?.focus();\n }, []);\n\n // Handle option selection\n const selectOption = useCallback(\n (option: SelectOption<T>, e?: React.MouseEvent) => {\n if (e) {\n e.stopPropagation();\n e.preventDefault();\n }\n if (option.disabled) return;\n onChange(option.value);\n closeDropdown();\n },\n [onChange, closeDropdown],\n );\n\n // Handle click outside to close\n useEffect(() => {\n const handleClickOutside = (event: MouseEvent) => {\n if (!isOpen) return;\n const target = event.target as Node;\n // Check if click is outside both the container and the dropdown (which is portaled)\n const isOutsideContainer =\n containerRef.current && !containerRef.current.contains(target);\n const isOutsideDropdown =\n dropdownRef.current && !dropdownRef.current.contains(target);\n if (isOutsideContainer && isOutsideDropdown) {\n closeDropdown();\n }\n };\n\n const handleEscape = (event: KeyboardEvent) => {\n if (event.key === \"Escape\" && isOpen) {\n closeDropdown();\n }\n };\n\n if (isOpen) {\n document.addEventListener(\"mousedown\", handleClickOutside);\n document.addEventListener(\"keydown\", handleEscape);\n }\n\n return () => {\n document.removeEventListener(\"mousedown\", handleClickOutside);\n document.removeEventListener(\"keydown\", handleEscape);\n };\n }, [isOpen, closeDropdown]);\n\n // Handle window resize/scroll to update dropdown position\n useEffect(() => {\n if (!isOpen) return;\n\n const handlePositionUpdate = () => {\n updateDropdownPosition();\n };\n\n window.addEventListener(\"resize\", handlePositionUpdate);\n window.addEventListener(\"scroll\", handlePositionUpdate, true);\n\n return () => {\n window.removeEventListener(\"resize\", handlePositionUpdate);\n window.removeEventListener(\"scroll\", handlePositionUpdate, true);\n };\n }, [isOpen, updateDropdownPosition]);\n\n useEffect(() => {\n if (isOpen && searchable) {\n searchInputRef.current?.focus();\n }\n }, [isOpen, searchable]);\n\n useEffect(() => {\n if (!isOpen || !searchable) return;\n optionsRef.current = [];\n const selectedIndex = visibleOptions.findIndex(\n (option) => option.value === value && !option.disabled,\n );\n setFocusedIndex(selectedIndex >= 0 ? selectedIndex : findEnabledIndex(0, 1));\n }, [isOpen, searchQuery, searchable, value, visibleOptions, findEnabledIndex]);\n\n // Keyboard navigation\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n if (disabled) return;\n\n switch (e.key) {\n case \"Enter\":\n case \" \":\n e.preventDefault();\n if (isOpen) {\n const focusedOption = visibleOptions[focusedIndex];\n if (focusedOption) {\n selectOption(focusedOption);\n }\n } else {\n openDropdown();\n }\n break;\n\n case \"Escape\":\n e.preventDefault();\n if (isOpen) {\n closeDropdown();\n }\n break;\n\n case \"ArrowDown\":\n e.preventDefault();\n if (!isOpen) {\n openDropdown();\n } else {\n const nextIndex = findEnabledIndex(focusedIndex + 1, 1);\n if (nextIndex >= 0) setFocusedIndex(nextIndex);\n }\n break;\n\n case \"ArrowUp\":\n e.preventDefault();\n if (isOpen) {\n const previousIndex = findEnabledIndex(focusedIndex - 1, -1);\n if (previousIndex >= 0) setFocusedIndex(previousIndex);\n }\n break;\n\n case \"Tab\":\n if (isOpen) {\n closeDropdown();\n }\n break;\n }\n },\n [\n disabled,\n isOpen,\n focusedIndex,\n visibleOptions,\n findEnabledIndex,\n openDropdown,\n closeDropdown,\n selectOption,\n ],\n );\n\n const handleSearchKeyDown = useCallback(\n (event: React.KeyboardEvent<HTMLInputElement>) => {\n switch (event.key) {\n case \"Enter\": {\n event.preventDefault();\n const focusedOption = visibleOptions[focusedIndex];\n if (focusedOption) selectOption(focusedOption);\n break;\n }\n case \"Escape\":\n event.preventDefault();\n event.stopPropagation();\n closeDropdown();\n break;\n case \"ArrowDown\":\n event.preventDefault();\n setFocusedIndex((current) => {\n const nextIndex = findEnabledIndex(current + 1, 1);\n return nextIndex >= 0 ? nextIndex : current;\n });\n break;\n case \"ArrowUp\":\n event.preventDefault();\n setFocusedIndex((current) => {\n const previousIndex = findEnabledIndex(current - 1, -1);\n return previousIndex >= 0 ? previousIndex : current;\n });\n break;\n case \"Tab\":\n closeDropdown();\n break;\n }\n },\n [closeDropdown, focusedIndex, selectOption, visibleOptions, findEnabledIndex],\n );\n\n // Scroll focused option into view\n useEffect(() => {\n const focusedElement = optionsRef.current[focusedIndex];\n if (isOpen && focusedIndex >= 0 && focusedElement) {\n focusedElement.scrollIntoView({\n block: \"nearest\",\n behavior: \"smooth\",\n });\n }\n }, [isOpen, focusedIndex]);\n\n const sizeClass = size !== \"default\" ? `select--${size}` : \"\";\n const widthClass = fullWidth ? \"select--full-width\" : \"\";\n const labelledClass = hasLabel ? \"select--labelled\" : \"\";\n // aria-labelledby wins over aria-label in the accessible-name calculation,\n // so a caller may pass either; the rendered label is preferred when present.\n const labelledBy = hasLabel ? labelId : undefined;\n const searchFieldLabel = searchPlaceholder ?? ariaLabel;\n\n return (\n <div\n ref={containerRef}\n className={`select ${sizeClass} ${widthClass} ${labelledClass} ${isOpen ? \"select--open\" : \"\"} ${disabled ? \"select--disabled\" : \"\"} ${className}`}\n >\n {hasLabel && (\n <span className=\"select__label\" id={labelId}>\n {label}\n </span>\n )}\n <button\n ref={triggerRef}\n type=\"button\"\n className=\"select__trigger\"\n onClick={() => {\n if (isOpen) {\n closeDropdown();\n } else {\n openDropdown();\n }\n }}\n onKeyDown={handleKeyDown}\n onBlur={onBlur}\n disabled={disabled}\n aria-haspopup=\"listbox\"\n aria-expanded={isOpen}\n aria-controls={isOpen ? listboxId : undefined}\n aria-activedescendant={isOpen ? activeDescendantId : undefined}\n aria-label={ariaLabel}\n aria-labelledby={labelledBy}\n aria-describedby={ariaDescribedBy}\n aria-invalid={invalid || undefined}\n >\n {selectedOption ? (\n <span className=\"select__value\">\n {selectedOption.icon && (\n <span className=\"select__value-icon\">{selectedOption.icon}</span>\n )}\n <span className=\"select__value-label\">{selectedOption.label}</span>\n </span>\n ) : (\n <span className=\"select__placeholder\">{placeholder}</span>\n )}\n <span className={`select__chevron ${isOpen ? \"select__chevron--open\" : \"\"}`}>\n <svg\n width=\"10\"\n height=\"6\"\n viewBox=\"0 0 10 6\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M1 1L5 5L9 1\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n </span>\n </button>\n\n {isOpen &&\n createPortal(\n <div\n ref={dropdownRef}\n className=\"select__dropdown select__dropdown--portal\"\n style={{\n position: \"fixed\",\n top: `${String(dropdownPosition.top)}px`,\n left: `${String(dropdownPosition.left)}px`,\n width: `${String(dropdownPosition.width)}px`,\n }}\n >\n {searchable && (\n <div className=\"select__search\">\n <input\n ref={searchInputRef}\n className=\"select__search-input\"\n type=\"search\"\n value={searchQuery}\n onChange={(event) => setSearchQuery(event.currentTarget.value)}\n onKeyDown={handleSearchKeyDown}\n placeholder={searchPlaceholder}\n aria-label={searchFieldLabel}\n aria-labelledby={searchFieldLabel ? undefined : labelledBy}\n aria-controls={listboxId}\n aria-activedescendant={activeDescendantId}\n autoComplete=\"off\"\n spellCheck={false}\n />\n </div>\n )}\n <div\n className=\"select__options\"\n role=\"listbox\"\n id={listboxId}\n aria-label={ariaLabel}\n aria-labelledby={labelledBy}\n >\n {visibleOptions.length === 0 ? (\n <div className=\"select__empty\">{noOptionsLabel}</div>\n ) : (\n visibleOptions.map((option, index) => (\n <div\n key={option.value}\n id={getOptionId(index)}\n ref={(el) => {\n optionsRef.current[index] = el;\n }}\n className={`select__option ${\n option.value === value ? \"select__option--selected\" : \"\"\n } ${index === focusedIndex ? \"select__option--focused\" : \"\"} ${option.disabled ? \"select__option--disabled\" : \"\"}`}\n role=\"option\"\n aria-selected={option.value === value}\n aria-disabled={option.disabled || undefined}\n aria-label={\n option.description\n ? option.label + \". \" + option.description\n : undefined\n }\n onClick={(e) => {\n selectOption(option, e);\n }}\n onMouseEnter={() => {\n if (!option.disabled) setFocusedIndex(index);\n }}\n >\n {option.icon && (\n <span className=\"select__option-icon\">{option.icon}</span>\n )}\n <div className=\"select__option-content\">\n <span className=\"select__option-label\">{option.label}</span>\n {option.description && (\n <span className=\"select__option-description\">\n {option.description}\n </span>\n )}\n </div>\n {option.value === value && (\n <span className=\"select__option-check\">\n <svg\n width=\"14\"\n height=\"10\"\n viewBox=\"0 0 14 10\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M1 5L5 9L13 1\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n </span>\n )}\n </div>\n ))\n )}\n </div>\n </div>,\n document.body,\n )}\n </div>\n );\n}\n"],"mappings":";;;;;AAsDA,SAAgB,EAAkC,EAChD,UACA,aACA,WACA,YACA,UACA,kBAAc,aACd,cAAW,IACX,UAAO,WACP,eAAY,IACZ,eAAY,IACZ,gBAAa,IACb,sBACA,cAAc,GACd,oBAAoB,GACpB,aAAU,IACV,oBAAiB,gBACA;CACjB,IAAM,CAAC,GAAQ,KAAa,EAAS,EAAK,GACpC,CAAC,GAAc,KAAmB,EAAS,EAAE,GAC7C,CAAC,GAAa,KAAkB,EAAS,EAAE,GAC3C,CAAC,GAAkB,MAAuB,EAAS;EACvD,KAAK;EACL,MAAM;EACN,OAAO;CACT,CAAC,GAEK,IAAe,EAAuB,IAAI,GAC1C,IAAa,EAA0B,IAAI,GAC3C,IAAc,EAAuB,IAAI,GACzC,IAAiB,EAAyB,IAAI,GAC9C,IAAa,EAAkC,CAAC,CAAC,GACjD,IAAY,EAAM,GAClB,IAAiB,EAAM,GACvB,IAAU,EAAM,GAChB,IAAW,KAAiC,QAAQ,MAAU,IAG9D,IAAiB,EAAQ,MAAM,MAAQ,EAAI,UAAU,CAAK,GAC1D,IAAiB,QAAc;EACnC,IAAM,IAAkB,EAAY,KAAK,CAAC,CAAC,YAAY;EAEvD,OADI,CAAC,KAAc,EAAgB,WAAW,IAAU,IACjD,EAAQ,QAAQ,MACrB;GAAC,EAAO;GAAO,EAAO;GAAO,EAAO,eAAe;EAAE,CAAC,CAAC,MAAM,MAC3D,EAAU,Y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,OAAD;QAAK,WAAU;QAAf,UAAA,CACE,kBAAC,QAAD;SAAM,WAAU;SAAwB,UAAA,EAAO;QAAY,CAAA,GAC1D,EAAO,eACN,kBAAC,QAAD;SAAM,WAAU;SACb,UAAA,EAAO;QACJ,CAAA,CAEL;;OACJ,EAAO,UAAU,KAChB,kBAAC,QAAD;QAAM,WAAU;QACd,UAAA,kBAAC,OAAD;SACE,OAAM;SACN,QAAO;SACP,SAAQ;SACR,MAAK;SACL,OAAM;SAEN,UAAA,kBAAC,QAAD;UACE,GAAE;UACF,QAAO;UACP,aAAY;UACZ,eAAc;UACd,gBAAe;SAChB,CAAA;QACE,CAAA;OACD,CAAA;MAEL;KArDE,GAAA,EAAO,KAqDT,CACN;IAEA,CAAA,CACF;GACL,CAAA,GAAA,SAAS,IACX;EACC;;AAET"}
|
|
@@ -11,6 +11,16 @@ export interface SkeletonProps {
|
|
|
11
11
|
testId?: string;
|
|
12
12
|
/** Accessible label announced while the skeleton is visible. Default: "Loading" */
|
|
13
13
|
loadingLabel?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Render as decoration: `aria-hidden`, with no role, no `aria-busy` and no
|
|
16
|
+
* label.
|
|
17
|
+
*
|
|
18
|
+
* For a shape inside a composite that announces the wait itself. `role="status"`
|
|
19
|
+
* is an implicit polite live region, so a composite that fills its own region
|
|
20
|
+
* with named primitives mounts one live region per shape and announces the
|
|
21
|
+
* same wait once per shape.
|
|
22
|
+
*/
|
|
23
|
+
decorative?: boolean;
|
|
14
24
|
}
|
|
15
25
|
/**
|
|
16
26
|
* Skeleton provides a loading placeholder with shimmer animation.
|
|
@@ -21,5 +31,5 @@ export interface SkeletonProps {
|
|
|
21
31
|
* - Multiple shape variants
|
|
22
32
|
* - Accessible via aria-busy and aria-label
|
|
23
33
|
*/
|
|
24
|
-
export declare function Skeleton({ width, height, variant, className, testId, loadingLabel, }: SkeletonProps): import("react").JSX.Element;
|
|
34
|
+
export declare function Skeleton({ width, height, variant, className, testId, loadingLabel, decorative, }: SkeletonProps): import("react").JSX.Element;
|
|
25
35
|
export default Skeleton;
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
/* empty css */
|
|
2
2
|
import { jsx as e } from "react/jsx-runtime";
|
|
3
3
|
//#region src/components/Skeleton/Skeleton.tsx
|
|
4
|
-
function t({ width: t = "100%", height: n = "20px", variant: r = "rect", className: i = "", testId: a, loadingLabel: o = "Loading" }) {
|
|
5
|
-
let
|
|
4
|
+
function t({ width: t = "100%", height: n = "20px", variant: r = "rect", className: i = "", testId: a, loadingLabel: o = "Loading", decorative: s = !1 }) {
|
|
5
|
+
let c = [
|
|
6
6
|
"skeleton",
|
|
7
7
|
`skeleton--${r}`,
|
|
8
8
|
i
|
|
9
9
|
].filter(Boolean).join(" ");
|
|
10
10
|
return /* @__PURE__ */ e("div", {
|
|
11
|
-
className:
|
|
11
|
+
className: c,
|
|
12
12
|
style: {
|
|
13
13
|
width: t,
|
|
14
14
|
height: n
|
|
15
15
|
},
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
...s ? { "aria-hidden": !0 } : {
|
|
17
|
+
role: "status",
|
|
18
|
+
"aria-busy": !0,
|
|
19
|
+
"aria-label": o
|
|
20
|
+
},
|
|
19
21
|
"data-testid": a,
|
|
20
22
|
children: /* @__PURE__ */ e("span", { className: "skeleton__shimmer" })
|
|
21
23
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Skeleton2.js","names":[],"sources":["../../../src/components/Skeleton/Skeleton.tsx"],"sourcesContent":["/**\n * Skeleton Component\n *\n * Base skeleton component for loading states.\n * Provides a shimmer animation effect that respects prefers-reduced-motion.\n *\n * @example\n * // Basic usage\n * <Skeleton width=\"100%\" height=\"20px\" />\n *\n * @example\n * // Circle skeleton\n * <Skeleton width=\"40px\" height=\"40px\" variant=\"circle\" />\n */\n\nimport \"./Skeleton.css\";\n\nexport interface SkeletonProps {\n /** Width of the skeleton (CSS value) */\n width?: string;\n /** Height of the skeleton (CSS value) */\n height?: string;\n /** Visual variant */\n variant?: \"rect\" | \"circle\" | \"text\";\n /** Additional CSS class names */\n className?: string;\n /** Test ID for testing */\n testId?: string;\n /** Accessible label announced while the skeleton is visible. Default: \"Loading\" */\n loadingLabel?: string;\n}\n\n/**\n * Skeleton provides a loading placeholder with shimmer animation.\n *\n * Features:\n * - Shimmer effect using CSS animation\n * - Reduced motion preference support\n * - Multiple shape variants\n * - Accessible via aria-busy and aria-label\n */\nexport function Skeleton({\n width = \"100%\",\n height = \"20px\",\n variant = \"rect\",\n className = \"\",\n testId,\n loadingLabel = \"Loading\",\n}: SkeletonProps) {\n const classNames = [\"skeleton\", `skeleton--${variant}`, className]\n .filter(Boolean)\n .join(\" \");\n\n return (\n <div\n className={classNames}\n style={{ width, height }}\n
|
|
1
|
+
{"version":3,"file":"Skeleton2.js","names":[],"sources":["../../../src/components/Skeleton/Skeleton.tsx"],"sourcesContent":["/**\n * Skeleton Component\n *\n * Base skeleton component for loading states.\n * Provides a shimmer animation effect that respects prefers-reduced-motion.\n *\n * @example\n * // Basic usage\n * <Skeleton width=\"100%\" height=\"20px\" />\n *\n * @example\n * // Circle skeleton\n * <Skeleton width=\"40px\" height=\"40px\" variant=\"circle\" />\n */\n\nimport \"./Skeleton.css\";\n\nexport interface SkeletonProps {\n /** Width of the skeleton (CSS value) */\n width?: string;\n /** Height of the skeleton (CSS value) */\n height?: string;\n /** Visual variant */\n variant?: \"rect\" | \"circle\" | \"text\";\n /** Additional CSS class names */\n className?: string;\n /** Test ID for testing */\n testId?: string;\n /** Accessible label announced while the skeleton is visible. Default: \"Loading\" */\n loadingLabel?: string;\n /**\n * Render as decoration: `aria-hidden`, with no role, no `aria-busy` and no\n * label.\n *\n * For a shape inside a composite that announces the wait itself. `role=\"status\"`\n * is an implicit polite live region, so a composite that fills its own region\n * with named primitives mounts one live region per shape and announces the\n * same wait once per shape.\n */\n decorative?: boolean;\n}\n\n/**\n * Skeleton provides a loading placeholder with shimmer animation.\n *\n * Features:\n * - Shimmer effect using CSS animation\n * - Reduced motion preference support\n * - Multiple shape variants\n * - Accessible via aria-busy and aria-label\n */\nexport function Skeleton({\n width = \"100%\",\n height = \"20px\",\n variant = \"rect\",\n className = \"\",\n testId,\n loadingLabel = \"Loading\",\n decorative = false,\n}: SkeletonProps) {\n const classNames = [\"skeleton\", `skeleton--${variant}`, className]\n .filter(Boolean)\n .join(\" \");\n\n // A decorative shape is one of several inside a composite that already\n // announces the wait. It keeps its size and its shimmer and leaves the\n // accessibility tree, so a card built from seven of these is one live region\n // rather than seven.\n const announcement = decorative\n ? ({ \"aria-hidden\": true } as const)\n : ({\n role: \"status\",\n \"aria-busy\": true,\n \"aria-label\": loadingLabel,\n } as const);\n\n return (\n <div\n className={classNames}\n style={{ width, height }}\n {...announcement}\n data-testid={testId}\n >\n <span className=\"skeleton__shimmer\" />\n </div>\n );\n}\n\nexport default Skeleton;\n"],"mappings":";;;AAmDA,SAAgB,EAAS,EACvB,WAAQ,QACR,YAAS,QACT,aAAU,QACV,eAAY,IACZ,WACA,kBAAe,WACf,gBAAa,MACG;CAChB,IAAM,IAAa;EAAC;EAAY,aAAa;EAAW;CAAS,CAAC,CAC/D,OAAO,OAAO,CAAC,CACf,KAAK,GAAG;CAcX,OACE,kBAAC,OAAD;EACE,WAAW;EACX,OAAO;GAAE;GAAO;EAAO;EACvB,GAZiB,IAChB,EAAE,eAAe,GAAK,IACtB;GACC,MAAM;GACN,aAAa;GACb,cAAc;EAChB;EAOA,eAAa;EAEb,UAAA,kBAAC,QAAD,EAAM,WAAU,oBAAqB,CAAA;CAClC,CAAA;AAET"}
|
|
@@ -5,6 +5,8 @@ export interface SkeletonCardProps {
|
|
|
5
5
|
className?: string;
|
|
6
6
|
/** Test ID for testing */
|
|
7
7
|
testId?: string;
|
|
8
|
+
/** Accessible name announced for the placeholder as a whole. Defaults to "Loading". */
|
|
9
|
+
loadingLabel?: string;
|
|
8
10
|
}
|
|
9
11
|
/**
|
|
10
12
|
* SkeletonCard provides a loading placeholder for card components.
|
|
@@ -14,5 +16,5 @@ export interface SkeletonCardProps {
|
|
|
14
16
|
* - compact: Smaller card with reduced padding
|
|
15
17
|
* - stat: Statistics card layout
|
|
16
18
|
*/
|
|
17
|
-
export declare function SkeletonCard({ variant, className, testId, }: SkeletonCardProps): import("react").JSX.Element;
|
|
19
|
+
export declare function SkeletonCard({ variant, className, testId, loadingLabel, }: SkeletonCardProps): import("react").JSX.Element;
|
|
18
20
|
export default SkeletonCard;
|
|
@@ -2,29 +2,33 @@ import { Skeleton as e } from "./Skeleton2.js";
|
|
|
2
2
|
/* empty css */
|
|
3
3
|
import { Fragment as t, jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
4
|
//#region src/components/Skeleton/SkeletonCard.tsx
|
|
5
|
-
function i({ variant: i = "default", className: a = "", testId: o }) {
|
|
6
|
-
let
|
|
5
|
+
function i({ variant: i = "default", className: a = "", testId: o, loadingLabel: s }) {
|
|
6
|
+
let c = [
|
|
7
7
|
"skeleton-card",
|
|
8
8
|
`skeleton-card--${i}`,
|
|
9
9
|
a
|
|
10
10
|
].filter(Boolean).join(" ");
|
|
11
11
|
return /* @__PURE__ */ n("div", {
|
|
12
|
-
className:
|
|
12
|
+
className: c,
|
|
13
13
|
"data-testid": o,
|
|
14
14
|
role: "status",
|
|
15
15
|
"aria-busy": "true",
|
|
16
|
+
"aria-label": s ?? "Loading",
|
|
16
17
|
children: i === "stat" ? /* @__PURE__ */ n(t, { children: /* @__PURE__ */ r("div", {
|
|
17
18
|
className: "skeleton-card__header",
|
|
18
19
|
children: [/* @__PURE__ */ n(e, {
|
|
20
|
+
decorative: !0,
|
|
19
21
|
width: "48px",
|
|
20
22
|
height: "48px",
|
|
21
23
|
variant: "circle"
|
|
22
24
|
}), /* @__PURE__ */ r("div", {
|
|
23
25
|
className: "skeleton-card__header-text",
|
|
24
26
|
children: [/* @__PURE__ */ n(e, {
|
|
27
|
+
decorative: !0,
|
|
25
28
|
width: "60%",
|
|
26
29
|
height: "16px"
|
|
27
30
|
}), /* @__PURE__ */ n(e, {
|
|
31
|
+
decorative: !0,
|
|
28
32
|
width: "40%",
|
|
29
33
|
height: "24px"
|
|
30
34
|
})]
|
|
@@ -33,6 +37,7 @@ function i({ variant: i = "default", className: a = "", testId: o }) {
|
|
|
33
37
|
/* @__PURE__ */ n("div", {
|
|
34
38
|
className: "skeleton-card__header",
|
|
35
39
|
children: /* @__PURE__ */ n(e, {
|
|
40
|
+
decorative: !0,
|
|
36
41
|
width: "70%",
|
|
37
42
|
height: "20px"
|
|
38
43
|
})
|
|
@@ -41,14 +46,17 @@ function i({ variant: i = "default", className: a = "", testId: o }) {
|
|
|
41
46
|
className: "skeleton-card__content",
|
|
42
47
|
children: [
|
|
43
48
|
/* @__PURE__ */ n(e, {
|
|
49
|
+
decorative: !0,
|
|
44
50
|
width: "100%",
|
|
45
51
|
height: "16px"
|
|
46
52
|
}),
|
|
47
53
|
/* @__PURE__ */ n(e, {
|
|
54
|
+
decorative: !0,
|
|
48
55
|
width: "90%",
|
|
49
56
|
height: "16px"
|
|
50
57
|
}),
|
|
51
58
|
/* @__PURE__ */ n(e, {
|
|
59
|
+
decorative: !0,
|
|
52
60
|
width: "80%",
|
|
53
61
|
height: "16px"
|
|
54
62
|
})
|
|
@@ -57,9 +65,11 @@ function i({ variant: i = "default", className: a = "", testId: o }) {
|
|
|
57
65
|
i !== "compact" && /* @__PURE__ */ r("div", {
|
|
58
66
|
className: "skeleton-card__footer",
|
|
59
67
|
children: [/* @__PURE__ */ n(e, {
|
|
68
|
+
decorative: !0,
|
|
60
69
|
width: "80px",
|
|
61
70
|
height: "32px"
|
|
62
71
|
}), /* @__PURE__ */ n(e, {
|
|
72
|
+
decorative: !0,
|
|
63
73
|
width: "80px",
|
|
64
74
|
height: "32px"
|
|
65
75
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SkeletonCard2.js","names":[],"sources":["../../../src/components/Skeleton/SkeletonCard.tsx"],"sourcesContent":["/**\n * SkeletonCard Component\n *\n * Skeleton placeholder for card components (model cards, stat cards, etc.).\n * Mimics the structure of a typical card with header, content, and footer areas.\n *\n * @example\n * // Basic usage\n * <SkeletonCard />\n *\n * @example\n * // Compact variant\n * <SkeletonCard variant=\"compact\" />\n */\n\nimport { Skeleton } from \"./Skeleton\";\nimport \"./SkeletonCard.css\";\n\nexport interface SkeletonCardProps {\n /** Card size variant */\n variant?: \"default\" | \"compact\" | \"stat\";\n /** Additional CSS class names */\n className?: string;\n /** Test ID for testing */\n testId?: string;\n}\n\n/**\n * SkeletonCard provides a loading placeholder for card components.\n *\n * Variants:\n * - default: Full card with header, content, and footer\n * - compact: Smaller card with reduced padding\n * - stat: Statistics card layout\n */\nexport function SkeletonCard({\n variant = \"default\",\n className = \"\",\n testId,\n}: SkeletonCardProps) {\n const classNames = [\"skeleton-card\", `skeleton-card--${variant}`, className]\n .filter(Boolean)\n .join(\" \");\n\n return (\n <div
|
|
1
|
+
{"version":3,"file":"SkeletonCard2.js","names":[],"sources":["../../../src/components/Skeleton/SkeletonCard.tsx"],"sourcesContent":["/**\n * SkeletonCard Component\n *\n * Skeleton placeholder for card components (model cards, stat cards, etc.).\n * Mimics the structure of a typical card with header, content, and footer areas.\n *\n * @example\n * // Basic usage\n * <SkeletonCard />\n *\n * @example\n * // Compact variant\n * <SkeletonCard variant=\"compact\" />\n */\n\nimport { Skeleton } from \"./Skeleton\";\nimport \"./SkeletonCard.css\";\n\nexport interface SkeletonCardProps {\n /** Card size variant */\n variant?: \"default\" | \"compact\" | \"stat\";\n /** Additional CSS class names */\n className?: string;\n /** Test ID for testing */\n testId?: string;\n /** Accessible name announced for the placeholder as a whole. Defaults to \"Loading\". */\n loadingLabel?: string;\n}\n\n/**\n * SkeletonCard provides a loading placeholder for card components.\n *\n * Variants:\n * - default: Full card with header, content, and footer\n * - compact: Smaller card with reduced padding\n * - stat: Statistics card layout\n */\nexport function SkeletonCard({\n variant = \"default\",\n className = \"\",\n testId,\n loadingLabel,\n}: SkeletonCardProps) {\n const classNames = [\"skeleton-card\", `skeleton-card--${variant}`, className]\n .filter(Boolean)\n .join(\" \");\n\n return (\n <div\n className={classNames}\n data-testid={testId}\n role=\"status\"\n aria-busy=\"true\"\n aria-label={loadingLabel ?? \"Loading\"}\n >\n {variant === \"stat\" ? (\n <>\n <div className=\"skeleton-card__header\">\n <Skeleton decorative width=\"48px\" height=\"48px\" variant=\"circle\" />\n <div className=\"skeleton-card__header-text\">\n <Skeleton decorative width=\"60%\" height=\"16px\" />\n <Skeleton decorative width=\"40%\" height=\"24px\" />\n </div>\n </div>\n </>\n ) : (\n <>\n <div className=\"skeleton-card__header\">\n <Skeleton decorative width=\"70%\" height=\"20px\" />\n </div>\n <div className=\"skeleton-card__content\">\n <Skeleton decorative width=\"100%\" height=\"16px\" />\n <Skeleton decorative width=\"90%\" height=\"16px\" />\n <Skeleton decorative width=\"80%\" height=\"16px\" />\n </div>\n {variant !== \"compact\" && (\n <div className=\"skeleton-card__footer\">\n <Skeleton decorative width=\"80px\" height=\"32px\" />\n <Skeleton decorative width=\"80px\" height=\"32px\" />\n </div>\n )}\n </>\n )}\n </div>\n );\n}\n\nexport default SkeletonCard;\n"],"mappings":";;;;AAqCA,SAAgB,EAAa,EAC3B,aAAU,WACV,eAAY,IACZ,WACA,mBACoB;CACpB,IAAM,IAAa;EAAC;EAAiB,kBAAkB;EAAW;CAAS,CAAC,CACzE,OAAO,OAAO,CAAC,CACf,KAAK,GAAG;CAEX,OACE,kBAAC,OAAD;EACE,WAAW;EACX,eAAa;EACb,MAAK;EACL,aAAU;EACV,cAAY,KAAgB;EAE3B,UAAA,MAAY,SACX,kBAAA,GAAA,EAAA,UACE,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,kBAAC,GAAD;IAAU,YAAA;IAAW,OAAM;IAAO,QAAO;IAAO,SAAQ;GAAU,CAAA,GAClE,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,kBAAC,GAAD;KAAU,YAAA;KAAW,OAAM;KAAM,QAAO;IAAQ,CAAA,GAChD,kBAAC,GAAD;KAAU,YAAA;KAAW,OAAM;KAAM,QAAO;IAAQ,CAAA,CAC7C;GACF,CAAA,CAAA;EACL,CAAA,EAAA,CAAA,IAEF,kBAAA,GAAA,EAAA,UAAA;GACE,kBAAC,OAAD;IAAK,WAAU;IACb,UAAA,kBAAC,GAAD;KAAU,YAAA;KAAW,OAAM;KAAM,QAAO;IAAQ,CAAA;GAC7C,CAAA;GACL,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA;KACE,kBAAC,GAAD;MAAU,YAAA;MAAW,OAAM;MAAO,QAAO;KAAQ,CAAA;KACjD,kBAAC,GAAD;MAAU,YAAA;MAAW,OAAM;MAAM,QAAO;KAAQ,CAAA;KAChD,kBAAC,GAAD;MAAU,YAAA;MAAW,OAAM;MAAM,QAAO;KAAQ,CAAA;IAC7C;;GACJ,MAAY,aACX,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,kBAAC,GAAD;KAAU,YAAA;KAAW,OAAM;KAAO,QAAO;IAAQ,CAAA,GACjD,kBAAC,GAAD;KAAU,YAAA;KAAW,OAAM;KAAO,QAAO;IAAQ,CAAA,CAC9C;;EAEP,EAAA,CAAA;CAED,CAAA;AAET"}
|
|
@@ -18,6 +18,7 @@ function r({ variant: r = "bar", height: i = "300px", className: a = "", testId:
|
|
|
18
18
|
children: r === "pie" ? /* @__PURE__ */ n("div", {
|
|
19
19
|
className: "skeleton-chart__pie",
|
|
20
20
|
children: [/* @__PURE__ */ t(e, {
|
|
21
|
+
decorative: !0,
|
|
21
22
|
width: "100%",
|
|
22
23
|
height: "100%",
|
|
23
24
|
variant: "circle"
|
|
@@ -26,10 +27,12 @@ function r({ variant: r = "bar", height: i = "300px", className: a = "", testId:
|
|
|
26
27
|
children: Array.from({ length: 4 }).map((r, i) => /* @__PURE__ */ n("div", {
|
|
27
28
|
className: "skeleton-chart__legend-item",
|
|
28
29
|
children: [/* @__PURE__ */ t(e, {
|
|
30
|
+
decorative: !0,
|
|
29
31
|
width: "16px",
|
|
30
32
|
height: "16px",
|
|
31
33
|
variant: "circle"
|
|
32
34
|
}), /* @__PURE__ */ t(e, {
|
|
35
|
+
decorative: !0,
|
|
33
36
|
width: "80px",
|
|
34
37
|
height: "14px"
|
|
35
38
|
})]
|
|
@@ -47,6 +50,7 @@ function r({ variant: r = "bar", height: i = "300px", className: a = "", testId:
|
|
|
47
50
|
85,
|
|
48
51
|
65
|
|
49
52
|
].map((n, r) => /* @__PURE__ */ t(e, {
|
|
53
|
+
decorative: !0,
|
|
50
54
|
width: "100%",
|
|
51
55
|
height: `${String(n)}%`,
|
|
52
56
|
className: "skeleton-chart__bar"
|
|
@@ -54,6 +58,7 @@ function r({ variant: r = "bar", height: i = "300px", className: a = "", testId:
|
|
|
54
58
|
}) : /* @__PURE__ */ t("div", {
|
|
55
59
|
className: "skeleton-chart__line",
|
|
56
60
|
children: /* @__PURE__ */ t(e, {
|
|
61
|
+
decorative: !0,
|
|
57
62
|
width: "100%",
|
|
58
63
|
height: "100%"
|
|
59
64
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SkeletonChart2.js","names":[],"sources":["../../../src/components/Skeleton/SkeletonChart.tsx"],"sourcesContent":["/**\n * SkeletonChart Component\n *\n * Skeleton placeholder for chart components.\n * Shows a simplified chart-like shape with bars or circular elements.\n *\n * @example\n * // Bar chart skeleton\n * <SkeletonChart variant=\"bar\" />\n *\n * @example\n * // Pie chart skeleton\n * <SkeletonChart variant=\"pie\" />\n */\n\nimport { Skeleton } from \"./Skeleton\";\nimport \"./SkeletonChart.css\";\n\nexport interface SkeletonChartProps {\n /** Chart type variant */\n variant?: \"bar\" | \"line\" | \"pie\" | \"area\";\n /** Chart height */\n height?: string;\n /** Additional CSS class names */\n className?: string;\n /** Test ID for testing */\n testId?: string;\n /** Accessible label announced while the chart is loading. Default: \"Loading chart\" */\n loadingLabel?: string;\n}\n\n/**\n * SkeletonChart provides a loading placeholder for chart components.\n *\n * Variants:\n * - bar: Vertical bars of varying heights\n * - line: Line graph placeholder\n * - pie: Circular chart placeholder\n * - area: Area chart placeholder\n */\nexport function SkeletonChart({\n variant = \"bar\",\n height = \"300px\",\n className = \"\",\n testId,\n loadingLabel = \"Loading chart\",\n}: SkeletonChartProps) {\n const classNames = [\"skeleton-chart\", `skeleton-chart--${variant}`, className]\n .filter(Boolean)\n .join(\" \");\n\n return (\n <div\n className={classNames}\n style={{ height }}\n data-testid={testId}\n role=\"status\"\n aria-busy=\"true\"\n aria-label={loadingLabel}\n >\n {variant === \"pie\" ? (\n <div className=\"skeleton-chart__pie\">\n <Skeleton width=\"100%\" height=\"100%\" variant=\"circle\" />\n <div className=\"skeleton-chart__legend\">\n {Array.from({ length: 4 }).map((_, i) => (\n <div key={i} className=\"skeleton-chart__legend-item\">\n <Skeleton width=\"16px\" height=\"16px\" variant=\"circle\" />\n <Skeleton width=\"80px\" height=\"14px\" />\n </div>\n ))}\n </div>\n </div>\n ) : variant === \"bar\" ? (\n <div className=\"skeleton-chart__bars\">\n {[60, 80, 45, 90, 70, 55, 85, 65].map((barHeight, i) => (\n <Skeleton\n key={i}\n width=\"100%\"\n height={`${String(barHeight)}%`}\n className=\"skeleton-chart__bar\"\n />\n ))}\n </div>\n ) : (\n <div className=\"skeleton-chart__line\">\n <Skeleton width=\"100%\" height=\"100%\" />\n </div>\n )}\n </div>\n );\n}\n\nexport default SkeletonChart;\n"],"mappings":";;;;AAwCA,SAAgB,EAAc,EAC5B,aAAU,OACV,YAAS,SACT,eAAY,IACZ,WACA,kBAAe,mBACM;CACrB,IAAM,IAAa;EAAC;EAAkB,mBAAmB;EAAW;CAAS,CAAC,CAC3E,OAAO,OAAO,CAAC,CACf,KAAK,GAAG;CAEX,OACE,kBAAC,OAAD;EACE,WAAW;EACX,OAAO,EAAE,UAAO;EAChB,eAAa;EACb,MAAK;EACL,aAAU;EACV,cAAY;EAEX,UAAA,MAAY,QACX,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,kBAAC,GAAD;IAAU,OAAM;IAAO,QAAO;IAAO,SAAQ;GAAU,CAAA,
|
|
1
|
+
{"version":3,"file":"SkeletonChart2.js","names":[],"sources":["../../../src/components/Skeleton/SkeletonChart.tsx"],"sourcesContent":["/**\n * SkeletonChart Component\n *\n * Skeleton placeholder for chart components.\n * Shows a simplified chart-like shape with bars or circular elements.\n *\n * @example\n * // Bar chart skeleton\n * <SkeletonChart variant=\"bar\" />\n *\n * @example\n * // Pie chart skeleton\n * <SkeletonChart variant=\"pie\" />\n */\n\nimport { Skeleton } from \"./Skeleton\";\nimport \"./SkeletonChart.css\";\n\nexport interface SkeletonChartProps {\n /** Chart type variant */\n variant?: \"bar\" | \"line\" | \"pie\" | \"area\";\n /** Chart height */\n height?: string;\n /** Additional CSS class names */\n className?: string;\n /** Test ID for testing */\n testId?: string;\n /** Accessible label announced while the chart is loading. Default: \"Loading chart\" */\n loadingLabel?: string;\n}\n\n/**\n * SkeletonChart provides a loading placeholder for chart components.\n *\n * Variants:\n * - bar: Vertical bars of varying heights\n * - line: Line graph placeholder\n * - pie: Circular chart placeholder\n * - area: Area chart placeholder\n */\nexport function SkeletonChart({\n variant = \"bar\",\n height = \"300px\",\n className = \"\",\n testId,\n loadingLabel = \"Loading chart\",\n}: SkeletonChartProps) {\n const classNames = [\"skeleton-chart\", `skeleton-chart--${variant}`, className]\n .filter(Boolean)\n .join(\" \");\n\n return (\n <div\n className={classNames}\n style={{ height }}\n data-testid={testId}\n role=\"status\"\n aria-busy=\"true\"\n aria-label={loadingLabel}\n >\n {variant === \"pie\" ? (\n <div className=\"skeleton-chart__pie\">\n <Skeleton decorative width=\"100%\" height=\"100%\" variant=\"circle\" />\n <div className=\"skeleton-chart__legend\">\n {Array.from({ length: 4 }).map((_, i) => (\n <div key={i} className=\"skeleton-chart__legend-item\">\n <Skeleton decorative width=\"16px\" height=\"16px\" variant=\"circle\" />\n <Skeleton decorative width=\"80px\" height=\"14px\" />\n </div>\n ))}\n </div>\n </div>\n ) : variant === \"bar\" ? (\n <div className=\"skeleton-chart__bars\">\n {[60, 80, 45, 90, 70, 55, 85, 65].map((barHeight, i) => (\n <Skeleton\n decorative\n key={i}\n width=\"100%\"\n height={`${String(barHeight)}%`}\n className=\"skeleton-chart__bar\"\n />\n ))}\n </div>\n ) : (\n <div className=\"skeleton-chart__line\">\n <Skeleton decorative width=\"100%\" height=\"100%\" />\n </div>\n )}\n </div>\n );\n}\n\nexport default SkeletonChart;\n"],"mappings":";;;;AAwCA,SAAgB,EAAc,EAC5B,aAAU,OACV,YAAS,SACT,eAAY,IACZ,WACA,kBAAe,mBACM;CACrB,IAAM,IAAa;EAAC;EAAkB,mBAAmB;EAAW;CAAS,CAAC,CAC3E,OAAO,OAAO,CAAC,CACf,KAAK,GAAG;CAEX,OACE,kBAAC,OAAD;EACE,WAAW;EACX,OAAO,EAAE,UAAO;EAChB,eAAa;EACb,MAAK;EACL,aAAU;EACV,cAAY;EAEX,UAAA,MAAY,QACX,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,kBAAC,GAAD;IAAU,YAAA;IAAW,OAAM;IAAO,QAAO;IAAO,SAAQ;GAAU,CAAA,GAClE,kBAAC,OAAD;IAAK,WAAU;IACZ,UAAA,MAAM,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,MACjC,kBAAC,OAAD;KAAa,WAAU;KAAvB,UAAA,CACE,kBAAC,GAAD;MAAU,YAAA;MAAW,OAAM;MAAO,QAAO;MAAO,SAAQ;KAAU,CAAA,GAClE,kBAAC,GAAD;MAAU,YAAA;MAAW,OAAM;MAAO,QAAO;KAAQ,CAAA,CAC9C;IAHK,GAAA,CAGL,CACN;GACE,CAAA,CACF;EACH,CAAA,IAAA,MAAY,QACd,kBAAC,OAAD;GAAK,WAAU;GACZ,UAAA;IAAC;IAAI;IAAI;IAAI;IAAI;IAAI;IAAI;IAAI;GAAE,CAAC,CAAC,KAAK,GAAW,MAChD,kBAAC,GAAD;IACE,YAAA;IAEA,OAAM;IACN,QAAQ,GAAG,OAAO,CAAS,EAAE;IAC7B,WAAU;GACX,GAJM,CAIN,CACF;EACE,CAAA,IAEL,kBAAC,OAAD;GAAK,WAAU;GACb,UAAA,kBAAC,GAAD;IAAU,YAAA;IAAW,OAAM;IAAO,QAAO;GAAQ,CAAA;EAC9C,CAAA;CAEJ,CAAA;AAET"}
|
|
@@ -9,6 +9,8 @@ export interface SkeletonRowProps {
|
|
|
9
9
|
className?: string;
|
|
10
10
|
/** Test ID for testing */
|
|
11
11
|
testId?: string;
|
|
12
|
+
/** Accessible name announced for the placeholder as a whole. Defaults to "Loading". */
|
|
13
|
+
loadingLabel?: string;
|
|
12
14
|
}
|
|
13
15
|
/**
|
|
14
16
|
* SkeletonRow provides a loading placeholder for list/table rows.
|
|
@@ -18,5 +20,5 @@ export interface SkeletonRowProps {
|
|
|
18
20
|
* - Optional action buttons
|
|
19
21
|
* - Multiple rows for lists
|
|
20
22
|
*/
|
|
21
|
-
export declare function SkeletonRow({ showAvatar, showActions, count, className, testId, }: SkeletonRowProps): import("react").JSX.Element;
|
|
23
|
+
export declare function SkeletonRow({ showAvatar, showActions, count, className, testId, loadingLabel, }: SkeletonRowProps): import("react").JSX.Element;
|
|
22
24
|
export default SkeletonRow;
|
|
@@ -2,17 +2,19 @@ import { Skeleton as e } from "./Skeleton2.js";
|
|
|
2
2
|
/* empty css */
|
|
3
3
|
import { Fragment as t, jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
4
|
//#region src/components/Skeleton/SkeletonRow.tsx
|
|
5
|
-
function i({ showAvatar: i = !1, showActions: a = !1, count: o = 1, className: s = "", testId: c }) {
|
|
6
|
-
let
|
|
7
|
-
return /* @__PURE__ */ n(t, { children:
|
|
5
|
+
function i({ showAvatar: i = !1, showActions: a = !1, count: o = 1, className: s = "", testId: c, loadingLabel: l }) {
|
|
6
|
+
let u = Array.from({ length: o });
|
|
7
|
+
return /* @__PURE__ */ n(t, { children: u.map((t, o) => /* @__PURE__ */ r("div", {
|
|
8
8
|
className: `skeleton-row ${s}`,
|
|
9
9
|
"data-testid": c ? `${c}-${String(o)}` : void 0,
|
|
10
10
|
role: "status",
|
|
11
11
|
"aria-busy": "true",
|
|
12
|
+
"aria-label": l ?? "Loading",
|
|
12
13
|
children: [
|
|
13
14
|
i && /* @__PURE__ */ n("div", {
|
|
14
15
|
className: "skeleton-row__avatar",
|
|
15
16
|
children: /* @__PURE__ */ n(e, {
|
|
17
|
+
decorative: !0,
|
|
16
18
|
width: "40px",
|
|
17
19
|
height: "40px",
|
|
18
20
|
variant: "circle"
|
|
@@ -21,9 +23,11 @@ function i({ showAvatar: i = !1, showActions: a = !1, count: o = 1, className: s
|
|
|
21
23
|
/* @__PURE__ */ r("div", {
|
|
22
24
|
className: "skeleton-row__content",
|
|
23
25
|
children: [/* @__PURE__ */ n(e, {
|
|
26
|
+
decorative: !0,
|
|
24
27
|
width: "25%",
|
|
25
28
|
height: "14px"
|
|
26
29
|
}), /* @__PURE__ */ n(e, {
|
|
30
|
+
decorative: !0,
|
|
27
31
|
width: "100%",
|
|
28
32
|
height: "16px"
|
|
29
33
|
})]
|
|
@@ -31,9 +35,11 @@ function i({ showAvatar: i = !1, showActions: a = !1, count: o = 1, className: s
|
|
|
31
35
|
a && /* @__PURE__ */ r("div", {
|
|
32
36
|
className: "skeleton-row__actions",
|
|
33
37
|
children: [/* @__PURE__ */ n(e, {
|
|
38
|
+
decorative: !0,
|
|
34
39
|
width: "32px",
|
|
35
40
|
height: "32px"
|
|
36
41
|
}), /* @__PURE__ */ n(e, {
|
|
42
|
+
decorative: !0,
|
|
37
43
|
width: "32px",
|
|
38
44
|
height: "32px"
|
|
39
45
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SkeletonRow2.js","names":[],"sources":["../../../src/components/Skeleton/SkeletonRow.tsx"],"sourcesContent":["/**\n * SkeletonRow Component\n *\n * Skeleton placeholder for list rows and table rows.\n * Mimics the structure of a log entry or table row.\n *\n * @example\n * // Basic usage\n * <SkeletonRow />\n *\n * @example\n * // With avatar\n * <SkeletonRow showAvatar />\n */\n\nimport { Skeleton } from \"./Skeleton\";\nimport \"./SkeletonRow.css\";\n\nexport interface SkeletonRowProps {\n /** Show avatar/icon on the left */\n showAvatar?: boolean;\n /** Show action buttons on the right */\n showActions?: boolean;\n /** Number of rows to display */\n count?: number;\n /** Additional CSS class names */\n className?: string;\n /** Test ID for testing */\n testId?: string;\n}\n\n/**\n * SkeletonRow provides a loading placeholder for list/table rows.\n *\n * Features:\n * - Optional avatar/icon\n * - Optional action buttons\n * - Multiple rows for lists\n */\nexport function SkeletonRow({\n showAvatar = false,\n showActions = false,\n count = 1,\n className = \"\",\n testId,\n}: SkeletonRowProps) {\n const rows = Array.from({ length: count });\n\n return (\n <>\n {rows.map((_, index) => (\n <div\n key={index}\n className={`skeleton-row ${className}`}\n data-testid={testId ? `${testId}-${String(index)}` : undefined}\n role=\"status\"\n aria-busy=\"true\"\n >\n {showAvatar && (\n <div className=\"skeleton-row__avatar\">\n <Skeleton width=\"40px\" height=\"40px\" variant=\"circle\" />\n </div>\n )}\n <div className=\"skeleton-row__content\">\n <Skeleton width=\"25%\" height=\"14px\" />\n <Skeleton width=\"100%\" height=\"16px\" />\n </div>\n {showActions && (\n <div className=\"skeleton-row__actions\">\n <Skeleton width=\"32px\" height=\"32px\" />\n <Skeleton width=\"32px\" height=\"32px\" />\n </div>\n )}\n </div>\n ))}\n </>\n );\n}\n\nexport default SkeletonRow;\n"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"SkeletonRow2.js","names":[],"sources":["../../../src/components/Skeleton/SkeletonRow.tsx"],"sourcesContent":["/**\n * SkeletonRow Component\n *\n * Skeleton placeholder for list rows and table rows.\n * Mimics the structure of a log entry or table row.\n *\n * @example\n * // Basic usage\n * <SkeletonRow />\n *\n * @example\n * // With avatar\n * <SkeletonRow showAvatar />\n */\n\nimport { Skeleton } from \"./Skeleton\";\nimport \"./SkeletonRow.css\";\n\nexport interface SkeletonRowProps {\n /** Show avatar/icon on the left */\n showAvatar?: boolean;\n /** Show action buttons on the right */\n showActions?: boolean;\n /** Number of rows to display */\n count?: number;\n /** Additional CSS class names */\n className?: string;\n /** Test ID for testing */\n testId?: string;\n /** Accessible name announced for the placeholder as a whole. Defaults to \"Loading\". */\n loadingLabel?: string;\n}\n\n/**\n * SkeletonRow provides a loading placeholder for list/table rows.\n *\n * Features:\n * - Optional avatar/icon\n * - Optional action buttons\n * - Multiple rows for lists\n */\nexport function SkeletonRow({\n showAvatar = false,\n showActions = false,\n count = 1,\n className = \"\",\n testId,\n loadingLabel,\n}: SkeletonRowProps) {\n const rows = Array.from({ length: count });\n\n return (\n <>\n {rows.map((_, index) => (\n <div\n key={index}\n className={`skeleton-row ${className}`}\n data-testid={testId ? `${testId}-${String(index)}` : undefined}\n role=\"status\"\n aria-busy=\"true\"\n aria-label={loadingLabel ?? \"Loading\"}\n >\n {showAvatar && (\n <div className=\"skeleton-row__avatar\">\n <Skeleton decorative width=\"40px\" height=\"40px\" variant=\"circle\" />\n </div>\n )}\n <div className=\"skeleton-row__content\">\n <Skeleton decorative width=\"25%\" height=\"14px\" />\n <Skeleton decorative width=\"100%\" height=\"16px\" />\n </div>\n {showActions && (\n <div className=\"skeleton-row__actions\">\n <Skeleton decorative width=\"32px\" height=\"32px\" />\n <Skeleton decorative width=\"32px\" height=\"32px\" />\n </div>\n )}\n </div>\n ))}\n </>\n );\n}\n\nexport default SkeletonRow;\n"],"mappings":";;;;AAyCA,SAAgB,EAAY,EAC1B,gBAAa,IACb,iBAAc,IACd,WAAQ,GACR,eAAY,IACZ,WACA,mBACmB;CACnB,IAAM,IAAO,MAAM,KAAK,EAAE,QAAQ,EAAM,CAAC;CAEzC,OACE,kBAAA,GAAA,EAAA,UACG,EAAK,KAAK,GAAG,MACZ,kBAAC,OAAD;EAEE,WAAW,gBAAgB;EAC3B,eAAa,IAAS,GAAG,EAAO,GAAG,OAAO,CAAK,MAAM,KAAA;EACrD,MAAK;EACL,aAAU;EACV,cAAY,KAAgB;EAN9B,UAAA;GAQG,KACC,kBAAC,OAAD;IAAK,WAAU;IACb,UAAA,kBAAC,GAAD;KAAU,YAAA;KAAW,OAAM;KAAO,QAAO;KAAO,SAAQ;IAAU,CAAA;GAC/D,CAAA;GAEP,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,kBAAC,GAAD;KAAU,YAAA;KAAW,OAAM;KAAM,QAAO;IAAQ,CAAA,GAChD,kBAAC,GAAD;KAAU,YAAA;KAAW,OAAM;KAAO,QAAO;IAAQ,CAAA,CAC9C;;GACJ,KACC,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,kBAAC,GAAD;KAAU,YAAA;KAAW,OAAM;KAAO,QAAO;IAAQ,CAAA,GACjD,kBAAC,GAAD;KAAU,YAAA;KAAW,OAAM;KAAO,QAAO;IAAQ,CAAA,CAC9C;;EAEJ;CAtBE,GAAA,CAsBF,CACN,EACD,CAAA;AAEN"}
|
|
@@ -7,6 +7,8 @@ export interface SkeletonTextProps {
|
|
|
7
7
|
className?: string;
|
|
8
8
|
/** Test ID for testing */
|
|
9
9
|
testId?: string;
|
|
10
|
+
/** Accessible name announced for the placeholder as a whole. Defaults to "Loading". */
|
|
11
|
+
loadingLabel?: string;
|
|
10
12
|
}
|
|
11
13
|
/**
|
|
12
14
|
* SkeletonText provides a loading placeholder for text content.
|
|
@@ -16,5 +18,5 @@ export interface SkeletonTextProps {
|
|
|
16
18
|
* - Configurable line spacing
|
|
17
19
|
* - Accessible via aria-busy
|
|
18
20
|
*/
|
|
19
|
-
export declare function SkeletonText({ lines, spacing, className, testId, }: SkeletonTextProps): import("react").JSX.Element;
|
|
21
|
+
export declare function SkeletonText({ lines, spacing, className, testId, loadingLabel, }: SkeletonTextProps): import("react").JSX.Element;
|
|
20
22
|
export default SkeletonText;
|
|
@@ -2,18 +2,20 @@ import { Skeleton as e } from "./Skeleton2.js";
|
|
|
2
2
|
/* empty css */
|
|
3
3
|
import { jsx as t } from "react/jsx-runtime";
|
|
4
4
|
//#region src/components/Skeleton/SkeletonText.tsx
|
|
5
|
-
function n({ lines: n = 3, spacing: r = "normal", className: i = "", testId: a }) {
|
|
6
|
-
let
|
|
5
|
+
function n({ lines: n = 3, spacing: r = "normal", className: i = "", testId: a, loadingLabel: o }) {
|
|
6
|
+
let s = [
|
|
7
7
|
"skeleton-text",
|
|
8
8
|
`skeleton-text--${r}`,
|
|
9
9
|
i
|
|
10
|
-
].filter(Boolean).join(" "),
|
|
10
|
+
].filter(Boolean).join(" "), c = Array.from({ length: n }, (e, t) => t === n - 1 ? "60%" : t % 2 == 0 ? "100%" : "95%");
|
|
11
11
|
return /* @__PURE__ */ t("div", {
|
|
12
|
-
className:
|
|
12
|
+
className: s,
|
|
13
13
|
"data-testid": a,
|
|
14
14
|
role: "status",
|
|
15
15
|
"aria-busy": "true",
|
|
16
|
-
|
|
16
|
+
"aria-label": o ?? "Loading",
|
|
17
|
+
children: c.map((n, r) => /* @__PURE__ */ t(e, {
|
|
18
|
+
decorative: !0,
|
|
17
19
|
width: n,
|
|
18
20
|
height: "1em",
|
|
19
21
|
variant: "text"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SkeletonText2.js","names":[],"sources":["../../../src/components/Skeleton/SkeletonText.tsx"],"sourcesContent":["/**\n * SkeletonText Component\n *\n * Skeleton placeholder for text content.\n * Provides multiple lines with varying widths for natural appearance.\n *\n * @example\n * // Basic usage (3 lines)\n * <SkeletonText />\n *\n * @example\n * // Custom number of lines\n * <SkeletonText lines={5} />\n */\n\nimport { Skeleton } from \"./Skeleton\";\nimport \"./SkeletonText.css\";\n\nexport interface SkeletonTextProps {\n /** Number of text lines to display */\n lines?: number;\n /** Spacing between lines */\n spacing?: \"compact\" | \"normal\" | \"relaxed\";\n /** Additional CSS class names */\n className?: string;\n /** Test ID for testing */\n testId?: string;\n}\n\n/**\n * SkeletonText provides a loading placeholder for text content.\n *\n * Features:\n * - Multiple lines with varying widths\n * - Configurable line spacing\n * - Accessible via aria-busy\n */\nexport function SkeletonText({\n lines = 3,\n spacing = \"normal\",\n className = \"\",\n testId,\n}: SkeletonTextProps) {\n const classNames = [\"skeleton-text\", `skeleton-text--${spacing}`, className]\n .filter(Boolean)\n .join(\" \");\n\n // Generate varying widths for natural appearance\n const widths = Array.from({ length: lines }, (_, i) => {\n if (i === lines - 1) {\n // Last line is shorter\n return \"60%\";\n }\n // Alternate between full and slightly shorter widths\n return i % 2 === 0 ? \"100%\" : \"95%\";\n });\n\n return (\n <div
|
|
1
|
+
{"version":3,"file":"SkeletonText2.js","names":[],"sources":["../../../src/components/Skeleton/SkeletonText.tsx"],"sourcesContent":["/**\n * SkeletonText Component\n *\n * Skeleton placeholder for text content.\n * Provides multiple lines with varying widths for natural appearance.\n *\n * @example\n * // Basic usage (3 lines)\n * <SkeletonText />\n *\n * @example\n * // Custom number of lines\n * <SkeletonText lines={5} />\n */\n\nimport { Skeleton } from \"./Skeleton\";\nimport \"./SkeletonText.css\";\n\nexport interface SkeletonTextProps {\n /** Number of text lines to display */\n lines?: number;\n /** Spacing between lines */\n spacing?: \"compact\" | \"normal\" | \"relaxed\";\n /** Additional CSS class names */\n className?: string;\n /** Test ID for testing */\n testId?: string;\n /** Accessible name announced for the placeholder as a whole. Defaults to \"Loading\". */\n loadingLabel?: string;\n}\n\n/**\n * SkeletonText provides a loading placeholder for text content.\n *\n * Features:\n * - Multiple lines with varying widths\n * - Configurable line spacing\n * - Accessible via aria-busy\n */\nexport function SkeletonText({\n lines = 3,\n spacing = \"normal\",\n className = \"\",\n testId,\n loadingLabel,\n}: SkeletonTextProps) {\n const classNames = [\"skeleton-text\", `skeleton-text--${spacing}`, className]\n .filter(Boolean)\n .join(\" \");\n\n // Generate varying widths for natural appearance\n const widths = Array.from({ length: lines }, (_, i) => {\n if (i === lines - 1) {\n // Last line is shorter\n return \"60%\";\n }\n // Alternate between full and slightly shorter widths\n return i % 2 === 0 ? \"100%\" : \"95%\";\n });\n\n return (\n <div\n className={classNames}\n data-testid={testId}\n role=\"status\"\n aria-busy=\"true\"\n aria-label={loadingLabel ?? \"Loading\"}\n >\n {widths.map((width, index) => (\n <Skeleton decorative key={index} width={width} height=\"1em\" variant=\"text\" />\n ))}\n </div>\n );\n}\n\nexport default SkeletonText;\n"],"mappings":";;;;AAuCA,SAAgB,EAAa,EAC3B,WAAQ,GACR,aAAU,UACV,eAAY,IACZ,WACA,mBACoB;CACpB,IAAM,IAAa;EAAC;EAAiB,kBAAkB;EAAW;CAAS,CAAC,CACzE,OAAO,OAAO,CAAC,CACf,KAAK,GAAG,GAGL,IAAS,MAAM,KAAK,EAAE,QAAQ,EAAM,IAAI,GAAG,MAC3C,MAAM,IAAQ,IAET,QAGF,IAAI,KAAM,IAAI,SAAS,KAC/B;CAED,OACE,kBAAC,OAAD;EACE,WAAW;EACX,eAAa;EACb,MAAK;EACL,aAAU;EACV,cAAY,KAAgB;EAE3B,UAAA,EAAO,KAAK,GAAO,MAClB,kBAAC,GAAD;GAAU,YAAA;GAA8B;GAAO,QAAO;GAAM,SAAQ;EAAQ,GAAlD,CAAkD,CAC7E;CACE,CAAA;AAET"}
|
|
@@ -13,6 +13,15 @@ export interface StatCardTrend {
|
|
|
13
13
|
export interface StatCardProps {
|
|
14
14
|
/** Short label rendered above the value (UPPERCASE styled) */
|
|
15
15
|
label: string;
|
|
16
|
+
/**
|
|
17
|
+
* Rendered in place of `label` when the label is not plain text: a glossary
|
|
18
|
+
* term carrying its definition, a unit badge, an info affordance.
|
|
19
|
+
*
|
|
20
|
+
* `label` stays required and stays the accessible name, so the name is a
|
|
21
|
+
* string the consumer wrote rather than whatever text happens to fall out of
|
|
22
|
+
* a node. Pass the same words in both.
|
|
23
|
+
*/
|
|
24
|
+
labelNode?: ReactNode;
|
|
16
25
|
/** Primary metric value (number is coerced to localised string) */
|
|
17
26
|
value: string | number;
|
|
18
27
|
/** Optional suffix appended to the value (e.g. "/ 4", "GB") */
|
|
@@ -54,6 +63,6 @@ export interface StatCardProps {
|
|
|
54
63
|
/** Visual weight. Default: "default" */
|
|
55
64
|
emphasis?: StatCardEmphasis;
|
|
56
65
|
}
|
|
57
|
-
declare function StatCardComponent({ label, value, valueSuffix, hint, icon, tone, trend, onClick, loading, ariaLabel, className, testId, format, animate, sparkline, emphasis, }: StatCardProps): JSX.Element;
|
|
66
|
+
declare function StatCardComponent({ label, labelNode, value, valueSuffix, hint, icon, tone, trend, onClick, loading, ariaLabel, className, testId, format, animate, sparkline, emphasis, }: StatCardProps): JSX.Element;
|
|
58
67
|
export declare const StatCard: import('react').MemoExoticComponent<typeof StatCardComponent>;
|
|
59
68
|
export {};
|
|
@@ -30,76 +30,76 @@ var d = {
|
|
|
30
30
|
function f(e, t) {
|
|
31
31
|
return typeof e == "number" ? t ? t(e) : e.toLocaleString() : e;
|
|
32
32
|
}
|
|
33
|
-
function p({ label: r,
|
|
34
|
-
let
|
|
33
|
+
function p({ label: r, labelNode: i, value: a, valueSuffix: o, hint: l, icon: p, tone: m = "default", trend: h, onClick: g, loading: _ = !1, ariaLabel: v, className: y = "", testId: b, format: x, animate: S = !1, sparkline: C, emphasis: w = "default" }) {
|
|
34
|
+
let T = n(), E = typeof a == "number", D = S && E && !_ && !T, O = u(E ? a : 0, D), k = f(E && D ? O : a, x), A = v ?? (_ ? r : `${r}: ${f(a, x)}${o ?? ""}`), j = [
|
|
35
35
|
"stat-card",
|
|
36
36
|
"corner-accent",
|
|
37
|
-
`stat-card--tone-${
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
`stat-card--tone-${m}`,
|
|
38
|
+
w === "default" ? "" : `stat-card--${w}`,
|
|
39
|
+
y
|
|
40
40
|
].filter(Boolean).join(" ");
|
|
41
41
|
return /* @__PURE__ */ c(e, {
|
|
42
|
-
className:
|
|
43
|
-
onClick:
|
|
44
|
-
role:
|
|
45
|
-
ariaLabel:
|
|
46
|
-
testId:
|
|
42
|
+
className: j,
|
|
43
|
+
onClick: g,
|
|
44
|
+
role: g ? void 0 : "group",
|
|
45
|
+
ariaLabel: A,
|
|
46
|
+
testId: b,
|
|
47
47
|
children: [
|
|
48
48
|
/* @__PURE__ */ c("div", {
|
|
49
49
|
className: "stat-card__header",
|
|
50
50
|
children: [/* @__PURE__ */ s("span", {
|
|
51
51
|
className: "stat-card__label",
|
|
52
|
-
children: r
|
|
53
|
-
}),
|
|
52
|
+
children: i ?? r
|
|
53
|
+
}), p && /* @__PURE__ */ s("span", {
|
|
54
54
|
className: "stat-card__icon",
|
|
55
55
|
"aria-hidden": "true",
|
|
56
|
-
children:
|
|
56
|
+
children: p
|
|
57
57
|
})]
|
|
58
58
|
}),
|
|
59
59
|
/* @__PURE__ */ c("div", {
|
|
60
60
|
className: "stat-card__body",
|
|
61
|
-
children: [
|
|
61
|
+
children: [_ ? /* @__PURE__ */ s(t, {
|
|
62
62
|
width: "60%",
|
|
63
63
|
height: "2rem"
|
|
64
|
-
}) :
|
|
64
|
+
}) : C ? /* @__PURE__ */ c("span", {
|
|
65
65
|
className: "stat-card__value-line",
|
|
66
66
|
children: [/* @__PURE__ */ c("span", {
|
|
67
67
|
className: "stat-card__value-row",
|
|
68
68
|
children: [/* @__PURE__ */ s("span", {
|
|
69
69
|
className: "stat-card__value",
|
|
70
|
-
children:
|
|
71
|
-
}),
|
|
70
|
+
children: k
|
|
71
|
+
}), o && /* @__PURE__ */ s("span", {
|
|
72
72
|
className: "stat-card__value-suffix",
|
|
73
|
-
children:
|
|
73
|
+
children: o
|
|
74
74
|
})]
|
|
75
75
|
}), /* @__PURE__ */ s("span", {
|
|
76
76
|
className: "stat-card__sparkline",
|
|
77
|
-
children:
|
|
77
|
+
children: C
|
|
78
78
|
})]
|
|
79
79
|
}) : /* @__PURE__ */ c("span", {
|
|
80
80
|
className: "stat-card__value-row",
|
|
81
81
|
children: [/* @__PURE__ */ s("span", {
|
|
82
82
|
className: "stat-card__value",
|
|
83
|
-
children:
|
|
84
|
-
}),
|
|
83
|
+
children: k
|
|
84
|
+
}), o && /* @__PURE__ */ s("span", {
|
|
85
85
|
className: "stat-card__value-suffix",
|
|
86
|
-
children:
|
|
86
|
+
children: o
|
|
87
87
|
})]
|
|
88
|
-
}),
|
|
89
|
-
className: `stat-card__trend stat-card__trend--${
|
|
90
|
-
"aria-label":
|
|
88
|
+
}), h && !_ && /* @__PURE__ */ c("span", {
|
|
89
|
+
className: `stat-card__trend stat-card__trend--${h.direction}`,
|
|
90
|
+
"aria-label": h.ariaLabel ?? h.label,
|
|
91
91
|
children: [/* @__PURE__ */ s("span", {
|
|
92
92
|
"aria-hidden": "true",
|
|
93
|
-
children: d[
|
|
94
|
-
}), /* @__PURE__ */ s("span", { children:
|
|
93
|
+
children: d[h.direction]
|
|
94
|
+
}), /* @__PURE__ */ s("span", { children: h.label })]
|
|
95
95
|
})]
|
|
96
96
|
}),
|
|
97
|
-
|
|
97
|
+
l != null && /* @__PURE__ */ s("div", {
|
|
98
98
|
className: "stat-card__hint",
|
|
99
|
-
children:
|
|
99
|
+
children: _ ? /* @__PURE__ */ s(t, {
|
|
100
100
|
width: "80%",
|
|
101
101
|
height: "0.85rem"
|
|
102
|
-
}) :
|
|
102
|
+
}) : l
|
|
103
103
|
})
|
|
104
104
|
]
|
|
105
105
|
});
|