@ostack.tech/ui 1.2.0-beta.1 → 1.3.0-beta.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.
Files changed (118) hide show
  1. package/dist/ostack-ui.css +867 -240
  2. package/dist/ostack-ui.js +8740 -6419
  3. package/dist/ostack-ui.js.map +1 -1
  4. package/package.json +1 -1
  5. package/scss/_utils.scss +2 -1
  6. package/scss/components/ButtonGroup/_ButtonGroup.scss +7 -4
  7. package/scss/components/Calendar/_Calendar.scss +0 -1
  8. package/scss/components/Card/_Card.scss +16 -7
  9. package/scss/components/Code/_Code.scss +3 -3
  10. package/scss/components/Container/_Container.scss +3 -3
  11. package/scss/components/ControlCode/_ControlCode.scss +1 -1
  12. package/scss/components/DataTable/_DataTable.scss +8 -8
  13. package/scss/components/DescriptionList/_DescriptionList.scss +1 -1
  14. package/scss/components/Feedback/_Feedback.scss +12 -9
  15. package/scss/components/Field/_Field.scss +3 -3
  16. package/scss/components/FieldGroup/_FieldGroup.scss +2 -1
  17. package/scss/components/Form/_Form.scss +2 -2
  18. package/scss/components/Grid/_Grid.scss +11 -11
  19. package/scss/components/Heading/_Heading-variables.scss +4 -1
  20. package/scss/components/Heading/_Heading.scss +22 -10
  21. package/scss/components/HelperText/_HelperText.scss +9 -7
  22. package/scss/components/Icon/_Icon-variables.scss +1 -0
  23. package/scss/components/Icon/_Icon.scss +2 -6
  24. package/scss/components/Keyboard/_Keyboard-variables.scss +4 -2
  25. package/scss/components/Keyboard/_Keyboard.scss +8 -4
  26. package/scss/components/Label/_Label-variables.scss +4 -0
  27. package/scss/components/Label/_Label.scss +13 -4
  28. package/scss/components/Link/_Link-variables.scss +1 -1
  29. package/scss/components/Link/_Link.scss +12 -3
  30. package/scss/components/Mark/_Mark.scss +2 -1
  31. package/scss/components/Spinner/_Spinner-variables.scss +1 -1
  32. package/scss/components/Spinner/_Spinner.scss +0 -7
  33. package/scss/components/Stack/_Stack.scss +20 -10
  34. package/scss/components/Stepper/_Stepper-variables.scss +0 -4
  35. package/scss/components/Stepper/_Stepper.scss +1 -6
  36. package/scss/components/Tabs/_Tabs-variables.scss +0 -1
  37. package/scss/components/Tabs/_Tabs.scss +4 -3
  38. package/scss/components/Tag/_Tag-variables.scss +1 -0
  39. package/scss/components/Tag/_Tag.scss +4 -3
  40. package/scss/components/Text/_Text-variables.scss +4 -0
  41. package/scss/components/Text/_Text.scss +19 -0
  42. package/scss/index.scss +5 -0
  43. package/scss/scss/helpers/_margin-utils.scss +35 -0
  44. package/scss/scss/helpers/_padding-utils.scss +35 -0
  45. package/scss/scss/helpers/_print-utils.scss +1 -1
  46. package/scss/scss/helpers/_sizing-utils.scss +45 -0
  47. package/scss/scss/helpers/_text-utils.scss +43 -0
  48. package/scss/scss/placeholders/checkable-group/_checkable-group.scss +2 -2
  49. package/scss/scss/placeholders/control/_control.scss +1 -9
  50. package/scss/scss/placeholders/menu/_menu.scss +2 -1
  51. package/scss/scss/placeholders/popover/_popover.scss +2 -2
  52. package/scss/scss/utils/_responsive-values.scss +7 -8
  53. package/types/components/Actions/Action.d.ts +1 -1
  54. package/types/components/Actions/Actions.d.ts +1 -1
  55. package/types/components/Alert/Alert.d.ts +3 -2
  56. package/types/components/Box/Box.d.ts +37 -0
  57. package/types/components/Box/index.d.ts +1 -0
  58. package/types/components/Button/Button.d.ts +3 -2
  59. package/types/components/ButtonGroup/ButtonGroup.d.ts +3 -2
  60. package/types/components/Calendar/Calendar.d.ts +3 -2
  61. package/types/components/Card/Card.d.ts +3 -2
  62. package/types/components/Card/CardTitle.d.ts +3 -2
  63. package/types/components/Checkbox/Checkbox.d.ts +2 -1
  64. package/types/components/CheckboxGroup/CheckboxGroup.d.ts +3 -2
  65. package/types/components/Code/Code.d.ts +4 -2
  66. package/types/components/Container/Container.d.ts +3 -2
  67. package/types/components/Control/Control.d.ts +13 -13
  68. package/types/components/ControlCode/ControlCode.d.ts +3 -2
  69. package/types/components/DataTable/DataTablePagination.d.ts +3 -2
  70. package/types/components/DataTable/DataTableRowsPerPage.d.ts +3 -2
  71. package/types/components/DateRangeInput/DateRangeInput.d.ts +5 -6
  72. package/types/components/Feedback/Feedback.d.ts +6 -4
  73. package/types/components/Feedback/FeedbackList.d.ts +3 -2
  74. package/types/components/Field/Field.d.ts +5 -10
  75. package/types/components/FieldGroup/FieldGroup.d.ts +3 -2
  76. package/types/components/FieldGroup/FieldGroupTitle.d.ts +3 -2
  77. package/types/components/Form/Form.d.ts +3 -8
  78. package/types/components/Grid/Grid.d.ts +4 -4
  79. package/types/components/Grid/GridContext.d.ts +1 -1
  80. package/types/components/Heading/Heading.d.ts +12 -3
  81. package/types/components/HelperText/HelperText.d.ts +4 -2
  82. package/types/components/Icon/Icon.d.ts +9 -4
  83. package/types/components/IconButton/IconButton.d.ts +3 -2
  84. package/types/components/Keybinds/Keybinds.d.ts +3 -2
  85. package/types/components/Keyboard/Keyboard.d.ts +17 -4
  86. package/types/components/Label/Label.d.ts +11 -2
  87. package/types/components/Link/Link.d.ts +4 -2
  88. package/types/components/Mark/Mark.d.ts +7 -5
  89. package/types/components/MenuList/MenuList.d.ts +3 -2
  90. package/types/components/Popover/Popover.d.ts +1 -1
  91. package/types/components/Popover/PopoverContent.d.ts +4 -2
  92. package/types/components/Printer/PrinterContent.d.ts +3 -9
  93. package/types/components/RadioGroup/Radio.d.ts +2 -1
  94. package/types/components/RadioGroup/RadioGroup.d.ts +3 -2
  95. package/types/components/Root/Root.d.ts +3 -8
  96. package/types/components/Root/RootElement.d.ts +2 -2
  97. package/types/components/Separator/Separator.d.ts +2 -1
  98. package/types/components/Spinner/Spinner.d.ts +7 -4
  99. package/types/components/Stack/Stack.d.ts +5 -10
  100. package/types/components/Stack/StackContext.d.ts +1 -1
  101. package/types/components/Stepper/StepContent.d.ts +3 -8
  102. package/types/components/Stepper/StepList.d.ts +3 -2
  103. package/types/components/Stepper/Stepper.d.ts +9 -13
  104. package/types/components/Table/Table.d.ts +2 -1
  105. package/types/components/Tabs/TabContent.d.ts +3 -2
  106. package/types/components/Tabs/TabList.d.ts +2 -1
  107. package/types/components/Tabs/Tabs.d.ts +6 -4
  108. package/types/components/Tag/Tag.d.ts +4 -2
  109. package/types/components/Text/Text.d.ts +48 -0
  110. package/types/components/Text/index.d.ts +1 -0
  111. package/types/index.d.ts +7 -1
  112. package/types/utils/responsiveValues.d.ts +41 -0
  113. package/types/utils/useMarginProps.d.ts +46 -0
  114. package/types/utils/usePaddingProps.d.ts +46 -0
  115. package/types/utils/useSizingProps.d.ts +23 -0
  116. package/types/utils/useTextProps.d.ts +50 -0
  117. package/types/utils/changeCase.d.ts +0 -2
  118. package/types/utils/useResponsiveValues.d.ts +0 -41
@@ -1,5 +1,7 @@
1
1
  import type { AccentColor } from "../../utils/accent.ts";
2
2
  import type { PolymorphicProps } from "../../utils/polymorphicTypes.ts";
3
+ import { type UseMarginPropsOptions } from "../../utils/useMarginProps.ts";
4
+ import { type UseTextPropsOptions } from "../../utils/useTextProps.ts";
3
5
  import { type IconProp, type IconProps } from "../Icon";
4
6
  /** Elements a link can be rendered as. */
5
7
  export type LinkAs = "a" | "button";
@@ -10,7 +12,7 @@ export type LinkColor = AccentColor;
10
12
  /** Properties of the link component. */
11
13
  export type LinkProps<TAs extends LinkAs = "a"> = PolymorphicProps<LinkAs, TAs, "a", LinkOwnProps>;
12
14
  /** Own properties of the link component. */
13
- export interface LinkOwnProps {
15
+ export interface LinkOwnProps extends UseMarginPropsOptions, UseTextPropsOptions {
14
16
  /**
15
17
  * Change the component to the HTML tag or custom component of the only child. This will merge the
16
18
  * original component props with the props of the supplied element/component and change the
@@ -57,4 +59,4 @@ export interface LinkOwnProps {
57
59
  * }
58
60
  * ```
59
61
  */
60
- export declare function Link<TAs extends LinkAs = "a">({ as, asChild, type, color: colorProp, variant: variantProp, external, icon, iconProps, className, children, ...otherProps }: LinkProps<TAs>): import("react").JSX.Element;
62
+ export declare function Link<TAs extends LinkAs = "a">({ as, asChild, type, color: colorProp, variant: variantProp, external, icon, iconProps, className, style, children, ...otherProps }: LinkProps<TAs>): import("react").JSX.Element;
@@ -1,9 +1,11 @@
1
1
  import type { ComponentProps } from "react";
2
2
  import type { AccentColor } from "../../utils/accent.ts";
3
+ import { type UseMarginPropsOptions } from "../../utils/useMarginProps.ts";
4
+ import { type UseTextPropsOptions } from "../../utils/useTextProps.ts";
3
5
  /** Possible mark colours. */
4
6
  export type MarkColor = AccentColor;
5
7
  /** Properties of the mark component. */
6
- export interface MarkProps extends ComponentProps<"mark"> {
8
+ export interface MarkProps extends UseMarginPropsOptions, UseTextPropsOptions, ComponentProps<"mark"> {
7
9
  /**
8
10
  * Change the component to the HTML tag or custom component of the only child. This will merge the
9
11
  * original component props with the props of the supplied element/component and change the
@@ -25,16 +27,16 @@ export interface MarkProps extends ComponentProps<"mark"> {
25
27
  * Example usage:
26
28
  *
27
29
  * ```tsx
28
- * import { Mark } from "@ostack.tech/ui";
30
+ * import { Mark, Text } from "@ostack.tech/ui";
29
31
  *
30
32
  * function HighlightedPassage() {
31
33
  * return (
32
- * <>
34
+ * <Text>
33
35
  * “The study found that <Mark>climate change significantly impacts biodiversity</Mark>,
34
36
  * leading to habitat loss and species extinction.”
35
- * </>
37
+ * </Text>
36
38
  * );
37
39
  * }
38
40
  * ```
39
41
  */
40
- export declare function Mark({ asChild, color, className, ...otherProps }: MarkProps): import("react").JSX.Element;
42
+ export declare function Mark({ asChild, color, className, style, ...otherProps }: MarkProps): import("react").JSX.Element;
@@ -1,10 +1,11 @@
1
1
  import type { ComponentProps } from "react";
2
+ import { type UseMarginPropsOptions } from "../../utils/useMarginProps.ts";
2
3
  /** Menu list variants. */
3
4
  export type MenuListVariant = "solid" | "subtle";
4
5
  /** Placement of icons within menu list items. */
5
6
  export type MenuListIconPlacement = "start" | "end";
6
7
  /** Properties of the menu list component. */
7
- export interface MenuListProps extends ComponentProps<"ul"> {
8
+ export interface MenuListProps extends UseMarginPropsOptions, ComponentProps<"ul"> {
8
9
  /**
9
10
  * Change the component to the HTML tag or custom component of the only child. This will merge the
10
11
  * original component props with the props of the supplied element/component and change the
@@ -49,4 +50,4 @@ export interface MenuListProps extends ComponentProps<"ul"> {
49
50
  * }
50
51
  * ```
51
52
  */
52
- export declare function MenuList({ asChild, variant, iconPlacement, className, ...otherProps }: MenuListProps): import("react").JSX.Element;
53
+ export declare function MenuList({ asChild, variant, iconPlacement, className, style, ...otherProps }: MenuListProps): import("react").JSX.Element;
@@ -26,7 +26,7 @@ export interface PopoverProps extends ComponentProps<typeof PopoverPrimitive.Roo
26
26
  * <PopoverTrigger>
27
27
  * <Button>Account information</Button>
28
28
  * </PopoverTrigger>
29
- * <PopoverContent>
29
+ * <PopoverContent p={2}>
30
30
  * <strong>Account name:</strong> Alana Richards
31
31
  * </PopoverContent>
32
32
  * </Popover>
@@ -1,7 +1,9 @@
1
1
  import { Popover as PopoverPrimitive } from "radix-ui";
2
2
  import type { ComponentProps } from "react";
3
+ import { type UsePaddingPropsOptions } from "../../utils/usePaddingProps.ts";
4
+ import { type UseSizingPropsOptions } from "../../utils/useSizingProps.ts";
3
5
  /** Properties of the popover content component. */
4
- export interface PopoverContentProps extends ComponentProps<typeof PopoverPrimitive.Content> {
6
+ export interface PopoverContentProps extends UsePaddingPropsOptions, UseSizingPropsOptions, ComponentProps<typeof PopoverPrimitive.Content> {
5
7
  /**
6
8
  * Whether to show an arrow pointing to the anchor.
7
9
  *
@@ -14,4 +16,4 @@ export interface PopoverContentProps extends ComponentProps<typeof PopoverPrimit
14
16
  arrowProps?: ComponentProps<typeof PopoverPrimitive.Arrow>;
15
17
  }
16
18
  /** The component that pops out when the popover is open. */
17
- export declare function PopoverContent({ showArrow, sideOffset, collisionPadding, forceMount, className, portalProps, arrowProps, children, ...otherProps }: PopoverContentProps): import("react").JSX.Element;
19
+ export declare function PopoverContent({ showArrow, sideOffset, collisionPadding, forceMount, className, style, portalProps, arrowProps, children, ...otherProps }: PopoverContentProps): import("react").JSX.Element;
@@ -1,13 +1,7 @@
1
- import type { ComponentProps } from "react";
1
+ import { type BoxProps } from "../Box";
2
2
  import { type PortalProps } from "../Portal";
3
3
  /** Properties of the printer content. */
4
- export interface PrinterContentProps extends ComponentProps<"div"> {
5
- /**
6
- * Change the component to the HTML tag or custom component of the only child. This will merge the
7
- * original component props with the props of the supplied element/component and change the
8
- * underlying DOM node.
9
- */
10
- asChild?: boolean;
4
+ export interface PrinterContentProps extends BoxProps {
11
5
  /** Whether the provided `children` should only be rendered while printing. */
12
6
  printOnly?: boolean;
13
7
  /** Container of the portal. */
@@ -19,4 +13,4 @@ export interface PrinterContentProps extends ComponentProps<"div"> {
19
13
  * All “element” properties provided to this component will be forwarded to a wrapper element which
20
14
  * **only** exists during printing.
21
15
  */
22
- export declare function PrinterContent({ asChild, printOnly, portalContainer, className, children, ref, ...otherProps }: PrinterContentProps): import("react").JSX.Element;
16
+ export declare function PrinterContent({ printOnly, portalContainer, className, children, ref, ...otherProps }: PrinterContentProps): import("react").JSX.Element;
@@ -1,11 +1,12 @@
1
1
  import { RadioGroup as RadioGroupPrimitive } from "radix-ui";
2
2
  import { type ComponentProps, type ReactNode } from "react";
3
+ import { type UseMarginPropsOptions } from "../../utils/useMarginProps.ts";
3
4
  import { type ControlStatus } from "../Control";
4
5
  import { type ControlCodeProps } from "../ControlCode";
5
6
  import { type LabelProps } from "../Label";
6
7
  import { type SpinnerProps } from "../Spinner";
7
8
  /** Properties of a radio component. */
8
- export interface RadioProps extends Omit<ComponentProps<typeof RadioGroupPrimitive.Item>, "value"> {
9
+ export interface RadioProps extends UseMarginPropsOptions, Omit<ComponentProps<typeof RadioGroupPrimitive.Item>, "value"> {
9
10
  /** Radio value. */
10
11
  value?: ComponentProps<"input">["value"];
11
12
  /** Sets the status of the radio. */
@@ -1,5 +1,6 @@
1
1
  import { RadioGroup as RadioGroupPrimitive } from "radix-ui";
2
2
  import { type ComponentProps, type FocusEvent, type ReactNode } from "react";
3
+ import { type UseMarginPropsOptions } from "../../utils/useMarginProps.ts";
3
4
  import { type CloseButtonProps } from "../CloseButton";
4
5
  import { type ControlShowClearButton, type ControlStatus, type ControlVariant } from "../Control";
5
6
  import { type ControlCodeProps } from "../ControlCode";
@@ -7,7 +8,7 @@ import type { FormValidationMode } from "../Form";
7
8
  import { type FormControlValidateFn } from "../Form/useRegisterFormControl.ts";
8
9
  import { type SpinnerProps } from "../Spinner";
9
10
  /** Properties of the radio group component. */
10
- export interface RadioGroupProps extends Omit<ComponentProps<typeof RadioGroupPrimitive.Root>, "asChild" | "onValueChange"> {
11
+ export interface RadioGroupProps extends UseMarginPropsOptions, Omit<ComponentProps<typeof RadioGroupPrimitive.Root>, "asChild" | "onValueChange"> {
11
12
  /** Whether to display the radio group inline. */
12
13
  inline?: boolean;
13
14
  /**
@@ -112,4 +113,4 @@ export interface RadioGroupProps extends Omit<ComponentProps<typeof RadioGroupPr
112
113
  * }
113
114
  * ```
114
115
  */
115
- export declare function RadioGroup({ defaultValue, value: controlledValue, onValueChange, inline: inlineProp, variant: variantProp, status: statusProp, loading, loadingDescription: loadingDescriptionProp, showSpinner, code, showClearButton, clearDescription: clearDescriptionProp, clearButtonLabel: clearButtonLabelProp, onBlurToOutside, validate, validationMode, startAdornment, endAdornment, codeProps, containerProps, startContainerProps, endContainerProps, clearButtonProps, spinnerProps, id, name, required, disabled: disabledProp, readOnly, className, children, "aria-disabled": ariaDisabled, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, ref, ...otherProps }: RadioGroupProps): import("react").JSX.Element;
116
+ export declare function RadioGroup({ defaultValue, value: controlledValue, onValueChange, inline: inlineProp, variant: variantProp, status: statusProp, loading, loadingDescription: loadingDescriptionProp, showSpinner, code, showClearButton, clearDescription: clearDescriptionProp, clearButtonLabel: clearButtonLabelProp, onBlurToOutside, validate, validationMode, startAdornment, endAdornment, codeProps, containerProps, startContainerProps, endContainerProps, clearButtonProps, spinnerProps, id, name, required, disabled: disabledProp, readOnly, className, style, children, "aria-disabled": ariaDisabled, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, ref, ...otherProps }: RadioGroupProps): import("react").JSX.Element;
@@ -2,16 +2,11 @@ import type { ComponentProps } from "react";
2
2
  import { type DocumentTitleProviderProps } from "../../providers/DocumentTitleProvider";
3
3
  import { type ErrorReportingProviderProps } from "../../providers/ErrorReportingProvider";
4
4
  import type { LocalizationObject } from "../../providers/LocalizationProvider";
5
+ import type { BoxProps } from "../Box";
5
6
  import type { ErrorBoundaryProps } from "../ErrorBoundary";
6
7
  import { type ToastSwipeDirection, type ToastViewportPosition } from "../Toast";
7
8
  /** Properties of the ostack/UI root component. */
8
- export interface RootProps extends ComponentProps<"div">, Pick<ErrorReportingProviderProps, "reportError" | "errorReportingUrl" | "errorReportingMethod" | "encodeErrorReport" | "encodedErrorReportMimeType" | "errorReportingOptions">, Pick<DocumentTitleProviderProps, "baseDocumentTitle"> {
9
- /**
10
- * Change the component to the HTML tag or custom component of the only child. This will merge the
11
- * original component props with the props of the supplied element/component and change the
12
- * underlying DOM node.
13
- */
14
- asChild?: boolean;
9
+ export interface RootProps extends Omit<BoxProps, "as">, Pick<ErrorReportingProviderProps, "reportError" | "errorReportingUrl" | "errorReportingMethod" | "encodeErrorReport" | "encodedErrorReportMimeType" | "errorReportingOptions">, Pick<DocumentTitleProviderProps, "baseDocumentTitle"> {
15
10
  /**
16
11
  * Custom prefix used to prefix all component classes, styles, etc.
17
12
  *
@@ -117,7 +112,7 @@ export interface RootProps extends ComponentProps<"div">, Pick<ErrorReportingPro
117
112
  }
118
113
  /**
119
114
  * Root component that should wrap an ostack/UI application, exposing all ostack/UI providers and
120
- * base styles.
115
+ * base styles. Built on top of the [`Box` component](/docs/ostack-ui-layout-box--docs).
121
116
  *
122
117
  * It further wraps the whole application in an error boundary with support for error reporting.
123
118
  */
@@ -1,7 +1,7 @@
1
- import { type ComponentProps } from "react";
1
+ import { type BoxProps } from "../Box";
2
2
  import type { RootProps } from "./Root.tsx";
3
3
  /** Properties of the root element component. */
4
- export interface RootElementProps extends ComponentProps<"div">, Pick<RootProps, "asChild" | "errorBoundaryProps"> {
4
+ export interface RootElementProps extends Omit<BoxProps, "as">, Pick<RootProps, "errorBoundaryProps"> {
5
5
  /** Whether to wrap children in an error boundary. */
6
6
  includeErrorBoundary: boolean;
7
7
  }
@@ -1,10 +1,11 @@
1
1
  import { Separator as SeparatorPrimitive } from "radix-ui";
2
2
  import type { ComponentProps } from "react";
3
3
  import type { AccentColor } from "../../utils/accent.ts";
4
+ import { type UseMarginPropsOptions } from "../../utils/useMarginProps.ts";
4
5
  /** Link colours. */
5
6
  export type SeparatorColor = AccentColor;
6
7
  /** Properties of the separator component. */
7
- export interface SeparatorProps extends ComponentProps<typeof SeparatorPrimitive.Root> {
8
+ export interface SeparatorProps extends UseMarginPropsOptions, ComponentProps<typeof SeparatorPrimitive.Root> {
8
9
  /**
9
10
  * Colour of the separator.
10
11
  *
@@ -1,13 +1,16 @@
1
1
  import type { ComponentProps, ReactNode } from "react";
2
2
  import type { AccentColor } from "../../utils/accent.ts";
3
+ import type { Responsive } from "../../utils/responsiveValues.ts";
4
+ import { type UseMarginPropsOptions } from "../../utils/useMarginProps.ts";
5
+ import { type TextSize } from "../../utils/useTextProps.ts";
3
6
  /** Possible sizes of the spinner. */
4
- export type SpinnerSize = "3xs" | "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "6xl" | "7xl" | "8xl" | "9xl";
7
+ export type SpinnerSize = TextSize;
5
8
  /** Possible colours of the spinner. */
6
9
  export type SpinnerColor = AccentColor;
7
10
  /** Properties of the spinner component. */
8
- export interface SpinnerProps extends ComponentProps<"span"> {
11
+ export interface SpinnerProps extends UseMarginPropsOptions, ComponentProps<"span"> {
9
12
  /** Size of the spinner. By default, the spinner will be sized according to the current font size. */
10
- size?: SpinnerSize;
13
+ size?: Responsive<SpinnerSize>;
11
14
  /** Colour of the spinner. By default, the spinner will have the current font's colour. */
12
15
  color?: SpinnerColor;
13
16
  /**
@@ -31,4 +34,4 @@ export interface SpinnerProps extends ComponentProps<"span"> {
31
34
  * }
32
35
  * ```
33
36
  */
34
- export declare function Spinner({ size, color, label, className, ...otherProps }: SpinnerProps): import("react").JSX.Element;
37
+ export declare function Spinner({ size, color, label, className, style, ...otherProps }: SpinnerProps): import("react").JSX.Element;
@@ -1,17 +1,12 @@
1
- import { type ComponentProps, type CSSProperties, type ReactElement } from "react";
2
- import { type Responsive } from "../../utils/useResponsiveValues.ts";
1
+ import { type CSSProperties, type ReactElement } from "react";
2
+ import { type Responsive } from "../../utils/responsiveValues.ts";
3
+ import { type BoxProps } from "../Box";
3
4
  /** Possible stack directions. */
4
5
  export type StackDirection = "column" | "column-reverse" | "row" | "row-reverse";
5
6
  /** Whether to wrap items. */
6
7
  export type StackWrap = boolean | "reverse";
7
8
  /** Properties of the stack component. */
8
- export interface StackProps extends ComponentProps<"div"> {
9
- /**
10
- * Change the component to the HTML tag or custom component of the only child. This will merge the
11
- * original component props with the props of the supplied element/component and change the
12
- * underlying DOM node.
13
- */
14
- asChild?: boolean;
9
+ export interface StackProps extends BoxProps {
15
10
  /**
16
11
  * Direction of the stack.
17
12
  *
@@ -57,4 +52,4 @@ export interface StackProps extends ComponentProps<"div"> {
57
52
  * }
58
53
  * ```
59
54
  */
60
- export declare function Stack({ asChild, direction, gap, divider, justifyContent, alignItems, alignContent, wrap, className, style, children, ...otherProps }: StackProps): import("react").JSX.Element;
55
+ export declare function Stack({ direction, gap, divider, justifyContent, alignItems, alignContent, wrap, className, style, children, ...otherProps }: StackProps): import("react").JSX.Element;
@@ -1,4 +1,4 @@
1
- import type { Responsive } from "../../utils/useResponsiveValues.ts";
1
+ import type { Responsive } from "../../utils/responsiveValues.ts";
2
2
  import type { StackDirection } from "./Stack.tsx";
3
3
  /** Value of the stack context. */
4
4
  export interface StackContextValue {
@@ -1,12 +1,7 @@
1
1
  import { type ComponentProps } from "react";
2
+ import { type BoxProps } from "../Box";
2
3
  /** Properties of the step content component. */
3
- export interface StepContentProps extends ComponentProps<"div"> {
4
- /**
5
- * Change the component to the HTML tag or custom component of the only child. This will merge the
6
- * original component props with the props of the supplied element/component and change the
7
- * underlying DOM node.
8
- */
9
- asChild?: boolean;
4
+ export interface StepContentProps extends BoxProps {
10
5
  /** Index of the step that corresponds to this content. */
11
6
  index?: number;
12
7
  /** Properties to pass to the content label element (print only). */
@@ -15,4 +10,4 @@ export interface StepContentProps extends ComponentProps<"div"> {
15
10
  stepContentLabelIndexProps?: ComponentProps<"span">;
16
11
  }
17
12
  /** Step content component. */
18
- export declare function StepContent({ asChild, index, id, className, stepContentLabelProps, stepContentLabelIndexProps, ref, ...otherProps }: StepContentProps): import("react").JSX.Element;
13
+ export declare function StepContent({ index, id, className, stepContentLabelProps, stepContentLabelIndexProps, ref, ...otherProps }: StepContentProps): import("react").JSX.Element;
@@ -1,6 +1,7 @@
1
1
  import { type ComponentProps } from "react";
2
+ import { type UseMarginPropsOptions } from "../../utils/useMarginProps.ts";
2
3
  /** Properties of the step list component. */
3
- export interface StepListProps extends ComponentProps<"ol"> {
4
+ export interface StepListProps extends UseMarginPropsOptions, ComponentProps<"ol"> {
4
5
  /**
5
6
  * Change the component to the HTML tag or custom component of the only child. This will merge the
6
7
  * original component props with the props of the supplied element/component and change the
@@ -13,4 +14,4 @@ export interface StepListProps extends ComponentProps<"ol"> {
13
14
  *
14
15
  * The `index` of each `Step` is automatically added when `Step`s are direct children of `StepList`.
15
16
  */
16
- export declare function StepList({ asChild, className, children, ...otherProps }: StepListProps): import("react").JSX.Element;
17
+ export declare function StepList({ asChild, className, style, children, ...otherProps }: StepListProps): import("react").JSX.Element;
@@ -1,13 +1,8 @@
1
- import { type ComponentProps, type Ref } from "react";
1
+ import { type Ref } from "react";
2
+ import { type BoxProps } from "../Box";
2
3
  import { type StepperApi } from "./StepperContext.ts";
3
4
  /** Properties of the stepper component. */
4
- export interface StepperProps extends ComponentProps<"div"> {
5
- /**
6
- * Change the component to the HTML tag or custom component of the only child. This will merge the
7
- * original component props with the props of the supplied element/component and change the
8
- * underlying DOM node.
9
- */
10
- asChild?: boolean;
5
+ export interface StepperProps extends Omit<BoxProps, "as"> {
11
6
  /**
12
7
  * Index of the default active step.
13
8
  *
@@ -28,7 +23,8 @@ export interface StepperProps extends ComponentProps<"div"> {
28
23
  apiRef?: Ref<StepperApi | undefined>;
29
24
  }
30
25
  /**
31
- * Display progress through a sequence of numbered steps.
26
+ * Display progress through a sequence of numbered steps. Built on top of the [`Box`
27
+ * component](/docs/ostack-ui-layout-box--docs).
32
28
  *
33
29
  * It composes the following subcomponents:
34
30
  *
@@ -61,9 +57,9 @@ export interface StepperProps extends ComponentProps<"div"> {
61
57
  * <Step>Payment</Step>
62
58
  * <Step>Review</Step>
63
59
  * </StepList>
64
- * <StepContent>Shipping options…</StepContent>
65
- * <StepContent>Payment options…</StepContent>
66
- * <StepContent>Finalize checkout…</StepContent>
60
+ * <StepContent py={2}>Shipping options…</StepContent>
61
+ * <StepContent py={2}>Payment options…</StepContent>
62
+ * <StepContent py={2}>Finalize checkout…</StepContent>
67
63
  * <StepperPreviousTrigger />
68
64
  * <StepperNextTrigger />
69
65
  * <StepperFinishTrigger onClick={completeCheckout} />
@@ -72,4 +68,4 @@ export interface StepperProps extends ComponentProps<"div"> {
72
68
  * }
73
69
  * ```
74
70
  */
75
- export declare function Stepper({ asChild, defaultActiveStep, activeStep: controlledActiveStep, onActiveStepChange, showAllStepsWhilePrinting, className, apiRef, children, ...otherProps }: StepperProps): import("react").JSX.Element;
71
+ export declare function Stepper({ defaultActiveStep, activeStep: controlledActiveStep, onActiveStepChange, showAllStepsWhilePrinting, className, apiRef, children, ...otherProps }: StepperProps): import("react").JSX.Element;
@@ -1,4 +1,5 @@
1
1
  import { type ComponentProps, type CSSProperties, type ReactNode } from "react";
2
+ import { type UseMarginPropsOptions } from "../../utils/useMarginProps.ts";
2
3
  import { type ControlStatus } from "../Control";
3
4
  /** Default column width in `"fixed"` mode. */
4
5
  export declare const DEFAULT_TABLE_COLUMN_WIDTH = 150;
@@ -9,7 +10,7 @@ export type TableVariant = "default" | "control";
9
10
  /** Possible table layouts. */
10
11
  export type TableLayout = "auto" | "fixed";
11
12
  /** Properties of the table component. */
12
- export interface TableProps extends ComponentProps<"table"> {
13
+ export interface TableProps extends UseMarginPropsOptions, ComponentProps<"table"> {
13
14
  /**
14
15
  * Caption of the table. This caption is displayed outside the table, above or below it (depending
15
16
  * on the value of `captionSide`), in a `<div>` element.
@@ -1,7 +1,8 @@
1
1
  import { Tabs as TabsPrimitive } from "radix-ui";
2
2
  import type { ComponentProps } from "react";
3
+ import { type BoxProps } from "../Box";
3
4
  /** Properties of the tab content component. */
4
- export interface TabContentProps extends Omit<ComponentProps<typeof TabsPrimitive.TabsContent>, "value"> {
5
+ export interface TabContentProps extends BoxProps, Omit<ComponentProps<typeof TabsPrimitive.TabsContent>, "value"> {
5
6
  /** Value of the tab that corresponds to this content. */
6
7
  value: string | number;
7
8
  /**
@@ -11,4 +12,4 @@ export interface TabContentProps extends Omit<ComponentProps<typeof TabsPrimitiv
11
12
  tabContentLabelProps?: ComponentProps<"span">;
12
13
  }
13
14
  /** Tab content component. */
14
- export declare function TabContent({ asChild, value, className, tabContentLabelProps, ...otherProps }: TabContentProps): import("react").JSX.Element;
15
+ export declare function TabContent({ value, forceMount, className, tabContentLabelProps, ...otherProps }: TabContentProps): import("react").JSX.Element;
@@ -1,8 +1,9 @@
1
1
  import { Tabs as TabsPrimitive } from "radix-ui";
2
2
  import { type ComponentProps, type ReactNode } from "react";
3
+ import { type UseMarginPropsOptions } from "../../utils/useMarginProps.ts";
3
4
  import { type IconButtonProps } from "../IconButton";
4
5
  /** Properties of the tab list component. */
5
- export interface TabListProps extends ComponentProps<typeof TabsPrimitive.List> {
6
+ export interface TabListProps extends UseMarginPropsOptions, ComponentProps<typeof TabsPrimitive.List> {
6
7
  /** Label of the scroll left button. */
7
8
  scrollLeftButtonLabel?: ReactNode;
8
9
  /** Label of the scroll right button. */
@@ -1,9 +1,10 @@
1
1
  import { Tabs as TabsPrimitive } from "radix-ui";
2
2
  import type { ComponentProps } from "react";
3
+ import { type BoxProps } from "../Box";
3
4
  /** Tabs variants. */
4
5
  export type TabsVariant = "default" | "annexes";
5
6
  /** Properties of the tabs component. */
6
- export interface TabsProps extends Omit<ComponentProps<typeof TabsPrimitive.Root>, "defaultValue" | "value" | "orientation" | "dir"> {
7
+ export interface TabsProps extends Omit<BoxProps, "as">, Omit<ComponentProps<typeof TabsPrimitive.Root>, "defaultValue" | "value" | "orientation" | "dir"> {
7
8
  /**
8
9
  * Tabs variant.
9
10
  *
@@ -22,7 +23,8 @@ export interface TabsProps extends Omit<ComponentProps<typeof TabsPrimitive.Root
22
23
  *
23
24
  * The `value` set on each tab should match the `value` of its content.
24
25
  *
25
- * Built on top of the [Radix Tabs primitive](https://radix-ui.com/primitives/docs/components/tabs).
26
+ * Built on top of the [Radix Tabs primitive](https://radix-ui.com/primitives/docs/components/tabs)
27
+ * and the [`Box` component](/docs/ostack-ui-layout-box--docs).
26
28
  *
27
29
  * It composes the following subcomponents:
28
30
  *
@@ -38,7 +40,7 @@ export interface TabsProps extends Omit<ComponentProps<typeof TabsPrimitive.Root
38
40
  * function Bills() {
39
41
  * return (
40
42
  * <Tabs>
41
- * <TabList>
43
+ * <TabList mb={2}>
42
44
  * <Tab value="water">Water</Tab>
43
45
  * <Tab value="electricity">Electricity</Tab>
44
46
  * <Tab value="gas">Gas</Tab>
@@ -51,4 +53,4 @@ export interface TabsProps extends Omit<ComponentProps<typeof TabsPrimitive.Root
51
53
  * }
52
54
  * ```
53
55
  */
54
- export declare function Tabs({ variant, defaultValue, value, onValueChange, showAllTabsWhilePrinting, className, ...otherProps }: TabsProps): import("react").JSX.Element;
56
+ export declare function Tabs({ variant, defaultValue, value, onValueChange, activationMode, showAllTabsWhilePrinting, className, ...otherProps }: TabsProps): import("react").JSX.Element;
@@ -1,5 +1,7 @@
1
1
  import type { ComponentProps } from "react";
2
2
  import type { AccentColor } from "../../utils/accent.ts";
3
+ import { type UseMarginPropsOptions } from "../../utils/useMarginProps.ts";
4
+ import { type UseTextPropsOptions } from "../../utils/useTextProps.ts";
3
5
  import { type CloseButtonProps } from "../CloseButton";
4
6
  import { type CollapsibleContentProps } from "../Collapsible";
5
7
  import { type IconProp, type IconProps } from "../Icon";
@@ -10,7 +12,7 @@ export type TagColor = AccentColor;
10
12
  /** Tag's icon placement. */
11
13
  export type TagIconPlacement = "start" | "end";
12
14
  /** Properties of the tag component. */
13
- export interface TagProps extends ComponentProps<"span"> {
15
+ export interface TagProps extends UseMarginPropsOptions, UseTextPropsOptions, ComponentProps<"span"> {
14
16
  /**
15
17
  * Change the component to the HTML tag or custom component of the only child. This will merge the
16
18
  * original component props with the props of the supplied element/component and change the
@@ -89,4 +91,4 @@ export interface TagProps extends ComponentProps<"span"> {
89
91
  * }
90
92
  * ```
91
93
  */
92
- export declare function Tag({ asChild, variant, color, defaultOpen, open, onOpenChange, icon, iconPlacement, pill, showCloseButton, className, containerProps, contentProps, iconProps, closeButtonProps, children, ...otherProps }: TagProps): import("react").JSX.Element;
94
+ export declare function Tag({ asChild, variant, color, defaultOpen, open, onOpenChange, icon, iconPlacement, pill, showCloseButton, className, truncate, style, containerProps, contentProps, iconProps, closeButtonProps, children, ...otherProps }: TagProps): import("react").JSX.Element;
@@ -0,0 +1,48 @@
1
+ import type { AccentColor } from "../../utils/accent.ts";
2
+ import type { PolymorphicProps } from "../../utils/polymorphicTypes.ts";
3
+ import { type UseMarginPropsOptions } from "../../utils/useMarginProps.ts";
4
+ import { type UseTextPropsOptions } from "../../utils/useTextProps.ts";
5
+ /** Elements text can be rendered as. */
6
+ export type TextAs = "span" | "div" | "p" | "strong" | "em" | "s" | "sub" | "sup" | "time" | "figcaption";
7
+ /** Text colours. */
8
+ export type TextColor = AccentColor;
9
+ /** Properties of the text component. */
10
+ export type TextProps<TAs extends TextAs = "span"> = PolymorphicProps<TextAs, TAs, "span", TextOwnProps>;
11
+ /** Own properties of the text component. */
12
+ export interface TextOwnProps extends UseMarginPropsOptions, UseTextPropsOptions {
13
+ /**
14
+ * Change the component to the HTML tag or custom component of the only child. This will merge the
15
+ * original component props with the props of the supplied element/component and change the
16
+ * underlying DOM node.
17
+ */
18
+ asChild?: boolean;
19
+ /**
20
+ * Colour of the text.
21
+ *
22
+ * @default "primary"
23
+ */
24
+ color?: TextColor;
25
+ /** Uses a higher contrast colour for the text. */
26
+ highContrast?: boolean;
27
+ }
28
+ /**
29
+ * Component used to render text. By default, it renders as a [`<span>`
30
+ * element](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/a). Use the `as`
31
+ * property to render as an `<em>`, `<p>`, `<strong>`, or other text elements.
32
+ *
33
+ * Example usage:
34
+ *
35
+ * ```tsx
36
+ * import { Text } from "@ostack.tech/ui";
37
+ *
38
+ * function LoremIpsum() {
39
+ * return (
40
+ * <Text>
41
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
42
+ * incididunt ut labore et dolore magna aliqua.
43
+ * </Text>
44
+ * );
45
+ * }
46
+ * ```
47
+ */
48
+ export declare function Text<TAs extends TextAs = "span">({ as, asChild, color, highContrast, className, style, ...otherProps }: TextProps<TAs>): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ export * from "./Text.tsx";
package/types/index.d.ts CHANGED
@@ -2,6 +2,7 @@ export * from "./components/Root";
2
2
  export * from "./components/Actions";
3
3
  export * from "./components/Alert";
4
4
  export * from "./components/AlertDialog";
5
+ export * from "./components/Box";
5
6
  export * from "./components/Button";
6
7
  export * from "./components/ButtonGroup";
7
8
  export * from "./components/Calendar";
@@ -56,6 +57,7 @@ export * from "./components/Stepper";
56
57
  export * from "./components/Table";
57
58
  export * from "./components/Tabs";
58
59
  export * from "./components/Tag";
60
+ export * from "./components/Text";
59
61
  export * from "./components/TextArea";
60
62
  export * from "./components/Toast";
61
63
  export * from "./components/Tooltip";
@@ -73,16 +75,20 @@ export * from "./utils/useCombinedEventHandler.ts";
73
75
  export * from "./utils/cx.ts";
74
76
  export * from "./utils/filtering.ts";
75
77
  export * from "./utils/keyboardShortcut.ts";
78
+ export * from "./utils/useMarginProps.ts";
76
79
  export * from "./utils/nativeControls.ts";
77
80
  export * from "./utils/navigate.ts";
78
81
  export * from "./utils/numericStringUtils.ts";
82
+ export * from "./utils/usePaddingProps.ts";
79
83
  export * from "./utils/parseChildren.ts";
80
84
  export * from "./utils/parseDateStrict.ts";
81
85
  export * from "./utils/polymorphicTypes.ts";
82
86
  export * from "./utils/reactCompilerUtils.ts";
83
87
  export * from "./utils/setNativeProperty.ts";
88
+ export * from "./utils/useSizingProps.ts";
84
89
  export * from "./utils/sorting.ts";
85
90
  export * from "./utils/stringHash.ts";
91
+ export * from "./utils/useTextProps.ts";
86
92
  export * from "./utils/useCombinedRef.ts";
87
93
  export * from "./utils/useConstant.ts";
88
94
  export * from "./utils/useControllableState.ts";
@@ -95,7 +101,7 @@ export * from "./utils/useMeasure.ts";
95
101
  export * from "./utils/useMediaQuery.ts";
96
102
  export * from "./utils/useNumericTransformer.tsx";
97
103
  export * from "./utils/usePrevious.ts";
98
- export * from "./utils/useResponsiveValues.ts";
104
+ export * from "./utils/responsiveValues.ts";
99
105
  export * from "./utils/useSafeLayoutEffect.ts";
100
106
  export * from "./utils/useScrollbarSize.ts";
101
107
  export * from "./utils/useScrollPosition.ts";
@@ -0,0 +1,41 @@
1
+ import { type Breakpoint } from "./breakpoints.ts";
2
+ import { type UseCssVarsOptions } from "./useCssVars.ts";
3
+ /** Value allowing for different values depending on the current breakpoint. */
4
+ export type Responsive<T = unknown> = T | ResponsiveObject<T>;
5
+ /** Value containing different values depending on the current breakpoint. */
6
+ export type ResponsiveObject<T = unknown> = Partial<Record<Breakpoint, T>>;
7
+ /** Options available to the {@link useResponsiveValue} hook. */
8
+ export type UseResponsiveValueOptions = UseCssVarsOptions;
9
+ /** Options available to the {@link useResponsiveValues} hook. */
10
+ export type UseResponsiveValuesOptions = UseResponsiveValueOptions;
11
+ /** Properties supporting responsive values. */
12
+ export interface ResponsiveValueProps {
13
+ cssVars: Record<string, string>;
14
+ dataAttrs: Record<string, string>;
15
+ }
16
+ /**
17
+ * Returns an object of CSS variables for multiple responsive values, together with data attributes
18
+ * specifying which breakpoints of each value have an associated CSS variable.
19
+ */
20
+ export declare function useResponsiveValue<T>(baseName: string, propName: string, value?: Responsive<T>, mapper?: (value: T) => unknown, options?: UseResponsiveValueOptions): ResponsiveValueProps;
21
+ /**
22
+ * Returns an object of CSS variables for a responsive value, together with data attributes
23
+ * specifying which breakpoints have an associated CSS variable.
24
+ */
25
+ export declare function useResponsiveValues<T extends Record<string, unknown>, TMappers extends {
26
+ [TKey in keyof T]: (value: T[TKey] extends Responsive<infer TValue> | undefined ? TValue : never) => unknown;
27
+ }>(baseName: string, values: T, mappers?: Partial<TMappers>, options?: UseResponsiveValuesOptions): ResponsiveValueProps;
28
+ /**
29
+ * Resolves a `Responsive<T>` value to the specific value matching the current breakpoint.
30
+ *
31
+ * @param value Responsive value.
32
+ * @param defaultValue Fallback value if no matching breakpoint is found or if `value` is
33
+ * `undefined`.
34
+ * @returns The resolved value for the current breakpoint, or `defaultValue`.
35
+ */
36
+ export declare function useCurrentResponsiveValue<T = unknown>(value: Responsive<T> | undefined): T | undefined;
37
+ export declare function useCurrentResponsiveValue<T = unknown>(value: Responsive<T> | undefined, defaultValue: T): T;
38
+ /** Merges two responsive values together. */
39
+ export declare function mergeResponsiveValues<T = unknown>(value: Responsive<T> | undefined, override: Responsive<T> | undefined): Responsive<T> | undefined;
40
+ /** Whether the provided value is (probably) a responsive value object. */
41
+ export declare function isResponsiveValueObject<T = unknown>(value: Responsive<T>): value is ResponsiveObject<T>;