@workday/canvas-kit-react 12.0.0-alpha.852-next.0 → 12.0.0-alpha.862-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.
@@ -18,91 +18,79 @@ var __importStar = (this && this.__importStar) || function (mod) {
18
18
  __setModuleDefault(result, mod);
19
19
  return result;
20
20
  };
21
- var __importDefault = (this && this.__importDefault) || function (mod) {
22
- return (mod && mod.__esModule) ? mod : { "default": mod };
23
- };
24
21
  Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.Avatar = exports.AvatarVariant = void 0;
22
+ exports.Avatar = exports.avatarStencil = void 0;
26
23
  const react_1 = __importStar(require("react"));
27
24
  const common_1 = require("@workday/canvas-kit-react/common");
28
- const is_prop_valid_1 = __importDefault(require("@emotion/is-prop-valid"));
25
+ const canvas_kit_styling_1 = require("@workday/canvas-kit-styling");
26
+ const layout_1 = require("@workday/canvas-kit-react/layout");
29
27
  const tokens_1 = require("@workday/canvas-kit-react/tokens");
30
28
  const icon_1 = require("@workday/canvas-kit-react/icon");
31
29
  const canvas_system_icons_web_1 = require("@workday/canvas-system-icons-web");
32
- var AvatarVariant;
33
- (function (AvatarVariant) {
34
- AvatarVariant[AvatarVariant["Light"] = 0] = "Light";
35
- AvatarVariant[AvatarVariant["Dark"] = 1] = "Dark";
36
- })(AvatarVariant = exports.AvatarVariant || (exports.AvatarVariant = {}));
37
- const fadeTransition = 'opacity 150ms linear';
38
- const StyledContainer = common_1.styled('button', {
39
- shouldForwardProp: prop => is_prop_valid_1.default(prop) && prop !== 'size',
40
- })({
41
- background: tokens_1.colors.soap200,
42
- position: 'relative',
43
- display: 'flex',
44
- alignItems: 'center',
45
- justifyContent: 'center',
46
- padding: 0,
47
- border: 0,
48
- boxSizing: 'border-box',
49
- overflow: 'hidden',
50
- borderRadius: tokens_1.borderRadius.circle,
51
- '&:not([disabled])': {
52
- '&:focus': {
53
- outline: 'none',
54
- ...common_1.focusRing({ separation: 2 }),
55
- },
30
+ const canvas_tokens_web_1 = require("@workday/canvas-tokens-web");
31
+ exports.avatarStencil = canvas_kit_styling_1.createStencil({
32
+ vars: {
33
+ size: '',
56
34
  },
57
- ...common_1.hideMouseFocus,
58
- }, ({ size }) => ({
59
- height: size,
60
- width: size,
61
- }), ({ onClick }) => ({
62
- cursor: onClick ? 'pointer' : 'default',
63
- }));
64
- const StyledStack = common_1.styled('span')({
65
- position: 'absolute',
66
- top: 0,
67
- left: 0,
68
- }, ({ size }) => ({
69
- height: size,
70
- width: size,
71
- }));
72
- const StyledIcon = common_1.styled(icon_1.SystemIconCircle, {
73
- shouldForwardProp: common_1.filterOutProps(['isImageLoaded']),
74
- })({
75
- transition: fadeTransition,
76
- }, ({ isImageLoaded }) => ({
77
- opacity: isImageLoaded ? 0 : 1,
78
- }));
79
- const StyledImage = common_1.styled('img', {
80
- shouldForwardProp: common_1.filterOutProps(['isLoaded', 'objectFit']),
81
- })({
82
- width: '100%',
83
- height: '100%',
84
- borderRadius: tokens_1.borderRadius.circle,
85
- transition: fadeTransition,
86
- }, ({ isLoaded, objectFit }) => ({
87
- opacity: isLoaded ? 1 : 0,
88
- objectFit,
89
- }));
90
- exports.Avatar = react_1.default.forwardRef(({ variant = AvatarVariant.Light, size = icon_1.SystemIconCircleSize.m, altText = 'Avatar', url, onClick, objectFit, ...elemProps }, ref) => {
91
- const [imageLoaded, setImageLoaded] = react_1.useState(false);
92
- const loadImage = () => {
93
- if (!imageLoaded) {
94
- setImageLoaded(true);
35
+ base: { name: "b532d4", styles: "box-sizing:border-box;background:var(--cnvs-sys-color-bg-caution-default);position:relative;display:flex;align-items:center;justify-content:center;padding:0;border:0;overflow:hidden;cursor:default;border-radius:var(--cnvs-sys-shape-round);width:var(--size-avatar-f68c19);height:var(--size-avatar-f68c19);&:focus-visible:not([disabled]), &.focus:not([disabled]){outline:none;box-shadow:0 0 0 2px var(--cnvs-base-palette-french-vanilla-100, rgba(255,255,255,1)), 0 0 0 4px var(--cnvs-brand-common-focus-outline, rgba(8,117,225,1));}:is(button){cursor:pointer;}& > [data-slot=\"avatar-icon\"]{transition:opacity 150ms linear;display:flex;align-items:center;justify-content:center;--size-svg-a30d66:calc(var(--size-avatar-f68c19) * 0.625);}& > [data-slot=\"avatar-image\"]{position:absolute;width:100%;height:100%;border-radius:999px;transition:opacity 150ms linear;}" },
36
+ modifiers: {
37
+ variant: {
38
+ light: { name: "93f2f0", styles: "background-color:var(--cnvs-sys-color-bg-alt-default);& [data-slot=\"avatar-icon\"]{--color-system-icon-583fae:var(--cnvs-sys-color-fg-default);}" },
39
+ dark: { name: "094953", styles: "background-color:var(--cnvs-sys-color-bg-primary-default);& [data-slot=\"avatar-icon\"]{--color-system-icon-583fae:var(--cnvs-sys-color-fg-inverse);}" }
40
+ },
41
+ size: {
42
+ extraSmall: { name: "dd6bba", styles: "width:var(--cnvs-sys-space-x4);height:var(--cnvs-sys-space-x4);& [data-slot=\"avatar-icon\"]{--size-svg-a30d66:calc(var(--cnvs-sys-space-x4) * 0.625);}" },
43
+ small: { name: "8bd568", styles: "width:var(--cnvs-sys-space-x6);height:var(--cnvs-sys-space-x6);& [data-slot=\"avatar-icon\"]{--size-svg-a30d66:calc(var(--cnvs-sys-space-x6) * 0.625);}" },
44
+ medium: { name: "73d354", styles: "width:var(--cnvs-sys-space-x8);height:var(--cnvs-sys-space-x8);& [data-slot=\"avatar-icon\"]{--size-svg-a30d66:calc(var(--cnvs-sys-space-x8) * 0.625);}" },
45
+ large: { name: "b1ab3d", styles: "width:var(--cnvs-sys-space-x10);height:var(--cnvs-sys-space-x10);& [data-slot=\"avatar-icon\"]{--size-svg-a30d66:calc(var(--cnvs-sys-space-x10) * 0.625);}" },
46
+ extraLarge: { name: "51b4a9", styles: "width:var(--cnvs-sys-space-x16);height:var(--cnvs-sys-space-x16);& [data-slot=\"avatar-icon\"]{--size-svg-a30d66:calc(var(--cnvs-sys-space-x16) * 0.625);}" },
47
+ extraExtraLarge: { name: "271180", styles: "width:calc(var(--cnvs-sys-space-x10) * 3);height:calc(var(--cnvs-sys-space-x10) * 3);& [data-slot=\"avatar-icon\"]{--size-svg-a30d66:calc(calc(var(--cnvs-sys-space-x10) * 3) * 0.625);}" }
48
+ },
49
+ objectFit: {
50
+ contain: { name: "ec34b8", styles: "& [data-slot=\"avatar-image\"]{object-fit:contain;}" },
51
+ fill: { name: "f2ce94", styles: "& [data-slot=\"avatar-image\"]{object-fit:fill;}" },
52
+ cover: { name: "f01d16", styles: "& [data-slot=\"avatar-image\"]{object-fit:cover;}" },
53
+ ['scale-down']: { name: "b72ff8", styles: "& [data-slot=\"avatar-image\"]{object-fit:scale-down;}" },
54
+ none: { name: "6349a5", styles: "& [data-slot=\"avatar-image\"]{object-fit:none;}" },
55
+ ['-moz-initial']: { name: "8d0a0d", styles: "& [data-slot=\"avatar-image\"]{object-fit:-moz-initial;}" },
56
+ ['initial']: { name: "23e1a7", styles: "& [data-slot=\"avatar-image\"]{object-fit:initial;}" },
57
+ ['inherit']: { name: "1be8d9", styles: "& [data-slot=\"avatar-image\"]{object-fit:inherit;}" },
58
+ ['revert']: { name: "1f00e3", styles: "& [data-slot=\"avatar-image\"]{object-fit:revert;}" },
59
+ ['unset']: { name: "6f1eb7", styles: "& [data-slot=\"avatar-image\"]{object-fit:unset;}" }
60
+ },
61
+ isImageLoaded: {
62
+ true: { name: "6ab642", styles: "& [data-slot=\"avatar-icon\"]{opacity:0;}& [data-slot=\"avatar-image\"]{opacity:1;}" },
63
+ false: { name: "53c2af", styles: "& [data-slot=\"avatar-icon\"]{opacity:1;}& [data-slot=\"avatar-image\"]{opacity:0;}" }
95
64
  }
96
- };
97
- react_1.default.useLayoutEffect(() => {
98
- setImageLoaded(false);
99
- }, [url]);
100
- const background = variant === AvatarVariant.Dark ? tokens_1.colors.blueberry400 : tokens_1.colors.soap300;
101
- return (react_1.default.createElement(StyledContainer, Object.assign({ size: size, "aria-label": altText, onClick: onClick, disabled: onClick ? false : true, ref: ref }, elemProps),
102
- react_1.default.createElement(StyledStack, { size: size },
103
- react_1.default.createElement(StyledIcon, { icon: canvas_system_icons_web_1.userIcon, background: background, size: size, isImageLoaded: imageLoaded })),
104
- url && (react_1.default.createElement(StyledStack, { size: size },
105
- react_1.default.createElement(StyledImage, { src: url, alt: altText, onLoad: loadImage, isLoaded: imageLoaded, objectFit: objectFit, loading: "lazy" })))));
106
- }); // AvatarProps and forwardRef signatures are incompatible, so we must force cast
107
- exports.Avatar.Variant = AvatarVariant;
108
- exports.Avatar.Size = icon_1.SystemIconCircleSize;
65
+ },
66
+ defaultModifiers: {
67
+ variant: 'light',
68
+ size: 'medium',
69
+ isImageLoaded: 'false',
70
+ objectFit: 'contain',
71
+ }
72
+ }, "avatar-f68c19");
73
+ exports.Avatar = common_1.createComponent('button')({
74
+ displayName: 'Avatar',
75
+ Component: ({ variant, size, altText = 'Avatar', url, objectFit, ...elemProps }, ref, Element) => {
76
+ const [imageLoaded, setImageLoaded] = react_1.useState(false);
77
+ const loadImage = () => {
78
+ if (!imageLoaded) {
79
+ setImageLoaded(true);
80
+ }
81
+ };
82
+ react_1.default.useLayoutEffect(() => {
83
+ setImageLoaded(false);
84
+ }, [url]);
85
+ return (react_1.default.createElement(Element, Object.assign({ ref: ref, "aria-label": altText }, layout_1.mergeStyles(elemProps, [
86
+ exports.avatarStencil({
87
+ variant,
88
+ size,
89
+ objectFit,
90
+ isImageLoaded: imageLoaded,
91
+ }),
92
+ ])),
93
+ react_1.default.createElement(icon_1.SystemIcon, { icon: canvas_system_icons_web_1.userIcon, "data-slot": "avatar-icon" }),
94
+ url && react_1.default.createElement("img", { "data-slot": "avatar-image", src: url, alt: altText, onLoad: loadImage })));
95
+ },
96
+ });
@@ -1,46 +1,79 @@
1
- import * as React from 'react';
2
- import { GrowthBehavior, ErrorType, Themeable } from '@workday/canvas-kit-react/common';
3
- export interface TextAreaProps extends Themeable, GrowthBehavior {
4
- /**
5
- * If true, set the TextArea to the disabled state.
6
- * @default false
7
- */
8
- disabled?: boolean;
1
+ import { GrowthBehavior, ErrorType } from '@workday/canvas-kit-react/common';
2
+ export declare type ValueOf<T> = T[keyof T];
3
+ export interface TextAreaProps extends GrowthBehavior {
9
4
  /**
10
5
  * The type of error associated with the TextArea (if applicable).
11
6
  */
12
7
  error?: ErrorType;
13
- /**
14
- * The function called when the TextArea state changes.
15
- */
16
- onChange?: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
17
- /**
18
- * The placeholder text of the TextArea.
19
- */
20
- placeholder?: string;
21
- /**
22
- * If true, set the TextArea to read-only. The user will be unable to interact with the TextArea.
23
- * @default false
24
- */
25
- readOnly?: boolean;
26
8
  /**
27
9
  * The resize constraints of the TextArea.
28
10
  * @default TextArea.ResizeDirection.Both
29
11
  */
30
- resize?: TextAreaResizeDirection;
31
- /**
32
- * The value of the TextArea.
33
- */
34
- value?: any;
35
- }
36
- export declare enum TextAreaResizeDirection {
37
- None = "none",
38
- Both = "both",
39
- Horizontal = "horizontal",
40
- Vertical = "vertical"
12
+ resize?: ValueOf<typeof TextAreaResizeDirection>;
41
13
  }
14
+ export declare const TextAreaResizeDirection: {
15
+ readonly None: "none";
16
+ readonly Both: "both";
17
+ readonly Horizontal: "horizontal";
18
+ readonly Vertical: "vertical";
19
+ };
20
+ export declare const textAreaStencil: import("@workday/canvas-kit-styling").Stencil<{
21
+ resize: {
22
+ both: {
23
+ resize: "both";
24
+ };
25
+ horizontal: {
26
+ resize: "horizontal";
27
+ };
28
+ vertical: {
29
+ resize: "vertical";
30
+ };
31
+ none: {
32
+ resize: "none";
33
+ };
34
+ };
35
+ }, {}, import("@workday/canvas-kit-styling").Stencil<{
36
+ grow: {
37
+ true: {
38
+ width: string;
39
+ resize: "vertical";
40
+ };
41
+ false: {
42
+ width: string;
43
+ };
44
+ };
45
+ error: {
46
+ error: {
47
+ borderColor: "--cnvs-brand-error-base";
48
+ boxShadow: string;
49
+ '&:hover, &.hover, &:disabled, &.disabled, &:focus-visible:not([disabled]), &.focus:not([disabled])': {
50
+ borderColor: "--cnvs-brand-error-base";
51
+ };
52
+ '&:focus-visible:not([disabled]), &.focus:not([disabled])': {
53
+ boxShadow: string;
54
+ };
55
+ };
56
+ alert: {
57
+ borderColor: "--cnvs-brand-alert-darkest";
58
+ boxShadow: string;
59
+ '&:hover, &.hover, &:disabled, &.disabled, &:focus-visible:not([disabled]), &.focus:not([disabled])': {
60
+ borderColor: "--cnvs-brand-alert-darkest";
61
+ };
62
+ '&:focus-visible:not([disabled]), &.focus:not([disabled])': {
63
+ boxShadow: string;
64
+ };
65
+ };
66
+ };
67
+ }, {
68
+ width: string;
69
+ }, never, never>, never>;
42
70
  export declare const TextArea: import("@workday/canvas-kit-react/common").ElementComponent<"textarea", TextAreaProps> & {
43
71
  ErrorType: typeof ErrorType;
44
- ResizeDirection: typeof TextAreaResizeDirection;
72
+ ResizeDirection: {
73
+ readonly None: "none";
74
+ readonly Both: "both";
75
+ readonly Horizontal: "horizontal";
76
+ readonly Vertical: "vertical";
77
+ };
45
78
  };
46
79
  //# sourceMappingURL=TextArea.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TextArea.d.ts","sourceRoot":"","sources":["../../../../text-area/lib/TextArea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAGL,cAAc,EACd,SAAS,EAGT,SAAS,EACV,MAAM,kCAAkC,CAAC;AAG1C,MAAM,WAAW,aAAc,SAAQ,SAAS,EAAE,cAAc;IAC9D;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAC;IAC/D;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,MAAM,CAAC,EAAE,uBAAuB,CAAC;IACjC;;OAEG;IACH,KAAK,CAAC,EAAE,GAAG,CAAC;CACb;AAED,oBAAY,uBAAuB;IACjC,IAAI,SAAS;IACb,IAAI,SAAS;IACb,UAAU,eAAe;IACzB,QAAQ,aAAa;CACtB;AA8CD,eAAO,MAAM,QAAQ;;;CAWnB,CAAC"}
1
+ {"version":3,"file":"TextArea.d.ts","sourceRoot":"","sources":["../../../../text-area/lib/TextArea.tsx"],"names":[],"mappings":"AACA,OAAO,EAAkB,cAAc,EAAE,SAAS,EAAC,MAAM,kCAAkC,CAAC;AAI5F,oBAAY,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAEpC,MAAM,WAAW,aAAc,SAAQ,cAAc;IACnD;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC,OAAO,uBAAuB,CAAC,CAAC;CAClD;AAED,eAAO,MAAM,uBAAuB;;;;;CAK1B,CAAC;AAEX,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA6B1B,CAAC;AAEH,eAAO,MAAM,QAAQ;;;;;;;;CAWnB,CAAC"}
@@ -19,61 +19,38 @@ var __importStar = (this && this.__importStar) || function (mod) {
19
19
  return result;
20
20
  };
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.TextArea = exports.TextAreaResizeDirection = void 0;
22
+ exports.TextArea = exports.textAreaStencil = exports.TextAreaResizeDirection = void 0;
23
23
  const React = __importStar(require("react"));
24
24
  const common_1 = require("@workday/canvas-kit-react/common");
25
- const tokens_1 = require("@workday/canvas-kit-react/tokens");
26
- var TextAreaResizeDirection;
27
- (function (TextAreaResizeDirection) {
28
- TextAreaResizeDirection["None"] = "none";
29
- TextAreaResizeDirection["Both"] = "both";
30
- TextAreaResizeDirection["Horizontal"] = "horizontal";
31
- TextAreaResizeDirection["Vertical"] = "vertical";
32
- })(TextAreaResizeDirection = exports.TextAreaResizeDirection || (exports.TextAreaResizeDirection = {}));
33
- const StyledTextArea = common_1.styled('textarea')(({ theme, error }) => ({
34
- ...tokens_1.type.levels.subtext.large,
35
- border: `1px solid ${tokens_1.inputColors.border}`,
36
- display: 'block',
37
- backgroundColor: tokens_1.inputColors.background,
38
- borderRadius: tokens_1.borderRadius.m,
39
- boxSizing: 'border-box',
40
- minHeight: tokens_1.space.xxl,
41
- minWidth: `calc((${tokens_1.space.xxxl} * 3) + ${tokens_1.space.xl})`,
42
- transition: '0.2s box-shadow, 0.2s border-color',
43
- padding: tokens_1.space.xxs,
44
- margin: 0,
45
- '&::webkit-resizer': {
46
- display: 'none',
47
- },
48
- '&::placeholder': {
49
- color: tokens_1.inputColors.placeholder,
50
- },
51
- '&:hover': {
52
- borderColor: tokens_1.inputColors.hoverBorder,
53
- },
54
- '&:focus:not([disabled])': {
55
- borderColor: theme.canvas.palette.common.focusOutline,
56
- boxShadow: `inset 0 0 0 1px ${theme.canvas.palette.common.focusOutline}`,
57
- outline: 'none',
58
- },
59
- '&:disabled': {
60
- backgroundColor: tokens_1.inputColors.disabled.background,
61
- borderColor: tokens_1.inputColors.disabled.border,
62
- color: tokens_1.inputColors.disabled.text,
63
- '&::placeholder': {
64
- color: tokens_1.inputColors.disabled.text,
65
- },
25
+ const canvas_kit_styling_1 = require("@workday/canvas-kit-styling");
26
+ const canvas_tokens_web_1 = require("@workday/canvas-tokens-web");
27
+ const text_input_1 = require("@workday/canvas-kit-react/text-input");
28
+ exports.TextAreaResizeDirection = {
29
+ None: 'none',
30
+ Both: 'both',
31
+ Horizontal: 'horizontal',
32
+ Vertical: 'vertical',
33
+ };
34
+ exports.textAreaStencil = canvas_kit_styling_1.createStencil({
35
+ extends: text_input_1.textInputStencil,
36
+ base: { name: "22b420", styles: "box-sizing:border-box;min-height:var(--cnvs-sys-space-x16);min-width:calc(calc(var(--cnvs-sys-space-x20) * 3) + var(--cnvs-sys-space-x10));&::webkit-resizer{display:none;}" },
37
+ modifiers: {
38
+ resize: {
39
+ both: { name: "7c01d6", styles: "resize:both;" },
40
+ horizontal: { name: "5904a0", styles: "resize:horizontal;" },
41
+ vertical: { name: "d5a9dd", styles: "resize:vertical;" },
42
+ none: { name: "1997d7", styles: "resize:none;" }
43
+ }
66
44
  },
67
- ...common_1.errorRing(error, theme),
68
- }), ({ resize, grow }) => ({
69
- width: grow ? '100%' : undefined,
70
- resize: grow ? TextAreaResizeDirection.Vertical : resize,
71
- }));
45
+ defaultModifiers: {
46
+ resize: 'both',
47
+ }
48
+ }, "text-area-3e725a");
72
49
  exports.TextArea = common_1.createComponent('textarea')({
73
50
  displayName: 'TextArea',
74
- Component: ({ resize = TextAreaResizeDirection.Both, grow, ...elemProps }, ref, Element) => React.createElement(StyledTextArea, Object.assign({ ref: ref, as: Element, grow: grow, resize: resize }, elemProps)),
51
+ Component: ({ resize = exports.TextAreaResizeDirection.Both, grow, error, ...elemProps }, ref, Element) => React.createElement(Element, Object.assign({ ref: ref }, canvas_kit_styling_1.handleCsProp(elemProps, exports.textAreaStencil({ error, grow, resize })))),
75
52
  subComponents: {
76
53
  ErrorType: common_1.ErrorType,
77
- ResizeDirection: TextAreaResizeDirection,
54
+ ResizeDirection: exports.TextAreaResizeDirection,
78
55
  },
79
56
  });
@@ -1,5 +1,5 @@
1
- import { GrowthBehavior, ErrorType, Themeable } from '@workday/canvas-kit-react/common';
2
- export interface TextInputProps extends Themeable, GrowthBehavior {
1
+ import { GrowthBehavior, ErrorType } from '@workday/canvas-kit-react/common';
2
+ export interface TextInputProps extends GrowthBehavior {
3
3
  /**
4
4
  * The type of error associated with the TextInput (if applicable).
5
5
  */
@@ -9,6 +9,41 @@ export interface TextInputProps extends Themeable, GrowthBehavior {
9
9
  */
10
10
  width?: number | string;
11
11
  }
12
+ export declare const textInputStencil: import("@workday/canvas-kit-styling").Stencil<{
13
+ grow: {
14
+ true: {
15
+ width: string;
16
+ resize: "vertical";
17
+ };
18
+ false: {
19
+ width: string;
20
+ };
21
+ };
22
+ error: {
23
+ error: {
24
+ borderColor: "--cnvs-brand-error-base";
25
+ boxShadow: string;
26
+ '&:hover, &.hover, &:disabled, &.disabled, &:focus-visible:not([disabled]), &.focus:not([disabled])': {
27
+ borderColor: "--cnvs-brand-error-base";
28
+ };
29
+ '&:focus-visible:not([disabled]), &.focus:not([disabled])': {
30
+ boxShadow: string;
31
+ };
32
+ };
33
+ alert: {
34
+ borderColor: "--cnvs-brand-alert-darkest";
35
+ boxShadow: string;
36
+ '&:hover, &.hover, &:disabled, &.disabled, &:focus-visible:not([disabled]), &.focus:not([disabled])': {
37
+ borderColor: "--cnvs-brand-alert-darkest";
38
+ };
39
+ '&:focus-visible:not([disabled]), &.focus:not([disabled])': {
40
+ boxShadow: string;
41
+ };
42
+ };
43
+ };
44
+ }, {
45
+ width: string;
46
+ }, never, never>;
12
47
  export declare const TextInput: import("@workday/canvas-kit-react/common").ElementComponent<"input", TextInputProps> & {
13
48
  ErrorType: typeof ErrorType;
14
49
  };
@@ -1 +1 @@
1
- {"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../../../text-input/lib/TextInput.tsx"],"names":[],"mappings":"AACA,OAAO,EAGL,cAAc,EACd,SAAS,EAGT,SAAS,EACV,MAAM,kCAAkC,CAAC;AAG1C,MAAM,WAAW,cAAe,SAAQ,SAAS,EAAE,cAAc;IAC/D;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AA2DD,eAAO,MAAM,SAAS;;CAgBpB,CAAC"}
1
+ {"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../../../text-input/lib/TextInput.tsx"],"names":[],"mappings":"AACA,OAAO,EAAkB,cAAc,EAAE,SAAS,EAAC,MAAM,kCAAkC,CAAC;AAI5F,MAAM,WAAW,cAAe,SAAQ,cAAc;IACpD;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAqF3B,CAAC;AAEH,eAAO,MAAM,SAAS;;CAepB,CAAC"}
@@ -19,61 +19,33 @@ var __importStar = (this && this.__importStar) || function (mod) {
19
19
  return result;
20
20
  };
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.TextInput = void 0;
22
+ exports.TextInput = exports.textInputStencil = void 0;
23
23
  const React = __importStar(require("react"));
24
24
  const common_1 = require("@workday/canvas-kit-react/common");
25
- const tokens_1 = require("@workday/canvas-kit-react/tokens");
26
- const StyledTextInput = common_1.styled('input')({
27
- ...tokens_1.type.levels.subtext.large,
28
- border: `1px solid ${tokens_1.inputColors.border}`,
29
- display: 'block',
30
- backgroundColor: tokens_1.inputColors.background,
31
- borderRadius: tokens_1.borderRadius.m,
32
- boxSizing: 'border-box',
33
- height: 40,
34
- transition: '0.2s box-shadow, 0.2s border-color',
35
- padding: tokens_1.space.xxs,
36
- margin: 0,
37
- '&::placeholder': {
38
- color: tokens_1.inputColors.placeholder,
25
+ const canvas_kit_styling_1 = require("@workday/canvas-kit-styling");
26
+ const canvas_tokens_web_1 = require("@workday/canvas-tokens-web");
27
+ exports.textInputStencil = canvas_kit_styling_1.createStencil({
28
+ vars: {
29
+ width: '',
39
30
  },
40
- '&:hover, &.hover': {
41
- borderColor: tokens_1.inputColors.hoverBorder,
42
- },
43
- '&:focus-visible:not([disabled]), &.focus:not([disabled]), &:focus:not([disabled])': {
44
- borderColor: tokens_1.inputColors.focusBorder,
45
- boxShadow: `inset 0 0 0 1px ${tokens_1.inputColors.focusBorder}`,
46
- outline: 'none',
47
- },
48
- '&:disabled': {
49
- backgroundColor: tokens_1.inputColors.disabled.background,
50
- borderColor: tokens_1.inputColors.disabled.border,
51
- color: tokens_1.inputColors.disabled.text,
52
- '&::placeholder': {
53
- color: tokens_1.inputColors.disabled.text,
31
+ base: { name: "edcc19", styles: "box-sizing:border-box;font-family:var(--cnvs-base-font-family-50);font-weight:var(--cnvs-base-font-weight-400);line-height:var(--cnvs-base-line-height-100);font-size:var(--cnvs-base-font-size-75);letter-spacing:var(--cnvs-base-letter-spacing-150);display:block;border:0.0625rem solid var(--cnvs-sys-color-border-input-default);background-color:var(--cnvs-sys-color-bg-default);border-radius:var(--cnvs-sys-shape-x1);height:var(--cnvs-sys-space-x10);transition:0.2s box-shadow, 0.2s border-color;padding:var(--cnvs-sys-space-x2);margin:0rem;width:var(--width-text-input-ac8e50);min-width:var(--width-text-input-ac8e50, calc(calc(var(--cnvs-sys-space-x20) * 3) + var(--cnvs-sys-space-x10)));color:var(--cnvs-sys-color-text-default);::-ms-clear{display:none;}&::placeholder{color:var(--cnvs-sys-color-text-hint);}&:hover, &.hover{border-color:var(--cnvs-sys-color-border-input-strong);}&:focus-visible:not([disabled]), &.focus:not([disabled]){border-color:var(--cnvs-brand-common-focus-outline);box-shadow:inset 0 0 0 1px var(--cnvs-brand-common-focus-outline);outline:none;}&:disabled, .disabled{background-color:var(--cnvs-sys-color-bg-alt-softer);border-color:var(--cnvs-sys-color-border-input-disabled);color:var(--cnvs-sys-color-text-disabled);&::placeholder{color:var(--cnvs-sys-color-text-disabled);}}" },
32
+ modifiers: {
33
+ grow: {
34
+ true: { name: "6c63b7", styles: "width:100%;resize:vertical;" },
35
+ false: { name: "ba7d2f", styles: "width:initial;" }
54
36
  },
37
+ error: {
38
+ error: { name: "a75f3c", styles: "border-color:var(--cnvs-brand-error-base);box-shadow:inset 0 0 0 0.0625rem var(--cnvs-brand-error-base);&:hover, &.hover, &:disabled, &.disabled, &:focus-visible:not([disabled]), &.focus:not([disabled]){border-color:var(--cnvs-brand-error-base);}&:focus-visible:not([disabled]), &.focus:not([disabled]){box-shadow:inset 0 0 0 0.0625rem var(--cnvs-brand-error-base), 0 0 0 2px var(--cnvs-sys-color-border-inverse), 0 0 0 4px var(--cnvs-brand-common-focus-outline);}" },
39
+ alert: { name: "277895", styles: "border-color:var(--cnvs-brand-alert-darkest);box-shadow:inset 0 0 0 0.125rem var(--cnvs-brand-alert-base);&:hover, &.hover, &:disabled, &.disabled, &:focus-visible:not([disabled]), &.focus:not([disabled]){border-color:var(--cnvs-brand-alert-darkest);}&:focus-visible:not([disabled]), &.focus:not([disabled]){box-shadow:inset 0 0 0 0.125rem var(--cnvs-brand-alert-base),\n 0 0 0 2px var(--cnvs-sys-color-border-inverse),\n 0 0 0 4px var(--cnvs-brand-common-focus-outline);}" }
40
+ }
55
41
  },
56
- '::-ms-clear': {
57
- display: 'none',
58
- },
59
- }, ({ width }) => ({
60
- minWidth: width || 280,
61
- width,
62
- }), ({ grow }) => grow && {
63
- width: '100%',
64
- }, ({ theme, error }) => {
65
- return {
66
- '&:focus-visible:not([disabled]), &.focus:not([disabled])': {
67
- borderColor: theme.canvas.palette.common.focusOutline,
68
- boxShadow: `inset 0 0 0 1px ${theme.canvas.palette.common.focusOutline}`,
69
- outline: 'none',
70
- },
71
- ...common_1.errorRing(error, theme),
72
- };
73
- });
42
+ defaultModifiers: {
43
+ grow: 'false',
44
+ }
45
+ }, "text-input-ac8e50");
74
46
  exports.TextInput = common_1.createComponent('input')({
75
47
  displayName: 'TextInput',
76
- Component: ({ grow, error, width, ...elemProps }, ref, Element) => (React.createElement(StyledTextInput, Object.assign({ type: "text", ref: ref, as: Element, grow: grow, error: error, width: width }, elemProps))),
48
+ Component: ({ grow, error, width, ...elemProps }, ref, Element) => (React.createElement(Element, Object.assign({ type: "text", ref: ref }, canvas_kit_styling_1.handleCsProp(elemProps, exports.textInputStencil({ width: typeof width === 'number' ? canvas_kit_styling_1.px2rem(width) : width, grow, error }))))),
77
49
  subComponents: {
78
50
  ErrorType: common_1.ErrorType,
79
51
  },