scorer-ui-kit 3.0.7 → 3.0.8

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.
@@ -3047,6 +3047,7 @@ var StyledButton$7 = styled.button`
3047
3047
 
3048
3048
  overflow: hidden;
3049
3049
  cursor: pointer;
3050
+ user-select: none;
3050
3051
  outline: none;
3051
3052
  box-sizing: border-box;
3052
3053
 
@@ -3773,6 +3774,7 @@ var InputActionButton = styled.button.attrs({ type: "button" })`
3773
3774
  background: transparent;
3774
3775
  border: none;
3775
3776
  cursor: pointer;
3777
+ user-select: none;
3776
3778
  outline: none;
3777
3779
  `;
3778
3780
  var FeedbackContainer$1 = styled.div`
@@ -11662,6 +11664,7 @@ var EditCell = ({ type = "text", placeholder = "", defaultValue, rowKey, alignme
11662
11664
  var CopyToClipboard = styled.button`
11663
11665
 
11664
11666
  cursor: pointer;
11667
+ user-select: none;
11665
11668
  opacity: 0;
11666
11669
 
11667
11670
  position: absolute;
@@ -11831,7 +11834,9 @@ var TypeTableRow = ({ selectable = false, selectCallback, hasStatus, hasThumbnai
11831
11834
  })
11832
11835
  }) : null,
11833
11836
  rowData.columns.map((cell, key) => {
11834
- const { cellStyle, alignment, showUnit, showStatus, hasCopyButton } = columnConfig[key];
11837
+ const config = columnConfig[key];
11838
+ if (config === void 0) return null;
11839
+ const { cellStyle, alignment, showUnit, showStatus, hasCopyButton } = config;
11835
11840
  const { unit, status, text, customComponent } = cell;
11836
11841
  return /* @__PURE__ */ jsx(TypeTableCell, {
11837
11842
  href: cell.href,
@@ -11935,6 +11940,7 @@ var MiddleLine = styled.div`
11935
11940
  margin-right: 15px;
11936
11941
  `};
11937
11942
  `;
11943
+ var columnKeyOf = (column, index) => column.columnId ?? `column_${index}`;
11938
11944
  var renderGroupHeader = (columnConfig, index) => {
11939
11945
  if (index < 0) return null;
11940
11946
  let isLastOfGroup = true;
@@ -11944,8 +11950,23 @@ var renderGroupHeader = (columnConfig, index) => {
11944
11950
  return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Title$6, { children: columnConfig[index].groupTitle }), /* @__PURE__ */ jsx(MiddleLine, { $isLastOfGroup: isLastOfGroup })] });
11945
11951
  };
11946
11952
  var TypeTableHeader = ({ selectable, hasStatus, hasThumbnail, hasTypeIcon, allChecked, disableAllChecked, hasHeaderGroups, columnConfig, defaultAscending, toggleAllCallback = () => {}, sortCallback = () => {} }) => {
11947
- const [sortSpec, setSortSpec] = useState(columnConfig);
11948
- const [ascendingState, setAscendingState] = useState(defaultAscending);
11953
+ const propActiveKey = useMemo(() => {
11954
+ const index = columnConfig.findIndex(({ sortActive }) => sortActive);
11955
+ return index === -1 ? null : columnKeyOf(columnConfig[index], index);
11956
+ }, [columnConfig]);
11957
+ const [activeKey, setActiveKey] = useState(propActiveKey);
11958
+ const [ascending, setAscending] = useState(defaultAscending);
11959
+ const [hasUserSorted, setHasUserSorted] = useState(false);
11960
+ const [prevPropActiveKey, setPrevPropActiveKey] = useState(propActiveKey);
11961
+ if (prevPropActiveKey !== propActiveKey) {
11962
+ setPrevPropActiveKey(propActiveKey);
11963
+ setActiveKey(propActiveKey);
11964
+ }
11965
+ const [prevDefaultAscending, setPrevDefaultAscending] = useState(defaultAscending);
11966
+ if (prevDefaultAscending !== defaultAscending) {
11967
+ setPrevDefaultAscending(defaultAscending);
11968
+ if (!hasUserSorted) setAscending(defaultAscending);
11969
+ }
11949
11970
  const toggleAllCallbackWrapper = useCallback((checked) => {
11950
11971
  toggleAllCallback(checked);
11951
11972
  }, [toggleAllCallback]);
@@ -11956,23 +11977,19 @@ var TypeTableHeader = ({ selectable, hasStatus, hasThumbnail, hasTypeIcon, allCh
11956
11977
  * - Clicked column was not active persist the last ascending option
11957
11978
  */
11958
11979
  const toggleSort = useCallback((indexKey, columnId) => {
11959
- if (sortSpec[indexKey] === void 0) return;
11960
- if (!sortSpec[indexKey].sortable) return;
11961
- const updatedSort = [...sortSpec];
11962
- let lastActiveKey = null;
11963
- updatedSort.forEach((col, key) => {
11964
- if (col.sortActive) lastActiveKey = key;
11965
- if (key === indexKey) col.sortActive = true;
11966
- else col.sortActive = false;
11967
- });
11968
- const newAscending = lastActiveKey === indexKey ? !ascendingState : ascendingState;
11969
- sortCallback(newAscending, columnId === void 0 ? `column_${indexKey}` : columnId);
11970
- setSortSpec(updatedSort);
11971
- setAscendingState(newAscending);
11980
+ const column = columnConfig[indexKey];
11981
+ if (column === void 0 || !column.sortable) return;
11982
+ const key = columnKeyOf(column, indexKey);
11983
+ const newAscending = activeKey === key ? !ascending : ascending;
11984
+ setHasUserSorted(true);
11985
+ setActiveKey(key);
11986
+ setAscending(newAscending);
11987
+ sortCallback(newAscending, columnId ?? key);
11972
11988
  }, [
11973
- ascendingState,
11974
- sortCallback,
11975
- sortSpec
11989
+ activeKey,
11990
+ ascending,
11991
+ columnConfig,
11992
+ sortCallback
11976
11993
  ]);
11977
11994
  return /* @__PURE__ */ jsxs(HeaderRow, { children: [
11978
11995
  selectable ? /* @__PURE__ */ jsx(HeaderItem, {
@@ -11997,13 +12014,14 @@ var TypeTableHeader = ({ selectable, hasStatus, hasThumbnail, hasTypeIcon, allCh
11997
12014
  $fixedWidth: 35
11998
12015
  }) : null,
11999
12016
  columnConfig.map((column, key, allColls) => {
12000
- const { header, alignment, hasCopyButton, sortActive, columnId, sortable, minWidth } = column;
12017
+ const { header, alignment, hasCopyButton, columnId, sortable, minWidth } = column;
12018
+ const isSortActive = activeKey === columnKeyOf(column, key);
12001
12019
  return /* @__PURE__ */ jsx(HeaderItem, {
12002
12020
  $alignment: alignment,
12003
12021
  $hasCopyButton: hasCopyButton,
12004
12022
  $minWidth: minWidth,
12005
12023
  $headerStyle: hasHeaderGroups ? "subHeader" : "header",
12006
- $isSortActive: sortActive,
12024
+ $isSortActive: isSortActive,
12007
12025
  children: /* @__PURE__ */ jsxs(TitleItems, {
12008
12026
  $alignment: alignment,
12009
12027
  children: [hasHeaderGroups && /* @__PURE__ */ jsx(GroupTitle, { children: hasHeaderGroups && renderGroupHeader(allColls, key) }), /* @__PURE__ */ jsx(TableHeaderTitle, {
@@ -12011,8 +12029,8 @@ var TypeTableHeader = ({ selectable, hasStatus, hasThumbnail, hasTypeIcon, allCh
12011
12029
  sortable,
12012
12030
  indexKey: key,
12013
12031
  columnId,
12014
- isSortActive: sortActive,
12015
- ascending: ascendingState,
12032
+ isSortActive,
12033
+ ascending,
12016
12034
  toggleSort
12017
12035
  })]
12018
12036
  })
@@ -12035,7 +12053,7 @@ var LoadingBox = styled.div`
12035
12053
  position: absolute;
12036
12054
  left: 0;
12037
12055
  z-index: 99;
12038
- background-color: var(--white-1);
12056
+ background-color: var(--grey-2);
12039
12057
  height: calc(100% - 50px);
12040
12058
  opacity: 85%;
12041
12059
  width: 100%;
@@ -12070,10 +12088,12 @@ var isChecked = ({ _checked = false }) => {
12070
12088
  var isCheckBoxDisabled = ({ checkboxDisabled = false }) => {
12071
12089
  return checkboxDisabled === true;
12072
12090
  };
12073
- var TypeTable = ({ columnConfig, selectable, rows = [], closeText, hasStatus = false, hasThumbnail = false, hasTypeIcon = false, defaultAscending = false, isLoading = false, loadingText = "Loading Data...", emptyTableTitle = "", emptyTableText = "", hasHeaderGroups = false, sortCallback = () => {}, selectCallback = () => {}, toggleAllCallback = () => {} }) => {
12091
+ var TypeTable = ({ columnConfig, selectable, rows: rowsProp = [], closeText, hasStatus = false, hasThumbnail = false, hasTypeIcon = false, defaultAscending = false, isLoading = false, loadingText = "Loading Data...", emptyTableTitle = "", emptyTableText = "", hasHeaderGroups = false, sortCallback = () => {}, selectCallback = () => {}, toggleAllCallback = () => {} }) => {
12092
+ const rows = rowsProp ?? [];
12074
12093
  const [allChecked, setAllChecked] = useState(false);
12075
12094
  const [disableAllChecked, setDisableAllChecked] = useState(false);
12076
- const isEmptyTable = rows.length === 1 && rows[0].columns.length === 0 && !isLoading;
12095
+ const isEmptyTable = !isLoading && (rows.length === 0 || rows.length === 1 && rows[0].columns.length === 0);
12096
+ const hasEmptyStateCopy = emptyTableTitle !== "" || emptyTableText !== "";
12077
12097
  useEffect(() => {
12078
12098
  let areAllChecked = false;
12079
12099
  let disableCheckAll = false;
@@ -12086,6 +12106,10 @@ var TypeTable = ({ columnConfig, selectable, rows = [], closeText, hasStatus = f
12086
12106
  isLoading,
12087
12107
  rows
12088
12108
  ]);
12109
+ useEffect(() => {
12110
+ const rowKey = rows.findIndex((row) => row.columns.length > columnConfig.length);
12111
+ if (rowKey !== -1) console.warn(`TypeTable: row ${rowKey} has ${rows[rowKey].columns.length} cells but columnConfig has ${columnConfig.length} entries. The extra cells are not rendered.`);
12112
+ }, [rows, columnConfig]);
12089
12113
  return /* @__PURE__ */ jsx(Container$24, { children: /* @__PURE__ */ jsxs(TableContainer, { children: [
12090
12114
  /* @__PURE__ */ jsx(TypeTableHeader, {
12091
12115
  selectable,
@@ -12104,7 +12128,7 @@ var TypeTable = ({ columnConfig, selectable, rows = [], closeText, hasStatus = f
12104
12128
  size: "large",
12105
12129
  styling: "primary"
12106
12130
  }), /* @__PURE__ */ jsx(LoadingText, { children: loadingText })] }) : null,
12107
- isEmptyTable ? /* @__PURE__ */ jsxs(EmptyTableBox, { children: [/* @__PURE__ */ jsx("h3", { children: emptyTableTitle }), /* @__PURE__ */ jsx("p", { children: emptyTableText })] }) : null,
12131
+ isEmptyTable && hasEmptyStateCopy ? /* @__PURE__ */ jsxs(EmptyTableBox, { children: [/* @__PURE__ */ jsx("h3", { children: emptyTableTitle }), /* @__PURE__ */ jsx("p", { children: emptyTableText })] }) : null,
12108
12132
  rows.map((rowData, key) => {
12109
12133
  const isLastRow = rows.length - 1 === key;
12110
12134
  return /* @__PURE__ */ jsx(TypeTableRow, {
@@ -12323,6 +12347,7 @@ var CameraPanelWrapper = styled.div`
12323
12347
 
12324
12348
  ${({ $hasOnClick }) => $hasOnClick && `
12325
12349
  cursor: pointer;
12350
+ user-select: none;
12326
12351
  `};
12327
12352
  `;
12328
12353
  var NewComponent = ({ streamProps, panelMetaData, customBottom, panelOnClick, ...props }) => {
@@ -12360,9 +12385,15 @@ var ButtonsWrapper = styled.div`
12360
12385
  justify-content: space-between;
12361
12386
  `;
12362
12387
  var LeftButtons = styled.div`
12363
- button {
12364
- margin: 0 10px 10px 0;
12365
- }
12388
+ display: flex;
12389
+ gap: 10px;
12390
+
12391
+ ${({ $actionsLayout }) => $actionsLayout === "stack" ? css`
12392
+ flex-direction: column;
12393
+ align-items: flex-start;
12394
+ ` : css`
12395
+ flex-wrap: wrap;
12396
+ `}
12366
12397
  `;
12367
12398
  var RightButtons = styled.div`
12368
12399
  flex-shrink: 0;
@@ -12377,19 +12408,21 @@ var SelectedResults = styled.div`
12377
12408
  var renderSelected = (template, selected, total) => {
12378
12409
  return template.replace("[SELECTED]", `${selected}`).replace("[TOTAL]", `${total}`);
12379
12410
  };
12380
- var ActionsBar = ({ title = "Actions:", finishTextButton = "Finish", actionButtons = [], selectedTemplate = "Selected [SELECTED] of [TOTAL] Results", totalSelected = 0, totalAvailable = 0, finishCallback = () => {} }) => {
12411
+ var ActionsBar = ({ title = "Actions:", finishTextButton = "Finish", actionButtons = [], actionsLayout = "inline", selectedTemplate = "Selected [SELECTED] of [TOTAL] Results", totalSelected = 0, totalAvailable = 0, finishCallback = () => {} }) => {
12381
12412
  return /* @__PURE__ */ jsxs(Container$21, { children: [
12382
12413
  /* @__PURE__ */ jsx(Title$4, { children: title }),
12383
- /* @__PURE__ */ jsxs(ButtonsWrapper, { children: [/* @__PURE__ */ jsx(LeftButtons, { children: actionButtons.map(({ design, size, position, text, ...props }) => {
12384
- return /* @__PURE__ */ jsx(ButtonWithIcon, {
12385
- design: design || "secondary",
12386
- size: size || "small",
12387
- position: position || "left",
12388
- ...props,
12389
- children: text
12390
- }, text);
12391
- }) }), /* @__PURE__ */ jsx(RightButtons, { children: /* @__PURE__ */ jsx(Button, {
12392
- size: "small",
12414
+ /* @__PURE__ */ jsxs(ButtonsWrapper, { children: [/* @__PURE__ */ jsx(LeftButtons, {
12415
+ $actionsLayout: actionsLayout,
12416
+ children: actionButtons.map(({ design, size, position, text, ...props }) => {
12417
+ return /* @__PURE__ */ jsx(ButtonWithIcon, {
12418
+ design: design || "secondary",
12419
+ size: size || "normal",
12420
+ position: position || "left",
12421
+ ...props,
12422
+ children: text
12423
+ }, text);
12424
+ })
12425
+ }), /* @__PURE__ */ jsx(RightButtons, { children: /* @__PURE__ */ jsx(Button, {
12393
12426
  onClick: finishCallback,
12394
12427
  children: finishTextButton
12395
12428
  }) })] }),
@@ -12698,6 +12731,7 @@ var StyledChip = styled.button`
12698
12731
  border: none;
12699
12732
  background: transparent;
12700
12733
  cursor: pointer;
12734
+ user-select: none;
12701
12735
  outline: none;
12702
12736
  box-sizing: border-box;
12703
12737
  font-family: var(--font-ui);
@@ -12876,6 +12910,7 @@ var MenuItem = styled.button`
12876
12910
  border-bottom: 1px solid var(--grey-7);
12877
12911
  background: transparent;
12878
12912
  cursor: pointer;
12913
+ user-select: none;
12879
12914
  font-family: var(--font-ui);
12880
12915
  font-size: 14px;
12881
12916
  font-weight: 500;
@@ -13842,6 +13877,7 @@ var ExtraAction = styled.button`
13842
13877
  text-decoration: none;
13843
13878
  transition: color 0.25s ease;
13844
13879
  cursor: pointer;
13880
+ user-select: none;
13845
13881
 
13846
13882
  ${ExtraActionIcon}{
13847
13883
  svg * {
@@ -14308,6 +14344,7 @@ var Container$14 = styled.div`
14308
14344
  border-top: 1px solid var(--dividing-line);
14309
14345
  align-items: center;
14310
14346
  cursor: pointer;
14347
+ user-select: none;
14311
14348
  svg {
14312
14349
  margin-top: 7px;
14313
14350
  }
@@ -14407,6 +14444,7 @@ var TitleContainer = styled.div`
14407
14444
  align-items: center;
14408
14445
  margin-left: 10px;
14409
14446
  margin: 3px 0 5px 10px;
14447
+ user-select: none;
14410
14448
  `;
14411
14449
  var Container$13 = styled.div`
14412
14450
  cursor: pointer;
@@ -15859,6 +15897,7 @@ var Container$7 = styled.div`
15859
15897
  padding-bottom: 7px;
15860
15898
  height: 60px;
15861
15899
  cursor: pointer;
15900
+ user-select: none;
15862
15901
 
15863
15902
  ${({ $active }) => $active ? css`
15864
15903
  border-bottom: 3px solid var(--primary-11);
@@ -16393,6 +16432,6 @@ var Sidebar = ({ children, ...props }) => {
16393
16432
  });
16394
16433
  };
16395
16434
  //#endregion
16396
- export { ActionButtons, ActionsBar, AlertBar, AlertWrapper, AreaUploadManager, AvatarUploader, BackLink, BaseStyles, BasicSearchInput, Button, ButtonWithIcon, ButtonWithLoading, ButtonsStack, CameraPanelWrapper, CameraPanels, Checkbox, ChipBar, ChipButton, ChipDropdown, ChipZoneBreak, ConfirmationModal, Content, ContentLayout, CropTool, DatePicker, DebouncedSearcher, DropArea, DurationSlider, EditCell, EditableText, FilterBar, FilterButton, FilterDropdown, FilterDropdownContainer, FilterInputs, FilterLayout, FiltersResults, FlexContentPlaceholder, Form, FullWidthContentBlock, GlobalUI, Icon, IconButton, IconSVGs, Input, InputFileButton, IntroductionText, Label, Layout, LineReducer_default as LineReducer, LineSetContext, LineUI, LineUI$1 as LineUIRTC, LineUIVideo, Logo, MainContainer, MainMenu, MediaBox, ModalContext, ModalProvider, MultilineContent, Notification, NotificationProvider, PageHeader, PageTitle, Pagination, PasswordField, PercentageSlider, RadioButton, SelectField, SelectWrapper, Sidebar, SidebarBox, SidebarHeading, SidebarLink, SidebarLinkHeading, SliderInput, SmallInput, SortDropdown, Spinner, SplitButton, SplitLayout, StatusIcon, Switch, Tab, TabContent, TabContext, TabList, TabWithIcon, TableHeaderTitle, TableRowThumbnail, Tabs, TabsWithIconBar, Tag, TagList, TagListWrapper, TextArea, TextAreaField, TextField, ThemeVariables, ToggleButton, Tooltip, TopBar, TypeTable, UtilityHeader, WebRTCPlayer as WebRTCClient, theme_default as defaultTheme, isDateInterval, isFilterItem, resetButtonStyles, useClickOutside, useCopyToClipboard, useInterval, useMediaModal, useModal, useNotification, usePoll, useThemeToggle, useTitle, useTo };
16435
+ export { ActionButtons, ActionsBar, AlertBar, AlertWrapper, AreaUploadManager, AvatarUploader, BackLink, BaseStyles, BasicSearchInput, Button, ButtonWithIcon, ButtonWithLoading, ButtonsStack, CameraPanelWrapper, CameraPanels, Checkbox, ChipBar, ChipButton, ChipDropdown, ChipZoneBreak, ConfirmationModal, Content, ContentLayout, CropTool, DatePicker, DebouncedSearcher, DropArea, DurationSlider, EditCell, EditableText, FilterBar, FilterButton, FilterDropdown, FilterDropdownContainer, FilterInputs, FilterLayout, FiltersResults, FlexContentPlaceholder, Form, FullWidthContentBlock, GlobalUI, Icon, IconButton, IconSVGs, Input, InputFileButton, IntroductionText, Label, Layout, LineReducer_default as LineReducer, LineSetContext, LineUI, LineUI$1 as LineUIRTC, LineUIVideo, Logo, MainContainer, MainMenu, MediaBox, ModalContext, ModalProvider, MultilineContent, Notification, NotificationProvider, PageHeader, PageTitle, Pagination, PasswordField, PercentageSlider, RadioButton, SelectField, SelectWrapper, Sidebar, SidebarBox, SidebarHeading, SidebarLink, SidebarLinkHeading, SliderInput, SmallInput, SortDropdown, Spinner, SplitButton, SplitLayout, StatusIcon, Switch, Tab, TabContent, TabContext, TabList, TabWithIcon, TableHeaderTitle, TableRowThumbnail, Tabs, TabsWithIconBar, Tag, TagList, TagListWrapper, TextArea, TextAreaField, TextField, ThemeVariables, ToggleButton, Tooltip, TopBar, TypeTable, UtilityHeader, WebRTCPlayer as WebRTCClient, theme_default as defaultTheme, isDateInterval, isFilterItem, resetButtonStyles, useBreakpoints, useClickOutside, useCopyToClipboard, useInterval, useMediaModal, useMediaQuery, useModal, useNotification, usePoll, useThemeToggle, useTitle, useTo };
16397
16436
 
16398
16437
  //# sourceMappingURL=index.modern.js.map