@ostack.tech/ui 1.2.0 → 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.
- package/dist/ostack-ui.css +867 -240
- package/dist/ostack-ui.js +8739 -6422
- package/dist/ostack-ui.js.map +1 -1
- package/package.json +1 -1
- package/scss/_utils.scss +2 -1
- package/scss/components/ButtonGroup/_ButtonGroup.scss +7 -4
- package/scss/components/Calendar/_Calendar.scss +0 -1
- package/scss/components/Card/_Card.scss +16 -7
- package/scss/components/Code/_Code.scss +3 -3
- package/scss/components/Container/_Container.scss +3 -3
- package/scss/components/ControlCode/_ControlCode.scss +1 -1
- package/scss/components/DataTable/_DataTable.scss +8 -8
- package/scss/components/DescriptionList/_DescriptionList.scss +1 -1
- package/scss/components/Feedback/_Feedback.scss +12 -9
- package/scss/components/Field/_Field.scss +3 -3
- package/scss/components/FieldGroup/_FieldGroup.scss +2 -1
- package/scss/components/Form/_Form.scss +2 -2
- package/scss/components/Grid/_Grid.scss +11 -11
- package/scss/components/Heading/_Heading-variables.scss +4 -1
- package/scss/components/Heading/_Heading.scss +22 -10
- package/scss/components/HelperText/_HelperText.scss +9 -7
- package/scss/components/Icon/_Icon-variables.scss +1 -0
- package/scss/components/Icon/_Icon.scss +2 -6
- package/scss/components/Keyboard/_Keyboard-variables.scss +4 -2
- package/scss/components/Keyboard/_Keyboard.scss +8 -4
- package/scss/components/Label/_Label-variables.scss +4 -0
- package/scss/components/Label/_Label.scss +13 -4
- package/scss/components/Link/_Link-variables.scss +1 -1
- package/scss/components/Link/_Link.scss +12 -3
- package/scss/components/Mark/_Mark.scss +2 -1
- package/scss/components/Spinner/_Spinner-variables.scss +1 -1
- package/scss/components/Spinner/_Spinner.scss +0 -7
- package/scss/components/Stack/_Stack.scss +20 -10
- package/scss/components/Stepper/_Stepper-variables.scss +0 -4
- package/scss/components/Stepper/_Stepper.scss +1 -6
- package/scss/components/Tabs/_Tabs-variables.scss +0 -1
- package/scss/components/Tabs/_Tabs.scss +4 -3
- package/scss/components/Tag/_Tag-variables.scss +1 -0
- package/scss/components/Tag/_Tag.scss +4 -3
- package/scss/components/Text/_Text-variables.scss +4 -0
- package/scss/components/Text/_Text.scss +19 -0
- package/scss/index.scss +5 -0
- package/scss/scss/helpers/_margin-utils.scss +35 -0
- package/scss/scss/helpers/_padding-utils.scss +35 -0
- package/scss/scss/helpers/_print-utils.scss +1 -1
- package/scss/scss/helpers/_sizing-utils.scss +45 -0
- package/scss/scss/helpers/_text-utils.scss +43 -0
- package/scss/scss/placeholders/checkable-group/_checkable-group.scss +2 -2
- package/scss/scss/placeholders/control/_control.scss +1 -9
- package/scss/scss/placeholders/menu/_menu.scss +2 -1
- package/scss/scss/placeholders/popover/_popover.scss +2 -2
- package/scss/scss/utils/_responsive-values.scss +7 -8
- package/types/components/Actions/Action.d.ts +1 -1
- package/types/components/Actions/Actions.d.ts +1 -1
- package/types/components/Alert/Alert.d.ts +3 -2
- package/types/components/Box/Box.d.ts +37 -0
- package/types/components/Box/index.d.ts +1 -0
- package/types/components/Button/Button.d.ts +3 -2
- package/types/components/ButtonGroup/ButtonGroup.d.ts +3 -2
- package/types/components/Calendar/Calendar.d.ts +3 -2
- package/types/components/Card/Card.d.ts +3 -2
- package/types/components/Card/CardTitle.d.ts +3 -2
- package/types/components/Checkbox/Checkbox.d.ts +2 -1
- package/types/components/CheckboxGroup/CheckboxGroup.d.ts +3 -2
- package/types/components/Code/Code.d.ts +4 -2
- package/types/components/Container/Container.d.ts +3 -2
- package/types/components/Control/Control.d.ts +13 -13
- package/types/components/ControlCode/ControlCode.d.ts +3 -2
- package/types/components/DataTable/DataTablePagination.d.ts +3 -2
- package/types/components/DataTable/DataTableRowsPerPage.d.ts +3 -2
- package/types/components/DateRangeInput/DateRangeInput.d.ts +5 -6
- package/types/components/Feedback/Feedback.d.ts +6 -4
- package/types/components/Feedback/FeedbackList.d.ts +3 -2
- package/types/components/Field/Field.d.ts +5 -10
- package/types/components/FieldGroup/FieldGroup.d.ts +3 -2
- package/types/components/FieldGroup/FieldGroupTitle.d.ts +3 -2
- package/types/components/Form/Form.d.ts +3 -8
- package/types/components/Grid/Grid.d.ts +4 -4
- package/types/components/Grid/GridContext.d.ts +1 -1
- package/types/components/Heading/Heading.d.ts +12 -3
- package/types/components/HelperText/HelperText.d.ts +4 -2
- package/types/components/Icon/Icon.d.ts +9 -4
- package/types/components/IconButton/IconButton.d.ts +3 -2
- package/types/components/Keybinds/Keybinds.d.ts +3 -2
- package/types/components/Keyboard/Keyboard.d.ts +17 -4
- package/types/components/Label/Label.d.ts +11 -2
- package/types/components/Link/Link.d.ts +4 -2
- package/types/components/Mark/Mark.d.ts +7 -5
- package/types/components/MenuList/MenuList.d.ts +3 -2
- package/types/components/Popover/Popover.d.ts +1 -1
- package/types/components/Popover/PopoverContent.d.ts +4 -2
- package/types/components/Printer/PrinterContent.d.ts +3 -9
- package/types/components/RadioGroup/Radio.d.ts +2 -1
- package/types/components/RadioGroup/RadioGroup.d.ts +3 -2
- package/types/components/Root/Root.d.ts +3 -8
- package/types/components/Root/RootElement.d.ts +2 -2
- package/types/components/Separator/Separator.d.ts +2 -1
- package/types/components/Spinner/Spinner.d.ts +7 -4
- package/types/components/Stack/Stack.d.ts +5 -10
- package/types/components/Stack/StackContext.d.ts +1 -1
- package/types/components/Stepper/StepContent.d.ts +3 -8
- package/types/components/Stepper/StepList.d.ts +3 -2
- package/types/components/Stepper/Stepper.d.ts +9 -13
- package/types/components/Table/Table.d.ts +2 -1
- package/types/components/Tabs/TabContent.d.ts +3 -2
- package/types/components/Tabs/TabList.d.ts +2 -1
- package/types/components/Tabs/Tabs.d.ts +6 -4
- package/types/components/Tag/Tag.d.ts +4 -2
- package/types/components/Text/Text.d.ts +48 -0
- package/types/components/Text/index.d.ts +1 -0
- package/types/index.d.ts +7 -1
- package/types/utils/responsiveValues.d.ts +41 -0
- package/types/utils/useMarginProps.d.ts +46 -0
- package/types/utils/usePaddingProps.d.ts +46 -0
- package/types/utils/useSizingProps.d.ts +23 -0
- package/types/utils/useTextProps.d.ts +50 -0
- package/types/utils/changeCase.d.ts +0 -2
- package/types/utils/useResponsiveValues.d.ts +0 -41
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { CSSProperties } from "react";
|
|
2
|
+
import { type Responsive, type ResponsiveValueProps } from "./responsiveValues.ts";
|
|
3
|
+
/** Properties available to the {@link useMarginProps} hook. */
|
|
4
|
+
export interface UseMarginPropsOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Margin area on all four sides of an element. When a number is provided, each unit corresponds
|
|
7
|
+
* to `var(--o-ui-space)`.
|
|
8
|
+
*/
|
|
9
|
+
m?: Responsive<number | CSSProperties["marginTop"]>;
|
|
10
|
+
/**
|
|
11
|
+
* Margin area on the top and bottom sides of an element. When a number is provided, each unit
|
|
12
|
+
* corresponds to `var(--o-ui-space)`.
|
|
13
|
+
*/
|
|
14
|
+
my?: Responsive<number | CSSProperties["marginTop"]>;
|
|
15
|
+
/**
|
|
16
|
+
* Margin area on the left and right sides of an element. When a number is provided, each unit
|
|
17
|
+
* corresponds to `var(--o-ui-space)`.
|
|
18
|
+
*/
|
|
19
|
+
mx?: Responsive<number | CSSProperties["marginLeft"]>;
|
|
20
|
+
/**
|
|
21
|
+
* Margin area on the top side of an element. When a number is provided, each unit corresponds to
|
|
22
|
+
* `var(--o-ui-space)`.
|
|
23
|
+
*/
|
|
24
|
+
mt?: Responsive<number | CSSProperties["marginTop"]>;
|
|
25
|
+
/**
|
|
26
|
+
* Margin area on the right side of an element. When a number is provided, each unit corresponds
|
|
27
|
+
* to `var(--o-ui-space)`.
|
|
28
|
+
*/
|
|
29
|
+
mr?: Responsive<number | CSSProperties["marginRight"]>;
|
|
30
|
+
/**
|
|
31
|
+
* Margin area on the bottom side of an element. When a number is provided, each unit corresponds
|
|
32
|
+
* to `var(--o-ui-space)`.
|
|
33
|
+
*/
|
|
34
|
+
mb?: Responsive<number | CSSProperties["marginBottom"]>;
|
|
35
|
+
/**
|
|
36
|
+
* Margin area on the left side of an element. When a number is provided, each unit corresponds to
|
|
37
|
+
* `var(--o-ui-space)`.
|
|
38
|
+
*/
|
|
39
|
+
ml?: Responsive<number | CSSProperties["marginLeft"]>;
|
|
40
|
+
}
|
|
41
|
+
/** Result of the {@link useMarginProps} hook. */
|
|
42
|
+
export type UseMarginPropsResult<T extends UseMarginPropsOptions> = Omit<T, keyof UseMarginPropsOptions> & {
|
|
43
|
+
marginProps: ResponsiveValueProps;
|
|
44
|
+
};
|
|
45
|
+
/** Hook providing access to all margin properties. */
|
|
46
|
+
export declare function useMarginProps<T extends UseMarginPropsOptions>({ m, my, mx, mt: mtProp, mr: mrProp, mb: mbProp, ml: mlProp, ...otherProps }: T): UseMarginPropsResult<T>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { CSSProperties } from "react";
|
|
2
|
+
import { type Responsive, type ResponsiveValueProps } from "./responsiveValues.ts";
|
|
3
|
+
/** Options available to the {@link usePaddingProps} hook. */
|
|
4
|
+
export interface UsePaddingPropsOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Padding area on all four sides of an element. When a number is provided, each unit corresponds
|
|
7
|
+
* to `var(--o-ui-space)`.
|
|
8
|
+
*/
|
|
9
|
+
p?: Responsive<number | CSSProperties["paddingTop"]>;
|
|
10
|
+
/**
|
|
11
|
+
* Padding area on the top and bottom sides of an element. When a number is provided, each unit
|
|
12
|
+
* corresponds to `var(--o-ui-space)`.
|
|
13
|
+
*/
|
|
14
|
+
py?: Responsive<number | CSSProperties["paddingTop"]>;
|
|
15
|
+
/**
|
|
16
|
+
* Padding area on the left and right sides of an element. When a number is provided, each unit
|
|
17
|
+
* corresponds to `var(--o-ui-space)`.
|
|
18
|
+
*/
|
|
19
|
+
px?: Responsive<number | CSSProperties["paddingLeft"]>;
|
|
20
|
+
/**
|
|
21
|
+
* Padding area on the top side of an element. When a number is provided, each unit corresponds to
|
|
22
|
+
* `var(--o-ui-space)`.
|
|
23
|
+
*/
|
|
24
|
+
pt?: Responsive<number | CSSProperties["paddingTop"]>;
|
|
25
|
+
/**
|
|
26
|
+
* Padding area on the right side of an element. When a number is provided, each unit corresponds
|
|
27
|
+
* to `var(--o-ui-space)`.
|
|
28
|
+
*/
|
|
29
|
+
pr?: Responsive<number | CSSProperties["paddingRight"]>;
|
|
30
|
+
/**
|
|
31
|
+
* Padding area on the bottom side of an element. When a number is provided, each unit corresponds
|
|
32
|
+
* to `var(--o-ui-space)`.
|
|
33
|
+
*/
|
|
34
|
+
pb?: Responsive<number | CSSProperties["paddingBottom"]>;
|
|
35
|
+
/**
|
|
36
|
+
* Padding area on the left side of an element. When a number is provided, each unit corresponds
|
|
37
|
+
* to `var(--o-ui-space)`.
|
|
38
|
+
*/
|
|
39
|
+
pl?: Responsive<number | CSSProperties["paddingLeft"]>;
|
|
40
|
+
}
|
|
41
|
+
/** Result of the {@link usePaddingProps} hook. */
|
|
42
|
+
export type UsePaddingPropsResult<T extends UsePaddingPropsOptions> = Omit<T, keyof UsePaddingPropsOptions> & {
|
|
43
|
+
paddingProps: ResponsiveValueProps;
|
|
44
|
+
};
|
|
45
|
+
/** Hook providing access to all padding properties. */
|
|
46
|
+
export declare function usePaddingProps<T extends UsePaddingPropsOptions>({ p, py, px, pt: ptProp, pr: prProp, pb: pbProp, pl: plProp, ...otherProps }: T): UsePaddingPropsResult<T>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { CSSProperties } from "react";
|
|
2
|
+
import { type Responsive, type ResponsiveValueProps } from "./responsiveValues.ts";
|
|
3
|
+
/** Options available to the {@link useSizingProps} hook. */
|
|
4
|
+
export interface UseSizingPropsOptions {
|
|
5
|
+
/** Width of an element. When a number is provided, it represents a size in pixels. */
|
|
6
|
+
width?: Responsive<CSSProperties["width"]>;
|
|
7
|
+
/** Minimum width of an element. When a number is provided, it represents a size in pixels. */
|
|
8
|
+
minWidth?: Responsive<CSSProperties["minWidth"]>;
|
|
9
|
+
/** Maximum width of an element. When a number is provided, it represents a size in pixels. */
|
|
10
|
+
maxWidth?: Responsive<CSSProperties["maxWidth"]>;
|
|
11
|
+
/** Height of an element. When a number is provided, it represents a size in pixels. */
|
|
12
|
+
height?: Responsive<CSSProperties["height"]>;
|
|
13
|
+
/** Minimum height of an element. When a number is provided, it represents a size in pixels. */
|
|
14
|
+
minHeight?: Responsive<CSSProperties["minHeight"]>;
|
|
15
|
+
/** Maximum height of an element. When a number is provided, it represents a size in pixels. */
|
|
16
|
+
maxHeight?: Responsive<CSSProperties["maxHeight"]>;
|
|
17
|
+
}
|
|
18
|
+
/** Result of the {@link useSizingProps} hook. */
|
|
19
|
+
export type UseSizingPropsResult<T extends UseSizingPropsOptions> = Omit<T, keyof UseSizingPropsOptions> & {
|
|
20
|
+
sizingProps: ResponsiveValueProps;
|
|
21
|
+
};
|
|
22
|
+
/** Hook providing access to all sizing properties. */
|
|
23
|
+
export declare function useSizingProps<T extends UseSizingPropsOptions>({ width, minWidth, maxWidth, height, minHeight, maxHeight, ...otherProps }: T): UseSizingPropsResult<T>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { CSSProperties } from "react";
|
|
2
|
+
import { type Responsive, type ResponsiveValueProps } from "./responsiveValues.ts";
|
|
3
|
+
/** Available font weights, matching SCSS variables. */
|
|
4
|
+
declare const FONT_WEIGHTS: {
|
|
5
|
+
thin: number;
|
|
6
|
+
"extra-light": number;
|
|
7
|
+
light: number;
|
|
8
|
+
normal: number;
|
|
9
|
+
medium: number;
|
|
10
|
+
semibold: number;
|
|
11
|
+
bold: number;
|
|
12
|
+
"extra-bold": number;
|
|
13
|
+
black: number;
|
|
14
|
+
};
|
|
15
|
+
/** Size of the text. */
|
|
16
|
+
export type TextSize = "3xs" | "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "6xl" | "7xl" | "8xl" | "9xl";
|
|
17
|
+
/** Weight of the text. */
|
|
18
|
+
export type TextWeight = keyof typeof FONT_WEIGHTS;
|
|
19
|
+
/** Properties available to the {@link useTextProps} hook. */
|
|
20
|
+
export interface UseTextPropsOptions {
|
|
21
|
+
/** Size of the text. */
|
|
22
|
+
size?: Responsive<TextSize>;
|
|
23
|
+
/**
|
|
24
|
+
* Truncates text with an ellipsis. For pitfalls, see: [Flexbox and Truncated
|
|
25
|
+
* Text](https://css-tricks.com/flexbox-truncated-text/).
|
|
26
|
+
*/
|
|
27
|
+
truncate?: boolean;
|
|
28
|
+
/** Sets the `text-align` CSS property. */
|
|
29
|
+
align?: Responsive<CSSProperties["textAlign"]>;
|
|
30
|
+
/**
|
|
31
|
+
* Sets the `font-weight` CSS property.
|
|
32
|
+
*
|
|
33
|
+
* Besides standard CSS values, the following aliases are available: `"thin"` (100),
|
|
34
|
+
* `"extra-light"` (200), `"light"` (300), `"normal"` (400), `"medium"` (500), `"semibold"` (600),
|
|
35
|
+
* `"bold"` (700), `"extra-bold"` (800), and `"black"` (900).
|
|
36
|
+
*/
|
|
37
|
+
weight?: Responsive<TextWeight | CSSProperties["fontWeight"]>;
|
|
38
|
+
/**
|
|
39
|
+
* Set the `text-wrap` CSS property. A `true`/`false` boolean value sets the property to
|
|
40
|
+
* `"wrap"`/`"nowrap"` respectively.
|
|
41
|
+
*/
|
|
42
|
+
wrap?: Responsive<boolean | CSSProperties["textWrap"]>;
|
|
43
|
+
}
|
|
44
|
+
/** Result of the {@link useTextProps} hook. */
|
|
45
|
+
export type UseTextPropsResult<T extends UseTextPropsOptions> = Omit<T, keyof UseTextPropsOptions> & {
|
|
46
|
+
textProps: ResponsiveValueProps;
|
|
47
|
+
};
|
|
48
|
+
/** Hook providing access to all text properties. */
|
|
49
|
+
export declare function useTextProps<T extends UseTextPropsOptions>({ size, truncate, align, weight, wrap, ...otherProps }: T): UseTextPropsResult<T>;
|
|
50
|
+
export {};
|
|
@@ -1,41 +0,0 @@
|
|
|
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 | Partial<Record<Breakpoint, T>>;
|
|
5
|
-
/** Options available to the {@link useResponsiveValues} hook. */
|
|
6
|
-
export type UseResponsiveValuesOptions = UseCssVarsOptions;
|
|
7
|
-
/** Result of the {@link useResponsiveValues} hook. */
|
|
8
|
-
export interface UseResponsiveValuesResult {
|
|
9
|
-
/**
|
|
10
|
-
* Returns an object of CSS variables for multiple responsive values, together with data
|
|
11
|
-
* attributes specifying which breakpoints of each value have an associated CSS variable.
|
|
12
|
-
*/
|
|
13
|
-
responsiveValuesToCssVarsAndDataAttrs: <T extends Record<string, unknown>, TMappers extends {
|
|
14
|
-
[TKey in keyof T]: (value: T[TKey] extends Responsive<infer TValue> | undefined ? TValue : never) => unknown;
|
|
15
|
-
}>(componentName: string, values: T, mappers?: Partial<TMappers>) => {
|
|
16
|
-
cssVars: Record<string, string | undefined>;
|
|
17
|
-
dataAttrs: Record<string, string | undefined>;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Returns an object of CSS variables for a responsive value, together with data attributes
|
|
21
|
-
* specifying which breakpoints have an associated CSS variable.
|
|
22
|
-
*/
|
|
23
|
-
responsiveValueToCssVarsAndDataAttrs: <T>(componentName: string, varName: string, value?: Responsive<T>, mapper?: (value: T) => unknown) => {
|
|
24
|
-
cssVars: Record<string, string | undefined>;
|
|
25
|
-
dataAttrs: Record<string, string | undefined>;
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
/** Hook providing access to responsive value utilities. */
|
|
29
|
-
export declare function useResponsiveValues(options?: UseResponsiveValuesOptions): UseResponsiveValuesResult;
|
|
30
|
-
/**
|
|
31
|
-
* Resolves a `Responsive<T>` value to the specific value matching the current breakpoint.
|
|
32
|
-
*
|
|
33
|
-
* @param value Responsive value.
|
|
34
|
-
* @param defaultValue Fallback value if no matching breakpoint is found or if `value` is
|
|
35
|
-
* `undefined`.
|
|
36
|
-
* @returns The resolved value for the current breakpoint, or `defaultValue`.
|
|
37
|
-
*/
|
|
38
|
-
export declare function useCurrentResponsiveValue<T = unknown>(value: Responsive<T> | undefined): T | undefined;
|
|
39
|
-
export declare function useCurrentResponsiveValue<T = unknown>(value: Responsive<T> | undefined, defaultValue: T): T;
|
|
40
|
-
/** Whether the provided value is (probably) a responsive value object. */
|
|
41
|
-
export declare function isResponsiveValueObject<T = unknown>(value: Responsive<T>): value is Partial<Record<Breakpoint, T>>;
|