sit-onyx 1.0.0-beta.151 → 1.0.0-beta.153

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.
@@ -0,0 +1,27 @@
1
+ import type { OnyxButtonProps } from "./types";
2
+ type __VLS_Props = Pick<OnyxButtonProps, "disabled" | "link" | "loading" | "type" | "autofocus">;
3
+ declare function __VLS_template(): {
4
+ attrs: Partial<{}>;
5
+ slots: Readonly<{
6
+ /**
7
+ * Button content.
8
+ */
9
+ default(): unknown;
10
+ }> & {
11
+ /**
12
+ * Button content.
13
+ */
14
+ default(): unknown;
15
+ };
16
+ refs: {};
17
+ rootEl: any;
18
+ };
19
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
20
+ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
21
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
22
+ export default _default;
23
+ type __VLS_WithTemplateSlots<T, S> = T & {
24
+ new (): {
25
+ $slots: S;
26
+ };
27
+ };
@@ -2,6 +2,7 @@ import type { DensityProp } from "../../composables/density";
2
2
  import type { SkeletonInjected } from "../../composables/useSkeletonState";
3
3
  import type { AutofocusProp } from "../../types";
4
4
  import type { FormInjected } from "../OnyxForm/OnyxForm.core";
5
+ import type { WithLinkProp } from "../OnyxRouterLink/types";
5
6
  export type OnyxButtonProps = DensityProp & AutofocusProp & {
6
7
  /**
7
8
  * The text content of the button.
@@ -35,6 +36,11 @@ export type OnyxButtonProps = DensityProp & AutofocusProp & {
35
36
  * Whether to show a skeleton button.
36
37
  */
37
38
  skeleton?: SkeletonInjected;
39
+ /**
40
+ * If set, the button will be rendered as link.
41
+ * Note that not all button properties are supported when used as link, e.g. `disabled`, `type` and `autofocus` are not supported.
42
+ */
43
+ link?: WithLinkProp["link"];
38
44
  };
39
45
  export declare const BUTTON_TYPES: readonly ["button", "submit", "reset"];
40
46
  export type ButtonType = (typeof BUTTON_TYPES)[number];
@@ -1,5 +1,5 @@
1
1
  import { type Component, type MaybeRefOrGetter, type WatchSource } from "vue";
2
- import { injectI18n } from "../../../i18n";
2
+ import { type OnyxI18n } from "../../../i18n";
3
3
  import type { OnyxMenuItem } from "../../OnyxNavBar/modules";
4
4
  import type { DataGridRendererCell, DataGridRendererColumn, DataGridRendererRow } from "../OnyxDataGridRenderer/types";
5
5
  import type { DataGridEntry, DataGridMetadata } from "../types";
@@ -25,6 +25,7 @@ export type TypeRenderMap<TEntry extends DataGridEntry> = Record<PropertyKey, Ty
25
25
  * ColumnConfig as it can be defined by the user.
26
26
  */
27
27
  export type ColumnConfig<TEntry extends DataGridEntry, TTypes> = keyof TEntry | NormalizedColumnConfig<TEntry, TTypes>;
28
+ export type DefaultSupportedTypes = "string" | "number";
28
29
  /**
29
30
  * Normalized column config for internal usage.
30
31
  */
@@ -42,7 +43,7 @@ export type NormalizedColumnConfig<TEntry extends DataGridEntry, TTypes = Proper
42
43
  * The `type` of the column. It defines how the header and cells of a column is rendered.
43
44
  * If not defined the values are displayed as plain strings.
44
45
  */
45
- type?: TTypes;
46
+ type?: TTypes | DefaultSupportedTypes;
46
47
  };
47
48
  /**
48
49
  * Complete Type for a single data grid feature.
@@ -118,7 +119,7 @@ export declare function createFeature<TArgs extends any[], TFeature extends Data
118
119
  type CheckDataGridFeature<T> = T extends DataGridFeature<infer A, TypeRenderMap<infer A>, infer C> ? DataGridFeature<A, TypeRenderMap<A>, C> : never;
119
120
  export type UseDataGridFeaturesOptions<TEntry extends DataGridEntry> = {
120
121
  columnConfig: MaybeRefOrGetter<ColumnConfig<TEntry, PropertyKey>[]>;
121
- t: ReturnType<typeof injectI18n>["t"];
122
+ i18n: OnyxI18n;
122
123
  };
123
124
  /**
124
125
  * Uses the defined datagrid features to provide factory functions.
@@ -154,7 +155,7 @@ export type UseDataGridFeaturesOptions<TEntry extends DataGridEntry> = {
154
155
  * </template>
155
156
  * ```
156
157
  */
157
- export declare const useDataGridFeatures: <TEntry extends DataGridEntry, TFeatureName extends symbol, TTypeRenderer extends TypeRenderMap<TEntry>, T extends DataGridFeature<TEntry, TTypeRenderer, TFeatureName>[] | []>(features: T, { t, columnConfig }: UseDataGridFeaturesOptions<TEntry>) => {
158
+ export declare const useDataGridFeatures: <TEntry extends DataGridEntry, TFeatureName extends symbol, TTypeRenderer extends TypeRenderMap<TEntry>, T extends DataGridFeature<TEntry, TTypeRenderer, TFeatureName>[] | []>(features: T, { i18n, columnConfig }: UseDataGridFeaturesOptions<TEntry>) => {
158
159
  /** Takes the column definition and maps all, calls mutation func and maps at the end to RendererCell */
159
160
  createRendererRows: (entries: TEntry[]) => DataGridRendererRow<TEntry, DataGridMetadata>[];
160
161
  /** Takes the column definition and creates a RenderHeader for each, adds actions from features */
@@ -0,0 +1,11 @@
1
+ import type { DataGridEntry } from "../types";
2
+ import type { DataGridFeature, TypeRenderer, TypeRenderMap } from "./index";
3
+ import "./renderer.scss";
4
+ export type DefaultSupportedTypes = "string" | "number";
5
+ export declare const createRenderer: <TEntry extends DataGridEntry>(features: DataGridFeature<TEntry, TypeRenderMap<TEntry>, symbol>[]) => {
6
+ /**
7
+ * Returns a renderer for any given component and type.
8
+ * Uses the fallbackRenderer if necessary.
9
+ */
10
+ getFor: <TComponent extends "cell" | "header">(component: TComponent, type?: PropertyKey) => NonNullable<TypeRenderer<TEntry>[TComponent]>;
11
+ };
@@ -1,9 +1,9 @@
1
1
  import type { DensityProp } from "../../composables/density";
2
2
  import type { SkeletonInjected } from "../../composables/useSkeletonState";
3
3
  import type { AutofocusProp } from "../../types";
4
- import type { ButtonColor, ButtonType } from "../OnyxButton/types";
4
+ import type { ButtonColor, ButtonType, OnyxButtonProps } from "../OnyxButton/types";
5
5
  import type { FormInjected } from "../OnyxForm/OnyxForm.core";
6
- export type OnyxIconButtonProps = DensityProp & AutofocusProp & {
6
+ export type OnyxIconButtonProps = DensityProp & AutofocusProp & Pick<OnyxButtonProps, "link"> & {
7
7
  /**
8
8
  * The aria-label of the button.
9
9
  */
@@ -1,5 +1,5 @@
1
1
  import type { OnyxButtonProps } from "../OnyxButton/types";
2
- export type OnyxSystemButtonProps = Pick<OnyxButtonProps, "disabled" | "autofocus" | "skeleton"> & {
2
+ export type OnyxSystemButtonProps = Pick<OnyxButtonProps, "disabled" | "autofocus" | "skeleton" | "link"> & {
3
3
  /**
4
4
  * Button label / text to show. Is always required (even if `icon` is set) for screen readers / accessibility.
5
5
  */
@@ -63,7 +63,8 @@ export type TranslationFunction = (key: OnyxTranslationKey,
63
63
  placeholders?: Record<string, string | number | undefined> & {
64
64
  n?: number;
65
65
  }) => string;
66
- export declare const I18N_INJECTION_KEY: InjectionKey<ReturnType<typeof createI18n>>;
66
+ export declare const I18N_INJECTION_KEY: InjectionKey<OnyxI18n>;
67
+ export type OnyxI18n = ReturnType<typeof createI18n>;
67
68
  /**
68
69
  * Creates a new i18n instance.
69
70
  */