@ctlyst.id/internal-ui 1.0.2 → 1.0.4-canary.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- import { useToken, Box, Text, useColorModeValue, Breadcrumb, BreadcrumbItem, BreadcrumbLink, Flex, Spinner, Table, Thead, Tr, Th, Tbody, Td, InputGroup, Input as Input$1, InputRightAddon, FormControl, FormLabel as FormLabel$1, InputRightElement, FormHelperText, FormErrorMessage, InputLeftAddon, InputLeftElement, Textarea as Textarea$1, Image, useDisclosure, Popover as Popover$1, HStack, VStack, PopoverTrigger, Avatar, PopoverContent, PopoverArrow, PopoverBody, useColorMode as useColorMode$1, Badge, ModalBody as ModalBody$1, ModalCloseButton as ModalCloseButton$1, ModalFooter as ModalFooter$1, ModalHeader as ModalHeader$1, Icon, Portal, Link, forwardRef as forwardRef$1, Button as Button$1, VisuallyHidden, Select as Select$1, theme as theme$1, useTab, useMultiStyleConfig, TabList as TabList$1, TabPanel as TabPanel$1, Stack, Heading, createMultiStyleConfigHelpers as createMultiStyleConfigHelpers$1, extendTheme } from '@chakra-ui/react';
1
+ import { useToken, Box, Text, useColorModeValue, Breadcrumb, BreadcrumbItem, BreadcrumbLink, Flex, Spinner, Table, Thead, Tr, Th, Tbody, Td, InputGroup, Input as Input$1, InputRightAddon, FormControl, FormLabel as FormLabel$1, InputRightElement, FormHelperText, FormErrorMessage, theme as theme$1, InputLeftAddon, InputLeftElement, Textarea as Textarea$1, Image, useDisclosure, Popover as Popover$1, HStack, VStack, PopoverTrigger, Avatar, PopoverContent, PopoverArrow, PopoverBody, useColorMode as useColorMode$1, Badge, ModalBody as ModalBody$1, ModalCloseButton as ModalCloseButton$1, ModalFooter as ModalFooter$1, ModalHeader as ModalHeader$1, Icon, Portal, Link, forwardRef as forwardRef$1, Button as Button$1, VisuallyHidden, Select as Select$1, useTab, useMultiStyleConfig, TabList as TabList$1, TabPanel as TabPanel$1, Stack, Heading, createMultiStyleConfigHelpers as createMultiStyleConfigHelpers$1, extendTheme } from '@chakra-ui/react';
2
2
  export { AlertDialog, ModalBody as AlertDialogBody, ModalCloseButton as AlertDialogCloseButton, AlertDialogContent, ModalFooter as AlertDialogFooter, ModalHeader as AlertDialogHeader, ModalOverlay as AlertDialogOverlay, Drawer, ModalBody as DrawerBody, ModalCloseButton as DrawerCloseButton, DrawerContent, ModalFooter as DrawerFooter, ModalHeader as DrawerHeader, ModalOverlay as DrawerOverlay, Modal, ModalContent, ModalContextProvider, ModalFocusScope, ModalOverlay, TabIndicator, TabPanels, Tabs, TabsDescendantsProvider, TabsProvider, useDrawerContext, useModal, useModalContext, useModalStyles, useTab, useTabIndicator, useTabList, useTabPanel, useTabPanels, useTabs, useTabsContext, useTabsDescendant, useTabsDescendants, useTabsDescendantsContext, useTabsStyles } from '@chakra-ui/react';
3
3
  import React__default, { createElement, useRef, useEffect, useState, useMemo, Fragment, forwardRef, useCallback, createContext, useContext } from 'react';
4
4
  import { FiChevronsRight, FiHome, FiCalendar, FiX, FiPower, FiMoon, FiSun, FiChevronDown } from 'react-icons/fi';
@@ -8,6 +8,7 @@ import { useReactTable, getCoreRowModel, getSortedRowModel, flexRender } from '@
8
8
  import classnames from 'classnames';
9
9
  import ReactDatePicker from 'react-datepicker';
10
10
  import { useColorMode } from '@chakra-ui/system';
11
+ import styled from '@emotion/styled';
11
12
  import ReactSelect from 'react-select';
12
13
  import { AsyncPaginate } from 'react-select-async-paginate';
13
14
  import ReactSelectAsyncCreatable from 'react-select/async-creatable';
@@ -442,6 +443,11 @@ const Styles = () => {
442
443
  display: inline-block;
443
444
  margin: 0 2px;
444
445
  }
446
+ .react-datepicker__header__dropdown.react-datepicker__header__dropdown--select {
447
+ font-weight: 600;
448
+ line-height: 22px;
449
+ color: #111111;
450
+ }
445
451
 
446
452
  .react-datepicker__current-month,
447
453
  .react-datepicker-time__header,
@@ -1192,1042 +1198,1144 @@ Datepicker.defaultProps = {
1192
1198
  showMonth: false
1193
1199
  };
1194
1200
 
1195
- /* eslint-disable no-nested-ternary */
1196
- const Field = props => {
1197
- const {
1198
- label,
1199
- isError,
1200
- error,
1201
- helperText,
1202
- isRequired,
1203
- children
1204
- } = props;
1205
- return /*#__PURE__*/React__default.createElement(FormControl, {
1206
- isInvalid: isError
1207
- }, label && (typeof label === 'string' ? /*#__PURE__*/React__default.createElement(FormLabel$1, {
1208
- fontSize: "field.sm",
1209
- requiredIndicator: undefined
1210
- }, isRequired && /*#__PURE__*/React__default.createElement(Box, {
1211
- as: "span",
1212
- color: "red.500",
1213
- ml: 0,
1214
- mr: 1
1215
- }, "*"), label) : label), children, !isError ? helperText && /*#__PURE__*/React__default.createElement(FormHelperText, {
1216
- fontSize: "field.sm"
1217
- }, helperText) : typeof error === 'string' ? /*#__PURE__*/React__default.createElement(FormErrorMessage, {
1218
- textStyle: "field.sm",
1219
- fontSize: "field.sm",
1220
- mt: 1,
1221
- marginStart: 1
1222
- }, error) : error);
1201
+ const DatePickerMonth = ({
1202
+ onChange,
1203
+ min,
1204
+ max,
1205
+ ...props
1206
+ }) => {
1207
+ const [date, setDate] = React__default.useState(null);
1208
+ return /*#__PURE__*/React__default.createElement(Box, {
1209
+ fontSize: '12px',
1210
+ lineHeight: '18px',
1211
+ css: css`
1212
+ input[type='date']::-webkit-inner-spin-button,
1213
+ input[type='date']::-webkit-calendar-picker-indicator {
1214
+ display: none;
1215
+ -webkit-appearance: none;
1216
+ }
1217
+ input[value=''] {
1218
+ width: 58px;
1219
+ }
1220
+ `
1221
+ }, /*#__PURE__*/React__default.createElement(Input$1, {
1222
+ "data-test-id": props['data-test-id'],
1223
+ type: "date",
1224
+ width: date ? '51px' : '58px',
1225
+ onChange: e => {
1226
+ onChange(e.target.value);
1227
+ setDate(e.target.value);
1228
+ },
1229
+ p: '8px',
1230
+ min: min,
1231
+ max: max,
1232
+ required: true,
1233
+ css: css`
1234
+ border: 1px solid transparent;
1235
+
1236
+ &:focus,
1237
+ &:hover {
1238
+ border: 1px solid transparent;
1239
+ }
1240
+
1241
+ &::placeholder {
1242
+ color: #111111;
1243
+ }
1244
+ `,
1245
+ value: date !== null && date !== void 0 ? date : ''
1246
+ }));
1223
1247
  };
1224
- Field.defaultProps = {
1225
- label: '',
1226
- isError: false,
1227
- error: undefined,
1228
- helperText: undefined,
1229
- isRequired: false
1248
+ DatePickerMonth.defaultProps = {
1249
+ 'data-test-id': ''
1230
1250
  };
1231
1251
 
1232
- const InputField = /*#__PURE__*/React__default.forwardRef((props, ref) => {
1233
- const {
1234
- value,
1235
- type,
1236
- addOnLeft,
1237
- addOnRight,
1238
- elementLeft,
1239
- elementRight,
1240
- size,
1241
- isRequired,
1242
- label,
1243
- isError,
1244
- error,
1245
- helperText,
1246
- ...inputProps
1247
- } = props;
1248
- return /*#__PURE__*/React__default.createElement(Field, {
1249
- label: label,
1250
- isError: isError,
1251
- error: error,
1252
- helperText: helperText,
1253
- isRequired: isRequired
1254
- }, /*#__PURE__*/React__default.createElement(InputGroup, {
1255
- size: size
1256
- }, addOnLeft && /*#__PURE__*/React__default.createElement(InputLeftAddon, null, addOnLeft), elementLeft && /*#__PURE__*/React__default.createElement(InputLeftElement, null, elementLeft), /*#__PURE__*/React__default.createElement(Input$1, Object.assign({
1257
- ref: ref,
1258
- type: type,
1259
- value: value
1260
- }, inputProps)), addOnRight && /*#__PURE__*/React__default.createElement(InputRightAddon, null, addOnRight), elementRight && /*#__PURE__*/React__default.createElement(InputRightElement, null, elementRight)));
1261
- });
1262
- InputField.defaultProps = {
1263
- addOnLeft: undefined,
1264
- addOnRight: undefined,
1265
- elementLeft: undefined,
1266
- elementRight: undefined
1252
+ const transparent = 'transparent';
1253
+ const black = {
1254
+ high: '#111111',
1255
+ medium: '#707070',
1256
+ low: '#B8B8B8'
1267
1257
  };
1268
-
1269
- const TextareaField = /*#__PURE__*/React__default.forwardRef((props, ref) => {
1270
- const {
1271
- value,
1272
- ...inputProps
1273
- } = props;
1274
- return /*#__PURE__*/React__default.createElement(Field, Object.assign({}, inputProps), /*#__PURE__*/React__default.createElement(Textarea$1, Object.assign({
1275
- ref: ref,
1276
- value: value
1277
- }, inputProps)));
1278
- });
1279
- TextareaField.defaultProps = {
1280
- addOnLeft: undefined,
1281
- addOnRight: undefined,
1282
- elementLeft: undefined,
1283
- elementRight: undefined
1258
+ const white = {
1259
+ high: '#FFFFFF',
1260
+ medium: '#F1F1F1',
1261
+ low: '#CCCCCC'
1284
1262
  };
1285
-
1286
- const XMSLogo = () => /*#__PURE__*/React__default.createElement(Image, {
1287
- height: 8,
1288
- src: useColorModeValue('https://assets.voila.id/xms/logo-xms.jpg', 'https://assets.voila.id/xms/logo-xms-dark.png')
1289
- });
1290
- const VoilaLogo = () => /*#__PURE__*/React__default.createElement(Image, {
1291
- src: "https://s3.ap-southeast-1.amazonaws.com/assets.voila.id/xms/logo-voila-black.png?v=1",
1292
- filter: useColorModeValue('none', 'invert(1)'),
1293
- maxW: 24
1294
- });
1295
-
1296
- const Profile = ({
1297
- data,
1298
- onLogout
1299
- }) => {
1300
- var _data$name;
1301
- const {
1302
- isOpen,
1303
- onToggle,
1304
- onClose
1305
- } = useDisclosure();
1306
- return /*#__PURE__*/createElement(Popover$1, {
1307
- placement: "bottom-end",
1308
- isOpen: isOpen,
1309
- onClose: onClose
1310
- }, /*#__PURE__*/createElement(Box, {
1311
- "data-test-id": "WE0UYbA93LOZy6S09IhDO",
1312
- as: "button",
1313
- cursor: 'pointer',
1314
- minW: 0,
1315
- _hover: {
1316
- textDecor: 'none'
1317
- },
1318
- m: 0,
1319
- onClick: onToggle
1320
- }, /*#__PURE__*/createElement(HStack, null, /*#__PURE__*/createElement(VStack, {
1321
- alignItems: "flex-end",
1322
- spacing: -0.5,
1323
- ml: "2"
1324
- }, /*#__PURE__*/createElement(Text, {
1325
- fontSize: "text.xs",
1326
- mb: 1,
1327
- fontWeight: 400,
1328
- lineHeight: "14px",
1329
- color: useColorModeValue('neutral.800', 'white')
1330
- }, data === null || data === void 0 ? void 0 : data.email), /*#__PURE__*/createElement(Text, {
1331
- fontSize: "text.xs",
1332
- fontWeight: 400,
1333
- lineHeight: "14px",
1334
- color: useColorModeValue('primary.500', 'success.400')
1335
- }, (data === null || data === void 0 ? void 0 : data.office) && /*#__PURE__*/createElement(Text, {
1336
- color: "neutral.700",
1337
- display: "inline-block",
1338
- mr: 0.5
1339
- }, data.office, " |", ' '), data === null || data === void 0 ? void 0 : data.userRole)), /*#__PURE__*/createElement(PopoverTrigger, null, /*#__PURE__*/createElement(Avatar, {
1340
- size: 'sm',
1341
- bg: "primary.500",
1342
- color: "white",
1343
- name: (_data$name = data === null || data === void 0 ? void 0 : data.name) !== null && _data$name !== void 0 ? _data$name : data === null || data === void 0 ? void 0 : data.email
1344
- })))), /*#__PURE__*/createElement(PopoverContent, {
1345
- bg: useColorModeValue('white', 'mirage.900'),
1346
- maxW: 200
1347
- }, /*#__PURE__*/createElement(PopoverArrow, {
1348
- bg: useColorModeValue('white', 'mirage.900')
1349
- }), /*#__PURE__*/createElement(PopoverBody, {
1350
- p: 1
1351
- }, /*#__PURE__*/createElement(Flex, {
1352
- "data-test-id": "gA7F9pucPX_Q3_dkgXIYZ",
1353
- alignItems: "center",
1354
- px: 3,
1355
- py: 2,
1356
- borderRadius: "sm",
1357
- cursor: "pointer",
1358
- _hover: {
1359
- bg: useColorModeValue('primary.500', 'mirage.900'),
1360
- color: 'white'
1361
- },
1362
- onClick: onLogout,
1363
- fontSize: "text.xs"
1364
- }, /*#__PURE__*/createElement(FiPower, null), /*#__PURE__*/createElement(Text, {
1365
- ml: 2
1366
- }, "Logout")))));
1263
+ const neutral = {
1264
+ '50': '#FFFFFF',
1265
+ '100': '#FAFAFA',
1266
+ '200': '#F5F5F5',
1267
+ '300': '#EEEEEE',
1268
+ '400': '#E0E0E0',
1269
+ '500': '#BDBDBD',
1270
+ '600': '#999999',
1271
+ '700': '#242424',
1272
+ '800': '#181818',
1273
+ '900': '#111111'
1367
1274
  };
1368
- Profile.defaultProps = {
1369
- data: undefined,
1370
- onLogout: undefined
1275
+ const primary = {
1276
+ '50': '#DFFFF1',
1277
+ '100': '#ACF5D5',
1278
+ '200': '#5EE5A9',
1279
+ '300': '#05CB72',
1280
+ '400': '#08A45E',
1281
+ '500': '#12784A',
1282
+ '600': '#0B603A',
1283
+ '700': '#075331',
1284
+ '800': '#064126',
1285
+ '900': '#042E1B'
1371
1286
  };
1372
-
1373
- const SwitchMode = () => {
1374
- const {
1375
- colorMode,
1376
- toggleColorMode
1377
- } = useColorMode$1();
1378
- return /*#__PURE__*/createElement(Box, {
1379
- "data-test-id": "rhYuTDCiWkFqr96upiEEh",
1380
- mx: 5,
1381
- onClick: toggleColorMode,
1382
- cursor: "pointer"
1383
- }, colorMode === 'light' ? /*#__PURE__*/createElement(FiMoon, {
1384
- size: 20
1385
- }) : /*#__PURE__*/createElement(FiSun, {
1386
- size: 20
1387
- }));
1287
+ const secondary = {
1288
+ '50': '#F2F2F3',
1289
+ '100': '#DADBDD',
1290
+ '200': '#C2C4C7',
1291
+ '300': '#AAADB0',
1292
+ '400': '#93969A',
1293
+ '500': '#7B7F84',
1294
+ '600': '#62666A',
1295
+ '700': '#4A4C4F',
1296
+ '800': '#313335',
1297
+ '900': '#19191A'
1388
1298
  };
1389
-
1390
- // eslint-disable-next-line import/prefer-default-export
1391
- function environmentName(env) {
1392
- switch (env) {
1393
- case 'DEVELOPMENT':
1394
- return 'Dev';
1395
- case 'STAGING':
1396
- return 'Staging';
1397
- default:
1398
- return null;
1399
- }
1400
- }
1401
-
1402
- /* eslint-disable react-hooks/rules-of-hooks */
1403
- const Version = ({
1404
- version,
1405
- environment,
1406
- onOpenModalRelease
1407
- }) => /*#__PURE__*/createElement(Fragment, null, version && /*#__PURE__*/createElement(Badge, {
1408
- "data-test-id": "dzl3esjhCphobaaIXpiUE",
1409
- bg: useColorModeValue('primary.500', 'rgba(124, 124, 124, 0.12)'),
1410
- color: useColorModeValue('white', 'secondary.400'),
1411
- fontSize: "text.xs",
1412
- py: 1,
1413
- px: 2.5,
1414
- fontWeight: "bold",
1415
- textTransform: "lowercase",
1416
- borderRadius: "md",
1417
- onClick: onOpenModalRelease,
1418
- cursor: onOpenModalRelease ? 'pointer' : 'auto'
1419
- }, version), /*#__PURE__*/createElement(Box, {
1420
- background: "primary.50",
1421
- color: "primary.500",
1422
- fontSize: "text.xs",
1423
- py: 1,
1424
- px: 2.5,
1425
- fontWeight: "bold",
1426
- borderRadius: "md"
1427
- }, environmentName(environment)));
1428
- Version.defaultProps = {
1429
- environment: undefined,
1430
- version: undefined,
1431
- onOpenModalRelease: undefined
1299
+ const success = {
1300
+ '50': '#ECFFED',
1301
+ '100': '#D3FCD5',
1302
+ '200': '#A9F9B5',
1303
+ '300': '#7CEE98',
1304
+ '400': '#58DD86',
1305
+ '500': '#28c76f',
1306
+ '600': '#1DAB6A',
1307
+ '700': '#148F63',
1308
+ '800': '#0C7359',
1309
+ '900': '#075F51'
1432
1310
  };
1433
-
1434
- const Header = ({
1435
- data,
1436
- onLogout,
1437
- onOpenModalRelease,
1438
- ...props
1439
- }) => /*#__PURE__*/createElement(Box, Object.assign({
1440
- minH: 14,
1441
- bg: useColorModeValue('white', 'ebony-clay.800'),
1442
- boxShadow: "0 4px 20px 0 rgb(0 0 0 / 5%)",
1443
- px: 4,
1444
- py: 1
1445
- }, props), /*#__PURE__*/createElement(Flex, {
1446
- h: 14,
1447
- alignItems: "center",
1448
- justifyContent: "space-between"
1449
- }, /*#__PURE__*/createElement(XMSLogo, null), /*#__PURE__*/createElement(HStack, {
1450
- spacing: 2,
1451
- alignItems: "center"
1452
- }, /*#__PURE__*/createElement(VoilaLogo, null), /*#__PURE__*/createElement(Version, {
1453
- version: data === null || data === void 0 ? void 0 : data.version,
1454
- environment: data === null || data === void 0 ? void 0 : data.environment,
1455
- onOpenModalRelease: onOpenModalRelease
1456
- })), /*#__PURE__*/createElement(Flex, {
1457
- alignItems: "center"
1458
- }, /*#__PURE__*/createElement(SwitchMode, null), /*#__PURE__*/createElement(Profile, {
1459
- data: data,
1460
- onLogout: onLogout
1461
- }))));
1462
- Header.defaultProps = {
1463
- data: undefined,
1464
- onLogout: undefined,
1465
- onOpenModalRelease: undefined
1311
+ const danger = {
1312
+ '50': '#FFEDEC',
1313
+ '100': '#FFC7C2',
1314
+ '200': '#FF8279',
1315
+ '300': '#FF5B4F',
1316
+ '400': '#F44336',
1317
+ '500': '#D82F23',
1318
+ '600': '#B71C1C',
1319
+ '700': '#930B0B',
1320
+ '800': '#660909',
1321
+ '900': '#3E0707'
1322
+ };
1323
+ const warning = {
1324
+ '50': '#FFF9EC',
1325
+ '100': '#FFEFCC',
1326
+ '200': '#FFD591',
1327
+ '300': '#FFC069',
1328
+ '400': '#FFA230',
1329
+ '500': '#F68522',
1330
+ '600': '#EF6C00',
1331
+ '700': '#C65B03',
1332
+ '800': '#9F4901',
1333
+ '900': '#652E00'
1334
+ };
1335
+ const info = {
1336
+ '50': '#EBFFFB',
1337
+ '100': '#CBFDF2',
1338
+ '200': '#97FCEF',
1339
+ '300': '#63F8F0',
1340
+ '400': '#3CECF1',
1341
+ '500': '#00CFE8',
1342
+ '600': '#00A1C7',
1343
+ '700': '#007AA7',
1344
+ '800': '#005786',
1345
+ '900': '#003F6F'
1346
+ };
1347
+ const dark = {
1348
+ '50': '#F2F2F2',
1349
+ '100': '#DBDBDB',
1350
+ '200': '#C4C4C4',
1351
+ '300': '#ADADAD',
1352
+ '400': '#969696',
1353
+ '500': '#808080',
1354
+ '600': '#666666',
1355
+ '700': '#4D4D4D',
1356
+ '800': '#333333',
1357
+ '900': '#1A1A1A'
1358
+ };
1359
+ const mirage = {
1360
+ '50': '#EDF0F7',
1361
+ '100': '#CED5E9',
1362
+ '200': '#AEBADB',
1363
+ '300': '#8E9ECC',
1364
+ '400': '#6F83BE',
1365
+ '500': '#4F68B0',
1366
+ '600': '#3F538D',
1367
+ '700': '#2F3E6A',
1368
+ '800': '#202A46',
1369
+ '900': '#101523'
1370
+ };
1371
+ const ebonyClay = {
1372
+ '50': '#EFF1F6',
1373
+ '100': '#D2D7E5',
1374
+ '200': '#B4BDD4',
1375
+ '300': '#97A3C4',
1376
+ '400': '#7A89B3',
1377
+ '500': '#5D6FA2',
1378
+ '600': '#4A5982',
1379
+ '700': '#384361',
1380
+ '800': '#252D41',
1381
+ '900': '#131620'
1382
+ };
1383
+ const brightGray = {
1384
+ '50': '#F0F1F4',
1385
+ '100': '#D5D9E1',
1386
+ '200': '#BAC0CE',
1387
+ '300': '#A0A8BB',
1388
+ '400': '#858FA8',
1389
+ '500': '#6A7795',
1390
+ '600': '#555F77',
1391
+ '700': '#404759',
1392
+ '800': '#2A2F3C',
1393
+ '900': '#15181E'
1394
+ };
1395
+ const doveGray = {
1396
+ '50': '#F2F2F2',
1397
+ '100': '#DBDBDB',
1398
+ '200': '#C4C4C4',
1399
+ '300': '#ADADAD',
1400
+ '400': '#969696',
1401
+ '500': '#808080',
1402
+ '600': '#666666',
1403
+ '700': '#4D4D4D',
1404
+ '800': '#333333',
1405
+ '900': '#1A1A1A'
1406
+ };
1407
+ const colors = {
1408
+ transparent,
1409
+ black,
1410
+ white,
1411
+ neutral,
1412
+ primary,
1413
+ secondary,
1414
+ success,
1415
+ danger,
1416
+ warning,
1417
+ info,
1418
+ dark,
1419
+ mirage,
1420
+ 'ebony-clay': ebonyClay,
1421
+ 'bright-gray': brightGray,
1422
+ 'dove-gray': doveGray
1466
1423
  };
1467
1424
 
1468
- const ModalBody = /*#__PURE__*/React__default.forwardRef(({
1469
- children,
1470
- ...rest
1471
- }, ref) => {
1472
- return /*#__PURE__*/React__default.createElement(ModalBody$1, Object.assign({
1473
- ref: ref,
1474
- background: useColorModeValue('white', 'mirage.900')
1475
- }, rest), children);
1476
- });
1477
-
1478
- const ModalCloseButton = /*#__PURE__*/forwardRef((props, ref) => {
1479
- return /*#__PURE__*/React__default.createElement(ModalCloseButton$1, Object.assign({
1480
- ref: ref,
1481
- top: 4,
1482
- right: 4,
1483
- size: "sm",
1484
- background: useColorModeValue('neutral.50', 'mirage.900')
1485
- }, props));
1486
- });
1425
+ const radius = {
1426
+ none: 0,
1427
+ sm: '2px',
1428
+ md: '4px',
1429
+ lg: '8px',
1430
+ full: '9999px'
1431
+ };
1487
1432
 
1488
- const ModalFooter = /*#__PURE__*/forwardRef(({
1489
- children,
1490
- ...rest
1491
- }, ref) => {
1492
- return /*#__PURE__*/React__default.createElement(ModalFooter$1, Object.assign({
1493
- ref: ref,
1494
- background: useColorModeValue('neutral.200', 'mirage.900'),
1495
- borderBottomRadius: "md"
1496
- }, rest), children);
1497
- });
1433
+ const spacing = {
1434
+ ...theme$1.space,
1435
+ 4.5: '1.125rem',
1436
+ 9.5: '2.375rem',
1437
+ 18: '4.5rem',
1438
+ 22: '5.5rem',
1439
+ 26: '6.5rem',
1440
+ 30: '7.5rem'
1441
+ };
1498
1442
 
1499
- const ModalHeader = /*#__PURE__*/forwardRef(({
1500
- children,
1501
- ...rest
1502
- }, ref) => {
1503
- return /*#__PURE__*/React__default.createElement(ModalHeader$1, Object.assign({
1504
- ref: ref,
1505
- background: useColorModeValue('neutral.200', 'mirage.900'),
1506
- borderTopRadius: 'md',
1507
- fontSize: 'lg'
1508
- }, rest), children);
1509
- });
1443
+ const sizes = {
1444
+ ...theme$1.sizes,
1445
+ 4.5: '1.125rem',
1446
+ 9.5: '2.375rem',
1447
+ 18: '4.5rem',
1448
+ 22: '5.5rem',
1449
+ 26: '6.5rem',
1450
+ 30: '7.5rem'
1451
+ };
1510
1452
 
1511
- /* eslint-disable react-hooks/rules-of-hooks */
1512
- const Navigation = ({
1513
- navigations,
1514
- activePath,
1515
- as,
1516
- ...props
1517
- }) => {
1518
- return /*#__PURE__*/createElement(Box, Object.assign({
1519
- bg: useColorModeValue('white', 'ebony-clay.800'),
1520
- boxShadow: "0 4px 20px 0 rgb(0 0 0 / 5%)",
1521
- borderRadius: "md",
1522
- overflowX: "auto"
1523
- }, props), /*#__PURE__*/createElement(Flex, {
1524
- alignItems: "center",
1525
- p: 2
1526
- }, /*#__PURE__*/createElement(HStack, {
1527
- spacing: 2
1528
- }, navigations === null || navigations === void 0 ? void 0 : navigations.map(navigation => {
1529
- const isActive = activePath.startsWith(navigation.navLink || '');
1530
- const activeBg = isActive ? 'primary.500' : undefined;
1531
- return /*#__PURE__*/createElement(Popover$1, {
1532
- key: navigation.title,
1533
- trigger: "hover",
1534
- placement: "bottom-start"
1535
- }, ({
1536
- isOpen
1537
- }) => /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(PopoverTrigger, null, /*#__PURE__*/createElement(Box, {
1538
- display: "flex",
1539
- alignItems: "center",
1540
- borderRadius: "md",
1541
- cursor: "pointer",
1542
- _hover: {
1543
- backgroundColor: !isActive ? useColorModeValue('dove-gray.50', 'transparent') : activeBg
1544
- },
1545
- backgroundColor: isOpen && !isActive ? useColorModeValue('dove-gray.50', 'transparent') : activeBg,
1546
- color: isActive ? 'white' : 'inherit',
1547
- p: 2
1548
- }, /*#__PURE__*/createElement(Icon, {
1549
- as: navigation.icon,
1550
- mr: 2
1551
- }), /*#__PURE__*/createElement(Text, {
1552
- whiteSpace: "nowrap",
1553
- fontSize: "text.sm",
1554
- fontWeight: 400
1555
- }, navigation.title), /*#__PURE__*/createElement(ChevronDownIcon, {
1556
- ml: 2
1557
- }))), navigation.children && /*#__PURE__*/createElement(Portal, null, /*#__PURE__*/createElement(Box, {
1558
- zIndex: "popover"
1559
- }, /*#__PURE__*/createElement(PopoverContent, {
1560
- key: navigation.title,
1561
- bg: useColorModeValue('white', 'ebony-clay.800'),
1562
- maxW: 250,
1563
- border: "none",
1564
- borderRadius: "md",
1565
- boxShadow: "0 5px 25px rgb(0 0 0 / 10%)"
1566
- }, navigation.children.map(({
1567
- title,
1568
- navHost,
1569
- navLink,
1570
- icon
1571
- }) => {
1572
- const link = navHost ? `${navHost}${navLink}` : navLink;
1573
- const isActiveSub = activePath === navLink;
1574
- return /*#__PURE__*/createElement(Link, {
1575
- as: as,
1576
- key: title,
1577
- display: "flex",
1578
- position: "relative",
1579
- alignItems: "center",
1580
- transition: "padding 0.35s ease 0s",
1581
- _hover: {
1582
- backgroundColor: useColorModeValue('dove-gray.50', 'mirage.900'),
1583
- color: useColorModeValue('primary.500', 'dove-gray.600'),
1584
- px: 5,
1585
- py: 4,
1586
- _first: {
1587
- borderTopRadius: 'md'
1588
- },
1589
- _last: {
1590
- borderBottomRadius: 'md'
1591
- }
1592
- },
1593
- px: 6,
1594
- py: 4,
1595
- href: link,
1596
- color: isActiveSub ? 'primary.500' : 'inherit',
1597
- css: css`
1598
- border-spacing: 4px;
1599
- `
1600
- }, /*#__PURE__*/createElement(Icon, {
1601
- as: icon,
1602
- mr: 3
1603
- }), /*#__PURE__*/createElement(Text, {
1604
- fontSize: "text.sm"
1605
- }, title), isActiveSub && /*#__PURE__*/createElement(Box, {
1606
- width: 0.5,
1607
- height: 8,
1608
- position: "absolute",
1609
- bg: "primary.500",
1610
- right: 0,
1611
- zIndex: "popover"
1612
- }));
1613
- }))))));
1614
- }))));
1453
+ const fonts = {
1454
+ heading: `'Poppins', sans-serif`,
1455
+ body: `'Poppins', sans-serif`
1615
1456
  };
1616
- Navigation.defaultProps = {
1617
- navigations: undefined,
1618
- as: 'a'
1457
+ const fontWeights = {
1458
+ hairline: 100,
1459
+ thin: 200,
1460
+ light: 300,
1461
+ normal: 400,
1462
+ medium: 500,
1463
+ semibold: 600,
1464
+ bold: 700,
1465
+ extrabold: 800,
1466
+ black: 900
1619
1467
  };
1620
-
1621
- const PaginationButton = /*#__PURE__*/forwardRef$1(({
1622
- className,
1623
- style,
1624
- isActive,
1625
- children,
1626
- ...rest
1627
- }, ref) => {
1628
- const btnBg = useColorModeValue('neutral.300', 'mirage.900');
1629
- const btnColor = useColorModeValue('black.high', 'primary.300');
1630
- const btnNotActiveBg = useColorModeValue('secondary.50', 'primary.500');
1631
- const btnNotActiveColor = useColorModeValue('primary.500', 'white');
1632
- return /*#__PURE__*/React__default.createElement(Button$1, Object.assign({
1633
- "data-test-id": "Pagination-Button",
1634
- ref: ref,
1635
- className: className,
1636
- style: style,
1637
- borderRadius: 50,
1638
- fontWeight: 700,
1639
- m: 0,
1640
- px: 3,
1641
- py: 2,
1642
- h: 8,
1643
- minW: "auto",
1644
- background: isActive ? 'primary.500' : btnBg,
1645
- color: isActive ? 'white' : btnColor,
1646
- _hover: !isActive ? {
1647
- background: btnNotActiveBg,
1648
- color: btnNotActiveColor
1649
- } : {},
1650
- _disabled: {
1651
- background: useColorModeValue('neutral.300', 'mirage.900'),
1652
- color: 'neutral.600',
1653
- pointerEvents: 'none'
1654
- }
1655
- }, rest), children);
1656
- });
1657
- PaginationButton.displayName = 'PaginationButton';
1658
- PaginationButton.defaultProps = {
1659
- isActive: undefined
1468
+ const lineHeights = {
1469
+ normal: 'normal',
1470
+ none: 1,
1471
+ shorter: 1.25,
1472
+ short: 1.375,
1473
+ base: 1.5,
1474
+ tall: 1.625,
1475
+ 34: '2.125rem',
1476
+ 32: '2rem',
1477
+ 30: '1.875rem',
1478
+ 28: '1.75',
1479
+ 26: '1.625rem',
1480
+ 24: '1.5rem',
1481
+ 22: '1.375rem',
1482
+ 20: '1.25rem',
1483
+ 18: '1.125rem',
1484
+ 16: '1rem',
1485
+ 14: '0.875rem',
1486
+ 12: '0.75rem'
1660
1487
  };
1661
-
1662
- const PaginationButtonTrigger = ({
1663
- color,
1664
- isDisabled,
1665
- onClick,
1666
- visuallyHidden,
1667
- icon
1668
- }) => /*#__PURE__*/createElement(PaginationButton, {
1669
- "data-test-id": "DLVCc_fBK35spHm5WxjcJ",
1670
- color: color,
1671
- isDisabled: isDisabled,
1672
- onClick: onClick
1673
- }, /*#__PURE__*/createElement(VisuallyHidden, null, visuallyHidden), icon);
1674
- PaginationButtonTrigger.defaultProps = {
1675
- color: undefined,
1676
- isDisabled: undefined,
1677
- onClick: undefined,
1678
- visuallyHidden: undefined,
1679
- icon: undefined
1488
+ const fontSizes = {
1489
+ heading: {
1490
+ 1: '1.75rem',
1491
+ 2: '1.5rem',
1492
+ 3: '1.25rem',
1493
+ 4: '1.125rem',
1494
+ 5: '1rem',
1495
+ 6: '0.875rem'
1496
+ },
1497
+ text: {
1498
+ xl: '1.125rem',
1499
+ lg: '1rem',
1500
+ md: '0.875rem',
1501
+ sm: '0.75rem',
1502
+ xs: '0.625rem'
1503
+ },
1504
+ button: {
1505
+ lg: '1.125rem',
1506
+ md: '0.875rem',
1507
+ sm: '0.625rem'
1508
+ },
1509
+ field: {
1510
+ lg: '1rem',
1511
+ md: '0.875rem',
1512
+ sm: '0.75rem'
1513
+ },
1514
+ table: {
1515
+ header: '0.75rem'
1516
+ }
1680
1517
  };
1681
-
1682
- const Pagination = ({
1683
- className,
1684
- current,
1685
- total,
1686
- onSelect
1687
- }) => {
1688
- const btnColorDisabled = useColorModeValue('secondary.100', 'primary.500');
1689
- const btnColor = useColorModeValue('primary.500', 'secondary.100');
1690
- const disabledPrevious = current === 1;
1691
- const previousButtonColor = disabledPrevious ? btnColorDisabled : btnColor;
1692
- const disabledNext = current === total;
1693
- const nextButtonColor = disabledNext ? btnColorDisabled : btnColor;
1694
- const handleSelectPage = page => {
1695
- if (onSelect) {
1696
- onSelect(page);
1697
- }
1698
- };
1699
- const generatePages = () => {
1700
- const maxButtons = 5;
1701
- const pageButtons = [];
1702
- let startPage;
1703
- let endPage;
1704
- if ( maxButtons < total) {
1705
- startPage = Math.max(Math.min(current - Math.floor(maxButtons / 2), total - maxButtons + 1), 1);
1706
- endPage = startPage + maxButtons - 1;
1707
- } else {
1708
- startPage = 1;
1709
- endPage = total;
1710
- }
1711
- // eslint-disable-next-line no-plusplus
1712
- for (let page = startPage; page <= endPage; ++page) {
1713
- pageButtons.push(page);
1714
- }
1715
- return pageButtons;
1716
- };
1717
- return /*#__PURE__*/createElement(Box, {
1718
- className: className,
1719
- display: "inline-flex",
1720
- alignItems: "center"
1721
- }, /*#__PURE__*/createElement(Box, {
1722
- mr: 1
1723
- }, /*#__PURE__*/createElement(PaginationButtonTrigger, {
1724
- "data-test-id": "Pagination-Button",
1725
- color: previousButtonColor,
1726
- isDisabled: disabledPrevious,
1727
- onClick: () => handleSelectPage(1),
1728
- visuallyHidden: "First Page",
1729
- icon: /*#__PURE__*/createElement(ArrowLeftIcon, {
1730
- width: 2
1731
- })
1732
- })), /*#__PURE__*/createElement(Box, {
1733
- backgroundColor: useColorModeValue('neutral.300', 'mirage.900'),
1734
- borderRadius: 50
1735
- }, /*#__PURE__*/createElement(PaginationButtonTrigger, {
1736
- "data-test-id": "Pagination-Button",
1737
- color: previousButtonColor,
1738
- isDisabled: disabledPrevious,
1739
- onClick: () => handleSelectPage(current - 1),
1740
- visuallyHidden: "Previous Page",
1741
- icon: /*#__PURE__*/createElement(ChevronLeftIcon, null)
1742
- }), generatePages().map(page => {
1743
- return /*#__PURE__*/createElement(PaginationButton, {
1744
- "data-test-id": "Pagination-Button",
1745
- key: page,
1746
- isActive: page === current,
1747
- onClick: () => typeof page === 'number' ? handleSelectPage(page) : null
1748
- }, /*#__PURE__*/createElement(Text, {
1749
- scale: 300,
1750
- fontSize: "text.sm",
1751
- lineHeight: 18,
1752
- fontWeight: 500
1753
- }, page));
1754
- }), /*#__PURE__*/createElement(PaginationButtonTrigger, {
1755
- "data-test-id": "Pagination-Button",
1756
- color: nextButtonColor,
1757
- isDisabled: disabledNext,
1758
- onClick: () => handleSelectPage(current + 1),
1759
- visuallyHidden: "Next Page",
1760
- icon: /*#__PURE__*/createElement(ChevronRightIcon, null)
1761
- })), /*#__PURE__*/createElement(Box, {
1762
- ml: 1
1763
- }, /*#__PURE__*/createElement(PaginationButtonTrigger, {
1764
- "data-test-id": "Pagination-Button",
1765
- color: nextButtonColor,
1766
- isDisabled: disabledNext,
1767
- onClick: () => handleSelectPage(total),
1768
- visuallyHidden: "Last Page",
1769
- icon: /*#__PURE__*/createElement(ArrowRightIcon, {
1770
- width: 2
1771
- })
1772
- })));
1518
+ const heading = {
1519
+ 1: {
1520
+ fontSize: fontSizes.heading[1],
1521
+ fontWeight: 'bold',
1522
+ lineHeight: '3.5rem',
1523
+ letterSpacing: '0'
1524
+ },
1525
+ 2: {
1526
+ fontSize: fontSizes.heading[2],
1527
+ fontWeight: 'bold',
1528
+ lineHeight: '2.875rem',
1529
+ letterSpacing: '0'
1530
+ },
1531
+ 3: {
1532
+ fontSize: fontSizes.heading[3],
1533
+ fontWeight: 'bold',
1534
+ lineHeight: '2.5rem',
1535
+ letterSpacing: '0'
1536
+ },
1537
+ 4: {
1538
+ fontSize: fontSizes.heading[4],
1539
+ fontWeight: 'bold',
1540
+ lineHeight: '2rem',
1541
+ letterSpacing: '0'
1542
+ },
1543
+ 5: {
1544
+ fontSize: fontSizes.heading[5],
1545
+ fontWeight: 'bold',
1546
+ lineHeight: '1.5rem',
1547
+ letterSpacing: '0'
1548
+ },
1549
+ 6: {
1550
+ fontSize: fontSizes.heading[6],
1551
+ fontWeight: 'bold',
1552
+ lineHeight: '1.375rem',
1553
+ letterSpacing: '0'
1554
+ }
1773
1555
  };
1774
- Pagination.defaultProps = {
1775
- className: undefined,
1776
- onSelect: undefined
1556
+ const text = {
1557
+ xl: {
1558
+ fontSize: fontSizes.text.xl,
1559
+ lineHeight: lineHeights[28],
1560
+ letterSpacing: '0'
1561
+ },
1562
+ lg: {
1563
+ fontSize: fontSizes.text.lg,
1564
+ lineHeight: lineHeights[24],
1565
+ letterSpacing: '0'
1566
+ },
1567
+ md: {
1568
+ fontSize: fontSizes.text.md,
1569
+ lineHeight: lineHeights[22],
1570
+ letterSpacing: '0'
1571
+ },
1572
+ sm: {
1573
+ fontSize: fontSizes.text.sm,
1574
+ lineHeight: lineHeights[18],
1575
+ letterSpacing: '0'
1576
+ },
1577
+ xs: {
1578
+ fontSize: fontSizes.text.xs,
1579
+ lineHeight: lineHeights[14],
1580
+ letterSpacing: '0'
1581
+ }
1582
+ };
1583
+ const button = {
1584
+ lg: {
1585
+ fontSize: fontSizes.button.lg,
1586
+ lineHeight: lineHeights[28],
1587
+ letterSpacing: '0',
1588
+ fontWeight: fontWeights.normal
1589
+ },
1590
+ md: {
1591
+ fontSize: fontSizes.button.md,
1592
+ lineHeight: lineHeights[22],
1593
+ letterSpacing: '0',
1594
+ fontWeight: fontWeights.normal
1595
+ },
1596
+ sm: {
1597
+ fontSize: fontSizes.button.sm,
1598
+ lineHeight: lineHeights[14],
1599
+ letterSpacing: '0',
1600
+ fontWeight: fontWeights.normal
1601
+ }
1602
+ };
1603
+ const field = {
1604
+ lg: {
1605
+ fontSize: fontSizes.field.lg,
1606
+ lineHeight: lineHeights[24],
1607
+ letterSpacing: '0',
1608
+ fontWeight: fontWeights.normal
1609
+ },
1610
+ md: {
1611
+ fontSize: fontSizes.field.md,
1612
+ lineHeight: lineHeights[22],
1613
+ letterSpacing: '0',
1614
+ fontWeight: fontWeights.normal
1615
+ },
1616
+ sm: {
1617
+ fontSize: fontSizes.field.sm,
1618
+ lineHeight: lineHeights[18],
1619
+ letterSpacing: '0',
1620
+ fontWeight: fontWeights.normal
1621
+ }
1622
+ };
1623
+ const textStyles = {
1624
+ heading,
1625
+ text,
1626
+ button,
1627
+ field
1777
1628
  };
1778
- Pagination.displayName = 'Pagination';
1779
1629
 
1780
- const PaginationDetail = ({
1781
- page,
1782
- limit,
1783
- length,
1784
- scale = 300,
1785
- fontSize = 'xs',
1786
- lineHeight = 18,
1787
- ...rest
1788
- }) => {
1789
- return /*#__PURE__*/createElement(Text, Object.assign({
1790
- scale: scale,
1791
- fontSize: fontSize,
1792
- lineHeight: lineHeight
1793
- }, rest), `${(page - 1) * limit + 1}-${limit * page < length ? limit * page : length} dari ${length} item`);
1630
+
1631
+
1632
+ var foundations = {
1633
+ __proto__: null,
1634
+ colors: colors,
1635
+ radii: radius,
1636
+ space: spacing,
1637
+ sizes: sizes,
1638
+ fonts: fonts,
1639
+ fontSizes: fontSizes,
1640
+ lineHeights: lineHeights,
1641
+ textStyles: textStyles
1794
1642
  };
1795
1643
 
1796
- const PaginationFilter = ({
1797
- limit,
1798
- label = 'Baris per halaman:',
1799
- items,
1644
+ const MultiDateWrapper = /*#__PURE__*/styled(Box)`
1645
+ display: flex;
1646
+ align-items: center;
1647
+ width: fit-content;
1648
+ border: 1px solid;
1649
+ box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.05);
1650
+ border-radius: 4px;
1651
+ border-color: ${({
1652
+ isError
1653
+ }) => isError ? `${colors.danger[500]}` : `${colors.primary[500]}`};
1654
+ `;
1655
+ const MultiDatePickerMonth = ({
1800
1656
  onChange,
1801
- ...rest
1657
+ isError = false,
1658
+ min = '2020-01-01',
1659
+ max = '2020-12-31'
1802
1660
  }) => {
1803
- const [value, setValue] = useState(limit);
1804
- return /*#__PURE__*/createElement(Box, {
1805
- display: "flex",
1806
- flexDirection: "row",
1807
- alignItems: "center"
1808
- }, /*#__PURE__*/createElement(Text, Object.assign({
1809
- fontSize: "text.sm",
1810
- lineHeight: 18,
1811
- color: useColorModeValue('neutral.900', 'white')
1812
- }, rest), label), /*#__PURE__*/createElement(Select$1, {
1813
- textAlign: "center",
1814
- size: "xs",
1815
- outline: "none",
1816
- border: "none",
1817
- boxShadow: "none",
1818
- width: 18,
1819
- icon: /*#__PURE__*/createElement(FiChevronDown, null),
1820
- _focusVisible: {
1821
- boxShadow: 'none'
1661
+ const [date, setDate] = React__default.useState([null, null]);
1662
+ return /*#__PURE__*/React__default.createElement(MultiDateWrapper, {
1663
+ isError: isError
1664
+ }, /*#__PURE__*/React__default.createElement(DatePickerMonth, {
1665
+ "data-test-id": "CT_DatePickerMonth_StartDate",
1666
+ onChange: val => {
1667
+ onChange(val, date[1]);
1668
+ setDate([val, date[1]]);
1822
1669
  },
1823
- onChange: e => {
1824
- const numberValue = Number(e.target.value);
1825
- onChange(numberValue);
1826
- setValue(numberValue);
1670
+ min: min,
1671
+ max: max
1672
+ }), /*#__PURE__*/React__default.createElement(Box, null, "-"), /*#__PURE__*/React__default.createElement(DatePickerMonth, {
1673
+ "data-test-id": "CT_DatePickerMonth_EndDate",
1674
+ onChange: val => {
1675
+ onChange(date[0], val);
1676
+ setDate([date[0], val]);
1827
1677
  },
1828
- value: value
1829
- }, items.map(item => {
1830
- return /*#__PURE__*/createElement("option", {
1831
- key: item,
1832
- value: item
1833
- }, item);
1834
- })));
1678
+ min: min,
1679
+ max: max
1680
+ }));
1835
1681
  };
1836
- PaginationFilter.defaultProps = {
1837
- limit: 10,
1838
- label: undefined
1682
+ MultiDatePickerMonth.defaultProps = {
1683
+ min: '2020-01-01',
1684
+ max: '2020-12-31',
1685
+ isError: false
1839
1686
  };
1840
1687
 
1841
- const transparent = 'transparent';
1842
- const black = {
1843
- high: '#111111',
1844
- medium: '#707070',
1845
- low: '#B8B8B8'
1846
- };
1847
- const white = {
1848
- high: '#FFFFFF',
1849
- medium: '#F1F1F1',
1850
- low: '#CCCCCC'
1851
- };
1852
- const neutral = {
1853
- '50': '#FFFFFF',
1854
- '100': '#FAFAFA',
1855
- '200': '#F5F5F5',
1856
- '300': '#EEEEEE',
1857
- '400': '#E0E0E0',
1858
- '500': '#BDBDBD',
1859
- '600': '#999999',
1860
- '700': '#242424',
1861
- '800': '#181818',
1862
- '900': '#111111'
1863
- };
1864
- const primary = {
1865
- '50': '#DFFFF1',
1866
- '100': '#ACF5D5',
1867
- '200': '#5EE5A9',
1868
- '300': '#05CB72',
1869
- '400': '#08A45E',
1870
- '500': '#12784A',
1871
- '600': '#0B603A',
1872
- '700': '#075331',
1873
- '800': '#064126',
1874
- '900': '#042E1B'
1875
- };
1876
- const secondary = {
1877
- '50': '#F2F2F3',
1878
- '100': '#DADBDD',
1879
- '200': '#C2C4C7',
1880
- '300': '#AAADB0',
1881
- '400': '#93969A',
1882
- '500': '#7B7F84',
1883
- '600': '#62666A',
1884
- '700': '#4A4C4F',
1885
- '800': '#313335',
1886
- '900': '#19191A'
1887
- };
1888
- const success = {
1889
- '50': '#ECFFED',
1890
- '100': '#D3FCD5',
1891
- '200': '#A9F9B5',
1892
- '300': '#7CEE98',
1893
- '400': '#58DD86',
1894
- '500': '#28c76f',
1895
- '600': '#1DAB6A',
1896
- '700': '#148F63',
1897
- '800': '#0C7359',
1898
- '900': '#075F51'
1899
- };
1900
- const danger = {
1901
- '50': '#FFEDEC',
1902
- '100': '#FFC7C2',
1903
- '200': '#FF8279',
1904
- '300': '#FF5B4F',
1905
- '400': '#F44336',
1906
- '500': '#D82F23',
1907
- '600': '#B71C1C',
1908
- '700': '#930B0B',
1909
- '800': '#660909',
1910
- '900': '#3E0707'
1911
- };
1912
- const warning = {
1913
- '50': '#FFF9EC',
1914
- '100': '#FFEFCC',
1915
- '200': '#FFD591',
1916
- '300': '#FFC069',
1917
- '400': '#FFA230',
1918
- '500': '#F68522',
1919
- '600': '#EF6C00',
1920
- '700': '#C65B03',
1921
- '800': '#9F4901',
1922
- '900': '#652E00'
1923
- };
1924
- const info = {
1925
- '50': '#EBFFFB',
1926
- '100': '#CBFDF2',
1927
- '200': '#97FCEF',
1928
- '300': '#63F8F0',
1929
- '400': '#3CECF1',
1930
- '500': '#00CFE8',
1931
- '600': '#00A1C7',
1932
- '700': '#007AA7',
1933
- '800': '#005786',
1934
- '900': '#003F6F'
1935
- };
1936
- const dark = {
1937
- '50': '#F2F2F2',
1938
- '100': '#DBDBDB',
1939
- '200': '#C4C4C4',
1940
- '300': '#ADADAD',
1941
- '400': '#969696',
1942
- '500': '#808080',
1943
- '600': '#666666',
1944
- '700': '#4D4D4D',
1945
- '800': '#333333',
1946
- '900': '#1A1A1A'
1947
- };
1948
- const mirage = {
1949
- '50': '#EDF0F7',
1950
- '100': '#CED5E9',
1951
- '200': '#AEBADB',
1952
- '300': '#8E9ECC',
1953
- '400': '#6F83BE',
1954
- '500': '#4F68B0',
1955
- '600': '#3F538D',
1956
- '700': '#2F3E6A',
1957
- '800': '#202A46',
1958
- '900': '#101523'
1959
- };
1960
- const ebonyClay = {
1961
- '50': '#EFF1F6',
1962
- '100': '#D2D7E5',
1963
- '200': '#B4BDD4',
1964
- '300': '#97A3C4',
1965
- '400': '#7A89B3',
1966
- '500': '#5D6FA2',
1967
- '600': '#4A5982',
1968
- '700': '#384361',
1969
- '800': '#252D41',
1970
- '900': '#131620'
1971
- };
1972
- const brightGray = {
1973
- '50': '#F0F1F4',
1974
- '100': '#D5D9E1',
1975
- '200': '#BAC0CE',
1976
- '300': '#A0A8BB',
1977
- '400': '#858FA8',
1978
- '500': '#6A7795',
1979
- '600': '#555F77',
1980
- '700': '#404759',
1981
- '800': '#2A2F3C',
1982
- '900': '#15181E'
1983
- };
1984
- const doveGray = {
1985
- '50': '#F2F2F2',
1986
- '100': '#DBDBDB',
1987
- '200': '#C4C4C4',
1988
- '300': '#ADADAD',
1989
- '400': '#969696',
1990
- '500': '#808080',
1991
- '600': '#666666',
1992
- '700': '#4D4D4D',
1993
- '800': '#333333',
1994
- '900': '#1A1A1A'
1995
- };
1996
- const colors = {
1997
- transparent,
1998
- black,
1999
- white,
2000
- neutral,
2001
- primary,
2002
- secondary,
2003
- success,
2004
- danger,
2005
- warning,
2006
- info,
2007
- dark,
2008
- mirage,
2009
- 'ebony-clay': ebonyClay,
2010
- 'bright-gray': brightGray,
2011
- 'dove-gray': doveGray
1688
+ /* eslint-disable no-nested-ternary */
1689
+ const Field = props => {
1690
+ const {
1691
+ label,
1692
+ isError,
1693
+ error,
1694
+ helperText,
1695
+ isRequired,
1696
+ children
1697
+ } = props;
1698
+ return /*#__PURE__*/React__default.createElement(FormControl, {
1699
+ isInvalid: isError
1700
+ }, label && (typeof label === 'string' ? /*#__PURE__*/React__default.createElement(FormLabel$1, {
1701
+ fontSize: "field.sm",
1702
+ requiredIndicator: undefined
1703
+ }, isRequired && /*#__PURE__*/React__default.createElement(Box, {
1704
+ as: "span",
1705
+ color: "red.500",
1706
+ ml: 0,
1707
+ mr: 1
1708
+ }, "*"), label) : label), children, !isError ? helperText && /*#__PURE__*/React__default.createElement(FormHelperText, {
1709
+ fontSize: "field.sm"
1710
+ }, helperText) : typeof error === 'string' ? /*#__PURE__*/React__default.createElement(FormErrorMessage, {
1711
+ textStyle: "field.sm",
1712
+ fontSize: "field.sm",
1713
+ mt: 1,
1714
+ marginStart: 1
1715
+ }, error) : error);
2012
1716
  };
2013
-
2014
- const radius = {
2015
- none: 0,
2016
- sm: '2px',
2017
- md: '4px',
2018
- lg: '8px',
2019
- full: '9999px'
1717
+ Field.defaultProps = {
1718
+ label: '',
1719
+ isError: false,
1720
+ error: undefined,
1721
+ helperText: undefined,
1722
+ isRequired: false
2020
1723
  };
2021
1724
 
2022
- const spacing = {
2023
- ...theme$1.space,
2024
- 4.5: '1.125rem',
2025
- 9.5: '2.375rem',
2026
- 18: '4.5rem',
2027
- 22: '5.5rem',
2028
- 26: '6.5rem',
2029
- 30: '7.5rem'
1725
+ const InputField = /*#__PURE__*/React__default.forwardRef((props, ref) => {
1726
+ const {
1727
+ value,
1728
+ type,
1729
+ addOnLeft,
1730
+ addOnRight,
1731
+ elementLeft,
1732
+ elementRight,
1733
+ size,
1734
+ isRequired,
1735
+ label,
1736
+ isError,
1737
+ error,
1738
+ helperText,
1739
+ ...inputProps
1740
+ } = props;
1741
+ return /*#__PURE__*/React__default.createElement(Field, {
1742
+ label: label,
1743
+ isError: isError,
1744
+ error: error,
1745
+ helperText: helperText,
1746
+ isRequired: isRequired
1747
+ }, /*#__PURE__*/React__default.createElement(InputGroup, {
1748
+ size: size
1749
+ }, addOnLeft && /*#__PURE__*/React__default.createElement(InputLeftAddon, null, addOnLeft), elementLeft && /*#__PURE__*/React__default.createElement(InputLeftElement, null, elementLeft), /*#__PURE__*/React__default.createElement(Input$1, Object.assign({
1750
+ ref: ref,
1751
+ type: type,
1752
+ value: value
1753
+ }, inputProps)), addOnRight && /*#__PURE__*/React__default.createElement(InputRightAddon, null, addOnRight), elementRight && /*#__PURE__*/React__default.createElement(InputRightElement, null, elementRight)));
1754
+ });
1755
+ InputField.defaultProps = {
1756
+ addOnLeft: undefined,
1757
+ addOnRight: undefined,
1758
+ elementLeft: undefined,
1759
+ elementRight: undefined
2030
1760
  };
2031
1761
 
2032
- const sizes = {
2033
- ...theme$1.sizes,
2034
- 4.5: '1.125rem',
2035
- 9.5: '2.375rem',
2036
- 18: '4.5rem',
2037
- 22: '5.5rem',
2038
- 26: '6.5rem',
2039
- 30: '7.5rem'
1762
+ const TextareaField = /*#__PURE__*/React__default.forwardRef((props, ref) => {
1763
+ const {
1764
+ value,
1765
+ ...inputProps
1766
+ } = props;
1767
+ return /*#__PURE__*/React__default.createElement(Field, Object.assign({}, inputProps), /*#__PURE__*/React__default.createElement(Textarea$1, Object.assign({
1768
+ ref: ref,
1769
+ value: value
1770
+ }, inputProps)));
1771
+ });
1772
+ TextareaField.defaultProps = {
1773
+ addOnLeft: undefined,
1774
+ addOnRight: undefined,
1775
+ elementLeft: undefined,
1776
+ elementRight: undefined
2040
1777
  };
2041
1778
 
2042
- const fonts = {
2043
- heading: `'Poppins', sans-serif`,
2044
- body: `'Poppins', sans-serif`
2045
- };
2046
- const fontWeights = {
2047
- hairline: 100,
2048
- thin: 200,
2049
- light: 300,
2050
- normal: 400,
2051
- medium: 500,
2052
- semibold: 600,
2053
- bold: 700,
2054
- extrabold: 800,
2055
- black: 900
1779
+ const XMSLogo = () => /*#__PURE__*/React__default.createElement(Image, {
1780
+ height: 8,
1781
+ src: useColorModeValue('https://assets.voila.id/xms/logo-xms.jpg', 'https://assets.voila.id/xms/logo-xms-dark.png')
1782
+ });
1783
+ const VoilaLogo = () => /*#__PURE__*/React__default.createElement(Image, {
1784
+ src: "https://s3.ap-southeast-1.amazonaws.com/assets.voila.id/xms/logo-voila-black.png?v=1",
1785
+ filter: useColorModeValue('none', 'invert(1)'),
1786
+ maxW: 24
1787
+ });
1788
+
1789
+ const Profile = ({
1790
+ data,
1791
+ onLogout
1792
+ }) => {
1793
+ var _data$name;
1794
+ const {
1795
+ isOpen,
1796
+ onToggle,
1797
+ onClose
1798
+ } = useDisclosure();
1799
+ return /*#__PURE__*/createElement(Popover$1, {
1800
+ placement: "bottom-end",
1801
+ isOpen: isOpen,
1802
+ onClose: onClose
1803
+ }, /*#__PURE__*/createElement(Box, {
1804
+ "data-test-id": "WE0UYbA93LOZy6S09IhDO",
1805
+ as: "button",
1806
+ cursor: 'pointer',
1807
+ minW: 0,
1808
+ _hover: {
1809
+ textDecor: 'none'
1810
+ },
1811
+ m: 0,
1812
+ onClick: onToggle
1813
+ }, /*#__PURE__*/createElement(HStack, null, /*#__PURE__*/createElement(VStack, {
1814
+ alignItems: "flex-end",
1815
+ spacing: -0.5,
1816
+ ml: "2"
1817
+ }, /*#__PURE__*/createElement(Text, {
1818
+ fontSize: "text.xs",
1819
+ mb: 1,
1820
+ fontWeight: 400,
1821
+ lineHeight: "14px",
1822
+ color: useColorModeValue('neutral.800', 'white')
1823
+ }, data === null || data === void 0 ? void 0 : data.email), /*#__PURE__*/createElement(Text, {
1824
+ fontSize: "text.xs",
1825
+ fontWeight: 400,
1826
+ lineHeight: "14px",
1827
+ color: useColorModeValue('primary.500', 'success.400')
1828
+ }, (data === null || data === void 0 ? void 0 : data.office) && /*#__PURE__*/createElement(Text, {
1829
+ color: "neutral.700",
1830
+ display: "inline-block",
1831
+ mr: 0.5
1832
+ }, data.office, " |", ' '), data === null || data === void 0 ? void 0 : data.userRole)), /*#__PURE__*/createElement(PopoverTrigger, null, /*#__PURE__*/createElement(Avatar, {
1833
+ size: 'sm',
1834
+ bg: "primary.500",
1835
+ color: "white",
1836
+ name: (_data$name = data === null || data === void 0 ? void 0 : data.name) !== null && _data$name !== void 0 ? _data$name : data === null || data === void 0 ? void 0 : data.email
1837
+ })))), /*#__PURE__*/createElement(PopoverContent, {
1838
+ bg: useColorModeValue('white', 'mirage.900'),
1839
+ maxW: 200
1840
+ }, /*#__PURE__*/createElement(PopoverArrow, {
1841
+ bg: useColorModeValue('white', 'mirage.900')
1842
+ }), /*#__PURE__*/createElement(PopoverBody, {
1843
+ p: 1
1844
+ }, /*#__PURE__*/createElement(Flex, {
1845
+ "data-test-id": "gA7F9pucPX_Q3_dkgXIYZ",
1846
+ alignItems: "center",
1847
+ px: 3,
1848
+ py: 2,
1849
+ borderRadius: "sm",
1850
+ cursor: "pointer",
1851
+ _hover: {
1852
+ bg: useColorModeValue('primary.500', 'mirage.900'),
1853
+ color: 'white'
1854
+ },
1855
+ onClick: onLogout,
1856
+ fontSize: "text.xs"
1857
+ }, /*#__PURE__*/createElement(FiPower, null), /*#__PURE__*/createElement(Text, {
1858
+ ml: 2
1859
+ }, "Logout")))));
2056
1860
  };
2057
- const lineHeights = {
2058
- normal: 'normal',
2059
- none: 1,
2060
- shorter: 1.25,
2061
- short: 1.375,
2062
- base: 1.5,
2063
- tall: 1.625,
2064
- 34: '2.125rem',
2065
- 32: '2rem',
2066
- 30: '1.875rem',
2067
- 28: '1.75',
2068
- 26: '1.625rem',
2069
- 24: '1.5rem',
2070
- 22: '1.375rem',
2071
- 20: '1.25rem',
2072
- 18: '1.125rem',
2073
- 16: '1rem',
2074
- 14: '0.875rem',
2075
- 12: '0.75rem'
1861
+ Profile.defaultProps = {
1862
+ data: undefined,
1863
+ onLogout: undefined
2076
1864
  };
2077
- const fontSizes = {
2078
- heading: {
2079
- 1: '1.75rem',
2080
- 2: '1.5rem',
2081
- 3: '1.25rem',
2082
- 4: '1.125rem',
2083
- 5: '1rem',
2084
- 6: '0.875rem'
2085
- },
2086
- text: {
2087
- xl: '1.125rem',
2088
- lg: '1rem',
2089
- md: '0.875rem',
2090
- sm: '0.75rem',
2091
- xs: '0.625rem'
2092
- },
2093
- button: {
2094
- lg: '1.125rem',
2095
- md: '0.875rem',
2096
- sm: '0.625rem'
2097
- },
2098
- field: {
2099
- lg: '1rem',
2100
- md: '0.875rem',
2101
- sm: '0.75rem'
2102
- },
2103
- table: {
2104
- header: '0.75rem'
2105
- }
1865
+
1866
+ const SwitchMode = () => {
1867
+ const {
1868
+ colorMode,
1869
+ toggleColorMode
1870
+ } = useColorMode$1();
1871
+ return /*#__PURE__*/createElement(Box, {
1872
+ "data-test-id": "rhYuTDCiWkFqr96upiEEh",
1873
+ mx: 5,
1874
+ onClick: toggleColorMode,
1875
+ cursor: "pointer"
1876
+ }, colorMode === 'light' ? /*#__PURE__*/createElement(FiMoon, {
1877
+ size: 20
1878
+ }) : /*#__PURE__*/createElement(FiSun, {
1879
+ size: 20
1880
+ }));
2106
1881
  };
2107
- const heading = {
2108
- 1: {
2109
- fontSize: fontSizes.heading[1],
2110
- fontWeight: 'bold',
2111
- lineHeight: '3.5rem',
2112
- letterSpacing: '0'
2113
- },
2114
- 2: {
2115
- fontSize: fontSizes.heading[2],
2116
- fontWeight: 'bold',
2117
- lineHeight: '2.875rem',
2118
- letterSpacing: '0'
2119
- },
2120
- 3: {
2121
- fontSize: fontSizes.heading[3],
2122
- fontWeight: 'bold',
2123
- lineHeight: '2.5rem',
2124
- letterSpacing: '0'
2125
- },
2126
- 4: {
2127
- fontSize: fontSizes.heading[4],
2128
- fontWeight: 'bold',
2129
- lineHeight: '2rem',
2130
- letterSpacing: '0'
2131
- },
2132
- 5: {
2133
- fontSize: fontSizes.heading[5],
2134
- fontWeight: 'bold',
2135
- lineHeight: '1.5rem',
2136
- letterSpacing: '0'
2137
- },
2138
- 6: {
2139
- fontSize: fontSizes.heading[6],
2140
- fontWeight: 'bold',
2141
- lineHeight: '1.375rem',
2142
- letterSpacing: '0'
1882
+
1883
+ // eslint-disable-next-line import/prefer-default-export
1884
+ function environmentName(env) {
1885
+ switch (env) {
1886
+ case 'DEVELOPMENT':
1887
+ return 'Dev';
1888
+ case 'STAGING':
1889
+ return 'Staging';
1890
+ default:
1891
+ return null;
2143
1892
  }
1893
+ }
1894
+
1895
+ /* eslint-disable react-hooks/rules-of-hooks */
1896
+ const Version = ({
1897
+ version,
1898
+ environment,
1899
+ onOpenModalRelease
1900
+ }) => /*#__PURE__*/createElement(Fragment, null, version && /*#__PURE__*/createElement(Badge, {
1901
+ "data-test-id": "dzl3esjhCphobaaIXpiUE",
1902
+ bg: useColorModeValue('primary.500', 'rgba(124, 124, 124, 0.12)'),
1903
+ color: useColorModeValue('white', 'secondary.400'),
1904
+ fontSize: "text.xs",
1905
+ py: 1,
1906
+ px: 2.5,
1907
+ fontWeight: "bold",
1908
+ textTransform: "lowercase",
1909
+ borderRadius: "md",
1910
+ onClick: onOpenModalRelease,
1911
+ cursor: onOpenModalRelease ? 'pointer' : 'auto'
1912
+ }, version), environmentName(environment) !== null && version && /*#__PURE__*/createElement(Box, {
1913
+ background: "primary.50",
1914
+ color: "primary.500",
1915
+ fontSize: "text.xs",
1916
+ py: 1,
1917
+ px: 2.5,
1918
+ fontWeight: "bold",
1919
+ borderRadius: "md"
1920
+ }, environmentName(environment)));
1921
+ Version.defaultProps = {
1922
+ environment: undefined,
1923
+ version: undefined,
1924
+ onOpenModalRelease: undefined
2144
1925
  };
2145
- const text = {
2146
- xl: {
2147
- fontSize: fontSizes.text.xl,
2148
- lineHeight: lineHeights[28],
2149
- letterSpacing: '0'
2150
- },
2151
- lg: {
2152
- fontSize: fontSizes.text.lg,
2153
- lineHeight: lineHeights[24],
2154
- letterSpacing: '0'
2155
- },
2156
- md: {
2157
- fontSize: fontSizes.text.md,
2158
- lineHeight: lineHeights[22],
2159
- letterSpacing: '0'
2160
- },
2161
- sm: {
2162
- fontSize: fontSizes.text.sm,
2163
- lineHeight: lineHeights[18],
2164
- letterSpacing: '0'
2165
- },
2166
- xs: {
2167
- fontSize: fontSizes.text.xs,
2168
- lineHeight: lineHeights[14],
2169
- letterSpacing: '0'
2170
- }
1926
+
1927
+ const Header = ({
1928
+ data,
1929
+ onLogout,
1930
+ onOpenModalRelease,
1931
+ ...props
1932
+ }) => /*#__PURE__*/createElement(Box, Object.assign({
1933
+ minH: 14,
1934
+ bg: useColorModeValue('white', 'ebony-clay.800'),
1935
+ boxShadow: "0 4px 20px 0 rgb(0 0 0 / 5%)",
1936
+ px: 4,
1937
+ py: 1
1938
+ }, props), /*#__PURE__*/createElement(Flex, {
1939
+ h: 14,
1940
+ alignItems: "center",
1941
+ justifyContent: "space-between"
1942
+ }, /*#__PURE__*/createElement(XMSLogo, null), /*#__PURE__*/createElement(HStack, {
1943
+ spacing: 2,
1944
+ alignItems: "center"
1945
+ }, /*#__PURE__*/createElement(VoilaLogo, null), /*#__PURE__*/createElement(Version, {
1946
+ version: data === null || data === void 0 ? void 0 : data.version,
1947
+ environment: data === null || data === void 0 ? void 0 : data.environment,
1948
+ onOpenModalRelease: onOpenModalRelease
1949
+ })), /*#__PURE__*/createElement(Flex, {
1950
+ alignItems: "center"
1951
+ }, /*#__PURE__*/createElement(SwitchMode, null), /*#__PURE__*/createElement(Profile, {
1952
+ data: data,
1953
+ onLogout: onLogout
1954
+ }))));
1955
+ Header.defaultProps = {
1956
+ data: undefined,
1957
+ onLogout: undefined,
1958
+ onOpenModalRelease: undefined
2171
1959
  };
2172
- const button = {
2173
- lg: {
2174
- fontSize: fontSizes.button.lg,
2175
- lineHeight: lineHeights[28],
2176
- letterSpacing: '0',
2177
- fontWeight: fontWeights.normal
2178
- },
2179
- md: {
2180
- fontSize: fontSizes.button.md,
2181
- lineHeight: lineHeights[22],
2182
- letterSpacing: '0',
2183
- fontWeight: fontWeights.normal
2184
- },
2185
- sm: {
2186
- fontSize: fontSizes.button.sm,
2187
- lineHeight: lineHeights[14],
2188
- letterSpacing: '0',
2189
- fontWeight: fontWeights.normal
2190
- }
1960
+
1961
+ const ModalBody = /*#__PURE__*/React__default.forwardRef(({
1962
+ children,
1963
+ ...rest
1964
+ }, ref) => {
1965
+ return /*#__PURE__*/React__default.createElement(ModalBody$1, Object.assign({
1966
+ ref: ref,
1967
+ background: useColorModeValue('white', 'mirage.900')
1968
+ }, rest), children);
1969
+ });
1970
+
1971
+ const ModalCloseButton = /*#__PURE__*/forwardRef((props, ref) => {
1972
+ return /*#__PURE__*/React__default.createElement(ModalCloseButton$1, Object.assign({
1973
+ ref: ref,
1974
+ top: 4,
1975
+ right: 4,
1976
+ size: "sm",
1977
+ background: useColorModeValue('neutral.50', 'mirage.900')
1978
+ }, props));
1979
+ });
1980
+
1981
+ const ModalFooter = /*#__PURE__*/forwardRef(({
1982
+ children,
1983
+ ...rest
1984
+ }, ref) => {
1985
+ return /*#__PURE__*/React__default.createElement(ModalFooter$1, Object.assign({
1986
+ ref: ref,
1987
+ background: useColorModeValue('neutral.200', 'mirage.900'),
1988
+ borderBottomRadius: "md"
1989
+ }, rest), children);
1990
+ });
1991
+
1992
+ const ModalHeader = /*#__PURE__*/forwardRef(({
1993
+ children,
1994
+ ...rest
1995
+ }, ref) => {
1996
+ return /*#__PURE__*/React__default.createElement(ModalHeader$1, Object.assign({
1997
+ ref: ref,
1998
+ background: useColorModeValue('neutral.200', 'mirage.900'),
1999
+ borderTopRadius: 'md',
2000
+ fontSize: 'lg'
2001
+ }, rest), children);
2002
+ });
2003
+
2004
+ /* eslint-disable react-hooks/rules-of-hooks */
2005
+ const Navigation = ({
2006
+ navigations,
2007
+ activePath,
2008
+ as,
2009
+ host,
2010
+ ...props
2011
+ }) => {
2012
+ return /*#__PURE__*/createElement(Box, Object.assign({
2013
+ bg: useColorModeValue('white', 'ebony-clay.800'),
2014
+ boxShadow: "0 4px 20px 0 rgb(0 0 0 / 5%)",
2015
+ borderRadius: "md",
2016
+ overflowX: "auto"
2017
+ }, props), /*#__PURE__*/createElement(Flex, {
2018
+ alignItems: "center",
2019
+ p: 2
2020
+ }, /*#__PURE__*/createElement(HStack, {
2021
+ spacing: 2
2022
+ }, navigations === null || navigations === void 0 ? void 0 : navigations.map(navigation => {
2023
+ const isActive = activePath.startsWith(navigation.navLink || '');
2024
+ const activeBg = isActive ? 'primary.500' : undefined;
2025
+ return /*#__PURE__*/createElement(Popover$1, {
2026
+ key: navigation.title,
2027
+ trigger: "hover",
2028
+ placement: "bottom-start"
2029
+ }, ({
2030
+ isOpen
2031
+ }) => /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(PopoverTrigger, null, /*#__PURE__*/createElement(Box, {
2032
+ display: "flex",
2033
+ alignItems: "center",
2034
+ borderRadius: "md",
2035
+ cursor: "pointer",
2036
+ _hover: {
2037
+ backgroundColor: !isActive ? useColorModeValue('dove-gray.50', 'transparent') : activeBg
2038
+ },
2039
+ backgroundColor: isOpen && !isActive ? useColorModeValue('dove-gray.50', 'transparent') : activeBg,
2040
+ color: isActive ? 'white' : 'inherit',
2041
+ p: 2
2042
+ }, /*#__PURE__*/createElement(Icon, {
2043
+ as: navigation.icon,
2044
+ mr: 2
2045
+ }), /*#__PURE__*/createElement(Text, {
2046
+ whiteSpace: "nowrap",
2047
+ fontSize: "text.sm",
2048
+ fontWeight: 400
2049
+ }, navigation.title), /*#__PURE__*/createElement(ChevronDownIcon, {
2050
+ ml: 2
2051
+ }))), navigation.children && /*#__PURE__*/createElement(Portal, null, /*#__PURE__*/createElement(Box, {
2052
+ zIndex: "popover"
2053
+ }, /*#__PURE__*/createElement(PopoverContent, {
2054
+ key: navigation.title,
2055
+ bg: useColorModeValue('white', 'ebony-clay.800'),
2056
+ maxW: 250,
2057
+ border: "none",
2058
+ borderRadius: "md",
2059
+ boxShadow: "0 5px 25px rgb(0 0 0 / 10%)"
2060
+ }, navigation.children.map(({
2061
+ title,
2062
+ navHost,
2063
+ navLink,
2064
+ icon
2065
+ }) => {
2066
+ const link = navHost ? `${navHost}${navLink}` : navLink;
2067
+ const isLocalLink = host === navHost;
2068
+ const isActiveSub = activePath === navLink;
2069
+ return /*#__PURE__*/createElement(Link, {
2070
+ as: isLocalLink ? as : undefined,
2071
+ key: title,
2072
+ href: link,
2073
+ _hover: {
2074
+ textDecoration: 'none'
2075
+ }
2076
+ }, /*#__PURE__*/createElement(Box, {
2077
+ display: "flex",
2078
+ position: "relative",
2079
+ alignItems: "center",
2080
+ transition: "padding 0.35s ease 0s",
2081
+ _hover: {
2082
+ backgroundColor: useColorModeValue('dove-gray.50', 'mirage.900'),
2083
+ color: useColorModeValue('primary.500', 'dove-gray.600'),
2084
+ px: 5,
2085
+ py: 4,
2086
+ _first: {
2087
+ borderTopRadius: 'md'
2088
+ },
2089
+ _last: {
2090
+ borderBottomRadius: 'md'
2091
+ }
2092
+ },
2093
+ color: isActiveSub ? 'primary.500' : 'inherit',
2094
+ css: css`
2095
+ border-spacing: 4px;
2096
+ `,
2097
+ px: 6,
2098
+ py: 4
2099
+ }, /*#__PURE__*/createElement(Icon, {
2100
+ as: icon,
2101
+ mr: 3
2102
+ }), /*#__PURE__*/createElement(Text, {
2103
+ fontSize: "text.sm"
2104
+ }, title), isActiveSub && /*#__PURE__*/createElement(Box, {
2105
+ width: 0.5,
2106
+ height: 8,
2107
+ position: "absolute",
2108
+ bg: "primary.500",
2109
+ right: 0,
2110
+ zIndex: "popover"
2111
+ })));
2112
+ }))))));
2113
+ }))));
2191
2114
  };
2192
- const field = {
2193
- lg: {
2194
- fontSize: fontSizes.field.lg,
2195
- lineHeight: lineHeights[24],
2196
- letterSpacing: '0',
2197
- fontWeight: fontWeights.normal
2198
- },
2199
- md: {
2200
- fontSize: fontSizes.field.md,
2201
- lineHeight: lineHeights[22],
2202
- letterSpacing: '0',
2203
- fontWeight: fontWeights.normal
2204
- },
2205
- sm: {
2206
- fontSize: fontSizes.field.sm,
2207
- lineHeight: lineHeights[18],
2208
- letterSpacing: '0',
2209
- fontWeight: fontWeights.normal
2210
- }
2115
+ Navigation.defaultProps = {
2116
+ navigations: undefined,
2117
+ as: 'a',
2118
+ host: undefined
2211
2119
  };
2212
- const textStyles = {
2213
- heading,
2214
- text,
2215
- button,
2216
- field
2120
+
2121
+ const PaginationButton = /*#__PURE__*/forwardRef$1(({
2122
+ className,
2123
+ style,
2124
+ isActive,
2125
+ children,
2126
+ ...rest
2127
+ }, ref) => {
2128
+ const btnBg = useColorModeValue('neutral.300', 'mirage.900');
2129
+ const btnColor = useColorModeValue('black.high', 'primary.300');
2130
+ const btnNotActiveBg = useColorModeValue('secondary.50', 'primary.500');
2131
+ const btnNotActiveColor = useColorModeValue('primary.500', 'white');
2132
+ return /*#__PURE__*/React__default.createElement(Button$1, Object.assign({
2133
+ "data-test-id": "Pagination-Button",
2134
+ ref: ref,
2135
+ className: className,
2136
+ style: style,
2137
+ borderRadius: 50,
2138
+ fontWeight: 700,
2139
+ m: 0,
2140
+ px: 3,
2141
+ py: 2,
2142
+ h: 8,
2143
+ minW: "auto",
2144
+ background: isActive ? 'primary.500' : btnBg,
2145
+ color: isActive ? 'white' : btnColor,
2146
+ _hover: !isActive ? {
2147
+ background: btnNotActiveBg,
2148
+ color: btnNotActiveColor
2149
+ } : {},
2150
+ _disabled: {
2151
+ background: useColorModeValue('neutral.300', 'mirage.900'),
2152
+ color: 'neutral.600',
2153
+ pointerEvents: 'none'
2154
+ }
2155
+ }, rest), children);
2156
+ });
2157
+ PaginationButton.displayName = 'PaginationButton';
2158
+ PaginationButton.defaultProps = {
2159
+ isActive: undefined
2160
+ };
2161
+
2162
+ const PaginationButtonTrigger = ({
2163
+ color,
2164
+ isDisabled,
2165
+ onClick,
2166
+ visuallyHidden,
2167
+ icon
2168
+ }) => /*#__PURE__*/createElement(PaginationButton, {
2169
+ "data-test-id": "DLVCc_fBK35spHm5WxjcJ",
2170
+ color: color,
2171
+ isDisabled: isDisabled,
2172
+ onClick: onClick
2173
+ }, /*#__PURE__*/createElement(VisuallyHidden, null, visuallyHidden), icon);
2174
+ PaginationButtonTrigger.defaultProps = {
2175
+ color: undefined,
2176
+ isDisabled: undefined,
2177
+ onClick: undefined,
2178
+ visuallyHidden: undefined,
2179
+ icon: undefined
2217
2180
  };
2218
2181
 
2182
+ const Pagination = ({
2183
+ className,
2184
+ current,
2185
+ total,
2186
+ onSelect
2187
+ }) => {
2188
+ const btnColorDisabled = useColorModeValue('secondary.100', 'primary.500');
2189
+ const btnColor = useColorModeValue('primary.500', 'secondary.100');
2190
+ const disabledPrevious = current === 1;
2191
+ const previousButtonColor = disabledPrevious ? btnColorDisabled : btnColor;
2192
+ const disabledNext = current === total;
2193
+ const nextButtonColor = disabledNext ? btnColorDisabled : btnColor;
2194
+ const handleSelectPage = page => {
2195
+ if (onSelect) {
2196
+ onSelect(page);
2197
+ }
2198
+ };
2199
+ const generatePages = () => {
2200
+ const maxButtons = 5;
2201
+ const pageButtons = [];
2202
+ let startPage;
2203
+ let endPage;
2204
+ if ( maxButtons < total) {
2205
+ startPage = Math.max(Math.min(current - Math.floor(maxButtons / 2), total - maxButtons + 1), 1);
2206
+ endPage = startPage + maxButtons - 1;
2207
+ } else {
2208
+ startPage = 1;
2209
+ endPage = total;
2210
+ }
2211
+ // eslint-disable-next-line no-plusplus
2212
+ for (let page = startPage; page <= endPage; ++page) {
2213
+ pageButtons.push(page);
2214
+ }
2215
+ return pageButtons;
2216
+ };
2217
+ return /*#__PURE__*/createElement(Box, {
2218
+ className: className,
2219
+ display: "inline-flex",
2220
+ alignItems: "center"
2221
+ }, /*#__PURE__*/createElement(Box, {
2222
+ mr: 1
2223
+ }, /*#__PURE__*/createElement(PaginationButtonTrigger, {
2224
+ "data-test-id": "Pagination-Button",
2225
+ color: previousButtonColor,
2226
+ isDisabled: disabledPrevious,
2227
+ onClick: () => handleSelectPage(1),
2228
+ visuallyHidden: "First Page",
2229
+ icon: /*#__PURE__*/createElement(ArrowLeftIcon, {
2230
+ width: 2
2231
+ })
2232
+ })), /*#__PURE__*/createElement(Box, {
2233
+ backgroundColor: useColorModeValue('neutral.300', 'mirage.900'),
2234
+ borderRadius: 50
2235
+ }, /*#__PURE__*/createElement(PaginationButtonTrigger, {
2236
+ "data-test-id": "Pagination-Button",
2237
+ color: previousButtonColor,
2238
+ isDisabled: disabledPrevious,
2239
+ onClick: () => handleSelectPage(current - 1),
2240
+ visuallyHidden: "Previous Page",
2241
+ icon: /*#__PURE__*/createElement(ChevronLeftIcon, null)
2242
+ }), generatePages().map(page => {
2243
+ return /*#__PURE__*/createElement(PaginationButton, {
2244
+ "data-test-id": "Pagination-Button",
2245
+ key: page,
2246
+ isActive: page === current,
2247
+ onClick: () => typeof page === 'number' ? handleSelectPage(page) : null
2248
+ }, /*#__PURE__*/createElement(Text, {
2249
+ scale: 300,
2250
+ fontSize: "text.sm",
2251
+ lineHeight: 18,
2252
+ fontWeight: 500
2253
+ }, page));
2254
+ }), /*#__PURE__*/createElement(PaginationButtonTrigger, {
2255
+ "data-test-id": "Pagination-Button",
2256
+ color: nextButtonColor,
2257
+ isDisabled: disabledNext,
2258
+ onClick: () => handleSelectPage(current + 1),
2259
+ visuallyHidden: "Next Page",
2260
+ icon: /*#__PURE__*/createElement(ChevronRightIcon, null)
2261
+ })), /*#__PURE__*/createElement(Box, {
2262
+ ml: 1
2263
+ }, /*#__PURE__*/createElement(PaginationButtonTrigger, {
2264
+ "data-test-id": "Pagination-Button",
2265
+ color: nextButtonColor,
2266
+ isDisabled: disabledNext,
2267
+ onClick: () => handleSelectPage(total),
2268
+ visuallyHidden: "Last Page",
2269
+ icon: /*#__PURE__*/createElement(ArrowRightIcon, {
2270
+ width: 2
2271
+ })
2272
+ })));
2273
+ };
2274
+ Pagination.defaultProps = {
2275
+ className: undefined,
2276
+ onSelect: undefined
2277
+ };
2278
+ Pagination.displayName = 'Pagination';
2219
2279
 
2280
+ const PaginationDetail = ({
2281
+ page,
2282
+ limit,
2283
+ length,
2284
+ scale = 300,
2285
+ fontSize = 'xs',
2286
+ lineHeight = 18,
2287
+ ...rest
2288
+ }) => {
2289
+ return /*#__PURE__*/createElement(Text, Object.assign({
2290
+ scale: scale,
2291
+ fontSize: fontSize,
2292
+ lineHeight: lineHeight
2293
+ }, rest), `${(page - 1) * limit + 1}-${limit * page < length ? limit * page : length} dari ${length} item`);
2294
+ };
2220
2295
 
2221
- var foundations = {
2222
- __proto__: null,
2223
- colors: colors,
2224
- radii: radius,
2225
- space: spacing,
2226
- sizes: sizes,
2227
- fonts: fonts,
2228
- fontSizes: fontSizes,
2229
- lineHeights: lineHeights,
2230
- textStyles: textStyles
2296
+ const PaginationFilter = ({
2297
+ limit,
2298
+ label = 'Baris per halaman:',
2299
+ items,
2300
+ onChange,
2301
+ ...rest
2302
+ }) => {
2303
+ const [value, setValue] = useState(limit);
2304
+ return /*#__PURE__*/createElement(Box, {
2305
+ display: "flex",
2306
+ flexDirection: "row",
2307
+ alignItems: "center"
2308
+ }, /*#__PURE__*/createElement(Text, Object.assign({
2309
+ fontSize: "text.sm",
2310
+ lineHeight: 18,
2311
+ color: useColorModeValue('neutral.900', 'white')
2312
+ }, rest), label), /*#__PURE__*/createElement(Select$1, {
2313
+ textAlign: "center",
2314
+ size: "xs",
2315
+ outline: "none",
2316
+ border: "none",
2317
+ boxShadow: "none",
2318
+ width: 18,
2319
+ icon: /*#__PURE__*/createElement(FiChevronDown, null),
2320
+ _focusVisible: {
2321
+ boxShadow: 'none'
2322
+ },
2323
+ onChange: e => {
2324
+ const numberValue = Number(e.target.value);
2325
+ onChange(numberValue);
2326
+ setValue(numberValue);
2327
+ },
2328
+ value: value
2329
+ }, items.map(item => {
2330
+ return /*#__PURE__*/createElement("option", {
2331
+ key: item,
2332
+ value: item
2333
+ }, item);
2334
+ })));
2335
+ };
2336
+ PaginationFilter.defaultProps = {
2337
+ limit: 10,
2338
+ label: undefined
2231
2339
  };
2232
2340
 
2233
2341
  const styleMd = textStyles.text.sm;
@@ -3015,5 +3123,5 @@ const Provider = ({
3015
3123
  };
3016
3124
  Provider.displayName = 'Provider';
3017
3125
 
3018
- export { BreadCrumb, DataTable, Datepicker, Field, Header, InputField, Navigation as MainMenu, ModalBody, ModalCloseButton, ModalFooter, ModalHeader, Pagination, PaginationDetail, PaginationFilter, Provider, ProviderContext, Select, SelectAsync, SelectAsyncCreatable, SelectCreatable, Tab, TabList, TabPanel, TextareaField, Uploader, theme, useInternalUI };
3126
+ export { BreadCrumb, DataTable, DatePickerMonth, Datepicker, Field, Header, InputField, Navigation as MainMenu, ModalBody, ModalCloseButton, ModalFooter, ModalHeader, MultiDatePickerMonth, Pagination, PaginationDetail, PaginationFilter, Provider, ProviderContext, Select, SelectAsync, SelectAsyncCreatable, SelectCreatable, Tab, TabList, TabPanel, TextareaField, Uploader, theme, useInternalUI };
3019
3127
  //# sourceMappingURL=internal-ui.esm.js.map