@elliemae/ds-grid 3.70.0-next.7 → 3.70.0-next.71

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/cjs/Grid.js CHANGED
@@ -37,10 +37,12 @@ var React = __toESM(require("react"));
37
37
  var import_jsx_runtime = require("react/jsx-runtime");
38
38
  var import_react = __toESM(require("react"));
39
39
  var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
40
+ var import_ds_system = require("@elliemae/ds-system");
40
41
  var import_react_desc_prop_types = require("./react-desc-prop-types.js");
41
42
  var import_GridItem = require("./GridItem.js");
42
43
  var import_useGrid = require("./config/useGrid.js");
43
44
  var import_DSGridDefinitions = require("./DSGridDefinitions.js");
45
+ var import_resolveLayoutMode = require("./utils/resolveLayoutMode.js");
44
46
  const Grid = import_react.default.forwardRef((props, ref) => {
45
47
  const {
46
48
  propsWithDefaults: {
@@ -56,6 +58,7 @@ const Grid = import_react.default.forwardRef((props, ref) => {
56
58
  height,
57
59
  innerRef,
58
60
  span,
61
+ withLayoutMode,
59
62
  ...rest
60
63
  },
61
64
  globalProps,
@@ -63,24 +66,19 @@ const Grid = import_react.default.forwardRef((props, ref) => {
63
66
  isSpanParent,
64
67
  renderChildren
65
68
  } = (0, import_useGrid.useGrid)(props);
69
+ const layoutMode = (0, import_ds_system.useGetLayoutMode)();
66
70
  const correctSpan = (0, import_react.useMemo)(() => {
67
- if (span && typeof span !== "number" && span.small && !span.xsmall) {
68
- return { ...span, xsmall: span.small };
69
- }
70
- return span;
71
- }, [span]);
71
+ const backfilled = span && typeof span !== "number" && span.small && !span.xsmall ? { ...span, xsmall: span.small } : span;
72
+ return withLayoutMode ? (0, import_resolveLayoutMode.resolveByLayoutMode)(backfilled, layoutMode) : backfilled;
73
+ }, [span, withLayoutMode, layoutMode]);
72
74
  const correctCols = (0, import_react.useMemo)(() => {
73
- if (typeof cols === "object" && !Array.isArray(cols) && cols.small && !cols.xsmall) {
74
- return { ...cols, xsmall: cols.small };
75
- }
76
- return cols;
77
- }, [cols]);
75
+ const backfilled = typeof cols === "object" && !Array.isArray(cols) && cols.small && !cols.xsmall ? { ...cols, xsmall: cols.small } : cols;
76
+ return withLayoutMode ? (0, import_resolveLayoutMode.resolveByLayoutMode)(backfilled, layoutMode) : backfilled;
77
+ }, [cols, withLayoutMode, layoutMode]);
78
78
  const correctRows = (0, import_react.useMemo)(() => {
79
- if (typeof rows === "object" && !Array.isArray(rows) && rows.small && !rows.xsmall) {
80
- return { ...rows, xsmall: rows.small };
81
- }
82
- return rows;
83
- }, [rows]);
79
+ const backfilled = typeof rows === "object" && !Array.isArray(rows) && rows.small && !rows.xsmall ? { ...rows, xsmall: rows.small } : rows;
80
+ return withLayoutMode ? (0, import_resolveLayoutMode.resolveByLayoutMode)(backfilled, layoutMode) : backfilled;
81
+ }, [rows, withLayoutMode, layoutMode]);
84
82
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
85
83
  import_GridItem.GridItem,
86
84
  {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/Grid.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import React, { useMemo } from 'react';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport type { DSGridT } from './react-desc-prop-types.js';\nimport { DSCardHeaderPropTypesSchema } from './react-desc-prop-types.js';\nimport { GridItem } from './GridItem.js';\nimport { useGrid } from './config/useGrid.js';\nimport { DSGridName } from './DSGridDefinitions.js';\n\nconst Grid = React.forwardRef<HTMLDivElement, DSGridT.Props>((props, ref) => {\n const {\n propsWithDefaults: {\n withMaxWidthBreakpoints,\n alignItems,\n cols,\n children,\n rows,\n gutter,\n justify,\n wrap,\n width,\n height,\n innerRef,\n span,\n ...rest\n },\n globalProps,\n xstyledProps,\n isSpanParent,\n renderChildren,\n } = useGrid(props);\n\n // xsmall was added after the initial implementation, so we need to make sure it's always present\n // to avoid breaking changes.\n\n const correctSpan = useMemo(() => {\n if (span && typeof span !== 'number' && span.small && !span.xsmall) {\n return { ...span, xsmall: span.small };\n }\n return span;\n }, [span]);\n\n const correctCols = useMemo(() => {\n if (typeof cols === 'object' && !Array.isArray(cols) && cols.small && !cols.xsmall) {\n return { ...cols, xsmall: cols.small };\n }\n return cols;\n }, [cols]);\n\n const correctRows = useMemo(() => {\n if (typeof rows === 'object' && !Array.isArray(rows) && rows.small && !rows.xsmall) {\n return { ...rows, xsmall: rows.small };\n }\n return rows;\n }, [rows]);\n\n return (\n <GridItem\n {...rest}\n {...globalProps}\n {...xstyledProps}\n span={correctSpan}\n alignItems={alignItems}\n cols={correctCols}\n gutter={gutter}\n isSpanParent={isSpanParent}\n justify={justify}\n rows={correctRows}\n wrap={wrap}\n childNumber={React.Children.count(children)}\n innerRef={innerRef ?? ref}\n w={width}\n h={height}\n withMaxWidthBreakpoints={withMaxWidthBreakpoints}\n >\n {renderChildren}\n </GridItem>\n );\n});\n\n// Since this component is using ForwardRef, we must provide a displayName to avoid 'undefined' name in propsTable.\nGrid.displayName = DSGridName;\nconst DSGridWithSchema = describe(Grid);\nDSGridWithSchema.propTypes = DSCardHeaderPropTypesSchema;\n\nexport default Grid;\nexport { DSGridWithSchema, Grid };\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADwDnB;AAxDJ,mBAA+B;AAC/B,8BAAyB;AAEzB,mCAA4C;AAC5C,sBAAyB;AACzB,qBAAwB;AACxB,+BAA2B;AAE3B,MAAM,OAAO,aAAAA,QAAM,WAA0C,CAAC,OAAO,QAAQ;AAC3E,QAAM;AAAA,IACJ,mBAAmB;AAAA,MACjB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAG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 'react';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { useGetLayoutMode } from '@elliemae/ds-system';\nimport type { DSGridT } from './react-desc-prop-types.js';\nimport { DSCardHeaderPropTypesSchema } from './react-desc-prop-types.js';\nimport { GridItem } from './GridItem.js';\nimport { useGrid } from './config/useGrid.js';\nimport { DSGridName } from './DSGridDefinitions.js';\nimport { resolveByLayoutMode, type LayoutMode } from './utils/resolveLayoutMode.js';\n\nconst Grid = React.forwardRef<HTMLDivElement, DSGridT.Props>((props, ref) => {\n const {\n propsWithDefaults: {\n withMaxWidthBreakpoints,\n alignItems,\n cols,\n children,\n rows,\n gutter,\n justify,\n wrap,\n width,\n height,\n innerRef,\n span,\n withLayoutMode,\n ...rest\n },\n globalProps,\n xstyledProps,\n isSpanParent,\n renderChildren,\n } = useGrid(props);\n\n // When withLayoutMode is opted into, the Grid resolves its responsive definitions from the\n // ancestor DSLayoutProvider's layoutMode instead of the viewport. resolveByLayoutMode is a\n // no-op when there is no layoutMode in context, so this stays safe outside a provider.\n const layoutMode = useGetLayoutMode() as LayoutMode | undefined;\n\n // xsmall was added after the initial implementation, so we need to make sure it's always present\n // to avoid breaking changes. The xsmall backfill runs first so layoutMode=\"xs\" can pick it up.\n\n const correctSpan = useMemo(() => {\n const backfilled =\n span && typeof span !== 'number' && span.small && !span.xsmall ? { ...span, xsmall: span.small } : span;\n return withLayoutMode ? resolveByLayoutMode(backfilled, layoutMode) : backfilled;\n }, [span, withLayoutMode, layoutMode]);\n\n const correctCols = useMemo(() => {\n const backfilled =\n typeof cols === 'object' && !Array.isArray(cols) && cols.small && !cols.xsmall\n ? { ...cols, xsmall: cols.small }\n : cols;\n return withLayoutMode ? resolveByLayoutMode(backfilled, layoutMode) : backfilled;\n }, [cols, withLayoutMode, layoutMode]);\n\n const correctRows = useMemo(() => {\n const backfilled =\n typeof rows === 'object' && !Array.isArray(rows) && rows.small && !rows.xsmall\n ? { ...rows, xsmall: rows.small }\n : rows;\n return withLayoutMode ? resolveByLayoutMode(backfilled, layoutMode) : backfilled;\n }, [rows, withLayoutMode, layoutMode]);\n\n return (\n <GridItem\n {...rest}\n {...globalProps}\n {...xstyledProps}\n span={correctSpan}\n alignItems={alignItems}\n cols={correctCols}\n gutter={gutter}\n isSpanParent={isSpanParent}\n justify={justify}\n rows={correctRows}\n wrap={wrap}\n childNumber={React.Children.count(children)}\n innerRef={innerRef ?? ref}\n w={width}\n h={height}\n withMaxWidthBreakpoints={withMaxWidthBreakpoints}\n >\n {renderChildren}\n </GridItem>\n );\n});\n\n// Since this component is using ForwardRef, we must provide a displayName to avoid 'undefined' name in propsTable.\nGrid.displayName = DSGridName;\nconst DSGridWithSchema = describe(Grid);\nDSGridWithSchema.propTypes = DSCardHeaderPropTypesSchema;\n\nexport default Grid;\nexport { DSGridWithSchema, Grid };\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADiEnB;AAjEJ,mBAA+B;AAC/B,8BAAyB;AACzB,uBAAiC;AAEjC,mCAA4C;AAC5C,sBAAyB;AACzB,qBAAwB;AACxB,+BAA2B;AAC3B,+BAAqD;AAErD,MAAM,OAAO,aAAAA,QAAM,WAA0C,CAAC,OAAO,QAAQ;AAC3E,QAAM;AAAA,IACJ,mBAAmB;AAAA,MACjB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,wBAAQ,KAAK;AAKjB,QAAM,iBAAa,mCAAiB;AAKpC,QAAM,kBAAc,sBAAQ,MAAM;AAChC,UAAM,aACJ,QAAQ,OAAO,SAAS,YAAY,KAAK,SAAS,CAAC,KAAK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
- "publishConfig": {
8
- "access": "public"
9
- }
6
+ ]
10
7
  }
@@ -86,6 +86,7 @@ const DSGridPropTypes = {
86
86
  innerRef: import_ds_props_helpers.PropTypes.oneOfType([import_ds_props_helpers.PropTypes.func, import_ds_props_helpers.PropTypes.object]).description("Ref to the grid"),
87
87
  wrap: import_ds_props_helpers.PropTypes.oneOf(import_constants.wrap).description("Wrap type").defaultValue(import_constants.wrap[0]),
88
88
  withMaxWidthBreakpoints: import_ds_props_helpers.PropTypes.bool.description("weather use max width").defaultValue(void 0),
89
+ withLayoutMode: import_ds_props_helpers.PropTypes.bool.description("Resolve responsive cols/rows/span from the ancestor DSLayoutProvider mode.").defaultValue(void 0),
89
90
  height: import_ds_props_helpers.PropTypes.oneOfType([import_ds_props_helpers.PropTypes.number, import_ds_props_helpers.PropTypes.string]).description("Grid height."),
90
91
  width: import_ds_props_helpers.PropTypes.oneOfType([import_ds_props_helpers.PropTypes.number, import_ds_props_helpers.PropTypes.string]).description("Grid width."),
91
92
  backgroundColor: import_ds_props_helpers.PropTypes.string.description("Sets background color."),
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/react-desc-prop-types.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import type { WeakValidationMap } from 'react';\nimport type React from 'react';\nimport type { GlobalAttributesT, XstyledProps, DSPropTypesSchema } from '@elliemae/ds-props-helpers';\nimport { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from '@elliemae/ds-props-helpers';\nimport { alignItemsPlacement, justifyPlacement, wrap, boxShadow } from './utils/constants.js';\n\nexport declare namespace DSGridT {\n export type RowOrColsSyntaxSugar = string | number | (string | number)[];\n\n export interface RowColBreakpoints {\n xsmall?: RowOrColsSyntaxSugar[];\n small?: RowOrColsSyntaxSugar[];\n medium?: RowOrColsSyntaxSugar[];\n large?: RowOrColsSyntaxSugar[];\n }\n\n export type RowOrColsValidValues = RowOrColsSyntaxSugar | RowColBreakpoints;\n\n export interface SpanBreakpoints {\n xsmall?: number;\n small?: number;\n medium?: number;\n large?: number;\n }\n\n export type JustifyPlacement =\n | 'flex-start'\n | 'center'\n | 'flex-end'\n | 'space-between'\n | 'space-around'\n | 'space-evenly';\n export type AlignItemsPlacement = 'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline' | 'space-between';\n export type Wrap = 'wrap' | 'nowrap' | 'wrap-reverse';\n export type BoxShadow = 'xs' | 's' | 'm' | 'l' | 'xl';\n\n export interface RequiredProps {}\n\n export interface DefaultProps {\n rows: RowOrColsValidValues;\n cols: RowOrColsValidValues;\n className: string;\n justify: JustifyPlacement;\n wrap: Wrap;\n span: number | SpanBreakpoints;\n justifyItems: string;\n }\n\n export interface OptionalProps {\n height?: string | number;\n width?: string | number;\n justifyContent?: JustifyPlacement;\n alignItems?: AlignItemsPlacement;\n alignContent?: AlignItemsPlacement;\n children?: React.ReactNode;\n withMaxWidthBreakpoints?: boolean;\n rowGap?: string | number;\n gutter?: string | number;\n innerRef?: React.MutableRefObject<HTMLDivElement | null> | React.RefCallback<HTMLDivElement>;\n }\n\n // Grid components override some of the global attributes,\n // components inheriting from Grid needs a way to exclude these attributes from GlobalAttributesT\n // in such scenario, they would do\n // Omit<\n // GlobalAttributesT<HTMLDivElement>, keyof DefaultProps | keyof OptionalProps\n // ^ their's namespace own DefaultProps | OptionalProps | ...\n // | keyof GridSpecificGlobalAttributes\n // ^ Grid's overrides\n // >\n // This way, the component will have all the global attributes except the ones that are overridden by Grid and by the component itself\n // in one line: Omit<GlobalAttributesT<HTMLDivElement>, keyof DefaultProps | keyof OptionalProps [ | ... ] | keyof GridSpecificGlobalAttributes>\n export type GridSpecificGlobalAttributes = Omit<\n GlobalAttributesT<HTMLDivElement>,\n keyof DefaultProps | keyof OptionalProps | keyof XstyledProps\n >;\n export type GridSpecificGlobalAttributesGeneric<ElementType = HTMLDivElement> = Omit<\n GlobalAttributesT<ElementType>,\n keyof DefaultProps | keyof OptionalProps | keyof XstyledProps\n >;\n\n export interface Props extends Partial<DefaultProps>, OptionalProps, GridSpecificGlobalAttributes, XstyledProps {}\n\n export interface InternalProps extends DefaultProps, OptionalProps, GridSpecificGlobalAttributes, XstyledProps {}\n\n export interface ItemProps {\n rows: RowOrColsValidValues;\n cols: RowOrColsValidValues;\n alignItems?: AlignItemsPlacement;\n alignContent?: AlignItemsPlacement;\n children: React.ReactNode;\n className?: string;\n justify: JustifyPlacement;\n gutter?: string | number;\n wrap: Wrap;\n childNumber: number;\n isSpanParent: boolean;\n span?: number | SpanBreakpoints;\n withMaxWidthBreakpoints?: boolean;\n }\n}\n\nexport const defaultProps: DSGridT.DefaultProps = {\n rows: [],\n cols: [],\n className: '',\n justify: 'flex-start',\n wrap: 'wrap',\n span: 1,\n justifyItems: 'normal',\n};\n\n// =============================================================================\n// PropTypes\n// =============================================================================\nconst rowColBreakpoints = PropTypes.shape({\n xsmall: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),\n small: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),\n medium: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),\n large: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),\n});\n\nconst spanBreakpoints = PropTypes.shape({\n xsmall: PropTypes.number,\n small: PropTypes.number,\n medium: PropTypes.number,\n large: PropTypes.number,\n});\n\nexport const DSGridPropTypes: DSPropTypesSchema<DSGridT.Props> = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n rows: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),\n PropTypes.number,\n rowColBreakpoints,\n ])\n .description('Row layout cells')\n .defaultValue([]),\n cols: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),\n PropTypes.number,\n rowColBreakpoints,\n ])\n .description('Column layout cells')\n .defaultValue([]),\n span: PropTypes.oneOfType([PropTypes.number, spanBreakpoints]).description(\n 'Expands the grid element within columns.',\n ),\n alignItems: PropTypes.oneOf(alignItemsPlacement).description('flex-like align items prop'),\n children: PropTypes.node.description('Children node inside grid cell'),\n className: PropTypes.string.description('CSS class').defaultValue(''),\n justifyContent: PropTypes.oneOf(justifyPlacement)\n .description('flex-like justify prop')\n .defaultValue(justifyPlacement[0]),\n gutter: PropTypes.oneOfType([PropTypes.number, PropTypes.string])\n .description('Space between cells prop')\n .defaultValue(0),\n justify: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Space between cells prop'),\n justifyItems: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Space between cells prop'),\n alignContent: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Space between cells prop'),\n rowGap: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Space between cells prop'),\n innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]).description('Ref to the grid'),\n wrap: PropTypes.oneOf(wrap).description('Wrap type').defaultValue(wrap[0]),\n withMaxWidthBreakpoints: PropTypes.bool.description('weather use max width').defaultValue(undefined),\n height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Grid height.'),\n width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Grid width.'),\n backgroundColor: PropTypes.string.description('Sets background color.'),\n bg: PropTypes.string.description('Sets background color.'),\n boxShadow: PropTypes.oneOf(boxShadow).description('Sets background color.'),\n border: PropTypes.string.description('Sets border.'),\n borderRadius: PropTypes.string.description('Sets border radius.'),\n borderWidth: PropTypes.string.description('Sets border width.'),\n borderStyle: PropTypes.string.description('Sets border style.'),\n borderColor: PropTypes.string.description('Sets border color.'),\n borderTop: PropTypes.string.description('Sets top border.'),\n borderBottom: PropTypes.string.description('Sets bottom border.'),\n borderLeft: PropTypes.string.description('Sets left border.'),\n borderRight: PropTypes.string.description('Sets right border.'),\n borderTopWidth: PropTypes.string.description('Sets border top width.'),\n borderTopStyle: PropTypes.string.description('Sets border top style.'),\n borderTopColor: PropTypes.string.description('Sets border top color.'),\n borderBottomWidth: PropTypes.string.description('Sets border bottom width.'),\n borderBottomStyle: PropTypes.string.description('Sets border bottom style.'),\n borderBottomColor: PropTypes.string.description('Sets border bottom color.'),\n borderRightWidth: PropTypes.string.description('Sets border right width.'),\n borderRightStyle: PropTypes.string.description('Sets border right style.'),\n borderRightColor: PropTypes.string.description('Sets border right color.'),\n borderLeftWidth: PropTypes.string.description('Sets border left width.'),\n borderLeftStyle: PropTypes.string.description('Sets border left style.'),\n borderLeftColor: PropTypes.string.description('Sets border left color.'),\n};\n\nexport const DSCardHeaderPropTypesSchema = DSGridPropTypes as unknown as WeakValidationMap<DSGridT.Props>;\n\nexport const getGridProps = (props: unknown): Partial<DSGridT.Props> => {\n if (typeof props !== 'object' || props === null) return {};\n const innerProps = props as Record<string, unknown>;\n const innerGridPropTypes = props as Record<keyof DSGridT.Props, unknown>;\n const filteredProps: Partial<DSGridT.Props> = {};\n\n Object.keys(innerProps).forEach((key) => {\n const innerKey = key as keyof DSGridT.Props;\n if (innerGridPropTypes[innerKey] && innerProps[innerKey] !== undefined) {\n filteredProps[innerKey] = innerProps[innerKey];\n }\n });\n return filteredProps;\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,8BAAuE;AACvE,uBAAuE;AAkGhE,MAAM,eAAqC;AAAA,EAChD,MAAM,CAAC;AAAA,EACP,MAAM,CAAC;AAAA,EACP,WAAW;AAAA,EACX,SAAS;AAAA,EACT,MAAM;AAAA,EACN,MAAM;AAAA,EACN,cAAc;AAChB;AAKA,MAAM,oBAAoB,kCAAU,MAAM;AAAA,EACxC,QAAQ,kCAAU,QAAQ,kCAAU,UAAU,CAAC,kCAAU,QAAQ,kCAAU,MAAM,CAAC,CAAC;AAAA,EACnF,OAAO,kCAAU,QA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+ "sourcesContent": ["import type { DSPropTypesSchema, GlobalAttributesT, XstyledProps } from '@elliemae/ds-props-helpers';\nimport { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from '@elliemae/ds-props-helpers';\nimport type React from 'react';\nimport type { WeakValidationMap } from 'react';\nimport { alignItemsPlacement, boxShadow, justifyPlacement, wrap } from './utils/constants.js';\n\nexport declare namespace DSGridT {\n export type RowOrColsSyntaxSugar = string | number | (string | number)[];\n\n export interface RowColBreakpoints {\n xsmall?: RowOrColsSyntaxSugar[];\n small?: RowOrColsSyntaxSugar[];\n medium?: RowOrColsSyntaxSugar[];\n large?: RowOrColsSyntaxSugar[];\n }\n\n export type RowOrColsValidValues = RowOrColsSyntaxSugar | RowColBreakpoints;\n\n export interface SpanBreakpoints {\n xsmall?: number;\n small?: number;\n medium?: number;\n large?: number;\n }\n\n export type JustifyPlacement =\n 'start' | 'flex-start' | 'center' | 'end' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly';\n export type AlignItemsPlacement =\n 'start' | 'flex-start' | 'center' | 'end' | 'flex-end' | 'stretch' | 'baseline' | 'space-between';\n export type Wrap = 'wrap' | 'nowrap' | 'wrap-reverse';\n export type BoxShadow = 'xs' | 's' | 'm' | 'l' | 'xl';\n\n export interface RequiredProps {}\n\n export interface DefaultProps {\n rows: RowOrColsValidValues;\n cols: RowOrColsValidValues;\n className: string;\n justify: JustifyPlacement;\n wrap: Wrap;\n span: number | SpanBreakpoints;\n justifyItems: string;\n }\n\n export interface OptionalProps {\n height?: string | number;\n width?: string | number;\n justifyContent?: JustifyPlacement;\n alignItems?: AlignItemsPlacement;\n alignContent?: AlignItemsPlacement;\n children?: React.ReactNode;\n withMaxWidthBreakpoints?: boolean;\n withLayoutMode?: boolean;\n rowGap?: string | number;\n gutter?: string | number;\n innerRef?: React.MutableRefObject<HTMLDivElement | null> | React.RefCallback<HTMLDivElement>;\n // this practically work. Trying to extend the styled itself produces\n // typescript expression produces a union type that is too complex to represent\n // in many places, adding it here lift the typescript computation.\n // harder to mantain, but if we don't lift it, right now we break something else so :shrug:\n as?: keyof React.JSX.IntrinsicElements;\n }\n\n // Grid components override some of the global attributes,\n // components inheriting from Grid needs a way to exclude these attributes from GlobalAttributesT\n // in such scenario, they would do\n // Omit<\n // GlobalAttributesT<HTMLDivElement>, keyof DefaultProps | keyof OptionalProps\n // ^ their's namespace own DefaultProps | OptionalProps | ...\n // | keyof GridSpecificGlobalAttributes\n // ^ Grid's overrides\n // >\n // This way, the component will have all the global attributes except the ones that are overridden by Grid and by the component itself\n // in one line: Omit<GlobalAttributesT<HTMLDivElement>, keyof DefaultProps | keyof OptionalProps [ | ... ] | keyof GridSpecificGlobalAttributes>\n export type GridSpecificGlobalAttributes = Omit<\n GlobalAttributesT<HTMLDivElement>,\n keyof RequiredProps | keyof DefaultProps | keyof OptionalProps | keyof XstyledProps\n >;\n export type GridSpecificGlobalAttributesGeneric<ElementType = HTMLDivElement> = Omit<\n GlobalAttributesT<ElementType>,\n keyof RequiredProps | keyof DefaultProps | keyof OptionalProps | keyof XstyledProps\n >;\n\n export interface Props extends Partial<DefaultProps>, OptionalProps, GridSpecificGlobalAttributes, XstyledProps {}\n\n export interface InternalProps extends DefaultProps, OptionalProps, GridSpecificGlobalAttributes, XstyledProps {}\n\n export interface ItemProps {\n rows: RowOrColsValidValues;\n cols: RowOrColsValidValues;\n alignItems?: AlignItemsPlacement;\n alignContent?: AlignItemsPlacement;\n children: React.ReactNode;\n className?: string;\n justify: JustifyPlacement;\n gutter?: string | number;\n wrap: Wrap;\n childNumber: number;\n isSpanParent: boolean;\n span?: number | SpanBreakpoints;\n withMaxWidthBreakpoints?: boolean;\n }\n}\n\nexport const defaultProps: DSGridT.DefaultProps = {\n rows: [],\n cols: [],\n className: '',\n justify: 'flex-start',\n wrap: 'wrap',\n span: 1,\n justifyItems: 'normal',\n};\n\n// =============================================================================\n// PropTypes\n// =============================================================================\nconst rowColBreakpoints = PropTypes.shape({\n xsmall: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),\n small: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),\n medium: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),\n large: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),\n});\n\nconst spanBreakpoints = PropTypes.shape({\n xsmall: PropTypes.number,\n small: PropTypes.number,\n medium: PropTypes.number,\n large: PropTypes.number,\n});\n\nexport const DSGridPropTypes: DSPropTypesSchema<DSGridT.Props> = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n rows: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),\n PropTypes.number,\n rowColBreakpoints,\n ])\n .description('Row layout cells')\n .defaultValue([]),\n cols: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),\n PropTypes.number,\n rowColBreakpoints,\n ])\n .description('Column layout cells')\n .defaultValue([]),\n span: PropTypes.oneOfType([PropTypes.number, spanBreakpoints]).description(\n 'Expands the grid element within columns.',\n ),\n alignItems: PropTypes.oneOf(alignItemsPlacement).description('flex-like align items prop'),\n children: PropTypes.node.description('Children node inside grid cell'),\n className: PropTypes.string.description('CSS class').defaultValue(''),\n justifyContent: PropTypes.oneOf(justifyPlacement)\n .description('flex-like justify prop')\n .defaultValue(justifyPlacement[0]),\n gutter: PropTypes.oneOfType([PropTypes.number, PropTypes.string])\n .description('Space between cells prop')\n .defaultValue(0),\n justify: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Space between cells prop'),\n justifyItems: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Space between cells prop'),\n alignContent: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Space between cells prop'),\n rowGap: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Space between cells prop'),\n innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]).description('Ref to the grid'),\n wrap: PropTypes.oneOf(wrap).description('Wrap type').defaultValue(wrap[0]),\n withMaxWidthBreakpoints: PropTypes.bool.description('weather use max width').defaultValue(undefined),\n withLayoutMode: PropTypes.bool\n .description('Resolve responsive cols/rows/span from the ancestor DSLayoutProvider mode.')\n .defaultValue(undefined),\n height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Grid height.'),\n width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Grid width.'),\n backgroundColor: PropTypes.string.description('Sets background color.'),\n bg: PropTypes.string.description('Sets background color.'),\n boxShadow: PropTypes.oneOf(boxShadow).description('Sets background color.'),\n border: PropTypes.string.description('Sets border.'),\n borderRadius: PropTypes.string.description('Sets border radius.'),\n borderWidth: PropTypes.string.description('Sets border width.'),\n borderStyle: PropTypes.string.description('Sets border style.'),\n borderColor: PropTypes.string.description('Sets border color.'),\n borderTop: PropTypes.string.description('Sets top border.'),\n borderBottom: PropTypes.string.description('Sets bottom border.'),\n borderLeft: PropTypes.string.description('Sets left border.'),\n borderRight: PropTypes.string.description('Sets right border.'),\n borderTopWidth: PropTypes.string.description('Sets border top width.'),\n borderTopStyle: PropTypes.string.description('Sets border top style.'),\n borderTopColor: PropTypes.string.description('Sets border top color.'),\n borderBottomWidth: PropTypes.string.description('Sets border bottom width.'),\n borderBottomStyle: PropTypes.string.description('Sets border bottom style.'),\n borderBottomColor: PropTypes.string.description('Sets border bottom color.'),\n borderRightWidth: PropTypes.string.description('Sets border right width.'),\n borderRightStyle: PropTypes.string.description('Sets border right style.'),\n borderRightColor: PropTypes.string.description('Sets border right color.'),\n borderLeftWidth: PropTypes.string.description('Sets border left width.'),\n borderLeftStyle: PropTypes.string.description('Sets border left style.'),\n borderLeftColor: PropTypes.string.description('Sets border left color.'),\n};\n\nexport const DSCardHeaderPropTypesSchema = DSGridPropTypes as unknown as WeakValidationMap<DSGridT.Props>;\n\nexport const getGridProps = (props: unknown): Partial<DSGridT.Props> => {\n if (typeof props !== 'object' || props === null) return {};\n const innerProps = props as Record<string, unknown>;\n const innerGridPropTypes = props as Record<keyof DSGridT.Props, unknown>;\n const filteredProps: Partial<DSGridT.Props> = {};\n\n Object.keys(innerProps).forEach((key) => {\n const innerKey = key as keyof DSGridT.Props;\n if (innerGridPropTypes[innerKey] && innerProps[innerKey] !== undefined) {\n filteredProps[innerKey] = innerProps[innerKey];\n }\n });\n return filteredProps;\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,8BAAuE;AAGvE,uBAAuE;AAoGhE,MAAM,eAAqC;AAAA,EAChD,MAAM,CAAC;AAAA,EACP,MAAM,CAAC;AAAA,EACP,WAAW;AAAA,EACX,SAAS;AAAA,EACT,MAAM;AAAA,EACN,MAAM;AAAA,EACN,cAAc;AAChB;AAKA,MAAM,oBAAoB,kCAAU,MAAM;AAAA,EACxC,QAAQ,kCAAU,QAAQ,kCAAU,UAAU,CAAC,kCAAU,QAAQ,kCAAU,MAAM,CAAC,CAAC;AAAA,EACnF,OAAO,kCAAU,QAAQ,kCAAU,UAAU,CAAC,kCAAU,QAAQ,kCAAU,MAAM,CAAC,CAAC;AAAA,EAClF,QAAQ,kCAAU,QAAQ,kCAAU,UAAU,CAAC,kCAAU,QAAQ,kCAAU,MAAM,CAAC,CAAC;AAAA,EACnF,OAAO,kCAAU,QAAQ,kCAAU,UAAU,CAAC,kCAAU,QAAQ,kCAAU,MAAM,CAAC,CAAC;AACpF,CAAC;AAED,MAAM,kBAAkB,kCAAU,MAAM;AAAA,EACtC,QAAQ,kCAAU;AAAA,EAClB,OAAO,kCAAU;AAAA,EACjB,QAAQ,kCAAU;AAAA,EAClB,OAAO,kCAAU;AACnB,CAAC;AAEM,MAAM,kBAAoD;AAAA,EAC/D,GAAG;AAAA,EACH,GAAG;AAAA,EACH,MAAM,kCAAU,UAAU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AO,YAAY,2BAA2B;AAAA,EAC3E,mBAAmB,kCAAU,OAAO,YAAY,2BAA2B;AAAA,EAC3E,mBAAmB,kCAAU,OAAO,YAAY,2BAA2B;AAAA,EAC3E,kBAAkB,kCAAU,OAAO,YAAY,0BAA0B;AAAA,EACzE,kBAAkB,kCAAU,OAAO,YAAY,0BAA0B;AAAA,EACzE,kBAAkB,kCAAU,OAAO,YAAY,0BAA0B;AAAA,EACzE,iBAAiB,kCAAU,OAAO,YAAY,yBAAyB;AAAA,EACvE,iBAAiB,kCAAU,OAAO,YAAY,yBAAyB;AAAA,EACvE,iBAAiB,kCAAU,OAAO,YAAY,yBAAyB;AACzE;AAEO,MAAM,8BAA8B;AAEpC,MAAM,eAAe,CAAC,UAA2C;AACtE,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO,CAAC;AACzD,QAAM,aAAa;AACnB,QAAM,qBAAqB;AAC3B,QAAM,gBAAwC,CAAC;AAE/C,SAAO,KAAK,UAAU,EAAE,QAAQ,CAAC,QAAQ;AACvC,UAAM,WAAW;AACjB,QAAI,mBAAmB,QAAQ,KAAK,WAAW,QAAQ,MAAM,QAAW;AACtE,oBAAc,QAAQ,IAAI,WAAW,QAAQ;AAAA,IAC/C;AAAA,EACF,CAAC;AACD,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -32,6 +32,7 @@ const testOptionalProps = {
32
32
  alignItems: "flex-start",
33
33
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: "hey" }),
34
34
  withMaxWidthBreakpoints: false,
35
+ withLayoutMode: true,
35
36
  rowGap: "xs",
36
37
  gutter: "xs"
37
38
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/typescript-testing/typescript-grid-valid.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { Grid } from '../index.js';\nimport type { DSGridT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSGridT.Props;\ntype ComponentPropsInternals = DSGridT.InternalProps;\ntype ComponentPropsDefaultProps = DSGridT.DefaultProps;\ntype ComponentPropsOptionalProps = DSGridT.OptionalProps;\ntype ComponentPropsRequiredProps = DSGridT.RequiredProps;\n\nconst testRequiredProps: ComponentPropsRequiredProps = {};\nconst testOptionalProps: ComponentPropsOptionalProps = {\n height: 0,\n width: 0,\n justifyContent: 'flex-start',\n alignItems: 'flex-start',\n children: <div>hey</div>,\n withMaxWidthBreakpoints: false,\n rowGap: 'xs',\n gutter: 'xs',\n};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {\n rows: [],\n cols: [],\n span: 2,\n justifyItems: 'flex-start',\n};\nconst testProps: ComponentPropsForApp = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n};\nconst testPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n rows: [],\n cols: [],\n span: 2,\n justifyItems: 'flex-start',\n className: '',\n justify: 'flex-start',\n wrap: 'nowrap',\n};\nconst testInternalProps: ComponentPropsInternals = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\nconst testInternalPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n cols: { small: ['1fr', '1fr', '1fr'], medium: ['5fr', '1fr', '1fr'], large: ['1fr', '4fr', '1fr'] },\n rows: { small: ['1fr', '1fr', '1fr'], medium: ['5fr', '1fr', '1fr'], large: ['1fr', '4fr', '1fr'] },\n span: { small: 2, medium: 3, large: 1 },\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n rows: [1, 2, 3],\n justifyContent: 'center',\n border: '1px solid black',\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n alignItems: 'center',\n gutter: 'xs',\n bg: 'brand-100',\n borderTopColor: 'neutral-100-a10',\n borderLeftColor: '#141414',\n borderRightColor: 'rgba(0,0,0,0.5)',\n borderBottomColor: 'rgb(0,0,0)',\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <Grid {...testExplicitDefinition} />\n <Grid {...testInferedTypeCompatibility} />\n <Grid {...testDefinitionAsConst} />\n {/* works with inline values */}\n <Grid rows={[1, 2, 3]} justifyContent=\"center\" border=\"1px solid black\" />\n </>\n);\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAuB;ACiBX;AAhBZ,eAAqB;AAUrB,MAAM,oBAAiD,CAAC;AACxD,MAAM,oBAAiD;AAAA,EACrD,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,gBAAgB;AAAA,EAChB,YAAY;AAAA,EACZ,UAAU,4CAAC,SAAI,iBAAG;AAAA,EAClB,yBAAyB;AAAA,EACzB,QAAQ;AAAA,EACR,QAAQ;AACV;AAIA,MAAM,sBAA2D;AAAA,EAC/D,MAAM,CAAC;AAAA,EACP,MAAM,CAAC;AAAA,EACP,MAAM;AAAA,EACN,cAAc;AAChB;AACA,MAAM,YAAkC;AAAA,EACtC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AACA,MAAM,oBAAoB;AAAA,EACxB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,uBAA6D;AAAA,EACjE,MAAM,CAAC;AAAA,EACP,MAAM,CAAC;AAAA,EACP,MAAM;AAAA,EACN,cAAc;AAAA,EACd,WAAW;AAAA,EACX,SAAS;AAAA,EACT,MAAM;AACR;AACA,MAAM,oBAA6C;AAAA,EACjD,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AACA,MAAM,4BAA4B;AAAA,EAChC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,yBAA+C;AAAA,EACnD,MAAM,EAAE,OAAO,CAAC,OAAO,OAAO,KAAK,GAAG,QAAQ,CAAC,OAAO,OAAO,KAAK,GAAG,OAAO,CAAC,OAAO,OAAO,KAAK,EAAE;AAAA,EAClG,MAAM,EAAE,OAAO,CAAC,OAAO,OAAO,KAAK,GAAG,QAAQ,CAAC,OAAO,OAAO,KAAK,GAAG,OAAO,CAAC,OAAO,OAAO,KAAK,EAAE;AAAA,EAClG,MAAM,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,EAAE;AACxC;AAGA,MAAM,+BAA+B;AAAA,EACnC,MAAM,CAAC,GAAG,GAAG,CAAC;AAAA,EACd,gBAAgB;AAAA,EAChB,QAAQ;AACV;AAEA,MAAM,wBAAwB;AAAA,EAC5B,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,IAAI;AAAA,EACJ,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,mBAAmB;AACrB;AAEA,MAAM,wBAAwB,MAC5B,4EAEE;AAAA,8CAAC,iBAAM,GAAG,wBAAwB;AAAA,EAClC,4CAAC,iBAAM,GAAG,8BAA8B;AAAA,EACxC,4CAAC,iBAAM,GAAG,uBAAuB;AAAA,EAEjC,4CAAC,iBAAK,MAAM,CAAC,GAAG,GAAG,CAAC,GAAG,gBAAe,UAAS,QAAO,mBAAkB;AAAA,GAC1E;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { Grid } from '../index.js';\nimport type { DSGridT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSGridT.Props;\ntype ComponentPropsInternals = DSGridT.InternalProps;\ntype ComponentPropsDefaultProps = DSGridT.DefaultProps;\ntype ComponentPropsOptionalProps = DSGridT.OptionalProps;\ntype ComponentPropsRequiredProps = DSGridT.RequiredProps;\n\nconst testRequiredProps: ComponentPropsRequiredProps = {};\nconst testOptionalProps: ComponentPropsOptionalProps = {\n height: 0,\n width: 0,\n justifyContent: 'flex-start',\n alignItems: 'flex-start',\n children: <div>hey</div>,\n withMaxWidthBreakpoints: false,\n withLayoutMode: true,\n rowGap: 'xs',\n gutter: 'xs',\n};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {\n rows: [],\n cols: [],\n span: 2,\n justifyItems: 'flex-start',\n};\nconst testProps: ComponentPropsForApp = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n};\nconst testPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n rows: [],\n cols: [],\n span: 2,\n justifyItems: 'flex-start',\n className: '',\n justify: 'flex-start',\n wrap: 'nowrap',\n};\nconst testInternalProps: ComponentPropsInternals = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\nconst testInternalPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n cols: { small: ['1fr', '1fr', '1fr'], medium: ['5fr', '1fr', '1fr'], large: ['1fr', '4fr', '1fr'] },\n rows: { small: ['1fr', '1fr', '1fr'], medium: ['5fr', '1fr', '1fr'], large: ['1fr', '4fr', '1fr'] },\n span: { small: 2, medium: 3, large: 1 },\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n rows: [1, 2, 3],\n justifyContent: 'center',\n border: '1px solid black',\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n alignItems: 'center',\n gutter: 'xs',\n bg: 'brand-100',\n borderTopColor: 'neutral-100-a10',\n borderLeftColor: '#141414',\n borderRightColor: 'rgba(0,0,0,0.5)',\n borderBottomColor: 'rgb(0,0,0)',\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <Grid {...testExplicitDefinition} />\n <Grid {...testInferedTypeCompatibility} />\n <Grid {...testDefinitionAsConst} />\n {/* works with inline values */}\n <Grid rows={[1, 2, 3]} justifyContent=\"center\" border=\"1px solid black\" />\n </>\n);\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAuB;ACiBX;AAhBZ,eAAqB;AAUrB,MAAM,oBAAiD,CAAC;AACxD,MAAM,oBAAiD;AAAA,EACrD,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,gBAAgB;AAAA,EAChB,YAAY;AAAA,EACZ,UAAU,4CAAC,SAAI,iBAAG;AAAA,EAClB,yBAAyB;AAAA,EACzB,gBAAgB;AAAA,EAChB,QAAQ;AAAA,EACR,QAAQ;AACV;AAIA,MAAM,sBAA2D;AAAA,EAC/D,MAAM,CAAC;AAAA,EACP,MAAM,CAAC;AAAA,EACP,MAAM;AAAA,EACN,cAAc;AAChB;AACA,MAAM,YAAkC;AAAA,EACtC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AACA,MAAM,oBAAoB;AAAA,EACxB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,uBAA6D;AAAA,EACjE,MAAM,CAAC;AAAA,EACP,MAAM,CAAC;AAAA,EACP,MAAM;AAAA,EACN,cAAc;AAAA,EACd,WAAW;AAAA,EACX,SAAS;AAAA,EACT,MAAM;AACR;AACA,MAAM,oBAA6C;AAAA,EACjD,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AACA,MAAM,4BAA4B;AAAA,EAChC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,yBAA+C;AAAA,EACnD,MAAM,EAAE,OAAO,CAAC,OAAO,OAAO,KAAK,GAAG,QAAQ,CAAC,OAAO,OAAO,KAAK,GAAG,OAAO,CAAC,OAAO,OAAO,KAAK,EAAE;AAAA,EAClG,MAAM,EAAE,OAAO,CAAC,OAAO,OAAO,KAAK,GAAG,QAAQ,CAAC,OAAO,OAAO,KAAK,GAAG,OAAO,CAAC,OAAO,OAAO,KAAK,EAAE;AAAA,EAClG,MAAM,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,EAAE;AACxC;AAGA,MAAM,+BAA+B;AAAA,EACnC,MAAM,CAAC,GAAG,GAAG,CAAC;AAAA,EACd,gBAAgB;AAAA,EAChB,QAAQ;AACV;AAEA,MAAM,wBAAwB;AAAA,EAC5B,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,IAAI;AAAA,EACJ,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,mBAAmB;AACrB;AAEA,MAAM,wBAAwB,MAC5B,4EAEE;AAAA,8CAAC,iBAAM,GAAG,wBAAwB;AAAA,EAClC,4CAAC,iBAAM,GAAG,8BAA8B;AAAA,EACxC,4CAAC,iBAAM,GAAG,uBAAuB;AAAA,EAEjC,4CAAC,iBAAK,MAAM,CAAC,GAAG,GAAG,CAAC,GAAG,gBAAe,UAAS,QAAO,mBAAkB;AAAA,GAC1E;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var resolveLayoutMode_exports = {};
30
+ __export(resolveLayoutMode_exports, {
31
+ BREAKPOINT_ORDER: () => BREAKPOINT_ORDER,
32
+ LAYOUT_MODE_TO_BREAKPOINT: () => LAYOUT_MODE_TO_BREAKPOINT,
33
+ resolveByLayoutMode: () => resolveByLayoutMode
34
+ });
35
+ module.exports = __toCommonJS(resolveLayoutMode_exports);
36
+ var React = __toESM(require("react"));
37
+ const LAYOUT_MODE_TO_BREAKPOINT = {
38
+ xs: "xsmall",
39
+ s: "small",
40
+ m: "medium",
41
+ l: "large"
42
+ };
43
+ const BREAKPOINT_ORDER = ["xsmall", "small", "medium", "large"];
44
+ const isBreakpointObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
45
+ const pickForLayoutMode = (value, layoutMode) => {
46
+ const targetIndex = BREAKPOINT_ORDER.indexOf(LAYOUT_MODE_TO_BREAKPOINT[layoutMode]);
47
+ if (targetIndex < 0) return value;
48
+ for (let i = targetIndex; i >= 0; i -= 1) {
49
+ const candidate = value[BREAKPOINT_ORDER[i]];
50
+ if (candidate !== void 0) return candidate;
51
+ }
52
+ for (let i = targetIndex + 1; i < BREAKPOINT_ORDER.length; i += 1) {
53
+ const candidate = value[BREAKPOINT_ORDER[i]];
54
+ if (candidate !== void 0) return candidate;
55
+ }
56
+ return value;
57
+ };
58
+ function resolveByLayoutMode(value, layoutMode) {
59
+ if (!layoutMode || !isBreakpointObject(value)) return value;
60
+ return pickForLayoutMode(value, layoutMode);
61
+ }
62
+ //# sourceMappingURL=resolveLayoutMode.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/utils/resolveLayoutMode.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import type { DSGridT } from '../react-desc-prop-types.js';\n\n// The layout modes exposed by DSLayoutProvider (injected into the styled-components theme\n// and read via useGetLayoutMode from @elliemae/ds-system). Kept as a local literal union so\n// ds-grid does not take a (type or runtime) dependency on ds-layout-provider.\nexport type LayoutMode = 'xs' | 's' | 'm' | 'l';\n\n// The breakpoint keys a Grid cols/rows/span definition may declare.\ntype BreakpointKey = keyof DSGridT.RowColBreakpoints;\n\n// Clean 4 -> 4 mapping between a LayoutProvider mode and the Grid breakpoint it selects.\nexport const LAYOUT_MODE_TO_BREAKPOINT: Record<LayoutMode, BreakpointKey> = {\n xs: 'xsmall',\n s: 'small',\n m: 'medium',\n l: 'large',\n};\n\n// Ordered smallest -> largest. Used for the partial-definition fallback below.\nexport const BREAKPOINT_ORDER: BreakpointKey[] = ['xsmall', 'small', 'medium', 'large'];\n\n// A breakpoint definition is an object that is not an array (arrays are the \"flat\" cols/rows\n// syntax and numbers/strings are scalar definitions - none of those are layoutMode-driven).\nconst isBreakpointObject = (value: unknown): value is Partial<Record<BreakpointKey, unknown>> =>\n typeof value === 'object' && value !== null && !Array.isArray(value);\n\nconst pickForLayoutMode = (value: Partial<Record<BreakpointKey, unknown>>, layoutMode: LayoutMode): unknown => {\n const targetIndex = BREAKPOINT_ORDER.indexOf(LAYOUT_MODE_TO_BREAKPOINT[layoutMode]);\n // Unknown / unsupported mode -> leave the definition untouched.\n if (targetIndex < 0) return value;\n\n // Breakpoint objects may be partial (e.g. only { small, large } defined). We resolve to a\n // single predictable value: the exact key if present, otherwise the nearest DEFINED key\n // walking down toward xsmall, and only then the nearest one walking up toward large.\n for (let i = targetIndex; i >= 0; i -= 1) {\n const candidate = value[BREAKPOINT_ORDER[i]];\n if (candidate !== undefined) return candidate;\n }\n for (let i = targetIndex + 1; i < BREAKPOINT_ORDER.length; i += 1) {\n const candidate = value[BREAKPOINT_ORDER[i]];\n if (candidate !== undefined) return candidate;\n }\n // The object declared no usable breakpoint -> no-op.\n return value;\n};\n\n/**\n * Collapse a responsive cols/rows/span definition down to the single value selected by the\n * ancestor DSLayoutProvider's layoutMode, so the Grid lays out for the container it lives in\n * instead of the viewport.\n *\n * Only breakpoint OBJECTS are affected: arrays, numbers and strings pass through untouched, and\n * when there is no layoutMode in context we return the value as-is so the Grid keeps its\n * existing viewport (media-query) behavior. This is what makes the feature safe and opt-in.\n */\nexport function resolveByLayoutMode(\n value: DSGridT.RowOrColsValidValues,\n layoutMode: LayoutMode | undefined,\n): DSGridT.RowOrColsValidValues;\nexport function resolveByLayoutMode(\n value: number | DSGridT.SpanBreakpoints,\n layoutMode: LayoutMode | undefined,\n): number | DSGridT.SpanBreakpoints;\nexport function resolveByLayoutMode(value: unknown, layoutMode: LayoutMode | undefined): unknown {\n if (!layoutMode || !isBreakpointObject(value)) return value;\n return pickForLayoutMode(value, layoutMode);\n}\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADWhB,MAAM,4BAA+D;AAAA,EAC1E,IAAI;AAAA,EACJ,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGO,MAAM,mBAAoC,CAAC,UAAU,SAAS,UAAU,OAAO;AAItF,MAAM,qBAAqB,CAAC,UAC1B,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAErE,MAAM,oBAAoB,CAAC,OAAgD,eAAoC;AAC7G,QAAM,cAAc,iBAAiB,QAAQ,0BAA0B,UAAU,CAAC;AAElF,MAAI,cAAc,EAAG,QAAO;AAK5B,WAAS,IAAI,aAAa,KAAK,GAAG,KAAK,GAAG;AACxC,UAAM,YAAY,MAAM,iBAAiB,CAAC,CAAC;AAC3C,QAAI,cAAc,OAAW,QAAO;AAAA,EACtC;AACA,WAAS,IAAI,cAAc,GAAG,IAAI,iBAAiB,QAAQ,KAAK,GAAG;AACjE,UAAM,YAAY,MAAM,iBAAiB,CAAC,CAAC;AAC3C,QAAI,cAAc,OAAW,QAAO;AAAA,EACtC;AAEA,SAAO;AACT;AAmBO,SAAS,oBAAoB,OAAgB,YAA6C;AAC/F,MAAI,CAAC,cAAc,CAAC,mBAAmB,KAAK,EAAG,QAAO;AACtD,SAAO,kBAAkB,OAAO,UAAU;AAC5C;",
6
+ "names": []
7
+ }
package/dist/esm/Grid.js CHANGED
@@ -2,10 +2,12 @@ import * as React from "react";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  import React2, { useMemo } from "react";
4
4
  import { describe } from "@elliemae/ds-props-helpers";
5
+ import { useGetLayoutMode } from "@elliemae/ds-system";
5
6
  import { DSCardHeaderPropTypesSchema } from "./react-desc-prop-types.js";
6
7
  import { GridItem } from "./GridItem.js";
7
8
  import { useGrid } from "./config/useGrid.js";
8
9
  import { DSGridName } from "./DSGridDefinitions.js";
10
+ import { resolveByLayoutMode } from "./utils/resolveLayoutMode.js";
9
11
  const Grid = React2.forwardRef((props, ref) => {
10
12
  const {
11
13
  propsWithDefaults: {
@@ -21,6 +23,7 @@ const Grid = React2.forwardRef((props, ref) => {
21
23
  height,
22
24
  innerRef,
23
25
  span,
26
+ withLayoutMode,
24
27
  ...rest
25
28
  },
26
29
  globalProps,
@@ -28,24 +31,19 @@ const Grid = React2.forwardRef((props, ref) => {
28
31
  isSpanParent,
29
32
  renderChildren
30
33
  } = useGrid(props);
34
+ const layoutMode = useGetLayoutMode();
31
35
  const correctSpan = useMemo(() => {
32
- if (span && typeof span !== "number" && span.small && !span.xsmall) {
33
- return { ...span, xsmall: span.small };
34
- }
35
- return span;
36
- }, [span]);
36
+ const backfilled = span && typeof span !== "number" && span.small && !span.xsmall ? { ...span, xsmall: span.small } : span;
37
+ return withLayoutMode ? resolveByLayoutMode(backfilled, layoutMode) : backfilled;
38
+ }, [span, withLayoutMode, layoutMode]);
37
39
  const correctCols = useMemo(() => {
38
- if (typeof cols === "object" && !Array.isArray(cols) && cols.small && !cols.xsmall) {
39
- return { ...cols, xsmall: cols.small };
40
- }
41
- return cols;
42
- }, [cols]);
40
+ const backfilled = typeof cols === "object" && !Array.isArray(cols) && cols.small && !cols.xsmall ? { ...cols, xsmall: cols.small } : cols;
41
+ return withLayoutMode ? resolveByLayoutMode(backfilled, layoutMode) : backfilled;
42
+ }, [cols, withLayoutMode, layoutMode]);
43
43
  const correctRows = useMemo(() => {
44
- if (typeof rows === "object" && !Array.isArray(rows) && rows.small && !rows.xsmall) {
45
- return { ...rows, xsmall: rows.small };
46
- }
47
- return rows;
48
- }, [rows]);
44
+ const backfilled = typeof rows === "object" && !Array.isArray(rows) && rows.small && !rows.xsmall ? { ...rows, xsmall: rows.small } : rows;
45
+ return withLayoutMode ? resolveByLayoutMode(backfilled, layoutMode) : backfilled;
46
+ }, [rows, withLayoutMode, layoutMode]);
49
47
  return /* @__PURE__ */ jsx(
50
48
  GridItem,
51
49
  {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/Grid.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useMemo } from 'react';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport type { DSGridT } from './react-desc-prop-types.js';\nimport { DSCardHeaderPropTypesSchema } from './react-desc-prop-types.js';\nimport { GridItem } from './GridItem.js';\nimport { useGrid } from './config/useGrid.js';\nimport { DSGridName } from './DSGridDefinitions.js';\n\nconst Grid = React.forwardRef<HTMLDivElement, DSGridT.Props>((props, ref) => {\n const {\n propsWithDefaults: {\n withMaxWidthBreakpoints,\n alignItems,\n cols,\n children,\n rows,\n gutter,\n justify,\n wrap,\n width,\n height,\n innerRef,\n span,\n ...rest\n },\n globalProps,\n xstyledProps,\n isSpanParent,\n renderChildren,\n } = useGrid(props);\n\n // xsmall was added after the initial implementation, so we need to make sure it's always present\n // to avoid breaking changes.\n\n const correctSpan = useMemo(() => {\n if (span && typeof span !== 'number' && span.small && !span.xsmall) {\n return { ...span, xsmall: span.small };\n }\n return span;\n }, [span]);\n\n const correctCols = useMemo(() => {\n if (typeof cols === 'object' && !Array.isArray(cols) && cols.small && !cols.xsmall) {\n return { ...cols, xsmall: cols.small };\n }\n return cols;\n }, [cols]);\n\n const correctRows = useMemo(() => {\n if (typeof rows === 'object' && !Array.isArray(rows) && rows.small && !rows.xsmall) {\n return { ...rows, xsmall: rows.small };\n }\n return rows;\n }, [rows]);\n\n return (\n <GridItem\n {...rest}\n {...globalProps}\n {...xstyledProps}\n span={correctSpan}\n alignItems={alignItems}\n cols={correctCols}\n gutter={gutter}\n isSpanParent={isSpanParent}\n justify={justify}\n rows={correctRows}\n wrap={wrap}\n childNumber={React.Children.count(children)}\n innerRef={innerRef ?? ref}\n w={width}\n h={height}\n withMaxWidthBreakpoints={withMaxWidthBreakpoints}\n >\n {renderChildren}\n </GridItem>\n );\n});\n\n// Since this component is using ForwardRef, we must provide a displayName to avoid 'undefined' name in propsTable.\nGrid.displayName = DSGridName;\nconst DSGridWithSchema = describe(Grid);\nDSGridWithSchema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E;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAG;AAAA,MACJ,MAAM;AAAA,MACN;AAAA,MACA,MAAM;AAAA,MACN;AAAA,MACA;AAAA,MACA;AAAA,MACA,MAAM;AAAA,MACN;AAAA,MACA,aAAaA,OAAM,SAAS,MAAM,QAAQ;AAAA,MAC1C,UAAU,YAAY;AAAA,MACtB,GAAG;AAAA,MACH,GAAG;AAAA,MACH;AAAA,MAEC;AAAA;AAAA,EACH;AAEJ,CAAC;AAGD,KAAK,cAAc;AACnB,MAAM,mBAAmB,SAAS,IAAI;AACtC,iBAAiB,YAAY;AAE7B,IAAO,eAAQ;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useMemo } from 'react';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { useGetLayoutMode } from '@elliemae/ds-system';\nimport type { DSGridT } from './react-desc-prop-types.js';\nimport { DSCardHeaderPropTypesSchema } from './react-desc-prop-types.js';\nimport { GridItem } from './GridItem.js';\nimport { useGrid } from './config/useGrid.js';\nimport { DSGridName } from './DSGridDefinitions.js';\nimport { resolveByLayoutMode, type LayoutMode } from './utils/resolveLayoutMode.js';\n\nconst Grid = React.forwardRef<HTMLDivElement, DSGridT.Props>((props, ref) => {\n const {\n propsWithDefaults: {\n withMaxWidthBreakpoints,\n alignItems,\n cols,\n children,\n rows,\n gutter,\n justify,\n wrap,\n width,\n height,\n innerRef,\n span,\n withLayoutMode,\n ...rest\n },\n globalProps,\n xstyledProps,\n isSpanParent,\n renderChildren,\n } = useGrid(props);\n\n // When withLayoutMode is opted into, the Grid resolves its responsive definitions from the\n // ancestor DSLayoutProvider's layoutMode instead of the viewport. resolveByLayoutMode is a\n // no-op when there is no layoutMode in context, so this stays safe outside a provider.\n const layoutMode = useGetLayoutMode() as LayoutMode | undefined;\n\n // xsmall was added after the initial implementation, so we need to make sure it's always present\n // to avoid breaking changes. The xsmall backfill runs first so layoutMode=\"xs\" can pick it up.\n\n const correctSpan = useMemo(() => {\n const backfilled =\n span && typeof span !== 'number' && span.small && !span.xsmall ? { ...span, xsmall: span.small } : span;\n return withLayoutMode ? resolveByLayoutMode(backfilled, layoutMode) : backfilled;\n }, [span, withLayoutMode, layoutMode]);\n\n const correctCols = useMemo(() => {\n const backfilled =\n typeof cols === 'object' && !Array.isArray(cols) && cols.small && !cols.xsmall\n ? { ...cols, xsmall: cols.small }\n : cols;\n return withLayoutMode ? resolveByLayoutMode(backfilled, layoutMode) : backfilled;\n }, [cols, withLayoutMode, layoutMode]);\n\n const correctRows = useMemo(() => {\n const backfilled =\n typeof rows === 'object' && !Array.isArray(rows) && rows.small && !rows.xsmall\n ? { ...rows, xsmall: rows.small }\n : rows;\n return withLayoutMode ? resolveByLayoutMode(backfilled, layoutMode) : backfilled;\n }, [rows, withLayoutMode, layoutMode]);\n\n return (\n <GridItem\n {...rest}\n {...globalProps}\n {...xstyledProps}\n span={correctSpan}\n alignItems={alignItems}\n cols={correctCols}\n gutter={gutter}\n isSpanParent={isSpanParent}\n justify={justify}\n rows={correctRows}\n wrap={wrap}\n childNumber={React.Children.count(children)}\n innerRef={innerRef ?? ref}\n w={width}\n h={height}\n withMaxWidthBreakpoints={withMaxWidthBreakpoints}\n >\n {renderChildren}\n </GridItem>\n );\n});\n\n// Since this component is using ForwardRef, we must provide a displayName to avoid 'undefined' name in propsTable.\nGrid.displayName = DSGridName;\nconst DSGridWithSchema = describe(Grid);\nDSGridWithSchema.propTypes = DSCardHeaderPropTypesSchema;\n\nexport default Grid;\nexport { DSGridWithSchema, Grid };\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACiEnB;AAjEJ,OAAOA,UAAS,eAAe;AAC/B,SAAS,gBAAgB;AACzB,SAAS,wBAAwB;AAEjC,SAAS,mCAAmC;AAC5C,SAAS,gBAAgB;AACzB,SAAS,eAAe;AACxB,SAAS,kBAAkB;AAC3B,SAAS,2BAA4C;AAErD,MAAM,OAAOA,OAAM,WAA0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AAM;AAAA,MACN;AAAA,MACA;AAAA,MACA;AAAA,MACA,MAAM;AAAA,MACN;AAAA,MACA,aAAaA,OAAM,SAAS,MAAM,QAAQ;AAAA,MAC1C,UAAU,YAAY;AAAA,MACtB,GAAG;AAAA,MACH,GAAG;AAAA,MACH;AAAA,MAEC;AAAA;AAAA,EACH;AAEJ,CAAC;AAGD,KAAK,cAAc;AACnB,MAAM,mBAAmB,SAAS,IAAI;AACtC,iBAAiB,YAAY;AAE7B,IAAO,eAAQ;",
6
6
  "names": ["React"]
7
7
  }
@@ -3,8 +3,5 @@
3
3
  "sideEffects": [
4
4
  "*.css",
5
5
  "*.scss"
6
- ],
7
- "publishConfig": {
8
- "access": "public"
9
- }
6
+ ]
10
7
  }
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from "@elliemae/ds-props-helpers";
3
- import { alignItemsPlacement, justifyPlacement, wrap, boxShadow } from "./utils/constants.js";
3
+ import { alignItemsPlacement, boxShadow, justifyPlacement, wrap } from "./utils/constants.js";
4
4
  const defaultProps = {
5
5
  rows: [],
6
6
  cols: [],
@@ -50,6 +50,7 @@ const DSGridPropTypes = {
50
50
  innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]).description("Ref to the grid"),
51
51
  wrap: PropTypes.oneOf(wrap).description("Wrap type").defaultValue(wrap[0]),
52
52
  withMaxWidthBreakpoints: PropTypes.bool.description("weather use max width").defaultValue(void 0),
53
+ withLayoutMode: PropTypes.bool.description("Resolve responsive cols/rows/span from the ancestor DSLayoutProvider mode.").defaultValue(void 0),
53
54
  height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description("Grid height."),
54
55
  width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description("Grid width."),
55
56
  backgroundColor: PropTypes.string.description("Sets background color."),
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/react-desc-prop-types.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type { WeakValidationMap } from 'react';\nimport type React from 'react';\nimport type { GlobalAttributesT, XstyledProps, DSPropTypesSchema } from '@elliemae/ds-props-helpers';\nimport { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from '@elliemae/ds-props-helpers';\nimport { alignItemsPlacement, justifyPlacement, wrap, boxShadow } from './utils/constants.js';\n\nexport declare namespace DSGridT {\n export type RowOrColsSyntaxSugar = string | number | (string | number)[];\n\n export interface RowColBreakpoints {\n xsmall?: RowOrColsSyntaxSugar[];\n small?: RowOrColsSyntaxSugar[];\n medium?: RowOrColsSyntaxSugar[];\n large?: RowOrColsSyntaxSugar[];\n }\n\n export type RowOrColsValidValues = RowOrColsSyntaxSugar | RowColBreakpoints;\n\n export interface SpanBreakpoints {\n xsmall?: number;\n small?: number;\n medium?: number;\n large?: number;\n }\n\n export type JustifyPlacement =\n | 'flex-start'\n | 'center'\n | 'flex-end'\n | 'space-between'\n | 'space-around'\n | 'space-evenly';\n export type AlignItemsPlacement = 'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline' | 'space-between';\n export type Wrap = 'wrap' | 'nowrap' | 'wrap-reverse';\n export type BoxShadow = 'xs' | 's' | 'm' | 'l' | 'xl';\n\n export interface RequiredProps {}\n\n export interface DefaultProps {\n rows: RowOrColsValidValues;\n cols: RowOrColsValidValues;\n className: string;\n justify: JustifyPlacement;\n wrap: Wrap;\n span: number | SpanBreakpoints;\n justifyItems: string;\n }\n\n export interface OptionalProps {\n height?: string | number;\n width?: string | number;\n justifyContent?: JustifyPlacement;\n alignItems?: AlignItemsPlacement;\n alignContent?: AlignItemsPlacement;\n children?: React.ReactNode;\n withMaxWidthBreakpoints?: boolean;\n rowGap?: string | number;\n gutter?: string | number;\n innerRef?: React.MutableRefObject<HTMLDivElement | null> | React.RefCallback<HTMLDivElement>;\n }\n\n // Grid components override some of the global attributes,\n // components inheriting from Grid needs a way to exclude these attributes from GlobalAttributesT\n // in such scenario, they would do\n // Omit<\n // GlobalAttributesT<HTMLDivElement>, keyof DefaultProps | keyof OptionalProps\n // ^ their's namespace own DefaultProps | OptionalProps | ...\n // | keyof GridSpecificGlobalAttributes\n // ^ Grid's overrides\n // >\n // This way, the component will have all the global attributes except the ones that are overridden by Grid and by the component itself\n // in one line: Omit<GlobalAttributesT<HTMLDivElement>, keyof DefaultProps | keyof OptionalProps [ | ... ] | keyof GridSpecificGlobalAttributes>\n export type GridSpecificGlobalAttributes = Omit<\n GlobalAttributesT<HTMLDivElement>,\n keyof DefaultProps | keyof OptionalProps | keyof XstyledProps\n >;\n export type GridSpecificGlobalAttributesGeneric<ElementType = HTMLDivElement> = Omit<\n GlobalAttributesT<ElementType>,\n keyof DefaultProps | keyof OptionalProps | keyof XstyledProps\n >;\n\n export interface Props extends Partial<DefaultProps>, OptionalProps, GridSpecificGlobalAttributes, XstyledProps {}\n\n export interface InternalProps extends DefaultProps, OptionalProps, GridSpecificGlobalAttributes, XstyledProps {}\n\n export interface ItemProps {\n rows: RowOrColsValidValues;\n cols: RowOrColsValidValues;\n alignItems?: AlignItemsPlacement;\n alignContent?: AlignItemsPlacement;\n children: React.ReactNode;\n className?: string;\n justify: JustifyPlacement;\n gutter?: string | number;\n wrap: Wrap;\n childNumber: number;\n isSpanParent: boolean;\n span?: number | SpanBreakpoints;\n withMaxWidthBreakpoints?: boolean;\n }\n}\n\nexport const defaultProps: DSGridT.DefaultProps = {\n rows: [],\n cols: [],\n className: '',\n justify: 'flex-start',\n wrap: 'wrap',\n span: 1,\n justifyItems: 'normal',\n};\n\n// =============================================================================\n// PropTypes\n// =============================================================================\nconst rowColBreakpoints = PropTypes.shape({\n xsmall: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),\n small: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),\n medium: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),\n large: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),\n});\n\nconst spanBreakpoints = PropTypes.shape({\n xsmall: PropTypes.number,\n small: PropTypes.number,\n medium: PropTypes.number,\n large: PropTypes.number,\n});\n\nexport const DSGridPropTypes: DSPropTypesSchema<DSGridT.Props> = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n rows: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),\n PropTypes.number,\n rowColBreakpoints,\n ])\n .description('Row layout cells')\n .defaultValue([]),\n cols: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),\n PropTypes.number,\n rowColBreakpoints,\n ])\n .description('Column layout cells')\n .defaultValue([]),\n span: PropTypes.oneOfType([PropTypes.number, spanBreakpoints]).description(\n 'Expands the grid element within columns.',\n ),\n alignItems: PropTypes.oneOf(alignItemsPlacement).description('flex-like align items prop'),\n children: PropTypes.node.description('Children node inside grid cell'),\n className: PropTypes.string.description('CSS class').defaultValue(''),\n justifyContent: PropTypes.oneOf(justifyPlacement)\n .description('flex-like justify prop')\n .defaultValue(justifyPlacement[0]),\n gutter: PropTypes.oneOfType([PropTypes.number, PropTypes.string])\n .description('Space between cells prop')\n .defaultValue(0),\n justify: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Space between cells prop'),\n justifyItems: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Space between cells prop'),\n alignContent: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Space between cells prop'),\n rowGap: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Space between cells prop'),\n innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]).description('Ref to the grid'),\n wrap: PropTypes.oneOf(wrap).description('Wrap type').defaultValue(wrap[0]),\n withMaxWidthBreakpoints: PropTypes.bool.description('weather use max width').defaultValue(undefined),\n height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Grid height.'),\n width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Grid width.'),\n backgroundColor: PropTypes.string.description('Sets background color.'),\n bg: PropTypes.string.description('Sets background color.'),\n boxShadow: PropTypes.oneOf(boxShadow).description('Sets background color.'),\n border: PropTypes.string.description('Sets border.'),\n borderRadius: PropTypes.string.description('Sets border radius.'),\n borderWidth: PropTypes.string.description('Sets border width.'),\n borderStyle: PropTypes.string.description('Sets border style.'),\n borderColor: PropTypes.string.description('Sets border color.'),\n borderTop: PropTypes.string.description('Sets top border.'),\n borderBottom: PropTypes.string.description('Sets bottom border.'),\n borderLeft: PropTypes.string.description('Sets left border.'),\n borderRight: PropTypes.string.description('Sets right border.'),\n borderTopWidth: PropTypes.string.description('Sets border top width.'),\n borderTopStyle: PropTypes.string.description('Sets border top style.'),\n borderTopColor: PropTypes.string.description('Sets border top color.'),\n borderBottomWidth: PropTypes.string.description('Sets border bottom width.'),\n borderBottomStyle: PropTypes.string.description('Sets border bottom style.'),\n borderBottomColor: PropTypes.string.description('Sets border bottom color.'),\n borderRightWidth: PropTypes.string.description('Sets border right width.'),\n borderRightStyle: PropTypes.string.description('Sets border right style.'),\n borderRightColor: PropTypes.string.description('Sets border right color.'),\n borderLeftWidth: PropTypes.string.description('Sets border left width.'),\n borderLeftStyle: PropTypes.string.description('Sets border left style.'),\n borderLeftColor: PropTypes.string.description('Sets border left color.'),\n};\n\nexport const DSCardHeaderPropTypesSchema = DSGridPropTypes as unknown as WeakValidationMap<DSGridT.Props>;\n\nexport const getGridProps = (props: unknown): Partial<DSGridT.Props> => {\n if (typeof props !== 'object' || props === null) return {};\n const innerProps = props as Record<string, unknown>;\n const innerGridPropTypes = props as Record<keyof DSGridT.Props, unknown>;\n const filteredProps: Partial<DSGridT.Props> = {};\n\n Object.keys(innerProps).forEach((key) => {\n const innerKey = key as keyof DSGridT.Props;\n if (innerGridPropTypes[innerKey] && innerProps[innerKey] !== undefined) {\n filteredProps[innerKey] = innerProps[inn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C;AACtE,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO,CAAC;AACzD,QAAM,aAAa;AACnB,QAAM,qBAAqB;AAC3B,QAAM,gBAAwC,CAAC;AAE/C,SAAO,KAAK,UAAU,EAAE,QAAQ,CAAC,QAAQ;AACvC,UAAM,WAAW;AACjB,QAAI,mBAAmB,QAAQ,KAAK,WAAW,QAAQ,MAAM,QAAW;AACtE,oBAAc,QAAQ,IAAI,WAAW,QAAQ;AAAA,IAC/C;AAAA,EACF,CAAC;AACD,SAAO;AACT;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type { DSPropTypesSchema, GlobalAttributesT, XstyledProps } from '@elliemae/ds-props-helpers';\nimport { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from '@elliemae/ds-props-helpers';\nimport type React from 'react';\nimport type { WeakValidationMap } from 'react';\nimport { alignItemsPlacement, boxShadow, justifyPlacement, wrap } from './utils/constants.js';\n\nexport declare namespace DSGridT {\n export type RowOrColsSyntaxSugar = string | number | (string | number)[];\n\n export interface RowColBreakpoints {\n xsmall?: RowOrColsSyntaxSugar[];\n small?: RowOrColsSyntaxSugar[];\n medium?: RowOrColsSyntaxSugar[];\n large?: RowOrColsSyntaxSugar[];\n }\n\n export type RowOrColsValidValues = RowOrColsSyntaxSugar | RowColBreakpoints;\n\n export interface SpanBreakpoints {\n xsmall?: number;\n small?: number;\n medium?: number;\n large?: number;\n }\n\n export type JustifyPlacement =\n 'start' | 'flex-start' | 'center' | 'end' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly';\n export type AlignItemsPlacement =\n 'start' | 'flex-start' | 'center' | 'end' | 'flex-end' | 'stretch' | 'baseline' | 'space-between';\n export type Wrap = 'wrap' | 'nowrap' | 'wrap-reverse';\n export type BoxShadow = 'xs' | 's' | 'm' | 'l' | 'xl';\n\n export interface RequiredProps {}\n\n export interface DefaultProps {\n rows: RowOrColsValidValues;\n cols: RowOrColsValidValues;\n className: string;\n justify: JustifyPlacement;\n wrap: Wrap;\n span: number | SpanBreakpoints;\n justifyItems: string;\n }\n\n export interface OptionalProps {\n height?: string | number;\n width?: string | number;\n justifyContent?: JustifyPlacement;\n alignItems?: AlignItemsPlacement;\n alignContent?: AlignItemsPlacement;\n children?: React.ReactNode;\n withMaxWidthBreakpoints?: boolean;\n withLayoutMode?: boolean;\n rowGap?: string | number;\n gutter?: string | number;\n innerRef?: React.MutableRefObject<HTMLDivElement | null> | React.RefCallback<HTMLDivElement>;\n // this practically work. Trying to extend the styled itself produces\n // typescript expression produces a union type that is too complex to represent\n // in many places, adding it here lift the typescript computation.\n // harder to mantain, but if we don't lift it, right now we break something else so :shrug:\n as?: keyof React.JSX.IntrinsicElements;\n }\n\n // Grid components override some of the global attributes,\n // components inheriting from Grid needs a way to exclude these attributes from GlobalAttributesT\n // in such scenario, they would do\n // Omit<\n // GlobalAttributesT<HTMLDivElement>, keyof DefaultProps | keyof OptionalProps\n // ^ their's namespace own DefaultProps | OptionalProps | ...\n // | keyof GridSpecificGlobalAttributes\n // ^ Grid's overrides\n // >\n // This way, the component will have all the global attributes except the ones that are overridden by Grid and by the component itself\n // in one line: Omit<GlobalAttributesT<HTMLDivElement>, keyof DefaultProps | keyof OptionalProps [ | ... ] | keyof GridSpecificGlobalAttributes>\n export type GridSpecificGlobalAttributes = Omit<\n GlobalAttributesT<HTMLDivElement>,\n keyof RequiredProps | keyof DefaultProps | keyof OptionalProps | keyof XstyledProps\n >;\n export type GridSpecificGlobalAttributesGeneric<ElementType = HTMLDivElement> = Omit<\n GlobalAttributesT<ElementType>,\n keyof RequiredProps | keyof DefaultProps | keyof OptionalProps | keyof XstyledProps\n >;\n\n export interface Props extends Partial<DefaultProps>, OptionalProps, GridSpecificGlobalAttributes, XstyledProps {}\n\n export interface InternalProps extends DefaultProps, OptionalProps, GridSpecificGlobalAttributes, XstyledProps {}\n\n export interface ItemProps {\n rows: RowOrColsValidValues;\n cols: RowOrColsValidValues;\n alignItems?: AlignItemsPlacement;\n alignContent?: AlignItemsPlacement;\n children: React.ReactNode;\n className?: string;\n justify: JustifyPlacement;\n gutter?: string | number;\n wrap: Wrap;\n childNumber: number;\n isSpanParent: boolean;\n span?: number | SpanBreakpoints;\n withMaxWidthBreakpoints?: boolean;\n }\n}\n\nexport const defaultProps: DSGridT.DefaultProps = {\n rows: [],\n cols: [],\n className: '',\n justify: 'flex-start',\n wrap: 'wrap',\n span: 1,\n justifyItems: 'normal',\n};\n\n// =============================================================================\n// PropTypes\n// =============================================================================\nconst rowColBreakpoints = PropTypes.shape({\n xsmall: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),\n small: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),\n medium: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),\n large: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),\n});\n\nconst spanBreakpoints = PropTypes.shape({\n xsmall: PropTypes.number,\n small: PropTypes.number,\n medium: PropTypes.number,\n large: PropTypes.number,\n});\n\nexport const DSGridPropTypes: DSPropTypesSchema<DSGridT.Props> = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n rows: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),\n PropTypes.number,\n rowColBreakpoints,\n ])\n .description('Row layout cells')\n .defaultValue([]),\n cols: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),\n PropTypes.number,\n rowColBreakpoints,\n ])\n .description('Column layout cells')\n .defaultValue([]),\n span: PropTypes.oneOfType([PropTypes.number, spanBreakpoints]).description(\n 'Expands the grid element within columns.',\n ),\n alignItems: PropTypes.oneOf(alignItemsPlacement).description('flex-like align items prop'),\n children: PropTypes.node.description('Children node inside grid cell'),\n className: PropTypes.string.description('CSS class').defaultValue(''),\n justifyContent: PropTypes.oneOf(justifyPlacement)\n .description('flex-like justify prop')\n .defaultValue(justifyPlacement[0]),\n gutter: PropTypes.oneOfType([PropTypes.number, PropTypes.string])\n .description('Space between cells prop')\n .defaultValue(0),\n justify: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Space between cells prop'),\n justifyItems: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Space between cells prop'),\n alignContent: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Space between cells prop'),\n rowGap: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Space between cells prop'),\n innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]).description('Ref to the grid'),\n wrap: PropTypes.oneOf(wrap).description('Wrap type').defaultValue(wrap[0]),\n withMaxWidthBreakpoints: PropTypes.bool.description('weather use max width').defaultValue(undefined),\n withLayoutMode: PropTypes.bool\n .description('Resolve responsive cols/rows/span from the ancestor DSLayoutProvider mode.')\n .defaultValue(undefined),\n height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Grid height.'),\n width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Grid width.'),\n backgroundColor: PropTypes.string.description('Sets background color.'),\n bg: PropTypes.string.description('Sets background color.'),\n boxShadow: PropTypes.oneOf(boxShadow).description('Sets background color.'),\n border: PropTypes.string.description('Sets border.'),\n borderRadius: PropTypes.string.description('Sets border radius.'),\n borderWidth: PropTypes.string.description('Sets border width.'),\n borderStyle: PropTypes.string.description('Sets border style.'),\n borderColor: PropTypes.string.description('Sets border color.'),\n borderTop: PropTypes.string.description('Sets top border.'),\n borderBottom: PropTypes.string.description('Sets bottom border.'),\n borderLeft: PropTypes.string.description('Sets left border.'),\n borderRight: PropTypes.string.description('Sets right border.'),\n borderTopWidth: PropTypes.string.description('Sets border top width.'),\n borderTopStyle: PropTypes.string.description('Sets border top style.'),\n borderTopColor: PropTypes.string.description('Sets border top color.'),\n borderBottomWidth: PropTypes.string.description('Sets border bottom width.'),\n borderBottomStyle: PropTypes.string.description('Sets border bottom style.'),\n borderBottomColor: PropTypes.string.description('Sets border bottom color.'),\n borderRightWidth: PropTypes.string.description('Sets border right width.'),\n borderRightStyle: PropTypes.string.description('Sets border right style.'),\n borderRightColor: PropTypes.string.description('Sets border right color.'),\n borderLeftWidth: PropTypes.string.description('Sets border left width.'),\n borderLeftStyle: PropTypes.string.description('Sets border left style.'),\n borderLeftColor: PropTypes.string.description('Sets border left color.'),\n};\n\nexport const DSCardHeaderPropTypesSchema = DSGridPropTypes as unknown as WeakValidationMap<DSGridT.Props>;\n\nexport const getGridProps = (props: unknown): Partial<DSGridT.Props> => {\n if (typeof props !== 'object' || props === null) return {};\n const innerProps = props as Record<string, unknown>;\n const innerGridPropTypes = props as Record<keyof DSGridT.Props, unknown>;\n const filteredProps: Partial<DSGridT.Props> = {};\n\n Object.keys(innerProps).forEach((key) => {\n const innerKey = key as keyof DSGridT.Props;\n if (innerGridPropTypes[innerKey] && innerProps[innerKey] !== undefined) {\n filteredProps[innerKey] = innerProps[innerKey];\n }\n });\n return filteredProps;\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,WAAW,2BAA2B,wBAAwB;AAGvE,SAAS,qBAAqB,WAAW,kBAAkB,YAAY;AAoGhE,MAAM,eAAqC;AAAA,EAChD,MAAM,CAAC;AAAA,EACP,MAAM,CAAC;AAAA,EACP,WAAW;AAAA,EACX,SAAS;AAAA,EACT,MAAM;AAAA,EACN,MAAM;AAAA,EACN,cAAc;AAChB;AAKA,MAAM,oBAAoB,UAAU,MAAM;AAAA,EACxC,QAAQ,UAAU,QAAQ,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,MAAM,CAAC,CAAC;AAAA,EACnF,OAAO,UAAU,QAAQ,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,MAAM,CAAC,CAAC;AAAA,EAClF,QAAQ,UAAU,QAAQ,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,MAAM,CAAC,CAAC;AAAA,EACnF,OAAO,UAAU,QAAQ,UAAU,UAA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C5D,aAAa,UAAU,OAAO,YAAY,oBAAoB;AAAA,EAC9D,gBAAgB,UAAU,OAAO,YAAY,wBAAwB;AAAA,EACrE,gBAAgB,UAAU,OAAO,YAAY,wBAAwB;AAAA,EACrE,gBAAgB,UAAU,OAAO,YAAY,wBAAwB;AAAA,EACrE,mBAAmB,UAAU,OAAO,YAAY,2BAA2B;AAAA,EAC3E,mBAAmB,UAAU,OAAO,YAAY,2BAA2B;AAAA,EAC3E,mBAAmB,UAAU,OAAO,YAAY,2BAA2B;AAAA,EAC3E,kBAAkB,UAAU,OAAO,YAAY,0BAA0B;AAAA,EACzE,kBAAkB,UAAU,OAAO,YAAY,0BAA0B;AAAA,EACzE,kBAAkB,UAAU,OAAO,YAAY,0BAA0B;AAAA,EACzE,iBAAiB,UAAU,OAAO,YAAY,yBAAyB;AAAA,EACvE,iBAAiB,UAAU,OAAO,YAAY,yBAAyB;AAAA,EACvE,iBAAiB,UAAU,OAAO,YAAY,yBAAyB;AACzE;AAEO,MAAM,8BAA8B;AAEpC,MAAM,eAAe,CAAC,UAA2C;AACtE,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO,CAAC;AACzD,QAAM,aAAa;AACnB,QAAM,qBAAqB;AAC3B,QAAM,gBAAwC,CAAC;AAE/C,SAAO,KAAK,UAAU,EAAE,QAAQ,CAAC,QAAQ;AACvC,UAAM,WAAW;AACjB,QAAI,mBAAmB,QAAQ,KAAK,WAAW,QAAQ,MAAM,QAAW;AACtE,oBAAc,QAAQ,IAAI,WAAW,QAAQ;AAAA,IAC/C;AAAA,EACF,CAAC;AACD,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -9,6 +9,7 @@ const testOptionalProps = {
9
9
  alignItems: "flex-start",
10
10
  children: /* @__PURE__ */ jsx("div", { children: "hey" }),
11
11
  withMaxWidthBreakpoints: false,
12
+ withLayoutMode: true,
12
13
  rowGap: "xs",
13
14
  gutter: "xs"
14
15
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/typescript-testing/typescript-grid-valid.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { Grid } from '../index.js';\nimport type { DSGridT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSGridT.Props;\ntype ComponentPropsInternals = DSGridT.InternalProps;\ntype ComponentPropsDefaultProps = DSGridT.DefaultProps;\ntype ComponentPropsOptionalProps = DSGridT.OptionalProps;\ntype ComponentPropsRequiredProps = DSGridT.RequiredProps;\n\nconst testRequiredProps: ComponentPropsRequiredProps = {};\nconst testOptionalProps: ComponentPropsOptionalProps = {\n height: 0,\n width: 0,\n justifyContent: 'flex-start',\n alignItems: 'flex-start',\n children: <div>hey</div>,\n withMaxWidthBreakpoints: false,\n rowGap: 'xs',\n gutter: 'xs',\n};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {\n rows: [],\n cols: [],\n span: 2,\n justifyItems: 'flex-start',\n};\nconst testProps: ComponentPropsForApp = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n};\nconst testPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n rows: [],\n cols: [],\n span: 2,\n justifyItems: 'flex-start',\n className: '',\n justify: 'flex-start',\n wrap: 'nowrap',\n};\nconst testInternalProps: ComponentPropsInternals = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\nconst testInternalPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n cols: { small: ['1fr', '1fr', '1fr'], medium: ['5fr', '1fr', '1fr'], large: ['1fr', '4fr', '1fr'] },\n rows: { small: ['1fr', '1fr', '1fr'], medium: ['5fr', '1fr', '1fr'], large: ['1fr', '4fr', '1fr'] },\n span: { small: 2, medium: 3, large: 1 },\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n rows: [1, 2, 3],\n justifyContent: 'center',\n border: '1px solid black',\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n alignItems: 'center',\n gutter: 'xs',\n bg: 'brand-100',\n borderTopColor: 'neutral-100-a10',\n borderLeftColor: '#141414',\n borderRightColor: 'rgba(0,0,0,0.5)',\n borderBottomColor: 'rgb(0,0,0)',\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <Grid {...testExplicitDefinition} />\n <Grid {...testInferedTypeCompatibility} />\n <Grid {...testDefinitionAsConst} />\n {/* works with inline values */}\n <Grid rows={[1, 2, 3]} justifyContent=\"center\" border=\"1px solid black\" />\n </>\n);\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACiBX,SAsEV,UAtEU,KAsEV,YAtEU;AAhBZ,SAAS,YAAY;AAUrB,MAAM,oBAAiD,CAAC;AACxD,MAAM,oBAAiD;AAAA,EACrD,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,gBAAgB;AAAA,EAChB,YAAY;AAAA,EACZ,UAAU,oBAAC,SAAI,iBAAG;AAAA,EAClB,yBAAyB;AAAA,EACzB,QAAQ;AAAA,EACR,QAAQ;AACV;AAIA,MAAM,sBAA2D;AAAA,EAC/D,MAAM,CAAC;AAAA,EACP,MAAM,CAAC;AAAA,EACP,MAAM;AAAA,EACN,cAAc;AAChB;AACA,MAAM,YAAkC;AAAA,EACtC,GAAG;AAAA,EACH,GAAG;AAAA,EACH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BAAe,UAAS,QAAO,mBAAkB;AAAA,GAC1E;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { Grid } from '../index.js';\nimport type { DSGridT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSGridT.Props;\ntype ComponentPropsInternals = DSGridT.InternalProps;\ntype ComponentPropsDefaultProps = DSGridT.DefaultProps;\ntype ComponentPropsOptionalProps = DSGridT.OptionalProps;\ntype ComponentPropsRequiredProps = DSGridT.RequiredProps;\n\nconst testRequiredProps: ComponentPropsRequiredProps = {};\nconst testOptionalProps: ComponentPropsOptionalProps = {\n height: 0,\n width: 0,\n justifyContent: 'flex-start',\n alignItems: 'flex-start',\n children: <div>hey</div>,\n withMaxWidthBreakpoints: false,\n withLayoutMode: true,\n rowGap: 'xs',\n gutter: 'xs',\n};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {\n rows: [],\n cols: [],\n span: 2,\n justifyItems: 'flex-start',\n};\nconst testProps: ComponentPropsForApp = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n};\nconst testPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n rows: [],\n cols: [],\n span: 2,\n justifyItems: 'flex-start',\n className: '',\n justify: 'flex-start',\n wrap: 'nowrap',\n};\nconst testInternalProps: ComponentPropsInternals = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\nconst testInternalPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n cols: { small: ['1fr', '1fr', '1fr'], medium: ['5fr', '1fr', '1fr'], large: ['1fr', '4fr', '1fr'] },\n rows: { small: ['1fr', '1fr', '1fr'], medium: ['5fr', '1fr', '1fr'], large: ['1fr', '4fr', '1fr'] },\n span: { small: 2, medium: 3, large: 1 },\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n rows: [1, 2, 3],\n justifyContent: 'center',\n border: '1px solid black',\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n alignItems: 'center',\n gutter: 'xs',\n bg: 'brand-100',\n borderTopColor: 'neutral-100-a10',\n borderLeftColor: '#141414',\n borderRightColor: 'rgba(0,0,0,0.5)',\n borderBottomColor: 'rgb(0,0,0)',\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <Grid {...testExplicitDefinition} />\n <Grid {...testInferedTypeCompatibility} />\n <Grid {...testDefinitionAsConst} />\n {/* works with inline values */}\n <Grid rows={[1, 2, 3]} justifyContent=\"center\" border=\"1px solid black\" />\n </>\n);\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACiBX,SAuEV,UAvEU,KAuEV,YAvEU;AAhBZ,SAAS,YAAY;AAUrB,MAAM,oBAAiD,CAAC;AACxD,MAAM,oBAAiD;AAAA,EACrD,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,gBAAgB;AAAA,EAChB,YAAY;AAAA,EACZ,UAAU,oBAAC,SAAI,iBAAG;AAAA,EAClB,yBAAyB;AAAA,EACzB,gBAAgB;AAAA,EAChB,QAAQ;AAAA,EACR,QAAQ;AACV;AAIA,MAAM,sBAA2D;AAAA,EAC/D,MAAM,CAAC;AAAA,EACP,MAAM,CAAC;AAAA,EACP,MAAM;AAAA,EACN,cAAc;AAChB;AACA,MAAM,YAAkC;AAAA,EACtC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAC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S,QAAO,mBAAkB;AAAA,GAC1E;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,32 @@
1
+ import * as React from "react";
2
+ const LAYOUT_MODE_TO_BREAKPOINT = {
3
+ xs: "xsmall",
4
+ s: "small",
5
+ m: "medium",
6
+ l: "large"
7
+ };
8
+ const BREAKPOINT_ORDER = ["xsmall", "small", "medium", "large"];
9
+ const isBreakpointObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
10
+ const pickForLayoutMode = (value, layoutMode) => {
11
+ const targetIndex = BREAKPOINT_ORDER.indexOf(LAYOUT_MODE_TO_BREAKPOINT[layoutMode]);
12
+ if (targetIndex < 0) return value;
13
+ for (let i = targetIndex; i >= 0; i -= 1) {
14
+ const candidate = value[BREAKPOINT_ORDER[i]];
15
+ if (candidate !== void 0) return candidate;
16
+ }
17
+ for (let i = targetIndex + 1; i < BREAKPOINT_ORDER.length; i += 1) {
18
+ const candidate = value[BREAKPOINT_ORDER[i]];
19
+ if (candidate !== void 0) return candidate;
20
+ }
21
+ return value;
22
+ };
23
+ function resolveByLayoutMode(value, layoutMode) {
24
+ if (!layoutMode || !isBreakpointObject(value)) return value;
25
+ return pickForLayoutMode(value, layoutMode);
26
+ }
27
+ export {
28
+ BREAKPOINT_ORDER,
29
+ LAYOUT_MODE_TO_BREAKPOINT,
30
+ resolveByLayoutMode
31
+ };
32
+ //# sourceMappingURL=resolveLayoutMode.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/utils/resolveLayoutMode.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type { DSGridT } from '../react-desc-prop-types.js';\n\n// The layout modes exposed by DSLayoutProvider (injected into the styled-components theme\n// and read via useGetLayoutMode from @elliemae/ds-system). Kept as a local literal union so\n// ds-grid does not take a (type or runtime) dependency on ds-layout-provider.\nexport type LayoutMode = 'xs' | 's' | 'm' | 'l';\n\n// The breakpoint keys a Grid cols/rows/span definition may declare.\ntype BreakpointKey = keyof DSGridT.RowColBreakpoints;\n\n// Clean 4 -> 4 mapping between a LayoutProvider mode and the Grid breakpoint it selects.\nexport const LAYOUT_MODE_TO_BREAKPOINT: Record<LayoutMode, BreakpointKey> = {\n xs: 'xsmall',\n s: 'small',\n m: 'medium',\n l: 'large',\n};\n\n// Ordered smallest -> largest. Used for the partial-definition fallback below.\nexport const BREAKPOINT_ORDER: BreakpointKey[] = ['xsmall', 'small', 'medium', 'large'];\n\n// A breakpoint definition is an object that is not an array (arrays are the \"flat\" cols/rows\n// syntax and numbers/strings are scalar definitions - none of those are layoutMode-driven).\nconst isBreakpointObject = (value: unknown): value is Partial<Record<BreakpointKey, unknown>> =>\n typeof value === 'object' && value !== null && !Array.isArray(value);\n\nconst pickForLayoutMode = (value: Partial<Record<BreakpointKey, unknown>>, layoutMode: LayoutMode): unknown => {\n const targetIndex = BREAKPOINT_ORDER.indexOf(LAYOUT_MODE_TO_BREAKPOINT[layoutMode]);\n // Unknown / unsupported mode -> leave the definition untouched.\n if (targetIndex < 0) return value;\n\n // Breakpoint objects may be partial (e.g. only { small, large } defined). We resolve to a\n // single predictable value: the exact key if present, otherwise the nearest DEFINED key\n // walking down toward xsmall, and only then the nearest one walking up toward large.\n for (let i = targetIndex; i >= 0; i -= 1) {\n const candidate = value[BREAKPOINT_ORDER[i]];\n if (candidate !== undefined) return candidate;\n }\n for (let i = targetIndex + 1; i < BREAKPOINT_ORDER.length; i += 1) {\n const candidate = value[BREAKPOINT_ORDER[i]];\n if (candidate !== undefined) return candidate;\n }\n // The object declared no usable breakpoint -> no-op.\n return value;\n};\n\n/**\n * Collapse a responsive cols/rows/span definition down to the single value selected by the\n * ancestor DSLayoutProvider's layoutMode, so the Grid lays out for the container it lives in\n * instead of the viewport.\n *\n * Only breakpoint OBJECTS are affected: arrays, numbers and strings pass through untouched, and\n * when there is no layoutMode in context we return the value as-is so the Grid keeps its\n * existing viewport (media-query) behavior. This is what makes the feature safe and opt-in.\n */\nexport function resolveByLayoutMode(\n value: DSGridT.RowOrColsValidValues,\n layoutMode: LayoutMode | undefined,\n): DSGridT.RowOrColsValidValues;\nexport function resolveByLayoutMode(\n value: number | DSGridT.SpanBreakpoints,\n layoutMode: LayoutMode | undefined,\n): number | DSGridT.SpanBreakpoints;\nexport function resolveByLayoutMode(value: unknown, layoutMode: LayoutMode | undefined): unknown {\n if (!layoutMode || !isBreakpointObject(value)) return value;\n return pickForLayoutMode(value, layoutMode);\n}\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACWhB,MAAM,4BAA+D;AAAA,EAC1E,IAAI;AAAA,EACJ,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGO,MAAM,mBAAoC,CAAC,UAAU,SAAS,UAAU,OAAO;AAItF,MAAM,qBAAqB,CAAC,UAC1B,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAErE,MAAM,oBAAoB,CAAC,OAAgD,eAAoC;AAC7G,QAAM,cAAc,iBAAiB,QAAQ,0BAA0B,UAAU,CAAC;AAElF,MAAI,cAAc,EAAG,QAAO;AAK5B,WAAS,IAAI,aAAa,KAAK,GAAG,KAAK,GAAG;AACxC,UAAM,YAAY,MAAM,iBAAiB,CAAC,CAAC;AAC3C,QAAI,cAAc,OAAW,QAAO;AAAA,EACtC;AACA,WAAS,IAAI,cAAc,GAAG,IAAI,iBAAiB,QAAQ,KAAK,GAAG;AACjE,UAAM,YAAY,MAAM,iBAAiB,CAAC,CAAC;AAC3C,QAAI,cAAc,OAAW,QAAO;AAAA,EACtC;AAEA,SAAO;AACT;AAmBO,SAAS,oBAAoB,OAAgB,YAA6C;AAC/F,MAAI,CAAC,cAAc,CAAC,mBAAmB,KAAK,EAAG,QAAO;AACtD,SAAO,kBAAkB,OAAO,UAAU;AAC5C;",
6
+ "names": []
7
+ }
@@ -1,9 +1,19 @@
1
1
  import type { DSGridT } from '../react-desc-prop-types.js';
2
2
  export declare const useGrid: (props: DSGridT.Props) => {
3
3
  propsWithDefaults: DSGridT.InternalProps;
4
- globalProps: Partial<Pick<object, "wrap" | "form" | "list" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "hidden" | "id" | "lang" | "nonce" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "content" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "exportparts" | "part" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "async" | "autoComplete" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "cite" | "classID" | "cols" | "colSpan" | "controls" | "coords" | "crossOrigin" | "data" | "dateTime" | "default" | "defer" | "disabled" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "label" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "multiple" | "muted" | "name" | "noValidate" | "open" | "optimum" | "pattern" | "placeholder" | "playsInline" | "poster" | "preload" | "readOnly" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "size" | "sizes" | "span" | "src" | "srcDoc" | "srcLang" | "srcSet" | "start" | "step" | "summary" | "target" | "type" | "useMap" | "value" | "width" | "wmode"> & Omit<{
4
+ globalProps: Partial<Pick<object, "wrap" | "start" | "cite" | "data" | "form" | "label" | "slot" | "span" | "style" | "summary" | "title" | "pattern" | "list" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "hidden" | "id" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "content" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "exportparts" | "part" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "async" | "autoComplete" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "classID" | "cols" | "colSpan" | "controls" | "coords" | "crossOrigin" | "dateTime" | "default" | "defer" | "disabled" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "multiple" | "muted" | "name" | "noValidate" | "open" | "optimum" | "placeholder" | "playsInline" | "poster" | "preload" | "readOnly" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "size" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "step" | "target" | "type" | "useMap" | "value" | "width" | "wmode"> & Omit<{
5
5
  wrap?: string | undefined | undefined;
6
+ start?: number | undefined | undefined;
7
+ cite?: string | undefined | undefined;
8
+ data?: string | undefined | undefined;
6
9
  form?: string | undefined | undefined;
10
+ label?: string | undefined | undefined;
11
+ slot?: string | undefined | undefined;
12
+ span?: number | undefined | undefined;
13
+ style?: import("react").CSSProperties | undefined;
14
+ summary?: string | undefined | undefined;
15
+ title?: string | undefined | undefined;
16
+ pattern?: string | undefined | undefined;
7
17
  list?: string | undefined | undefined;
8
18
  "aria-activedescendant"?: string | undefined | undefined;
9
19
  "aria-atomic"?: (boolean | "true" | "false") | undefined;
@@ -234,11 +244,8 @@ export declare const useGrid: (props: DSGridT.Props) => {
234
244
  id?: string | undefined | undefined;
235
245
  lang?: string | undefined | undefined;
236
246
  nonce?: string | undefined | undefined;
237
- slot?: string | undefined | undefined;
238
247
  spellCheck?: (boolean | "true" | "false") | undefined;
239
- style?: import("react").CSSProperties | undefined;
240
248
  tabIndex?: 0 | -1 | undefined;
241
- title?: string | undefined | undefined;
242
249
  translate?: "yes" | "no" | undefined | undefined;
243
250
  radioGroup?: string | undefined | undefined;
244
251
  role?: import("react").AriaRole | undefined;
@@ -283,14 +290,12 @@ export declare const useGrid: (props: DSGridT.Props) => {
283
290
  charSet?: string | undefined | undefined;
284
291
  challenge?: string | undefined | undefined;
285
292
  checked?: boolean | undefined | undefined;
286
- cite?: string | undefined | undefined;
287
293
  classID?: string | undefined | undefined;
288
294
  cols?: number | undefined | undefined;
289
295
  colSpan?: number | undefined | undefined;
290
296
  controls?: boolean | undefined | undefined;
291
297
  coords?: string | undefined | undefined;
292
298
  crossOrigin?: "" | "anonymous" | "use-credentials" | undefined;
293
- data?: string | undefined | undefined;
294
299
  dateTime?: string | undefined | undefined;
295
300
  default?: boolean | undefined | undefined;
296
301
  defer?: boolean | undefined | undefined;
@@ -314,7 +319,6 @@ export declare const useGrid: (props: DSGridT.Props) => {
314
319
  keyParams?: string | undefined | undefined;
315
320
  keyType?: string | undefined | undefined;
316
321
  kind?: string | undefined | undefined;
317
- label?: string | undefined | undefined;
318
322
  loop?: boolean | undefined | undefined;
319
323
  low?: number | undefined | undefined;
320
324
  manifest?: string | undefined | undefined;
@@ -333,7 +337,6 @@ export declare const useGrid: (props: DSGridT.Props) => {
333
337
  noValidate?: boolean | undefined | undefined;
334
338
  open?: boolean | undefined | undefined;
335
339
  optimum?: number | undefined | undefined;
336
- pattern?: string | undefined | undefined;
337
340
  placeholder?: string | undefined | undefined;
338
341
  playsInline?: boolean | undefined | undefined;
339
342
  poster?: string | undefined | undefined;
@@ -352,14 +355,11 @@ export declare const useGrid: (props: DSGridT.Props) => {
352
355
  shape?: string | undefined | undefined;
353
356
  size?: number | undefined | undefined;
354
357
  sizes?: string | undefined | undefined;
355
- span?: number | undefined | undefined;
356
358
  src?: string | undefined | undefined;
357
359
  srcDoc?: string | undefined | undefined;
358
360
  srcLang?: string | undefined | undefined;
359
361
  srcSet?: string | undefined | undefined;
360
- start?: number | undefined | undefined;
361
362
  step?: number | string | undefined | undefined;
362
- summary?: string | undefined | undefined;
363
363
  target?: string | undefined | undefined;
364
364
  type?: string | undefined | undefined;
365
365
  useMap?: string | undefined | undefined;
@@ -1,6 +1,6 @@
1
- import type { WeakValidationMap } from 'react';
1
+ import type { DSPropTypesSchema, GlobalAttributesT, XstyledProps } from '@elliemae/ds-props-helpers';
2
2
  import type React from 'react';
3
- import type { GlobalAttributesT, XstyledProps, DSPropTypesSchema } from '@elliemae/ds-props-helpers';
3
+ import type { WeakValidationMap } from 'react';
4
4
  export declare namespace DSGridT {
5
5
  type RowOrColsSyntaxSugar = string | number | (string | number)[];
6
6
  interface RowColBreakpoints {
@@ -16,8 +16,8 @@ export declare namespace DSGridT {
16
16
  medium?: number;
17
17
  large?: number;
18
18
  }
19
- type JustifyPlacement = 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly';
20
- type AlignItemsPlacement = 'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline' | 'space-between';
19
+ type JustifyPlacement = 'start' | 'flex-start' | 'center' | 'end' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly';
20
+ type AlignItemsPlacement = 'start' | 'flex-start' | 'center' | 'end' | 'flex-end' | 'stretch' | 'baseline' | 'space-between';
21
21
  type Wrap = 'wrap' | 'nowrap' | 'wrap-reverse';
22
22
  type BoxShadow = 'xs' | 's' | 'm' | 'l' | 'xl';
23
23
  interface RequiredProps {
@@ -39,12 +39,14 @@ export declare namespace DSGridT {
39
39
  alignContent?: AlignItemsPlacement;
40
40
  children?: React.ReactNode;
41
41
  withMaxWidthBreakpoints?: boolean;
42
+ withLayoutMode?: boolean;
42
43
  rowGap?: string | number;
43
44
  gutter?: string | number;
44
45
  innerRef?: React.MutableRefObject<HTMLDivElement | null> | React.RefCallback<HTMLDivElement>;
46
+ as?: keyof React.JSX.IntrinsicElements;
45
47
  }
46
- type GridSpecificGlobalAttributes = Omit<GlobalAttributesT<HTMLDivElement>, keyof DefaultProps | keyof OptionalProps | keyof XstyledProps>;
47
- type GridSpecificGlobalAttributesGeneric<ElementType = HTMLDivElement> = Omit<GlobalAttributesT<ElementType>, keyof DefaultProps | keyof OptionalProps | keyof XstyledProps>;
48
+ type GridSpecificGlobalAttributes = Omit<GlobalAttributesT<HTMLDivElement>, keyof RequiredProps | keyof DefaultProps | keyof OptionalProps | keyof XstyledProps>;
49
+ type GridSpecificGlobalAttributesGeneric<ElementType = HTMLDivElement> = Omit<GlobalAttributesT<ElementType>, keyof RequiredProps | keyof DefaultProps | keyof OptionalProps | keyof XstyledProps>;
48
50
  interface Props extends Partial<DefaultProps>, OptionalProps, GridSpecificGlobalAttributes, XstyledProps {
49
51
  }
50
52
  interface InternalProps extends DefaultProps, OptionalProps, GridSpecificGlobalAttributes, XstyledProps {
@@ -0,0 +1,17 @@
1
+ import type { DSGridT } from '../react-desc-prop-types.js';
2
+ export type LayoutMode = 'xs' | 's' | 'm' | 'l';
3
+ type BreakpointKey = keyof DSGridT.RowColBreakpoints;
4
+ export declare const LAYOUT_MODE_TO_BREAKPOINT: Record<LayoutMode, BreakpointKey>;
5
+ export declare const BREAKPOINT_ORDER: BreakpointKey[];
6
+ /**
7
+ * Collapse a responsive cols/rows/span definition down to the single value selected by the
8
+ * ancestor DSLayoutProvider's layoutMode, so the Grid lays out for the container it lives in
9
+ * instead of the viewport.
10
+ *
11
+ * Only breakpoint OBJECTS are affected: arrays, numbers and strings pass through untouched, and
12
+ * when there is no layoutMode in context we return the value as-is so the Grid keeps its
13
+ * existing viewport (media-query) behavior. This is what makes the feature safe and opt-in.
14
+ */
15
+ export declare function resolveByLayoutMode(value: DSGridT.RowOrColsValidValues, layoutMode: LayoutMode | undefined): DSGridT.RowOrColsValidValues;
16
+ export declare function resolveByLayoutMode(value: number | DSGridT.SpanBreakpoints, layoutMode: LayoutMode | undefined): number | DSGridT.SpanBreakpoints;
17
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-grid",
3
- "version": "3.70.0-next.7",
3
+ "version": "3.70.0-next.71",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Grid",
6
6
  "files": [
@@ -22,7 +22,7 @@
22
22
  ],
23
23
  "repository": {
24
24
  "type": "git",
25
- "url": "https://git.elliemae.io/platform-ui/dimsum.git"
25
+ "url": "https://github.com/intcx/PLATFORM-UI.dimsum.git"
26
26
  },
27
27
  "engines": {
28
28
  "pnpm": ">=9",
@@ -37,23 +37,23 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@xstyled/system": "~3.8.1",
40
- "@elliemae/ds-props-helpers": "3.70.0-next.7",
41
- "@elliemae/ds-system": "3.70.0-next.7"
40
+ "@elliemae/ds-props-helpers": "3.70.0-next.71",
41
+ "@elliemae/ds-system": "3.70.0-next.71"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@elliemae/pui-theme": "~2.13.0",
45
45
  "jest": "^30.0.0",
46
46
  "react-test-renderer": "^18.3.1",
47
- "styled-components": "~5.3.9",
48
- "@elliemae/ds-monorepo-devops": "3.70.0-next.7",
49
- "@elliemae/ds-test-utils": "3.70.0-next.7"
47
+ "styled-components": "~5.3.11",
48
+ "@elliemae/ds-monorepo-devops": "3.70.0-next.71",
49
+ "@elliemae/ds-test-utils": "3.70.0-next.71"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "@elliemae/pui-theme": "~2.13.0",
53
- "lodash-es": "^4.17.21",
53
+ "lodash-es": "^4.18.1",
54
54
  "react": "^18.3.1",
55
55
  "react-dom": "^18.3.1",
56
- "styled-components": "~5.3.9",
56
+ "styled-components": "~5.3.11",
57
57
  "styled-system": "^5.1.5"
58
58
  },
59
59
  "publishConfig": {
@@ -69,4 +69,4 @@
69
69
  "build": "cross-env NODE_ENV=production node ../../../scripts/build/build.mjs",
70
70
  "checkDeps": "npx -yes ../../util/ds-codemods check-missing-packages --projectFolderPath=\"./\" --ignorePackagesGlobPattern=\"\" --ignoreFilesGlobPattern=\"**/test-ables/*,**/tests/*\""
71
71
  }
72
- }
72
+ }
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};