@pantheon-systems/pds-toolkit-react 2.0.0-alpha.92 → 2.0.0-beta.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,5 +1,5 @@
1
1
  import { ComponentPropsWithoutRef, ReactNode } from 'react';
2
- import { GapScale } from '../../libs/types/layout-types';
2
+ import { ContainerStackBreakpoint, GapScale } from '../../libs/types/layout-types';
3
3
  import './flex-container.css';
4
4
  type FlexAlignContent = 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'stretch';
5
5
  type FlexAlignItems = 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'baseline';
@@ -15,6 +15,23 @@ interface FlexContainerProps extends ComponentPropsWithoutRef<'div'> {
15
15
  * Aligns items on the cross axis.
16
16
  */
17
17
  alignItems?: FlexAlignItems;
18
+ /**
19
+ * Make this element an inline-size query container (named
20
+ * `pds-flex-container`, same as `stackBelow`) without any built-in
21
+ * stacking rule, so you can author your own `@container` rule at
22
+ * whatever threshold or descendant selectors suit the content — for a
23
+ * threshold `stackBelow`'s curated scale doesn't cover, or for a
24
+ * composition where a shared measurement needs to restyle more than one
25
+ * descendant at once (see the `FlexContainer.mdx` "Custom thresholds"
26
+ * example). Implied by `stackBelow`; only set this directly when you
27
+ * don't also want `stackBelow`'s built-in behavior.
28
+ *
29
+ * A query container can't target itself with its own `@container` rule —
30
+ * your rule must target a descendant (a child element, or a nested
31
+ * `FlexContainer`), never this same `FlexContainer` instance, or it will
32
+ * silently have no effect.
33
+ */
34
+ asContainer?: boolean;
18
35
  /**
19
36
  * Container content.
20
37
  */
@@ -23,6 +40,48 @@ interface FlexContainerProps extends ComponentPropsWithoutRef<'div'> {
23
40
  * Additional class names
24
41
  */
25
42
  className?: string;
43
+ /**
44
+ * Align content once the container's own width drops below `stackBelow`. If
45
+ * not set, defaults to the same value as `alignContent`. No effect unless
46
+ * `stackBelow` is set.
47
+ */
48
+ containerAlignContent?: FlexAlignContent;
49
+ /**
50
+ * Align items once the container's own width drops below `stackBelow`. If
51
+ * not set, defaults to the same value as `alignItems`. No effect unless
52
+ * `stackBelow` is set.
53
+ */
54
+ containerAlignItems?: FlexAlignItems;
55
+ /**
56
+ * Flex direction once the container's own width drops below `stackBelow`.
57
+ * If not set, defaults to the same value as `flexDirection`. No effect
58
+ * unless `stackBelow` is set.
59
+ */
60
+ containerFlexDirection?: FlexDirection;
61
+ /**
62
+ * Flex wrap once the container's own width drops below `stackBelow`. If not
63
+ * set, defaults to the same value as `flexWrap`. No effect unless
64
+ * `stackBelow` is set.
65
+ */
66
+ containerFlexWrap?: FlexWrap;
67
+ /**
68
+ * Gap once the container's own width drops below `stackBelow`. If not set,
69
+ * defaults to the same value as `gap`. No effect unless `stackBelow` is set.
70
+ */
71
+ containerGap?: GapScale;
72
+ /**
73
+ * Justify content once the container's own width drops below `stackBelow`.
74
+ * If not set, defaults to the same value as `justifyContent`. No effect
75
+ * unless `stackBelow` is set.
76
+ */
77
+ containerJustifyContent?: FlexJustifyContent;
78
+ /**
79
+ * When both the viewport mobile breakpoint and `stackBelow` are active at
80
+ * once, which set of values wins: the component's own width (`'container'`,
81
+ * the default) or the viewport (`'mobile'`). No effect unless `stackBelow`
82
+ * is set.
83
+ */
84
+ containerQueryPriority?: 'container' | 'mobile';
26
85
  /**
27
86
  * Establishes the main-axis, thus defining the direction flex items are placed in the flex container.
28
87
  */
@@ -64,9 +123,17 @@ interface FlexContainerProps extends ComponentPropsWithoutRef<'div'> {
64
123
  * Justify content for mobile. If not set, will default to the same value as `justifyContent`.
65
124
  */
66
125
  mobileJustifyContent?: FlexJustifyContent;
126
+ /**
127
+ * Collapse to the `container*` prop values once the container's own
128
+ * width — not the viewport's — drops below this threshold. A curated
129
+ * scale (`s` 30rem, `m` 48rem, `l` 60rem, `xl` 75rem), shared with `Grid`'s
130
+ * `stackBelow`, since container query thresholds can't reference design
131
+ * tokens. Implies `container-type: inline-size` on this element.
132
+ */
133
+ stackBelow?: ContainerStackBreakpoint;
67
134
  }
68
135
  /**
69
136
  * Flex Container UI component
70
137
  */
71
- export declare const FlexContainer: ({ alignContent, alignItems, children, className, flexDirection, flexWrap, gap, justifyContent, mobileAlignContent, mobileAlignItems, mobileFlexDirection, mobileFlexWrap, mobileGap, mobileJustifyContent, style, ...props }: FlexContainerProps) => import("react/jsx-runtime").JSX.Element;
138
+ export declare const FlexContainer: ({ alignContent, alignItems, asContainer, children, className, containerAlignContent, containerAlignItems, containerFlexDirection, containerFlexWrap, containerGap, containerJustifyContent, containerQueryPriority, flexDirection, flexWrap, gap, justifyContent, mobileAlignContent, mobileAlignItems, mobileFlexDirection, mobileFlexWrap, mobileGap, mobileJustifyContent, stackBelow, style, ...props }: FlexContainerProps) => import("react/jsx-runtime").JSX.Element;
72
139
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pantheon-systems/pds-toolkit-react",
3
3
  "technology": "React",
4
- "version": "2.0.0-alpha.92",
4
+ "version": "2.0.0-beta.0",
5
5
  "description": "PDS toolkit built using the React framework",
6
6
  "publishConfig": {
7
7
  "access": "public",
@@ -185,7 +185,7 @@
185
185
  "@floating-ui/react": "^0.24.3",
186
186
  "@floating-ui/react-dom": "~1.3.0",
187
187
  "@internationalized/date": "^3.12.2",
188
- "@pantheon-systems/pds-design-tokens": "^2.0.0-alpha.70",
188
+ "@pantheon-systems/pds-design-tokens": "^2.0.0-beta.0",
189
189
  "@reactuses/core": "^5.0.15",
190
190
  "date-fns": "^4.1.0",
191
191
  "downshift": "^9.3.2",