@workday/canvas-kit-preview-react 8.0.0-alpha.253-next.22 → 8.0.0-alpha.428-next.2
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/color-picker/lib/ColorPicker.tsx +1 -1
- package/dist/commonjs/color-picker/lib/ColorPicker.js +25 -48
- package/dist/commonjs/color-picker/lib/parts/ColorReset.js +32 -23
- package/dist/commonjs/color-picker/lib/parts/SwatchBook.js +26 -39
- package/dist/commonjs/form-field/lib/FormField.d.ts +4 -10
- package/dist/commonjs/form-field/lib/FormField.d.ts.map +1 -1
- package/dist/commonjs/form-field/lib/FormField.js +10 -33
- package/dist/commonjs/form-field/lib/FormFieldHint.d.ts +1 -1
- package/dist/commonjs/form-field/lib/FormFieldHint.js +8 -31
- package/dist/commonjs/form-field/lib/FormFieldInput.d.ts +1 -1
- package/dist/commonjs/form-field/lib/FormFieldInput.js +6 -17
- package/dist/commonjs/form-field/lib/FormFieldLabel.d.ts +2 -8
- package/dist/commonjs/form-field/lib/FormFieldLabel.d.ts.map +1 -1
- package/dist/commonjs/form-field/lib/FormFieldLabel.js +8 -31
- package/dist/commonjs/form-field/lib/hooks/useFormFieldHint.d.ts +3 -5
- package/dist/commonjs/form-field/lib/hooks/useFormFieldHint.d.ts.map +1 -1
- package/dist/commonjs/form-field/lib/hooks/useFormFieldHint.js +4 -5
- package/dist/commonjs/form-field/lib/hooks/useFormFieldInput.d.ts +3 -5
- package/dist/commonjs/form-field/lib/hooks/useFormFieldInput.d.ts.map +1 -1
- package/dist/commonjs/form-field/lib/hooks/useFormFieldInput.js +5 -6
- package/dist/commonjs/form-field/lib/hooks/useFormFieldLabel.d.ts +3 -5
- package/dist/commonjs/form-field/lib/hooks/useFormFieldLabel.d.ts.map +1 -1
- package/dist/commonjs/form-field/lib/hooks/useFormFieldLabel.js +4 -5
- package/dist/commonjs/form-field/lib/hooks/useFormFieldModel.d.ts +2 -12
- package/dist/commonjs/form-field/lib/hooks/useFormFieldModel.d.ts.map +1 -1
- package/dist/commonjs/form-field/lib/hooks/useFormFieldModel.js +9 -19
- package/dist/commonjs/form-field/lib/hooks/useFormFieldOrientation.d.ts +4 -4
- package/dist/commonjs/form-field/lib/hooks/useFormFieldOrientation.d.ts.map +1 -1
- package/dist/commonjs/form-field/lib/hooks/useFormFieldOrientation.js +5 -5
- package/dist/commonjs/menu/lib/Menu.d.ts +16 -9
- package/dist/commonjs/menu/lib/Menu.d.ts.map +1 -1
- package/dist/commonjs/menu/lib/Menu.js +108 -132
- package/dist/commonjs/menu/lib/MenuItem.d.ts +17 -7
- package/dist/commonjs/menu/lib/MenuItem.d.ts.map +1 -1
- package/dist/commonjs/menu/lib/MenuItem.js +111 -114
- package/dist/commonjs/pill/lib/Pill.d.ts +103 -5
- package/dist/commonjs/pill/lib/Pill.d.ts.map +1 -1
- package/dist/commonjs/pill/lib/Pill.js +158 -64
- package/dist/commonjs/pill/lib/PillAvatar.js +6 -17
- package/dist/commonjs/pill/lib/PillCount.js +7 -30
- package/dist/commonjs/pill/lib/PillIcon.js +8 -31
- package/dist/commonjs/pill/lib/PillIconButton.js +13 -36
- package/dist/commonjs/pill/lib/PillLabel.js +10 -33
- package/dist/commonjs/pill/lib/usePillModel.js +8 -16
- package/dist/commonjs/segmented-control/index.d.ts +2 -0
- package/dist/commonjs/segmented-control/index.d.ts.map +1 -1
- package/dist/commonjs/segmented-control/index.js +4 -0
- package/dist/commonjs/segmented-control/lib/SegmentedControl.d.ts +267 -82
- package/dist/commonjs/segmented-control/lib/SegmentedControl.d.ts.map +1 -1
- package/dist/commonjs/segmented-control/lib/SegmentedControl.js +42 -7
- package/dist/commonjs/segmented-control/lib/SegmentedControlItem.d.ts +9 -5
- package/dist/commonjs/segmented-control/lib/SegmentedControlItem.d.ts.map +1 -1
- package/dist/commonjs/segmented-control/lib/SegmentedControlItem.js +24 -49
- package/dist/commonjs/segmented-control/lib/SegmentedControlList.d.ts +71 -2
- package/dist/commonjs/segmented-control/lib/SegmentedControlList.d.ts.map +1 -1
- package/dist/commonjs/segmented-control/lib/SegmentedControlList.js +15 -40
- package/dist/commonjs/segmented-control/lib/hooks/useSegmentedControlItem.d.ts +28 -9
- package/dist/commonjs/segmented-control/lib/hooks/useSegmentedControlItem.d.ts.map +1 -1
- package/dist/commonjs/segmented-control/lib/hooks/useSegmentedControlItem.js +8 -10
- package/dist/commonjs/segmented-control/lib/hooks/useSegmentedControlModel.d.ts +233 -83
- package/dist/commonjs/segmented-control/lib/hooks/useSegmentedControlModel.d.ts.map +1 -1
- package/dist/commonjs/segmented-control/lib/hooks/useSegmentedControlModel.js +33 -32
- package/dist/commonjs/select/lib/Select.js +147 -187
- package/dist/commonjs/select/lib/SelectBase.js +106 -101
- package/dist/commonjs/select/lib/SelectMenu.js +53 -84
- package/dist/commonjs/select/lib/SelectOption.js +33 -47
- package/dist/commonjs/select/lib/scrolling.js +6 -7
- package/dist/commonjs/select/lib/utils.js +4 -4
- package/dist/commonjs/side-panel/lib/SidePanel.d.ts +13 -26
- package/dist/commonjs/side-panel/lib/SidePanel.d.ts.map +1 -1
- package/dist/commonjs/side-panel/lib/SidePanel.js +95 -133
- package/dist/commonjs/side-panel/lib/SidePanelToggleButton.d.ts +17 -0
- package/dist/commonjs/side-panel/lib/SidePanelToggleButton.d.ts.map +1 -0
- package/dist/commonjs/side-panel/lib/SidePanelToggleButton.js +65 -0
- package/dist/commonjs/side-panel/lib/hooks.d.ts +20 -0
- package/dist/commonjs/side-panel/lib/hooks.d.ts.map +1 -1
- package/dist/commonjs/side-panel/lib/hooks.js +40 -21
- package/dist/commonjs/status-indicator/index.d.ts +2 -0
- package/dist/commonjs/status-indicator/index.d.ts.map +1 -1
- package/dist/commonjs/status-indicator/index.js +4 -0
- package/dist/commonjs/status-indicator/lib/StatusIndicator.d.ts +32 -8
- package/dist/commonjs/status-indicator/lib/StatusIndicator.d.ts.map +1 -1
- package/dist/commonjs/status-indicator/lib/StatusIndicator.js +37 -35
- package/dist/commonjs/status-indicator/lib/StatusIndicatorIcon.d.ts +10 -0
- package/dist/commonjs/status-indicator/lib/StatusIndicatorIcon.d.ts.map +1 -1
- package/dist/commonjs/status-indicator/lib/StatusIndicatorIcon.js +11 -23
- package/dist/commonjs/status-indicator/lib/StatusIndicatorLabel.js +5 -28
- package/dist/commonjs/status-indicator/lib/hooks/useStatusIndicatorModel.js +6 -15
- package/dist/commonjs/table/index.d.ts +2 -0
- package/dist/commonjs/table/index.d.ts.map +1 -0
- package/dist/commonjs/{text-area/lib/hooks → table}/index.js +1 -1
- package/dist/commonjs/table/lib/Table.d.ts +207 -0
- package/dist/commonjs/table/lib/Table.d.ts.map +1 -0
- package/dist/commonjs/table/lib/Table.js +229 -0
- package/dist/commonjs/table/lib/TableBody.d.ts +2 -0
- package/dist/commonjs/table/lib/TableBody.d.ts.map +1 -0
- package/dist/commonjs/table/lib/TableBody.js +35 -0
- package/dist/commonjs/table/lib/TableCaption.d.ts +2 -0
- package/dist/commonjs/table/lib/TableCaption.d.ts.map +1 -0
- package/dist/commonjs/table/lib/TableCaption.js +16 -0
- package/dist/commonjs/table/lib/TableCell.d.ts +2 -0
- package/dist/commonjs/table/lib/TableCell.d.ts.map +1 -0
- package/dist/commonjs/table/lib/TableCell.js +16 -0
- package/dist/commonjs/table/lib/TableFooter.d.ts +2 -0
- package/dist/commonjs/table/lib/TableFooter.d.ts.map +1 -0
- package/dist/commonjs/table/lib/TableFooter.js +15 -0
- package/dist/commonjs/table/lib/TableHead.d.ts +2 -0
- package/dist/commonjs/table/lib/TableHead.d.ts.map +1 -0
- package/dist/commonjs/table/lib/TableHead.js +23 -0
- package/dist/commonjs/table/lib/TableHeader.d.ts +2 -0
- package/dist/commonjs/table/lib/TableHeader.d.ts.map +1 -0
- package/dist/commonjs/table/lib/TableHeader.js +16 -0
- package/dist/commonjs/table/lib/TableRow.d.ts +2 -0
- package/dist/commonjs/table/lib/TableRow.d.ts.map +1 -0
- package/dist/commonjs/table/lib/TableRow.js +19 -0
- package/dist/commonjs/text-area/lib/TextArea.d.ts +2 -2
- package/dist/commonjs/text-area/lib/TextArea.d.ts.map +1 -1
- package/dist/commonjs/text-area/lib/TextArea.js +9 -33
- package/dist/commonjs/text-area/lib/TextAreaField.d.ts +1 -1
- package/dist/commonjs/text-area/lib/TextAreaField.d.ts.map +1 -1
- package/dist/commonjs/text-area/lib/TextAreaField.js +12 -36
- package/dist/commonjs/text-input/lib/TextInput.d.ts +4 -4
- package/dist/commonjs/text-input/lib/TextInput.d.ts.map +1 -1
- package/dist/commonjs/text-input/lib/TextInput.js +9 -33
- package/dist/commonjs/text-input/lib/TextInputField.d.ts +1 -1
- package/dist/commonjs/text-input/lib/TextInputField.d.ts.map +1 -1
- package/dist/commonjs/text-input/lib/TextInputField.js +13 -25
- package/dist/commonjs/text-input/lib/hooks/useTextInputField.d.ts +3 -5
- package/dist/commonjs/text-input/lib/hooks/useTextInputField.d.ts.map +1 -1
- package/dist/commonjs/text-input/lib/hooks/useTextInputField.js +3 -3
- package/dist/commonjs/text-input/lib/hooks/useTextInputModel.d.ts +1 -0
- package/dist/commonjs/text-input/lib/hooks/useTextInputModel.d.ts.map +1 -1
- package/dist/commonjs/text-input/lib/hooks/useTextInputModel.js +2 -1
- package/dist/es6/color-picker/lib/ColorPicker.js +16 -39
- package/dist/es6/color-picker/lib/parts/ColorReset.js +27 -18
- package/dist/es6/color-picker/lib/parts/SwatchBook.js +21 -34
- package/dist/es6/form-field/lib/FormField.d.ts +4 -10
- package/dist/es6/form-field/lib/FormField.d.ts.map +1 -1
- package/dist/es6/form-field/lib/FormField.js +5 -28
- package/dist/es6/form-field/lib/FormFieldHint.d.ts +1 -1
- package/dist/es6/form-field/lib/FormFieldHint.js +4 -27
- package/dist/es6/form-field/lib/FormFieldInput.d.ts +1 -1
- package/dist/es6/form-field/lib/FormFieldInput.js +3 -14
- package/dist/es6/form-field/lib/FormFieldLabel.d.ts +2 -8
- package/dist/es6/form-field/lib/FormFieldLabel.d.ts.map +1 -1
- package/dist/es6/form-field/lib/FormFieldLabel.js +5 -28
- package/dist/es6/form-field/lib/hooks/useFormFieldHint.d.ts +3 -5
- package/dist/es6/form-field/lib/hooks/useFormFieldHint.d.ts.map +1 -1
- package/dist/es6/form-field/lib/hooks/useFormFieldHint.js +2 -3
- package/dist/es6/form-field/lib/hooks/useFormFieldInput.d.ts +3 -5
- package/dist/es6/form-field/lib/hooks/useFormFieldInput.d.ts.map +1 -1
- package/dist/es6/form-field/lib/hooks/useFormFieldInput.js +3 -4
- package/dist/es6/form-field/lib/hooks/useFormFieldLabel.d.ts +3 -5
- package/dist/es6/form-field/lib/hooks/useFormFieldLabel.d.ts.map +1 -1
- package/dist/es6/form-field/lib/hooks/useFormFieldLabel.js +2 -3
- package/dist/es6/form-field/lib/hooks/useFormFieldModel.d.ts +2 -12
- package/dist/es6/form-field/lib/hooks/useFormFieldModel.d.ts.map +1 -1
- package/dist/es6/form-field/lib/hooks/useFormFieldModel.js +9 -19
- package/dist/es6/form-field/lib/hooks/useFormFieldOrientation.d.ts +4 -4
- package/dist/es6/form-field/lib/hooks/useFormFieldOrientation.d.ts.map +1 -1
- package/dist/es6/form-field/lib/hooks/useFormFieldOrientation.js +4 -4
- package/dist/es6/menu/lib/Menu.d.ts +16 -9
- package/dist/es6/menu/lib/Menu.d.ts.map +1 -1
- package/dist/es6/menu/lib/Menu.js +103 -128
- package/dist/es6/menu/lib/MenuItem.d.ts +17 -7
- package/dist/es6/menu/lib/MenuItem.d.ts.map +1 -1
- package/dist/es6/menu/lib/MenuItem.js +107 -111
- package/dist/es6/pill/lib/Pill.d.ts +103 -5
- package/dist/es6/pill/lib/Pill.d.ts.map +1 -1
- package/dist/es6/pill/lib/Pill.js +149 -55
- package/dist/es6/pill/lib/PillAvatar.js +3 -14
- package/dist/es6/pill/lib/PillCount.js +4 -27
- package/dist/es6/pill/lib/PillIcon.js +3 -26
- package/dist/es6/pill/lib/PillIconButton.js +7 -30
- package/dist/es6/pill/lib/PillLabel.js +5 -28
- package/dist/es6/pill/lib/usePillModel.js +8 -16
- package/dist/es6/segmented-control/index.d.ts +2 -0
- package/dist/es6/segmented-control/index.d.ts.map +1 -1
- package/dist/es6/segmented-control/index.js +2 -0
- package/dist/es6/segmented-control/lib/SegmentedControl.d.ts +267 -82
- package/dist/es6/segmented-control/lib/SegmentedControl.d.ts.map +1 -1
- package/dist/es6/segmented-control/lib/SegmentedControl.js +38 -3
- package/dist/es6/segmented-control/lib/SegmentedControlItem.d.ts +9 -5
- package/dist/es6/segmented-control/lib/SegmentedControlItem.d.ts.map +1 -1
- package/dist/es6/segmented-control/lib/SegmentedControlItem.js +17 -42
- package/dist/es6/segmented-control/lib/SegmentedControlList.d.ts +71 -2
- package/dist/es6/segmented-control/lib/SegmentedControlList.d.ts.map +1 -1
- package/dist/es6/segmented-control/lib/SegmentedControlList.js +9 -34
- package/dist/es6/segmented-control/lib/hooks/useSegmentedControlItem.d.ts +28 -9
- package/dist/es6/segmented-control/lib/hooks/useSegmentedControlItem.d.ts.map +1 -1
- package/dist/es6/segmented-control/lib/hooks/useSegmentedControlItem.js +5 -7
- package/dist/es6/segmented-control/lib/hooks/useSegmentedControlModel.d.ts +233 -83
- package/dist/es6/segmented-control/lib/hooks/useSegmentedControlModel.d.ts.map +1 -1
- package/dist/es6/segmented-control/lib/hooks/useSegmentedControlModel.js +31 -30
- package/dist/es6/select/lib/Select.js +144 -184
- package/dist/es6/select/lib/SelectBase.js +99 -94
- package/dist/es6/select/lib/SelectMenu.js +49 -80
- package/dist/es6/select/lib/SelectOption.js +30 -44
- package/dist/es6/select/lib/scrolling.js +6 -7
- package/dist/es6/select/lib/utils.js +4 -4
- package/dist/es6/side-panel/lib/SidePanel.d.ts +13 -26
- package/dist/es6/side-panel/lib/SidePanel.d.ts.map +1 -1
- package/dist/es6/side-panel/lib/SidePanel.js +93 -130
- package/dist/es6/side-panel/lib/SidePanelToggleButton.d.ts +17 -0
- package/dist/es6/side-panel/lib/SidePanelToggleButton.d.ts.map +1 -0
- package/dist/es6/side-panel/lib/SidePanelToggleButton.js +43 -0
- package/dist/es6/side-panel/lib/hooks.d.ts +20 -0
- package/dist/es6/side-panel/lib/hooks.d.ts.map +1 -1
- package/dist/es6/side-panel/lib/hooks.js +37 -18
- package/dist/es6/status-indicator/index.d.ts +2 -0
- package/dist/es6/status-indicator/index.d.ts.map +1 -1
- package/dist/es6/status-indicator/index.js +2 -0
- package/dist/es6/status-indicator/lib/StatusIndicator.d.ts +32 -8
- package/dist/es6/status-indicator/lib/StatusIndicator.d.ts.map +1 -1
- package/dist/es6/status-indicator/lib/StatusIndicator.js +33 -31
- package/dist/es6/status-indicator/lib/StatusIndicatorIcon.d.ts +10 -0
- package/dist/es6/status-indicator/lib/StatusIndicatorIcon.d.ts.map +1 -1
- package/dist/es6/status-indicator/lib/StatusIndicatorIcon.js +6 -18
- package/dist/es6/status-indicator/lib/StatusIndicatorLabel.js +3 -26
- package/dist/es6/status-indicator/lib/hooks/useStatusIndicatorModel.js +6 -15
- package/dist/es6/table/index.d.ts +2 -0
- package/dist/es6/table/index.d.ts.map +1 -0
- package/dist/es6/table/index.js +1 -0
- package/dist/es6/table/lib/Table.d.ts +207 -0
- package/dist/es6/table/lib/Table.d.ts.map +1 -0
- package/dist/es6/table/lib/Table.js +223 -0
- package/dist/es6/table/lib/TableBody.d.ts +2 -0
- package/dist/es6/table/lib/TableBody.d.ts.map +1 -0
- package/dist/es6/table/lib/TableBody.js +29 -0
- package/dist/es6/table/lib/TableCaption.d.ts +2 -0
- package/dist/es6/table/lib/TableCaption.d.ts.map +1 -0
- package/dist/es6/table/lib/TableCaption.js +10 -0
- package/dist/es6/table/lib/TableCell.d.ts +2 -0
- package/dist/es6/table/lib/TableCell.d.ts.map +1 -0
- package/dist/es6/table/lib/TableCell.js +10 -0
- package/dist/es6/table/lib/TableFooter.d.ts +2 -0
- package/dist/es6/table/lib/TableFooter.d.ts.map +1 -0
- package/dist/es6/table/lib/TableFooter.js +9 -0
- package/dist/es6/table/lib/TableHead.d.ts +2 -0
- package/dist/es6/table/lib/TableHead.d.ts.map +1 -0
- package/dist/es6/table/lib/TableHead.js +17 -0
- package/dist/es6/table/lib/TableHeader.d.ts +2 -0
- package/dist/es6/table/lib/TableHeader.d.ts.map +1 -0
- package/dist/es6/table/lib/TableHeader.js +10 -0
- package/dist/es6/table/lib/TableRow.d.ts +2 -0
- package/dist/es6/table/lib/TableRow.d.ts.map +1 -0
- package/dist/es6/table/lib/TableRow.js +13 -0
- package/dist/es6/text-area/lib/TextArea.d.ts +2 -2
- package/dist/es6/text-area/lib/TextArea.d.ts.map +1 -1
- package/dist/es6/text-area/lib/TextArea.js +7 -31
- package/dist/es6/text-area/lib/TextAreaField.d.ts +1 -1
- package/dist/es6/text-area/lib/TextAreaField.d.ts.map +1 -1
- package/dist/es6/text-area/lib/TextAreaField.js +9 -33
- package/dist/es6/text-input/lib/TextInput.d.ts +4 -4
- package/dist/es6/text-input/lib/TextInput.d.ts.map +1 -1
- package/dist/es6/text-input/lib/TextInput.js +7 -31
- package/dist/es6/text-input/lib/TextInputField.d.ts +1 -1
- package/dist/es6/text-input/lib/TextInputField.d.ts.map +1 -1
- package/dist/es6/text-input/lib/TextInputField.js +12 -24
- package/dist/es6/text-input/lib/hooks/useTextInputField.d.ts +3 -5
- package/dist/es6/text-input/lib/hooks/useTextInputField.d.ts.map +1 -1
- package/dist/es6/text-input/lib/hooks/useTextInputField.js +1 -1
- package/dist/es6/text-input/lib/hooks/useTextInputModel.d.ts +1 -0
- package/dist/es6/text-input/lib/hooks/useTextInputModel.d.ts.map +1 -1
- package/dist/es6/text-input/lib/hooks/useTextInputModel.js +2 -1
- package/form-field/lib/FormField.tsx +5 -10
- package/form-field/lib/FormFieldLabel.tsx +6 -11
- package/form-field/lib/hooks/useFormFieldModel.tsx +1 -3
- package/form-field/lib/hooks/useFormFieldOrientation.tsx +6 -6
- package/menu/lib/Menu.tsx +16 -9
- package/menu/lib/MenuItem.tsx +19 -8
- package/package.json +4 -5
- package/pill/lib/Pill.tsx +109 -10
- package/pill/lib/PillCount.tsx +1 -1
- package/pill/lib/PillIcon.tsx +1 -1
- package/segmented-control/index.ts +2 -0
- package/segmented-control/lib/SegmentedControl.tsx +36 -0
- package/segmented-control/lib/SegmentedControlList.tsx +1 -1
- package/segmented-control/lib/hooks/useSegmentedControlItem.tsx +1 -5
- package/side-panel/lib/SidePanel.tsx +119 -169
- package/side-panel/lib/SidePanelToggleButton.tsx +78 -0
- package/side-panel/lib/hooks.ts +20 -0
- package/status-indicator/index.ts +2 -0
- package/status-indicator/lib/StatusIndicator.tsx +32 -6
- package/status-indicator/lib/StatusIndicatorIcon.tsx +1 -1
- package/table/LICENSE +51 -0
- package/table/README.md +5 -0
- package/table/index.ts +1 -0
- package/table/lib/Table.tsx +236 -0
- package/table/lib/TableBody.tsx +35 -0
- package/table/lib/TableCaption.tsx +22 -0
- package/table/lib/TableCell.tsx +27 -0
- package/table/lib/TableFooter.tsx +14 -0
- package/table/lib/TableHead.tsx +23 -0
- package/table/lib/TableHeader.tsx +28 -0
- package/table/lib/TableRow.tsx +26 -0
- package/table/package.json +6 -0
- package/text-area/lib/TextArea.tsx +9 -6
- package/text-area/lib/TextAreaField.tsx +6 -2
- package/text-input/lib/TextInput.tsx +9 -6
- package/text-input/lib/TextInputField.tsx +9 -5
- package/text-input/lib/hooks/useTextInputModel.ts +1 -0
- package/dist/commonjs/text-area/lib/hooks/index.d.ts +0 -2
- package/dist/commonjs/text-area/lib/hooks/index.d.ts.map +0 -1
- package/dist/commonjs/text-area/lib/hooks/useTextAreaModel.d.ts +0 -28
- package/dist/commonjs/text-area/lib/hooks/useTextAreaModel.d.ts.map +0 -1
- package/dist/commonjs/text-area/lib/hooks/useTextAreaModel.js +0 -5
- package/dist/es6/text-area/lib/hooks/index.d.ts +0 -2
- package/dist/es6/text-area/lib/hooks/index.d.ts.map +0 -1
- package/dist/es6/text-area/lib/hooks/index.js +0 -1
- package/dist/es6/text-area/lib/hooks/useTextAreaModel.d.ts +0 -28
- package/dist/es6/text-area/lib/hooks/useTextAreaModel.d.ts.map +0 -1
- package/dist/es6/text-area/lib/hooks/useTextAreaModel.js +0 -2
- package/text-area/lib/hooks/index.ts +0 -1
- package/text-area/lib/hooks/useTextAreaModel.ts +0 -3
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
// Modified from https://gist.github.com/hsablonniere/2581101
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
var parent = elem.parentElement;
|
|
2
|
+
export const scrollIntoViewIfNeeded = (elem, centerIfNeeded = true) => {
|
|
3
|
+
const parent = elem.parentElement;
|
|
5
4
|
if (elem && parent) {
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
const parentComputedStyle = window.getComputedStyle(parent, null);
|
|
6
|
+
const parentBorderTopWidth = parseInt(parentComputedStyle.getPropertyValue('border-top-width'), 10);
|
|
8
7
|
// Check if elem is out of view at the top edge of the parent's viewport
|
|
9
|
-
|
|
8
|
+
const overTop = elem.offsetTop < parent.scrollTop + parentBorderTopWidth;
|
|
10
9
|
// Check if elem is out of view at the bottom edge of the parent's viewport
|
|
11
|
-
|
|
10
|
+
const overBottom = elem.offsetTop + elem.offsetHeight >
|
|
12
11
|
parent.scrollTop + parentBorderTopWidth + parent.clientHeight;
|
|
13
12
|
if ((overTop || overBottom) && centerIfNeeded) {
|
|
14
13
|
parent.scrollTop = Math.floor(elem.offsetTop - parent.clientHeight / 2 - parentBorderTopWidth + elem.clientHeight / 2);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export
|
|
1
|
+
export const getIndexByValue = (options, value) => {
|
|
2
2
|
if (!options || value === undefined) {
|
|
3
3
|
return -1;
|
|
4
4
|
}
|
|
5
|
-
for (
|
|
5
|
+
for (let i = 0; i < options.length; i++) {
|
|
6
6
|
if (options[i].value === value) {
|
|
7
7
|
return i;
|
|
8
8
|
}
|
|
@@ -10,7 +10,7 @@ export var getIndexByValue = function (options, value) {
|
|
|
10
10
|
return -1;
|
|
11
11
|
};
|
|
12
12
|
// If the value doesn't exist in the options, return index 0
|
|
13
|
-
export
|
|
14
|
-
|
|
13
|
+
export const getCorrectedIndexByValue = (options, value) => {
|
|
14
|
+
const indexByValue = getIndexByValue(options, value);
|
|
15
15
|
return indexByValue === -1 ? 0 : indexByValue;
|
|
16
16
|
};
|
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import { jsx } from '@emotion/react';
|
|
5
|
-
import { TertiaryButtonProps } from '@workday/canvas-kit-react/button';
|
|
6
4
|
export declare type SidePanelVariant = 'standard' | 'alternate';
|
|
7
5
|
export declare type SidePanelTransitionStates = 'collapsed' | 'collapsing' | 'expanded' | 'expanding';
|
|
8
|
-
export interface SidePanelProps
|
|
9
|
-
/**
|
|
10
|
-
* The element the side panel will render as (e.g. 'div').
|
|
11
|
-
*
|
|
12
|
-
* @default 'section'
|
|
13
|
-
*/
|
|
14
|
-
as?: React.ElementType;
|
|
6
|
+
export interface SidePanelProps {
|
|
15
7
|
/**
|
|
16
8
|
* The width of the component (in `px` if it's a `number`) when it is collapsed.
|
|
17
9
|
*
|
|
@@ -61,25 +53,20 @@ export interface SidePanelProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
61
53
|
* @param boolean
|
|
62
54
|
*/
|
|
63
55
|
touched: boolean;
|
|
56
|
+
children?: React.ReactNode;
|
|
57
|
+
onAnimationStart?: React.AnimationEventHandler<HTMLElement>;
|
|
58
|
+
onAnimationEnd?: React.AnimationEventHandler<HTMLElement>;
|
|
64
59
|
}
|
|
65
|
-
export declare const
|
|
66
|
-
state: string;
|
|
67
|
-
origin: string;
|
|
68
|
-
}>;
|
|
69
|
-
export declare const SidePanel: {
|
|
70
|
-
({ as, children, collapsedWidth, expanded, expandedWidth, onAnimationEnd, onAnimationStart, onExpandedChange, onStateTransition, origin, variant, touched, ...elemProps }: SidePanelProps): jsx.JSX.Element;
|
|
71
|
-
ToggleButton: ({ variant, icon, tooltipTextExpand: expandLabel, tooltipTextCollapse: collapseLabel, ...rest }: ToggleButtonProps & React.ButtonHTMLAttributes<HTMLButtonElement>) => jsx.JSX.Element;
|
|
72
|
-
};
|
|
73
|
-
export declare type ToggleButtonProps = TertiaryButtonProps & {
|
|
60
|
+
export declare const SidePanel: import("@workday/canvas-kit-react/common").ElementComponent<"section", SidePanelProps> & {
|
|
74
61
|
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
*
|
|
81
|
-
*
|
|
62
|
+
* `SidePanel.ToggleButton` is a control that is meant to toggle between `expanded = true` and
|
|
63
|
+
* `expanded = false` states. It must be used within the `SidePanel` component as a child. Use
|
|
64
|
+
* in conjunction with `useSidePanel`'s `controlProps`, otherwise it does not come with explicit
|
|
65
|
+
* `onClick` handlers.
|
|
66
|
+
*
|
|
67
|
+
* For accessibility purposes, it must be the first focusable element. We recommend that you
|
|
68
|
+
* keep it as the first child of `SidePanel`
|
|
82
69
|
*/
|
|
83
|
-
|
|
70
|
+
ToggleButton: import("@workday/canvas-kit-react/common").ElementComponent<"button", import("./SidePanelToggleButton").SidePanelToggleButtonProps>;
|
|
84
71
|
};
|
|
85
72
|
//# sourceMappingURL=SidePanel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidePanel.d.ts","sourceRoot":"","sources":["../../../../side-panel/lib/SidePanel.tsx"],"names":[],"mappings":"AAAA,0BAA0B;AAC1B,eAAe;AACf,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"SidePanel.d.ts","sourceRoot":"","sources":["../../../../side-panel/lib/SidePanel.tsx"],"names":[],"mappings":"AAAA,0BAA0B;AAC1B,eAAe;AACf,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,oBAAY,gBAAgB,GAAG,UAAU,GAAG,WAAW,CAAC;AACxD,oBAAY,yBAAyB,GAAG,WAAW,GAAG,YAAY,GAAG,UAAU,GAAG,WAAW,CAAC;AAE9F,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACjC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAChC;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAChD;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,yBAAyB,KAAK,IAAI,CAAC;IAChE;;;;OAIG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B;;;;OAIG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,gBAAgB,CAAC,EAAE,KAAK,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC;IAC5D,cAAc,CAAC,EAAE,KAAK,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC;CAC3D;AAsCD,eAAO,MAAM,SAAS;IAwGlB;;;;;;;;OAQG;;CAGL,CAAC"}
|
|
@@ -1,149 +1,112 @@
|
|
|
1
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
-
return cooked;
|
|
4
|
-
};
|
|
5
|
-
var __assign = (this && this.__assign) || function () {
|
|
6
|
-
__assign = Object.assign || function(t) {
|
|
7
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
8
|
-
s = arguments[i];
|
|
9
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
10
|
-
t[p] = s[p];
|
|
11
|
-
}
|
|
12
|
-
return t;
|
|
13
|
-
};
|
|
14
|
-
return __assign.apply(this, arguments);
|
|
15
|
-
};
|
|
16
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
17
|
-
var t = {};
|
|
18
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
19
|
-
t[p] = s[p];
|
|
20
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
21
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
22
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
23
|
-
t[p[i]] = s[p[i]];
|
|
24
|
-
}
|
|
25
|
-
return t;
|
|
26
|
-
};
|
|
27
1
|
/** @jsxRuntime classic */
|
|
28
2
|
/** @jsx jsx */
|
|
29
3
|
import * as React from 'react';
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
var normalized = {
|
|
4
|
+
import { createComponent, styled } from '@workday/canvas-kit-react/common';
|
|
5
|
+
import { jsx, keyframes } from '@emotion/react';
|
|
6
|
+
import { colors, depth } from '@workday/canvas-kit-react/tokens';
|
|
7
|
+
import { SidePanelContext } from './hooks';
|
|
8
|
+
import { SidePanelToggleButton } from './SidePanelToggleButton';
|
|
9
|
+
const createKeyframes = (from, to) => {
|
|
10
|
+
const normalized = {
|
|
38
11
|
from: typeof from === 'number' ? from + 'px' : from,
|
|
39
12
|
to: typeof to === 'number' ? to + 'px' : to,
|
|
40
13
|
};
|
|
41
|
-
return keyframes
|
|
14
|
+
return keyframes `
|
|
15
|
+
from {
|
|
16
|
+
width: ${normalized.from};
|
|
17
|
+
min-width: ${normalized.from};
|
|
18
|
+
max-width: ${normalized.from};
|
|
19
|
+
} to {
|
|
20
|
+
width: ${normalized.to};
|
|
21
|
+
min-width: ${normalized.to};
|
|
22
|
+
max-width: ${normalized.to};
|
|
23
|
+
}
|
|
24
|
+
`;
|
|
42
25
|
};
|
|
43
|
-
|
|
44
|
-
alternate:
|
|
26
|
+
const containerVariantStyle = {
|
|
27
|
+
alternate: {
|
|
28
|
+
backgroundColor: colors.frenchVanilla100,
|
|
29
|
+
...depth[5],
|
|
30
|
+
},
|
|
45
31
|
standard: {
|
|
46
32
|
backgroundColor: colors.soap100,
|
|
47
33
|
},
|
|
48
34
|
};
|
|
49
|
-
|
|
35
|
+
const Panel = styled('section')({
|
|
50
36
|
overflow: 'hidden',
|
|
51
37
|
position: 'relative',
|
|
52
38
|
boxSizing: 'border-box',
|
|
53
39
|
height: '100%',
|
|
54
40
|
});
|
|
55
|
-
export
|
|
56
|
-
|
|
57
|
-
origin
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
React.useEffect(function () {
|
|
63
|
-
if (typeof onExpandedChange !== 'undefined') {
|
|
64
|
-
onExpandedChange(expanded);
|
|
65
|
-
}
|
|
66
|
-
}, [expanded, onExpandedChange]);
|
|
67
|
-
React.useEffect(function () {
|
|
68
|
-
if (typeof onStateTransition !== 'undefined') {
|
|
69
|
-
onStateTransition(state);
|
|
70
|
-
}
|
|
71
|
-
}, [state, onStateTransition]);
|
|
72
|
-
var motion = {
|
|
73
|
-
collapse: createKeyframes(expandedWidth, collapsedWidth),
|
|
74
|
-
expand: createKeyframes(collapsedWidth, expandedWidth),
|
|
75
|
-
};
|
|
76
|
-
var handleAnimationEnd = function (event) {
|
|
77
|
-
if (event.currentTarget === event.target) {
|
|
78
|
-
if (event.animationName === motion.collapse.name) {
|
|
79
|
-
setState('collapsed');
|
|
41
|
+
export const SidePanel = createComponent('section')({
|
|
42
|
+
displayName: 'SidePanel',
|
|
43
|
+
Component({ children, collapsedWidth = 64, expanded = true, expandedWidth = 320, onAnimationEnd, onAnimationStart, onExpandedChange, onStateTransition, origin = 'left', variant = 'standard', touched, ...elemProps }, ref, Element) {
|
|
44
|
+
const [state, setState] = React.useState(expanded ? 'expanded' : 'collapsed');
|
|
45
|
+
React.useEffect(() => {
|
|
46
|
+
if (typeof onExpandedChange !== 'undefined') {
|
|
47
|
+
onExpandedChange(expanded);
|
|
80
48
|
}
|
|
81
|
-
|
|
82
|
-
|
|
49
|
+
}, [expanded, onExpandedChange]);
|
|
50
|
+
React.useEffect(() => {
|
|
51
|
+
if (typeof onStateTransition !== 'undefined') {
|
|
52
|
+
onStateTransition(state);
|
|
83
53
|
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
54
|
+
}, [state, onStateTransition]);
|
|
55
|
+
const motion = {
|
|
56
|
+
collapse: createKeyframes(expandedWidth, collapsedWidth),
|
|
57
|
+
expand: createKeyframes(collapsedWidth, expandedWidth),
|
|
58
|
+
};
|
|
59
|
+
const handleAnimationEnd = (event) => {
|
|
60
|
+
if (event.currentTarget === event.target) {
|
|
61
|
+
if (event.animationName === motion.collapse.name) {
|
|
62
|
+
setState('collapsed');
|
|
63
|
+
}
|
|
64
|
+
if (event.animationName === motion.expand.name) {
|
|
65
|
+
setState('expanded');
|
|
66
|
+
}
|
|
94
67
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
margin: context.state === 'collapsed' ? 'auto' : 0,
|
|
141
|
-
transform: context.state === 'collapsed' || context.state === 'collapsing'
|
|
142
|
-
? "scaleX(" + (rtlOrigin === 'left' ? '1' : '-1') + ")"
|
|
143
|
-
: "scaleX(" + (rtlOrigin === 'left' ? '-1' : '1') + ")",
|
|
144
|
-
});
|
|
145
|
-
return (jsx(Tooltip, { title: context.state === 'collapsed' ? expandLabel : collapseLabel, type: "muted" },
|
|
146
|
-
jsx(TertiaryButton, __assign({ type: "button", css: buttonStyle, icon: icon, variant: variant }, rest))));
|
|
147
|
-
};
|
|
148
|
-
SidePanel.ToggleButton = ToggleButton;
|
|
149
|
-
var templateObject_1;
|
|
68
|
+
if (typeof onAnimationEnd !== 'undefined') {
|
|
69
|
+
onAnimationEnd(event);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
const handleAnimationStart = (event) => {
|
|
73
|
+
if (event.currentTarget === event.target) {
|
|
74
|
+
if (event.animationName === motion.collapse.name ||
|
|
75
|
+
event.animationName === motion.expand.name) {
|
|
76
|
+
setState(expanded ? 'expanding' : 'collapsing');
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (typeof onAnimationStart !== 'undefined') {
|
|
80
|
+
onAnimationStart(event);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
return (jsx(Panel, Object.assign({ ref: ref, as: Element, css: [
|
|
84
|
+
{
|
|
85
|
+
width: expanded ? expandedWidth : collapsedWidth,
|
|
86
|
+
maxWidth: expanded ? expandedWidth : collapsedWidth,
|
|
87
|
+
// mounted.current will be false on the first render, thus you won't get an unwanted animation here
|
|
88
|
+
// Will animate again if you force a re-render (like in Storybook)
|
|
89
|
+
animation: touched
|
|
90
|
+
? `${expanded ? motion.expand : motion.collapse} 200ms ease-out`
|
|
91
|
+
: undefined,
|
|
92
|
+
},
|
|
93
|
+
containerVariantStyle[variant],
|
|
94
|
+
], onAnimationEnd: handleAnimationEnd, onAnimationStart: handleAnimationStart }, elemProps),
|
|
95
|
+
jsx(SidePanelContext.Provider, { value: {
|
|
96
|
+
state,
|
|
97
|
+
origin,
|
|
98
|
+
} }, children)));
|
|
99
|
+
},
|
|
100
|
+
subComponents: {
|
|
101
|
+
/**
|
|
102
|
+
* `SidePanel.ToggleButton` is a control that is meant to toggle between `expanded = true` and
|
|
103
|
+
* `expanded = false` states. It must be used within the `SidePanel` component as a child. Use
|
|
104
|
+
* in conjunction with `useSidePanel`'s `controlProps`, otherwise it does not come with explicit
|
|
105
|
+
* `onClick` handlers.
|
|
106
|
+
*
|
|
107
|
+
* For accessibility purposes, it must be the first focusable element. We recommend that you
|
|
108
|
+
* keep it as the first child of `SidePanel`
|
|
109
|
+
*/
|
|
110
|
+
ToggleButton: SidePanelToggleButton,
|
|
111
|
+
},
|
|
112
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ExtractProps } from '@workday/canvas-kit-react/common';
|
|
2
|
+
import { TertiaryButton } from '@workday/canvas-kit-react/button';
|
|
3
|
+
export interface SidePanelToggleButtonProps extends ExtractProps<typeof TertiaryButton, never> {
|
|
4
|
+
/**
|
|
5
|
+
* The tooltip text to expand the side panel
|
|
6
|
+
*/
|
|
7
|
+
tooltipTextExpand?: string;
|
|
8
|
+
/**
|
|
9
|
+
* The tooltip text to collapse the side panel
|
|
10
|
+
*/
|
|
11
|
+
tooltipTextCollapse?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A toggle button styled specifically for the side panel container.
|
|
15
|
+
*/
|
|
16
|
+
export declare const SidePanelToggleButton: import("@workday/canvas-kit-react/common").ElementComponent<"button", SidePanelToggleButtonProps>;
|
|
17
|
+
//# sourceMappingURL=SidePanelToggleButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SidePanelToggleButton.d.ts","sourceRoot":"","sources":["../../../../side-panel/lib/SidePanelToggleButton.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAkB,YAAY,EAAW,MAAM,kCAAkC,CAAC;AAEzF,OAAO,EAAC,cAAc,EAAC,MAAM,kCAAkC,CAAC;AAMhE,MAAM,WAAW,0BAA2B,SAAQ,YAAY,CAAC,OAAO,cAAc,EAAE,KAAK,CAAC;IAC5F;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;GAEG;AACH,eAAO,MAAM,qBAAqB,mGAoDhC,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/** @jsxRuntime classic */
|
|
2
|
+
/** @jsx jsx */
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { createComponent, useIsRTL } from '@workday/canvas-kit-react/common';
|
|
5
|
+
import { css, jsx } from '@emotion/react';
|
|
6
|
+
import { TertiaryButton } from '@workday/canvas-kit-react/button';
|
|
7
|
+
import { space } from '@workday/canvas-kit-react/tokens';
|
|
8
|
+
import { transformationImportIcon } from '@workday/canvas-system-icons-web';
|
|
9
|
+
import { Tooltip } from '@workday/canvas-kit-react/tooltip';
|
|
10
|
+
import { SidePanelContext } from './hooks';
|
|
11
|
+
/**
|
|
12
|
+
* A toggle button styled specifically for the side panel container.
|
|
13
|
+
*/
|
|
14
|
+
export const SidePanelToggleButton = createComponent('button')({
|
|
15
|
+
displayName: 'SidePanel.ToggleButton',
|
|
16
|
+
Component({ variant = undefined, icon = transformationImportIcon, tooltipTextExpand = 'Expand', tooltipTextCollapse = 'Collapse', ...elemProps }) {
|
|
17
|
+
const context = React.useContext(SidePanelContext);
|
|
18
|
+
const useRTLOrigin = () => {
|
|
19
|
+
const isRTL = useIsRTL();
|
|
20
|
+
// if the direction is set to RTl, flip the origin
|
|
21
|
+
if (isRTL) {
|
|
22
|
+
return context.origin === 'left' ? 'right' : 'left';
|
|
23
|
+
}
|
|
24
|
+
// Otherwise, default to returning the origin
|
|
25
|
+
return context.origin;
|
|
26
|
+
};
|
|
27
|
+
const rtlOrigin = useRTLOrigin();
|
|
28
|
+
// Note: Depending on the collapsed width, the button could "jump" to it's final position.
|
|
29
|
+
const buttonStyle = css({
|
|
30
|
+
position: 'absolute',
|
|
31
|
+
top: space.m,
|
|
32
|
+
width: space.l,
|
|
33
|
+
right: context.state === 'collapsed' ? 0 : rtlOrigin === 'left' ? space.s : undefined,
|
|
34
|
+
left: context.state === 'collapsed' ? 0 : rtlOrigin === 'right' ? space.s : undefined,
|
|
35
|
+
margin: context.state === 'collapsed' ? 'auto' : 0,
|
|
36
|
+
transform: context.state === 'collapsed' || context.state === 'collapsing'
|
|
37
|
+
? `scaleX(${rtlOrigin === 'left' ? '1' : '-1'})`
|
|
38
|
+
: `scaleX(${rtlOrigin === 'left' ? '-1' : '1'})`,
|
|
39
|
+
});
|
|
40
|
+
return (jsx(Tooltip, { title: context.state === 'collapsed' ? tooltipTextExpand : tooltipTextCollapse, type: "muted" },
|
|
41
|
+
jsx(TertiaryButton, Object.assign({ type: "button", css: buttonStyle, icon: icon, variant: variant }, elemProps))));
|
|
42
|
+
},
|
|
43
|
+
});
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare const SidePanelContext: React.Context<{
|
|
3
|
+
state: string;
|
|
4
|
+
origin: string;
|
|
5
|
+
}>;
|
|
1
6
|
/**
|
|
2
7
|
* The optional config options for the `useSidePanel` hook
|
|
3
8
|
*/
|
|
@@ -70,6 +75,21 @@ export interface ControlProps {
|
|
|
70
75
|
*/
|
|
71
76
|
onClick: () => void;
|
|
72
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
*
|
|
80
|
+
* This hook manages the state and `aria-` attributes for the SidePanel. It takes an optional
|
|
81
|
+
* configuration object:
|
|
82
|
+
*
|
|
83
|
+
* ```tsx
|
|
84
|
+
* import {useSidePanel} from '@workday/canvas-kit-preview-react/side-panel';
|
|
85
|
+
*
|
|
86
|
+
* const {expanded, setExpanded, panelProps, labelProps, controlProps} = useSidePanel({
|
|
87
|
+
* initialExpanded: false,
|
|
88
|
+
* panelId: 'custom-panel-id',
|
|
89
|
+
* labelId: 'custom-label-id',
|
|
90
|
+
* });
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
73
93
|
export declare const useSidePanel: (config?: UseSidePanelProps | undefined) => {
|
|
74
94
|
expanded: boolean;
|
|
75
95
|
setExpanded: (newExpandedState: boolean) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../../side-panel/lib/hooks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../../side-panel/lib/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,eAAO,MAAM,gBAAgB;;;EAG3B,CAAC;AAGH;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;;OAGG;IACH,iBAAiB,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB;;;OAGG;IACH,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,eAAe,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,eAAe,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,iBAAiB,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,YAAY;;oCA2BsB,OAAO;;;;CA8BrD,CAAC"}
|
|
@@ -1,51 +1,70 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
export const SidePanelContext = React.createContext({
|
|
3
|
+
state: 'expanded',
|
|
4
|
+
origin: 'left',
|
|
5
|
+
});
|
|
2
6
|
import { useUniqueId } from '@workday/canvas-kit-react/common';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* This hook manages the state and `aria-` attributes for the SidePanel. It takes an optional
|
|
10
|
+
* configuration object:
|
|
11
|
+
*
|
|
12
|
+
* ```tsx
|
|
13
|
+
* import {useSidePanel} from '@workday/canvas-kit-preview-react/side-panel';
|
|
14
|
+
*
|
|
15
|
+
* const {expanded, setExpanded, panelProps, labelProps, controlProps} = useSidePanel({
|
|
16
|
+
* initialExpanded: false,
|
|
17
|
+
* panelId: 'custom-panel-id',
|
|
18
|
+
* labelId: 'custom-label-id',
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export const useSidePanel = (config) => {
|
|
23
|
+
const [touched, setTouched] = React.useState(false);
|
|
24
|
+
const configParams = config
|
|
6
25
|
? config
|
|
7
26
|
: {
|
|
8
27
|
initialExpanded: true,
|
|
9
28
|
panelId: undefined,
|
|
10
29
|
labelId: undefined,
|
|
11
30
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
31
|
+
const { initialExpanded = true, panelId: panelIdParam, labelId: labelIdParam } = configParams;
|
|
32
|
+
const [expanded, setExpanded] = React.useState(initialExpanded);
|
|
33
|
+
const panelId = useUniqueId(panelIdParam);
|
|
34
|
+
const labelId = useUniqueId(labelIdParam);
|
|
16
35
|
// This prevents keyframes animations from rendering prematurely
|
|
17
|
-
|
|
36
|
+
const handleSetTouched = () => {
|
|
18
37
|
if (touched === false) {
|
|
19
38
|
setTouched(true);
|
|
20
39
|
}
|
|
21
40
|
};
|
|
22
|
-
|
|
41
|
+
const handleClick = () => {
|
|
23
42
|
handleSetExpanded(!expanded);
|
|
24
43
|
};
|
|
25
|
-
|
|
44
|
+
const handleSetExpanded = (newExpandedState) => {
|
|
26
45
|
handleSetTouched();
|
|
27
46
|
setExpanded(newExpandedState);
|
|
28
47
|
};
|
|
29
|
-
|
|
48
|
+
const panelProps = {
|
|
30
49
|
expanded: expanded,
|
|
31
50
|
id: panelId,
|
|
32
51
|
'aria-labelledby': labelId,
|
|
33
|
-
touched
|
|
52
|
+
touched,
|
|
34
53
|
};
|
|
35
|
-
|
|
54
|
+
const labelProps = {
|
|
36
55
|
id: labelId,
|
|
37
56
|
};
|
|
38
|
-
|
|
57
|
+
const controlProps = {
|
|
39
58
|
'aria-controls': panelId,
|
|
40
59
|
'aria-expanded': expanded,
|
|
41
60
|
'aria-labelledby': labelId,
|
|
42
61
|
onClick: handleClick,
|
|
43
62
|
};
|
|
44
63
|
return {
|
|
45
|
-
expanded
|
|
64
|
+
expanded,
|
|
46
65
|
setExpanded: handleSetExpanded,
|
|
47
|
-
panelProps
|
|
48
|
-
labelProps
|
|
49
|
-
controlProps
|
|
66
|
+
panelProps,
|
|
67
|
+
labelProps,
|
|
68
|
+
controlProps,
|
|
50
69
|
};
|
|
51
70
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../status-indicator/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../status-indicator/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,qCAAqC,CAAC;AACpD,OAAO,EAAC,sBAAsB,EAAC,MAAM,2BAA2B,CAAC"}
|
|
@@ -1,25 +1,33 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ExtractProps } from '@workday/canvas-kit-react/common';
|
|
3
|
-
import {
|
|
4
|
-
export interface StatusIndicatorProps extends
|
|
3
|
+
import { Flex } from '@workday/canvas-kit-react/layout';
|
|
4
|
+
export interface StatusIndicatorProps extends ExtractProps<typeof Flex, never> {
|
|
5
5
|
/**
|
|
6
6
|
* Children of the `StatusIndicator`. Can contain a `StatusIndicator.Label` and optionally a `StatusIndicator.Icon`.
|
|
7
7
|
*/
|
|
8
8
|
children: React.ReactNode;
|
|
9
9
|
}
|
|
10
|
-
export declare const useStatusIndicator: <
|
|
10
|
+
export declare const useStatusIndicator: import("@workday/canvas-kit-react/common").BehaviorHook<{
|
|
11
11
|
state: {
|
|
12
12
|
emphasis: import("./hooks").StatusIndicatorEmphasis;
|
|
13
13
|
variant: import("./hooks").StatusIndicatorVariant;
|
|
14
14
|
};
|
|
15
15
|
events: {};
|
|
16
|
-
},
|
|
16
|
+
}, {
|
|
17
17
|
opacity: string | undefined;
|
|
18
18
|
color: string;
|
|
19
19
|
background: string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
}>;
|
|
21
|
+
/**
|
|
22
|
+
* `StatusIndicator` is a container component which renders an {@link Flex} under the hood to
|
|
23
|
+
* apply spacing evenly between its children. It has a default maximum width of `200px`.
|
|
24
|
+
*
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <StatusIndicator emphasis="low" variant="blue">
|
|
27
|
+
* {Child components}
|
|
28
|
+
* </StatusIndicator>
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
23
31
|
export declare const StatusIndicator: import("@workday/canvas-kit-react/common").ElementComponentM<"div", StatusIndicatorProps & Partial<{
|
|
24
32
|
emphasis: import("./hooks").StatusIndicatorEmphasis;
|
|
25
33
|
variant: import("./hooks").StatusIndicatorVariant;
|
|
@@ -30,6 +38,23 @@ export declare const StatusIndicator: import("@workday/canvas-kit-react/common")
|
|
|
30
38
|
};
|
|
31
39
|
events: {};
|
|
32
40
|
}> & {
|
|
41
|
+
/**
|
|
42
|
+
* `StatusIndicator.Label` renders {@link Text} under the hood. It will apply an ellipsis if its
|
|
43
|
+
* contents exceed the component's maximum width.
|
|
44
|
+
*
|
|
45
|
+
* ```tsx
|
|
46
|
+
* <StatusIndicator.Label>{The text to be rendered}</StatusIndicator.Label>
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
Label: import("@workday/canvas-kit-react/common").ElementComponent<"span", import("./StatusIndicatorLabel").StatusIndicatorLabelProps>;
|
|
50
|
+
/**
|
|
51
|
+
* `StatusIndicator.Icon` renders {@link SystemIcon} under the hood. It's used as a decorative
|
|
52
|
+
* element to visually support the {@link StatusIndicatorLabel StatusIndicator.Label} text.
|
|
53
|
+
*
|
|
54
|
+
* ```tsx
|
|
55
|
+
* <StatusIndicator.Icon icon={uploadCloudIcon} />
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
33
58
|
Icon: import("@workday/canvas-kit-react/common").ElementComponentM<"span", import("./StatusIndicatorIcon").StatusIndicatorIconProps, {
|
|
34
59
|
state: {
|
|
35
60
|
emphasis: import("./hooks").StatusIndicatorEmphasis;
|
|
@@ -37,6 +62,5 @@ export declare const StatusIndicator: import("@workday/canvas-kit-react/common")
|
|
|
37
62
|
};
|
|
38
63
|
events: {};
|
|
39
64
|
}>;
|
|
40
|
-
Label: import("@workday/canvas-kit-react/common").ElementComponent<"span", import("./StatusIndicatorLabel").StatusIndicatorLabelProps>;
|
|
41
65
|
};
|
|
42
66
|
//# sourceMappingURL=StatusIndicator.d.ts.map
|