@ostack.tech/ui 1.3.0 → 1.3.2

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 (48) hide show
  1. package/dist/chunks/{en-Czf-_HZt.js → en-MXAz48KY.js} +2 -1
  2. package/dist/chunks/{en-Czf-_HZt.js.map → en-MXAz48KY.js.map} +1 -1
  3. package/dist/locales/en-GB.js +1 -1
  4. package/dist/locales/en-US.js +1 -1
  5. package/dist/locales/fr-FR.js +1 -0
  6. package/dist/locales/fr-FR.js.map +1 -1
  7. package/dist/locales/pt-PT.js +1 -0
  8. package/dist/locales/pt-PT.js.map +1 -1
  9. package/dist/ostack-ui.css +89 -84
  10. package/dist/ostack-ui.js +1073 -993
  11. package/dist/ostack-ui.js.map +1 -1
  12. package/package.json +1 -1
  13. package/scss/components/Calendar/_Calendar-variables.scss +1 -1
  14. package/scss/components/Calendar/_Calendar.scss +15 -16
  15. package/scss/components/ControlAddon/_ControlAddon.scss +3 -5
  16. package/scss/components/DataTable/_DataTable.scss +7 -2
  17. package/scss/components/DropdownMenu/_DropdownMenu.scss +1 -1
  18. package/scss/components/Feedback/_Feedback.scss +2 -0
  19. package/scss/components/Field/_Field.scss +0 -1
  20. package/scss/components/HelperText/_HelperText.scss +2 -1
  21. package/scss/components/Input/_Input.scss +1 -1
  22. package/scss/components/Label/_Label.scss +1 -0
  23. package/scss/components/Link/_Link.scss +1 -1
  24. package/scss/components/Root/_Root.scss +1 -1
  25. package/scss/components/Stack/_Stack.scss +1 -1
  26. package/scss/components/Table/_Table.scss +23 -9
  27. package/scss/components/Tabs/_Tabs.scss +2 -2
  28. package/scss/scss/helpers/_margin-utils.scss +13 -11
  29. package/scss/scss/helpers/_padding-utils.scss +13 -11
  30. package/scss/scss/helpers/_print-utils.scss +3 -1
  31. package/scss/scss/helpers/_sizing-utils.scss +19 -17
  32. package/scss/scss/helpers/_text-utils.scss +19 -17
  33. package/scss/scss/helpers/_visually-hidden.scss +1 -1
  34. package/scss/scss/utils/_button-reset.scss +1 -1
  35. package/types/components/Form/FormError.d.ts +1 -1
  36. package/types/components/Keybinds/KeyPress.d.ts +3 -3
  37. package/types/components/Keybinds/Keybind.d.ts +2 -2
  38. package/types/components/Keybinds/Keybinds.d.ts +1 -1
  39. package/types/components/Printer/Printer.d.ts +2 -2
  40. package/types/components/Printer/PrinterContentContext.d.ts +4 -16
  41. package/types/components/Printer/PrinterContext.d.ts +1 -2
  42. package/types/components/Printer/index.d.ts +1 -1
  43. package/types/components/Printer/usePrintClassNames.d.ts +6 -2
  44. package/types/components/Table/TableContext.d.ts +2 -0
  45. package/types/components/Table/columnUtils.d.ts +4 -0
  46. package/types/index.d.ts +1 -0
  47. package/types/utils/useIntersectionObserver.d.ts +6 -2
  48. package/types/utils/useResizeObserver.d.ts +6 -0
@@ -1,8 +1,7 @@
1
1
  /** Value of the printer content context. */
2
2
  export interface PrinterContextValue {
3
3
  printing: boolean;
4
- startPrintingTask?: () => void;
5
- finishPrintingTask?: () => void;
4
+ startPrintingTask?: () => () => void;
6
5
  }
7
6
  /** Printer content context. */
8
7
  export declare const PrinterContentContext: import("react").Context<PrinterContextValue>;
@@ -18,20 +17,9 @@ export declare function usePrinterContentContext(): PrinterContextValue;
18
17
  * > **Note:** This hook **can** be called outside the printer context.
19
18
  */
20
19
  export declare function usePrinting(): boolean;
21
- /** Options for the `useStartPrintingTask` hook. */
22
- export interface UseStartPrintingTaskOptions {
23
- /**
24
- * Whether to enable the printing task.
25
- *
26
- * @default true
27
- */
28
- enabled?: boolean;
29
- }
30
20
  /**
31
- * Marks a printing task as having started and returns a function that should be called when it
32
- * finishes. The printer will wait for any ongoing printing tasks before printing.
21
+ * Prevents printing from happening while `pending` is `true`.
33
22
  *
34
- * > **Note:** This hook **can** be called outside the printer context, in which case
35
- * > starting/finishing printing tasks will be no-ops but **won't** fail.
23
+ * > **Note:** This hook **can** be called outside the printer context, in which case it is a no-op.
36
24
  */
37
- export declare function useStartPrintingTask({ enabled, }?: UseStartPrintingTaskOptions): () => void;
25
+ export declare function usePrintingTask(pending: boolean): void;
@@ -9,8 +9,7 @@ interface PrinterContextValue {
9
9
  triggerRef: RefObject<HTMLButtonElement | null>;
10
10
  contentRef: RefObject<Element | Text | null>;
11
11
  print: (options?: PrintOptions) => Promise<void>;
12
- startPrintingTask: () => void;
13
- finishPrintingTask: () => void;
12
+ startPrintingTask: () => () => void;
14
13
  }
15
14
  /** Printer context. */
16
15
  export declare const PrinterContext: import("react").Context<PrinterContextValue | null>;
@@ -1,6 +1,6 @@
1
1
  export * from "./Printer.tsx";
2
2
  export * from "./PrinterContent.tsx";
3
- export { usePrinting, useStartPrintingTask } from "./PrinterContentContext.tsx";
3
+ export { usePrinting, usePrintingTask } from "./PrinterContentContext.tsx";
4
4
  export { usePrint, usePrinterDocumentTitle, usePrintInProgress } from "./PrinterContext.ts";
5
5
  export * from "./PrinterTrigger.tsx";
6
6
  export * from "./usePrintClassNames.ts";
@@ -1,5 +1,9 @@
1
- export interface UsePrintClassNames {
1
+ /** Print-related class names. */
2
+ export interface PrintClassNames {
3
+ /** Class name used for content that should only be visible while printing. */
2
4
  printOnly: string;
5
+ /** Class name used for content that should be hidden while printing. */
3
6
  printHidden: string;
4
7
  }
5
- export declare function usePrintClassNames(): UsePrintClassNames;
8
+ /** Hook which exposes print-related class names. */
9
+ export declare function usePrintClassNames(): PrintClassNames;
@@ -2,6 +2,7 @@ import type { ScrollPosition } from "../../utils/useScrollPosition.ts";
2
2
  import type { ControlStatus } from "../Control";
3
3
  import type { TableLayout } from "./Table.tsx";
4
4
  import type { TableColumnObject } from "./TableColumn.tsx";
5
+ import type { TableColumnGroupObject } from "./TableColumnGroup.tsx";
5
6
  /** Value of the table context. */
6
7
  export interface TableContextValue {
7
8
  editable: boolean;
@@ -13,6 +14,7 @@ export interface TableContextValue {
13
14
  export interface TableState {
14
15
  scrollPosition?: ScrollPosition;
15
16
  leafColumns?: TableColumnObject[];
17
+ columnKeys?: Map<TableColumnObject | TableColumnGroupObject, string>;
16
18
  defaultColumnWidth: number;
17
19
  numberOfColumns: () => number | undefined;
18
20
  stickyColumnOffsets: () => (number | undefined)[] | undefined;
@@ -27,3 +27,7 @@ export declare function leftMostLeafColumn(column: TableColumnGroupObject | Tabl
27
27
  export declare function rightMostLeafColumn(column: TableColumnGroupObject | TableColumnObject): TableColumnObject;
28
28
  /** Offsets (`left`/`right` CSS properties) to provide to sticky columns. */
29
29
  export declare function stickyColumnOffsets(leaves: TableColumnObject[], defaultColumnWidth: number): (number | undefined)[];
30
+ /** Keys of all columns (leaves and groups), based on their location in the column tree. */
31
+ export declare function columnKeys(columns: TableColumnObjects): Map<TableColumnObject | TableColumnGroupObject, string>;
32
+ /** Keys of the `<col>` elements, aligned with the result of `columnWidths`. */
33
+ export declare function colKeys(leaves: TableColumnObject[], keys: Map<TableColumnObject | TableColumnGroupObject, string>): string[];
package/types/index.d.ts CHANGED
@@ -102,6 +102,7 @@ export * from "./utils/useMediaQuery.ts";
102
102
  export * from "./utils/useNumericTransformer.tsx";
103
103
  export * from "./utils/usePaddingProps.ts";
104
104
  export * from "./utils/usePrevious.ts";
105
+ export * from "./utils/useResizeObserver.ts";
105
106
  export * from "./utils/useSafeLayoutEffect.ts";
106
107
  export * from "./utils/useScrollPosition.ts";
107
108
  export * from "./utils/useScrollbarSize.ts";
@@ -1,2 +1,6 @@
1
- /** Hook wrapping an `IntersectionObserver` which tracks the intersection ratio of an element. */
2
- export declare function useIntersectionObserver(element: Element | null, onIntersectionEntryChange: (entry: IntersectionObserverEntry) => void, options?: IntersectionObserverInit): void;
1
+ /**
2
+ * Hook wrapping an `IntersectionObserver` which observes one or more elements. `onIntersect` is
3
+ * called with the observer's entries whenever the intersection of any observed element changes,
4
+ * including once right after the elements start being observed.
5
+ */
6
+ export declare function useIntersectionObserver(elements: Element | null | readonly (Element | null)[], onIntersect: (entries: IntersectionObserverEntry[]) => void, options?: IntersectionObserverInit): void;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Hook wrapping a `ResizeObserver` which observes one or more elements. `onResize` is called with
3
+ * the observer's entries whenever any observed element is resized, including once right after the
4
+ * elements start being observed.
5
+ */
6
+ export declare function useResizeObserver(elements: Element | null | readonly (Element | null)[], onResize: (entries: ResizeObserverEntry[]) => void, options?: ResizeObserverOptions): void;