@itwin/itwinui-react 3.0.0-dev.6 → 3.0.0-dev.8
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/CHANGELOG.md +101 -0
- package/cjs/core/Alert/Alert.d.ts +20 -9
- package/cjs/core/Alert/Alert.js +48 -10
- package/cjs/core/Avatar/Avatar.d.ts +3 -2
- package/cjs/core/Avatar/Avatar.js +21 -19
- package/cjs/core/AvatarGroup/AvatarGroup.js +3 -8
- package/cjs/core/ButtonGroup/ButtonGroup.js +41 -36
- package/cjs/core/Buttons/Button/Button.d.ts +15 -2
- package/cjs/core/Buttons/Button/Button.js +23 -9
- package/cjs/core/Buttons/DropdownButton/DropdownButton.js +1 -1
- package/cjs/core/Buttons/IconButton/IconButton.d.ts +5 -1
- package/cjs/core/Buttons/IconButton/IconButton.js +27 -38
- package/cjs/core/Buttons/SplitButton/SplitButton.d.ts +9 -0
- package/cjs/core/Buttons/SplitButton/SplitButton.js +25 -13
- package/cjs/core/Carousel/Carousel.d.ts +6 -4
- package/cjs/core/Carousel/Carousel.js +2 -2
- package/cjs/core/Carousel/CarouselDot.js +1 -3
- package/cjs/core/Carousel/CarouselNavigation.d.ts +6 -4
- package/cjs/core/ColorPicker/ColorBuilder.js +2 -1
- package/cjs/core/ColorPicker/ColorInputPanel.js +172 -231
- package/cjs/core/ComboBox/ComboBox.js +3 -3
- package/cjs/core/ComboBox/ComboBoxDropdown.js +4 -9
- package/cjs/core/ComboBox/ComboBoxEndIcon.js +3 -22
- package/cjs/core/ComboBox/ComboBoxInput.js +1 -1
- package/cjs/core/ComboBox/ComboBoxMenu.d.ts +2 -2
- package/cjs/core/ComboBox/ComboBoxMenu.js +5 -5
- package/cjs/core/ComboBox/ComboBoxMenuItem.d.ts +1 -1
- package/cjs/core/ComboBox/ComboBoxMenuItem.js +8 -6
- package/cjs/core/ComboBox/helpers.d.ts +1 -2
- package/cjs/core/DatePicker/DatePicker.d.ts +30 -8
- package/cjs/core/DatePicker/DatePicker.js +47 -6
- package/cjs/core/Dialog/Dialog.js +10 -17
- package/cjs/core/Dialog/DialogContext.d.ts +3 -4
- package/cjs/core/Dialog/DialogMain.js +5 -5
- package/cjs/core/ExpandableBlock/ExpandableBlock.d.ts +20 -14
- package/cjs/core/ExpandableBlock/ExpandableBlock.js +39 -18
- package/cjs/core/FileUpload/FileUpload.d.ts +4 -0
- package/cjs/core/FileUpload/FileUpload.js +24 -3
- package/cjs/core/Header/HeaderBasicButton.js +3 -16
- package/cjs/core/Header/HeaderDropdownButton.js +1 -1
- package/cjs/core/Header/HeaderSplitButton.js +3 -4
- package/cjs/core/Input/Input.d.ts +4 -0
- package/cjs/core/Input/Input.js +2 -1
- package/cjs/core/InputGrid/InputGrid.d.ts +25 -0
- package/cjs/core/InputGrid/InputGrid.js +39 -0
- package/cjs/core/InputGrid/index.d.ts +3 -0
- package/cjs/core/InputGrid/index.js +15 -0
- package/cjs/core/InputGroup/InputGroup.d.ts +13 -0
- package/cjs/core/InputGroup/InputGroup.js +35 -9
- package/cjs/core/InputWithDecorations/InputWithDecorations.d.ts +39 -0
- package/cjs/core/InputWithDecorations/InputWithDecorations.js +81 -0
- package/cjs/core/InputWithDecorations/index.d.ts +3 -0
- package/cjs/core/InputWithDecorations/index.js +15 -0
- package/cjs/core/Label/Label.d.ts +5 -0
- package/cjs/core/Label/Label.js +2 -0
- package/cjs/core/LabeledInput/LabeledInput.d.ts +22 -16
- package/cjs/core/LabeledInput/LabeledInput.js +52 -29
- package/cjs/core/LabeledSelect/LabeledSelect.d.ts +17 -7
- package/cjs/core/LabeledSelect/LabeledSelect.js +36 -17
- package/cjs/core/LabeledTextarea/LabeledTextarea.d.ts +15 -5
- package/cjs/core/LabeledTextarea/LabeledTextarea.js +12 -45
- package/cjs/core/Menu/Menu.d.ts +1 -1
- package/cjs/core/Menu/Menu.js +1 -1
- package/cjs/core/Menu/MenuDivider.d.ts +2 -1
- package/cjs/core/Menu/MenuDivider.js +1 -1
- package/cjs/core/Menu/MenuItem.d.ts +1 -1
- package/cjs/core/Menu/MenuItem.js +1 -0
- package/cjs/core/Menu/MenuItemSkeleton.d.ts +1 -1
- package/cjs/core/Menu/MenuItemSkeleton.js +0 -1
- package/cjs/core/ProgressIndicators/ProgressLinear.d.ts +4 -0
- package/cjs/core/ProgressIndicators/ProgressLinear.js +9 -1
- package/cjs/core/SearchBox/SearchBox.js +1 -1
- package/cjs/core/Select/Select.d.ts +4 -0
- package/cjs/core/Select/Select.js +12 -11
- package/cjs/core/SideNavigation/SideNavigation.d.ts +16 -0
- package/cjs/core/SideNavigation/SideNavigation.js +42 -9
- package/cjs/core/Slider/Slider.d.ts +24 -0
- package/cjs/core/Slider/Slider.js +58 -10
- package/cjs/core/Slider/Thumb.js +3 -2
- package/cjs/core/Slider/Track.d.ts +1 -1
- package/cjs/core/Slider/Track.js +17 -6
- package/cjs/core/StatusMessage/StatusMessage.d.ts +12 -2
- package/cjs/core/StatusMessage/StatusMessage.js +23 -9
- package/cjs/core/Stepper/Stepper.d.ts +26 -1
- package/cjs/core/Stepper/Stepper.js +35 -6
- package/cjs/core/Stepper/StepperStep.d.ts +17 -0
- package/cjs/core/Stepper/StepperStep.js +33 -8
- package/cjs/core/Stepper/WorkflowDiagram.d.ts +11 -1
- package/cjs/core/Stepper/WorkflowDiagram.js +23 -10
- package/cjs/core/Stepper/WorkflowDiagramStep.d.ts +6 -1
- package/cjs/core/Stepper/WorkflowDiagramStep.js +9 -2
- package/cjs/core/Table/SubRowExpander.js +3 -1
- package/cjs/core/Table/Table.js +0 -1
- package/cjs/core/Table/TableCell.js +1 -1
- package/cjs/core/Table/TablePaginator.js +1 -3
- package/cjs/core/Table/filters/DateRangeFilter/DatePickerInput.d.ts +6 -1
- package/cjs/core/Table/filters/DateRangeFilter/DatePickerInput.js +46 -18
- package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.d.ts +2 -0
- package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.js +2 -0
- package/cjs/core/Tabs/Tab.js +1 -2
- package/cjs/core/Textarea/Textarea.d.ts +7 -1
- package/cjs/core/Textarea/Textarea.js +6 -11
- package/cjs/core/ThemeProvider/ThemeContext.d.ts +1 -1
- package/cjs/core/ThemeProvider/ThemeProvider.d.ts +23 -3
- package/cjs/core/ThemeProvider/ThemeProvider.js +56 -23
- package/cjs/core/Tile/Tile.d.ts +142 -17
- package/cjs/core/Tile/Tile.js +107 -16
- package/cjs/core/Toast/Toast.d.ts +12 -4
- package/cjs/core/Toast/Toast.js +24 -13
- package/cjs/core/Tooltip/Tooltip.d.ts +35 -28
- package/cjs/core/Tooltip/Tooltip.js +116 -118
- package/cjs/core/TransferList/TransferList.js +4 -12
- package/cjs/core/Tree/TreeNode.js +1 -1
- package/cjs/core/index.d.ts +2 -0
- package/cjs/core/index.js +20 -4
- package/cjs/core/utils/components/ButtonBase.d.ts +14 -0
- package/cjs/core/utils/components/ButtonBase.js +46 -0
- package/cjs/core/utils/components/Icon.d.ts +5 -0
- package/cjs/core/utils/components/Icon.js +8 -1
- package/cjs/core/utils/components/InputContainer.d.ts +0 -1
- package/cjs/core/utils/components/InputContainer.js +14 -34
- package/cjs/core/utils/components/InputFlexContainer.d.ts +1 -0
- package/cjs/core/utils/components/InputFlexContainer.js +3 -1
- package/cjs/core/utils/components/Popover.js +5 -3
- package/cjs/core/utils/components/Portal.d.ts +27 -0
- package/cjs/core/utils/components/Portal.js +43 -0
- package/cjs/core/utils/components/VirtualScroll.js +4 -4
- package/cjs/core/utils/components/index.d.ts +2 -0
- package/cjs/core/utils/components/index.js +2 -0
- package/cjs/core/utils/functions/colors.d.ts +1 -1
- package/cjs/core/utils/functions/colors.js +1 -13
- package/cjs/core/utils/functions/index.d.ts +1 -0
- package/cjs/core/utils/functions/index.js +1 -0
- package/cjs/core/utils/functions/react.d.ts +8 -0
- package/cjs/core/utils/functions/react.js +40 -0
- package/cjs/core/utils/hooks/index.d.ts +1 -0
- package/cjs/core/utils/hooks/index.js +1 -0
- package/cjs/core/utils/hooks/useControlledState.d.ts +13 -0
- package/cjs/core/utils/hooks/useControlledState.js +39 -0
- package/cjs/core/utils/hooks/useGlobals.d.ts +1 -1
- package/cjs/styles.js +11 -35
- package/esm/core/Alert/Alert.d.ts +20 -9
- package/esm/core/Alert/Alert.js +49 -10
- package/esm/core/Avatar/Avatar.d.ts +3 -2
- package/esm/core/Avatar/Avatar.js +21 -17
- package/esm/core/AvatarGroup/AvatarGroup.js +3 -8
- package/esm/core/ButtonGroup/ButtonGroup.js +41 -36
- package/esm/core/Buttons/Button/Button.d.ts +15 -2
- package/esm/core/Buttons/Button/Button.js +18 -10
- package/esm/core/Buttons/DropdownButton/DropdownButton.js +1 -1
- package/esm/core/Buttons/IconButton/IconButton.d.ts +5 -1
- package/esm/core/Buttons/IconButton/IconButton.js +25 -37
- package/esm/core/Buttons/SplitButton/SplitButton.d.ts +9 -0
- package/esm/core/Buttons/SplitButton/SplitButton.js +31 -14
- package/esm/core/Carousel/Carousel.d.ts +6 -4
- package/esm/core/Carousel/Carousel.js +8 -3
- package/esm/core/Carousel/CarouselDot.js +2 -4
- package/esm/core/Carousel/CarouselNavigation.d.ts +6 -4
- package/esm/core/ColorPicker/ColorBuilder.js +2 -1
- package/esm/core/ColorPicker/ColorInputPanel.js +173 -232
- package/esm/core/ComboBox/ComboBox.js +3 -3
- package/esm/core/ComboBox/ComboBoxDropdown.js +4 -9
- package/esm/core/ComboBox/ComboBoxEndIcon.js +4 -25
- package/esm/core/ComboBox/ComboBoxInput.js +1 -1
- package/esm/core/ComboBox/ComboBoxMenu.d.ts +2 -2
- package/esm/core/ComboBox/ComboBoxMenu.js +5 -5
- package/esm/core/ComboBox/ComboBoxMenuItem.d.ts +1 -1
- package/esm/core/ComboBox/ComboBoxMenuItem.js +9 -7
- package/esm/core/ComboBox/helpers.d.ts +1 -2
- package/esm/core/DatePicker/DatePicker.d.ts +30 -8
- package/esm/core/DatePicker/DatePicker.js +33 -6
- package/esm/core/Dialog/Dialog.js +11 -23
- package/esm/core/Dialog/DialogContext.d.ts +3 -4
- package/esm/core/Dialog/DialogMain.js +5 -5
- package/esm/core/ExpandableBlock/ExpandableBlock.d.ts +20 -14
- package/esm/core/ExpandableBlock/ExpandableBlock.js +41 -20
- package/esm/core/FileUpload/FileUpload.d.ts +4 -0
- package/esm/core/FileUpload/FileUpload.js +26 -3
- package/esm/core/Header/HeaderBasicButton.js +4 -17
- package/esm/core/Header/HeaderDropdownButton.js +1 -1
- package/esm/core/Header/HeaderSplitButton.js +9 -5
- package/esm/core/Input/Input.d.ts +4 -0
- package/esm/core/Input/Input.js +2 -1
- package/esm/core/InputGrid/InputGrid.d.ts +25 -0
- package/esm/core/InputGrid/InputGrid.js +35 -0
- package/esm/core/InputGrid/index.d.ts +3 -0
- package/esm/core/InputGrid/index.js +6 -0
- package/esm/core/InputGroup/InputGroup.d.ts +13 -0
- package/esm/core/InputGroup/InputGroup.js +34 -10
- package/esm/core/InputWithDecorations/InputWithDecorations.d.ts +39 -0
- package/esm/core/InputWithDecorations/InputWithDecorations.js +80 -0
- package/esm/core/InputWithDecorations/index.d.ts +3 -0
- package/esm/core/InputWithDecorations/index.js +6 -0
- package/esm/core/Label/Label.d.ts +5 -0
- package/esm/core/Label/Label.js +2 -0
- package/esm/core/LabeledInput/LabeledInput.d.ts +22 -16
- package/esm/core/LabeledInput/LabeledInput.js +53 -29
- package/esm/core/LabeledSelect/LabeledSelect.d.ts +17 -7
- package/esm/core/LabeledSelect/LabeledSelect.js +37 -18
- package/esm/core/LabeledTextarea/LabeledTextarea.d.ts +15 -5
- package/esm/core/LabeledTextarea/LabeledTextarea.js +14 -45
- package/esm/core/Menu/Menu.d.ts +1 -1
- package/esm/core/Menu/Menu.js +1 -1
- package/esm/core/Menu/MenuDivider.d.ts +2 -1
- package/esm/core/Menu/MenuDivider.js +1 -1
- package/esm/core/Menu/MenuItem.d.ts +1 -1
- package/esm/core/Menu/MenuItem.js +1 -0
- package/esm/core/Menu/MenuItemSkeleton.d.ts +1 -1
- package/esm/core/Menu/MenuItemSkeleton.js +0 -1
- package/esm/core/ProgressIndicators/ProgressLinear.d.ts +4 -0
- package/esm/core/ProgressIndicators/ProgressLinear.js +9 -1
- package/esm/core/SearchBox/SearchBox.js +1 -1
- package/esm/core/Select/Select.d.ts +4 -0
- package/esm/core/Select/Select.js +12 -11
- package/esm/core/SideNavigation/SideNavigation.d.ts +16 -0
- package/esm/core/SideNavigation/SideNavigation.js +33 -9
- package/esm/core/Slider/Slider.d.ts +24 -0
- package/esm/core/Slider/Slider.js +43 -10
- package/esm/core/Slider/Thumb.js +3 -2
- package/esm/core/Slider/Track.d.ts +1 -1
- package/esm/core/Slider/Track.js +14 -6
- package/esm/core/StatusMessage/StatusMessage.d.ts +12 -2
- package/esm/core/StatusMessage/StatusMessage.js +23 -16
- package/esm/core/Stepper/Stepper.d.ts +26 -1
- package/esm/core/Stepper/Stepper.js +32 -6
- package/esm/core/Stepper/StepperStep.d.ts +17 -0
- package/esm/core/Stepper/StepperStep.js +27 -8
- package/esm/core/Stepper/WorkflowDiagram.d.ts +11 -1
- package/esm/core/Stepper/WorkflowDiagram.js +10 -7
- package/esm/core/Stepper/WorkflowDiagramStep.d.ts +6 -1
- package/esm/core/Stepper/WorkflowDiagramStep.js +6 -2
- package/esm/core/Table/SubRowExpander.js +3 -1
- package/esm/core/Table/Table.js +0 -1
- package/esm/core/Table/TableCell.js +1 -1
- package/esm/core/Table/TablePaginator.js +2 -3
- package/esm/core/Table/filters/DateRangeFilter/DatePickerInput.d.ts +6 -1
- package/esm/core/Table/filters/DateRangeFilter/DatePickerInput.js +45 -17
- package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.d.ts +2 -0
- package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.js +2 -0
- package/esm/core/Tabs/Tab.js +2 -3
- package/esm/core/Textarea/Textarea.d.ts +7 -1
- package/esm/core/Textarea/Textarea.js +6 -11
- package/esm/core/ThemeProvider/ThemeContext.d.ts +1 -1
- package/esm/core/ThemeProvider/ThemeProvider.d.ts +23 -3
- package/esm/core/ThemeProvider/ThemeProvider.js +65 -24
- package/esm/core/Tile/Tile.d.ts +142 -17
- package/esm/core/Tile/Tile.js +107 -16
- package/esm/core/Toast/Toast.d.ts +12 -4
- package/esm/core/Toast/Toast.js +26 -13
- package/esm/core/Tooltip/Tooltip.d.ts +35 -28
- package/esm/core/Tooltip/Tooltip.js +119 -116
- package/esm/core/TransferList/TransferList.js +4 -9
- package/esm/core/Tree/TreeNode.js +1 -1
- package/esm/core/index.d.ts +2 -0
- package/esm/core/index.js +2 -0
- package/esm/core/utils/components/ButtonBase.d.ts +14 -0
- package/esm/core/utils/components/ButtonBase.js +42 -0
- package/esm/core/utils/components/Icon.d.ts +5 -0
- package/esm/core/utils/components/Icon.js +8 -1
- package/esm/core/utils/components/InputContainer.d.ts +0 -1
- package/esm/core/utils/components/InputContainer.js +14 -30
- package/esm/core/utils/components/InputFlexContainer.d.ts +1 -0
- package/esm/core/utils/components/InputFlexContainer.js +3 -1
- package/esm/core/utils/components/Popover.js +5 -3
- package/esm/core/utils/components/Portal.d.ts +27 -0
- package/esm/core/utils/components/Portal.js +36 -0
- package/esm/core/utils/components/VirtualScroll.js +4 -4
- package/esm/core/utils/components/index.d.ts +2 -0
- package/esm/core/utils/components/index.js +2 -0
- package/esm/core/utils/functions/colors.d.ts +1 -1
- package/esm/core/utils/functions/colors.js +1 -13
- package/esm/core/utils/functions/index.d.ts +1 -0
- package/esm/core/utils/functions/index.js +1 -0
- package/esm/core/utils/functions/react.d.ts +8 -0
- package/esm/core/utils/functions/react.js +35 -0
- package/esm/core/utils/hooks/index.d.ts +1 -0
- package/esm/core/utils/hooks/index.js +1 -0
- package/esm/core/utils/hooks/useControlledState.d.ts +13 -0
- package/esm/core/utils/hooks/useControlledState.js +34 -0
- package/esm/core/utils/hooks/useGlobals.d.ts +1 -1
- package/esm/styles.js +11 -35
- package/package.json +3 -3
- package/styles.css +49 -46
|
@@ -25,8 +25,7 @@ export declare const comboBoxReducer: (state: {
|
|
|
25
25
|
};
|
|
26
26
|
export declare const ComboBoxRefsContext: React.Context<{
|
|
27
27
|
inputRef: React.RefObject<HTMLInputElement>;
|
|
28
|
-
menuRef: React.RefObject<
|
|
29
|
-
toggleButtonRef: React.RefObject<HTMLSpanElement>;
|
|
28
|
+
menuRef: React.RefObject<HTMLElement>;
|
|
30
29
|
optionsExtraInfoRef: React.MutableRefObject<Record<string, {
|
|
31
30
|
__originalIndex: number;
|
|
32
31
|
}>>;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
import type { PolymorphicForwardRefComponent } from '../utils/index.js';
|
|
2
3
|
import type { TimePickerProps } from '../TimePicker/TimePicker.js';
|
|
4
|
+
export type DatePickerLocalizedNames = {
|
|
5
|
+
[key in 'months' | 'shortDays' | 'days']: string[];
|
|
6
|
+
};
|
|
3
7
|
/**
|
|
4
8
|
* Generate localized months and days strings using `Intl.DateTimeFormat` for passed locale to use in DatePicker component.
|
|
5
9
|
* If locale is not passed, browser locale will be used.
|
|
6
10
|
*/
|
|
7
|
-
export declare const generateLocalizedStrings: (locale?: string) =>
|
|
8
|
-
months: string[];
|
|
9
|
-
shortDays: string[];
|
|
10
|
-
days: string[];
|
|
11
|
-
};
|
|
11
|
+
export declare const generateLocalizedStrings: (locale?: string) => DatePickerLocalizedNames;
|
|
12
12
|
export type DateRangePickerProps = {
|
|
13
13
|
/**
|
|
14
14
|
* Enable date range support.
|
|
@@ -42,9 +42,7 @@ type DatePickerProps = {
|
|
|
42
42
|
* Pass localized week days (start from sunday) and months.
|
|
43
43
|
* Use helper function `generateLocalizedStrings` to generate strings using `Intl.DateTimeFormat`.
|
|
44
44
|
*/
|
|
45
|
-
localizedNames?:
|
|
46
|
-
[key in 'months' | 'shortDays' | 'days']: string[];
|
|
47
|
-
};
|
|
45
|
+
localizedNames?: DatePickerLocalizedNames;
|
|
48
46
|
/**
|
|
49
47
|
* Set focus on selected day or today.
|
|
50
48
|
* @default false
|
|
@@ -60,6 +58,30 @@ type DatePickerProps = {
|
|
|
60
58
|
* @default false
|
|
61
59
|
*/
|
|
62
60
|
showYearSelection?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Allows props to be passed for calendar month year, referring to the div that wraps around the month/year and the next/previous buttons.
|
|
63
|
+
*/
|
|
64
|
+
monthYearProps?: React.ComponentProps<'div'>;
|
|
65
|
+
/**
|
|
66
|
+
* Allows props to be passed for only month, referring to span that wraps around the month title.
|
|
67
|
+
*/
|
|
68
|
+
monthProps?: React.ComponentProps<'span'>;
|
|
69
|
+
/**
|
|
70
|
+
* Allows props to be passed for week days, referring to div that wraps around the week day title.
|
|
71
|
+
*/
|
|
72
|
+
weekDayProps?: React.ComponentProps<'div'>;
|
|
73
|
+
/**
|
|
74
|
+
* Allows props to be passed for individual day , referring to div element the wraps around single day number.
|
|
75
|
+
*/
|
|
76
|
+
dayProps?: React.ComponentProps<'div'>;
|
|
77
|
+
/**
|
|
78
|
+
* Allows props to be passed for calendar, referring to div that is used for listbox for wraping days and weeks.
|
|
79
|
+
*/
|
|
80
|
+
calendarProps?: React.ComponentProps<'div'>;
|
|
81
|
+
/**
|
|
82
|
+
* Allows props to be passed for weeks, referring to div that wraps around weeks.
|
|
83
|
+
*/
|
|
84
|
+
weekProps?: React.ComponentProps<'div'>;
|
|
63
85
|
/**
|
|
64
86
|
* Will disable dates for which this function returns true.
|
|
65
87
|
* Disabled dates cannot be selected.
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
SvgChevronRightDouble,
|
|
12
12
|
isBefore,
|
|
13
13
|
Box,
|
|
14
|
+
useId,
|
|
14
15
|
} from '../utils/index.js';
|
|
15
16
|
import { IconButton } from '../Buttons/IconButton/index.js';
|
|
16
17
|
import { TimePicker } from '../TimePicker/index.js';
|
|
@@ -141,6 +142,12 @@ export const DatePicker = React.forwardRef((props, forwardedRef) => {
|
|
|
141
142
|
enableRangeSelect = false,
|
|
142
143
|
startDate,
|
|
143
144
|
endDate,
|
|
145
|
+
monthYearProps,
|
|
146
|
+
calendarProps,
|
|
147
|
+
monthProps,
|
|
148
|
+
weekDayProps,
|
|
149
|
+
dayProps,
|
|
150
|
+
weekProps,
|
|
144
151
|
isDateDisabled,
|
|
145
152
|
...rest
|
|
146
153
|
} = props;
|
|
@@ -409,6 +416,7 @@ export const DatePicker = React.forwardRef((props, forwardedRef) => {
|
|
|
409
416
|
}
|
|
410
417
|
return dayClass;
|
|
411
418
|
};
|
|
419
|
+
const dateTableId = useId();
|
|
412
420
|
return React.createElement(
|
|
413
421
|
Box,
|
|
414
422
|
{ className: cx('iui-date-picker', className), ref: forwardedRef, ...rest },
|
|
@@ -417,7 +425,11 @@ export const DatePicker = React.forwardRef((props, forwardedRef) => {
|
|
|
417
425
|
null,
|
|
418
426
|
React.createElement(
|
|
419
427
|
Box,
|
|
420
|
-
{
|
|
428
|
+
{
|
|
429
|
+
as: 'div',
|
|
430
|
+
...monthYearProps,
|
|
431
|
+
className: cx('iui-calendar-month-year', monthYearProps?.className),
|
|
432
|
+
},
|
|
421
433
|
showYearSelection &&
|
|
422
434
|
React.createElement(
|
|
423
435
|
IconButton,
|
|
@@ -446,8 +458,10 @@ export const DatePicker = React.forwardRef((props, forwardedRef) => {
|
|
|
446
458
|
Box,
|
|
447
459
|
{
|
|
448
460
|
as: 'span',
|
|
449
|
-
|
|
461
|
+
id: dateTableId,
|
|
450
462
|
title: monthNames[displayedMonthIndex],
|
|
463
|
+
...monthProps,
|
|
464
|
+
className: cx('iui-calendar-month', monthProps?.className),
|
|
451
465
|
},
|
|
452
466
|
monthNames[displayedMonthIndex],
|
|
453
467
|
),
|
|
@@ -478,20 +492,31 @@ export const DatePicker = React.forwardRef((props, forwardedRef) => {
|
|
|
478
492
|
),
|
|
479
493
|
React.createElement(
|
|
480
494
|
Box,
|
|
481
|
-
{
|
|
495
|
+
{
|
|
496
|
+
as: 'div',
|
|
497
|
+
...weekDayProps,
|
|
498
|
+
className: cx('iui-calendar-weekdays', weekDayProps?.className),
|
|
499
|
+
},
|
|
482
500
|
shortDays.map((day, index) =>
|
|
483
501
|
React.createElement('div', { key: day, title: longDays[index] }, day),
|
|
484
502
|
),
|
|
485
503
|
),
|
|
486
504
|
React.createElement(
|
|
487
505
|
'div',
|
|
488
|
-
{
|
|
506
|
+
{
|
|
507
|
+
onKeyDown: handleCalendarKeyDown,
|
|
508
|
+
role: 'listbox',
|
|
509
|
+
'aria-labelledby': dateTableId,
|
|
510
|
+
...calendarProps,
|
|
511
|
+
},
|
|
489
512
|
weeks.map((weekDays, weekIndex) => {
|
|
490
513
|
return React.createElement(
|
|
491
514
|
Box,
|
|
492
515
|
{
|
|
516
|
+
as: 'div',
|
|
493
517
|
key: `week-${displayedMonthIndex}-${weekIndex}`,
|
|
494
|
-
|
|
518
|
+
...weekProps,
|
|
519
|
+
className: cx('iui-calendar-week', weekProps?.className),
|
|
495
520
|
},
|
|
496
521
|
weekDays.map((weekDay, dayIndex) => {
|
|
497
522
|
const dateValue = weekDay.getDate();
|
|
@@ -499,8 +524,8 @@ export const DatePicker = React.forwardRef((props, forwardedRef) => {
|
|
|
499
524
|
return React.createElement(
|
|
500
525
|
Box,
|
|
501
526
|
{
|
|
527
|
+
as: 'div',
|
|
502
528
|
key: `day-${displayedMonthIndex}-${dayIndex}`,
|
|
503
|
-
className: getDayClass(weekDay),
|
|
504
529
|
onClick: () => !isDisabled && onDayClick(weekDay),
|
|
505
530
|
role: 'option',
|
|
506
531
|
tabIndex: isSameDay(weekDay, focusedDay) ? 0 : -1,
|
|
@@ -509,6 +534,8 @@ export const DatePicker = React.forwardRef((props, forwardedRef) => {
|
|
|
509
534
|
isSameDay(weekDay, focusedDay) &&
|
|
510
535
|
needFocus.current &&
|
|
511
536
|
element?.focus(),
|
|
537
|
+
...dayProps,
|
|
538
|
+
className: cx(getDayClass(weekDay), dayProps?.className),
|
|
512
539
|
},
|
|
513
540
|
dateValue,
|
|
514
541
|
);
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as React from 'react';
|
|
6
|
-
import * as ReactDOM from 'react-dom';
|
|
7
6
|
import cx from 'classnames';
|
|
8
7
|
import { DialogTitleBar } from './DialogTitleBar.js';
|
|
9
8
|
import { DialogContent } from './DialogContent.js';
|
|
@@ -11,13 +10,7 @@ import { DialogBackdrop } from './DialogBackdrop.js';
|
|
|
11
10
|
import { DialogContext } from './DialogContext.js';
|
|
12
11
|
import { DialogButtonBar } from './DialogButtonBar.js';
|
|
13
12
|
import { DialogMain } from './DialogMain.js';
|
|
14
|
-
import {
|
|
15
|
-
useMergedRefs,
|
|
16
|
-
Box,
|
|
17
|
-
useGlobals,
|
|
18
|
-
getDocument,
|
|
19
|
-
useIsClient,
|
|
20
|
-
} from '../utils/index.js';
|
|
13
|
+
import { useMergedRefs, Box, Portal } from '../utils/index.js';
|
|
21
14
|
const DialogComponent = React.forwardRef((props, ref) => {
|
|
22
15
|
const {
|
|
23
16
|
trapFocus = false,
|
|
@@ -37,20 +30,6 @@ const DialogComponent = React.forwardRef((props, ref) => {
|
|
|
37
30
|
...rest
|
|
38
31
|
} = props;
|
|
39
32
|
const dialogRootRef = React.useRef(null);
|
|
40
|
-
const context = useGlobals();
|
|
41
|
-
const isClient = useIsClient();
|
|
42
|
-
const portalTo =
|
|
43
|
-
typeof portal !== 'boolean'
|
|
44
|
-
? portal.to
|
|
45
|
-
: portal
|
|
46
|
-
? context?.portalContainerRef?.current ?? getDocument()?.body
|
|
47
|
-
: null;
|
|
48
|
-
const dialog = React.createElement(Box, {
|
|
49
|
-
className: cx('iui-dialog-wrapper', className),
|
|
50
|
-
'data-iui-relative': relativeTo === 'container',
|
|
51
|
-
ref: useMergedRefs(ref, dialogRootRef),
|
|
52
|
-
...rest,
|
|
53
|
-
});
|
|
54
33
|
return React.createElement(
|
|
55
34
|
DialogContext.Provider,
|
|
56
35
|
{
|
|
@@ -70,7 +49,16 @@ const DialogComponent = React.forwardRef((props, ref) => {
|
|
|
70
49
|
placement,
|
|
71
50
|
},
|
|
72
51
|
},
|
|
73
|
-
|
|
52
|
+
React.createElement(
|
|
53
|
+
Portal,
|
|
54
|
+
{ portal: portal },
|
|
55
|
+
React.createElement(Box, {
|
|
56
|
+
className: cx('iui-dialog-wrapper', className),
|
|
57
|
+
'data-iui-relative': relativeTo === 'container',
|
|
58
|
+
ref: useMergedRefs(ref, dialogRootRef),
|
|
59
|
+
...rest,
|
|
60
|
+
}),
|
|
61
|
+
),
|
|
74
62
|
);
|
|
75
63
|
});
|
|
76
64
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import type { PortalProps } from '../utils/index.js';
|
|
2
3
|
export type DialogContextProps = {
|
|
3
4
|
/**
|
|
4
5
|
* Flag whether dialog should be shown.
|
|
@@ -67,11 +68,9 @@ export type DialogContextProps = {
|
|
|
67
68
|
*
|
|
68
69
|
* Can be set to an object with a `to` property to portal into a specific element.
|
|
69
70
|
*
|
|
70
|
-
*
|
|
71
|
+
* Defaults to false if using `Dialog` and true if using `Modal`.
|
|
71
72
|
*/
|
|
72
|
-
portal?:
|
|
73
|
-
to: HTMLElement;
|
|
74
|
-
};
|
|
73
|
+
portal?: PortalProps['portal'];
|
|
75
74
|
/**
|
|
76
75
|
* Dialog root ref. For internal use.
|
|
77
76
|
*/
|
|
@@ -121,10 +121,10 @@ export const DialogMain = React.forwardRef((props, ref) => {
|
|
|
121
121
|
const [translateX, translateY] = getTranslateValues(dialogRef.current);
|
|
122
122
|
setStyle((oldStyle) => ({
|
|
123
123
|
...oldStyle,
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
124
|
+
inlineSize: rect?.width,
|
|
125
|
+
blockSize: rect?.height,
|
|
126
|
+
insetInlineStart: dialogRef.current?.offsetLeft,
|
|
127
|
+
insetBlockStart: dialogRef.current?.offsetTop,
|
|
128
128
|
transform: `translate(${translateX}px,${translateY}px)`,
|
|
129
129
|
}));
|
|
130
130
|
}, [isDraggable, isOpen]);
|
|
@@ -166,7 +166,7 @@ export const DialogMain = React.forwardRef((props, ref) => {
|
|
|
166
166
|
onResizeStart: () => {
|
|
167
167
|
if (!hasBeenResized.current) {
|
|
168
168
|
hasBeenResized.current = true;
|
|
169
|
-
setResizeStyle({
|
|
169
|
+
setResizeStyle({ maxInlineSize: '100%' });
|
|
170
170
|
}
|
|
171
171
|
},
|
|
172
172
|
onResizeEnd: setResizeStyle,
|
|
@@ -36,9 +36,11 @@ type ExpandableBlockOwnProps = {
|
|
|
36
36
|
*/
|
|
37
37
|
disabled?: boolean;
|
|
38
38
|
};
|
|
39
|
-
type
|
|
39
|
+
type ExpandableBlockTriggerOwnProps = {
|
|
40
40
|
label?: React.ReactNode;
|
|
41
|
+
caption?: React.ReactNode;
|
|
41
42
|
expandIcon?: React.ReactNode;
|
|
43
|
+
endIcon?: React.ReactNode;
|
|
42
44
|
};
|
|
43
45
|
type ExpandableBlockContentOwnProps = {
|
|
44
46
|
innerProps?: React.ComponentPropsWithoutRef<'div'>;
|
|
@@ -46,29 +48,32 @@ type ExpandableBlockContentOwnProps = {
|
|
|
46
48
|
/**
|
|
47
49
|
* Expandable block with customizable Title, Caption, Content and EndIcon subcomponents.
|
|
48
50
|
* @example
|
|
49
|
-
* <ExpandableBlock>
|
|
50
|
-
* <ExpandableBlock.
|
|
51
|
+
* <ExpandableBlock.Wrapper>
|
|
52
|
+
* <ExpandableBlock.Trigger>
|
|
51
53
|
* <ExpandableBlock.ExpandIcon/>
|
|
52
54
|
* <ExpandableBlock.LabelArea>
|
|
53
55
|
* <ExpandableBlock.Title/>
|
|
54
56
|
* <ExpandableBlock.Caption/>
|
|
55
57
|
* </ExpandableBlock.LabelArea>
|
|
56
58
|
* <ExpandableBlock.EndIcon/>
|
|
57
|
-
* </ExpandableBlock.
|
|
59
|
+
* </ExpandableBlock.Trigger>
|
|
58
60
|
* <ExpandableBlock.Content/>
|
|
59
|
-
* </ExpandableBlock>
|
|
61
|
+
* </ExpandableBlock.Wrapper>
|
|
60
62
|
*/
|
|
61
|
-
export declare const ExpandableBlock: PolymorphicForwardRefComponent<"div", ExpandableBlockOwnProps
|
|
63
|
+
export declare const ExpandableBlock: PolymorphicForwardRefComponent<"div", ExpandableBlockOwnProps & {
|
|
64
|
+
title?: React.ReactNode;
|
|
65
|
+
} & Pick<ExpandableBlockTriggerOwnProps, "caption" | "endIcon">> & {
|
|
66
|
+
Wrapper: PolymorphicForwardRefComponent<"div", ExpandableBlockOwnProps>;
|
|
62
67
|
/**
|
|
63
68
|
* `Header` container that contains `ExpandIcon`, `LabelArea` and `EndIcon` subcomponents
|
|
64
69
|
* @example
|
|
65
|
-
* <ExpandableBlock.
|
|
70
|
+
* <ExpandableBlock.Trigger>
|
|
66
71
|
* <ExpandableBlock.ExpandIcon/>
|
|
67
72
|
* <ExpandableBlock.LabelArea/>
|
|
68
73
|
* <ExpandableBlock.EndIcon/>
|
|
69
|
-
* </ExpandableBlock.
|
|
74
|
+
* </ExpandableBlock.Trigger>
|
|
70
75
|
*/
|
|
71
|
-
|
|
76
|
+
Trigger: PolymorphicForwardRefComponent<"button", ExpandableBlockTriggerOwnProps>;
|
|
72
77
|
/**
|
|
73
78
|
* The expanding icon on the left of header
|
|
74
79
|
*/
|
|
@@ -94,24 +99,25 @@ export declare const ExpandableBlock: PolymorphicForwardRefComponent<"div", Expa
|
|
|
94
99
|
* Svg icon displayed at the end of the main text.
|
|
95
100
|
* Will override status icon if specified. Used inside `Header` subcomponent.
|
|
96
101
|
* @example
|
|
97
|
-
* <ExpandableBlock.
|
|
102
|
+
* <ExpandableBlock.Trigger>
|
|
98
103
|
* <ExpandableBlock.EndIcon> <SvgIcon/> </ExpandableBlock.EndIcon>
|
|
99
|
-
* <ExpandableBlock.
|
|
104
|
+
* <ExpandableBlock.Trigger/>
|
|
100
105
|
*/
|
|
101
106
|
EndIcon: PolymorphicForwardRefComponent<"span", Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
|
|
102
107
|
ref?: ((instance: HTMLSpanElement | null) => void) | React.RefObject<HTMLSpanElement> | null | undefined;
|
|
103
|
-
}, "fill" | "as" | "key" | "size" | keyof React.HTMLAttributes<HTMLSpanElement
|
|
108
|
+
}, "fill" | "as" | "key" | "size" | keyof React.HTMLAttributes<HTMLSpanElement> | "padded"> & {
|
|
104
109
|
size?: "small" | "large" | "auto" | "medium" | import("../utils/types.js").AnyString | undefined;
|
|
105
110
|
fill?: "default" | "informational" | "negative" | "positive" | "warning" | import("../utils/types.js").AnyString | undefined;
|
|
111
|
+
padded?: boolean | undefined;
|
|
106
112
|
} & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
|
|
107
113
|
as?: "span" | undefined;
|
|
108
114
|
}, "ref">>;
|
|
109
115
|
/**
|
|
110
116
|
* Content shown in the block's body when fully expanded.
|
|
111
117
|
* @example
|
|
112
|
-
* <ExpandableBlock>
|
|
118
|
+
* <ExpandableBlock.Wrapper>
|
|
113
119
|
* <ExpandableBlock.Content> Content </ExpandableBlock.Content>
|
|
114
|
-
* </ExpandableBlock>
|
|
120
|
+
* </ExpandableBlock.Wrapper>
|
|
115
121
|
*/
|
|
116
122
|
Content: PolymorphicForwardRefComponent<"div", ExpandableBlockContentOwnProps>;
|
|
117
123
|
};
|
|
@@ -12,10 +12,26 @@ import {
|
|
|
12
12
|
useSafeContext,
|
|
13
13
|
polymorphic,
|
|
14
14
|
mergeEventHandlers,
|
|
15
|
+
ButtonBase,
|
|
15
16
|
} from '../utils/index.js';
|
|
16
17
|
const ExpandableBlockContext = React.createContext(undefined);
|
|
17
18
|
ExpandableBlockContext.displayName = 'ExpandableBlockContext';
|
|
18
19
|
const ExpandableBlockComponent = React.forwardRef((props, forwardedRef) => {
|
|
20
|
+
const { children, title, caption, endIcon, ...rest } = props;
|
|
21
|
+
return React.createElement(
|
|
22
|
+
ExpandableBlock.Wrapper,
|
|
23
|
+
{ ...rest, ref: forwardedRef },
|
|
24
|
+
React.createElement(ExpandableBlock.Trigger, {
|
|
25
|
+
label: title,
|
|
26
|
+
caption: caption,
|
|
27
|
+
endIcon: endIcon,
|
|
28
|
+
}),
|
|
29
|
+
React.createElement(ExpandableBlock.Content, null, children),
|
|
30
|
+
);
|
|
31
|
+
});
|
|
32
|
+
ExpandableBlockComponent.displayName = 'ExpandableBlock';
|
|
33
|
+
// ----------------------------------------------------------------------------
|
|
34
|
+
const ExpandableBlockWrapper = React.forwardRef((props, forwardedRef) => {
|
|
19
35
|
const {
|
|
20
36
|
children,
|
|
21
37
|
className,
|
|
@@ -59,24 +75,23 @@ const ExpandableBlockComponent = React.forwardRef((props, forwardedRef) => {
|
|
|
59
75
|
),
|
|
60
76
|
);
|
|
61
77
|
});
|
|
62
|
-
|
|
63
|
-
const
|
|
78
|
+
ExpandableBlockWrapper.displayName = 'ExpandableBlock.Wrapper';
|
|
79
|
+
const ExpandableBlockTrigger = React.forwardRef((props, forwardedRef) => {
|
|
64
80
|
const {
|
|
65
81
|
className,
|
|
66
82
|
children,
|
|
67
83
|
label,
|
|
84
|
+
caption,
|
|
68
85
|
onClick: onClickProp,
|
|
69
86
|
expandIcon,
|
|
87
|
+
endIcon,
|
|
70
88
|
...rest
|
|
71
89
|
} = props;
|
|
72
|
-
const { isExpanded, setExpanded, disabled, onToggle } =
|
|
73
|
-
ExpandableBlockContext
|
|
74
|
-
);
|
|
90
|
+
const { isExpanded, setExpanded, disabled, onToggle, status } =
|
|
91
|
+
useSafeContext(ExpandableBlockContext);
|
|
75
92
|
return React.createElement(
|
|
76
|
-
|
|
93
|
+
ButtonBase,
|
|
77
94
|
{
|
|
78
|
-
as: 'button',
|
|
79
|
-
type: 'button',
|
|
80
95
|
className: cx('iui-expandable-header', className),
|
|
81
96
|
'aria-expanded': isExpanded,
|
|
82
97
|
'aria-disabled': disabled,
|
|
@@ -99,11 +114,16 @@ const ExpandableBlockHeader = React.forwardRef((props, forwardedRef) => {
|
|
|
99
114
|
ExpandableBlock.LabelArea,
|
|
100
115
|
null,
|
|
101
116
|
React.createElement(ExpandableBlock.Title, null, label),
|
|
117
|
+
caption &&
|
|
118
|
+
React.createElement(ExpandableBlock.Caption, null, caption),
|
|
102
119
|
),
|
|
120
|
+
endIcon || status
|
|
121
|
+
? React.createElement(ExpandableBlock.EndIcon, null, endIcon)
|
|
122
|
+
: null,
|
|
103
123
|
),
|
|
104
124
|
);
|
|
105
125
|
});
|
|
106
|
-
|
|
126
|
+
ExpandableBlockTrigger.displayName = 'ExpandableBlock.Trigger';
|
|
107
127
|
// ----------------------------------------------------------------------------
|
|
108
128
|
// ExpandableBlock.ExpandIcon component
|
|
109
129
|
const ExpandableBlockExpandIcon = React.forwardRef((props, forwardedRef) => {
|
|
@@ -171,29 +191,30 @@ ExpandableBlockContent.displayName = 'ExpandableBlock.Content';
|
|
|
171
191
|
/**
|
|
172
192
|
* Expandable block with customizable Title, Caption, Content and EndIcon subcomponents.
|
|
173
193
|
* @example
|
|
174
|
-
* <ExpandableBlock>
|
|
175
|
-
* <ExpandableBlock.
|
|
194
|
+
* <ExpandableBlock.Wrapper>
|
|
195
|
+
* <ExpandableBlock.Trigger>
|
|
176
196
|
* <ExpandableBlock.ExpandIcon/>
|
|
177
197
|
* <ExpandableBlock.LabelArea>
|
|
178
198
|
* <ExpandableBlock.Title/>
|
|
179
199
|
* <ExpandableBlock.Caption/>
|
|
180
200
|
* </ExpandableBlock.LabelArea>
|
|
181
201
|
* <ExpandableBlock.EndIcon/>
|
|
182
|
-
* </ExpandableBlock.
|
|
202
|
+
* </ExpandableBlock.Trigger>
|
|
183
203
|
* <ExpandableBlock.Content/>
|
|
184
|
-
* </ExpandableBlock>
|
|
204
|
+
* </ExpandableBlock.Wrapper>
|
|
185
205
|
*/
|
|
186
206
|
export const ExpandableBlock = Object.assign(ExpandableBlockComponent, {
|
|
207
|
+
Wrapper: ExpandableBlockWrapper,
|
|
187
208
|
/**
|
|
188
209
|
* `Header` container that contains `ExpandIcon`, `LabelArea` and `EndIcon` subcomponents
|
|
189
210
|
* @example
|
|
190
|
-
* <ExpandableBlock.
|
|
211
|
+
* <ExpandableBlock.Trigger>
|
|
191
212
|
* <ExpandableBlock.ExpandIcon/>
|
|
192
213
|
* <ExpandableBlock.LabelArea/>
|
|
193
214
|
* <ExpandableBlock.EndIcon/>
|
|
194
|
-
* </ExpandableBlock.
|
|
215
|
+
* </ExpandableBlock.Trigger>
|
|
195
216
|
*/
|
|
196
|
-
|
|
217
|
+
Trigger: ExpandableBlockTrigger,
|
|
197
218
|
/**
|
|
198
219
|
* The expanding icon on the left of header
|
|
199
220
|
*/
|
|
@@ -219,17 +240,17 @@ export const ExpandableBlock = Object.assign(ExpandableBlockComponent, {
|
|
|
219
240
|
* Svg icon displayed at the end of the main text.
|
|
220
241
|
* Will override status icon if specified. Used inside `Header` subcomponent.
|
|
221
242
|
* @example
|
|
222
|
-
* <ExpandableBlock.
|
|
243
|
+
* <ExpandableBlock.Trigger>
|
|
223
244
|
* <ExpandableBlock.EndIcon> <SvgIcon/> </ExpandableBlock.EndIcon>
|
|
224
|
-
* <ExpandableBlock.
|
|
245
|
+
* <ExpandableBlock.Trigger/>
|
|
225
246
|
*/
|
|
226
247
|
EndIcon: ExpandableBlockEndIcon,
|
|
227
248
|
/**
|
|
228
249
|
* Content shown in the block's body when fully expanded.
|
|
229
250
|
* @example
|
|
230
|
-
* <ExpandableBlock>
|
|
251
|
+
* <ExpandableBlock.Wrapper>
|
|
231
252
|
* <ExpandableBlock.Content> Content </ExpandableBlock.Content>
|
|
232
|
-
* </ExpandableBlock>
|
|
253
|
+
* </ExpandableBlock.Wrapper>
|
|
233
254
|
*/
|
|
234
255
|
Content: ExpandableBlockContent,
|
|
235
256
|
});
|
|
@@ -15,6 +15,10 @@ type FileUploadProps = {
|
|
|
15
15
|
* Either pass `FileUploadCard` (for default state) or a different component to wrap.
|
|
16
16
|
*/
|
|
17
17
|
children: React.ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* Allows for custom prop to be passed for content.
|
|
20
|
+
*/
|
|
21
|
+
contentProps?: React.ComponentProps<'div'>;
|
|
18
22
|
};
|
|
19
23
|
/**
|
|
20
24
|
* File upload component to be wrapped around `FileUploadCard` or any arbitrary component.
|
|
@@ -13,7 +13,14 @@ import { Box, useMergedRefs } from '../utils/index.js';
|
|
|
13
13
|
* <FileUpload dragContent='Drop file here' onFileDropped={console.log}><Textarea /></FileUpload>
|
|
14
14
|
*/
|
|
15
15
|
export const FileUpload = React.forwardRef((props, ref) => {
|
|
16
|
-
const {
|
|
16
|
+
const {
|
|
17
|
+
dragContent,
|
|
18
|
+
children,
|
|
19
|
+
onFileDropped,
|
|
20
|
+
className,
|
|
21
|
+
contentProps,
|
|
22
|
+
...rest
|
|
23
|
+
} = props;
|
|
17
24
|
const [isDragActive, setIsDragActive] = React.useState(false);
|
|
18
25
|
const fileUploadRef = React.useRef(null);
|
|
19
26
|
const refs = useMergedRefs(fileUploadRef, ref);
|
|
@@ -58,9 +65,25 @@ export const FileUpload = React.forwardRef((props, ref) => {
|
|
|
58
65
|
},
|
|
59
66
|
dragContent
|
|
60
67
|
? children
|
|
61
|
-
: React.createElement(
|
|
68
|
+
: React.createElement(
|
|
69
|
+
Box,
|
|
70
|
+
{
|
|
71
|
+
as: 'div',
|
|
72
|
+
...contentProps,
|
|
73
|
+
className: cx('iui-content', contentProps?.className),
|
|
74
|
+
},
|
|
75
|
+
children,
|
|
76
|
+
),
|
|
62
77
|
dragContent &&
|
|
63
|
-
React.createElement(
|
|
78
|
+
React.createElement(
|
|
79
|
+
Box,
|
|
80
|
+
{
|
|
81
|
+
as: 'div',
|
|
82
|
+
...contentProps,
|
|
83
|
+
className: cx('iui-content', contentProps?.className),
|
|
84
|
+
},
|
|
85
|
+
dragContent,
|
|
86
|
+
),
|
|
64
87
|
);
|
|
65
88
|
});
|
|
66
89
|
export default FileUpload;
|
|
@@ -4,30 +4,17 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import cx from 'classnames';
|
|
6
6
|
import * as React from 'react';
|
|
7
|
-
import {
|
|
7
|
+
import { ButtonBase } from '../utils/index.js';
|
|
8
8
|
export const HeaderBasicButton = React.forwardRef((props, ref) => {
|
|
9
|
-
const {
|
|
10
|
-
|
|
11
|
-
className,
|
|
12
|
-
children,
|
|
13
|
-
style,
|
|
14
|
-
startIcon,
|
|
15
|
-
endIcon,
|
|
16
|
-
styleType,
|
|
17
|
-
size,
|
|
18
|
-
...rest
|
|
19
|
-
} = props;
|
|
9
|
+
const { className, children, startIcon, endIcon, styleType, size, ...rest } =
|
|
10
|
+
props;
|
|
20
11
|
styleType; // To omit and prevent eslint error.
|
|
21
12
|
size; // To omit and prevent eslint error.
|
|
22
13
|
return React.createElement(
|
|
23
|
-
|
|
14
|
+
ButtonBase,
|
|
24
15
|
{
|
|
25
|
-
as: 'button',
|
|
26
16
|
className: cx('iui-header-breadcrumb-button', className),
|
|
27
|
-
onClick: onClick,
|
|
28
17
|
ref: ref,
|
|
29
|
-
type: 'button',
|
|
30
|
-
style: style,
|
|
31
18
|
...rest,
|
|
32
19
|
},
|
|
33
20
|
startIcon,
|
|
@@ -26,7 +26,7 @@ export const HeaderDropdownButton = React.forwardRef((props, ref) => {
|
|
|
26
26
|
DropdownMenu,
|
|
27
27
|
{
|
|
28
28
|
menuItems: menuItems,
|
|
29
|
-
style: {
|
|
29
|
+
style: { minInlineSize: menuWidth },
|
|
30
30
|
onShow: () => setIsMenuOpen(true),
|
|
31
31
|
onHide: () => setIsMenuOpen(false),
|
|
32
32
|
},
|
|
@@ -5,7 +5,12 @@
|
|
|
5
5
|
import cx from 'classnames';
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import { DropdownMenu } from '../DropdownMenu/index.js';
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
SvgCaretDownSmall,
|
|
10
|
+
SvgCaretUpSmall,
|
|
11
|
+
Box,
|
|
12
|
+
ButtonBase,
|
|
13
|
+
} from '../utils/index.js';
|
|
9
14
|
import { HeaderBasicButton } from './HeaderBasicButton.js';
|
|
10
15
|
export const HeaderSplitButton = React.forwardRef((props, forwardedRef) => {
|
|
11
16
|
const {
|
|
@@ -40,15 +45,14 @@ export const HeaderSplitButton = React.forwardRef((props, forwardedRef) => {
|
|
|
40
45
|
{
|
|
41
46
|
placement: menuPlacement,
|
|
42
47
|
menuItems: menuItems,
|
|
43
|
-
style: {
|
|
48
|
+
style: { minInlineSize: menuWidth },
|
|
44
49
|
onShow: React.useCallback(() => setIsMenuOpen(true), []),
|
|
45
50
|
onHide: React.useCallback(() => setIsMenuOpen(false), []),
|
|
46
51
|
},
|
|
47
52
|
React.createElement(
|
|
48
|
-
|
|
53
|
+
ButtonBase,
|
|
49
54
|
{
|
|
50
|
-
|
|
51
|
-
type: 'button',
|
|
55
|
+
'aria-label': 'More',
|
|
52
56
|
className:
|
|
53
57
|
'iui-header-breadcrumb-button iui-header-breadcrumb-button-split',
|
|
54
58
|
disabled: disabled,
|
|
@@ -4,6 +4,10 @@ export type InputProps = {
|
|
|
4
4
|
* Modify size of the input.
|
|
5
5
|
*/
|
|
6
6
|
size?: 'small' | 'large';
|
|
7
|
+
/**
|
|
8
|
+
* Status of input.
|
|
9
|
+
*/
|
|
10
|
+
status?: 'positive' | 'warning' | 'negative';
|
|
7
11
|
/**
|
|
8
12
|
* Modify the native `size` attribute of the `<input>` element.
|
|
9
13
|
* The `width` or `inline-size` property must be unset in order to use this prop.
|
package/esm/core/Input/Input.js
CHANGED
|
@@ -13,13 +13,14 @@ import { useMergedRefs, Box } from '../utils/index.js';
|
|
|
13
13
|
* <Input size='small' />
|
|
14
14
|
*/
|
|
15
15
|
export const Input = React.forwardRef((props, ref) => {
|
|
16
|
-
const { size, htmlSize, className, ...rest } = props;
|
|
16
|
+
const { size, htmlSize, status, className, ...rest } = props;
|
|
17
17
|
const inputRef = React.useRef(null);
|
|
18
18
|
const refs = useMergedRefs(inputRef, ref);
|
|
19
19
|
return React.createElement(Box, {
|
|
20
20
|
as: 'input',
|
|
21
21
|
className: cx('iui-input', className),
|
|
22
22
|
'data-iui-size': size,
|
|
23
|
+
'data-iui-status': status,
|
|
23
24
|
size: htmlSize,
|
|
24
25
|
ref: refs,
|
|
25
26
|
...rest,
|