@workday/canvas-kit-labs-react 6.0.5 → 6.1.1

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.
Files changed (104) hide show
  1. package/common/README.md +32 -0
  2. package/common/lib/theming/useThemedRing.ts +20 -26
  3. package/dist/commonjs/common/lib/theming/useThemedRing.d.ts +1 -1
  4. package/dist/commonjs/common/lib/theming/useThemedRing.d.ts.map +1 -1
  5. package/dist/commonjs/common/lib/theming/useThemedRing.js +17 -17
  6. package/dist/commonjs/index.d.ts +0 -1
  7. package/dist/commonjs/index.d.ts.map +1 -1
  8. package/dist/commonjs/index.js +0 -1
  9. package/dist/es6/common/lib/theming/useThemedRing.d.ts +1 -1
  10. package/dist/es6/common/lib/theming/useThemedRing.d.ts.map +1 -1
  11. package/dist/es6/common/lib/theming/useThemedRing.js +18 -18
  12. package/dist/es6/index.d.ts +0 -1
  13. package/dist/es6/index.d.ts.map +1 -1
  14. package/dist/es6/index.js +0 -1
  15. package/index.ts +0 -1
  16. package/package.json +7 -8
  17. package/ts3.5/dist/commonjs/common/lib/theming/useThemedRing.d.ts +1 -1
  18. package/ts3.5/dist/commonjs/index.d.ts +0 -1
  19. package/ts3.5/dist/es6/common/lib/theming/useThemedRing.d.ts +1 -1
  20. package/ts3.5/dist/es6/index.d.ts +0 -1
  21. package/dist/commonjs/text-input/index.d.ts +0 -7
  22. package/dist/commonjs/text-input/index.d.ts.map +0 -1
  23. package/dist/commonjs/text-input/index.js +0 -11
  24. package/dist/commonjs/text-input/lib/TextInput.d.ts +0 -21
  25. package/dist/commonjs/text-input/lib/TextInput.d.ts.map +0 -1
  26. package/dist/commonjs/text-input/lib/TextInput.js +0 -36
  27. package/dist/commonjs/text-input/lib/TextInputField.d.ts +0 -8
  28. package/dist/commonjs/text-input/lib/TextInputField.d.ts.map +0 -1
  29. package/dist/commonjs/text-input/lib/TextInputField.js +0 -66
  30. package/dist/commonjs/text-input/lib/TextInputHint.d.ts +0 -13
  31. package/dist/commonjs/text-input/lib/TextInputHint.d.ts.map +0 -1
  32. package/dist/commonjs/text-input/lib/TextInputHint.js +0 -46
  33. package/dist/commonjs/text-input/lib/TextInputLabel.d.ts +0 -17
  34. package/dist/commonjs/text-input/lib/TextInputLabel.d.ts.map +0 -1
  35. package/dist/commonjs/text-input/lib/TextInputLabel.js +0 -54
  36. package/dist/commonjs/text-input/lib/hooks/useTextInputField.d.ts +0 -19
  37. package/dist/commonjs/text-input/lib/hooks/useTextInputField.d.ts.map +0 -1
  38. package/dist/commonjs/text-input/lib/hooks/useTextInputField.js +0 -16
  39. package/dist/commonjs/text-input/lib/hooks/useTextInputHint.d.ts +0 -15
  40. package/dist/commonjs/text-input/lib/hooks/useTextInputHint.d.ts.map +0 -1
  41. package/dist/commonjs/text-input/lib/hooks/useTextInputHint.js +0 -12
  42. package/dist/commonjs/text-input/lib/hooks/useTextInputLabel.d.ts +0 -15
  43. package/dist/commonjs/text-input/lib/hooks/useTextInputLabel.d.ts.map +0 -1
  44. package/dist/commonjs/text-input/lib/hooks/useTextInputLabel.js +0 -12
  45. package/dist/commonjs/text-input/lib/hooks/useTextInputModel.d.ts +0 -17
  46. package/dist/commonjs/text-input/lib/hooks/useTextInputModel.d.ts.map +0 -1
  47. package/dist/commonjs/text-input/lib/hooks/useTextInputModel.js +0 -23
  48. package/dist/es6/text-input/index.d.ts +0 -7
  49. package/dist/es6/text-input/index.d.ts.map +0 -1
  50. package/dist/es6/text-input/index.js +0 -6
  51. package/dist/es6/text-input/lib/TextInput.d.ts +0 -21
  52. package/dist/es6/text-input/lib/TextInput.d.ts.map +0 -1
  53. package/dist/es6/text-input/lib/TextInput.js +0 -31
  54. package/dist/es6/text-input/lib/TextInputField.d.ts +0 -8
  55. package/dist/es6/text-input/lib/TextInputField.d.ts.map +0 -1
  56. package/dist/es6/text-input/lib/TextInputField.js +0 -64
  57. package/dist/es6/text-input/lib/TextInputHint.d.ts +0 -13
  58. package/dist/es6/text-input/lib/TextInputHint.d.ts.map +0 -1
  59. package/dist/es6/text-input/lib/TextInputHint.js +0 -44
  60. package/dist/es6/text-input/lib/TextInputLabel.d.ts +0 -17
  61. package/dist/es6/text-input/lib/TextInputLabel.d.ts.map +0 -1
  62. package/dist/es6/text-input/lib/TextInputLabel.js +0 -52
  63. package/dist/es6/text-input/lib/hooks/useTextInputField.d.ts +0 -19
  64. package/dist/es6/text-input/lib/hooks/useTextInputField.d.ts.map +0 -1
  65. package/dist/es6/text-input/lib/hooks/useTextInputField.js +0 -14
  66. package/dist/es6/text-input/lib/hooks/useTextInputHint.d.ts +0 -15
  67. package/dist/es6/text-input/lib/hooks/useTextInputHint.d.ts.map +0 -1
  68. package/dist/es6/text-input/lib/hooks/useTextInputHint.js +0 -10
  69. package/dist/es6/text-input/lib/hooks/useTextInputLabel.d.ts +0 -15
  70. package/dist/es6/text-input/lib/hooks/useTextInputLabel.d.ts.map +0 -1
  71. package/dist/es6/text-input/lib/hooks/useTextInputLabel.js +0 -10
  72. package/dist/es6/text-input/lib/hooks/useTextInputModel.d.ts +0 -17
  73. package/dist/es6/text-input/lib/hooks/useTextInputModel.d.ts.map +0 -1
  74. package/dist/es6/text-input/lib/hooks/useTextInputModel.js +0 -21
  75. package/text-input/LICENSE +0 -52
  76. package/text-input/README.md +0 -11
  77. package/text-input/index.ts +0 -6
  78. package/text-input/lib/TextInput.tsx +0 -34
  79. package/text-input/lib/TextInputField.tsx +0 -75
  80. package/text-input/lib/TextInputHint.tsx +0 -52
  81. package/text-input/lib/TextInputLabel.tsx +0 -74
  82. package/text-input/lib/hooks/useTextInputField.tsx +0 -15
  83. package/text-input/lib/hooks/useTextInputHint.tsx +0 -11
  84. package/text-input/lib/hooks/useTextInputLabel.tsx +0 -11
  85. package/text-input/lib/hooks/useTextInputModel.tsx +0 -45
  86. package/text-input/package.json +0 -5
  87. package/ts3.5/dist/commonjs/text-input/index.d.ts +0 -7
  88. package/ts3.5/dist/commonjs/text-input/lib/TextInput.d.ts +0 -21
  89. package/ts3.5/dist/commonjs/text-input/lib/TextInputField.d.ts +0 -8
  90. package/ts3.5/dist/commonjs/text-input/lib/TextInputHint.d.ts +0 -13
  91. package/ts3.5/dist/commonjs/text-input/lib/TextInputLabel.d.ts +0 -17
  92. package/ts3.5/dist/commonjs/text-input/lib/hooks/useTextInputField.d.ts +0 -19
  93. package/ts3.5/dist/commonjs/text-input/lib/hooks/useTextInputHint.d.ts +0 -15
  94. package/ts3.5/dist/commonjs/text-input/lib/hooks/useTextInputLabel.d.ts +0 -15
  95. package/ts3.5/dist/commonjs/text-input/lib/hooks/useTextInputModel.d.ts +0 -17
  96. package/ts3.5/dist/es6/text-input/index.d.ts +0 -7
  97. package/ts3.5/dist/es6/text-input/lib/TextInput.d.ts +0 -21
  98. package/ts3.5/dist/es6/text-input/lib/TextInputField.d.ts +0 -8
  99. package/ts3.5/dist/es6/text-input/lib/TextInputHint.d.ts +0 -13
  100. package/ts3.5/dist/es6/text-input/lib/TextInputLabel.d.ts +0 -17
  101. package/ts3.5/dist/es6/text-input/lib/hooks/useTextInputField.d.ts +0 -19
  102. package/ts3.5/dist/es6/text-input/lib/hooks/useTextInputHint.d.ts +0 -15
  103. package/ts3.5/dist/es6/text-input/lib/hooks/useTextInputLabel.d.ts +0 -15
  104. package/ts3.5/dist/es6/text-input/lib/hooks/useTextInputModel.d.ts +0 -17
@@ -1,54 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __rest = (this && this.__rest) || function (s, e) {
14
- var t = {};
15
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
- t[p] = s[p];
17
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
- t[p[i]] = s[p[i]];
21
- }
22
- return t;
23
- };
24
- Object.defineProperty(exports, "__esModule", { value: true });
25
- /** @jsx jsx */
26
- var core_1 = require("@emotion/core");
27
- var common_1 = require("@workday/canvas-kit-react/common");
28
- var common_2 = require("@workday/canvas-kit-labs-react/common");
29
- var tokens_1 = require("@workday/canvas-kit-react/tokens");
30
- var layout_1 = require("@workday/canvas-kit-labs-react/layout");
31
- var TextInput_1 = require("./TextInput");
32
- var useTextInputLabel_1 = require("./hooks/useTextInputLabel");
33
- var styles = {
34
- label: __assign(__assign({}, tokens_1.type.levels.subtext.large), { fontWeight: tokens_1.type.properties.fontWeights.medium, minWidth: '180px' }),
35
- label_visuallyHidden: __assign({}, common_1.accessibleHide),
36
- asterisk: {
37
- fontSize: tokens_1.type.properties.fontSizes[16],
38
- fontWeight: tokens_1.type.properties.fontWeights.regular,
39
- textDecoration: 'unset',
40
- },
41
- };
42
- exports.TextInputLabel = common_1.createComponent('label')({
43
- displayName: 'TextInput.Label',
44
- Component: function (_a, ref) {
45
- var isVisuallyHidden = _a.isVisuallyHidden, model = _a.model, children = _a.children, elemProps = __rest(_a, ["isVisuallyHidden", "model", "children"]);
46
- var localModel = common_1.useModelContext(TextInput_1.TextInputModelContext, model);
47
- var props = useTextInputLabel_1.useTextInputLabel(localModel, elemProps, ref);
48
- var _b = common_2.useThemeRTL(), themeRTL = _b.themeRTL, theme = _b.theme;
49
- return (core_1.jsx(common_2.Box, __assign({ as: "label", css: themeRTL(styles.label, isVisuallyHidden ? styles.label_visuallyHidden : {}) }, props),
50
- core_1.jsx(layout_1.HStack, { spacing: "xxxs" },
51
- core_1.jsx("span", null, children),
52
- localModel.state.isRequired && (core_1.jsx("span", { css: themeRTL(styles.asterisk, { color: theme.canvas.palette.error.main }), "aria-hidden": "true" }, "*")))));
53
- },
54
- });
@@ -1,19 +0,0 @@
1
- /// <reference types="@emotion/core" />
2
- /**
3
- * Adds the necessary props to a `Field` component. Used by the TextInput.Field subcomponent.
4
- */
5
- export declare const useTextInputField: <P extends {}, R>(model: import("@workday/canvas-kit-react/common").Model<{
6
- hasError?: boolean | undefined;
7
- inputId?: string | undefined;
8
- hintId?: string | undefined;
9
- isRequired?: boolean | undefined;
10
- }, {}>, elemProps?: P | undefined, ref?: ((instance: R | null) => void) | import("react").RefObject<R> | null | undefined) => {
11
- type: string;
12
- required: boolean | undefined;
13
- 'aria-invalid': boolean | undefined;
14
- 'aria-describedby': string | undefined;
15
- id: string | undefined;
16
- } & P & (R extends HTMLOrSVGElement ? {
17
- ref: import("react").Ref<R>;
18
- } : {});
19
- //# sourceMappingURL=useTextInputField.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useTextInputField.d.ts","sourceRoot":"","sources":["../../../../../text-input/lib/hooks/useTextInputField.tsx"],"names":[],"mappings":";AAGA;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;OAQ5B,CAAC"}
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var common_1 = require("@workday/canvas-kit-react/common");
4
- /**
5
- * Adds the necessary props to a `Field` component. Used by the TextInput.Field subcomponent.
6
- */
7
- exports.useTextInputField = common_1.createHook(function (_a) {
8
- var state = _a.state;
9
- return {
10
- type: 'text',
11
- required: state.isRequired ? true : undefined,
12
- 'aria-invalid': state.hasError ? true : undefined,
13
- 'aria-describedby': state.hintId,
14
- id: state.inputId,
15
- };
16
- });
@@ -1,15 +0,0 @@
1
- /// <reference types="@emotion/core" />
2
- /**
3
- * Adds the necessary props to a `Hint` component. Used by the TextInput.Hint subcomponent.
4
- */
5
- export declare const useTextInputHint: <P extends {}, R>(model: import("@workday/canvas-kit-react/common").Model<{
6
- hasError?: boolean | undefined;
7
- inputId?: string | undefined;
8
- hintId?: string | undefined;
9
- isRequired?: boolean | undefined;
10
- }, {}>, elemProps?: P | undefined, ref?: ((instance: R | null) => void) | import("react").RefObject<R> | null | undefined) => {
11
- id: string | undefined;
12
- } & P & (R extends HTMLOrSVGElement ? {
13
- ref: import("react").Ref<R>;
14
- } : {});
15
- //# sourceMappingURL=useTextInputHint.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useTextInputHint.d.ts","sourceRoot":"","sources":["../../../../../text-input/lib/hooks/useTextInputHint.tsx"],"names":[],"mappings":";AAGA;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;OAI3B,CAAC"}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var common_1 = require("@workday/canvas-kit-react/common");
4
- /**
5
- * Adds the necessary props to a `Hint` component. Used by the TextInput.Hint subcomponent.
6
- */
7
- exports.useTextInputHint = common_1.createHook(function (_a) {
8
- var state = _a.state;
9
- return {
10
- id: state.hintId,
11
- };
12
- });
@@ -1,15 +0,0 @@
1
- /// <reference types="@emotion/core" />
2
- /**
3
- * Adds the necessary props to a `Label` component. Used by the TextInput.Label subcomponent.
4
- */
5
- export declare const useTextInputLabel: <P extends {}, R>(model: import("@workday/canvas-kit-react/common").Model<{
6
- hasError?: boolean | undefined;
7
- inputId?: string | undefined;
8
- hintId?: string | undefined;
9
- isRequired?: boolean | undefined;
10
- }, {}>, elemProps?: P | undefined, ref?: ((instance: R | null) => void) | import("react").RefObject<R> | null | undefined) => {
11
- htmlFor: string | undefined;
12
- } & P & (R extends HTMLOrSVGElement ? {
13
- ref: import("react").Ref<R>;
14
- } : {});
15
- //# sourceMappingURL=useTextInputLabel.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useTextInputLabel.d.ts","sourceRoot":"","sources":["../../../../../text-input/lib/hooks/useTextInputLabel.tsx"],"names":[],"mappings":";AAGA;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;OAI5B,CAAC"}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var common_1 = require("@workday/canvas-kit-react/common");
4
- /**
5
- * Adds the necessary props to a `Label` component. Used by the TextInput.Label subcomponent.
6
- */
7
- exports.useTextInputLabel = common_1.createHook(function (_a) {
8
- var state = _a.state;
9
- return {
10
- htmlFor: state.inputId,
11
- };
12
- });
@@ -1,17 +0,0 @@
1
- import { Model, ToModelConfig } from '@workday/canvas-kit-react/common';
2
- declare type TextInputState = {
3
- hasError?: boolean;
4
- inputId?: string;
5
- hintId?: string;
6
- isRequired?: boolean;
7
- };
8
- declare type TextInputEvents = {};
9
- export declare type TextInputModel = Model<TextInputState, TextInputEvents>;
10
- declare const textInputEventMap: {
11
- guards: {};
12
- callbacks: {};
13
- };
14
- export declare type TextInputModelConfig = TextInputState & Partial<ToModelConfig<TextInputState, TextInputEvents, typeof textInputEventMap>>;
15
- export declare const useTextInputModel: (config?: TextInputModelConfig) => Model<TextInputState, TextInputEvents>;
16
- export {};
17
- //# sourceMappingURL=useTextInputModel.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useTextInputModel.d.ts","sourceRoot":"","sources":["../../../../../text-input/lib/hooks/useTextInputModel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,EACL,aAAa,EAGd,MAAM,kCAAkC,CAAC;AAE1C,aAAK,cAAc,GAAG;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,aAAK,eAAe,GAAG,EAAE,CAAC;AAE1B,oBAAY,cAAc,GAAG,KAAK,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;AAEpE,QAAA,MAAM,iBAAiB;;;CAGrB,CAAC;AAEH,oBAAY,oBAAoB,GAAG,cAAc,GAC/C,OAAO,CAAC,aAAa,CAAC,cAAc,EAAE,eAAe,EAAE,OAAO,iBAAiB,CAAC,CAAC,CAAC;AAEpF,eAAO,MAAM,iBAAiB,2EAiB7B,CAAC"}
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var common_1 = require("@workday/canvas-kit-react/common");
4
- var textInputEventMap = common_1.createEventMap()({
5
- guards: {},
6
- callbacks: {},
7
- });
8
- exports.useTextInputModel = function (config) {
9
- if (config === void 0) { config = {}; }
10
- var inputId = common_1.useUniqueId(config.inputId);
11
- var hintId = common_1.useUniqueId(config.hintId);
12
- var state = {
13
- hasError: config.hasError,
14
- isRequired: config.isRequired,
15
- inputId: inputId,
16
- hintId: hintId,
17
- };
18
- var events = common_1.useEventMap(textInputEventMap, state, config, {});
19
- return {
20
- state: state,
21
- events: events,
22
- };
23
- };
@@ -1,7 +0,0 @@
1
- export * from './lib/TextInput';
2
- export * from './lib/hooks/useTextInputModel';
3
- export * from './lib/hooks/useTextInputHint';
4
- export * from './lib/hooks/useTextInputField';
5
- export * from './lib/hooks/useTextInputHint';
6
- export * from './lib/hooks/useTextInputLabel';
7
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../text-input/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC"}
@@ -1,6 +0,0 @@
1
- export * from './lib/TextInput';
2
- export * from './lib/hooks/useTextInputModel';
3
- export * from './lib/hooks/useTextInputHint';
4
- export * from './lib/hooks/useTextInputField';
5
- export * from './lib/hooks/useTextInputHint';
6
- export * from './lib/hooks/useTextInputLabel';
@@ -1,21 +0,0 @@
1
- import React from 'react';
2
- import { TextInputModel, TextInputModelConfig } from './hooks/useTextInputModel';
3
- export declare const TextInputModelContext: React.Context<import("@workday/canvas-kit-react/common").Model<{
4
- hasError?: boolean | undefined;
5
- inputId?: string | undefined;
6
- hintId?: string | undefined;
7
- isRequired?: boolean | undefined;
8
- }, {}>>;
9
- export interface TextInputProps extends TextInputModelConfig {
10
- model?: TextInputModel;
11
- /**
12
- * Children of the Text Input. Should contain a `<TextInput.Field>`, a `<TextInput.Label>` and an optional `<TextInput.Hint>`
13
- */
14
- children: React.ReactNode;
15
- }
16
- export declare const TextInput: import("@workday/canvas-kit-react/common").Component<TextInputProps> & {
17
- Field: import("@workday/canvas-kit-react/common").ElementComponent<"input", import("./TextInputField").TextInputFieldProps>;
18
- Label: import("@workday/canvas-kit-react/common").ElementComponent<"label", import("./TextInputLabel").TextInputLabelProps>;
19
- Hint: import("@workday/canvas-kit-react/common").ElementComponent<"p", import("./TextInputHint").TextInputHintProps>;
20
- };
21
- //# sourceMappingURL=TextInput.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../../../text-input/lib/TextInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAoB,cAAc,EAAE,oBAAoB,EAAC,MAAM,2BAA2B,CAAC;AAKlG,eAAO,MAAM,qBAAqB;;;;;OAAiD,CAAC;AAEpF,MAAM,WAAW,cAAe,SAAQ,oBAAoB;IAC1D,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,SAAS;;;;CAcpB,CAAC"}
@@ -1,31 +0,0 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
- import React from 'react';
13
- import { createComponent, useDefaultModel } from '@workday/canvas-kit-react/common';
14
- import { useTextInputModel } from './hooks/useTextInputModel';
15
- import { TextInputField } from './TextInputField';
16
- import { TextInputLabel } from './TextInputLabel';
17
- import { TextInputHint } from './TextInputHint';
18
- export var TextInputModelContext = React.createContext({});
19
- export var TextInput = createComponent()({
20
- displayName: 'TextInput',
21
- Component: function (_a) {
22
- var children = _a.children, model = _a.model, config = __rest(_a, ["children", "model"]);
23
- var value = useDefaultModel(model, config, useTextInputModel);
24
- return (React.createElement(TextInputModelContext.Provider, { value: value }, children));
25
- },
26
- subComponents: {
27
- Field: TextInputField,
28
- Label: TextInputLabel,
29
- Hint: TextInputHint,
30
- },
31
- });
@@ -1,8 +0,0 @@
1
- import { ExtractProps } from '@workday/canvas-kit-react/common';
2
- import { Box } from '@workday/canvas-kit-labs-react/common';
3
- import { TextInputModel } from './hooks/useTextInputModel';
4
- export interface TextInputFieldProps extends ExtractProps<typeof Box, never> {
5
- model?: TextInputModel;
6
- }
7
- export declare const TextInputField: import("@workday/canvas-kit-react/common").ElementComponent<"input", TextInputFieldProps>;
8
- //# sourceMappingURL=TextInputField.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TextInputField.d.ts","sourceRoot":"","sources":["../../../../text-input/lib/TextInputField.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAkB,YAAY,EAAkB,MAAM,kCAAkC,CAAC;AAChG,OAAO,EAAC,GAAG,EAA6B,MAAM,uCAAuC,CAAC;AAGtF,OAAO,EAAC,cAAc,EAAC,MAAM,2BAA2B,CAAC;AAGzD,MAAM,WAAW,mBAAoB,SAAQ,YAAY,CAAC,OAAO,GAAG,EAAE,KAAK,CAAC;IAC1E,KAAK,CAAC,EAAE,cAAc,CAAC;CACxB;AAmCD,eAAO,MAAM,cAAc,2FAoBzB,CAAC"}
@@ -1,64 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- var __rest = (this && this.__rest) || function (s, e) {
13
- var t = {};
14
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
- t[p] = s[p];
16
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
- t[p[i]] = s[p[i]];
20
- }
21
- return t;
22
- };
23
- /** @jsx jsx */
24
- import { jsx } from '@emotion/core';
25
- import { borderRadius, inputColors, space, type, } from '@workday/canvas-kit-react/tokens';
26
- import { createComponent, useModelContext } from '@workday/canvas-kit-react/common';
27
- import { Box, useThemedRing, useThemeRTL } from '@workday/canvas-kit-labs-react/common';
28
- import { TextInputModelContext } from './TextInput';
29
- import { useTextInputField } from './hooks/useTextInputField';
30
- var baseStyles = __assign(__assign({}, type.levels.subtext.large), { padding: space.xxs, margin: 0, minWidth: '280px', border: "1px solid " + inputColors.border, backgroundColor: inputColors.background, borderRadius: borderRadius.m, display: 'block', height: '40px', transition: '0.2s box-shadow, 0.2s border-color', '&::placeholder': {
31
- color: inputColors.placeholder,
32
- }, '&:hover': {
33
- borderColor: inputColors.hoverBorder,
34
- }, '&:focus:not([disabled])': {
35
- outline: 'none',
36
- }, '&:disabled': {
37
- backgroundColor: inputColors.disabled.background,
38
- borderColor: inputColors.disabled.border,
39
- color: inputColors.disabled.text,
40
- '&::placeholder': {
41
- color: inputColors.disabled.text,
42
- },
43
- }, '::-ms-clear': {
44
- display: 'none',
45
- } });
46
- export var TextInputField = createComponent('input')({
47
- displayName: 'TextInput.Field',
48
- Component: function (_a, ref) {
49
- var model = _a.model, elemProps = __rest(_a, ["model"]);
50
- var localModel = useModelContext(TextInputModelContext, model);
51
- var props = useTextInputField(localModel, elemProps, ref);
52
- var _b = useThemeRTL(), themeRTL = _b.themeRTL, theme = _b.theme;
53
- var errorRing = useThemedRing('error');
54
- var focusStyles = localModel.state.hasError
55
- ? errorRing
56
- : themeRTL({
57
- '&:focus:not([disabled])': {
58
- borderColor: theme.canvas.palette.common.focusOutline,
59
- boxShadow: "inset 0 0 0 1px " + theme.canvas.palette.common.focusOutline,
60
- },
61
- });
62
- return jsx(Box, __assign({ as: "input", css: [themeRTL(baseStyles), focusStyles] }, props));
63
- },
64
- });
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- import { ExtractProps } from '@workday/canvas-kit-react/common';
3
- import { Box } from '@workday/canvas-kit-labs-react/common';
4
- import { TextInputModel } from './hooks/useTextInputModel';
5
- export interface TextInputHintProps extends ExtractProps<typeof Box, never> {
6
- model?: TextInputModel;
7
- /**
8
- * Hint text to show to the user regarding the Error/Alert
9
- */
10
- children?: React.ReactNode;
11
- }
12
- export declare const TextInputHint: import("@workday/canvas-kit-react/common").ElementComponent<"p", TextInputHintProps>;
13
- //# sourceMappingURL=TextInputHint.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TextInputHint.d.ts","sourceRoot":"","sources":["../../../../text-input/lib/TextInputHint.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAkB,YAAY,EAAkB,MAAM,kCAAkC,CAAC;AAEhG,OAAO,EAAC,GAAG,EAAc,MAAM,uCAAuC,CAAC;AAGvE,OAAO,EAAC,cAAc,EAAC,MAAM,2BAA2B,CAAC;AAGzD,MAAM,WAAW,kBAAmB,SAAQ,YAAY,CAAC,OAAO,GAAG,EAAE,KAAK,CAAC;IACzE,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAQD,eAAO,MAAM,aAAa,sFAyBxB,CAAC"}
@@ -1,44 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- var __rest = (this && this.__rest) || function (s, e) {
13
- var t = {};
14
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
- t[p] = s[p];
16
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
- t[p[i]] = s[p[i]];
20
- }
21
- return t;
22
- };
23
- /** @jsx jsx */
24
- import { jsx } from '@emotion/core';
25
- import { createComponent, useModelContext } from '@workday/canvas-kit-react/common';
26
- import { space, type } from '@workday/canvas-kit-react/tokens';
27
- import { Box, useThemeRTL } from '@workday/canvas-kit-labs-react/common';
28
- import { TextInputModelContext } from './TextInput';
29
- import { useTextInputHint } from './hooks/useTextInputHint';
30
- var baseStyles = __assign(__assign({}, type.levels.subtext.medium), { margin: space.xxs + " 0 0", width: '100%' });
31
- export var TextInputHint = createComponent('p')({
32
- displayName: 'TextInput.Hint',
33
- Component: function (_a, ref, Element) {
34
- var model = _a.model, children = _a.children, elemProps = __rest(_a, ["model", "children"]);
35
- var localModel = useModelContext(TextInputModelContext, model);
36
- var props = useTextInputHint(localModel, elemProps, ref);
37
- var _b = useThemeRTL(), themeRTL = _b.themeRTL, theme = _b.theme;
38
- if (!children) {
39
- // If there is no hint text just skip rendering
40
- return null;
41
- }
42
- return (jsx(Box, __assign({ as: Element, css: themeRTL(baseStyles, localModel.state.hasError ? { color: theme.canvas.palette.error.main } : {}) }, props), children));
43
- },
44
- });
@@ -1,17 +0,0 @@
1
- import React from 'react';
2
- import { ExtractProps } from '@workday/canvas-kit-react/common';
3
- import { Box } from '@workday/canvas-kit-labs-react/common';
4
- import { TextInputModel } from './hooks/useTextInputModel';
5
- export interface TextInputLabelProps extends ExtractProps<typeof Box, never> {
6
- model?: TextInputModel;
7
- /**
8
- * If true, apply the `accessibleHide` styles to the Label.
9
- */
10
- isVisuallyHidden?: boolean;
11
- /**
12
- * The text of the label.
13
- */
14
- children: React.ReactNode;
15
- }
16
- export declare const TextInputLabel: import("@workday/canvas-kit-react/common").ElementComponent<"label", TextInputLabelProps>;
17
- //# sourceMappingURL=TextInputLabel.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TextInputLabel.d.ts","sourceRoot":"","sources":["../../../../text-input/lib/TextInputLabel.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAGL,YAAY,EAEb,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAC,GAAG,EAA+B,MAAM,uCAAuC,CAAC;AAKxF,OAAO,EAAC,cAAc,EAAC,MAAM,2BAA2B,CAAC;AAGzD,MAAM,WAAW,mBAAoB,SAAQ,YAAY,CAAC,OAAO,GAAG,EAAE,KAAK,CAAC;IAC1E,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAkBD,eAAO,MAAM,cAAc,2FA2BzB,CAAC"}
@@ -1,52 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- var __rest = (this && this.__rest) || function (s, e) {
13
- var t = {};
14
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
- t[p] = s[p];
16
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
- t[p[i]] = s[p[i]];
20
- }
21
- return t;
22
- };
23
- /** @jsx jsx */
24
- import { jsx } from '@emotion/core';
25
- import { accessibleHide, createComponent, useModelContext, } from '@workday/canvas-kit-react/common';
26
- import { Box, useThemeRTL } from '@workday/canvas-kit-labs-react/common';
27
- import { type } from '@workday/canvas-kit-react/tokens';
28
- import { HStack } from '@workday/canvas-kit-labs-react/layout';
29
- import { TextInputModelContext } from './TextInput';
30
- import { useTextInputLabel } from './hooks/useTextInputLabel';
31
- var styles = {
32
- label: __assign(__assign({}, type.levels.subtext.large), { fontWeight: type.properties.fontWeights.medium, minWidth: '180px' }),
33
- label_visuallyHidden: __assign({}, accessibleHide),
34
- asterisk: {
35
- fontSize: type.properties.fontSizes[16],
36
- fontWeight: type.properties.fontWeights.regular,
37
- textDecoration: 'unset',
38
- },
39
- };
40
- export var TextInputLabel = createComponent('label')({
41
- displayName: 'TextInput.Label',
42
- Component: function (_a, ref) {
43
- var isVisuallyHidden = _a.isVisuallyHidden, model = _a.model, children = _a.children, elemProps = __rest(_a, ["isVisuallyHidden", "model", "children"]);
44
- var localModel = useModelContext(TextInputModelContext, model);
45
- var props = useTextInputLabel(localModel, elemProps, ref);
46
- var _b = useThemeRTL(), themeRTL = _b.themeRTL, theme = _b.theme;
47
- return (jsx(Box, __assign({ as: "label", css: themeRTL(styles.label, isVisuallyHidden ? styles.label_visuallyHidden : {}) }, props),
48
- jsx(HStack, { spacing: "xxxs" },
49
- jsx("span", null, children),
50
- localModel.state.isRequired && (jsx("span", { css: themeRTL(styles.asterisk, { color: theme.canvas.palette.error.main }), "aria-hidden": "true" }, "*")))));
51
- },
52
- });
@@ -1,19 +0,0 @@
1
- /// <reference types="@emotion/core" />
2
- /**
3
- * Adds the necessary props to a `Field` component. Used by the TextInput.Field subcomponent.
4
- */
5
- export declare const useTextInputField: <P extends {}, R>(model: import("@workday/canvas-kit-react/common").Model<{
6
- hasError?: boolean | undefined;
7
- inputId?: string | undefined;
8
- hintId?: string | undefined;
9
- isRequired?: boolean | undefined;
10
- }, {}>, elemProps?: P | undefined, ref?: ((instance: R | null) => void) | import("react").RefObject<R> | null | undefined) => {
11
- type: string;
12
- required: boolean | undefined;
13
- 'aria-invalid': boolean | undefined;
14
- 'aria-describedby': string | undefined;
15
- id: string | undefined;
16
- } & P & (R extends HTMLOrSVGElement ? {
17
- ref: import("react").Ref<R>;
18
- } : {});
19
- //# sourceMappingURL=useTextInputField.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useTextInputField.d.ts","sourceRoot":"","sources":["../../../../../text-input/lib/hooks/useTextInputField.tsx"],"names":[],"mappings":";AAGA;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;OAQ5B,CAAC"}
@@ -1,14 +0,0 @@
1
- import { createHook } from '@workday/canvas-kit-react/common';
2
- /**
3
- * Adds the necessary props to a `Field` component. Used by the TextInput.Field subcomponent.
4
- */
5
- export var useTextInputField = createHook(function (_a) {
6
- var state = _a.state;
7
- return {
8
- type: 'text',
9
- required: state.isRequired ? true : undefined,
10
- 'aria-invalid': state.hasError ? true : undefined,
11
- 'aria-describedby': state.hintId,
12
- id: state.inputId,
13
- };
14
- });
@@ -1,15 +0,0 @@
1
- /// <reference types="@emotion/core" />
2
- /**
3
- * Adds the necessary props to a `Hint` component. Used by the TextInput.Hint subcomponent.
4
- */
5
- export declare const useTextInputHint: <P extends {}, R>(model: import("@workday/canvas-kit-react/common").Model<{
6
- hasError?: boolean | undefined;
7
- inputId?: string | undefined;
8
- hintId?: string | undefined;
9
- isRequired?: boolean | undefined;
10
- }, {}>, elemProps?: P | undefined, ref?: ((instance: R | null) => void) | import("react").RefObject<R> | null | undefined) => {
11
- id: string | undefined;
12
- } & P & (R extends HTMLOrSVGElement ? {
13
- ref: import("react").Ref<R>;
14
- } : {});
15
- //# sourceMappingURL=useTextInputHint.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useTextInputHint.d.ts","sourceRoot":"","sources":["../../../../../text-input/lib/hooks/useTextInputHint.tsx"],"names":[],"mappings":";AAGA;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;OAI3B,CAAC"}
@@ -1,10 +0,0 @@
1
- import { createHook } from '@workday/canvas-kit-react/common';
2
- /**
3
- * Adds the necessary props to a `Hint` component. Used by the TextInput.Hint subcomponent.
4
- */
5
- export var useTextInputHint = createHook(function (_a) {
6
- var state = _a.state;
7
- return {
8
- id: state.hintId,
9
- };
10
- });
@@ -1,15 +0,0 @@
1
- /// <reference types="@emotion/core" />
2
- /**
3
- * Adds the necessary props to a `Label` component. Used by the TextInput.Label subcomponent.
4
- */
5
- export declare const useTextInputLabel: <P extends {}, R>(model: import("@workday/canvas-kit-react/common").Model<{
6
- hasError?: boolean | undefined;
7
- inputId?: string | undefined;
8
- hintId?: string | undefined;
9
- isRequired?: boolean | undefined;
10
- }, {}>, elemProps?: P | undefined, ref?: ((instance: R | null) => void) | import("react").RefObject<R> | null | undefined) => {
11
- htmlFor: string | undefined;
12
- } & P & (R extends HTMLOrSVGElement ? {
13
- ref: import("react").Ref<R>;
14
- } : {});
15
- //# sourceMappingURL=useTextInputLabel.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useTextInputLabel.d.ts","sourceRoot":"","sources":["../../../../../text-input/lib/hooks/useTextInputLabel.tsx"],"names":[],"mappings":";AAGA;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;OAI5B,CAAC"}
@@ -1,10 +0,0 @@
1
- import { createHook } from '@workday/canvas-kit-react/common';
2
- /**
3
- * Adds the necessary props to a `Label` component. Used by the TextInput.Label subcomponent.
4
- */
5
- export var useTextInputLabel = createHook(function (_a) {
6
- var state = _a.state;
7
- return {
8
- htmlFor: state.inputId,
9
- };
10
- });
@@ -1,17 +0,0 @@
1
- import { Model, ToModelConfig } from '@workday/canvas-kit-react/common';
2
- declare type TextInputState = {
3
- hasError?: boolean;
4
- inputId?: string;
5
- hintId?: string;
6
- isRequired?: boolean;
7
- };
8
- declare type TextInputEvents = {};
9
- export declare type TextInputModel = Model<TextInputState, TextInputEvents>;
10
- declare const textInputEventMap: {
11
- guards: {};
12
- callbacks: {};
13
- };
14
- export declare type TextInputModelConfig = TextInputState & Partial<ToModelConfig<TextInputState, TextInputEvents, typeof textInputEventMap>>;
15
- export declare const useTextInputModel: (config?: TextInputModelConfig) => Model<TextInputState, TextInputEvents>;
16
- export {};
17
- //# sourceMappingURL=useTextInputModel.d.ts.map