@ssa-ui-kit/core 2.31.0 → 2.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1102,6 +1102,7 @@ __webpack_require__.d(Field_index_parts_namespaceObject, {
1102
1102
  var JsonSchemaForm_namespaceObject = {};
1103
1103
  __webpack_require__.r(JsonSchemaForm_namespaceObject);
1104
1104
  __webpack_require__.d(JsonSchemaForm_namespaceObject, {
1105
+ DEFAULT_AVATAR_SIZE: () => (DEFAULT_AVATAR_SIZE),
1105
1106
  Fields: () => (fields),
1106
1107
  Form: () => (JsonSchemaForm_Form),
1107
1108
  Templates: () => (templates),
@@ -8226,7 +8227,8 @@ const useTooltip = props => {
8226
8227
  size = 'small',
8227
8228
  hasArrow = true,
8228
8229
  arrowProps = {},
8229
- isOpen: isInitOpen = false
8230
+ isOpen: isInitOpen = false,
8231
+ allowHoverContent = false
8230
8232
  } = props || {};
8231
8233
  const [isOpen, setIsOpen] = (0,external_react_namespaceObject.useState)(isInitOpen || false);
8232
8234
  const arrowRef = (0,external_react_namespaceObject.useRef)(null);
@@ -8244,7 +8246,8 @@ const useTooltip = props => {
8244
8246
  } = floatingData;
8245
8247
  const hover = (0,external_floating_ui_react_namespaceObject.useHover)(context, {
8246
8248
  enabled: enableHover,
8247
- move: true
8249
+ move: true,
8250
+ handleClose: allowHoverContent ? (0,external_floating_ui_react_namespaceObject.safePolygon)() : undefined
8248
8251
  });
8249
8252
  const click = (0,external_floating_ui_react_namespaceObject.useClick)(context, {
8250
8253
  enabled: enableClick
@@ -14350,54 +14353,72 @@ function PersonInfo_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have t
14350
14353
 
14351
14354
 
14352
14355
  const PersonInfoBase = /*#__PURE__*/base_default()("div", true ? {
14353
- target: "ej2kihb12"
14356
+ target: "ej2kihb15"
14354
14357
  } : 0)( true ? {
14355
14358
  name: "3w0yoi",
14356
14359
  styles: "display:flex;flex-direction:column;gap:8px"
14357
14360
  } : 0);
14358
14361
  const PersonInfoHeader = /*#__PURE__*/base_default()("div", true ? {
14359
- target: "ej2kihb11"
14362
+ target: "ej2kihb14"
14360
14363
  } : 0)( true ? {
14361
14364
  name: "1ocjxm6",
14362
14365
  styles: "display:flex;align-items:flex-start;gap:8px"
14363
14366
  } : 0);
14364
14367
  const styles_IconWrapper = /*#__PURE__*/base_default()("div", true ? {
14365
- target: "ej2kihb10"
14368
+ target: "ej2kihb13"
14366
14369
  } : 0)( true ? {
14367
14370
  name: "13ltyg2",
14368
14371
  styles: "display:flex;align-items:flex-start;flex-shrink:0"
14369
14372
  } : 0);
14370
14373
  const styles_TitleWrapper = /*#__PURE__*/base_default()("div", true ? {
14371
- target: "ej2kihb9"
14374
+ target: "ej2kihb12"
14372
14375
  } : 0)( true ? {
14373
14376
  name: "1tcizyl",
14374
14377
  styles: "display:flex;flex-direction:column;gap:4px;flex:1"
14375
14378
  } : 0);
14376
14379
  const Title = /*#__PURE__*/base_default()("div", true ? {
14377
- target: "ej2kihb8"
14380
+ target: "ej2kihb11"
14378
14381
  } : 0)( true ? {
14379
14382
  name: "edklr6",
14380
14383
  styles: "font-size:14px;font-weight:600;line-height:19px"
14381
14384
  } : 0);
14385
+ const Row = /*#__PURE__*/base_default()("div", true ? {
14386
+ target: "ej2kihb10"
14387
+ } : 0)( true ? {
14388
+ name: "1j5vobt",
14389
+ styles: "display:flex;align-items:center;gap:4px"
14390
+ } : 0);
14382
14391
  const TextBase = /*#__PURE__*/base_default()("div", true ? {
14383
- target: "ej2kihb7"
14392
+ target: "ej2kihb9"
14384
14393
  } : 0)( true ? {
14385
14394
  name: "1bzpq77",
14386
14395
  styles: "font-size:14px;font-weight:400;line-height:19px"
14387
14396
  } : 0);
14388
14397
  const ValueWithCounter = /*#__PURE__*/base_default()("div", true ? {
14389
- target: "ej2kihb6"
14398
+ target: "ej2kihb8"
14390
14399
  } : 0)( true ? {
14391
14400
  name: "1j5vobt",
14392
14401
  styles: "display:flex;align-items:center;gap:4px"
14393
14402
  } : 0);
14394
14403
  const Counter = /*#__PURE__*/base_default()(TextBase.withComponent('span', true ? {
14395
- target: "ej2kihb13"
14404
+ target: "ej2kihb16"
14396
14405
  } : 0), true ? {
14397
- target: "ej2kihb5"
14406
+ target: "ej2kihb7"
14398
14407
  } : 0)("color:", ({
14399
14408
  theme
14400
- }) => theme.colors.greyDropdownFocused, ";margin-left:5px;" + ( true ? "" : 0));
14409
+ }) => theme.colors.greyDropdownFocused, ";margin-left:5px;cursor:pointer;" + ( true ? "" : 0));
14410
+ const CounterTooltipContent = /*#__PURE__*/base_default()("div", true ? {
14411
+ target: "ej2kihb6"
14412
+ } : 0)( true ? {
14413
+ name: "1oeds5o",
14414
+ styles: "min-width:220px;padding:12px"
14415
+ } : 0);
14416
+ const CounterTooltipList = /*#__PURE__*/base_default()("div", true ? {
14417
+ target: "ej2kihb5"
14418
+ } : 0)( true ? {
14419
+ name: "1acx518",
14420
+ styles: "display:flex;flex-direction:column;gap:8px;height:auto;max-height:220px;overflow:hidden;overflow-y:auto;padding-right:4px"
14421
+ } : 0);
14401
14422
  const AttributesList = /*#__PURE__*/base_default()("div", true ? {
14402
14423
  target: "ej2kihb4"
14403
14424
  } : 0)( true ? {
@@ -14441,6 +14462,29 @@ const CustomBadge = /*#__PURE__*/base_default()("div", true ? {
14441
14462
  } = BADGE_COLORS(theme)[colorName];
14442
14463
  return bg;
14443
14464
  }, ";" + ( true ? "" : 0));
14465
+ const personInfoValueLinkStyles = theme => ({
14466
+ textDecoration: 'none',
14467
+ color: theme.colors.greyDarker,
14468
+ cursor: 'pointer',
14469
+ transition: 'color 0.2s ease',
14470
+ display: 'inline-flex',
14471
+ alignItems: 'center',
14472
+ '&:hover': {
14473
+ color: theme.colors.blue
14474
+ }
14475
+ });
14476
+ const avatarWrapperLinkStyles = theme => ({
14477
+ textDecoration: 'none',
14478
+ color: theme.colors.greyDarker,
14479
+ cursor: 'pointer',
14480
+ transition: 'color 0.2s ease',
14481
+ '&:hover': {
14482
+ color: theme.colors.blue,
14483
+ '& > div:last-child': {
14484
+ color: theme.colors.blue
14485
+ }
14486
+ }
14487
+ });
14444
14488
  ;// ./src/components/PersonInfo/PersonInfoIcon.tsx
14445
14489
 
14446
14490
 
@@ -14465,17 +14509,25 @@ const PersonInfoIcon = ({
14465
14509
 
14466
14510
  const PersonInfoValue = ({
14467
14511
  value,
14468
- counter,
14469
14512
  css,
14470
- counterCss
14513
+ linkAttributes
14471
14514
  }) => {
14472
- return (0,jsx_runtime_namespaceObject.jsxs)(TextBase, {
14473
- css: css,
14474
- children: [value, counter && (0,jsx_runtime_namespaceObject.jsxs)(Counter, {
14475
- css: counterCss,
14476
- children: [" ", counter]
14477
- })]
14478
- });
14515
+ const isLink = Boolean(linkAttributes?.href);
14516
+ return (0,jsx_runtime_namespaceObject.jsx)(TextBase, {
14517
+ css: [isLink ? personInfoValueLinkStyles : undefined, css, true ? "" : 0, true ? "" : 0],
14518
+ ...(linkAttributes ?? {}),
14519
+ children: value
14520
+ });
14521
+ };
14522
+ ;// ./src/components/PersonInfo/helpers.ts
14523
+ const getLinkAttributes = (link, openLinkInNewTab) => {
14524
+ const isLink = Boolean(link);
14525
+ return isLink ? {
14526
+ as: 'a',
14527
+ href: link,
14528
+ target: openLinkInNewTab ? '_blank' : undefined,
14529
+ rel: openLinkInNewTab ? 'noreferrer' : undefined
14530
+ } : {};
14479
14531
  };
14480
14532
  ;// ./src/components/PersonInfo/PersonInfoAvatar.tsx
14481
14533
 
@@ -14483,22 +14535,34 @@ const PersonInfoValue = ({
14483
14535
 
14484
14536
 
14485
14537
 
14538
+
14486
14539
  const PersonInfoAvatar = ({
14487
14540
  avatar,
14488
14541
  value,
14489
- counter,
14490
- styles
14542
+ styles,
14543
+ link,
14544
+ openLinkInNewTab
14491
14545
  }) => {
14546
+ const hasAvatar = Boolean(avatar);
14547
+ const hasValue = Boolean(value);
14548
+ const isLink = Boolean(link);
14549
+ const linkAttributes = getLinkAttributes(link, openLinkInNewTab);
14550
+ if (!hasAvatar && !hasValue) return null;
14551
+ const valueNode = hasValue ? (0,jsx_runtime_namespaceObject.jsx)(PersonInfoValue, {
14552
+ value: value,
14553
+ css: hasAvatar ? styles?.avatarName : styles?.value,
14554
+ linkAttributes: !hasAvatar ? linkAttributes : undefined
14555
+ }) : null;
14556
+ if (!hasAvatar) {
14557
+ return valueNode;
14558
+ }
14492
14559
  return (0,jsx_runtime_namespaceObject.jsxs)(styles_AvatarWrapper, {
14560
+ css: isLink ? avatarWrapperLinkStyles : undefined,
14561
+ ...linkAttributes,
14493
14562
  children: [(0,jsx_runtime_namespaceObject.jsx)(Avatar_Avatar, {
14494
14563
  size: 24,
14495
14564
  image: avatar
14496
- }), value && (0,jsx_runtime_namespaceObject.jsx)(PersonInfoValue, {
14497
- value: value,
14498
- counter: counter,
14499
- css: styles?.avatarName,
14500
- counterCss: styles?.counter
14501
- })]
14565
+ }), valueNode]
14502
14566
  });
14503
14567
  };
14504
14568
  ;// ./src/components/PersonInfo/PersonInfoBadges.tsx
@@ -14535,6 +14599,100 @@ const PersonInfoBadges = ({
14535
14599
  })
14536
14600
  });
14537
14601
  };
14602
+ ;// ./src/components/ImageItem/ImageItem.tsx
14603
+ function ImageItem_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
14604
+
14605
+
14606
+
14607
+
14608
+ var ImageItem_ref = true ? {
14609
+ name: "c5ejfv",
14610
+ styles: "gap:8px;text-decoration:none"
14611
+ } : 0;
14612
+ const ImageItem = ({
14613
+ children,
14614
+ image,
14615
+ avatarSize = 24,
14616
+ link = '',
14617
+ openLinkInNewTab = false,
14618
+ className
14619
+ }) => {
14620
+ const theme = (0,react_namespaceObject.useTheme)();
14621
+ const additionalProps = link ? {
14622
+ href: link,
14623
+ target: openLinkInNewTab ? '_blank' : undefined
14624
+ } : {};
14625
+ return (0,jsx_runtime_namespaceObject.jsxs)(Wrapper_Wrapper, {
14626
+ css: ImageItem_ref,
14627
+ as: link ? 'a' : 'div',
14628
+ className: className,
14629
+ "data-testid": "image-item",
14630
+ ...additionalProps,
14631
+ children: [(0,jsx_runtime_namespaceObject.jsx)(Avatar_Avatar, {
14632
+ size: avatarSize,
14633
+ image: image
14634
+ }), (0,jsx_runtime_namespaceObject.jsx)("span", {
14635
+ css: /*#__PURE__*/(0,react_namespaceObject.css)({
14636
+ color: theme.colors.greyDarker,
14637
+ fontSize: 14,
14638
+ fontWeight: 500,
14639
+ cursor: link ? 'pointer' : 'default',
14640
+ '&:hover': {
14641
+ color: link ? theme.colors.blue : theme.colors.greyDarker
14642
+ }
14643
+ }, true ? "" : 0, true ? "" : 0),
14644
+ children: children
14645
+ })]
14646
+ });
14647
+ };
14648
+ ;// ./src/components/PersonInfo/PersonInfoCounter.tsx
14649
+
14650
+
14651
+
14652
+
14653
+
14654
+
14655
+
14656
+ const PersonInfoCounter = ({
14657
+ counterTooltip,
14658
+ css
14659
+ }) => {
14660
+ const tooltipUsers = counterTooltip?.users ?? [];
14661
+ const hasTooltipUsers = tooltipUsers.length > 0;
14662
+ const counterValue = hasTooltipUsers ? `+${tooltipUsers.length}` : null;
14663
+ if (!counterValue) {
14664
+ return null;
14665
+ }
14666
+ const tooltipBody = (0,jsx_runtime_namespaceObject.jsx)(CounterTooltipList, {
14667
+ "data-testid": "person-info-counter-tooltip-list",
14668
+ children: tooltipUsers.map(user => (0,jsx_runtime_namespaceObject.jsx)(ImageItem, {
14669
+ image: user.avatar,
14670
+ link: user.link,
14671
+ openLinkInNewTab: user.openLinkInNewTab,
14672
+ children: user.name
14673
+ }, user.id))
14674
+ });
14675
+ const counterNode = (0,jsx_runtime_namespaceObject.jsx)(Counter, {
14676
+ css: css,
14677
+ "data-testid": "person-info-counter",
14678
+ children: counterValue
14679
+ });
14680
+ return (0,jsx_runtime_namespaceObject.jsxs)(Tooltip_Tooltip, {
14681
+ enableHover: true,
14682
+ enableClick: false,
14683
+ allowHoverContent: true,
14684
+ placement: "top",
14685
+ size: "medium",
14686
+ hasArrow: true,
14687
+ children: [(0,jsx_runtime_namespaceObject.jsx)(TooltipTrigger_TooltipTrigger, {
14688
+ children: counterNode
14689
+ }), (0,jsx_runtime_namespaceObject.jsx)(TooltipContent_TooltipContent, {
14690
+ children: (0,jsx_runtime_namespaceObject.jsx)(CounterTooltipContent, {
14691
+ children: tooltipBody
14692
+ })
14693
+ })]
14694
+ });
14695
+ };
14538
14696
  ;// ./src/components/PersonInfo/PersonInfo.tsx
14539
14697
 
14540
14698
 
@@ -14549,11 +14707,13 @@ const PersonInfo = /*#__PURE__*/external_react_default().forwardRef(function Per
14549
14707
  value,
14550
14708
  badges,
14551
14709
  avatar,
14552
- counter,
14710
+ counterTooltip,
14553
14711
  attributes,
14554
14712
  description,
14555
14713
  styles,
14556
14714
  className,
14715
+ link,
14716
+ openLinkInNewTab,
14557
14717
  ...props
14558
14718
  }, ref) {
14559
14719
  return (0,jsx_runtime_namespaceObject.jsx)(PersonInfoBase, {
@@ -14567,16 +14727,17 @@ const PersonInfo = /*#__PURE__*/external_react_default().forwardRef(function Per
14567
14727
  children: [(0,jsx_runtime_namespaceObject.jsx)(Title, {
14568
14728
  css: styles?.title,
14569
14729
  children: title
14570
- }), avatar && (0,jsx_runtime_namespaceObject.jsx)(PersonInfoAvatar, {
14571
- avatar: avatar,
14572
- value: value,
14573
- counter: counter,
14574
- styles: styles
14575
- }), !avatar && value && (0,jsx_runtime_namespaceObject.jsx)(PersonInfoValue, {
14576
- value: value,
14577
- counter: counter,
14578
- css: styles?.value,
14579
- counterCss: styles?.counter
14730
+ }), (0,jsx_runtime_namespaceObject.jsxs)(Row, {
14731
+ children: [(0,jsx_runtime_namespaceObject.jsx)(PersonInfoAvatar, {
14732
+ avatar: avatar,
14733
+ value: value,
14734
+ styles: styles,
14735
+ link: link,
14736
+ openLinkInNewTab: openLinkInNewTab
14737
+ }), counterTooltip && (0,jsx_runtime_namespaceObject.jsx)(PersonInfoCounter, {
14738
+ counterTooltip: counterTooltip,
14739
+ css: styles?.counter
14740
+ })]
14580
14741
  }), badges && (0,jsx_runtime_namespaceObject.jsx)(PersonInfoBadges, {
14581
14742
  badges: badges,
14582
14743
  styles: styles
@@ -18173,52 +18334,6 @@ const FiltersMultiSelectOptions = ({
18173
18334
  ;// ./src/components/Icon/index.ts
18174
18335
 
18175
18336
 
18176
- ;// ./src/components/ImageItem/ImageItem.tsx
18177
- function ImageItem_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
18178
-
18179
-
18180
-
18181
-
18182
- var ImageItem_ref = true ? {
18183
- name: "c5ejfv",
18184
- styles: "gap:8px;text-decoration:none"
18185
- } : 0;
18186
- const ImageItem = ({
18187
- children,
18188
- image,
18189
- avatarSize = 24,
18190
- link = '',
18191
- openLinkInNewTab = false,
18192
- className
18193
- }) => {
18194
- const theme = (0,react_namespaceObject.useTheme)();
18195
- const additionalProps = link ? {
18196
- href: link,
18197
- target: openLinkInNewTab ? '_blank' : undefined
18198
- } : {};
18199
- return (0,jsx_runtime_namespaceObject.jsxs)(Wrapper_Wrapper, {
18200
- css: ImageItem_ref,
18201
- as: link ? 'a' : 'div',
18202
- className: className,
18203
- "data-testid": "image-item",
18204
- ...additionalProps,
18205
- children: [(0,jsx_runtime_namespaceObject.jsx)(Avatar_Avatar, {
18206
- size: avatarSize,
18207
- image: image
18208
- }), (0,jsx_runtime_namespaceObject.jsx)("span", {
18209
- css: /*#__PURE__*/(0,react_namespaceObject.css)({
18210
- color: theme.colors.greyDarker,
18211
- fontSize: 14,
18212
- fontWeight: 500,
18213
- cursor: link ? 'pointer' : 'default',
18214
- '&:hover': {
18215
- color: link ? theme.colors.blue : theme.colors.greyDarker
18216
- }
18217
- }, true ? "" : 0, true ? "" : 0),
18218
- children: children
18219
- })]
18220
- });
18221
- };
18222
18337
  ;// ./src/components/ImageItem/index.ts
18223
18338
 
18224
18339
  ;// ./src/components/LinksTabBar/LinksTabBarBase.tsx
@@ -21132,10 +21247,22 @@ const RadioWidget = props => {
21132
21247
  }, i)) : undefined
21133
21248
  });
21134
21249
  };
21250
+ ;// ./src/components/JsonSchemaForm/constants.ts
21251
+ const DEFAULT_AVATAR_SIZE = 24;
21135
21252
  ;// ./src/components/JsonSchemaForm/widgets/SelectWidget.tsx
21136
21253
 
21137
21254
 
21138
21255
 
21256
+
21257
+ const getAvatarNode = (option, uiOptions) => {
21258
+ const avatar = option.schema?.avatar;
21259
+ if (!avatar) return;
21260
+ const avatarSize = uiOptions.typeaheadAvatarSize ?? DEFAULT_AVATAR_SIZE;
21261
+ return (0,jsx_runtime_namespaceObject.jsx)(Avatar_Avatar, {
21262
+ size: avatarSize,
21263
+ image: avatar
21264
+ });
21265
+ };
21139
21266
  const SelectWidget = props => {
21140
21267
  const {
21141
21268
  id,
@@ -21156,6 +21283,7 @@ const SelectWidget = props => {
21156
21283
  enumDisabled = []
21157
21284
  } = options;
21158
21285
  const customPlaceholder = placeholder || uiSchema?.['ui:placeholder'];
21286
+ const selectUiOptions = uiSchema?.['ui:options'] || {};
21159
21287
  const isMultiple = !!multiple || Array.isArray(value);
21160
21288
  const items = Array.isArray(enumOptions) ? enumOptions : [];
21161
21289
  const handleChange = onChangeOverride ? onChangeOverride : value => {
@@ -21183,8 +21311,7 @@ const SelectWidget = props => {
21183
21311
  };
21184
21312
  const handleTypeaheadChange = (changedValue, isAdded) => {
21185
21313
  if (isMultiple) {
21186
- const currentSelected = Array.isArray(selectedItems) ? selectedItems : [];
21187
- const newSelected = isAdded ? [...currentSelected, changedValue] : currentSelected.filter(item => item !== changedValue);
21314
+ const newSelected = isAdded ? [...selectedItems, changedValue] : selectedItems.filter(item => item !== changedValue);
21188
21315
  handleFormChange(newSelected);
21189
21316
  } else {
21190
21317
  const newValue = isAdded ? changedValue : undefined;
@@ -21207,8 +21334,7 @@ const SelectWidget = props => {
21207
21334
  };
21208
21335
  const onRemoveSelectedClick = removedValue => {
21209
21336
  if (isMultiple) {
21210
- const currentSelected = Array.isArray(selectedItems) ? selectedItems : [];
21211
- const newSelected = currentSelected.filter(item => item !== removedValue);
21337
+ const newSelected = selectedItems.filter(item => item !== removedValue);
21212
21338
  handleChange(newSelected);
21213
21339
  } else {
21214
21340
  handleChange(undefined);
@@ -21233,15 +21359,13 @@ const SelectWidget = props => {
21233
21359
  label,
21234
21360
  input
21235
21361
  }) => highlightInputMatch(label, input),
21236
- children: items.map(({
21237
- label,
21238
- value
21239
- }) => (0,jsx_runtime_namespaceObject.jsx)(TypeaheadOption_TypeaheadOption, {
21240
- value: value,
21241
- label: label || value,
21242
- isDisabled: disabled || Array.isArray(enumDisabled) && enumDisabled.includes(value),
21243
- children: label || value
21244
- }, value))
21362
+ children: items.map(item => (0,jsx_runtime_namespaceObject.jsx)(TypeaheadOption_TypeaheadOption, {
21363
+ value: item.value,
21364
+ label: item.label || item.value,
21365
+ avatar: getAvatarNode(item, selectUiOptions),
21366
+ isDisabled: disabled || Array.isArray(enumDisabled) && enumDisabled.includes(item.value),
21367
+ children: item.label || item.value
21368
+ }, item.value))
21245
21369
  })
21246
21370
  });
21247
21371
  };
@@ -21579,6 +21703,7 @@ const JsonSchemaForm_Form = /*#__PURE__*/base_default()(UnstyledForm, true ? {
21579
21703
  styles: ".form-group{margin-bottom:16px;}.form-group:last-child{margin-bottom:0;}"
21580
21704
  } : 0);
21581
21705
 
21706
+
21582
21707
  ;// ./src/components/index.ts
21583
21708
 
21584
21709