UNPKG

@workday/canvas-kit-react

Version:

The parent module that contains all Workday Canvas Kit React components

30 lines (29 loc) 1.24 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useToastModel = void 0; const common_1 = require("@workday/canvas-kit-react/common"); exports.useToastModel = (0, common_1.createModelHook)({ defaultConfig: { /** * Sets the correct aria attributes for the Toast. * Alert toasts are used to convey urgency and important information. The `role` is set to `alert` * Status toasts are used to convey a message or a successful action. The `role` is set to `status` * Dialog toasts are used when there's an action to be taken. The `role` is set to `dialog`. * If you use this mode, you must add an aria-label to the main `Toast` component. * The aria-label should provide additional information to the contents of the `Toast`. * @default 'status' */ mode: 'status', /** * When the Toast has a `mode="dialog"` this adds a unique id to `Toast.Message` so that the message gets read out for screen readers. */ id: '', }, })(config => { const id = (0, common_1.useUniqueId)(config.id); const state = { ...config, id, }; return { state, events: {} }; });