@inc2734/unitone-css 1.4.1 → 1.4.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.
Files changed (34) hide show
  1. package/dist/app.css +1 -1
  2. package/dist/app.js +1 -1
  3. package/dist/behaviors/dividers.js +1 -1
  4. package/dist/behaviors/index.js +1 -1
  5. package/dist/behaviors/stairs.js +1 -1
  6. package/dist/layout-primitives/cluster/react.js +1 -1
  7. package/dist/layout-primitives/index.js +1 -1
  8. package/dist/layout-primitives/marquee/behavior.js +1 -1
  9. package/dist/layout-primitives/marquee/react.js +1 -1
  10. package/dist/layout-primitives/responsive-grid/react.js +1 -1
  11. package/dist/layout-primitives/stack/react.js +1 -1
  12. package/dist/layout-primitives/switcher/react.js +1 -1
  13. package/dist/layout-primitives/vertical-writing/behavior.js +1 -1
  14. package/dist/layout-primitives/vertical-writing/react.js +1 -1
  15. package/dist/layout-primitives/with-sidebar/react.js +1 -1
  16. package/dist/library.js +1 -1
  17. package/package.json +1 -1
  18. package/src/behaviors/dividers.js +3 -1
  19. package/src/behaviors/stairs.js +3 -1
  20. package/src/layout-behavior-state.js +41 -0
  21. package/src/layout-primitives/cluster/index.jsx +25 -16
  22. package/src/layout-primitives/marquee/_index.scss +15 -7
  23. package/src/layout-primitives/marquee/behavior.js +1 -1
  24. package/src/layout-primitives/marquee/index.jsx +69 -7
  25. package/src/layout-primitives/marquee/layout.js +163 -0
  26. package/src/layout-primitives/responsive-grid/index.jsx +29 -17
  27. package/src/layout-primitives/stack/index.jsx +25 -16
  28. package/src/layout-primitives/switcher/index.jsx +26 -17
  29. package/src/layout-primitives/vertical-writing/behavior.js +3 -1
  30. package/src/layout-primitives/vertical-writing/index.jsx +11 -11
  31. package/src/layout-primitives/with-sidebar/index.jsx +27 -18
  32. package/src/library.js +162 -298
  33. package/src/register-layout-initializer.js +34 -24
  34. package/src/use-layout-behaviors.js +60 -0
@@ -1,21 +1,31 @@
1
+ 'use client';
2
+
1
3
  import React from 'react';
4
+ import { useLayoutBehaviors } from '../../use-layout-behaviors';
2
5
 
3
- export const ResponsiveGrid = ({
4
- columnMinWidth,
5
- gap,
6
- autoRepeat,
7
- divider,
8
- dividerWidth,
9
- dividerStyle,
10
- dividerColor,
11
- stairs,
12
- stairsUp,
13
- containerType,
14
- responsiveContext,
15
- fluidReference, // @deprecated Kept for backward compatibility. Use responsiveContext on an ancestor instead.
16
- style,
17
- ...props
18
- }) => {
6
+ export const ResponsiveGrid = React.forwardRef(function ResponsiveGrid(
7
+ {
8
+ columnMinWidth,
9
+ gap,
10
+ autoRepeat,
11
+ divider,
12
+ dividerWidth,
13
+ dividerStyle,
14
+ dividerColor,
15
+ stairs,
16
+ stairsUp,
17
+ containerType,
18
+ responsiveContext,
19
+ fluidReference, // @deprecated Kept for backward compatibility. Use responsiveContext on an ancestor instead.
20
+ style,
21
+ ...props
22
+ },
23
+ forwardedRef,
24
+ ) {
25
+ const layoutRef = useLayoutBehaviors(
26
+ { divider: '' !== (divider ?? ''), stairs: '' !== (stairs ?? '') },
27
+ forwardedRef,
28
+ );
19
29
  style = {
20
30
  ...style,
21
31
  '--unitone--column-min-width': '' !== columnMinWidth ? columnMinWidth : undefined,
@@ -41,8 +51,10 @@ export const ResponsiveGrid = ({
41
51
  .join(' ')}
42
52
  style={style}
43
53
  {...props}
54
+ ref={layoutRef}
55
+ data-unitone-react-layout=""
44
56
  >
45
57
  {props.children}
46
58
  </div>
47
59
  );
48
- };
60
+ });
@@ -1,20 +1,27 @@
1
+ 'use client';
2
+
1
3
  import React from 'react';
4
+ import { useLayoutBehaviors } from '../../use-layout-behaviors';
2
5
 
3
- export const Stack = ({
4
- gap,
5
- negative,
6
- revert,
7
- divider,
8
- dividerWidth,
9
- dividerStyle,
10
- dividerColor,
11
- containerType,
12
- responsiveContext,
13
- fluidReference, // @deprecated Kept for backward compatibility. Use responsiveContext on an ancestor instead.
14
- tagName = 'div',
15
- style,
16
- ...props
17
- }) => {
6
+ export const Stack = React.forwardRef(function Stack(
7
+ {
8
+ gap,
9
+ negative,
10
+ revert,
11
+ divider,
12
+ dividerWidth,
13
+ dividerStyle,
14
+ dividerColor,
15
+ containerType,
16
+ responsiveContext,
17
+ fluidReference, // @deprecated Kept for backward compatibility. Use responsiveContext on an ancestor instead.
18
+ tagName = 'div',
19
+ style,
20
+ ...props
21
+ },
22
+ forwardedRef,
23
+ ) {
24
+ const layoutRef = useLayoutBehaviors({ divider: '' !== (divider ?? '') }, forwardedRef);
18
25
  const Tag = tagName;
19
26
 
20
27
  style = {
@@ -40,8 +47,10 @@ export const Stack = ({
40
47
  .join(' ')}
41
48
  style={style}
42
49
  {...props}
50
+ ref={layoutRef}
51
+ data-unitone-react-layout=""
43
52
  >
44
53
  {props.children}
45
54
  </Tag>
46
55
  );
47
- };
56
+ });
@@ -1,21 +1,28 @@
1
+ 'use client';
2
+
1
3
  import React from 'react';
4
+ import { useLayoutBehaviors } from '../../use-layout-behaviors';
2
5
 
3
- export const Switcher = ({
4
- gap,
5
- columnGap,
6
- rowGap,
7
- limit,
8
- revert,
9
- threshold,
10
- alignItems,
11
- stairs,
12
- stairsUp,
13
- containerType,
14
- responsiveContext,
15
- fluidReference, // @deprecated Kept for backward compatibility. Use responsiveContext on an ancestor instead.
16
- style,
17
- ...props
18
- }) => {
6
+ export const Switcher = React.forwardRef(function Switcher(
7
+ {
8
+ gap,
9
+ columnGap,
10
+ rowGap,
11
+ limit,
12
+ revert,
13
+ threshold,
14
+ alignItems,
15
+ stairs,
16
+ stairsUp,
17
+ containerType,
18
+ responsiveContext,
19
+ fluidReference, // @deprecated Kept for backward compatibility. Use responsiveContext on an ancestor instead.
20
+ style,
21
+ ...props
22
+ },
23
+ forwardedRef,
24
+ ) {
25
+ const layoutRef = useLayoutBehaviors({ stairs: '' !== (stairs ?? '') }, forwardedRef);
19
26
  style = {
20
27
  ...style,
21
28
  '--unitone--threshold': '' !== threshold ? threshold : undefined,
@@ -40,8 +47,10 @@ export const Switcher = ({
40
47
  .join(' ')}
41
48
  style={style}
42
49
  {...props}
50
+ ref={layoutRef}
51
+ data-unitone-react-layout=""
43
52
  >
44
53
  {props.children}
45
54
  </div>
46
55
  );
47
- };
56
+ });
@@ -1,8 +1,10 @@
1
+ import { resetLayoutBehavior } from '../../layout-behavior-state';
1
2
  import { verticalsResizeObserver } from '../../library';
2
3
  import { registerLayoutInitializer } from '../../register-layout-initializer';
3
4
 
4
5
  registerLayoutInitializer({
5
6
  key: 'layout-primitives/vertical-writing',
6
- selector: '[data-unitone-layout~="vertical-writing"]',
7
+ selector: '[data-unitone-layout~="vertical-writing"]:not([data-unitone-react-layout])',
8
+ reset: (target) => resetLayoutBehavior(target, 'vertical'),
7
9
  initialize: verticalsResizeObserver,
8
10
  });
@@ -1,15 +1,13 @@
1
+ 'use client';
2
+
1
3
  import React from 'react';
4
+ import { useLayoutBehaviors } from '../../use-layout-behaviors';
2
5
 
3
- export const VerticalWriting = ({
4
- textOrientation,
5
- gap,
6
- maxHeight,
7
- switchWritingMode,
8
- threshold,
9
- queryContext,
10
- style,
11
- ...props
12
- }) => {
6
+ export const VerticalWriting = React.forwardRef(function VerticalWriting(
7
+ { textOrientation, gap, maxHeight, switchWritingMode, threshold, queryContext, style, ...props },
8
+ forwardedRef,
9
+ ) {
10
+ const layoutRef = useLayoutBehaviors({ vertical: true }, forwardedRef);
13
11
  style = {
14
12
  ...style,
15
13
  '--unitone--max-height': '' !== maxHeight ? maxHeight : undefined,
@@ -30,9 +28,11 @@ export const VerticalWriting = ({
30
28
  .join(' ')}
31
29
  style={style}
32
30
  {...props}
31
+ ref={layoutRef}
32
+ data-unitone-react-layout=""
33
33
  >
34
34
  {props.children}
35
35
  </div>
36
36
  </div>
37
37
  );
38
- };
38
+ });
@@ -1,22 +1,29 @@
1
+ 'use client';
2
+
1
3
  import React from 'react';
4
+ import { useLayoutBehaviors } from '../../use-layout-behaviors';
2
5
 
3
- export const WithSidebar = ({
4
- gap,
5
- columnGap,
6
- rowGap,
7
- contentMinWidth,
8
- revert,
9
- sidebar,
10
- sidebarWidth,
11
- alignItems,
12
- overflow,
13
- divider,
14
- dividerWidth,
15
- dividerStyle,
16
- dividerColor,
17
- style,
18
- ...props
19
- }) => {
6
+ export const WithSidebar = React.forwardRef(function WithSidebar(
7
+ {
8
+ gap,
9
+ columnGap,
10
+ rowGap,
11
+ contentMinWidth,
12
+ revert,
13
+ sidebar,
14
+ sidebarWidth,
15
+ alignItems,
16
+ overflow,
17
+ divider,
18
+ dividerWidth,
19
+ dividerStyle,
20
+ dividerColor,
21
+ style,
22
+ ...props
23
+ },
24
+ forwardedRef,
25
+ ) {
26
+ const layoutRef = useLayoutBehaviors({ divider: '' !== (divider ?? '') }, forwardedRef);
20
27
  style = {
21
28
  ...style,
22
29
  '--unitone--sidebar-width': '' !== sidebarWidth ? sidebarWidth : undefined,
@@ -43,8 +50,10 @@ export const WithSidebar = ({
43
50
  .join(' ')}
44
51
  style={style}
45
52
  {...props}
53
+ ref={layoutRef}
54
+ data-unitone-react-layout=""
46
55
  >
47
56
  {props.children}
48
57
  </div>
49
58
  );
50
- };
59
+ });