sit-onyx 1.2.0-dev-20251016073921 → 1.2.0-dev-20251016153744
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/components/OnyxDataGrid/types.d.ts +2 -2
- package/dist/components/OnyxDatePicker/types.d.ts +4 -2
- package/dist/components/OnyxLink/OnyxLink.d.vue.ts +1 -1
- package/dist/index.esm-bundler.js +99 -57
- package/dist/index.esm-bundler.js.map +1 -1
- package/dist/index.js +3021 -3009
- package/dist/types/utils.d.ts +8 -2
- package/dist/utils/date.d.ts +14 -1
- package/dist/utils/props.d.ts +30 -0
- package/package.json +5 -5
package/dist/types/utils.d.ts
CHANGED
|
@@ -40,9 +40,15 @@ export type Merge<Target, Source> = {
|
|
|
40
40
|
*/
|
|
41
41
|
export type MergeAll<T extends unknown[]> = T extends [infer First, ...infer Rest] ? Rest extends [] ? First : Merge<First, MergeAll<Rest>> : never;
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
43
|
+
* Take the value types from `T` for the key `K`, if it exists.
|
|
44
44
|
*/
|
|
45
|
-
export type
|
|
45
|
+
export type MaybeUnwrap<T, Key, Fallback = never> = Key extends keyof T ? T[Key] : Fallback;
|
|
46
|
+
/**
|
|
47
|
+
* Create a subset of `T` for all keys `Key` that exist in `T`
|
|
48
|
+
*/
|
|
49
|
+
export type MaybePick<T, Key extends PropertyKey> = {
|
|
50
|
+
[P in Key as P extends keyof T ? P : never]: P extends keyof T ? T[P] : never;
|
|
51
|
+
};
|
|
46
52
|
/**
|
|
47
53
|
* Recursive / deep implementation of TypeScript's built-in `Partial<T>` type.
|
|
48
54
|
*/
|
package/dist/utils/date.d.ts
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
* Checks whether the given value is a valid `Date` object.
|
|
3
3
|
*
|
|
4
4
|
* @example isValidDate(new Date()) // true
|
|
5
|
-
* @example isValidDate("not-a-date") // false
|
|
5
|
+
* @example isValidDate(new Date("not-a-date")) // false
|
|
6
|
+
* @example isValidDate("definitely-not-a-date") // false
|
|
6
7
|
*/
|
|
7
8
|
export declare const isValidDate: (date: unknown) => date is Date;
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @param date The JS Date object to convert
|
|
12
|
+
* @param type If the formatted string should include the time and if so, with UTC timezone or as local time.
|
|
13
|
+
* @returns Returns a full date-only ISO8601 complaint string, which is also parsable by new Date()
|
|
14
|
+
*
|
|
15
|
+
* @example dateToISOString(new Date("2025-10-16T11:01:09.564Z", "date")) // "2025-10-16"
|
|
16
|
+
* @example dateToISOString(new Date("2025-10-16T11:01:09.564Z", "datetime-utc")) // "2025-10-16T11:01:09.564Z"
|
|
17
|
+
* @example dateToISOString(new Date("2025-10-16T13:01:09.564Z", "datetime-local")) // "2025-10-16T13:01:09.564"
|
|
18
|
+
* @example dateToISOString(new Date("not-a-date")) // undefined
|
|
19
|
+
*/
|
|
20
|
+
export declare const dateToISOString: (date: Date | undefined, type: "date" | "datetime-utc" | "datetime-local") => string | undefined;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ComponentProps } from 'vue-component-type-helpers';
|
|
2
|
+
import { Data, MaybePick } from '../types/utils.js';
|
|
3
|
+
/**
|
|
4
|
+
* The computed value is an object, that only contains properties that are defined by the target component.
|
|
5
|
+
* Is useful to forward only a matching subset of properties from a parent component to a wrapped child component.
|
|
6
|
+
*
|
|
7
|
+
* This is necessary when the parent defines props, which are not defined in the child component.
|
|
8
|
+
* Otherwise, the child component will set the extraneous props as attributes, which bloats the DOM and can lead to unexpected side-effects.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
*
|
|
12
|
+
* ```vue
|
|
13
|
+
* <script setup lang="ts">
|
|
14
|
+
* import { useForwardProps } from "sit-onyx";
|
|
15
|
+
* import MyChildComponent from "./MyChildComponent.vue";
|
|
16
|
+
*
|
|
17
|
+
* const props = defineProps<ParentProps & ChildProps>();
|
|
18
|
+
* const childProps = useForwardProps(props, MyChildComponent);
|
|
19
|
+
* </script>
|
|
20
|
+
* <template>
|
|
21
|
+
* <!-- childProps only includes props that exist on MyChildComponent -->
|
|
22
|
+
* <MyChildComponent v-bind="childProps" />
|
|
23
|
+
* </template>
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @param props The reactive props object of the parent component.
|
|
27
|
+
* @param target Component for which the properties are to be forwarded.
|
|
28
|
+
* @returns computed value with properties that are also defined the target component.
|
|
29
|
+
*/
|
|
30
|
+
export declare const useForwardProps: <T extends Data, TComponent, TProps = ComponentProps<TComponent>, R = MaybePick<T, keyof TProps>>(props: T, target: TComponent) => import('vue').ComputedRef<R>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sit-onyx",
|
|
3
3
|
"description": "A design system and Vue.js component library created by Schwarz IT",
|
|
4
|
-
"version": "1.2.0-dev-
|
|
4
|
+
"version": "1.2.0-dev-20251016153744",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Schwarz IT KG",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -58,11 +58,11 @@
|
|
|
58
58
|
"vue-component-type-helpers": "^3.1.1",
|
|
59
59
|
"vue-i18n": "^11.1.12",
|
|
60
60
|
"vue-router": "^4.6.0",
|
|
61
|
+
"@sit-onyx/headless": "^0.2.0-dev-20251016153744",
|
|
61
62
|
"@sit-onyx/flags": "^1.0.0",
|
|
62
|
-
"@sit-onyx/
|
|
63
|
-
"@sit-onyx/storybook-utils": "^1.0.2-dev-
|
|
64
|
-
"@sit-onyx/shared": "^0.1.0"
|
|
65
|
-
"@sit-onyx/playwright-utils": "^1.0.0"
|
|
63
|
+
"@sit-onyx/playwright-utils": "^1.0.0",
|
|
64
|
+
"@sit-onyx/storybook-utils": "^1.0.2-dev-20251016153744",
|
|
65
|
+
"@sit-onyx/shared": "^0.1.0"
|
|
66
66
|
},
|
|
67
67
|
"scripts": {
|
|
68
68
|
"dev": "storybook dev -p 6006 --no-open",
|