linear-react-components-ui 1.1.24-beta.4 → 1.1.25-rc.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.
- package/lib/@types/ColorStyles.d.ts +1 -2
- package/lib/@types/Position.d.ts +1 -2
- package/lib/assets/styles/calendar.scss +137 -32
- package/lib/assets/styles/colorpicker.scss +6 -1
- package/lib/assets/styles/colors.scss +12 -48
- package/lib/assets/styles/file.scss +8 -0
- package/lib/assets/styles/table.scss +6 -0
- package/lib/buttons/ActivateButton.d.ts +0 -1
- package/lib/buttons/AddButton.d.ts +0 -1
- package/lib/buttons/Button.d.ts +0 -1
- package/lib/buttons/CancelButton.d.ts +0 -1
- package/lib/buttons/DangerButton.d.ts +0 -1
- package/lib/buttons/DefaultButton.d.ts +0 -1
- package/lib/buttons/DefaultButton.js +17 -32
- package/lib/buttons/DestroyButton.d.ts +0 -1
- package/lib/buttons/EditButton.d.ts +0 -1
- package/lib/buttons/InactivateButton.d.ts +0 -1
- package/lib/buttons/InfoButton.d.ts +0 -1
- package/lib/buttons/PrimaryButton.d.ts +0 -1
- package/lib/buttons/RestoreButton.d.ts +0 -1
- package/lib/buttons/SaveButton.d.ts +0 -1
- package/lib/buttons/SuccessButton.d.ts +0 -1
- package/lib/buttons/WarningButton.d.ts +0 -1
- package/lib/buttons/index.d.ts +0 -1
- package/lib/buttons/split_button/index.d.ts +0 -1
- package/lib/buttons/types.d.ts +5 -2
- package/lib/calendar/base/index.js +113 -40
- package/lib/dialog/base/index.js +2 -2
- package/lib/form/Field.d.ts +1 -1
- package/lib/form/FieldArray.d.ts +1 -1
- package/lib/form/FieldNumber.d.ts +1 -1
- package/lib/form/FieldPeriod.d.ts +1 -1
- package/lib/form/helpers.d.ts +1 -1
- package/lib/form/index.d.ts +1 -1
- package/lib/form/types.d.ts +1 -1
- package/lib/form/withFieldHOC.d.ts +1 -1
- package/lib/form/withFormSecurity.d.ts +1 -1
- package/lib/icons/helper.d.ts +0 -20
- package/lib/icons/helper.js +0 -20
- package/lib/icons/index.d.ts +6 -4
- package/lib/icons/index.js +9 -14
- package/lib/icons/types.d.ts +6 -3
- package/lib/index.d.ts +0 -1
- package/lib/inputs/base/InputTextBase.d.ts +1 -1
- package/lib/inputs/base/InputTextBase.js +8 -18
- package/lib/inputs/base/Label.d.ts +14 -0
- package/lib/inputs/base/Label.js +35 -0
- package/lib/inputs/base/helpers.d.ts +1 -1
- package/lib/inputs/base/types.d.ts +17 -6
- package/lib/inputs/color/index.js +1 -1
- package/lib/inputs/color/types.d.ts +1 -1
- package/lib/inputs/date/Dialog.d.ts +1 -1
- package/lib/inputs/date/Dropdown.d.ts +1 -1
- package/lib/inputs/date/index.d.ts +1 -1
- package/lib/inputs/date/types.d.ts +2 -2
- package/lib/inputs/errorMessage/index.d.ts +1 -1
- package/lib/inputs/file/DefaultFile.d.ts +1 -1
- package/lib/inputs/file/DefaultFile.js +27 -27
- package/lib/inputs/file/DragDropFile.d.ts +1 -1
- package/lib/inputs/file/File.d.ts +1 -1
- package/lib/inputs/file/File.js +1 -0
- package/lib/inputs/file/FileButtonSettings.d.ts +1 -1
- package/lib/inputs/file/FileButtonSettings.js +0 -1
- package/lib/inputs/file/helpers.d.ts +1 -1
- package/lib/inputs/file/index.d.ts +1 -1
- package/lib/inputs/file/types.d.ts +1 -1
- package/lib/inputs/inputHOC.d.ts +1 -1
- package/lib/inputs/mask/BaseMask.d.ts +1 -1
- package/lib/inputs/mask/Cnpj.d.ts +1 -1
- package/lib/inputs/mask/Cpf.d.ts +1 -1
- package/lib/inputs/mask/Phone.d.ts +1 -1
- package/lib/inputs/mask/ZipCode.d.ts +1 -1
- package/lib/inputs/mask/helpers.d.ts +1 -1
- package/lib/inputs/mask/index.d.ts +1 -1
- package/lib/inputs/mask/types.d.ts +2 -2
- package/lib/inputs/multiSelect/ActionButtons.d.ts +1 -1
- package/lib/inputs/multiSelect/Dropdown.d.ts +1 -1
- package/lib/inputs/multiSelect/helper.d.ts +1 -1
- package/lib/inputs/multiSelect/index.d.ts +1 -1
- package/lib/inputs/multiSelect/types.d.ts +2 -2
- package/lib/inputs/number/BaseNumber.d.ts +1 -1
- package/lib/inputs/number/Currency.d.ts +1 -1
- package/lib/inputs/number/Decimal.d.ts +1 -1
- package/lib/inputs/number/index.d.ts +1 -1
- package/lib/inputs/number/types.d.ts +3 -3
- package/lib/inputs/period/Dialog.d.ts +1 -1
- package/lib/inputs/period/Dropdown.d.ts +1 -1
- package/lib/inputs/period/PeriodList.d.ts +1 -1
- package/lib/inputs/period/helper.d.ts +1 -1
- package/lib/inputs/period/index.d.ts +1 -1
- package/lib/inputs/period/index.js +10 -8
- package/lib/inputs/period/types.d.ts +5 -2
- package/lib/inputs/search/index.d.ts +1 -1
- package/lib/inputs/search/index.js +6 -2
- package/lib/inputs/select/ActionButtons.d.ts +1 -1
- package/lib/inputs/select/Dropdown.d.ts +1 -1
- package/lib/inputs/select/helper.d.ts +1 -1
- package/lib/inputs/select/index.d.ts +1 -1
- package/lib/inputs/select/multiple/Selecteds.d.ts +1 -1
- package/lib/inputs/select/multiple/index.d.ts +1 -1
- package/lib/inputs/select/simple/index.d.ts +1 -1
- package/lib/inputs/select/types.d.ts +1 -1
- package/lib/inputs/text/index.d.ts +1 -1
- package/lib/inputs/text/types.d.ts +3 -2
- package/lib/inputs/textarea/index.d.ts +1 -1
- package/lib/inputs/textarea/types.d.ts +1 -1
- package/lib/inputs/types.d.ts +2 -1
- package/lib/internals/types.d.ts +17 -1
- package/lib/internals/withTooltip.d.ts +12 -0
- package/lib/internals/withTooltip.js +172 -0
- package/lib/labels/DangerLabel.d.ts +0 -1
- package/lib/labels/DefaultLabel.d.ts +5 -3
- package/lib/labels/DefaultLabel.js +7 -15
- package/lib/labels/InfoLabel.d.ts +0 -1
- package/lib/labels/PrimaryLabel.d.ts +0 -1
- package/lib/labels/SuccessLabel.d.ts +0 -1
- package/lib/labels/WarningLabel.d.ts +0 -1
- package/lib/labels/index.d.ts +2 -3
- package/lib/labels/types.d.ts +5 -2
- package/lib/list/Header.d.ts +0 -1
- package/lib/list/Item.d.ts +5 -3
- package/lib/list/Item.js +12 -17
- package/lib/list/helpers.d.ts +0 -1
- package/lib/list/index.d.ts +0 -1
- package/lib/list/types.d.ts +6 -4
- package/lib/menus/sidenav/ExpandMenu.d.ts +2 -2
- package/lib/menus/sidenav/MenuLink.d.ts +7 -4
- package/lib/menus/sidenav/MenuLink.js +11 -20
- package/lib/menus/sidenav/NavMenuGroup.d.ts +2 -2
- package/lib/menus/sidenav/NavMenuItem.d.ts +7 -4
- package/lib/menus/sidenav/NavMenuItem.js +12 -16
- package/lib/menus/sidenav/NavSubMenuItem.d.ts +2 -2
- package/lib/menus/sidenav/helpers.d.ts +2 -2
- package/lib/menus/sidenav/index.d.ts +2 -2
- package/lib/menus/sidenav/popup_menu_search/EmptyList.d.ts +2 -2
- package/lib/menus/sidenav/popup_menu_search/index.d.ts +2 -2
- package/lib/menus/sidenav/types.d.ts +6 -6
- package/lib/popover/PopoverText.js +2 -11
- package/lib/popover/index.js +0 -1
- package/lib/popover/types.d.ts +0 -1
- package/lib/table/index.js +18 -8
- package/lib/table/types.d.ts +1 -0
- package/lib/textContent/index.d.ts +11 -6
- package/lib/textContent/index.js +11 -20
- package/lib/tooltip/index.d.ts +3 -4
- package/lib/tooltip/index.js +53 -36
- package/lib/tooltip/types.d.ts +3 -25
- package/package.json +2 -3
- package/lib/BaseMask-0c14ef51.d.ts +0 -24
- package/lib/Cnpj-bde01dd0.d.ts +0 -18
- package/lib/Cpf-3fa496ad.d.ts +0 -18
- package/lib/Phone-2bb0b397.d.ts +0 -18
- package/lib/ZipCode-09460e18.d.ts +0 -13
- package/lib/assets/styles/checkbox2.scss +0 -199
- package/lib/assets/styles/datepicker2.scss +0 -338
- package/lib/assets/styles/numberfield.scss +0 -18
- package/lib/assets/styles/radiofield.scss +0 -185
- package/lib/assets/styles/selectfield.scss +0 -409
- package/lib/assets/styles/slot.scss +0 -34
- package/lib/assets/styles/textfield.scss +0 -147
- package/lib/calendar/base/Day.d.ts +0 -8
- package/lib/calendar/base/Day.js +0 -36
- package/lib/calendar/base/Month.d.ts +0 -8
- package/lib/calendar/base/Month.js +0 -39
- package/lib/calendar/base/Week.d.ts +0 -8
- package/lib/calendar/base/Week.js +0 -35
- package/lib/form2/helpers.d.ts +0 -8
- package/lib/form2/helpers.js +0 -41
- package/lib/form2/index.d.ts +0 -9
- package/lib/form2/index.js +0 -36
- package/lib/form2/types.d.ts +0 -125
- package/lib/form2/types.js +0 -5
- package/lib/form2/useForm/index.d.ts +0 -5
- package/lib/form2/useForm/index.js +0 -202
- package/lib/index-368f781f.d.ts +0 -15
- package/lib/index-3b70931d.d.ts +0 -44
- package/lib/index-789dd9a5.d.ts +0 -41
- package/lib/index-7ad68789.d.ts +0 -15
- package/lib/index-9e576346.d.ts +0 -23
- package/lib/index-c512803d.d.ts +0 -23
- package/lib/index-c9247c1f.d.ts +0 -15
- package/lib/index-ecafc8c6.d.ts +0 -30
- package/lib/inputs2/checkboxfield/index.d.ts +0 -7
- package/lib/inputs2/checkboxfield/index.js +0 -146
- package/lib/inputs2/colorfield/index.d.ts +0 -9
- package/lib/inputs2/colorfield/index.js +0 -119
- package/lib/inputs2/date/base/constants.d.ts +0 -7
- package/lib/inputs2/date/base/constants.js +0 -43
- package/lib/inputs2/date/base/index.d.ts +0 -12
- package/lib/inputs2/date/base/index.js +0 -179
- package/lib/inputs2/date/datefield/calendarbox.d.ts +0 -7
- package/lib/inputs2/date/datefield/calendarbox.js +0 -115
- package/lib/inputs2/date/datefield/context.d.ts +0 -14
- package/lib/inputs2/date/datefield/context.js +0 -15
- package/lib/inputs2/date/datefield/index.d.ts +0 -10
- package/lib/inputs2/date/datefield/index.js +0 -336
- package/lib/inputs2/date/datefield/triggers.d.ts +0 -8
- package/lib/inputs2/date/datefield/triggers.js +0 -47
- package/lib/inputs2/date/datefield/types.d.ts +0 -63
- package/lib/inputs2/date/datefield/types.js +0 -5
- package/lib/inputs2/date/dateperiodfield/calendarbox.d.ts +0 -7
- package/lib/inputs2/date/dateperiodfield/calendarbox.js +0 -136
- package/lib/inputs2/date/dateperiodfield/context.d.ts +0 -14
- package/lib/inputs2/date/dateperiodfield/context.js +0 -17
- package/lib/inputs2/date/dateperiodfield/index.d.ts +0 -10
- package/lib/inputs2/date/dateperiodfield/index.js +0 -593
- package/lib/inputs2/date/dateperiodfield/triggers.d.ts +0 -6
- package/lib/inputs2/date/dateperiodfield/triggers.js +0 -120
- package/lib/inputs2/date/dateperiodfield/types.d.ts +0 -101
- package/lib/inputs2/date/dateperiodfield/types.js +0 -19
- package/lib/inputs2/date/helpers.d.ts +0 -21
- package/lib/inputs2/date/helpers.js +0 -62
- package/lib/inputs2/date/types.d.ts +0 -60
- package/lib/inputs2/date/types.js +0 -19
- package/lib/inputs2/index.d.ts +0 -32
- package/lib/inputs2/index.js +0 -34
- package/lib/inputs2/mask/BaseMask.d.ts +0 -10
- package/lib/inputs2/mask/BaseMask.js +0 -95
- package/lib/inputs2/mask/Cnpj.d.ts +0 -11
- package/lib/inputs2/mask/Cnpj.js +0 -57
- package/lib/inputs2/mask/Cpf.d.ts +0 -11
- package/lib/inputs2/mask/Cpf.js +0 -53
- package/lib/inputs2/mask/Phone.d.ts +0 -11
- package/lib/inputs2/mask/Phone.js +0 -26
- package/lib/inputs2/mask/ZipCode.d.ts +0 -11
- package/lib/inputs2/mask/ZipCode.js +0 -23
- package/lib/inputs2/mask/helpers.d.ts +0 -4
- package/lib/inputs2/mask/helpers.js +0 -57
- package/lib/inputs2/numberfield/currency.d.ts +0 -13
- package/lib/inputs2/numberfield/currency.js +0 -91
- package/lib/inputs2/numberfield/decimal.d.ts +0 -13
- package/lib/inputs2/numberfield/decimal.js +0 -85
- package/lib/inputs2/numberfield/helpers.d.ts +0 -30
- package/lib/inputs2/numberfield/helpers.js +0 -53
- package/lib/inputs2/numberfield/index.d.ts +0 -12
- package/lib/inputs2/numberfield/index.js +0 -104
- package/lib/inputs2/numberfield/types.d.ts +0 -36
- package/lib/inputs2/numberfield/types.js +0 -5
- package/lib/inputs2/radiofield/index.d.ts +0 -9
- package/lib/inputs2/radiofield/index.js +0 -143
- package/lib/inputs2/radiofield/types.d.ts +0 -33
- package/lib/inputs2/radiofield/types.js +0 -5
- package/lib/inputs2/selectfield/context.d.ts +0 -38
- package/lib/inputs2/selectfield/context.js +0 -15
- package/lib/inputs2/selectfield/helpers.d.ts +0 -6
- package/lib/inputs2/selectfield/helpers.js +0 -25
- package/lib/inputs2/selectfield/index.d.ts +0 -10
- package/lib/inputs2/selectfield/index.js +0 -491
- package/lib/inputs2/selectfield/item.d.ts +0 -11
- package/lib/inputs2/selectfield/item.js +0 -85
- package/lib/inputs2/selectfield/listbox.d.ts +0 -7
- package/lib/inputs2/selectfield/listbox.js +0 -103
- package/lib/inputs2/selectfield/search.d.ts +0 -7
- package/lib/inputs2/selectfield/search.js +0 -71
- package/lib/inputs2/selectfield/selections.d.ts +0 -10
- package/lib/inputs2/selectfield/selections.js +0 -86
- package/lib/inputs2/selectfield/triggers.d.ts +0 -8
- package/lib/inputs2/selectfield/triggers.js +0 -100
- package/lib/inputs2/selectfield/types.d.ts +0 -54
- package/lib/inputs2/selectfield/types.js +0 -21
- package/lib/inputs2/slot/index.d.ts +0 -14
- package/lib/inputs2/slot/index.js +0 -47
- package/lib/inputs2/textfield/index.d.ts +0 -8
- package/lib/inputs2/textfield/index.js +0 -159
- package/lib/tooltip/TooltipContent.d.ts +0 -7
- package/lib/tooltip/TooltipContent.js +0 -65
- package/lib/tooltip/useTooltip.d.ts +0 -30
- package/lib/tooltip/useTooltip.js +0 -128
|
@@ -1,491 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.Input = void 0;
|
|
7
|
-
Object.defineProperty(exports, "Item", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function () {
|
|
10
|
-
return _item.Item;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
Object.defineProperty(exports, "LeftSlot", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function () {
|
|
16
|
-
return _slot.LeftSlot;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
Object.defineProperty(exports, "RightSlot", {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
get: function () {
|
|
22
|
-
return _slot.RightSlot;
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
require("../../assets/styles/selectfield.scss");
|
|
26
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
27
|
-
var _lodash = _interopRequireDefault(require("lodash"));
|
|
28
|
-
var _uuid = require("uuid");
|
|
29
|
-
var _reactDom = require("react-dom");
|
|
30
|
-
var _hint = _interopRequireDefault(require("../../hint"));
|
|
31
|
-
var _gridlayout = _interopRequireDefault(require("../../gridlayout"));
|
|
32
|
-
var _popover = _interopRequireWildcard(require("../../popover"));
|
|
33
|
-
var _tooltip = require("../../tooltip");
|
|
34
|
-
var _helpers = require("../../form2/helpers");
|
|
35
|
-
var _permissionValidations = require("../../permissionValidations");
|
|
36
|
-
var _slot = require("../slot");
|
|
37
|
-
var _listbox = require("./listbox");
|
|
38
|
-
var _triggers = require("./triggers");
|
|
39
|
-
var _selections = require("./selections");
|
|
40
|
-
var _context = require("./context");
|
|
41
|
-
var _item = require("./item");
|
|
42
|
-
var _types = require("./types");
|
|
43
|
-
var _helpers2 = require("./helpers");
|
|
44
|
-
const _excluded = ["name", "label", "errors", "children", "gridLayout", "onChange", "tooltip", "tooltipPosition", "tooltipWidth", "hintPosition", "themePopover", "popoverAlign", "skeletonize", "striped", "undigitable", "externalSearch", "openDropdownOnFocus", "showClearButton", "textAlign", "searchOnDropdown", "onSearch", "permissionAttr", "customClass", "customClassLabel", "customClassWrapper", "customClassInputContainer", "onDeniedActions", "notFoundFilterLabel", "multipleInputLabelEmpty", "multipleInputLabelManySelection", "searchInputPlaceholder", "dropdownAlignButton"];
|
|
45
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
46
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
47
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
48
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
49
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
50
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
51
|
-
const SELECT_FIELD_CONTROLS_ID = `select-field-controls-${(0, _uuid.v1)()}`;
|
|
52
|
-
const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
53
|
-
const {
|
|
54
|
-
name,
|
|
55
|
-
label,
|
|
56
|
-
errors,
|
|
57
|
-
children,
|
|
58
|
-
gridLayout,
|
|
59
|
-
onChange,
|
|
60
|
-
tooltip,
|
|
61
|
-
tooltipPosition,
|
|
62
|
-
tooltipWidth,
|
|
63
|
-
hintPosition = 'below',
|
|
64
|
-
themePopover = 'light',
|
|
65
|
-
popoverAlign = 'left',
|
|
66
|
-
skeletonize = false,
|
|
67
|
-
striped = false,
|
|
68
|
-
undigitable = false,
|
|
69
|
-
externalSearch = false,
|
|
70
|
-
openDropdownOnFocus = true,
|
|
71
|
-
showClearButton = true,
|
|
72
|
-
textAlign = 'left',
|
|
73
|
-
searchOnDropdown = false,
|
|
74
|
-
onSearch = undefined,
|
|
75
|
-
permissionAttr = undefined,
|
|
76
|
-
customClass = '',
|
|
77
|
-
customClassLabel = '',
|
|
78
|
-
customClassWrapper = '',
|
|
79
|
-
customClassInputContainer = '',
|
|
80
|
-
onDeniedActions = undefined,
|
|
81
|
-
notFoundFilterLabel = 'Nenhuma opção encontrada.',
|
|
82
|
-
multipleInputLabelEmpty = 'Nenhum registro selecionado',
|
|
83
|
-
multipleInputLabelManySelection = 'Múltiplos registros selecionados',
|
|
84
|
-
searchInputPlaceholder = 'Pesquisar registros',
|
|
85
|
-
dropdownAlignButton = 'left'
|
|
86
|
-
} = props,
|
|
87
|
-
rest = _objectWithoutProperties(props, _excluded);
|
|
88
|
-
const onDenied = _react.default.useMemo(() => {
|
|
89
|
-
return onDeniedActions || (0, _permissionValidations.actionsOnPermissionDenied)(_helpers2.options, permissionAttr);
|
|
90
|
-
}, [onDeniedActions, permissionAttr]);
|
|
91
|
-
const {
|
|
92
|
-
hideContent,
|
|
93
|
-
unvisible
|
|
94
|
-
} = onDenied;
|
|
95
|
-
const [inputValue, setInputValue] = _react.default.useState('');
|
|
96
|
-
const [filterValue, setFilterValue] = _react.default.useState('');
|
|
97
|
-
const [listBoxOpen, setListBoxOpen] = _react.default.useState(false);
|
|
98
|
-
const [activeDescendant, setActiveDescendant] = _react.default.useState(undefined);
|
|
99
|
-
const isMultipleDefault = _lodash.default.isEqual(props?.multiple, _types.MultipleVariantEnum.default);
|
|
100
|
-
const isMultipleWithCheckboxes = _lodash.default.isEqual(props?.multiple, _types.MultipleVariantEnum.checkboxes);
|
|
101
|
-
const isMultipleSelect = isMultipleDefault || isMultipleWithCheckboxes;
|
|
102
|
-
const liSelectedRef = _react.default.useRef(null);
|
|
103
|
-
const selectInputRef = _react.default.useRef(null);
|
|
104
|
-
const selectListBoxRef = _react.default.useRef(null);
|
|
105
|
-
const selectContainerRef = _react.default.useRef(null);
|
|
106
|
-
const selectSearchInputRef = _react.default.useRef(null);
|
|
107
|
-
const listOptionsMap = _react.default.useMemo(() => {
|
|
108
|
-
const optionsMap = new Map();
|
|
109
|
-
_react.default.Children.forEach(children, child => {
|
|
110
|
-
if (/*#__PURE__*/_react.default.isValidElement(child)) {
|
|
111
|
-
optionsMap.set(child.props.value, child.props.label);
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
return optionsMap;
|
|
115
|
-
}, [children]);
|
|
116
|
-
_react.default.useEffect(() => {
|
|
117
|
-
if (isMultipleWithCheckboxes) {
|
|
118
|
-
setInputValue(multipleInputLabelEmpty);
|
|
119
|
-
}
|
|
120
|
-
}, []);
|
|
121
|
-
_react.default.useEffect(() => {
|
|
122
|
-
if (openDropdownOnFocus && listBoxOpen) {
|
|
123
|
-
requestAnimationFrame(() => {
|
|
124
|
-
if (isMultipleWithCheckboxes) {
|
|
125
|
-
selectSearchInputRef.current?.focus?.();
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
}, [listBoxOpen]);
|
|
130
|
-
_react.default.useEffect(() => {
|
|
131
|
-
if (!isMultipleWithCheckboxes && !props?.value) setInputValue('');
|
|
132
|
-
if (!props?.value || document.activeElement === selectInputRef.current) return;
|
|
133
|
-
const lazyInputValue = listOptionsMap.get(rest.value);
|
|
134
|
-
if (!isMultipleWithCheckboxes) setInputValue(lazyInputValue ?? '');
|
|
135
|
-
if (isMultipleWithCheckboxes) {
|
|
136
|
-
const firstSelectionLabel = listOptionsMap.get(props?.value[0]);
|
|
137
|
-
switch (_lodash.default.size(props?.value)) {
|
|
138
|
-
case 0:
|
|
139
|
-
return setInputValue(multipleInputLabelEmpty);
|
|
140
|
-
case 1:
|
|
141
|
-
return setInputValue(firstSelectionLabel ?? '');
|
|
142
|
-
default:
|
|
143
|
-
return setInputValue(multipleInputLabelManySelection);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}, [props?.value, listOptionsMap]);
|
|
147
|
-
const hasLabel = !_lodash.default.isEmpty(props?.label);
|
|
148
|
-
const hasHintMessages = Boolean(props.hint?.length);
|
|
149
|
-
const hasValidationErrors = Boolean(errors?.length);
|
|
150
|
-
const isReadOnly = Boolean(props.readOnly || onDenied.readOnly);
|
|
151
|
-
const isDisabled = Boolean(props.disabled || onDenied.disabled);
|
|
152
|
-
const {
|
|
153
|
-
leftSlotElements,
|
|
154
|
-
rightSlotElements
|
|
155
|
-
} = _react.default.useMemo(() => {
|
|
156
|
-
const left = [];
|
|
157
|
-
const right = [];
|
|
158
|
-
_react.default.Children.map(children, (childElement, index) => {
|
|
159
|
-
if (/*#__PURE__*/_react.default.isValidElement(childElement)) {
|
|
160
|
-
const clonedChild = /*#__PURE__*/_react.default.cloneElement(childElement, {
|
|
161
|
-
key: childElement.key ?? `slot-${index}`,
|
|
162
|
-
disabled: isDisabled,
|
|
163
|
-
'aria-disabled': isDisabled
|
|
164
|
-
});
|
|
165
|
-
if (childElement.type === _slot.LeftSlot) left.push(clonedChild);
|
|
166
|
-
if (childElement.type === _slot.RightSlot) right.push(clonedChild);
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
return {
|
|
170
|
-
leftSlotElements: left,
|
|
171
|
-
rightSlotElements: right
|
|
172
|
-
};
|
|
173
|
-
}, [children, isDisabled]);
|
|
174
|
-
const hasLeftSlotElements = Boolean(leftSlotElements?.length);
|
|
175
|
-
const hasRightSlotElements = Boolean(rightSlotElements?.length);
|
|
176
|
-
const handleCloseListBox = () => {
|
|
177
|
-
setListBoxOpen(false);
|
|
178
|
-
setFilterValue('');
|
|
179
|
-
};
|
|
180
|
-
const handleOpenListBox = () => {
|
|
181
|
-
const currentValue = !isMultipleSelect ? props?.value : _lodash.default.orderBy([...props.value], value => _lodash.default.toNumber(value), ['asc'])[0];
|
|
182
|
-
setActiveDescendant(_lodash.default.toString(currentValue) ?? undefined);
|
|
183
|
-
};
|
|
184
|
-
const handleChangeListBoxState = () => {
|
|
185
|
-
setListBoxOpen(prevState => {
|
|
186
|
-
if (prevState) {
|
|
187
|
-
setFilterValue('');
|
|
188
|
-
}
|
|
189
|
-
if (selectInputRef.current !== document.activeElement) {
|
|
190
|
-
selectInputRef?.current?.focus?.();
|
|
191
|
-
}
|
|
192
|
-
return !prevState;
|
|
193
|
-
});
|
|
194
|
-
};
|
|
195
|
-
const handleChangeLiSelected = liElement => {
|
|
196
|
-
liSelectedRef.current = liElement;
|
|
197
|
-
};
|
|
198
|
-
const handleOnChange = (value, inputLabel, addOrRemove) => {
|
|
199
|
-
let multipleValue = props?.value;
|
|
200
|
-
if (!addOrRemove) multipleValue = _lodash.default.union(props.value, [value]);
|
|
201
|
-
if (addOrRemove) multipleValue = _lodash.default.without(props.value, value);
|
|
202
|
-
const changedValue = !isMultipleSelect ? value : _lodash.default.orderBy(multipleValue, multiValue => _lodash.default.toNumber(multiValue), ['asc']);
|
|
203
|
-
const syntheticEvent = {
|
|
204
|
-
target: {
|
|
205
|
-
name,
|
|
206
|
-
value: changedValue
|
|
207
|
-
}
|
|
208
|
-
};
|
|
209
|
-
onChange?.(syntheticEvent);
|
|
210
|
-
if (!isMultipleSelect) {
|
|
211
|
-
setListBoxOpen(false);
|
|
212
|
-
setFilterValue('');
|
|
213
|
-
setInputValue(inputLabel ?? '');
|
|
214
|
-
if (document.activeElement === selectSearchInputRef.current) {
|
|
215
|
-
selectInputRef?.current?.focus?.();
|
|
216
|
-
setListBoxOpen(false);
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
};
|
|
220
|
-
const handleCheckMultiple = checkOrUncheckAll => {
|
|
221
|
-
const checkAll = Boolean(checkOrUncheckAll);
|
|
222
|
-
let allValues = [];
|
|
223
|
-
listOptionsMap.forEach((__, key) => allValues.push(key));
|
|
224
|
-
const value = checkAll ? allValues : [];
|
|
225
|
-
const syntheticEvent = {
|
|
226
|
-
target: {
|
|
227
|
-
name,
|
|
228
|
-
value
|
|
229
|
-
}
|
|
230
|
-
};
|
|
231
|
-
onChange?.(syntheticEvent);
|
|
232
|
-
};
|
|
233
|
-
const handleClearValue = () => {
|
|
234
|
-
const resetValue = !isMultipleSelect ? '' : [];
|
|
235
|
-
const syntheticEvent = {
|
|
236
|
-
target: {
|
|
237
|
-
name,
|
|
238
|
-
value: resetValue
|
|
239
|
-
}
|
|
240
|
-
};
|
|
241
|
-
onChange?.(syntheticEvent);
|
|
242
|
-
setListBoxOpen(false);
|
|
243
|
-
if (!isMultipleSelect) {
|
|
244
|
-
setFilterValue('');
|
|
245
|
-
setInputValue('');
|
|
246
|
-
}
|
|
247
|
-
if (isMultipleWithCheckboxes) {
|
|
248
|
-
setInputValue(multipleInputLabelEmpty);
|
|
249
|
-
}
|
|
250
|
-
};
|
|
251
|
-
const handleOnBlur = event => {
|
|
252
|
-
props?.onBlur?.(event);
|
|
253
|
-
if (!event.relatedTarget || event.relatedTarget !== selectSearchInputRef.current) {
|
|
254
|
-
setListBoxOpen(false);
|
|
255
|
-
}
|
|
256
|
-
setFilterValue('');
|
|
257
|
-
};
|
|
258
|
-
const handleOnFocus = event => {
|
|
259
|
-
props?.onFocus?.(event);
|
|
260
|
-
if (openDropdownOnFocus) {
|
|
261
|
-
setListBoxOpen(true);
|
|
262
|
-
handleOpenListBox();
|
|
263
|
-
}
|
|
264
|
-
};
|
|
265
|
-
const handleOnChangeInput = event => {
|
|
266
|
-
setFilterValue(event.target.value);
|
|
267
|
-
setInputValue(event.target.value);
|
|
268
|
-
};
|
|
269
|
-
const handleOnPaste = event => {
|
|
270
|
-
if (undigitable || isMultipleWithCheckboxes) {
|
|
271
|
-
event.preventDefault();
|
|
272
|
-
} else {
|
|
273
|
-
props.onPaste?.(event);
|
|
274
|
-
}
|
|
275
|
-
};
|
|
276
|
-
const handleOnBeforeInput = event => {
|
|
277
|
-
if (undigitable || isMultipleWithCheckboxes) {
|
|
278
|
-
event.preventDefault();
|
|
279
|
-
} else {
|
|
280
|
-
props.onBeforeInput?.(event);
|
|
281
|
-
}
|
|
282
|
-
};
|
|
283
|
-
const handleOnSearch = event => {
|
|
284
|
-
if (externalSearch) {
|
|
285
|
-
onSearch?.(event);
|
|
286
|
-
} else {
|
|
287
|
-
setFilterValue(event.target.value);
|
|
288
|
-
}
|
|
289
|
-
};
|
|
290
|
-
const handleOnKeyDown = event => {
|
|
291
|
-
props?.onKeyDown?.(event);
|
|
292
|
-
const notUndigitableKeys = [_types.Keys.backspace, _types.Keys.delete];
|
|
293
|
-
if (undigitable && notUndigitableKeys.includes(event.key)) {
|
|
294
|
-
event.preventDefault();
|
|
295
|
-
return;
|
|
296
|
-
}
|
|
297
|
-
const shouldOpenByTyping = (0, _helpers2.isTypingKey)(event) || event.key === _types.Keys.arrowDown;
|
|
298
|
-
if (shouldOpenByTyping && selectInputRef.current === document.activeElement) {
|
|
299
|
-
if (event.key === _types.Keys.arrowDown) {
|
|
300
|
-
event.preventDefault();
|
|
301
|
-
}
|
|
302
|
-
requestAnimationFrame(() => {
|
|
303
|
-
const ulListElement = selectListBoxRef.current?.querySelector('ul[role="listbox"]');
|
|
304
|
-
const liElementsFiltered = ulListElement?.querySelectorAll('li[data-state-filtered="true"]') ?? [];
|
|
305
|
-
if (!listBoxOpen && event.key === _types.Keys.arrowDown) {
|
|
306
|
-
const currentValue = !isMultipleSelect ? props?.value : _lodash.default.orderBy([...props.value], value => _lodash.default.toNumber(value), ['asc'])[0];
|
|
307
|
-
setActiveDescendant(_lodash.default.toString(currentValue) ?? undefined);
|
|
308
|
-
} else {
|
|
309
|
-
setActiveDescendant(liElementsFiltered[0]?.id ?? undefined);
|
|
310
|
-
}
|
|
311
|
-
});
|
|
312
|
-
if (!listBoxOpen) {
|
|
313
|
-
setListBoxOpen(true);
|
|
314
|
-
handleOpenListBox();
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
if (listBoxOpen && _helpers2.NAVIGATION_KEYS.includes(event.key)) {
|
|
318
|
-
event.preventDefault();
|
|
319
|
-
}
|
|
320
|
-
requestAnimationFrame(() => {
|
|
321
|
-
const ulListElement = selectListBoxRef.current?.querySelector('ul[role="listbox"]');
|
|
322
|
-
const liElementsFiltered = ulListElement?.querySelectorAll('li[data-state-filtered="true"]') ?? [];
|
|
323
|
-
const currentElementIndex = Array.from(liElementsFiltered).findIndex(liElement => liElement.id === activeDescendant);
|
|
324
|
-
let nextElementIndex = currentElementIndex;
|
|
325
|
-
if (listBoxOpen) {
|
|
326
|
-
if (_helpers2.NAVIGATION_KEYS.includes(event.key)) {
|
|
327
|
-
switch (event.key) {
|
|
328
|
-
case _types.Keys.escape:
|
|
329
|
-
setListBoxOpen(false);
|
|
330
|
-
setFilterValue('');
|
|
331
|
-
selectInputRef.current?.focus();
|
|
332
|
-
if (event.target === selectSearchInputRef.current) {
|
|
333
|
-
setListBoxOpen(false);
|
|
334
|
-
}
|
|
335
|
-
break;
|
|
336
|
-
case _types.Keys.arrowDown:
|
|
337
|
-
nextElementIndex = Math.min(currentElementIndex + 1, liElementsFiltered.length - 1);
|
|
338
|
-
break;
|
|
339
|
-
case _types.Keys.arrowUp:
|
|
340
|
-
nextElementIndex = Math.max(currentElementIndex - 1, 0);
|
|
341
|
-
break;
|
|
342
|
-
case _types.Keys.enter:
|
|
343
|
-
if (activeDescendant) {
|
|
344
|
-
const selectedLIOption = liElementsFiltered[nextElementIndex];
|
|
345
|
-
if (selectedLIOption) {
|
|
346
|
-
selectedLIOption.click();
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
break;
|
|
350
|
-
default:
|
|
351
|
-
break;
|
|
352
|
-
}
|
|
353
|
-
const nextLIOption = liElementsFiltered[nextElementIndex];
|
|
354
|
-
if (nextLIOption) {
|
|
355
|
-
setActiveDescendant(nextLIOption?.id ?? '');
|
|
356
|
-
nextLIOption.scrollIntoView({
|
|
357
|
-
block: 'nearest'
|
|
358
|
-
});
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
} else return null;
|
|
362
|
-
});
|
|
363
|
-
};
|
|
364
|
-
const contextValues = _react.default.useMemo(() => ({
|
|
365
|
-
selectFieldId: SELECT_FIELD_CONTROLS_ID,
|
|
366
|
-
label: props.label,
|
|
367
|
-
striped,
|
|
368
|
-
listBoxOpen,
|
|
369
|
-
filterValue,
|
|
370
|
-
isDisabled,
|
|
371
|
-
liSelectedRef,
|
|
372
|
-
selectInputRef,
|
|
373
|
-
selectSearchInputRef,
|
|
374
|
-
handleOnSearch,
|
|
375
|
-
searchOnDropdown,
|
|
376
|
-
nameSelect: String(props.name),
|
|
377
|
-
valueSelect: props?.value,
|
|
378
|
-
activeDescendant,
|
|
379
|
-
handleOnChange,
|
|
380
|
-
handleOnKeyDown,
|
|
381
|
-
selectContainerRef,
|
|
382
|
-
handleCloseListBox,
|
|
383
|
-
notFoundFilterLabel,
|
|
384
|
-
handleChangeLiSelected,
|
|
385
|
-
isMultipleSelect,
|
|
386
|
-
isMultipleDefault,
|
|
387
|
-
isMultipleWithCheckboxes,
|
|
388
|
-
searchInputPlaceholder,
|
|
389
|
-
showClearButton,
|
|
390
|
-
dropdownAlignButton,
|
|
391
|
-
handleClearValue,
|
|
392
|
-
handleCheckMultiple,
|
|
393
|
-
handleChangeListBoxState
|
|
394
|
-
}), [striped, listBoxOpen, isDisabled, filterValue, props?.name, props?.value, activeDescendant, notFoundFilterLabel, searchOnDropdown, isMultipleSelect, showClearButton, isMultipleDefault, isMultipleWithCheckboxes, searchInputPlaceholder, dropdownAlignButton]);
|
|
395
|
-
if (unvisible || hideContent) return null;
|
|
396
|
-
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_gridlayout.default, {
|
|
397
|
-
cols: gridLayout
|
|
398
|
-
}, /*#__PURE__*/_react.default.createElement(_context.SelectFieldContext.Provider, {
|
|
399
|
-
value: contextValues
|
|
400
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
401
|
-
"data-testid": "test-select-field-root",
|
|
402
|
-
className: `select-field-root ${customClassWrapper}`,
|
|
403
|
-
"data-state-error": hasValidationErrors,
|
|
404
|
-
"data-state-hint-position": hintPosition
|
|
405
|
-
}, hasLabel && /*#__PURE__*/_react.default.createElement("span", {
|
|
406
|
-
className: `root-label ${customClassLabel}`,
|
|
407
|
-
"data-state-skeletonize": skeletonize
|
|
408
|
-
}, /*#__PURE__*/_react.default.createElement("label", {
|
|
409
|
-
"data-testid": "test-select-field-label",
|
|
410
|
-
className: "label",
|
|
411
|
-
title: label,
|
|
412
|
-
htmlFor: name,
|
|
413
|
-
"aria-disabled": isDisabled,
|
|
414
|
-
"aria-readonly": isReadOnly,
|
|
415
|
-
"data-state-input-required": props.required
|
|
416
|
-
}, label), hasHintMessages && hintPosition === 'onLabelRight' && !skeletonize && /*#__PURE__*/_react.default.createElement(_popover.default, {
|
|
417
|
-
customClass: "label-popover",
|
|
418
|
-
theme: themePopover,
|
|
419
|
-
align: popoverAlign,
|
|
420
|
-
iconColor: "#03bde2"
|
|
421
|
-
}, /*#__PURE__*/_react.default.createElement(_popover.PopoverText, {
|
|
422
|
-
text: props?.hint ?? ''
|
|
423
|
-
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
424
|
-
ref: selectContainerRef,
|
|
425
|
-
className: `container ${customClassInputContainer}`,
|
|
426
|
-
"aria-expanded": listBoxOpen,
|
|
427
|
-
"data-state-skeletonize": skeletonize
|
|
428
|
-
}, hasLeftSlotElements && !skeletonize && leftSlotElements, /*#__PURE__*/_react.default.createElement("div", {
|
|
429
|
-
className: "input-root"
|
|
430
|
-
}, /*#__PURE__*/_react.default.createElement("input", _extends({}, rest, {
|
|
431
|
-
ref: (0, _helpers.mergeRefs)(ref, selectInputRef),
|
|
432
|
-
readOnly: props.readOnly || undigitable,
|
|
433
|
-
className: `input ${customClass}`,
|
|
434
|
-
placeholder: rest.placeholder,
|
|
435
|
-
"data-state-error": hasValidationErrors,
|
|
436
|
-
"data-state-multiple": isMultipleSelect,
|
|
437
|
-
"data-state-read-only": isReadOnly,
|
|
438
|
-
"data-state-text-align": textAlign,
|
|
439
|
-
"data-state-undigitable": undigitable,
|
|
440
|
-
"data-state-skeletonize": skeletonize,
|
|
441
|
-
"data-state-multiple-with-checkboxes": isMultipleWithCheckboxes,
|
|
442
|
-
id: name,
|
|
443
|
-
type: "text",
|
|
444
|
-
role: "combobox",
|
|
445
|
-
multiple: false,
|
|
446
|
-
"data-testid": "test-select-field-input",
|
|
447
|
-
"aria-autocomplete": "list",
|
|
448
|
-
"aria-expanded": listBoxOpen,
|
|
449
|
-
"aria-controls": SELECT_FIELD_CONTROLS_ID,
|
|
450
|
-
"aria-activedescendant": activeDescendant,
|
|
451
|
-
tabIndex: !isReadOnly && !skeletonize ? 0 : -1,
|
|
452
|
-
value: inputValue,
|
|
453
|
-
onBlur: handleOnBlur,
|
|
454
|
-
onFocus: handleOnFocus,
|
|
455
|
-
onKeyDown: handleOnKeyDown,
|
|
456
|
-
onChange: handleOnChangeInput,
|
|
457
|
-
onPaste: handleOnPaste,
|
|
458
|
-
onBeforeInput: handleOnBeforeInput
|
|
459
|
-
})), isMultipleDefault && /*#__PURE__*/_react.default.createElement(_selections.Selections, {
|
|
460
|
-
isDisabled: isDisabled,
|
|
461
|
-
isReadOnly: isReadOnly,
|
|
462
|
-
listOfOptionsToSelect: listOptionsMap
|
|
463
|
-
})), hasRightSlotElements && !skeletonize && rightSlotElements, /*#__PURE__*/_react.default.createElement("div", {
|
|
464
|
-
className: "triggers",
|
|
465
|
-
"data-state-disabled": isDisabled,
|
|
466
|
-
"data-state-read-only": isReadOnly,
|
|
467
|
-
"data-state-skeletonize": skeletonize
|
|
468
|
-
}, /*#__PURE__*/_react.default.createElement(_triggers.Triggers, null)), listBoxOpen && !hideContent && /*#__PURE__*/(0, _reactDom.createPortal)(/*#__PURE__*/_react.default.createElement(_listbox.ListBox, {
|
|
469
|
-
ref: selectListBoxRef
|
|
470
|
-
}, children), document.body)), hintPosition === 'below' && /*#__PURE__*/_react.default.createElement(_hint.default, {
|
|
471
|
-
customClass: "hint",
|
|
472
|
-
skeletonize: skeletonize,
|
|
473
|
-
description: props.hint,
|
|
474
|
-
disabled: isDisabled,
|
|
475
|
-
visible: hasHintMessages
|
|
476
|
-
}), hasValidationErrors && /*#__PURE__*/_react.default.createElement("span", {
|
|
477
|
-
"data-testid": "test-select-field-list-errors",
|
|
478
|
-
className: "error",
|
|
479
|
-
"data-state-skeletonize": skeletonize,
|
|
480
|
-
"aria-describedby": String(name).concat('-errors')
|
|
481
|
-
}, errors?.map((error, index) => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
|
|
482
|
-
key: `${index + 1}-${error}`
|
|
483
|
-
}, error, "\xA0")))))), /*#__PURE__*/_react.default.createElement(_tooltip.Tooltip, {
|
|
484
|
-
targetRef: selectInputRef,
|
|
485
|
-
text: tooltip,
|
|
486
|
-
position: tooltipPosition,
|
|
487
|
-
width: tooltipWidth,
|
|
488
|
-
space: tooltipPosition === 'right' ? 64 : undefined
|
|
489
|
-
}));
|
|
490
|
-
});
|
|
491
|
-
Input.displayName = 'SelectFieldInput';
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
|
|
3
|
-
interface SelectFieldItemProps extends React__default.ComponentProps<'li'> {
|
|
4
|
-
value: any;
|
|
5
|
-
label: string;
|
|
6
|
-
disabled?: boolean;
|
|
7
|
-
children: React__default.ReactNode;
|
|
8
|
-
}
|
|
9
|
-
declare const Item: React__default.ForwardRefExoticComponent<Pick<SelectFieldItemProps, "className" | "disabled" | "onClick" | "color" | "children" | "label" | "style" | "id" | "key" | "slot" | "title" | "hidden" | "onKeyPress" | "role" | "tabIndex" | "align" | "value" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "nonce" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture"> & React__default.RefAttributes<HTMLLIElement>>;
|
|
10
|
-
|
|
11
|
-
export { Item, SelectFieldItemProps };
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.Item = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _lodash = _interopRequireDefault(require("lodash"));
|
|
9
|
-
var Checkbox = _interopRequireWildcard(require("../checkboxfield"));
|
|
10
|
-
var _context = require("./context");
|
|
11
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
15
|
-
const Item = exports.Item = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
16
|
-
const {
|
|
17
|
-
disabled,
|
|
18
|
-
children
|
|
19
|
-
} = props;
|
|
20
|
-
const {
|
|
21
|
-
striped,
|
|
22
|
-
filterValue,
|
|
23
|
-
valueSelect,
|
|
24
|
-
activeDescendant,
|
|
25
|
-
handleOnChange,
|
|
26
|
-
handleChangeLiSelected,
|
|
27
|
-
isMultipleSelect,
|
|
28
|
-
isMultipleDefault,
|
|
29
|
-
isMultipleWithCheckboxes
|
|
30
|
-
} = (0, _context.useSelectFieldContext)();
|
|
31
|
-
const valueToString = _lodash.default.toString(props.value);
|
|
32
|
-
const hasFocus = Boolean(activeDescendant === valueToString);
|
|
33
|
-
const ariaSelected = !isMultipleSelect ? Boolean(props.value === valueSelect) : [...valueSelect].includes(props.value);
|
|
34
|
-
const addOrRemove = !isMultipleSelect ? undefined : ariaSelected;
|
|
35
|
-
const hasPartOfFilter = Boolean(String(props.label).toLowerCase().includes(filterValue?.toString().toLowerCase() ?? ''));
|
|
36
|
-
const handleOnClickItem = event => {
|
|
37
|
-
if (isMultipleDefault && ariaSelected) event.preventDefault();else {
|
|
38
|
-
handleOnChange?.(props.value, props.label, addOrRemove);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
return /*#__PURE__*/_react.default.createElement("li", _extends({
|
|
42
|
-
ref: el => {
|
|
43
|
-
if (el) {
|
|
44
|
-
if (ariaSelected) {
|
|
45
|
-
handleChangeLiSelected(el);
|
|
46
|
-
}
|
|
47
|
-
if (typeof ref === 'function') {
|
|
48
|
-
ref(el);
|
|
49
|
-
} else if (ref) {
|
|
50
|
-
ref.current = el;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
key: props.value,
|
|
55
|
-
id: props.value,
|
|
56
|
-
hidden: props.hidden || !hasPartOfFilter,
|
|
57
|
-
tabIndex: -1,
|
|
58
|
-
title: props.label,
|
|
59
|
-
"aria-label": props.label,
|
|
60
|
-
"aria-selected": ariaSelected,
|
|
61
|
-
"aria-hidden": props['aria-hidden'] || !hasPartOfFilter,
|
|
62
|
-
"aria-disabled": disabled,
|
|
63
|
-
"data-content-value": props.value,
|
|
64
|
-
"data-content-label": props.label,
|
|
65
|
-
"data-state-striped": striped,
|
|
66
|
-
"data-state-in-focus": hasFocus,
|
|
67
|
-
"data-state-filtered": hasPartOfFilter,
|
|
68
|
-
"data-state-multiple-with-default": isMultipleDefault,
|
|
69
|
-
"data-state-multiple-with-checkboxes": isMultipleWithCheckboxes,
|
|
70
|
-
"data-testid": "test-select-field-listbox-item",
|
|
71
|
-
role: "option",
|
|
72
|
-
onClick: handleOnClickItem,
|
|
73
|
-
onMouseDown: event => {
|
|
74
|
-
event.preventDefault();
|
|
75
|
-
}
|
|
76
|
-
}, props), isMultipleWithCheckboxes && /*#__PURE__*/_react.default.createElement(Checkbox.Input, {
|
|
77
|
-
rounded: true,
|
|
78
|
-
checked: ariaSelected,
|
|
79
|
-
size: "default",
|
|
80
|
-
variant: "secondary",
|
|
81
|
-
"data-state-in-focus-select-field": hasFocus,
|
|
82
|
-
name: String(props.label).concat('-').concat(props.value)
|
|
83
|
-
}), children);
|
|
84
|
-
});
|
|
85
|
-
Item.displayName = 'SelectFieldItem';
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
|
|
3
|
-
interface SelectFieldListBoxProps extends React__default.ComponentProps<'div'> {
|
|
4
|
-
}
|
|
5
|
-
declare const ListBox: React__default.ForwardRefExoticComponent<Pick<SelectFieldListBoxProps, "className" | "onClick" | "color" | "children" | "style" | "id" | "key" | "slot" | "title" | "hidden" | "onKeyPress" | "role" | "tabIndex" | "align" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "nonce" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture"> & React__default.RefAttributes<HTMLDivElement>>;
|
|
6
|
-
|
|
7
|
-
export { ListBox, SelectFieldListBoxProps };
|