@object-ui/mobile 17.6.0 → 17.7.0

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.
@@ -1,71 +0,0 @@
1
- /**
2
- * ObjectUI
3
- * Copyright (c) 2024-present ObjectStack Inc.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- */
8
- import type { BreakpointName, SpecResponsiveConfig } from '@object-ui/types';
9
- /**
10
- * The responsive layout config this hook consumes — re-exported, not re-declared
11
- * (objectui#4598).
12
- *
13
- * This used to be a hand-written interface over the same four keys, under a
14
- * comment asserting it mirrored the schema. The assertion was true on the day it
15
- * was written and maintained by nobody after that: the interface named the
16
- * schema without ever referring to it, so a key added or retired upstream would
17
- * have moved the two apart in silence. `ViewNavigationConfig` (objectui#4588)
18
- * read the same way until it had drifted on `mode`.
19
- *
20
- * `@object-ui/types` — already this package's only runtime dependency — publishes
21
- * the schema's own type at `index.ts` under this exact name, imported from
22
- * `@objectstack/spec/ui` rather than copied. Re-exporting it costs no new
23
- * dependency edge and leaves the published name unchanged, so the four keys are
24
- * now whatever the schema says they are rather than whatever this file last
25
- * remembered. `@object-ui/core`'s `ResponsiveProtocol` already binds through the
26
- * same re-export.
27
- *
28
- * `responsive-config-spec-parity.test.ts` pins the chain to the schema itself,
29
- * because the one link this file cannot see is `@object-ui/types` re-growing a
30
- * hand copy of its own.
31
- *
32
- * @example
33
- * ```ts
34
- * const config: SpecResponsiveConfig = {
35
- * columns: { xs: 12, sm: 6, lg: 4 },
36
- * hiddenOn: ['xs'],
37
- * order: { xs: 2, lg: 1 },
38
- * };
39
- * ```
40
- */
41
- export type { SpecResponsiveConfig };
42
- /**
43
- * Resolved responsive state from a SpecResponsiveConfig.
44
- */
45
- export interface ResolvedResponsiveState {
46
- /** Whether the component is hidden at the current breakpoint */
47
- hidden: boolean;
48
- /** Resolved column count for the current breakpoint */
49
- columns: number | undefined;
50
- /** Resolved display order for the current breakpoint */
51
- order: number | undefined;
52
- /** Current active breakpoint name */
53
- breakpoint: BreakpointName;
54
- }
55
- /**
56
- * Hook that consumes @objectstack/spec ResponsiveConfigSchema and
57
- * resolves breakpoint-aware layout state.
58
- *
59
- * @example
60
- * ```tsx
61
- * const { hidden, columns, order } = useResponsiveConfig({
62
- * columns: { xs: 12, sm: 6, lg: 4 },
63
- * hiddenOn: ['xs'],
64
- * order: { xs: 2, lg: 1 },
65
- * });
66
- * if (hidden) return null;
67
- * return <div style={{ gridColumn: `span ${columns}`, order }}>...</div>;
68
- * ```
69
- */
70
- export declare function useResponsiveConfig(config?: SpecResponsiveConfig): ResolvedResponsiveState;
71
- //# sourceMappingURL=useResponsiveConfig.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useResponsiveConfig.d.ts","sourceRoot":"","sources":["../src/useResponsiveConfig.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,YAAY,EAAE,oBAAoB,EAAE,CAAC;AAErC;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,gEAAgE;IAChE,MAAM,EAAE,OAAO,CAAC;IAChB,uDAAuD;IACvD,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,wDAAwD;IACxD,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,qCAAqC;IACrC,UAAU,EAAE,cAAc,CAAC;CAC5B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,CAAC,EAAE,oBAAoB,GAAG,uBAAuB,CAoB1F"}
@@ -1,41 +0,0 @@
1
- /**
2
- * ObjectUI
3
- * Copyright (c) 2024-present ObjectStack Inc.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- */
8
- import { useMemo } from 'react';
9
- import { useBreakpoint } from './useBreakpoint.js';
10
- import { resolveResponsiveValue } from './breakpoints.js';
11
- /**
12
- * Hook that consumes @objectstack/spec ResponsiveConfigSchema and
13
- * resolves breakpoint-aware layout state.
14
- *
15
- * @example
16
- * ```tsx
17
- * const { hidden, columns, order } = useResponsiveConfig({
18
- * columns: { xs: 12, sm: 6, lg: 4 },
19
- * hiddenOn: ['xs'],
20
- * order: { xs: 2, lg: 1 },
21
- * });
22
- * if (hidden) return null;
23
- * return <div style={{ gridColumn: `span ${columns}`, order }}>...</div>;
24
- * ```
25
- */
26
- export function useResponsiveConfig(config) {
27
- const { breakpoint } = useBreakpoint();
28
- return useMemo(() => {
29
- if (!config) {
30
- return { hidden: false, columns: undefined, order: undefined, breakpoint };
31
- }
32
- const hidden = config.hiddenOn?.includes(breakpoint) ?? false;
33
- const columns = config.columns
34
- ? resolveResponsiveValue(config.columns, breakpoint)
35
- : undefined;
36
- const order = config.order
37
- ? resolveResponsiveValue(config.order, breakpoint)
38
- : undefined;
39
- return { hidden, columns, order, breakpoint };
40
- }, [config, breakpoint]);
41
- }