@workday/canvas-kit-preview-react 7.1.4 → 7.2.0-427-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/README.md +1 -1
- package/color-picker/index.ts +1 -1
- package/color-picker/lib/ColorPicker.tsx +3 -4
- package/color-picker/package.json +2 -1
- package/dist/commonjs/color-picker/index.d.ts +1 -1
- package/dist/commonjs/color-picker/index.d.ts.map +1 -1
- package/dist/commonjs/color-picker/index.js +2 -6
- package/dist/commonjs/color-picker/lib/ColorPicker.d.ts +1 -2
- package/dist/commonjs/color-picker/lib/ColorPicker.d.ts.map +1 -1
- package/dist/commonjs/color-picker/lib/ColorPicker.js +28 -50
- 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 -19
- 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.d.ts.map +1 -1
- package/dist/commonjs/form-field/lib/FormFieldHint.js +8 -32
- 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 +10 -39
- 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/index.d.ts +2 -1
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +2 -2
- package/dist/commonjs/menu/index.d.ts +1 -4
- package/dist/commonjs/menu/index.d.ts.map +1 -1
- package/dist/commonjs/menu/index.js +1 -9
- package/dist/commonjs/menu/lib/Menu.d.ts +44 -13
- package/dist/commonjs/menu/lib/Menu.d.ts.map +1 -1
- package/dist/commonjs/menu/lib/Menu.js +127 -130
- package/dist/commonjs/menu/lib/MenuItem.d.ts +45 -14
- package/dist/commonjs/menu/lib/MenuItem.d.ts.map +1 -1
- package/dist/commonjs/menu/lib/MenuItem.js +118 -106
- package/dist/commonjs/pill/lib/Pill.d.ts +101 -13
- 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 +5 -0
- package/dist/commonjs/segmented-control/index.d.ts.map +1 -0
- package/dist/commonjs/segmented-control/index.js +18 -0
- package/dist/commonjs/segmented-control/lib/SegmentedControl.d.ts +1189 -0
- package/dist/commonjs/segmented-control/lib/SegmentedControl.d.ts.map +1 -0
- package/dist/commonjs/segmented-control/lib/SegmentedControl.js +57 -0
- package/dist/commonjs/segmented-control/lib/SegmentedControlItem.d.ts +107 -0
- package/dist/commonjs/segmented-control/lib/SegmentedControlItem.d.ts.map +1 -0
- package/dist/commonjs/segmented-control/lib/SegmentedControlItem.js +105 -0
- package/dist/commonjs/segmented-control/lib/SegmentedControlList.d.ts +135 -0
- package/dist/commonjs/segmented-control/lib/SegmentedControlList.d.ts.map +1 -0
- package/dist/commonjs/segmented-control/lib/SegmentedControlList.js +41 -0
- package/dist/commonjs/segmented-control/lib/hooks/useSegmentedControlItem.d.ts +79 -0
- package/dist/commonjs/segmented-control/lib/hooks/useSegmentedControlItem.d.ts.map +1 -0
- package/dist/commonjs/segmented-control/lib/hooks/useSegmentedControlItem.js +21 -0
- package/dist/commonjs/segmented-control/lib/hooks/useSegmentedControlModel.d.ts +1202 -0
- package/dist/commonjs/segmented-control/lib/hooks/useSegmentedControlModel.d.ts.map +1 -0
- package/dist/commonjs/segmented-control/lib/hooks/useSegmentedControlModel.js +75 -0
- package/dist/commonjs/select/index.d.ts +0 -3
- package/dist/commonjs/select/index.d.ts.map +1 -1
- package/dist/commonjs/select/index.js +0 -7
- package/dist/commonjs/select/lib/Select.d.ts +0 -1
- package/dist/commonjs/select/lib/Select.d.ts.map +1 -1
- package/dist/commonjs/select/lib/Select.js +147 -191
- package/dist/commonjs/select/lib/SelectBase.d.ts +2 -2
- package/dist/commonjs/select/lib/SelectBase.d.ts.map +1 -1
- package/dist/commonjs/select/lib/SelectBase.js +109 -107
- package/dist/commonjs/select/lib/SelectMenu.d.ts +2 -2
- package/dist/commonjs/select/lib/SelectMenu.d.ts.map +1 -1
- package/dist/commonjs/select/lib/SelectMenu.js +55 -86
- package/dist/commonjs/select/lib/SelectOption.d.ts +1 -2
- package/dist/commonjs/select/lib/SelectOption.d.ts.map +1 -1
- package/dist/commonjs/select/lib/SelectOption.js +35 -48
- package/dist/commonjs/select/lib/scrolling.js +6 -7
- package/dist/commonjs/select/lib/utils.js +4 -4
- package/dist/commonjs/side-panel/index.d.ts +0 -3
- package/dist/commonjs/side-panel/index.d.ts.map +1 -1
- package/dist/commonjs/side-panel/index.js +0 -7
- package/dist/commonjs/side-panel/lib/SidePanel.d.ts +13 -27
- 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 +4 -0
- package/dist/commonjs/status-indicator/index.d.ts.map +1 -0
- package/dist/commonjs/status-indicator/index.js +17 -0
- package/dist/commonjs/status-indicator/lib/StatusIndicator.d.ts +66 -0
- package/dist/commonjs/status-indicator/lib/StatusIndicator.d.ts.map +1 -0
- package/dist/commonjs/status-indicator/lib/StatusIndicator.js +57 -0
- package/dist/commonjs/status-indicator/lib/StatusIndicatorIcon.d.ts +83 -0
- package/dist/commonjs/status-indicator/lib/StatusIndicatorIcon.d.ts.map +1 -0
- package/dist/commonjs/status-indicator/lib/StatusIndicatorIcon.js +86 -0
- package/dist/commonjs/status-indicator/lib/StatusIndicatorLabel.d.ts +5 -0
- package/dist/commonjs/status-indicator/lib/StatusIndicatorLabel.d.ts.map +1 -0
- package/dist/commonjs/status-indicator/lib/StatusIndicatorLabel.js +15 -0
- package/dist/commonjs/status-indicator/lib/hooks/index.d.ts +2 -0
- package/dist/commonjs/status-indicator/lib/hooks/index.d.ts.map +1 -0
- package/dist/commonjs/{breadcrumbs → status-indicator/lib/hooks}/index.js +1 -5
- package/dist/commonjs/status-indicator/lib/hooks/useStatusIndicatorModel.d.ts +75 -0
- package/dist/commonjs/status-indicator/lib/hooks/useStatusIndicatorModel.d.ts.map +1 -0
- package/dist/commonjs/status-indicator/lib/hooks/useStatusIndicatorModel.js +25 -0
- 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 +3 -12
- 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 +2 -2
- package/dist/commonjs/text-area/lib/TextAreaField.d.ts.map +1 -1
- package/dist/commonjs/text-area/lib/TextAreaField.js +25 -41
- package/dist/commonjs/text-input/lib/TextInput.d.ts +5 -14
- 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 +2 -2
- package/dist/commonjs/text-input/lib/TextInputField.d.ts.map +1 -1
- package/dist/commonjs/text-input/lib/TextInputField.js +25 -30
- 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/index.d.ts +1 -1
- package/dist/es6/color-picker/index.d.ts.map +1 -1
- package/dist/es6/color-picker/index.js +1 -1
- package/dist/es6/color-picker/lib/ColorPicker.d.ts +1 -2
- package/dist/es6/color-picker/lib/ColorPicker.d.ts.map +1 -1
- package/dist/es6/color-picker/lib/ColorPicker.js +17 -41
- 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 -19
- 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.d.ts.map +1 -1
- package/dist/es6/form-field/lib/FormFieldHint.js +7 -31
- 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 +9 -38
- 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/index.d.ts +2 -1
- package/dist/es6/index.d.ts.map +1 -1
- package/dist/es6/index.js +2 -2
- package/dist/es6/menu/index.d.ts +1 -4
- package/dist/es6/menu/index.d.ts.map +1 -1
- package/dist/es6/menu/index.js +1 -4
- package/dist/es6/menu/lib/Menu.d.ts +44 -13
- package/dist/es6/menu/lib/Menu.d.ts.map +1 -1
- package/dist/es6/menu/lib/Menu.js +120 -125
- package/dist/es6/menu/lib/MenuItem.d.ts +45 -14
- package/dist/es6/menu/lib/MenuItem.d.ts.map +1 -1
- package/dist/es6/menu/lib/MenuItem.js +112 -102
- package/dist/es6/pill/lib/Pill.d.ts +107 -19
- 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.d.ts +1 -2
- package/dist/es6/pill/lib/PillAvatar.d.ts.map +1 -1
- package/dist/es6/pill/lib/PillAvatar.js +3 -14
- package/dist/es6/pill/lib/PillCount.js +4 -27
- package/dist/es6/pill/lib/PillIcon.d.ts +1 -2
- package/dist/es6/pill/lib/PillIcon.d.ts.map +1 -1
- package/dist/es6/pill/lib/PillIcon.js +3 -26
- package/dist/es6/pill/lib/PillIconButton.d.ts +1 -2
- package/dist/es6/pill/lib/PillIconButton.d.ts.map +1 -1
- package/dist/es6/pill/lib/PillIconButton.js +7 -30
- package/dist/es6/pill/lib/PillLabel.d.ts +1 -2
- package/dist/es6/pill/lib/PillLabel.d.ts.map +1 -1
- package/dist/es6/pill/lib/PillLabel.js +5 -28
- package/dist/es6/pill/lib/usePillModel.d.ts +5 -5
- package/dist/es6/pill/lib/usePillModel.js +8 -16
- package/dist/es6/segmented-control/index.d.ts +5 -0
- package/dist/es6/segmented-control/index.d.ts.map +1 -0
- package/dist/es6/segmented-control/index.js +4 -0
- package/dist/es6/segmented-control/lib/SegmentedControl.d.ts +1189 -0
- package/dist/es6/segmented-control/lib/SegmentedControl.d.ts.map +1 -0
- package/dist/es6/segmented-control/lib/SegmentedControl.js +51 -0
- package/dist/es6/segmented-control/lib/SegmentedControlItem.d.ts +107 -0
- package/dist/es6/segmented-control/lib/SegmentedControlItem.d.ts.map +1 -0
- package/dist/es6/segmented-control/lib/SegmentedControlItem.js +83 -0
- package/dist/es6/segmented-control/lib/SegmentedControlList.d.ts +135 -0
- package/dist/es6/segmented-control/lib/SegmentedControlList.d.ts.map +1 -0
- package/dist/es6/segmented-control/lib/SegmentedControlList.js +19 -0
- package/dist/es6/segmented-control/lib/hooks/useSegmentedControlItem.d.ts +79 -0
- package/dist/es6/segmented-control/lib/hooks/useSegmentedControlItem.d.ts.map +1 -0
- package/dist/es6/segmented-control/lib/hooks/useSegmentedControlItem.js +18 -0
- package/dist/es6/segmented-control/lib/hooks/useSegmentedControlModel.d.ts +1202 -0
- package/dist/es6/segmented-control/lib/hooks/useSegmentedControlModel.d.ts.map +1 -0
- package/dist/es6/segmented-control/lib/hooks/useSegmentedControlModel.js +69 -0
- package/dist/es6/select/index.d.ts +0 -3
- package/dist/es6/select/index.d.ts.map +1 -1
- package/dist/es6/select/index.js +0 -3
- package/dist/es6/select/lib/Select.d.ts +0 -1
- package/dist/es6/select/lib/Select.d.ts.map +1 -1
- package/dist/es6/select/lib/Select.js +145 -186
- package/dist/es6/select/lib/SelectBase.d.ts +2 -2
- package/dist/es6/select/lib/SelectBase.d.ts.map +1 -1
- package/dist/es6/select/lib/SelectBase.js +101 -97
- package/dist/es6/select/lib/SelectMenu.d.ts +2 -2
- package/dist/es6/select/lib/SelectMenu.d.ts.map +1 -1
- package/dist/es6/select/lib/SelectMenu.js +49 -81
- package/dist/es6/select/lib/SelectOption.d.ts +1 -2
- package/dist/es6/select/lib/SelectOption.d.ts.map +1 -1
- package/dist/es6/select/lib/SelectOption.js +30 -45
- package/dist/es6/select/lib/scrolling.js +6 -7
- package/dist/es6/select/lib/utils.js +4 -4
- package/dist/es6/side-panel/index.d.ts +0 -3
- package/dist/es6/side-panel/index.d.ts.map +1 -1
- package/dist/es6/side-panel/index.js +0 -3
- package/dist/es6/side-panel/lib/SidePanel.d.ts +13 -27
- package/dist/es6/side-panel/lib/SidePanel.d.ts.map +1 -1
- package/dist/es6/side-panel/lib/SidePanel.js +93 -131
- 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 +4 -0
- package/dist/es6/status-indicator/index.d.ts.map +1 -0
- package/dist/es6/status-indicator/index.js +3 -0
- package/dist/es6/status-indicator/lib/StatusIndicator.d.ts +66 -0
- package/dist/es6/status-indicator/lib/StatusIndicator.d.ts.map +1 -0
- package/dist/es6/status-indicator/lib/StatusIndicator.js +51 -0
- package/dist/es6/status-indicator/lib/StatusIndicatorIcon.d.ts +83 -0
- package/dist/es6/status-indicator/lib/StatusIndicatorIcon.d.ts.map +1 -0
- package/dist/es6/status-indicator/lib/StatusIndicatorIcon.js +80 -0
- package/dist/es6/status-indicator/lib/StatusIndicatorLabel.d.ts +5 -0
- package/dist/es6/status-indicator/lib/StatusIndicatorLabel.d.ts.map +1 -0
- package/dist/es6/status-indicator/lib/StatusIndicatorLabel.js +9 -0
- package/dist/es6/status-indicator/lib/hooks/index.d.ts +2 -0
- package/dist/es6/status-indicator/lib/hooks/index.d.ts.map +1 -0
- package/dist/es6/status-indicator/lib/hooks/index.js +1 -0
- package/dist/es6/status-indicator/lib/hooks/useStatusIndicatorModel.d.ts +75 -0
- package/dist/es6/status-indicator/lib/hooks/useStatusIndicatorModel.d.ts.map +1 -0
- package/dist/es6/status-indicator/lib/hooks/useStatusIndicatorModel.js +22 -0
- 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 +3 -12
- 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 +2 -2
- package/dist/es6/text-area/lib/TextAreaField.d.ts.map +1 -1
- package/dist/es6/text-area/lib/TextAreaField.js +22 -38
- package/dist/es6/text-input/lib/TextInput.d.ts +5 -14
- 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 +2 -2
- package/dist/es6/text-input/lib/TextInputField.d.ts.map +1 -1
- package/dist/es6/text-input/lib/TextInputField.js +24 -29
- 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/FormFieldHint.tsx +23 -30
- package/form-field/lib/FormFieldLabel.tsx +18 -33
- package/form-field/lib/hooks/useFormFieldModel.tsx +1 -3
- package/form-field/lib/hooks/useFormFieldOrientation.tsx +6 -6
- package/form-field/package.json +2 -1
- package/index.ts +2 -3
- package/menu/index.ts +1 -6
- package/menu/lib/Menu.tsx +81 -27
- package/menu/lib/MenuItem.tsx +63 -19
- package/menu/package.json +2 -1
- package/package.json +6 -6
- package/pill/lib/Pill.tsx +109 -10
- package/pill/lib/PillCount.tsx +1 -1
- package/pill/lib/PillIcon.tsx +1 -1
- package/pill/package.json +2 -1
- package/segmented-control/LICENSE +126 -0
- package/segmented-control/README.md +6 -0
- package/segmented-control/index.ts +4 -0
- package/segmented-control/lib/SegmentedControl.tsx +57 -0
- package/segmented-control/lib/SegmentedControlItem.tsx +175 -0
- package/segmented-control/lib/SegmentedControlList.tsx +49 -0
- package/segmented-control/lib/hooks/useSegmentedControlItem.tsx +33 -0
- package/segmented-control/lib/hooks/useSegmentedControlModel.tsx +75 -0
- package/segmented-control/package.json +6 -0
- package/select/README.md +7 -7
- package/select/index.ts +0 -4
- package/select/lib/Select.tsx +1 -3
- package/select/lib/SelectBase.tsx +3 -5
- package/select/lib/SelectMenu.tsx +1 -3
- package/select/lib/SelectOption.tsx +1 -3
- package/select/package.json +2 -1
- package/side-panel/index.ts +0 -4
- package/side-panel/lib/SidePanel.tsx +119 -170
- package/side-panel/lib/SidePanelToggleButton.tsx +78 -0
- package/side-panel/lib/hooks.ts +20 -0
- package/side-panel/package.json +2 -1
- package/status-indicator/LICENSE +52 -0
- package/status-indicator/README.md +12 -0
- package/status-indicator/index.ts +3 -0
- package/status-indicator/lib/StatusIndicator.tsx +75 -0
- package/status-indicator/lib/StatusIndicatorIcon.tsx +88 -0
- package/status-indicator/lib/StatusIndicatorLabel.tsx +28 -0
- package/status-indicator/lib/hooks/index.ts +1 -0
- package/status-indicator/lib/hooks/useStatusIndicatorModel.tsx +29 -0
- package/status-indicator/package.json +6 -0
- package/{breadcrumbs → table}/LICENSE +0 -1
- 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 +7 -3
- package/text-area/package.json +2 -1
- package/text-input/lib/TextInput.tsx +9 -6
- package/text-input/lib/TextInputField.tsx +10 -6
- package/text-input/lib/hooks/useTextInputModel.ts +1 -0
- package/text-input/package.json +2 -1
- package/breadcrumbs/README.md +0 -7
- package/breadcrumbs/index.ts +0 -5
- package/breadcrumbs/lib/Breadcrumbs/Dropdown/Button.tsx +0 -85
- package/breadcrumbs/lib/Breadcrumbs/Dropdown/Menu.tsx +0 -152
- package/breadcrumbs/lib/Breadcrumbs/Dropdown/MenuItemLink.tsx +0 -63
- package/breadcrumbs/lib/Breadcrumbs/Dropdown/hooks.ts +0 -109
- package/breadcrumbs/lib/Breadcrumbs/Dropdown/index.tsx +0 -38
- package/breadcrumbs/lib/Breadcrumbs/List/Collapsible.tsx +0 -66
- package/breadcrumbs/lib/Breadcrumbs/List/CurrentItem.tsx +0 -64
- package/breadcrumbs/lib/Breadcrumbs/List/Link.tsx +0 -88
- package/breadcrumbs/lib/Breadcrumbs/List/ListItem.tsx +0 -30
- package/breadcrumbs/lib/Breadcrumbs/List/hooks.ts +0 -114
- package/breadcrumbs/lib/Breadcrumbs/List/index.tsx +0 -28
- package/breadcrumbs/lib/Breadcrumbs/List/styles.ts +0 -12
- package/breadcrumbs/lib/Breadcrumbs/Nav.tsx +0 -14
- package/breadcrumbs/lib/Breadcrumbs/hooks.ts +0 -13
- package/breadcrumbs/lib/Breadcrumbs/index.tsx +0 -15
- package/breadcrumbs/lib/Breadcrumbs/types.ts +0 -7
- package/breadcrumbs/package.json +0 -5
- package/dist/commonjs/breadcrumbs/index.d.ts +0 -5
- package/dist/commonjs/breadcrumbs/index.d.ts.map +0 -1
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/Button.d.ts +0 -20
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/Button.d.ts.map +0 -1
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/Button.js +0 -69
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/Menu.d.ts +0 -38
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/Menu.d.ts.map +0 -1
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/Menu.js +0 -94
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/MenuItemLink.d.ts +0 -14
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/MenuItemLink.d.ts.map +0 -1
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/MenuItemLink.js +0 -73
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/hooks.d.ts +0 -13
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/hooks.d.ts.map +0 -1
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/hooks.js +0 -77
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/index.d.ts +0 -8
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/index.d.ts.map +0 -1
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/index.js +0 -37
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/Collapsible.d.ts +0 -16
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/Collapsible.d.ts.map +0 -1
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/Collapsible.js +0 -78
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/CurrentItem.d.ts +0 -11
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/CurrentItem.d.ts.map +0 -1
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/CurrentItem.js +0 -49
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/Link.d.ts +0 -19
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/Link.d.ts.map +0 -1
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/Link.js +0 -66
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/ListItem.d.ts +0 -4
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/ListItem.d.ts.map +0 -1
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/ListItem.js +0 -43
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/hooks.d.ts +0 -19
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/hooks.d.ts.map +0 -1
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/hooks.js +0 -116
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/index.d.ts +0 -4
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/index.d.ts.map +0 -1
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/index.js +0 -38
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/styles.d.ts +0 -3
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/styles.d.ts.map +0 -1
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/styles.js +0 -16
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Nav.d.ts +0 -11
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Nav.d.ts.map +0 -1
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Nav.js +0 -34
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/hooks.d.ts +0 -5
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/hooks.d.ts.map +0 -1
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/hooks.js +0 -12
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/index.d.ts +0 -9
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/index.d.ts.map +0 -1
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/index.js +0 -17
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/types.d.ts +0 -8
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/types.d.ts.map +0 -1
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/types.js +0 -2
- 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/breadcrumbs/index.d.ts +0 -5
- package/dist/es6/breadcrumbs/index.d.ts.map +0 -1
- package/dist/es6/breadcrumbs/index.js +0 -4
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/Button.d.ts +0 -20
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/Button.d.ts.map +0 -1
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/Button.js +0 -63
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/Menu.d.ts +0 -38
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/Menu.d.ts.map +0 -1
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/Menu.js +0 -87
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/MenuItemLink.d.ts +0 -14
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/MenuItemLink.d.ts.map +0 -1
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/MenuItemLink.js +0 -51
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/hooks.d.ts +0 -13
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/hooks.d.ts.map +0 -1
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/hooks.js +0 -72
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/index.d.ts +0 -8
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/index.d.ts.map +0 -1
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/index.js +0 -30
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/Collapsible.d.ts +0 -16
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/Collapsible.d.ts.map +0 -1
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/Collapsible.js +0 -55
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/CurrentItem.d.ts +0 -11
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/CurrentItem.d.ts.map +0 -1
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/CurrentItem.js +0 -42
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/Link.d.ts +0 -19
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/Link.d.ts.map +0 -1
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/Link.js +0 -59
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/ListItem.d.ts +0 -4
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/ListItem.d.ts.map +0 -1
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/ListItem.js +0 -36
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/hooks.d.ts +0 -19
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/hooks.d.ts.map +0 -1
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/hooks.js +0 -91
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/index.d.ts +0 -4
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/index.d.ts.map +0 -1
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/index.js +0 -32
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/styles.d.ts +0 -3
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/styles.d.ts.map +0 -1
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/styles.js +0 -12
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/Nav.d.ts +0 -11
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/Nav.d.ts.map +0 -1
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/Nav.js +0 -27
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/hooks.d.ts +0 -5
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/hooks.d.ts.map +0 -1
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/hooks.js +0 -8
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/index.d.ts +0 -9
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/index.d.ts.map +0 -1
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/index.js +0 -14
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/types.d.ts +0 -8
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/types.d.ts.map +0 -1
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/types.js +0 -1
- 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
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}
|
package/pill/package.json
CHANGED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
Apache License, Version 2.0 Apache License Version 2.0, January 2004
|
|
2
|
+
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and
|
|
8
|
+
distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the
|
|
9
|
+
copyright owner or entity authorized by the copyright owner that is granting the License. "Legal
|
|
10
|
+
Entity" shall mean the union of the acting entity and all other entities that control, are
|
|
11
|
+
controlled by, or are under common control with that entity. For the purposes of this definition,
|
|
12
|
+
"control" means (i) the power, direct or indirect, to cause the direction or management of such
|
|
13
|
+
entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
14
|
+
outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an
|
|
15
|
+
individual or Legal Entity exercising permissions granted by this License. "Source" form shall
|
|
16
|
+
mean the preferred form for making modifications, including but not limited to software source
|
|
17
|
+
code, documentation source, and configuration files. "Object" form shall mean any form resulting
|
|
18
|
+
from mechanical transformation or translation of a Source form, including but not limited to
|
|
19
|
+
compiled object code, generated documentation, and conversions to other media types. "Work" shall
|
|
20
|
+
mean the work of authorship, whether in Source or Object form, made available under the License,
|
|
21
|
+
as indicated by a copyright notice that is included in or attached to the work (an example is
|
|
22
|
+
provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or
|
|
23
|
+
Object form, that is based on (or derived from) the Work and for which the editorial revisions,
|
|
24
|
+
annotations, elaborations, or other modifications represent, as a whole, an original work of
|
|
25
|
+
authorship. For the purposes of this License, Derivative Works shall not include works that
|
|
26
|
+
remain separable from, or merely link (or bind by name) to the interfaces of, the Work and
|
|
27
|
+
Derivative Works thereof. "Contribution" shall mean any work of authorship, including the
|
|
28
|
+
original version of the Work and any modifications or additions to that Work or Derivative Works
|
|
29
|
+
thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright
|
|
30
|
+
owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner.
|
|
31
|
+
For the purposes of this definition, "submitted" means any form of electronic, verbal, or written
|
|
32
|
+
communication sent to the Licensor or its representatives, including but not limited to
|
|
33
|
+
communication on electronic mailing lists, source code control systems, and issue tracking
|
|
34
|
+
systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and
|
|
35
|
+
improving the Work, but excluding communication that is conspicuously marked or otherwise
|
|
36
|
+
designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean
|
|
37
|
+
Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by
|
|
38
|
+
Licensor and subsequently incorporated within the Work.
|
|
39
|
+
|
|
40
|
+
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor
|
|
41
|
+
hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
42
|
+
copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform,
|
|
43
|
+
sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
|
44
|
+
|
|
45
|
+
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor
|
|
46
|
+
hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
47
|
+
(except as stated in this section) patent license to make, have made, use, offer to sell, sell,
|
|
48
|
+
import, and otherwise transfer the Work, where such license applies only to those patent claims
|
|
49
|
+
licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or
|
|
50
|
+
by combination of their Contribution(s) with the Work to which such Contribution(s) was
|
|
51
|
+
submitted. If You institute patent litigation against any entity (including a cross-claim or
|
|
52
|
+
counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work
|
|
53
|
+
constitutes direct or contributory patent infringement, then any patent licenses granted to You
|
|
54
|
+
under this License for that Work shall terminate as of the date such litigation is filed.
|
|
55
|
+
|
|
56
|
+
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof
|
|
57
|
+
in any medium, with or without modifications, and in Source or Object form, provided that You
|
|
58
|
+
meet the following conditions: You must give any other recipients of the Work or Derivative Works
|
|
59
|
+
a copy of this License; and You must cause any modified files to carry prominent notices stating
|
|
60
|
+
that You changed the files; and You must retain, in the Source form of any Derivative Works that
|
|
61
|
+
You distribute, all copyright, patent, trademark, and attribution notices from the Source form of
|
|
62
|
+
the Work, excluding those notices that do not pertain to any part of the Derivative Works; and If
|
|
63
|
+
the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works
|
|
64
|
+
that You distribute must include a readable copy of the attribution notices contained within such
|
|
65
|
+
NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in
|
|
66
|
+
at least one of the following places: within a NOTICE text file distributed as part of the
|
|
67
|
+
Derivative Works; within the Source form or documentation, if provided along with the Derivative
|
|
68
|
+
Works; or, within a display generated by the Derivative Works, if and wherever such third-party
|
|
69
|
+
notices normally appear. The contents of the NOTICE file are for informational purposes only and
|
|
70
|
+
do not modify the License. You may add Your own attribution notices within Derivative Works that
|
|
71
|
+
You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such
|
|
72
|
+
additional attribution notices cannot be construed as modifying the License. You may add Your own
|
|
73
|
+
copyright statement to Your modifications and may provide additional or different license terms
|
|
74
|
+
and conditions for use, reproduction, or distribution of Your modifications, or for any such
|
|
75
|
+
Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work
|
|
76
|
+
otherwise complies with the conditions stated in this License.
|
|
77
|
+
|
|
78
|
+
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution
|
|
79
|
+
intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms
|
|
80
|
+
and conditions of this License, without any additional terms or conditions. Notwithstanding the
|
|
81
|
+
above, nothing herein shall supersede or modify the terms of any separate license agreement you
|
|
82
|
+
may have executed with Licensor regarding such Contributions.
|
|
83
|
+
|
|
84
|
+
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service
|
|
85
|
+
marks, or product names of the Licensor, except as required for reasonable and customary use in
|
|
86
|
+
describing the origin of the Work and reproducing the content of the NOTICE file.
|
|
87
|
+
|
|
88
|
+
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor
|
|
89
|
+
provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT
|
|
90
|
+
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation,
|
|
91
|
+
any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
92
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or
|
|
93
|
+
redistributing the Work and assume any risks associated with Your exercise of permissions under
|
|
94
|
+
this License.
|
|
95
|
+
|
|
96
|
+
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including
|
|
97
|
+
negligence), contract, or otherwise, unless required by applicable law (such as deliberate and
|
|
98
|
+
grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for
|
|
99
|
+
damages, including any direct, indirect, special, incidental, or consequential damages of any
|
|
100
|
+
character arising as a result of this License or out of the use or inability to use the Work
|
|
101
|
+
(including but not limited to damages for loss of goodwill, work stoppage, computer failure or
|
|
102
|
+
malfunction, or any and all other commercial damages or losses), even if such Contributor has
|
|
103
|
+
been advised of the possibility of such damages.
|
|
104
|
+
|
|
105
|
+
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works
|
|
106
|
+
thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty,
|
|
107
|
+
indemnity, or other liability obligations and/or rights consistent with this License. However, in
|
|
108
|
+
accepting such obligations, You may act only on Your own behalf and on Your sole responsibility,
|
|
109
|
+
not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each
|
|
110
|
+
Contributor harmless for any liability incurred by, or claims asserted against, such Contributor
|
|
111
|
+
by reason of your accepting any such warranty or additional liability.
|
|
112
|
+
|
|
113
|
+
END OF TERMS AND CONDITIONS
|
|
114
|
+
|
|
115
|
+
©2022 Workday, Inc. All rights reserved. Workday and the Workday logo are registered trademarks of
|
|
116
|
+
Workday, Inc. All other brand and product names are trademarks or registered trademarks of their
|
|
117
|
+
respective holders.
|
|
118
|
+
|
|
119
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
|
|
120
|
+
compliance with the License. You may obtain a copy of the License at
|
|
121
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
122
|
+
|
|
123
|
+
Unless required by applicable law or agreed to in writing, software distributed under the License is
|
|
124
|
+
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
125
|
+
implied. See the License for the specific language governing permissions and limitations under the
|
|
126
|
+
License.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Canvas Kit React Segmented Control
|
|
2
|
+
|
|
3
|
+
`SegmentedControl` contains primary and secondary actions related to a page or task.
|
|
4
|
+
|
|
5
|
+
For more detailed information on this component, please refer to the
|
|
6
|
+
[storybook documentation](https://workday.github.io/canvas-kit/?path=/docs/preview-segmented-control-react--basic)
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {createContainer} from '@workday/canvas-kit-react/common';
|
|
3
|
+
|
|
4
|
+
import {useSegmentedControlModel} from './hooks/useSegmentedControlModel';
|
|
5
|
+
import {SegmentedControlList} from './SegmentedControlList';
|
|
6
|
+
import {SegmentedControlItem} from './SegmentedControlItem';
|
|
7
|
+
|
|
8
|
+
export interface SegmentedControlProps {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
}
|
|
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
|
+
*/
|
|
32
|
+
export const SegmentedControl = createContainer()({
|
|
33
|
+
displayName: 'SegmentedControl',
|
|
34
|
+
modelHook: useSegmentedControlModel,
|
|
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
|
+
*/
|
|
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
|
+
*/
|
|
53
|
+
Item: SegmentedControlItem,
|
|
54
|
+
},
|
|
55
|
+
})<SegmentedControlProps>(({children}) => {
|
|
56
|
+
return <>{children}</>;
|
|
57
|
+
});
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import {colors, type, space} from '@workday/canvas-kit-react/tokens';
|
|
4
|
+
import {createSubcomponent, useIsRTL} from '@workday/canvas-kit-react/common';
|
|
5
|
+
import {Tooltip, TooltipProps} from '@workday/canvas-kit-react/tooltip';
|
|
6
|
+
import {
|
|
7
|
+
BaseButton,
|
|
8
|
+
ButtonContainerProps,
|
|
9
|
+
ButtonColors,
|
|
10
|
+
ButtonSizes,
|
|
11
|
+
getMinWidthStyles,
|
|
12
|
+
} from '@workday/canvas-kit-react/button';
|
|
13
|
+
import {CanvasSystemIcon} from '@workday/design-assets-types';
|
|
14
|
+
import {useSegmentedControlModel} from './hooks/useSegmentedControlModel';
|
|
15
|
+
import {Text} from '@workday/canvas-kit-react/text';
|
|
16
|
+
import {useSegmentedControlItem} from './hooks/useSegmentedControlItem';
|
|
17
|
+
|
|
18
|
+
export interface ItemProps extends ButtonContainerProps {
|
|
19
|
+
/**
|
|
20
|
+
* Optionally pass index to the item. This should be done if `SegmentedControl.Item` components were created
|
|
21
|
+
* via a `[Array::map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)` function. This index will ensure keyboard navigation works even if items are
|
|
22
|
+
* inserted out of order.
|
|
23
|
+
*/
|
|
24
|
+
index?: number;
|
|
25
|
+
/**
|
|
26
|
+
* The contents of the item. This is text used as the accessible name of the button for screen readers.
|
|
27
|
+
*/
|
|
28
|
+
children?: React.ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* The identifier of the item. This identifier will be used in change events and for `initialTab`.
|
|
31
|
+
* If this property is not provided, it will default to a string representation
|
|
32
|
+
* of the the zero-based index of the item when it was initialized.
|
|
33
|
+
*/
|
|
34
|
+
'data-id'?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Optional id. If not set, it will inherit the ID passed to the `SegmentedControl` component and append the
|
|
37
|
+
* index at the end. Only set this for advanced cases.
|
|
38
|
+
*/
|
|
39
|
+
id?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Part of the ARIA specification for buttons. Lets screen readers know which button is active. This
|
|
42
|
+
* should either be `true` or `false`. This is automatically set by the
|
|
43
|
+
* component and should only be used in advanced cases.
|
|
44
|
+
*/
|
|
45
|
+
'aria-pressed'?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* The icon of the button.
|
|
48
|
+
*/
|
|
49
|
+
icon?: CanvasSystemIcon;
|
|
50
|
+
/**
|
|
51
|
+
* Tooltip Props
|
|
52
|
+
*/
|
|
53
|
+
tooltipProps?: Omit<TooltipProps, 'children'>;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const getButtonSize = (size: ButtonContainerProps['size']) => {
|
|
57
|
+
switch (size) {
|
|
58
|
+
case 'large':
|
|
59
|
+
return 'medium';
|
|
60
|
+
case 'medium':
|
|
61
|
+
return 'small';
|
|
62
|
+
case 'small':
|
|
63
|
+
return 'extraSmall';
|
|
64
|
+
default:
|
|
65
|
+
return 'medium';
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const getIconButtonColors = (toggled?: boolean): ButtonColors => {
|
|
70
|
+
return {
|
|
71
|
+
default: {
|
|
72
|
+
background: toggled ? colors.frenchVanilla100 : colors.soap200,
|
|
73
|
+
border: toggled ? colors.licorice200 : 'transparent',
|
|
74
|
+
icon: toggled ? colors.blackPepper400 : colors.licorice400,
|
|
75
|
+
label: toggled ? colors.blackPepper400 : colors.licorice400,
|
|
76
|
+
},
|
|
77
|
+
hover: {
|
|
78
|
+
background: toggled ? colors.frenchVanilla100 : colors.soap400,
|
|
79
|
+
icon: colors.licorice400,
|
|
80
|
+
label: colors.licorice400,
|
|
81
|
+
},
|
|
82
|
+
active: {
|
|
83
|
+
background: toggled ? colors.frenchVanilla100 : colors.soap400,
|
|
84
|
+
icon: colors.licorice400,
|
|
85
|
+
label: colors.licorice400,
|
|
86
|
+
},
|
|
87
|
+
focus: {},
|
|
88
|
+
disabled: {
|
|
89
|
+
background: colors.soap200,
|
|
90
|
+
opacity: '1',
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const getPaddingStyles = (
|
|
96
|
+
children: React.ReactNode,
|
|
97
|
+
size: ButtonContainerProps['size'],
|
|
98
|
+
icon: CanvasSystemIcon | undefined
|
|
99
|
+
) => {
|
|
100
|
+
if (!children) {
|
|
101
|
+
return 0;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
switch (size) {
|
|
105
|
+
case 'large':
|
|
106
|
+
return icon ? `0 ${space.m} 0 20px` : `0 ${space.m}`;
|
|
107
|
+
|
|
108
|
+
case 'medium':
|
|
109
|
+
return icon ? `0 20px 0 ${space.s}` : `0 ${space.s}`;
|
|
110
|
+
|
|
111
|
+
case 'small':
|
|
112
|
+
return icon ? `0 ${space.xs} 0 ${space.xxs}` : `0 ${space.xs}`;
|
|
113
|
+
|
|
114
|
+
default:
|
|
115
|
+
return icon ? `0 20px 0 ${space.s}` : `0 ${space.s}`;
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const geButtonStyles = (size: ButtonSizes, children: React.ReactNode, icon?: CanvasSystemIcon) => {
|
|
120
|
+
const buttonSize = getButtonSize(size);
|
|
121
|
+
const minWidthValue = getMinWidthStyles(children, children ? size : buttonSize);
|
|
122
|
+
|
|
123
|
+
return {
|
|
124
|
+
height: getMinWidthStyles(false, buttonSize),
|
|
125
|
+
minWidth: minWidthValue,
|
|
126
|
+
padding: getPaddingStyles(children, size, icon),
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const Container = ({
|
|
131
|
+
tooltipProps,
|
|
132
|
+
children,
|
|
133
|
+
}: {
|
|
134
|
+
tooltipProps?: Omit<TooltipProps, 'children'>;
|
|
135
|
+
children: React.ReactElement;
|
|
136
|
+
}) => {
|
|
137
|
+
return tooltipProps ? (
|
|
138
|
+
<Tooltip {...tooltipProps}>{children}</Tooltip>
|
|
139
|
+
) : (
|
|
140
|
+
<React.Fragment>{children}</React.Fragment>
|
|
141
|
+
);
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
export const SegmentedControlItem = createSubcomponent('button')({
|
|
145
|
+
displayName: 'SegmentedControl.Item',
|
|
146
|
+
modelHook: useSegmentedControlModel,
|
|
147
|
+
elemPropsHook: useSegmentedControlItem,
|
|
148
|
+
})<ItemProps>(({children, icon, tooltipProps, ...elemProps}, Element, {state: {size}}) => {
|
|
149
|
+
const {color, ...textStyles} = type.levels.subtext[size === 'small' ? 'medium' : 'large'];
|
|
150
|
+
|
|
151
|
+
return (
|
|
152
|
+
<Container tooltipProps={tooltipProps}>
|
|
153
|
+
<BaseButton
|
|
154
|
+
as={Element}
|
|
155
|
+
borderRadius="m"
|
|
156
|
+
colors={getIconButtonColors(elemProps['aria-pressed'])}
|
|
157
|
+
{...geButtonStyles(size, children, icon)}
|
|
158
|
+
{...elemProps}
|
|
159
|
+
>
|
|
160
|
+
{icon && (
|
|
161
|
+
<BaseButton.Icon
|
|
162
|
+
size={size === 'small' ? 'extraSmall' : 'medium'}
|
|
163
|
+
icon={icon}
|
|
164
|
+
shouldMirrorIcon={useIsRTL()}
|
|
165
|
+
/>
|
|
166
|
+
)}
|
|
167
|
+
{children && (
|
|
168
|
+
<Text {...textStyles} fontWeight="bold" textAlign="left">
|
|
169
|
+
{children}
|
|
170
|
+
</Text>
|
|
171
|
+
)}
|
|
172
|
+
</BaseButton>
|
|
173
|
+
</Container>
|
|
174
|
+
);
|
|
175
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
createSubcomponent,
|
|
5
|
+
ExtractProps,
|
|
6
|
+
createElemPropsHook,
|
|
7
|
+
} from '@workday/canvas-kit-react/common';
|
|
8
|
+
import {Grid} from '@workday/canvas-kit-react/layout';
|
|
9
|
+
import {useListRenderItems} from '@workday/canvas-kit-react/collection';
|
|
10
|
+
import {useSegmentedControlModel} from './hooks/useSegmentedControlModel';
|
|
11
|
+
|
|
12
|
+
export interface SegmentedControlListProps<T = any>
|
|
13
|
+
extends Omit<Partial<ExtractProps<typeof Grid, never>>, 'children'> {
|
|
14
|
+
'aria-label': string;
|
|
15
|
+
children: ((item: T) => React.ReactNode) | React.ReactNode;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const useSegmentedControlList = createElemPropsHook(useSegmentedControlModel)(
|
|
19
|
+
({state: {orientation, disabled, items}}) => {
|
|
20
|
+
const directionName = orientation === 'vertical' ? 'Row' : 'Column';
|
|
21
|
+
return {
|
|
22
|
+
[`gridTemplate${directionName}s`]: `repeat(${items.length}, 1fr)`,
|
|
23
|
+
opacity: disabled ? 0.4 : undefined,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
export const SegmentedControlList = createSubcomponent('div')({
|
|
29
|
+
displayName: 'SegmentedControl.List',
|
|
30
|
+
modelHook: useSegmentedControlModel,
|
|
31
|
+
elemPropsHook: useSegmentedControlList,
|
|
32
|
+
})<SegmentedControlListProps>(({children, ...elemProps}, Element, model) => {
|
|
33
|
+
return (
|
|
34
|
+
<Grid
|
|
35
|
+
as={Element}
|
|
36
|
+
display="inline-grid"
|
|
37
|
+
role="group"
|
|
38
|
+
backgroundColor="soap200"
|
|
39
|
+
border="1px solid transparent"
|
|
40
|
+
borderColor="licorice200"
|
|
41
|
+
borderRadius="l"
|
|
42
|
+
padding="3px"
|
|
43
|
+
gridGap="xxs"
|
|
44
|
+
{...elemProps}
|
|
45
|
+
>
|
|
46
|
+
{useListRenderItems(model, children)}
|
|
47
|
+
</Grid>
|
|
48
|
+
);
|
|
49
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import {createElemPropsHook, composeHooks} from '@workday/canvas-kit-react/common';
|
|
4
|
+
import {
|
|
5
|
+
useListItemRegister,
|
|
6
|
+
isSelected,
|
|
7
|
+
useListItemSelect,
|
|
8
|
+
} from '@workday/canvas-kit-react/collection';
|
|
9
|
+
import {useSegmentedControlModel} from './useSegmentedControlModel';
|
|
10
|
+
|
|
11
|
+
export const useSegmentedControlItem = composeHooks(
|
|
12
|
+
useListItemSelect,
|
|
13
|
+
createElemPropsHook(useSegmentedControlModel)(
|
|
14
|
+
(model, _, elemProps: {'data-id'?: string; children?: React.ReactNode} = {}) => {
|
|
15
|
+
const name = elemProps['data-id'] || '';
|
|
16
|
+
const selected = !!name && isSelected(name, model.state);
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
id: `${model.state.id}-${name}`,
|
|
20
|
+
'aria-pressed': selected,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
),
|
|
24
|
+
useListItemRegister,
|
|
25
|
+
createElemPropsHook(useSegmentedControlModel)(({state}) => {
|
|
26
|
+
return {
|
|
27
|
+
// override the default disabled functionality of `useListItemRegister`
|
|
28
|
+
// it shouldn't allow to set disabled state only for one button
|
|
29
|
+
// state prop will disable the whole container
|
|
30
|
+
disabled: state.disabled ? true : undefined,
|
|
31
|
+
};
|
|
32
|
+
})
|
|
33
|
+
);
|