@sixthshift/design-system 0.2.1 → 0.4.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 +242 -33
- package/dist/components/Badge/Badge.d.ts +65 -7
- package/dist/components/Badge/Badge.d.ts.map +1 -1
- package/dist/components/Badge/Badge.js +56 -46
- package/dist/components/Badge/Badge.js.map +1 -1
- package/dist/components/Badge/index.d.ts +1 -1
- package/dist/components/Badge/index.d.ts.map +1 -1
- package/dist/components/Badge/index.js +1 -1
- package/dist/components/Badge/index.js.map +1 -1
- package/dist/components/BarChart/BarChart.d.ts +20 -2
- package/dist/components/BarChart/BarChart.d.ts.map +1 -1
- package/dist/components/BarChart/BarChart.js +17 -3
- package/dist/components/BarChart/BarChart.js.map +1 -1
- package/dist/components/Button/Button.d.ts +85 -6
- package/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/components/Button/Button.js +97 -106
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/Button/index.d.ts +1 -1
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +1 -1
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Calendar/Calendar.d.ts +31 -1
- package/dist/components/Calendar/Calendar.d.ts.map +1 -1
- package/dist/components/Calendar/Calendar.js +94 -225
- package/dist/components/Calendar/Calendar.js.map +1 -1
- package/dist/components/Calendar/CalendarView.d.ts +15 -0
- package/dist/components/Calendar/CalendarView.d.ts.map +1 -0
- package/dist/components/Calendar/CalendarView.js +263 -0
- package/dist/components/Calendar/CalendarView.js.map +1 -0
- package/dist/components/Calendar/calendar.types.d.ts +87 -27
- package/dist/components/Calendar/calendar.types.d.ts.map +1 -1
- package/dist/components/Calendar/calendar.types.js +10 -3
- package/dist/components/Calendar/calendar.types.js.map +1 -1
- package/dist/components/Calendar/index.d.ts +16 -2
- package/dist/components/Calendar/index.d.ts.map +1 -1
- package/dist/components/Calendar/index.js +15 -1
- package/dist/components/Calendar/index.js.map +1 -1
- package/dist/components/Card/Card.d.ts +13 -0
- package/dist/components/Card/Card.d.ts.map +1 -1
- package/dist/components/Card/Card.js +15 -2
- package/dist/components/Card/Card.js.map +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +21 -0
- package/dist/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/components/Checkbox/Checkbox.js +22 -1
- package/dist/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +22 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts.map +1 -1
- package/dist/components/CheckboxGroup/CheckboxGroup.js +22 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.js.map +1 -1
- package/dist/components/Code/Editor/Editor.js +2 -2
- package/dist/components/Code/Editor/Editor.js.map +1 -1
- package/dist/components/Code/Editor/themes.d.ts +2 -2
- package/dist/components/Code/Editor/themes.d.ts.map +1 -1
- package/dist/components/Code/Editor/themes.js +50 -32
- package/dist/components/Code/Editor/themes.js.map +1 -1
- package/dist/components/Code/ValidationStatus/ValidationStatus.d.ts.map +1 -1
- package/dist/components/Code/ValidationStatus/ValidationStatus.js.map +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts +45 -2
- package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/components/DatePicker/DatePicker.js +228 -11
- package/dist/components/DatePicker/DatePicker.js.map +1 -1
- package/dist/components/DatePicker/DateSegments.d.ts +60 -0
- package/dist/components/DatePicker/DateSegments.d.ts.map +1 -0
- package/dist/components/DatePicker/DateSegments.js +80 -0
- package/dist/components/DatePicker/DateSegments.js.map +1 -0
- package/dist/components/DatePicker/datepicker.types.d.ts +53 -37
- package/dist/components/DatePicker/datepicker.types.d.ts.map +1 -1
- package/dist/components/DatePicker/datepicker.types.js +5 -3
- package/dist/components/DatePicker/datepicker.types.js.map +1 -1
- package/dist/components/DatePicker/index.d.ts +10 -1
- package/dist/components/DatePicker/index.d.ts.map +1 -1
- package/dist/components/DatePicker/index.js +8 -0
- package/dist/components/DatePicker/index.js.map +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +22 -3
- package/dist/components/DateRangePicker/DateRangePicker.d.ts.map +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.js +38 -24
- package/dist/components/DateRangePicker/DateRangePicker.js.map +1 -1
- package/dist/components/DateRangePicker/daterangepicker.types.d.ts +26 -21
- package/dist/components/DateRangePicker/daterangepicker.types.d.ts.map +1 -1
- package/dist/components/DateRangePicker/daterangepicker.types.js +6 -0
- package/dist/components/DateRangePicker/daterangepicker.types.js.map +1 -1
- package/dist/components/DateRangePicker/index.d.ts +8 -1
- package/dist/components/DateRangePicker/index.d.ts.map +1 -1
- package/dist/components/DateRangePicker/index.js +6 -0
- package/dist/components/DateRangePicker/index.js.map +1 -1
- package/dist/components/DateTimePicker/DateTimePicker.d.ts +32 -4
- package/dist/components/DateTimePicker/DateTimePicker.d.ts.map +1 -1
- package/dist/components/DateTimePicker/DateTimePicker.js +133 -42
- package/dist/components/DateTimePicker/DateTimePicker.js.map +1 -1
- package/dist/components/DateTimePicker/DateTimeSegments.d.ts +41 -0
- package/dist/components/DateTimePicker/DateTimeSegments.d.ts.map +1 -0
- package/dist/components/DateTimePicker/DateTimeSegments.js +67 -0
- package/dist/components/DateTimePicker/DateTimeSegments.js.map +1 -0
- package/dist/components/DateTimePicker/datetimepicker.types.d.ts +26 -18
- package/dist/components/DateTimePicker/datetimepicker.types.d.ts.map +1 -1
- package/dist/components/DateTimePicker/datetimepicker.types.js +10 -0
- package/dist/components/DateTimePicker/datetimepicker.types.js.map +1 -1
- package/dist/components/DateTimePicker/index.d.ts +8 -1
- package/dist/components/DateTimePicker/index.d.ts.map +1 -1
- package/dist/components/DateTimePicker/index.js +6 -0
- package/dist/components/DateTimePicker/index.js.map +1 -1
- package/dist/components/DateTimeRangePicker/DateTimeRangePicker.d.ts +30 -4
- package/dist/components/DateTimeRangePicker/DateTimeRangePicker.d.ts.map +1 -1
- package/dist/components/DateTimeRangePicker/DateTimeRangePicker.js +171 -72
- package/dist/components/DateTimeRangePicker/DateTimeRangePicker.js.map +1 -1
- package/dist/components/DateTimeRangePicker/datetimerangepicker.types.d.ts +28 -19
- package/dist/components/DateTimeRangePicker/datetimerangepicker.types.d.ts.map +1 -1
- package/dist/components/DateTimeRangePicker/datetimerangepicker.types.js +8 -0
- package/dist/components/DateTimeRangePicker/datetimerangepicker.types.js.map +1 -1
- package/dist/components/DateTimeRangePicker/index.d.ts +8 -0
- package/dist/components/DateTimeRangePicker/index.d.ts.map +1 -1
- package/dist/components/DateTimeRangePicker/index.js +7 -0
- package/dist/components/DateTimeRangePicker/index.js.map +1 -1
- package/dist/components/Field/Field.d.ts +18 -20
- package/dist/components/Field/Field.d.ts.map +1 -1
- package/dist/components/Field/Field.js +22 -5
- package/dist/components/Field/Field.js.map +1 -1
- package/dist/components/FormField/FormField.d.ts +15 -0
- package/dist/components/FormField/FormField.d.ts.map +1 -1
- package/dist/components/FormField/FormField.js +15 -0
- package/dist/components/FormField/FormField.js.map +1 -1
- package/dist/components/HoverCard/HoverCard.d.ts +6 -0
- package/dist/components/HoverCard/HoverCard.d.ts.map +1 -1
- package/dist/components/HoverCard/HoverCard.js +6 -0
- package/dist/components/HoverCard/HoverCard.js.map +1 -1
- package/dist/components/Input/Input.d.ts +15 -0
- package/dist/components/Input/Input.d.ts.map +1 -1
- package/dist/components/Input/Input.js +18 -3
- package/dist/components/Input/Input.js.map +1 -1
- package/dist/components/LineChart/LineChart.d.ts +35 -2
- package/dist/components/LineChart/LineChart.d.ts.map +1 -1
- package/dist/components/LineChart/LineChart.js +22 -3
- package/dist/components/LineChart/LineChart.js.map +1 -1
- package/dist/components/Markdown/Markdown.d.ts +19 -4
- package/dist/components/Markdown/Markdown.d.ts.map +1 -1
- package/dist/components/Markdown/Markdown.js +20 -2
- package/dist/components/Markdown/Markdown.js.map +1 -1
- package/dist/components/Message/Message.d.ts +49 -4
- package/dist/components/Message/Message.d.ts.map +1 -1
- package/dist/components/Message/Message.js +62 -11
- package/dist/components/Message/Message.js.map +1 -1
- package/dist/components/Message/index.d.ts +1 -1
- package/dist/components/Message/index.d.ts.map +1 -1
- package/dist/components/Modal/Modal.d.ts +60 -5
- package/dist/components/Modal/Modal.d.ts.map +1 -1
- package/dist/components/Modal/Modal.js +52 -6
- package/dist/components/Modal/Modal.js.map +1 -1
- package/dist/components/Modal/components/ModalContext.d.ts +14 -0
- package/dist/components/Modal/components/ModalContext.d.ts.map +1 -1
- package/dist/components/Modal/components/ModalContext.js.map +1 -1
- package/dist/components/Modal/components/ModalHeader.d.ts.map +1 -1
- package/dist/components/Modal/components/ModalHeader.js +13 -2
- package/dist/components/Modal/components/ModalHeader.js.map +1 -1
- package/dist/components/Popover/Popover.d.ts +29 -0
- package/dist/components/Popover/Popover.d.ts.map +1 -1
- package/dist/components/Popover/Popover.js +36 -0
- package/dist/components/Popover/Popover.js.map +1 -1
- package/dist/components/Popover/components/PopoverBody.d.ts.map +1 -1
- package/dist/components/Popover/components/PopoverBody.js +5 -2
- package/dist/components/Popover/components/PopoverBody.js.map +1 -1
- package/dist/components/Popover/components/PopoverContext.d.ts +1 -0
- package/dist/components/Popover/components/PopoverContext.d.ts.map +1 -1
- package/dist/components/Popover/components/PopoverContext.js.map +1 -1
- package/dist/components/Popover/components/PopoverTrigger.d.ts.map +1 -1
- package/dist/components/Popover/components/PopoverTrigger.js +2 -2
- package/dist/components/Popover/components/PopoverTrigger.js.map +1 -1
- package/dist/components/ProgressBar/ProgressBar.d.ts +16 -1
- package/dist/components/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/dist/components/ProgressBar/ProgressBar.js +19 -3
- package/dist/components/ProgressBar/ProgressBar.js.map +1 -1
- package/dist/components/RadioButton/RadioButton.d.ts +26 -0
- package/dist/components/RadioButton/RadioButton.d.ts.map +1 -1
- package/dist/components/RadioButton/RadioButton.js +35 -1
- package/dist/components/RadioButton/RadioButton.js.map +1 -1
- package/dist/components/RadioButtonGroup/RadioButtonGroup.d.ts +26 -0
- package/dist/components/RadioButtonGroup/RadioButtonGroup.d.ts.map +1 -1
- package/dist/components/RadioButtonGroup/RadioButtonGroup.js +33 -0
- package/dist/components/RadioButtonGroup/RadioButtonGroup.js.map +1 -1
- package/dist/components/SearchInput/SearchInput.d.ts +10 -0
- package/dist/components/SearchInput/SearchInput.d.ts.map +1 -1
- package/dist/components/SearchInput/SearchInput.js +12 -1
- package/dist/components/SearchInput/SearchInput.js.map +1 -1
- package/dist/components/Select/Select.d.ts +10 -2
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/components/Select/Select.js +63 -18
- package/dist/components/Select/Select.js.map +1 -1
- package/dist/components/Select/SelectDropdown.d.ts +14 -2
- package/dist/components/Select/SelectDropdown.d.ts.map +1 -1
- package/dist/components/Select/SelectDropdown.js +20 -4
- package/dist/components/Select/SelectDropdown.js.map +1 -1
- package/dist/components/Select/SelectTrigger.d.ts +10 -3
- package/dist/components/Select/SelectTrigger.d.ts.map +1 -1
- package/dist/components/Select/SelectTrigger.js +12 -3
- package/dist/components/Select/SelectTrigger.js.map +1 -1
- package/dist/components/Select/useSelectKeyboard.d.ts +15 -1
- package/dist/components/Select/useSelectKeyboard.d.ts.map +1 -1
- package/dist/components/Select/useSelectKeyboard.js +73 -65
- package/dist/components/Select/useSelectKeyboard.js.map +1 -1
- package/dist/components/Separator/Separator.d.ts +10 -0
- package/dist/components/Separator/Separator.d.ts.map +1 -1
- package/dist/components/Separator/Separator.js +10 -0
- package/dist/components/Separator/Separator.js.map +1 -1
- package/dist/components/Sheet/Sheet.d.ts +25 -5
- package/dist/components/Sheet/Sheet.d.ts.map +1 -1
- package/dist/components/Sheet/Sheet.js +24 -6
- package/dist/components/Sheet/Sheet.js.map +1 -1
- package/dist/components/Sheet/components/SheetContext.d.ts +10 -0
- package/dist/components/Sheet/components/SheetContext.d.ts.map +1 -1
- package/dist/components/Sheet/components/SheetContext.js.map +1 -1
- package/dist/components/Sheet/components/SheetFooter.js +1 -1
- package/dist/components/Sheet/components/SheetFooter.js.map +1 -1
- package/dist/components/Sheet/components/SheetHeader.d.ts.map +1 -1
- package/dist/components/Sheet/components/SheetHeader.js +11 -2
- package/dist/components/Sheet/components/SheetHeader.js.map +1 -1
- package/dist/components/Sparkline/Sparkline.d.ts +21 -2
- package/dist/components/Sparkline/Sparkline.d.ts.map +1 -1
- package/dist/components/Sparkline/Sparkline.js +16 -3
- package/dist/components/Sparkline/Sparkline.js.map +1 -1
- package/dist/components/Spinner/Spinner.d.ts +27 -2
- package/dist/components/Spinner/Spinner.d.ts.map +1 -1
- package/dist/components/Spinner/Spinner.js +28 -3
- package/dist/components/Spinner/Spinner.js.map +1 -1
- package/dist/components/Switch/Switch.d.ts +18 -0
- package/dist/components/Switch/Switch.d.ts.map +1 -1
- package/dist/components/Switch/Switch.js +19 -1
- package/dist/components/Switch/Switch.js.map +1 -1
- package/dist/components/Tabs/Tabs.d.ts +8 -2
- package/dist/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/components/Tabs/Tabs.js +6 -0
- package/dist/components/Tabs/Tabs.js.map +1 -1
- package/dist/components/Tabs/components/TabsList.d.ts +1 -1
- package/dist/components/Tabs/components/TabsList.d.ts.map +1 -1
- package/dist/components/Tabs/components/TabsList.js +5 -4
- package/dist/components/Tabs/components/TabsList.js.map +1 -1
- package/dist/components/Tabs/components/TabsPanels.d.ts +1 -1
- package/dist/components/Tabs/components/TabsPanels.d.ts.map +1 -1
- package/dist/components/Tabs/components/TabsPanels.js +5 -3
- package/dist/components/Tabs/components/TabsPanels.js.map +1 -1
- package/dist/components/Tabs/components/TabsTrigger.d.ts.map +1 -1
- package/dist/components/Tabs/components/TabsTrigger.js +22 -6
- package/dist/components/Tabs/components/TabsTrigger.js.map +1 -1
- package/dist/components/TagChip/TagChip.d.ts +16 -13
- package/dist/components/TagChip/TagChip.d.ts.map +1 -1
- package/dist/components/TagChip/TagChip.js +18 -3
- package/dist/components/TagChip/TagChip.js.map +1 -1
- package/dist/components/TagInput/TagInput.d.ts +12 -9
- package/dist/components/TagInput/TagInput.d.ts.map +1 -1
- package/dist/components/TagInput/TagInput.js +16 -4
- package/dist/components/TagInput/TagInput.js.map +1 -1
- package/dist/components/Text/Text.d.ts +9 -0
- package/dist/components/Text/Text.d.ts.map +1 -1
- package/dist/components/Text/Text.js +9 -0
- package/dist/components/Text/Text.js.map +1 -1
- package/dist/components/TextInline/TextInline.d.ts +15 -4
- package/dist/components/TextInline/TextInline.d.ts.map +1 -1
- package/dist/components/TextInline/TextInline.js +11 -0
- package/dist/components/TextInline/TextInline.js.map +1 -1
- package/dist/components/Textarea/Textarea.d.ts +12 -0
- package/dist/components/Textarea/Textarea.d.ts.map +1 -1
- package/dist/components/Textarea/Textarea.js +13 -1
- package/dist/components/Textarea/Textarea.js.map +1 -1
- package/dist/components/TimePicker/TimeColumn.d.ts +10 -1
- package/dist/components/TimePicker/TimeColumn.d.ts.map +1 -1
- package/dist/components/TimePicker/TimeColumn.js +8 -1
- package/dist/components/TimePicker/TimeColumn.js.map +1 -1
- package/dist/components/TimePicker/TimePicker.d.ts +34 -2
- package/dist/components/TimePicker/TimePicker.d.ts.map +1 -1
- package/dist/components/TimePicker/TimePicker.js +118 -15
- package/dist/components/TimePicker/TimePicker.js.map +1 -1
- package/dist/components/TimePicker/TimeSegments.d.ts +50 -0
- package/dist/components/TimePicker/TimeSegments.d.ts.map +1 -0
- package/dist/components/TimePicker/TimeSegments.js +93 -0
- package/dist/components/TimePicker/TimeSegments.js.map +1 -0
- package/dist/components/TimePicker/timepicker.hooks.d.ts +0 -4
- package/dist/components/TimePicker/timepicker.hooks.d.ts.map +1 -1
- package/dist/components/TimePicker/timepicker.hooks.js +1 -23
- package/dist/components/TimePicker/timepicker.hooks.js.map +1 -1
- package/dist/components/TimePicker/timepicker.types.d.ts +14 -15
- package/dist/components/TimePicker/timepicker.types.d.ts.map +1 -1
- package/dist/components/TimePicker/timepicker.types.js +4 -3
- package/dist/components/TimePicker/timepicker.types.js.map +1 -1
- package/dist/components/Toast/Toast.d.ts +27 -0
- package/dist/components/Toast/Toast.d.ts.map +1 -1
- package/dist/components/Toast/Toast.js +28 -1
- package/dist/components/Toast/Toast.js.map +1 -1
- package/dist/components/Toggle/Toggle.d.ts +31 -12
- package/dist/components/Toggle/Toggle.d.ts.map +1 -1
- package/dist/components/Toggle/Toggle.js +19 -31
- package/dist/components/Toggle/Toggle.js.map +1 -1
- package/dist/components/Toggle/index.d.ts +1 -1
- package/dist/components/Toggle/index.d.ts.map +1 -1
- package/dist/components/Toggle/index.js +1 -1
- package/dist/components/Toggle/index.js.map +1 -1
- package/dist/components/ToggleGroup/ToggleGroup.d.ts +17 -0
- package/dist/components/ToggleGroup/ToggleGroup.d.ts.map +1 -1
- package/dist/components/ToggleGroup/ToggleGroup.js +17 -0
- package/dist/components/ToggleGroup/ToggleGroup.js.map +1 -1
- package/dist/components/ToggleGroup/ToggleGroupItem.d.ts +1 -1
- package/dist/components/ToggleGroup/ToggleGroupItem.d.ts.map +1 -1
- package/dist/components/ToggleGroup/ToggleGroupItem.js +7 -6
- package/dist/components/ToggleGroup/ToggleGroupItem.js.map +1 -1
- package/dist/components/ToggleGroup/ToggleGroupMultiple.d.ts +4 -3
- package/dist/components/ToggleGroup/ToggleGroupMultiple.d.ts.map +1 -1
- package/dist/components/ToggleGroup/ToggleGroupMultiple.js +2 -2
- package/dist/components/ToggleGroup/ToggleGroupMultiple.js.map +1 -1
- package/dist/components/ToggleGroup/ToggleGroupSingle.d.ts +4 -3
- package/dist/components/ToggleGroup/ToggleGroupSingle.d.ts.map +1 -1
- package/dist/components/ToggleGroup/ToggleGroupSingle.js +2 -2
- package/dist/components/ToggleGroup/ToggleGroupSingle.js.map +1 -1
- package/dist/components/ToggleGroup/toggleGroup.types.d.ts +12 -3
- package/dist/components/ToggleGroup/toggleGroup.types.d.ts.map +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +6 -0
- package/dist/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/components/Tooltip/Tooltip.js +6 -0
- package/dist/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/date-time/index.d.ts +2 -0
- package/dist/date-time/index.d.ts.map +1 -1
- package/dist/date-time/index.js +9 -1
- package/dist/date-time/index.js.map +1 -1
- package/dist/date-time/iso.d.ts +261 -0
- package/dist/date-time/iso.d.ts.map +1 -0
- package/dist/date-time/iso.js +358 -0
- package/dist/date-time/iso.js.map +1 -0
- package/dist/date-time/now.d.ts +7 -6
- package/dist/date-time/now.d.ts.map +1 -1
- package/dist/date-time/now.js +3 -3
- package/dist/date-time/now.js.map +1 -1
- package/dist/internal/PickerField.d.ts +45 -0
- package/dist/internal/PickerField.d.ts.map +1 -0
- package/dist/internal/PickerField.js +24 -0
- package/dist/internal/PickerField.js.map +1 -0
- package/dist/internal/SegmentedField.d.ts +98 -0
- package/dist/internal/SegmentedField.d.ts.map +1 -0
- package/dist/internal/SegmentedField.js +315 -0
- package/dist/internal/SegmentedField.js.map +1 -0
- package/dist/internal/index.d.ts +2 -0
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +2 -0
- package/dist/internal/index.js.map +1 -1
- package/dist/theme/index.d.ts +4 -3
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +3 -2
- package/dist/theme/index.js.map +1 -1
- package/dist/theme/schema.d.ts +49 -33
- package/dist/theme/schema.d.ts.map +1 -1
- package/dist/theme/schema.js +30 -21
- package/dist/theme/schema.js.map +1 -1
- package/package.json +11 -59
- package/src/components/Badge/Badge.tsx +87 -49
- package/src/components/Badge/index.ts +10 -1
- package/src/components/BarChart/BarChart.tsx +37 -30
- package/src/components/Button/Button.tsx +129 -106
- package/src/components/Button/index.ts +10 -1
- package/src/components/Calendar/Calendar.tsx +104 -401
- package/src/components/Calendar/CalendarView.tsx +454 -0
- package/src/components/Calendar/calendar.types.ts +104 -29
- package/src/components/Calendar/index.ts +16 -17
- package/src/components/Card/Card.tsx +15 -2
- package/src/components/Checkbox/Checkbox.tsx +22 -2
- package/src/components/CheckboxGroup/CheckboxGroup.tsx +22 -0
- package/src/components/Code/Editor/Editor.tsx +2 -2
- package/src/components/Code/Editor/themes.ts +50 -32
- package/src/components/Code/ValidationStatus/ValidationStatus.tsx +6 -3
- package/src/components/DatePicker/DatePicker.tsx +369 -42
- package/src/components/DatePicker/DateSegments.tsx +125 -0
- package/src/components/DatePicker/datepicker.types.ts +58 -39
- package/src/components/DatePicker/index.ts +11 -3
- package/src/components/DateRangePicker/DateRangePicker.tsx +38 -24
- package/src/components/DateRangePicker/daterangepicker.types.ts +29 -23
- package/src/components/DateRangePicker/index.ts +9 -1
- package/src/components/DateTimePicker/DateTimePicker.tsx +189 -88
- package/src/components/DateTimePicker/DateTimeSegments.tsx +113 -0
- package/src/components/DateTimePicker/datetimepicker.types.ts +29 -19
- package/src/components/DateTimePicker/index.ts +9 -1
- package/src/components/DateTimeRangePicker/DateTimeRangePicker.tsx +251 -126
- package/src/components/DateTimeRangePicker/datetimerangepicker.types.ts +31 -20
- package/src/components/DateTimeRangePicker/index.ts +9 -0
- package/src/components/Field/Field.tsx +25 -26
- package/src/components/FormField/FormField.tsx +15 -0
- package/src/components/HoverCard/HoverCard.tsx +6 -0
- package/src/components/Input/Input.tsx +19 -4
- package/src/components/LineChart/LineChart.tsx +164 -141
- package/src/components/Markdown/Markdown.tsx +21 -3
- package/src/components/Message/Message.tsx +83 -17
- package/src/components/Message/index.ts +1 -1
- package/src/components/Modal/Modal.tsx +157 -86
- package/src/components/Modal/components/ModalContext.tsx +14 -0
- package/src/components/Modal/components/ModalHeader.tsx +15 -3
- package/src/components/Popover/Popover.tsx +36 -0
- package/src/components/Popover/components/PopoverBody.tsx +6 -1
- package/src/components/Popover/components/PopoverContext.tsx +1 -0
- package/src/components/Popover/components/PopoverTrigger.tsx +2 -1
- package/src/components/ProgressBar/ProgressBar.tsx +46 -28
- package/src/components/RadioButton/RadioButton.tsx +34 -3
- package/src/components/RadioButtonGroup/RadioButtonGroup.tsx +32 -0
- package/src/components/SearchInput/SearchInput.tsx +13 -2
- package/src/components/Select/Select.tsx +75 -19
- package/src/components/Select/SelectDropdown.tsx +45 -12
- package/src/components/Select/SelectTrigger.tsx +31 -8
- package/src/components/Select/useSelectKeyboard.ts +20 -10
- package/src/components/Separator/Separator.tsx +10 -0
- package/src/components/Sheet/Sheet.tsx +114 -83
- package/src/components/Sheet/components/SheetContext.tsx +10 -0
- package/src/components/Sheet/components/SheetFooter.tsx +1 -1
- package/src/components/Sheet/components/SheetHeader.tsx +18 -3
- package/src/components/Sparkline/Sparkline.tsx +40 -36
- package/src/components/Spinner/Spinner.tsx +28 -3
- package/src/components/Switch/Switch.tsx +27 -4
- package/src/components/Tabs/Tabs.tsx +6 -0
- package/src/components/Tabs/components/TabsList.tsx +5 -3
- package/src/components/Tabs/components/TabsPanels.tsx +5 -3
- package/src/components/Tabs/components/TabsTrigger.tsx +22 -5
- package/src/components/TagChip/TagChip.tsx +27 -18
- package/src/components/TagInput/TagInput.tsx +16 -11
- package/src/components/Text/Text.tsx +9 -0
- package/src/components/TextInline/TextInline.tsx +11 -0
- package/src/components/Textarea/Textarea.tsx +13 -1
- package/src/components/TimePicker/TimeColumn.tsx +24 -1
- package/src/components/TimePicker/TimePicker.tsx +157 -51
- package/src/components/TimePicker/TimeSegments.tsx +131 -0
- package/src/components/TimePicker/timepicker.hooks.ts +1 -24
- package/src/components/TimePicker/timepicker.types.ts +14 -16
- package/src/components/Toast/Toast.tsx +28 -1
- package/src/components/Toggle/Toggle.tsx +34 -32
- package/src/components/Toggle/index.ts +1 -1
- package/src/components/ToggleGroup/ToggleGroup.tsx +17 -0
- package/src/components/ToggleGroup/ToggleGroupItem.tsx +13 -8
- package/src/components/ToggleGroup/ToggleGroupMultiple.tsx +3 -1
- package/src/components/ToggleGroup/ToggleGroupSingle.tsx +3 -1
- package/src/components/ToggleGroup/toggleGroup.types.ts +12 -3
- package/src/components/Tooltip/Tooltip.tsx +6 -0
- package/src/date-time/index.ts +61 -1
- package/src/date-time/iso.ts +511 -0
- package/src/date-time/now.ts +10 -9
- package/src/internal/PickerField.tsx +90 -0
- package/src/internal/SegmentedField.tsx +445 -0
- package/src/internal/index.ts +2 -0
- package/src/theme/index.ts +11 -9
- package/src/theme/recipes/badge.css +140 -0
- package/src/theme/recipes/button.css +167 -0
- package/src/theme/recipes/card.css +26 -0
- package/src/theme/recipes/checkbox.css +44 -0
- package/src/theme/recipes/field.css +14 -0
- package/src/theme/recipes/index.css +28 -0
- package/src/theme/recipes/input.css +29 -0
- package/src/theme/recipes/message.css +47 -0
- package/src/theme/recipes/modal.css +31 -0
- package/src/theme/recipes/radio-button.css +42 -0
- package/src/theme/recipes/search-input.css +16 -0
- package/src/theme/recipes/select.css +105 -0
- package/src/theme/recipes/sheet.css +34 -0
- package/src/theme/recipes/spinner.css +17 -0
- package/src/theme/recipes/switch.css +39 -0
- package/src/theme/recipes/tabs.css +41 -0
- package/src/theme/recipes/tag-chip.css +27 -0
- package/src/theme/recipes/textarea.css +20 -0
- package/src/theme/recipes/toggle.css +92 -0
- package/src/theme/schema.ts +59 -58
- package/src/theme/tokens.css +824 -0
- package/dist/components/Avatar/Avatar.d.ts +0 -6
- package/dist/components/Avatar/Avatar.d.ts.map +0 -1
- package/dist/components/Avatar/Avatar.js +0 -11
- package/dist/components/Avatar/Avatar.js.map +0 -1
- package/dist/components/Avatar/index.d.ts +0 -2
- package/dist/components/Avatar/index.d.ts.map +0 -1
- package/dist/components/Avatar/index.js +0 -2
- package/dist/components/Avatar/index.js.map +0 -1
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +0 -12
- package/dist/components/Breadcrumb/Breadcrumb.d.ts.map +0 -1
- package/dist/components/Breadcrumb/Breadcrumb.js +0 -19
- package/dist/components/Breadcrumb/Breadcrumb.js.map +0 -1
- package/dist/components/Breadcrumb/index.d.ts +0 -2
- package/dist/components/Breadcrumb/index.d.ts.map +0 -1
- package/dist/components/Breadcrumb/index.js +0 -2
- package/dist/components/Breadcrumb/index.js.map +0 -1
- package/dist/components/ColorDot/ColorDot.d.ts +0 -13
- package/dist/components/ColorDot/ColorDot.d.ts.map +0 -1
- package/dist/components/ColorDot/ColorDot.js +0 -34
- package/dist/components/ColorDot/ColorDot.js.map +0 -1
- package/dist/components/ColorDot/index.d.ts +0 -2
- package/dist/components/ColorDot/index.d.ts.map +0 -1
- package/dist/components/ColorDot/index.js +0 -2
- package/dist/components/ColorDot/index.js.map +0 -1
- package/dist/components/EmptyState/EmptyState.d.ts +0 -15
- package/dist/components/EmptyState/EmptyState.d.ts.map +0 -1
- package/dist/components/EmptyState/EmptyState.js +0 -7
- package/dist/components/EmptyState/EmptyState.js.map +0 -1
- package/dist/components/EmptyState/index.d.ts +0 -2
- package/dist/components/EmptyState/index.d.ts.map +0 -1
- package/dist/components/EmptyState/index.js +0 -2
- package/dist/components/EmptyState/index.js.map +0 -1
- package/dist/components/HeatMap/HeatMapCalendar.d.ts +0 -11
- package/dist/components/HeatMap/HeatMapCalendar.d.ts.map +0 -1
- package/dist/components/HeatMap/HeatMapCalendar.js +0 -68
- package/dist/components/HeatMap/HeatMapCalendar.js.map +0 -1
- package/dist/components/HeatMap/HeatMapMatrix.d.ts +0 -12
- package/dist/components/HeatMap/HeatMapMatrix.d.ts.map +0 -1
- package/dist/components/HeatMap/HeatMapMatrix.js +0 -35
- package/dist/components/HeatMap/HeatMapMatrix.js.map +0 -1
- package/dist/components/HeatMap/heat-map.utils.d.ts +0 -10
- package/dist/components/HeatMap/heat-map.utils.d.ts.map +0 -1
- package/dist/components/HeatMap/heat-map.utils.js +0 -10
- package/dist/components/HeatMap/heat-map.utils.js.map +0 -1
- package/dist/components/HeatMap/index.d.ts +0 -4
- package/dist/components/HeatMap/index.d.ts.map +0 -1
- package/dist/components/HeatMap/index.js +0 -3
- package/dist/components/HeatMap/index.js.map +0 -1
- package/dist/components/MetricList/MetricList.d.ts +0 -9
- package/dist/components/MetricList/MetricList.d.ts.map +0 -1
- package/dist/components/MetricList/MetricList.js +0 -6
- package/dist/components/MetricList/MetricList.js.map +0 -1
- package/dist/components/MetricList/MetricRow.d.ts +0 -13
- package/dist/components/MetricList/MetricRow.d.ts.map +0 -1
- package/dist/components/MetricList/MetricRow.js +0 -13
- package/dist/components/MetricList/MetricRow.js.map +0 -1
- package/dist/components/MetricList/index.d.ts +0 -3
- package/dist/components/MetricList/index.d.ts.map +0 -1
- package/dist/components/MetricList/index.js +0 -3
- package/dist/components/MetricList/index.js.map +0 -1
- package/dist/components/NavBottom/NavBottom.d.ts +0 -15
- package/dist/components/NavBottom/NavBottom.d.ts.map +0 -1
- package/dist/components/NavBottom/NavBottom.js +0 -19
- package/dist/components/NavBottom/NavBottom.js.map +0 -1
- package/dist/components/NavBottom/index.d.ts +0 -3
- package/dist/components/NavBottom/index.d.ts.map +0 -1
- package/dist/components/NavBottom/index.js +0 -2
- package/dist/components/NavBottom/index.js.map +0 -1
- package/dist/components/NavSide/NavItem.d.ts +0 -9
- package/dist/components/NavSide/NavItem.d.ts.map +0 -1
- package/dist/components/NavSide/NavItem.js +0 -13
- package/dist/components/NavSide/NavItem.js.map +0 -1
- package/dist/components/NavSide/NavSide.d.ts +0 -15
- package/dist/components/NavSide/NavSide.d.ts.map +0 -1
- package/dist/components/NavSide/NavSide.js +0 -10
- package/dist/components/NavSide/NavSide.js.map +0 -1
- package/dist/components/NavSide/index.d.ts +0 -3
- package/dist/components/NavSide/index.d.ts.map +0 -1
- package/dist/components/NavSide/index.js +0 -2
- package/dist/components/NavSide/index.js.map +0 -1
- package/dist/components/NavSide/types.d.ts +0 -38
- package/dist/components/NavSide/types.d.ts.map +0 -1
- package/dist/components/NavSide/types.js +0 -2
- package/dist/components/NavSide/types.js.map +0 -1
- package/dist/components/Pagination/Pagination.d.ts +0 -35
- package/dist/components/Pagination/Pagination.d.ts.map +0 -1
- package/dist/components/Pagination/Pagination.js +0 -26
- package/dist/components/Pagination/Pagination.js.map +0 -1
- package/dist/components/Pagination/index.d.ts +0 -3
- package/dist/components/Pagination/index.d.ts.map +0 -1
- package/dist/components/Pagination/index.js +0 -2
- package/dist/components/Pagination/index.js.map +0 -1
- package/dist/components/Skeleton/Skeleton.d.ts +0 -3
- package/dist/components/Skeleton/Skeleton.d.ts.map +0 -1
- package/dist/components/Skeleton/Skeleton.js +0 -7
- package/dist/components/Skeleton/Skeleton.js.map +0 -1
- package/dist/components/Skeleton/index.d.ts +0 -2
- package/dist/components/Skeleton/index.d.ts.map +0 -1
- package/dist/components/Skeleton/index.js +0 -2
- package/dist/components/Skeleton/index.js.map +0 -1
- package/dist/components/StatsCard/StatsCard.d.ts +0 -17
- package/dist/components/StatsCard/StatsCard.d.ts.map +0 -1
- package/dist/components/StatsCard/StatsCard.js +0 -13
- package/dist/components/StatsCard/StatsCard.js.map +0 -1
- package/dist/components/StatsCard/index.d.ts +0 -2
- package/dist/components/StatsCard/index.d.ts.map +0 -1
- package/dist/components/StatsCard/index.js +0 -2
- package/dist/components/StatsCard/index.js.map +0 -1
- package/dist/styles.css +0 -2
- package/dist/theme.generated.css +0 -438
- package/src/components/Avatar/Avatar.tsx +0 -19
- package/src/components/Avatar/index.ts +0 -1
- package/src/components/Breadcrumb/Breadcrumb.tsx +0 -47
- package/src/components/Breadcrumb/index.ts +0 -5
- package/src/components/ColorDot/ColorDot.tsx +0 -50
- package/src/components/ColorDot/index.ts +0 -1
- package/src/components/EmptyState/EmptyState.tsx +0 -29
- package/src/components/EmptyState/index.ts +0 -1
- package/src/components/HeatMap/HeatMapCalendar.tsx +0 -127
- package/src/components/HeatMap/HeatMapMatrix.tsx +0 -75
- package/src/components/HeatMap/heat-map.utils.ts +0 -15
- package/src/components/HeatMap/index.ts +0 -3
- package/src/components/MetricList/MetricList.tsx +0 -13
- package/src/components/MetricList/MetricRow.tsx +0 -30
- package/src/components/MetricList/index.ts +0 -2
- package/src/components/NavBottom/NavBottom.tsx +0 -53
- package/src/components/NavBottom/index.ts +0 -3
- package/src/components/NavSide/NavItem.tsx +0 -39
- package/src/components/NavSide/NavSide.tsx +0 -40
- package/src/components/NavSide/index.ts +0 -2
- package/src/components/NavSide/types.ts +0 -36
- package/src/components/Pagination/Pagination.tsx +0 -86
- package/src/components/Pagination/index.ts +0 -2
- package/src/components/Skeleton/Skeleton.tsx +0 -7
- package/src/components/Skeleton/index.ts +0 -1
- package/src/components/StatsCard/StatsCard.tsx +0 -40
- package/src/components/StatsCard/index.ts +0 -1
- package/src/styles/base.css +0 -41
- package/src/theme/palette.json +0 -100
- package/src/theme/palette.schema.json +0 -40
- package/src/theme/theme.json +0 -349
- package/src/theme/theme.schema.json +0 -876
- package/src/theme/typography.json +0 -7
- package/src/theme/typography.schema.json +0 -36
- package/tailwind.config.ts +0 -261
|
@@ -6,28 +6,79 @@ import { MessageBody } from "./components/MessageBody.js";
|
|
|
6
6
|
import { MessageDescription } from "./components/MessageDescription.js";
|
|
7
7
|
import { MessageIcon } from "./components/MessageIcon.js";
|
|
8
8
|
import { MessageTitle } from "./components/MessageTitle.js";
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Geometry only, plus the three `--message-*` component tokens.
|
|
11
|
+
*
|
|
12
|
+
* Every colour reads a `--message-*` component token whose value is decided by
|
|
13
|
+
* src/theme/recipes/message.css. That file is the mapping from `intent` to a
|
|
14
|
+
* semantic token — the layer that used to be the `intent` entry in `variants`
|
|
15
|
+
* here, compiled into class-name literals and unreachable from outside.
|
|
16
|
+
* `size` stays here: it is pure geometry (padding, gap, font-size), not
|
|
17
|
+
* colour, so it has no reason to move.
|
|
18
|
+
*/
|
|
19
|
+
export const messageVariants = cva(
|
|
20
|
+
// One literal, deliberately: `useSortedClasses --unsafe` strips the trailing
|
|
21
|
+
// space before a `+`, silently welding the last class of one fragment to the
|
|
22
|
+
// first of the next. A single string means the sorter has nothing to break.
|
|
23
|
+
"message border-(color:--message-border) flex gap-3 rounded-lg border bg-(--message-bg) p-4 text-(--message-fg) text-sm [&>svg]:shrink-0", {
|
|
10
24
|
variants: {
|
|
11
|
-
intent: {
|
|
12
|
-
neutral: "border-border-normal bg-bg-normal text-fg-normal",
|
|
13
|
-
success: "border-border-success bg-bg-success-subtle text-fg-on-success-subtle",
|
|
14
|
-
warning: "border-border-warning bg-bg-warning-subtle text-fg-on-warning-subtle",
|
|
15
|
-
danger: "border-border-danger bg-bg-danger-subtle text-fg-on-danger-subtle",
|
|
16
|
-
},
|
|
17
25
|
size: {
|
|
18
|
-
|
|
26
|
+
md: "p-4",
|
|
19
27
|
sm: "gap-2 p-3 text-xs",
|
|
20
28
|
},
|
|
21
29
|
},
|
|
22
30
|
defaultVariants: {
|
|
23
|
-
|
|
24
|
-
size: "default",
|
|
31
|
+
size: "md",
|
|
25
32
|
},
|
|
26
33
|
});
|
|
34
|
+
/**
|
|
35
|
+
* A message is a live region, and the intent decides how rudely it interrupts.
|
|
36
|
+
* `danger` is the only intent that earns `role="alert"` — an assertive region
|
|
37
|
+
* cuts off whatever the screen reader was saying. Everything else is
|
|
38
|
+
* `role="status"` (polite), which is announced at the next natural pause. A
|
|
39
|
+
* success confirmation or a static "Note" callout stamped as `alert` trains
|
|
40
|
+
* users to ignore the role that actually matters. Consumers can override by
|
|
41
|
+
* passing their own `role` — `props` is spread after this.
|
|
42
|
+
*
|
|
43
|
+
* `intent` is widened to admit values this file has never heard of (see
|
|
44
|
+
* `MessageIntent` above), so this is deliberately not a lookup keyed by the
|
|
45
|
+
* closed union: an unrecognised intent has no entry and must fall through to
|
|
46
|
+
* `"status"` rather than resolving to `undefined`, which would render with no
|
|
47
|
+
* live-region role at all.
|
|
48
|
+
*/
|
|
49
|
+
const ALERT_INTENTS = new Set(["danger"]);
|
|
50
|
+
function intentRole(intent) {
|
|
51
|
+
return ALERT_INTENTS.has(intent) ? "alert" : "status";
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* An inline feedback banner — info, success, warning, or error — that
|
|
55
|
+
* renders wherever the caller places it and stays until the caller removes
|
|
56
|
+
* it. Reach for `Message` over `Toast` when the feedback belongs in the
|
|
57
|
+
* page's own layout (form validation, an in-card load error); reach for
|
|
58
|
+
* `Toast` when it should float above the page and disappear on its own.
|
|
59
|
+
* `Toast` itself renders a `Message` internally.
|
|
60
|
+
*
|
|
61
|
+
* `intent` (`"neutral"` (default) | `"success"` | `"warning"` | `"danger"`,
|
|
62
|
+
* widened to accept any string) drives both the color, via `--message-*`
|
|
63
|
+
* component tokens, and the ARIA live-region role: `"danger"` is the only
|
|
64
|
+
* intent that gets `role="alert"` (assertive — cuts off whatever a screen
|
|
65
|
+
* reader was announcing); every other intent, including one this library has
|
|
66
|
+
* never heard of, gets `role="status"` (polite — announced at the next
|
|
67
|
+
* natural pause). An unrecognised intent still falls through to
|
|
68
|
+
* `role="status"` rather than resolving to no role at all. `role` can be
|
|
69
|
+
* overridden directly if a specific case needs it. `size` (`"md"` | `"sm"`)
|
|
70
|
+
* is geometry only (padding/gap/font-size) and carries no color.
|
|
71
|
+
*
|
|
72
|
+
* Two ways to give it content: the simple API (`title` + `icon` props, with
|
|
73
|
+
* `children` as the description), or compound children (`Message.Icon`,
|
|
74
|
+
* `Message.Body`, `Message.Title`, `Message.Description`) for layouts the
|
|
75
|
+
* simple API can't express. Message detects which one is in use by
|
|
76
|
+
* inspecting its children, so the two aren't meant to be mixed.
|
|
77
|
+
*/
|
|
27
78
|
export const Message = React.forwardRef(({ className, intent = "neutral", size, title, icon, children, ...props }, ref) => {
|
|
28
79
|
const hasCompoundChildren = React.Children.toArray(children).some((child) => React.isValidElement(child) &&
|
|
29
80
|
(child.type === MessageIcon || child.type === MessageBody || child.type === MessageTitle || child.type === MessageDescription));
|
|
30
|
-
return (_jsx("div", { ref: ref, role: "
|
|
81
|
+
return (_jsx("div", { ref: ref, role: intentRole(intent), "data-intent": intent, className: cn(messageVariants({ size, className })), ...props, children: hasCompoundChildren ? (children) : (_jsxs(_Fragment, { children: [icon && _jsx(MessageIcon, { children: icon }), _jsxs(MessageBody, { children: [title && _jsx(MessageTitle, { children: title }), _jsx(MessageDescription, { children: children })] })] })) }));
|
|
31
82
|
});
|
|
32
83
|
Message.displayName = "Message";
|
|
33
84
|
//# sourceMappingURL=Message.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Message.js","sourceRoot":"","sources":["../../../src/components/Message/Message.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,iCAAiC,CAAC;AACrD,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG
|
|
1
|
+
{"version":3,"file":"Message.js","sourceRoot":"","sources":["../../../src/components/Message/Message.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,iCAAiC,CAAC;AACrD,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG;AAChC,6EAA6E;AAC7E,6EAA6E;AAC7E,4EAA4E;AAC5E,yIAAyI,EACzI;IACE,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,EAAE,EAAE,KAAK;YACT,E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1C,MAAC,WAAW,eACT,KAAK,IAAI,KAAC,YAAY,cAAE,KAAK,GAAgB,EAC9C,KAAC,kBAAkB,cAAE,QAAQ,GAAsB,IACvC,IACb,CACJ,GACG,CACP,CAAC;AACJ,CAAC,CAAC,CAAC;AACH,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC"}
|
|
@@ -6,6 +6,6 @@ export type { MessageIconProps } from "./components/MessageIcon.js";
|
|
|
6
6
|
export { MessageIcon } from "./components/MessageIcon.js";
|
|
7
7
|
export type { MessageTitleProps } from "./components/MessageTitle.js";
|
|
8
8
|
export { MessageTitle } from "./components/MessageTitle.js";
|
|
9
|
-
export type { MessageProps } from "./Message.js";
|
|
9
|
+
export type { MessageIntent, MessageIntentName, MessageProps } from "./Message.js";
|
|
10
10
|
export { Message, messageVariants } from "./Message.js";
|
|
11
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Message/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,YAAY,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,YAAY,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Message/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,YAAY,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,YAAY,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAChF,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type HTMLAttributes, type ReactNode } from "react";
|
|
2
|
-
export type ModalProps = Pick<HTMLAttributes<HTMLDivElement>, "className" | "style"> & {
|
|
2
|
+
export type ModalProps = Pick<HTMLAttributes<HTMLDivElement>, "className" | "style" | "aria-label" | "aria-labelledby" | "aria-describedby"> & {
|
|
3
3
|
/**
|
|
4
4
|
* Called when the modal's open state should change. Today Modal is mount-driven
|
|
5
5
|
* (parent conditionally renders), so this fires only with `false` on dismissal.
|
|
@@ -22,10 +22,65 @@ export type ModalProps = Pick<HTMLAttributes<HTMLDivElement>, "className" | "sty
|
|
|
22
22
|
/** Vertical alignment on desktop. "center" (default) or "top" (anchored near top, content grows down) */
|
|
23
23
|
align?: "center" | "top";
|
|
24
24
|
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
/**
|
|
26
|
+
* A centered, backdrop-dimmed dialog that fully interrupts the page — the
|
|
27
|
+
* background stays visually present but the user can't reach it. Reach for
|
|
28
|
+
* `Modal` when the interruption should own the user's attention completely
|
|
29
|
+
* (a confirmation, a focused form); reach for `Sheet` when the page behind
|
|
30
|
+
* should stay visible and interactive, or `Popover` when there's no need for
|
|
31
|
+
* a backdrop at all.
|
|
32
|
+
*
|
|
33
|
+
* `size` (`"sm" | "md" | "lg" | "full"`, default `"md"`) sets the desktop
|
|
34
|
+
* width — every size slides up full-width from the bottom on mobile.
|
|
35
|
+
* `align` positions the desktop dialog `"center"` (default) or `"top"`.
|
|
36
|
+
* `dismissable` (default `true`) governs outside-press only: clicking the
|
|
37
|
+
* backdrop closes the modal unless set to `false`. `closable` shows an X
|
|
38
|
+
* button in `Modal.Header`.
|
|
39
|
+
*
|
|
40
|
+
* Modal is mount-driven — a parent (or `useModal`'s stack) decides whether it
|
|
41
|
+
* renders at all, so there's no `open` prop. `onOpenChange` still exists,
|
|
42
|
+
* firing only with `false` on dismissal, so every overlay in this library
|
|
43
|
+
* shares one open/close shape. Escape is *not* wired inside Modal itself:
|
|
44
|
+
* `OverlayProvider` owns it globally so a stack of modals closes
|
|
45
|
+
* topmost-first. That means Escape only closes a Modal opened through
|
|
46
|
+
* `useModal()` — one a parent mounts directly from its own boolean state
|
|
47
|
+
* won't respond to Escape unless the app wires that separately.
|
|
48
|
+
*
|
|
49
|
+
* Focus moves into the modal on mount and is trapped there
|
|
50
|
+
* (`FloatingFocusManager modal`) until it unmounts, then returns to whatever
|
|
51
|
+
* triggered it. The dialog carries `role="dialog"` and `aria-modal="true"`,
|
|
52
|
+
* and names itself from `Modal.Header` via `aria-labelledby` unless the
|
|
53
|
+
* caller passes their own `aria-label`. It stays mounted through its
|
|
54
|
+
* fade-out exit animation (`usePresence`), so `onOpenChange(false)` fires
|
|
55
|
+
* only after the animation completes.
|
|
56
|
+
*
|
|
57
|
+
* Compound: `Modal.Header` (title + optional close button), `Modal.Body`
|
|
58
|
+
* (scrolls internally so the modal itself never grows past the viewport),
|
|
59
|
+
* `Modal.Footer` (action buttons). None are required.
|
|
60
|
+
*/
|
|
61
|
+
export declare const Modal: import("react").ForwardRefExoticComponent<Pick<HTMLAttributes<HTMLDivElement>, "className" | "style" | "aria-describedby" | "aria-label" | "aria-labelledby"> & {
|
|
62
|
+
/**
|
|
63
|
+
* Called when the modal's open state should change. Today Modal is mount-driven
|
|
64
|
+
* (parent conditionally renders), so this fires only with `false` on dismissal.
|
|
65
|
+
* The signature matches Popover/Tooltip/HoverCard/Tabs for API consistency and
|
|
66
|
+
* leaves room to evolve Modal into a state-driven primitive later.
|
|
67
|
+
*/
|
|
68
|
+
onOpenChange?: (open: boolean) => void;
|
|
69
|
+
/** Modal size */
|
|
70
|
+
size?: "sm" | "md" | "lg" | "full";
|
|
71
|
+
/** Children - use Modal.Header, Modal.Body, Modal.Footer */
|
|
72
|
+
children: ReactNode;
|
|
73
|
+
/**
|
|
74
|
+
* When true (default), clicking outside closes the modal.
|
|
75
|
+
* When false, the modal can only be closed programmatically.
|
|
76
|
+
* Note: Escape key is handled by OverlayContext for proper stack ordering.
|
|
77
|
+
*/
|
|
78
|
+
dismissable?: boolean;
|
|
79
|
+
/** When true, shows a close (X) button in the modal header */
|
|
80
|
+
closable?: boolean;
|
|
81
|
+
/** Vertical alignment on desktop. "center" (default) or "top" (anchored near top, content grows down) */
|
|
82
|
+
align?: "center" | "top";
|
|
83
|
+
} & import("react").RefAttributes<HTMLDivElement>> & {
|
|
29
84
|
Header: import("react").ForwardRefExoticComponent<import("./components/index.js").ModalHeaderProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
30
85
|
Body: import("react").ForwardRefExoticComponent<import("./components/index.js").ModalBodyProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
31
86
|
Footer: import("react").ForwardRefExoticComponent<import("./components/index.js").ModalFooterProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/Modal.tsx"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/Modal.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAc,KAAK,cAAc,EAAE,KAAK,SAAS,EAAgE,MAAM,OAAO,CAAC;AAOtI,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,WAAW,GAAG,OAAO,GAAG,YAAY,GAAG,iBAAiB,GAAG,kBAAkB,CAAC,GAAG;IAC7I;;;;;OAKG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,iBAAiB;IACjB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;IACnC,4DAA4D;IAC5D,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yGAAyG;IACzG,KAAK,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC;CAC1B,CAAC;AAgJF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,eAAO,MAAM,KAAK;IAzMhB;;;;;OAKG;mBACY,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI;IACtC,iBAAiB;WACV,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM;IAClC,4DAA4D;cAClD,SAAS;IACnB;;;;OAIG;kBACW,OAAO;IACrB,8DAA8D;eACnD,OAAO;IAClB,yGAAyG;YACjG,QAAQ,GAAG,KAAK;;;;;CAyLxB,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { FloatingFocusManager, FloatingOverlay, useDismiss, useFloating, useInteractions, useRole } from "@floating-ui/react";
|
|
3
3
|
import { useMergedFloatingRef, usePresence } from "@sixthshift/design-system/hooks";
|
|
4
4
|
import { cn } from "@sixthshift/design-system/utils";
|
|
5
|
-
import { useCallback, useContext, useEffect, useMemo } from "react";
|
|
5
|
+
import { forwardRef, useCallback, useContext, useEffect, useId, useMemo, useState } from "react";
|
|
6
6
|
import { ModalBody, ModalContext, ModalFooter, ModalHeader } from "./components/index.js";
|
|
7
7
|
// =============================================================================
|
|
8
8
|
// Size classes
|
|
@@ -16,7 +16,7 @@ const sizeClasses = {
|
|
|
16
16
|
// =============================================================================
|
|
17
17
|
// Modal
|
|
18
18
|
// =============================================================================
|
|
19
|
-
const ModalRoot = ({ onOpenChange, size = "md", className, style, children, dismissable = true, closable, align = "center" }) => {
|
|
19
|
+
const ModalRoot = forwardRef(({ onOpenChange, size = "md", className, style, children, dismissable = true, closable, align = "center", "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, }, ref) => {
|
|
20
20
|
// Prefer explicit prop over context (context is set by useModal's overlay system)
|
|
21
21
|
const contextValue = useContext(ModalContext);
|
|
22
22
|
// Context provides a parameterless onClose for programmatic modals; adapt to the boolean shape.
|
|
@@ -40,7 +40,7 @@ const ModalRoot = ({ onOpenChange, size = "md", className, style, children, dism
|
|
|
40
40
|
handleClose();
|
|
41
41
|
},
|
|
42
42
|
});
|
|
43
|
-
const mergedRef = useMergedFloatingRef(refs, presenceRef);
|
|
43
|
+
const mergedRef = useMergedFloatingRef(refs, presenceRef, ref);
|
|
44
44
|
const dismiss = useDismiss(context, {
|
|
45
45
|
enabled: dismissable,
|
|
46
46
|
// OverlayContext handles escape key for proper stack ordering
|
|
@@ -52,12 +52,22 @@ const ModalRoot = ({ onOpenChange, size = "md", className, style, children, dism
|
|
|
52
52
|
role: "dialog",
|
|
53
53
|
});
|
|
54
54
|
const { getFloatingProps } = useInteractions([dismiss, role]);
|
|
55
|
-
|
|
55
|
+
// The dialog names itself from its header. `Modal.Header` stamps `titleId`
|
|
56
|
+
// on itself and reports back, so a headerless modal falls through to the
|
|
57
|
+
// caller's `aria-label` instead of referencing an id that isn't there.
|
|
58
|
+
const titleId = useId();
|
|
59
|
+
const [hasTitle, setHasTitle] = useState(false);
|
|
60
|
+
const registerTitle = useCallback((present) => setHasTitle(present), []);
|
|
61
|
+
// `aria-labelledby` beats `aria-label` in the name computation, so a caller
|
|
62
|
+
// who passes a label must not also be pointed at the header — they would
|
|
63
|
+
// never see their own string win.
|
|
64
|
+
const labelledBy = ariaLabelledBy ?? (ariaLabel || !hasTitle ? undefined : titleId);
|
|
65
|
+
const modalContextValue = useMemo(() => ({ onClose: handleClose, closable, titleId, registerTitle }), [closable, handleClose, titleId, registerTitle]);
|
|
56
66
|
if (!isMounted)
|
|
57
67
|
return null;
|
|
58
68
|
const isEntering = state === "entering";
|
|
59
69
|
const isExiting = state === "exiting";
|
|
60
|
-
return (_jsx(FloatingFocusManager, { context: context, modal: true, children: _jsx(FloatingOverlay, { lockScroll: true, className: cn("fixed inset-0 z-modal bg-
|
|
70
|
+
return (_jsx(FloatingFocusManager, { context: context, modal: true, children: _jsx(FloatingOverlay, { lockScroll: true, className: cn("modal-overlay fixed inset-0 z-modal bg-(--modal-overlay-bg)", isEntering && "animate-fade-in", isExiting && "animate-fade-out"), children: _jsx("div", { ref: mergedRef, role: "dialog", "aria-modal": "true", "aria-label": ariaLabel, "aria-labelledby": labelledBy, "aria-describedby": ariaDescribedBy, tabIndex: -1, "data-state": state, className: cn("modal fixed flex flex-col overflow-hidden outline-hidden", "border-(color:--modal-border) rounded-xl border bg-(--modal-bg)",
|
|
61
71
|
// Size
|
|
62
72
|
sizeClasses[size],
|
|
63
73
|
// Cap height so ModalBody scrolls instead of overflowing the viewport
|
|
@@ -66,11 +76,47 @@ const ModalRoot = ({ onOpenChange, size = "md", className, style, children, dism
|
|
|
66
76
|
"max-sm:inset-x-0 max-sm:bottom-0 max-sm:rounded-b-none", isEntering && "max-sm:animate-slide-up-in", isExiting && "max-sm:animate-slide-up-out",
|
|
67
77
|
// Desktop: horizontal center + vertical alignment
|
|
68
78
|
"sm:left-1/2 sm:-translate-x-1/2", align === "center" && "sm:top-1/2 sm:-translate-y-1/2", align === "top" && "sm:top-[15vh]", isEntering && "sm:animate-fade-in", isExiting && "sm:animate-fade-out", className), style: style, ...getFloatingProps({}), children: _jsx(ModalContext.Provider, { value: modalContextValue, children: children }) }) }) }));
|
|
69
|
-
};
|
|
79
|
+
});
|
|
70
80
|
ModalRoot.displayName = "Modal";
|
|
71
81
|
// =============================================================================
|
|
72
82
|
// Compound Component Export
|
|
73
83
|
// =============================================================================
|
|
84
|
+
/**
|
|
85
|
+
* A centered, backdrop-dimmed dialog that fully interrupts the page — the
|
|
86
|
+
* background stays visually present but the user can't reach it. Reach for
|
|
87
|
+
* `Modal` when the interruption should own the user's attention completely
|
|
88
|
+
* (a confirmation, a focused form); reach for `Sheet` when the page behind
|
|
89
|
+
* should stay visible and interactive, or `Popover` when there's no need for
|
|
90
|
+
* a backdrop at all.
|
|
91
|
+
*
|
|
92
|
+
* `size` (`"sm" | "md" | "lg" | "full"`, default `"md"`) sets the desktop
|
|
93
|
+
* width — every size slides up full-width from the bottom on mobile.
|
|
94
|
+
* `align` positions the desktop dialog `"center"` (default) or `"top"`.
|
|
95
|
+
* `dismissable` (default `true`) governs outside-press only: clicking the
|
|
96
|
+
* backdrop closes the modal unless set to `false`. `closable` shows an X
|
|
97
|
+
* button in `Modal.Header`.
|
|
98
|
+
*
|
|
99
|
+
* Modal is mount-driven — a parent (or `useModal`'s stack) decides whether it
|
|
100
|
+
* renders at all, so there's no `open` prop. `onOpenChange` still exists,
|
|
101
|
+
* firing only with `false` on dismissal, so every overlay in this library
|
|
102
|
+
* shares one open/close shape. Escape is *not* wired inside Modal itself:
|
|
103
|
+
* `OverlayProvider` owns it globally so a stack of modals closes
|
|
104
|
+
* topmost-first. That means Escape only closes a Modal opened through
|
|
105
|
+
* `useModal()` — one a parent mounts directly from its own boolean state
|
|
106
|
+
* won't respond to Escape unless the app wires that separately.
|
|
107
|
+
*
|
|
108
|
+
* Focus moves into the modal on mount and is trapped there
|
|
109
|
+
* (`FloatingFocusManager modal`) until it unmounts, then returns to whatever
|
|
110
|
+
* triggered it. The dialog carries `role="dialog"` and `aria-modal="true"`,
|
|
111
|
+
* and names itself from `Modal.Header` via `aria-labelledby` unless the
|
|
112
|
+
* caller passes their own `aria-label`. It stays mounted through its
|
|
113
|
+
* fade-out exit animation (`usePresence`), so `onOpenChange(false)` fires
|
|
114
|
+
* only after the animation completes.
|
|
115
|
+
*
|
|
116
|
+
* Compound: `Modal.Header` (title + optional close button), `Modal.Body`
|
|
117
|
+
* (scrolls internally so the modal itself never grows past the viewport),
|
|
118
|
+
* `Modal.Footer` (action buttons). None are required.
|
|
119
|
+
*/
|
|
74
120
|
export const Modal = Object.assign(ModalRoot, {
|
|
75
121
|
Header: ModalHeader,
|
|
76
122
|
Body: ModalBody,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.js","sourceRoot":"","sources":["../../../src/components/Modal/Modal.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC9H,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACpF,OAAO,EAAE,EAAE,EAAE,MAAM,iCAAiC,CAAC;AACrD,OAAO,EAAuC,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Modal.js","sourceRoot":"","sources":["../../../src/components/Modal/Modal.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC9H,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACpF,OAAO,EAAE,EAAE,EAAE,MAAM,iCAAiC,CAAC;AACrD,OAAO,EAAE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ACJ,CAAC,CACF,CAAC;AACF,SAAS,CAAC,WAAW,GAAG,OAAO,CAAC;AAEhC,gFAAgF;AAChF,4BAA4B;AAC5B,gFAAgF;AAEhF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE;IAC5C,MAAM,EAAE,WAAW;IACnB,IAAI,EAAE,SAAS;IACf,MAAM,EAAE,WAAW;CACpB,CAAC,CAAC"}
|
|
@@ -7,6 +7,20 @@ export type OnClose = () => void;
|
|
|
7
7
|
interface ModalContextValue {
|
|
8
8
|
onClose: OnClose;
|
|
9
9
|
closable?: boolean | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* The id `Modal.Header` stamps on itself so the dialog can name itself from
|
|
12
|
+
* its own title. A dialog with no accessible name is announced as just
|
|
13
|
+
* "dialog", which tells a screen-reader user nothing about what interrupted
|
|
14
|
+
* them.
|
|
15
|
+
*/
|
|
16
|
+
titleId?: string;
|
|
17
|
+
/**
|
|
18
|
+
* The header reports its presence, because a headerless modal must not point
|
|
19
|
+
* `aria-labelledby` at an element that never rendered — a dangling reference
|
|
20
|
+
* is worse than no reference at all (it resolves to an empty name and axe
|
|
21
|
+
* flags it as an invalid attribute value).
|
|
22
|
+
*/
|
|
23
|
+
registerTitle?: (present: boolean) => void;
|
|
10
24
|
}
|
|
11
25
|
export declare const ModalContext: import("react").Context<ModalContextValue | null>;
|
|
12
26
|
export declare function useModalContext(): ModalContextValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalContext.d.ts","sourceRoot":"","sources":["../../../../src/components/Modal/components/ModalContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,iBAAiB,EAAuB,MAAM,OAAO,CAAC;AAEnF;;;GAGG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC;AAEjC,UAAU,iBAAiB;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"ModalContext.d.ts","sourceRoot":"","sources":["../../../../src/components/Modal/components/ModalContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,iBAAiB,EAAuB,MAAM,OAAO,CAAC;AAEnF;;;GAGG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC;AAEjC,UAAU,iBAAiB;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC/B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5C;AAED,eAAO,MAAM,YAAY,mDAAgD,CAAC;AAE1E,wBAAgB,eAAe,sBAM9B;AAED,eAAO,MAAM,oBAAoB,oCAAqC,iBAAiB,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,gCAGhI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalContext.js","sourceRoot":"","sources":["../../../../src/components/Modal/components/ModalContext.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAA0B,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ModalContext.js","sourceRoot":"","sources":["../../../../src/components/Modal/components/ModalContext.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAA0B,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AA2BnF,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAA2B,IAAI,CAAC,CAAC;AAE1E,MAAM,UAAU,eAAe;IAC7B,MAAM,OAAO,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IACzC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAA+D,EAAE,EAAE;IACnI,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC1E,OAAO,KAAC,YAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,GAAyB,CAAC;AACjF,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalHeader.d.ts","sourceRoot":"","sources":["../../../../src/components/Modal/components/ModalHeader.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;AAEpE,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"ModalHeader.d.ts","sourceRoot":"","sources":["../../../../src/components/Modal/components/ModalHeader.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;AAEpE,eAAO,MAAM,WAAW,yFAgCtB,CAAC"}
|
|
@@ -3,11 +3,22 @@ import { cn } from "@sixthshift/design-system/utils";
|
|
|
3
3
|
import { X } from "lucide-react";
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import { ModalContext } from "./ModalContext.js";
|
|
6
|
-
export const ModalHeader = React.forwardRef(({ className, children, ...props }, ref) => {
|
|
6
|
+
export const ModalHeader = React.forwardRef(({ className, children, id, ...props }, ref) => {
|
|
7
7
|
const context = React.useContext(ModalContext);
|
|
8
8
|
const closable = context?.closable;
|
|
9
9
|
const onClose = context?.onClose;
|
|
10
|
-
|
|
10
|
+
const registerTitle = context?.registerTitle;
|
|
11
|
+
// Tell the dialog it has a title to point `aria-labelledby` at, and take that
|
|
12
|
+
// back on unmount so a header removed at runtime doesn't leave a dangling
|
|
13
|
+
// reference behind. A caller-supplied `id` wins over the generated one, which
|
|
14
|
+
// also means the dialog can no longer find it — say so rather than pointing
|
|
15
|
+
// at an id that isn't in the DOM, and let the caller label the Modal itself.
|
|
16
|
+
const ownsTitleId = id === undefined;
|
|
17
|
+
React.useEffect(() => {
|
|
18
|
+
registerTitle?.(ownsTitleId);
|
|
19
|
+
return () => registerTitle?.(false);
|
|
20
|
+
}, [registerTitle, ownsTitleId]);
|
|
21
|
+
return (_jsxs("div", { ref: ref, id: id ?? context?.titleId, className: cn("flex flex-col space-y-1.5 p-6", closable && "pr-12", className), ...props, children: [children, closable && (_jsx("button", { type: "button", onClick: onClose, "aria-label": "Close", className: "modal-close absolute top-4 right-4 cursor-pointer rounded-md p-1 text-(--modal-close-fg) transition-colors hover:bg-(--modal-close-bg-hovered) hover:text-(--modal-close-fg-hovered)", children: _jsx(X, { size: 16 }) }))] }));
|
|
11
22
|
});
|
|
12
23
|
ModalHeader.displayName = "ModalHeader";
|
|
13
24
|
//# sourceMappingURL=ModalHeader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalHeader.js","sourceRoot":"","sources":["../../../../src/components/Modal/components/ModalHeader.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,iCAAiC,CAAC;AACrD,OAAO,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AACjC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAI9C,MAAM,C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,EAAE,CAAC,+BAA+B,EAAE,QAAQ,IAAI,OAAO,EAAE,SAAS,CAAC,KAAM,KAAK,aACjI,QAAQ,EACR,QAAQ,IAAI,CACX,iBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,OAAO,gBACL,OAAO,EAClB,SAAS,EAAC,sLAAsL,YAEhM,KAAC,CAAC,IAAC,IAAI,EAAE,EAAE,GAAI,GACR,CACV,IACG,CACP,CAAC;AACJ,CAAC,CAAC,CAAC;AACH,WAAW,CAAC,WAAW,GAAG,aAAa,CAAC"}
|
|
@@ -14,6 +14,35 @@ export type PopoverProps = {
|
|
|
14
14
|
/** Children - compound components */
|
|
15
15
|
children: React.ReactNode;
|
|
16
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* A click-triggered floating panel anchored to a trigger element, with no
|
|
19
|
+
* backdrop. Reach for `Popover` over `Modal`/`Sheet` when the content is a
|
|
20
|
+
* menu, a small edit form, or info-on-demand that should stay tethered to
|
|
21
|
+
* whatever the user clicked, rather than taking over the page. Reach for
|
|
22
|
+
* `HoverCard` instead when the panel should open passively on hover/focus
|
|
23
|
+
* rather than a click, and for `Tooltip` when it's a short text label rather
|
|
24
|
+
* than a panel with real content.
|
|
25
|
+
*
|
|
26
|
+
* Works both controlled (`open` + `onOpenChange`) and uncontrolled
|
|
27
|
+
* (`defaultOpen`) via `useControllableState`. `placement` (default
|
|
28
|
+
* `"bottom"`) and `offsetPx` (default `8`) position it relative to the
|
|
29
|
+
* trigger through floating-ui's `offset → flip → shift` middleware, which
|
|
30
|
+
* repositions automatically on scroll/resize (`autoUpdate`).
|
|
31
|
+
*
|
|
32
|
+
* Opens via `useClick` and dismisses via `useDismiss` — outside-press and
|
|
33
|
+
* Escape both close it, handled directly by floating-ui rather than
|
|
34
|
+
* `OverlayProvider`, since a Popover isn't part of the modal stack.
|
|
35
|
+
* `Popover.Body` renders in a `FloatingPortal` to `document.body` and hard
|
|
36
|
+
* unmounts (`return null`) when closed — there's no exit animation. It
|
|
37
|
+
* carries `role="dialog"` and, since there's no title slot to read from,
|
|
38
|
+
* names itself from `Popover.Trigger` via `aria-labelledby` unless the
|
|
39
|
+
* caller passes their own `aria-label`/`aria-labelledby`.
|
|
40
|
+
*
|
|
41
|
+
* Compound: `Popover.Trigger` (`asChild` to render the child element as the
|
|
42
|
+
* trigger instead of wrapping it in a `<button>`), `Popover.Body`,
|
|
43
|
+
* `Popover.Close` (a button that calls `onOpenChange(false)` — for a close
|
|
44
|
+
* affordance inside the panel's own content).
|
|
45
|
+
*/
|
|
17
46
|
export declare const Popover: (({ open: controlledOpen, onOpenChange, defaultOpen, placement, offsetPx, children }: PopoverProps) => React.JSX.Element) & {
|
|
18
47
|
Trigger: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
19
48
|
asChild?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popover.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/Popover.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,SAAS,EAA6D,MAAM,oBAAoB,CAAC;AAEzI,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAOpC,MAAM,MAAM,YAAY,GAAG;IACzB,4BAA4B;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,uCAAuC;IACvC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,+CAA+C;IAC/C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,mDAAmD;IACnD,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,wCAAwC;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qCAAqC;IACrC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;
|
|
1
|
+
{"version":3,"file":"Popover.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/Popover.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,SAAS,EAA6D,MAAM,oBAAoB,CAAC;AAEzI,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAOpC,MAAM,MAAM,YAAY,GAAG;IACzB,4BAA4B;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,uCAAuC;IACvC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,+CAA+C;IAC/C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,mDAAmD;IACnD,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,wCAAwC;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qCAAqC;IACrC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAgDF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,OAAO,wFA3E4G,YAAY;;;;;;;;CA+E1I,CAAC"}
|
|
@@ -25,6 +25,12 @@ const PopoverRoot = ({ open: controlledOpen, onOpenChange, defaultOpen = false,
|
|
|
25
25
|
const { getReferenceProps, getFloatingProps } = useInteractions([click, dismiss]);
|
|
26
26
|
const id = useId();
|
|
27
27
|
const contentId = `popover-content-${id}`;
|
|
28
|
+
// `Popover.Body` is a `role="dialog"`, and a dialog with no accessible name is
|
|
29
|
+
// announced as just "dialog". There is no title sub-part to read from, so the
|
|
30
|
+
// trigger — which always has a label, because it is what the user clicked —
|
|
31
|
+
// names the popover. A caller passing their own `aria-label`/`aria-labelledby`
|
|
32
|
+
// to `Popover.Body` still wins.
|
|
33
|
+
const triggerId = `popover-trigger-${id}`;
|
|
28
34
|
const contextValue = {
|
|
29
35
|
open,
|
|
30
36
|
onOpenChange: setOpen,
|
|
@@ -36,9 +42,39 @@ const PopoverRoot = ({ open: controlledOpen, onOpenChange, defaultOpen = false,
|
|
|
36
42
|
getReferenceProps,
|
|
37
43
|
getFloatingProps,
|
|
38
44
|
contentId,
|
|
45
|
+
triggerId,
|
|
39
46
|
};
|
|
40
47
|
return _jsx(PopoverContext.Provider, { value: contextValue, children: children });
|
|
41
48
|
};
|
|
49
|
+
/**
|
|
50
|
+
* A click-triggered floating panel anchored to a trigger element, with no
|
|
51
|
+
* backdrop. Reach for `Popover` over `Modal`/`Sheet` when the content is a
|
|
52
|
+
* menu, a small edit form, or info-on-demand that should stay tethered to
|
|
53
|
+
* whatever the user clicked, rather than taking over the page. Reach for
|
|
54
|
+
* `HoverCard` instead when the panel should open passively on hover/focus
|
|
55
|
+
* rather than a click, and for `Tooltip` when it's a short text label rather
|
|
56
|
+
* than a panel with real content.
|
|
57
|
+
*
|
|
58
|
+
* Works both controlled (`open` + `onOpenChange`) and uncontrolled
|
|
59
|
+
* (`defaultOpen`) via `useControllableState`. `placement` (default
|
|
60
|
+
* `"bottom"`) and `offsetPx` (default `8`) position it relative to the
|
|
61
|
+
* trigger through floating-ui's `offset → flip → shift` middleware, which
|
|
62
|
+
* repositions automatically on scroll/resize (`autoUpdate`).
|
|
63
|
+
*
|
|
64
|
+
* Opens via `useClick` and dismisses via `useDismiss` — outside-press and
|
|
65
|
+
* Escape both close it, handled directly by floating-ui rather than
|
|
66
|
+
* `OverlayProvider`, since a Popover isn't part of the modal stack.
|
|
67
|
+
* `Popover.Body` renders in a `FloatingPortal` to `document.body` and hard
|
|
68
|
+
* unmounts (`return null`) when closed — there's no exit animation. It
|
|
69
|
+
* carries `role="dialog"` and, since there's no title slot to read from,
|
|
70
|
+
* names itself from `Popover.Trigger` via `aria-labelledby` unless the
|
|
71
|
+
* caller passes their own `aria-label`/`aria-labelledby`.
|
|
72
|
+
*
|
|
73
|
+
* Compound: `Popover.Trigger` (`asChild` to render the child element as the
|
|
74
|
+
* trigger instead of wrapping it in a `<button>`), `Popover.Body`,
|
|
75
|
+
* `Popover.Close` (a button that calls `onOpenChange(false)` — for a close
|
|
76
|
+
* affordance inside the panel's own content).
|
|
77
|
+
*/
|
|
42
78
|
export const Popover = Object.assign(PopoverRoot, {
|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;QACnB,IAAI;QACJ,YAAY,EAAE,OAAO;QACrB,IAAI,EAAE;YACJ,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,WAAW,EAAE,IAAI,CAAC,WAAW;SAC9B;QACD,cAAc;QACd,iBAAiB;QACjB,gBAAgB;QAChB,SAAS;QACT,SAAS;KACV,CAAC;IAEF,OAAO,KAAC,cAAc,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,YAAG,QAAQ,GAA2B,CAAC;AAC5F,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE;IAChD,OAAO,EAAE,cAAc;IACvB,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,YAAY;CACpB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopoverBody.d.ts","sourceRoot":"","sources":["../../../../src/components/Popover/components/PopoverBody.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;AAEpE,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"PopoverBody.d.ts","sourceRoot":"","sources":["../../../../src/components/Popover/components/PopoverBody.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;AAEpE,eAAO,MAAM,WAAW,yFA4BtB,CAAC"}
|
|
@@ -4,7 +4,10 @@ import { cn } from "@sixthshift/design-system/utils";
|
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import { usePopoverContext } from "./PopoverContext.js";
|
|
6
6
|
export const PopoverBody = React.forwardRef(({ className, children, ...props }, forwardedRef) => {
|
|
7
|
-
const { open, refs, floatingStyles, getFloatingProps, contentId } = usePopoverContext();
|
|
7
|
+
const { open, refs, floatingStyles, getFloatingProps, contentId, triggerId } = usePopoverContext();
|
|
8
|
+
// `aria-labelledby` outranks `aria-label` in the name computation, so the
|
|
9
|
+
// trigger only names the dialog when the caller hasn't named it themselves.
|
|
10
|
+
const hasOwnLabel = props["aria-label"] !== undefined || props["aria-labelledby"] !== undefined;
|
|
8
11
|
if (!open)
|
|
9
12
|
return null;
|
|
10
13
|
return (_jsx(FloatingPortal, { children: _jsx("div", { ref: (node) => {
|
|
@@ -13,7 +16,7 @@ export const PopoverBody = React.forwardRef(({ className, children, ...props },
|
|
|
13
16
|
forwardedRef(node);
|
|
14
17
|
else if (forwardedRef)
|
|
15
18
|
forwardedRef.current = node;
|
|
16
|
-
}, id: contentId, role: "dialog", style: floatingStyles, className: cn("z-popover rounded-lg border border-border-normal bg-bg-normal p-4 shadow-lg", className), ...getFloatingProps(props), children: children }) }));
|
|
19
|
+
}, id: contentId, role: "dialog", "aria-labelledby": hasOwnLabel ? undefined : triggerId, style: floatingStyles, className: cn("z-popover rounded-lg border border-border-normal bg-bg-normal p-4 shadow-lg", className), ...getFloatingProps(props), children: children }) }));
|
|
17
20
|
});
|
|
18
21
|
PopoverBody.displayName = "PopoverBody";
|
|
19
22
|
//# sourceMappingURL=PopoverBody.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopoverBody.js","sourceRoot":"","sources":["../../../../src/components/Popover/components/PopoverBody.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,EAAE,EAAE,MAAM,iCAAiC,CAAC;AACrD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAIrD,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,CAAC,UAAU,CAAmC,CAAC,EAAE,SAA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QAAQ,qBACI,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EACpD,KAAK,EAAE,cAAc,EACrB,SAAS,EAAE,EAAE,CAAC,6EAA6E,EAAE,SAAS,CAAC,KACnG,gBAAgB,CAAC,KAAK,CAAC,YAE1B,QAAQ,GACL,GACS,CAClB,CAAC;AACJ,CAAC,CAAC,CAAC;AACH,WAAW,CAAC,WAAW,GAAG,aAAa,CAAC"}
|
|
@@ -9,6 +9,7 @@ export type PopoverContextValue = {
|
|
|
9
9
|
getReferenceProps: (props?: React.HTMLProps<HTMLElement>) => Record<string, unknown>;
|
|
10
10
|
getFloatingProps: (props?: React.HTMLProps<HTMLElement>) => Record<string, unknown>;
|
|
11
11
|
contentId: string;
|
|
12
|
+
triggerId: string;
|
|
12
13
|
};
|
|
13
14
|
export declare const PopoverContext: import("react").Context<PopoverContextValue | null>;
|
|
14
15
|
export declare function usePopoverContext(): PopoverContextValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopoverContext.d.ts","sourceRoot":"","sources":["../../../../src/components/Popover/components/PopoverContext.tsx"],"names":[],"mappings":"AAEA,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,IAAI,EAAE;QACJ,YAAY,EAAE,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;QACjD,WAAW,EAAE,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;KACjD,CAAC;IACF,cAAc,EAAE,KAAK,CAAC,aAAa,CAAC;IACpC,iBAAiB,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrF,gBAAgB,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpF,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,cAAc,qDAAkD,CAAC;AAE9E,wBAAgB,iBAAiB,wBAMhC"}
|
|
1
|
+
{"version":3,"file":"PopoverContext.d.ts","sourceRoot":"","sources":["../../../../src/components/Popover/components/PopoverContext.tsx"],"names":[],"mappings":"AAEA,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,IAAI,EAAE;QACJ,YAAY,EAAE,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;QACjD,WAAW,EAAE,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;KACjD,CAAC;IACF,cAAc,EAAE,KAAK,CAAC,aAAa,CAAC;IACpC,iBAAiB,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrF,gBAAgB,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpF,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,cAAc,qDAAkD,CAAC;AAE9E,wBAAgB,iBAAiB,wBAMhC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopoverContext.js","sourceRoot":"","sources":["../../../../src/components/Popover/components/PopoverContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"PopoverContext.js","sourceRoot":"","sources":["../../../../src/components/Popover/components/PopoverContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAgBlD,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAA6B,IAAI,CAAC,CAAC;AAE9E,MAAM,UAAU,iBAAiB;IAC/B,MAAM,OAAO,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;IAC3C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAC;IAC/E,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopoverTrigger.d.ts","sourceRoot":"","sources":["../../../../src/components/Popover/components/PopoverTrigger.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,GAAG;IAChF,8BAA8B;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,cAAc;IAJzB,8BAA8B;cACpB,OAAO;
|
|
1
|
+
{"version":3,"file":"PopoverTrigger.d.ts","sourceRoot":"","sources":["../../../../src/components/Popover/components/PopoverTrigger.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,GAAG;IAChF,8BAA8B;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,cAAc;IAJzB,8BAA8B;cACpB,OAAO;2CAwBjB,CAAC"}
|
|
@@ -3,7 +3,7 @@ import * as React from "react";
|
|
|
3
3
|
import { Slot } from "../../../internal/Slot.js";
|
|
4
4
|
import { usePopoverContext } from "./PopoverContext.js";
|
|
5
5
|
export const PopoverTrigger = React.forwardRef(({ asChild = false, children, ...props }, forwardedRef) => {
|
|
6
|
-
const { refs, getReferenceProps, contentId, open } = usePopoverContext();
|
|
6
|
+
const { refs, getReferenceProps, contentId, triggerId, open } = usePopoverContext();
|
|
7
7
|
const Comp = asChild ? Slot : "button";
|
|
8
8
|
return (_jsx(Comp, { ref: (node) => {
|
|
9
9
|
refs.setReference(node);
|
|
@@ -11,7 +11,7 @@ export const PopoverTrigger = React.forwardRef(({ asChild = false, children, ...
|
|
|
11
11
|
forwardedRef(node);
|
|
12
12
|
else if (forwardedRef)
|
|
13
13
|
forwardedRef.current = node;
|
|
14
|
-
}, type: asChild ? undefined : "button", "aria-haspopup": "dialog", "aria-expanded": open, "aria-controls": open ? contentId : undefined, ...getReferenceProps(props), children: children }));
|
|
14
|
+
}, type: asChild ? undefined : "button", id: triggerId, "aria-haspopup": "dialog", "aria-expanded": open, "aria-controls": open ? contentId : undefined, ...getReferenceProps(props), children: children }));
|
|
15
15
|
});
|
|
16
16
|
PopoverTrigger.displayName = "PopoverTrigger";
|
|
17
17
|
//# sourceMappingURL=PopoverTrigger.js.map
|