@workday/canvas-kit-react 11.0.0-alpha.671-next.0 → 11.0.0-alpha.682-next.0
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/checkbox/lib/CheckBackground.tsx +48 -0
- package/checkbox/lib/Checkbox.tsx +18 -355
- package/checkbox/lib/CheckboxCheck.tsx +81 -0
- package/checkbox/lib/CheckboxContainer.tsx +58 -0
- package/checkbox/lib/CheckboxInput.tsx +279 -0
- package/checkbox/lib/CheckboxRipple.tsx +21 -0
- package/common/lib/styles/focusRing.ts +4 -17
- package/dist/commonjs/avatar/lib/Avatar.js +1 -1
- package/dist/commonjs/badge/lib/CountBadge.js +7 -7
- package/dist/commonjs/banner/lib/Banner.js +1 -1
- package/dist/commonjs/button/lib/BaseButton.js +22 -22
- package/dist/commonjs/button/lib/DeleteButton.js +1 -1
- package/dist/commonjs/button/lib/PrimaryButton.js +2 -2
- package/dist/commonjs/button/lib/SecondaryButton.js +2 -2
- package/dist/commonjs/button/lib/TertiaryButton.js +15 -15
- package/dist/commonjs/button/lib/ToolbarDropdownButton.js +6 -1
- package/dist/commonjs/button/lib/ToolbarIconButton.js +6 -1
- package/dist/commonjs/button/lib/deprecated_Button.js +2 -2
- package/dist/commonjs/card/lib/Card.js +1 -1
- package/dist/commonjs/card/lib/CardHeading.js +1 -1
- package/dist/commonjs/checkbox/lib/CheckBackground.d.ts +10 -0
- package/dist/commonjs/checkbox/lib/CheckBackground.d.ts.map +1 -0
- package/dist/commonjs/checkbox/lib/CheckBackground.js +42 -0
- package/dist/commonjs/checkbox/lib/Checkbox.d.ts +3 -45
- package/dist/commonjs/checkbox/lib/Checkbox.d.ts.map +1 -1
- package/dist/commonjs/checkbox/lib/Checkbox.js +10 -204
- package/dist/commonjs/checkbox/lib/CheckboxCheck.d.ts +10 -0
- package/dist/commonjs/checkbox/lib/CheckboxCheck.d.ts.map +1 -0
- package/dist/commonjs/checkbox/lib/CheckboxCheck.js +51 -0
- package/dist/commonjs/checkbox/lib/CheckboxContainer.d.ts +13 -0
- package/dist/commonjs/checkbox/lib/CheckboxContainer.d.ts.map +1 -0
- package/dist/commonjs/checkbox/lib/CheckboxContainer.js +37 -0
- package/dist/commonjs/checkbox/lib/CheckboxInput.d.ts +48 -0
- package/dist/commonjs/checkbox/lib/CheckboxInput.d.ts.map +1 -0
- package/dist/commonjs/checkbox/lib/CheckboxInput.js +59 -0
- package/dist/commonjs/checkbox/lib/CheckboxRipple.d.ts +2 -0
- package/dist/commonjs/checkbox/lib/CheckboxRipple.d.ts.map +1 -0
- package/dist/commonjs/checkbox/lib/CheckboxRipple.js +33 -0
- package/dist/commonjs/common/lib/AccessibleHide.js +1 -1
- package/dist/commonjs/common/lib/CanvasProvider.js +1 -1
- package/dist/commonjs/common/lib/styles/focusRing.d.ts.map +1 -1
- package/dist/commonjs/common/lib/styles/focusRing.js +5 -16
- package/dist/commonjs/loading-dots/lib/LoadingDots.js +2 -2
- package/dist/commonjs/radio/lib/Radio.js +17 -3
- package/dist/commonjs/select/lib/Select.js +1 -1
- package/dist/commonjs/switch/lib/Switch.js +2 -2
- package/dist/commonjs/tabs/lib/TabsItem.js +1 -1
- package/dist/commonjs/text/lib/LabelText.js +24 -24
- package/dist/commonjs/text/lib/Text.js +15 -15
- package/dist/es6/avatar/lib/Avatar.js +1 -1
- package/dist/es6/badge/lib/CountBadge.js +7 -7
- package/dist/es6/banner/lib/Banner.js +1 -1
- package/dist/es6/button/lib/BaseButton.js +22 -22
- package/dist/es6/button/lib/DeleteButton.js +1 -1
- package/dist/es6/button/lib/PrimaryButton.js +2 -2
- package/dist/es6/button/lib/SecondaryButton.js +2 -2
- package/dist/es6/button/lib/TertiaryButton.js +15 -15
- package/dist/es6/button/lib/ToolbarDropdownButton.js +6 -1
- package/dist/es6/button/lib/ToolbarIconButton.js +6 -1
- package/dist/es6/button/lib/deprecated_Button.js +2 -2
- package/dist/es6/card/lib/Card.js +1 -1
- package/dist/es6/card/lib/CardHeading.js +1 -1
- package/dist/es6/checkbox/lib/CheckBackground.d.ts +10 -0
- package/dist/es6/checkbox/lib/CheckBackground.d.ts.map +1 -0
- package/dist/es6/checkbox/lib/CheckBackground.js +20 -0
- package/dist/es6/checkbox/lib/Checkbox.d.ts +3 -45
- package/dist/es6/checkbox/lib/Checkbox.d.ts.map +1 -1
- package/dist/es6/checkbox/lib/Checkbox.js +11 -205
- package/dist/es6/checkbox/lib/CheckboxCheck.d.ts +10 -0
- package/dist/es6/checkbox/lib/CheckboxCheck.d.ts.map +1 -0
- package/dist/es6/checkbox/lib/CheckboxCheck.js +29 -0
- package/dist/es6/checkbox/lib/CheckboxContainer.d.ts +13 -0
- package/dist/es6/checkbox/lib/CheckboxContainer.d.ts.map +1 -0
- package/dist/es6/checkbox/lib/CheckboxContainer.js +15 -0
- package/dist/es6/checkbox/lib/CheckboxInput.d.ts +48 -0
- package/dist/es6/checkbox/lib/CheckboxInput.d.ts.map +1 -0
- package/dist/es6/checkbox/lib/CheckboxInput.js +37 -0
- package/dist/es6/checkbox/lib/CheckboxRipple.d.ts +2 -0
- package/dist/es6/checkbox/lib/CheckboxRipple.d.ts.map +1 -0
- package/dist/es6/checkbox/lib/CheckboxRipple.js +11 -0
- package/dist/es6/common/lib/AccessibleHide.js +1 -1
- package/dist/es6/common/lib/CanvasProvider.js +1 -1
- package/dist/es6/common/lib/styles/focusRing.d.ts.map +1 -1
- package/dist/es6/common/lib/styles/focusRing.js +5 -16
- package/dist/es6/loading-dots/lib/LoadingDots.js +2 -2
- package/dist/es6/radio/lib/Radio.js +17 -3
- package/dist/es6/select/lib/Select.js +1 -1
- package/dist/es6/switch/lib/Switch.js +2 -2
- package/dist/es6/tabs/lib/TabsItem.js +1 -1
- package/dist/es6/text/lib/LabelText.js +24 -24
- package/dist/es6/text/lib/Text.js +15 -15
- package/package.json +4 -4
|
@@ -5,7 +5,7 @@ import { createStyles } from '@workday/canvas-kit-styling';
|
|
|
5
5
|
import { mergeStyles } from '@workday/canvas-kit-react/layout';
|
|
6
6
|
import { base, brand, system } from '@workday/canvas-tokens-web';
|
|
7
7
|
import { Button } from './Button';
|
|
8
|
-
const deleteStyles = createStyles({ name: "
|
|
8
|
+
const deleteStyles = createStyles({ name: "1qtsx01", styles: "--cnvs-button-default-background:var(--cnvs-brand-error-base, rgba(222,46,33,1));--cnvs-button-default-border:transparent;--cnvs-button-default-borderRadius:var(--cnvs-sys-shape-round, calc(0.25rem * 250));--cnvs-button-default-label-emotion-safe:var(--cnvs-brand-error-accent, rgba(255,255,255,1));--cnvs-button-default-icon:var(--cnvs-brand-error-accent, rgba(255,255,255,1));&:hover, &.hover{--cnvs-button-hover-background:var(--cnvs-brand-error-dark, rgba(163,27,18,1));--cnvs-button-hover-border:transparent;--cnvs-button-hover-label-emotion-safe:var(--cnvs-brand-error-accent, rgba(255,255,255,1));--cnvs-button-hover-icon:var(--cnvs-brand-error-accent, rgba(255,255,255,1));}&:focus-visible, &.focus{--cnvs-button-focus-background:var(--cnvs-brand-error-base, rgba(222,46,33,1));--cnvs-button-focus-border:transparent;--cnvs-button-focus-label-emotion-safe:var(--cnvs-brand-error-accent, rgba(255,255,255,1));--cnvs-button-focus-icon:var(--cnvs-brand-error-accent, rgba(255,255,255,1));--cnvs-button-focus-boxShadowInner:var(--cnvs-base-palette-french-vanilla-100, rgba(255,255,255,1));--cnvs-button-focus-boxShadowOuter:var(--cnvs-brand-common-focus-outline, rgba(8,117,225,1));}&:active, &.active{--cnvs-button-active-background:var(--cnvs-brand-error-darkest, rgba(128,22,14,1));--cnvs-button-active-border:transparent;--cnvs-button-active-label-emotion-safe:var(--cnvs-brand-error-accent, rgba(255,255,255,1));--cnvs-button-active-icon:var(--cnvs-brand-error-accent, rgba(255,255,255,1));}&:disabled, &:active:disabled, &:focus:disabled, &:hover:disabled{--cnvs-button-disabled-background:var(--cnvs-brand-error-base, rgba(222,46,33,1));--cnvs-button-disabled-label-emotion-safe:var(--cnvs-brand-error-accent, rgba(255,255,255,1));--cnvs-button-disabled-icon:var(--cnvs-brand-error-accent, rgba(255,255,255,1));--cnvs-button-disabled-opacity:0.4;}" });
|
|
9
9
|
/**
|
|
10
10
|
* Use sparingly for destructive actions that will result in data loss, can’t be undone, or will
|
|
11
11
|
* have significant consequences. They commonly appear in confirmation dialogs as the final
|
|
@@ -5,10 +5,10 @@ import { mergeStyles } from '@workday/canvas-kit-react/layout';
|
|
|
5
5
|
import { createStyles, createModifiers } from '@workday/canvas-kit-styling';
|
|
6
6
|
import { base, brand, system } from '@workday/canvas-tokens-web';
|
|
7
7
|
import { Button } from './Button';
|
|
8
|
-
const primaryStyles = createStyles({ name: "
|
|
8
|
+
const primaryStyles = createStyles({ name: "1pt3ej4", styles: "--cnvs-button-default-background:var(--cnvs-brand-primary-base, rgba(8,117,225,1));--cnvs-button-default-border:transparent;--cnvs-button-default-borderRadius:var(--cnvs-sys-shape-round, calc(0.25rem * 250));--cnvs-button-default-label-emotion-safe:var(--cnvs-brand-primary-accent, rgba(255,255,255,1));--cnvs-button-default-icon:var(--cnvs-brand-primary-accent, rgba(255,255,255,1));--cnvs-button-hover-background:var(--cnvs-brand-primary-dark, rgba(0,92,185,1));--cnvs-button-hover-border:transparent;--cnvs-button-hover-label-emotion-safe:var(--cnvs-brand-primary-accent, rgba(255,255,255,1));--cnvs-button-hover-icon:var(--cnvs-brand-primary-accent, rgba(255,255,255,1));--cnvs-button-focus-background:var(--cnvs-brand-primary-base, rgba(8,117,225,1));--cnvs-button-focus-border:transparent;--cnvs-button-focus-label-emotion-safe:var(--cnvs-brand-primary-accent, rgba(255,255,255,1));--cnvs-button-focus-icon:var(--cnvs-brand-primary-accent, rgba(255,255,255,1));--cnvs-button-focus-boxShadowInner:var(--cnvs-base-palette-french-vanilla-100, rgba(255,255,255,1));--cnvs-button-focus-boxShadowOuter:var(--cnvs-brand-common-focus-outline, rgba(8,117,225,1));--cnvs-button-active-background:var(--cnvs-brand-primary-darkest, rgba(0,67,135,1));--cnvs-button-active-border:transparent;--cnvs-button-active-label-emotion-safe:var(--cnvs-brand-primary-accent, rgba(255,255,255,1));--cnvs-button-active-icon:var(--cnvs-brand-primary-accent, rgba(255,255,255,1));--cnvs-button-disabled-background:var(--cnvs-brand-primary-base, rgba(8,117,225,1));--cnvs-button-disabled-border:transparent;--cnvs-button-disabled-label-emotion-safe:var(--cnvs-brand-primary-accent, rgba(255,255,255,1));--cnvs-button-disabled-opacity:0.4;--cnvs-button-disabled-icon:var(--cnvs-brand-primary-accent, rgba(255,255,255,1));" });
|
|
9
9
|
export const primaryButtonModifiers = createModifiers({
|
|
10
10
|
variant: {
|
|
11
|
-
inverse: createStyles({ name: "
|
|
11
|
+
inverse: createStyles({ name: "a2rvr", styles: "--cnvs-button-default-background:var(--cnvs-base-palette-french-vanilla-100, rgba(255,255,255,1));--cnvs-button-default-borderRadius:var(--cnvs-sys-shape-round, calc(0.25rem * 250));--cnvs-button-default-label-emotion-safe:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--cnvs-button-default-icon:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--cnvs-button-hover-background:var(--cnvs-base-palette-soap-300, rgba(232,235,237,1));--cnvs-button-hover-label-emotion-safe:var(--cnvs-base-palette-black-pepper-500, rgba(30,30,30,1));--cnvs-button-hover-icon:var(--cnvs-base-palette-black-pepper-500, rgba(30,30,30,1));--cnvs-button-focus-background:var(--cnvs-base-palette-french-vanilla-100, rgba(255,255,255,1));--cnvs-button-focus-label-emotion-safe:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--cnvs-button-focus-icon:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--cnvs-button-focus-boxShadowInner:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--cnvs-button-focus-boxShadowOuter:var(--cnvs-base-palette-french-vanilla-100, rgba(255,255,255,1));--cnvs-button-active-background:var(--cnvs-base-palette-soap-400, rgba(223,226,230,1));--cnvs-button-active-label-emotion-safe:var(--cnvs-base-palette-black-pepper-500, rgba(30,30,30,1));--cnvs-button-active-icon:var(--cnvs-base-palette-black-pepper-500, rgba(30,30,30,1));--cnvs-button-disabled-background:var(--cnvs-base-palette-french-vanilla-100, rgba(255,255,255,1));--cnvs-button-disabled-label-emotion-safe:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--cnvs-button-disabled-icon:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));" }),
|
|
12
12
|
},
|
|
13
13
|
});
|
|
14
14
|
export const PrimaryButton = createComponent('button')({
|
|
@@ -5,10 +5,10 @@ import { mergeStyles } from '@workday/canvas-kit-react/layout';
|
|
|
5
5
|
import { createStyles, createModifiers } from '@workday/canvas-kit-styling';
|
|
6
6
|
import { base, brand, system } from '@workday/canvas-tokens-web';
|
|
7
7
|
import { Button } from './Button';
|
|
8
|
-
const secondaryStyles = createStyles({ name: "
|
|
8
|
+
const secondaryStyles = createStyles({ name: "193160q", styles: "--cnvs-button-default-background:transparent;--cnvs-button-default-border:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--cnvs-button-default-borderRadius:var(--cnvs-sys-shape-round, calc(0.25rem * 250));--cnvs-button-default-label-emotion-safe:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--cnvs-button-default-icon:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--cnvs-button-hover-background:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--cnvs-button-hover-border:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--cnvs-button-hover-label-emotion-safe:var(--cnvs-brand-primary-accent, rgba(255,255,255,1));--cnvs-button-hover-icon:var(--cnvs-brand-primary-accent, rgba(255,255,255,1));--cnvs-button-focus-background:transparent;--cnvs-button-focus-border:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--cnvs-button-focus-label-emotion-safe:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--cnvs-button-focus-icon:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--cnvs-button-focus-boxShadowInner:var(--cnvs-base-palette-french-vanilla-100, rgba(255,255,255,1));--cnvs-button-focus-boxShadowOuter:var(--cnvs-brand-common-focus-outline, rgba(8,117,225,1));--cnvs-button-active-background:var(--cnvs-base-palette-black-pepper-500, rgba(30,30,30,1));--cnvs-button-active-border:var(--cnvs-base-palette-black-pepper-500, rgba(30,30,30,1));--cnvs-button-active-label-emotion-safe:var(--cnvs-brand-primary-accent, rgba(255,255,255,1));--cnvs-button-active-icon:var(--cnvs-brand-primary-accent, rgba(255,255,255,1));--cnvs-button-disabled-background:transparent;--cnvs-button-disabled-border:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--cnvs-button-disabled-label-emotion-safe:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--cnvs-button-disabled-opacity:0.4;--cnvs-button-disabled-icon:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));" });
|
|
9
9
|
export const secondaryButtonModifiers = createModifiers({
|
|
10
10
|
variant: {
|
|
11
|
-
inverse: createStyles({ name: "
|
|
11
|
+
inverse: createStyles({ name: "1ukv7d0", styles: "--cnvs-button-default-background:transparent;--cnvs-button-default-border:var(--cnvs-base-palette-french-vanilla-100, rgba(255,255,255,1));--cnvs-button-default-label-emotion-safe:var(--cnvs-base-palette-french-vanilla-100, rgba(255,255,255,1));--cnvs-button-default-icon:var(--cnvs-base-palette-french-vanilla-100, rgba(255,255,255,1));--cnvs-button-hover-background:var(--cnvs-base-palette-soap-300, rgba(232,235,237,1));--cnvs-button-hover-border:var(--cnvs-base-palette-soap-300, rgba(232,235,237,1));--cnvs-button-hover-label-emotion-safe:var(--cnvs-base-palette-black-pepper-500, rgba(30,30,30,1));--cnvs-button-hover-icon:var(--cnvs-base-palette-black-pepper-500, rgba(30,30,30,1));--cnvs-button-focus-background:var(--cnvs-base-palette-french-vanilla-100, rgba(255,255,255,1));--cnvs-button-focus-border:var(--cnvs-base-palette-french-vanilla-100, rgba(255,255,255,1));--cnvs-button-focus-label-emotion-safe:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--cnvs-button-focus-icon:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--cnvs-button-focus-boxShadowInner:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--cnvs-button-focus-boxShadowOuter:var(--cnvs-base-palette-french-vanilla-100, rgba(255,255,255,1));--cnvs-button-active-background:var(--cnvs-base-palette-soap-400, rgba(223,226,230,1));--cnvs-button-active-border:var(--cnvs-base-palette-soap-400, rgba(223,226,230,1));--cnvs-button-active-label-emotion-safe:var(--cnvs-base-palette-black-pepper-500, rgba(30,30,30,1));--cnvs-button-active-icon:var(--cnvs-base-palette-black-pepper-500, rgba(30,30,30,1));--cnvs-button-disabled-background:transparent;--cnvs-button-disabled-border:var(--cnvs-base-palette-french-vanilla-100, rgba(255,255,255,1));--cnvs-button-disabled-label-emotion-safe:var(--cnvs-base-palette-french-vanilla-100, rgba(255,255,255,1));--cnvs-button-disabled-icon:var(--cnvs-base-palette-french-vanilla-100, rgba(255,255,255,1));" }),
|
|
12
12
|
},
|
|
13
13
|
});
|
|
14
14
|
export const SecondaryButton = createComponent('button')({
|
|
@@ -6,27 +6,27 @@ import { mergeStyles } from '@workday/canvas-kit-react/layout';
|
|
|
6
6
|
import { system, brand, base } from '@workday/canvas-tokens-web';
|
|
7
7
|
import { borderRadius, space } from '@workday/canvas-kit-react/tokens';
|
|
8
8
|
import { Button } from './Button';
|
|
9
|
-
const tertiaryStyles = createStyles({ name: "
|
|
9
|
+
const tertiaryStyles = createStyles({ name: "o529iz", styles: "padding-inline:var(--cnvs-sys-space-x2, calc(0.25rem * 2));min-width:auto;text-decoration:underline;border:0px;--cnvs-button-default-background:transparent;--cnvs-button-default-border:transparent;--cnvs-button-default-borderRadius:var(--cnvs-sys-shape-x1, 0.25rem);--cnvs-button-default-label-emotion-safe:var(--cnvs-brand-primary-base, rgba(8,117,225,1));--cnvs-button-default-icon:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--cnvs-button-hover-background:var(--cnvs-base-palette-soap-300, rgba(232,235,237,1));--cnvs-button-hover-border:transparent;--cnvs-button-hover-label-emotion-safe:var(--cnvs-brand-primary-dark, rgba(0,92,185,1));--cnvs-button-hover-icon:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--cnvs-button-focus-background:transparent;--cnvs-button-focus-border:transparent;--cnvs-button-focus-label-emotion-safe:var(--cnvs-brand-primary-base, rgba(8,117,225,1));--cnvs-button-focus-icon:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--cnvs-button-focus-boxShadowInner:var(--cnvs-brand-common-focus-outline, rgba(8,117,225,1));--cnvs-button-focus-boxShadowOuter:var(--cnvs-brand-common-focus-outline, rgba(8,117,225,1));--cnvs-button-active-background:var(--cnvs-base-palette-soap-400, rgba(223,226,230,1));--cnvs-button-active-border:transparent;--cnvs-button-active-label-emotion-safe:var(--cnvs-brand-primary-darkest, rgba(0,67,135,1));--cnvs-button-active-icon:var(--cnvs-base-palette-black-pepper-500, rgba(30,30,30,1));--cnvs-button-disabled-background:transparent;--cnvs-button-disabled-border:transparent;--cnvs-button-disabled-label-emotion-safe:var(--cnvs-brand-primary-base, rgba(8,117,225,1));--cnvs-button-disabled-icon:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--cnvs-button-disabled-opacity:0.4;&:focus-visible, &.focus{box-shadow:0 0 0 0px var(--cnvs-base-palette-french-vanilla-100), 0 0 0 2px var(--cnvs-brand-common-focus-outline);}" });
|
|
10
10
|
export const tertiaryButtonModifiers = createModifiers({
|
|
11
11
|
isThemeable: {
|
|
12
|
-
true: createStyles({ name: "
|
|
12
|
+
true: createStyles({ name: "1t7d7ry", styles: "--cnvs-button-default-icon:var(--cnvs-brand-primary-base, rgba(8,117,225,1));--cnvs-button-hover-icon:var(--cnvs-brand-primary-dark, rgba(0,92,185,1));--cnvs-button-focus-icon:var(--cnvs-brand-primary-base, rgba(8,117,225,1));--cnvs-button-active-icon:var(--cnvs-brand-primary-darkest, rgba(0,67,135,1));--cnvs-button-disabled-icon:var(--cnvs-brand-primary-base, rgba(8,117,225,1));" }),
|
|
13
13
|
},
|
|
14
14
|
variant: {
|
|
15
|
-
inverse: createStyles({ name: "
|
|
15
|
+
inverse: createStyles({ name: "1n00uny", styles: "--cnvs-button-default-background:transparent;--cnvs-button-default-border:transparent;--cnvs-button-default-label-emotion-safe:var(--cnvs-base-palette-french-vanilla-100, rgba(255,255,255,1));--cnvs-button-default-icon:var(--cnvs-base-palette-french-vanilla-100, rgba(255,255,255,1));--cnvs-button-hover-background:var(--cnvs-base-palette-french-vanilla-100, rgba(255,255,255,1));--cnvs-button-hover-border:transparent;--cnvs-button-hover-label-emotion-safe:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--cnvs-button-hover-icon:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--cnvs-button-focus-background:var(--cnvs-base-palette-french-vanilla-100, rgba(255,255,255,1));--cnvs-button-focus-border:transparent;--cnvs-button-focus-label-emotion-safe:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--cnvs-button-focus-icon:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--cnvs-button-active-background:var(--cnvs-base-palette-soap-200, rgba(240,241,242,1));--cnvs-button-active-border:transparent;--cnvs-button-active-label-emotion-safe:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--cnvs-button-active-icon:var(--cnvs-base-palette-black-pepper-400, rgba(51,51,51,1));--cnvs-button-disabled-background:transparent;--cnvs-button-disabled-border:var(--cnvs-base-palette-french-vanilla-100, rgba(255,255,255,1));--cnvs-button-disabled-label-emotion-safe:var(--cnvs-base-palette-french-vanilla-100, rgba(255,255,255,1));--cnvs-button-disabled-icon:var(--cnvs-base-palette-french-vanilla-100, rgba(255,255,255,1));&:focus-visible, &.focus{box-shadow:inset 0 0 0 2px var(--cnvs-base-palette-black-pepper-400), 0 0 0 2px var(--cnvs-base-palette-french-vanilla-100);}" }),
|
|
16
16
|
},
|
|
17
17
|
iconPosition: {
|
|
18
|
-
largeOnly: createStyles({ name: "
|
|
19
|
-
largeStart: createStyles({ name: "
|
|
20
|
-
largeEnd: createStyles({ name: "
|
|
21
|
-
mediumOnly: createStyles({ name: "
|
|
22
|
-
mediumStart: createStyles({ name: "
|
|
23
|
-
mediumEnd: createStyles({ name: "
|
|
24
|
-
smallOnly: createStyles({ name: "
|
|
25
|
-
smallStart: createStyles({ name: "
|
|
26
|
-
smallEnd: createStyles({ name: "
|
|
27
|
-
extraSmallOnly: createStyles({ name: "
|
|
28
|
-
extraSmallStart: createStyles({ name: "
|
|
29
|
-
extraSmallEnd: createStyles({ name: "
|
|
18
|
+
largeOnly: createStyles({ name: "xih0j4", styles: "border-radius:999px;padding:0;min-width:calc(var(--cnvs-sys-space-x4, calc(0.25rem * 4)) * 3);" }),
|
|
19
|
+
largeStart: createStyles({ name: "13w6ubi", styles: "padding-inline-start:0.5rem;padding-inline-end:0.75rem;" }),
|
|
20
|
+
largeEnd: createStyles({ name: "1g2rd08", styles: "padding-inline-start:0.75rem;padding-inline-end:0.5rem;" }),
|
|
21
|
+
mediumOnly: createStyles({ name: "10i0ly8", styles: "padding:0;min-width:2.5rem;border-radius:999px;" }),
|
|
22
|
+
mediumStart: createStyles({ name: "13w6ubi", styles: "padding-inline-start:0.5rem;padding-inline-end:0.75rem;" }),
|
|
23
|
+
mediumEnd: createStyles({ name: "1g2rd08", styles: "padding-inline-start:0.75rem;padding-inline-end:0.5rem;" }),
|
|
24
|
+
smallOnly: createStyles({ name: "18m1kdv", styles: "padding:0;min-width:2rem;border-radius:999px;" }),
|
|
25
|
+
smallStart: createStyles({ name: "13w6ubi", styles: "padding-inline-start:0.5rem;padding-inline-end:0.75rem;" }),
|
|
26
|
+
smallEnd: createStyles({ name: "1g2rd08", styles: "padding-inline-start:0.75rem;padding-inline-end:0.5rem;" }),
|
|
27
|
+
extraSmallOnly: createStyles({ name: "1pnzsxn", styles: "padding:0;min-width:1.5rem;border-radius:999px;" }),
|
|
28
|
+
extraSmallStart: createStyles({ name: "1ixecau", styles: "padding-inline-start:0.25rem;padding-inline-end:0.5rem;" }),
|
|
29
|
+
extraSmallEnd: createStyles({ name: "f1t4k2", styles: "padding-inline-start:0.5rem;padding-inline-end:0.25rem;" }),
|
|
30
30
|
},
|
|
31
31
|
});
|
|
32
32
|
export const TertiaryButton = createComponent('button')({
|
|
@@ -25,7 +25,12 @@ const StyledToolbarDropdownButton = styled(BaseButton)({
|
|
|
25
25
|
width: 18, // decrease the space between a custom icon and the chevron per design
|
|
26
26
|
},
|
|
27
27
|
'&:focus-visible, &.focus': {
|
|
28
|
-
...
|
|
28
|
+
...focusRing({
|
|
29
|
+
width: 2,
|
|
30
|
+
separation: 0,
|
|
31
|
+
innerColor: 'transparent',
|
|
32
|
+
outerColor: brand.common.focusOutline,
|
|
33
|
+
}),
|
|
29
34
|
},
|
|
30
35
|
});
|
|
31
36
|
export const ToolbarDropdownButton = createComponent('button')({
|
|
@@ -10,7 +10,12 @@ const StyledToolbarIconButton = styled(BaseButton)({
|
|
|
10
10
|
height: 20,
|
|
11
11
|
},
|
|
12
12
|
'&:focus-visible, &.focus': {
|
|
13
|
-
...
|
|
13
|
+
...focusRing({
|
|
14
|
+
width: 2,
|
|
15
|
+
separation: 0,
|
|
16
|
+
innerColor: 'transparent',
|
|
17
|
+
outerColor: brand.common.focusOutline,
|
|
18
|
+
}),
|
|
14
19
|
},
|
|
15
20
|
});
|
|
16
21
|
export const ToolbarIconButton = createComponent('button')({
|
|
@@ -105,11 +105,11 @@ const Container = styled('button')({
|
|
|
105
105
|
'&:not([disabled])': {
|
|
106
106
|
'&:focus': {
|
|
107
107
|
borderColor: buttonColors.focusBorder,
|
|
108
|
-
...
|
|
108
|
+
...focusRing(),
|
|
109
109
|
},
|
|
110
110
|
'&:active': {
|
|
111
111
|
borderColor: buttonColors.activeBorder,
|
|
112
|
-
...
|
|
112
|
+
...focusRing(),
|
|
113
113
|
},
|
|
114
114
|
},
|
|
115
115
|
...mouseFocusBehavior({
|
|
@@ -5,7 +5,7 @@ import { createStyles } from '@workday/canvas-kit-styling';
|
|
|
5
5
|
import { base, system } from '@workday/canvas-tokens-web';
|
|
6
6
|
import { CardHeading } from './CardHeading';
|
|
7
7
|
import { CardBody } from './CardBody';
|
|
8
|
-
const cardBaseStyles = createStyles({ name: "
|
|
8
|
+
const cardBaseStyles = createStyles({ name: "1t9ablw", styles: "box-shadow:var(--cnvs-sys-depth-1, 0 0.0625rem 0.25rem 0 rgba(31,38,46,0.12),0 0.125rem 0.5rem 0 rgba(31,38,46,0.08));padding:var(--cnvs-sys-space-x8, calc(0.25rem * 8));background-color:var(--cnvs-base-palette-french-vanilla-100, rgba(255,255,255,1));border:0.0625rem solid var(--cnvs-base-palette-soap-500, rgba(206,211,217,1));border-radius:var(--cnvs-sys-shape-x2, calc(0.25rem * 2));" });
|
|
9
9
|
/**
|
|
10
10
|
* `Card` is a container component that holds a {@link CardBody Card.Body} and an optional
|
|
11
11
|
* {@link CardHeading Card.Heading}. `Card` wraps a non-semantic `div` element. The element can be
|
|
@@ -4,7 +4,7 @@ import { mergeStyles } from '@workday/canvas-kit-react/layout';
|
|
|
4
4
|
import { BodyText } from '@workday/canvas-kit-react/text';
|
|
5
5
|
import { createStyles } from '@workday/canvas-kit-styling';
|
|
6
6
|
import { system } from '@workday/canvas-tokens-web';
|
|
7
|
-
const cardHeadingBaseStyles = createStyles({ name: "
|
|
7
|
+
const cardHeadingBaseStyles = createStyles({ name: "1oy61zb", styles: "font-weight:var(--cnvs-sys-font-weight-bold, 700);margin-bottom:var(--cnvs-sys-space-x6, calc(0.25rem * 6));margin-top:0px;" });
|
|
8
8
|
export const CardHeading = createComponent('h3')({
|
|
9
9
|
displayName: 'Card.Heading',
|
|
10
10
|
Component: ({ children, ...elemProps }, ref, Element) => {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ErrorType } from '@workday/canvas-kit-react/common';
|
|
3
|
+
interface CheckBackgroundProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
error?: ErrorType;
|
|
6
|
+
}
|
|
7
|
+
export declare const backgroundVars: import("@workday/canvas-kit-styling").CsVars<"inner" | "outer", never>;
|
|
8
|
+
export declare const CheckBackground: import("@workday/canvas-kit-react/common").ElementComponent<"div", CheckBackgroundProps>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=CheckBackground.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckBackground.d.ts","sourceRoot":"","sources":["../../../../checkbox/lib/CheckBackground.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAkB,SAAS,EAAC,MAAM,kCAAkC,CAAC;AAI5E,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED,eAAO,MAAM,cAAc,wEAA+B,CAAC;AAgC3D,eAAO,MAAM,eAAe,0FAK1B,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { createComponent } from '@workday/canvas-kit-react/common';
|
|
3
|
+
import { calc, createStencil, createVars, px2rem, cssVar } from '@workday/canvas-kit-styling';
|
|
4
|
+
import { base, brand, system } from '@workday/canvas-tokens-web';
|
|
5
|
+
export const backgroundVars = createVars({ id: "cnvs-background", args: ["inner", "outer"] });
|
|
6
|
+
const checkboxBackgroundStencil = createStencil({
|
|
7
|
+
base: { name: "13c6rci", styles: "align-items:center;background-color:var(--cnvs-base-palette-french-vanilla-100, rgba(255,255,255,1));border-radius:var(--cnvs-sys-shape-half, calc(0.25rem * 0.5));box-sizing:border-box;display:flex;height:calc(var(--cnvs-sys-space-x4) + 0.125rem);justify-content:center;padding:var(--cnvs-sys-space-zero, 0) calc(var(--cnvs-sys-space-x1) / 2);pointer-events:none;position:absolute;transition:border 200ms ease, background 200ms;width:calc(var(--cnvs-sys-space-x4) + 0.125rem);border:0.0625rem solid var(--cnvs-base-palette-licorice-200, rgba(123,133,143,1));" },
|
|
8
|
+
modifiers: {
|
|
9
|
+
modifiers: {
|
|
10
|
+
error: { name: "1oai5jc", styles: "--cnvs-background-inner:var(--cnvs-brand-error-base, var(--cnvs-base-palette-cinnamon-500));--cnvs-background-outer:transparent;" },
|
|
11
|
+
alert: { name: "6w2nb6", styles: "--cnvs-background-inner:var(--cnvs-brand-alert-base, var(--cnvs-base-palette-cantaloupe-600));--cnvs-background-outer:var(--cnvs-brand-alert-darkest, var(--cnvs-base-palette-cantaloupe-400));" }
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}, "checkbox-background");
|
|
15
|
+
export const CheckBackground = createComponent('div')({
|
|
16
|
+
displayName: 'CheckBackground',
|
|
17
|
+
Component: ({ error, children }) => {
|
|
18
|
+
return React.createElement("div", Object.assign({}, checkboxBackgroundStencil({ error })), children);
|
|
19
|
+
},
|
|
20
|
+
});
|
|
@@ -1,49 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
export interface CheckboxProps extends Themeable {
|
|
4
|
-
/**
|
|
5
|
-
* If true, set the Checkbox to the checked state.
|
|
6
|
-
* @default false
|
|
7
|
-
*/
|
|
8
|
-
checked?: boolean;
|
|
9
|
-
/**
|
|
10
|
-
* If true, set the Checkbox to the disabled state.
|
|
11
|
-
* @default false
|
|
12
|
-
*/
|
|
13
|
-
disabled?: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* The HTML `id` of the underlying checkbox input element. This is required if `label` is defined as a non-empty string.
|
|
16
|
-
* @default {useUniqueId}
|
|
17
|
-
*/
|
|
18
|
-
id?: string;
|
|
19
|
-
/**
|
|
20
|
-
* The text of the Checkbox label.
|
|
21
|
-
* @default ''
|
|
22
|
-
*/
|
|
23
|
-
label?: string;
|
|
24
|
-
/**
|
|
25
|
-
* The function called when the Checkbox state changes.
|
|
26
|
-
*/
|
|
27
|
-
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
28
|
-
/**
|
|
29
|
-
* The value of the Checkbox.
|
|
30
|
-
*/
|
|
31
|
-
value?: string;
|
|
32
|
-
/**
|
|
33
|
-
* The type of error associated with the Checkbox (if applicable).
|
|
34
|
-
*/
|
|
35
|
-
error?: ErrorType;
|
|
36
|
-
/**
|
|
37
|
-
* If true, set the Checkbox to an indeterminate state. Use this on a Checkbox with nested child Checkboxes to denote that some (but not all) child Checkboxes are checked.
|
|
38
|
-
* @default false
|
|
39
|
-
*/
|
|
40
|
-
indeterminate?: boolean;
|
|
41
|
-
/**
|
|
42
|
-
* The variant for the checkbox
|
|
43
|
-
*/
|
|
44
|
-
variant?: 'inverse' | undefined;
|
|
45
|
-
}
|
|
1
|
+
import { ErrorType } from '@workday/canvas-kit-react/common';
|
|
2
|
+
import { CheckboxProps } from './CheckboxInput';
|
|
46
3
|
export declare const Checkbox: import("@workday/canvas-kit-react/common").ElementComponent<"input", CheckboxProps> & {
|
|
47
4
|
ErrorType: typeof ErrorType;
|
|
48
5
|
};
|
|
6
|
+
export { CheckboxProps };
|
|
49
7
|
//# sourceMappingURL=Checkbox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../../checkbox/lib/Checkbox.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../../checkbox/lib/Checkbox.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,SAAS,EAGV,MAAM,kCAAkC,CAAC;AAI1C,OAAO,EAAgB,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAE7D,eAAO,MAAM,QAAQ;;CA6BnB,CAAC;AAEH,OAAO,EAAC,aAAa,EAAC,CAAC"}
|
|
@@ -1,202 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { createComponent, ErrorType, useUniqueId,
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { base } from '@workday/canvas-tokens-web';
|
|
8
|
-
import { cssVar } from '@workday/canvas-kit-styling';
|
|
9
|
-
const CheckboxContainer = styled('div')({
|
|
10
|
-
display: 'flex',
|
|
11
|
-
alignItems: 'center',
|
|
12
|
-
minHeight: space.m,
|
|
13
|
-
position: 'relative',
|
|
14
|
-
});
|
|
15
|
-
/**
|
|
16
|
-
* Using a wrapper prevents the browser default behavior of trigging
|
|
17
|
-
* :hover on the checkbox when you hover on it's corresponding label.
|
|
18
|
-
* This stops the ripple from showing when you hover on the label.
|
|
19
|
-
*/
|
|
20
|
-
const CheckboxInputWrapper = styled('div')({
|
|
21
|
-
display: 'flex',
|
|
22
|
-
height: `calc(${space.s} + 2px)`,
|
|
23
|
-
minWidth: `calc(${space.s} + 2px)`,
|
|
24
|
-
marginTop: '3px',
|
|
25
|
-
alignSelf: 'flex-start',
|
|
26
|
-
});
|
|
27
|
-
const CheckboxRipple = styled('span')({
|
|
28
|
-
borderRadius: borderRadius.circle,
|
|
29
|
-
boxShadow: `0 0 0 0 ${colors.soap200}`,
|
|
30
|
-
height: `calc(${space.s} + 2px)`,
|
|
31
|
-
transition: 'box-shadow 150ms ease-out',
|
|
32
|
-
width: `calc(${space.s} + 2px)`,
|
|
33
|
-
position: 'absolute',
|
|
34
|
-
pointerEvents: 'none', // This is a decorative element we don't want it to block clicks to input
|
|
35
|
-
}, ({ variant }) => ({
|
|
36
|
-
opacity: variant === 'inverse' ? '0.4' : '1',
|
|
37
|
-
}));
|
|
38
|
-
/**
|
|
39
|
-
* Note: `~ div:first-of-type` refers to `CheckboxBackground`
|
|
40
|
-
* and was easier to use than a component selector in this case.
|
|
41
|
-
*/
|
|
42
|
-
const CheckboxInput = styled('input')(({ theme: { canvas: { palette: { primary: themePrimary, common: { focusOutline: themeFocusOutline }, }, }, }, variant, }) => ({
|
|
43
|
-
borderRadius: borderRadius.s,
|
|
44
|
-
width: space.m,
|
|
45
|
-
height: space.m,
|
|
46
|
-
margin: 0,
|
|
47
|
-
marginTop: '-3px',
|
|
48
|
-
marginLeft: '-3px',
|
|
49
|
-
position: 'absolute',
|
|
50
|
-
opacity: 0,
|
|
51
|
-
'&:not(:disabled)': {
|
|
52
|
-
cursor: 'pointer',
|
|
53
|
-
},
|
|
54
|
-
// States
|
|
55
|
-
'&:not(:checked):not(:indeterminate):not(:disabled):not(:focus):hover, &:not(:checked):not(:indeterminate):not(:disabled):active': {
|
|
56
|
-
'~ div:first-of-type': {
|
|
57
|
-
borderColor: variant === 'inverse' ? colors.soap300 : inputColors.hoverBorder,
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
'&:checked ~ div:first-of-type, &:indeterminate ~ div:first-of-type': {
|
|
61
|
-
borderColor: variant === 'inverse' ? colors.soap300 : themePrimary.main,
|
|
62
|
-
backgroundColor: variant === 'inverse' ? colors.frenchVanilla100 : themePrimary.main,
|
|
63
|
-
},
|
|
64
|
-
'&:disabled ~ div:first-of-type': {
|
|
65
|
-
borderColor: base.licorice100,
|
|
66
|
-
backgroundColor: variant === 'inverse' ? colors.soap300 : inputColors.disabled.background,
|
|
67
|
-
opacity: variant === 'inverse' ? '.4' : '1',
|
|
68
|
-
},
|
|
69
|
-
'&:disabled:checked ~ div:first-of-type, &:disabled:indeterminate ~ div:first-of-type': {
|
|
70
|
-
borderColor: variant === 'inverse' ? colors.soap300 : themePrimary.light,
|
|
71
|
-
backgroundColor: variant === 'inverse' ? colors.frenchVanilla100 : themePrimary.light,
|
|
72
|
-
},
|
|
73
|
-
// Focus
|
|
74
|
-
'&:focus, &:active': {
|
|
75
|
-
outline: 'none',
|
|
76
|
-
},
|
|
77
|
-
'&:focus ~ div:first-of-type': {
|
|
78
|
-
borderColor: variant === 'inverse' ? colors.blackPepper400 : themePrimary.main,
|
|
79
|
-
borderWidth: '2px',
|
|
80
|
-
boxShadow: 'none',
|
|
81
|
-
...{ boxShadow: `0 0 0 ${0} ${variant === 'inverse' ? colors.blackPepper400 : undefined}, 0 0 0 calc(${variant === 'inverse' ? 2 : 0} + ${0}) ${variant === 'inverse' ? colors.frenchVanilla100 : undefined}` },
|
|
82
|
-
},
|
|
83
|
-
'&:checked:focus ~ div:first-of-type, &:indeterminate:focus ~ div:first-of-type': {
|
|
84
|
-
...{ boxShadow: `0 0 0 ${2} ${variant === 'inverse' ? colors.blackPepper400 : undefined}, 0 0 0 calc(${2} + ${2}) ${variant === 'inverse' ? colors.frenchVanilla100 : themeFocusOutline}` },
|
|
85
|
-
borderColor: variant === 'inverse' ? colors.frenchVanilla100 : themePrimary.main,
|
|
86
|
-
borderWidth: '2px',
|
|
87
|
-
'& span': {
|
|
88
|
-
marginLeft: '-7px',
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
...mouseFocusBehavior({
|
|
92
|
-
'&:focus ~ div:first-of-type': {
|
|
93
|
-
border: variant === 'inverse'
|
|
94
|
-
? `1px solid ${colors.soap300}`
|
|
95
|
-
: `1px solid ${inputColors.hoverBorder}`,
|
|
96
|
-
boxShadow: 'none',
|
|
97
|
-
'& span': {
|
|
98
|
-
marginLeft: '-6px',
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
'&:checked ~ div:first-of-type, &:indeterminate ~ div:first-of-type': {
|
|
102
|
-
borderColor: variant === 'inverse' ? colors.soap300 : themePrimary.main,
|
|
103
|
-
},
|
|
104
|
-
'&:disabled:checked ~ div:first-of-type, &:disabled:indeterminate ~ div:first-of-type': {
|
|
105
|
-
borderColor: themePrimary.light,
|
|
106
|
-
backgroundColor: variant === 'inverse' ? colors.frenchVanilla100 : themePrimary.light,
|
|
107
|
-
},
|
|
108
|
-
}),
|
|
109
|
-
}), ({ disabled }) => ({
|
|
110
|
-
'&:hover ~ span:first-of-type': {
|
|
111
|
-
boxShadow: disabled
|
|
112
|
-
? undefined
|
|
113
|
-
: `0 0 0 calc((${space.l} - (${space.s} + 2px)) / 2) ${colors.soap200}`,
|
|
114
|
-
},
|
|
115
|
-
}), ({ theme, error, variant }) => {
|
|
116
|
-
const errorColors = getErrorColors(error, theme);
|
|
117
|
-
if (errorColors.outer === errorColors.inner) {
|
|
118
|
-
errorColors.outer = 'transparent';
|
|
119
|
-
}
|
|
120
|
-
const errorStyles = {
|
|
121
|
-
'& ~ div:first-of-type': {
|
|
122
|
-
border: variant === 'inverse' ? `1px solid ${colors.soap300}` : `1px solid ${errorColors.inner}`,
|
|
123
|
-
boxShadow: `0 0 0 1px ${errorColors.inner}, 0 0 0 2px ${errorColors.outer}`,
|
|
124
|
-
},
|
|
125
|
-
'&:not(:checked):not(:indeterminate):not(:disabled):not(:focus):hover, &:not(:checked):not(:indeterminate):not(:disabled):active': {
|
|
126
|
-
'~ div:first-of-type': {
|
|
127
|
-
borderColor: variant === 'inverse' ? `1px solid ${colors.soap300}` : errorColors.inner,
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
'&:checked ~ div:first-of-type, &:indeterminate ~ div:first-of-type': {
|
|
131
|
-
borderColor: variant === 'inverse' ? colors.soap300 : theme.canvas.palette.primary.main,
|
|
132
|
-
boxShadow: `
|
|
133
|
-
0 0 0 2px ${colors.frenchVanilla100},
|
|
134
|
-
0 0 0 4px ${errorColors.inner},
|
|
135
|
-
0 0 0 5px ${errorColors.outer}`,
|
|
136
|
-
},
|
|
137
|
-
};
|
|
138
|
-
return {
|
|
139
|
-
// Error rings take precedence over focus
|
|
140
|
-
...mouseFocusBehavior({
|
|
141
|
-
...errorStyles,
|
|
142
|
-
'&:not(:checked):not(:indeterminate):focus ~ div:first-of-type': {
|
|
143
|
-
border: `1px solid ${errorColors.inner}`,
|
|
144
|
-
boxShadow: `0 0 0 1px ${errorColors.inner}, 0 0 0 2px ${errorColors.outer}`,
|
|
145
|
-
},
|
|
146
|
-
}),
|
|
147
|
-
...errorStyles,
|
|
148
|
-
};
|
|
149
|
-
});
|
|
150
|
-
const CheckboxBackground = styled('div')({
|
|
151
|
-
alignItems: 'center',
|
|
152
|
-
backgroundColor: colors.frenchVanilla100,
|
|
153
|
-
borderRadius: borderRadius.s,
|
|
154
|
-
boxSizing: 'border-box',
|
|
155
|
-
display: 'flex',
|
|
156
|
-
height: `calc(${space.s} + 2px)`,
|
|
157
|
-
justifyContent: 'center',
|
|
158
|
-
padding: '0px 2px',
|
|
159
|
-
pointerEvents: 'none',
|
|
160
|
-
position: 'absolute',
|
|
161
|
-
transition: 'border 200ms ease, background 200ms',
|
|
162
|
-
width: `calc(${space.s} + 2px)`,
|
|
163
|
-
}, ({ variant }) => ({
|
|
164
|
-
border: `1px solid ${variant === 'inverse' ? colors.soap300 : inputColors.border}`,
|
|
165
|
-
}));
|
|
166
|
-
const CheckboxCheck = styled('div')({
|
|
167
|
-
display: 'flex',
|
|
168
|
-
flexDirection: 'column',
|
|
169
|
-
// When using align-items: center on a flex container in the column direction,
|
|
170
|
-
// the contents of flex item, if too big, will overflow their container in IE 10-11.
|
|
171
|
-
// max-width: 100%; is a workaround
|
|
172
|
-
// https://github.com/philipwalton/flexbugs#flexbug-2
|
|
173
|
-
maxWidth: '100%',
|
|
174
|
-
pointerEvents: 'none',
|
|
175
|
-
transition: 'transform 200ms ease, opacity 200ms ease',
|
|
176
|
-
span: {
|
|
177
|
-
// This is necessary because we're using max-width: 100% in the CheckboxCheck container
|
|
178
|
-
// in order for the Checkbox to render properly on IE 11
|
|
179
|
-
marginLeft: '-6px',
|
|
180
|
-
transition: 'margin 200ms ease',
|
|
181
|
-
},
|
|
182
|
-
}, ({ checked, indeterminate }) => ({
|
|
183
|
-
opacity: checked || indeterminate ? 1 : 0,
|
|
184
|
-
transform: checked || indeterminate ? 'scale(1)' : 'scale(0.5)',
|
|
185
|
-
}));
|
|
186
|
-
const IndeterminateBox = styled('div')({
|
|
187
|
-
width: '10px',
|
|
188
|
-
height: '2px',
|
|
189
|
-
}, ({ theme, variant }) => ({
|
|
190
|
-
backgroundColor: variant === 'inverse'
|
|
191
|
-
? theme.canvas.palette.primary.main
|
|
192
|
-
: theme.canvas.palette.primary.contrast,
|
|
193
|
-
}));
|
|
2
|
+
import { createComponent, ErrorType, useUniqueId, useLocalRef, } from '@workday/canvas-kit-react/common';
|
|
3
|
+
import { CheckboxRipple } from './CheckboxRipple';
|
|
4
|
+
import { CheckboxContainer } from './CheckboxContainer';
|
|
5
|
+
import { CheckboxCheck } from './CheckboxCheck';
|
|
6
|
+
import { CheckboxInput } from './CheckboxInput';
|
|
194
7
|
export const Checkbox = createComponent('input')({
|
|
195
8
|
displayName: 'Checkbox',
|
|
196
|
-
Component: ({
|
|
197
|
-
|
|
198
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
199
|
-
theme = useTheme(), id, disabled, indeterminate, variant, ...elemProps }, ref, Element) => {
|
|
9
|
+
Component: ({ id, label = '', ...elemProps }, ref, Element) => {
|
|
10
|
+
const { checked = false, disabled, error, indeterminate, variant } = elemProps;
|
|
200
11
|
const inputId = useUniqueId(id);
|
|
201
12
|
const { localRef, elementRef } = useLocalRef(ref);
|
|
202
13
|
React.useEffect(() => {
|
|
@@ -204,15 +15,10 @@ export const Checkbox = createComponent('input')({
|
|
|
204
15
|
localRef.current.indeterminate = indeterminate;
|
|
205
16
|
}
|
|
206
17
|
}, [indeterminate, localRef]);
|
|
207
|
-
return (React.createElement(CheckboxContainer,
|
|
208
|
-
React.createElement(
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
React.createElement(CheckboxBackground, { variant: variant, checked: checked, disabled: disabled },
|
|
212
|
-
React.createElement(CheckboxCheck, { checked: checked, indeterminate: indeterminate }, indeterminate ? (React.createElement(IndeterminateBox, { variant: variant })) : checked ? (React.createElement(SystemIcon, { icon: checkSmallIcon, color: variant === 'inverse'
|
|
213
|
-
? theme.canvas.palette.primary.main
|
|
214
|
-
: theme.canvas.palette.primary.contrast })) : null))),
|
|
215
|
-
label && (React.createElement(LabelText, { htmlFor: inputId, disabled: disabled, variant: variant, paddingInlineStart: space.xs, cursor: "pointer" }, label))));
|
|
18
|
+
return (React.createElement(CheckboxContainer, { label: label, disabled: disabled, id: inputId, variant: variant },
|
|
19
|
+
React.createElement(CheckboxInput, Object.assign({ as: Element, id: inputId, ref: elementRef }, elemProps)),
|
|
20
|
+
React.createElement(CheckboxRipple, null),
|
|
21
|
+
React.createElement(CheckboxCheck, { variant: variant, checked: checked, indeterminate: indeterminate, error: error })));
|
|
216
22
|
},
|
|
217
23
|
subComponents: {
|
|
218
24
|
ErrorType,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ErrorType } from '@workday/canvas-kit-react/common';
|
|
2
|
+
interface CheckboxCheckProps {
|
|
3
|
+
checked: boolean;
|
|
4
|
+
error?: ErrorType;
|
|
5
|
+
indeterminate?: boolean;
|
|
6
|
+
variant?: 'inverse';
|
|
7
|
+
}
|
|
8
|
+
export declare const CheckboxCheck: import("@workday/canvas-kit-react/common").ElementComponent<"div", CheckboxCheckProps>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=CheckboxCheck.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxCheck.d.ts","sourceRoot":"","sources":["../../../../checkbox/lib/CheckboxCheck.tsx"],"names":[],"mappings":"AACA,OAAO,EAAC,SAAS,EAAkB,MAAM,kCAAkC,CAAC;AAO5E,UAAU,kBAAkB;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB;AA6CD,eAAO,MAAM,aAAa,wFAsBxB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { createComponent } from '@workday/canvas-kit-react/common';
|
|
3
|
+
import { createStencil, createStyles, cssVar, calc, px2rem } from '@workday/canvas-kit-styling';
|
|
4
|
+
import { brand, system } from '@workday/canvas-tokens-web';
|
|
5
|
+
import { SystemIcon } from '@workday/canvas-kit-react/icon';
|
|
6
|
+
import { checkSmallIcon } from '@workday/canvas-system-icons-web';
|
|
7
|
+
import { CheckBackground } from './CheckBackground';
|
|
8
|
+
const checkboxCheckStencil = createStencil({
|
|
9
|
+
base: { name: "e9m2ww", styles: "display:flex;flex-direction:column;max-width:100%;pointer-events:none;transition:transform 200ms ease, opacity 200ms ease;span{margin-inline-start:calc(0.375rem * -1);transition:margin 200ms ease;}opacity:0px;transform:scale(0.5);" },
|
|
10
|
+
modifiers: {
|
|
11
|
+
modifiers: {
|
|
12
|
+
true: { name: "11cckse", styles: "opacity:1px;transform:scale(1);" }
|
|
13
|
+
},
|
|
14
|
+
modifiers: {
|
|
15
|
+
true: { name: "11cckse", styles: "opacity:1px;transform:scale(1);" }
|
|
16
|
+
},
|
|
17
|
+
modifiers: {
|
|
18
|
+
inverse: { name: "18xh6xb", styles: "& > div{background-color:var(--cnvs-brand-primary-base, rgba(8,117,225,1));}" }
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}, "checkbox-check");
|
|
22
|
+
const indeterminateBoxStyles = createStyles({ name: "1ekwrf6", styles: "width:calc(var(--cnvs-sys-space-x2) + 0.125rem);height:calc(var(--cnvs-sys-space-x1) / 2);background-color:var(--cnvs-brand-primary-accent, rgba(255,255,255,1));" });
|
|
23
|
+
export const CheckboxCheck = createComponent('div')({
|
|
24
|
+
displayName: 'CheckboxCheck',
|
|
25
|
+
Component: ({ checked, error, indeterminate, variant }) => {
|
|
26
|
+
return (React.createElement(CheckBackground, { error: error },
|
|
27
|
+
React.createElement("div", Object.assign({}, checkboxCheckStencil({ checked, indeterminate, variant })), indeterminate ? (React.createElement("div", { className: indeterminateBoxStyles })) : (checked && (React.createElement(SystemIcon, { icon: checkSmallIcon, color: variant === 'inverse' ? cssVar(brand.primary.base) : cssVar(brand.primary.accent) }))))));
|
|
28
|
+
},
|
|
29
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { CSProps } from '@workday/canvas-kit-styling';
|
|
3
|
+
interface CheckboxContainerProps extends CSProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
id: string;
|
|
7
|
+
label: string;
|
|
8
|
+
variant?: 'inverse';
|
|
9
|
+
}
|
|
10
|
+
export declare const inputVars: import("@workday/canvas-kit-styling").CsVars<"errorInner" | "errorOuter" | "alertInner" | "alertOuter", never>;
|
|
11
|
+
export declare const CheckboxContainer: import("@workday/canvas-kit-react/common").ElementComponent<"div", CheckboxContainerProps>;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=CheckboxContainer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxContainer.d.ts","sourceRoot":"","sources":["../../../../checkbox/lib/CheckboxContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,OAAO,EAAiD,MAAM,6BAA6B,CAAC;AAIpG,UAAU,sBAAuB,SAAQ,OAAO;IAC9C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB;AAED,eAAO,MAAM,SAAS,gHAAqE,CAAC;AAwB5F,eAAO,MAAM,iBAAiB,4FAmB5B,CAAC"}
|