@pingux/astro 2.220.0 → 2.221.0-alpha.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/lib/cjs/components/AIComponents/PromptInput/PromptInput.js +4 -1
- package/lib/cjs/components/FileInputField/FileInputField.d.ts +8 -0
- package/lib/cjs/components/FileInputField/FileInputField.js +19 -77
- package/lib/cjs/components/FileInputField/FileInputField.stories.js +7 -10
- package/lib/cjs/components/FileInputField/FileInputField.styles.d.ts +47 -0
- package/lib/cjs/components/FileInputField/FileInputField.test.js +3 -2
- package/lib/cjs/components/FileInputField/FileItem.d.ts +4 -0
- package/lib/cjs/components/FileInputField/FileItem.js +8 -16
- package/lib/cjs/components/FileInputField/FileSelect.d.ts +4 -0
- package/lib/cjs/components/FileInputField/FileSelect.js +1 -18
- package/lib/cjs/components/FileInputField/index.d.ts +1 -0
- package/lib/cjs/components/PhoneNumberField/PhoneNumberField.js +17 -7
- package/lib/cjs/components/PhoneNumberField/PhoneNumberField.test.js +111 -0
- package/lib/cjs/styles/themes/next-gen/next-gen.d.ts +5 -1
- package/lib/cjs/styles/themes/next-gen/variants/variants.d.ts +5 -1
- package/lib/cjs/styles/themes/next-gen/variants/variants.js +5 -1
- package/lib/cjs/types/fileInputField.d.ts +106 -0
- package/lib/cjs/types/fileInputField.js +6 -0
- package/lib/cjs/types/index.d.ts +1 -0
- package/lib/cjs/types/index.js +60 -49
- package/lib/cjs/types/input.d.ts +4 -3
- package/lib/components/AIComponents/PromptInput/PromptInput.js +4 -1
- package/lib/components/FileInputField/FileInputField.js +20 -78
- package/lib/components/FileInputField/FileInputField.stories.js +7 -10
- package/lib/components/FileInputField/FileInputField.test.js +3 -2
- package/lib/components/FileInputField/FileItem.js +8 -16
- package/lib/components/FileInputField/FileSelect.js +2 -20
- package/lib/components/PhoneNumberField/PhoneNumberField.js +17 -7
- package/lib/components/PhoneNumberField/PhoneNumberField.test.js +112 -1
- package/lib/styles/themes/next-gen/variants/variants.js +5 -1
- package/lib/types/fileInputField.js +1 -0
- package/lib/types/index.js +1 -0
- package/package.json +2 -2
|
@@ -1,13 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _typeof = require("@babel/runtime-corejs3/helpers/typeof");
|
|
4
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
5
|
+
var _Symbol = require("@babel/runtime-corejs3/core-js-stable/symbol");
|
|
6
|
+
var _Object$create = require("@babel/runtime-corejs3/core-js-stable/object/create");
|
|
7
|
+
var _bindInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/bind");
|
|
8
|
+
var _Object$getPrototypeOf = require("@babel/runtime-corejs3/core-js-stable/object/get-prototype-of");
|
|
9
|
+
var _Object$setPrototypeOf = require("@babel/runtime-corejs3/core-js-stable/object/set-prototype-of");
|
|
10
|
+
var _Symbol$asyncIterator = require("@babel/runtime-corejs3/core-js-stable/symbol/async-iterator");
|
|
11
|
+
var _Promise = require("@babel/runtime-corejs3/core-js-stable/promise");
|
|
12
|
+
var _Symbol$iterator = require("@babel/runtime-corejs3/core-js-stable/symbol/iterator");
|
|
13
|
+
var _reverseInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/reverse");
|
|
3
14
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
15
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncToGenerator"));
|
|
4
16
|
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
|
5
17
|
var _react = _interopRequireDefault(require("react"));
|
|
6
18
|
var _react2 = require("@testing-library/react");
|
|
19
|
+
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
|
7
20
|
var _universalComponentTest = require("../../utils/testUtils/universalComponentTest");
|
|
8
21
|
var _universalFormSubmitTest = require("../../utils/testUtils/universalFormSubmitTest");
|
|
9
22
|
var _ = _interopRequireDefault(require("."));
|
|
10
23
|
var _react3 = require("@emotion/react");
|
|
24
|
+
function _regeneratorRuntime() { "use strict"; var r = _regenerator(), e = r.m(_regeneratorRuntime), t = (_Object$getPrototypeOf ? _Object$getPrototypeOf(e) : e.__proto__).constructor; function n(r) { var e = "function" == typeof r && r.constructor; return !!e && (e === t || "GeneratorFunction" === (e.displayName || e.name)); } var o = { "throw": 1, "return": 2, "break": 3, "continue": 3 }; function a(r) { var e, t; return function (n) { e || (e = { stop: function stop() { return t(n.a, 2); }, "catch": function _catch() { return n.v; }, abrupt: function abrupt(r, e) { return t(n.a, o[r], e); }, delegateYield: function delegateYield(r, o, a) { return e.resultName = o, t(n.d, _regeneratorValues(r), a); }, finish: function finish(r) { return t(n.f, r); } }, t = function t(r, _t, o) { n.p = e.prev, n.n = e.next; try { return r(_t, o); } finally { e.next = n.n; } }), e.resultName && (e[e.resultName] = n.v, e.resultName = void 0), e.sent = n.v, e.next = n.n; try { return r.call(this, e); } finally { n.p = e.prev, n.n = e.next; } }; } return (_regeneratorRuntime = function _regeneratorRuntime() { return { wrap: function wrap(e, t, n, o) { return r.w(a(e), t, n, o && _reverseInstanceProperty(o).call(o)); }, isGeneratorFunction: n, mark: r.m, awrap: function awrap(r, e) { return new _OverloadYield(r, e); }, AsyncIterator: _regeneratorAsyncIterator, async: function async(r, e, t, o, u) { return (n(e) ? _regeneratorAsyncGen : _regeneratorAsync)(a(r), e, t, o, u); }, keys: _regeneratorKeys, values: _regeneratorValues }; })(); }
|
|
25
|
+
function _regeneratorValues(e) { if (null != e) { var t = e["function" == typeof _Symbol && _Symbol$iterator || "@@iterator"], r = 0; if (t) return t.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) return { next: function next() { return e && r >= e.length && (e = void 0), { value: e && e[r++], done: !e }; } }; } throw new TypeError(_typeof(e) + " is not iterable"); }
|
|
26
|
+
function _regeneratorKeys(e) { var n = Object(e), r = []; for (var t in n) r.unshift(t); return function e() { for (; r.length;) if ((t = r.pop()) in n) return e.value = t, e.done = !1, e; return e.done = !0, e; }; }
|
|
27
|
+
function _regeneratorAsync(n, e, r, t, o) { var a = _regeneratorAsyncGen(n, e, r, t, o); return a.next().then(function (n) { return n.done ? n.value : a.next(); }); }
|
|
28
|
+
function _regeneratorAsyncGen(r, e, t, o, n) { return new _regeneratorAsyncIterator(_regenerator().w(r, e, t, o), n || _Promise); }
|
|
29
|
+
function _regeneratorAsyncIterator(t, e) { function n(r, o, i, f) { try { var c = t[r](o), u = c.value; return u instanceof _OverloadYield ? e.resolve(u.v).then(function (t) { n("next", t, i, f); }, function (t) { n("throw", t, i, f); }) : e.resolve(u).then(function (t) { c.value = t, i(c); }, function (t) { return n("throw", t, i, f); }); } catch (t) { f(t); } } var r; this.next || (_regeneratorDefine2(_regeneratorAsyncIterator.prototype), _regeneratorDefine2(_regeneratorAsyncIterator.prototype, "function" == typeof _Symbol && _Symbol$asyncIterator || "@asyncIterator", function () { return this; })), _regeneratorDefine2(this, "_invoke", function (t, o, i) { function f() { return new e(function (e, r) { n(t, i, e, r); }); } return r = r ? r.then(f, f) : f(); }, !0); }
|
|
30
|
+
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof _Symbol ? _Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = _Object$create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: _bindInstanceProperty(d).call(d, e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = _Object$getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = _Object$create(c); function f(e) { return _Object$setPrototypeOf ? _Object$setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = _Object$create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
31
|
+
function _regeneratorDefine2(e, r, n, t) { var i = _Object$defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
32
|
+
function _OverloadYield(e, d) { this.v = e, this.k = d; }
|
|
11
33
|
var testId = 'test-phone-number-field';
|
|
12
34
|
var testLabel = 'Test Label';
|
|
13
35
|
var defaultProps = {
|
|
@@ -41,6 +63,95 @@ test('default render has label, phone input, and country combobox', function ()
|
|
|
41
63
|
expect(_react2.screen.getByRole('textbox')).toBeInTheDocument();
|
|
42
64
|
expect(_react2.screen.getByRole('combobox')).toBeInTheDocument();
|
|
43
65
|
});
|
|
66
|
+
test('telephone input receives focus after tabbing from country picker', /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
67
|
+
var countryPicker, phoneInput;
|
|
68
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
69
|
+
while (1) switch (_context.prev = _context.next) {
|
|
70
|
+
case 0:
|
|
71
|
+
getComponent();
|
|
72
|
+
countryPicker = _react2.screen.getByRole('combobox', {
|
|
73
|
+
name: 'Country Picker'
|
|
74
|
+
});
|
|
75
|
+
phoneInput = _react2.screen.getByRole('textbox');
|
|
76
|
+
_context.next = 5;
|
|
77
|
+
return _userEvent["default"].tab();
|
|
78
|
+
case 5:
|
|
79
|
+
expect(countryPicker).toHaveFocus();
|
|
80
|
+
_context.next = 8;
|
|
81
|
+
return _userEvent["default"].tab();
|
|
82
|
+
case 8:
|
|
83
|
+
expect(phoneInput).toHaveFocus();
|
|
84
|
+
expect(phoneInput).toHaveClass('is-focused');
|
|
85
|
+
case 10:
|
|
86
|
+
case "end":
|
|
87
|
+
return _context.stop();
|
|
88
|
+
}
|
|
89
|
+
}, _callee);
|
|
90
|
+
})));
|
|
91
|
+
test('narrow country picker stays accessible and locally constrained when opened', /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
92
|
+
var narrowAvailableWidth, offsetWidthSpy, clientWidthSpy, clientHeightSpy, _listbox$parentElemen, countryPicker, listbox, options, popover, scrollBox;
|
|
93
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
94
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
95
|
+
case 0:
|
|
96
|
+
narrowAvailableWidth = 480;
|
|
97
|
+
offsetWidthSpy = jest.spyOn(window.HTMLElement.prototype, 'offsetWidth', 'get').mockImplementation(function getOffsetWidth() {
|
|
98
|
+
return this.querySelector('input') ? narrowAvailableWidth : 0;
|
|
99
|
+
});
|
|
100
|
+
clientWidthSpy = jest.spyOn(window.HTMLElement.prototype, 'clientWidth', 'get').mockReturnValue(narrowAvailableWidth);
|
|
101
|
+
clientHeightSpy = jest.spyOn(window.HTMLElement.prototype, 'clientHeight', 'get').mockReturnValue(1000);
|
|
102
|
+
_context2.prev = 4;
|
|
103
|
+
getComponent({
|
|
104
|
+
sx: {
|
|
105
|
+
width: "".concat(narrowAvailableWidth, "px")
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
countryPicker = _react2.screen.getByRole('combobox', {
|
|
109
|
+
name: 'Country Picker'
|
|
110
|
+
});
|
|
111
|
+
_context2.next = 9;
|
|
112
|
+
return _userEvent["default"].click(countryPicker);
|
|
113
|
+
case 9:
|
|
114
|
+
_context2.next = 11;
|
|
115
|
+
return _react2.screen.findByRole('listbox');
|
|
116
|
+
case 11:
|
|
117
|
+
listbox = _context2.sent;
|
|
118
|
+
options = (0, _react2.within)(listbox).getAllByRole('option', {
|
|
119
|
+
hidden: true
|
|
120
|
+
});
|
|
121
|
+
popover = listbox.closest('[role="presentation"]');
|
|
122
|
+
scrollBox = (_listbox$parentElemen = listbox.parentElement) === null || _listbox$parentElemen === void 0 ? void 0 : _listbox$parentElemen.parentElement;
|
|
123
|
+
expect(countryPicker).toHaveAttribute('aria-expanded', 'true');
|
|
124
|
+
expect(options.length).toBeGreaterThan(0);
|
|
125
|
+
expect(popover).toHaveStyle({
|
|
126
|
+
width: "".concat(narrowAvailableWidth, "px")
|
|
127
|
+
});
|
|
128
|
+
expect(popover).not.toHaveStyle({
|
|
129
|
+
'min-width': '280px'
|
|
130
|
+
});
|
|
131
|
+
expect(scrollBox).toHaveStyle({
|
|
132
|
+
'min-width': '0'
|
|
133
|
+
});
|
|
134
|
+
expect(scrollBox).toHaveStyleRule('width', '100%', {
|
|
135
|
+
media: 'screen and (max-width: 500px)'
|
|
136
|
+
});
|
|
137
|
+
expect(scrollBox).toHaveStyleRule('max-width', '100%', {
|
|
138
|
+
media: 'screen and (max-width: 500px)'
|
|
139
|
+
});
|
|
140
|
+
expect(scrollBox).toHaveStyleRule('overflow-x', 'hidden', {
|
|
141
|
+
media: 'screen and (max-width: 500px)'
|
|
142
|
+
});
|
|
143
|
+
case 23:
|
|
144
|
+
_context2.prev = 23;
|
|
145
|
+
offsetWidthSpy.mockRestore();
|
|
146
|
+
clientWidthSpy.mockRestore();
|
|
147
|
+
clientHeightSpy.mockRestore();
|
|
148
|
+
return _context2.finish(23);
|
|
149
|
+
case 28:
|
|
150
|
+
case "end":
|
|
151
|
+
return _context2.stop();
|
|
152
|
+
}
|
|
153
|
+
}, _callee2, null, [[4,, 23, 28]]);
|
|
154
|
+
})));
|
|
44
155
|
test('typing a non-numeric character does not update phone input value', function () {
|
|
45
156
|
getComponent();
|
|
46
157
|
var phoneInput = _react2.screen.getByRole('textbox');
|
|
@@ -6660,7 +6660,11 @@ declare const _default: {
|
|
|
6660
6660
|
thumbSwitch: {
|
|
6661
6661
|
textTransform: string;
|
|
6662
6662
|
backgroundColor: string;
|
|
6663
|
-
|
|
6663
|
+
px: string;
|
|
6664
|
+
py: string;
|
|
6665
|
+
fontSize: string;
|
|
6666
|
+
fontWeight: number;
|
|
6667
|
+
lineHeight: string;
|
|
6664
6668
|
height: string;
|
|
6665
6669
|
color: string;
|
|
6666
6670
|
border: string;
|
|
@@ -1702,7 +1702,11 @@ declare const _default: {
|
|
|
1702
1702
|
thumbSwitch: {
|
|
1703
1703
|
textTransform: string;
|
|
1704
1704
|
backgroundColor: string;
|
|
1705
|
-
|
|
1705
|
+
px: string;
|
|
1706
|
+
py: string;
|
|
1707
|
+
fontSize: string;
|
|
1708
|
+
fontWeight: number;
|
|
1709
|
+
lineHeight: string;
|
|
1706
1710
|
height: string;
|
|
1707
1711
|
color: string;
|
|
1708
1712
|
border: string;
|
|
@@ -320,7 +320,11 @@ var rockerButton = {
|
|
|
320
320
|
thumbSwitch: {
|
|
321
321
|
textTransform: 'none',
|
|
322
322
|
backgroundColor: 'backgroundBase',
|
|
323
|
-
|
|
323
|
+
px: '20px',
|
|
324
|
+
py: '12px',
|
|
325
|
+
fontSize: 'md',
|
|
326
|
+
fontWeight: 0,
|
|
327
|
+
lineHeight: 'body',
|
|
324
328
|
height: '50px',
|
|
325
329
|
color: 'active',
|
|
326
330
|
border: '1px solid',
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ContainerProps, ControlProps } from '../hooks/useField/useField';
|
|
3
|
+
import { BoxProps } from './box';
|
|
4
|
+
import { ButtonProps } from './button';
|
|
5
|
+
import { HelpHintProps } from './helpHint';
|
|
6
|
+
import { IconProps } from './icon';
|
|
7
|
+
import { Status } from './item';
|
|
8
|
+
import { LabelProps } from './label';
|
|
9
|
+
import { DOMAttributes, StyleProps } from './shared';
|
|
10
|
+
import { TextProps } from './text';
|
|
11
|
+
export interface FileListItem {
|
|
12
|
+
/** The File object from the browser File API. */
|
|
13
|
+
fileObj?: object;
|
|
14
|
+
/** Unique identifier for the file (required). */
|
|
15
|
+
id: string;
|
|
16
|
+
/** Display name for the file (required). */
|
|
17
|
+
name: string;
|
|
18
|
+
/** URL to download the file. */
|
|
19
|
+
downloadLink?: string;
|
|
20
|
+
/** Status of the file upload. */
|
|
21
|
+
status?: Status;
|
|
22
|
+
}
|
|
23
|
+
export interface FileInputFieldProps extends StyleProps, DOMAttributes {
|
|
24
|
+
/** Props object that is spread directly into the select button element. */
|
|
25
|
+
buttonProps?: ButtonProps;
|
|
26
|
+
/** Default button text that will be changed to the file name once a file is uploaded. */
|
|
27
|
+
defaultButtonText?: string;
|
|
28
|
+
/** Default array of objects for uploaded files (uncontrolled). */
|
|
29
|
+
defaultFileList?: FileListItem[];
|
|
30
|
+
/** Array of accepted file type extensions or MIME type strings. */
|
|
31
|
+
fileTypes?: string[];
|
|
32
|
+
/** Array of objects for uploaded files (controlled). */
|
|
33
|
+
fileList?: FileListItem[];
|
|
34
|
+
/** Text rendered below the input. */
|
|
35
|
+
helperText?: string | React.ReactNode;
|
|
36
|
+
/** Props object that is spread directly into the helphint element. */
|
|
37
|
+
helpHintProps?: HelpHintProps;
|
|
38
|
+
/** Props object that is spread directly into the icon container element. */
|
|
39
|
+
iconContainerProps?: BoxProps;
|
|
40
|
+
/** Props object that is spread directly into the icon element. */
|
|
41
|
+
iconProps?: IconProps;
|
|
42
|
+
/** Whether the field is disabled. */
|
|
43
|
+
isDisabled?: boolean;
|
|
44
|
+
/** Whether to render the select trigger as an icon button. */
|
|
45
|
+
isIconButton?: boolean;
|
|
46
|
+
/** Determines whether the loading indicator is shown. */
|
|
47
|
+
isLoading?: boolean;
|
|
48
|
+
/** Defines whether the input can accept multiple files. */
|
|
49
|
+
isMultiple?: boolean;
|
|
50
|
+
/** The rendered label for the field. */
|
|
51
|
+
label?: React.ReactNode;
|
|
52
|
+
/** Handler called when files are selected or dropped.
|
|
53
|
+
*
|
|
54
|
+
* `(event: React.ChangeEvent<HTMLInputElement> | React.DragEvent, files: FileList
|
|
55
|
+
* | File[]) => void`
|
|
56
|
+
*/
|
|
57
|
+
onFileSelect?: (event: React.ChangeEvent<HTMLInputElement> | React.DragEvent, files: FileList | File[]) => void;
|
|
58
|
+
/** Handler called when an uploaded file is removed.
|
|
59
|
+
*
|
|
60
|
+
* `(e: React.SyntheticEvent, fileId: string) => void`
|
|
61
|
+
*/
|
|
62
|
+
onRemove?: (e: React.SyntheticEvent, fileId: string) => void;
|
|
63
|
+
/** Determines the field status indicator and helper text styling. */
|
|
64
|
+
status?: Status;
|
|
65
|
+
/** Props object that is spread into the field text component. */
|
|
66
|
+
textProps?: TextProps;
|
|
67
|
+
/** Props object that is spread into the container element. */
|
|
68
|
+
containerProps?: ContainerProps;
|
|
69
|
+
/** Props object that is spread into the control element. */
|
|
70
|
+
controlProps?: ControlProps;
|
|
71
|
+
/** Props object that is spread into the control wrapper element. */
|
|
72
|
+
controlWrapperProps?: BoxProps;
|
|
73
|
+
/** Props object that is spread into the label element. */
|
|
74
|
+
labelProps?: LabelProps;
|
|
75
|
+
}
|
|
76
|
+
export interface FileItemProps {
|
|
77
|
+
/** URL to download the file. */
|
|
78
|
+
downloadLink?: string;
|
|
79
|
+
/** Handler called when a file is deleted.
|
|
80
|
+
*
|
|
81
|
+
* `(e: React.SyntheticEvent, id: string) => void`
|
|
82
|
+
*/
|
|
83
|
+
handleFileDelete: (e: React.SyntheticEvent, id: string) => void;
|
|
84
|
+
/** The aria-describedby id from the helper text element. */
|
|
85
|
+
helperTextId?: string;
|
|
86
|
+
/** Unique identifier for the file. */
|
|
87
|
+
id: string;
|
|
88
|
+
/** Whether the item is disabled. */
|
|
89
|
+
isDisabled?: boolean;
|
|
90
|
+
/** Display name for the file. */
|
|
91
|
+
name: string;
|
|
92
|
+
/** Determines the file item status indicator styling. */
|
|
93
|
+
status?: Status;
|
|
94
|
+
/** Props object that is spread into the file name text component. */
|
|
95
|
+
textProps?: TextProps;
|
|
96
|
+
}
|
|
97
|
+
export interface FileSelectProps extends DOMAttributes {
|
|
98
|
+
/** Text to display in the select button. */
|
|
99
|
+
buttonText?: string;
|
|
100
|
+
/** Handler called when the select button is pressed. */
|
|
101
|
+
handleFileSelect?: () => void;
|
|
102
|
+
/** Whether the select button is disabled. */
|
|
103
|
+
isDisabled?: boolean;
|
|
104
|
+
/** Props object that is spread into the button text component. */
|
|
105
|
+
textProps?: TextProps;
|
|
106
|
+
}
|
package/lib/cjs/types/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export * from './datePicker';
|
|
|
19
19
|
export * from './environmentBreadcrumb';
|
|
20
20
|
export * from './expandableText';
|
|
21
21
|
export * from './fieldHelperText';
|
|
22
|
+
export * from './fileInputField';
|
|
22
23
|
export * from './footer';
|
|
23
24
|
export * from './grid';
|
|
24
25
|
export * from './helpHint';
|