@workday/canvas-kit-preview-react 6.8.9 → 6.9.0-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/breadcrumbs/lib/Breadcrumbs/Dropdown/Button.tsx +52 -26
- package/breadcrumbs/lib/Breadcrumbs/Dropdown/Menu.tsx +5 -6
- package/breadcrumbs/lib/Breadcrumbs/List/CurrentItem.tsx +1 -0
- package/breadcrumbs/lib/Breadcrumbs/List/ListItem.tsx +7 -9
- package/breadcrumbs/lib/Breadcrumbs/List/index.tsx +22 -20
- package/breadcrumbs/lib/Breadcrumbs/List/styles.ts +1 -1
- package/breadcrumbs/package.json +2 -1
- package/color-picker/lib/ColorPicker.tsx +3 -3
- package/color-picker/package.json +2 -1
- package/dist/commonjs/breadcrumbs/index.js +13 -5
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/Button.d.ts +3 -3
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/Button.d.ts.map +1 -1
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/Button.js +38 -9
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/Menu.d.ts +0 -1
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/Menu.d.ts.map +1 -1
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/Menu.js +14 -8
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/MenuItemLink.js +20 -7
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/hooks.d.ts +1 -2
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/hooks.d.ts.map +1 -1
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/hooks.js +5 -2
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/index.d.ts.map +1 -1
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/index.js +3 -1
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/Collapsible.d.ts.map +1 -1
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/Collapsible.js +22 -8
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/CurrentItem.d.ts.map +1 -1
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/CurrentItem.js +4 -2
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/Link.d.ts.map +1 -1
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/Link.js +3 -1
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/ListItem.d.ts +0 -1
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/ListItem.d.ts.map +1 -1
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/ListItem.js +10 -8
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/hooks.d.ts +1 -1
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/hooks.d.ts.map +1 -1
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/hooks.js +21 -5
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/index.d.ts +1 -2
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/index.d.ts.map +1 -1
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/index.js +13 -16
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/styles.d.ts +1 -1
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/styles.d.ts.map +1 -1
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/styles.js +3 -1
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Nav.d.ts.map +1 -1
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Nav.js +3 -1
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/hooks.js +3 -1
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/index.d.ts +1 -2
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/index.d.ts.map +1 -1
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs/index.js +1 -0
- package/dist/commonjs/color-picker/index.js +6 -2
- package/dist/commonjs/color-picker/lib/ColorPicker.d.ts.map +1 -1
- package/dist/commonjs/color-picker/lib/ColorPicker.js +21 -9
- package/dist/commonjs/color-picker/lib/parts/ColorReset.d.ts.map +1 -1
- package/dist/commonjs/color-picker/lib/parts/ColorReset.js +17 -3
- package/dist/commonjs/color-picker/lib/parts/SwatchBook.d.ts.map +1 -1
- package/dist/commonjs/color-picker/lib/parts/SwatchBook.js +17 -3
- package/dist/commonjs/form-field/index.js +12 -5
- package/dist/commonjs/form-field/lib/FormField.d.ts +47 -13
- package/dist/commonjs/form-field/lib/FormField.d.ts.map +1 -1
- package/dist/commonjs/form-field/lib/FormField.js +8 -11
- package/dist/commonjs/form-field/lib/FormFieldHint.d.ts +8 -12
- package/dist/commonjs/form-field/lib/FormFieldHint.d.ts.map +1 -1
- package/dist/commonjs/form-field/lib/FormFieldHint.js +18 -16
- package/dist/commonjs/form-field/lib/FormFieldInput.d.ts +8 -7
- package/dist/commonjs/form-field/lib/FormFieldInput.d.ts.map +1 -1
- package/dist/commonjs/form-field/lib/FormFieldInput.js +7 -20
- package/dist/commonjs/form-field/lib/FormFieldLabel.d.ts +9 -4
- package/dist/commonjs/form-field/lib/FormFieldLabel.d.ts.map +1 -1
- package/dist/commonjs/form-field/lib/FormFieldLabel.js +21 -22
- package/dist/commonjs/form-field/lib/hooks/index.js +15 -8
- package/dist/commonjs/form-field/lib/hooks/useFormFieldHint.d.ts +8 -6
- package/dist/commonjs/form-field/lib/hooks/useFormFieldHint.d.ts.map +1 -1
- package/dist/commonjs/form-field/lib/hooks/useFormFieldHint.js +3 -1
- package/dist/commonjs/form-field/lib/hooks/useFormFieldInput.d.ts +8 -6
- package/dist/commonjs/form-field/lib/hooks/useFormFieldInput.d.ts.map +1 -1
- package/dist/commonjs/form-field/lib/hooks/useFormFieldInput.js +3 -1
- package/dist/commonjs/form-field/lib/hooks/useFormFieldLabel.d.ts +8 -6
- package/dist/commonjs/form-field/lib/hooks/useFormFieldLabel.d.ts.map +1 -1
- package/dist/commonjs/form-field/lib/hooks/useFormFieldLabel.js +3 -1
- package/dist/commonjs/form-field/lib/hooks/useFormFieldModel.d.ts +77 -15
- package/dist/commonjs/form-field/lib/hooks/useFormFieldModel.d.ts.map +1 -1
- package/dist/commonjs/form-field/lib/hooks/useFormFieldModel.js +42 -14
- package/dist/commonjs/form-field/lib/hooks/useFormFieldOrientation.d.ts +5 -4
- package/dist/commonjs/form-field/lib/hooks/useFormFieldOrientation.d.ts.map +1 -1
- package/dist/commonjs/form-field/lib/hooks/useFormFieldOrientation.js +3 -1
- package/dist/commonjs/index.d.ts +1 -0
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +19 -11
- package/dist/commonjs/menu/index.js +12 -4
- package/dist/commonjs/menu/lib/Menu.d.ts.map +1 -1
- package/dist/commonjs/menu/lib/Menu.js +21 -9
- package/dist/commonjs/menu/lib/MenuItem.d.ts.map +1 -1
- package/dist/commonjs/menu/lib/MenuItem.js +20 -8
- package/dist/commonjs/pill/index.d.ts +3 -0
- package/dist/commonjs/pill/index.d.ts.map +1 -0
- package/dist/commonjs/pill/index.js +14 -0
- package/dist/commonjs/pill/lib/Pill.d.ts +65 -0
- package/dist/commonjs/pill/lib/Pill.d.ts.map +1 -0
- package/dist/commonjs/pill/lib/Pill.js +171 -0
- package/dist/commonjs/pill/lib/PillAvatar.d.ts +12 -0
- package/dist/commonjs/pill/lib/PillAvatar.d.ts.map +1 -0
- package/dist/commonjs/pill/lib/PillAvatar.js +29 -0
- package/dist/commonjs/pill/lib/PillCount.d.ts +5 -0
- package/dist/commonjs/pill/lib/PillCount.d.ts.map +1 -0
- package/dist/commonjs/pill/lib/PillCount.js +45 -0
- package/dist/commonjs/pill/lib/PillIcon.d.ts +18 -0
- package/dist/commonjs/pill/lib/PillIcon.d.ts.map +1 -0
- package/dist/commonjs/pill/lib/PillIcon.js +40 -0
- package/dist/commonjs/pill/lib/PillIconButton.d.ts +23 -0
- package/dist/commonjs/pill/lib/PillIconButton.d.ts.map +1 -0
- package/dist/commonjs/pill/lib/PillIconButton.js +81 -0
- package/dist/commonjs/pill/lib/PillLabel.d.ts +14 -0
- package/dist/commonjs/pill/lib/PillLabel.d.ts.map +1 -0
- package/dist/commonjs/pill/lib/PillLabel.js +47 -0
- package/dist/commonjs/pill/lib/usePillModel.d.ts +71 -0
- package/dist/commonjs/pill/lib/usePillModel.d.ts.map +1 -0
- package/dist/commonjs/pill/lib/usePillModel.js +37 -0
- package/dist/commonjs/select/index.d.ts +1 -1
- package/dist/commonjs/select/index.d.ts.map +1 -1
- package/dist/commonjs/select/index.js +12 -4
- package/dist/commonjs/select/lib/Select.d.ts.map +1 -1
- package/dist/commonjs/select/lib/Select.js +22 -8
- package/dist/commonjs/select/lib/SelectBase.d.ts +20 -1
- package/dist/commonjs/select/lib/SelectBase.d.ts.map +1 -1
- package/dist/commonjs/select/lib/SelectBase.js +26 -11
- package/dist/commonjs/select/lib/SelectMenu.d.ts.map +1 -1
- package/dist/commonjs/select/lib/SelectMenu.js +20 -7
- package/dist/commonjs/select/lib/SelectOption.d.ts.map +1 -1
- package/dist/commonjs/select/lib/SelectOption.js +19 -7
- package/dist/commonjs/select/lib/scrolling.d.ts.map +1 -1
- package/dist/commonjs/select/lib/scrolling.js +3 -1
- package/dist/commonjs/select/lib/utils.d.ts.map +1 -1
- package/dist/commonjs/select/lib/utils.js +5 -2
- package/dist/commonjs/side-panel/index.js +13 -5
- package/dist/commonjs/side-panel/lib/SidePanel.d.ts +18 -5
- package/dist/commonjs/side-panel/lib/SidePanel.d.ts.map +1 -1
- package/dist/commonjs/side-panel/lib/SidePanel.js +32 -16
- package/dist/commonjs/side-panel/lib/hooks.d.ts.map +1 -1
- package/dist/commonjs/side-panel/lib/hooks.js +17 -3
- package/dist/commonjs/text-area/index.js +11 -4
- package/dist/commonjs/text-area/lib/TextArea.d.ts +52 -11
- package/dist/commonjs/text-area/lib/TextArea.d.ts.map +1 -1
- package/dist/commonjs/text-area/lib/TextArea.js +10 -15
- package/dist/commonjs/text-area/lib/TextAreaField.d.ts +15 -7
- package/dist/commonjs/text-area/lib/TextAreaField.d.ts.map +1 -1
- package/dist/commonjs/text-area/lib/TextAreaField.js +19 -18
- package/dist/commonjs/text-area/lib/hooks/index.js +11 -4
- package/dist/commonjs/text-area/lib/hooks/useTextAreaModel.d.ts +27 -7
- package/dist/commonjs/text-area/lib/hooks/useTextAreaModel.d.ts.map +1 -1
- package/dist/commonjs/text-area/lib/hooks/useTextAreaModel.js +1 -0
- package/dist/commonjs/text-input/index.js +12 -5
- package/dist/commonjs/text-input/lib/TextInput.d.ts +59 -11
- package/dist/commonjs/text-input/lib/TextInput.d.ts.map +1 -1
- package/dist/commonjs/text-input/lib/TextInput.js +10 -15
- package/dist/commonjs/text-input/lib/TextInputField.d.ts +15 -7
- package/dist/commonjs/text-input/lib/TextInputField.d.ts.map +1 -1
- package/dist/commonjs/text-input/lib/TextInputField.js +18 -30
- package/dist/commonjs/text-input/lib/hooks/index.js +12 -5
- package/dist/commonjs/text-input/lib/hooks/useTextInputField.d.ts +8 -2
- package/dist/commonjs/text-input/lib/hooks/useTextInputField.d.ts.map +1 -1
- package/dist/commonjs/text-input/lib/hooks/useTextInputField.js +3 -1
- package/dist/commonjs/text-input/lib/hooks/useTextInputModel.d.ts +27 -7
- package/dist/commonjs/text-input/lib/hooks/useTextInputModel.d.ts.map +1 -1
- package/dist/commonjs/text-input/lib/hooks/useTextInputModel.js +1 -0
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/Button.d.ts +3 -3
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/Button.d.ts.map +1 -1
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/Button.js +36 -11
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/Menu.d.ts +0 -1
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/Menu.d.ts.map +1 -1
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/Menu.js +8 -7
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/hooks.d.ts +1 -2
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/hooks.d.ts.map +1 -1
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/index.d.ts.map +1 -1
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/Collapsible.d.ts.map +1 -1
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/CurrentItem.d.ts.map +1 -1
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/CurrentItem.js +1 -1
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/Link.d.ts.map +1 -1
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/ListItem.d.ts +0 -1
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/ListItem.d.ts.map +1 -1
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/ListItem.js +4 -7
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/hooks.d.ts +1 -1
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/hooks.d.ts.map +1 -1
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/index.d.ts +1 -2
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/index.d.ts.map +1 -1
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/index.js +9 -16
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/styles.d.ts +1 -1
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/List/styles.d.ts.map +1 -1
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/Nav.d.ts.map +1 -1
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/index.d.ts +1 -2
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/index.d.ts.map +1 -1
- package/dist/es6/breadcrumbs/lib/Breadcrumbs/types.js +1 -0
- package/dist/es6/color-picker/lib/ColorPicker.d.ts.map +1 -1
- package/dist/es6/color-picker/lib/ColorPicker.js +3 -3
- package/dist/es6/color-picker/lib/parts/ColorReset.d.ts.map +1 -1
- package/dist/es6/color-picker/lib/parts/SwatchBook.d.ts.map +1 -1
- package/dist/es6/form-field/lib/FormField.d.ts +47 -13
- package/dist/es6/form-field/lib/FormField.d.ts.map +1 -1
- package/dist/es6/form-field/lib/FormField.js +9 -13
- package/dist/es6/form-field/lib/FormFieldHint.d.ts +8 -12
- package/dist/es6/form-field/lib/FormFieldHint.d.ts.map +1 -1
- package/dist/es6/form-field/lib/FormFieldHint.js +17 -19
- package/dist/es6/form-field/lib/FormFieldInput.d.ts +8 -7
- package/dist/es6/form-field/lib/FormFieldInput.d.ts.map +1 -1
- package/dist/es6/form-field/lib/FormFieldInput.js +8 -22
- package/dist/es6/form-field/lib/FormFieldLabel.d.ts +9 -4
- package/dist/es6/form-field/lib/FormFieldLabel.d.ts.map +1 -1
- package/dist/es6/form-field/lib/FormFieldLabel.js +19 -24
- package/dist/es6/form-field/lib/hooks/useFormFieldHint.d.ts +8 -6
- package/dist/es6/form-field/lib/hooks/useFormFieldHint.d.ts.map +1 -1
- package/dist/es6/form-field/lib/hooks/useFormFieldHint.js +3 -2
- package/dist/es6/form-field/lib/hooks/useFormFieldInput.d.ts +8 -6
- package/dist/es6/form-field/lib/hooks/useFormFieldInput.d.ts.map +1 -1
- package/dist/es6/form-field/lib/hooks/useFormFieldInput.js +3 -2
- package/dist/es6/form-field/lib/hooks/useFormFieldLabel.d.ts +8 -6
- package/dist/es6/form-field/lib/hooks/useFormFieldLabel.d.ts.map +1 -1
- package/dist/es6/form-field/lib/hooks/useFormFieldLabel.js +3 -2
- package/dist/es6/form-field/lib/hooks/useFormFieldModel.d.ts +77 -15
- package/dist/es6/form-field/lib/hooks/useFormFieldModel.d.ts.map +1 -1
- package/dist/es6/form-field/lib/hooks/useFormFieldModel.js +42 -15
- package/dist/es6/form-field/lib/hooks/useFormFieldOrientation.d.ts +5 -4
- package/dist/es6/form-field/lib/hooks/useFormFieldOrientation.d.ts.map +1 -1
- package/dist/es6/index.d.ts +1 -0
- package/dist/es6/index.d.ts.map +1 -1
- package/dist/es6/index.js +1 -0
- package/dist/es6/menu/lib/Menu.d.ts.map +1 -1
- package/dist/es6/menu/lib/Menu.js +2 -2
- package/dist/es6/menu/lib/MenuItem.d.ts.map +1 -1
- package/dist/es6/menu/lib/MenuItem.js +1 -1
- package/dist/es6/pill/index.d.ts +3 -0
- package/dist/es6/pill/index.d.ts.map +1 -0
- package/dist/es6/pill/index.js +2 -0
- package/dist/es6/pill/lib/Pill.d.ts +65 -0
- package/dist/es6/pill/lib/Pill.d.ts.map +1 -0
- package/dist/es6/pill/lib/Pill.js +165 -0
- package/dist/es6/pill/lib/PillAvatar.d.ts +13 -0
- package/dist/es6/pill/lib/PillAvatar.d.ts.map +1 -0
- package/dist/es6/pill/lib/PillAvatar.js +23 -0
- package/dist/es6/pill/lib/PillCount.d.ts +5 -0
- package/dist/es6/pill/lib/PillCount.d.ts.map +1 -0
- package/dist/es6/pill/lib/PillCount.js +39 -0
- package/dist/es6/pill/lib/PillIcon.d.ts +19 -0
- package/dist/es6/pill/lib/PillIcon.d.ts.map +1 -0
- package/dist/es6/pill/lib/PillIcon.js +34 -0
- package/dist/es6/pill/lib/PillIconButton.d.ts +24 -0
- package/dist/es6/pill/lib/PillIconButton.d.ts.map +1 -0
- package/dist/es6/pill/lib/PillIconButton.js +75 -0
- package/dist/es6/pill/lib/PillLabel.d.ts +15 -0
- package/dist/es6/pill/lib/PillLabel.d.ts.map +1 -0
- package/dist/es6/pill/lib/PillLabel.js +41 -0
- package/dist/es6/pill/lib/usePillModel.d.ts +71 -0
- package/dist/es6/pill/lib/usePillModel.d.ts.map +1 -0
- package/dist/es6/pill/lib/usePillModel.js +34 -0
- package/dist/es6/select/index.d.ts +1 -1
- package/dist/es6/select/index.d.ts.map +1 -1
- package/dist/es6/select/lib/Select.d.ts.map +1 -1
- package/dist/es6/select/lib/Select.js +2 -1
- package/dist/es6/select/lib/SelectBase.d.ts +20 -1
- package/dist/es6/select/lib/SelectBase.d.ts.map +1 -1
- package/dist/es6/select/lib/SelectBase.js +6 -4
- package/dist/es6/select/lib/SelectMenu.d.ts.map +1 -1
- package/dist/es6/select/lib/SelectOption.d.ts.map +1 -1
- package/dist/es6/select/lib/scrolling.d.ts.map +1 -1
- package/dist/es6/select/lib/types.js +1 -0
- package/dist/es6/select/lib/utils.d.ts.map +1 -1
- package/dist/es6/side-panel/lib/SidePanel.d.ts +18 -5
- package/dist/es6/side-panel/lib/SidePanel.d.ts.map +1 -1
- package/dist/es6/side-panel/lib/SidePanel.js +9 -6
- package/dist/es6/side-panel/lib/hooks.d.ts.map +1 -1
- package/dist/es6/text-area/lib/TextArea.d.ts +52 -11
- package/dist/es6/text-area/lib/TextArea.d.ts.map +1 -1
- package/dist/es6/text-area/lib/TextArea.js +11 -17
- package/dist/es6/text-area/lib/TextAreaField.d.ts +15 -7
- package/dist/es6/text-area/lib/TextAreaField.d.ts.map +1 -1
- package/dist/es6/text-area/lib/TextAreaField.js +19 -19
- package/dist/es6/text-area/lib/hooks/useTextAreaModel.d.ts +27 -7
- package/dist/es6/text-area/lib/hooks/useTextAreaModel.d.ts.map +1 -1
- package/dist/es6/text-input/lib/TextInput.d.ts +59 -11
- package/dist/es6/text-input/lib/TextInput.d.ts.map +1 -1
- package/dist/es6/text-input/lib/TextInput.js +11 -17
- package/dist/es6/text-input/lib/TextInputField.d.ts +15 -7
- package/dist/es6/text-input/lib/TextInputField.d.ts.map +1 -1
- package/dist/es6/text-input/lib/TextInputField.js +19 -32
- package/dist/es6/text-input/lib/hooks/useTextInputField.d.ts +8 -2
- package/dist/es6/text-input/lib/hooks/useTextInputField.d.ts.map +1 -1
- package/dist/es6/text-input/lib/hooks/useTextInputField.js +3 -2
- package/dist/es6/text-input/lib/hooks/useTextInputModel.d.ts +27 -7
- package/dist/es6/text-input/lib/hooks/useTextInputModel.d.ts.map +1 -1
- package/form-field/lib/FormField.tsx +14 -29
- package/form-field/lib/FormFieldHint.tsx +28 -38
- package/form-field/lib/FormFieldInput.tsx +8 -15
- package/form-field/lib/FormFieldLabel.tsx +30 -39
- package/form-field/lib/hooks/useFormFieldHint.tsx +3 -3
- package/form-field/lib/hooks/useFormFieldInput.tsx +3 -3
- package/form-field/lib/hooks/useFormFieldLabel.tsx +3 -3
- package/form-field/lib/hooks/useFormFieldModel.tsx +32 -53
- package/form-field/lib/hooks/useFormFieldOrientation.tsx +1 -1
- package/form-field/package.json +2 -1
- package/index.ts +1 -0
- package/menu/lib/Menu.tsx +1 -1
- package/menu/package.json +2 -1
- package/package.json +14 -22
- package/pill/LICENSE +52 -0
- package/pill/README.md +5 -0
- package/pill/index.ts +2 -0
- package/pill/lib/Pill.tsx +226 -0
- package/pill/lib/PillAvatar.tsx +27 -0
- package/pill/lib/PillCount.tsx +39 -0
- package/pill/lib/PillIcon.tsx +34 -0
- package/pill/lib/PillIconButton.tsx +100 -0
- package/pill/lib/PillLabel.tsx +36 -0
- package/pill/lib/usePillModel.tsx +28 -0
- package/pill/package.json +6 -0
- package/select/index.ts +6 -1
- package/select/lib/Select.tsx +1 -0
- package/select/lib/SelectBase.tsx +27 -3
- package/select/lib/SelectMenu.tsx +1 -1
- package/select/lib/SelectOption.tsx +1 -1
- package/select/package.json +2 -1
- package/side-panel/lib/SidePanel.tsx +28 -9
- package/side-panel/package.json +2 -1
- package/text-area/lib/TextArea.tsx +16 -30
- package/text-area/lib/TextAreaField.tsx +32 -45
- package/text-area/lib/hooks/useTextAreaModel.ts +1 -3
- package/text-area/package.json +2 -1
- package/text-input/lib/TextInput.tsx +16 -30
- package/text-input/lib/TextInputField.tsx +33 -44
- package/text-input/lib/hooks/useTextInputField.tsx +3 -2
- package/text-input/lib/hooks/useTextInputModel.ts +1 -3
- package/text-input/package.json +2 -1
- package/dist/commonjs/text-area/lib/TextAreaHint.d.ts +0 -5
- package/dist/commonjs/text-area/lib/TextAreaHint.d.ts.map +0 -1
- package/dist/commonjs/text-area/lib/TextAreaHint.js +0 -4
- package/dist/commonjs/text-area/lib/TextAreaLabel.d.ts +0 -5
- package/dist/commonjs/text-area/lib/TextAreaLabel.d.ts.map +0 -1
- package/dist/commonjs/text-area/lib/TextAreaLabel.js +0 -4
- package/dist/commonjs/text-input/lib/TextInputHint.d.ts +0 -5
- package/dist/commonjs/text-input/lib/TextInputHint.d.ts.map +0 -1
- package/dist/commonjs/text-input/lib/TextInputHint.js +0 -4
- package/dist/commonjs/text-input/lib/TextInputLabel.d.ts +0 -5
- package/dist/commonjs/text-input/lib/TextInputLabel.d.ts.map +0 -1
- package/dist/commonjs/text-input/lib/TextInputLabel.js +0 -4
- package/dist/es6/text-area/lib/TextAreaHint.d.ts +0 -5
- package/dist/es6/text-area/lib/TextAreaHint.d.ts.map +0 -1
- package/dist/es6/text-area/lib/TextAreaHint.js +0 -2
- package/dist/es6/text-area/lib/TextAreaLabel.d.ts +0 -5
- package/dist/es6/text-area/lib/TextAreaLabel.d.ts.map +0 -1
- package/dist/es6/text-area/lib/TextAreaLabel.js +0 -2
- package/dist/es6/text-input/lib/TextInputHint.d.ts +0 -5
- package/dist/es6/text-input/lib/TextInputHint.d.ts.map +0 -1
- package/dist/es6/text-input/lib/TextInputHint.js +0 -2
- package/dist/es6/text-input/lib/TextInputLabel.d.ts +0 -5
- package/dist/es6/text-input/lib/TextInputLabel.d.ts.map +0 -1
- package/dist/es6/text-input/lib/TextInputLabel.js +0 -2
- package/text-area/lib/TextAreaHint.tsx +0 -6
- package/text-area/lib/TextAreaLabel.tsx +0 -6
- package/text-input/lib/TextInputHint.tsx +0 -6
- package/text-input/lib/TextInputLabel.tsx +0 -6
- package/ts3.5/dist/commonjs/breadcrumbs/index.d.ts +0 -5
- package/ts3.5/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/Button.d.ts +0 -20
- package/ts3.5/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/Menu.d.ts +0 -39
- package/ts3.5/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/MenuItemLink.d.ts +0 -14
- package/ts3.5/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/hooks.d.ts +0 -14
- package/ts3.5/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/index.d.ts +0 -8
- package/ts3.5/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/Collapsible.d.ts +0 -16
- package/ts3.5/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/CurrentItem.d.ts +0 -11
- package/ts3.5/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/Link.d.ts +0 -19
- package/ts3.5/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/ListItem.d.ts +0 -5
- package/ts3.5/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/hooks.d.ts +0 -19
- package/ts3.5/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/index.d.ts +0 -5
- package/ts3.5/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/styles.d.ts +0 -3
- package/ts3.5/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Nav.d.ts +0 -11
- package/ts3.5/dist/commonjs/breadcrumbs/lib/Breadcrumbs/hooks.d.ts +0 -5
- package/ts3.5/dist/commonjs/breadcrumbs/lib/Breadcrumbs/index.d.ts +0 -10
- package/ts3.5/dist/commonjs/breadcrumbs/lib/Breadcrumbs/types.d.ts +0 -8
- package/ts3.5/dist/commonjs/color-picker/index.d.ts +0 -2
- package/ts3.5/dist/commonjs/color-picker/lib/ColorPicker.d.ts +0 -55
- package/ts3.5/dist/commonjs/color-picker/lib/parts/ColorReset.d.ts +0 -7
- package/ts3.5/dist/commonjs/color-picker/lib/parts/SwatchBook.d.ts +0 -7
- package/ts3.5/dist/commonjs/form-field/index.d.ts +0 -3
- package/ts3.5/dist/commonjs/form-field/lib/FormField.d.ts +0 -31
- package/ts3.5/dist/commonjs/form-field/lib/FormFieldHint.d.ts +0 -13
- package/ts3.5/dist/commonjs/form-field/lib/FormFieldInput.d.ts +0 -8
- package/ts3.5/dist/commonjs/form-field/lib/FormFieldLabel.d.ts +0 -18
- package/ts3.5/dist/commonjs/form-field/lib/hooks/index.d.ts +0 -6
- package/ts3.5/dist/commonjs/form-field/lib/hooks/useFormFieldHint.d.ts +0 -15
- package/ts3.5/dist/commonjs/form-field/lib/hooks/useFormFieldInput.d.ts +0 -18
- package/ts3.5/dist/commonjs/form-field/lib/hooks/useFormFieldLabel.d.ts +0 -15
- package/ts3.5/dist/commonjs/form-field/lib/hooks/useFormFieldModel.d.ts +0 -36
- package/ts3.5/dist/commonjs/form-field/lib/hooks/useFormFieldOrientation.d.ts +0 -9
- package/ts3.5/dist/commonjs/index.d.ts +0 -9
- package/ts3.5/dist/commonjs/menu/index.d.ts +0 -6
- package/ts3.5/dist/commonjs/menu/lib/Menu.d.ts +0 -61
- package/ts3.5/dist/commonjs/menu/lib/MenuItem.d.ts +0 -53
- package/ts3.5/dist/commonjs/select/index.d.ts +0 -6
- package/ts3.5/dist/commonjs/select/lib/Select.d.ts +0 -25
- package/ts3.5/dist/commonjs/select/lib/SelectBase.d.ts +0 -123
- package/ts3.5/dist/commonjs/select/lib/SelectMenu.d.ts +0 -42
- package/ts3.5/dist/commonjs/select/lib/SelectOption.d.ts +0 -33
- package/ts3.5/dist/commonjs/select/lib/scrolling.d.ts +0 -2
- package/ts3.5/dist/commonjs/select/lib/types.d.ts +0 -33
- package/ts3.5/dist/commonjs/select/lib/utils.d.ts +0 -4
- package/ts3.5/dist/commonjs/side-panel/index.d.ts +0 -6
- package/ts3.5/dist/commonjs/side-panel/lib/SidePanel.d.ts +0 -73
- package/ts3.5/dist/commonjs/side-panel/lib/hooks.d.ts +0 -80
- package/ts3.5/dist/commonjs/text-area/index.d.ts +0 -2
- package/ts3.5/dist/commonjs/text-area/lib/TextArea.d.ts +0 -22
- package/ts3.5/dist/commonjs/text-area/lib/TextAreaField.d.ts +0 -8
- package/ts3.5/dist/commonjs/text-area/lib/TextAreaHint.d.ts +0 -5
- package/ts3.5/dist/commonjs/text-area/lib/TextAreaLabel.d.ts +0 -5
- package/ts3.5/dist/commonjs/text-area/lib/hooks/index.d.ts +0 -2
- package/ts3.5/dist/commonjs/text-area/lib/hooks/useTextAreaModel.d.ts +0 -8
- package/ts3.5/dist/commonjs/text-input/index.d.ts +0 -3
- package/ts3.5/dist/commonjs/text-input/lib/TextInput.d.ts +0 -22
- package/ts3.5/dist/commonjs/text-input/lib/TextInputField.d.ts +0 -8
- package/ts3.5/dist/commonjs/text-input/lib/TextInputHint.d.ts +0 -5
- package/ts3.5/dist/commonjs/text-input/lib/TextInputLabel.d.ts +0 -5
- package/ts3.5/dist/commonjs/text-input/lib/hooks/index.d.ts +0 -3
- package/ts3.5/dist/commonjs/text-input/lib/hooks/useTextInputField.d.ts +0 -10
- package/ts3.5/dist/commonjs/text-input/lib/hooks/useTextInputModel.d.ts +0 -8
- package/ts3.5/dist/es6/breadcrumbs/index.d.ts +0 -5
- package/ts3.5/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/Button.d.ts +0 -20
- package/ts3.5/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/Menu.d.ts +0 -39
- package/ts3.5/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/MenuItemLink.d.ts +0 -14
- package/ts3.5/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/hooks.d.ts +0 -14
- package/ts3.5/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/index.d.ts +0 -8
- package/ts3.5/dist/es6/breadcrumbs/lib/Breadcrumbs/List/Collapsible.d.ts +0 -16
- package/ts3.5/dist/es6/breadcrumbs/lib/Breadcrumbs/List/CurrentItem.d.ts +0 -11
- package/ts3.5/dist/es6/breadcrumbs/lib/Breadcrumbs/List/Link.d.ts +0 -19
- package/ts3.5/dist/es6/breadcrumbs/lib/Breadcrumbs/List/ListItem.d.ts +0 -5
- package/ts3.5/dist/es6/breadcrumbs/lib/Breadcrumbs/List/hooks.d.ts +0 -19
- package/ts3.5/dist/es6/breadcrumbs/lib/Breadcrumbs/List/index.d.ts +0 -5
- package/ts3.5/dist/es6/breadcrumbs/lib/Breadcrumbs/List/styles.d.ts +0 -3
- package/ts3.5/dist/es6/breadcrumbs/lib/Breadcrumbs/Nav.d.ts +0 -11
- package/ts3.5/dist/es6/breadcrumbs/lib/Breadcrumbs/hooks.d.ts +0 -5
- package/ts3.5/dist/es6/breadcrumbs/lib/Breadcrumbs/index.d.ts +0 -10
- package/ts3.5/dist/es6/breadcrumbs/lib/Breadcrumbs/types.d.ts +0 -8
- package/ts3.5/dist/es6/color-picker/index.d.ts +0 -2
- package/ts3.5/dist/es6/color-picker/lib/ColorPicker.d.ts +0 -55
- package/ts3.5/dist/es6/color-picker/lib/parts/ColorReset.d.ts +0 -7
- package/ts3.5/dist/es6/color-picker/lib/parts/SwatchBook.d.ts +0 -7
- package/ts3.5/dist/es6/form-field/index.d.ts +0 -3
- package/ts3.5/dist/es6/form-field/lib/FormField.d.ts +0 -31
- package/ts3.5/dist/es6/form-field/lib/FormFieldHint.d.ts +0 -13
- package/ts3.5/dist/es6/form-field/lib/FormFieldInput.d.ts +0 -8
- package/ts3.5/dist/es6/form-field/lib/FormFieldLabel.d.ts +0 -18
- package/ts3.5/dist/es6/form-field/lib/hooks/index.d.ts +0 -6
- package/ts3.5/dist/es6/form-field/lib/hooks/useFormFieldHint.d.ts +0 -15
- package/ts3.5/dist/es6/form-field/lib/hooks/useFormFieldInput.d.ts +0 -18
- package/ts3.5/dist/es6/form-field/lib/hooks/useFormFieldLabel.d.ts +0 -15
- package/ts3.5/dist/es6/form-field/lib/hooks/useFormFieldModel.d.ts +0 -36
- package/ts3.5/dist/es6/form-field/lib/hooks/useFormFieldOrientation.d.ts +0 -9
- package/ts3.5/dist/es6/index.d.ts +0 -9
- package/ts3.5/dist/es6/menu/index.d.ts +0 -6
- package/ts3.5/dist/es6/menu/lib/Menu.d.ts +0 -61
- package/ts3.5/dist/es6/menu/lib/MenuItem.d.ts +0 -53
- package/ts3.5/dist/es6/select/index.d.ts +0 -6
- package/ts3.5/dist/es6/select/lib/Select.d.ts +0 -25
- package/ts3.5/dist/es6/select/lib/SelectBase.d.ts +0 -123
- package/ts3.5/dist/es6/select/lib/SelectMenu.d.ts +0 -42
- package/ts3.5/dist/es6/select/lib/SelectOption.d.ts +0 -33
- package/ts3.5/dist/es6/select/lib/scrolling.d.ts +0 -2
- package/ts3.5/dist/es6/select/lib/types.d.ts +0 -33
- package/ts3.5/dist/es6/select/lib/utils.d.ts +0 -4
- package/ts3.5/dist/es6/side-panel/index.d.ts +0 -6
- package/ts3.5/dist/es6/side-panel/lib/SidePanel.d.ts +0 -73
- package/ts3.5/dist/es6/side-panel/lib/hooks.d.ts +0 -80
- package/ts3.5/dist/es6/text-area/index.d.ts +0 -2
- package/ts3.5/dist/es6/text-area/lib/TextArea.d.ts +0 -22
- package/ts3.5/dist/es6/text-area/lib/TextAreaField.d.ts +0 -8
- package/ts3.5/dist/es6/text-area/lib/TextAreaHint.d.ts +0 -5
- package/ts3.5/dist/es6/text-area/lib/TextAreaLabel.d.ts +0 -5
- package/ts3.5/dist/es6/text-area/lib/hooks/index.d.ts +0 -2
- package/ts3.5/dist/es6/text-area/lib/hooks/useTextAreaModel.d.ts +0 -8
- package/ts3.5/dist/es6/text-input/index.d.ts +0 -3
- package/ts3.5/dist/es6/text-input/lib/TextInput.d.ts +0 -22
- package/ts3.5/dist/es6/text-input/lib/TextInputField.d.ts +0 -8
- package/ts3.5/dist/es6/text-input/lib/TextInputHint.d.ts +0 -5
- package/ts3.5/dist/es6/text-input/lib/TextInputLabel.d.ts +0 -5
- package/ts3.5/dist/es6/text-input/lib/hooks/index.d.ts +0 -3
- package/ts3.5/dist/es6/text-input/lib/hooks/useTextInputField.d.ts +0 -10
- package/ts3.5/dist/es6/text-input/lib/hooks/useTextInputModel.d.ts +0 -8
package/pill/index.ts
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {CSSObject} from '@emotion/react';
|
|
3
|
+
|
|
4
|
+
import {BaseButton} from '@workday/canvas-kit-react/button';
|
|
5
|
+
import {
|
|
6
|
+
createContainer,
|
|
7
|
+
focusRing,
|
|
8
|
+
mouseFocusBehavior,
|
|
9
|
+
styled,
|
|
10
|
+
StyledType,
|
|
11
|
+
} from '@workday/canvas-kit-react/common';
|
|
12
|
+
import {BoxProps, boxStyleFn, HStack, Stack} from '@workday/canvas-kit-react/layout';
|
|
13
|
+
import {borderRadius, colors, space, type} from '@workday/canvas-kit-react/tokens';
|
|
14
|
+
|
|
15
|
+
import {usePillModel} from './usePillModel';
|
|
16
|
+
|
|
17
|
+
import {PillIcon} from './PillIcon';
|
|
18
|
+
import {PillIconButton} from './PillIconButton';
|
|
19
|
+
import {PillCount} from './PillCount';
|
|
20
|
+
import {PillAvatar} from './PillAvatar';
|
|
21
|
+
import {PillLabel} from './PillLabel';
|
|
22
|
+
|
|
23
|
+
export interface PillProps extends BoxProps {
|
|
24
|
+
/**
|
|
25
|
+
* Defines what kind of pill to render stylistically and its interaction states
|
|
26
|
+
* @default 'default'
|
|
27
|
+
*/
|
|
28
|
+
variant?: 'default' | 'readOnly' | 'removable';
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const getButtonPillColors = () => {
|
|
32
|
+
return {
|
|
33
|
+
default: {
|
|
34
|
+
background: colors.soap300,
|
|
35
|
+
icon: colors.licorice200,
|
|
36
|
+
label: colors.blackPepper400,
|
|
37
|
+
border: colors.licorice200,
|
|
38
|
+
},
|
|
39
|
+
hover: {
|
|
40
|
+
icon: colors.licorice500,
|
|
41
|
+
background: colors.soap400,
|
|
42
|
+
border: colors.licorice400,
|
|
43
|
+
},
|
|
44
|
+
active: {
|
|
45
|
+
icon: colors.licorice500,
|
|
46
|
+
background: colors.soap500,
|
|
47
|
+
border: colors.licorice500,
|
|
48
|
+
},
|
|
49
|
+
focus: {
|
|
50
|
+
icon: colors.licorice500,
|
|
51
|
+
background: colors.soap300,
|
|
52
|
+
border: colors.blueberry400,
|
|
53
|
+
focusRing: focusRing({
|
|
54
|
+
width: 0,
|
|
55
|
+
inset: 'inner',
|
|
56
|
+
innerColor: colors.blueberry400,
|
|
57
|
+
outerColor: colors.blueberry400,
|
|
58
|
+
separation: 1,
|
|
59
|
+
}),
|
|
60
|
+
},
|
|
61
|
+
disabled: {
|
|
62
|
+
icon: colors.licorice100,
|
|
63
|
+
label: colors.licorice100,
|
|
64
|
+
background: colors.soap100,
|
|
65
|
+
border: colors.licorice100,
|
|
66
|
+
opacity: '1',
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const getRemovablePillColors = (disabled?: boolean) => {
|
|
72
|
+
return {
|
|
73
|
+
default: {
|
|
74
|
+
background: disabled ? colors.soap100 : colors.soap300,
|
|
75
|
+
icon: disabled ? colors.licorice100 : colors.licorice200,
|
|
76
|
+
label: disabled ? colors.licorice100 : colors.blackPepper400,
|
|
77
|
+
border: disabled ? colors.licorice100 : colors.licorice200,
|
|
78
|
+
},
|
|
79
|
+
hover: {
|
|
80
|
+
icon: disabled ? colors.licorice100 : colors.licorice500,
|
|
81
|
+
background: disabled ? colors.soap100 : colors.soap300,
|
|
82
|
+
border: disabled ? colors.licorice100 : colors.licorice200,
|
|
83
|
+
label: disabled ? colors.licorice100 : colors.blackPepper400,
|
|
84
|
+
},
|
|
85
|
+
active: {
|
|
86
|
+
icon: disabled ? colors.licorice100 : colors.licorice500,
|
|
87
|
+
background: disabled ? colors.soap100 : colors.soap500,
|
|
88
|
+
border: disabled ? colors.licorice100 : colors.licorice500,
|
|
89
|
+
label: disabled ? colors.licorice100 : colors.blackPepper400,
|
|
90
|
+
},
|
|
91
|
+
focus: {
|
|
92
|
+
icon: colors.licorice200,
|
|
93
|
+
background: colors.soap300,
|
|
94
|
+
label: colors.blackPepper400,
|
|
95
|
+
|
|
96
|
+
focusRing: focusRing({
|
|
97
|
+
width: 0,
|
|
98
|
+
innerColor: 'transparent',
|
|
99
|
+
outerColor: 'transparent',
|
|
100
|
+
}),
|
|
101
|
+
},
|
|
102
|
+
disabled: {},
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const pillBaseStyles: CSSObject = {
|
|
107
|
+
display: 'inline-flex',
|
|
108
|
+
alignItems: 'center',
|
|
109
|
+
borderRadius: borderRadius.m,
|
|
110
|
+
flexShrink: 0,
|
|
111
|
+
...type.levels.subtext.large,
|
|
112
|
+
color: colors.blackPepper400,
|
|
113
|
+
boxShadow: 'none',
|
|
114
|
+
outline: 'none',
|
|
115
|
+
fontWeight: type.properties.fontWeights.medium,
|
|
116
|
+
WebkitFontSmoothing: 'antialiased',
|
|
117
|
+
MozOsxFontSmoothing: 'grayscale',
|
|
118
|
+
width: 'fit-content',
|
|
119
|
+
padding: `2px ${space.xxs}`,
|
|
120
|
+
height: space.m,
|
|
121
|
+
position: 'relative',
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const StyledBasePill = styled(BaseButton.as('button'))<StyledType & PillProps>(
|
|
125
|
+
{
|
|
126
|
+
...pillBaseStyles,
|
|
127
|
+
'&:focus': {
|
|
128
|
+
'span[data-count="ck-pill-count"]': {
|
|
129
|
+
borderTop: `1px solid ${colors.blueberry400}`,
|
|
130
|
+
borderBottom: `1px solid ${colors.blueberry400}`,
|
|
131
|
+
borderRight: `1px solid ${colors.blueberry400}`,
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
'&:active, &:active:hover, &:active:focus': {
|
|
135
|
+
'span[data-count="ck-pill-count"]': {
|
|
136
|
+
backgroundColor: colors.soap600,
|
|
137
|
+
border: 'none',
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
...mouseFocusBehavior({
|
|
142
|
+
'&:focus': {
|
|
143
|
+
'span[data-count="ck-pill-count"]': {
|
|
144
|
+
border: 'none',
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
}),
|
|
148
|
+
},
|
|
149
|
+
({variant}) => ({
|
|
150
|
+
'&:focus': {
|
|
151
|
+
borderColor: variant === 'removable' ? undefined : colors.blueberry400,
|
|
152
|
+
},
|
|
153
|
+
}),
|
|
154
|
+
boxStyleFn
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
const StyledNonInteractivePill = styled(StyledBasePill)<StyledType>({
|
|
158
|
+
cursor: 'default',
|
|
159
|
+
overflow: 'revert', // override BaseButton overflow styles so the click target exists outside the pill for removable
|
|
160
|
+
position: 'relative',
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
export const Pill = createContainer('button')({
|
|
164
|
+
modelHook: usePillModel,
|
|
165
|
+
subComponents: {
|
|
166
|
+
Icon: PillIcon,
|
|
167
|
+
Avatar: PillAvatar,
|
|
168
|
+
Count: PillCount,
|
|
169
|
+
Label: PillLabel,
|
|
170
|
+
IconButton: PillIconButton,
|
|
171
|
+
},
|
|
172
|
+
})<PillProps>(({variant = 'default', maxWidth, ...elemProps}, Element, model) => {
|
|
173
|
+
return (
|
|
174
|
+
<>
|
|
175
|
+
{variant === 'readOnly' && (
|
|
176
|
+
<StyledNonInteractivePill
|
|
177
|
+
maxWidth={model.state.maxWidth}
|
|
178
|
+
as={Element !== 'button' ? Element : 'span'}
|
|
179
|
+
border={`1px solid ${colors.licorice200}`}
|
|
180
|
+
id={model.state.id}
|
|
181
|
+
{...elemProps}
|
|
182
|
+
>
|
|
183
|
+
<PillLabel>{elemProps.children}</PillLabel>
|
|
184
|
+
</StyledNonInteractivePill>
|
|
185
|
+
)}
|
|
186
|
+
{variant === 'default' && (
|
|
187
|
+
<StyledBasePill
|
|
188
|
+
colors={getButtonPillColors()}
|
|
189
|
+
as={Element}
|
|
190
|
+
{...elemProps}
|
|
191
|
+
disabled={model.state.disabled}
|
|
192
|
+
>
|
|
193
|
+
<HStack spacing="xxxs" display="inline-flex" alignItems="center">
|
|
194
|
+
{React.Children.map(elemProps.children, (child, index) => {
|
|
195
|
+
if (typeof child === 'string') {
|
|
196
|
+
return <PillLabel key={index}>{child}</PillLabel>;
|
|
197
|
+
}
|
|
198
|
+
return (
|
|
199
|
+
<Stack.Item key={index} display="inline-flex">
|
|
200
|
+
{child}
|
|
201
|
+
</Stack.Item>
|
|
202
|
+
);
|
|
203
|
+
})}
|
|
204
|
+
</HStack>
|
|
205
|
+
</StyledBasePill>
|
|
206
|
+
)}
|
|
207
|
+
{variant === 'removable' && (
|
|
208
|
+
<StyledNonInteractivePill
|
|
209
|
+
colors={getRemovablePillColors(model.state.disabled)}
|
|
210
|
+
as={Element !== 'button' ? Element : 'span'}
|
|
211
|
+
variant={variant}
|
|
212
|
+
{...elemProps}
|
|
213
|
+
>
|
|
214
|
+
<HStack spacing="xxxs" display="inline-flex" alignItems="center" justifyContent="center">
|
|
215
|
+
{React.Children.map(elemProps.children, (child, index) => {
|
|
216
|
+
if (typeof child === 'string') {
|
|
217
|
+
return <PillLabel key={index}>{child}</PillLabel>;
|
|
218
|
+
}
|
|
219
|
+
return <Stack.Item key={index}>{child}</Stack.Item>;
|
|
220
|
+
})}
|
|
221
|
+
</HStack>
|
|
222
|
+
</StyledNonInteractivePill>
|
|
223
|
+
)}
|
|
224
|
+
</>
|
|
225
|
+
);
|
|
226
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import {createSubcomponent} from '@workday/canvas-kit-react/common';
|
|
4
|
+
import {Avatar, AvatarProps} from '@workday/canvas-kit-react/avatar';
|
|
5
|
+
import {usePillModel} from './usePillModel';
|
|
6
|
+
|
|
7
|
+
export interface PillAvatarProps extends AvatarProps {}
|
|
8
|
+
|
|
9
|
+
// When the component is created, it needs to be a button element to match AvatarProps.
|
|
10
|
+
// Once Avatar becomes a `createComponent` we can default the element type to a `div`
|
|
11
|
+
// and the types should be properly extracted
|
|
12
|
+
export const PillAvatar = createSubcomponent('button')({
|
|
13
|
+
modelHook: usePillModel,
|
|
14
|
+
})<PillAvatarProps>((elemProps, Element, model) => {
|
|
15
|
+
return (
|
|
16
|
+
<Avatar
|
|
17
|
+
style={{opacity: model.state.disabled ? '.7' : '1'}}
|
|
18
|
+
as="div"
|
|
19
|
+
size={18}
|
|
20
|
+
altText={undefined}
|
|
21
|
+
{...elemProps}
|
|
22
|
+
disabled={model.state.disabled}
|
|
23
|
+
>
|
|
24
|
+
{elemProps.children}
|
|
25
|
+
</Avatar>
|
|
26
|
+
);
|
|
27
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import {createComponent, styled, StyledType} from '@workday/canvas-kit-react/common';
|
|
4
|
+
import {Flex, FlexProps} from '@workday/canvas-kit-react/layout';
|
|
5
|
+
import {borderRadius, colors, space} from '@workday/canvas-kit-react/tokens';
|
|
6
|
+
|
|
7
|
+
export interface PillCountProps extends FlexProps {}
|
|
8
|
+
|
|
9
|
+
const StyledCountContainer = styled(Flex.as('span'))<StyledType>({
|
|
10
|
+
borderTopLeftRadius: borderRadius.zero,
|
|
11
|
+
borderTopRightRadius: borderRadius.m,
|
|
12
|
+
borderBottomLeftRadius: borderRadius.zero,
|
|
13
|
+
borderBottomRightRadius: borderRadius.m,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const PillCount = createComponent('span')({
|
|
17
|
+
displayName: 'Pill.Avatar',
|
|
18
|
+
Component: ({children, ...elemProps}: PillCountProps, ref, Element) => {
|
|
19
|
+
return (
|
|
20
|
+
<StyledCountContainer
|
|
21
|
+
display="inline-flex"
|
|
22
|
+
alignItems="center"
|
|
23
|
+
justifyContent="center"
|
|
24
|
+
as={Element}
|
|
25
|
+
height={22}
|
|
26
|
+
minWidth={22}
|
|
27
|
+
padding={`0 ${space.xxxs}`}
|
|
28
|
+
marginInlineEnd={`-${space.xxs}`} // Remove padding from HStack on the right side
|
|
29
|
+
marginInlineStart={`${space.xxxs}`}
|
|
30
|
+
backgroundColor={colors.soap500}
|
|
31
|
+
data-count="ck-pill-count"
|
|
32
|
+
ref={ref}
|
|
33
|
+
{...elemProps}
|
|
34
|
+
>
|
|
35
|
+
{children}
|
|
36
|
+
</StyledCountContainer>
|
|
37
|
+
);
|
|
38
|
+
},
|
|
39
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import {createSubcomponent} from '@workday/canvas-kit-react/common';
|
|
4
|
+
|
|
5
|
+
import {SystemIcon, SystemIconProps} from '@workday/canvas-kit-react/icon';
|
|
6
|
+
import {usePillModel} from './usePillModel';
|
|
7
|
+
import {plusIcon} from '@workday/canvas-system-icons-web';
|
|
8
|
+
import {CanvasSystemIcon} from '@workday/design-assets-types';
|
|
9
|
+
import {space} from '@workday/canvas-kit-react/tokens';
|
|
10
|
+
|
|
11
|
+
export interface PillIconProps extends Omit<SystemIconProps, 'icon'> {
|
|
12
|
+
/**
|
|
13
|
+
* The system icon rendered by the component
|
|
14
|
+
* @default `plusIcon`
|
|
15
|
+
*/
|
|
16
|
+
icon?: CanvasSystemIcon;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const PillIcon = createSubcomponent('span')({
|
|
20
|
+
modelHook: usePillModel,
|
|
21
|
+
})<PillIconProps>(({size, icon, ...elemProps}, Element) => {
|
|
22
|
+
return (
|
|
23
|
+
<SystemIcon
|
|
24
|
+
marginInlineStart={`-${space.xxxs}`} // remove padding on the left from HStack
|
|
25
|
+
display="flex"
|
|
26
|
+
as={Element}
|
|
27
|
+
size={20}
|
|
28
|
+
role="img"
|
|
29
|
+
aria-label="add"
|
|
30
|
+
icon={icon || plusIcon}
|
|
31
|
+
{...elemProps}
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
34
|
+
});
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import {focusRing, styled, StyledType, createSubcomponent} from '@workday/canvas-kit-react/common';
|
|
4
|
+
|
|
5
|
+
import {SystemIcon, SystemIconProps} from '@workday/canvas-kit-react/icon';
|
|
6
|
+
import {usePillModel} from './usePillModel';
|
|
7
|
+
import {xSmallIcon} from '@workday/canvas-system-icons-web';
|
|
8
|
+
import {CanvasSystemIcon} from '@workday/design-assets-types';
|
|
9
|
+
import {colors, space} from '@workday/canvas-kit-react/tokens';
|
|
10
|
+
import {BaseButton} from '@workday/canvas-kit-react/button';
|
|
11
|
+
|
|
12
|
+
export interface PillIconButtonProps extends Omit<SystemIconProps, 'icon'> {
|
|
13
|
+
/**
|
|
14
|
+
* The system icon rendered by the button
|
|
15
|
+
* @default `xSmallIcon`
|
|
16
|
+
*/
|
|
17
|
+
icon?: CanvasSystemIcon;
|
|
18
|
+
/**
|
|
19
|
+
* The aria label for the removable icon
|
|
20
|
+
* @default 'remove'
|
|
21
|
+
*/
|
|
22
|
+
'aria-label'?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const getIconColors = () => {
|
|
26
|
+
return {
|
|
27
|
+
default: {
|
|
28
|
+
icon: colors.licorice200,
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
hover: {
|
|
32
|
+
icon: colors.licorice500,
|
|
33
|
+
},
|
|
34
|
+
active: {
|
|
35
|
+
icon: colors.licorice500,
|
|
36
|
+
},
|
|
37
|
+
focus: {
|
|
38
|
+
icon: colors.licorice500,
|
|
39
|
+
|
|
40
|
+
focusRing: focusRing({
|
|
41
|
+
innerColor: 'transparent',
|
|
42
|
+
}),
|
|
43
|
+
},
|
|
44
|
+
disabled: {
|
|
45
|
+
icon: colors.licorice100,
|
|
46
|
+
opacity: '1',
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const StyledIconButton = styled(BaseButton)<StyledType & PillIconButtonProps>({
|
|
52
|
+
marginInlineEnd: '-7px', // visually pull in the pill to the right size
|
|
53
|
+
marginInlineStart: `-2px`, // visually create space between label and the button
|
|
54
|
+
overflow: 'visible',
|
|
55
|
+
'::after': {
|
|
56
|
+
content: '""',
|
|
57
|
+
height: space.l,
|
|
58
|
+
width: space.l,
|
|
59
|
+
position: 'absolute',
|
|
60
|
+
left: '-7px',
|
|
61
|
+
bottom: '-7px',
|
|
62
|
+
margin: 0,
|
|
63
|
+
pointerEvents: 'all',
|
|
64
|
+
cursor: 'pointer',
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
export const PillIconButton = createSubcomponent('button')({
|
|
69
|
+
modelHook: usePillModel,
|
|
70
|
+
})<PillIconButtonProps>(
|
|
71
|
+
(
|
|
72
|
+
{size, icon = xSmallIcon, maxWidth, children, 'aria-label': ariaLabel = 'remove', ...elemProps},
|
|
73
|
+
Element,
|
|
74
|
+
model
|
|
75
|
+
) => {
|
|
76
|
+
return (
|
|
77
|
+
<StyledIconButton
|
|
78
|
+
borderRadius="s"
|
|
79
|
+
height={20}
|
|
80
|
+
width={20}
|
|
81
|
+
padding="zero"
|
|
82
|
+
disabled={model.state.disabled}
|
|
83
|
+
colors={getIconColors()}
|
|
84
|
+
aria-labelledby={`removable-${model.state.id} label-${model.state.id}`}
|
|
85
|
+
as={Element}
|
|
86
|
+
position="relative"
|
|
87
|
+
{...elemProps}
|
|
88
|
+
>
|
|
89
|
+
<SystemIcon
|
|
90
|
+
aria-label={ariaLabel}
|
|
91
|
+
id={`removable-${model.state.id}`}
|
|
92
|
+
icon={icon}
|
|
93
|
+
size={space.m}
|
|
94
|
+
aria-hidden // This works for Chrome but not needed in Safari
|
|
95
|
+
role="img"
|
|
96
|
+
/>
|
|
97
|
+
</StyledIconButton>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import {createSubcomponent, styled, StyledType} from '@workday/canvas-kit-react/common';
|
|
4
|
+
import {Box, BoxProps} from '@workday/canvas-kit-react/layout';
|
|
5
|
+
import {OverflowTooltip, OverflowTooltipProps} from '@workday/canvas-kit-react/tooltip';
|
|
6
|
+
|
|
7
|
+
import {usePillModel} from './usePillModel';
|
|
8
|
+
import {colors} from '@workday/canvas-kit-react/tokens';
|
|
9
|
+
|
|
10
|
+
export interface PillLabelProps extends BoxProps {
|
|
11
|
+
tooltipProps?: Omit<OverflowTooltipProps, 'children'>;
|
|
12
|
+
}
|
|
13
|
+
const StyledLabelContainer = styled(Box.as('span'))<StyledType>({
|
|
14
|
+
whiteSpace: 'nowrap',
|
|
15
|
+
overflow: 'hidden',
|
|
16
|
+
textOverflow: 'ellipsis',
|
|
17
|
+
display: 'block',
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export const PillLabel = createSubcomponent('span')({
|
|
21
|
+
modelHook: usePillModel,
|
|
22
|
+
})<PillLabelProps>(({tooltipProps, ...elemProps}, Element, model) => {
|
|
23
|
+
return (
|
|
24
|
+
<OverflowTooltip {...tooltipProps}>
|
|
25
|
+
<StyledLabelContainer
|
|
26
|
+
color={model.state.disabled ? colors.licorice100 : 'inherit'}
|
|
27
|
+
maxWidth={model.state.maxWidth}
|
|
28
|
+
as={Element}
|
|
29
|
+
id={`label-${model.state.id}`}
|
|
30
|
+
{...elemProps}
|
|
31
|
+
>
|
|
32
|
+
{elemProps.children}
|
|
33
|
+
</StyledLabelContainer>
|
|
34
|
+
</OverflowTooltip>
|
|
35
|
+
);
|
|
36
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {createModelHook, useUniqueId} from '@workday/canvas-kit-react/common';
|
|
2
|
+
|
|
3
|
+
export const usePillModel = createModelHook({
|
|
4
|
+
defaultConfig: {
|
|
5
|
+
/**
|
|
6
|
+
* Determines the max width of the pill. If the pill text is longer than the max width,
|
|
7
|
+
* text will be truncated and a tooltip will show the rest of the content when hovered over
|
|
8
|
+
*/
|
|
9
|
+
maxWidth: 200 as string | number,
|
|
10
|
+
/**
|
|
11
|
+
* Use to disable a pill.
|
|
12
|
+
*/
|
|
13
|
+
disabled: false,
|
|
14
|
+
/**
|
|
15
|
+
* ID used to add accessibility labels to pill elements.
|
|
16
|
+
* @default `useUniqueId()`
|
|
17
|
+
*/
|
|
18
|
+
id: '',
|
|
19
|
+
},
|
|
20
|
+
})(config => {
|
|
21
|
+
const id = useUniqueId(config.id);
|
|
22
|
+
const state = {
|
|
23
|
+
...config,
|
|
24
|
+
id,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
return {state, events: {}};
|
|
28
|
+
});
|
package/select/index.ts
CHANGED
|
@@ -4,4 +4,9 @@ export default Select;
|
|
|
4
4
|
export {Select};
|
|
5
5
|
export * from './lib/Select';
|
|
6
6
|
|
|
7
|
-
export {
|
|
7
|
+
export {
|
|
8
|
+
Option,
|
|
9
|
+
RenderableOption,
|
|
10
|
+
RenderOptionFunction,
|
|
11
|
+
RenderSelectedFunction,
|
|
12
|
+
} from './lib/SelectBase';
|
package/select/lib/Select.tsx
CHANGED
|
@@ -368,6 +368,7 @@ class SelectContainer extends React.Component<SelectContainerProps, SelectContai
|
|
|
368
368
|
// (2) Either update the current value of buttonRef if it was a ref object,
|
|
369
369
|
// or call buttonRef with the underlying button element if it was a
|
|
370
370
|
// callback ref.
|
|
371
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
371
372
|
this.forwardedButtonRef = useForkRef(props.buttonRef, this.localButtonRef);
|
|
372
373
|
}
|
|
373
374
|
|
|
@@ -49,6 +49,10 @@ export interface NormalizedOption extends Option {
|
|
|
49
49
|
label: string;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
export interface RenderSelectedFunction {
|
|
53
|
+
(option: NormalizedOption): React.ReactNode;
|
|
54
|
+
}
|
|
55
|
+
|
|
52
56
|
export interface RenderableOption extends NormalizedOption {
|
|
53
57
|
focused: boolean;
|
|
54
58
|
selected: boolean;
|
|
@@ -86,6 +90,22 @@ export interface CoreSelectBaseProps
|
|
|
86
90
|
* @default defaultRenderOption
|
|
87
91
|
*/
|
|
88
92
|
renderOption?: RenderOptionFunction;
|
|
93
|
+
/**
|
|
94
|
+
* The function called to render the selected option.
|
|
95
|
+
*
|
|
96
|
+
* The `option` argument passed to the function is an object which contains the following:
|
|
97
|
+
*
|
|
98
|
+
* * `data: object` (data object carried over from the corresponding option originally passed into the component)
|
|
99
|
+
* * `disabled: boolean`
|
|
100
|
+
* * `id: string`
|
|
101
|
+
* * `label: string`
|
|
102
|
+
* * `value: string`
|
|
103
|
+
*
|
|
104
|
+
* If you omit the `renderSelected` prop, each option will be rendered using a `defaultRenderSelected` function provided by the component.
|
|
105
|
+
*
|
|
106
|
+
* @default defaultRenderSelected
|
|
107
|
+
*/
|
|
108
|
+
renderSelected?: RenderSelectedFunction;
|
|
89
109
|
/**
|
|
90
110
|
* The value of the Select.
|
|
91
111
|
*/
|
|
@@ -261,7 +281,11 @@ const SelectWrapper = styled('div')<Pick<SelectBaseProps, 'grow' | 'disabled'>>(
|
|
|
261
281
|
);
|
|
262
282
|
|
|
263
283
|
const defaultRenderOption: RenderOptionFunction = option => {
|
|
264
|
-
return <div>{option
|
|
284
|
+
return <div>{defaultRenderSelected(option)}</div>;
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
const defaultRenderSelected: RenderSelectedFunction = option => {
|
|
288
|
+
return option.label;
|
|
265
289
|
};
|
|
266
290
|
|
|
267
291
|
const SelectBase = ({
|
|
@@ -284,6 +308,7 @@ const SelectBase = ({
|
|
|
284
308
|
onOptionSelection,
|
|
285
309
|
options,
|
|
286
310
|
renderOption = defaultRenderOption,
|
|
311
|
+
renderSelected = defaultRenderSelected,
|
|
287
312
|
required,
|
|
288
313
|
shouldMenuAutoFlip = true,
|
|
289
314
|
shouldMenuAutoFocus = true,
|
|
@@ -393,7 +418,6 @@ const SelectBase = ({
|
|
|
393
418
|
// Do a bit of error-checking in case options weren't provided
|
|
394
419
|
const hasOptions = options.length > 0;
|
|
395
420
|
const selectedOption = hasOptions ? options[getCorrectedIndexByValue(options, value)] : null;
|
|
396
|
-
const selectedOptionLabel = selectedOption ? selectedOption.label : '';
|
|
397
421
|
const selectedOptionValue = selectedOption ? selectedOption.value : '';
|
|
398
422
|
|
|
399
423
|
return (
|
|
@@ -419,7 +443,7 @@ const SelectBase = ({
|
|
|
419
443
|
value={selectedOptionValue}
|
|
420
444
|
{...elemProps}
|
|
421
445
|
>
|
|
422
|
-
{
|
|
446
|
+
{!!selectedOption && renderSelected(selectedOption)}
|
|
423
447
|
</SelectButton>
|
|
424
448
|
<SelectInput onChange={onChange} ref={inputRef} type="text" value={selectedOptionValue} />
|
|
425
449
|
{hasOptions && menuVisibility !== 'closed' && (
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, {useState, useEffect, useLayoutEffect, useCallback} from 'react';
|
|
2
2
|
|
|
3
|
-
import {CSSObject} from '@emotion/
|
|
3
|
+
import {CSSObject} from '@emotion/styled';
|
|
4
4
|
import {EmotionCanvasTheme, ErrorType, Themeable, styled} from '@workday/canvas-kit-react/common';
|
|
5
5
|
import {
|
|
6
6
|
Placement,
|