@cloudscape-design/components-themeable 3.0.315 → 3.0.317

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/lib/internal/manifest.json +1 -1
  2. package/lib/internal/scss/column-layout/flexible-column-layout/styles.scss +27 -0
  3. package/lib/internal/scss/expandable-section/styles.scss +11 -18
  4. package/lib/internal/scss/split-panel/styles.scss +2 -0
  5. package/lib/internal/template/alert/internal.d.ts.map +1 -1
  6. package/lib/internal/template/alert/internal.js +5 -1
  7. package/lib/internal/template/alert/internal.js.map +1 -1
  8. package/lib/internal/template/breadcrumb-group/item/item.d.ts.map +1 -1
  9. package/lib/internal/template/breadcrumb-group/item/item.js +7 -5
  10. package/lib/internal/template/breadcrumb-group/item/item.js.map +1 -1
  11. package/lib/internal/template/column-layout/flexible-column-layout/index.d.ts +9 -0
  12. package/lib/internal/template/column-layout/flexible-column-layout/index.d.ts.map +1 -0
  13. package/lib/internal/template/column-layout/flexible-column-layout/index.js +33 -0
  14. package/lib/internal/template/column-layout/flexible-column-layout/index.js.map +1 -0
  15. package/lib/internal/template/column-layout/flexible-column-layout/styles.css.js +10 -0
  16. package/lib/internal/template/column-layout/flexible-column-layout/styles.scoped.css +24 -0
  17. package/lib/internal/template/column-layout/flexible-column-layout/styles.selectors.js +11 -0
  18. package/lib/internal/template/column-layout/grid-column-layout.d.ts +10 -0
  19. package/lib/internal/template/column-layout/grid-column-layout.d.ts.map +1 -0
  20. package/lib/internal/template/column-layout/grid-column-layout.js +32 -0
  21. package/lib/internal/template/column-layout/grid-column-layout.js.map +1 -0
  22. package/lib/internal/template/column-layout/index.d.ts.map +1 -1
  23. package/lib/internal/template/column-layout/index.js +2 -4
  24. package/lib/internal/template/column-layout/index.js.map +1 -1
  25. package/lib/internal/template/column-layout/interfaces.d.ts +11 -0
  26. package/lib/internal/template/column-layout/interfaces.d.ts.map +1 -1
  27. package/lib/internal/template/column-layout/interfaces.js.map +1 -1
  28. package/lib/internal/template/column-layout/internal.d.ts +2 -3
  29. package/lib/internal/template/column-layout/internal.d.ts.map +1 -1
  30. package/lib/internal/template/column-layout/internal.js +6 -27
  31. package/lib/internal/template/column-layout/internal.js.map +1 -1
  32. package/lib/internal/template/expandable-section/expandable-section-header.d.ts +4 -1
  33. package/lib/internal/template/expandable-section/expandable-section-header.d.ts.map +1 -1
  34. package/lib/internal/template/expandable-section/expandable-section-header.js +19 -10
  35. package/lib/internal/template/expandable-section/expandable-section-header.js.map +1 -1
  36. package/lib/internal/template/expandable-section/interfaces.d.ts +11 -3
  37. package/lib/internal/template/expandable-section/interfaces.d.ts.map +1 -1
  38. package/lib/internal/template/expandable-section/interfaces.js.map +1 -1
  39. package/lib/internal/template/expandable-section/internal.d.ts +1 -1
  40. package/lib/internal/template/expandable-section/internal.d.ts.map +1 -1
  41. package/lib/internal/template/expandable-section/internal.js +2 -2
  42. package/lib/internal/template/expandable-section/internal.js.map +1 -1
  43. package/lib/internal/template/expandable-section/styles.css.js +26 -24
  44. package/lib/internal/template/expandable-section/styles.scoped.css +50 -58
  45. package/lib/internal/template/expandable-section/styles.selectors.js +26 -24
  46. package/lib/internal/template/flashbar/flash.d.ts.map +1 -1
  47. package/lib/internal/template/flashbar/flash.js +6 -2
  48. package/lib/internal/template/flashbar/flash.js.map +1 -1
  49. package/lib/internal/template/form-field/internal.d.ts.map +1 -1
  50. package/lib/internal/template/form-field/internal.js +8 -10
  51. package/lib/internal/template/form-field/internal.js.map +1 -1
  52. package/lib/internal/template/header/internal.d.ts.map +1 -1
  53. package/lib/internal/template/header/internal.js +2 -1
  54. package/lib/internal/template/header/internal.js.map +1 -1
  55. package/lib/internal/template/internal/analytics/components/analytics-funnel.d.ts.map +1 -1
  56. package/lib/internal/template/internal/analytics/components/analytics-funnel.js +3 -2
  57. package/lib/internal/template/internal/analytics/components/analytics-funnel.js.map +1 -1
  58. package/lib/internal/template/internal/analytics/hooks/use-funnel.d.ts +1 -1
  59. package/lib/internal/template/internal/analytics/hooks/use-funnel.d.ts.map +1 -1
  60. package/lib/internal/template/internal/analytics/hooks/use-funnel.js +5 -5
  61. package/lib/internal/template/internal/analytics/hooks/use-funnel.js.map +1 -1
  62. package/lib/internal/template/internal/analytics/interfaces.d.ts +2 -2
  63. package/lib/internal/template/internal/analytics/interfaces.d.ts.map +1 -1
  64. package/lib/internal/template/internal/analytics/interfaces.js.map +1 -1
  65. package/lib/internal/template/internal/analytics/selectors.d.ts +15 -1
  66. package/lib/internal/template/internal/analytics/selectors.d.ts.map +1 -1
  67. package/lib/internal/template/internal/analytics/selectors.js +19 -5
  68. package/lib/internal/template/internal/analytics/selectors.js.map +1 -1
  69. package/lib/internal/template/internal/environment.js +1 -1
  70. package/lib/internal/template/link/internal.js +4 -4
  71. package/lib/internal/template/link/internal.js.map +1 -1
  72. package/lib/internal/template/split-panel/styles.css.js +59 -59
  73. package/lib/internal/template/split-panel/styles.scoped.css +83 -81
  74. package/lib/internal/template/split-panel/styles.selectors.js +59 -59
  75. package/package.json +1 -1
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "8a8d7f04ecd9cbcc0ccfc9daab11a2d5a10ff4ba"
2
+ "commit": "8caa2d5f8ecc20ae7adc4eedbe8f04b9d7e41165"
3
3
  }
@@ -0,0 +1,27 @@
1
+ /*
2
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ @use '../../internal/styles/tokens' as awsui;
6
+
7
+ .css-grid {
8
+ display: grid;
9
+ gap: awsui.$space-grid-gutter;
10
+
11
+ &.grid-no-gutters {
12
+ gap: 0;
13
+ }
14
+
15
+ &.grid-variant-text-grid {
16
+ > .item {
17
+ border-left: awsui.$border-divider-section-width solid awsui.$color-border-divider-default;
18
+ padding-left: awsui.$space-grid-gutter;
19
+ padding-right: awsui.$space-grid-gutter;
20
+
21
+ &.first-column {
22
+ border-left: 0;
23
+ padding-left: 0;
24
+ }
25
+ }
26
+ }
27
+ }
@@ -34,8 +34,7 @@
34
34
  }
35
35
  }
36
36
 
37
- .trigger {
38
- cursor: pointer;
37
+ .wrapper {
39
38
  box-sizing: border-box;
40
39
  display: flex;
41
40
  border: none;
@@ -83,7 +82,7 @@
83
82
  }
84
83
  }
85
84
 
86
- &-default.trigger-expanded {
85
+ &-default.wrapper-expanded {
87
86
  border-bottom-color: awsui.$color-border-divider-default;
88
87
  }
89
88
  }
@@ -102,13 +101,19 @@
102
101
  &-button {
103
102
  box-sizing: border-box;
104
103
  display: flex;
104
+ }
105
105
 
106
- // Header buttons for non-container variants show the focus ring directly
106
+ &-button,
107
+ &-container-button {
107
108
  @include focus-visible.when-visible {
108
109
  @include styles.focus-highlight(0px);
109
110
  }
110
111
  }
111
112
 
113
+ &:not(.with-interactive-elements) {
114
+ cursor: pointer;
115
+ }
116
+
112
117
  &-container {
113
118
  width: 100%;
114
119
  // The icon-container style is kept for variant='container' and header
@@ -117,20 +122,8 @@
117
122
  }
118
123
 
119
124
  // stylelint-disable-next-line selector-combinator-disallowed-list
120
- body[data-awsui-focus-visible='true'] &:focus-within {
121
- outline: none;
122
- text-decoration: none;
123
- padding: container.$header-focus-visible-padding;
124
-
125
- @include styles.form-focus-element(awsui.$border-radius-control-default-focus-ring);
126
- }
127
-
128
- // Header buttons that sit in a container should not show focus because the parent container has a focus ring already
129
- &-button {
130
- @include focus-visible.when-visible {
131
- outline: none;
132
- text-decoration: none;
133
- }
125
+ &.with-interactive-elements &-button {
126
+ cursor: pointer;
134
127
  }
135
128
  }
136
129
 
@@ -221,6 +221,8 @@ $app-layout-drawer-width: calc(#{awsui.$space-layout-toggle-diameter} + 2 * #{aw
221
221
  .content-bottom {
222
222
  padding: 0 awsui.$space-scaled-2x-xxxl;
223
223
  margin-top: awsui.$space-panel-split-top;
224
+ position: relative;
225
+ z-index: 0; // the content inside .content-bottom should not be above pane-header-wrapper-bottom
224
226
  .drawer-mobile > .drawer-content-bottom > & {
225
227
  padding: 0 awsui.$space-l;
226
228
  }
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["alert/internal.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAUjD,KAAK,kBAAkB,GAAG,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,GAAG,0BAA0B,CAAC;AAExF,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACpC,IAAI,EACJ,mBAAmB,EACnB,OAAc,EACd,WAAW,EACX,gBAAgB,EAChB,QAAQ,EACR,MAAM,EACN,UAAU,EACV,MAAM,EACN,SAAS,EACT,aAAa,EACb,iBAAwB,EACxB,GAAG,IAAI,EACR,EAAE,kBAAkB,eA+DpB"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["alert/internal.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAWjD,KAAK,kBAAkB,GAAG,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,GAAG,0BAA0B,CAAC;AAExF,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACpC,IAAI,EACJ,mBAAmB,EACnB,OAAc,EACd,WAAW,EACX,gBAAgB,EAChB,QAAQ,EACR,MAAM,EACN,UAAU,EACV,MAAM,EACN,SAAS,EACT,aAAa,EACb,iBAAwB,EACxB,GAAG,IAAI,EACR,EAAE,kBAAkB,eAkEpB"}
@@ -13,6 +13,7 @@ import { useContainerBreakpoints } from '../internal/hooks/container-queries';
13
13
  import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
14
14
  import { useMergeRefs } from '../internal/hooks/use-merge-refs';
15
15
  import { useInternalI18n } from '../internal/i18n/context';
16
+ import { DATA_ATTR_ANALYTICS_ALERT } from '../internal/analytics/selectors';
16
17
  const typeToIcon = {
17
18
  error: 'status-negative',
18
19
  warning: 'status-warning',
@@ -29,7 +30,10 @@ export default function InternalAlert(_a) {
29
30
  const size = isRefresh ? 'normal' : header && children ? 'big' : 'normal';
30
31
  const actionButton = action || (React.createElement(InternalButton, { className: styles['action-button'], onClick: () => fireNonCancelableEvent(onButtonClick), formAction: "none" }, buttonText));
31
32
  const hasAction = Boolean(action || buttonText);
32
- return (React.createElement("div", Object.assign({}, baseProps, { "data-analytics-alert": type, "aria-hidden": !visible, className: clsx(styles.root, { [styles.hidden]: !visible }, baseProps.className, styles[`breakpoint-${breakpoint}`]), ref: mergedRef }),
33
+ const analyticsAttributes = {
34
+ [DATA_ATTR_ANALYTICS_ALERT]: type,
35
+ };
36
+ return (React.createElement("div", Object.assign({}, baseProps, analyticsAttributes, { "aria-hidden": !visible, className: clsx(styles.root, { [styles.hidden]: !visible }, baseProps.className, styles[`breakpoint-${breakpoint}`]), ref: mergedRef }),
33
37
  React.createElement(VisualContext, { contextName: "alert" },
34
38
  React.createElement("div", { className: clsx(styles.alert, styles[`type-${type}`]) },
35
39
  React.createElement("div", { className: clsx(styles.icon, styles.text), role: "img", "aria-label": statusIconAriaLabel },
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["alert/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,aAAa,MAAM,uCAAuC,CAAC;AAClE,OAAO,M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,6BAAK,SAAS,EAAE,MAAM,CAAC,OAAO;oBAC5B,oBAAC,cAAc,IACb,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,EACnC,OAAO,EAAC,MAAM,EACd,QAAQ,EAAC,OAAO,EAChB,UAAU,EAAC,MAAM,EACjB,SAAS,EAAE,IAAI,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,EACrD,OAAO,EAAE,GAAG,EAAE,CAAC,sBAAsB,CAAC,SAAS,CAAC,GAChD,CACE,CACP,CACG,CACQ,CACZ,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\nimport { InternalButton } from '../button/internal';\nimport { IconProps } from '../icon/interfaces';\nimport InternalIcon from '../icon/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport VisualContext from '../internal/components/visual-context';\nimport styles from './styles.css.js';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { useContainerBreakpoints } from '../internal/hooks/container-queries';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { AlertProps } from './interfaces';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { SomeRequired } from '../internal/types';\nimport { useInternalI18n } from '../internal/i18n/context';\n\nconst typeToIcon: Record<AlertProps.Type, IconProps['name']> = {\n error: 'status-negative',\n warning: 'status-warning',\n success: 'status-positive',\n info: 'status-info',\n};\n\ntype InternalAlertProps = SomeRequired<AlertProps, 'type'> & InternalBaseComponentProps;\n\nexport default function InternalAlert({\n type,\n statusIconAriaLabel,\n visible = true,\n dismissible,\n dismissAriaLabel,\n children,\n header,\n buttonText,\n action,\n onDismiss,\n onButtonClick,\n __internalRootRef = null,\n ...rest\n}: InternalAlertProps) {\n const baseProps = getBaseProps(rest);\n const i18n = useInternalI18n('alert');\n\n const [breakpoint, breakpointRef] = useContainerBreakpoints(['xs']);\n const mergedRef = useMergeRefs(breakpointRef, __internalRootRef);\n\n const isRefresh = useVisualRefresh();\n const size = isRefresh ? 'normal' : header && children ? 'big' : 'normal';\n\n const actionButton = action || (\n <InternalButton\n className={styles['action-button']}\n onClick={() => fireNonCancelableEvent(onButtonClick)}\n formAction=\"none\"\n >\n {buttonText}\n </InternalButton>\n );\n\n const hasAction = Boolean(action || buttonText);\n\n return (\n <div\n {...baseProps}\n data-analytics-alert={type}\n aria-hidden={!visible}\n className={clsx(\n styles.root,\n { [styles.hidden]: !visible },\n baseProps.className,\n styles[`breakpoint-${breakpoint}`]\n )}\n ref={mergedRef}\n >\n <VisualContext contextName=\"alert\">\n <div className={clsx(styles.alert, styles[`type-${type}`])}>\n <div className={clsx(styles.icon, styles.text)} role=\"img\" aria-label={statusIconAriaLabel}>\n <InternalIcon name={typeToIcon[type]} size={size} />\n </div>\n <div className={styles.body}>\n <div className={clsx(styles.message, styles.text)}>\n {header && <div className={styles.header}>{header}</div>}\n <div className={styles.content}>{children}</div>\n </div>\n {hasAction && <div className={styles.action}>{actionButton}</div>}\n </div>\n {dismissible && (\n <div className={styles.dismiss}>\n <InternalButton\n className={styles['dismiss-button']}\n variant=\"icon\"\n iconName=\"close\"\n formAction=\"none\"\n ariaLabel={i18n('dismissAriaLabel', dismissAriaLabel)}\n onClick={() => fireNonCancelableEvent(onDismiss)}\n />\n </div>\n )}\n </div>\n </VisualContext>\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["alert/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AA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AM,CAAO;wBACxD,6BAAK,SAAS,EAAE,MAAM,CAAC,OAAO,IAAG,QAAQ,CAAO,CAC5C;oBACL,SAAS,IAAI,6BAAK,SAAS,EAAE,MAAM,CAAC,MAAM,IAAG,YAAY,CAAO,CAC7D;gBACL,WAAW,IAAI,CACd,6BAAK,SAAS,EAAE,MAAM,CAAC,OAAO;oBAC5B,oBAAC,cAAc,IACb,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,EACnC,OAAO,EAAC,MAAM,EACd,QAAQ,EAAC,OAAO,EAChB,UAAU,EAAC,MAAM,EACjB,SAAS,EAAE,IAAI,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,EACrD,OAAO,EAAE,GAAG,EAAE,CAAC,sBAAsB,CAAC,SAAS,CAAC,GAChD,CACE,CACP,CACG,CACQ,CACZ,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\nimport { InternalButton } from '../button/internal';\nimport { IconProps } from '../icon/interfaces';\nimport InternalIcon from '../icon/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport VisualContext from '../internal/components/visual-context';\nimport styles from './styles.css.js';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { useContainerBreakpoints } from '../internal/hooks/container-queries';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { AlertProps } from './interfaces';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { SomeRequired } from '../internal/types';\nimport { useInternalI18n } from '../internal/i18n/context';\nimport { DATA_ATTR_ANALYTICS_ALERT } from '../internal/analytics/selectors';\n\nconst typeToIcon: Record<AlertProps.Type, IconProps['name']> = {\n error: 'status-negative',\n warning: 'status-warning',\n success: 'status-positive',\n info: 'status-info',\n};\n\ntype InternalAlertProps = SomeRequired<AlertProps, 'type'> & InternalBaseComponentProps;\n\nexport default function InternalAlert({\n type,\n statusIconAriaLabel,\n visible = true,\n dismissible,\n dismissAriaLabel,\n children,\n header,\n buttonText,\n action,\n onDismiss,\n onButtonClick,\n __internalRootRef = null,\n ...rest\n}: InternalAlertProps) {\n const baseProps = getBaseProps(rest);\n const i18n = useInternalI18n('alert');\n\n const [breakpoint, breakpointRef] = useContainerBreakpoints(['xs']);\n const mergedRef = useMergeRefs(breakpointRef, __internalRootRef);\n\n const isRefresh = useVisualRefresh();\n const size = isRefresh ? 'normal' : header && children ? 'big' : 'normal';\n\n const actionButton = action || (\n <InternalButton\n className={styles['action-button']}\n onClick={() => fireNonCancelableEvent(onButtonClick)}\n formAction=\"none\"\n >\n {buttonText}\n </InternalButton>\n );\n\n const hasAction = Boolean(action || buttonText);\n const analyticsAttributes = {\n [DATA_ATTR_ANALYTICS_ALERT]: type,\n };\n\n return (\n <div\n {...baseProps}\n {...analyticsAttributes}\n aria-hidden={!visible}\n className={clsx(\n styles.root,\n { [styles.hidden]: !visible },\n baseProps.className,\n styles[`breakpoint-${breakpoint}`]\n )}\n ref={mergedRef}\n >\n <VisualContext contextName=\"alert\">\n <div className={clsx(styles.alert, styles[`type-${type}`])}>\n <div className={clsx(styles.icon, styles.text)} role=\"img\" aria-label={statusIconAriaLabel}>\n <InternalIcon name={typeToIcon[type]} size={size} />\n </div>\n <div className={styles.body}>\n <div className={clsx(styles.message, styles.text)}>\n {header && <div className={styles.header}>{header}</div>}\n <div className={styles.content}>{children}</div>\n </div>\n {hasAction && <div className={styles.action}>{actionButton}</div>}\n </div>\n {dismissible && (\n <div className={styles.dismiss}>\n <InternalButton\n className={styles['dismiss-button']}\n variant=\"icon\"\n iconName=\"close\"\n formAction=\"none\"\n ariaLabel={i18n('dismissAriaLabel', dismissAriaLabel)}\n onClick={() => fireNonCancelableEvent(onDismiss)}\n />\n </div>\n )}\n </div>\n </VisualContext>\n </div>\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"item.d.ts","sourceRoot":"lib/default/","sources":["breadcrumb-group/item/item.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAyH1E,wBAAgB,cAAc,CAAC,CAAC,SAAS,oBAAoB,CAAC,IAAI,EAAE,EAClE,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,WAAW,EACX,MAAc,EACd,YAAoB,GACrB,EAAE,mBAAmB,CAAC,CAAC,CAAC,eA2CxB"}
1
+ {"version":3,"file":"item.d.ts","sourceRoot":"lib/default/","sources":["breadcrumb-group/item/item.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AA8H1E,wBAAgB,cAAc,CAAC,CAAC,SAAS,oBAAoB,CAAC,IAAI,EAAE,EAClE,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,WAAW,EACX,MAAc,EACd,YAAoB,GACrB,EAAE,mBAAmB,CAAC,CAAC,CAAC,eA2CxB"}
@@ -12,6 +12,8 @@ import PopoverContainer from '../../popover/container';
12
12
  import PopoverBody from '../../popover/body';
13
13
  import Portal from '../../internal/components/portal';
14
14
  import popoverStyles from '../../popover/styles.css.js';
15
+ import { DATA_ATTR_FUNNEL_KEY } from '../../internal/analytics/selectors';
16
+ import { FUNNEL_KEY_FUNNEL_NAME } from '../../internal/analytics/selectors';
15
17
  const BreadcrumbItemWithPopover = (_a) => {
16
18
  var { item, isLast, anchorAttributes } = _a, itemAttributes = __rest(_a, ["item", "isLast", "anchorAttributes"]);
17
19
  const [showPopover, setShowPopover] = useState(false);
@@ -58,8 +60,8 @@ const BreadcrumbItemWithPopover = (_a) => {
58
60
  showPopover && popoverContent));
59
61
  };
60
62
  const Item = (_a) => {
61
- var { anchorAttributes, children, isLast } = _a, itemAttributes = __rest(_a, ["anchorAttributes", "children", "isLast"]);
62
- return isLast ? (React.createElement("span", Object.assign({}, itemAttributes), children)) : (React.createElement("a", Object.assign({}, itemAttributes, anchorAttributes), children));
63
+ var { anchorAttributes, dataAttributes, children, isLast } = _a, itemAttributes = __rest(_a, ["anchorAttributes", "dataAttributes", "children", "isLast"]);
64
+ return isLast ? (React.createElement("span", Object.assign({}, itemAttributes, dataAttributes), children)) : (React.createElement("a", Object.assign({}, itemAttributes, anchorAttributes, dataAttributes), children));
63
65
  };
64
66
  export function BreadcrumbItem({ item, onClick, onFollow, isDisplayed, isLast = false, isCompressed = false, }) {
65
67
  const preventDefault = (event) => event.preventDefault();
@@ -78,10 +80,10 @@ export function BreadcrumbItem({ item, onClick, onFollow, isDisplayed, isLast =
78
80
  };
79
81
  const dataAttibutes = {};
80
82
  if (isLast) {
81
- dataAttibutes['data-analytics-context'] = 'breadcrumb';
83
+ dataAttibutes[DATA_ATTR_FUNNEL_KEY] = FUNNEL_KEY_FUNNEL_NAME;
82
84
  }
83
- return (React.createElement("div", Object.assign({ className: clsx(styles.breadcrumb, isLast && styles.last) }, dataAttibutes),
84
- isDisplayed && isCompressed ? (React.createElement(BreadcrumbItemWithPopover, Object.assign({ item: item, isLast: isLast, anchorAttributes: anchorAttributes }, itemAttributes))) : (React.createElement(Item, Object.assign({ isLast: isLast, anchorAttributes: anchorAttributes }, itemAttributes),
85
+ return (React.createElement("div", { className: clsx(styles.breadcrumb, isLast && styles.last) },
86
+ isDisplayed && isCompressed ? (React.createElement(BreadcrumbItemWithPopover, Object.assign({ item: item, isLast: isLast, anchorAttributes: anchorAttributes }, itemAttributes))) : (React.createElement(Item, Object.assign({ isLast: isLast, anchorAttributes: anchorAttributes }, itemAttributes, dataAttibutes),
85
87
  React.createElement("span", { className: styles.text }, item.text))),
86
88
  !isLast ? (React.createElement("span", { className: styles.icon },
87
89
  React.createElement(InternalIcon, { name: "angle-right" }))) : null));
@@ -1 +1 @@
1
- {"version":3,"file":"item.js","sourceRoot":"lib/default/","sources":["breadcrumb-group/item/item.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC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C,IAAI,CAAQ,CAC3C,CACR;QACA,CAAC,MAAM,CAAC,CAAC,CAAC,CACT,8BAAM,SAAS,EAAE,MAAM,CAAC,IAAI;YAC1B,oBAAC,YAAY,IAAC,IAAI,EAAC,aAAa,GAAG,CAC9B,CACR,CAAC,CAAC,CAAC,IAAI,CACJ,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef, useState } from 'react';\nimport { BreadcrumbGroupProps, BreadcrumbItemProps } from '../interfaces';\nimport InternalIcon from '../../icon/internal';\nimport styles from './styles.css.js';\nimport clsx from 'clsx';\nimport { fireCancelableEvent, isPlainLeftClick } from '../../internal/events';\nimport { getEventDetail } from '../internal';\nimport { Transition } from '../../internal/components/transition';\nimport PopoverContainer from '../../popover/container';\nimport PopoverBody from '../../popover/body';\nimport Portal from '../../internal/components/portal';\nimport popoverStyles from '../../popover/styles.css.js';\n\ntype BreadcrumbItemWithPopoverProps<T extends BreadcrumbGroupProps.Item> = React.HTMLAttributes<HTMLElement> & {\n item: T;\n isLast: boolean;\n anchorAttributes: React.AnchorHTMLAttributes<HTMLAnchorElement>;\n};\n\nconst BreadcrumbItemWithPopover = <T extends BreadcrumbGroupProps.Item>({\n item,\n isLast,\n anchorAttributes,\n ...itemAttributes\n}: BreadcrumbItemWithPopoverProps<T>) => {\n const [showPopover, setShowPopover] = useState(false);\n const textRef = useRef<HTMLElement>(null);\n const virtualTextRef = useRef<HTMLElement>(null);\n\n const isTruncated = (textRef: React.RefObject<HTMLElement>, virtualTextRef: React.RefObject<HTMLElement>) => {\n if (!textRef || !virtualTextRef || !textRef.current || !virtualTextRef.current) {\n return false;\n }\n const virtualTextWidth = virtualTextRef.current.getBoundingClientRect().width;\n const textWidth = textRef.current.getBoundingClientRect().width;\n if (virtualTextWidth > textWidth) {\n return true;\n }\n return false;\n };\n\n const popoverContent = (\n <Portal>\n <div className={styles['item-popover']}>\n <Transition in={true}>\n {() => (\n <PopoverContainer\n trackRef={textRef}\n size=\"small\"\n fixedWidth={false}\n position=\"bottom\"\n arrow={position => (\n <div className={clsx(popoverStyles.arrow, popoverStyles[`arrow-position-${position}`])}>\n <div className={popoverStyles['arrow-outer']} />\n <div className={popoverStyles['arrow-inner']} />\n </div>\n )}\n >\n <PopoverBody dismissButton={false} dismissAriaLabel={undefined} onDismiss={() => {}} header={undefined}>\n {item.text}\n </PopoverBody>\n </PopoverContainer>\n )}\n </Transition>\n </div>\n </Portal>\n );\n\n useEffect(() => {\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n setShowPopover(false);\n }\n };\n if (showPopover) {\n document.addEventListener('keydown', onKeyDown);\n }\n return () => {\n document.removeEventListener('keydown', onKeyDown);\n };\n }, [showPopover]);\n\n return (\n <>\n <Item\n isLast={isLast}\n {...itemAttributes}\n onFocus={() => {\n isTruncated(textRef, virtualTextRef) && setShowPopover(true);\n }}\n onBlur={() => setShowPopover(false)}\n onMouseEnter={() => {\n isTruncated(textRef, virtualTextRef) && setShowPopover(true);\n }}\n onMouseLeave={() => setShowPopover(false)}\n anchorAttributes={anchorAttributes}\n >\n <span className={styles.text} ref={textRef}>\n {item.text}\n </span>\n <span className={styles['virtual-item']} ref={virtualTextRef}>\n {item.text}\n </span>\n </Item>\n {showPopover && popoverContent}\n </>\n );\n};\n\ntype ItemProps = React.HTMLAttributes<HTMLElement> & {\n anchorAttributes: React.AnchorHTMLAttributes<HTMLAnchorElement>;\n isLast: boolean;\n};\nconst Item = ({ anchorAttributes, children, isLast, ...itemAttributes }: ItemProps) =>\n isLast ? (\n <span {...itemAttributes}>{children}</span>\n ) : (\n <a {...itemAttributes} {...anchorAttributes}>\n {children}\n </a>\n );\n\nexport function BreadcrumbItem<T extends BreadcrumbGroupProps.Item>({\n item,\n onClick,\n onFollow,\n isDisplayed,\n isLast = false,\n isCompressed = false,\n}: BreadcrumbItemProps<T>) {\n const preventDefault = (event: React.MouseEvent) => event.preventDefault();\n const onClickHandler = (event: React.MouseEvent) => {\n if (isPlainLeftClick(event)) {\n fireCancelableEvent(onFollow, getEventDetail(item), event);\n }\n fireCancelableEvent(onClick, getEventDetail(item), event);\n };\n\n const itemAttributes: React.HTMLAttributes<HTMLElement> = {\n className: clsx(styles.anchor, { [styles.compressed]: isCompressed }),\n };\n const anchorAttributes: React.AnchorHTMLAttributes<HTMLAnchorElement> = {\n href: item.href || '#',\n onClick: isLast ? preventDefault : onClickHandler,\n };\n\n const dataAttibutes: Record<string, string> = {};\n if (isLast) {\n dataAttibutes['data-analytics-context'] = 'breadcrumb';\n }\n\n return (\n <div className={clsx(styles.breadcrumb, isLast && styles.last)} {...dataAttibutes}>\n {isDisplayed && isCompressed ? (\n <BreadcrumbItemWithPopover\n item={item}\n isLast={isLast}\n anchorAttributes={anchorAttributes}\n {...itemAttributes}\n />\n ) : (\n <Item isLast={isLast} anchorAttributes={anchorAttributes} {...itemAttributes}>\n <span className={styles.text}>{item.text}</span>\n </Item>\n )}\n {!isLast ? (\n <span className={styles.icon}>\n <InternalIcon name=\"angle-right\" />\n </span>\n ) : null}\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"item.js","sourceRoot":"lib/default/","sources":["breadcrumb-group/item/item.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE3D,OAAO,YAAY,MAAM,qBAAqB,CAAC;AAC/C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAClE,OAAO,gBAAgB,MAA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or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef, useState } from 'react';\nimport { BreadcrumbGroupProps, BreadcrumbItemProps } from '../interfaces';\nimport InternalIcon from '../../icon/internal';\nimport styles from './styles.css.js';\nimport clsx from 'clsx';\nimport { fireCancelableEvent, isPlainLeftClick } from '../../internal/events';\nimport { getEventDetail } from '../internal';\nimport { Transition } from '../../internal/components/transition';\nimport PopoverContainer from '../../popover/container';\nimport PopoverBody from '../../popover/body';\nimport Portal from '../../internal/components/portal';\nimport popoverStyles from '../../popover/styles.css.js';\nimport { DATA_ATTR_FUNNEL_KEY } from '../../internal/analytics/selectors';\nimport { FUNNEL_KEY_FUNNEL_NAME } from '../../internal/analytics/selectors';\n\ntype BreadcrumbItemWithPopoverProps<T extends BreadcrumbGroupProps.Item> = React.HTMLAttributes<HTMLElement> & {\n item: T;\n isLast: boolean;\n anchorAttributes: React.AnchorHTMLAttributes<HTMLAnchorElement>;\n};\n\nconst BreadcrumbItemWithPopover = <T extends BreadcrumbGroupProps.Item>({\n item,\n isLast,\n anchorAttributes,\n ...itemAttributes\n}: BreadcrumbItemWithPopoverProps<T>) => {\n const [showPopover, setShowPopover] = useState(false);\n const textRef = useRef<HTMLElement>(null);\n const virtualTextRef = useRef<HTMLElement>(null);\n\n const isTruncated = (textRef: React.RefObject<HTMLElement>, virtualTextRef: React.RefObject<HTMLElement>) => {\n if (!textRef || !virtualTextRef || !textRef.current || !virtualTextRef.current) {\n return false;\n }\n const virtualTextWidth = virtualTextRef.current.getBoundingClientRect().width;\n const textWidth = textRef.current.getBoundingClientRect().width;\n if (virtualTextWidth > textWidth) {\n return true;\n }\n return false;\n };\n\n const popoverContent = (\n <Portal>\n <div className={styles['item-popover']}>\n <Transition in={true}>\n {() => (\n <PopoverContainer\n trackRef={textRef}\n size=\"small\"\n fixedWidth={false}\n position=\"bottom\"\n arrow={position => (\n <div className={clsx(popoverStyles.arrow, popoverStyles[`arrow-position-${position}`])}>\n <div className={popoverStyles['arrow-outer']} />\n <div className={popoverStyles['arrow-inner']} />\n </div>\n )}\n >\n <PopoverBody dismissButton={false} dismissAriaLabel={undefined} onDismiss={() => {}} header={undefined}>\n {item.text}\n </PopoverBody>\n </PopoverContainer>\n )}\n </Transition>\n </div>\n </Portal>\n );\n\n useEffect(() => {\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n setShowPopover(false);\n }\n };\n if (showPopover) {\n document.addEventListener('keydown', onKeyDown);\n }\n return () => {\n document.removeEventListener('keydown', onKeyDown);\n };\n }, [showPopover]);\n\n return (\n <>\n <Item\n isLast={isLast}\n {...itemAttributes}\n onFocus={() => {\n isTruncated(textRef, virtualTextRef) && setShowPopover(true);\n }}\n onBlur={() => setShowPopover(false)}\n onMouseEnter={() => {\n isTruncated(textRef, virtualTextRef) && setShowPopover(true);\n }}\n onMouseLeave={() => setShowPopover(false)}\n anchorAttributes={anchorAttributes}\n >\n <span className={styles.text} ref={textRef}>\n {item.text}\n </span>\n <span className={styles['virtual-item']} ref={virtualTextRef}>\n {item.text}\n </span>\n </Item>\n {showPopover && popoverContent}\n </>\n );\n};\n\ntype ItemProps = React.HTMLAttributes<HTMLElement> & {\n dataAttributes?: React.DataHTMLAttributes<HTMLElement>;\n anchorAttributes: React.AnchorHTMLAttributes<HTMLAnchorElement>;\n isLast: boolean;\n};\nconst Item = ({ anchorAttributes, dataAttributes, children, isLast, ...itemAttributes }: ItemProps) =>\n isLast ? (\n <span {...itemAttributes} {...dataAttributes}>\n {children}\n </span>\n ) : (\n <a {...itemAttributes} {...anchorAttributes} {...dataAttributes}>\n {children}\n </a>\n );\n\nexport function BreadcrumbItem<T extends BreadcrumbGroupProps.Item>({\n item,\n onClick,\n onFollow,\n isDisplayed,\n isLast = false,\n isCompressed = false,\n}: BreadcrumbItemProps<T>) {\n const preventDefault = (event: React.MouseEvent) => event.preventDefault();\n const onClickHandler = (event: React.MouseEvent) => {\n if (isPlainLeftClick(event)) {\n fireCancelableEvent(onFollow, getEventDetail(item), event);\n }\n fireCancelableEvent(onClick, getEventDetail(item), event);\n };\n\n const itemAttributes: React.HTMLAttributes<HTMLElement> = {\n className: clsx(styles.anchor, { [styles.compressed]: isCompressed }),\n };\n const anchorAttributes: React.AnchorHTMLAttributes<HTMLAnchorElement> = {\n href: item.href || '#',\n onClick: isLast ? preventDefault : onClickHandler,\n };\n\n const dataAttibutes: Record<string, string> = {};\n if (isLast) {\n dataAttibutes[DATA_ATTR_FUNNEL_KEY] = FUNNEL_KEY_FUNNEL_NAME;\n }\n\n return (\n <div className={clsx(styles.breadcrumb, isLast && styles.last)}>\n {isDisplayed && isCompressed ? (\n <BreadcrumbItemWithPopover\n item={item}\n isLast={isLast}\n anchorAttributes={anchorAttributes}\n {...itemAttributes}\n />\n ) : (\n <Item isLast={isLast} anchorAttributes={anchorAttributes} {...itemAttributes} {...dataAttibutes}>\n <span className={styles.text}>{item.text}</span>\n </Item>\n )}\n {!isLast ? (\n <span className={styles.icon}>\n <InternalIcon name=\"angle-right\" />\n </span>\n ) : null}\n </div>\n );\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { InternalColumnLayoutProps } from '../interfaces';
3
+ export declare function calculcateCssColumnCount(columns: number, minColumnWidth: number, containerWidth: number | null): number;
4
+ interface FlexibleColumnLayoutProps extends Pick<InternalColumnLayoutProps, 'minColumnWidth' | 'columns' | 'variant' | 'borders' | 'disableGutters'> {
5
+ children: React.ReactNode;
6
+ }
7
+ export default function FlexibleColumnLayout({ columns, minColumnWidth, disableGutters, variant, children, }: FlexibleColumnLayoutProps): JSX.Element;
8
+ export {};
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["column-layout/flexible-column-layout/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAK1D,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM,EACtB,cAAc,EAAE,MAAM,GAAG,IAAI,GAC5B,MAAM,CAaR;AAED,UAAU,yBACR,SAAQ,IAAI,CAAC,yBAAyB,EAAE,gBAAgB,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,gBAAgB,CAAC;IAChH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,EAC3C,OAAW,EACX,cAAkB,EAClB,cAAc,EACd,OAAO,EACP,QAAQ,GACT,EAAE,yBAAyB,eAqC3B"}
@@ -0,0 +1,33 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import React from 'react';
4
+ import clsx from 'clsx';
5
+ import flattenChildren from 'react-keyed-flatten-children';
6
+ import { useContainerQuery } from '../../internal/hooks/container-queries';
7
+ import styles from './styles.css.js';
8
+ const isOdd = (value) => value % 2 !== 0;
9
+ export function calculcateCssColumnCount(columns, minColumnWidth, containerWidth) {
10
+ if (!containerWidth) {
11
+ return columns;
12
+ }
13
+ // First, calculate how many columns we can have based on the current container width and minColumnWidth.
14
+ const targetColumnCount = Math.min(columns, Math.floor(containerWidth / minColumnWidth));
15
+ // When we start wrapping into fewer columns than desired, we want to keep the number of columns even.
16
+ return Math.max(1, targetColumnCount < columns && isOdd(targetColumnCount) ? targetColumnCount - 1 : targetColumnCount);
17
+ }
18
+ export default function FlexibleColumnLayout({ columns = 1, minColumnWidth = 0, disableGutters, variant, children, }) {
19
+ const [containerWidth, containerRef] = useContainerQuery(rect => rect.width);
20
+ const columnCount = calculcateCssColumnCount(columns, minColumnWidth, containerWidth);
21
+ const shouldDisableGutters = variant !== 'text-grid' && disableGutters;
22
+ // Flattening the children allows us to "see through" React Fragments and nested arrays.
23
+ const flattenedChildren = flattenChildren(children);
24
+ return (React.createElement("div", { ref: containerRef, className: clsx(styles['css-grid'], styles[`grid-variant-${variant}`], shouldDisableGutters && [styles['grid-no-gutters']]), style: { gridTemplateColumns: `repeat(${columnCount}, 1fr)` } }, flattenedChildren.map((child, i) => {
25
+ // If this react child is a primitive value, the key will be undefined
26
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
+ const key = child.key;
28
+ return (React.createElement("div", { key: key, className: clsx(styles.item, {
29
+ [styles['first-column']]: i % columnCount === 0,
30
+ }) }, child));
31
+ })));
32
+ }
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["column-layout/flexible-column-layout/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,eAAe,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAE3E,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,KAAK,GAAG,CAAC,KAAa,EAAW,EAAE,CAAC,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC;AAE1D,MAAM,UAAU,wBAAwB,CACtC,OAAe,EACf,cAAsB,EACtB,cAA6B;IAE7B,IAAI,CAAC,cAAc,EAAE;QACnB,OAAO,OAAO,CAAC;KAChB;IAED,yGAAyG;IACzG,MAAM,iBAAiB,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,GAAG,cAAc,CAAC,CAAC,CAAC;IAEzF,sGAAsG;IACtG,OAAO,IAAI,CAAC,GAAG,CACb,CAAC,EACD,iBAAiB,GAAG,OAAO,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,iBAAiB,GAAG,CAAC,CAAC,CAAC,CAAC,iBAAiB,CACpG,CA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.0\nimport React from 'react';\nimport clsx from 'clsx';\nimport flattenChildren from 'react-keyed-flatten-children';\nimport { useContainerQuery } from '../../internal/hooks/container-queries';\nimport { InternalColumnLayoutProps } from '../interfaces';\nimport styles from './styles.css.js';\n\nconst isOdd = (value: number): boolean => value % 2 !== 0;\n\nexport function calculcateCssColumnCount(\n columns: number,\n minColumnWidth: number,\n containerWidth: number | null\n): number {\n if (!containerWidth) {\n return columns;\n }\n\n // First, calculate how many columns we can have based on the current container width and minColumnWidth.\n const targetColumnCount = Math.min(columns, Math.floor(containerWidth / minColumnWidth));\n\n // When we start wrapping into fewer columns than desired, we want to keep the number of columns even.\n return Math.max(\n 1,\n targetColumnCount < columns && isOdd(targetColumnCount) ? targetColumnCount - 1 : targetColumnCount\n );\n}\n\ninterface FlexibleColumnLayoutProps\n extends Pick<InternalColumnLayoutProps, 'minColumnWidth' | 'columns' | 'variant' | 'borders' | 'disableGutters'> {\n children: React.ReactNode;\n}\n\nexport default function FlexibleColumnLayout({\n columns = 1,\n minColumnWidth = 0,\n disableGutters,\n variant,\n children,\n}: FlexibleColumnLayoutProps) {\n const [containerWidth, containerRef] = useContainerQuery(rect => rect.width);\n\n const columnCount = calculcateCssColumnCount(columns, minColumnWidth, containerWidth);\n const shouldDisableGutters = variant !== 'text-grid' && disableGutters;\n\n // Flattening the children allows us to \"see through\" React Fragments and nested arrays.\n const flattenedChildren = flattenChildren(children);\n\n return (\n <div\n ref={containerRef}\n className={clsx(\n styles['css-grid'],\n styles[`grid-variant-${variant}`],\n shouldDisableGutters && [styles['grid-no-gutters']]\n )}\n style={{ gridTemplateColumns: `repeat(${columnCount}, 1fr)` }}\n >\n {flattenedChildren.map((child, i) => {\n // If this react child is a primitive value, the key will be undefined\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const key = (child as any).key;\n\n return (\n <div\n key={key}\n className={clsx(styles.item, {\n [styles['first-column']]: i % columnCount === 0,\n })}\n >\n {child}\n </div>\n );\n })}\n </div>\n );\n}\n"]}
@@ -0,0 +1,10 @@
1
+
2
+ import './styles.scoped.css';
3
+ export default {
4
+ "css-grid": "awsui_css-grid_zqq3x_dgfws_9",
5
+ "grid-no-gutters": "awsui_grid-no-gutters_zqq3x_dgfws_13",
6
+ "grid-variant-text-grid": "awsui_grid-variant-text-grid_zqq3x_dgfws_16",
7
+ "item": "awsui_item_zqq3x_dgfws_16",
8
+ "first-column": "awsui_first-column_zqq3x_dgfws_21"
9
+ };
10
+
@@ -0,0 +1,24 @@
1
+ /*
2
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ /*
6
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
7
+ SPDX-License-Identifier: Apache-2.0
8
+ */
9
+ .awsui_css-grid_zqq3x_dgfws_9:not(#\9) {
10
+ display: grid;
11
+ gap: var(--space-grid-gutter-jlj43y, 20px);
12
+ }
13
+ .awsui_css-grid_zqq3x_dgfws_9.awsui_grid-no-gutters_zqq3x_dgfws_13:not(#\9) {
14
+ gap: 0;
15
+ }
16
+ .awsui_css-grid_zqq3x_dgfws_9.awsui_grid-variant-text-grid_zqq3x_dgfws_16 > .awsui_item_zqq3x_dgfws_16:not(#\9) {
17
+ border-left: var(--border-divider-section-width-p0xg84, 1px) solid var(--color-border-divider-default-uqjcpn, #eaeded);
18
+ padding-left: var(--space-grid-gutter-jlj43y, 20px);
19
+ padding-right: var(--space-grid-gutter-jlj43y, 20px);
20
+ }
21
+ .awsui_css-grid_zqq3x_dgfws_9.awsui_grid-variant-text-grid_zqq3x_dgfws_16 > .awsui_item_zqq3x_dgfws_16.awsui_first-column_zqq3x_dgfws_21:not(#\9) {
22
+ border-left: 0;
23
+ padding-left: 0;
24
+ }
@@ -0,0 +1,11 @@
1
+
2
+ // es-module interop with Babel and Typescript
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ module.exports.default = {
5
+ "css-grid": "awsui_css-grid_zqq3x_dgfws_9",
6
+ "grid-no-gutters": "awsui_grid-no-gutters_zqq3x_dgfws_13",
7
+ "grid-variant-text-grid": "awsui_grid-variant-text-grid_zqq3x_dgfws_16",
8
+ "item": "awsui_item_zqq3x_dgfws_16",
9
+ "first-column": "awsui_first-column_zqq3x_dgfws_21"
10
+ };
11
+
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { InternalColumnLayoutProps } from './interfaces';
3
+ import { ColumnLayoutBreakpoint } from './internal';
4
+ interface GridColumnLayoutProps extends Required<Pick<InternalColumnLayoutProps, 'columns' | 'variant' | 'borders' | 'disableGutters'>> {
5
+ children: React.ReactNode;
6
+ __breakpoint?: ColumnLayoutBreakpoint;
7
+ }
8
+ export default function GridColumnLayout({ columns, variant, borders, disableGutters, __breakpoint, children, }: GridColumnLayoutProps): JSX.Element;
9
+ export {};
10
+ //# sourceMappingURL=grid-column-layout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grid-column-layout.d.ts","sourceRoot":"lib/default/","sources":["column-layout/grid-column-layout.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAmB,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAUrE,UAAU,qBACR,SAAQ,QAAQ,CAAC,IAAI,CAAC,yBAAyB,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,gBAAgB,CAAC,CAAC;IACvG,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,YAAY,CAAC,EAAE,sBAAsB,CAAC;CACvC;AAED,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,OAAO,EACP,OAAO,EACP,OAAO,EACP,cAAc,EACd,YAAY,EACZ,QAAQ,GACT,EAAE,qBAAqB,eA2BvB"}
@@ -0,0 +1,32 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import React from 'react';
4
+ import clsx from 'clsx';
5
+ import flattenChildren from 'react-keyed-flatten-children';
6
+ import InternalGrid from '../grid/internal';
7
+ import { useContainerBreakpoints } from '../internal/hooks/container-queries';
8
+ import { repeat } from './util';
9
+ import { COLUMN_TRIGGERS } from './internal';
10
+ import styles from './styles.css.js';
11
+ const COLUMN_DEFS = {
12
+ 1: { colspan: { default: 12, xxs: 12, xs: 12 } },
13
+ 2: { colspan: { default: 12, xxs: 6, xs: 6 } },
14
+ 3: { colspan: { default: 12, xxs: 6, xs: 4 } },
15
+ 4: { colspan: { default: 12, xxs: 6, xs: 3 } },
16
+ };
17
+ export default function GridColumnLayout({ columns, variant, borders, disableGutters, __breakpoint, children, }) {
18
+ var _a;
19
+ const isTextGridVariant = variant === 'text-grid';
20
+ const shouldDisableGutters = !isTextGridVariant && disableGutters;
21
+ const shouldHaveHorizontalBorders = !isTextGridVariant && (borders === 'horizontal' || borders === 'all');
22
+ const shouldHaveVerticalBorders = !isTextGridVariant && (borders === 'vertical' || borders === 'all');
23
+ // Flattening the children allows us to "see through" React Fragments and nested arrays.
24
+ const flattenedChildren = flattenChildren(children);
25
+ const [breakpoint, ref] = useContainerBreakpoints(COLUMN_TRIGGERS);
26
+ return (React.createElement(InternalGrid, { ref: ref, disableGutters: true, gridDefinition: repeat((_a = COLUMN_DEFS[columns]) !== null && _a !== void 0 ? _a : {}, flattenedChildren.length), className: clsx(styles.grid, styles[`grid-columns-${columns}`], styles[`grid-variant-${variant}`], {
27
+ [styles['grid-horizontal-borders']]: shouldHaveHorizontalBorders,
28
+ [styles['grid-vertical-borders']]: shouldHaveVerticalBorders,
29
+ [styles['grid-no-gutters']]: shouldDisableGutters,
30
+ }), __breakpoint: __breakpoint || breakpoint, __responsiveClassName: breakpoint => breakpoint && styles[`grid-breakpoint-${breakpoint}`] }, children));
31
+ }
32
+ //# sourceMappingURL=grid-column-layout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grid-column-lay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I,CAAC,OAAO,KAAK,YAAY,IAAI,OAAO,KAAK,KAAK,CAAC,CAAC;IAC1G,MAAM,yBAAyB,GAAG,CAAC,iBAAiB,IAAI,CAAC,OAAO,KAAK,UAAU,IAAI,OAAO,KAAK,KAAK,CAAC,CAAC;IAEtG,wFAAwF;IACxF,MAAM,iBAAiB,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;IAEpD,MAAM,CAAC,UAAU,EAAE,GAAG,CAAC,GAAG,uBAAuB,CAAC,eAAe,CAAC,CAAC;IAEnE,OAAO,CACL,oBAAC,YAAY,IACX,GAAG,EAAE,GAAG,EACR,cAAc,EAAE,IAAI,EACpB,cAAc,EAAE,MAAM,CAAC,MAAA,WAAW,CAAC,OAAO,CAAC,mCAAI,EAAE,EAAE,iBAAiB,CAAC,MAAM,CAAC,EAC5E,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,gBAAgB,OAAO,EAAE,CAAC,EAAE,MAAM,CAAC,gBAAgB,OAAO,EAAE,CAAC,EAAE;YACjG,CAAC,MAAM,CAAC,yBAAyB,CAAC,CAAC,EAAE,2BAA2B;YAChE,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC,EAAE,yBAAyB;YAC5D,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,EAAE,oBAAoB;SAClD,CAAC,EACF,YAAY,EAAE,YAAY,IAAI,UAAU,EACxC,qBAAqB,EAAE,UAAU,CAAC,EAAE,CAAC,UAAU,IAAI,MAAM,CAAC,mBAAmB,UAAU,EAAE,CAAC,IAEzF,QAAQ,CACI,CAChB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\nimport flattenChildren from 'react-keyed-flatten-children';\nimport InternalGrid from '../grid/internal';\nimport { GridProps } from '../grid/interfaces';\nimport { useContainerBreakpoints } from '../internal/hooks/container-queries';\nimport { repeat } from './util';\nimport { InternalColumnLayoutProps } from './interfaces';\nimport { COLUMN_TRIGGERS, ColumnLayoutBreakpoint } from './internal';\nimport styles from './styles.css.js';\n\nconst COLUMN_DEFS: Record<number, GridProps.ElementDefinition | undefined> = {\n 1: { colspan: { default: 12, xxs: 12, xs: 12 } },\n 2: { colspan: { default: 12, xxs: 6, xs: 6 } },\n 3: { colspan: { default: 12, xxs: 6, xs: 4 } },\n 4: { colspan: { default: 12, xxs: 6, xs: 3 } },\n};\n\ninterface GridColumnLayoutProps\n extends Required<Pick<InternalColumnLayoutProps, 'columns' | 'variant' | 'borders' | 'disableGutters'>> {\n children: React.ReactNode;\n __breakpoint?: ColumnLayoutBreakpoint;\n}\n\nexport default function GridColumnLayout({\n columns,\n variant,\n borders,\n disableGutters,\n __breakpoint,\n children,\n}: GridColumnLayoutProps) {\n const isTextGridVariant = variant === 'text-grid';\n const shouldDisableGutters = !isTextGridVariant && disableGutters;\n const shouldHaveHorizontalBorders = !isTextGridVariant && (borders === 'horizontal' || borders === 'all');\n const shouldHaveVerticalBorders = !isTextGridVariant && (borders === 'vertical' || borders === 'all');\n\n // Flattening the children allows us to \"see through\" React Fragments and nested arrays.\n const flattenedChildren = flattenChildren(children);\n\n const [breakpoint, ref] = useContainerBreakpoints(COLUMN_TRIGGERS);\n\n return (\n <InternalGrid\n ref={ref}\n disableGutters={true}\n gridDefinition={repeat(COLUMN_DEFS[columns] ?? {}, flattenedChildren.length)}\n className={clsx(styles.grid, styles[`grid-columns-${columns}`], styles[`grid-variant-${variant}`], {\n [styles['grid-horizontal-borders']]: shouldHaveHorizontalBorders,\n [styles['grid-vertical-borders']]: shouldHaveVerticalBorders,\n [styles['grid-no-gutters']]: shouldDisableGutters,\n })}\n __breakpoint={__breakpoint || breakpoint}\n __responsiveClassName={breakpoint => breakpoint && styles[`grid-breakpoint-${breakpoint}`]}\n >\n {children}\n </InternalGrid>\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["column-layout/index.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAE7B,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,OAAW,EACX,OAAmB,EACnB,OAAgB,EAChB,cAAsB,EACtB,GAAG,KAAK,EACT,EAAE,iBAAiB,eAgBnB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["column-layout/index.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAE7B,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,OAAW,EACX,OAAmB,EACnB,OAAgB,EAChB,cAAsB,EACtB,GAAG,KAAK,EACT,EAAE,iBAAiB,eAanB"}
@@ -2,17 +2,15 @@ import { __rest } from "tslib";
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  import React from 'react';
5
- import InternalColumnLayout, { COLUMN_TRIGGERS } from './internal';
5
+ import InternalColumnLayout from './internal';
6
6
  import { getExternalProps } from '../internal/utils/external-props';
7
- import { useContainerBreakpoints } from '../internal/hooks/container-queries';
8
7
  import { applyDisplayName } from '../internal/utils/apply-display-name';
9
8
  import useBaseComponent from '../internal/hooks/use-base-component';
10
9
  export default function ColumnLayout(_a) {
11
10
  var { columns = 1, variant = 'default', borders = 'none', disableGutters = false } = _a, props = __rest(_a, ["columns", "variant", "borders", "disableGutters"]);
12
11
  const baseComponentProps = useBaseComponent('ColumnLayout');
13
- const [breakpoint, ref] = useContainerBreakpoints(COLUMN_TRIGGERS);
14
12
  const externalProps = getExternalProps(props);
15
- return (React.createElement(InternalColumnLayout, Object.assign({ columns: columns, variant: variant, borders: borders, disableGutters: disableGutters }, externalProps, baseComponentProps, { __breakpoint: breakpoint, ref: ref })));
13
+ return (React.createElement(InternalColumnLayout, Object.assign({ columns: columns, variant: variant, borders: borders, disableGutters: disableGutters }, externalProps, baseComponentProps)));
16
14
  }
17
15
  applyDisplayName(ColumnLayout, 'ColumnLayout');
18
16
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["column-layout/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,oBAAoB,EAAE,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AAKpE,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EAMjB;QANiB,EACnC,OAAO,GAAG,CAAC,EACX,OAAO,GAAG,SAAS,EACnB,OAAO,GAAG,MAAM,EAChB,cAAc,GAAG,KAAK,OAEJ,EADf,KAAK,cAL2B,mDAMpC,CADS;IAER,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,cAAc,CAAC,CAAC;IAC5D,MAAM,CAAC,UAAU,EAAE,GAAG,CAAC,GAAG,uBAAuB,CAAC,eAAe,CAAC,CAAC;IACnE,MAAM,aAAa,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAC9C,OAAO,CACL,oBAAC,oBAAoB,kBACnB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,cAAc,IAC1B,aAAa,EACb,kBAAkB,IACtB,YAAY,EAAE,UAAU,EACxB,GAAG,EAAE,GAAG,IACR,CACH,CAAC;AACJ,CAAC;AAED,gBAAgB,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport InternalColumnLayout, { COLUMN_TRIGGERS } from './internal';\nimport { getExternalProps } from '../internal/utils/external-props';\nimport { useContainerBreakpoints } from '../internal/hooks/container-queries';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { ColumnLayoutProps } from './interfaces';\n\nexport { ColumnLayoutProps };\n\nexport default function ColumnLayout({\n columns = 1,\n variant = 'default',\n borders = 'none',\n disableGutters = false,\n ...props\n}: ColumnLayoutProps) {\n const baseComponentProps = useBaseComponent('ColumnLayout');\n const [breakpoint, ref] = useContainerBreakpoints(COLUMN_TRIGGERS);\n const externalProps = getExternalProps(props);\n return (\n <InternalColumnLayout\n columns={columns}\n variant={variant}\n borders={borders}\n disableGutters={disableGutters}\n {...externalProps}\n {...baseComponentProps}\n __breakpoint={breakpoint}\n ref={ref}\n />\n );\n}\n\napplyDisplayName(ColumnLayout, 'ColumnLayout');\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["column-layout/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,oBAAoB,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AAKpE,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EAMjB;QANiB,EACnC,OAAO,GAAG,CAAC,EACX,OAAO,GAAG,SAAS,EACnB,OAAO,GAAG,MAAM,EAChB,cAAc,GAAG,KAAK,OAEJ,EADf,KAAK,cAL2B,mDAMpC,CADS;IAER,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,cAAc,CAAC,CAAC;IAC5D,MAAM,aAAa,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAC9C,OAAO,CACL,oBAAC,oBAAoB,kBACnB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,cAAc,IAC1B,aAAa,EACb,kBAAkB,EACtB,CACH,CAAC;AACJ,CAAC;AAED,gBAAgB,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport InternalColumnLayout from './internal';\nimport { getExternalProps } from '../internal/utils/external-props';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { ColumnLayoutProps } from './interfaces';\n\nexport { ColumnLayoutProps };\n\nexport default function ColumnLayout({\n columns = 1,\n variant = 'default',\n borders = 'none',\n disableGutters = false,\n ...props\n}: ColumnLayoutProps) {\n const baseComponentProps = useBaseComponent('ColumnLayout');\n const externalProps = getExternalProps(props);\n return (\n <InternalColumnLayout\n columns={columns}\n variant={variant}\n borders={borders}\n disableGutters={disableGutters}\n {...externalProps}\n {...baseComponentProps}\n />\n );\n}\n\napplyDisplayName(ColumnLayout, 'ColumnLayout');\n"]}
@@ -6,6 +6,8 @@ export interface ColumnLayoutProps extends BaseComponentProps {
6
6
  /**
7
7
  * Specifies the number of columns in each grid row.
8
8
  * Valid values are any integer between 1 and 4.
9
+ *
10
+ * Note that there is no upper limit when used in combination with `minColumnWidth`.
9
11
  */
10
12
  columns?: number;
11
13
  /**
@@ -14,12 +16,21 @@ export interface ColumnLayoutProps extends BaseComponentProps {
14
16
  variant?: ColumnLayoutProps.Variant;
15
17
  /**
16
18
  * Controls whether dividers are placed between rows and columns.
19
+ *
20
+ * Note: This is not supported when used with `minColumnWidth`.
17
21
  */
18
22
  borders?: ColumnLayoutProps.Borders;
19
23
  /**
20
24
  * Determines whether the default gutters between columns are removed.
21
25
  */
22
26
  disableGutters?: boolean;
27
+ /**
28
+ * Use together with `columns` to specify the desired minimum width for each column in pixels.
29
+ *
30
+ * The number of columns is determined by the value of this property, the available space,
31
+ * and the maximum number of columns as defined by the `columns` property.
32
+ */
33
+ minColumnWidth?: number;
23
34
  /**
24
35
  * The columns to render.
25
36
  */
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"lib/default/","sources":["column-layout/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEpD,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB;IAC3D;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,OAAO,CAAC,EAAE,iBAAiB,CAAC,OAAO,CAAC;IAEpC;;OAEG;IACH,OAAO,CAAC,EAAE,iBAAiB,CAAC,OAAO,CAAC;IAEpC;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,yBAAiB,iBAAiB,CAAC;IACjC,KAAY,OAAO,GAAG,SAAS,GAAG,WAAW,CAAC;IAC9C,KAAY,OAAO,GAAG,MAAM,GAAG,UAAU,GAAG,YAAY,GAAG,KAAK,CAAC;CAClE;AAED,MAAM,WAAW,yBAA0B,SAAQ,iBAAiB,EAAE,0BAA0B;IAC9F,YAAY,CAAC,EAAE,sBAAsB,CAAC;CACvC"}
1
+ {"version":3,"file":"interfaces.d.ts","sourceRoot":"lib/default/","sources":["column-layout/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEpD,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB;IAC3D;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,OAAO,CAAC,EAAE,iBAAiB,CAAC,OAAO,CAAC;IAEpC;;;;OAIG;IACH,OAAO,CAAC,EAAE,iBAAiB,CAAC,OAAO,CAAC;IAEpC;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,yBAAiB,iBAAiB,CAAC;IACjC,KAAY,OAAO,GAAG,SAAS,GAAG,WAAW,CAAC;IAC9C,KAAY,OAAO,GAAG,MAAM,GAAG,UAAU,GAAG,YAAY,GAAG,KAAK,CAAC;CAClE;AAED,MAAM,WAAW,yBAA0B,SAAQ,iBAAiB,EAAE,0BAA0B;IAC9F,YAAY,CAAC,EAAE,sBAAsB,CAAC;CACvC"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["column-layout/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\nimport React from 'react';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { ColumnLayoutBreakpoint } from './internal';\n\nexport interface ColumnLayoutProps extends BaseComponentProps {\n /**\n * Specifies the number of columns in each grid row.\n * Valid values are any integer between 1 and 4.\n */\n columns?: number;\n\n /**\n * Specifies the content type. This determines the spacing of the grid.\n */\n variant?: ColumnLayoutProps.Variant;\n\n /**\n * Controls whether dividers are placed between rows and columns.\n */\n borders?: ColumnLayoutProps.Borders;\n\n /**\n * Determines whether the default gutters between columns are removed.\n */\n disableGutters?: boolean;\n\n /**\n * The columns to render.\n */\n children?: React.ReactNode;\n}\n\nexport namespace ColumnLayoutProps {\n export type Variant = 'default' | 'text-grid';\n export type Borders = 'none' | 'vertical' | 'horizontal' | 'all';\n}\n\nexport interface InternalColumnLayoutProps extends ColumnLayoutProps, InternalBaseComponentProps {\n __breakpoint?: ColumnLayoutBreakpoint;\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["column-layout/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\nimport React from 'react';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { ColumnLayoutBreakpoint } from './internal';\n\nexport interface ColumnLayoutProps extends BaseComponentProps {\n /**\n * Specifies the number of columns in each grid row.\n * Valid values are any integer between 1 and 4.\n *\n * Note that there is no upper limit when used in combination with `minColumnWidth`.\n */\n columns?: number;\n\n /**\n * Specifies the content type. This determines the spacing of the grid.\n */\n variant?: ColumnLayoutProps.Variant;\n\n /**\n * Controls whether dividers are placed between rows and columns.\n *\n * Note: This is not supported when used with `minColumnWidth`.\n */\n borders?: ColumnLayoutProps.Borders;\n\n /**\n * Determines whether the default gutters between columns are removed.\n */\n disableGutters?: boolean;\n\n /**\n * Use together with `columns` to specify the desired minimum width for each column in pixels.\n *\n * The number of columns is determined by the value of this property, the available space,\n * and the maximum number of columns as defined by the `columns` property.\n */\n minColumnWidth?: number;\n\n /**\n * The columns to render.\n */\n children?: React.ReactNode;\n}\n\nexport namespace ColumnLayoutProps {\n export type Variant = 'default' | 'text-grid';\n export type Borders = 'none' | 'vertical' | 'horizontal' | 'all';\n}\n\nexport interface InternalColumnLayoutProps extends ColumnLayoutProps, InternalBaseComponentProps {\n __breakpoint?: ColumnLayoutBreakpoint;\n}\n"]}
@@ -1,10 +1,9 @@
1
- import React from 'react';
1
+ /// <reference types="react" />
2
2
  import { InternalColumnLayoutProps } from './interfaces';
3
3
  export declare const COLUMN_TRIGGERS: readonly ["default", "xxs", "xs"];
4
4
  export type ColumnLayoutBreakpoint = typeof COLUMN_TRIGGERS[number] | null;
5
5
  /**
6
6
  * A responsive grid layout.
7
7
  */
8
- declare const _default: React.ForwardRefExoticComponent<InternalColumnLayoutProps & React.RefAttributes<any>>;
9
- export default _default;
8
+ export default function ColumnLayout({ columns, variant, borders, disableGutters, minColumnWidth, children, __breakpoint, __internalRootRef, ...restProps }: InternalColumnLayoutProps): JSX.Element;
10
9
  //# sourceMappingURL=internal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["column-layout/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAEzD,eAAO,MAAM,eAAe,mCAAoC,CAAC;AACjE,MAAM,MAAM,sBAAsB,GAAG,OAAO,eAAe,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;AAQ3E;;GAEG;;AACH,wBAyCG"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["column-layout/internal.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAKzD,eAAO,MAAM,eAAe,mCAAoC,CAAC;AACjE,MAAM,MAAM,sBAAsB,GAAG,OAAO,eAAe,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;AAE3E;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,OAAW,EACX,OAAmB,EACnB,OAAgB,EAChB,cAAsB,EACtB,cAAc,EACd,QAAQ,EACR,YAAY,EACZ,iBAAiB,EACjB,GAAG,SAAS,EACb,EAAE,yBAAyB,eA4B3B"}
@@ -3,38 +3,17 @@ import { __rest } from "tslib";
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  import React from 'react';
5
5
  import clsx from 'clsx';
6
- import flattenChildren from 'react-keyed-flatten-children';
7
- import InternalGrid from '../grid/internal';
8
6
  import { getBaseProps } from '../internal/base-component';
9
- import { repeat } from './util';
7
+ import FlexibleColumnLayout from './flexible-column-layout';
8
+ import GridColumnLayout from './grid-column-layout';
10
9
  import styles from './styles.css.js';
11
10
  export const COLUMN_TRIGGERS = ['default', 'xxs', 'xs'];
12
- const COLUMN_DEFS = {
13
- 1: { colspan: { default: 12, xxs: 12, xs: 12 } },
14
- 2: { colspan: { default: 12, xxs: 6, xs: 6 } },
15
- 3: { colspan: { default: 12, xxs: 6, xs: 4 } },
16
- 4: { colspan: { default: 12, xxs: 6, xs: 3 } },
17
- };
18
11
  /**
19
12
  * A responsive grid layout.
20
13
  */
21
- export default React.forwardRef(function ColumnLayout(_a, ref) {
22
- var _b;
23
- var { columns = 1, variant = 'default', borders = 'none', disableGutters = false, children, __breakpoint, __internalRootRef } = _a, restProps = __rest(_a, ["columns", "variant", "borders", "disableGutters", "children", "__breakpoint", "__internalRootRef"]);
14
+ export default function ColumnLayout(_a) {
15
+ var { columns = 1, variant = 'default', borders = 'none', disableGutters = false, minColumnWidth, children, __breakpoint, __internalRootRef } = _a, restProps = __rest(_a, ["columns", "variant", "borders", "disableGutters", "minColumnWidth", "children", "__breakpoint", "__internalRootRef"]);
24
16
  const baseProps = getBaseProps(restProps);
25
- const isTextGridVariant = variant === 'text-grid';
26
- const shouldDisableGutters = !isTextGridVariant && disableGutters;
27
- const shouldHaveHorizontalBorders = !isTextGridVariant && (borders === 'horizontal' || borders === 'all');
28
- const shouldHaveVerticalBorders = !isTextGridVariant && (borders === 'vertical' || borders === 'all');
29
- /*
30
- Flattening the children allows us to "see through" React Fragments and nested arrays.
31
- */
32
- const flattenedChildren = flattenChildren(children);
33
- return (React.createElement("div", Object.assign({}, baseProps, { className: clsx(baseProps.className, styles['column-layout']), ref: __internalRootRef }),
34
- React.createElement(InternalGrid, { ref: ref, disableGutters: true, gridDefinition: repeat((_b = COLUMN_DEFS[columns]) !== null && _b !== void 0 ? _b : {}, flattenedChildren.length), className: clsx(styles.grid, styles[`grid-columns-${columns}`], styles[`grid-variant-${variant}`], {
35
- [styles['grid-horizontal-borders']]: shouldHaveHorizontalBorders,
36
- [styles['grid-vertical-borders']]: shouldHaveVerticalBorders,
37
- [styles['grid-no-gutters']]: shouldDisableGutters,
38
- }), __breakpoint: __breakpoint, __responsiveClassName: breakpoint => breakpoint && styles[`grid-breakpoint-${breakpoint}`] }, children)));
39
- });
17
+ return (React.createElement("div", Object.assign({}, baseProps, { className: clsx(baseProps.className, styles['column-layout']), ref: __internalRootRef }), minColumnWidth ? (React.createElement(FlexibleColumnLayout, { columns: columns, borders: borders, variant: variant, minColumnWidth: minColumnWidth, disableGutters: disableGutters }, children)) : (React.createElement(GridColumnLayout, { columns: columns, variant: variant, borders: borders, disableGutters: disableGutters, __breakpoint: __breakpoint }, children))));
18
+ }
40
19
  //# sourceMappingURL=internal.js.map