@webitel/ui-sdk 26.6.119 → 26.8.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/ui-sdk",
3
- "version": "26.6.119",
3
+ "version": "26.8.2",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "npm run docs:dev",
@@ -4,4 +4,4 @@ export const LoginOptions = {
4
4
  SSO_ONLY: 'sso_only',
5
5
  } as const;
6
6
 
7
- export type LoginOptions = keyof typeof LoginOptions;
7
+ export type LoginOptions = (typeof LoginOptions)[keyof typeof LoginOptions];
@@ -1,13 +1,46 @@
1
- import { reactive } from 'vue';
1
+ import { type App, reactive } from 'vue';
2
2
 
3
- import debounce from '../../scripts/debounce.js';
3
+ import debounce from '../../scripts/debounce';
4
4
 
5
5
  // https://stackoverflow.com/questions/41791193/vuejs-reactive-binding-for-a-plugin-how-to/41801107#41801107
6
6
  // https://stackoverflow.com/questions/50111231/vue-prototype-not-reactive-when-data-changes
7
7
 
8
8
  // https://github.com/vuetifyjs/vuetify/blob/master/packages/vuetify/src/services/breakpoint/index.ts
9
9
 
10
- const breakpoint = reactive({
10
+ /** Reactive viewport state exposed app-wide as `$breakpoint`. */
11
+ export interface Breakpoint {
12
+ // Breakpoints
13
+ xs: boolean;
14
+ sm: boolean;
15
+ md: boolean;
16
+ lg: boolean;
17
+ xl: boolean;
18
+
19
+ // Conditionals
20
+ xsOnly: boolean;
21
+ smOnly: boolean;
22
+ smAndDown: boolean;
23
+ smAndUp: boolean;
24
+ mdOnly: boolean;
25
+ mdAndDown: boolean;
26
+ mdAndUp: boolean;
27
+ lgOnly: boolean;
28
+ lgAndDown: boolean;
29
+ lgAndUp: boolean;
30
+ xlOnly: boolean;
31
+
32
+ /** true if screen width < mobileBreakpoint */
33
+ mobile: boolean;
34
+
35
+ /** Current breakpoint name (e.g. 'md') */
36
+ name: string;
37
+
38
+ // Dimensions
39
+ height: number;
40
+ width: number;
41
+ }
42
+
43
+ const breakpoint = reactive<Breakpoint>({
11
44
  // Breakpoints
12
45
  xs: false,
13
46
  sm: false,
@@ -122,7 +155,7 @@ const onResize = () => {
122
155
  breakpoint.mobile = current <= max;
123
156
  };
124
157
 
125
- const install = (app) => {
158
+ const install = (app: App) => {
126
159
  window.addEventListener('resize', debounce(onResize), {
127
160
  passive: true,
128
161
  });
@@ -133,3 +166,9 @@ const install = (app) => {
133
166
  };
134
167
 
135
168
  export { install };
169
+
170
+ declare module 'vue' {
171
+ interface ComponentCustomProperties {
172
+ $breakpoint: Breakpoint;
173
+ }
174
+ }
@@ -25,9 +25,12 @@ export type NormalizeDatetimeOptions = {
25
25
  };
26
26
 
27
27
  export const isRelativeDatetimeValue = (
28
- value: string,
28
+ value: unknown,
29
29
  ): value is RelativeDatetimeValue => {
30
- return (Object.values(RelativeDatetimeValue) as string[]).includes(value);
30
+ return (
31
+ typeof value === 'string' &&
32
+ (Object.values(RelativeDatetimeValue) as string[]).includes(value)
33
+ );
31
34
  };
32
35
 
33
36
  const convertRelativeDatetimeToTimestamp = (