@avenirs-esr/avenirs-dsav 0.1.52 → 0.1.53
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/avenirs-dsav.es.js +1606 -1494
- package/dist/avenirs-dsav.umd.js +7 -7
- package/dist/composables/index.d.ts +1 -1
- package/dist/composables/use-av-breakpoints/use-av-breakpoints.d.ts +72 -0
- package/dist/config/index.d.ts +0 -1
- package/package.json +3 -3
- package/dist/composables/use-breakpoint/use-breakpoint.d.ts +0 -54
- package/dist/config/breakpoints.d.ts +0 -10
- /package/dist/composables/{use-breakpoint/use-breakpoint.test.d.ts → use-av-breakpoints/use-av-breakpoints.test.d.ts} +0 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* Named viewport breakpoints for responsive behavior.
|
|
4
|
+
* These values are aligned with the DSFR / Avenirs design system.
|
|
5
|
+
*/
|
|
6
|
+
export declare const AV_BREAKPOINTS: {
|
|
7
|
+
readonly sm: 576;
|
|
8
|
+
readonly md: 768;
|
|
9
|
+
readonly lg: 1024;
|
|
10
|
+
readonly xl: 1440;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Result returned by the `useAvBreakpoints` composable.
|
|
14
|
+
*
|
|
15
|
+
* Each property is a reactive reference (`Ref<boolean>`) that updates automatically
|
|
16
|
+
* when the viewport width changes. It provides both **granular breakpoint flags**
|
|
17
|
+
* (`isBelowSm`, `isAboveLg`, etc.) and **semantic viewport categories**
|
|
18
|
+
* (`isMobile`, `isTablet`, `isDesktop`).
|
|
19
|
+
*/
|
|
20
|
+
export interface UseAvBreakpointsReturn {
|
|
21
|
+
/**
|
|
22
|
+
* True if the viewport width is considered mobile.
|
|
23
|
+
* Equivalent to `width < 768px (48rem)` (below md).
|
|
24
|
+
*/
|
|
25
|
+
isMobile: Ref<boolean>;
|
|
26
|
+
/**
|
|
27
|
+
* True if the viewport width is considered tablet.
|
|
28
|
+
* Equivalent to `768px (48rem) <= width < 1024px (64rem)` (between md and lg).
|
|
29
|
+
*/
|
|
30
|
+
isTablet: Ref<boolean>;
|
|
31
|
+
/**
|
|
32
|
+
* True if the viewport width is considered desktop.
|
|
33
|
+
* Equivalent to `width >= 1024px (64rem)` (lg and above).
|
|
34
|
+
*/
|
|
35
|
+
isDesktop: Ref<boolean>;
|
|
36
|
+
/** True if viewport width is below 576px (36rem). */
|
|
37
|
+
isBelowSm: Ref<boolean>;
|
|
38
|
+
/** True if viewport width is below 768px (48rem). */
|
|
39
|
+
isBelowMd: Ref<boolean>;
|
|
40
|
+
/** True if viewport width is below 1024px (64rem). */
|
|
41
|
+
isBelowLg: Ref<boolean>;
|
|
42
|
+
/** True if viewport width is below 1440px (90rem). */
|
|
43
|
+
isBelowXl: Ref<boolean>;
|
|
44
|
+
/** True if viewport width is above or equal to 768px (48rem). */
|
|
45
|
+
isAboveMd: Ref<boolean>;
|
|
46
|
+
/** True if viewport width is above or equal to 1024px (64rem). */
|
|
47
|
+
isAboveLg: Ref<boolean>;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Vue composable providing reactive responsive utilities
|
|
51
|
+
* based on the current viewport width.
|
|
52
|
+
*
|
|
53
|
+
* It uses VueUse useBreakpoints with DSAV breakpoints:
|
|
54
|
+
* - sm: 576px (36rem),
|
|
55
|
+
* - md: 768px (48rem),
|
|
56
|
+
* - lg: 1024px (64rem),
|
|
57
|
+
* - xl: 1440px (90rem),
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* import { useAvBreakpoints } from '@avenirs-esr/avenirs-dsav'
|
|
62
|
+
*
|
|
63
|
+
* const { isMobile, isDesktop, isBelowMd, isAboveLg } = useAvBreakpoints()
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* @returns {UseAvBreakpointsReturn} Object containing:
|
|
67
|
+
* - `isBelowSm|Md|Lg|Xl`: computed refs returning true if below a breakpoint
|
|
68
|
+
* - `isAboveMd|Lg`: computed refs returning true if above a breakpoint
|
|
69
|
+
*
|
|
70
|
+
* @see {@link https://vueuse.org/core/useBreakpoints/ useBreakpoints on VueUse}
|
|
71
|
+
*/
|
|
72
|
+
export declare function useAvBreakpoints(): UseAvBreakpointsReturn;
|
package/dist/config/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@avenirs-esr/avenirs-dsav",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.53",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/avenirs-esr/avenirs-dsav"
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@chromatic-com/storybook": "^4.1.1",
|
|
69
69
|
"@commitlint/cli": "^19.8.1",
|
|
70
70
|
"@commitlint/config-conventional": "^19.8.1",
|
|
71
|
-
"@playwright/test": "1.
|
|
71
|
+
"@playwright/test": "^1.55.0",
|
|
72
72
|
"@rushstack/eslint-patch": "^1.10.4",
|
|
73
73
|
"@storybook/addon-a11y": "^9.1.6",
|
|
74
74
|
"@storybook/addon-docs": "^9.1.6",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"jsdom": "^25.0.0",
|
|
97
97
|
"lint-staged": "^16.1.6",
|
|
98
98
|
"npm-run-all2": "^6.2.2",
|
|
99
|
-
"playwright": "1.
|
|
99
|
+
"playwright": "^1.55.0",
|
|
100
100
|
"rimraf": "^5.0.10",
|
|
101
101
|
"sass-embedded": "^1.92.1",
|
|
102
102
|
"storybook": "^9.1.6",
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import type { ComputedRef } from 'vue';
|
|
2
|
-
import type { BREAKPOINTS } from '@/config';
|
|
3
|
-
/**
|
|
4
|
-
* Result returned by the useBreakpoint composable.
|
|
5
|
-
*/
|
|
6
|
-
export interface UseBreakpointReturn {
|
|
7
|
-
/**
|
|
8
|
-
* Returns a computed boolean that is `true` when the viewport width
|
|
9
|
-
* is strictly **below** the given breakpoint (`max-width: bp - 1px`).
|
|
10
|
-
*
|
|
11
|
-
* Equivalent to the Sass mixin: `@include respond-below($breakpoint)`
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```ts
|
|
15
|
-
* const isMobile = respondBelow(BREAKPOINTS.MD) // true if width <= 767px
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
respondBelow: (bp: BREAKPOINTS) => ComputedRef<boolean>;
|
|
19
|
-
/**
|
|
20
|
-
* Returns a computed boolean that is `true` when the viewport width
|
|
21
|
-
* is **at or above** the given breakpoint (`min-width: bp`).
|
|
22
|
-
*
|
|
23
|
-
* Equivalent to the Sass mixin: `@include respond-to($breakpoint)`
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* ```ts
|
|
27
|
-
* const isDesktop = respondTo(BREAKPOINTS.LG) // true if width >= 1024px
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
respondTo: (bp: BREAKPOINTS) => ComputedRef<boolean>;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Vue composable to handle responsive breakpoints based on the current viewport width.
|
|
34
|
-
*
|
|
35
|
-
* This composable provides reactive utilities (`respondBelow` and `respondTo`)
|
|
36
|
-
* that mirror the behavior of the Sass mixins `@include respond-below($breakpoint)`
|
|
37
|
-
* and `@include respond-to($breakpoint)`, allowing you to keep logic and styles
|
|
38
|
-
* perfectly in sync.
|
|
39
|
-
*
|
|
40
|
-
* @example
|
|
41
|
-
* ```ts
|
|
42
|
-
* const { respondBelow, respondTo } = useBreakpoint()
|
|
43
|
-
*
|
|
44
|
-
* const isMobile = respondBelow(BREAKPOINTS.MD) // true if width < 768px
|
|
45
|
-
* const isDesktop = respondTo(BREAKPOINTS.LG) // true if width >= 1024px
|
|
46
|
-
* ```
|
|
47
|
-
*
|
|
48
|
-
* @returns {UseBreakpointReturn} Object containing:
|
|
49
|
-
* - `respondBelow`: Returns a computed boolean (`true` if width < breakpoint),
|
|
50
|
-
* - `respondTo`: Returns a computed boolean (`true` if width >= breakpoint).
|
|
51
|
-
*
|
|
52
|
-
* @see BREAKPOINTS for the defined responsive thresholds.
|
|
53
|
-
*/
|
|
54
|
-
export declare function useBreakpoint(): UseBreakpointReturn;
|