linear-react-components-ui 2.2.0-beta.1 → 2.2.0-beta.11
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/inputs2/selectfield/base.js +33 -15
- package/lib/inputs2/selectfield/base.js.map +1 -1
- package/lib/inputs2/selectfield/context.d.ts +1 -0
- package/lib/inputs2/selectfield/context.js.map +1 -1
- package/lib/inputs2/selectfield/item.js +52 -50
- package/lib/inputs2/selectfield/item.js.map +1 -1
- package/lib/inputs2/selectfield/listbox.d.ts +1 -2
- package/lib/inputs2/selectfield/listbox.js +0 -8
- package/lib/inputs2/selectfield/listbox.js.map +1 -1
- package/lib/inputs2/selectfield/types.d.ts +3 -5
- package/lib/inputs2/selectfield/types.js.map +1 -1
- package/lib/node_modules/lodash/lodash.js +2 -2
- package/lib/node_modules/lodash/lodash.js.map +1 -1
- package/lib/panel/Content.js +77 -20
- package/lib/panel/Content.js.map +1 -1
- package/lib/panel/helpers.js +16 -1
- package/lib/panel/helpers.js.map +1 -1
- package/lib/panel/types.d.ts +6 -3
- package/package.json +1 -1
- package/lib/hooks/useScrollEndReached/index.d.ts +0 -8
- package/lib/hooks/useScrollEndReached/index.js +0 -103
- package/lib/hooks/useScrollEndReached/index.js.map +0 -1
- package/lib/hooks/useScrollEndReached/types.d.ts +0 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listbox.js","sources":["../../../src/lib/inputs2/selectfield/listbox.tsx"],"sourcesContent":["import _ from 'lodash';\nimport { ComponentProps, CSSProperties, forwardRef, useEffect, useRef, useState } from 'react';\nimport {
|
|
1
|
+
{"version":3,"file":"listbox.js","sources":["../../../src/lib/inputs2/selectfield/listbox.tsx"],"sourcesContent":["import _ from 'lodash';\nimport { ComponentProps, CSSProperties, forwardRef, useEffect, useRef, useState } from 'react';\nimport { Search } from './search';\nimport { useSelectFieldContext } from './context';\n\ninterface SelectFieldListBoxProps extends ComponentProps<'div'> {\n dropdownMaxWidth?: number;\n}\n\nconst MAX_HEIGHT = ((27 * 15) + 1); // 27px de height do list item * 15 itens máximos na exibição + 1px de borda listbox.\nconst ListBox = forwardRef<HTMLDivElement, SelectFieldListBoxProps>((props, ref) => {\n const { children, dropdownMaxWidth, ...rest } = props;\n const {\n listBoxOpen, valueSelect, selectFieldId, selectContainerRef, notFoundFilterLabel,\n searchOnDropdown, isMultipleWithCheckboxes,\n } = useSelectFieldContext();\n\n const [listBoxStyles, setListBoxStyles] = useState<CSSProperties>({});\n const [filterResultIsEmpty, setFilterResultIsEmpty] = useState(false);\n const listBoxRef = useRef<HTMLUListElement>(null);\n const shouldBeShowSearchInput = searchOnDropdown || isMultipleWithCheckboxes;\n\n requestAnimationFrame(() => {\n const hasChildrenElementsInUL = (listBoxRef.current?.childNodes);\n const liElementsFiltered = (listBoxRef.current?.querySelectorAll(\n 'li[data-state-filtered=\"true\"]',\n ) ?? []) as HTMLLIElement[];\n const filterIsEmpty = !_.isEmpty(hasChildrenElementsInUL) && _.isEmpty(liElementsFiltered);\n setFilterResultIsEmpty(filterIsEmpty);\n });\n\n useEffect(() => {\n const updatePosition = () => {\n const selectPositionOnScreen = selectContainerRef.current?.getBoundingClientRect();\n if (selectPositionOnScreen) {\n const { top, left, width, height } = selectPositionOnScreen;\n const spaceBelow = window.innerHeight - (top + height);\n const spaceAbove = top;\n const shouldOpenUp = spaceBelow < MAX_HEIGHT && spaceAbove > spaceBelow;\n\n const styles: CSSProperties = {\n left: left + window.scrollX,\n minWidth: dropdownMaxWidth ?? width,\n };\n\n if (shouldOpenUp) {\n styles.bottom = window.innerHeight - top - window.scrollY;\n styles.maxHeight = Math.min(MAX_HEIGHT, spaceAbove);\n } else {\n styles.top = top + height + window.scrollY;\n styles.maxHeight = Math.min(MAX_HEIGHT, spaceBelow);\n }\n\n setListBoxStyles(styles);\n }\n };\n\n if (listBoxOpen) {\n updatePosition();\n window.addEventListener('resize', updatePosition);\n window.addEventListener('scroll', updatePosition, true);\n }\n\n return () => {\n window.removeEventListener('resize', updatePosition);\n window.removeEventListener('scroll', updatePosition, true);\n };\n }, [listBoxOpen, valueSelect, selectContainerRef]);\n\n return (\n <div\n ref={ref}\n style={listBoxStyles}\n aria-expanded={listBoxOpen}\n className=\"select-field-listbox\"\n data-testid=\"test-select-field-listbox\"\n data-dropdown-max-width={dropdownMaxWidth}\n {...rest}>\n {shouldBeShowSearchInput && (<Search />)}\n <ul\n id={selectFieldId}\n role=\"listbox\"\n ref={listBoxRef}>\n {children}\n {filterResultIsEmpty && (\n <li\n tabIndex={-1}\n aria-disabled={true}\n aria-label={notFoundFilterLabel}\n key=\"not-found-values\"\n // eslint-disable-next-line jsx-a11y/role-has-required-aria-props\n role=\"option\"\n id=\"not-found-values\"\n className=\"not-found-values\"\n onClick={(event) => { event.preventDefault(); }}\n onMouseDown={(event) => { event.preventDefault(); }}>\n {notFoundFilterLabel}\n </li>\n )}\n </ul>\n </div>\n );\n});\n\nListBox.displayName = 'SelectListBox';\nexport { ListBox };\nexport type { SelectFieldListBoxProps };\n"],"names":["MAX_HEIGHT","ListBox","forwardRef","props","ref","children","dropdownMaxWidth","rest","listBoxOpen","valueSelect","selectFieldId","selectContainerRef","notFoundFilterLabel","searchOnDropdown","isMultipleWithCheckboxes","useSelectFieldContext","listBoxStyles","setListBoxStyles","useState","filterResultIsEmpty","setFilterResultIsEmpty","listBoxRef","useRef","shouldBeShowSearchInput","requestAnimationFrame","hasChildrenElementsInUL","current","childNodes","liElementsFiltered","querySelectorAll","filterIsEmpty","_","isEmpty","useEffect","updatePosition","selectPositionOnScreen","getBoundingClientRect","top","left","width","height","spaceBelow","window","innerHeight","spaceAbove","shouldOpenUp","styles","scrollX","minWidth","bottom","scrollY","maxHeight","Math","min","addEventListener","removeEventListener","event","preventDefault","displayName"],"mappings":";;;;;AASA,MAAMA,aAAe,KAAK,KAAM;AAChC,MAAMC,UAAUC,WAAoD,CAACC,OAAOC,QAAQ;AAClF,QAAM;AAAA,IAAEC;AAAAA,IA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;AACnCJ,iBAAOK,YAAYC,KAAKC,IAAIrD,YAAYyC,UAAU;AAAA,QACpD;AAEAxB,yBAAiB6B,MAAM;AAAA,MACzB;AAAA,IACF;AAEA,QAAItC,aAAa;AACf0B,qBAAAA;AACAQ,aAAOY,iBAAiB,UAAUpB,cAAc;AAChDQ,aAAOY,iBAAiB,UAAUpB,gBAAgB,IAAI;AAAA,IACxD;AAEA,WAAO,MAAM;AACXQ,aAAOa,oBAAoB,UAAUrB,cAAc;AACnDQ,aAAOa,oBAAoB,UAAUrB,gBAAgB,IAAI;AAAA,IAC3D;AAAA,EACF,GAAG,CAAC1B,aAAaC,aAAaE,kBAAkB,CAAC;AAEjD,SACE,qBAAC,OAAA,EACC,KACA,OAAOK,eACP,iBAAeR,aACf,WAAU,wBACV,eAAY,6BACZ,2BAAyBF,kBACzB,GAAIC,MACHgB,UAAAA;AAAAA,IAAAA,+CAA6B,QAAA,EAAM;AAAA,yBACnC,MAAA,EACC,IAAIb,eACJ,MAAK,WACL,KAAKW,YACJhB,UAAAA;AAAAA,MAAAA;AAAAA,MACAc,uBACC;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,UAAU;AAAA,UACV,iBAAe;AAAA,UACf,cAAYP;AAAAA,UAGZ,MAAK;AAAA,UACL,IAAG;AAAA,UACH,WAAU;AAAA,UACV,SAAU4C,CAAAA,UAAU;AAAEA,kBAAMC,eAAAA;AAAAA,UAAkB;AAAA,UAC9C,aAAcD,CAAAA,YAAU;AAAEA,oBAAMC,eAAAA;AAAAA,UAAkB;AAAA,UACjD7C,UAAAA;AAAAA,QAAAA;AAAAA,QAPG;AAAA,MAAA;AAAA,IAQN,EAAA,CAEJ;AAAA,EAAA,GACF;AAEJ,CAAC;AAEDX,QAAQyD,cAAc;"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { UseScrollEndReachedParams } from 'src/lib/hooks/useScrollEndReached/types';
|
|
1
|
+
import { ComponentPropsWithoutRef } from 'react';
|
|
3
2
|
import { TextAlign } from '../../@types/Align';
|
|
4
3
|
import { ColorTheme } from '../../@types/ColorStyles';
|
|
5
4
|
import { ITooltipCommonProps } from '../../tooltip/types';
|
|
@@ -24,10 +23,9 @@ export interface SelectFieldInputProps extends SelectFieldInputBaseProps {
|
|
|
24
23
|
permissionAttr?: PermissionAttr;
|
|
25
24
|
onDeniedActions?: OnDenied;
|
|
26
25
|
}
|
|
27
|
-
export interface SelectFieldInputBaseProps extends InputHTMLProps, ITooltipCommonProps
|
|
26
|
+
export interface SelectFieldInputBaseProps extends InputHTMLProps, ITooltipCommonProps {
|
|
28
27
|
skeletonize?: boolean;
|
|
29
28
|
undigitable?: boolean;
|
|
30
|
-
externalSearch?: boolean;
|
|
31
29
|
showClearButton?: boolean;
|
|
32
30
|
searchOnDropdown?: boolean;
|
|
33
31
|
openDropdownOnFocus?: boolean;
|
|
@@ -49,7 +47,7 @@ export interface SelectFieldInputBaseProps extends InputHTMLProps, ITooltipCommo
|
|
|
49
47
|
themePopover?: ColorTheme;
|
|
50
48
|
popoverAlign?: Extract<Position, 'left' | 'right'>;
|
|
51
49
|
dropdownAlignButton?: Extract<Position, 'left' | 'right'>;
|
|
52
|
-
|
|
50
|
+
onRemoteSearch?: (value: string) => void;
|
|
53
51
|
multiple?: keyof typeof MultipleVariantEnum;
|
|
54
52
|
dropdownMaxWidth?: number;
|
|
55
53
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../../../src/lib/inputs2/selectfield/types.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../src/lib/inputs2/selectfield/types.ts"],"sourcesContent":["import { type ComponentPropsWithoutRef } from 'react';\nimport type { TextAlign } from '../../@types/Align';\nimport type { ColorTheme } from '../../@types/ColorStyles';\nimport type { ITooltipCommonProps } from '../../tooltip/types';\nimport type { Position, HintPosition } from '../../@types/Position';\nimport type { OnDenied, PermissionAttr } from '../../@types/PermissionAttr';\n\nexport enum MultipleVariantEnum { default = 'default', checkboxes = 'checkboxes' }\nexport enum Keys {\n escape = 'Escape',\n arrowDown = 'ArrowDown',\n arrowUp = 'ArrowUp',\n enter = 'Enter',\n backspace = 'Backspace',\n delete = 'Delete',\n spaceBar = ' '\n}\ntype InputHTMLProps = Omit<ComponentPropsWithoutRef<'input'>, 'multiple' | 'type'>;\n\nexport interface SelectFieldInputProps extends SelectFieldInputBaseProps {\n gridLayout?: string;\n permissionAttr?: PermissionAttr;\n onDeniedActions?: OnDenied;\n}\n\nexport interface SelectFieldInputBaseProps extends InputHTMLProps, ITooltipCommonProps {\n skeletonize?: boolean;\n undigitable?: boolean;\n showClearButton?: boolean;\n searchOnDropdown?: boolean;\n openDropdownOnFocus?: boolean;\n value?: any;\n label?: string;\n errors?: string[];\n striped?: boolean;\n hint?: string;\n notFoundFilterLabel?: string;\n customClass?: string;\n customClassLabel?: string;\n customClassWrapper?: string;\n searchInputPlaceholder?: string;\n customClassInputContainer?: string;\n multipleInputLabelEmpty?: string;\n multipleInputLabelManySelection?: string;\n textAlign?: TextAlign;\n hintPosition?: HintPosition;\n themePopover?: ColorTheme;\n popoverAlign?: Extract<Position, 'left' | 'right'>;\n dropdownAlignButton?: Extract<Position, 'left' | 'right'>;\n onRemoteSearch?: (value: string) => void;\n multiple?: keyof typeof MultipleVariantEnum;\n dropdownMaxWidth?: number;\n}\n"],"names":["MultipleVariantEnum","default","checkboxes","Keys","escape","arrowDown","arrowUp","enter","backspace","delete","spaceBar"],"mappings":"AAOO,IAAKA,wCAAAA,yBAAL;AAA2BC,uBAAAA,SAAAA,IAAU;AAAWC,uBAAAA,YAAAA,IAAa;AAAxDF,SAAAA;AAAAA,GAAAA,uBAAAA,CAAAA,CAAAA;AACL,IAAKG,yBAAAA,UAAL;AACLC,QAAAA,QAAAA,IAAS;AACTC,QAAAA,WAAAA,IAAY;AACZC,QAAAA,SAAAA,IAAU;AACVC,QAAAA,OAAAA,IAAQ;AACRC,QAAAA,WAAAA,IAAY;AACZC,QAAAA,QAAAA,IAAS;AACTC,QAAAA,UAAAA,IAAW;AAPDP,SAAAA;AAAAA,GAAAA,QAAAA,CAAAA,CAAAA;"}
|
|
@@ -13,7 +13,7 @@ var hasRequiredLodash;
|
|
|
13
13
|
function requireLodash() {
|
|
14
14
|
if (hasRequiredLodash) return lodash$1.exports;
|
|
15
15
|
hasRequiredLodash = 1;
|
|
16
|
-
(function(module, exports) {
|
|
16
|
+
(function(module, exports$1) {
|
|
17
17
|
(function() {
|
|
18
18
|
var undefined$1;
|
|
19
19
|
var VERSION = "4.17.21";
|
|
@@ -341,7 +341,7 @@ function requireLodash() {
|
|
|
341
341
|
var freeGlobal = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
342
342
|
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
343
343
|
var root = freeGlobal || freeSelf || Function("return this")();
|
|
344
|
-
var freeExports = exports && !exports.nodeType && exports;
|
|
344
|
+
var freeExports = exports$1 && !exports$1.nodeType && exports$1;
|
|
345
345
|
var freeModule = freeExports && true && module && !module.nodeType && module;
|
|
346
346
|
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
347
347
|
var freeProcess = moduleExports && freeGlobal.process;
|