@sixthshift/design-system 0.3.0 → 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 +114 -12
- package/dist/components/Badge/Badge.d.ts +64 -9
- package/dist/components/Badge/Badge.d.ts.map +1 -1
- package/dist/components/Badge/Badge.js +54 -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 +12 -0
- package/dist/components/BarChart/BarChart.d.ts.map +1 -1
- package/dist/components/BarChart/BarChart.js +12 -0
- 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 +18 -4
- package/dist/components/Calendar/Calendar.d.ts.map +1 -1
- package/dist/components/Calendar/Calendar.js +19 -5
- package/dist/components/Calendar/Calendar.js.map +1 -1
- package/dist/components/Calendar/CalendarView.d.ts.map +1 -1
- package/dist/components/Calendar/CalendarView.js +10 -2
- package/dist/components/Calendar/CalendarView.js.map +1 -1
- package/dist/components/Calendar/calendar.types.d.ts +9 -0
- package/dist/components/Calendar/calendar.types.d.ts.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 +43 -0
- package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/components/DatePicker/DatePicker.js +166 -4
- 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 +19 -1
- package/dist/components/DatePicker/datepicker.types.d.ts.map +1 -1
- package/dist/components/DatePicker/index.d.ts +1 -1
- package/dist/components/DatePicker/index.d.ts.map +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +20 -2
- package/dist/components/DateRangePicker/DateRangePicker.d.ts.map +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.js +22 -4
- package/dist/components/DateRangePicker/DateRangePicker.js.map +1 -1
- package/dist/components/DateRangePicker/daterangepicker.types.d.ts +6 -1
- package/dist/components/DateRangePicker/daterangepicker.types.d.ts.map +1 -1
- package/dist/components/DateTimePicker/DateTimePicker.d.ts +30 -2
- package/dist/components/DateTimePicker/DateTimePicker.d.ts.map +1 -1
- package/dist/components/DateTimePicker/DateTimePicker.js +105 -32
- 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 +6 -1
- package/dist/components/DateTimePicker/datetimepicker.types.d.ts.map +1 -1
- package/dist/components/DateTimeRangePicker/DateTimeRangePicker.d.ts +28 -2
- package/dist/components/DateTimeRangePicker/DateTimeRangePicker.d.ts.map +1 -1
- package/dist/components/DateTimeRangePicker/DateTimeRangePicker.js +136 -58
- package/dist/components/DateTimeRangePicker/DateTimeRangePicker.js.map +1 -1
- package/dist/components/DateTimeRangePicker/datetimerangepicker.types.d.ts +6 -1
- package/dist/components/DateTimeRangePicker/datetimerangepicker.types.d.ts.map +1 -1
- package/dist/components/Field/Field.d.ts +15 -17
- package/dist/components/Field/Field.d.ts.map +1 -1
- package/dist/components/Field/Field.js +18 -3
- 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 +17 -0
- package/dist/components/LineChart/LineChart.d.ts.map +1 -1
- package/dist/components/LineChart/LineChart.js +17 -0
- package/dist/components/LineChart/LineChart.js.map +1 -1
- package/dist/components/Markdown/Markdown.d.ts +17 -0
- package/dist/components/Markdown/Markdown.d.ts.map +1 -1
- package/dist/components/Markdown/Markdown.js +17 -0
- 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 +53 -17
- 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 +36 -0
- package/dist/components/Modal/Modal.d.ts.map +1 -1
- package/dist/components/Modal/Modal.js +37 -1
- package/dist/components/Modal/Modal.js.map +1 -1
- package/dist/components/Modal/components/ModalHeader.js +1 -1
- 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 +29 -0
- package/dist/components/Popover/Popover.js.map +1 -1
- package/dist/components/ProgressBar/ProgressBar.d.ts +14 -0
- package/dist/components/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/dist/components/ProgressBar/ProgressBar.js +14 -0
- 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 +4 -5
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/components/Select/Select.js +4 -5
- package/dist/components/Select/Select.js.map +1 -1
- package/dist/components/Select/SelectDropdown.d.ts.map +1 -1
- package/dist/components/Select/SelectDropdown.js +4 -3
- package/dist/components/Select/SelectDropdown.js.map +1 -1
- package/dist/components/Select/SelectTrigger.js +2 -2
- package/dist/components/Select/SelectTrigger.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 +6 -0
- package/dist/components/Sheet/Sheet.d.ts.map +1 -1
- package/dist/components/Sheet/Sheet.js +7 -1
- package/dist/components/Sheet/Sheet.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.js +1 -1
- package/dist/components/Sheet/components/SheetHeader.js.map +1 -1
- package/dist/components/Sparkline/Sparkline.d.ts +11 -0
- package/dist/components/Sparkline/Sparkline.d.ts.map +1 -1
- package/dist/components/Sparkline/Sparkline.js +11 -0
- 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 +6 -0
- 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/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 +14 -12
- package/dist/components/TagChip/TagChip.d.ts.map +1 -1
- package/dist/components/TagChip/TagChip.js +14 -1
- package/dist/components/TagChip/TagChip.js.map +1 -1
- package/dist/components/TagInput/TagInput.d.ts +11 -8
- package/dist/components/TagInput/TagInput.d.ts.map +1 -1
- package/dist/components/TagInput/TagInput.js +11 -0
- 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 +32 -0
- package/dist/components/TimePicker/TimePicker.d.ts.map +1 -1
- package/dist/components/TimePicker/TimePicker.js +93 -6
- 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 +0 -2
- package/dist/components/TimePicker/timepicker.types.d.ts.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.map +1 -1
- package/dist/date-time/index.js +0 -1
- package/dist/date-time/index.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 +2 -2
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +1 -1
- package/dist/theme/index.js.map +1 -1
- package/dist/theme/schema.d.ts +0 -22
- package/dist/theme/schema.d.ts.map +1 -1
- package/dist/theme/schema.js +0 -9
- package/dist/theme/schema.js.map +1 -1
- package/package.json +3 -45
- package/src/components/Badge/Badge.tsx +85 -48
- package/src/components/Badge/index.ts +10 -1
- package/src/components/BarChart/BarChart.tsx +12 -0
- package/src/components/Button/Button.tsx +129 -106
- package/src/components/Button/index.ts +10 -1
- package/src/components/Calendar/Calendar.tsx +29 -16
- package/src/components/Calendar/CalendarView.tsx +10 -1
- package/src/components/Calendar/calendar.types.ts +10 -0
- 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 +279 -28
- package/src/components/DatePicker/DateSegments.tsx +125 -0
- package/src/components/DatePicker/datepicker.types.ts +21 -1
- package/src/components/DatePicker/index.ts +8 -1
- package/src/components/DateRangePicker/DateRangePicker.tsx +22 -4
- package/src/components/DateRangePicker/daterangepicker.types.ts +7 -1
- package/src/components/DateTimePicker/DateTimePicker.tsx +143 -70
- package/src/components/DateTimePicker/DateTimeSegments.tsx +113 -0
- package/src/components/DateTimePicker/datetimepicker.types.ts +7 -1
- package/src/components/DateTimeRangePicker/DateTimeRangePicker.tsx +195 -104
- package/src/components/DateTimeRangePicker/datetimerangepicker.types.ts +7 -1
- package/src/components/Field/Field.tsx +20 -22
- 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 +17 -0
- package/src/components/Markdown/Markdown.tsx +17 -0
- package/src/components/Message/Message.tsx +73 -23
- package/src/components/Message/index.ts +1 -1
- package/src/components/Modal/Modal.tsx +42 -3
- package/src/components/Modal/components/ModalHeader.tsx +1 -1
- package/src/components/Popover/Popover.tsx +29 -0
- package/src/components/ProgressBar/ProgressBar.tsx +14 -0
- 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 +4 -5
- package/src/components/Select/SelectDropdown.tsx +13 -9
- package/src/components/Select/SelectTrigger.tsx +7 -7
- package/src/components/Separator/Separator.tsx +10 -0
- package/src/components/Sheet/Sheet.tsx +8 -2
- package/src/components/Sheet/components/SheetFooter.tsx +1 -1
- package/src/components/Sheet/components/SheetHeader.tsx +2 -2
- package/src/components/Sparkline/Sparkline.tsx +11 -0
- 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/TabsTrigger.tsx +22 -5
- package/src/components/TagChip/TagChip.tsx +18 -16
- package/src/components/TagInput/TagInput.tsx +11 -8
- 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 +127 -39
- package/src/components/TimePicker/TimeSegments.tsx +131 -0
- package/src/components/TimePicker/timepicker.hooks.ts +1 -24
- package/src/components/TimePicker/timepicker.types.ts +0 -3
- 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 +0 -1
- 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 +0 -6
- 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 +0 -27
- package/src/theme/tokens.css +26 -9
- 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 -19
- package/dist/components/ColorDot/ColorDot.d.ts.map +0 -1
- package/dist/components/ColorDot/ColorDot.js +0 -36
- 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 -26
- package/dist/components/EmptyState/EmptyState.d.ts.map +0 -1
- package/dist/components/EmptyState/EmptyState.js +0 -9
- 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 -8
- 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 -16
- package/dist/components/NavBottom/NavBottom.d.ts.map +0 -1
- package/dist/components/NavBottom/NavBottom.js +0 -21
- 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 -16
- package/dist/components/NavSide/NavSide.d.ts.map +0 -1
- package/dist/components/NavSide/NavSide.js +0 -12
- 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 -4
- package/dist/components/Skeleton/Skeleton.d.ts.map +0 -1
- package/dist/components/Skeleton/Skeleton.js +0 -9
- 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 -15
- 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/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 -52
- package/src/components/ColorDot/index.ts +0 -1
- package/src/components/EmptyState/EmptyState.tsx +0 -30
- 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 -18
- package/src/components/MetricList/MetricRow.tsx +0 -30
- package/src/components/MetricList/index.ts +0 -2
- package/src/components/NavBottom/NavBottom.tsx +0 -55
- package/src/components/NavBottom/index.ts +0 -3
- package/src/components/NavSide/NavItem.tsx +0 -39
- package/src/components/NavSide/NavSide.tsx +0 -42
- 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 -9
- package/src/components/Skeleton/index.ts +0 -1
- package/src/components/StatsCard/StatsCard.tsx +0 -41
- package/src/components/StatsCard/index.ts +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { autoUpdate, FloatingPortal, flip, offset, shift, useClick, useDismiss, useFloating, useInteractions } from "@floating-ui/react";
|
|
2
2
|
import { useControllableState } from "@sixthshift/design-system/hooks";
|
|
3
3
|
import { cn } from "@sixthshift/design-system/utils";
|
|
4
|
-
import { Calendar as CalendarIcon
|
|
4
|
+
import { Calendar as CalendarIcon } from "lucide-react";
|
|
5
5
|
import * as React from "react";
|
|
6
|
-
import { useCallback, useId, useMemo, useState } from "react";
|
|
6
|
+
import { useCallback, useId, useMemo, useRef, useState } from "react";
|
|
7
7
|
import {
|
|
8
8
|
adaptDisabledDates,
|
|
9
9
|
fromISODateOrUndefined,
|
|
@@ -17,9 +17,12 @@ import {
|
|
|
17
17
|
toISOInstantRange,
|
|
18
18
|
} from "../../date-time";
|
|
19
19
|
|
|
20
|
+
import { PickerField } from "../../internal";
|
|
20
21
|
import { Button } from "../Button";
|
|
21
22
|
import { CalendarView } from "../Calendar/CalendarView";
|
|
23
|
+
import { isDateDisabled } from "../Calendar/calendar.hooks";
|
|
22
24
|
import type { DateRangeValue } from "../Calendar/calendar.types";
|
|
25
|
+
import { DateTimeSegments } from "../DateTimePicker/DateTimeSegments";
|
|
23
26
|
import { Separator } from "../Separator";
|
|
24
27
|
import { PeriodSelector } from "../TimePicker/PeriodSelector";
|
|
25
28
|
import { TimeColumn } from "../TimePicker/TimeColumn";
|
|
@@ -36,59 +39,6 @@ import {
|
|
|
36
39
|
import type { ParsedTime, TimePeriod } from "../TimePicker/timepicker.types";
|
|
37
40
|
import type { DateTimeRangePickerProps, DateTimeRangePresetOption, DateTimeRangeValue } from "./datetimerangepicker.types";
|
|
38
41
|
|
|
39
|
-
/**
|
|
40
|
-
* Format an Instant for display
|
|
41
|
-
*/
|
|
42
|
-
function formatInstantDisplay(instant: Temporal.Instant, clockFormat: "12h" | "24h", showSeconds: boolean, timeZone?: string): string {
|
|
43
|
-
const tz = timeZone ?? Temporal.Now.timeZoneId();
|
|
44
|
-
const zoned = instant.toZonedDateTimeISO(tz);
|
|
45
|
-
const plainDateTime = zoned.toPlainDateTime();
|
|
46
|
-
|
|
47
|
-
// Format date part
|
|
48
|
-
const datePart = plainDateTime.toLocaleString("en-US", {
|
|
49
|
-
month: "long",
|
|
50
|
-
day: "numeric",
|
|
51
|
-
year: "numeric",
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
// Format time part based on props
|
|
55
|
-
const timeOptions: Intl.DateTimeFormatOptions = {
|
|
56
|
-
hour: "numeric",
|
|
57
|
-
minute: "2-digit",
|
|
58
|
-
hour12: clockFormat === "12h",
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
if (showSeconds) {
|
|
62
|
-
timeOptions.second = "2-digit";
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const timePart = plainDateTime.toLocaleString("en-US", timeOptions);
|
|
66
|
-
|
|
67
|
-
return `${datePart}, ${timePart}`;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Format an Instant range for display.
|
|
72
|
-
*
|
|
73
|
-
* Takes the internal Temporal range, not the public ISO shape — display runs
|
|
74
|
-
* below the boundary.
|
|
75
|
-
*/
|
|
76
|
-
function formatRangeDisplay(range: TemporalInstantRange | undefined, clockFormat: "12h" | "24h", showSeconds: boolean): string {
|
|
77
|
-
if (!range?.from && !range?.to) {
|
|
78
|
-
return "";
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
if (range.from && !range.to) {
|
|
82
|
-
return `${formatInstantDisplay(range.from, clockFormat, showSeconds)} – ...`;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (!range.from && range.to) {
|
|
86
|
-
return `... – ${formatInstantDisplay(range.to, clockFormat, showSeconds)}`;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return `${formatInstantDisplay(range.from!, clockFormat, showSeconds)} – ${formatInstantDisplay(range.to!, clockFormat, showSeconds)}`;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
42
|
/**
|
|
93
43
|
* Default preset ranges for DateTimeRangePicker
|
|
94
44
|
*
|
|
@@ -144,8 +94,34 @@ function getDefaultPresets(): DateTimeRangePresetOption[] {
|
|
|
144
94
|
/**
|
|
145
95
|
* DateTimeRangePicker - A component for selecting a datetime range
|
|
146
96
|
*
|
|
147
|
-
* Combines
|
|
148
|
-
*
|
|
97
|
+
* Combines a single range calendar with two sets of time columns — Start Time
|
|
98
|
+
* and End Time — shown side by side below it. Like `DateTimePicker`, it is
|
|
99
|
+
* not a composition of other picker components: it builds directly on the
|
|
100
|
+
* same internal calendar grid and time-column primitives `TimePicker` and
|
|
101
|
+
* `DateTimePicker` use.
|
|
102
|
+
*
|
|
103
|
+
* The trigger is two typeable fields, one per end — each a full date-and-time
|
|
104
|
+
* (`1520260900a` is January 5th 2026 at 9am), each with its own clear button,
|
|
105
|
+
* sharing one popover that anchors to whichever half is being edited. A typed
|
|
106
|
+
* end that falls outside `minDate`/`maxDate`/`minTime`/`maxTime` is flagged
|
|
107
|
+
* rather than clamped. See `SegmentedField` for the keyboard model.
|
|
108
|
+
*
|
|
109
|
+
* The value is an `ISOInstantRange` (`{ from?: ISOInstant, to?: ISOInstant }`,
|
|
110
|
+
* exported as `DateTimeRangeValue` for historical reasons) — both ends
|
|
111
|
+
* absolute instants, always UTC and ending in `Z`. Each end is edited in the
|
|
112
|
+
* viewer's local timezone and converted to/from UTC at the boundary. Supports
|
|
113
|
+
* controlled (`value`/`onChange`) and uncontrolled (`defaultValue`) use.
|
|
114
|
+
*
|
|
115
|
+
* Opening the popover seeds date-range and time drafts from the committed
|
|
116
|
+
* value; the footer's Apply combines them into an instant range and commits,
|
|
117
|
+
* Cancel discards the draft. `minDate`/`maxDate` and `disabledDates` bound the
|
|
118
|
+
* date grid. `minTime`/`maxTime` are wall-clock bounds that apply to **both**
|
|
119
|
+
* the start and end time columns identically — they do not mean "start no
|
|
120
|
+
* earlier than X, end no later than Y" relative to each other, and they say
|
|
121
|
+
* nothing about the resulting instants (a `maxTime` of `17:00` still allows an
|
|
122
|
+
* end date after the start date). `presets` (a zero-arg-function value, like
|
|
123
|
+
* `DateRangePicker`) replaces the built-in preset list; `showPresets={false}`
|
|
124
|
+
* hides the sidebar.
|
|
149
125
|
*/
|
|
150
126
|
export const DateTimeRangePicker = React.forwardRef<HTMLDivElement, DateTimeRangePickerProps>((props, ref) => {
|
|
151
127
|
const {
|
|
@@ -161,8 +137,8 @@ export const DateTimeRangePicker = React.forwardRef<HTMLDivElement, DateTimeRang
|
|
|
161
137
|
maxTime,
|
|
162
138
|
minuteStep = 1,
|
|
163
139
|
clockFormat = "12h",
|
|
140
|
+
segmentOrder = "mdy",
|
|
164
141
|
showSeconds = false,
|
|
165
|
-
placeholder = "Select datetime range...",
|
|
166
142
|
weekStartsOn = 0,
|
|
167
143
|
name,
|
|
168
144
|
isDisabled = false,
|
|
@@ -174,6 +150,8 @@ export const DateTimeRangePicker = React.forwardRef<HTMLDivElement, DateTimeRang
|
|
|
174
150
|
|
|
175
151
|
// Open state
|
|
176
152
|
const [open, setOpen] = useState(false);
|
|
153
|
+
// The day grid takes focus only when the popover was opened from the keyboard.
|
|
154
|
+
const [autoFocusDay, setAutoFocusDay] = useState(false);
|
|
177
155
|
|
|
178
156
|
// ---------------------------------------------------------------------------
|
|
179
157
|
// The ISO boundary.
|
|
@@ -413,14 +391,6 @@ export const DateTimeRangePicker = React.forwardRef<HTMLDivElement, DateTimeRang
|
|
|
413
391
|
}, [committedValue, clockFormat]);
|
|
414
392
|
|
|
415
393
|
// Clear value
|
|
416
|
-
const handleClear = useCallback(
|
|
417
|
-
(e: React.MouseEvent) => {
|
|
418
|
-
e.stopPropagation();
|
|
419
|
-
e.preventDefault();
|
|
420
|
-
setCommittedValue(undefined);
|
|
421
|
-
},
|
|
422
|
-
[setCommittedValue]
|
|
423
|
-
);
|
|
424
394
|
|
|
425
395
|
// Apply preset
|
|
426
396
|
const _handlePresetClick = useCallback(
|
|
@@ -447,11 +417,149 @@ export const DateTimeRangePicker = React.forwardRef<HTMLDivElement, DateTimeRang
|
|
|
447
417
|
// IDs for accessibility
|
|
448
418
|
const id = useId();
|
|
449
419
|
const contentId = `datetimerangepicker-content-${id}`;
|
|
450
|
-
const inputId = `datetimerangepicker-input-${id}`;
|
|
451
420
|
|
|
452
421
|
// Display value (from committed value)
|
|
453
|
-
|
|
454
|
-
|
|
422
|
+
|
|
423
|
+
// ---------------------------------------------------------------------------
|
|
424
|
+
// Two typeable fields, one per end.
|
|
425
|
+
//
|
|
426
|
+
// A range is two instants, and typing one should not require knowing where the
|
|
427
|
+
// other ends. Each half is its own segmented field with its own clear button;
|
|
428
|
+
// they share the one popover, which anchors to whichever half is being edited.
|
|
429
|
+
// While it is open the fields show the draft, so picking in the grid or the
|
|
430
|
+
// columns shows up in the segments and vice versa.
|
|
431
|
+
// ---------------------------------------------------------------------------
|
|
432
|
+
|
|
433
|
+
const draftRange = getDraftRange();
|
|
434
|
+
const shownFor = (end: "from" | "to") => (open ? draftRange[end] : committedValue?.[end]);
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* A typed end can fall outside what the grid and columns allow. The field
|
|
438
|
+
* flags it rather than clamping; see `DatePicker` for why.
|
|
439
|
+
*/
|
|
440
|
+
const outOfBounds = (instant: Temporal.Instant | undefined) => {
|
|
441
|
+
if (!instant) return false;
|
|
442
|
+
const zoned = instant.toZonedDateTimeISO(userTimeZone);
|
|
443
|
+
return (
|
|
444
|
+
isDateDisabled(zoned.toPlainDate(), temporalDisabledDates, temporalMinDate, temporalMaxDate) ||
|
|
445
|
+
isTimeDisabled(zoned.toPlainTime(), temporalMinTime, temporalMaxTime)
|
|
446
|
+
);
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
const setRangeEnd = useCallback(
|
|
450
|
+
(end: "from" | "to", instant: Temporal.Instant | undefined) => {
|
|
451
|
+
if (!open) {
|
|
452
|
+
const next = { from: end === "from" ? instant : committedValue?.from, to: end === "to" ? instant : committedValue?.to };
|
|
453
|
+
setCommittedValue(next.from || next.to ? next : undefined);
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
if (!instant) {
|
|
458
|
+
setDraftDateRange((current) => ({ from: end === "from" ? undefined : current?.from, to: end === "to" ? undefined : current?.to }));
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
const zoned = instant.toZonedDateTimeISO(userTimeZone);
|
|
463
|
+
const parsed = temporalToParsed(zoned.toPlainTime());
|
|
464
|
+
setDraftDateRange((current) => ({
|
|
465
|
+
from: end === "from" ? zoned.toPlainDate() : current?.from,
|
|
466
|
+
to: end === "to" ? zoned.toPlainDate() : current?.to,
|
|
467
|
+
}));
|
|
468
|
+
if (end === "from") {
|
|
469
|
+
setDraftStartHour(clockFormat === "12h" ? to12Hour(parsed.hour).hour12 : parsed.hour);
|
|
470
|
+
setDraftStartMinute(parsed.minute);
|
|
471
|
+
setDraftStartSecond(parsed.second);
|
|
472
|
+
setDraftStartPeriod(to12Hour(parsed.hour).period);
|
|
473
|
+
} else {
|
|
474
|
+
setDraftEndHour(clockFormat === "12h" ? to12Hour(parsed.hour).hour12 : parsed.hour);
|
|
475
|
+
setDraftEndMinute(parsed.minute);
|
|
476
|
+
setDraftEndSecond(parsed.second);
|
|
477
|
+
setDraftEndPeriod(to12Hour(parsed.hour).period);
|
|
478
|
+
}
|
|
479
|
+
},
|
|
480
|
+
[clockFormat, committedValue, open, setCommittedValue, userTimeZone]
|
|
481
|
+
);
|
|
482
|
+
|
|
483
|
+
const clearRangeEnd = useCallback(
|
|
484
|
+
(end: "from" | "to") => (event: React.MouseEvent) => {
|
|
485
|
+
event.stopPropagation();
|
|
486
|
+
event.preventDefault();
|
|
487
|
+
const next = { from: end === "from" ? undefined : committedValue?.from, to: end === "to" ? undefined : committedValue?.to };
|
|
488
|
+
// Clearing the last remaining end clears the range itself.
|
|
489
|
+
setCommittedValue(next.from || next.to ? next : undefined);
|
|
490
|
+
},
|
|
491
|
+
[committedValue, setCommittedValue]
|
|
492
|
+
);
|
|
493
|
+
|
|
494
|
+
const rangeHalves = useRef<Record<"from" | "to", HTMLDivElement | null>>({ from: null, to: null });
|
|
495
|
+
const anchorToHalf = useCallback(
|
|
496
|
+
(end: "from" | "to") => {
|
|
497
|
+
const node = rangeHalves.current[end];
|
|
498
|
+
if (node) refs.setPositionReference(node);
|
|
499
|
+
},
|
|
500
|
+
[refs]
|
|
501
|
+
);
|
|
502
|
+
|
|
503
|
+
/** `Alt+ArrowDown` from a segment: open the popover *and* go to the grid. */
|
|
504
|
+
const openWithGridFocus = useCallback(
|
|
505
|
+
(end: "from" | "to") => () => {
|
|
506
|
+
anchorToHalf(end);
|
|
507
|
+
setAutoFocusDay(true);
|
|
508
|
+
handleOpenChange(true);
|
|
509
|
+
},
|
|
510
|
+
[anchorToHalf, handleOpenChange]
|
|
511
|
+
);
|
|
512
|
+
|
|
513
|
+
/** `Enter` in a segment commits the draft, matching the popover's Apply. */
|
|
514
|
+
const handleFieldSubmit = useCallback(() => {
|
|
515
|
+
if (open) handleApply();
|
|
516
|
+
}, [handleApply, open]);
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* One end of the range. A render function rather than a component so the
|
|
520
|
+
* fields are not remounted — and focus is not dropped — on every keystroke.
|
|
521
|
+
*/
|
|
522
|
+
const renderRangeHalf = (end: "from" | "to", label: string) => {
|
|
523
|
+
const settled = committedValue?.[end];
|
|
524
|
+
|
|
525
|
+
return (
|
|
526
|
+
<PickerField
|
|
527
|
+
ref={(node) => {
|
|
528
|
+
rangeHalves.current[end] = node;
|
|
529
|
+
}}
|
|
530
|
+
onFocusCapture={() => anchorToHalf(end)}
|
|
531
|
+
className="min-w-70 flex-1"
|
|
532
|
+
icon={<CalendarIcon className="h-4 w-4" />}
|
|
533
|
+
toggleLabel={`Open picker for ${label.toLowerCase()}`}
|
|
534
|
+
// Both handlers have to run: Floating UI's opens the popover, and ours
|
|
535
|
+
// points it at this half. Spreading after `onClick` would drop ours on
|
|
536
|
+
// the floor, which is how the popover ended up anchored to the whole
|
|
537
|
+
// trigger.
|
|
538
|
+
toggleProps={getReferenceProps({ onClick: () => anchorToHalf(end) })}
|
|
539
|
+
isOpen={open}
|
|
540
|
+
contentId={contentId}
|
|
541
|
+
isDisabled={isDisabled}
|
|
542
|
+
isInvalid={isInvalid || outOfBounds(shownFor(end))}
|
|
543
|
+
onClear={clearable && settled && !isDisabled ? clearRangeEnd(end) : undefined}
|
|
544
|
+
clearLabel={`Clear ${label.toLowerCase()}`}
|
|
545
|
+
>
|
|
546
|
+
<DateTimeSegments
|
|
547
|
+
className="h-full flex-1"
|
|
548
|
+
label={label}
|
|
549
|
+
value={shownFor(end)}
|
|
550
|
+
onChange={(instant) => setRangeEnd(end, instant)}
|
|
551
|
+
timeZone={userTimeZone}
|
|
552
|
+
order={segmentOrder}
|
|
553
|
+
clockFormat={clockFormat}
|
|
554
|
+
showSeconds={showSeconds}
|
|
555
|
+
isDisabled={isDisabled}
|
|
556
|
+
isInvalid={isInvalid || outOfBounds(shownFor(end))}
|
|
557
|
+
onOpenRequest={openWithGridFocus(end)}
|
|
558
|
+
onSubmit={handleFieldSubmit}
|
|
559
|
+
/>
|
|
560
|
+
</PickerField>
|
|
561
|
+
);
|
|
562
|
+
};
|
|
455
563
|
|
|
456
564
|
// Time selection handlers - Start time
|
|
457
565
|
const handleStartHourChange = (hour: number) => setDraftStartHour(hour);
|
|
@@ -486,39 +594,21 @@ export const DateTimeRangePicker = React.forwardRef<HTMLDivElement, DateTimeRang
|
|
|
486
594
|
return (
|
|
487
595
|
<>
|
|
488
596
|
{/* Trigger Input */}
|
|
489
|
-
<div
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
className={cn(
|
|
505
|
-
`flex h-9 w-full min-w-125 cursor-pointer rounded-md border border-border-normal bg-transparent py-1 pl-9 text-sm shadow-xs transition-colors placeholder:text-fg-subtle focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-focus-ring disabled:cursor-not-allowed disabled:opacity-50`,
|
|
506
|
-
clearable && hasValue ? "pr-9" : "pr-3",
|
|
507
|
-
isInvalid && "border-border-danger",
|
|
508
|
-
className
|
|
509
|
-
)}
|
|
510
|
-
{...getReferenceProps()}
|
|
511
|
-
/>
|
|
512
|
-
{clearable && hasValue && !isDisabled && (
|
|
513
|
-
<button
|
|
514
|
-
type="button"
|
|
515
|
-
onClick={handleClear}
|
|
516
|
-
className="absolute right-3 rounded-sm p-0.5 text-fg-subtle hover:bg-bg-subtle hover:text-fg-normal focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-focus-ring"
|
|
517
|
-
aria-label="Clear datetime range"
|
|
518
|
-
>
|
|
519
|
-
<X className="h-3.5 w-3.5" />
|
|
520
|
-
</button>
|
|
521
|
-
)}
|
|
597
|
+
<div
|
|
598
|
+
ref={(node) => {
|
|
599
|
+
// The container is the interaction reference, so a click in either half
|
|
600
|
+
// counts as inside; the *position* reference follows the active half.
|
|
601
|
+
refs.setReference(node);
|
|
602
|
+
if (typeof ref === "function") ref(node);
|
|
603
|
+
else if (ref) (ref as React.MutableRefObject<HTMLDivElement | null>).current = node;
|
|
604
|
+
}}
|
|
605
|
+
className={cn("relative flex min-w-125 items-center gap-2", className)}
|
|
606
|
+
>
|
|
607
|
+
{renderRangeHalf("from", "Start date and time")}
|
|
608
|
+
<span aria-hidden="true" className="text-fg-subtle">
|
|
609
|
+
–
|
|
610
|
+
</span>
|
|
611
|
+
{renderRangeHalf("to", "End date and time")}
|
|
522
612
|
|
|
523
613
|
{/* Hidden inputs for form submission */}
|
|
524
614
|
{name && committedValue?.from && <input type="hidden" name={`${name}.from`} value={committedValue.from.toString()} />}
|
|
@@ -532,7 +622,7 @@ export const DateTimeRangePicker = React.forwardRef<HTMLDivElement, DateTimeRang
|
|
|
532
622
|
ref={refs.setFloating}
|
|
533
623
|
id={contentId}
|
|
534
624
|
role="dialog"
|
|
535
|
-
aria-
|
|
625
|
+
aria-label="Choose date and time range"
|
|
536
626
|
style={floatingStyles}
|
|
537
627
|
className="z-popover rounded-xl border border-border-normal bg-bg-normal p-4 shadow-lg"
|
|
538
628
|
{...getFloatingProps()}
|
|
@@ -575,6 +665,7 @@ export const DateTimeRangePicker = React.forwardRef<HTMLDivElement, DateTimeRang
|
|
|
575
665
|
disabled={temporalDisabledDates}
|
|
576
666
|
weekStartsOn={weekStartsOn}
|
|
577
667
|
showFooter={false}
|
|
668
|
+
autoFocusDay={autoFocusDay}
|
|
578
669
|
/>
|
|
579
670
|
</div>
|
|
580
671
|
|
|
@@ -700,7 +791,7 @@ export const DateTimeRangePicker = React.forwardRef<HTMLDivElement, DateTimeRang
|
|
|
700
791
|
<Button type="button" variant="ghost" size="sm" onClick={handleCancel}>
|
|
701
792
|
Cancel
|
|
702
793
|
</Button>
|
|
703
|
-
<Button type="button" variant="solid" size="sm" onClick={handleApply}>
|
|
794
|
+
<Button type="button" variant="solid" intent="brand" size="sm" onClick={handleApply}>
|
|
704
795
|
Apply
|
|
705
796
|
</Button>
|
|
706
797
|
</div>
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import type { DisabledDates, ISODate, ISOInstantRange, ISOTime, WeekStartsOn } from "../../date-time";
|
|
11
|
+
import type { DateSegmentOrder } from "../DatePicker/datepicker.types";
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* A datetime range.
|
|
@@ -45,10 +46,15 @@ export type DateTimeRangePickerProps = {
|
|
|
45
46
|
|
|
46
47
|
// Time format
|
|
47
48
|
clockFormat?: "12h" | "24h"; // Default: "12h"
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Segment order for the date half of each typeable field (default `mdy`).
|
|
52
|
+
* Never inferred from the locale — `08/09` is a different date under each.
|
|
53
|
+
*/
|
|
54
|
+
segmentOrder?: DateSegmentOrder;
|
|
48
55
|
showSeconds?: boolean; // Default: false
|
|
49
56
|
|
|
50
57
|
// Display
|
|
51
|
-
placeholder?: string;
|
|
52
58
|
weekStartsOn?: WeekStartsOn;
|
|
53
59
|
|
|
54
60
|
// Form
|
|
@@ -1,23 +1,6 @@
|
|
|
1
1
|
import { cn } from "@sixthshift/design-system/utils";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* The labelled identifier carve-out used by identity-disclosure surfaces
|
|
6
|
-
* (Person Detail's Identifiers card, Calendar Event's per-source provenance).
|
|
7
|
-
*
|
|
8
|
-
* Field exists because identifiers (JIDs, external IDs, OAuth subs) are
|
|
9
|
-
* *content* on these surfaces — they answer "what does PA know about this
|
|
10
|
-
* contact?" The default value rendering is monospaced with `break-all`
|
|
11
|
-
* because a raw JID is the canonical case and it must wrap inside the row.
|
|
12
|
-
*
|
|
13
|
-
* Sibling primitive — not a replacement: `MetricRow` (in `@sixthshift/design-system/metric-list`)
|
|
14
|
-
* carries runtime metrics ("CPU: 12.5%"). Both are label/value pairs but the
|
|
15
|
-
* value semantics differ: a metric is a short readable number; an identifier
|
|
16
|
-
* is a long opaque string. Forcing `MetricRow` to do both would conflate the
|
|
17
|
-
* two and break Identifiers-card wrapping.
|
|
18
|
-
*
|
|
19
|
-
* See: docs/engineering/explanation/concepts/identity-rendering.md
|
|
20
|
-
*/
|
|
21
4
|
export type FieldProps = {
|
|
22
5
|
/** The humane label for what the identifier identifies ("WhatsApp", "Email"). */
|
|
23
6
|
label: string;
|
|
@@ -39,21 +22,36 @@ export type FieldProps = {
|
|
|
39
22
|
className?: string;
|
|
40
23
|
};
|
|
41
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Read-only label/value pair for displaying an identifier on
|
|
27
|
+
* identity-disclosure surfaces — a contact's JIDs, external IDs, OAuth
|
|
28
|
+
* subjects. Not a form control: there is no input and nothing to submit.
|
|
29
|
+
*
|
|
30
|
+
* `layout="stacked"` (default) puts the label above the value, for long
|
|
31
|
+
* identifiers that need width to wrap; `layout="row"` puts label and value
|
|
32
|
+
* on one line with the value right-aligned. `mono` (default `true`) renders
|
|
33
|
+
* the value monospaced with `break-all`, since a raw identifier is the
|
|
34
|
+
* canonical case; set it `false` when the value is itself human-readable.
|
|
35
|
+
*
|
|
36
|
+
* Distinct from `FormField`, which is the label + input wrapper for
|
|
37
|
+
* interactive form controls. Both are label/value pairs, but this one is
|
|
38
|
+
* read-only: the value is a long opaque identifier, not an editable field.
|
|
39
|
+
*/
|
|
42
40
|
export const Field = React.forwardRef<HTMLDivElement, FieldProps>(({ label, children, layout = "stacked", mono = true, className }, ref) => {
|
|
43
|
-
const valueClass = cn("text-fg
|
|
41
|
+
const valueClass = cn("text-(--field-fg) text-xs", mono && "break-all font-mono");
|
|
44
42
|
|
|
45
43
|
if (layout === "row") {
|
|
46
44
|
return (
|
|
47
|
-
<div ref={ref} className={cn("flex items-baseline justify-between gap-3", className)}>
|
|
48
|
-
<span className="shrink-0 text-fg
|
|
45
|
+
<div ref={ref} className={cn("field flex items-baseline justify-between gap-3", className)}>
|
|
46
|
+
<span className="shrink-0 text-(--field-fg) text-sm">{label}</span>
|
|
49
47
|
<span className={cn(valueClass, "min-w-0 text-right")}>{children}</span>
|
|
50
48
|
</div>
|
|
51
49
|
);
|
|
52
50
|
}
|
|
53
51
|
|
|
54
52
|
return (
|
|
55
|
-
<div ref={ref} className={cn("flex flex-col gap-1", className)}>
|
|
56
|
-
<span className="text-fg
|
|
53
|
+
<div ref={ref} className={cn("field flex flex-col gap-1", className)}>
|
|
54
|
+
<span className="text-(--field-fg) text-xs uppercase tracking-wide">{label}</span>
|
|
57
55
|
<span className={valueClass}>{children}</span>
|
|
58
56
|
</div>
|
|
59
57
|
);
|
|
@@ -16,6 +16,21 @@ export type FormFieldProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
16
16
|
required?: boolean;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Wraps a form control with a label, optional description, and optional
|
|
21
|
+
* validation feedback — the composition point for `Input`, `Textarea`,
|
|
22
|
+
* `Select` and similar controls inside a form.
|
|
23
|
+
*
|
|
24
|
+
* Generates an `id` (or uses the one passed in) and clones it, plus
|
|
25
|
+
* `aria-describedby` (pointing at the description and/or feedback text) and
|
|
26
|
+
* `aria-invalid` (when `feedback.intent` is `"danger"`), onto its child —
|
|
27
|
+
* so the wrapped control does not need those wired by hand. It expects a
|
|
28
|
+
* single child control: the same id and aria attributes get cloned onto
|
|
29
|
+
* every child if more than one is passed.
|
|
30
|
+
*
|
|
31
|
+
* Distinct from `Field`, which displays a read-only label/value pair rather
|
|
32
|
+
* than wrapping an interactive control.
|
|
33
|
+
*/
|
|
19
34
|
const FormField = React.forwardRef<HTMLDivElement, FormFieldProps>(({ className, label, description, feedback, required, children, id, ...props }, ref) => {
|
|
20
35
|
const generatedId = React.useId();
|
|
21
36
|
const fieldId = id ?? generatedId;
|
|
@@ -77,6 +77,12 @@ type HoverCardComponent = typeof HoverCardRoot & {
|
|
|
77
77
|
Content: typeof HoverCardContent;
|
|
78
78
|
};
|
|
79
79
|
|
|
80
|
+
/**
|
|
81
|
+
* NOTE: Storybook shows the copy in HoverCard.stories.tsx
|
|
82
|
+
* (`parameters.docs.description.component`), not this comment. react-docgen
|
|
83
|
+
* cannot extract a description from this declaration shape, so keeping a
|
|
84
|
+
* second copy here would only drift. Edit the stories file.
|
|
85
|
+
*/
|
|
80
86
|
export const HoverCard: HoverCardComponent = Object.assign(HoverCardRoot, {
|
|
81
87
|
Trigger: HoverCardTrigger,
|
|
82
88
|
Content: HoverCardContent,
|
|
@@ -6,20 +6,35 @@ export type InputProps = React.InputHTMLAttributes<HTMLInputElement> & {
|
|
|
6
6
|
iconRight?: React.ReactNode;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
const iconSlotStyles = `absolute top-1/2 -translate-y-1/2 text-fg
|
|
9
|
+
const iconSlotStyles = `absolute top-1/2 -translate-y-1/2 text-(--input-icon-fg)
|
|
10
10
|
[&_svg]:h-4 [&_svg]:w-4
|
|
11
11
|
[&_button]:flex [&_button]:cursor-pointer [&_button]:appearance-none
|
|
12
12
|
[&_button]:border-0 [&_button]:bg-transparent`;
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Single-line text input for free-form text entry.
|
|
16
|
+
*
|
|
17
|
+
* Renders a plain `<input>` unless `iconLeft` or `iconRight` is supplied, in
|
|
18
|
+
* which case it wraps the input in a relatively positioned container so an
|
|
19
|
+
* icon — or an icon-styled button, as `SearchInput` uses for its clear
|
|
20
|
+
* button — can sit inside the field's padding without affecting layout.
|
|
21
|
+
*
|
|
22
|
+
* Controlled or uncontrolled exactly like a native input (`value`/`onChange`
|
|
23
|
+
* or `defaultValue`), and `type` is forwarded as-is, so `type="password"`,
|
|
24
|
+
* `type="number"`, etc. all work.
|
|
25
|
+
*
|
|
26
|
+
* Meant to be wrapped by `FormField` for label, description and validation
|
|
27
|
+
* wiring, or by `SearchInput` for a search affordance.
|
|
28
|
+
*/
|
|
14
29
|
const Input = React.forwardRef<HTMLInputElement, InputProps>(({ className, type, iconLeft, iconRight, ...props }, ref) => {
|
|
15
30
|
if (iconLeft || iconRight) {
|
|
16
31
|
return (
|
|
17
|
-
<div className={cn("relative h-9 w-full text-sm", className)}>
|
|
32
|
+
<div className={cn("input relative h-9 w-full text-sm", className)}>
|
|
18
33
|
{iconLeft && <span className={cn(iconSlotStyles, "left-3")}>{iconLeft}</span>}
|
|
19
34
|
<input
|
|
20
35
|
type={type}
|
|
21
36
|
className={cn(
|
|
22
|
-
`flex h-full w-full rounded-md border
|
|
37
|
+
`input border-(color:--input-border) focus-visible:ring-(color:--input-ring) flex h-full w-full rounded-md border bg-(--input-bg) py-1 text-[length:inherit] shadow-xs transition-colors file:border-0 file:bg-(--input-file-bg) file:font-medium file:text-(--input-file-fg) file:text-sm placeholder:text-(--input-placeholder-fg) focus-visible:outline-hidden focus-visible:ring-2 disabled:cursor-not-allowed disabled:opacity-50`,
|
|
23
38
|
iconLeft ? "pl-9" : "pl-3",
|
|
24
39
|
iconRight ? "pr-9" : "pr-3"
|
|
25
40
|
)}
|
|
@@ -35,7 +50,7 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(({ className, type,
|
|
|
35
50
|
<input
|
|
36
51
|
type={type}
|
|
37
52
|
className={cn(
|
|
38
|
-
`flex h-9 w-full rounded-md border
|
|
53
|
+
`input border-(color:--input-border) focus-visible:ring-(color:--input-ring) flex h-9 w-full rounded-md border bg-(--input-bg) px-3 py-1 text-sm shadow-xs transition-colors file:border-0 file:bg-(--input-file-bg) file:font-medium file:text-(--input-file-fg) file:text-sm placeholder:text-(--input-placeholder-fg) focus-visible:outline-hidden focus-visible:ring-2 disabled:cursor-not-allowed disabled:opacity-50`,
|
|
39
54
|
className
|
|
40
55
|
)}
|
|
41
56
|
ref={ref}
|
|
@@ -96,6 +96,23 @@ function buildPath(points: { x: number; y: number }[], interpolation: Interpolat
|
|
|
96
96
|
return parts.join(" ");
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
/**
|
|
100
|
+
* Multi-series line chart, rendered as a single responsive SVG (a `viewBox`,
|
|
101
|
+
* no fixed pixel size) with one `<path>` per series, plus optional grid
|
|
102
|
+
* lines, axes, dots, and per-point value labels.
|
|
103
|
+
*
|
|
104
|
+
* Colour is per-series: pass a CSS color string via `color` on a
|
|
105
|
+
* `LineChartSeries` (typically a `var(--fg-*)` token), or omit it to cycle
|
|
106
|
+
* through the same default palette `BarChart` uses. The y-axis scale is
|
|
107
|
+
* computed from the data into "nice" round ticks unless `yMin`/`yMax`/
|
|
108
|
+
* `yTicks` override it.
|
|
109
|
+
*
|
|
110
|
+
* The chart has a single static accessible name — `<title>Line
|
|
111
|
+
* chart</title>` behind `role="img"` — regardless of what's plotted; it does
|
|
112
|
+
* not describe the series or values. `showTooltip` overlays a `Tooltip` at
|
|
113
|
+
* each data point, but the trigger is a plain, unfocusable `<span>`, so it
|
|
114
|
+
* only responds to mouse hover, not keyboard.
|
|
115
|
+
*/
|
|
99
116
|
export const LineChart = React.forwardRef<HTMLDivElement, LineChartProps>(
|
|
100
117
|
(
|
|
101
118
|
{
|
|
@@ -10,6 +10,23 @@ export type MarkdownProps = {
|
|
|
10
10
|
className?: string;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Renders a markdown string through the design system's own typography
|
|
15
|
+
* components (`Heading`, `Body`, `Emphasis`) rather than raw HTML tags, so
|
|
16
|
+
* markdown content picks up the same type ramp as everything else.
|
|
17
|
+
*
|
|
18
|
+
* Built for short, chat/assistant-style content rather than full documents:
|
|
19
|
+
* it covers headings, paragraphs, emphasis, links, lists, and code, but
|
|
20
|
+
* heading levels are compressed — `#` renders as `Heading as="h3"`, `##` as
|
|
21
|
+
* `Heading as="h4"`, and `###` as inline `Emphasis` rather than a heading at
|
|
22
|
+
* all — and `h4`+ and tables aren't specially handled: there's no
|
|
23
|
+
* `remark-gfm`, so GFM table syntax doesn't render as a table. Raw HTML
|
|
24
|
+
* embedded in the source is not rendered.
|
|
25
|
+
*
|
|
26
|
+
* `react-markdown` is an optional peer dependency of this package — a
|
|
27
|
+
* consuming app that imports `Markdown` without installing it will fail at
|
|
28
|
+
* runtime.
|
|
29
|
+
*/
|
|
13
30
|
export const Markdown = React.forwardRef<HTMLDivElement, MarkdownProps>(({ children, className }, ref) => (
|
|
14
31
|
<div ref={ref} className={cn("flex flex-col", className)}>
|
|
15
32
|
<ReactMarkdown
|