@primer/react 36.14.0 → 36.15.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.
Files changed (77) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/browser.esm.js +1 -1
  3. package/dist/browser.esm.js.map +1 -1
  4. package/dist/browser.umd.js +1 -1
  5. package/dist/browser.umd.js.map +1 -1
  6. package/generated/components.json +71 -15
  7. package/lib/ActionList/Item.d.ts.map +1 -1
  8. package/lib/ActionList/Item.js +2 -1
  9. package/lib/FeatureFlags/DefaultFeatureFlags.d.ts +3 -0
  10. package/lib/FeatureFlags/DefaultFeatureFlags.d.ts.map +1 -0
  11. package/lib/FeatureFlags/DefaultFeatureFlags.js +7 -0
  12. package/lib/FeatureFlags/FeatureFlagContext.d.ts +4 -0
  13. package/lib/FeatureFlags/FeatureFlagContext.d.ts.map +1 -0
  14. package/lib/FeatureFlags/FeatureFlagContext.js +8 -0
  15. package/lib/FeatureFlags/FeatureFlagScope.d.ts +22 -0
  16. package/lib/FeatureFlags/FeatureFlagScope.d.ts.map +1 -0
  17. package/lib/FeatureFlags/FeatureFlagScope.js +44 -0
  18. package/lib/FeatureFlags/FeatureFlags.d.ts +7 -0
  19. package/lib/FeatureFlags/FeatureFlags.d.ts.map +1 -0
  20. package/lib/FeatureFlags/FeatureFlags.js +26 -0
  21. package/lib/FeatureFlags/index.d.ts +4 -0
  22. package/lib/FeatureFlags/index.d.ts.map +1 -0
  23. package/lib/FeatureFlags/useFeatureFlag.d.ts +5 -0
  24. package/lib/FeatureFlags/useFeatureFlag.d.ts.map +1 -0
  25. package/lib/Stack/Stack.d.ts +65 -0
  26. package/lib/Stack/Stack.d.ts.map +1 -0
  27. package/lib/Stack/Stack.js +52 -0
  28. package/lib/Stack/index.d.ts +6 -0
  29. package/lib/Stack/index.d.ts.map +1 -0
  30. package/lib/Stack/index.js +9 -0
  31. package/lib/drafts/ActionBar/ActionBar.d.ts +8 -2
  32. package/lib/drafts/ActionBar/ActionBar.d.ts.map +1 -1
  33. package/lib/drafts/ActionBar/ActionBar.js +1 -0
  34. package/lib/drafts/ActionBar/index.js +6 -4
  35. package/lib/drafts/TabPanels/TabPanels.js +2 -2
  36. package/lib/drafts/index.d.ts +3 -0
  37. package/lib/drafts/index.d.ts.map +1 -1
  38. package/lib/drafts/index.js +4 -1
  39. package/lib/experimental/index.d.ts +2 -0
  40. package/lib/experimental/index.d.ts.map +1 -1
  41. package/lib/experimental/index.js +8 -1
  42. package/lib/internal/utils/__tests__/getResponsiveAttributes.test.d.ts +2 -0
  43. package/lib/internal/utils/__tests__/getResponsiveAttributes.test.d.ts.map +1 -0
  44. package/lib/internal/utils/getResponsiveAttributes.d.ts +19 -0
  45. package/lib/internal/utils/getResponsiveAttributes.d.ts.map +1 -0
  46. package/lib/internal/utils/getResponsiveAttributes.js +40 -0
  47. package/lib/internal/utils/getResponsiveControlValues.d.ts +8 -0
  48. package/lib/internal/utils/getResponsiveControlValues.d.ts.map +1 -0
  49. package/lib-esm/ActionList/Item.js +2 -1
  50. package/lib-esm/FeatureFlags/DefaultFeatureFlags.d.ts +3 -0
  51. package/lib-esm/FeatureFlags/DefaultFeatureFlags.js +5 -0
  52. package/lib-esm/FeatureFlags/FeatureFlagContext.d.ts +4 -0
  53. package/lib-esm/FeatureFlags/FeatureFlagContext.js +6 -0
  54. package/lib-esm/FeatureFlags/FeatureFlagScope.d.ts +22 -0
  55. package/lib-esm/FeatureFlags/FeatureFlagScope.js +42 -0
  56. package/lib-esm/FeatureFlags/FeatureFlags.d.ts +7 -0
  57. package/lib-esm/FeatureFlags/FeatureFlags.js +20 -0
  58. package/lib-esm/FeatureFlags/index.d.ts +4 -0
  59. package/lib-esm/FeatureFlags/useFeatureFlag.d.ts +5 -0
  60. package/lib-esm/Stack/Stack.d.ts +65 -0
  61. package/lib-esm/Stack/Stack.js +44 -0
  62. package/lib-esm/Stack/index.d.ts +6 -0
  63. package/lib-esm/Stack/index.js +7 -0
  64. package/lib-esm/drafts/ActionBar/ActionBar.d.ts +8 -2
  65. package/lib-esm/drafts/ActionBar/ActionBar.js +1 -0
  66. package/lib-esm/drafts/ActionBar/index.js +4 -2
  67. package/lib-esm/drafts/index.d.ts +3 -0
  68. package/lib-esm/drafts/index.js +2 -1
  69. package/lib-esm/experimental/index.d.ts +2 -0
  70. package/lib-esm/experimental/index.js +5 -1
  71. package/lib-esm/internal/utils/__tests__/getResponsiveAttributes.test.d.ts +2 -0
  72. package/lib-esm/internal/utils/getResponsiveAttributes.d.ts +19 -0
  73. package/lib-esm/internal/utils/getResponsiveAttributes.js +38 -0
  74. package/lib-esm/internal/utils/getResponsiveControlValues.d.ts +8 -0
  75. package/package.json +1 -1
  76. /package/lib/{packages/react/node_modules → node_modules}/@github/tab-container-element/dist/tab-container-element-define.js +0 -0
  77. /package/lib/{packages/react/node_modules → node_modules}/@github/tab-container-element/dist/tab-container-element.js +0 -0
@@ -19,7 +19,8 @@ var NavList = require('../NavList/NavList.js');
19
19
  var SelectPanel = require('./SelectPanel2/SelectPanel.js');
20
20
  var TabPanels = require('./TabPanels/TabPanels.js');
21
21
  var Tooltip = require('../TooltipV2/Tooltip.js');
22
- require('./ActionBar/index.js');
22
+ var index$2 = require('./ActionBar/index.js');
23
+ var index$3 = require('../Stack/index.js');
23
24
  var DataTable = require('../DataTable/DataTable.js');
24
25
  var column = require('../DataTable/column.js');
25
26
 
@@ -45,5 +46,7 @@ exports.SelectPanel = SelectPanel.SelectPanel;
45
46
  exports.TabPanels = TabPanels;
46
47
  exports.Tooltip = Tooltip.Tooltip;
47
48
  exports.TooltipContext = Tooltip.TooltipContext;
49
+ exports.ActionBar = index$2;
50
+ exports.Stack = index$3.Stack;
48
51
  exports.DataTable = DataTable.DataTable;
49
52
  exports.createColumnHelper = column.createColumnHelper;
@@ -1,2 +1,4 @@
1
1
  export * from '../drafts';
2
+ export { FeatureFlags } from '../FeatureFlags';
3
+ export type { FeatureFlagsProps } from '../FeatureFlags';
2
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/experimental/index.ts"],"names":[],"mappings":"AAEA,cAAc,WAAW,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/experimental/index.ts"],"names":[],"mappings":"AAEA,cAAc,WAAW,CAAA;AACzB,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAA;AAC5C,YAAY,EAAC,iBAAiB,EAAC,MAAM,iBAAiB,CAAA"}
@@ -19,7 +19,11 @@ var NavList = require('../NavList/NavList.js');
19
19
  var SelectPanel = require('../drafts/SelectPanel2/SelectPanel.js');
20
20
  var TabPanels = require('../drafts/TabPanels/TabPanels.js');
21
21
  var Tooltip = require('../TooltipV2/Tooltip.js');
22
- require('../drafts/ActionBar/index.js');
22
+ var index$2 = require('../drafts/ActionBar/index.js');
23
+ var index$3 = require('../Stack/index.js');
24
+ var FeatureFlags = require('../FeatureFlags/FeatureFlags.js');
25
+ require('react');
26
+ require('../FeatureFlags/DefaultFeatureFlags.js');
23
27
  var DataTable = require('../DataTable/DataTable.js');
24
28
  var column = require('../DataTable/column.js');
25
29
 
@@ -45,5 +49,8 @@ exports.SelectPanel = SelectPanel.SelectPanel;
45
49
  exports.TabPanels = TabPanels;
46
50
  exports.Tooltip = Tooltip.Tooltip;
47
51
  exports.TooltipContext = Tooltip.TooltipContext;
52
+ exports.ActionBar = index$2;
53
+ exports.Stack = index$3.Stack;
54
+ exports.FeatureFlags = FeatureFlags.FeatureFlags;
48
55
  exports.DataTable = DataTable.DataTable;
49
56
  exports.createColumnHelper = column.createColumnHelper;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=getResponsiveAttributes.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getResponsiveAttributes.test.d.ts","sourceRoot":"","sources":["../../../../src/internal/utils/__tests__/getResponsiveAttributes.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,19 @@
1
+ import type { ResponsiveValue } from '../../hooks/useResponsiveValue';
2
+ /**
3
+ * Transform the given property and values in to corresponding data attributes
4
+ * to be placed on a container. This function is helpful for coordinating
5
+ * between responsive prop values and the corresponding styles in CSS.
6
+ *
7
+ * @param property - The name that will be given to the data attribute. For
8
+ * example, a property of "gap" will be transformed to `data-gap`.
9
+ *
10
+ * If responsive values are used, then the breakpoint name will be appended to
11
+ * the data attribute name. For example, `data-gap-narrow`.
12
+ *
13
+ * @param values - The value, or responsive values, that will be set as the
14
+ * value of the data property set by `property`. These values should typically
15
+ * be a `string` or `boolean`. For boolean values, the data attribute will be
16
+ * set when the value is `true` and will not be set when the value is `false`.
17
+ */
18
+ export declare function getResponsiveAttributes<T>(property: string, values?: T | ResponsiveValue<T>): Record<string, T extends boolean ? '' : T> | undefined;
19
+ //# sourceMappingURL=getResponsiveAttributes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getResponsiveAttributes.d.ts","sourceRoot":"","sources":["../../../src/internal/utils/getResponsiveAttributes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAA;AAEnE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,EACvC,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,GAC9B,MAAM,CAAC,MAAM,EAAE,CAAC,SAAS,OAAO,GAAG,EAAE,GAAG,CAAC,CAAC,GAAG,SAAS,CAcxD"}
@@ -0,0 +1,40 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Transform the given property and values in to corresponding data attributes
5
+ * to be placed on a container. This function is helpful for coordinating
6
+ * between responsive prop values and the corresponding styles in CSS.
7
+ *
8
+ * @param property - The name that will be given to the data attribute. For
9
+ * example, a property of "gap" will be transformed to `data-gap`.
10
+ *
11
+ * If responsive values are used, then the breakpoint name will be appended to
12
+ * the data attribute name. For example, `data-gap-narrow`.
13
+ *
14
+ * @param values - The value, or responsive values, that will be set as the
15
+ * value of the data property set by `property`. These values should typically
16
+ * be a `string` or `boolean`. For boolean values, the data attribute will be
17
+ * set when the value is `true` and will not be set when the value is `false`.
18
+ */
19
+ function getResponsiveAttributes(property, values) {
20
+ if (values === undefined || values === null) {
21
+ return;
22
+ }
23
+ if (typeof values == 'object') {
24
+ return Object.fromEntries(Object.entries(values).map(([key, value]) => {
25
+ return serialize(`data-${property}-${key}`, value);
26
+ }));
27
+ }
28
+ return Object.fromEntries([serialize(`data-${property}`, values)]);
29
+ }
30
+ function serialize(property, value) {
31
+ if (typeof value === 'boolean') {
32
+ if (value) {
33
+ return [property, ''];
34
+ }
35
+ return [];
36
+ }
37
+ return [property, value];
38
+ }
39
+
40
+ exports.getResponsiveAttributes = getResponsiveAttributes;
@@ -0,0 +1,8 @@
1
+ import type { ResponsiveValue } from '../../hooks/useResponsiveValue';
2
+ /**
3
+ * Helper utility to get the value for a prop based on control args. This is
4
+ * helpful when an arg can have both responsive values and a plain value. In
5
+ * cases where both are defined, responsive values will take preference
6
+ */
7
+ export declare function getResponsiveControlValues<T>(value: T, responsiveValue: ResponsiveValue<T>): T | ResponsiveValue<T>;
8
+ //# sourceMappingURL=getResponsiveControlValues.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getResponsiveControlValues.d.ts","sourceRoot":"","sources":["../../../src/internal/utils/getResponsiveControlValues.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAA;AAInE;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,eAAe,EAAE,eAAe,CAAC,CAAC,CAAC,0BAQ1F"}
@@ -295,7 +295,8 @@ const Item = /*#__PURE__*/React.forwardRef(({
295
295
  sx: {
296
296
  flexGrow: slots.inlineDescription ? 0 : 1,
297
297
  fontWeight: slots.inlineDescription || slots.blockDescription || active ? 'bold' : 'normal',
298
- marginBlockEnd: slots.blockDescription ? '4px' : undefined
298
+ marginBlockEnd: slots.blockDescription ? '4px' : undefined,
299
+ wordBreak: 'break-word'
299
300
  }
300
301
  }, childrenWithoutSlots), slots.inlineDescription),
301
302
  // If we're showing an inactive indicator and a leading visual has NOT been passed,
@@ -0,0 +1,3 @@
1
+ import { FeatureFlagScope } from './FeatureFlagScope';
2
+ export declare const DefaultFeatureFlags: FeatureFlagScope;
3
+ //# sourceMappingURL=DefaultFeatureFlags.d.ts.map
@@ -0,0 +1,5 @@
1
+ import { FeatureFlagScope } from './FeatureFlagScope.js';
2
+
3
+ const DefaultFeatureFlags = FeatureFlagScope.create();
4
+
5
+ export { DefaultFeatureFlags };
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import type { FeatureFlagScope } from './FeatureFlagScope';
3
+ export declare const FeatureFlagContext: import("react").Context<FeatureFlagScope>;
4
+ //# sourceMappingURL=FeatureFlagContext.d.ts.map
@@ -0,0 +1,6 @@
1
+ import { createContext } from 'react';
2
+ import { DefaultFeatureFlags } from './DefaultFeatureFlags.js';
3
+
4
+ const FeatureFlagContext = /*#__PURE__*/createContext(DefaultFeatureFlags);
5
+
6
+ export { FeatureFlagContext };
@@ -0,0 +1,22 @@
1
+ export type FeatureFlags = {
2
+ [key: string]: boolean;
3
+ };
4
+ export declare class FeatureFlagScope {
5
+ static create(flags?: FeatureFlags): FeatureFlagScope;
6
+ static merge(a: FeatureFlagScope, b: FeatureFlagScope): FeatureFlagScope;
7
+ flags: Map<string, boolean>;
8
+ constructor(flags?: FeatureFlags);
9
+ /**
10
+ * Enable a feature flag
11
+ */
12
+ enable(name: string): void;
13
+ /**
14
+ * Disable a feature flag
15
+ */
16
+ disable(name: string): void;
17
+ /**
18
+ * Check if a feature flag is enabled
19
+ */
20
+ enabled(name: string): boolean;
21
+ }
22
+ //# sourceMappingURL=FeatureFlagScope.d.ts.map
@@ -0,0 +1,42 @@
1
+ class FeatureFlagScope {
2
+ static create(flags) {
3
+ return new FeatureFlagScope(flags);
4
+ }
5
+ static merge(a, b) {
6
+ const merged = new FeatureFlagScope();
7
+ for (const [key, value] of a.flags) {
8
+ merged.flags.set(key, value);
9
+ }
10
+ for (const [key, value] of b.flags) {
11
+ merged.flags.set(key, value);
12
+ }
13
+ return merged;
14
+ }
15
+ constructor(flags = {}) {
16
+ this.flags = new Map(Object.entries(flags));
17
+ }
18
+
19
+ /**
20
+ * Enable a feature flag
21
+ */
22
+ enable(name) {
23
+ this.flags.set(name, true);
24
+ }
25
+
26
+ /**
27
+ * Disable a feature flag
28
+ */
29
+ disable(name) {
30
+ this.flags.set(name, false);
31
+ }
32
+
33
+ /**
34
+ * Check if a feature flag is enabled
35
+ */
36
+ enabled(name) {
37
+ var _this$flags$get;
38
+ return (_this$flags$get = this.flags.get(name)) !== null && _this$flags$get !== void 0 ? _this$flags$get : false;
39
+ }
40
+ }
41
+
42
+ export { FeatureFlagScope };
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { type FeatureFlags } from './FeatureFlagScope';
3
+ export type FeatureFlagsProps = React.PropsWithChildren<{
4
+ flags: FeatureFlags;
5
+ }>;
6
+ export declare function FeatureFlags({ children, flags }: FeatureFlagsProps): React.JSX.Element;
7
+ //# sourceMappingURL=FeatureFlags.d.ts.map
@@ -0,0 +1,20 @@
1
+ import React, { useMemo } from 'react';
2
+ import { FeatureFlagContext } from './FeatureFlagContext.js';
3
+ import { FeatureFlagScope } from './FeatureFlagScope.js';
4
+ import { DefaultFeatureFlags } from './DefaultFeatureFlags.js';
5
+
6
+ function FeatureFlags({
7
+ children,
8
+ flags
9
+ }) {
10
+ const value = useMemo(() => {
11
+ const scope = FeatureFlagScope.merge(DefaultFeatureFlags, FeatureFlagScope.create(flags));
12
+ return scope;
13
+ }, [flags]);
14
+ return /*#__PURE__*/React.createElement(FeatureFlagContext.Provider, {
15
+ value: value
16
+ }, children);
17
+ }
18
+ FeatureFlags.displayName = "FeatureFlags";
19
+
20
+ export { FeatureFlags };
@@ -0,0 +1,4 @@
1
+ export { FeatureFlags } from './FeatureFlags';
2
+ export type { FeatureFlagsProps } from './FeatureFlags';
3
+ export { useFeatureFlag } from './useFeatureFlag';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Check if the given feature flag is enabled
3
+ */
4
+ export declare function useFeatureFlag(flag: string): boolean;
5
+ //# sourceMappingURL=useFeatureFlag.d.ts.map
@@ -0,0 +1,65 @@
1
+ import React, { type ElementType } from 'react';
2
+ import type { ResponsiveValue } from '../hooks/useResponsiveValue';
3
+ type GapScale = 'none' | 'condensed' | 'normal' | 'spacious';
4
+ type Gap = GapScale | ResponsiveValue<GapScale>;
5
+ type DirectionScale = 'horizontal' | 'vertical';
6
+ type Direction = DirectionScale | ResponsiveValue<DirectionScale>;
7
+ type AlignScale = 'stretch' | 'start' | 'center' | 'end' | 'baseline';
8
+ type Align = AlignScale | ResponsiveValue<AlignScale>;
9
+ type WrapScale = 'wrap' | 'nowrap';
10
+ type Wrap = WrapScale | ResponsiveValue<WrapScale>;
11
+ type JustifyScale = 'start' | 'center' | 'end' | 'space-between' | 'space-evenly';
12
+ type Justify = JustifyScale | ResponsiveValue<JustifyScale>;
13
+ type PaddingScale = 'none' | 'condensed' | 'normal' | 'spacious';
14
+ type Padding = PaddingScale | ResponsiveValue<PaddingScale>;
15
+ type StackProps<As> = React.PropsWithChildren<{
16
+ /**
17
+ * Customize the element type of the rendered container
18
+ */
19
+ as?: As;
20
+ /**
21
+ * Specify the gap between children elements in the stack
22
+ */
23
+ gap?: Gap;
24
+ /**
25
+ * Specify the orientation for the stack container
26
+ * @default vertical
27
+ */
28
+ direction?: Direction;
29
+ /**
30
+ * Specify the alignment between items in the cross-axis of the orientation
31
+ * @default stretch
32
+ */
33
+ align?: Align;
34
+ /**
35
+ * Specify whether items are forced onto one line or can wrap onto multiple lines
36
+ * @default nowrap
37
+ */
38
+ wrap?: Wrap;
39
+ /**
40
+ * Specify how items will be distributed in the stacking direction
41
+ * @default start
42
+ */
43
+ justify?: Justify;
44
+ /**
45
+ * Specify the padding of the stack container
46
+ * @default none
47
+ */
48
+ padding?: Padding;
49
+ }>;
50
+ declare function Stack<As extends ElementType>({ as, children, align, direction, gap, justify, padding, wrap, ...rest }: StackProps<As> & React.ComponentPropsWithoutRef<ElementType extends As ? As : 'div'>): React.JSX.Element;
51
+ type StackItemProps<As> = React.PropsWithChildren<{
52
+ /**
53
+ * Customize the element type of the rendered container
54
+ */
55
+ as?: As;
56
+ /**
57
+ * Allow item to keep size or expand to fill the available space
58
+ * @default false
59
+ */
60
+ grow?: boolean | ResponsiveValue<boolean>;
61
+ }>;
62
+ declare function StackItem<As extends ElementType>({ as, children, grow, ...rest }: StackItemProps<As> & React.ComponentPropsWithoutRef<ElementType extends As ? As : 'div'>): React.JSX.Element;
63
+ export { Stack, StackItem };
64
+ export type { StackProps, StackItemProps };
65
+ //# sourceMappingURL=Stack.d.ts.map
@@ -0,0 +1,44 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ import { getResponsiveAttributes } from '../internal/utils/getResponsiveAttributes.js';
4
+
5
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
6
+ const StyledStack = styled.div.withConfig({
7
+ displayName: "Stack__StyledStack",
8
+ componentId: "sc-x3xa2i-0"
9
+ })(["--Stack-gap-whenRegular:var(--stack-gap-normal,16px);--Stack-gap-whenNarrow:var(--stack-gap-normal,16px);--Stack-gap-whenWide:var(--Stack-gap-whenRegular);display:flex;flex-flow:column;align-items:stretch;align-content:flex-start;gap:var(--Stack-gap-whenNarrow);&[data-padding='none'],&[data-padding-narrow='none']{padding:0;}&[data-padding='condensed'],&[data-padding-narrow='condensed']{padding:var(--stack-padding-condensed,8px);}&[data-padding='normal'],&[data-padding-narrow='normal']{padding:var(--stack-padding-normal,16px);}&[data-padding='spacious'],&[data-padding-narrow='spacious']{padding:var(--stack-padding-spacious,24px);}&[data-orientation='horizontal'],&[data-orientation-narrow='horizontal']{flex-flow:row;}&[data-orientation='vertical'],&[data-orientation-narrow='vertical']{flex-flow:column;}&[data-gap='none'],&[data-gap-narrow='none']{--Stack-gap-whenNarrow:0;}&[data-gap='condensed'],&[data-gap-narrow='condensed']{--Stack-gap-whenNarrow:var(--stack-gap-condensed,8px);}&[data-gap='normal'],&[data-gap-narrow='normal']{--Stack-gap-whenNarrow:var(--stack-gap-normal,16px);}&[data-align='start'],&[data-align-narrow='start']{align-items:flex-start;}&[data-align='center'],&[data-align-narrow='center']{align-items:center;}&[data-align='end'],&[data-align-narrow='end']{align-items:flex-end;}&[data-align='baseline'],&[data-align-narrow='baseline']{align-items:baseline;}&[data-spread='start'],&[data-spread-narrow='start']{justify-content:flex-start;}&[data-spread='center'],&[data-spread-narrow='center']{justify-content:center;}&[data-spread='end'],&[data-spread-narrow='end']{justify-content:flex-end;}&[data-spread='space-between'],&[data-spread-narrow='space-between']{justify-content:space-between;}&[data-spread='space-evenly'],&[data-spread-narrow='space-evenly']{justify-content:space-evenly;}&[data-wrap='wrap'],&[data-wrap-narrow='wrap']{flex-wrap:wrap;}&[data-wrap='nowrap'],&[data-wrap-narrow='nowrap']{flex-wrap:nowrap;}@media (min-width:48rem){&[data-padding-regular='none']{padding:0;}&[data-padding-regular='condensed']{padding:var(--stack-padding-condensed,8px);}&[data-padding-regular='normal']{padding:var(--stack-padding-normal,16px);}&[data-padding-regular='spacious']{padding:var(--stack-padding-spacious,24px);}&[data-orientation-regular='horizontal']{flex-flow:row;}&[data-orientation-regular='vertical']{flex-flow:column;}&[data-gap-regular='none']{--Stack-gap-whenRegular:0;}&[data-gap-regular='condensed']{--Stack-gap-whenRegular:var(--stack-gap-condensed,8px);}&[data-gap-regular='normal']{--Stack-gap-whenRegular:var(--stack-gap-normal,16px);}&[data-gap-regular='spacious']{--Stack-gap-whenRegular:var(--stack-gap-spacious,24px);}&[data-align-regular='start']{align-items:flex-start;}&[data-align-regular='center']{align-items:center;}&[data-align-regular='end']{align-items:flex-end;}&[data-align-regular='baseline']{align-items:baseline;}&[data-spread-regular='start']{justify-content:flex-start;}&[data-spread-regular='center']{justify-content:center;}&[data-spread-regular='end']{justify-content:flex-end;}&[data-spread-regular='space-between']{justify-content:space-between;}&[data-spread-regular='space-evenly']{justify-content:space-evenly;}&[data-wrap-regular='wrap']{flex-wrap:wrap;}&[data-wrap-regular='nowrap']{flex-wrap:nowrap;}}@media (min-width:87.5rem){gap:var(--Stack-gap-whenWide);&[data-padding-wide='none']{padding:0;}&[data-padding-wide='condensed']{padding:var(--stack-padding-condensed,8px);}&[data-padding-wide='normal']{padding:var(--stack-padding-normal,16px);}&[data-padding-wide='spacious']{padding:var(--stack-padding-spacious,24px);}&[data-orientation-wide='horizontal']{flex-flow:row;}&[data-orientation-wide='vertical']{flex-flow:column;}&[data-gap-wide='none']{--Stack-gap-whenWide:0;}&[data-gap-wide='condensed']{--Stack-gap-whenWide:var(--stack-gap-condensed,8px);}&[data-gap-wide='normal']{--Stack-gap-whenWide:var(--stack-gap-normal,16px);}&[data-gap-wide='spacious']{--Stack-gap-whenWide:var(--stack-gap-spacious,24px);}&[data-align-wide='start']{align-items:flex-start;}&[data-align-wide='center']{align-items:center;}&[data-align-wide='end']{align-items:flex-end;}&[data-align-wide='baseline']{align-items:baseline;}&[data-spread-wide='start']{justify-content:flex-start;}&[data-spread-wide='center']{justify-content:center;}&[data-spread-wide='end']{justify-content:flex-end;}&[data-spread-wide='space-between']{justify-content:space-between;}&[data-spread-wide='space-evenly']{justify-content:space-evenly;}}"]);
10
+ function Stack({
11
+ as,
12
+ children,
13
+ align = 'stretch',
14
+ direction = 'vertical',
15
+ gap,
16
+ justify = 'start',
17
+ padding = 'none',
18
+ wrap = 'nowrap',
19
+ ...rest
20
+ }) {
21
+ const BaseComponent = as !== null && as !== void 0 ? as : 'div';
22
+ return /*#__PURE__*/React.createElement(StyledStack, _extends({}, rest, {
23
+ as: BaseComponent
24
+ }, getResponsiveAttributes('gap', gap), getResponsiveAttributes('direction', direction), getResponsiveAttributes('align', align), getResponsiveAttributes('wrap', wrap), getResponsiveAttributes('justify', justify), getResponsiveAttributes('padding', padding)), children);
25
+ }
26
+ Stack.displayName = "Stack";
27
+ const StyledStackItem = styled.div.withConfig({
28
+ displayName: "Stack__StyledStackItem",
29
+ componentId: "sc-x3xa2i-1"
30
+ })(["flex:0 1 auto;min-inline-size:0;&[data-grow],&[data-grow-narrow]{flex-grow:1;}@media (min-width:48rem){&[data-grow-regular]{flex-grow:1;}}@media (min-width:87.5rem){&[data-grow-wide]{flex-grow:1;}}"]);
31
+ function StackItem({
32
+ as,
33
+ children,
34
+ grow = false,
35
+ ...rest
36
+ }) {
37
+ const BaseComponent = as !== null && as !== void 0 ? as : 'div';
38
+ return /*#__PURE__*/React.createElement(StyledStackItem, _extends({}, rest, {
39
+ as: BaseComponent
40
+ }, getResponsiveAttributes('grow', grow)), children);
41
+ }
42
+ StackItem.displayName = "StackItem";
43
+
44
+ export { Stack, StackItem };
@@ -0,0 +1,6 @@
1
+ import { Stack as StackImpl, StackItem } from './Stack';
2
+ export declare const Stack: typeof StackImpl & {
3
+ Item: typeof StackItem;
4
+ };
5
+ export type { StackProps, StackItemProps } from './Stack';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,7 @@
1
+ import { Stack as Stack$1, StackItem } from './Stack.js';
2
+
3
+ const Stack = Object.assign(Stack$1, {
4
+ Item: StackItem
5
+ });
6
+
7
+ export { Stack };
@@ -1,11 +1,17 @@
1
1
  import React from 'react';
2
2
  import type { IconButtonProps } from '../../Button';
3
3
  type Size = 'small' | 'medium' | 'large';
4
+ type A11yProps = {
5
+ 'aria-label': React.AriaAttributes['aria-label'];
6
+ 'aria-labelledby'?: undefined;
7
+ } | {
8
+ 'aria-label'?: undefined;
9
+ 'aria-labelledby': React.AriaAttributes['aria-labelledby'];
10
+ };
4
11
  export type ActionBarProps = {
5
12
  size?: Size;
6
- 'aria-label'?: React.AriaAttributes['aria-label'];
7
13
  children: React.ReactNode;
8
- };
14
+ } & A11yProps;
9
15
  export type ActionBarIconButtonProps = IconButtonProps;
10
16
  export declare const ActionBar: React.FC<React.PropsWithChildren<ActionBarProps>>;
11
17
  export declare const ActionBarIconButton: React.ForwardRefExoticComponent<IconButtonProps & React.RefAttributes<unknown>>;
@@ -35,6 +35,7 @@ const NavigationList = styled.div.withConfig({
35
35
  const GAP = 8;
36
36
  const listStyles = {
37
37
  display: 'flex',
38
+ minWidth: 0,
38
39
  listStyle: 'none',
39
40
  whiteSpace: 'nowrap',
40
41
  paddingY: 0,
@@ -1,6 +1,8 @@
1
- import { ActionBar, ActionBarIconButton, VerticalDivider } from './ActionBar.js';
1
+ import { ActionBar as ActionBar$1, ActionBarIconButton, VerticalDivider } from './ActionBar.js';
2
2
 
3
- Object.assign(ActionBar, {
3
+ const ActionBar = Object.assign(ActionBar$1, {
4
4
  IconButton: ActionBarIconButton,
5
5
  Divider: VerticalDivider
6
6
  });
7
+
8
+ export { ActionBar as default };
@@ -25,5 +25,8 @@ export * from './SelectPanel2';
25
25
  export { default as TabPanels } from './TabPanels';
26
26
  export type { TabPanelsProps, TabPanelsTabProps, TabPanelsPanelProps } from './TabPanels';
27
27
  export * from '../TooltipV2';
28
+ export { default as ActionBar } from './ActionBar';
28
29
  export * from './ActionBar';
30
+ export { Stack } from '../Stack';
31
+ export type { StackProps, StackItemProps } from '../Stack';
29
32
  //# sourceMappingURL=index.d.ts.map
@@ -17,6 +17,7 @@ export { NavList } from '../NavList/NavList.js';
17
17
  export { SelectPanel } from './SelectPanel2/SelectPanel.js';
18
18
  export { default as TabPanels } from './TabPanels/TabPanels.js';
19
19
  export { Tooltip, TooltipContext } from '../TooltipV2/Tooltip.js';
20
- import './ActionBar/index.js';
20
+ export { default as ActionBar } from './ActionBar/index.js';
21
+ export { Stack } from '../Stack/index.js';
21
22
  export { DataTable } from '../DataTable/DataTable.js';
22
23
  export { createColumnHelper } from '../DataTable/column.js';
@@ -1,2 +1,4 @@
1
1
  export * from '../drafts';
2
+ export { FeatureFlags } from '../FeatureFlags';
3
+ export type { FeatureFlagsProps } from '../FeatureFlags';
2
4
  //# sourceMappingURL=index.d.ts.map
@@ -17,6 +17,10 @@ export { NavList } from '../NavList/NavList.js';
17
17
  export { SelectPanel } from '../drafts/SelectPanel2/SelectPanel.js';
18
18
  export { default as TabPanels } from '../drafts/TabPanels/TabPanels.js';
19
19
  export { Tooltip, TooltipContext } from '../TooltipV2/Tooltip.js';
20
- import '../drafts/ActionBar/index.js';
20
+ export { default as ActionBar } from '../drafts/ActionBar/index.js';
21
+ export { Stack } from '../Stack/index.js';
22
+ export { FeatureFlags } from '../FeatureFlags/FeatureFlags.js';
23
+ import 'react';
24
+ import '../FeatureFlags/DefaultFeatureFlags.js';
21
25
  export { DataTable } from '../DataTable/DataTable.js';
22
26
  export { createColumnHelper } from '../DataTable/column.js';
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=getResponsiveAttributes.test.d.ts.map
@@ -0,0 +1,19 @@
1
+ import type { ResponsiveValue } from '../../hooks/useResponsiveValue';
2
+ /**
3
+ * Transform the given property and values in to corresponding data attributes
4
+ * to be placed on a container. This function is helpful for coordinating
5
+ * between responsive prop values and the corresponding styles in CSS.
6
+ *
7
+ * @param property - The name that will be given to the data attribute. For
8
+ * example, a property of "gap" will be transformed to `data-gap`.
9
+ *
10
+ * If responsive values are used, then the breakpoint name will be appended to
11
+ * the data attribute name. For example, `data-gap-narrow`.
12
+ *
13
+ * @param values - The value, or responsive values, that will be set as the
14
+ * value of the data property set by `property`. These values should typically
15
+ * be a `string` or `boolean`. For boolean values, the data attribute will be
16
+ * set when the value is `true` and will not be set when the value is `false`.
17
+ */
18
+ export declare function getResponsiveAttributes<T>(property: string, values?: T | ResponsiveValue<T>): Record<string, T extends boolean ? '' : T> | undefined;
19
+ //# sourceMappingURL=getResponsiveAttributes.d.ts.map
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Transform the given property and values in to corresponding data attributes
3
+ * to be placed on a container. This function is helpful for coordinating
4
+ * between responsive prop values and the corresponding styles in CSS.
5
+ *
6
+ * @param property - The name that will be given to the data attribute. For
7
+ * example, a property of "gap" will be transformed to `data-gap`.
8
+ *
9
+ * If responsive values are used, then the breakpoint name will be appended to
10
+ * the data attribute name. For example, `data-gap-narrow`.
11
+ *
12
+ * @param values - The value, or responsive values, that will be set as the
13
+ * value of the data property set by `property`. These values should typically
14
+ * be a `string` or `boolean`. For boolean values, the data attribute will be
15
+ * set when the value is `true` and will not be set when the value is `false`.
16
+ */
17
+ function getResponsiveAttributes(property, values) {
18
+ if (values === undefined || values === null) {
19
+ return;
20
+ }
21
+ if (typeof values == 'object') {
22
+ return Object.fromEntries(Object.entries(values).map(([key, value]) => {
23
+ return serialize(`data-${property}-${key}`, value);
24
+ }));
25
+ }
26
+ return Object.fromEntries([serialize(`data-${property}`, values)]);
27
+ }
28
+ function serialize(property, value) {
29
+ if (typeof value === 'boolean') {
30
+ if (value) {
31
+ return [property, ''];
32
+ }
33
+ return [];
34
+ }
35
+ return [property, value];
36
+ }
37
+
38
+ export { getResponsiveAttributes };
@@ -0,0 +1,8 @@
1
+ import type { ResponsiveValue } from '../../hooks/useResponsiveValue';
2
+ /**
3
+ * Helper utility to get the value for a prop based on control args. This is
4
+ * helpful when an arg can have both responsive values and a plain value. In
5
+ * cases where both are defined, responsive values will take preference
6
+ */
7
+ export declare function getResponsiveControlValues<T>(value: T, responsiveValue: ResponsiveValue<T>): T | ResponsiveValue<T>;
8
+ //# sourceMappingURL=getResponsiveControlValues.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primer/react",
3
- "version": "36.14.0",
3
+ "version": "36.15.0",
4
4
  "description": "An implementation of GitHub's Primer Design System using React",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib-esm/index.js",