@tecsinapse/react-web-kit 1.8.0 → 1.10.2

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 (91) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/dist/components/atoms/Button/Button.d.ts +3 -3
  3. package/dist/components/atoms/Button/Button.js.map +1 -1
  4. package/dist/components/atoms/Input/Input.js +5 -3
  5. package/dist/components/atoms/Input/Input.js.map +1 -1
  6. package/dist/components/atoms/Table/Header/THead.js +2 -2
  7. package/dist/components/atoms/Table/Header/THead.js.map +1 -1
  8. package/dist/components/atoms/Tooltip/Tooltip.d.ts +12 -0
  9. package/dist/components/atoms/Tooltip/Tooltip.js +50 -0
  10. package/dist/components/atoms/Tooltip/Tooltip.js.map +1 -0
  11. package/dist/components/atoms/Tooltip/index.d.ts +1 -0
  12. package/dist/components/atoms/Tooltip/index.js +24 -0
  13. package/dist/components/atoms/Tooltip/index.js.map +1 -0
  14. package/dist/components/atoms/Tooltip/styled.d.ts +9 -0
  15. package/dist/components/atoms/Tooltip/styled.js +140 -0
  16. package/dist/components/atoms/Tooltip/styled.js.map +1 -0
  17. package/dist/components/molecules/Drawer/styled.js.map +1 -1
  18. package/dist/components/molecules/InputPassword/InputPassword.js +5 -3
  19. package/dist/components/molecules/InputPassword/InputPassword.js.map +1 -1
  20. package/dist/components/molecules/Menubar/Menubar.js +1 -1
  21. package/dist/components/molecules/Menubar/Menubar.js.map +1 -1
  22. package/dist/components/molecules/Select/Dropdown/Dropdown.d.ts +1 -1
  23. package/dist/components/molecules/Select/Dropdown/Dropdown.js +39 -26
  24. package/dist/components/molecules/Select/Dropdown/Dropdown.js.map +1 -1
  25. package/dist/components/molecules/Select/Dropdown/components/SearchInput.d.ts +8 -0
  26. package/dist/components/molecules/Select/Dropdown/components/SearchInput.js +43 -0
  27. package/dist/components/molecules/Select/Dropdown/components/SearchInput.js.map +1 -0
  28. package/dist/components/molecules/Select/Dropdown/components/index.d.ts +1 -0
  29. package/dist/components/molecules/Select/Dropdown/components/index.js +16 -0
  30. package/dist/components/molecules/Select/Dropdown/components/index.js.map +1 -0
  31. package/dist/components/molecules/Select/Dropdown/styled.d.ts +2 -1
  32. package/dist/components/molecules/Select/Dropdown/styled.js +6 -3
  33. package/dist/components/molecules/Select/Dropdown/styled.js.map +1 -1
  34. package/dist/components/molecules/Select/Select.d.ts +2 -1
  35. package/dist/components/molecules/Select/Select.js +9 -11
  36. package/dist/components/molecules/Select/Select.js.map +1 -1
  37. package/dist/components/molecules/Select/SelectItem/SelectItem.d.ts +3 -3
  38. package/dist/components/molecules/Select/SelectItem/SelectItem.js +10 -9
  39. package/dist/components/molecules/Select/SelectItem/SelectItem.js.map +1 -1
  40. package/dist/components/molecules/Select/functions.d.ts +1 -1
  41. package/dist/components/molecules/Select/functions.js +1 -1
  42. package/dist/components/molecules/Select/functions.js.map +1 -1
  43. package/dist/components/molecules/Select/styled.d.ts +4 -3
  44. package/dist/components/molecules/Select/styled.js +16 -1
  45. package/dist/components/molecules/Select/styled.js.map +1 -1
  46. package/dist/components/molecules/TextArea/TextArea.d.ts +1 -2
  47. package/dist/components/molecules/TextArea/TextArea.js.map +1 -1
  48. package/dist/components/organisms/DataGrid/DataGrid.js +1 -1
  49. package/dist/components/organisms/DataGrid/DataGrid.js.map +1 -1
  50. package/dist/components/organisms/DataGrid/Footer/Footer.js +2 -1
  51. package/dist/components/organisms/DataGrid/Footer/Footer.js.map +1 -1
  52. package/dist/components/organisms/DataGrid/Header/Header.js.map +1 -1
  53. package/dist/components/organisms/DataGrid/Header/utils.d.ts +6 -8
  54. package/dist/components/organisms/DataGrid/Header/utils.js.map +1 -1
  55. package/dist/components/organisms/DataGrid/types.d.ts +2 -1
  56. package/dist/hooks/useClickAwayListener.d.ts +1 -1
  57. package/dist/hooks/useClickAwayListener.js +3 -3
  58. package/dist/hooks/useClickAwayListener.js.map +1 -1
  59. package/dist/index.d.ts +1 -0
  60. package/dist/index.js +17 -1
  61. package/dist/index.js.map +1 -1
  62. package/package.json +3 -3
  63. package/src/components/atoms/Button/Button.tsx +3 -3
  64. package/src/components/atoms/Input/Input.stories.tsx +1 -1
  65. package/src/components/atoms/Input/Input.tsx +65 -57
  66. package/src/components/atoms/Table/Header/THead.tsx +1 -1
  67. package/src/components/atoms/Tooltip/Tooltip.stories.tsx +30 -0
  68. package/src/components/atoms/Tooltip/Tooltip.tsx +51 -0
  69. package/src/components/atoms/Tooltip/index.ts +1 -0
  70. package/src/components/atoms/Tooltip/styled.ts +158 -0
  71. package/src/components/molecules/Drawer/styled.ts +1 -1
  72. package/src/components/molecules/InputPassword/InputPassword.stories.tsx +1 -1
  73. package/src/components/molecules/InputPassword/InputPassword.tsx +24 -22
  74. package/src/components/molecules/Menubar/Menubar.tsx +1 -1
  75. package/src/components/molecules/Select/Dropdown/Dropdown.tsx +45 -28
  76. package/src/components/molecules/Select/Dropdown/components/SearchInput.tsx +26 -0
  77. package/src/components/molecules/Select/Dropdown/components/index.ts +1 -0
  78. package/src/components/molecules/Select/Dropdown/styled.ts +10 -4
  79. package/src/components/molecules/Select/Select.stories.tsx +42 -16
  80. package/src/components/molecules/Select/Select.tsx +16 -12
  81. package/src/components/molecules/Select/SelectItem/SelectItem.tsx +27 -24
  82. package/src/components/molecules/Select/functions.ts +10 -18
  83. package/src/components/molecules/Select/{styled.ts → styled.tsx} +11 -1
  84. package/src/components/molecules/TextArea/TextArea.tsx +1 -2
  85. package/src/components/organisms/DataGrid/DataGrid.tsx +14 -12
  86. package/src/components/organisms/DataGrid/Footer/Footer.tsx +1 -0
  87. package/src/components/organisms/DataGrid/Header/Header.tsx +2 -2
  88. package/src/components/organisms/DataGrid/Header/utils.ts +15 -5
  89. package/src/components/organisms/DataGrid/types.ts +3 -1
  90. package/src/hooks/useClickAwayListener.ts +5 -4
  91. package/src/index.ts +1 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/molecules/TextArea/TextArea.tsx"],"names":["TextArea","label","labelColor","labelColorVariant","labelColorTone","labelTypography","labelStack","labelWeight","leftComponent","rightComponent","disabled","style","borderColor","borderColorGradation","inputFontStack","inputFontWeight","inputContainerStyle","variant","hintComponent","hint","onFocus","onBlur","value","maxLength","rest","focused","handleBlur","handleFocus","Text"],"mappings":";;;;;;;AAAA;;AACA;;AAMA;;;;;;AAKA,MAAMA,QAA2B,GAAG,CAAC;AACnCC,EAAAA,KADmC;AAEnCC,EAAAA,UAFmC;AAGnCC,EAAAA,iBAHmC;AAInCC,EAAAA,cAJmC;AAKnCC,EAAAA,eALmC;AAMnCC,EAAAA,UANmC;AAOnCC,EAAAA,WAPmC;AAQnCC,EAAAA,aARmC;AASnCC,EAAAA,cATmC;AAUnCC,EAAAA,QAVmC;AAWnCC,EAAAA,KAXmC;AAYnCC,EAAAA,WAZmC;AAanCC,EAAAA,oBAbmC;AAcnCC,EAAAA,cAAc,GAAG,SAdkB;AAenCC,EAAAA,eAAe,GAAG,MAfiB;AAgBnCC,EAAAA,mBAhBmC;AAiBnCC,EAAAA,OAAO,GAAG,SAjByB;AAkBnCC,EAAAA,aAlBmC;AAmBnCC,EAAAA,IAnBmC;AAoBnCC,EAAAA,OApBmC;AAqBnCC,EAAAA,MArBmC;AAsBnCC,EAAAA,KAtBmC;AAuBnCC,EAAAA,SAvBmC;AAwBnC,KAAGC;AAxBgC,CAAD,KAyB9B;AACJ,QAAM;AAAEC,IAAAA,OAAF;AAAWC,IAAAA,UAAX;AAAuBC,IAAAA;AAAvB,MAAuC,8BAC3CP,OAD2C,EAE3CC,MAF2C,EAG3C,CAACX,QAH0C,CAA7C;AAMA,SACE,6BAAC,mBAAD;AACE,IAAA,KAAK,EAAET,KADT;AAEE,IAAA,UAAU,EAAEC,UAFd;AAGE,IAAA,iBAAiB,EAAEC,iBAHrB;AAIE,IAAA,cAAc,EAAEC,cAJlB;AAKE,IAAA,eAAe,EAAEC,eALnB;AAME,IAAA,UAAU,EAAEC,UANd;AAOE,IAAA,WAAW,EAAEC,WAPf;AAQE,IAAA,cAAc,EAAEqB,eARlB;AASE,IAAA,aAAa,EAAEpB,aATjB;AAUE,IAAA,cAAc,EAAEC,cAVlB;AAWE,IAAA,WAAW,EAAEG,WAXf;AAYE,IAAA,oBAAoB,EAAEC,oBAZxB;AAaE,IAAA,mBAAmB,EAAEG,mBAbvB;AAcE,IAAA,OAAO,EAAES,OAdX;AAeE,IAAA,QAAQ,EAAEf,QAfZ;AAgBE,IAAA,OAAO,EAAEO,OAhBX;AAiBE,IAAA,KAAK,EAAEK,KAjBT;AAkBE,IAAA,aAAa,EAAEJ,aAlBjB;AAmBE,IAAA,IAAI,EAAEC,IAnBR;AAoBE,IAAA,KAAK,EAAER,KApBT;AAqBE,IAAA,aAAa,EAAEiB,eArBjB;AAsBE,IAAA,SAAS,EAAEL;AAtBb,KAwBE,6BAAC,sBAAD,eACMC,IADN;AAEE,IAAA,SAAS,EAAEV,cAFb;AAGE,IAAA,UAAU,EAAEC,eAHd;AAIE,IAAA,QAAQ,EAAEL,QAJZ;AAKE,IAAA,OAAO,EAAEiB,WALX;AAME,IAAA,MAAM,EAAED,UANV;AAOE,IAAA,iBAAiB,EAAE,KAPrB;AAQE,IAAA,SAAS,MARX;AASE,IAAA,KAAK,EAAEJ,KATT;AAUE,IAAA,SAAS,EAAEC;AAVb,KAxBF,CADF;AAuCD,CAvED;;eAyEevB,Q","sourcesContent":["import React, { FC } from 'react';\nimport {\n useInputFocus,\n TextAreaProps as ITACore,\n TextArea as TACore,\n Text,\n} from '@tecsinapse/react-core';\nimport { StyledWebInput } from './styled';\n\nexport interface TextAreaProps\n extends Omit<ITACore, 'TextComponent' | 'focused'> {}\n\nconst TextArea: FC<TextAreaProps> = ({\n label,\n labelColor,\n labelColorVariant,\n labelColorTone,\n labelTypography,\n labelStack,\n labelWeight,\n leftComponent,\n rightComponent,\n disabled,\n style,\n borderColor,\n borderColorGradation,\n inputFontStack = 'default',\n inputFontWeight = 'bold',\n inputContainerStyle,\n variant = 'default',\n hintComponent,\n hint,\n onFocus,\n onBlur,\n value,\n maxLength,\n ...rest\n}) => {\n const { focused, handleBlur, handleFocus } = useInputFocus(\n onFocus,\n onBlur,\n !disabled\n );\n\n return (\n <TACore\n label={label}\n labelColor={labelColor}\n labelColorVariant={labelColorVariant}\n labelColorTone={labelColorTone}\n labelTypography={labelTypography}\n labelStack={labelStack}\n labelWeight={labelWeight}\n LabelComponent={Text}\n leftComponent={leftComponent}\n rightComponent={rightComponent}\n borderColor={borderColor}\n borderColorGradation={borderColorGradation}\n inputContainerStyle={inputContainerStyle}\n focused={focused}\n disabled={disabled}\n variant={variant}\n value={value}\n hintComponent={hintComponent}\n hint={hint}\n style={style}\n TextComponent={Text}\n maxLength={maxLength}\n >\n <StyledWebInput\n {...rest}\n fontStack={inputFontStack}\n fontWeight={inputFontWeight}\n disabled={disabled}\n onFocus={handleFocus}\n onBlur={handleBlur}\n textAlignVertical={'top'}\n multiline\n value={value}\n maxLength={maxLength}\n />\n </TACore>\n );\n};\n\nexport default TextArea;\n"],"file":"TextArea.js"}
1
+ {"version":3,"sources":["../../../../src/components/molecules/TextArea/TextArea.tsx"],"names":["TextArea","label","labelColor","labelColorVariant","labelColorTone","labelTypography","labelStack","labelWeight","leftComponent","rightComponent","disabled","style","borderColor","borderColorGradation","inputFontStack","inputFontWeight","inputContainerStyle","variant","hintComponent","hint","onFocus","onBlur","value","maxLength","rest","focused","handleBlur","handleFocus","Text"],"mappings":";;;;;;;AAAA;;AACA;;AAMA;;;;;;AAIA,MAAMA,QAA2B,GAAG,CAAC;AACnCC,EAAAA,KADmC;AAEnCC,EAAAA,UAFmC;AAGnCC,EAAAA,iBAHmC;AAInCC,EAAAA,cAJmC;AAKnCC,EAAAA,eALmC;AAMnCC,EAAAA,UANmC;AAOnCC,EAAAA,WAPmC;AAQnCC,EAAAA,aARmC;AASnCC,EAAAA,cATmC;AAUnCC,EAAAA,QAVmC;AAWnCC,EAAAA,KAXmC;AAYnCC,EAAAA,WAZmC;AAanCC,EAA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,sBAAD,eACMC,IADN;AAEE,IAAA,SAAS,EAAEV,cAFb;AAGE,IAAA,UAAU,EAAEC,eAHd;AAIE,IAAA,QAAQ,EAAEL,QAJZ;AAKE,IAAA,OAAO,EAAEiB,WALX;AAME,IAAA,MAAM,EAAED,UANV;AAOE,IAAA,iBAAiB,EAAE,KAPrB;AAQE,IAAA,SAAS,MARX;AASE,IAAA,KAAK,EAAEJ,KATT;AAUE,IAAA,SAAS,EAAEC;AAVb,KAxBF,CADF;AAuCD,CAvED;;eAyEevB,Q","sourcesContent":["import React, { FC } from 'react';\nimport {\n useInputFocus,\n TextAreaProps as ITACore,\n TextArea as TACore,\n Text,\n} from '@tecsinapse/react-core';\nimport { StyledWebInput } from './styled';\n\nexport type TextAreaProps = Omit<ITACore, 'TextComponent' | 'focused'>;\n\nconst TextArea: FC<TextAreaProps> = ({\n label,\n labelColor,\n labelColorVariant,\n labelColorTone,\n labelTypography,\n labelStack,\n labelWeight,\n leftComponent,\n rightComponent,\n disabled,\n style,\n borderColor,\n borderColorGradation,\n inputFontStack = 'default',\n inputFontWeight = 'bold',\n inputContainerStyle,\n variant = 'default',\n hintComponent,\n hint,\n onFocus,\n onBlur,\n value,\n maxLength,\n ...rest\n}) => {\n const { focused, handleBlur, handleFocus } = useInputFocus(\n onFocus,\n onBlur,\n !disabled\n );\n\n return (\n <TACore\n label={label}\n labelColor={labelColor}\n labelColorVariant={labelColorVariant}\n labelColorTone={labelColorTone}\n labelTypography={labelTypography}\n labelStack={labelStack}\n labelWeight={labelWeight}\n LabelComponent={Text}\n leftComponent={leftComponent}\n rightComponent={rightComponent}\n borderColor={borderColor}\n borderColorGradation={borderColorGradation}\n inputContainerStyle={inputContainerStyle}\n focused={focused}\n disabled={disabled}\n variant={variant}\n value={value}\n hintComponent={hintComponent}\n hint={hint}\n style={style}\n TextComponent={Text}\n maxLength={maxLength}\n >\n <StyledWebInput\n {...rest}\n fontStack={inputFontStack}\n fontWeight={inputFontWeight}\n disabled={disabled}\n onFocus={handleFocus}\n onBlur={handleBlur}\n textAlignVertical={'top'}\n multiline\n value={value}\n maxLength={maxLength}\n />\n </TACore>\n );\n};\n\nexport default TextArea;\n"],"file":"TextArea.js"}
@@ -103,7 +103,7 @@ const DataGrid = ({
103
103
  style: {
104
104
  width: '100%'
105
105
  }
106
- })))))), _react.default.createElement(_Footer.Footer, {
106
+ })))))), (Number(rowsCount) > 0 || data.length > 0) && _react.default.createElement(_Footer.Footer, {
107
107
  exportFunction: exportFunction,
108
108
  exportLabel: exportLabel,
109
109
  rowsPerPageLabel: rowsPerPageLabel,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/organisms/DataGrid/DataGrid.tsx"],"names":["DataGrid","headers","data","rowKeyExtractor","toolbarTitle","toolbarFooter","toolbarRightIcons","selectable","selectedRows","onSelectedRows","pagination","rowsPerPage","onRowsPerPageChange","rowsPerPageOptions","_rowsPerPageOptions","rowsPerPageLabel","_rowsPerPageLabel","exportLabel","exportFunction","rowsCount","page","onPageChange","loading","skeletonComponent","emptyPlaceholder","rest","Error","React","useCallback","value","useMemo","handleSelect","current","checked","prevState","idx","findIndex","el","length","map","item","some","sel","Array","keys","padding","width"],"mappings":";;;;;;;AAAA;;AACA;;AAQA;;AACA;;AAEA;;AACA;;AACA;;;;AA2CA,MAAMA,QAAQ,GAAG,CAAuB;AACtCC,EAAAA,OADsC;AAEtCC,EAAAA,IAFsC;AAGtCC,EAAAA,eAHsC;AAItCC,EAAAA,YAJsC;AAKtCC,EAAAA,aALsC;AAMtCC,EAAAA,iBANsC;AAOtCC,EAAAA,UAAU,GAAG,KAPyB;AAQtCC,EAAAA,YAAY,GAAG,EARuB;AAStCC,EAAAA,cATsC;AAUtCC,EAAAA,UAAU,GAAG,KAVyB;AAWtCC,EAAAA,WAAW,GAAG,EAXwB;AAYtCC,EAAAA,mBAZsC;AAatCC,EAAAA,kBAAkB,EAAEC,mBAbkB;AActCC,EAAAA,gBAAgB,EAAEC,iBAdoB;AAetCC,EAA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L,CAAmBiC,IAAnB,EAAJ,EAA+BL,GAA/B,CAAmCJ,GAAG,IACrC,6BAAC,SAAD;AAAI,IAAA,GAAG,EAAG,YAAWA,GAAI;AAAzB,KACE,6BAAC,SAAD;AAAI,IAAA,OAAO,EAAE,EAAb;AAAiB,IAAA,KAAK,EAAE;AAAEU,MAAAA,OAAO,EAAE;AAAX;AAAxB,KACGtB,iBAAiB,IAChB,6BAAC,kBAAD;AAAU,IAAA,MAAM,EAAE,EAAlB;AAAsB,IAAA,MAAM,EAAC,MAA7B;AAAoC,IAAA,SAAS,EAAC;AAA9C,KACE;AAAK,IAAA,KAAK,EAAE;AAAEuB,MAAAA,KAAK,EAAE;AAAT;AAAZ,IADF,CAFJ,CADF,CADD,CADH,CAxCJ,EAuDE,6BAAC,cAAD;AACE,IAAA,cAAc,EAAE5B,cADlB;AAEE,IAAA,WAAW,EAAED,WAFf;AAGE,IAAA,gBAAgB,EAAEF,gBAHpB;AAIE,IAAA,WAAW,EAAEJ,WAJf;AAKE,IAAA,mBAAmB,EAAEC,mBALvB;AAME,IAAA,kBAAkB,EAAEC,kBANtB;AAOE,IAAA,SAAS,EAAEM,SAAS,IAAIjB,IAAI,CAACoC,MAP/B;AAQE,IAAA,IAAI,EAAElB,IARR;AASE,IAAA,YAAY,EAAEC,YAThB;AAUE,IAAA,UAAU,EAAEX;AAVd,IAvDF,CANF,CADF;AA6ED,CAzID;;eA2IeV,Q","sourcesContent":["import React from 'react';\nimport {\n Table,\n TableToolbar,\n TableContainer,\n Tr,\n Td,\n TBody,\n} from '../../atoms/Table';\nimport { Header } from './Header';\nimport { Row } from './Row';\nimport { HeadersType } from './types';\nimport { Footer } from './Footer';\nimport { Skeleton } from '../../atoms/Skeleton';\nimport { getData, removeElement } from './utils';\n\nexport interface DataGridProps<Data>\n extends React.HTMLAttributes<HTMLDivElement> {\n headers: HeadersType<Data>[];\n data: Data[];\n /** Unique identifier for row data */\n rowKeyExtractor: (data: Data) => string;\n toolbarRightIcons?: React.ReactNode;\n toolbarFooter?: React.ReactNode;\n toolbarTitle: string;\n /** Enable rows selection */\n selectable?: boolean;\n /** Selected items */\n selectedRows?: Data[];\n /** Selection handler */\n onSelectedRows?: (data: Data[] | ((prevState: Data[]) => Data[])) => void;\n /** Shows pagination controls */\n pagination?: boolean;\n /** Results per page */\n rowsPerPage?: number;\n /** Results per page handler */\n onRowsPerPageChange?: (value: number) => void;\n rowsPerPageOptions?: number[];\n rowsPerPageLabel?: (value: number) => string;\n /** Export button label */\n exportLabel?: string;\n exportFunction?: () => void;\n /** Total data elements. Only specify this property if your data is server-side */\n rowsCount?: number;\n /** Current page. Always start in 0 */\n page?: number;\n /** Current page handler */\n onPageChange?: (page: number) => void;\n /** Loading state. The amount of skeleton rows is based on current rowsPerPage */\n loading?: boolean;\n /** Custom skeleton component for better visual */\n skeletonComponent?: React.ReactNode;\n /** Empty state placeholder */\n emptyPlaceholder?: React.ReactNode;\n}\n\n/** Note: Consider memoizing functions for a better performance */\nconst DataGrid = <Data extends unknown>({\n headers,\n data,\n rowKeyExtractor,\n toolbarTitle,\n toolbarFooter,\n toolbarRightIcons,\n selectable = false,\n selectedRows = [],\n onSelectedRows,\n pagination = false,\n rowsPerPage = 10,\n onRowsPerPageChange,\n rowsPerPageOptions: _rowsPerPageOptions,\n rowsPerPageLabel: _rowsPerPageLabel,\n exportLabel = 'Exportar',\n exportFunction,\n rowsCount,\n page = 0,\n onPageChange,\n loading = false,\n skeletonComponent,\n emptyPlaceholder,\n ...rest\n}: DataGridProps<Data>): JSX.Element => {\n if (selectable && (!selectedRows || !onSelectedRows)) {\n throw new Error(\n '[DataGrid] You should specify selection handlers (selectedRows, onSelectedRows)'\n );\n }\n\n const rowsPerPageLabel = React.useCallback(\n value =>\n _rowsPerPageLabel\n ? _rowsPerPageLabel(value)\n : `Exibir por página: ${value} itens`,\n [_rowsPerPageLabel]\n );\n const rowsPerPageOptions = React.useMemo(\n () => _rowsPerPageOptions ?? [10, 25, 50],\n [_rowsPerPageOptions]\n );\n\n const handleSelect = React.useCallback(\n (current, checked) => {\n if (checked) {\n onSelectedRows?.(prevState => [...prevState, current]);\n return;\n }\n\n onSelectedRows?.(prevState => {\n const idx = prevState.findIndex(\n el => rowKeyExtractor(el) === rowKeyExtractor(current)\n );\n return [...removeElement(prevState, idx)];\n });\n },\n [onSelectedRows, rowKeyExtractor]\n );\n\n return (\n <TableContainer {...rest}>\n <TableToolbar\n title={toolbarTitle}\n rightIcons={toolbarRightIcons}\n footer={toolbarFooter}\n />\n <Table>\n <Header\n selectable={selectable}\n headers={headers}\n data={data}\n rowsCount={rowsCount ?? data.length}\n rowKeyExtractor={rowKeyExtractor}\n selectedRows={selectedRows}\n onSelected={onSelectedRows}\n />\n\n {!loading ? (\n <TBody>\n {data.length > 0 ? (\n getData(\n data,\n rowsCount,\n page,\n rowsPerPage,\n pagination\n ).map(item => (\n <Row\n key={rowKeyExtractor(item)}\n rowKeyExtractor={rowKeyExtractor}\n handleSelect={handleSelect}\n selectable={selectable}\n headers={headers}\n data={item}\n checked={selectedRows?.some(\n sel => rowKeyExtractor(sel) === rowKeyExtractor(item)\n )}\n />\n ))\n ) : (\n <tr>\n <td colSpan={99}>{emptyPlaceholder}</td>\n </tr>\n )}\n </TBody>\n ) : (\n <TBody>\n {[...Array(rowsPerPage).keys()].map(idx => (\n <Tr key={`skeleton-${idx}`}>\n <Td colSpan={99} style={{ padding: 0 }}>\n {skeletonComponent ?? (\n <Skeleton height={55} radius=\"mili\" animation=\"wave\">\n <div style={{ width: '100%' }} />\n </Skeleton>\n )}\n </Td>\n </Tr>\n ))}\n </TBody>\n )}\n\n <Footer\n exportFunction={exportFunction}\n exportLabel={exportLabel}\n rowsPerPageLabel={rowsPerPageLabel}\n rowsPerPage={rowsPerPage}\n onRowsPerPageChange={onRowsPerPageChange}\n rowsPerPageOptions={rowsPerPageOptions}\n rowsCount={rowsCount ?? data.length}\n page={page}\n onPageChange={onPageChange}\n pagination={pagination}\n />\n </Table>\n </TableContainer>\n );\n};\n\nexport default DataGrid;\n"],"file":"DataGrid.js"}
1
+ {"version":3,"sources":["../../../../src/components/organisms/DataGrid/DataGrid.tsx"],"names":["DataGrid","headers","data","rowKeyExtractor","toolbarTitle","toolbarFooter","toolbarRightIcons","selectable","selectedRows","onSelectedRows","pagination","rowsPerPage","onRowsPerPageChange","rowsPerPageOptions","_rowsPerPageOptions","rowsPerPageLabel","_rowsPerPageLabel","exportLabel","exportFunction","rowsCount","page","onPageChange","loading","skeletonComponent","emptyPlaceholder","rest","Error","React","useCallback","value","useMemo","handleSelect","current","checked","prevState","idx","findIndex","el","length","map","item","some","sel","Array","keys","padding","width","Number"],"mappings":";;;;;;;AAAA;;AACA;;AAQA;;AACA;;AAEA;;AACA;;AACA;;;;AA2CA,MAAMA,QAAQ,GAAG,CAAuB;AACtCC,EAAAA,OADsC;AAEtCC,EAAAA,IAFsC;AAGtCC,EAAAA,eAHsC;AAItCC,EAAAA,YAJsC;AAKtCC,EAAAA,aALsC;AAMtCC,EAAAA,iBANsC;AAOtCC,EAAAA,UAAU,GAAG,KAPyB;AAQtCC,EAAAA,YAAY,GAAG,EARuB;AAStCC,EAAAA,cATsC;AAUtCC,EAAAA,UAAU,GAAG,KAVyB;AAWtCC,EAAAA,WAAW,GAAG,EAXwB;AAYtCC,EAAAA,mBAZsC;AAatCC,EAAAA,kBAAkB,EAAEC,mBAbkB;AActCC,EAAAA,gBAAgB,EAAEC,iBAdoB;AAetCC,EAAAA,WAAW,GAAG,UAfwB;AAgBtCC,EAAAA,cAhBsC;AAiBtCC,EAAAA,SAjBsC;AAkBtCC,EAAAA,IAAI,GAAG,CAlB+B;AAmBtCC,EAAAA,YAnBsC;AAoBtCC,EAAAA,OAAO,GAAG,KApB4B;AAqBtCC,EAAAA,iBArBsC;AAsBtCC,EAAAA,gBAtBsC;AAuBtC,KAAGC;AAvBmC,CAAvB,KAwBuB;AACtC,MAAIlB,UAAU,KAAK,CAACC,YAAD,IAAiB,CAACC,cAAvB,CA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C,MAA7B;AAAoC,IAAA,SAAS,EAAC;AAA9C,KACE;AAAK,IAAA,KAAK,EAAE;AAAEuB,MAAAA,KAAK,EAAE;AAAT;AAAZ,IADF,CAFJ,CADF,CADD,CADH,CAxCJ,EAuDG,CAACC,MAAM,CAAC5B,SAAD,CAAN,GAAoB,CAApB,IAAyBjB,IAAI,CAACoC,MAAL,GAAc,CAAxC,KACC,6BAAC,cAAD;AACE,IAAA,cAAc,EAAEpB,cADlB;AAEE,IAAA,WAAW,EAAED,WAFf;AAGE,IAAA,gBAAgB,EAAEF,gBAHpB;AAIE,IAAA,WAAW,EAAEJ,WAJf;AAKE,IAAA,mBAAmB,EAAEC,mBALvB;AAME,IAAA,kBAAkB,EAAEC,kBANtB;AAOE,IAAA,SAAS,EAAEM,SAAS,IAAIjB,IAAI,CAACoC,MAP/B;AAQE,IAAA,IAAI,EAAElB,IARR;AASE,IAAA,YAAY,EAAEC,YAThB;AAUE,IAAA,UAAU,EAAEX;AAVd,IAxDJ,CANF,CADF;AA+ED,CA3ID;;eA6IeV,Q","sourcesContent":["import React from 'react';\nimport {\n Table,\n TableToolbar,\n TableContainer,\n Tr,\n Td,\n TBody,\n} from '../../atoms/Table';\nimport { Header } from './Header';\nimport { Row } from './Row';\nimport { HeadersType } from './types';\nimport { Footer } from './Footer';\nimport { Skeleton } from '../../atoms/Skeleton';\nimport { getData, removeElement } from './utils';\n\nexport interface DataGridProps<Data>\n extends React.HTMLAttributes<HTMLDivElement> {\n headers: HeadersType<Data>[];\n data: Data[];\n /** Unique identifier for row data */\n rowKeyExtractor: (data: Data) => string;\n toolbarRightIcons?: React.ReactNode;\n toolbarFooter?: React.ReactNode;\n toolbarTitle: string;\n /** Enable rows selection */\n selectable?: boolean;\n /** Selected items */\n selectedRows?: Data[];\n /** Selection handler */\n onSelectedRows?: (data: Data[] | ((prevState: Data[]) => Data[])) => void;\n /** Shows pagination controls */\n pagination?: boolean;\n /** Results per page */\n rowsPerPage?: number;\n /** Results per page handler */\n onRowsPerPageChange?: (value: number) => void;\n rowsPerPageOptions?: number[];\n rowsPerPageLabel?: (value: number) => string;\n /** Export button label */\n exportLabel?: string;\n exportFunction?: () => void;\n /** Total data elements. Only specify this property if your data is server-side */\n rowsCount?: number;\n /** Current page. Always start in 0 */\n page?: number;\n /** Current page handler */\n onPageChange?: (page: number) => void;\n /** Loading state. The amount of skeleton rows is based on current rowsPerPage */\n loading?: boolean;\n /** Custom skeleton component for better visual */\n skeletonComponent?: React.ReactNode;\n /** Empty state placeholder */\n emptyPlaceholder?: React.ReactNode;\n}\n\n/** Note: Consider memoizing functions for a better performance */\nconst DataGrid = <Data extends unknown>({\n headers,\n data,\n rowKeyExtractor,\n toolbarTitle,\n toolbarFooter,\n toolbarRightIcons,\n selectable = false,\n selectedRows = [],\n onSelectedRows,\n pagination = false,\n rowsPerPage = 10,\n onRowsPerPageChange,\n rowsPerPageOptions: _rowsPerPageOptions,\n rowsPerPageLabel: _rowsPerPageLabel,\n exportLabel = 'Exportar',\n exportFunction,\n rowsCount,\n page = 0,\n onPageChange,\n loading = false,\n skeletonComponent,\n emptyPlaceholder,\n ...rest\n}: DataGridProps<Data>): JSX.Element => {\n if (selectable && (!selectedRows || !onSelectedRows)) {\n throw new Error(\n '[DataGrid] You should specify selection handlers (selectedRows, onSelectedRows)'\n );\n }\n\n const rowsPerPageLabel = React.useCallback(\n value =>\n _rowsPerPageLabel\n ? _rowsPerPageLabel(value)\n : `Exibir por página: ${value} itens`,\n [_rowsPerPageLabel]\n );\n const rowsPerPageOptions = React.useMemo(\n () => _rowsPerPageOptions ?? [10, 25, 50],\n [_rowsPerPageOptions]\n );\n\n const handleSelect = React.useCallback(\n (current, checked) => {\n if (checked) {\n onSelectedRows?.(prevState => [...prevState, current]);\n return;\n }\n\n onSelectedRows?.(prevState => {\n const idx = prevState.findIndex(\n el => rowKeyExtractor(el) === rowKeyExtractor(current)\n );\n return [...removeElement(prevState, idx)];\n });\n },\n [onSelectedRows, rowKeyExtractor]\n );\n\n return (\n <TableContainer {...rest}>\n <TableToolbar\n title={toolbarTitle}\n rightIcons={toolbarRightIcons}\n footer={toolbarFooter}\n />\n <Table>\n <Header\n selectable={selectable}\n headers={headers}\n data={data}\n rowsCount={rowsCount ?? data.length}\n rowKeyExtractor={rowKeyExtractor}\n selectedRows={selectedRows}\n onSelected={onSelectedRows}\n />\n\n {!loading ? (\n <TBody>\n {data.length > 0 ? (\n getData(\n data,\n rowsCount,\n page,\n rowsPerPage,\n pagination\n ).map(item => (\n <Row\n key={rowKeyExtractor(item)}\n rowKeyExtractor={rowKeyExtractor}\n handleSelect={handleSelect}\n selectable={selectable}\n headers={headers}\n data={item}\n checked={selectedRows?.some(\n sel => rowKeyExtractor(sel) === rowKeyExtractor(item)\n )}\n />\n ))\n ) : (\n <tr>\n <td colSpan={99}>{emptyPlaceholder}</td>\n </tr>\n )}\n </TBody>\n ) : (\n <TBody>\n {[...Array(rowsPerPage).keys()].map(idx => (\n <Tr key={`skeleton-${idx}`}>\n <Td colSpan={99} style={{ padding: 0 }}>\n {skeletonComponent ?? (\n <Skeleton height={55} radius=\"mili\" animation=\"wave\">\n <div style={{ width: '100%' }} />\n </Skeleton>\n )}\n </Td>\n </Tr>\n ))}\n </TBody>\n )}\n\n {(Number(rowsCount) > 0 || data.length > 0) && (\n <Footer\n exportFunction={exportFunction}\n exportLabel={exportLabel}\n rowsPerPageLabel={rowsPerPageLabel}\n rowsPerPage={rowsPerPage}\n onRowsPerPageChange={onRowsPerPageChange}\n rowsPerPageOptions={rowsPerPageOptions}\n rowsCount={rowsCount ?? data.length}\n page={page}\n onPageChange={onPageChange}\n pagination={pagination}\n />\n )}\n </Table>\n </TableContainer>\n );\n};\n\nexport default DataGrid;\n"],"file":"DataGrid.js"}
@@ -74,7 +74,8 @@ const Footer = ({
74
74
  value: rowsPerPage,
75
75
  type: 'single',
76
76
  keyExtractor: value => String(value),
77
- labelExtractor: rowsPerPageLabel
77
+ labelExtractor: rowsPerPageLabel,
78
+ anchor: "top"
78
79
  })), exportFunction && _react.default.createElement(_styled.HoveredText, null, _react.default.createElement(_reactWebKit.Button, {
79
80
  variant: "outlined",
80
81
  onPress: () => exportFunction()
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/components/organisms/DataGrid/Footer/Footer.tsx"],"names":["Footer","rowsPerPage","onRowsPerPageChange","rowsPerPageOptions","rowsPerPageLabel","exportFunction","exportLabel","rowsCount","page","onPageChange","pagination","Error","getPaginationSlice","totalPages","Math","ceil","start","end","handleRowsPerPage","React","useCallback","value","String","Array","keys","slice","map","memo"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;AA0BA,MAAMA,MAAqC,GAAG,CAAC;AAC7CC,EAAAA,WAD6C;AAE7CC,EAAAA,mBAF6C;AAG7CC,EAAAA,kBAH6C;AAI7CC,EAAAA,gBAJ6C;AAK7CC,EAAAA,cAL6C;AAM7CC,EAAAA,WAN6C;AAO7CC,EAAAA,SAP6C;AAQ7CC,EAAAA,IAR6C;AAS7CC,EAAAA,YAT6C;AAU7CC,EAAAA;AAV6C,CAAD,KAWxC;AACJ,MAAIA,UAAU,KAAK,CAACD,YAAD,IAAiB,CAACP,mBAAvB,CAAd,EAA2D;AACzD,UAAM,IAAIS,KAAJ,CACJ,uFADI,CAAN;AAGD;;AAED,QAAMC,kBAAkB,GAAG,MAAsC;AAC/D,UAAMC,UAAU,GAAGC,IAAI,CAACC,IAAL,CAAUR,SAAS,GAAGN,WAAtB,CAAnB;;AACA,QAAIY,UAAU,GAAG,CAAjB,EAAoB;AAClB,aAAO;AAAEG,QAAAA,KAAK,EAAE,CAAT;AAAYC,QAAAA,GAAG,EAAEJ;AAAjB,OAAP;AACD;;AACD,QAAIL,IAAI,KAAK,CAAb,EAAgB;AACd,aAAO;AAAEQ,QAAAA,KAAK,EAAER,IAAT;AAAeS,QAAAA,GAAG,EAAET,IAAI,GAAG;AAA3B,OAAP;AACD;;AACD,QAAIA,IAAI,KAAKK,UAAU,GAAG,CAA1B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AzBJ,CADF,CADF,CADF,CADF;AAyED,CAjHD;;eAmHekB,eAAMQ,IAAN,CAAW3B,MAAX,C","sourcesContent":["import React from 'react';\nimport { Button, Icon, Select, Text } from '@tecsinapse/react-web-kit';\nimport { TFoot, Tr } from '../../../atoms/Table';\nimport {\n FooterContainer,\n FooterContainerEnd,\n FooterContainerStart,\n HoveredText,\n NavigationButton,\n PageButton,\n PagesContainer,\n SelectContainer,\n TdFooterStyled,\n} from './styled';\n\ninterface DataGridFooterProps {\n rowsPerPage: number;\n onRowsPerPageChange?: (value: number) => void;\n rowsPerPageOptions: number[];\n rowsPerPageLabel: (value: number) => string;\n exportLabel?: string;\n exportFunction?: () => void;\n /** Total data elements */\n rowsCount: number;\n page: number;\n onPageChange?: (page: number) => void;\n pagination: boolean;\n}\n\nconst Footer: React.FC<DataGridFooterProps> = ({\n rowsPerPage,\n onRowsPerPageChange,\n rowsPerPageOptions,\n rowsPerPageLabel,\n exportFunction,\n exportLabel,\n rowsCount,\n page,\n onPageChange,\n pagination,\n}) => {\n if (pagination && (!onPageChange || !onRowsPerPageChange)) {\n throw new Error(\n '[DataGrid] You should specify pagination handlers (onPageChange, onRowsPerPageChange)'\n );\n }\n\n const getPaginationSlice = (): { start: number; end: number } => {\n const totalPages = Math.ceil(rowsCount / rowsPerPage);\n if (totalPages < 4) {\n return { start: 0, end: totalPages };\n }\n if (page === 0) {\n return { start: page, end: page + 3 };\n }\n if (page === totalPages - 1) {\n return { start: page - 2, end: page + 1 };\n }\n return { start: page - 1, end: page + 2 };\n };\n\n const handleRowsPerPage = React.useCallback(\n value => {\n onRowsPerPageChange?.(value as number);\n onPageChange?.(0);\n },\n [onPageChange, onRowsPerPageChange]\n );\n\n return (\n <TFoot>\n <Tr>\n <TdFooterStyled colSpan={99}>\n <FooterContainer>\n <FooterContainerStart>\n {pagination && (\n <SelectContainer>\n <Select\n options={rowsPerPageOptions}\n onSelect={handleRowsPerPage}\n value={rowsPerPage}\n type={'single'}\n keyExtractor={value => String(value)}\n labelExtractor={rowsPerPageLabel}\n />\n </SelectContainer>\n )}\n {exportFunction && (\n <HoveredText>\n <Button variant=\"outlined\" onPress={() => exportFunction()}>\n <Text fontColor=\"orange\" fontWeight=\"bold\">\n {exportLabel}\n </Text>\n </Button>\n </HoveredText>\n )}\n </FooterContainerStart>\n {pagination && (\n <FooterContainerEnd>\n <NavigationButton\n onPress={() => onPageChange?.(page - 1)}\n disabled={page === 0}\n >\n <Icon\n name={'chevron-left'}\n type={'material-community'}\n fontColor={'light'}\n />\n </NavigationButton>\n <PagesContainer>\n {[...Array(Math.ceil(rowsCount / rowsPerPage)).keys()]\n .slice(getPaginationSlice().start, getPaginationSlice().end)\n .map(value => (\n <HoveredText key={`page-${value}`}>\n <PageButton\n variant={page === value ? 'outlined' : 'text'}\n onPress={() => onPageChange?.(value)}\n >\n <Text fontColor=\"medium\" fontWeight=\"bold\">\n {value + 1}\n </Text>\n </PageButton>\n </HoveredText>\n ))}\n </PagesContainer>\n <NavigationButton\n onPress={() => onPageChange?.(page + 1)}\n disabled={page === Math.ceil(rowsCount / rowsPerPage) - 1}\n >\n <Icon\n name={'chevron-right'}\n type={'material-community'}\n fontColor={'light'}\n />\n </NavigationButton>\n </FooterContainerEnd>\n )}\n </FooterContainer>\n </TdFooterStyled>\n </Tr>\n </TFoot>\n );\n};\n\nexport default React.memo(Footer);\n"],"file":"Footer.js"}
1
+ {"version":3,"sources":["../../../../../src/components/organisms/DataGrid/Footer/Footer.tsx"],"names":["Footer","rowsPerPage","onRowsPerPageChange","rowsPerPageOptions","rowsPerPageLabel","exportFunction","exportLabel","rowsCount","page","onPageChange","pagination","Error","getPaginationSlice","totalPages","Math","ceil","start","end","handleRowsPerPage","React","useCallback","value","String","Array","keys","slice","map","memo"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;AA0BA,MAAMA,MAAqC,GAAG,CAAC;AAC7CC,EAAAA,WAD6C;AAE7CC,EAAAA,mBAF6C;AAG7CC,EAAAA,k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oCJ,kBAAkB,GAAGK,GADzD,EAEES,GAFF,CAEML,KAAK,IACR,6BAAC,mBAAD;AAAa,IAAA,GAAG,EAAG,QAAOA,KAAM;AAAhC,KACE,6BAAC,kBAAD;AACE,IAAA,OAAO,EAAEb,IAAI,KAAKa,KAAT,GAAiB,UAAjB,GAA8B,MADzC;AAEE,IAAA,OAAO,EAAE,MAAMZ,YAAN,aAAMA,YAAN,uBAAMA,YAAY,CAAGY,KAAH;AAF7B,KAIE,6BAAC,iBAAD;AAAM,IAAA,SAAS,EAAC,QAAhB;AAAyB,IAAA,UAAU,EAAC;AAApC,KACGA,KAAK,GAAG,CADX,CAJF,CADF,CAHH,CADH,CAXF,EA2BE,6BAAC,wBAAD;AACE,IAAA,OAAO,EAAE,MAAMZ,YAAN,aAAMA,YAAN,uBAAMA,YAAY,CAAGD,IAAI,GAAG,CAAV,CAD7B;AAEE,IAAA,QAAQ,EAAEA,IAAI,KAAKM,IAAI,CAACC,IAAL,CAAUR,SAAS,GAAGN,WAAtB,IAAqC;AAF1D,KAIE,6BAAC,iBAAD;AACE,IAAA,IAAI,EAAE,eADR;AAEE,IAAA,IAAI,EAAE,oBAFR;AAGE,IAAA,SAAS,EAAE;AAHb,IAJF,CA3BF,CA1BJ,CADF,CADF,CADF,CADF;AA0ED,CAlHD;;eAoHekB,eAAMQ,IAAN,CAAW3B,MAAX,C","sourcesContent":["import React from 'react';\nimport { Button, Icon, Select, Text } from '@tecsinapse/react-web-kit';\nimport { TFoot, Tr } from '../../../atoms/Table';\nimport {\n FooterContainer,\n FooterContainerEnd,\n FooterContainerStart,\n HoveredText,\n NavigationButton,\n PageButton,\n PagesContainer,\n SelectContainer,\n TdFooterStyled,\n} from './styled';\n\ninterface DataGridFooterProps {\n rowsPerPage: number;\n onRowsPerPageChange?: (value: number) => void;\n rowsPerPageOptions: number[];\n rowsPerPageLabel: (value: number) => string;\n exportLabel?: string;\n exportFunction?: () => void;\n /** Total data elements */\n rowsCount: number;\n page: number;\n onPageChange?: (page: number) => void;\n pagination: boolean;\n}\n\nconst Footer: React.FC<DataGridFooterProps> = ({\n rowsPerPage,\n onRowsPerPageChange,\n rowsPerPageOptions,\n rowsPerPageLabel,\n exportFunction,\n exportLabel,\n rowsCount,\n page,\n onPageChange,\n pagination,\n}) => {\n if (pagination && (!onPageChange || !onRowsPerPageChange)) {\n throw new Error(\n '[DataGrid] You should specify pagination handlers (onPageChange, onRowsPerPageChange)'\n );\n }\n\n const getPaginationSlice = (): { start: number; end: number } => {\n const totalPages = Math.ceil(rowsCount / rowsPerPage);\n if (totalPages < 4) {\n return { start: 0, end: totalPages };\n }\n if (page === 0) {\n return { start: page, end: page + 3 };\n }\n if (page === totalPages - 1) {\n return { start: page - 2, end: page + 1 };\n }\n return { start: page - 1, end: page + 2 };\n };\n\n const handleRowsPerPage = React.useCallback(\n value => {\n onRowsPerPageChange?.(value as number);\n onPageChange?.(0);\n },\n [onPageChange, onRowsPerPageChange]\n );\n\n return (\n <TFoot>\n <Tr>\n <TdFooterStyled colSpan={99}>\n <FooterContainer>\n <FooterContainerStart>\n {pagination && (\n <SelectContainer>\n <Select\n options={rowsPerPageOptions}\n onSelect={handleRowsPerPage}\n value={rowsPerPage}\n type={'single'}\n keyExtractor={value => String(value)}\n labelExtractor={rowsPerPageLabel}\n anchor=\"top\"\n />\n </SelectContainer>\n )}\n {exportFunction && (\n <HoveredText>\n <Button variant=\"outlined\" onPress={() => exportFunction()}>\n <Text fontColor=\"orange\" fontWeight=\"bold\">\n {exportLabel}\n </Text>\n </Button>\n </HoveredText>\n )}\n </FooterContainerStart>\n {pagination && (\n <FooterContainerEnd>\n <NavigationButton\n onPress={() => onPageChange?.(page - 1)}\n disabled={page === 0}\n >\n <Icon\n name={'chevron-left'}\n type={'material-community'}\n fontColor={'light'}\n />\n </NavigationButton>\n <PagesContainer>\n {[...Array(Math.ceil(rowsCount / rowsPerPage)).keys()]\n .slice(getPaginationSlice().start, getPaginationSlice().end)\n .map(value => (\n <HoveredText key={`page-${value}`}>\n <PageButton\n variant={page === value ? 'outlined' : 'text'}\n onPress={() => onPageChange?.(value)}\n >\n <Text fontColor=\"medium\" fontWeight=\"bold\">\n {value + 1}\n </Text>\n </PageButton>\n </HoveredText>\n ))}\n </PagesContainer>\n <NavigationButton\n onPress={() => onPageChange?.(page + 1)}\n disabled={page === Math.ceil(rowsCount / rowsPerPage) - 1}\n >\n <Icon\n name={'chevron-right'}\n type={'material-community'}\n fontColor={'light'}\n />\n </NavigationButton>\n </FooterContainerEnd>\n )}\n </FooterContainer>\n </TdFooterStyled>\n </Tr>\n </TFoot>\n );\n};\n\nexport default React.memo(Footer);\n"],"file":"Footer.js"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/components/organisms/DataGrid/Header/Header.tsx"],"names":["Header","selectable","rowsCount","headers","data","rowKeyExtractor","selectedRows","onSelected","sortDirection","setSortDirection","React","useState","NEXT_STATE","initial","handleSortDirection","sort","handleSelectAll","checked","currentItemsOnData","unselectedItemsOnData","length","concat","map","label","justifyContent","display","alignItems","marginLeft"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;;;AAkBA,MAAMA,MAAM,GAAG,CAAuB;AACpCC,EAAAA,UADoC;AAEpCC,EAAAA,SAFoC;AAGpCC,EAAAA,OAHoC;AAIpCC,EAAAA,IAJoC;AAKpCC,EAAAA,eALoC;AAMpCC,EAAAA,YANoC;AAOpCC,EAAAA;AAPoC,CAAvB,KAQ+B;AAC5C,QAAM,CAACC,aAAD,EAAgBC,gBAAhB,IAAoCC,eAAMC,QAAN,CACxCC,kBAAWC,OAD6B,CAA1C;;AAIA,QAAMC,mBAAmB,GAAGC,IAAI,IAAI;AAClCA,IAAAA,IAAI,CAACH,kBAAWJ,aAAX,CAAD,CAAJ;AACAC,IAAAA,gBAAgB,CAACG,kBAAWJ,aAAX,CAAD,CAAhB;AACD,GAHD;;AAKA,QAAMQ,eAAe,GAAGC,OAAO,IAAI;AACjC,QAAI,CAACA,OAAL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MAAAA;AAHK;AADT,KAOGD,KAPH,EAQGR,IAAI,IACH;AAAK,IAAA,KAAK,EAAE;AAAEY,MAAAA,UAAU,EAAE;AAAd;AAAZ,KACE,6BAAC,2BAAD;AAAkB,IAAA,OAAO,EAAE,MAAMb,mBAAmB,CAACC,IAAD;AAApD,KACE,6BAAC,eAAD;AACE,IAAA,IAAI,EAAG,qBAAoB,0BAAcP,aAAd,CAA6B,EAD1D;AAEE,IAAA,IAAI,EAAE,oBAFR;AAGE,IAAA,SAAS,EAAE,yBAAaA,aAAb;AAHb,IADF,CADF,CATJ,CADF,CADD,CATH,CADF,CADF;AAsCD,CArFD;;eAuFeR,M","sourcesContent":["import React from 'react';\nimport { Checkbox, Icon, PressableSurface } from '@tecsinapse/react-core';\nimport { Th, THead, Tr } from '../../../atoms/Table';\nimport { CheckboxHeader } from './styled';\nimport { HeadersType } from '../types';\nimport {\n findCurrentItemsOnData,\n findUnselectedItemsOnData,\n getIconColor,\n getIconSuffix,\n NEXT_STATE,\n} from './utils';\n\nexport interface DataGridHeaderProps<Data> {\n headers: HeadersType<Data>[];\n data: Data[];\n selectedRows: Data[];\n onSelected?: (data: Data[]) => void;\n rowKeyExtractor: (data: Data) => string;\n rowsCount: number;\n selectable?: boolean;\n}\n\nconst Header = <Data extends unknown>({\n selectable,\n rowsCount,\n headers,\n data,\n rowKeyExtractor,\n selectedRows,\n onSelected,\n}: DataGridHeaderProps<Data>): JSX.Element => {\n const [sortDirection, setSortDirection] = React.useState<string>(\n NEXT_STATE.initial\n );\n\n const handleSortDirection = sort => {\n sort(NEXT_STATE[sortDirection]);\n setSortDirection(NEXT_STATE[sortDirection]);\n };\n\n const handleSelectAll = checked => {\n if (!checked) {\n onSelected?.([]);\n return;\n }\n\n const currentItemsOnData = findCurrentItemsOnData(\n selectedRows,\n data,\n rowKeyExtractor\n );\n\n const unselectedItemsOnData = findUnselectedItemsOnData(\n selectedRows,\n data,\n rowKeyExtractor\n );\n\n if (checked && selectedRows.length < 1) {\n onSelected?.(data);\n return;\n }\n if (checked && currentItemsOnData.length < 1) {\n onSelected?.(unselectedItemsOnData.concat(selectedRows));\n return;\n }\n onSelected?.(selectedRows.concat(unselectedItemsOnData));\n };\n\n return (\n <THead>\n <Tr>\n {selectable && (\n <CheckboxHeader>\n <Checkbox\n checked={rowsCount === selectedRows?.length}\n onChange={handleSelectAll}\n />\n </CheckboxHeader>\n )}\n {headers.map(({ label, sort, justifyContent = 'flex-start' }) => (\n <Th key={label}>\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n justifyContent,\n }}\n >\n {label}\n {sort && (\n <div style={{ marginLeft: 8 }}>\n <PressableSurface onPress={() => handleSortDirection(sort)}>\n <Icon\n name={`sort-alphabetical-${getIconSuffix(sortDirection)}`}\n type={'material-community'}\n fontColor={getIconColor(sortDirection)}\n />\n </PressableSurface>\n </div>\n )}\n </div>\n </Th>\n ))}\n </Tr>\n </THead>\n );\n};\n\nexport default Header;\n"],"file":"Header.js"}
1
+ {"version":3,"sources":["../../../../../src/components/organisms/DataGrid/Header/Header.tsx"],"names":["Header","selectable","rowsCount","headers","data","rowKeyExtractor","selectedRows","onSelected","sortDirection","setSortDirection","React","useState","NEXT_STATE","initial","handleSortDirection","sort","handleSelectAll","checked","currentItemsOnData","unselectedItemsOnData","length","concat","map","label","justifyContent","display","alignItems","marginLeft"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;;;AAkBA,MAAMA,MAAM,GAAG,CAAuB;AACpCC,EAAAA,UADoC;AAEpCC,EAAAA,SAFoC;AAGpCC,EAAAA,OAHoC;AAIpCC,EAAAA,IAJoC;AAKpCC,EAAAA,eALoC;AAMpCC,EAAAA,YANoC;AAOpCC,EAAAA;AAPoC,CAAvB,KAQ+B;AAC5C,QAAM,CAACC,aAAD,EAAgBC,gBAAhB,IAAoCC,eAAMC,QAAN,CACxCC,kBAAWC,OAD6B,CAA1C;;AAIA,QAAMC,mBAAmB,GAAGC,IAAI,IAAI;AAClCA,I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IAAAA,cAAc,GAAG;AAAhC,GAAD,KACX,6BAAC,SAAD;AAAI,IAAA,GAAG,EAAED;AAAT,KACE;AACE,IAAA,KAAK,EAAE;AACLE,MAAAA,OAAO,EAAE,MADJ;AAELC,MAAAA,UAAU,EAAE,QAFP;AAGLF,MAAAA;AAHK;AADT,KAOGD,KAPH,EAQGR,IAAI,IACH;AAAK,IAAA,KAAK,EAAE;AAAEY,MAAAA,UAAU,EAAE;AAAd;AAAZ,KACE,6BAAC,2BAAD;AAAkB,IAAA,OAAO,EAAE,MAAMb,mBAAmB,CAACC,IAAD;AAApD,KACE,6BAAC,eAAD;AACE,IAAA,IAAI,EAAG,qBAAoB,0BAAcP,aAAd,CAA6B,EAD1D;AAEE,IAAA,IAAI,EAAE,oBAFR;AAGE,IAAA,SAAS,EAAE,yBAAaA,aAAb;AAHb,IADF,CADF,CATJ,CADF,CADD,CATH,CADF,CADF;AAsCD,CArFD;;eAuFeR,M","sourcesContent":["import React from 'react';\nimport { Checkbox, Icon, PressableSurface } from '@tecsinapse/react-core';\nimport { Th, THead, Tr } from '../../../atoms/Table';\nimport { CheckboxHeader } from './styled';\nimport { HeadersType, SortState } from '../types';\nimport {\n findCurrentItemsOnData,\n findUnselectedItemsOnData,\n getIconColor,\n getIconSuffix,\n NEXT_STATE,\n} from './utils';\n\nexport interface DataGridHeaderProps<Data> {\n headers: HeadersType<Data>[];\n data: Data[];\n selectedRows: Data[];\n onSelected?: (data: Data[]) => void;\n rowKeyExtractor: (data: Data) => string;\n rowsCount: number;\n selectable?: boolean;\n}\n\nconst Header = <Data extends unknown>({\n selectable,\n rowsCount,\n headers,\n data,\n rowKeyExtractor,\n selectedRows,\n onSelected,\n}: DataGridHeaderProps<Data>): JSX.Element => {\n const [sortDirection, setSortDirection] = React.useState<SortState>(\n NEXT_STATE.initial\n );\n\n const handleSortDirection = sort => {\n sort(NEXT_STATE[sortDirection]);\n setSortDirection(NEXT_STATE[sortDirection]);\n };\n\n const handleSelectAll = checked => {\n if (!checked) {\n onSelected?.([]);\n return;\n }\n\n const currentItemsOnData = findCurrentItemsOnData(\n selectedRows,\n data,\n rowKeyExtractor\n );\n\n const unselectedItemsOnData = findUnselectedItemsOnData(\n selectedRows,\n data,\n rowKeyExtractor\n );\n\n if (checked && selectedRows.length < 1) {\n onSelected?.(data);\n return;\n }\n if (checked && currentItemsOnData.length < 1) {\n onSelected?.(unselectedItemsOnData.concat(selectedRows));\n return;\n }\n onSelected?.(selectedRows.concat(unselectedItemsOnData));\n };\n\n return (\n <THead>\n <Tr>\n {selectable && (\n <CheckboxHeader>\n <Checkbox\n checked={rowsCount === selectedRows?.length}\n onChange={handleSelectAll}\n />\n </CheckboxHeader>\n )}\n {headers.map(({ label, sort, justifyContent = 'flex-start' }) => (\n <Th key={label}>\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n justifyContent,\n }}\n >\n {label}\n {sort && (\n <div style={{ marginLeft: 8 }}>\n <PressableSurface onPress={() => handleSortDirection(sort)}>\n <Icon\n name={`sort-alphabetical-${getIconSuffix(sortDirection)}`}\n type={'material-community'}\n fontColor={getIconColor(sortDirection)}\n />\n </PressableSurface>\n </div>\n )}\n </div>\n </Th>\n ))}\n </Tr>\n </THead>\n );\n};\n\nexport default Header;\n"],"file":"Header.js"}
@@ -1,10 +1,8 @@
1
+ import { SortState } from '../types';
1
2
  export declare const NEXT_STATE: {
2
- unsorted: string;
3
- ascending: string;
4
- descending: string;
5
- initial: string;
3
+ [key: string]: SortState;
6
4
  };
7
- export declare const getIconSuffix: (state: any) => any;
8
- export declare const getIconColor: (state: any) => "medium" | "orange";
9
- export declare const findUnselectedItemsOnData: (selected: any, data: any, rowKeyExtractor: any) => any;
10
- export declare const findCurrentItemsOnData: (selected: any, data: any, rowKeyExtractor: any) => any;
5
+ export declare const getIconSuffix: (state: SortState) => string;
6
+ export declare const getIconColor: (state: SortState) => 'medium' | 'orange';
7
+ export declare const findUnselectedItemsOnData: <T>(selected: T[], data: T[], rowKeyExtractor: (t: T) => string) => T[];
8
+ export declare const findCurrentItemsOnData: <T>(selected: T[], data: T[], rowKeyExtractor: (t: T) => string) => T[];
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/components/organisms/DataGrid/Header/utils.ts"],"names":["NEXT_STATE","unsorted","ascending","descending","initial","getIconSuffix","state","getIconColor","findUnselectedItemsOnData","selected","data","rowKeyExtractor","length","filter","item","every","rowData","findCurrentItemsOnData","some"],"mappings":";;;;;;AAAO,MAAMA,UAAU,GAAG;AACxBC,EAAAA,QAAQ,EAAE,WADc;AAExBC,EAAAA,SAAS,EAAE,YAFa;AAGxBC,EAAAA,UAAU,EAAE,UAHY;AAIxBC,EAAAA,OAAO,EAAE;AAJe,CAAnB;;;AAOA,MAAMC,aAAa,GAAGC,KAAK,IAChCA,KAAK,KAAK,UAAV,GAAuB,WAAvB,GAAqCA,KADhC;;;;AAGA,MAAMC,YAAY,GAAGD,KAAK,IAC/BA,KAAK,KAAK,UAAV,GAAuB,QAAvB,GAAkC,QAD7B;;;;AAGA,MAAME,yBAAyB,GAAG,CAACC,QAAD,EAAWC,IAAX,EAAiBC,eAAjB,KACvCF,QAAQ,CAACG,MAAT,GAAkB,CAAlB,GACIF,IAAI,CAACG,MAAL,CAAYC,IAAI,IACdL,QAAQ,CAACM,KAAT,CACEC,OAAO,IAAIL,eAAe,CAACK,OAAD,CAAf,KAA6BL,eAAe,CAACG,IAAD,CADzD,CADF,CADJ,GAMI,EAPC;;;;AASA,MAAMG,sBAAsB,GAAG,CAACR,QAAD,EAAWC,IAAX,EAAiBC,eAAjB,KACpCF,QAAQ,CAACG,MAAT,GAAkB,CAAlB,GACIH,QAAQ,CAACI,MAAT,CAAgBC,IAAI,IAClBJ,IAAI,CAACQ,IAAL,CAAUF,OAAO,IAAIL,eAAe,CAACK,OAAD,CAAf,KAA6BL,eAAe,CAACG,IAAD,CAAjE,CADF,CADJ,GAII,EALC","sourcesContent":["export const NEXT_STATE = {\n unsorted: 'ascending',\n ascending: 'descending',\n descending: 'unsorted',\n initial: 'unsorted',\n};\n\nexport const getIconSuffix = state =>\n state === 'unsorted' ? 'ascending' : state;\n\nexport const getIconColor = state =>\n state === 'unsorted' ? 'medium' : 'orange';\n\nexport const findUnselectedItemsOnData = (selected, data, rowKeyExtractor) =>\n selected.length > 0\n ? data.filter(item =>\n selected.every(\n rowData => rowKeyExtractor(rowData) !== rowKeyExtractor(item)\n )\n )\n : [];\n\nexport const findCurrentItemsOnData = (selected, data, rowKeyExtractor) =>\n selected.length > 0\n ? selected.filter(item =>\n data.some(rowData => rowKeyExtractor(rowData) === rowKeyExtractor(item))\n )\n : [];\n"],"file":"utils.js"}
1
+ {"version":3,"sources":["../../../../../src/components/organisms/DataGrid/Header/utils.ts"],"names":["NEXT_STATE","unsorted","ascending","descending","initial","getIconSuffix","state","getIconColor","findUnselectedItemsOnData","selected","data","rowKeyExtractor","length","filter","item","every","rowData","findCurrentItemsOnData","some"],"mappings":";;;;;;AAEO,MAAMA,UAAwC,GAAG;AACtDC,EAAAA,QAAQ,EAAE,WAD4C;AAEtDC,EAAAA,SAAS,EAAE,YAF2C;AAGtDC,EAAAA,UAAU,EAAE,UAH0C;AAItDC,EAAAA,OAAO,EAAE;AAJ6C,CAAjD;;;AAOA,MAAMC,aAAa,GAAIC,KAAD,IAC3BA,KAAK,KAAK,UAAV,GAAuB,WAAvB,GAAqCA,KADhC;;;;AAGA,MAAMC,YAAY,GAAID,KAAD,IAC1BA,KAAK,KAAK,UAAV,GAAuB,QAAvB,GAAkC,QAD7B;;;;AAGA,MAAME,yBAAyB,GAAG,CACvCC,QADuC,EAEvCC,IAFuC,EAGvCC,eAHuC,KAKvCF,QAAQ,CAACG,MAAT,GAAkB,CAAlB,GACIF,IAAI,CAACG,MAAL,CAAYC,IAAI,IACdL,QAAQ,CAACM,KAAT,CACEC,OAAO,IAAIL,eAAe,CAACK,OAAD,CAAf,KAA6BL,eAAe,CAACG,IAAD,CADzD,CADF,CADJ,GAMI,EAXC;;;;AAaA,MAAMG,sBAAsB,GAAG,CACpCR,QADoC,EAEpCC,IAFoC,EAGpCC,eAHoC,KAKpCF,QAAQ,CAACG,MAAT,GAAkB,CAAlB,GACIH,QAAQ,CAACI,MAAT,CAAgBC,IAAI,IAClBJ,IAAI,CAACQ,IAAL,CAAUF,OAAO,IAAIL,eAAe,CAACK,OAAD,CAAf,KAA6BL,eAAe,CAACG,IAAD,CAAjE,CADF,CADJ,GAII,EATC","sourcesContent":["import { SortState } from '../types';\n\nexport const NEXT_STATE: { [key: string]: SortState } = {\n unsorted: 'ascending',\n ascending: 'descending',\n descending: 'unsorted',\n initial: 'unsorted',\n};\n\nexport const getIconSuffix = (state: SortState): string =>\n state === 'unsorted' ? 'ascending' : state;\n\nexport const getIconColor = (state: SortState): 'medium' | 'orange' =>\n state === 'unsorted' ? 'medium' : 'orange';\n\nexport const findUnselectedItemsOnData = <T>(\n selected: T[],\n data: T[],\n rowKeyExtractor: (t: T) => string\n): T[] =>\n selected.length > 0\n ? data.filter(item =>\n selected.every(\n rowData => rowKeyExtractor(rowData) !== rowKeyExtractor(item)\n )\n )\n : [];\n\nexport const findCurrentItemsOnData = <T>(\n selected: T[],\n data: T[],\n rowKeyExtractor: (t: T) => string\n): T[] =>\n selected.length > 0\n ? selected.filter(item =>\n data.some(rowData => rowKeyExtractor(rowData) === rowKeyExtractor(item))\n )\n : [];\n"],"file":"utils.js"}
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
+ export declare type SortState = 'ascending' | 'descending' | 'unsorted';
2
3
  export declare type HeadersType<Data> = {
3
4
  label: string;
4
5
  render: (data: Data) => React.ReactNode;
5
- sort?: (direction: 'ascending' | 'descending' | 'unsorted') => void;
6
+ sort?: (direction: SortState) => void;
6
7
  justifyContent?: 'flex-start' | 'center' | 'flex-end';
7
8
  };
@@ -1,2 +1,2 @@
1
1
  import React from 'react';
2
- export declare const useClickAwayListener: (ref: React.MutableRefObject<any>, setVisible: React.Dispatch<React.SetStateAction<boolean>>) => void;
2
+ export declare const useClickAwayListener: (ref: React.MutableRefObject<any>, setVisible: React.Dispatch<React.SetStateAction<boolean>>, event?: 'mouseup' | 'mousedown' | undefined) => void;
@@ -9,7 +9,7 @@ var _react = _interopRequireDefault(require("react"));
9
9
 
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
11
 
12
- const useClickAwayListener = (ref, setVisible) => {
12
+ const useClickAwayListener = (ref, setVisible, event = 'mousedown') => {
13
13
  _react.default.useEffect(() => {
14
14
  const handleClickOutside = event => {
15
15
  if (ref.current && !ref.current.contains(event.target)) {
@@ -17,9 +17,9 @@ const useClickAwayListener = (ref, setVisible) => {
17
17
  }
18
18
  };
19
19
 
20
- document.addEventListener('mousedown', handleClickOutside);
20
+ document.addEventListener(event, handleClickOutside);
21
21
  return () => {
22
- document.removeEventListener('mousedown', handleClickOutside);
22
+ document.removeEventListener(event, handleClickOutside);
23
23
  };
24
24
  }, [ref]);
25
25
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/hooks/useClickAwayListener.ts"],"names":["useClickAwayListener","ref","setVisible","React","useEffect","handleClickOutside","event","current","contains","target","document","addEventListener","removeEventListener"],"mappings":";;;;;;;AAAA;;;;AAEO,MAAMA,oBAAoB,GAAG,CAClCC,GADkC,EAElCC,UAFkC,KAG/B;AACHC,iBAAMC,SAAN,CAAgB,MAAM;AACpB,UAAMC,kBAAkB,GAAGC,KAAK,IAAI;AAClC,UAAIL,GAAG,CAACM,OAAJ,IAAe,CAACN,GAAG,CAACM,OAAJ,CAAYC,QAAZ,CAAqBF,KAAK,CAACG,MAA3B,CAApB,EAAwD;AACtDP,QAAAA,UAAU,CAAC,KAAD,CAAV;AACD;AACF,KAJD;;AAKAQ,IAAAA,QAAQ,CAACC,gBAAT,CAA0B,WAA1B,EAAuCN,kBAAvC;AACA,WAAO,MAAM;AACXK,MAAAA,QAAQ,CAACE,mBAAT,CAA6B,WAA7B,EAA0CP,kBAA1C;AACD,KAFD;AAGD,GAVD,EAUG,CAACJ,GAAD,CAVH;AAWD,CAfM","sourcesContent":["import React from 'react';\n\nexport const useClickAwayListener = (\n ref: React.MutableRefObject<any>,\n setVisible: React.Dispatch<React.SetStateAction<boolean>>\n) => {\n React.useEffect(() => {\n const handleClickOutside = event => {\n if (ref.current && !ref.current.contains(event.target)) {\n setVisible(false);\n }\n };\n document.addEventListener('mousedown', handleClickOutside);\n return () => {\n document.removeEventListener('mousedown', handleClickOutside);\n };\n }, [ref]);\n};\n"],"file":"useClickAwayListener.js"}
1
+ {"version":3,"sources":["../../src/hooks/useClickAwayListener.ts"],"names":["useClickAwayListener","ref","setVisible","event","React","useEffect","handleClickOutside","current","contains","target","document","addEventListener","removeEventListener"],"mappings":";;;;;;;AAAA;;;;AAEO,MAAMA,oBAAoB,GAAG,CAClCC,GADkC,EAElCC,UAFkC,EAGlCC,KAA0C,GAAG,WAHX,KAIzB;AACTC,iBAAMC,SAAN,CAAgB,MAAM;AACpB,UAAMC,kBAAkB,GAAGH,KAAK,IAAI;AAClC,UAAIF,GAAG,CAACM,OAAJ,IAAe,CAACN,GAAG,CAACM,OAAJ,CAAYC,QAAZ,CAAqBL,KAAK,CAACM,MAA3B,CAApB,EAAwD;AACtDP,QAAAA,UAAU,CAAC,KAAD,CAAV;AACD;AACF,KAJD;;AAKAQ,IAAAA,QAAQ,CAACC,gBAAT,CAA0BR,KAA1B,EAAiCG,kBAAjC;AACA,WAAO,MAAM;AACXI,MAAAA,QAAQ,CAACE,mBAAT,CAA6BT,KAA7B,EAAoCG,kBAApC;AACD,KAFD;AAGD,GAVD,EAUG,CAACL,GAAD,CAVH;AAWD,CAhBM","sourcesContent":["import React from 'react';\n\nexport const useClickAwayListener = (\n ref: React.MutableRefObject<any>,\n setVisible: React.Dispatch<React.SetStateAction<boolean>>,\n event: 'mouseup' | 'mousedown' | undefined = 'mousedown'\n): void => {\n React.useEffect(() => {\n const handleClickOutside = event => {\n if (ref.current && !ref.current.contains(event.target)) {\n setVisible(false);\n }\n };\n document.addEventListener(event, handleClickOutside);\n return () => {\n document.removeEventListener(event, handleClickOutside);\n };\n }, [ref]);\n};\n"],"file":"useClickAwayListener.js"}
package/dist/index.d.ts CHANGED
@@ -14,4 +14,5 @@ export { Accordion, AccordionProps } from './components/atoms/Accordion';
14
14
  export { DataGrid, DataGridProps, HeadersType, } from './components/organisms/DataGrid';
15
15
  export { Modal, ModalProps } from './components/atoms/Modal';
16
16
  export { TextArea, TextAreaProps } from './components/molecules/TextArea';
17
+ export { Tooltip, ITooltip } from './components/atoms/Tooltip';
17
18
  export * from './hooks';
package/dist/index.js CHANGED
@@ -39,7 +39,9 @@ var _exportNames = {
39
39
  Modal: true,
40
40
  ModalProps: true,
41
41
  TextArea: true,
42
- TextAreaProps: true
42
+ TextAreaProps: true,
43
+ Tooltip: true,
44
+ ITooltip: true
43
45
  };
44
46
  Object.defineProperty(exports, "Badge", {
45
47
  enumerable: true,
@@ -257,6 +259,18 @@ Object.defineProperty(exports, "TextAreaProps", {
257
259
  return _TextArea.TextAreaProps;
258
260
  }
259
261
  });
262
+ Object.defineProperty(exports, "Tooltip", {
263
+ enumerable: true,
264
+ get: function () {
265
+ return _Tooltip.Tooltip;
266
+ }
267
+ });
268
+ Object.defineProperty(exports, "ITooltip", {
269
+ enumerable: true,
270
+ get: function () {
271
+ return _Tooltip.ITooltip;
272
+ }
273
+ });
260
274
 
261
275
  var _reactCore = require("@tecsinapse/react-core");
262
276
 
@@ -302,6 +316,8 @@ var _Modal = require("./components/atoms/Modal");
302
316
 
303
317
  var _TextArea = require("./components/molecules/TextArea");
304
318
 
319
+ var _Tooltip = require("./components/atoms/Tooltip");
320
+
305
321
  var _hooks = require("./hooks");
306
322
 
307
323
  Object.keys(_hooks).forEach(function (key) {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAIA;;AAKA;;AACA;;AACA;;AAIA;;AAOA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from '@tecsinapse/react-core';\nexport {\n default as Badge,\n BadgeWebProps,\n} from './components/atoms/Badge/Badge';\nexport {\n Button,\n useMouseHover,\n WebButtonProps,\n} from './components/atoms/Button';\nexport { Input, InputWebProps } from './components/atoms/Input';\nexport { Tag, TagProps } from './components/atoms/Tag';\nexport {\n InputPassword,\n InputPasswordWebProps,\n} from './components/molecules/InputPassword';\nexport {\n Menubar,\n MenubarProps,\n MenubarOptionsType,\n MenubarItemsOptions,\n MenubarMostUsedType,\n} from './components/molecules/Menubar';\nexport { Drawer, DrawerProps } from './components/molecules/Drawer';\nexport { Select, SelectProps } from './components/molecules/Select';\nexport { Snackbar, SnackbarWebProps } from './components/molecules/Snackbar';\nexport {\n Breadcrumbs,\n BreadcrumbsProps,\n BreadcrumbType,\n} from './components/molecules/Breadcrumbs';\nexport { Skeleton, SkeletonProps } from './components/atoms/Skeleton';\nexport { Accordion, AccordionProps } from './components/atoms/Accordion';\nexport {\n DataGrid,\n DataGridProps,\n HeadersType,\n} from './components/organisms/DataGrid';\nexport { Modal, ModalProps } from './components/atoms/Modal';\nexport { TextArea, TextAreaProps } from './components/molecules/TextArea';\nexport * from './hooks';\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAIA;;AAKA;;AACA;;AACA;;AAIA;;AAOA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from '@tecsinapse/react-core';\nexport {\n default as Badge,\n BadgeWebProps,\n} from './components/atoms/Badge/Badge';\nexport {\n Button,\n useMouseHover,\n WebButtonProps,\n} from './components/atoms/Button';\nexport { Input, InputWebProps } from './components/atoms/Input';\nexport { Tag, TagProps } from './components/atoms/Tag';\nexport {\n InputPassword,\n InputPasswordWebProps,\n} from './components/molecules/InputPassword';\nexport {\n Menubar,\n MenubarProps,\n MenubarOptionsType,\n MenubarItemsOptions,\n MenubarMostUsedType,\n} from './components/molecules/Menubar';\nexport { Drawer, DrawerProps } from './components/molecules/Drawer';\nexport { Select, SelectProps } from './components/molecules/Select';\nexport { Snackbar, SnackbarWebProps } from './components/molecules/Snackbar';\nexport {\n Breadcrumbs,\n BreadcrumbsProps,\n BreadcrumbType,\n} from './components/molecules/Breadcrumbs';\nexport { Skeleton, SkeletonProps } from './components/atoms/Skeleton';\nexport { Accordion, AccordionProps } from './components/atoms/Accordion';\nexport {\n DataGrid,\n DataGridProps,\n HeadersType,\n} from './components/organisms/DataGrid';\nexport { Modal, ModalProps } from './components/atoms/Modal';\nexport { TextArea, TextAreaProps } from './components/molecules/TextArea';\nexport { Tooltip, ITooltip } from './components/atoms/Tooltip';\nexport * from './hooks';\n"],"file":"index.js"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tecsinapse/react-web-kit",
3
3
  "description": "TecSinapse React components",
4
- "version": "1.8.0",
4
+ "version": "1.10.2",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "license": "MIT",
@@ -14,7 +14,7 @@
14
14
  "@emotion/native": "^11.0.0",
15
15
  "@emotion/react": "^11.4.1",
16
16
  "@emotion/styled": "^11.3.0",
17
- "@tecsinapse/react-core": "^1.8.0",
17
+ "@tecsinapse/react-core": "^1.10.1",
18
18
  "@types/react-native": "^0.64.4",
19
19
  "react-native-vector-icons": "^8.1.0",
20
20
  "react-transition-group": "^4.4.2"
@@ -33,5 +33,5 @@
33
33
  "react-dom": ">=16.8.0",
34
34
  "react-native-web": "^0.17.1"
35
35
  },
36
- "gitHead": "007818f30ad4257a740f6abe53c10495b1187ac1"
36
+ "gitHead": "68cf48b922cfcdd0b4e734541d00f7021f4bc575"
37
37
  }
@@ -7,12 +7,12 @@ import { StyledWebButton } from './styled';
7
7
  * TODO: Add a property 'defaultElement' to render a default
8
8
  * component and provide some button's state to it.
9
9
  */
10
- export interface WebButtonProps extends ButtonProps {
10
+ export type WebButtonProps = ButtonProps & {
11
11
  onMouseOver?: () => void;
12
12
  onMouseOut?: () => void;
13
- }
13
+ };
14
14
 
15
- const Button: FC<ButtonProps> = ({
15
+ const Button: FC<WebButtonProps> = ({
16
16
  children,
17
17
  disabled,
18
18
  frozen,
@@ -9,7 +9,7 @@ export default {
9
9
  };
10
10
 
11
11
  const Template: Story<InputWebProps> = args => {
12
- const [value, setValue] = useState<string>();
12
+ const [value, setValue] = useState<string>('');
13
13
 
14
14
  const onChange = text => {
15
15
  setValue(text);
@@ -13,64 +13,72 @@ export interface InputWebProps
13
13
  extends Omit<InputElementProps, 'style'>,
14
14
  InputContainerProps {}
15
15
 
16
- const Input: FC<InputWebProps> = ({
17
- label,
18
- labelColor,
19
- labelColorVariant,
20
- labelColorTone,
21
- labelTypography,
22
- labelStack,
23
- labelWeight,
24
- leftComponent,
25
- rightComponent,
26
- disabled,
27
- style,
28
- borderColor,
29
- borderColorGradation,
30
- inputContainerStyle,
31
- variant = 'default',
32
- hintComponent,
33
- hint,
34
- onFocus,
35
- onBlur,
36
- ...rest
37
- }) => {
38
- const _hint = hintComponent || <Hint text={hint} variant={variant} />;
39
- const { focused, handleBlur, handleFocus } = useInputFocus(
40
- onFocus,
41
- onBlur,
42
- !disabled
43
- );
16
+ const Input: FC<InputWebProps> = React.forwardRef(
17
+ (
18
+ {
19
+ label,
20
+ labelColor,
21
+ labelColorVariant,
22
+ labelColorTone,
23
+ labelTypography,
24
+ labelStack,
25
+ labelWeight,
26
+ leftComponent,
27
+ rightComponent,
28
+ disabled,
29
+ style,
30
+ borderColor,
31
+ borderColorGradation,
32
+ inputContainerStyle,
33
+ variant = 'default',
34
+ hintComponent,
35
+ hint,
36
+ onFocus,
37
+ onBlur,
38
+ ...rest
39
+ },
40
+ ref
41
+ ) => {
42
+ const _hint = hintComponent || <Hint text={hint} variant={variant} />;
43
+ const { focused, handleBlur, handleFocus } = useInputFocus(
44
+ onFocus,
45
+ onBlur,
46
+ !disabled
47
+ );
44
48
 
45
- return (
46
- <View style={style}>
47
- <InputContainer
48
- label={label}
49
- labelColor={labelColor}
50
- labelColorVariant={labelColorVariant}
51
- labelColorTone={labelColorTone}
52
- labelTypography={labelTypography}
53
- labelStack={labelStack}
54
- labelWeight={labelWeight}
55
- leftComponent={leftComponent}
56
- rightComponent={rightComponent}
57
- borderColor={borderColor}
58
- borderColorGradation={borderColorGradation}
59
- inputContainerStyle={inputContainerStyle}
60
- focused={focused}
61
- disabled={disabled}
62
- variant={variant}
63
- >
64
- <StyledWebTextInput
65
- {...rest}
49
+ return (
50
+ <View style={style}>
51
+ <InputContainer
52
+ label={label}
53
+ labelColor={labelColor}
54
+ labelColorVariant={labelColorVariant}
55
+ labelColorTone={labelColorTone}
56
+ labelTypography={labelTypography}
57
+ labelStack={labelStack}
58
+ labelWeight={labelWeight}
59
+ leftComponent={leftComponent}
60
+ rightComponent={rightComponent}
61
+ borderColor={borderColor}
62
+ borderColorGradation={borderColorGradation}
63
+ inputContainerStyle={inputContainerStyle}
64
+ focused={focused}
66
65
  disabled={disabled}
67
- onFocus={handleFocus}
68
- onBlur={handleBlur}
69
- />
70
- </InputContainer>
71
- {hint && _hint}
72
- </View>
73
- );
74
- };
66
+ variant={variant}
67
+ >
68
+ <StyledWebTextInput
69
+ {...rest}
70
+ ref={ref}
71
+ disabled={disabled}
72
+ onFocus={handleFocus}
73
+ onBlur={handleBlur}
74
+ />
75
+ </InputContainer>
76
+ {hint && _hint}
77
+ </View>
78
+ );
79
+ }
80
+ );
81
+
82
+ Input.displayName = 'Input';
75
83
 
76
84
  export default Input;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { HeaderBackground, THeadStyled } from './styled';
3
- import Tr from '../Row/Tr';
3
+ import { Tr } from '../Row/Tr';
4
4
 
5
5
  const THead: React.FC<React.HTMLAttributes<HTMLTableSectionElement>> = ({
6
6
  children,
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import { Story } from '@storybook/react';
3
+ import Tooltip, { ITooltip } from './Tooltip';
4
+ import { Button } from '../Button';
5
+ import { Text } from '@tecsinapse/react-core';
6
+
7
+ export default {
8
+ title: 'Web/Tooltip',
9
+ component: Tooltip,
10
+ };
11
+
12
+ const Template: Story<ITooltip> = args => {
13
+ return (
14
+ <div style={{ display: 'flex', flexDirection: 'column' }}>
15
+ <Tooltip {...args}>
16
+ <Button>
17
+ <Text fontColor="light" fontWeight="bold">
18
+ Hover me
19
+ </Text>
20
+ </Button>
21
+ </Tooltip>
22
+ </div>
23
+ );
24
+ };
25
+
26
+ export const Base = Template.bind({});
27
+
28
+ Base.args = {
29
+ title: 'Tooltip',
30
+ };
@@ -0,0 +1,51 @@
1
+ import React from 'react';
2
+ import { Text } from '@tecsinapse/react-core';
3
+ import { Container, TooltipSpan } from './styled';
4
+
5
+ export type ComputedType = { width?: number; height?: number };
6
+ export type Position = 'top' | 'bottom' | 'right' | 'left';
7
+
8
+ export interface ITooltip {
9
+ title: string;
10
+ position?: Position;
11
+ }
12
+
13
+ const Tooltip: React.FC<ITooltip> = ({
14
+ children,
15
+ title,
16
+ position = 'bottom',
17
+ }) => {
18
+ const spanRef = React.useRef<HTMLSpanElement | null>();
19
+ const [computed, setComputed] = React.useState<ComputedType | undefined>(
20
+ undefined
21
+ );
22
+
23
+ React.useLayoutEffect(() => {
24
+ setComputed({
25
+ width: spanRef.current?.clientWidth,
26
+ height: spanRef.current?.clientHeight,
27
+ });
28
+ }, []);
29
+
30
+ return (
31
+ <Container position={position}>
32
+ {children}
33
+ <TooltipSpan
34
+ computed={computed}
35
+ position={position}
36
+ ref={ref => (spanRef.current = ref)}
37
+ >
38
+ <Text
39
+ fontWeight="bold"
40
+ typography="base"
41
+ colorVariant="secondary"
42
+ colorTone="xlight"
43
+ >
44
+ {title}
45
+ </Text>
46
+ </TooltipSpan>
47
+ </Container>
48
+ );
49
+ };
50
+
51
+ export default Tooltip;
@@ -0,0 +1 @@
1
+ export { default as Tooltip, ITooltip } from './Tooltip';