@cloudscape-design/components-themeable 3.0.686 → 3.0.688
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/lib/internal/manifest.json +1 -1
- package/lib/internal/scss/internal/components/button-trigger/styles.scss +1 -1
- package/lib/internal/scss/internal/components/checkbox-icon/styles.scss +5 -1
- package/lib/internal/scss/radio-group/styles.scss +6 -1
- package/lib/internal/scss/slider/mixins.scss +23 -0
- package/lib/internal/scss/slider/styles.scss +57 -0
- package/lib/internal/scss/tiles/styles.scss +4 -0
- package/lib/internal/scss/toggle/styles.scss +10 -0
- package/lib/internal/scss/token-group/styles.scss +15 -0
- package/lib/internal/template/checkbox/base-checkbox.d.ts +7 -0
- package/lib/internal/template/checkbox/base-checkbox.d.ts.map +1 -1
- package/lib/internal/template/checkbox/base-checkbox.js.map +1 -1
- package/lib/internal/template/checkbox/internal.d.ts.map +1 -1
- package/lib/internal/template/checkbox/internal.js +3 -3
- package/lib/internal/template/checkbox/internal.js.map +1 -1
- package/lib/internal/template/date-picker/interfaces.d.ts +1 -1
- package/lib/internal/template/date-picker/interfaces.js.map +1 -1
- package/lib/internal/template/date-range-picker/index.d.ts.map +1 -1
- package/lib/internal/template/date-range-picker/index.js +1 -3
- package/lib/internal/template/date-range-picker/index.js.map +1 -1
- package/lib/internal/template/input/interfaces.d.ts +1 -1
- package/lib/internal/template/input/interfaces.js.map +1 -1
- package/lib/internal/template/internal/base-component/styles.scoped.css +11 -0
- package/lib/internal/template/internal/components/abstract-switch/index.d.ts +2 -1
- package/lib/internal/template/internal/components/abstract-switch/index.d.ts.map +1 -1
- package/lib/internal/template/internal/components/abstract-switch/index.js +2 -2
- package/lib/internal/template/internal/components/abstract-switch/index.js.map +1 -1
- package/lib/internal/template/internal/components/button-trigger/index.d.ts.map +1 -1
- package/lib/internal/template/internal/components/button-trigger/index.js +5 -2
- package/lib/internal/template/internal/components/button-trigger/index.js.map +1 -1
- package/lib/internal/template/internal/components/button-trigger/styles.css.js +11 -11
- package/lib/internal/template/internal/components/button-trigger/styles.scoped.css +26 -26
- package/lib/internal/template/internal/components/button-trigger/styles.selectors.js +11 -11
- package/lib/internal/template/internal/components/checkbox-icon/index.d.ts +2 -1
- package/lib/internal/template/internal/components/checkbox-icon/index.d.ts.map +1 -1
- package/lib/internal/template/internal/components/checkbox-icon/index.js +6 -2
- package/lib/internal/template/internal/components/checkbox-icon/index.js.map +1 -1
- package/lib/internal/template/internal/components/checkbox-icon/styles.css.js +9 -7
- package/lib/internal/template/internal/components/checkbox-icon/styles.scoped.css +11 -8
- package/lib/internal/template/internal/components/checkbox-icon/styles.selectors.js +9 -7
- package/lib/internal/template/internal/environment.js +1 -1
- package/lib/internal/template/internal/environment.json +1 -1
- package/lib/internal/template/internal/generated/styles/tokens.d.ts +1 -0
- package/lib/internal/template/internal/generated/styles/tokens.js +1 -0
- package/lib/internal/template/internal/generated/theming/index.cjs +33 -0
- package/lib/internal/template/internal/generated/theming/index.cjs.d.ts +8 -0
- package/lib/internal/template/internal/generated/theming/index.d.ts +8 -0
- package/lib/internal/template/internal/generated/theming/index.js +33 -0
- package/lib/internal/template/multiselect/internal.d.ts.map +1 -1
- package/lib/internal/template/multiselect/internal.js +3 -3
- package/lib/internal/template/multiselect/internal.js.map +1 -1
- package/lib/internal/template/radio-group/interfaces.d.ts +6 -0
- package/lib/internal/template/radio-group/interfaces.d.ts.map +1 -1
- package/lib/internal/template/radio-group/interfaces.js.map +1 -1
- package/lib/internal/template/radio-group/internal.d.ts.map +1 -1
- package/lib/internal/template/radio-group/internal.js +3 -3
- package/lib/internal/template/radio-group/internal.js.map +1 -1
- package/lib/internal/template/radio-group/radio-button.d.ts +1 -0
- package/lib/internal/template/radio-group/radio-button.d.ts.map +1 -1
- package/lib/internal/template/radio-group/radio-button.js +7 -3
- package/lib/internal/template/radio-group/radio-button.js.map +1 -1
- package/lib/internal/template/radio-group/styles.css.js +10 -9
- package/lib/internal/template/radio-group/styles.scoped.css +19 -15
- package/lib/internal/template/radio-group/styles.selectors.js +10 -9
- package/lib/internal/template/select/interfaces.d.ts +5 -0
- package/lib/internal/template/select/interfaces.d.ts.map +1 -1
- package/lib/internal/template/select/interfaces.js.map +1 -1
- package/lib/internal/template/select/internal.d.ts.map +1 -1
- package/lib/internal/template/select/internal.js +2 -2
- package/lib/internal/template/select/internal.js.map +1 -1
- package/lib/internal/template/select/parts/trigger.d.ts +1 -0
- package/lib/internal/template/select/parts/trigger.d.ts.map +1 -1
- package/lib/internal/template/select/parts/trigger.js +2 -2
- package/lib/internal/template/select/parts/trigger.js.map +1 -1
- package/lib/internal/template/slider/interfaces.d.ts +6 -0
- package/lib/internal/template/slider/interfaces.d.ts.map +1 -1
- package/lib/internal/template/slider/interfaces.js.map +1 -1
- package/lib/internal/template/slider/internal.d.ts +1 -1
- package/lib/internal/template/slider/internal.d.ts.map +1 -1
- package/lib/internal/template/slider/internal.js +15 -6
- package/lib/internal/template/slider/internal.js.map +1 -1
- package/lib/internal/template/slider/styles.css.js +27 -25
- package/lib/internal/template/slider/styles.scoped.css +129 -62
- package/lib/internal/template/slider/styles.selectors.js +27 -25
- package/lib/internal/template/slider/tick-marks.d.ts +1 -0
- package/lib/internal/template/slider/tick-marks.d.ts.map +1 -1
- package/lib/internal/template/slider/tick-marks.js +2 -1
- package/lib/internal/template/slider/tick-marks.js.map +1 -1
- package/lib/internal/template/slider/utils.d.ts +1 -0
- package/lib/internal/template/slider/utils.d.ts.map +1 -1
- package/lib/internal/template/slider/utils.js +1 -0
- package/lib/internal/template/slider/utils.js.map +1 -1
- package/lib/internal/template/tiles/interfaces.d.ts +6 -0
- package/lib/internal/template/tiles/interfaces.d.ts.map +1 -1
- package/lib/internal/template/tiles/interfaces.js.map +1 -1
- package/lib/internal/template/tiles/internal.d.ts.map +1 -1
- package/lib/internal/template/tiles/internal.js +3 -3
- package/lib/internal/template/tiles/internal.js.map +1 -1
- package/lib/internal/template/tiles/styles.css.js +30 -29
- package/lib/internal/template/tiles/styles.scoped.css +75 -70
- package/lib/internal/template/tiles/styles.selectors.js +30 -29
- package/lib/internal/template/tiles/tile.d.ts +1 -0
- package/lib/internal/template/tiles/tile.d.ts.map +1 -1
- package/lib/internal/template/tiles/tile.js +4 -4
- package/lib/internal/template/tiles/tile.js.map +1 -1
- package/lib/internal/template/toggle/internal.d.ts.map +1 -1
- package/lib/internal/template/toggle/internal.js +4 -2
- package/lib/internal/template/toggle/internal.js.map +1 -1
- package/lib/internal/template/toggle/styles.css.js +10 -8
- package/lib/internal/template/toggle/styles.scoped.css +23 -14
- package/lib/internal/template/toggle/styles.selectors.js +10 -8
- package/lib/internal/template/token-group/dismiss-button.d.ts +1 -0
- package/lib/internal/template/token-group/dismiss-button.d.ts.map +1 -1
- package/lib/internal/template/token-group/dismiss-button.js +7 -2
- package/lib/internal/template/token-group/dismiss-button.js.map +1 -1
- package/lib/internal/template/token-group/interfaces.d.ts +5 -0
- package/lib/internal/template/token-group/interfaces.d.ts.map +1 -1
- package/lib/internal/template/token-group/interfaces.js.map +1 -1
- package/lib/internal/template/token-group/internal.d.ts +1 -1
- package/lib/internal/template/token-group/internal.d.ts.map +1 -1
- package/lib/internal/template/token-group/internal.js +2 -2
- package/lib/internal/template/token-group/internal.js.map +1 -1
- package/lib/internal/template/token-group/styles.css.js +10 -9
- package/lib/internal/template/token-group/styles.scoped.css +33 -19
- package/lib/internal/template/token-group/styles.selectors.js +10 -9
- package/lib/internal/template/token-group/token.d.ts +2 -1
- package/lib/internal/template/token-group/token.d.ts.map +1 -1
- package/lib/internal/template/token-group/token.js +3 -3
- package/lib/internal/template/token-group/token.js.map +1 -1
- package/lib/internal/template/top-navigation/1.0-beta/interfaces.d.ts +1 -1
- package/lib/internal/template/top-navigation/1.0-beta/interfaces.js.map +1 -1
- package/lib/internal/template/top-navigation/interfaces.d.ts +1 -1
- package/lib/internal/template/top-navigation/interfaces.js.map +1 -1
- package/package.json +1 -1
|
@@ -2,30 +2,32 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"root": "
|
|
6
|
-
"slider": "
|
|
7
|
-
"slider-track": "awsui_slider-
|
|
8
|
-
"slider-range": "awsui_slider-
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"labels
|
|
17
|
-
"labels-
|
|
18
|
-
"labels-
|
|
19
|
-
"labels-
|
|
20
|
-
"labels-
|
|
21
|
-
"
|
|
22
|
-
"ticks
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
5
|
+
"root": "awsui_root_pcgz5_ts4q0_101",
|
|
6
|
+
"slider": "awsui_slider_pcgz5_ts4q0_141",
|
|
7
|
+
"slider-track": "awsui_slider-track_pcgz5_ts4q0_145",
|
|
8
|
+
"slider-range": "awsui_slider-range_pcgz5_ts4q0_145",
|
|
9
|
+
"readonly": "awsui_readonly_pcgz5_ts4q0_154",
|
|
10
|
+
"disabled": "awsui_disabled_pcgz5_ts4q0_154",
|
|
11
|
+
"error": "awsui_error_pcgz5_ts4q0_177",
|
|
12
|
+
"warning": "awsui_warning_pcgz5_ts4q0_180",
|
|
13
|
+
"active": "awsui_active_pcgz5_ts4q0_183",
|
|
14
|
+
"error-active": "awsui_error-active_pcgz5_ts4q0_186",
|
|
15
|
+
"warning-active": "awsui_warning-active_pcgz5_ts4q0_189",
|
|
16
|
+
"labels": "awsui_labels_pcgz5_ts4q0_200",
|
|
17
|
+
"labels-noref": "awsui_labels-noref_pcgz5_ts4q0_206",
|
|
18
|
+
"labels-reference": "awsui_labels-reference_pcgz5_ts4q0_209",
|
|
19
|
+
"labels-min": "awsui_labels-min_pcgz5_ts4q0_216",
|
|
20
|
+
"labels-max": "awsui_labels-max_pcgz5_ts4q0_222",
|
|
21
|
+
"labels-aria-description": "awsui_labels-aria-description_pcgz5_ts4q0_230",
|
|
22
|
+
"ticks": "awsui_ticks_pcgz5_ts4q0_248",
|
|
23
|
+
"ticks-wrapper": "awsui_ticks-wrapper_pcgz5_ts4q0_254",
|
|
24
|
+
"tick": "awsui_tick_pcgz5_ts4q0_248",
|
|
25
|
+
"middle": "awsui_middle_pcgz5_ts4q0_269",
|
|
26
|
+
"filled": "awsui_filled_pcgz5_ts4q0_272",
|
|
27
|
+
"tick-disabled": "awsui_tick-disabled_pcgz5_ts4q0_275",
|
|
28
|
+
"tooltip-thumb": "awsui_tooltip-thumb_pcgz5_ts4q0_300",
|
|
29
|
+
"thumb": "awsui_thumb_pcgz5_ts4q0_313",
|
|
30
|
+
"min": "awsui_min_pcgz5_ts4q0_349",
|
|
31
|
+
"max": "awsui_max_pcgz5_ts4q0_352"
|
|
30
32
|
};
|
|
31
33
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tick-marks.d.ts","sourceRoot":"","sources":["../../../src/slider/tick-marks.tsx"],"names":[],"mappings":";AAQA,MAAM,WAAW,gBAAgB;IAC/B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,mBAAoB,SAAQ,gBAAgB;IAC3D,IAAI,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;CAC9B;
|
|
1
|
+
{"version":3,"file":"tick-marks.d.ts","sourceRoot":"","sources":["../../../src/slider/tick-marks.tsx"],"names":[],"mappings":";AAQA,MAAM,WAAW,gBAAgB;IAC/B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,mBAAoB,SAAQ,gBAAgB;IAC3D,IAAI,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;CAC9B;AAkCD,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,KAAK,EAAE,gBAAgB,eAmB9D"}
|
|
@@ -6,7 +6,7 @@ import customCssProps from '../internal/generated/custom-css-properties/index.js
|
|
|
6
6
|
import styles from './styles.css.js';
|
|
7
7
|
import { getStepArray } from './utils.js';
|
|
8
8
|
function TickMark(props) {
|
|
9
|
-
const { hideFillLine, value, isActive, invalid, warning, disabled, type, min, max, step } = props;
|
|
9
|
+
const { hideFillLine, value, isActive, invalid, warning, disabled, type, min, max, step, readOnly } = props;
|
|
10
10
|
const showWarning = warning && !invalid;
|
|
11
11
|
const getType = () => {
|
|
12
12
|
if (type === 'min') {
|
|
@@ -25,6 +25,7 @@ function TickMark(props) {
|
|
|
25
25
|
[styles['error-active']]: invalid && isActive && !hideFillLine && value > getType(),
|
|
26
26
|
[styles['warning-active']]: showWarning && isActive && !hideFillLine && value > getType(),
|
|
27
27
|
[styles.disabled]: disabled,
|
|
28
|
+
[styles.readonly]: readOnly,
|
|
28
29
|
[styles.middle]: type === 'step',
|
|
29
30
|
}) }));
|
|
30
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tick-marks.js","sourceRoot":"","sources":["../../../src/slider/tick-marks.ts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AC,CACnD,oBAAC,QAAQ,oBAAK,KAAK,IAAE,IAAI,EAAC,MAAM,EAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,KAAK,EAAE,IAAI,CACtE,CAAC,CACE;QACN,oBAAC,QAAQ,oBAAK,KAAK,IAAE,IAAI,EAAC,KAAK,IAAG,CAC9B,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 customCssProps from '../internal/generated/custom-css-properties/index.js';\nimport styles from './styles.css.js';\nimport { getStepArray } from './utils.js';\n\nexport interface SliderTicksProps {\n hideFillLine?: boolean;\n value: number;\n isActive: boolean;\n invalid?: boolean;\n warning?: boolean;\n disabled?: boolean;\n readOnly?: boolean;\n min: number;\n max: number;\n step: number;\n}\n\nexport interface SliderTickMarkProps extends SliderTicksProps {\n type: 'min' | 'max' | 'step';\n}\n\nfunction TickMark(props: SliderTickMarkProps) {\n const { hideFillLine, value, isActive, invalid, warning, disabled, type, min, max, step, readOnly } = props;\n\n const showWarning = warning && !invalid;\n\n const getType = () => {\n if (type === 'min') {\n return min;\n }\n if (type === 'max') {\n return max;\n }\n return step;\n };\n\n return (\n <div\n className={clsx(styles.tick, {\n [styles.filled]: !hideFillLine && value > getType(),\n [styles.active]: !hideFillLine && isActive && value > getType(),\n [styles.error]: invalid && !hideFillLine && value > getType(),\n [styles.warning]: showWarning && !hideFillLine && value > getType(),\n [styles['error-active']]: invalid && isActive && !hideFillLine && value > getType(),\n [styles['warning-active']]: showWarning && isActive && !hideFillLine && value > getType(),\n [styles.disabled]: disabled,\n [styles.readonly]: readOnly,\n [styles.middle]: type === 'step',\n })}\n />\n );\n}\n\nexport default function SliderTickMarks(props: SliderTicksProps) {\n const { min, max, step } = props;\n\n return (\n <div className={styles['ticks-wrapper']}>\n <TickMark {...props} type=\"min\" />\n <div\n className={styles.ticks}\n style={{\n [customCssProps.sliderTickCount]: Math.round((max - min) / step),\n }}\n >\n {getStepArray(step, [min, max]).map((step, index) => (\n <TickMark {...props} type=\"step\" step={step} key={`step-${index}`} />\n ))}\n </div>\n <TickMark {...props} type=\"max\" />\n </div>\n );\n}\n"]}
|
|
@@ -6,4 +6,5 @@ export declare const findLowerAndHigherValues: <T extends number>(array: readonl
|
|
|
6
6
|
};
|
|
7
7
|
export declare const valuesAreValid: (referenceValues: ReadonlyArray<number>) => boolean;
|
|
8
8
|
export declare const THUMB_SIZE = 16;
|
|
9
|
+
export declare const THUMB_READONLY_SIZE = 12;
|
|
9
10
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/slider/utils.ts"],"names":[],"mappings":"AAGA,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,UAE1E;AAeD,eAAO,MAAM,YAAY,SAAU,MAAM,qDAiBxC,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;CAYpC,CAAC;AAEF,eAAO,MAAM,cAAc,oBAAqB,cAAc,MAAM,CAAC,YAIpE,CAAC;AAEF,eAAO,MAAM,UAAU,KAAK,CAAC"}
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/slider/utils.ts"],"names":[],"mappings":"AAGA,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,UAE1E;AAeD,eAAO,MAAM,YAAY,SAAU,MAAM,qDAiBxC,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;CAYpC,CAAC;AAEF,eAAO,MAAM,cAAc,oBAAqB,cAAc,MAAM,CAAC,YAIpE,CAAC;AAEF,eAAO,MAAM,UAAU,KAAK,CAAC;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-2.0\n\nexport function getPercent(value: number, range: [min: number, max: number]) {\n return ((value - range[0]) / (range[1] - range[0])) * 100;\n}\n\nfunction countDecimals(value: number) {\n if (Math.floor(value) === value) {\n return 0;\n }\n\n const str = Math.abs(value).toString();\n // very small numbers, e.g. 1e-9\n if (str.indexOf('-') !== -1) {\n return parseInt(str.split('-')[1], 10) || 0;\n }\n return str.split('.')[1]?.length || 0;\n}\n\nexport const getStepArray = (step: number, [min, max]: [min: number, max: number]) => {\n const steps = [min];\n\n // JS struggles with rounding errors when using decimals, so include a multiplier\n // to make step calculations integer-based\n const multiplier = Math.pow(10, countDecimals(step));\n\n let currentStep = min;\n\n while (currentStep < max) {\n currentStep = (multiplier * currentStep + multiplier * step) / multiplier;\n if (currentStep <= max) {\n steps.push(currentStep);\n }\n }\n\n return steps;\n};\n\nexport const findLowerAndHigherValues = <T extends number>(\n array: ReadonlyArray<T>,\n value: T\n): { lower: undefined | T; higher: undefined | T } => {\n let sortedArray = [...array];\n sortedArray = sortedArray.sort((a, b) => a - b);\n\n const index = sortedArray.indexOf(value) || 0;\n const lower = sortedArray[index - 1] || undefined;\n const higher = sortedArray[index + 1] || undefined;\n\n return { lower, higher };\n};\n\nexport const valuesAreValid = (referenceValues: ReadonlyArray<number>) => {\n const valuesWithDecimals = referenceValues?.filter(value => !Number.isInteger(value));\n\n return valuesWithDecimals.length === 0;\n};\n\nexport const THUMB_SIZE = 16;\n"]}
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/slider/utils.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,MAAM,UAAU,UAAU,CAAC,KAAa,EAAE,KAAiC;IACzE,OAAO,CAAC,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;AAC5D,CAAC;AAED,SAAS,aAAa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7B,WAAW,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAEhD,MAAM,KAAK,GAAG,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC9C,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,GAAG,CAAC,CAAC,IAAI,SAAS,CAAC;IAClD,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,GAAG,CAAC,CAAC,IAAI,SAAS,CAAC;IAEnD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAC3B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,eAAsC,EAAE,EAAE;IACvE,MAAM,kBAAkB,GAAG,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;IAEtF,OAAO,kBAAkB,CAAC,MAAM,KAAK,CAAC,CAAC;AACzC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,EAAE,CAAC;AAC7B,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport function getPercent(value: number, range: [min: number, max: number]) {\n return ((value - range[0]) / (range[1] - range[0])) * 100;\n}\n\nfunction countDecimals(value: number) {\n if (Math.floor(value) === value) {\n return 0;\n }\n\n const str = Math.abs(value).toString();\n // very small numbers, e.g. 1e-9\n if (str.indexOf('-') !== -1) {\n return parseInt(str.split('-')[1], 10) || 0;\n }\n return str.split('.')[1]?.length || 0;\n}\n\nexport const getStepArray = (step: number, [min, max]: [min: number, max: number]) => {\n const steps = [min];\n\n // JS struggles with rounding errors when using decimals, so include a multiplier\n // to make step calculations integer-based\n const multiplier = Math.pow(10, countDecimals(step));\n\n let currentStep = min;\n\n while (currentStep < max) {\n currentStep = (multiplier * currentStep + multiplier * step) / multiplier;\n if (currentStep <= max) {\n steps.push(currentStep);\n }\n }\n\n return steps;\n};\n\nexport const findLowerAndHigherValues = <T extends number>(\n array: ReadonlyArray<T>,\n value: T\n): { lower: undefined | T; higher: undefined | T } => {\n let sortedArray = [...array];\n sortedArray = sortedArray.sort((a, b) => a - b);\n\n const index = sortedArray.indexOf(value) || 0;\n const lower = sortedArray[index - 1] || undefined;\n const higher = sortedArray[index + 1] || undefined;\n\n return { lower, higher };\n};\n\nexport const valuesAreValid = (referenceValues: ReadonlyArray<number>) => {\n const valuesWithDecimals = referenceValues?.filter(value => !Number.isInteger(value));\n\n return valuesWithDecimals.length === 0;\n};\n\nexport const THUMB_SIZE = 16;\nexport const THUMB_READONLY_SIZE = 12;\n"]}
|
|
@@ -49,6 +49,12 @@ export interface TilesProps extends BaseComponentProps, FormFieldControlProps {
|
|
|
49
49
|
* If the component controls any secondary content (for example, another form field), use this to provide an ID referring to the secondary content.
|
|
50
50
|
*/
|
|
51
51
|
ariaControls?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Specifies if the control is read-only, which prevents the
|
|
54
|
+
* user from modifying the value, but does not prevent the value from
|
|
55
|
+
* being included in a form submission. A read-only control is still focusable.
|
|
56
|
+
*/
|
|
57
|
+
readOnly?: boolean;
|
|
52
58
|
}
|
|
53
59
|
export declare namespace TilesProps {
|
|
54
60
|
type Breakpoint = _Breakpoint;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/tiles/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAA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H,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,QAAQ,CAAC,EAAE,yBAAyB,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IAE9D;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,yBAAiB,UAAU,CAAC;IAC1B,KAAY,UAAU,GAAG,WAAW,CAAC;IACrC,UAAiB,eAAe;QAC9B,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;QACvB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;QAC9B,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;QACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB;IAED,UAAiB,YAAY;QAC3B,KAAK,EAAE,MAAM,CAAC;KACf;IAED,UAAiB,GAAG;QAClB;;WAEG;QACH,KAAK,IAAI,IAAI,CAAC;KACf;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/tiles/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { FormFieldControlProps } from '../internal/context/form-field-context';\nimport { Breakpoint as _Breakpoint } from '../internal/breakpoints';\n\nexport interface TilesProps extends BaseComponentProps, FormFieldControlProps {\n /**\n * Specify a custom name for the native radio buttons. If not provided, the tiles component generates a random name.\n */\n name?: string;\n\n /**\n * Specifies the value of the selected tile.\n * If you want to clear the selection, use `null`.\n */\n value: string | null;\n\n /**\n * List of tile definitions. Each tile has the following properties:\n *\n * - `value` [string] - The value that will be associated with the tile. This is the value the tiles will get when the radio button is selected.\n * - `label` [ReactNode] - A short description for the option the tile represents.\n * - `description` [ReactNode] - (Optional) Further explanatory guidance on the tile option, shown below the `label`.\n * - `image` [ReactNode] - (Optional) Visually distinctive image for the tile option, shown below the `description`.\n * - `disabled` [boolean] - (Optional) Specifies whether the tile is disabled. Users can't select disabled tiles.\n * - `controlId` [string] - (Optional) The ID of the internal input. You can use this to relate a label element's `for` attribute to this control.\n * We recommend that you don't set this property because it's automatically set by the tiles component.\n */\n items?: ReadonlyArray<TilesProps.TilesDefinition>;\n\n /**\n * Adds `aria-label` on the group. Don't set this property if you are using this form element within a form field\n * because the form field component automatically sets the correct labels to make the component accessible.\n */\n ariaLabel?: string;\n\n /**\n * Adds `aria-required` on the group.\n */\n ariaRequired?: boolean;\n\n /**\n * The number of columns for the tiles to be displayed in. Valid values are integers between 1 and 4.\n * If no value is specified, the number of columns is determined based on the number of items, with a maximum of 3.\n * It is set to 2 if 4 or 8 items are supplied in order to optimize the layout.\n */\n columns?: number;\n\n /**\n * Called when the user selects a different tile.\n */\n onChange?: NonCancelableEventHandler<TilesProps.ChangeDetail>;\n\n /**\n * Adds `aria-controls` attribute to the component.\n * If the component controls any secondary content (for example, another form field), use this to provide an ID referring to the secondary content.\n */\n ariaControls?: string;\n}\n\nexport namespace TilesProps {\n export type Breakpoint = _Breakpoint;\n export interface TilesDefinition {\n value: string;\n label: React.ReactNode;\n description?: React.ReactNode;\n image?: React.ReactNode;\n disabled?: boolean;\n controlId?: string;\n }\n\n export interface ChangeDetail {\n value: string;\n }\n\n export interface Ref {\n /**\n * Sets input focus onto the UI control.\n */\n focus(): void;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/tiles/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { FormFieldControlProps } from '../internal/context/form-field-context';\nimport { Breakpoint as _Breakpoint } from '../internal/breakpoints';\n\nexport interface TilesProps extends BaseComponentProps, FormFieldControlProps {\n /**\n * Specify a custom name for the native radio buttons. If not provided, the tiles component generates a random name.\n */\n name?: string;\n\n /**\n * Specifies the value of the selected tile.\n * If you want to clear the selection, use `null`.\n */\n value: string | null;\n\n /**\n * List of tile definitions. Each tile has the following properties:\n *\n * - `value` [string] - The value that will be associated with the tile. This is the value the tiles will get when the radio button is selected.\n * - `label` [ReactNode] - A short description for the option the tile represents.\n * - `description` [ReactNode] - (Optional) Further explanatory guidance on the tile option, shown below the `label`.\n * - `image` [ReactNode] - (Optional) Visually distinctive image for the tile option, shown below the `description`.\n * - `disabled` [boolean] - (Optional) Specifies whether the tile is disabled. Users can't select disabled tiles.\n * - `controlId` [string] - (Optional) The ID of the internal input. You can use this to relate a label element's `for` attribute to this control.\n * We recommend that you don't set this property because it's automatically set by the tiles component.\n */\n items?: ReadonlyArray<TilesProps.TilesDefinition>;\n\n /**\n * Adds `aria-label` on the group. Don't set this property if you are using this form element within a form field\n * because the form field component automatically sets the correct labels to make the component accessible.\n */\n ariaLabel?: string;\n\n /**\n * Adds `aria-required` on the group.\n */\n ariaRequired?: boolean;\n\n /**\n * The number of columns for the tiles to be displayed in. Valid values are integers between 1 and 4.\n * If no value is specified, the number of columns is determined based on the number of items, with a maximum of 3.\n * It is set to 2 if 4 or 8 items are supplied in order to optimize the layout.\n */\n columns?: number;\n\n /**\n * Called when the user selects a different tile.\n */\n onChange?: NonCancelableEventHandler<TilesProps.ChangeDetail>;\n\n /**\n * Adds `aria-controls` attribute to the component.\n * If the component controls any secondary content (for example, another form field), use this to provide an ID referring to the secondary content.\n */\n ariaControls?: string;\n\n /**\n * Specifies if the control is read-only, which prevents the\n * user from modifying the value, but does not prevent the value from\n * being included in a form submission. A read-only control is still focusable.\n */\n readOnly?: boolean;\n}\n\nexport namespace TilesProps {\n export type Breakpoint = _Breakpoint;\n export interface TilesDefinition {\n value: string;\n label: React.ReactNode;\n description?: React.ReactNode;\n image?: React.ReactNode;\n disabled?: boolean;\n controlId?: string;\n }\n\n export interface ChangeDetail {\n value: string;\n }\n\n export interface Ref {\n /**\n * Sets input focus onto the UI control.\n */\n focus(): void;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/tiles/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAM1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AASlF,QAAA,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/tiles/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAM1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AASlF,QAAA,MAAM,aAAa,qHA0DlB,CAAC;AAqBF,eAAe,aAAa,CAAC"}
|
|
@@ -13,7 +13,7 @@ import { Tile } from './tile';
|
|
|
13
13
|
import useRadioGroupForwardFocus from '../internal/hooks/forward-focus/radio-group';
|
|
14
14
|
const COLUMN_TRIGGERS = ['default', 'xxs', 'xs'];
|
|
15
15
|
const InternalTiles = React.forwardRef((_a, ref) => {
|
|
16
|
-
var { name, value, items, ariaLabel, ariaRequired, ariaControls, columns, onChange, __internalRootRef = null } = _a, rest = __rest(_a, ["name", "value", "items", "ariaLabel", "ariaRequired", "ariaControls", "columns", "onChange", "__internalRootRef"]);
|
|
16
|
+
var { name, value, items, ariaLabel, ariaRequired, ariaControls, columns, onChange, readOnly, __internalRootRef = null } = _a, rest = __rest(_a, ["name", "value", "items", "ariaLabel", "ariaRequired", "ariaControls", "columns", "onChange", "readOnly", "__internalRootRef"]);
|
|
17
17
|
const baseProps = getBaseProps(rest);
|
|
18
18
|
const { ariaDescribedby, ariaLabelledby } = useFormFieldContext(rest);
|
|
19
19
|
const generatedName = useUniqueId('awsui-tiles-');
|
|
@@ -21,9 +21,9 @@ const InternalTiles = React.forwardRef((_a, ref) => {
|
|
|
21
21
|
const [breakpoint, breakpointRef] = useContainerBreakpoints(COLUMN_TRIGGERS);
|
|
22
22
|
const mergedRef = useMergeRefs(breakpointRef, __internalRootRef);
|
|
23
23
|
const columnCount = getColumnCount(items, columns);
|
|
24
|
-
return (React.createElement("div", Object.assign({ role: "radiogroup", "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedby, "aria-required": ariaRequired, "aria-controls": ariaControls }, baseProps, { className: clsx(baseProps.className, styles.root), ref: mergedRef }),
|
|
24
|
+
return (React.createElement("div", Object.assign({ role: "radiogroup", "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedby, "aria-required": ariaRequired, "aria-controls": ariaControls, "aria-readonly": readOnly ? 'true' : undefined }, baseProps, { className: clsx(baseProps.className, styles.root), ref: mergedRef }),
|
|
25
25
|
React.createElement("div", { className: clsx(styles.columns, styles[`column-${columnCount}`]) }, items &&
|
|
26
|
-
items.map((item, index) => (React.createElement(Tile, { ref: index === tileRefIndex ? tileRef : undefined, key: item.value, item: item, selected: item.value === value, name: name || generatedName, breakpoint: breakpoint, onChange: onChange }))))));
|
|
26
|
+
items.map((item, index) => (React.createElement(Tile, { ref: index === tileRefIndex ? tileRef : undefined, key: item.value, item: item, selected: item.value === value, name: name || generatedName, breakpoint: breakpoint, onChange: onChange, readOnly: readOnly }))))));
|
|
27
27
|
});
|
|
28
28
|
function getColumnCount(items, columns) {
|
|
29
29
|
if (columns) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/tiles/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAE9E,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,yBAAyB,MAAM,6CAA6C,CAAC;AAEpF,MAAM,eAAe,GAA4B,CAAC,SAAS,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;AAI1E,MAAM,aAAa,GAAG,KAAK,CAAC,UAAU,CACpC,CACE,
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/tiles/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAE9E,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OA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AAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,UAAU,WAAW,EAAE,CAAC,CAAC,IAClE,KAAK;YACJ,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CACzB,oBAAC,IAAI,IACH,GAAG,EAAE,KAAK,KAAK,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EACjD,GAAG,EAAE,IAAI,CAAC,KAAK,EACf,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,IAAI,CAAC,KAAK,KAAK,KAAK,EAC9B,IAAI,EAAE,IAAI,IAAI,aAAa,EAC3B,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC,CACA,CACF,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,SAAS,cAAc,CACrB,KAA4D,EAC5D,OAA2B;IAE3B,IAAI,OAAO,EAAE;QACX,OAAO,OAAO,CAAC;KAChB;IAED,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACxC,MAAM,aAAa,GAA2B;QAC5C,CAAC,EAAE,CAAC;QACJ,CAAC,EAAE,CAAC;QACJ,CAAC,EAAE,CAAC;QACJ,CAAC,EAAE,CAAC;QACJ,CAAC,EAAE,CAAC;KACL,CAAC;IACF,OAAO,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACpC,CAAC;AAED,eAAe,aAAa,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React from 'react';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { TilesProps } from './interfaces';\nimport styles from './styles.css.js';\n\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { useContainerBreakpoints } from '../internal/hooks/container-queries';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { Tile } from './tile';\nimport useRadioGroupForwardFocus from '../internal/hooks/forward-focus/radio-group';\n\nconst COLUMN_TRIGGERS: TilesProps.Breakpoint[] = ['default', 'xxs', 'xs'];\n\ntype InternalTilesProps = TilesProps & InternalBaseComponentProps;\n\nconst InternalTiles = React.forwardRef(\n (\n {\n name,\n value,\n items,\n ariaLabel,\n ariaRequired,\n ariaControls,\n columns,\n onChange,\n readOnly,\n __internalRootRef = null,\n ...rest\n }: InternalTilesProps,\n ref: React.Ref<TilesProps.Ref>\n ) => {\n const baseProps = getBaseProps(rest);\n const { ariaDescribedby, ariaLabelledby } = useFormFieldContext(rest);\n const generatedName = useUniqueId('awsui-tiles-');\n\n const [tileRef, tileRefIndex] = useRadioGroupForwardFocus(ref, items, value);\n const [breakpoint, breakpointRef] = useContainerBreakpoints(COLUMN_TRIGGERS);\n const mergedRef = useMergeRefs(breakpointRef, __internalRootRef);\n\n const columnCount = getColumnCount(items, columns);\n\n return (\n <div\n role=\"radiogroup\"\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n aria-describedby={ariaDescribedby}\n aria-required={ariaRequired}\n aria-controls={ariaControls}\n aria-readonly={readOnly ? 'true' : undefined}\n {...baseProps}\n className={clsx(baseProps.className, styles.root)}\n ref={mergedRef}\n >\n <div className={clsx(styles.columns, styles[`column-${columnCount}`])}>\n {items &&\n items.map((item, index) => (\n <Tile\n ref={index === tileRefIndex ? tileRef : undefined}\n key={item.value}\n item={item}\n selected={item.value === value}\n name={name || generatedName}\n breakpoint={breakpoint}\n onChange={onChange}\n readOnly={readOnly}\n />\n ))}\n </div>\n </div>\n );\n }\n);\n\nfunction getColumnCount(\n items: ReadonlyArray<TilesProps.TilesDefinition> | undefined,\n columns: number | undefined\n): number {\n if (columns) {\n return columns;\n }\n\n const nItems = items ? items.length : 0;\n const columnsLookup: Record<number, number> = {\n 0: 1,\n 1: 1,\n 2: 2,\n 4: 2,\n 8: 2,\n };\n return columnsLookup[nItems] || 3;\n}\n\nexport default InternalTiles;\n"]}
|
|
@@ -1,34 +1,35 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"column-layout": "awsui_column-
|
|
5
|
-
"grid": "
|
|
6
|
-
"grid-no-gutters": "awsui_grid-no-
|
|
7
|
-
"grid-variant-text-grid": "awsui_grid-variant-text-
|
|
8
|
-
"grid-breakpoint-default": "awsui_grid-breakpoint-
|
|
9
|
-
"grid-columns-1": "awsui_grid-columns-
|
|
10
|
-
"grid-breakpoint-xxs": "awsui_grid-breakpoint-
|
|
11
|
-
"grid-breakpoint-xs": "awsui_grid-breakpoint-
|
|
12
|
-
"grid-columns-2": "awsui_grid-columns-
|
|
13
|
-
"grid-columns-3": "awsui_grid-columns-
|
|
14
|
-
"grid-columns-4": "awsui_grid-columns-
|
|
15
|
-
"grid-vertical-borders": "awsui_grid-vertical-
|
|
16
|
-
"grid-horizontal-borders": "awsui_grid-horizontal-
|
|
17
|
-
"root": "
|
|
18
|
-
"tile-container": "awsui_tile-
|
|
19
|
-
"refresh": "
|
|
20
|
-
"has-metadata": "awsui_has-
|
|
21
|
-
"selected": "
|
|
22
|
-
"disabled": "
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"breakpoint-
|
|
27
|
-
"
|
|
28
|
-
"column-
|
|
29
|
-
"column-
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"image": "
|
|
4
|
+
"column-layout": "awsui_column-layout_vj6p7_x18xx_97",
|
|
5
|
+
"grid": "awsui_grid_vj6p7_x18xx_132",
|
|
6
|
+
"grid-no-gutters": "awsui_grid-no-gutters_vj6p7_x18xx_138",
|
|
7
|
+
"grid-variant-text-grid": "awsui_grid-variant-text-grid_vj6p7_x18xx_142",
|
|
8
|
+
"grid-breakpoint-default": "awsui_grid-breakpoint-default_vj6p7_x18xx_150",
|
|
9
|
+
"grid-columns-1": "awsui_grid-columns-1_vj6p7_x18xx_153",
|
|
10
|
+
"grid-breakpoint-xxs": "awsui_grid-breakpoint-xxs_vj6p7_x18xx_153",
|
|
11
|
+
"grid-breakpoint-xs": "awsui_grid-breakpoint-xs_vj6p7_x18xx_156",
|
|
12
|
+
"grid-columns-2": "awsui_grid-columns-2_vj6p7_x18xx_159",
|
|
13
|
+
"grid-columns-3": "awsui_grid-columns-3_vj6p7_x18xx_165",
|
|
14
|
+
"grid-columns-4": "awsui_grid-columns-4_vj6p7_x18xx_171",
|
|
15
|
+
"grid-vertical-borders": "awsui_grid-vertical-borders_vj6p7_x18xx_187",
|
|
16
|
+
"grid-horizontal-borders": "awsui_grid-horizontal-borders_vj6p7_x18xx_220",
|
|
17
|
+
"root": "awsui_root_vj6p7_x18xx_274",
|
|
18
|
+
"tile-container": "awsui_tile-container_vj6p7_x18xx_312",
|
|
19
|
+
"refresh": "awsui_refresh_vj6p7_x18xx_327",
|
|
20
|
+
"has-metadata": "awsui_has-metadata_vj6p7_x18xx_331",
|
|
21
|
+
"selected": "awsui_selected_vj6p7_x18xx_337",
|
|
22
|
+
"disabled": "awsui_disabled_vj6p7_x18xx_342",
|
|
23
|
+
"readonly": "awsui_readonly_vj6p7_x18xx_347",
|
|
24
|
+
"columns": "awsui_columns_vj6p7_x18xx_363",
|
|
25
|
+
"column-1": "awsui_column-1_vj6p7_x18xx_369",
|
|
26
|
+
"breakpoint-xs": "awsui_breakpoint-xs_vj6p7_x18xx_376",
|
|
27
|
+
"breakpoint-xxs": "awsui_breakpoint-xxs_vj6p7_x18xx_380",
|
|
28
|
+
"column-2": "awsui_column-2_vj6p7_x18xx_384",
|
|
29
|
+
"column-3": "awsui_column-3_vj6p7_x18xx_399",
|
|
30
|
+
"column-4": "awsui_column-4_vj6p7_x18xx_414",
|
|
31
|
+
"control": "awsui_control_vj6p7_x18xx_430",
|
|
32
|
+
"no-image": "awsui_no-image_vj6p7_x18xx_434",
|
|
33
|
+
"image": "awsui_image_vj6p7_x18xx_438"
|
|
33
34
|
};
|
|
34
35
|
|