UNPKG

@awsui/components-react

Version:

AWS UI is a collection of [React](https://reactjs.org/) components that help create intuitive, responsive, and accessible user experiences for web applications. It is developed by Amazon Web Services (AWS). This work is available under the terms of the [A

51 lines (50 loc) 1.58 kB
function makeSlotId(prop, formFieldId, propName) { if (!prop) { return undefined; } return formFieldId + "-" + propName; } export function getSlotIds(formFieldId, label, description, constraintText, errorText) { var ids = { label: makeSlotId(label, formFieldId, 'label'), description: makeSlotId(description, formFieldId, 'description'), constraint: makeSlotId(constraintText, formFieldId, 'constraint'), error: makeSlotId(errorText, formFieldId, 'error') }; return ids; } export function getAriaDescribedBy(_a) { var error = _a.error, description = _a.description, constraint = _a.constraint; var describedByAttributes = [error, description, constraint].filter(function (e) { return !!e; }); var describedBy = describedByAttributes.length ? describedByAttributes.join(' ') : undefined; return describedBy; } export function getGridDefinition(stretch, secondaryControlPresent) { var columns = [ { colspan: { "default": 12 } }, { colspan: { "default": 12 } } ]; if (!stretch) { columns[0].colspan.xs = 9; columns[1].colspan.xs = 3; } if (!secondaryControlPresent) { return [columns[0]]; } return columns; } export var joinStrings = function () { var strings = []; for (var _i = 0; _i < arguments.length; _i++) { strings[_i] = arguments[_i]; } return strings.filter(function (val) { return val; }).join(' '); };