@workday/canvas-kit-preview-react 8.0.0-alpha.254-next.23 → 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,31 +1,26 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import {createSubcomponent,
|
|
4
|
-
import {
|
|
3
|
+
import {createSubcomponent, useTheme} from '@workday/canvas-kit-react/common';
|
|
4
|
+
import {Flex, FlexProps} from '@workday/canvas-kit-react/layout';
|
|
5
5
|
import {LabelText, Text} from '@workday/canvas-kit-react/text';
|
|
6
6
|
import {useFormFieldLabel, useFormFieldModel} from './hooks';
|
|
7
7
|
|
|
8
|
-
export interface FormFieldLabelProps extends
|
|
8
|
+
export interface FormFieldLabelProps extends FlexProps {
|
|
9
9
|
/**
|
|
10
10
|
* The text of the label.
|
|
11
11
|
*/
|
|
12
12
|
children: React.ReactNode;
|
|
13
|
-
/**
|
|
14
|
-
* When the input is required, this is spacing between label and asterisk.
|
|
15
|
-
* @default xxxs
|
|
16
|
-
*/
|
|
17
|
-
spacing?: StackSpacing;
|
|
18
13
|
}
|
|
19
14
|
|
|
20
15
|
export const FormFieldLabel = createSubcomponent('label')({
|
|
21
16
|
displayName: 'FormField.Label',
|
|
22
17
|
modelHook: useFormFieldModel,
|
|
23
18
|
elemPropsHook: useFormFieldLabel,
|
|
24
|
-
})<FormFieldLabelProps>(({
|
|
19
|
+
})<FormFieldLabelProps>(({gap = 'xxxs', children, ...elemProps}, Element, model) => {
|
|
25
20
|
const theme = useTheme();
|
|
26
21
|
|
|
27
22
|
return (
|
|
28
|
-
<
|
|
23
|
+
<Flex as={Element} gap={gap} minWidth="180px" {...elemProps}>
|
|
29
24
|
<LabelText as="span" fontWeight="medium">
|
|
30
25
|
{children}
|
|
31
26
|
</LabelText>
|
|
@@ -40,6 +35,6 @@ export const FormFieldLabel = createSubcomponent('label')({
|
|
|
40
35
|
*
|
|
41
36
|
</Text>
|
|
42
37
|
)}
|
|
43
|
-
</
|
|
38
|
+
</Flex>
|
|
44
39
|
);
|
|
45
40
|
});
|
|
@@ -5,7 +5,6 @@ export const useFormFieldModel = createModelHook({
|
|
|
5
5
|
/**
|
|
6
6
|
* Optional flag to denote if this field has an error to display. When true the `FormField.Input` will have
|
|
7
7
|
* `required` set to true, and usually some subcomponents will have a error color applied.
|
|
8
|
-
* @default false
|
|
9
8
|
*/
|
|
10
9
|
hasError: false,
|
|
11
10
|
/**
|
|
@@ -16,13 +15,12 @@ export const useFormFieldModel = createModelHook({
|
|
|
16
15
|
* - `FormField.Hint` will set `id` to `hint-${id}`
|
|
17
16
|
*
|
|
18
17
|
* If a value is not provided, a unique id will be automatically created by `useUniqueId()`.
|
|
19
|
-
* @default
|
|
18
|
+
* @default {useUniqueId}
|
|
20
19
|
*/
|
|
21
20
|
id: '',
|
|
22
21
|
/**
|
|
23
22
|
* Optional flag to denote if this field is required. When true the `FormField.Input` will have
|
|
24
23
|
* `required` set to true, and an asterisk will be appended to the `FormField.Label`.
|
|
25
|
-
* @default false
|
|
26
24
|
*/
|
|
27
25
|
isRequired: false,
|
|
28
26
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {FlexProps} from '@workday/canvas-kit-react/layout';
|
|
2
2
|
import {space} from '@workday/canvas-kit-react/tokens';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -6,21 +6,21 @@ import {space} from '@workday/canvas-kit-react/tokens';
|
|
|
6
6
|
*/
|
|
7
7
|
export const useFormFieldOrientation = (orientation: 'horizontal' | 'vertical') => {
|
|
8
8
|
let layoutProps: {
|
|
9
|
-
flexDirection:
|
|
10
|
-
alignItems:
|
|
11
|
-
|
|
9
|
+
flexDirection: FlexProps['flexDirection'];
|
|
10
|
+
alignItems: FlexProps['alignItems'];
|
|
11
|
+
gap: FlexProps['gap'];
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
if (orientation === 'horizontal') {
|
|
15
15
|
layoutProps = {
|
|
16
16
|
flexDirection: 'row',
|
|
17
|
-
|
|
17
|
+
gap: space.l,
|
|
18
18
|
alignItems: 'center',
|
|
19
19
|
};
|
|
20
20
|
} else {
|
|
21
21
|
layoutProps = {
|
|
22
22
|
flexDirection: 'column',
|
|
23
|
-
|
|
23
|
+
gap: space.xxxs,
|
|
24
24
|
alignItems: 'flex-start',
|
|
25
25
|
};
|
|
26
26
|
}
|
package/menu/lib/Menu.tsx
CHANGED
|
@@ -9,8 +9,8 @@ import {hideMouseFocus, GrowthBehavior, generateUniqueId} from '@workday/canvas-
|
|
|
9
9
|
/**
|
|
10
10
|
* ### Deprecated Menu
|
|
11
11
|
*
|
|
12
|
-
* As of Canvas Kit v8, Menu is being
|
|
13
|
-
* It will be
|
|
12
|
+
* As of Canvas Kit v8, Menu is being deprecated.
|
|
13
|
+
* It will be removed in v10. Please see the
|
|
14
14
|
* [upgrade guide](https://workday.github.io/canvas-kit/?path=/story/welcome-upgrade-guides-v8-0--page)
|
|
15
15
|
* for more information.
|
|
16
16
|
*/
|
|
@@ -57,8 +57,8 @@ export interface DeprecatedMenuProps
|
|
|
57
57
|
/**
|
|
58
58
|
* ### Deprecated Menu State
|
|
59
59
|
*
|
|
60
|
-
* As of Canvas Kit v8, Menu is being
|
|
61
|
-
* It will be
|
|
60
|
+
* As of Canvas Kit v8, Menu is being deprecated.
|
|
61
|
+
* It will be removed in v10. Please see the
|
|
62
62
|
* [upgrade guide](https://workday.github.io/canvas-kit/?path=/story/welcome-upgrade-guides-v8-0--page)
|
|
63
63
|
* for more information.
|
|
64
64
|
*/
|
|
@@ -78,12 +78,19 @@ const List = styled('ul')({
|
|
|
78
78
|
});
|
|
79
79
|
|
|
80
80
|
/**
|
|
81
|
-
*
|
|
81
|
+
* As of Canvas Kit v8, Menu is being deprecated.
|
|
82
|
+
* It will be removed in v10. Please see the [upgrade
|
|
83
|
+
* guide](https://workday.github.io/canvas-kit/?path=/story/welcome-upgrade-guides-v8-0--page) for
|
|
84
|
+
* more information.
|
|
82
85
|
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
86
|
+
* `DeprecatedMenu` renders a styled `<ul role="menu">` element within a {@link Card} and follows
|
|
87
|
+
* the [Active Menu
|
|
88
|
+
* pattern](https://www.w3.org/TR/wai-aria-practices/examples/menu-button/menu-button-actions-active-descendant.html)
|
|
89
|
+
* using `aria-activedescendant`.
|
|
90
|
+
*
|
|
91
|
+
* Undocumented props are spread to the underlying `<ul>` element.
|
|
92
|
+
*
|
|
93
|
+
* @deprecated
|
|
87
94
|
*/
|
|
88
95
|
export class DeprecatedMenu extends React.Component<DeprecatedMenuProps, DeprecatedMenuState> {
|
|
89
96
|
private id = generateUniqueId();
|
package/menu/lib/MenuItem.tsx
CHANGED
|
@@ -14,8 +14,8 @@ import {SystemIcon, SystemIconProps} from '@workday/canvas-kit-react/icon';
|
|
|
14
14
|
/**
|
|
15
15
|
* ### Deprecated Menu Item Props
|
|
16
16
|
*
|
|
17
|
-
* As of Canvas Kit v8, Menu is being
|
|
18
|
-
* It will be
|
|
17
|
+
* As of Canvas Kit v8, Menu is being deprecated.
|
|
18
|
+
* It will be removed in v10. Please see the
|
|
19
19
|
* [upgrade guide](https://workday.github.io/canvas-kit/?path=/story/welcome-upgrade-guides-v8-0--page)
|
|
20
20
|
* for more information.
|
|
21
21
|
*/
|
|
@@ -254,12 +254,22 @@ const scrollIntoViewIfNeeded = (elem: HTMLElement, centerIfNeeded = true): void
|
|
|
254
254
|
};
|
|
255
255
|
|
|
256
256
|
/**
|
|
257
|
-
*
|
|
257
|
+
* `DeprecatedMenuItem` renders an `<li>` element with the correct attributes to ensure it is
|
|
258
|
+
* accessible. If you choose to implement your own custom menu items, be sure to use semantic `<li>`
|
|
259
|
+
* elements with the following attributes:
|
|
258
260
|
*
|
|
259
|
-
*
|
|
260
|
-
*
|
|
261
|
-
*
|
|
262
|
-
*
|
|
261
|
+
* - `role="menuitem"`
|
|
262
|
+
* - `tabindex={-1}`
|
|
263
|
+
* - `id`s following this pattern: `${MenuId}-${index}`
|
|
264
|
+
*
|
|
265
|
+
* As of Canvas Kit v8, Menu is being deprecated.
|
|
266
|
+
* It will be removed in v10. Please see the [upgrade
|
|
267
|
+
* guide](https://workday.github.io/canvas-kit/?path=/story/welcome-upgrade-guides-v8-0--page) for
|
|
268
|
+
* more information.
|
|
269
|
+
*
|
|
270
|
+
* Undocumented props are spread to the underlying `<li>` element.
|
|
271
|
+
*
|
|
272
|
+
* @deprecated
|
|
263
273
|
*/
|
|
264
274
|
export class DeprecatedMenuItem extends React.Component<DeprecatedMenuItemProps> {
|
|
265
275
|
ref = React.createRef<HTMLLIElement>();
|
|
@@ -301,12 +311,13 @@ export class DeprecatedMenuItem extends React.Component<DeprecatedMenuItemProps>
|
|
|
301
311
|
|
|
302
312
|
return (
|
|
303
313
|
<>
|
|
304
|
-
{hasDivider && <Divider />}
|
|
314
|
+
{hasDivider && <Divider aria-hidden="true" />}
|
|
305
315
|
<Item
|
|
306
316
|
ref={this.ref}
|
|
307
317
|
tabIndex={-1}
|
|
308
318
|
id={id}
|
|
309
319
|
role={isHeader ? 'presentation' : role}
|
|
320
|
+
aria-hidden={isHeader ? true : undefined}
|
|
310
321
|
onClick={this.handleClick}
|
|
311
322
|
aria-disabled={isDisabled ? true : undefined}
|
|
312
323
|
isDisabled={!!isDisabled}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-preview-react",
|
|
3
|
-
"version": "8.0.0-alpha.
|
|
3
|
+
"version": "8.0.0-alpha.428-next.2+2c79134a",
|
|
4
4
|
"description": "Canvas Kit Preview is made up of components that have the full design and a11y review, are part of the DS ecosystem and are approved for use in product. The API's could be subject to change, but not without strong communication and migration strategies.",
|
|
5
5
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -41,21 +41,20 @@
|
|
|
41
41
|
"workday"
|
|
42
42
|
],
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"react": "
|
|
44
|
+
"react": ">=16.14"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@emotion/react": "^11.7.1",
|
|
48
48
|
"@emotion/styled": "^11.6.0",
|
|
49
|
-
"@workday/canvas-kit-react": "^8.0.0-alpha.
|
|
49
|
+
"@workday/canvas-kit-react": "^8.0.0-alpha.428-next.2+2c79134a",
|
|
50
50
|
"@workday/canvas-system-icons-web": "^3.0.0",
|
|
51
51
|
"@workday/design-assets-types": "^0.2.8"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@workday/canvas-accent-icons-web": "^3.0.0",
|
|
55
|
-
"@workday/canvas-kit-labs-react": "^8.0.0-alpha.254-next.23+2fa69377",
|
|
56
55
|
"formik": "^2.2.9",
|
|
57
56
|
"react-hook-form": "7.36.1",
|
|
58
57
|
"yup": "^0.32.11"
|
|
59
58
|
},
|
|
60
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "2c79134aa48ef0efde9cdf883b529b8157337a28"
|
|
61
60
|
}
|
package/pill/lib/Pill.tsx
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
styled,
|
|
10
10
|
StyledType,
|
|
11
11
|
} from '@workday/canvas-kit-react/common';
|
|
12
|
-
import {BoxProps, boxStyleFn,
|
|
12
|
+
import {BoxProps, boxStyleFn, Flex} from '@workday/canvas-kit-react/layout';
|
|
13
13
|
import {borderRadius, colors, space, type} from '@workday/canvas-kit-react/tokens';
|
|
14
14
|
|
|
15
15
|
import {usePillModel} from './usePillModel';
|
|
@@ -160,14 +160,113 @@ const StyledNonInteractivePill = styled(StyledBasePill)<StyledType>({
|
|
|
160
160
|
position: 'relative',
|
|
161
161
|
});
|
|
162
162
|
|
|
163
|
+
/**
|
|
164
|
+
* By default, a `Pill` renders an interactive element that accepts subcomponents. By "interactive"
|
|
165
|
+
* we mean that the Pill container is a focusable element (a `<button>`). All leading elements
|
|
166
|
+
* (icons or avatars) are intended to be descriptive, helping support the label. They should not
|
|
167
|
+
* receive focus.
|
|
168
|
+
*
|
|
169
|
+
* `Pill` is the container component. It also provides a React context model for its subcomponents.
|
|
170
|
+
* Based on the `variant` prop this component will render different styled `Pill`s.
|
|
171
|
+
*
|
|
172
|
+
* Example of read only:
|
|
173
|
+
*
|
|
174
|
+
* ```tsx
|
|
175
|
+
* <Pill variant="readOnly">This is a read only</Pill>
|
|
176
|
+
* ```
|
|
177
|
+
*
|
|
178
|
+
* Example of interactive:
|
|
179
|
+
*
|
|
180
|
+
* ```tsx
|
|
181
|
+
* <Pill onClick={() => console.log('clicked')}>
|
|
182
|
+
* <Pill.Avatar /> Regina Skeltor
|
|
183
|
+
* </Pill>
|
|
184
|
+
* ```
|
|
185
|
+
*
|
|
186
|
+
* Example of removable:
|
|
187
|
+
*
|
|
188
|
+
* ```tsx
|
|
189
|
+
* <Pill variant="removable">
|
|
190
|
+
* <Pill.Avatar /> Regina Skeltor
|
|
191
|
+
* <Pill.IconButton onClick={() => console.log('clicked')} />
|
|
192
|
+
* </Pill>
|
|
193
|
+
* ```
|
|
194
|
+
*
|
|
195
|
+
* If you set the `Pill` `variant` to `removable`, it will render a `<span>` element. You can then
|
|
196
|
+
* provide a `Pill.IconButton` that acts as the focus target. This creates a smaller, more
|
|
197
|
+
* intentional click target that prevents users from accidentally deleting an item.
|
|
198
|
+
*
|
|
199
|
+
* ```tsx
|
|
200
|
+
* <Pill variant="removable">
|
|
201
|
+
* Shoes
|
|
202
|
+
* <Pill.IconButton onClick={() => console.log('handle remove')} />
|
|
203
|
+
* </Pill>
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
163
206
|
export const Pill = createContainer('button')({
|
|
207
|
+
displayName: 'Pill',
|
|
164
208
|
modelHook: usePillModel,
|
|
165
209
|
subComponents: {
|
|
166
|
-
|
|
210
|
+
/**
|
|
211
|
+
* This component renders an avatar. It supports all props of the `Avatar` component.
|
|
212
|
+
*
|
|
213
|
+
* ```tsx
|
|
214
|
+
* <Pill variant="removable">
|
|
215
|
+
* <Pill.Avatar url={avatarUrl} />
|
|
216
|
+
* Regina Skeltor
|
|
217
|
+
* <Pill.IconButton onClick={() => console.log('handle remove')} />
|
|
218
|
+
* </Pill>
|
|
219
|
+
* ```
|
|
220
|
+
*/
|
|
167
221
|
Avatar: PillAvatar,
|
|
222
|
+
/**
|
|
223
|
+
* This component renders its `children` as the count.
|
|
224
|
+
*
|
|
225
|
+
* ```tsx
|
|
226
|
+
* <Pill onClick={() => console.warn('clicked')}>
|
|
227
|
+
* Shoes
|
|
228
|
+
* <Pill.Count>30</Pill.Count>
|
|
229
|
+
* </Pill>
|
|
230
|
+
* ```
|
|
231
|
+
*/
|
|
168
232
|
Count: PillCount,
|
|
169
|
-
|
|
233
|
+
/**
|
|
234
|
+
* This component renders an `icon`. It not be used with the `default` styling – not `readOnly`
|
|
235
|
+
* or `removable` variants. By default it renders a `plusIcon` but it can be overridden by
|
|
236
|
+
* providing an icon to the `icon` prop.
|
|
237
|
+
*
|
|
238
|
+
* ```tsx
|
|
239
|
+
* <Pill onClick={() => console.warn('clicked')}>
|
|
240
|
+
* <Pill.Icon />
|
|
241
|
+
* <Pill.Label>Regina Skeltor</Pill.Label>
|
|
242
|
+
* </Pill>
|
|
243
|
+
* ```
|
|
244
|
+
*/
|
|
245
|
+
Icon: PillIcon,
|
|
246
|
+
/**
|
|
247
|
+
* This component renders a custom icon button. It is only intended to be used with the
|
|
248
|
+
* `removable` variant. By default, it renders a `xSmallIcon` but can be overridden by providing
|
|
249
|
+
* an icon to the `icon` prop.
|
|
250
|
+
*
|
|
251
|
+
* ```tsx
|
|
252
|
+
* <Pill variant="removable">
|
|
253
|
+
* Pink Shirts
|
|
254
|
+
* <Pill.IconButton onClick={() => console.warn('clicked')} />
|
|
255
|
+
* </Pill>
|
|
256
|
+
* ```
|
|
257
|
+
*/
|
|
170
258
|
IconButton: PillIconButton,
|
|
259
|
+
/**
|
|
260
|
+
* This component renders a `<span>` that automatically handles overflow by rendering a tooltip.
|
|
261
|
+
* There's no need to use this component directly since the overflow is handled for you automatically.
|
|
262
|
+
*
|
|
263
|
+
* ```tsx
|
|
264
|
+
* <Pill variant="readOnly">
|
|
265
|
+
* <Pill.Label>Read-only</Pill.Label>
|
|
266
|
+
* </Pill>
|
|
267
|
+
* ```
|
|
268
|
+
*/
|
|
269
|
+
Label: PillLabel,
|
|
171
270
|
},
|
|
172
271
|
})<PillProps>(({variant = 'default', maxWidth, ...elemProps}, Element, model) => {
|
|
173
272
|
return (
|
|
@@ -190,18 +289,18 @@ export const Pill = createContainer('button')({
|
|
|
190
289
|
{...elemProps}
|
|
191
290
|
disabled={model.state.disabled}
|
|
192
291
|
>
|
|
193
|
-
<
|
|
292
|
+
<Flex gap="xxxs" display="inline-flex" alignItems="center">
|
|
194
293
|
{React.Children.map(elemProps.children, (child, index) => {
|
|
195
294
|
if (typeof child === 'string') {
|
|
196
295
|
return <PillLabel key={index}>{child}</PillLabel>;
|
|
197
296
|
}
|
|
198
297
|
return (
|
|
199
|
-
<
|
|
298
|
+
<Flex.Item key={index} display="inline-flex">
|
|
200
299
|
{child}
|
|
201
|
-
</
|
|
300
|
+
</Flex.Item>
|
|
202
301
|
);
|
|
203
302
|
})}
|
|
204
|
-
</
|
|
303
|
+
</Flex>
|
|
205
304
|
</StyledBasePill>
|
|
206
305
|
)}
|
|
207
306
|
{variant === 'removable' && (
|
|
@@ -211,14 +310,14 @@ export const Pill = createContainer('button')({
|
|
|
211
310
|
variant={variant}
|
|
212
311
|
{...elemProps}
|
|
213
312
|
>
|
|
214
|
-
<
|
|
313
|
+
<Flex gap="xxxs" display="inline-flex" alignItems="center" justifyContent="center">
|
|
215
314
|
{React.Children.map(elemProps.children, (child, index) => {
|
|
216
315
|
if (typeof child === 'string') {
|
|
217
316
|
return <PillLabel key={index}>{child}</PillLabel>;
|
|
218
317
|
}
|
|
219
|
-
return <
|
|
318
|
+
return <Flex.Item key={index}>{child}</Flex.Item>;
|
|
220
319
|
})}
|
|
221
|
-
</
|
|
320
|
+
</Flex>
|
|
222
321
|
</StyledNonInteractivePill>
|
|
223
322
|
)}
|
|
224
323
|
</>
|
package/pill/lib/PillCount.tsx
CHANGED
|
@@ -25,7 +25,7 @@ export const PillCount = createComponent('span')({
|
|
|
25
25
|
height={22}
|
|
26
26
|
minWidth={22}
|
|
27
27
|
padding={`0 ${space.xxxs}`}
|
|
28
|
-
marginInlineEnd={`-${space.xxs}`} // Remove
|
|
28
|
+
marginInlineEnd={`-${space.xxs}`} // Remove excess margin at the end
|
|
29
29
|
marginInlineStart={`${space.xxxs}`}
|
|
30
30
|
backgroundColor={colors.soap500}
|
|
31
31
|
data-count="ck-pill-count"
|
package/pill/lib/PillIcon.tsx
CHANGED
|
@@ -21,7 +21,7 @@ export const PillIcon = createSubcomponent('span')({
|
|
|
21
21
|
})<PillIconProps>(({size, icon, ...elemProps}, Element) => {
|
|
22
22
|
return (
|
|
23
23
|
<SystemIcon
|
|
24
|
-
marginInlineStart={`-${space.xxxs}`} // remove
|
|
24
|
+
marginInlineStart={`-${space.xxxs}`} // remove excess margin from the start
|
|
25
25
|
display="flex"
|
|
26
26
|
as={Element}
|
|
27
27
|
size={20}
|
|
@@ -9,11 +9,47 @@ export interface SegmentedControlProps {
|
|
|
9
9
|
children: React.ReactNode;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* `SegmentedControl` is a container component that is responsible for creating a
|
|
14
|
+
* {@link SegmentedControlModel} and sharing it with its subcomponents using React context. It does
|
|
15
|
+
* not represent a real element.
|
|
16
|
+
*
|
|
17
|
+
* ```tsx
|
|
18
|
+
* <SegmentedControl items={[]}>{Child components}</SegmentedControl>
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* Alternatively, you may pass in a model using the [hoisted model
|
|
22
|
+
* pattern](/getting-started/for-developers/resources/compound-components/#configuring-a-model).
|
|
23
|
+
*
|
|
24
|
+
* ```tsx
|
|
25
|
+
* const model = useSegmentedControlModel({
|
|
26
|
+
* items: [],
|
|
27
|
+
* });
|
|
28
|
+
*
|
|
29
|
+
* <SegmentedControl model={model}>{Child components}</SegmentedControl>;
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
12
32
|
export const SegmentedControl = createContainer()({
|
|
13
33
|
displayName: 'SegmentedControl',
|
|
14
34
|
modelHook: useSegmentedControlModel,
|
|
15
35
|
subComponents: {
|
|
36
|
+
/**
|
|
37
|
+
* `SegmentedControl.List` renders {@link Grid} under the hood. It is a container for
|
|
38
|
+
* {@link SegmentedControlItem SegmentedControl.Item} subcomponents.
|
|
39
|
+
*
|
|
40
|
+
* ```tsx
|
|
41
|
+
* <SegmentedControl.List>{SegmentedControl.Items}</SegmentedControl.List>
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
16
44
|
List: SegmentedControlList,
|
|
45
|
+
/**
|
|
46
|
+
* `SegmentedControl.Item` is a `button` element built on `BaseButton`. `SegmentedControl.Item`
|
|
47
|
+
* has a `data-id` prop to handle `onSelect` properly.
|
|
48
|
+
*
|
|
49
|
+
* ```tsx
|
|
50
|
+
* <SegmentedControl.Item data-id="table">Table</SegmentedControl.Item>
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
17
53
|
Item: SegmentedControlItem,
|
|
18
54
|
},
|
|
19
55
|
})<SegmentedControlProps>(({children}) => {
|
|
@@ -15,7 +15,7 @@ export interface SegmentedControlListProps<T = any>
|
|
|
15
15
|
children: ((item: T) => React.ReactNode) | React.ReactNode;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
const useSegmentedControlList = createElemPropsHook(useSegmentedControlModel)(
|
|
18
|
+
export const useSegmentedControlList = createElemPropsHook(useSegmentedControlModel)(
|
|
19
19
|
({state: {orientation, disabled, items}}) => {
|
|
20
20
|
const directionName = orientation === 'vertical' ? 'Row' : 'Column';
|
|
21
21
|
return {
|
|
@@ -11,11 +11,7 @@ import {useSegmentedControlModel} from './useSegmentedControlModel';
|
|
|
11
11
|
export const useSegmentedControlItem = composeHooks(
|
|
12
12
|
useListItemSelect,
|
|
13
13
|
createElemPropsHook(useSegmentedControlModel)(
|
|
14
|
-
(
|
|
15
|
-
model,
|
|
16
|
-
_?: React.Ref<HTMLElement>,
|
|
17
|
-
elemProps: {'data-id'?: string; children?: React.ReactNode} = {}
|
|
18
|
-
) => {
|
|
14
|
+
(model, _, elemProps: {'data-id'?: string; children?: React.ReactNode} = {}) => {
|
|
19
15
|
const name = elemProps['data-id'] || '';
|
|
20
16
|
const selected = !!name && isSelected(name, model.state);
|
|
21
17
|
|