@mortenbrudvik/waveui 0.7.0 → 0.8.0
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/README.md +395 -132
- package/dist/components/button/Button.cjs +1 -1
- package/dist/components/button/Button.cjs.map +1 -1
- package/dist/components/button/Button.mjs +36 -35
- package/dist/components/button/Button.mjs.map +1 -1
- package/dist/components/button/Button.slots.cjs +1 -1
- package/dist/components/button/Button.slots.cjs.map +1 -1
- package/dist/components/button/Button.slots.mjs +31 -21
- package/dist/components/button/Button.slots.mjs.map +1 -1
- package/dist/components/button/CompoundButton.cjs +1 -1
- package/dist/components/button/CompoundButton.cjs.map +1 -1
- package/dist/components/button/CompoundButton.mjs +31 -29
- package/dist/components/button/CompoundButton.mjs.map +1 -1
- package/dist/components/button/Link.cjs +1 -1
- package/dist/components/button/Link.cjs.map +1 -1
- package/dist/components/button/Link.mjs +24 -23
- package/dist/components/button/Link.mjs.map +1 -1
- package/dist/components/button/MenuButton.cjs +1 -1
- package/dist/components/button/MenuButton.cjs.map +1 -1
- package/dist/components/button/MenuButton.mjs +29 -28
- package/dist/components/button/MenuButton.mjs.map +1 -1
- package/dist/components/button/SplitButton.cjs +1 -1
- package/dist/components/button/SplitButton.cjs.map +1 -1
- package/dist/components/button/SplitButton.mjs +46 -45
- package/dist/components/button/SplitButton.mjs.map +1 -1
- package/dist/components/button/ToggleButton.cjs +1 -1
- package/dist/components/button/ToggleButton.cjs.map +1 -1
- package/dist/components/button/ToggleButton.mjs +38 -35
- package/dist/components/button/ToggleButton.mjs.map +1 -1
- package/dist/components/button/Toolbar.cjs +1 -1
- package/dist/components/button/Toolbar.cjs.map +1 -1
- package/dist/components/button/Toolbar.mjs +43 -42
- package/dist/components/button/Toolbar.mjs.map +1 -1
- package/dist/components/button/Toolbar.parts.cjs +1 -1
- package/dist/components/button/Toolbar.parts.cjs.map +1 -1
- package/dist/components/button/Toolbar.parts.mjs +76 -81
- package/dist/components/button/Toolbar.parts.mjs.map +1 -1
- package/dist/components/data-display/Avatar.cjs +1 -1
- package/dist/components/data-display/Avatar.cjs.map +1 -1
- package/dist/components/data-display/Avatar.mjs +72 -67
- package/dist/components/data-display/Avatar.mjs.map +1 -1
- package/dist/components/data-display/AvatarGroup.cjs +1 -1
- package/dist/components/data-display/AvatarGroup.cjs.map +1 -1
- package/dist/components/data-display/AvatarGroup.mjs +89 -88
- package/dist/components/data-display/AvatarGroup.mjs.map +1 -1
- package/dist/components/data-display/Badge.cjs +1 -1
- package/dist/components/data-display/Badge.cjs.map +1 -1
- package/dist/components/data-display/Badge.mjs +17 -16
- package/dist/components/data-display/Badge.mjs.map +1 -1
- package/dist/components/data-display/CounterBadge.cjs +1 -1
- package/dist/components/data-display/CounterBadge.cjs.map +1 -1
- package/dist/components/data-display/CounterBadge.mjs +18 -17
- package/dist/components/data-display/CounterBadge.mjs.map +1 -1
- package/dist/components/data-display/Divider.cjs +1 -1
- package/dist/components/data-display/Divider.cjs.map +1 -1
- package/dist/components/data-display/Divider.mjs +31 -30
- package/dist/components/data-display/Divider.mjs.map +1 -1
- package/dist/components/data-display/Image.cjs +1 -1
- package/dist/components/data-display/Image.cjs.map +1 -1
- package/dist/components/data-display/Image.mjs +16 -15
- package/dist/components/data-display/Image.mjs.map +1 -1
- package/dist/components/data-display/InfoLabel.cjs +1 -1
- package/dist/components/data-display/InfoLabel.cjs.map +1 -1
- package/dist/components/data-display/InfoLabel.mjs +74 -73
- package/dist/components/data-display/InfoLabel.mjs.map +1 -1
- package/dist/components/data-display/List.cjs +1 -1
- package/dist/components/data-display/List.cjs.map +1 -1
- package/dist/components/data-display/List.mjs +175 -174
- package/dist/components/data-display/List.mjs.map +1 -1
- package/dist/components/data-display/Persona.cjs +1 -1
- package/dist/components/data-display/Persona.cjs.map +1 -1
- package/dist/components/data-display/Persona.mjs +31 -29
- package/dist/components/data-display/Persona.mjs.map +1 -1
- package/dist/components/data-display/PresenceBadge.cjs +1 -1
- package/dist/components/data-display/PresenceBadge.cjs.map +1 -1
- package/dist/components/data-display/PresenceBadge.mjs +25 -24
- package/dist/components/data-display/PresenceBadge.mjs.map +1 -1
- package/dist/components/data-display/Tag.cjs +1 -1
- package/dist/components/data-display/Tag.cjs.map +1 -1
- package/dist/components/data-display/Tag.mjs +87 -82
- package/dist/components/data-display/Tag.mjs.map +1 -1
- package/dist/components/feedback/MessageBar.cjs +1 -1
- package/dist/components/feedback/MessageBar.cjs.map +1 -1
- package/dist/components/feedback/MessageBar.mjs +129 -71
- package/dist/components/feedback/MessageBar.mjs.map +1 -1
- package/dist/components/feedback/MessageBar.parts.cjs +2 -0
- package/dist/components/feedback/MessageBar.parts.cjs.map +1 -0
- package/dist/components/feedback/MessageBar.parts.mjs +84 -0
- package/dist/components/feedback/MessageBar.parts.mjs.map +1 -0
- package/dist/components/feedback/MessageBar.reflow.cjs +2 -0
- package/dist/components/feedback/MessageBar.reflow.cjs.map +1 -0
- package/dist/components/feedback/MessageBar.reflow.mjs +74 -0
- package/dist/components/feedback/MessageBar.reflow.mjs.map +1 -0
- package/dist/components/feedback/MessageBar.status.cjs +1 -1
- package/dist/components/feedback/MessageBar.status.cjs.map +1 -1
- package/dist/components/feedback/MessageBar.status.mjs +2 -1
- package/dist/components/feedback/MessageBar.status.mjs.map +1 -1
- package/dist/components/feedback/ProgressBar.cjs +1 -1
- package/dist/components/feedback/ProgressBar.cjs.map +1 -1
- package/dist/components/feedback/ProgressBar.mjs +44 -43
- package/dist/components/feedback/ProgressBar.mjs.map +1 -1
- package/dist/components/feedback/Skeleton.cjs +1 -1
- package/dist/components/feedback/Skeleton.cjs.map +1 -1
- package/dist/components/feedback/Skeleton.mjs +26 -24
- package/dist/components/feedback/Skeleton.mjs.map +1 -1
- package/dist/components/feedback/Spinner.cjs +1 -1
- package/dist/components/feedback/Spinner.cjs.map +1 -1
- package/dist/components/feedback/Spinner.mjs +32 -31
- package/dist/components/feedback/Spinner.mjs.map +1 -1
- package/dist/components/feedback/Toast.cjs +1 -1
- package/dist/components/feedback/Toast.cjs.map +1 -1
- package/dist/components/feedback/Toast.context.cjs +2 -0
- package/dist/components/feedback/Toast.context.cjs.map +1 -0
- package/dist/components/feedback/Toast.context.mjs +23 -0
- package/dist/components/feedback/Toast.context.mjs.map +1 -0
- package/dist/components/feedback/Toast.mjs +10 -342
- package/dist/components/feedback/Toast.mjs.map +1 -1
- package/dist/components/feedback/Toast.parts.cjs +2 -0
- package/dist/components/feedback/Toast.parts.cjs.map +1 -0
- package/dist/components/feedback/Toast.parts.mjs +98 -0
- package/dist/components/feedback/Toast.parts.mjs.map +1 -0
- package/dist/components/feedback/Toast.root.cjs +2 -0
- package/dist/components/feedback/Toast.root.cjs.map +1 -0
- package/dist/components/feedback/Toast.root.mjs +109 -0
- package/dist/components/feedback/Toast.root.mjs.map +1 -0
- package/dist/components/feedback/Toaster.cjs +2 -0
- package/dist/components/feedback/Toaster.cjs.map +1 -0
- package/dist/components/feedback/Toaster.mjs +564 -0
- package/dist/components/feedback/Toaster.mjs.map +1 -0
- package/dist/components/input/AlphaSlider.cjs +2 -0
- package/dist/components/input/AlphaSlider.cjs.map +1 -0
- package/dist/components/input/AlphaSlider.mjs +115 -0
- package/dist/components/input/AlphaSlider.mjs.map +1 -0
- package/dist/components/input/Checkbox.cjs +1 -1
- package/dist/components/input/Checkbox.cjs.map +1 -1
- package/dist/components/input/Checkbox.mjs +47 -46
- package/dist/components/input/Checkbox.mjs.map +1 -1
- package/dist/components/input/ColorArea.cjs +2 -0
- package/dist/components/input/ColorArea.cjs.map +1 -0
- package/dist/components/input/ColorArea.mjs +204 -0
- package/dist/components/input/ColorArea.mjs.map +1 -0
- package/dist/components/input/ColorPicker.cjs +5 -5
- package/dist/components/input/ColorPicker.cjs.map +1 -1
- package/dist/components/input/ColorPicker.mjs +142 -165
- package/dist/components/input/ColorPicker.mjs.map +1 -1
- package/dist/components/input/ColorPicker.parts.cjs +2 -0
- package/dist/components/input/ColorPicker.parts.cjs.map +1 -0
- package/dist/components/input/ColorPicker.parts.mjs +192 -0
- package/dist/components/input/ColorPicker.parts.mjs.map +1 -0
- package/dist/components/input/ColorSlider.cjs +2 -0
- package/dist/components/input/ColorSlider.cjs.map +1 -0
- package/dist/components/input/ColorSlider.mjs +138 -0
- package/dist/components/input/ColorSlider.mjs.map +1 -0
- package/dist/components/input/Combobox.cjs +1 -1
- package/dist/components/input/Combobox.cjs.map +1 -1
- package/dist/components/input/Combobox.expand.cjs +1 -1
- package/dist/components/input/Combobox.expand.cjs.map +1 -1
- package/dist/components/input/Combobox.expand.mjs +9 -9
- package/dist/components/input/Combobox.expand.mjs.map +1 -1
- package/dist/components/input/Combobox.mjs +90 -85
- package/dist/components/input/Combobox.mjs.map +1 -1
- package/dist/components/input/DatePicker.cjs +1 -1
- package/dist/components/input/DatePicker.cjs.map +1 -1
- package/dist/components/input/DatePicker.mjs +186 -185
- package/dist/components/input/DatePicker.mjs.map +1 -1
- package/dist/components/input/Dropdown.cjs +1 -1
- package/dist/components/input/Dropdown.cjs.map +1 -1
- package/dist/components/input/Dropdown.mjs +71 -68
- package/dist/components/input/Dropdown.mjs.map +1 -1
- package/dist/components/input/Field.cjs +1 -1
- package/dist/components/input/Field.cjs.map +1 -1
- package/dist/components/input/Field.mjs +113 -112
- package/dist/components/input/Field.mjs.map +1 -1
- package/dist/components/input/Input.cjs +1 -1
- package/dist/components/input/Input.cjs.map +1 -1
- package/dist/components/input/Input.mjs +55 -54
- package/dist/components/input/Input.mjs.map +1 -1
- package/dist/components/input/Label.cjs +1 -1
- package/dist/components/input/Label.cjs.map +1 -1
- package/dist/components/input/Label.mjs +12 -11
- package/dist/components/input/Label.mjs.map +1 -1
- package/dist/components/input/Option.cjs +1 -1
- package/dist/components/input/Option.cjs.map +1 -1
- package/dist/components/input/Option.mjs +100 -98
- package/dist/components/input/Option.mjs.map +1 -1
- package/dist/components/input/RadioGroup.cjs +1 -1
- package/dist/components/input/RadioGroup.cjs.map +1 -1
- package/dist/components/input/RadioGroup.mjs +89 -88
- package/dist/components/input/RadioGroup.mjs.map +1 -1
- package/dist/components/input/Rating.cjs +1 -1
- package/dist/components/input/Rating.cjs.map +1 -1
- package/dist/components/input/Rating.mjs +110 -109
- package/dist/components/input/Rating.mjs.map +1 -1
- package/dist/components/input/SearchBox.cjs +1 -1
- package/dist/components/input/SearchBox.cjs.map +1 -1
- package/dist/components/input/SearchBox.mjs +118 -119
- package/dist/components/input/SearchBox.mjs.map +1 -1
- package/dist/components/input/Select.cjs +1 -1
- package/dist/components/input/Select.cjs.map +1 -1
- package/dist/components/input/Select.mjs +25 -24
- package/dist/components/input/Select.mjs.map +1 -1
- package/dist/components/input/Slider.cjs +1 -1
- package/dist/components/input/Slider.cjs.map +1 -1
- package/dist/components/input/Slider.mjs +47 -46
- package/dist/components/input/Slider.mjs.map +1 -1
- package/dist/components/input/SpinButton.cjs +1 -1
- package/dist/components/input/SpinButton.cjs.map +1 -1
- package/dist/components/input/SpinButton.mjs +76 -75
- package/dist/components/input/SpinButton.mjs.map +1 -1
- package/dist/components/input/SwatchPicker.cjs +1 -1
- package/dist/components/input/SwatchPicker.cjs.map +1 -1
- package/dist/components/input/SwatchPicker.mjs +38 -37
- package/dist/components/input/SwatchPicker.mjs.map +1 -1
- package/dist/components/input/Switch.cjs +1 -1
- package/dist/components/input/Switch.cjs.map +1 -1
- package/dist/components/input/Switch.mjs +65 -64
- package/dist/components/input/Switch.mjs.map +1 -1
- package/dist/components/input/TagPicker.cjs +1 -1
- package/dist/components/input/TagPicker.cjs.map +1 -1
- package/dist/components/input/TagPicker.mjs +161 -157
- package/dist/components/input/TagPicker.mjs.map +1 -1
- package/dist/components/input/Textarea.cjs +1 -1
- package/dist/components/input/Textarea.cjs.map +1 -1
- package/dist/components/input/Textarea.mjs +24 -23
- package/dist/components/input/Textarea.mjs.map +1 -1
- package/dist/components/input/TimePicker.cjs +1 -1
- package/dist/components/input/TimePicker.cjs.map +1 -1
- package/dist/components/input/TimePicker.mjs +202 -199
- package/dist/components/input/TimePicker.mjs.map +1 -1
- package/dist/components/input/colorName.cjs +2 -0
- package/dist/components/input/colorName.cjs.map +1 -0
- package/dist/components/input/colorName.mjs +30 -0
- package/dist/components/input/colorName.mjs.map +1 -0
- package/dist/components/input/colorUtils.cjs +1 -1
- package/dist/components/input/colorUtils.cjs.map +1 -1
- package/dist/components/input/colorUtils.mjs +154 -56
- package/dist/components/input/colorUtils.mjs.map +1 -1
- package/dist/components/layout/Accordion.cjs +1 -1
- package/dist/components/layout/Accordion.cjs.map +1 -1
- package/dist/components/layout/Accordion.mjs +130 -129
- package/dist/components/layout/Accordion.mjs.map +1 -1
- package/dist/components/layout/Card.cjs +1 -1
- package/dist/components/layout/Card.cjs.map +1 -1
- package/dist/components/layout/Card.mjs +78 -77
- package/dist/components/layout/Card.mjs.map +1 -1
- package/dist/components/layout/Carousel.cjs +1 -1
- package/dist/components/layout/Carousel.cjs.map +1 -1
- package/dist/components/layout/Carousel.mjs +111 -110
- package/dist/components/layout/Carousel.mjs.map +1 -1
- package/dist/components/layout/Flex.cjs +1 -1
- package/dist/components/layout/Flex.cjs.map +1 -1
- package/dist/components/layout/Flex.mjs +22 -21
- package/dist/components/layout/Flex.mjs.map +1 -1
- package/dist/components/layout/Grid.cjs +1 -1
- package/dist/components/layout/Grid.cjs.map +1 -1
- package/dist/components/layout/Grid.mjs +19 -18
- package/dist/components/layout/Grid.mjs.map +1 -1
- package/dist/components/layout/Overflow.cjs +1 -1
- package/dist/components/layout/Overflow.cjs.map +1 -1
- package/dist/components/layout/Overflow.mjs +92 -91
- package/dist/components/layout/Overflow.mjs.map +1 -1
- package/dist/components/layout/Stack.cjs +1 -1
- package/dist/components/layout/Stack.cjs.map +1 -1
- package/dist/components/layout/Stack.mjs +14 -13
- package/dist/components/layout/Stack.mjs.map +1 -1
- package/dist/components/layout/TabList.cjs +1 -1
- package/dist/components/layout/TabList.cjs.map +1 -1
- package/dist/components/layout/TabList.mjs +118 -117
- package/dist/components/layout/TabList.mjs.map +1 -1
- package/dist/components/layout/Tree.cjs +1 -1
- package/dist/components/layout/Tree.cjs.map +1 -1
- package/dist/components/layout/Tree.context.cjs +2 -0
- package/dist/components/layout/Tree.context.cjs.map +1 -0
- package/dist/components/layout/Tree.context.mjs +33 -0
- package/dist/components/layout/Tree.context.mjs.map +1 -0
- package/dist/components/layout/Tree.core.cjs +2 -0
- package/dist/components/layout/Tree.core.cjs.map +1 -0
- package/dist/components/layout/Tree.core.mjs +416 -0
- package/dist/components/layout/Tree.core.mjs.map +1 -0
- package/dist/components/layout/Tree.itemPersonaLayout.cjs +2 -0
- package/dist/components/layout/Tree.itemPersonaLayout.cjs.map +1 -0
- package/dist/components/layout/Tree.itemPersonaLayout.mjs +46 -0
- package/dist/components/layout/Tree.itemPersonaLayout.mjs.map +1 -0
- package/dist/components/layout/Tree.mjs +7 -215
- package/dist/components/layout/Tree.mjs.map +1 -1
- package/dist/components/layout/Tree.selection.cjs +2 -0
- package/dist/components/layout/Tree.selection.cjs.map +1 -0
- package/dist/components/layout/Tree.selection.mjs +73 -0
- package/dist/components/layout/Tree.selection.mjs.map +1 -0
- package/dist/components/navigation/Breadcrumb.cjs +1 -1
- package/dist/components/navigation/Breadcrumb.cjs.map +1 -1
- package/dist/components/navigation/Breadcrumb.mjs +76 -75
- package/dist/components/navigation/Breadcrumb.mjs.map +1 -1
- package/dist/components/navigation/Menu.group.cjs +1 -1
- package/dist/components/navigation/Menu.group.cjs.map +1 -1
- package/dist/components/navigation/Menu.group.mjs +39 -37
- package/dist/components/navigation/Menu.group.mjs.map +1 -1
- package/dist/components/navigation/Menu.items.cjs +1 -1
- package/dist/components/navigation/Menu.items.cjs.map +1 -1
- package/dist/components/navigation/Menu.items.mjs +67 -61
- package/dist/components/navigation/Menu.items.mjs.map +1 -1
- package/dist/components/navigation/Menu.link.cjs +1 -1
- package/dist/components/navigation/Menu.link.cjs.map +1 -1
- package/dist/components/navigation/Menu.link.mjs +34 -28
- package/dist/components/navigation/Menu.link.mjs.map +1 -1
- package/dist/components/navigation/Menu.popover.cjs +1 -1
- package/dist/components/navigation/Menu.popover.cjs.map +1 -1
- package/dist/components/navigation/Menu.popover.mjs +110 -109
- package/dist/components/navigation/Menu.popover.mjs.map +1 -1
- package/dist/components/navigation/Menu.root.cjs +1 -1
- package/dist/components/navigation/Menu.root.cjs.map +1 -1
- package/dist/components/navigation/Menu.root.mjs +171 -170
- package/dist/components/navigation/Menu.root.mjs.map +1 -1
- package/dist/components/navigation/Menu.selectable.cjs +1 -1
- package/dist/components/navigation/Menu.selectable.cjs.map +1 -1
- package/dist/components/navigation/Menu.selectable.mjs +85 -63
- package/dist/components/navigation/Menu.selectable.mjs.map +1 -1
- package/dist/components/navigation/Menu.splitGroup.cjs +1 -1
- package/dist/components/navigation/Menu.splitGroup.cjs.map +1 -1
- package/dist/components/navigation/Menu.splitGroup.mjs +27 -26
- package/dist/components/navigation/Menu.splitGroup.mjs.map +1 -1
- package/dist/components/navigation/Menu.trigger.cjs +1 -1
- package/dist/components/navigation/Menu.trigger.cjs.map +1 -1
- package/dist/components/navigation/Menu.trigger.mjs +6 -6
- package/dist/components/navigation/Nav.cjs +1 -1
- package/dist/components/navigation/Nav.cjs.map +1 -1
- package/dist/components/navigation/Nav.mjs +170 -155
- package/dist/components/navigation/Nav.mjs.map +1 -1
- package/dist/components/navigation/Pagination.cjs +1 -1
- package/dist/components/navigation/Pagination.cjs.map +1 -1
- package/dist/components/navigation/Pagination.mjs +73 -65
- package/dist/components/navigation/Pagination.mjs.map +1 -1
- package/dist/components/navigation/Stepper.cjs +1 -1
- package/dist/components/navigation/Stepper.cjs.map +1 -1
- package/dist/components/navigation/Stepper.mjs +110 -109
- package/dist/components/navigation/Stepper.mjs.map +1 -1
- package/dist/components/overlays/Dialog.cjs +1 -1
- package/dist/components/overlays/Dialog.cjs.map +1 -1
- package/dist/components/overlays/Dialog.mjs +109 -108
- package/dist/components/overlays/Dialog.mjs.map +1 -1
- package/dist/components/overlays/Drawer.cjs +1 -1
- package/dist/components/overlays/Drawer.cjs.map +1 -1
- package/dist/components/overlays/Drawer.mjs +110 -109
- package/dist/components/overlays/Drawer.mjs.map +1 -1
- package/dist/components/overlays/Popover.cjs +1 -1
- package/dist/components/overlays/Popover.cjs.map +1 -1
- package/dist/components/overlays/Popover.mjs +229 -227
- package/dist/components/overlays/Popover.mjs.map +1 -1
- package/dist/components/overlays/TeachingPopover.cjs +1 -1
- package/dist/components/overlays/TeachingPopover.cjs.map +1 -1
- package/dist/components/overlays/TeachingPopover.mjs +41 -37
- package/dist/components/overlays/TeachingPopover.mjs.map +1 -1
- package/dist/components/overlays/Tooltip.cjs +1 -1
- package/dist/components/overlays/Tooltip.cjs.map +1 -1
- package/dist/components/overlays/Tooltip.mjs +87 -86
- package/dist/components/overlays/Tooltip.mjs.map +1 -1
- package/dist/components/portal/Portal.cjs +1 -1
- package/dist/components/portal/Portal.cjs.map +1 -1
- package/dist/components/portal/Portal.mjs +33 -32
- package/dist/components/portal/Portal.mjs.map +1 -1
- package/dist/components/provider/WaveProvider.cjs +1 -1
- package/dist/components/provider/WaveProvider.cjs.map +1 -1
- package/dist/components/provider/WaveProvider.mjs +31 -30
- package/dist/components/provider/WaveProvider.mjs.map +1 -1
- package/dist/components/table/DataGrid.cjs +1 -1
- package/dist/components/table/DataGrid.cjs.map +1 -1
- package/dist/components/table/DataGrid.mjs +228 -227
- package/dist/components/table/DataGrid.mjs.map +1 -1
- package/dist/components/table/Table.cjs +1 -1
- package/dist/components/table/Table.cjs.map +1 -1
- package/dist/components/table/Table.mjs +60 -59
- package/dist/components/table/Table.mjs.map +1 -1
- package/dist/components/typography/Text.cjs +1 -1
- package/dist/components/typography/Text.cjs.map +1 -1
- package/dist/components/typography/Text.mjs +12 -11
- package/dist/components/typography/Text.mjs.map +1 -1
- package/dist/hooks/useMediaQuery.cjs +2 -0
- package/dist/hooks/useMediaQuery.cjs.map +1 -0
- package/dist/hooks/useMediaQuery.mjs +20 -0
- package/dist/hooks/useMediaQuery.mjs.map +1 -0
- package/dist/hooks/usePrefersReducedMotion.cjs +1 -1
- package/dist/hooks/usePrefersReducedMotion.cjs.map +1 -1
- package/dist/hooks/usePrefersReducedMotion.mjs +4 -18
- package/dist/hooks/usePrefersReducedMotion.mjs.map +1 -1
- package/dist/hooks/useRovingTabIndex.cjs +1 -1
- package/dist/hooks/useRovingTabIndex.cjs.map +1 -1
- package/dist/hooks/useRovingTabIndex.mjs +3 -3
- package/dist/hooks/useRovingTabIndex.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2089 -102
- package/dist/index.d.ts +2089 -102
- package/dist/index.mjs +99 -87
- package/dist/lib/classNames.cjs +2 -0
- package/dist/lib/classNames.cjs.map +1 -0
- package/dist/lib/classNames.mjs +415 -0
- package/dist/lib/classNames.mjs.map +1 -0
- package/dist/lib/color.cjs +2 -0
- package/dist/lib/color.cjs.map +1 -0
- package/dist/lib/color.mjs +86 -0
- package/dist/lib/color.mjs.map +1 -0
- package/dist/lib/globalRegistry.cjs.map +1 -1
- package/dist/lib/globalRegistry.mjs.map +1 -1
- package/dist/lib/toaster.cjs +2 -0
- package/dist/lib/toaster.cjs.map +1 -0
- package/dist/lib/toaster.mjs +77 -0
- package/dist/lib/toaster.mjs.map +1 -0
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs"),n=require("../../lib/children.cjs"),r=require("../../lib/dev.cjs"),i=require("../../lib/slot.cjs"),a=require("../../
|
|
1
|
+
"use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs"),n=require("../../lib/children.cjs"),r=require("../../lib/dev.cjs"),i=require("../../lib/slot.cjs"),a=require("../../lib/classNames.cjs"),o=require("../../hooks/useId.cjs"),s=require("../../hooks/useMergedRefs.cjs"),c=require("../../lib/aria.cjs"),l=require("../../lib/styles.cjs"),u=require("../button/Button.cjs"),d=require("../button/Button.slots.cjs"),f=require("../../lib/icons.cjs"),p=require("../../lib/mergeProps.cjs"),m=require("../../lib/labelInName.cjs"),h=require("./MessageBar.reflow.cjs"),g=require("./MessageBar.status.cjs"),_=require("./MessageBar.parts.cjs");let v=require("react");v=e.__toESM(v,1);let y=require("react/jsx-runtime");var b={info:`bg-info-tint`,success:`bg-success-tint`,warning:`bg-warning-tint`,error:`bg-error-tint`},x=`Dismiss`,S=new Set([`type`,`disabled`,`autoFocus`,`form`,`formAction`,`formEncType`,`formMethod`,`formNoValidate`,`formTarget`,`name`,`value`,`popoverTarget`,`popoverTargetAction`]),C=new Set([`aria-label`,`aria-labelledby`,`title`]),w=/^on[A-Z]/,T=`inline-flex items-center justify-center`,E=new Set([`alert`,`status`,`log`,`marquee`,`timer`]),D=new Set([`none`,`presentation`,`generic`]);function O(e){return e?.trim().split(/\s+/)[0]||void 0}function ee(e){let t=O(e);return t!==void 0&&!E.has(t)&&!D.has(t)}var te=()=>{};function k(e){return(0,y.jsx)(f.DismissIcon,{className:e})}function A(e){return e===`button`||e===u.Button}function j(){return{buttonProps:{},content:k(a.messageBarClassNames.dismissIcon),contentMayName:!1,literalTextLabel:!1,disabledFocusable:!1,warning:null}}function ne(e){if(e===null)return null;if(e===void 0||typeof e==`boolean`)return j();let r=e;if(n.isElementOfType(r,`button`,u.Button)){let e={};for(let[t,n]of Object.entries(r.props))t!==`children`&&t!==`dangerouslySetInnerHTML`&&!d.BUTTON_OWN_PROP_KEYS.has(t)&&(e[t]=n);let o=n.isElementOfType(r,u.Button),s=r.props.dangerouslySetInnerHTML,c=s==null?i.materialiseSlotContent(r.props.children):(0,y.jsx)(`span`,{className:T,dangerouslySetInnerHTML:s}),l=r.props.icon,f=o&&i.slotRendersContent(l)?i.renderSlot(l,`span`,t.cn(a.messageBarClassNames.dismissIcon,T),{"aria-hidden":!0}):null;return{buttonProps:e,content:f||i.slotRendersContent(c)?d.placeButtonIcon(f,c,r.props.iconPosition):k(a.messageBarClassNames.dismissIcon),contentMayName:!0,literalTextLabel:m.hasTextLabel(c),disabledFocusable:o&&!!r.props.disabledFocusable,warning:`button-element`}}let o=i.resolveSlot(e,`span`);if(!o)return j();let{Component:s,props:c,children:l}=o,f=A(s),p=f||Object.keys(c).some(e=>S.has(e)||w.test(e)),h={},g={},_=null;for(let[e,n]of Object.entries(c))s===u.Button&&d.BUTTON_OWN_PROP_KEYS.has(e)?e===`icon`&&i.slotRendersContent(n)&&(_=i.renderSlot(n,`span`,t.cn(a.messageBarClassNames.dismissIcon,T),{"aria-hidden":!0})):S.has(e)||w.test(e)||C.has(e)||p&&(e===`className`||e===`style`||e===`ref`)?h[e]=n:g[e]=n;let b=f?`span`:s,x={"aria-hidden":!0,...g,className:t.cn(_===null&&a.messageBarClassNames.dismissIcon,T,g.className)},E=null;return _||i.slotRendersContent(l)?E=d.placeButtonIcon(_,l,s===u.Button&&c.iconPosition):i.slotWrapsDefaultContent(b,{...g,children:l})&&(E=k()),{buttonProps:h,content:E===null?v.createElement(b,x):v.createElement(b,x,E),contentMayName:!1,literalTextLabel:!1,disabledFocusable:s===u.Button&&!!c.disabledFocusable,warning:p?`button-object`:null}}var M=({status:e=`info`,statusLabel:n,onDismiss:u,icon:f,dismiss:S,layout:w=`auto`,children:T,className:E,ref:D,...k})=>{let A=t.cn(a.messageBarClassNames.icon,`mt-0.5 inline-flex shrink-0`,g.STATUS_ICON_COLOR[e]),j=f===void 0?(0,y.jsx)(`span`,{"aria-hidden":`true`,className:A,children:(0,y.jsx)(g.StatusIcon,{status:e,size:20})}):i.slotRendersContent(f)?i.renderSlot(f,`span`,A,{"aria-hidden":!0}):null,M=u!==void 0||S!==void 0&&typeof S!=`boolean`?ne(S):null,N=M?.warning??null;v.useEffect(()=>{N===`button-element`?r.warnOnce(`MessageBar:dismiss-button-element`,"MessageBar: `dismiss` received a button element; its props were merged into the built-in dismiss button (buttons cannot be nested). Pass icon content instead, e.g. `dismiss={<CloseIcon />}`, and use `onDismiss`."):N===`button-object`&&r.warnOnce(`MessageBar:dismiss-button-object`,"MessageBar: the button-object form of `dismiss` is deprecated and will be removed in 1.0; its button props were merged into the built-in dismiss button. Pass icon content instead, e.g. `dismiss={<CloseIcon />}`, and use `onDismiss`.")},[N]);let{ref:re,...P}=M?.buttonProps??{},F=Object.keys(P).some(e=>C.has(e)&&P[e]!=null),I=M!==null&&M.contentMayName&&!F,L=M?.literalTextLabel??!1,[R,ie]=v.useState(null),ae=v.useCallback(e=>R?m.observeTextLabel(R,e):te,[R]),oe=v.useSyncExternalStore(ae,()=>R?m.hasRenderedTextLabel(R):L,()=>L),se=I&&oe,ce=s.useMergedRefs(re,I?ie:void 0),z=null;if(M){let e=p.mergeProps({"aria-label":F||se?void 0:x,onClick:()=>u?.(),className:t.cn(a.messageBarClassNames.dismissButton,`ms-auto inline-flex shrink-0 cursor-pointer items-center justify-center rounded border-none bg-transparent p-1 text-muted-foreground`,`not-disabled:not-aria-disabled:hover:bg-subtle-hover not-disabled:not-aria-disabled:hover:text-foreground`,`not-disabled:not-aria-disabled:active:bg-subtle-pressed`,l.focusRing,`disabled:cursor-not-allowed disabled:opacity-50`,d.mergedAriaDisabledClasses)},P);z=(0,y.jsx)(`button`,{...e,ref:ce,type:e.type??`button`,...M.disabledFocusable?d.MERGED_DISABLED_FOCUSABLE_PROPS:void 0,children:M.content})}let{title:B,ownTitleId:le,actions:V,body:ue}=_.partitionMessageBarChildren(T),de=o.useId(`wave-message-bar-title`),H=_.useTitlePlacement(le,de),fe=H.titleId,U=e===`error`||e===`warning`?`alert`:`status`,W=`role`in k?k.role:U,G=k[`aria-label`]!==void 0||k[`aria-labelledby`]!==void 0,K=g.getStatusLabel(e,n),q=o.useId(`wave-message-bar-status`),J=B!==void 0&&!G&&ee(W),pe=G?k[`aria-labelledby`]:J?c.joinIds(K?q:void 0,fe):void 0,Y=O(W)===`region`&&B===void 0&&!G;v.useEffect(()=>{Y&&r.warnOnce(`MessageBar:region-name`,`MessageBar: a bar with role="region" is a landmark only when it has a name. Add a MessageBar.Title, or pass aria-label or aria-labelledby.`)},[Y]);let X=V.length>0,Z=w===`auto`&&X,[me,he]=v.useState(null),[ge,_e]=v.useState(null),ve=s.useMergedRefs(D,Z?he:void 0),ye=h.useMessageBarReflow(me,ge,Z),Q=w===`auto`?X?ye:`multiline`:w,be=Z&&Q===`singleline`,$=(0,y.jsxs)(`div`,{ref:Z?_e:void 0,className:t.cn(a.messageBarClassNames.body,`min-w-0 flex-1 text-body-1`,be&&`whitespace-nowrap`),children:[(0,y.jsx)(g.StatusText,{id:J&&K?q:void 0,label:K}),B&&(0,y.jsx)(_.MessageBarPartContext.Provider,{value:H,children:B.element}),B&&` `,ue.map(({key:e,node:t,extraTitle:n})=>n?(0,y.jsx)(_.MessageBarPartContext.Provider,{value:_.EXTRA_TITLE_PLACEMENT,children:t},e):(0,y.jsx)(v.Fragment,{children:t},e))]});return(0,y.jsx)(`div`,{ref:ve,role:U,"data-layout":Q,...k,"aria-labelledby":pe,className:t.cn(a.messageBarClassNames.root,`flex items-start gap-3 rounded border-s-4 px-4 py-3 text-foreground`,b[e],g.STATUS_BORDER[e],E),children:(0,y.jsxs)(_.MessageBarPartContext.Provider,{value:_.CONTENT_PLACEMENT,children:[j,X?(0,y.jsxs)(`div`,{className:t.cn(`flex min-w-0 flex-1 gap-x-3 gap-y-2`,Q===`multiline`?`flex-col`:`items-start`),children:[$,(0,y.jsx)(_.MessageBarPartContext.Provider,{value:_.ACTIONS_PLACEMENT,children:V.map(({key:e,element:t})=>(0,y.jsx)(v.Fragment,{children:t},e))})]}):$,z]})})};M.displayName=`MessageBar`;var N=Object.assign(M,{Title:_.MessageBarTitle,Actions:_.MessageBarActions});exports.MessageBar=N,exports.MessageBarActions=_.MessageBarActions,exports.MessageBarTitle=_.MessageBarTitle;
|
|
2
2
|
//# sourceMappingURL=MessageBar.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageBar.cjs","names":["DismissIcon","Button","isElementOfType","BUTTON_OWN_PROP_KEYS","materialiseSlotContent","slotRendersContent","renderSlot","placeButtonIcon","hasTextLabel","resolveSlot","cn","slotWrapsDefaultContent","React","STATUS_ICON_COLOR","StatusIcon","observeTextLabel","hasRenderedTextLabel","useMergedRefs","mergeProps","focusRing","mergedAriaDisabledClasses","MERGED_DISABLED_FOCUSABLE_PROPS","STATUS_BORDER","StatusText","getStatusLabel","require_runtime","require_cn","require_children","require_dev","require_slot","require_useMergedRefs","require_styles","require_Button","require_icons","require_mergeProps","require_Button_slots","require_labelInName","require_MessageBar_status","react","react_jsx_runtime","tintClasses","DEFAULT_DISMISS_LABEL","BUTTON_ONLY_KEYS","NAMING_KEYS","HANDLER_KEY","dismissContentClassName","noop","defaultDismissContent","isButtonType","type","defaultDismiss","resolveDismiss","dismiss","element","buttonProps","key","value","isWaveButton","markup","children","icon","iconNode","resolved","asButton","Component","isButtonObject","props","contentProps","ContentTag","elementProps","inner","MessageBar","rest","iconClassName","status","renderedIcon","dismissParts","onDismiss","dismissWarning","slotRef","slotButtonProps","hasOwnName","checksContent","literalTextLabel","labelTarget","setLabelTarget","subscribeToContent","onChange","contentHasTextLabel","namedByContent","dismissRef","renderedDismiss","className","statusLabel"],"sources":["../../../src/components/feedback/MessageBar.tsx"],"sourcesContent":["import * as React from 'react';\nimport { isElementOfType } from '../../lib/children';\nimport { cn } from '../../lib/cn';\nimport { warnOnce } from '../../lib/dev';\nimport { DismissIcon } from '../../lib/icons';\nimport { hasRenderedTextLabel, hasTextLabel, observeTextLabel } from '../../lib/labelInName';\nimport { mergeProps } from '../../lib/mergeProps';\nimport {\n materialiseSlotContent,\n renderSlot,\n resolveSlot,\n slotRendersContent,\n slotWrapsDefaultContent,\n} from '../../lib/slot';\nimport { focusRing } from '../../lib/styles';\nimport type { Status, Slot, SlotObject } from '../../lib/types';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { Button } from '../button/Button';\nimport {\n BUTTON_OWN_PROP_KEYS,\n MERGED_DISABLED_FOCUSABLE_PROPS,\n mergedAriaDisabledClasses,\n placeButtonIcon,\n} from '../button/Button.slots';\nimport {\n STATUS_BORDER,\n STATUS_ICON_COLOR,\n StatusIcon,\n StatusText,\n getStatusLabel,\n} from './MessageBar.status';\n\n/** Properties for the MessageBar component. */\nexport interface MessageBarProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Status level controlling the color, icon, status text and role of the message bar.\n * `warning` and `error` render `role=\"alert\"`, `info` and `success` `role=\"status\"` (a consumer\n * `role` wins).\n * @default 'info'\n */\n status?: Status;\n /**\n * Visually hidden text read before the message so screen-reader users hear the severity\n * (`'Info:'`, `'Success:'`, `'Warning:'`, `'Error:'` by default). Pass a translation for other\n * languages, or `''` when the message text already states the severity.\n */\n statusLabel?: string;\n /**\n * Called when the dismiss button is activated. Passing it renders the dismiss button (unless\n * `dismiss` is `null`).\n */\n onDismiss?: () => void;\n /**\n * Custom status icon, rendered decoratively (`aria-hidden=\"true\"`, a slot object can override\n * it) in the status color. `null` renders no icon.\n */\n icon?: Slot<'span'>;\n /**\n * Content of the dismiss button (replaces the default dismiss icon). It always renders **inside**\n * the built-in `<button type=\"button\" aria-label=\"Dismiss\">`, which calls `onDismiss`; passing\n * content shows the dismiss button even without `onDismiss`. `null` is the only value that hides\n * the button. A boolean counts as no slot, so the conditional idiom\n * `dismiss={useBrandIcon && <BrandCloseIcon />}` keeps the default button: the default icon with\n * `onDismiss`, no button without it. Content that renders nothing (`''`, or an array or Fragment\n * of only `null`, `false`, `true` and `''`, also as the children of a slot object or a merged\n * button) keeps the default icon, so the button is never empty; a slot object that renders a\n * component or a void element (`{ as: CloseIcon }`, `{ as: 'img', src, alt: '' }`) or sets\n * `dangerouslySetInnerHTML` is the icon itself. The content is\n * decorative (`aria-hidden`), so the button keeps the name \"Dismiss\": when the content is\n * visible text, pass a slot object whose `aria-label` matches it\n * (`{ children: 'Close', 'aria-label': 'Close' }`) so the name contains the visible label. An\n * `aria-label`, `aria-labelledby` or `title` on a slot object names the button instead of\n * \"Dismiss\".\n *\n * A `<button>` element or a Wave `Button` passed here is not nested: its props are merged into\n * the built-in button (its `onClick` runs first and can call `preventDefault()` to cancel\n * `onDismiss`; its `aria-label` and an explicit `type` win over the defaults) and its content\n * (children, or `dangerouslySetInnerHTML` markup) is used as is, with a development warning.\n * A Wave `Button`'s own props are not attributes: its `icon` becomes decorative content before\n * its children (after them with `iconPosition=\"after\"`), `disabledFocusable` makes the dismiss\n * button unavailable but focusable as on the Button (`onDismiss` is not called), and\n * `appearance` and `size` are ignored.\n * When the rendered content has a text label (at least two letters or digits:\n * `<button>Close</button>`, or text rendered by a component such as a translation), that text\n * names the button, as in 0.4. An icon, a lone character (`X`, `×`,\n * `+`: a symbol, not a label) and text that is `aria-hidden` or `hidden` keep the name\n * \"Dismiss\". Text hidden only with CSS still counts as the label: a responsive label such as\n * `<span className=\"hidden sm:inline\">Close</span>` drops the default name, so the button has\n * no name wherever that text is not displayed. Give such a button an explicit `aria-label`\n * (`<button aria-label=\"Close\">…</button>`). An `aria-label`, `aria-labelledby` or `title` on\n * the element names the button.\n *\n * The 0.4 button-object form (`{ as: 'button', onClick, … }`, `{ as: Button, … }` or an object\n * with button props) is **deprecated**: its button props (`type` included), `className` and\n * `style` are merged the same way, and a Wave Button's own props apply as for the element form.\n * Pass icon content instead, e.g. `dismiss={<CloseIcon />}`.\n */\n dismiss?: Slot<'span'> | SlotObject<'button'>;\n /** Message content to display. */\n children: React.ReactNode;\n /** Ref to the root `<div>`. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\nconst tintClasses: Record<Status, string> = {\n info: 'bg-info-tint',\n success: 'bg-success-tint',\n warning: 'bg-warning-tint',\n error: 'bg-error-tint',\n};\n\ntype UnknownProps = Record<string, unknown>;\n\n/** Name of the dismiss button when nothing else names it. */\nconst DEFAULT_DISMISS_LABEL = 'Dismiss';\n\n/** Attributes that only make sense on the dismiss `<button>` itself. */\nconst BUTTON_ONLY_KEYS: ReadonlySet<string> = new Set([\n 'type',\n 'disabled',\n 'autoFocus',\n 'form',\n 'formAction',\n 'formEncType',\n 'formMethod',\n 'formNoValidate',\n 'formTarget',\n 'name',\n 'value',\n 'popoverTarget',\n 'popoverTargetAction',\n]);\n\n/**\n * Attributes that name the dismiss button. On a slot object they go to the button (its content is\n * decorative); on the merged button, any of them replaces the default `aria-label`.\n */\nconst NAMING_KEYS: ReadonlySet<string> = new Set(['aria-label', 'aria-labelledby', 'title']);\n\nconst HANDLER_KEY = /^on[A-Z]/;\n\nconst dismissContentClassName = 'inline-flex items-center justify-center';\n\ninterface DismissParts {\n /** Props merged onto the wired dismiss button. */\n buttonProps: UnknownProps;\n /** What renders inside the dismiss button. */\n content: React.ReactNode;\n /**\n * `true` when the content is rendered as is (a merged `<button>`/`Button`), so a text label in it\n * names the button (C-SLOTS naming, WCAG 2.5.3 Label in Name); `false` when the content is\n * decorative (`aria-hidden`).\n */\n contentMayName: boolean;\n /**\n * Whether the content's literal children contain a text label. Used for the server render and\n * the first client render; after mount, the rendered button's text decides (see\n * {@link hasRenderedTextLabel}).\n */\n literalTextLabel: boolean;\n /**\n * Whether a merged Wave `Button` set `disabledFocusable`: the dismiss button is then unavailable\n * but focusable, as the Button would be.\n */\n disabledFocusable: boolean;\n /** Which development warning the slot needs. */\n warning: 'button-element' | 'button-object' | null;\n}\n\nconst noop = () => {};\n\n/** The decorative default dismiss glyph. */\nfunction defaultDismissContent(): React.ReactNode {\n return <DismissIcon />;\n}\n\nfunction isButtonType(type: unknown): boolean {\n return type === 'button' || type === Button;\n}\n\n/** The dismiss button without a slot: the default icon and name. */\nfunction defaultDismiss(): DismissParts {\n return {\n buttonProps: {},\n content: defaultDismissContent(),\n contentMayName: false,\n literalTextLabel: false,\n disabledFocusable: false,\n warning: null,\n };\n}\n\n/**\n * Splits the `dismiss` slot into props for the wired dismiss button and the content rendered\n * inside it (C-SLOTS dismiss semantics). `null` means: no dismiss button. A boolean is no slot\n * (the default dismiss button), and content that renders nothing keeps the default icon.\n */\nfunction resolveDismiss(dismiss: MessageBarProps['dismiss']): DismissParts | null {\n if (dismiss === null) return null;\n if (dismiss === undefined || typeof dismiss === 'boolean') return defaultDismiss();\n\n // A merged `<button>`/`Button` keeps its content accessible (as in 0.4): a text label names the\n // button, anything else (an icon, a lone character such as `X` or `×`) gets the default name.\n // The type is compared through `isElementOfType`, so a Button written in a Server Component\n // (a lazy client reference) is merged too.\n const element = dismiss as React.ReactNode;\n if (isElementOfType<UnknownProps>(element, 'button', Button)) {\n const buttonProps: UnknownProps = {};\n for (const [key, value] of Object.entries(element.props)) {\n if (\n key !== 'children' &&\n key !== 'dangerouslySetInnerHTML' &&\n !BUTTON_OWN_PROP_KEYS.has(key)\n ) {\n buttonProps[key] = value;\n }\n }\n const isWaveButton = isElementOfType(element, Button);\n // A generator is read once by the check; its items are what renders (and names the button).\n // Markup of the merged button (`dangerouslySetInnerHTML`) is its content as well, rendered in\n // a span inside the dismiss button (the button itself also holds the icon).\n const markup = element.props.dangerouslySetInnerHTML as\n React.HTMLAttributes<HTMLElement>['dangerouslySetInnerHTML'] | undefined;\n const children =\n markup != null ? (\n <span className={dismissContentClassName} dangerouslySetInnerHTML={markup} />\n ) : (\n materialiseSlotContent(element.props.children)\n );\n // Wave Button's icon becomes decorative content before its children (after them with\n // `iconPosition=\"after\"`).\n const icon = element.props.icon as Slot<'span'>;\n const iconNode =\n isWaveButton && slotRendersContent(icon)\n ? renderSlot(icon, 'span', dismissContentClassName, { 'aria-hidden': true })\n : null;\n const content =\n iconNode || slotRendersContent(children)\n ? placeButtonIcon(iconNode, children, element.props.iconPosition)\n : defaultDismissContent();\n return {\n buttonProps,\n content,\n contentMayName: true,\n literalTextLabel: hasTextLabel(children),\n disabledFocusable: isWaveButton && Boolean(element.props.disabledFocusable),\n warning: 'button-element',\n };\n }\n\n // Everything else is classified by the slot system (F2): shorthand content resolves to the\n // default `span` with no attributes; a slot object resolves to its element and attributes.\n const resolved = resolveSlot(dismiss as Slot<'span'>, 'span');\n if (!resolved) return defaultDismiss();\n const { Component, props, children } = resolved;\n const asButton = isButtonType(Component);\n const isButtonObject =\n asButton ||\n Object.keys(props).some((key) => BUTTON_ONLY_KEYS.has(key) || HANDLER_KEY.test(key));\n const buttonProps: UnknownProps = {};\n const contentProps: UnknownProps = {};\n let iconNode: React.ReactNode = null;\n for (const [key, value] of Object.entries(props)) {\n if (Component === Button && BUTTON_OWN_PROP_KEYS.has(key)) {\n // Wave Button's own props are not attributes: `icon`, `iconPosition` and\n // `disabledFocusable` are applied below, the others (`appearance`, `size`) are dropped.\n if (key === 'icon' && slotRendersContent(value)) {\n iconNode = renderSlot(value as Slot<'span'>, 'span', dismissContentClassName, {\n 'aria-hidden': true,\n });\n }\n } else if (\n BUTTON_ONLY_KEYS.has(key) ||\n HANDLER_KEY.test(key) ||\n NAMING_KEYS.has(key) ||\n // 0.4 rendered the object as the button itself: its className, style and ref stay there.\n (isButtonObject && (key === 'className' || key === 'style' || key === 'ref'))\n ) {\n buttonProps[key] = value;\n } else {\n contentProps[key] = value;\n }\n }\n\n // The content element: the object's own element, or a span for the button-object form. An\n // object whose children render nothing styles the default icon\n // (e.g. `{ className: 'text-error' }`), unless its element is the icon itself.\n const ContentTag: React.ElementType = asButton ? 'span' : Component;\n const elementProps = {\n 'aria-hidden': true,\n ...contentProps,\n className: cn(dismissContentClassName, contentProps.className as string | undefined),\n };\n let inner: React.ReactNode = null;\n if (iconNode || slotRendersContent(children)) {\n inner = placeButtonIcon(iconNode, children, Component === Button && props.iconPosition);\n } else if (slotWrapsDefaultContent(ContentTag, { ...contentProps, children })) {\n inner = defaultDismissContent();\n }\n return {\n buttonProps,\n content:\n inner === null\n ? React.createElement(ContentTag, elementProps)\n : React.createElement(ContentTag, elementProps, inner),\n contentMayName: false,\n literalTextLabel: false,\n disabledFocusable: Component === Button && Boolean(props.disabledFocusable),\n warning: isButtonObject ? 'button-object' : null,\n };\n}\n\n/**\n * An inline message that tells the user about the state of a page or task: a status icon, a\n * visually hidden status label (\"Warning:\"), the message and an optional dismiss button.\n *\n * - The status sets the tint, the logical start border, the icon and the role (`alert` for\n * `warning`/`error`, `status` otherwise). Screen readers hear the severity through `statusLabel`.\n * - The dismiss button is always the MessageBar's own `<button>` wired to `onDismiss`\n * (`type=\"button\"` unless a merged button slot sets its own `type`); the `dismiss` slot only\n * replaces its content (see {@link MessageBarProps.dismiss}).\n *\n * @example\n * <MessageBar status=\"warning\" onDismiss={() => setVisible(false)}>\n * Your subscription expires in 3 days.\n * </MessageBar>\n */\nexport const MessageBar = ({\n status = 'info',\n statusLabel,\n onDismiss,\n icon,\n dismiss,\n children,\n className,\n ref,\n ...rest\n}: MessageBarProps) => {\n const iconClassName = cn('mt-0.5 inline-flex shrink-0', STATUS_ICON_COLOR[status]);\n const renderedIcon =\n icon !== undefined ? (\n renderSlot(icon, 'span', iconClassName, { 'aria-hidden': true })\n ) : (\n <span aria-hidden=\"true\" className={iconClassName}>\n <StatusIcon status={status} size={20} />\n </span>\n );\n\n // A boolean `dismiss` is no slot (`dismiss={cond && <CloseIcon />}`): only `onDismiss` shows it.\n const showDismiss =\n onDismiss !== undefined || (dismiss !== undefined && typeof dismiss !== 'boolean');\n const dismissParts = showDismiss ? resolveDismiss(dismiss) : null;\n const dismissWarning = dismissParts?.warning ?? null;\n React.useEffect(() => {\n if (dismissWarning === 'button-element') {\n warnOnce(\n 'MessageBar:dismiss-button-element',\n 'MessageBar: `dismiss` received a button element; its props were merged into the built-in dismiss button (buttons cannot be nested). Pass icon content instead, e.g. `dismiss={<CloseIcon />}`, and use `onDismiss`.',\n );\n } else if (dismissWarning === 'button-object') {\n warnOnce(\n 'MessageBar:dismiss-button-object',\n 'MessageBar: the button-object form of `dismiss` is deprecated and will be removed in 1.0; its button props were merged into the built-in dismiss button. Pass icon content instead, e.g. `dismiss={<CloseIcon />}`, and use `onDismiss`.',\n );\n }\n }, [dismissWarning]);\n\n // The slot's ref joins ours through a stable merged ref (never a new callback per render).\n const { ref: slotRef, ...slotButtonProps } = dismissParts?.buttonProps ?? {};\n const hasOwnName = Object.keys(slotButtonProps).some(\n (key) => NAMING_KEYS.has(key) && slotButtonProps[key] != null,\n );\n\n // C-SLOTS naming (WCAG 2.5.3 Label in Name): a merged button's content names it when it renders\n // a text label (at least two letters or digits; a lone `X` or `×` is a glyph), and the default\n // `aria-label` would hide that label. The literal children decide on the server and on the first\n // render; after mount, the rendered button's text does (text from components, e.g. translations,\n // and later changes).\n const checksContent = dismissParts !== null && dismissParts.contentMayName && !hasOwnName;\n const literalTextLabel = dismissParts?.literalTextLabel ?? false;\n const [labelTarget, setLabelTarget] = React.useState<HTMLButtonElement | null>(null);\n const subscribeToContent = React.useCallback(\n (onChange: () => void) => (labelTarget ? observeTextLabel(labelTarget, onChange) : noop),\n [labelTarget],\n );\n const contentHasTextLabel = React.useSyncExternalStore(\n subscribeToContent,\n () => (labelTarget ? hasRenderedTextLabel(labelTarget) : literalTextLabel),\n () => literalTextLabel,\n );\n const namedByContent = checksContent && contentHasTextLabel;\n const dismissRef = useMergedRefs<HTMLButtonElement>(\n slotRef as React.Ref<HTMLButtonElement> | undefined,\n checksContent ? setLabelTarget : undefined,\n );\n\n let renderedDismiss: React.ReactNode = null;\n if (dismissParts) {\n const buttonProps = mergeProps(\n {\n 'aria-label': hasOwnName || namedByContent ? undefined : DEFAULT_DISMISS_LABEL,\n onClick: () => onDismiss?.(),\n className: cn(\n 'ms-auto inline-flex shrink-0 cursor-pointer items-center justify-center rounded border-none bg-transparent p-1 text-muted-foreground',\n 'not-disabled:not-aria-disabled:hover:bg-subtle-hover not-disabled:not-aria-disabled:hover:text-foreground',\n 'not-disabled:not-aria-disabled:active:bg-subtle-pressed',\n focusRing,\n 'disabled:cursor-not-allowed disabled:opacity-50',\n mergedAriaDisabledClasses,\n ),\n },\n slotButtonProps,\n ) as React.ComponentPropsWithoutRef<'button'>;\n renderedDismiss = (\n // `type` is \"button\" unless the slot sets one (`null`, from JavaScript callers, means the\n // default too, so the button never submits an enclosing form by accident). A merged\n // `disabledFocusable` Button makes it unavailable but focusable (spread last: it wins).\n <button\n {...buttonProps}\n ref={dismissRef}\n type={buttonProps.type ?? 'button'}\n {...(dismissParts.disabledFocusable ? MERGED_DISABLED_FOCUSABLE_PROPS : undefined)}\n >\n {dismissParts.content}\n </button>\n );\n }\n\n return (\n <div\n ref={ref}\n role={status === 'error' || status === 'warning' ? 'alert' : 'status'}\n {...rest}\n className={cn(\n 'flex items-start gap-3 rounded border-s-4 px-4 py-3 text-foreground',\n tintClasses[status],\n STATUS_BORDER[status],\n className,\n )}\n >\n {renderedIcon}\n <div className=\"min-w-0 flex-1 text-body-1\">\n <StatusText label={getStatusLabel(status, statusLabel)} />\n {children}\n </div>\n {renderedDismiss}\n </div>\n );\n};\n\nMessageBar.displayName = 'MessageBar';\n"],"mappings":"2jBAuGA,IAAMwC,EAAsC,CAC1C,KAAM,eACN,QAAS,kBACT,QAAS,kBACT,MAAO,eACT,EAKMC,EAAwB,UAGxBC,EAAwC,IAAI,IAAI,CACpD,OACA,WACA,YACA,OACA,aACA,cACA,aACA,iBACA,aACA,OACA,QACA,gBACA,qBACF,CAAC,EAMKC,EAAmC,IAAI,IAAI,CAAC,aAAc,kBAAmB,OAAO,CAAC,EAErFC,EAAc,WAEdC,EAA0B,0CA4B1BC,MAAa,CAAC,EAGpB,SAASC,GAAyC,CAChD,OAAO,EAAAR,EAAA,IAAA,CAACvC,EAAAA,YAAD,CAAc,CAAA,CACvB,CAEA,SAASgD,EAAa,EAAwB,CAC5C,OAAOC,IAAS,UAAYA,IAAShD,EAAAA,MACvC,CAGA,SAASiD,GAA+B,CACtC,MAAO,CACL,YAAa,CAAC,EACd,QAASH,EAAsB,EAC/B,eAAgB,GAChB,iBAAkB,GAClB,kBAAmB,GACnB,QAAS,IACX,CACF,CAOA,SAASI,EAAe,EAA0D,CAChF,GAAIC,IAAY,KAAM,OAAO,KAC7B,GAAIA,IAAY,IAAA,IAAa,OAAOA,GAAY,UAAW,OAAOF,E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E,EAAAA,GACT,uIACA,4GACA,0DACAS,EAAAA,UACA,kDACAC,EAAAA,yBACF,CACF,EACA4D,CACF,EACA,GAIE,EAAAzC,EAAA,IAAA,CAAC,SAAD,CACE,GAAIe,EACJ,IAAKoC,EACL,KAAMpC,EAAY,MAAQ,SAC1B,GAAKsB,EAAa,kBAAoBvD,EAAAA,gCAAkC,IAAA,GAEvE,SAAAuD,EAAa,OACR,CAAA,CAEZ,CAEA,OACE,EAAArC,EAAA,KAAA,CAAC,MAAD,CACO,MACL,KAAMmC,IAAW,SAAWA,IAAW,UAAY,QAAU,SAC7D,GAAIF,EACJ,UAAW9D,EAAAA,GACT,sEACA8B,EAAYkC,GACZpD,EAAAA,cAAcoD,GACdkB,CACF,EATF,SAAA,CAWGjB,GACD,EAAApC,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,6BAAf,SAAA,EACE,EAAAA,EAAA,IAAA,CAAChB,EAAAA,WAAD,CAAY,MAAOC,EAAAA,eAAekD,EAAQmB,CAAW,CAAI,CAAA,EACxDlC,CACE,IACJgC,CACE,GAET,EAEA,EAAW,YAAc"}
|
|
1
|
+
{"version":3,"file":"MessageBar.cjs","names":["DismissIcon","Button","messageBarClassNames","isElementOfType","BUTTON_OWN_PROP_KEYS","materialiseSlotContent","slotRendersContent","renderSlot","cn","placeButtonIcon","hasTextLabel","resolveSlot","slotWrapsDefaultContent","React","STATUS_ICON_COLOR","StatusIcon","observeTextLabel","hasRenderedTextLabel","useMergedRefs","mergeProps","focusRing","mergedAriaDisabledClasses","MERGED_DISABLED_FOCUSABLE_PROPS","partitionMessageBarChildren","useId","useTitlePlacement","getStatusLabel","joinIds","useMessageBarReflow","StatusText","MessageBarPartContext","EXTRA_TITLE_PLACEMENT","STATUS_BORDER","CONTENT_PLACEMENT","ACTIONS_PLACEMENT","MessageBarTitle","MessageBarActions","require_runtime","require_cn","require_children","require_dev","require_slot","require_classNames","require_useId","require_useMergedRefs","require_aria","require_styles","require_Button","require_Button_slots","require_icons","require_mergeProps","require_labelInName","require_MessageBar_reflow","require_MessageBar_status","require_MessageBar_parts","react","react_jsx_runtime","tintClasses","DEFAULT_DISMISS_LABEL","BUTTON_ONLY_KEYS","NAMING_KEYS","HANDLER_KEY","dismissContentClassName","LIVE_REGION_ROLES","UNNAMED_ROLES","firstRoleToken","role","isNamedByTitle","token","noop","defaultDismissContent","isButtonType","type","defaultDismiss","resolveDismiss","dismiss","element","buttonProps","key","value","isWaveButton","markup","children","icon","iconNode","resolved","asButton","Component","isButtonObject","props","contentProps","ContentTag","elementProps","inner","MessageBarRoot","rest","iconClassName","status","renderedIcon","dismissParts","onDismiss","dismissWarning","slotRef","slotButtonProps","hasOwnName","checksContent","literalTextLabel","labelTarget","setLabelTarget","subscribeToContent","onChange","contentHasTextLabel","namedByContent","dismissRef","renderedDismiss","generatedTitleId","titlePlacement","ownTitleId","titleId","defaultRole","ownName","statusText","statusLabel","statusTextId","namedByTitle","title","labelledBy","missingRegionName","hasActions","actions","measuring","layout","rootElement","setRootElement","textElement","setTextElement","rootRef","ref","measuredLayout","resolvedLayout","unwrapped","text","body","extraTitle","node","className","MessageBar"],"sources":["../../../src/components/feedback/MessageBar.tsx"],"sourcesContent":["import * as React from 'react';\nimport { joinIds } from '../../lib/aria';\nimport { isElementOfType } from '../../lib/children';\nimport { messageBarClassNames } from '../../lib/classNames';\nimport { cn } from '../../lib/cn';\nimport { warnOnce } from '../../lib/dev';\nimport { DismissIcon } from '../../lib/icons';\nimport { hasRenderedTextLabel, hasTextLabel, observeTextLabel } from '../../lib/labelInName';\nimport { mergeProps } from '../../lib/mergeProps';\nimport {\n materialiseSlotContent,\n renderSlot,\n resolveSlot,\n slotRendersContent,\n slotWrapsDefaultContent,\n} from '../../lib/slot';\nimport { focusRing } from '../../lib/styles';\nimport type { Status, Slot, SlotObject } from '../../lib/types';\nimport { useId } from '../../hooks/useId';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { Button } from '../button/Button';\nimport { useMessageBarReflow } from './MessageBar.reflow';\nimport {\n BUTTON_OWN_PROP_KEYS,\n MERGED_DISABLED_FOCUSABLE_PROPS,\n mergedAriaDisabledClasses,\n placeButtonIcon,\n} from '../button/Button.slots';\nimport {\n STATUS_BORDER,\n STATUS_ICON_COLOR,\n StatusIcon,\n StatusText,\n getStatusLabel,\n} from './MessageBar.status';\nimport {\n ACTIONS_PLACEMENT,\n CONTENT_PLACEMENT,\n EXTRA_TITLE_PLACEMENT,\n MessageBarActions,\n MessageBarPartContext,\n MessageBarTitle,\n partitionMessageBarChildren,\n useTitlePlacement,\n} from './MessageBar.parts';\n\n/** Properties for the MessageBar component. */\nexport interface MessageBarProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Status level controlling the color, icon, status text and role of the message bar.\n * `warning` and `error` render `role=\"alert\"`, `info` and `success` `role=\"status\"` (a consumer\n * `role` wins).\n * @default 'info'\n */\n status?: Status;\n /**\n * Visually hidden text read before the message so screen-reader users hear the severity\n * (`'Info:'`, `'Success:'`, `'Warning:'`, `'Error:'` by default). Pass a translation for other\n * languages, or `''` when the message text already states the severity.\n */\n statusLabel?: string;\n /**\n * Called when the dismiss button is activated. Passing it renders the dismiss button (unless\n * `dismiss` is `null`).\n */\n onDismiss?: () => void;\n /**\n * Custom status icon, rendered decoratively (`aria-hidden=\"true\"`, a slot object can override\n * it) in the status color. Only `undefined` keeps the default status icon; `null`, or anything that\n * renders nothing (`false`, `''`), shows no icon.\n */\n icon?: Slot<'span'>;\n /**\n * Content of the dismiss button (replaces the default dismiss icon). It always renders **inside**\n * the built-in `<button type=\"button\" aria-label=\"Dismiss\">`, which calls `onDismiss`; passing\n * content shows the dismiss button even without `onDismiss`. `null` is the only value that hides\n * the button. A boolean counts as no slot, so the conditional idiom\n * `dismiss={useBrandIcon && <BrandCloseIcon />}` keeps the default button: the default icon with\n * `onDismiss`, no button without it. Content that renders nothing (`''`, or an array or Fragment\n * of only `null`, `false`, `true` and `''`, also as the children of a slot object or a merged\n * button) keeps the default icon, so the button is never empty; a slot object that renders a\n * component or a void element (`{ as: CloseIcon }`, `{ as: 'img', src, alt: '' }`) or sets\n * `dangerouslySetInnerHTML` is the icon itself. The content is\n * decorative (`aria-hidden`), so the button keeps the name \"Dismiss\": when the content is\n * visible text, pass a slot object whose `aria-label` matches it\n * (`{ children: 'Close', 'aria-label': 'Close' }`) so the name contains the visible label. An\n * `aria-label`, `aria-labelledby` or `title` on a slot object names the button instead of\n * \"Dismiss\".\n *\n * A `<button>` element or a Wave `Button` passed here is not nested: its props are merged into\n * the built-in button (its `onClick` runs first and can call `preventDefault()` to cancel\n * `onDismiss`; its `aria-label` and an explicit `type` win over the defaults) and its content\n * (children, or `dangerouslySetInnerHTML` markup) is used as is, with a development warning.\n * A Wave `Button`'s own props are not attributes: its `icon` becomes decorative content before\n * its children (after them with `iconPosition=\"after\"`), `disabledFocusable` makes the dismiss\n * button unavailable but focusable as on the Button (`onDismiss` is not called), and\n * `appearance` and `size` are ignored.\n * When the rendered content has a text label (at least two letters or digits:\n * `<button>Close</button>`, or text rendered by a component such as a translation), that text\n * names the button, as in 0.4. An icon, a lone character (`X`, `×`,\n * `+`: a symbol, not a label) and text that is `aria-hidden` or `hidden` keep the name\n * \"Dismiss\". Text hidden only with CSS still counts as the label: a responsive label such as\n * `<span className=\"hidden sm:inline\">Close</span>` drops the default name, so the button has\n * no name wherever that text is not displayed. Give such a button an explicit `aria-label`\n * (`<button aria-label=\"Close\">…</button>`). An `aria-label`, `aria-labelledby` or `title` on\n * the element names the button.\n *\n * The 0.4 button-object form (`{ as: 'button', onClick, … }`, `{ as: Button, … }` or an object\n * with button props) is **deprecated**: its button props (`type` included), `className` and\n * `style` are merged the same way, and a Wave Button's own props apply as for the element form.\n * Pass icon content instead, e.g. `dismiss={<CloseIcon />}`.\n */\n dismiss?: Slot<'span'> | SlotObject<'button'>;\n /**\n * How the text and the actions share the bar. `'singleline'`: the actions sit on the text's row\n * (the text wraps inside its column; it is never cut off). `'multiline'`: the actions get a row of\n * their own under the text. `'auto'`: the actions stay on the text's row while the text fits on\n * one line, measured after mount (the server renders one row), and move below it otherwise; a bar\n * without `MessageBar.Actions` is `'multiline'`, the 0.7 look. The root renders the layout in use\n * as `data-layout` (`singleline` or `multiline`). Fluent's `layout`.\n * @default 'auto'\n */\n layout?: 'auto' | 'singleline' | 'multiline';\n /**\n * The message: body text, with the parts `MessageBar.Title` and `MessageBar.Actions` as direct\n * children (see the component docs).\n */\n children: React.ReactNode;\n /** Ref to the root `<div>`. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\nconst tintClasses: Record<Status, string> = {\n info: 'bg-info-tint',\n success: 'bg-success-tint',\n warning: 'bg-warning-tint',\n error: 'bg-error-tint',\n};\n\ntype UnknownProps = Record<string, unknown>;\n\n/** Name of the dismiss button when nothing else names it. */\nconst DEFAULT_DISMISS_LABEL = 'Dismiss';\n\n/** Attributes that only make sense on the dismiss `<button>` itself. */\nconst BUTTON_ONLY_KEYS: ReadonlySet<string> = new Set([\n 'type',\n 'disabled',\n 'autoFocus',\n 'form',\n 'formAction',\n 'formEncType',\n 'formMethod',\n 'formNoValidate',\n 'formTarget',\n 'name',\n 'value',\n 'popoverTarget',\n 'popoverTargetAction',\n]);\n\n/**\n * Attributes that name the dismiss button. On a slot object they go to the button (its content is\n * decorative); on the merged button, any of them replaces the default `aria-label`.\n */\nconst NAMING_KEYS: ReadonlySet<string> = new Set(['aria-label', 'aria-labelledby', 'title']);\n\nconst HANDLER_KEY = /^on[A-Z]/;\n\nconst dismissContentClassName = 'inline-flex items-center justify-center';\n\n/** Live-region roles: a title is read as the start of their content, never as their name. */\nconst LIVE_REGION_ROLES: ReadonlySet<string> = new Set([\n 'alert',\n 'status',\n 'log',\n 'marquee',\n 'timer',\n]);\n\n/** Roles that take no name. */\nconst UNNAMED_ROLES: ReadonlySet<string> = new Set(['none', 'presentation', 'generic']);\n\n/** The first token of a `role` value (a list of fallback roles is read by its first). */\nfunction firstRoleToken(role: string | undefined): string | undefined {\n return role?.trim().split(/\\s+/)[0] || undefined;\n}\n\n/** Whether a title names a bar with this role (spec D16: a non-live role, such as region or group). */\nfunction isNamedByTitle(role: string | undefined): boolean {\n const token = firstRoleToken(role);\n return token !== undefined && !LIVE_REGION_ROLES.has(token) && !UNNAMED_ROLES.has(token);\n}\n\ninterface DismissParts {\n /** Props merged onto the wired dismiss button. */\n buttonProps: UnknownProps;\n /** What renders inside the dismiss button. */\n content: React.ReactNode;\n /**\n * `true` when the content is rendered as is (a merged `<button>`/`Button`), so a text label in it\n * names the button (C-SLOTS naming, WCAG 2.5.3 Label in Name); `false` when the content is\n * decorative (`aria-hidden`).\n */\n contentMayName: boolean;\n /**\n * Whether the content's literal children contain a text label. Used for the server render and\n * the first client render; after mount, the rendered button's text decides (see\n * {@link hasRenderedTextLabel}).\n */\n literalTextLabel: boolean;\n /**\n * Whether a merged Wave `Button` set `disabledFocusable`: the dismiss button is then unavailable\n * but focusable, as the Button would be.\n */\n disabledFocusable: boolean;\n /** Which development warning the slot needs. */\n warning: 'button-element' | 'button-object' | null;\n}\n\nconst noop = () => {};\n\n/**\n * The decorative default dismiss glyph. It carries the dismiss icon part class when it is the\n * dismiss button's own content, not when the element of a slot object wraps it.\n */\nfunction defaultDismissContent(className?: string): React.ReactNode {\n return <DismissIcon className={className} />;\n}\n\nfunction isButtonType(type: unknown): boolean {\n return type === 'button' || type === Button;\n}\n\n/** The dismiss button without a slot: the default icon and name. */\nfunction defaultDismiss(): DismissParts {\n return {\n buttonProps: {},\n content: defaultDismissContent(messageBarClassNames.dismissIcon),\n contentMayName: false,\n literalTextLabel: false,\n disabledFocusable: false,\n warning: null,\n };\n}\n\n/**\n * Splits the `dismiss` slot into props for the wired dismiss button and the content rendered\n * inside it (C-SLOTS dismiss semantics). `null` means: no dismiss button. A boolean is no slot\n * (the default dismiss button), and content that renders nothing keeps the default icon.\n */\nfunction resolveDismiss(dismiss: MessageBarProps['dismiss']): DismissParts | null {\n if (dismiss === null) return null;\n if (dismiss === undefined || typeof dismiss === 'boolean') return defaultDismiss();\n\n // A merged `<button>`/`Button` keeps its content accessible (as in 0.4): a text label names the\n // button, anything else (an icon, a lone character such as `X` or `×`) gets the default name.\n // The type is compared through `isElementOfType`, so a Button written in a Server Component\n // (a lazy client reference) is merged too.\n const element = dismiss as React.ReactNode;\n if (isElementOfType<UnknownProps>(element, 'button', Button)) {\n const buttonProps: UnknownProps = {};\n for (const [key, value] of Object.entries(element.props)) {\n if (\n key !== 'children' &&\n key !== 'dangerouslySetInnerHTML' &&\n !BUTTON_OWN_PROP_KEYS.has(key)\n ) {\n buttonProps[key] = value;\n }\n }\n const isWaveButton = isElementOfType(element, Button);\n // A generator is read once by the check; its items are what renders (and names the button).\n // Markup of the merged button (`dangerouslySetInnerHTML`) is its content as well, rendered in\n // a span inside the dismiss button (the button itself also holds the icon).\n const markup = element.props.dangerouslySetInnerHTML as\n React.HTMLAttributes<HTMLElement>['dangerouslySetInnerHTML'] | undefined;\n const children =\n markup != null ? (\n <span className={dismissContentClassName} dangerouslySetInnerHTML={markup} />\n ) : (\n materialiseSlotContent(element.props.children)\n );\n // Wave Button's icon becomes decorative content before its children (after them with\n // `iconPosition=\"after\"`).\n const icon = element.props.icon as Slot<'span'>;\n const iconNode =\n isWaveButton && slotRendersContent(icon)\n ? renderSlot(icon, 'span', cn(messageBarClassNames.dismissIcon, dismissContentClassName), {\n 'aria-hidden': true,\n })\n : null;\n const content =\n iconNode || slotRendersContent(children)\n ? placeButtonIcon(iconNode, children, element.props.iconPosition)\n : defaultDismissContent(messageBarClassNames.dismissIcon);\n return {\n buttonProps,\n content,\n contentMayName: true,\n literalTextLabel: hasTextLabel(children),\n disabledFocusable: isWaveButton && Boolean(element.props.disabledFocusable),\n warning: 'button-element',\n };\n }\n\n // Everything else is classified by the slot system (F2): shorthand content resolves to the\n // default `span` with no attributes; a slot object resolves to its element and attributes.\n const resolved = resolveSlot(dismiss as Slot<'span'>, 'span');\n if (!resolved) return defaultDismiss();\n const { Component, props, children } = resolved;\n const asButton = isButtonType(Component);\n const isButtonObject =\n asButton ||\n Object.keys(props).some((key) => BUTTON_ONLY_KEYS.has(key) || HANDLER_KEY.test(key));\n const buttonProps: UnknownProps = {};\n const contentProps: UnknownProps = {};\n let iconNode: React.ReactNode = null;\n for (const [key, value] of Object.entries(props)) {\n if (Component === Button && BUTTON_OWN_PROP_KEYS.has(key)) {\n // Wave Button's own props are not attributes: `icon`, `iconPosition` and\n // `disabledFocusable` are applied below, the others (`appearance`, `size`) are dropped.\n if (key === 'icon' && slotRendersContent(value)) {\n iconNode = renderSlot(\n value as Slot<'span'>,\n 'span',\n cn(messageBarClassNames.dismissIcon, dismissContentClassName),\n { 'aria-hidden': true },\n );\n }\n } else if (\n BUTTON_ONLY_KEYS.has(key) ||\n HANDLER_KEY.test(key) ||\n NAMING_KEYS.has(key) ||\n // 0.4 rendered the object as the button itself: its className, style and ref stay there.\n (isButtonObject && (key === 'className' || key === 'style' || key === 'ref'))\n ) {\n buttonProps[key] = value;\n } else {\n contentProps[key] = value;\n }\n }\n\n // The content element: the object's own element, or a span for the button-object form. An\n // object whose children render nothing styles the default icon\n // (e.g. `{ className: 'text-error' }`), unless its element is the icon itself.\n const ContentTag: React.ElementType = asButton ? 'span' : Component;\n const elementProps = {\n 'aria-hidden': true,\n ...contentProps,\n className: cn(\n iconNode === null && messageBarClassNames.dismissIcon,\n dismissContentClassName,\n contentProps.className as string | undefined,\n ),\n };\n let inner: React.ReactNode = null;\n if (iconNode || slotRendersContent(children)) {\n inner = placeButtonIcon(iconNode, children, Component === Button && props.iconPosition);\n } else if (slotWrapsDefaultContent(ContentTag, { ...contentProps, children })) {\n inner = defaultDismissContent();\n }\n return {\n buttonProps,\n content:\n inner === null\n ? React.createElement(ContentTag, elementProps)\n : React.createElement(ContentTag, elementProps, inner),\n contentMayName: false,\n literalTextLabel: false,\n disabledFocusable: Component === Button && Boolean(props.disabledFocusable),\n warning: isButtonObject ? 'button-object' : null,\n };\n}\n\n// The MessageBar root, documented on the exported `MessageBar` const.\nconst MessageBarRoot = ({\n status = 'info',\n statusLabel,\n onDismiss,\n icon,\n dismiss,\n layout = 'auto',\n children,\n className,\n ref,\n ...rest\n}: MessageBarProps) => {\n const iconClassName = cn(\n messageBarClassNames.icon,\n 'mt-0.5 inline-flex shrink-0',\n STATUS_ICON_COLOR[status],\n );\n const renderedIcon =\n icon !== undefined ? (\n slotRendersContent(icon) ? (\n renderSlot(icon, 'span', iconClassName, { 'aria-hidden': true })\n ) : null\n ) : (\n <span aria-hidden=\"true\" className={iconClassName}>\n <StatusIcon status={status} size={20} />\n </span>\n );\n\n // A boolean `dismiss` is no slot (`dismiss={cond && <CloseIcon />}`): only `onDismiss` shows it.\n const showDismiss =\n onDismiss !== undefined || (dismiss !== undefined && typeof dismiss !== 'boolean');\n const dismissParts = showDismiss ? resolveDismiss(dismiss) : null;\n const dismissWarning = dismissParts?.warning ?? null;\n React.useEffect(() => {\n if (dismissWarning === 'button-element') {\n warnOnce(\n 'MessageBar:dismiss-button-element',\n 'MessageBar: `dismiss` received a button element; its props were merged into the built-in dismiss button (buttons cannot be nested). Pass icon content instead, e.g. `dismiss={<CloseIcon />}`, and use `onDismiss`.',\n );\n } else if (dismissWarning === 'button-object') {\n warnOnce(\n 'MessageBar:dismiss-button-object',\n 'MessageBar: the button-object form of `dismiss` is deprecated and will be removed in 1.0; its button props were merged into the built-in dismiss button. Pass icon content instead, e.g. `dismiss={<CloseIcon />}`, and use `onDismiss`.',\n );\n }\n }, [dismissWarning]);\n\n // The slot's ref joins ours through a stable merged ref (never a new callback per render).\n const { ref: slotRef, ...slotButtonProps } = dismissParts?.buttonProps ?? {};\n const hasOwnName = Object.keys(slotButtonProps).some(\n (key) => NAMING_KEYS.has(key) && slotButtonProps[key] != null,\n );\n\n // C-SLOTS naming (WCAG 2.5.3 Label in Name): a merged button's content names it when it renders\n // a text label (at least two letters or digits; a lone `X` or `×` is a glyph), and the default\n // `aria-label` would hide that label. The literal children decide on the server and on the first\n // render; after mount, the rendered button's text does (text from components, e.g. translations,\n // and later changes).\n const checksContent = dismissParts !== null && dismissParts.contentMayName && !hasOwnName;\n const literalTextLabel = dismissParts?.literalTextLabel ?? false;\n const [labelTarget, setLabelTarget] = React.useState<HTMLButtonElement | null>(null);\n const subscribeToContent = React.useCallback(\n (onChange: () => void) => (labelTarget ? observeTextLabel(labelTarget, onChange) : noop),\n [labelTarget],\n );\n const contentHasTextLabel = React.useSyncExternalStore(\n subscribeToContent,\n () => (labelTarget ? hasRenderedTextLabel(labelTarget) : literalTextLabel),\n () => literalTextLabel,\n );\n const namedByContent = checksContent && contentHasTextLabel;\n const dismissRef = useMergedRefs<HTMLButtonElement>(\n slotRef as React.Ref<HTMLButtonElement> | undefined,\n checksContent ? setLabelTarget : undefined,\n );\n\n let renderedDismiss: React.ReactNode = null;\n if (dismissParts) {\n const buttonProps = mergeProps(\n {\n 'aria-label': hasOwnName || namedByContent ? undefined : DEFAULT_DISMISS_LABEL,\n onClick: () => onDismiss?.(),\n className: cn(\n messageBarClassNames.dismissButton,\n 'ms-auto inline-flex shrink-0 cursor-pointer items-center justify-center rounded border-none bg-transparent p-1 text-muted-foreground',\n 'not-disabled:not-aria-disabled:hover:bg-subtle-hover not-disabled:not-aria-disabled:hover:text-foreground',\n 'not-disabled:not-aria-disabled:active:bg-subtle-pressed',\n focusRing,\n 'disabled:cursor-not-allowed disabled:opacity-50',\n mergedAriaDisabledClasses,\n ),\n },\n slotButtonProps,\n ) as React.ComponentPropsWithoutRef<'button'>;\n renderedDismiss = (\n // `type` is \"button\" unless the slot sets one (`null`, from JavaScript callers, means the\n // default too, so the button never submits an enclosing form by accident). A merged\n // `disabledFocusable` Button makes it unavailable but focusable (spread last: it wins).\n <button\n {...buttonProps}\n ref={dismissRef}\n type={buttonProps.type ?? 'button'}\n {...(dismissParts.disabledFocusable ? MERGED_DISABLED_FOCUSABLE_PROPS : undefined)}\n >\n {dismissParts.content}\n </button>\n );\n }\n\n // Parts (D15): a static scan of the direct children (Fragments flattened, Server Component\n // references included), so the title and the actions are placed in the server HTML too.\n const { title, ownTitleId, actions, body } = partitionMessageBarChildren(children);\n const generatedTitleId = useId('wave-message-bar-title');\n const titlePlacement = useTitlePlacement(ownTitleId, generatedTitleId);\n const titleId = titlePlacement.titleId;\n\n // Labelling (D16). The role the bar renders: the consumer's when the prop is given (it is spread\n // after the default, as in 0.7), else the status role. A live bar is read once, title included,\n // and gets no name; a bar with a non-live role is named by the severity text and the title.\n const defaultRole = status === 'error' || status === 'warning' ? 'alert' : 'status';\n const role = 'role' in rest ? rest.role : defaultRole;\n // A prop that holds `undefined` (a wrapper forwarding it) is no name of the consumer's.\n const ownName = rest['aria-label'] !== undefined || rest['aria-labelledby'] !== undefined;\n const statusText = getStatusLabel(status, statusLabel);\n const statusTextId = useId('wave-message-bar-status');\n const namedByTitle = title !== undefined && !ownName && isNamedByTitle(role);\n // Written after the spread, so a forwarded `aria-labelledby={undefined}` cannot remove it.\n const labelledBy = ownName\n ? rest['aria-labelledby']\n : namedByTitle\n ? joinIds(statusText ? statusTextId : undefined, titleId)\n : undefined;\n const missingRegionName = firstRoleToken(role) === 'region' && title === undefined && !ownName;\n React.useEffect(() => {\n if (missingRegionName) {\n warnOnce(\n 'MessageBar:region-name',\n 'MessageBar: a bar with role=\"region\" is a landmark only when it has a name. Add a MessageBar.Title, or pass aria-label or aria-labelledby.',\n );\n }\n }, [missingRegionName]);\n\n // Layout (D17): one DOM order in every layout (icon, text, actions, Dismiss), so a layout change\n // never moves a focused element; only classes change. Without actions the bar keeps 0.7's markup.\n const hasActions = actions.length > 0;\n // `'auto'` with actions measures its text (MessageBar.reflow.ts); the elements it reads are held\n // in state through callback refs, attached only while it measures (no extra render otherwise).\n const measuring = layout === 'auto' && hasActions;\n const [rootElement, setRootElement] = React.useState<HTMLDivElement | null>(null);\n const [textElement, setTextElement] = React.useState<HTMLDivElement | null>(null);\n const rootRef = useMergedRefs<HTMLDivElement>(ref, measuring ? setRootElement : undefined);\n const measuredLayout = useMessageBarReflow(rootElement, textElement, measuring);\n const resolvedLayout: 'singleline' | 'multiline' =\n layout === 'auto' ? (hasActions ? measuredLayout : 'multiline') : layout;\n // While it measures one row, the text column does not wrap, so text that does not fit overflows\n // the column (never cut off) and the measurement sees it.\n const unwrapped = measuring && resolvedLayout === 'singleline';\n\n // The text column: the severity text, the title (and a space, so the two never run together),\n // then the body in its order.\n const text = (\n <div\n ref={measuring ? setTextElement : undefined}\n className={cn(\n messageBarClassNames.body,\n 'min-w-0 flex-1 text-body-1',\n unwrapped && 'whitespace-nowrap',\n )}\n >\n <StatusText id={namedByTitle && statusText ? statusTextId : undefined} label={statusText} />\n {title && (\n <MessageBarPartContext.Provider value={titlePlacement}>\n {title.element}\n </MessageBarPartContext.Provider>\n )}\n {title && ' '}\n {body.map(({ key, node, extraTitle }) =>\n extraTitle ? (\n <MessageBarPartContext.Provider key={key} value={EXTRA_TITLE_PLACEMENT}>\n {node}\n </MessageBarPartContext.Provider>\n ) : (\n <React.Fragment key={key}>{node}</React.Fragment>\n ),\n )}\n </div>\n );\n\n return (\n <div\n ref={rootRef}\n role={defaultRole}\n data-layout={resolvedLayout}\n {...rest}\n aria-labelledby={labelledBy}\n className={cn(\n messageBarClassNames.root,\n 'flex items-start gap-3 rounded border-s-4 px-4 py-3 text-foreground',\n tintClasses[status],\n STATUS_BORDER[status],\n className,\n )}\n >\n <MessageBarPartContext.Provider value={CONTENT_PLACEMENT}>\n {renderedIcon}\n {hasActions ? (\n // A layout wrapper (not a part): the text column and the actions, in this DOM order.\n <div\n className={cn(\n 'flex min-w-0 flex-1 gap-x-3 gap-y-2',\n resolvedLayout === 'multiline' ? 'flex-col' : 'items-start',\n )}\n >\n {text}\n <MessageBarPartContext.Provider value={ACTIONS_PLACEMENT}>\n {actions.map(({ key, element }) => (\n <React.Fragment key={key}>{element}</React.Fragment>\n ))}\n </MessageBarPartContext.Provider>\n </div>\n ) : (\n text\n )}\n {renderedDismiss}\n </MessageBarPartContext.Provider>\n </div>\n );\n};\nMessageBarRoot.displayName = 'MessageBar';\n\n/**\n * An inline message that tells the user about the state of a page or task: a status icon, a\n * visually hidden status label (\"Warning:\"), an optional title, the message, optional actions and\n * an optional dismiss button.\n *\n * - The status sets the tint, the logical start border, the icon and the role (`alert` for\n * `warning`/`error`, `status` otherwise). Screen readers hear the severity through `statusLabel`.\n * - Parts, as direct children: `MessageBar.Title` (a semibold lead-in, read first after the\n * severity) and `MessageBar.Actions` (buttons after the text on one row, or below it with\n * `layout=\"multiline\"`). The built-in Dismiss button stays the bar's own.\n * - With its default roles the bar is a live region and the title is read as the start of its\n * content; give the bar `role=\"region\"` (a notice that stays on the page) and the title names it.\n * - The dismiss button is always the MessageBar's own `<button>` wired to `onDismiss`\n * (`type=\"button\"` unless a merged button slot sets its own `type`); the `dismiss` slot only\n * replaces its content (see {@link MessageBarProps.dismiss}).\n *\n * React Server Components cannot dot into a client module: import the flat names\n * `MessageBarTitle` and `MessageBarActions` there; `MessageBar.Title` and `MessageBar.Actions`\n * work in client files.\n *\n * @example\n * <MessageBar status=\"warning\" onDismiss={() => setVisible(false)}>\n * <MessageBar.Title>Update available</MessageBar.Title>\n * A new version is ready to install.\n * <MessageBar.Actions>\n * <Button size=\"small\">Update now</Button>\n * </MessageBar.Actions>\n * </MessageBar>\n */\nexport const MessageBar = /* @__PURE__ */ Object.assign(MessageBarRoot, {\n Title: MessageBarTitle,\n Actions: MessageBarActions,\n});\n\nexport { MessageBarTitle, MessageBarActions };\nexport type { MessageBarTitleProps, MessageBarActionsProps } from './MessageBar.parts';\n"],"mappings":"6uBAmIA,IAAMyD,EAAsC,CAC1C,KAAM,eACN,QAAS,kBACT,QAAS,kBACT,MAAO,eACT,EAKMC,EAAwB,UAGxBC,EAAwC,IAAI,IAAI,CACpD,OACA,WACA,YACA,OACA,aACA,cACA,aACA,iBACA,aACA,OACA,QACA,gBACA,qBACF,CAAC,EAMKC,EAAmC,IAAI,IAAI,CAAC,aAAc,kBAAmB,OAAO,CA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C,MAAOI,EAAAA,kBACpC,SAAA+F,EAAQ,KAAK,CAAE,MAAK,cACnB,EAAAzE,EAAA,IAAA,CAAC3C,EAAM,SAAP,CAAA,SAA2B+D,CAAwB,EAA9BE,CAA8B,CACpD,CAC6B,CAAA,CAC7B,CAEL,CAAA,EAAA+D,EAED3B,CAC6B,GAC7B,CAAA,CAET,EACA,EAAe,YAAc,aA+B7B,IAAagC,EAA6B,OAAO,OAAOpD,EAAgB,CACtE,MAAO3D,EAAAA,gBACP,QAASC,EAAAA,iBACX,CAAC"}
|
|
@@ -3,23 +3,28 @@ import { cn as e } from "../../lib/cn.mjs";
|
|
|
3
3
|
import { isElementOfType as t } from "../../lib/children.mjs";
|
|
4
4
|
import { warnOnce as n } from "../../lib/dev.mjs";
|
|
5
5
|
import { materialiseSlotContent as r, renderSlot as i, resolveSlot as a, slotRendersContent as o, slotWrapsDefaultContent as s } from "../../lib/slot.mjs";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
15
|
-
import {
|
|
6
|
+
import { messageBarClassNames as c } from "../../lib/classNames.mjs";
|
|
7
|
+
import { useId as l } from "../../hooks/useId.mjs";
|
|
8
|
+
import { useMergedRefs as u } from "../../hooks/useMergedRefs.mjs";
|
|
9
|
+
import { joinIds as d } from "../../lib/aria.mjs";
|
|
10
|
+
import { focusRing as f } from "../../lib/styles.mjs";
|
|
11
|
+
import { Button as p } from "../button/Button.mjs";
|
|
12
|
+
import { BUTTON_OWN_PROP_KEYS as m, MERGED_DISABLED_FOCUSABLE_PROPS as h, mergedAriaDisabledClasses as g, placeButtonIcon as _ } from "../button/Button.slots.mjs";
|
|
13
|
+
import { DismissIcon as v } from "../../lib/icons.mjs";
|
|
14
|
+
import { mergeProps as y } from "../../lib/mergeProps.mjs";
|
|
15
|
+
import { hasRenderedTextLabel as b, hasTextLabel as ee, observeTextLabel as x } from "../../lib/labelInName.mjs";
|
|
16
|
+
import { useMessageBarReflow as S } from "./MessageBar.reflow.mjs";
|
|
17
|
+
import { STATUS_BORDER as C, STATUS_ICON_COLOR as w, StatusIcon as te, StatusText as ne, getStatusLabel as re } from "./MessageBar.status.mjs";
|
|
18
|
+
import { ACTIONS_PLACEMENT as ie, CONTENT_PLACEMENT as ae, EXTRA_TITLE_PLACEMENT as oe, MessageBarActions as T, MessageBarPartContext as E, MessageBarTitle as D, partitionMessageBarChildren as se, useTitlePlacement as ce } from "./MessageBar.parts.mjs";
|
|
19
|
+
import * as O from "react";
|
|
20
|
+
import { jsx as k, jsxs as A } from "react/jsx-runtime";
|
|
16
21
|
//#region src/components/feedback/MessageBar.tsx
|
|
17
|
-
var
|
|
22
|
+
var le = {
|
|
18
23
|
info: "bg-info-tint",
|
|
19
24
|
success: "bg-success-tint",
|
|
20
25
|
warning: "bg-warning-tint",
|
|
21
26
|
error: "bg-error-tint"
|
|
22
|
-
},
|
|
27
|
+
}, ue = "Dismiss", j = /* @__PURE__ */ new Set([
|
|
23
28
|
"type",
|
|
24
29
|
"disabled",
|
|
25
30
|
"autoFocus",
|
|
@@ -33,112 +38,165 @@ var O = {
|
|
|
33
38
|
"value",
|
|
34
39
|
"popoverTarget",
|
|
35
40
|
"popoverTargetAction"
|
|
36
|
-
]),
|
|
41
|
+
]), de = /* @__PURE__ */ new Set([
|
|
37
42
|
"aria-label",
|
|
38
43
|
"aria-labelledby",
|
|
39
44
|
"title"
|
|
40
|
-
]), M = /^on[A-Z]/, N = "inline-flex items-center justify-center", P =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
]), M = /^on[A-Z]/, N = "inline-flex items-center justify-center", P = /* @__PURE__ */ new Set([
|
|
46
|
+
"alert",
|
|
47
|
+
"status",
|
|
48
|
+
"log",
|
|
49
|
+
"marquee",
|
|
50
|
+
"timer"
|
|
51
|
+
]), F = /* @__PURE__ */ new Set([
|
|
52
|
+
"none",
|
|
53
|
+
"presentation",
|
|
54
|
+
"generic"
|
|
55
|
+
]);
|
|
44
56
|
function I(e) {
|
|
45
|
-
return e
|
|
57
|
+
return e?.trim().split(/\s+/)[0] || void 0;
|
|
58
|
+
}
|
|
59
|
+
function fe(e) {
|
|
60
|
+
let t = I(e);
|
|
61
|
+
return t !== void 0 && !P.has(t) && !F.has(t);
|
|
62
|
+
}
|
|
63
|
+
var pe = () => {};
|
|
64
|
+
function L(e) {
|
|
65
|
+
return /* @__PURE__ */ k(v, { className: e });
|
|
66
|
+
}
|
|
67
|
+
function R(e) {
|
|
68
|
+
return e === "button" || e === p;
|
|
46
69
|
}
|
|
47
|
-
function
|
|
70
|
+
function z() {
|
|
48
71
|
return {
|
|
49
72
|
buttonProps: {},
|
|
50
|
-
content:
|
|
73
|
+
content: L(c.dismissIcon),
|
|
51
74
|
contentMayName: !1,
|
|
52
75
|
literalTextLabel: !1,
|
|
53
76
|
disabledFocusable: !1,
|
|
54
77
|
warning: null
|
|
55
78
|
};
|
|
56
79
|
}
|
|
57
|
-
function
|
|
80
|
+
function me(n) {
|
|
58
81
|
if (n === null) return null;
|
|
59
|
-
if (n === void 0 || typeof n == "boolean") return
|
|
60
|
-
let
|
|
61
|
-
if (t(
|
|
62
|
-
let
|
|
63
|
-
for (let [
|
|
64
|
-
let
|
|
82
|
+
if (n === void 0 || typeof n == "boolean") return z();
|
|
83
|
+
let l = n;
|
|
84
|
+
if (t(l, "button", p)) {
|
|
85
|
+
let n = {};
|
|
86
|
+
for (let [e, t] of Object.entries(l.props)) e !== "children" && e !== "dangerouslySetInnerHTML" && !m.has(e) && (n[e] = t);
|
|
87
|
+
let a = t(l, p), s = l.props.dangerouslySetInnerHTML, u = s == null ? r(l.props.children) : /* @__PURE__ */ k("span", {
|
|
65
88
|
className: N,
|
|
66
|
-
dangerouslySetInnerHTML:
|
|
67
|
-
}),
|
|
89
|
+
dangerouslySetInnerHTML: s
|
|
90
|
+
}), d = l.props.icon, f = a && o(d) ? i(d, "span", e(c.dismissIcon, N), { "aria-hidden": !0 }) : null;
|
|
68
91
|
return {
|
|
69
|
-
buttonProps:
|
|
70
|
-
content:
|
|
92
|
+
buttonProps: n,
|
|
93
|
+
content: f || o(u) ? _(f, u, l.props.iconPosition) : L(c.dismissIcon),
|
|
71
94
|
contentMayName: !0,
|
|
72
|
-
literalTextLabel:
|
|
73
|
-
disabledFocusable:
|
|
95
|
+
literalTextLabel: ee(u),
|
|
96
|
+
disabledFocusable: a && !!l.props.disabledFocusable,
|
|
74
97
|
warning: "button-element"
|
|
75
98
|
};
|
|
76
99
|
}
|
|
77
|
-
let
|
|
78
|
-
if (!
|
|
79
|
-
let { Component: d, props: f, children:
|
|
80
|
-
for (let [
|
|
81
|
-
let S =
|
|
100
|
+
let u = a(n, "span");
|
|
101
|
+
if (!u) return z();
|
|
102
|
+
let { Component: d, props: f, children: h } = u, g = R(d), v = g || Object.keys(f).some((e) => j.has(e) || M.test(e)), y = {}, b = {}, x = null;
|
|
103
|
+
for (let [t, n] of Object.entries(f)) d === p && m.has(t) ? t === "icon" && o(n) && (x = i(n, "span", e(c.dismissIcon, N), { "aria-hidden": !0 })) : j.has(t) || M.test(t) || de.has(t) || v && (t === "className" || t === "style" || t === "ref") ? y[t] = n : b[t] = n;
|
|
104
|
+
let S = g ? "span" : d, C = {
|
|
82
105
|
"aria-hidden": !0,
|
|
83
106
|
...b,
|
|
84
|
-
className: e(N, b.className)
|
|
107
|
+
className: e(x === null && c.dismissIcon, N, b.className)
|
|
85
108
|
}, w = null;
|
|
86
|
-
return x || o(
|
|
109
|
+
return x || o(h) ? w = _(x, h, d === p && f.iconPosition) : s(S, {
|
|
87
110
|
...b,
|
|
88
|
-
children:
|
|
89
|
-
}) && (w =
|
|
111
|
+
children: h
|
|
112
|
+
}) && (w = L()), {
|
|
90
113
|
buttonProps: y,
|
|
91
|
-
content: w === null ?
|
|
114
|
+
content: w === null ? O.createElement(S, C) : O.createElement(S, C, w),
|
|
92
115
|
contentMayName: !1,
|
|
93
116
|
literalTextLabel: !1,
|
|
94
|
-
disabledFocusable: d ===
|
|
95
|
-
warning:
|
|
117
|
+
disabledFocusable: d === p && !!f.disabledFocusable,
|
|
118
|
+
warning: v ? "button-object" : null
|
|
96
119
|
};
|
|
97
120
|
}
|
|
98
|
-
var
|
|
99
|
-
let
|
|
121
|
+
var B = ({ status: t = "info", statusLabel: r, onDismiss: a, icon: s, dismiss: p, layout: m = "auto", children: _, className: v, ref: ee, ...T }) => {
|
|
122
|
+
let D = e(c.icon, "mt-0.5 inline-flex shrink-0", w[t]), j = s === void 0 ? /* @__PURE__ */ k("span", {
|
|
100
123
|
"aria-hidden": "true",
|
|
101
|
-
className:
|
|
102
|
-
children: /* @__PURE__ */
|
|
124
|
+
className: D,
|
|
125
|
+
children: /* @__PURE__ */ k(te, {
|
|
103
126
|
status: t,
|
|
104
127
|
size: 20
|
|
105
128
|
})
|
|
106
|
-
}) : i(
|
|
107
|
-
|
|
129
|
+
}) : o(s) ? i(s, "span", D, { "aria-hidden": !0 }) : null, M = a !== void 0 || p !== void 0 && typeof p != "boolean" ? me(p) : null, N = M?.warning ?? null;
|
|
130
|
+
O.useEffect(() => {
|
|
108
131
|
N === "button-element" ? n("MessageBar:dismiss-button-element", "MessageBar: `dismiss` received a button element; its props were merged into the built-in dismiss button (buttons cannot be nested). Pass icon content instead, e.g. `dismiss={<CloseIcon />}`, and use `onDismiss`.") : N === "button-object" && n("MessageBar:dismiss-button-object", "MessageBar: the button-object form of `dismiss` is deprecated and will be removed in 1.0; its button props were merged into the built-in dismiss button. Pass icon content instead, e.g. `dismiss={<CloseIcon />}`, and use `onDismiss`.");
|
|
109
132
|
}, [N]);
|
|
110
|
-
let { ref:
|
|
133
|
+
let { ref: P, ...F } = M?.buttonProps ?? {}, L = Object.keys(F).some((e) => de.has(e) && F[e] != null), R = M !== null && M.contentMayName && !L, z = M?.literalTextLabel ?? !1, [B, V] = O.useState(null), he = O.useCallback((e) => B ? x(B, e) : pe, [B]), ge = O.useSyncExternalStore(he, () => B ? b(B) : z, () => z), _e = R && ge, ve = u(P, R ? V : void 0), H = null;
|
|
111
134
|
if (M) {
|
|
112
|
-
let t =
|
|
113
|
-
"aria-label": L ||
|
|
135
|
+
let t = y({
|
|
136
|
+
"aria-label": L || _e ? void 0 : ue,
|
|
114
137
|
onClick: () => a?.(),
|
|
115
|
-
className: e("ms-auto inline-flex shrink-0 cursor-pointer items-center justify-center rounded border-none bg-transparent p-1 text-muted-foreground", "not-disabled:not-aria-disabled:hover:bg-subtle-hover not-disabled:not-aria-disabled:hover:text-foreground", "not-disabled:not-aria-disabled:active:bg-subtle-pressed",
|
|
116
|
-
},
|
|
117
|
-
|
|
138
|
+
className: e(c.dismissButton, "ms-auto inline-flex shrink-0 cursor-pointer items-center justify-center rounded border-none bg-transparent p-1 text-muted-foreground", "not-disabled:not-aria-disabled:hover:bg-subtle-hover not-disabled:not-aria-disabled:hover:text-foreground", "not-disabled:not-aria-disabled:active:bg-subtle-pressed", f, "disabled:cursor-not-allowed disabled:opacity-50", g)
|
|
139
|
+
}, F);
|
|
140
|
+
H = /* @__PURE__ */ k("button", {
|
|
118
141
|
...t,
|
|
119
|
-
ref:
|
|
142
|
+
ref: ve,
|
|
120
143
|
type: t.type ?? "button",
|
|
121
|
-
...M.disabledFocusable ?
|
|
144
|
+
...M.disabledFocusable ? h : void 0,
|
|
122
145
|
children: M.content
|
|
123
146
|
});
|
|
124
147
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
148
|
+
let { title: U, ownTitleId: ye, actions: W, body: be } = se(_), xe = l("wave-message-bar-title"), G = ce(ye, xe), Se = G.titleId, K = t === "error" || t === "warning" ? "alert" : "status", q = "role" in T ? T.role : K, J = T["aria-label"] !== void 0 || T["aria-labelledby"] !== void 0, Y = re(t, r), X = l("wave-message-bar-status"), Ce = U !== void 0 && !J && fe(q), we = J ? T["aria-labelledby"] : Ce ? d(Y ? X : void 0, Se) : void 0, Te = I(q) === "region" && U === void 0 && !J;
|
|
149
|
+
O.useEffect(() => {
|
|
150
|
+
Te && n("MessageBar:region-name", "MessageBar: a bar with role=\"region\" is a landmark only when it has a name. Add a MessageBar.Title, or pass aria-label or aria-labelledby.");
|
|
151
|
+
}, [Te]);
|
|
152
|
+
let Z = W.length > 0, Q = m === "auto" && Z, [Ee, De] = O.useState(null), [Oe, ke] = O.useState(null), Ae = u(ee, Q ? De : void 0), je = S(Ee, Oe, Q), $ = m === "auto" ? Z ? je : "multiline" : m, Me = Q && $ === "singleline", Ne = /* @__PURE__ */ A("div", {
|
|
153
|
+
ref: Q ? ke : void 0,
|
|
154
|
+
className: e(c.body, "min-w-0 flex-1 text-body-1", Me && "whitespace-nowrap"),
|
|
130
155
|
children: [
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
children: [/* @__PURE__ */ E(C, { label: w(t, r) }), u]
|
|
156
|
+
/* @__PURE__ */ k(ne, {
|
|
157
|
+
id: Ce && Y ? X : void 0,
|
|
158
|
+
label: Y
|
|
135
159
|
}),
|
|
136
|
-
|
|
160
|
+
U && /* @__PURE__ */ k(E.Provider, {
|
|
161
|
+
value: G,
|
|
162
|
+
children: U.element
|
|
163
|
+
}),
|
|
164
|
+
U && " ",
|
|
165
|
+
be.map(({ key: e, node: t, extraTitle: n }) => n ? /* @__PURE__ */ k(E.Provider, {
|
|
166
|
+
value: oe,
|
|
167
|
+
children: t
|
|
168
|
+
}, e) : /* @__PURE__ */ k(O.Fragment, { children: t }, e))
|
|
137
169
|
]
|
|
138
170
|
});
|
|
171
|
+
return /* @__PURE__ */ k("div", {
|
|
172
|
+
ref: Ae,
|
|
173
|
+
role: K,
|
|
174
|
+
"data-layout": $,
|
|
175
|
+
...T,
|
|
176
|
+
"aria-labelledby": we,
|
|
177
|
+
className: e(c.root, "flex items-start gap-3 rounded border-s-4 px-4 py-3 text-foreground", le[t], C[t], v),
|
|
178
|
+
children: /* @__PURE__ */ A(E.Provider, {
|
|
179
|
+
value: ae,
|
|
180
|
+
children: [
|
|
181
|
+
j,
|
|
182
|
+
Z ? /* @__PURE__ */ A("div", {
|
|
183
|
+
className: e("flex min-w-0 flex-1 gap-x-3 gap-y-2", $ === "multiline" ? "flex-col" : "items-start"),
|
|
184
|
+
children: [Ne, /* @__PURE__ */ k(E.Provider, {
|
|
185
|
+
value: ie,
|
|
186
|
+
children: W.map(({ key: e, element: t }) => /* @__PURE__ */ k(O.Fragment, { children: t }, e))
|
|
187
|
+
})]
|
|
188
|
+
}) : Ne,
|
|
189
|
+
H
|
|
190
|
+
]
|
|
191
|
+
})
|
|
192
|
+
});
|
|
139
193
|
};
|
|
140
|
-
|
|
194
|
+
B.displayName = "MessageBar";
|
|
195
|
+
var V = /* @__PURE__ */ Object.assign(B, {
|
|
196
|
+
Title: D,
|
|
197
|
+
Actions: T
|
|
198
|
+
});
|
|
141
199
|
//#endregion
|
|
142
|
-
export {
|
|
200
|
+
export { V as MessageBar, T as MessageBarActions, D as MessageBarTitle };
|
|
143
201
|
|
|
144
202
|
//# sourceMappingURL=MessageBar.mjs.map
|