@techsio/ui-kit 0.60.0 → 0.62.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 +59 -0
- package/dist/atoms/action-icon.js +9 -4
- package/dist/atoms/badge.js +59 -33
- package/dist/atoms/button.js +73 -54
- package/dist/atoms/checkbox.js +5 -1
- package/dist/atoms/hotkeys.js +5 -1
- package/dist/atoms/icon.js +9 -4
- package/dist/atoms/image.js +9 -2
- package/dist/atoms/input.js +10 -6
- package/dist/atoms/label.js +6 -1
- package/dist/atoms/link-button.js +9 -4
- package/dist/atoms/link.js +6 -1
- package/dist/atoms/numeric-input.js +11 -7
- package/dist/atoms/rating.js +5 -1
- package/dist/atoms/skeleton.js +22 -15
- package/dist/atoms/status-text.js +6 -1
- package/dist/atoms/textarea.js +23 -12
- package/dist/atoms/tooltip.js +10 -5
- package/dist/internal/molecules/vertical-navigation.styles.js +7 -7
- package/dist/molecules/accordion.js +20 -14
- package/dist/molecules/availability-status.js +2 -1
- package/dist/molecules/breadcrumb.js +9 -4
- package/dist/molecules/carousel.js +5 -1
- package/dist/molecules/cascade-select.js +8 -4
- package/dist/molecules/color-select.js +5 -1
- package/dist/molecules/combobox.js +8 -4
- package/dist/molecules/date-picker.js +26 -22
- package/dist/molecules/dialog.js +7 -3
- package/dist/molecules/drawer.js +9 -5
- package/dist/molecules/file-upload.js +9 -5
- package/dist/molecules/form-checkbox.js +5 -1
- package/dist/molecules/form-input.js +12 -2
- package/dist/molecules/form-numeric-input.js +11 -1
- package/dist/molecules/form-textarea.js +12 -2
- package/dist/molecules/menu.js +17 -7
- package/dist/molecules/pagination.js +13 -8
- package/dist/molecules/phone-input.js +5 -1
- package/dist/molecules/popover.js +10 -6
- package/dist/molecules/price-block.js +1 -1
- package/dist/molecules/product-card.js +5 -5
- package/dist/molecules/quantity-field.js +5 -1
- package/dist/molecules/radio-card.js +26 -21
- package/dist/molecules/radio-group.js +24 -19
- package/dist/molecules/search-form.js +8 -4
- package/dist/molecules/select.js +8 -4
- package/dist/molecules/slider.js +5 -1
- package/dist/molecules/steps.js +24 -14
- package/dist/molecules/switch.js +5 -1
- package/dist/molecules/tabs.js +13 -8
- package/dist/molecules/toast.js +3 -3
- package/dist/molecules/totals-summary.js +5 -5
- package/dist/molecules/tree-view.js +7 -2
- package/dist/molecules/vertical-navigation.js +23 -13
- package/dist/organisms/data-table.fields.js +2 -2
- package/dist/organisms/data-table.js +39 -23
- package/dist/organisms/footer.js +5 -1
- package/dist/organisms/gallery.js +1 -1
- package/dist/organisms/header.js +7 -3
- package/dist/organisms/line-item.js +2 -2
- package/dist/organisms/sidebar.js +5 -6
- package/dist/organisms/table.js +10 -5
- package/dist/src/atoms/action-icon.d.ts +5 -5
- package/dist/src/atoms/action-icon.d.ts.map +1 -1
- package/dist/src/atoms/badge.d.ts +55 -40
- package/dist/src/atoms/badge.d.ts.map +1 -1
- package/dist/src/atoms/button.d.ts +29 -18
- package/dist/src/atoms/button.d.ts.map +1 -1
- package/dist/src/atoms/checkbox.d.ts +2 -2
- package/dist/src/atoms/checkbox.d.ts.map +1 -1
- package/dist/src/atoms/hotkeys.d.ts +2 -2
- package/dist/src/atoms/hotkeys.d.ts.map +1 -1
- package/dist/src/atoms/icon.d.ts +5 -5
- package/dist/src/atoms/icon.d.ts.map +1 -1
- package/dist/src/atoms/image.d.ts +2 -2
- package/dist/src/atoms/image.d.ts.map +1 -1
- package/dist/src/atoms/input.d.ts +5 -5
- package/dist/src/atoms/input.d.ts.map +1 -1
- package/dist/src/atoms/label.d.ts +2 -2
- package/dist/src/atoms/label.d.ts.map +1 -1
- package/dist/src/atoms/link-button.d.ts +34 -29
- package/dist/src/atoms/link-button.d.ts.map +1 -1
- package/dist/src/atoms/link.d.ts +2 -2
- package/dist/src/atoms/link.d.ts.map +1 -1
- package/dist/src/atoms/numeric-input.d.ts +9 -8
- package/dist/src/atoms/numeric-input.d.ts.map +1 -1
- package/dist/src/atoms/rating.d.ts +2 -2
- package/dist/src/atoms/rating.d.ts.map +1 -1
- package/dist/src/atoms/skeleton.d.ts +9 -9
- package/dist/src/atoms/skeleton.d.ts.map +1 -1
- package/dist/src/atoms/status-text.d.ts +2 -2
- package/dist/src/atoms/status-text.d.ts.map +1 -1
- package/dist/src/atoms/textarea.d.ts +17 -8
- package/dist/src/atoms/textarea.d.ts.map +1 -1
- package/dist/src/atoms/tooltip.d.ts +7 -7
- package/dist/src/atoms/tooltip.d.ts.map +1 -1
- package/dist/src/internal/molecules/vertical-navigation.context.d.ts +2 -2
- package/dist/src/internal/molecules/vertical-navigation.context.d.ts.map +1 -1
- package/dist/src/internal/molecules/vertical-navigation.styles.d.ts +9 -9
- package/dist/src/internal/molecules/vertical-navigation.styles.d.ts.map +1 -1
- package/dist/src/molecules/accordion.d.ts +25 -14
- package/dist/src/molecules/accordion.d.ts.map +1 -1
- package/dist/src/molecules/availability-status.d.ts +1 -1
- package/dist/src/molecules/availability-status.d.ts.map +1 -1
- package/dist/src/molecules/breadcrumb.d.ts +6 -6
- package/dist/src/molecules/breadcrumb.d.ts.map +1 -1
- package/dist/src/molecules/carousel.d.ts +2 -2
- package/dist/src/molecules/carousel.d.ts.map +1 -1
- package/dist/src/molecules/cascade-select.d.ts +3 -3
- package/dist/src/molecules/cascade-select.d.ts.map +1 -1
- package/dist/src/molecules/color-select.d.ts +2 -2
- package/dist/src/molecules/color-select.d.ts.map +1 -1
- package/dist/src/molecules/combobox.d.ts +2 -2
- package/dist/src/molecules/combobox.d.ts.map +1 -1
- package/dist/src/molecules/command.d.ts +1 -1
- package/dist/src/molecules/date-picker.d.ts +5 -5
- package/dist/src/molecules/date-picker.d.ts.map +1 -1
- package/dist/src/molecules/dialog.d.ts +1 -1
- package/dist/src/molecules/dialog.d.ts.map +1 -1
- package/dist/src/molecules/drawer.d.ts +1 -1
- package/dist/src/molecules/drawer.d.ts.map +1 -1
- package/dist/src/molecules/file-upload.d.ts +2 -2
- package/dist/src/molecules/file-upload.d.ts.map +1 -1
- package/dist/src/molecules/form-checkbox.d.ts +1 -1
- package/dist/src/molecules/form-checkbox.d.ts.map +1 -1
- package/dist/src/molecules/form-input.d.ts +2 -2
- package/dist/src/molecules/form-input.d.ts.map +1 -1
- package/dist/src/molecules/form-numeric-input.d.ts +2 -2
- package/dist/src/molecules/form-numeric-input.d.ts.map +1 -1
- package/dist/src/molecules/form-textarea.d.ts +2 -2
- package/dist/src/molecules/form-textarea.d.ts.map +1 -1
- package/dist/src/molecules/menu.d.ts +2 -2
- package/dist/src/molecules/menu.d.ts.map +1 -1
- package/dist/src/molecules/pagination.d.ts +15 -15
- package/dist/src/molecules/pagination.d.ts.map +1 -1
- package/dist/src/molecules/phone-input.d.ts +2 -2
- package/dist/src/molecules/phone-input.d.ts.map +1 -1
- package/dist/src/molecules/popover.d.ts +4 -4
- package/dist/src/molecules/popover.d.ts.map +1 -1
- package/dist/src/molecules/price-block.d.ts +1 -1
- package/dist/src/molecules/product-card.d.ts +7 -7
- package/dist/src/molecules/product-card.d.ts.map +1 -1
- package/dist/src/molecules/quantity-field.d.ts +2 -2
- package/dist/src/molecules/quantity-field.d.ts.map +1 -1
- package/dist/src/molecules/radio-card.d.ts +7 -7
- package/dist/src/molecules/radio-card.d.ts.map +1 -1
- package/dist/src/molecules/radio-group.d.ts +7 -7
- package/dist/src/molecules/radio-group.d.ts.map +1 -1
- package/dist/src/molecules/search-form.d.ts +3 -3
- package/dist/src/molecules/search-form.d.ts.map +1 -1
- package/dist/src/molecules/select.d.ts +1 -1
- package/dist/src/molecules/select.d.ts.map +1 -1
- package/dist/src/molecules/slider.d.ts +1 -1
- package/dist/src/molecules/slider.d.ts.map +1 -1
- package/dist/src/molecules/steps.d.ts +7 -7
- package/dist/src/molecules/steps.d.ts.map +1 -1
- package/dist/src/molecules/switch.d.ts +1 -1
- package/dist/src/molecules/switch.d.ts.map +1 -1
- package/dist/src/molecules/tabs.d.ts +8 -8
- package/dist/src/molecules/tabs.d.ts.map +1 -1
- package/dist/src/molecules/totals-summary.d.ts +2 -2
- package/dist/src/molecules/tour.d.ts +1 -1
- package/dist/src/molecules/tree-view.d.ts +1 -1
- package/dist/src/molecules/tree-view.d.ts.map +1 -1
- package/dist/src/molecules/vertical-navigation.d.ts +13 -11
- package/dist/src/molecules/vertical-navigation.d.ts.map +1 -1
- package/dist/src/organisms/data-table.d.ts +5 -5
- package/dist/src/organisms/data-table.d.ts.map +1 -1
- package/dist/src/organisms/footer.d.ts +2 -2
- package/dist/src/organisms/footer.d.ts.map +1 -1
- package/dist/src/organisms/gallery.d.ts +1 -1
- package/dist/src/organisms/header.d.ts +2 -2
- package/dist/src/organisms/header.d.ts.map +1 -1
- package/dist/src/organisms/line-item.d.ts +2 -2
- package/dist/src/organisms/line-item.d.ts.map +1 -1
- package/dist/src/organisms/sidebar.d.ts +4 -3
- package/dist/src/organisms/sidebar.d.ts.map +1 -1
- package/dist/src/organisms/table.d.ts +5 -5
- package/dist/src/organisms/table.d.ts.map +1 -1
- package/dist/src/templates/accordion.d.ts +2 -2
- package/dist/src/templates/accordion.d.ts.map +1 -1
- package/dist/src/templates/breadcrumb.d.ts +1 -1
- package/dist/src/templates/carousel.d.ts +1 -1
- package/dist/src/templates/facet-filter-panel.d.ts +1 -1
- package/dist/src/templates/facet-filter-panel.d.ts.map +1 -1
- package/dist/src/templates/gallery.d.ts +1 -1
- package/dist/src/templates/numeric-input.d.ts +1 -1
- package/dist/src/templates/popover.d.ts +1 -1
- package/dist/src/templates/product-card.d.ts +1 -1
- package/dist/src/templates/select.d.ts +1 -1
- package/dist/src/templates/tabs.d.ts +2 -2
- package/dist/src/templates/tabs.d.ts.map +1 -1
- package/dist/src/theme/theme-config.d.ts +11 -0
- package/dist/src/theme/theme-config.d.ts.map +1 -1
- package/dist/src/theme/theme-provider.d.ts.map +1 -1
- package/dist/src/theme/ui-provider.d.ts +48 -0
- package/dist/src/theme/ui-provider.d.ts.map +1 -0
- package/dist/templates/accordion.js +1 -3
- package/dist/templates/facet-filter-panel.js +20 -9
- package/dist/templates/product-card.js +3 -3
- package/dist/templates/tabs.js +1 -3
- package/dist/theme/theme-config.js +12 -1
- package/dist/theme/theme-provider.js +6 -2
- package/dist/theme/theme-toggle.js +4 -4
- package/dist/theme/ui-provider.js +53 -0
- package/package.json +1 -1
- package/src/tokens/_foundation-overrides.css +1 -1
- package/src/tokens/_scheme-scopes.css +8 -0
- package/src/tokens/_semantic.css +1 -1
- package/src/tokens/components/atoms/_action-icon.css +1 -1
- package/src/tokens/components/atoms/_badge.css +13 -0
- package/src/tokens/components/atoms/_icon.css +1 -1
- package/src/tokens/components/molecules/_chart.css +1 -1
- package/src/tokens/components/molecules/_combobox.css +1 -1
- package/src/tokens/figma/akros/variables.css +1 -1
- package/src/tokens/figma/business/variables.css +1 -1
- package/src/tokens/figma/dark/variables.css +1 -1
- package/src/tokens/figma/light/variables.css +1 -1
- package/src/tokens/figma/n1/variables.css +1 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type PropsWithChildren } from "react";
|
|
2
|
+
/** Canonical fill styles shared by every component that has an `appearance`. */
|
|
3
|
+
export type UIAppearance = "solid" | "subtle" | "outline" | "ghost" | "plain";
|
|
4
|
+
/** The shared size scale. Each component accepts the subset it supports. */
|
|
5
|
+
export type UISize = "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "full";
|
|
6
|
+
/** Color intent shared by every component that has a `severity`. */
|
|
7
|
+
export type UISeverity = "primary" | "secondary" | "tertiary" | "neutral" | "info" | "success" | "warning" | "danger" | "discount";
|
|
8
|
+
/** Per-component defaults. Values are typed loosely on purpose: a component
|
|
9
|
+
* keeps its own scale (Dialog `full`, Icon `current`, Tabs `line` …). */
|
|
10
|
+
export type UIComponentDefaults = {
|
|
11
|
+
size?: string;
|
|
12
|
+
appearance?: string;
|
|
13
|
+
};
|
|
14
|
+
export type UIComponentName = "Accordion" | "ActionIcon" | "Badge" | "Breadcrumb" | "Button" | "Carousel" | "CascadeSelect" | "Checkbox" | "ColorSelect" | "Combobox" | "DataTable" | "DatePicker" | "Dialog" | "Drawer" | "FacetFilterPanel" | "FileUpload" | "Footer" | "Header" | "Hotkeys" | "Icon" | "Image" | "Input" | "Label" | "Link" | "LinkButton" | "Menu" | "NumericInput" | "Pagination" | "PhoneInput" | "Popover" | "QuantityField" | "RadioCard" | "RadioGroup" | "Rating" | "SearchForm" | "Select" | "Skeleton" | "Slider" | "StatusText" | "Steps" | "Switch" | "Table" | "Tabs" | "Textarea" | "Tooltip" | "TreeView" | "VerticalNavigation";
|
|
15
|
+
export type UIDefaults = {
|
|
16
|
+
/** Default size for every component that has a `size` prop. */
|
|
17
|
+
size?: UISize;
|
|
18
|
+
/** Default fill style for every component that has an `appearance` prop. */
|
|
19
|
+
appearance?: UIAppearance;
|
|
20
|
+
/** Per-component defaults; they win over the global values of the same provider. */
|
|
21
|
+
components?: Partial<Record<UIComponentName, UIComponentDefaults>>;
|
|
22
|
+
};
|
|
23
|
+
export type UIProviderProps = PropsWithChildren<UIDefaults>;
|
|
24
|
+
type UIStyleKey = keyof UIComponentDefaults;
|
|
25
|
+
export declare function UIProvider({ size, appearance, components, children, }: UIProviderProps): import("react").JSX.Element;
|
|
26
|
+
/** Variant keys supported by a `tv()` style function, e.g. `["sm","md","lg"]`. */
|
|
27
|
+
export declare function variantKeys(styles: {
|
|
28
|
+
variants?: unknown;
|
|
29
|
+
}, key: string): readonly string[];
|
|
30
|
+
type Supported<T extends UIStyleKey> = Partial<Record<T, readonly string[]>>;
|
|
31
|
+
/** A `tv()` style function, or an explicit list of supported values per key. */
|
|
32
|
+
type UIStyleSource<T extends UIStyleKey> = {
|
|
33
|
+
variants?: unknown;
|
|
34
|
+
} | Supported<T>;
|
|
35
|
+
/**
|
|
36
|
+
* Resolve `size` / `appearance` for a component against the provider chain.
|
|
37
|
+
* Pass the props as received (undefined when the caller did not set them) and
|
|
38
|
+
* either the component's `tv()` styles (supported values are read from its
|
|
39
|
+
* variants) or an explicit list per key. An explicit prop always wins.
|
|
40
|
+
*
|
|
41
|
+
* ```ts
|
|
42
|
+
* const resolved = useUIDefaults("Button", { size, appearance }, buttonVariants)
|
|
43
|
+
* const { size } = useUIDefaults("Select", { size }, { size: SELECT_SIZES })
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare function useUIDefaults<P extends Partial<Record<UIStyleKey, string | undefined | null>>>(component: UIComponentName, props: P, source: UIStyleSource<Extract<keyof P, UIStyleKey>>): P;
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=ui-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui-provider.d.ts","sourceRoot":"","sources":["../../../src/theme/ui-provider.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAiB,KAAK,iBAAiB,EAAc,MAAM,OAAO,CAAA;AAEzE,gFAAgF;AAChF,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAA;AAE7E,4EAA4E;AAC5E,MAAM,MAAM,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,MAAM,CAAA;AAEtE,oEAAoE;AACpE,MAAM,MAAM,UAAU,GAClB,SAAS,GACT,WAAW,GACX,UAAU,GACV,SAAS,GACT,MAAM,GACN,SAAS,GACT,SAAS,GACT,QAAQ,GACR,UAAU,CAAA;AAEd;yEACyE;AACzE,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,eAAe,GACvB,WAAW,GACX,YAAY,GACZ,OAAO,GACP,YAAY,GACZ,QAAQ,GACR,UAAU,GACV,eAAe,GACf,UAAU,GACV,aAAa,GACb,UAAU,GACV,WAAW,GACX,YAAY,GACZ,QAAQ,GACR,QAAQ,GACR,kBAAkB,GAClB,YAAY,GACZ,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,MAAM,GACN,OAAO,GACP,OAAO,GACP,OAAO,GACP,MAAM,GACN,YAAY,GACZ,MAAM,GACN,cAAc,GACd,YAAY,GACZ,YAAY,GACZ,SAAS,GACT,eAAe,GACf,WAAW,GACX,YAAY,GACZ,QAAQ,GACR,YAAY,GACZ,QAAQ,GACR,UAAU,GACV,QAAQ,GACR,YAAY,GACZ,OAAO,GACP,QAAQ,GACR,OAAO,GACP,MAAM,GACN,UAAU,GACV,SAAS,GACT,UAAU,GACV,oBAAoB,CAAA;AAExB,MAAM,MAAM,UAAU,GAAG;IACvB,+DAA+D;IAC/D,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,4EAA4E;IAC5E,UAAU,CAAC,EAAE,YAAY,CAAA;IACzB,oFAAoF;IACpF,UAAU,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,mBAAmB,CAAC,CAAC,CAAA;CACnE,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,iBAAiB,CAAC,UAAU,CAAC,CAAA;AAE3D,KAAK,UAAU,GAAG,MAAM,mBAAmB,CAAA;AAK3C,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,UAAU,EACV,UAAU,EACV,QAAQ,GACT,EAAE,eAAe,+BASjB;AAED,kFAAkF;AAClF,wBAAgB,WAAW,CACzB,MAAM,EAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,EAC9B,GAAG,EAAE,MAAM,GACV,SAAS,MAAM,EAAE,CAInB;AAoBD,KAAK,SAAS,CAAC,CAAC,SAAS,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CAAA;AAE5E,gFAAgF;AAChF,KAAK,aAAa,CAAC,CAAC,SAAS,UAAU,IAAI;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAAA;AAYhF;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAC3B,CAAC,SAAS,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC,CAAC,EAEhE,SAAS,EAAE,eAAe,EAC1B,KAAK,EAAE,CAAC,EACR,MAAM,EAAE,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,CAAC,GAClD,CAAC,CAiBH"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Accordion } from "../molecules/accordion.js";
|
|
4
|
-
function AccordionTemplate({ items, headingLevel = 3, showIndicator = true, indicatorIcon = "token-icon-accordion-chevron",
|
|
4
|
+
function AccordionTemplate({ items, headingLevel = 3, showIndicator = true, indicatorIcon = "token-icon-accordion-chevron", shadow = "none", collapsible = true, multiple = false, defaultValue, value, onChange, ref, className, ...accordionProps }) {
|
|
5
5
|
return /*#__PURE__*/ jsx(Accordion, {
|
|
6
6
|
className: className,
|
|
7
7
|
collapsible: collapsible,
|
|
@@ -10,9 +10,7 @@ function AccordionTemplate({ items, headingLevel = 3, showIndicator = true, indi
|
|
|
10
10
|
onChange: onChange,
|
|
11
11
|
ref: ref,
|
|
12
12
|
shadow: shadow,
|
|
13
|
-
size: size,
|
|
14
13
|
value: value,
|
|
15
|
-
variant: variant,
|
|
16
14
|
...accordionProps,
|
|
17
15
|
children: items.map((item)=>/*#__PURE__*/ jsxs(Accordion.Item, {
|
|
18
16
|
disabled: item.disabled,
|
|
@@ -8,6 +8,7 @@ import { Accordion } from "../molecules/accordion.js";
|
|
|
8
8
|
import { Dialog } from "../molecules/dialog.js";
|
|
9
9
|
import { FormCheckbox } from "../molecules/form-checkbox.js";
|
|
10
10
|
import { Slider } from "../molecules/slider.js";
|
|
11
|
+
import { useUIDefaults } from "../theme/ui-provider.js";
|
|
11
12
|
import { tv } from "../utils.js";
|
|
12
13
|
const facetFilterPanelStyles = tv({
|
|
13
14
|
slots: {
|
|
@@ -88,20 +89,29 @@ function FacetFilterOptions({ group, selectedValues, disabled, readOnly, size, s
|
|
|
88
89
|
}, option.value))
|
|
89
90
|
}),
|
|
90
91
|
hasOverflow ? /*#__PURE__*/ jsx(Button, {
|
|
92
|
+
appearance: "ghost",
|
|
91
93
|
"aria-expanded": expanded,
|
|
92
94
|
className: styles.overflowAction(),
|
|
93
95
|
disabled: disabled,
|
|
94
96
|
onClick: ()=>setExpanded((current)=>!current),
|
|
97
|
+
severity: "primary",
|
|
95
98
|
size: "sm",
|
|
96
|
-
theme: "borderless",
|
|
97
99
|
type: "button",
|
|
98
|
-
variant: "primary",
|
|
99
100
|
children: expanded ? showLessLabel : showMoreLabel(group.options.length - collapseAfter)
|
|
100
101
|
}) : null
|
|
101
102
|
]
|
|
102
103
|
});
|
|
103
104
|
}
|
|
104
|
-
function FacetFilterPanelContent({ title, groups, selectedValues = {}, activeFilters = [], disabled = false, readOnly = false, size
|
|
105
|
+
function FacetFilterPanelContent({ title, groups, selectedValues = {}, activeFilters = [], disabled = false, readOnly = false, size: sizeProp, pending = false, pendingLabel, activeFiltersLabel, resetLabel, showMoreLabel, showLessLabel, expandedGroups, defaultExpandedGroups, onExpandedGroupsChange, onOptionChange, onRangeChange, onRangeChangeEnd, onRemoveFilter, onReset, showTitle, titleId }) {
|
|
106
|
+
const { size = "md" } = useUIDefaults("FacetFilterPanel", {
|
|
107
|
+
size: sizeProp
|
|
108
|
+
}, {
|
|
109
|
+
size: [
|
|
110
|
+
"sm",
|
|
111
|
+
"md",
|
|
112
|
+
"lg"
|
|
113
|
+
]
|
|
114
|
+
});
|
|
105
115
|
const styles = facetFilterPanelStyles();
|
|
106
116
|
const messages = useUiMessages();
|
|
107
117
|
const showMoreText = showMoreLabel ?? messages.facetFilterPanel.showMore;
|
|
@@ -148,15 +158,16 @@ function FacetFilterPanelContent({ title, groups, selectedValues = {}, activeFil
|
|
|
148
158
|
resetLabel: resetLabel ?? messages.facetFilterPanel.reset
|
|
149
159
|
}),
|
|
150
160
|
/*#__PURE__*/ jsx(Accordion, {
|
|
161
|
+
appearance: "ghost",
|
|
151
162
|
className: styles.groups(),
|
|
152
163
|
disabled: disabled,
|
|
153
164
|
multiple: true,
|
|
165
|
+
nested: true,
|
|
154
166
|
onChange: (groupIds)=>{
|
|
155
167
|
if (void 0 === expandedGroups) setLocalExpandedGroups(groupIds);
|
|
156
168
|
onExpandedGroupsChange?.(groupIds);
|
|
157
169
|
},
|
|
158
170
|
value: expandedGroups ?? localExpandedGroups,
|
|
159
|
-
variant: "child",
|
|
160
171
|
children: groups.map((group)=>{
|
|
161
172
|
if ("range" === group.type) return /*#__PURE__*/ jsx("section", {
|
|
162
173
|
className: styles.rangeGroup(),
|
|
@@ -241,8 +252,8 @@ function FacetFilterPanel({ "aria-label": ariaLabel, presentation = "inline", dr
|
|
|
241
252
|
icon: "token-icon-facet-filter-panel-filter",
|
|
242
253
|
onClick: ()=>setDrawerOpen(true),
|
|
243
254
|
ref: drawerTriggerRef,
|
|
255
|
+
severity: "primary",
|
|
244
256
|
type: "button",
|
|
245
|
-
variant: "primary",
|
|
246
257
|
children: [
|
|
247
258
|
drawerTriggerLabel ?? props.title,
|
|
248
259
|
activeCount > 0 ? /*#__PURE__*/ jsx("span", {
|
|
@@ -342,15 +353,15 @@ FacetFilterPanel.ActiveFilters = function({ items, label, resetLabel, disabled =
|
|
|
342
353
|
children: resolvedLabel
|
|
343
354
|
}),
|
|
344
355
|
!readOnly && /*#__PURE__*/ jsx(Button, {
|
|
356
|
+
appearance: "ghost",
|
|
345
357
|
disabled: disabled,
|
|
346
358
|
onClick: (event)=>{
|
|
347
359
|
trackFocus(event.currentTarget, -1);
|
|
348
360
|
onReset?.();
|
|
349
361
|
},
|
|
362
|
+
severity: "primary",
|
|
350
363
|
size: "sm",
|
|
351
|
-
theme: "borderless",
|
|
352
364
|
type: "button",
|
|
353
|
-
variant: "primary",
|
|
354
365
|
children: resetLabel ?? messages.facetFilterPanel.reset
|
|
355
366
|
})
|
|
356
367
|
]
|
|
@@ -361,6 +372,7 @@ FacetFilterPanel.ActiveFilters = function({ items, label, resetLabel, disabled =
|
|
|
361
372
|
className: styles.optionText(),
|
|
362
373
|
children: item.label
|
|
363
374
|
}, item.id) : /*#__PURE__*/ jsx(Button, {
|
|
375
|
+
appearance: "outline",
|
|
364
376
|
"aria-label": item.removeLabel,
|
|
365
377
|
"data-filter-id": item.id,
|
|
366
378
|
disabled: disabled,
|
|
@@ -370,10 +382,9 @@ FacetFilterPanel.ActiveFilters = function({ items, label, resetLabel, disabled =
|
|
|
370
382
|
trackFocus(event.currentTarget, items.indexOf(item));
|
|
371
383
|
onRemove?.(item.id);
|
|
372
384
|
},
|
|
385
|
+
severity: "primary",
|
|
373
386
|
size: "sm",
|
|
374
|
-
theme: "outlined",
|
|
375
387
|
type: "button",
|
|
376
|
-
variant: "primary",
|
|
377
388
|
children: item.label
|
|
378
389
|
}, item.id))
|
|
379
390
|
})
|
|
@@ -98,19 +98,19 @@ function ProductCardTemplate({ image, name, nameAs, href, linkAs, linkProps, pri
|
|
|
98
98
|
showActions && (onAddToCart || onViewDetails || onAddToWishlist) && /*#__PURE__*/ jsxs(ProductCard.Actions, {
|
|
99
99
|
children: [
|
|
100
100
|
onAddToCart && /*#__PURE__*/ jsx(ProductCard.Button, {
|
|
101
|
-
|
|
101
|
+
action: "cart",
|
|
102
102
|
icon: "token-icon-cart-button",
|
|
103
103
|
onClick: onAddToCart,
|
|
104
104
|
children: cartButtonText ?? messages.productCard.addToCart
|
|
105
105
|
}),
|
|
106
106
|
onViewDetails && /*#__PURE__*/ jsx(ProductCard.Button, {
|
|
107
|
-
|
|
107
|
+
action: "detail",
|
|
108
108
|
icon: "token-icon-detail-button",
|
|
109
109
|
onClick: onViewDetails,
|
|
110
110
|
children: detailButtonText ?? messages.productCard.viewDetails
|
|
111
111
|
}),
|
|
112
112
|
onAddToWishlist && /*#__PURE__*/ jsx(ProductCard.Button, {
|
|
113
|
-
|
|
113
|
+
action: "wishlist",
|
|
114
114
|
icon: "token-icon-wishlist-button",
|
|
115
115
|
onClick: onAddToWishlist,
|
|
116
116
|
children: wishlistButtonText ?? messages.productCard.addToWishlist
|
package/dist/templates/tabs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Tabs } from "../molecules/tabs.js";
|
|
4
|
-
function TabsTemplate({ items, tablistProps, showIndicator = false,
|
|
4
|
+
function TabsTemplate({ items, tablistProps, showIndicator = false, fitted = false, justify = "start", orientation = "horizontal", defaultValue, value, onValueChange, ref, className, ...tabsProps }) {
|
|
5
5
|
return /*#__PURE__*/ jsxs(Tabs, {
|
|
6
6
|
className: className,
|
|
7
7
|
defaultValue: defaultValue ?? items.find((item)=>!item.disabled)?.value,
|
|
@@ -10,9 +10,7 @@ function TabsTemplate({ items, tablistProps, showIndicator = false, variant = "d
|
|
|
10
10
|
onValueChange: onValueChange,
|
|
11
11
|
orientation: orientation,
|
|
12
12
|
ref: ref,
|
|
13
|
-
size: size,
|
|
14
13
|
value: value,
|
|
15
|
-
variant: variant,
|
|
16
14
|
...tabsProps,
|
|
17
15
|
children: [
|
|
18
16
|
/*#__PURE__*/ jsxs(Tabs.List, {
|
|
@@ -34,6 +34,17 @@ function getBrand(key) {
|
|
|
34
34
|
function isBrandKey(value) {
|
|
35
35
|
return Object.hasOwn(THEMES, value);
|
|
36
36
|
}
|
|
37
|
+
const BASE_UI_DEFAULTS = {
|
|
38
|
+
size: "md",
|
|
39
|
+
appearance: "solid"
|
|
40
|
+
};
|
|
41
|
+
function brandUIDefaults(key) {
|
|
42
|
+
const defaults = getBrand(key).defaults;
|
|
43
|
+
return {
|
|
44
|
+
...BASE_UI_DEFAULTS,
|
|
45
|
+
...defaults
|
|
46
|
+
};
|
|
47
|
+
}
|
|
37
48
|
function brandAttr(key) {
|
|
38
49
|
return getBrand(key).attr;
|
|
39
50
|
}
|
|
@@ -49,4 +60,4 @@ function availableModeSettings(key) {
|
|
|
49
60
|
"light"
|
|
50
61
|
];
|
|
51
62
|
}
|
|
52
|
-
export { BRAND_STORAGE_KEY, DEFAULT_BRAND, DEFAULT_MODE, MODE_STORAGE_KEY, THEMES, availableModeSettings, brandAttr, brandKeys, brandSupportsDark, getBrand, isBrandKey };
|
|
63
|
+
export { BASE_UI_DEFAULTS, BRAND_STORAGE_KEY, DEFAULT_BRAND, DEFAULT_MODE, MODE_STORAGE_KEY, THEMES, availableModeSettings, brandAttr, brandKeys, brandSupportsDark, brandUIDefaults, getBrand, isBrandKey };
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { ThemeProvider, useTheme } from "better-themes";
|
|
5
5
|
import { createContext, useContext, useEffect, useLayoutEffect, useState, useSyncExternalStore } from "react";
|
|
6
|
-
import { BRAND_STORAGE_KEY, DEFAULT_BRAND, DEFAULT_MODE, MODE_STORAGE_KEY, availableModeSettings, brandAttr, brandKeys, brandSupportsDark, isBrandKey } from "./theme-config.js";
|
|
6
|
+
import { BRAND_STORAGE_KEY, DEFAULT_BRAND, DEFAULT_MODE, MODE_STORAGE_KEY, availableModeSettings, brandAttr, brandKeys, brandSupportsDark, brandUIDefaults, isBrandKey } from "./theme-config.js";
|
|
7
|
+
import { UIProvider } from "./ui-provider.js";
|
|
7
8
|
function readStoredBrand() {
|
|
8
9
|
try {
|
|
9
10
|
const value = window.localStorage.getItem(BRAND_STORAGE_KEY);
|
|
@@ -71,7 +72,10 @@ function BrandProvider({ defaultBrand, defaultMode, children }) {
|
|
|
71
72
|
availableModes: availableModeSettings(brand),
|
|
72
73
|
mounted
|
|
73
74
|
},
|
|
74
|
-
children:
|
|
75
|
+
children: /*#__PURE__*/ jsx(UIProvider, {
|
|
76
|
+
...brandUIDefaults(mounted ? brand : defaultBrand),
|
|
77
|
+
children: children
|
|
78
|
+
})
|
|
75
79
|
});
|
|
76
80
|
}
|
|
77
81
|
function AppThemeProvider({ defaultBrand = DEFAULT_BRAND, defaultMode = DEFAULT_MODE, nonce, children }) {
|
|
@@ -41,13 +41,13 @@ function ThemeToggle({ className }) {
|
|
|
41
41
|
/*#__PURE__*/ jsx("div", {
|
|
42
42
|
className: row(),
|
|
43
43
|
children: brands.map((key)=>/*#__PURE__*/ jsx(Button, {
|
|
44
|
+
appearance: mounted && key === brand ? "solid" : "outline",
|
|
44
45
|
"aria-pressed": mounted && key === brand,
|
|
45
46
|
className: choice(),
|
|
46
47
|
onClick: ()=>setBrand(key),
|
|
48
|
+
severity: "primary",
|
|
47
49
|
size: "sm",
|
|
48
|
-
theme: mounted && key === brand ? "solid" : "outlined",
|
|
49
50
|
type: "button",
|
|
50
|
-
variant: "primary",
|
|
51
51
|
children: getBrand(key).label
|
|
52
52
|
}, key))
|
|
53
53
|
})
|
|
@@ -63,13 +63,13 @@ function ThemeToggle({ className }) {
|
|
|
63
63
|
/*#__PURE__*/ jsx("div", {
|
|
64
64
|
className: row(),
|
|
65
65
|
children: availableModes.map((value)=>/*#__PURE__*/ jsx(Button, {
|
|
66
|
+
appearance: mounted && value === mode ? "solid" : "outline",
|
|
66
67
|
"aria-pressed": mounted && value === mode,
|
|
67
68
|
className: choice(),
|
|
68
69
|
onClick: ()=>setMode(value),
|
|
70
|
+
severity: "secondary",
|
|
69
71
|
size: "sm",
|
|
70
|
-
theme: mounted && value === mode ? "solid" : "outlined",
|
|
71
72
|
type: "button",
|
|
72
|
-
variant: "secondary",
|
|
73
73
|
children: modeLabels[value]
|
|
74
74
|
}, value))
|
|
75
75
|
})
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { createContext, useContext } from "react";
|
|
5
|
+
const UIDefaultsContext = /*#__PURE__*/ createContext([]);
|
|
6
|
+
function UIProvider({ size, appearance, components, children }) {
|
|
7
|
+
const parent = useContext(UIDefaultsContext);
|
|
8
|
+
return /*#__PURE__*/ jsx(UIDefaultsContext.Provider, {
|
|
9
|
+
value: [
|
|
10
|
+
...parent,
|
|
11
|
+
{
|
|
12
|
+
size,
|
|
13
|
+
appearance,
|
|
14
|
+
components
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
children: children
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
function variantKeys(styles, key) {
|
|
21
|
+
const variants = styles.variants;
|
|
22
|
+
const values = variants?.[key];
|
|
23
|
+
return values ? Object.keys(values) : [];
|
|
24
|
+
}
|
|
25
|
+
function pick(levels, component, key, supported) {
|
|
26
|
+
for(let i = levels.length - 1; i >= 0; i--){
|
|
27
|
+
const level = levels[i];
|
|
28
|
+
const candidates = [
|
|
29
|
+
level?.components?.[component]?.[key],
|
|
30
|
+
level?.[key]
|
|
31
|
+
];
|
|
32
|
+
for (const value of candidates)if (void 0 !== value && supported.includes(value)) return value;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function supportedValues(source, key) {
|
|
36
|
+
if ("variants" in source) return variantKeys(source, key);
|
|
37
|
+
return source[key];
|
|
38
|
+
}
|
|
39
|
+
function useUIDefaults(component, props, source) {
|
|
40
|
+
const levels = useContext(UIDefaultsContext);
|
|
41
|
+
if (0 === levels.length) return props;
|
|
42
|
+
const resolved = {
|
|
43
|
+
...props
|
|
44
|
+
};
|
|
45
|
+
for (const key of Object.keys(props)){
|
|
46
|
+
if (null != props[key]) continue;
|
|
47
|
+
const values = supportedValues(source, key);
|
|
48
|
+
const value = values ? pick(levels, component, key, values) : void 0;
|
|
49
|
+
if (void 0 !== value) resolved[key] = value;
|
|
50
|
+
}
|
|
51
|
+
return resolved;
|
|
52
|
+
}
|
|
53
|
+
export { UIProvider, useUIDefaults, variantKeys };
|
package/package.json
CHANGED
|
@@ -166,7 +166,7 @@
|
|
|
166
166
|
min-height: var(--height-form-control-lg);
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
-
/* Two-
|
|
169
|
+
/* Two-severity focus: at least one edge contrasts with both bright fills and dark
|
|
170
170
|
* surfaces. Do not replace validation outlines while the control is resting. */
|
|
171
171
|
:where(button, a, input, select, textarea, [tabindex], [data-part]):is(
|
|
172
172
|
:focus-visible,
|
|
@@ -269,6 +269,14 @@
|
|
|
269
269
|
var(--color-white)
|
|
270
270
|
);
|
|
271
271
|
--color-popup-item-fg-checked: var(--color-popup-checked);
|
|
272
|
+
--color-badge-border-outline-primary: var(--color-badge-bg-primary);
|
|
273
|
+
--color-badge-border-outline-secondary: var(--color-badge-bg-secondary);
|
|
274
|
+
--color-badge-border-outline-tertiary: var(--color-badge-bg-tertiary);
|
|
275
|
+
--color-badge-border-outline-discount: var(--color-badge-bg-discount);
|
|
276
|
+
--color-badge-border-outline-info: var(--color-badge-bg-info);
|
|
277
|
+
--color-badge-border-outline-success: var(--color-badge-bg-success);
|
|
278
|
+
--color-badge-border-outline-warning: var(--color-badge-bg-warning);
|
|
279
|
+
--color-badge-border-outline-danger: var(--color-badge-bg-danger);
|
|
272
280
|
--text-action-icon-glyph-sm: var(--text-icon-control-sm);
|
|
273
281
|
--text-action-icon-glyph-md: var(--text-icon-control-md);
|
|
274
282
|
--text-action-icon-glyph-lg: var(--text-icon-control-lg);
|
package/src/tokens/_semantic.css
CHANGED
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
/* === TAILWIND UTILITY VARIABLES === */
|
|
60
60
|
@theme static {
|
|
61
61
|
/* Colors */
|
|
62
|
-
/* User interface main
|
|
62
|
+
/* User interface main severity and interactive colors, usually used for main operation button, etc */
|
|
63
63
|
--color-primary: light-dark(var(--color-blue-300), var(--color-sky-300));
|
|
64
64
|
--color-primary-hover: oklch(
|
|
65
65
|
from var(--color-primary) calc(l + var(--state-hover)) c h
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* Code-owned pressed pair; hand off the aliases to Figma before export.
|
|
2
2
|
* Opposite danger endpoints stay distinct in every brand and color scheme.
|
|
3
|
-
* Use explicit foreground paint so simultaneous hover cannot leak its
|
|
3
|
+
* Use explicit foreground paint so simultaneous hover cannot leak its severity. */
|
|
4
4
|
@theme static {
|
|
5
5
|
/* Default to the shared scale; theme refinements stay local to ActionIcon. */
|
|
6
6
|
--text-action-icon-glyph-sm: var(--text-icon-control-sm);
|
|
@@ -6,10 +6,23 @@
|
|
|
6
6
|
* utility on the root; every variant overrides it via Figma's
|
|
7
7
|
* `--color-badge-border-{variant}` tokens).
|
|
8
8
|
*
|
|
9
|
+
* - `--color-badge-border-outline-{severity}`: the border of
|
|
10
|
+
* `appearance="outline"` with a severity. Severity borders exported by
|
|
11
|
+
* Figma can be transparent (they match the fill), so the outline look
|
|
12
|
+
* draws its frame in the severity's fill color instead.
|
|
13
|
+
*
|
|
9
14
|
* Sizing, color, font-weight, radius, border-width are all owned by Figma
|
|
10
15
|
* now — see grep `--color-badge-` in figma/variables.css.
|
|
11
16
|
*/
|
|
12
17
|
|
|
13
18
|
@theme static {
|
|
14
19
|
--color-badge-border: oklch(0 0 none / 0);
|
|
20
|
+
--color-badge-border-outline-primary: var(--color-badge-bg-primary);
|
|
21
|
+
--color-badge-border-outline-secondary: var(--color-badge-bg-secondary);
|
|
22
|
+
--color-badge-border-outline-tertiary: var(--color-badge-bg-tertiary);
|
|
23
|
+
--color-badge-border-outline-discount: var(--color-badge-bg-discount);
|
|
24
|
+
--color-badge-border-outline-info: var(--color-badge-bg-info);
|
|
25
|
+
--color-badge-border-outline-success: var(--color-badge-bg-success);
|
|
26
|
+
--color-badge-border-outline-warning: var(--color-badge-bg-warning);
|
|
27
|
+
--color-badge-border-outline-danger: var(--color-badge-bg-danger);
|
|
15
28
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Icon — sizes and component color aliases come from Figma tokens.
|
|
3
|
-
* `
|
|
3
|
+
* `severity="current"` inherits text; explicit colors consume --color-icon-fg-*.
|
|
4
4
|
* Semantic glyph aliases below use the MDI and MDI Light families.
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
|
|
36
36
|
/* Derived layer — chart chrome and tooltip surface. Axis/tick/legend text
|
|
37
37
|
* renders at small sizes inside the SVG, so it wears primary ink rather than
|
|
38
|
-
* the secondary
|
|
38
|
+
* the secondary severity.
|
|
39
39
|
*
|
|
40
40
|
* Chart overrides upstream label opacity at the scene boundary. */
|
|
41
41
|
--text-chart-data: var(--text-sm);
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
/* Input is a standalone control elsewhere, but here its atom-level paint must
|
|
95
|
-
* not create a second surface. Keep this unlayered: the shared two-
|
|
95
|
+
* not create a second surface. Keep this unlayered: the shared two-severity focus
|
|
96
96
|
* rule is unlayered too, so a utility-only reset cannot suppress its inner halo.
|
|
97
97
|
* Geometry and padding still come from the Combobox's size slots.
|
|
98
98
|
* Command also renders zag's combobox parts, but its control has no surface and
|