@nebula.js/stardust 4.5.0 → 4.6.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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * @nebula.js/stardust v4.5.0
2
+ * @nebula.js/stardust v4.6.0
3
3
  * Copyright (c) 2023 QlikTech International AB
4
4
  * Released under the MIT license.
5
5
  */
@@ -722,26 +722,26 @@
722
722
  }
723
723
  })(runtime);
724
724
 
725
- function ownKeys(e, r) {
726
- var t = Object.keys(e);
725
+ function ownKeys(object, enumerableOnly) {
726
+ var keys = Object.keys(object);
727
727
  if (Object.getOwnPropertySymbols) {
728
- var o = Object.getOwnPropertySymbols(e);
729
- r && (o = o.filter(function (r) {
730
- return Object.getOwnPropertyDescriptor(e, r).enumerable;
731
- })), t.push.apply(t, o);
732
- }
733
- return t;
734
- }
735
- function _objectSpread2(e) {
736
- for (var r = 1; r < arguments.length; r++) {
737
- var t = null != arguments[r] ? arguments[r] : {};
738
- r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
739
- _defineProperty(e, r, t[r]);
740
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
741
- Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
728
+ var symbols = Object.getOwnPropertySymbols(object);
729
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
730
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
731
+ })), keys.push.apply(keys, symbols);
732
+ }
733
+ return keys;
734
+ }
735
+ function _objectSpread2(target) {
736
+ for (var i = 1; i < arguments.length; i++) {
737
+ var source = null != arguments[i] ? arguments[i] : {};
738
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
739
+ _defineProperty(target, key, source[key]);
740
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
741
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
742
742
  });
743
743
  }
744
- return e;
744
+ return target;
745
745
  }
746
746
  function _defineProperty(obj, key, value) {
747
747
  key = _toPropertyKey(key);
@@ -6952,7 +6952,7 @@
6952
6952
  }
6953
6953
 
6954
6954
  /**
6955
- * @mui/styled-engine v5.14.11
6955
+ * @mui/styled-engine v5.14.13
6956
6956
  *
6957
6957
  * @license MIT
6958
6958
  * This source code is licensed under the MIT license found in the
@@ -8267,40 +8267,48 @@
8267
8267
  }
8268
8268
  return null;
8269
8269
  };
8270
+ const transformVariants = variants => {
8271
+ const variantsStyles = {};
8272
+ if (variants) {
8273
+ variants.forEach(definition => {
8274
+ const key = propsToClassKey(definition.props);
8275
+ variantsStyles[key] = definition.style;
8276
+ });
8277
+ }
8278
+ return variantsStyles;
8279
+ };
8270
8280
  const getVariantStyles = (name, theme) => {
8271
8281
  let variants = [];
8272
8282
  if (theme && theme.components && theme.components[name] && theme.components[name].variants) {
8273
8283
  variants = theme.components[name].variants;
8274
8284
  }
8275
- const variantsStyles = {};
8276
- variants.forEach(definition => {
8277
- const key = propsToClassKey(definition.props);
8278
- variantsStyles[key] = definition.style;
8279
- });
8280
- return variantsStyles;
8285
+ return transformVariants(variants);
8281
8286
  };
8282
- const variantsResolver = (props, styles, theme, name) => {
8283
- var _theme$components;
8287
+ const variantsResolver = (props, styles, variants) => {
8284
8288
  const {
8285
8289
  ownerState = {}
8286
8290
  } = props;
8287
8291
  const variantsStyles = [];
8288
- const themeVariants = theme == null || (_theme$components = theme.components) == null || (_theme$components = _theme$components[name]) == null ? void 0 : _theme$components.variants;
8289
- if (themeVariants) {
8290
- themeVariants.forEach(themeVariant => {
8292
+ if (variants) {
8293
+ variants.forEach(variant => {
8291
8294
  let isMatch = true;
8292
- Object.keys(themeVariant.props).forEach(key => {
8293
- if (ownerState[key] !== themeVariant.props[key] && props[key] !== themeVariant.props[key]) {
8295
+ Object.keys(variant.props).forEach(key => {
8296
+ if (ownerState[key] !== variant.props[key] && props[key] !== variant.props[key]) {
8294
8297
  isMatch = false;
8295
8298
  }
8296
8299
  });
8297
8300
  if (isMatch) {
8298
- variantsStyles.push(styles[propsToClassKey(themeVariant.props)]);
8301
+ variantsStyles.push(styles[propsToClassKey(variant.props)]);
8299
8302
  }
8300
8303
  });
8301
8304
  }
8302
8305
  return variantsStyles;
8303
8306
  };
8307
+ const themeVariantsResolver = (props, styles, theme, name) => {
8308
+ var _theme$components;
8309
+ const themeVariants = theme == null || (_theme$components = theme.components) == null || (_theme$components = _theme$components[name]) == null ? void 0 : _theme$components.variants;
8310
+ return variantsResolver(props, styles, themeVariants);
8311
+ };
8304
8312
 
8305
8313
  // Update /system/styled/#api in case if this changes
8306
8314
  function shouldForwardProp(prop) {
@@ -8326,6 +8334,29 @@
8326
8334
  }
8327
8335
  return (props, styles) => styles[slot];
8328
8336
  }
8337
+ const muiStyledFunctionResolver = ({
8338
+ styledArg,
8339
+ props,
8340
+ defaultTheme,
8341
+ themeId
8342
+ }) => {
8343
+ const resolvedStyles = styledArg(_extends$3({}, props, {
8344
+ theme: resolveTheme(_extends$3({}, props, {
8345
+ defaultTheme,
8346
+ themeId
8347
+ }))
8348
+ }));
8349
+ let optionalVariants;
8350
+ if (resolvedStyles && resolvedStyles.variants) {
8351
+ optionalVariants = resolvedStyles.variants;
8352
+ delete resolvedStyles.variants;
8353
+ }
8354
+ if (optionalVariants) {
8355
+ const variantsStyles = variantsResolver(props, transformVariants(optionalVariants), optionalVariants);
8356
+ return [resolvedStyles, ...variantsStyles];
8357
+ }
8358
+ return resolvedStyles;
8359
+ };
8329
8360
  function createStyled(input = {}) {
8330
8361
  const {
8331
8362
  themeId,
@@ -8385,16 +8416,61 @@
8385
8416
  // On the server Emotion doesn't use React.forwardRef for creating components, so the created
8386
8417
  // component stays as a function. This condition makes sure that we do not interpolate functions
8387
8418
  // which are basically components used as a selectors.
8388
- return typeof stylesArg === 'function' && stylesArg.__emotion_real !== stylesArg ? props => {
8389
- return stylesArg(_extends$3({}, props, {
8390
- theme: resolveTheme(_extends$3({}, props, {
8391
- defaultTheme,
8392
- themeId
8393
- }))
8394
- }));
8395
- } : stylesArg;
8419
+ if (typeof stylesArg === 'function' && stylesArg.__emotion_real !== stylesArg) {
8420
+ return props => muiStyledFunctionResolver({
8421
+ styledArg: stylesArg,
8422
+ props,
8423
+ defaultTheme,
8424
+ themeId
8425
+ });
8426
+ }
8427
+ if (isPlainObject(stylesArg)) {
8428
+ let transformedStylesArg = stylesArg;
8429
+ let styledArgVariants;
8430
+ if (stylesArg && stylesArg.variants) {
8431
+ styledArgVariants = stylesArg.variants;
8432
+ delete transformedStylesArg.variants;
8433
+ transformedStylesArg = props => {
8434
+ let result = stylesArg;
8435
+ const variantStyles = variantsResolver(props, transformVariants(styledArgVariants), styledArgVariants);
8436
+ variantStyles.forEach(variantStyle => {
8437
+ result = deepmerge(result, variantStyle);
8438
+ });
8439
+ return result;
8440
+ };
8441
+ }
8442
+ return transformedStylesArg;
8443
+ }
8444
+ return stylesArg;
8396
8445
  }) : [];
8397
8446
  let transformedStyleArg = styleArg;
8447
+ if (isPlainObject(styleArg)) {
8448
+ let styledArgVariants;
8449
+ if (styleArg && styleArg.variants) {
8450
+ styledArgVariants = styleArg.variants;
8451
+ delete transformedStyleArg.variants;
8452
+ transformedStyleArg = props => {
8453
+ let result = styleArg;
8454
+ const variantStyles = variantsResolver(props, transformVariants(styledArgVariants), styledArgVariants);
8455
+ variantStyles.forEach(variantStyle => {
8456
+ result = deepmerge(result, variantStyle);
8457
+ });
8458
+ return result;
8459
+ };
8460
+ }
8461
+ } else if (typeof styleArg === 'function' &&
8462
+ // On the server Emotion doesn't use React.forwardRef for creating components, so the created
8463
+ // component stays as a function. This condition makes sure that we do not interpolate functions
8464
+ // which are basically components used as a selectors.
8465
+ styleArg.__emotion_real !== styleArg) {
8466
+ // If the type is function, we need to define the default theme.
8467
+ transformedStyleArg = props => muiStyledFunctionResolver({
8468
+ styledArg: styleArg,
8469
+ props,
8470
+ defaultTheme,
8471
+ themeId
8472
+ });
8473
+ }
8398
8474
  if (componentName && overridesResolver) {
8399
8475
  expressionsWithDefaultTheme.push(props => {
8400
8476
  const theme = resolveTheme(_extends$3({}, props, {
@@ -8420,7 +8496,7 @@
8420
8496
  defaultTheme,
8421
8497
  themeId
8422
8498
  }));
8423
- return variantsResolver(props, getVariantStyles(componentName, theme), theme, componentName);
8499
+ return themeVariantsResolver(props, getVariantStyles(componentName, theme), theme, componentName);
8424
8500
  });
8425
8501
  }
8426
8502
  if (!skipSx) {
@@ -8432,18 +8508,6 @@
8432
8508
  // If the type is array, than we need to add placeholders in the template for the overrides, variants and the sx styles.
8433
8509
  transformedStyleArg = [...styleArg, ...placeholders];
8434
8510
  transformedStyleArg.raw = [...styleArg.raw, ...placeholders];
8435
- } else if (typeof styleArg === 'function' &&
8436
- // On the server Emotion doesn't use React.forwardRef for creating components, so the created
8437
- // component stays as a function. This condition makes sure that we do not interpolate functions
8438
- // which are basically components used as a selectors.
8439
- styleArg.__emotion_real !== styleArg) {
8440
- // If the type is function, we need to define the default theme.
8441
- transformedStyleArg = props => styleArg(_extends$3({}, props, {
8442
- theme: resolveTheme(_extends$3({}, props, {
8443
- defaultTheme,
8444
- themeId
8445
- }))
8446
- }));
8447
8511
  }
8448
8512
  const Component = defaultStyledResolver(transformedStyleArg, ...expressionsWithDefaultTheme);
8449
8513
  if (tag.muiName) {
@@ -11129,7 +11193,7 @@
11129
11193
  type: type
11130
11194
  }, buttonProps, other, {
11131
11195
  children: [children, enableTouchRipple ?
11132
- /*#__PURE__*/
11196
+
11133
11197
  /* TouchRipple is only needed client-side, x2 boost on the server. */
11134
11198
  jsxRuntimeExports.jsx(TouchRipple$1, _extends$5({
11135
11199
  ref: handleRippleRef,
@@ -11497,7 +11561,9 @@
11497
11561
  text: {
11498
11562
  primary: colors.grey25,
11499
11563
  secondary: 'rgba(0, 0, 0, 0.55)',
11500
- disabled: 'rgba(0, 0, 0, 0.3)'
11564
+ disabled: 'rgba(0, 0, 0, 0.3)',
11565
+ light: colors.grey100,
11566
+ dark: colors.grey0
11501
11567
  },
11502
11568
  action: {
11503
11569
  active: '#545454',
@@ -11531,9 +11597,13 @@
11531
11597
  main: colors.green,
11532
11598
  alternative: '#E4E4E4',
11533
11599
  excluded: '#BEBEBE',
11600
+ selectedExcluded: '#BEBEBE',
11601
+ possible: colors.grey100,
11534
11602
  mainContrastText: colors.grey100,
11535
11603
  alternativeContrastText: colors.grey25,
11536
- excludedContrastText: colors.grey25
11604
+ excludedContrastText: colors.grey25,
11605
+ selectedExcludedContrastText: colors.grey100,
11606
+ possibleContrastText: colors.grey0
11537
11607
  },
11538
11608
  btn: {
11539
11609
  normal: 'rgba(255, 255, 255, 0.6)',
@@ -11561,7 +11631,9 @@
11561
11631
  text: {
11562
11632
  primary: colors.grey100,
11563
11633
  secondary: 'rgba(255, 255, 255, 0.6)',
11564
- disabled: 'rgba(255, 255, 255, 0.3)'
11634
+ disabled: 'rgba(255, 255, 255, 0.3)',
11635
+ light: colors.grey100,
11636
+ dark: colors.grey0
11565
11637
  },
11566
11638
  action: {
11567
11639
  // active: 'rgba(0, 0, 0, 0.55)',
@@ -11592,9 +11664,13 @@
11592
11664
  main: colors.green,
11593
11665
  alternative: colors.grey20,
11594
11666
  excluded: colors.grey10,
11667
+ selectedExcluded: colors.grey10,
11668
+ possible: colors.grey80,
11595
11669
  mainContrastText: colors.grey100,
11596
11670
  alternativeContrastText: colors.grey100,
11597
- excludedContrastText: colors.grey100
11671
+ excludedContrastText: colors.grey100,
11672
+ selectedExcludedContrastText: colors.grey100,
11673
+ possibleContrastText: colors.grey0
11598
11674
  },
11599
11675
  btn: {
11600
11676
  normal: 'rgba(255, 255, 255, 0.15)',
@@ -11742,7 +11818,7 @@
11742
11818
  return cache[key];
11743
11819
  }
11744
11820
 
11745
- const NEBULA_VERSION_HASH = "7c03" ;
11821
+ const NEBULA_VERSION_HASH = "ba42" ;
11746
11822
  ClassNameGenerator$1.configure(componentName => {
11747
11823
  return "njs-".concat(NEBULA_VERSION_HASH, "-").concat(componentName.replace('Mui', ''));
11748
11824
  });
@@ -12003,7 +12079,7 @@
12003
12079
  const appRef = React.createRef();
12004
12080
  const element = document.createElement('div');
12005
12081
  element.style.display = 'none';
12006
- element.setAttribute('data-nebulajs-version', "4.5.0" );
12082
+ element.setAttribute('data-nebulajs-version', "4.6.0" );
12007
12083
  element.setAttribute('data-app-id', app.id);
12008
12084
  document.body.appendChild(element);
12009
12085
  if (context) {
@@ -17020,7 +17096,7 @@
17020
17096
  color: (theme.vars || theme).palette.text.secondary
17021
17097
  }, !ownerState.disableRipple && {
17022
17098
  '&:hover': {
17023
- backgroundColor: theme.vars ? `rgba(${ownerState.color === 'default' ? theme.vars.palette.action.activeChannel : theme.vars.palette.primary.mainChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha(ownerState.color === 'default' ? theme.palette.action.active : theme.palette[ownerState.color].main, theme.palette.action.hoverOpacity),
17099
+ backgroundColor: theme.vars ? `rgba(${ownerState.color === 'default' ? theme.vars.palette.action.activeChannel : theme.vars.palette[ownerState.color].mainChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha(ownerState.color === 'default' ? theme.palette.action.active : theme.palette[ownerState.color].main, theme.palette.action.hoverOpacity),
17024
17100
  // Reset on touch devices, it doesn't add specificity
17025
17101
  '@media (hover: none)': {
17026
17102
  backgroundColor: 'transparent'
@@ -20819,10 +20895,6 @@
20819
20895
  const [modelStore] = useModelStore();
20820
20896
  const [rpcRequestSessionModelStore] = useRpcRequestSessionModelStore();
20821
20897
  const [model, setModel] = reactExports.useState();
20822
- let rpcShared;
20823
- if (key) {
20824
- rpcShared = rpcRequestSessionModelStore.get(key);
20825
- }
20826
20898
  for (var _len = arguments.length, deps = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
20827
20899
  deps[_key - 2] = arguments[_key];
20828
20900
  }
@@ -20832,9 +20904,9 @@
20832
20904
  }
20833
20905
  // Create new session object
20834
20906
  const create = async () => {
20907
+ let rpcShared = rpcRequestSessionModelStore.get(key);
20835
20908
  if (!rpcShared) {
20836
- const rpc = app.createSessionObject(definition);
20837
- rpcShared = rpc;
20909
+ rpcShared = app.createSessionObject(definition);
20838
20910
  rpcRequestSessionModelStore.set(key, rpcShared);
20839
20911
  }
20840
20912
  const newModel = await rpcShared;
@@ -21947,17 +22019,30 @@
21947
22019
  };
21948
22020
  const getSelectedStyle = _ref3 => {
21949
22021
  let {
21950
- theme
22022
+ theme,
22023
+ styles,
22024
+ selectedState
21951
22025
  } = _ref3;
22026
+ const selectionStyles = styles.selections;
22027
+ const backgroundColor = selectionStyles[selectedState];
22028
+ const contrastTextColor = selectionStyles["".concat(selectedState, "Contrast")];
21952
22029
  return {
21953
- background: theme.palette.selected.main,
21954
- color: theme.palette.selected.mainContrastText,
22030
+ background: backgroundColor,
22031
+ color: contrastTextColor,
21955
22032
  '&:focus': {
21956
22033
  boxShadow: "inset 0 0 0 2px ".concat(theme.palette.custom.focusBorder),
21957
22034
  outline: 'none'
21958
22035
  },
21959
22036
  '& $cell': {
21960
22037
  paddingRight: 0
22038
+ },
22039
+ // Override default label text style for selection states
22040
+ // when contrasting text is needed.
22041
+ ["& .".concat(rowColClasses.labelText)]: {
22042
+ color: contrastTextColor
22043
+ },
22044
+ ["& .".concat(rowColClasses.icon)]: {
22045
+ color: contrastTextColor
21961
22046
  }
21962
22047
  };
21963
22048
  };
@@ -21970,9 +22055,8 @@
21970
22055
  const iconWidth = 24; // tick and lock icon width in px
21971
22056
 
21972
22057
  const RowColRoot = styled$1('div', {
21973
- shouldForwardProp: prop => !['checkboxes', 'isGridMode', 'isGridCol', 'dense', 'direction', 'sizes', 'frequencyMode', 'freqHitsValue'].includes(prop)
22058
+ shouldForwardProp: prop => !['checkboxes', 'isGridMode', 'isGridCol', 'dense', 'direction', 'sizes', 'frequencyMode', 'freqHitsValue', 'layout', 'styles'].includes(prop)
21974
22059
  })(_ref4 => {
21975
- var _theme$listBox$conten, _theme$listBox, _theme$listBox$conten2, _theme$listBox2, _theme$listBox3, _theme$listBox4;
21976
22060
  let {
21977
22061
  theme,
21978
22062
  checkboxes,
@@ -21982,8 +22066,21 @@
21982
22066
  direction,
21983
22067
  sizes,
21984
22068
  frequencyMode,
21985
- freqHitsValue
22069
+ freqHitsValue,
22070
+ styles
21986
22071
  } = _ref4;
22072
+ const rowFontColor = styles.content.color;
22073
+ const rowBackgroundColor = styles.content.backgroundColor;
22074
+ const selectStyle = getSelectedStyle({
22075
+ theme,
22076
+ styles,
22077
+ selectedState: 'selected'
22078
+ });
22079
+ const excludedSelectStyle = getSelectedStyle({
22080
+ theme,
22081
+ styles,
22082
+ selectedState: 'excluded'
22083
+ });
21987
22084
  return {
21988
22085
  '&:focus': {
21989
22086
  boxShadow: "inset 0 0 0 2px ".concat(theme.palette.custom.focusBorder, " !important")
@@ -22001,7 +22098,8 @@
22001
22098
  },
22002
22099
  ["& .".concat(rowColClasses.row)]: {
22003
22100
  flexWrap: 'nowrap',
22004
- color: (_theme$listBox$conten = (_theme$listBox = theme.listBox) === null || _theme$listBox === void 0 || (_theme$listBox = _theme$listBox.content) === null || _theme$listBox === void 0 ? void 0 : _theme$listBox.color) !== null && _theme$listBox$conten !== void 0 ? _theme$listBox$conten : theme.palette.text.primary
22101
+ color: rowFontColor,
22102
+ backgroundColor: rowBackgroundColor
22005
22103
  },
22006
22104
  ["& .".concat(rowColClasses.rowBorderBottom)]: {
22007
22105
  borderBottom: isGridCol ? 'none' : "1px solid ".concat(theme.palette.divider),
@@ -22010,10 +22108,11 @@
22010
22108
  ["& .".concat(rowColClasses.column)]: {
22011
22109
  flexWrap: 'nowrap',
22012
22110
  borderRight: "1px solid ".concat(theme.palette.divider),
22013
- color: (_theme$listBox$conten2 = (_theme$listBox2 = theme.listBox) === null || _theme$listBox2 === void 0 || (_theme$listBox2 = _theme$listBox2.content) === null || _theme$listBox2 === void 0 ? void 0 : _theme$listBox2.color) !== null && _theme$listBox$conten2 !== void 0 ? _theme$listBox$conten2 : theme.palette.text.primary
22111
+ color: rowFontColor
22014
22112
  },
22015
22113
  // The interior wrapper for all field content.
22016
22114
  ["& .".concat(rowColClasses.cell)]: {
22115
+ zIndex: 2,
22017
22116
  display: 'flex',
22018
22117
  alignItems: 'center',
22019
22118
  flexGrow: 1,
@@ -22030,8 +22129,9 @@
22030
22129
  userSelect: 'none',
22031
22130
  paddingRight: '1px'
22032
22131
  }, ellipsis), {}, {
22033
- fontSize: (_theme$listBox3 = theme.listBox) === null || _theme$listBox3 === void 0 || (_theme$listBox3 = _theme$listBox3.content) === null || _theme$listBox3 === void 0 ? void 0 : _theme$listBox3.fontSize,
22034
- fontFamily: (_theme$listBox4 = theme.listBox) === null || _theme$listBox4 === void 0 || (_theme$listBox4 = _theme$listBox4.content) === null || _theme$listBox4 === void 0 ? void 0 : _theme$listBox4.fontFamily
22132
+ fontSize: styles.content.fontSize,
22133
+ fontFamily: styles.content.fontFamily,
22134
+ color: rowFontColor
22035
22135
  }),
22036
22136
  ["& .".concat(rowColClasses.labelDense)]: {
22037
22137
  fontSize: 12
@@ -22065,32 +22165,32 @@
22065
22165
  justifyContent: 'center',
22066
22166
  width: iconWidth,
22067
22167
  minWidth: iconWidth,
22068
- maxWidth: iconWidth
22168
+ maxWidth: iconWidth,
22169
+ color: rowFontColor
22069
22170
  },
22070
- // Selection styles (S=Selected, XS=ExcludedSelected, A=Available, X=Excluded).
22071
- ["& .".concat(rowColClasses.S)]: _objectSpread2(_objectSpread2({}, getSelectedStyle({
22072
- theme
22073
- })), {}, {
22171
+ // Selection styles (S=Selected, XS=ExcludedSelected, A=Alternative, X=Excluded).
22172
+ ["& .".concat(rowColClasses.S)]: _objectSpread2(_objectSpread2({}, selectStyle), {}, {
22074
22173
  border: isGridMode ? 'none' : undefined
22075
22174
  }),
22076
22175
  ["& .".concat(rowColClasses.XS)]: _objectSpread2(_objectSpread2({}, getSelectedStyle({
22077
- theme
22176
+ theme,
22177
+ styles,
22178
+ selectedState: 'selectedExcluded'
22078
22179
  })), {}, {
22079
- background: theme.palette.selected.excluded,
22080
- color: theme.palette.selected.excludedContrastText,
22081
22180
  border: isGridMode ? 'none' : undefined
22082
22181
  }),
22083
- ["& .".concat(rowColClasses.A)]: {
22084
- background: theme.palette.selected.alternative,
22085
- color: theme.palette.selected.alternativeContrastText,
22182
+ ["& .".concat(rowColClasses.A)]: _objectSpread2(_objectSpread2({}, getSelectedStyle({
22183
+ theme,
22184
+ styles,
22185
+ selectedState: 'alternative'
22186
+ })), {}, {
22086
22187
  border: isGridMode ? 'none' : undefined
22087
- },
22088
- ["& .".concat(rowColClasses.X)]: {
22089
- background: theme.palette.selected.excluded,
22090
- color: theme.palette.selected.excludedContrastText,
22188
+ }),
22189
+ ["& .".concat(rowColClasses.X)]: _objectSpread2(_objectSpread2({}, excludedSelectStyle), {}, {
22091
22190
  border: isGridMode ? 'none' : undefined
22092
- },
22191
+ }),
22093
22192
  ["& .".concat(rowColClasses.frequencyCount)]: _objectSpread2(_objectSpread2({
22193
+ zIndex: 3,
22094
22194
  justifyContent: 'flex-end'
22095
22195
  }, ellipsis), {}, {
22096
22196
  flex: "0 0 ".concat(getFreqFlexBasis({
@@ -22118,7 +22218,7 @@
22118
22218
  ["& .".concat(rowColClasses.bar)]: {
22119
22219
  height: dense ? '16px' : '20px',
22120
22220
  position: 'absolute',
22121
- zIndex: '-1',
22221
+ zIndex: 1,
22122
22222
  alignSelf: 'center',
22123
22223
  left: barPadPx,
22124
22224
  width: "calc(100% - ".concat(barPadPx * 2, "px)"),
@@ -22133,7 +22233,6 @@
22133
22233
  }
22134
22234
  },
22135
22235
  ["& .".concat(rowColClasses.barSelected)]: {
22136
- zIndex: '0',
22137
22236
  '& .bar-filled': {
22138
22237
  opacity: '30%',
22139
22238
  background: theme.palette.background.lighter
@@ -22145,8 +22244,9 @@
22145
22244
  },
22146
22245
  ["& .".concat(rowColClasses.barSelectedWithCheckbox)]: {
22147
22246
  '& .bar-filled': {
22148
- background: '#BFE5D0',
22149
- borderColor: '#BFE5D0'
22247
+ opacity: '30%',
22248
+ background: selectStyle.background || '#BFE5D0',
22249
+ borderColor: selectStyle.background || '#BFE5D0'
22150
22250
  }
22151
22251
  },
22152
22252
  ["& .".concat(rowColClasses.excludedTextWithCheckbox)]: {
@@ -22169,9 +22269,12 @@
22169
22269
  checkbox: "".concat(PREFIX$b, "-checkbox"),
22170
22270
  dense: "".concat(PREFIX$b, "-dense")
22171
22271
  };
22172
- const StyledCheckbox = styled$1(Checkbox$1)(_ref => {
22272
+ const StyledCheckbox = styled$1(Checkbox$1, {
22273
+ shouldForwardProp: p => p !== 'styles'
22274
+ })(_ref => {
22173
22275
  let {
22174
- theme
22276
+ theme,
22277
+ styles
22175
22278
  } = _ref;
22176
22279
  return {
22177
22280
  ["& .".concat(classes$b.cbIcon)]: {
@@ -22187,7 +22290,7 @@
22187
22290
  },
22188
22291
  ["& .".concat(classes$b.cbIconChecked)]: {
22189
22292
  borderRadius,
22190
- backgroundColor: theme.palette.selected.main,
22293
+ backgroundColor: styles.selections.selected,
22191
22294
  backgroundImage: 'linear-gradient(180deg,hsla(0,0%,100%,.1),hsla(0,0%,100%,0))',
22192
22295
  '&:before': {
22193
22296
  display: 'block',
@@ -22236,6 +22339,7 @@
22236
22339
  label,
22237
22340
  dense,
22238
22341
  excluded,
22342
+ styles,
22239
22343
  showGray = true,
22240
22344
  dataN
22241
22345
  } = _ref2;
@@ -22253,7 +22357,8 @@
22253
22357
  icon: getIcon(classes$b, showGray, excluded),
22254
22358
  checkedIcon: /*#__PURE__*/React.createElement("span", {
22255
22359
  className: classes$b.cbIconChecked
22256
- })
22360
+ }),
22361
+ styles: styles
22257
22362
  });
22258
22363
  }
22259
22364
 
@@ -22305,7 +22410,6 @@
22305
22410
  function ValueField(_ref) {
22306
22411
  let {
22307
22412
  label,
22308
- color,
22309
22413
  dense,
22310
22414
  showGray = true,
22311
22415
  checkboxes,
@@ -22319,7 +22423,6 @@
22319
22423
  cell,
22320
22424
  checkboxes
22321
22425
  }) && rowColClasses.excludedTextWithCheckbox]),
22322
- color: color,
22323
22426
  align: valueTextAlign,
22324
22427
  dir: "auto"
22325
22428
  }, /*#__PURE__*/React.createElement("span", null, label));
@@ -22353,7 +22456,6 @@
22353
22456
  let {
22354
22457
  onChange,
22355
22458
  label,
22356
- color,
22357
22459
  qElemNumber,
22358
22460
  isSelected,
22359
22461
  dense,
@@ -22362,7 +22464,8 @@
22362
22464
  showGray,
22363
22465
  isSingleSelect,
22364
22466
  checkboxes,
22365
- valueTextAlign
22467
+ valueTextAlign,
22468
+ styles
22366
22469
  } = _ref;
22367
22470
  const cb = /*#__PURE__*/React.createElement(ListboxCheckbox, {
22368
22471
  onChange: onChange,
@@ -22372,7 +22475,8 @@
22372
22475
  excluded: isExcluded(cell),
22373
22476
  isGridCol: isGridCol,
22374
22477
  showGray: showGray,
22375
- dataN: qElemNumber
22478
+ dataN: qElemNumber,
22479
+ styles: styles
22376
22480
  });
22377
22481
  const rb = /*#__PURE__*/React.createElement(ListBoxRadioButton, {
22378
22482
  onChange: onChange,
@@ -22382,12 +22486,10 @@
22382
22486
  dataN: qElemNumber
22383
22487
  });
22384
22488
  return /*#__PURE__*/React.createElement(FormControlLabel$1, {
22385
- color: color,
22386
22489
  control: isSingleSelect ? rb : cb,
22387
22490
  className: rowColClasses.checkboxLabel,
22388
22491
  label: /*#__PURE__*/React.createElement(LabelTag, {
22389
22492
  label: label,
22390
- color: color,
22391
22493
  dense: dense,
22392
22494
  showGray: showGray,
22393
22495
  checkboxes: checkboxes,
@@ -22426,13 +22528,13 @@
22426
22528
  checkboxes,
22427
22529
  dense,
22428
22530
  showGray,
22429
- color,
22430
22531
  qElemNumber,
22431
22532
  isSelected,
22432
22533
  cell,
22433
22534
  isGridCol,
22434
22535
  isSingleSelect,
22435
- valueTextAlign
22536
+ valueTextAlign,
22537
+ styles
22436
22538
  } = _ref3;
22437
22539
  const LWR = /*#__PURE__*/React.createElement(LabelsWithRanges, {
22438
22540
  labels: labels,
@@ -22443,7 +22545,6 @@
22443
22545
  return checkboxes ? /*#__PURE__*/React.createElement(CheckboxField, {
22444
22546
  onChange: onChange,
22445
22547
  label: LWR,
22446
- color: color,
22447
22548
  qElemNumber: qElemNumber,
22448
22549
  isSelected: isSelected,
22449
22550
  dense: dense,
@@ -22452,7 +22553,8 @@
22452
22553
  showGray: showGray,
22453
22554
  isSingleSelect: isSingleSelect,
22454
22555
  checkboxes: checkboxes,
22455
- valueTextAlign: valueTextAlign
22556
+ valueTextAlign: valueTextAlign,
22557
+ styles: styles
22456
22558
  }) : LWR;
22457
22559
  }
22458
22560
 
@@ -22460,7 +22562,6 @@
22460
22562
  let {
22461
22563
  onChange,
22462
22564
  label,
22463
- color,
22464
22565
  qElemNumber,
22465
22566
  isSelected,
22466
22567
  dense,
@@ -22469,12 +22570,12 @@
22469
22570
  showGray,
22470
22571
  isSingleSelect,
22471
22572
  checkboxes,
22472
- valueTextAlign
22573
+ valueTextAlign,
22574
+ styles
22473
22575
  } = _ref;
22474
22576
  return checkboxes ? /*#__PURE__*/React.createElement(CheckboxField, {
22475
22577
  onChange: onChange,
22476
22578
  label: label,
22477
- color: color,
22478
22579
  qElemNumber: qElemNumber,
22479
22580
  isSelected: isSelected,
22480
22581
  dense: dense,
@@ -22483,10 +22584,10 @@
22483
22584
  showGray: showGray,
22484
22585
  isSingleSelect: isSingleSelect,
22485
22586
  checkboxes: checkboxes,
22486
- valueTextAlign: valueTextAlign
22587
+ valueTextAlign: valueTextAlign,
22588
+ styles: styles
22487
22589
  }) : /*#__PURE__*/React.createElement(ValueField, {
22488
22590
  label: label,
22489
- color: color,
22490
22591
  dense: dense,
22491
22592
  showGray: true,
22492
22593
  checkboxes: checkboxes,
@@ -23036,7 +23137,9 @@
23036
23137
  sizes,
23037
23138
  translator,
23038
23139
  showSearch,
23039
- isModal
23140
+ isModal,
23141
+ contentFontStyle,
23142
+ styles
23040
23143
  } = data;
23041
23144
  const {
23042
23145
  dense = false,
@@ -23047,7 +23150,7 @@
23047
23150
  itemPadding
23048
23151
  } = sizes;
23049
23152
  let cellIndex;
23050
- let styles;
23153
+ let styleOverrides;
23051
23154
  const count = {
23052
23155
  max: null,
23053
23156
  currentIndex: null
@@ -23063,7 +23166,7 @@
23063
23166
  count.currentIndex = columnIndex;
23064
23167
  }
23065
23168
  const padding = 0;
23066
- styles = _objectSpread2(_objectSpread2({}, style), {}, {
23169
+ styleOverrides = _objectSpread2(_objectSpread2({}, style), {}, {
23067
23170
  left: padding + (columnIndex === 0 ? style.left : Number(style.left) + columnIndex * padding),
23068
23171
  // right: columnIndex === columnCount ? style.right : Number(style.right) + columnIndex * padding,
23069
23172
  top: rowIndex === 0 ? style.top : Number(style.top) + rowIndex * padding
@@ -23072,7 +23175,7 @@
23072
23175
  cellIndex = index;
23073
23176
  count.max = listCount;
23074
23177
  count.currentIndex = index;
23075
- styles = _objectSpread2({}, style);
23178
+ styleOverrides = _objectSpread2({}, style);
23076
23179
  }
23077
23180
  cellIndex += dataOffset;
23078
23181
  const [rowRef, setRowRef] = reactExports.useState(null);
@@ -23162,7 +23265,8 @@
23162
23265
  return /*#__PURE__*/React.createElement(RowColRoot$1, {
23163
23266
  className: rowColClasses.barContainer,
23164
23267
  checkboxes: checkboxes,
23165
- style: styles,
23268
+ style: styleOverrides,
23269
+ styles: styles,
23166
23270
  isGridCol: isGridCol,
23167
23271
  isGridMode: dataLayout === 'grid',
23168
23272
  dense: dense,
@@ -23170,6 +23274,7 @@
23170
23274
  sizes: sizes,
23171
23275
  frequencyMode: deducedFrequencyMode,
23172
23276
  freqHitsValue: freqHitsValue,
23277
+ contentFontStyle: contentFontStyle,
23173
23278
  "data-testid": "listbox.item"
23174
23279
  }, /*#__PURE__*/React.createElement(ItemGrid, {
23175
23280
  role: "row",
@@ -23216,18 +23321,16 @@
23216
23321
  checkboxes: checkboxes,
23217
23322
  dense: dense,
23218
23323
  showGray: showGray,
23219
- color: "inherit" // TODO: Check this
23220
- ,
23221
23324
  qElemNumber: cell.qElemNumber,
23222
23325
  isSelected: isSelected,
23223
23326
  cell: cell,
23224
23327
  isGridCol: isGridCol,
23225
23328
  isSingleSelect: isSingleSelect,
23226
- valueTextAlign: valueTextAlign
23329
+ valueTextAlign: valueTextAlign,
23330
+ styles: styles
23227
23331
  }) : /*#__PURE__*/React.createElement(Field$1, {
23228
23332
  onChange: onChange,
23229
23333
  label: label,
23230
- color: "inherit",
23231
23334
  qElemNumber: cell.qElemNumber,
23232
23335
  isSelected: isSelected,
23233
23336
  dense: dense,
@@ -23236,7 +23339,8 @@
23236
23339
  showGray: showGray,
23237
23340
  isSingleSelect: isSingleSelect,
23238
23341
  checkboxes: checkboxes,
23239
- valueTextAlign: valueTextAlign
23342
+ valueTextAlign: valueTextAlign,
23343
+ styles: styles
23240
23344
  })), freqIsAllowed && /*#__PURE__*/React.createElement(Frequency, {
23241
23345
  cell: cell,
23242
23346
  checkboxes: checkboxes,
@@ -24816,7 +24920,8 @@
24816
24920
  freqIsAllowed,
24817
24921
  translator,
24818
24922
  showSearch,
24819
- isModal
24923
+ isModal,
24924
+ styles
24820
24925
  } = _ref;
24821
24926
  const {
24822
24927
  layoutOptions = {}
@@ -24870,7 +24975,8 @@
24870
24975
  direction,
24871
24976
  translator,
24872
24977
  showSearch,
24873
- isModal
24978
+ isModal,
24979
+ styles
24874
24980
  });
24875
24981
  const List = _ref2 => {
24876
24982
  let {
@@ -25001,6 +25107,7 @@
25001
25107
  } else {
25002
25108
  rowCount = Math.min(listCount, maxRows, autoRowCount);
25003
25109
  }
25110
+ rowCount = Math.max(rowCount, 1);
25004
25111
  const columnCount = Math.ceil(listCount / rowCount);
25005
25112
  const columnWidth = Math.max(columnAutoWidth, containerWidth / columnCount, itemMinWidth);
25006
25113
  return {
@@ -25027,6 +25134,7 @@
25027
25134
  } else {
25028
25135
  columnCount = Math.min(listCount, maxColumns, autoColumnCount);
25029
25136
  }
25137
+ columnCount = Math.max(columnCount, 1);
25030
25138
  const columnWidth = innerWidth / columnCount;
25031
25139
  const rowCount = Math.ceil(listCount / columnCount);
25032
25140
  return {
@@ -25066,7 +25174,6 @@
25066
25174
  }
25067
25175
 
25068
25176
  function useListSizes(_ref) {
25069
- var _theme$listBox;
25070
25177
  let {
25071
25178
  layout,
25072
25179
  width,
@@ -25075,7 +25182,7 @@
25075
25182
  count,
25076
25183
  freqIsAllowed,
25077
25184
  checkboxes,
25078
- theme
25185
+ styles
25079
25186
  } = _ref;
25080
25187
  const {
25081
25188
  layoutOptions = {}
@@ -25090,7 +25197,7 @@
25090
25197
  const {
25091
25198
  fontSize = '12px',
25092
25199
  fontFamily = 'Source sans pro'
25093
- } = (theme === null || theme === void 0 || (_theme$listBox = theme.listBox) === null || _theme$listBox === void 0 ? void 0 : _theme$listBox.content) || {};
25200
+ } = (styles === null || styles === void 0 ? void 0 : styles.content) || {};
25094
25201
  const font = "".concat(fontSize, " ").concat(fontFamily); // font format as supported by HTML canvas
25095
25202
  const textWidth = useTextWidth({
25096
25203
  text: getMeasureText(layout),
@@ -25611,7 +25718,6 @@
25611
25718
  model,
25612
25719
  app,
25613
25720
  constraints,
25614
- theme,
25615
25721
  layout,
25616
25722
  selections,
25617
25723
  selectionState,
@@ -25638,7 +25744,8 @@
25638
25744
  renderedCallback,
25639
25745
  onCtrlF,
25640
25746
  showSearch,
25641
- isModal
25747
+ isModal,
25748
+ styles
25642
25749
  } = _ref;
25643
25750
  const {
25644
25751
  translator: translatorDynamic
@@ -25794,7 +25901,7 @@
25794
25901
  count,
25795
25902
  freqIsAllowed,
25796
25903
  checkboxes,
25797
- theme
25904
+ styles
25798
25905
  });
25799
25906
  if (sizes.columnWidth) {
25800
25907
  // In grid mode, where we have a dynamic item width, get a second opinion on showing/hiding frequency.
@@ -25909,7 +26016,8 @@
25909
26016
  freqIsAllowed,
25910
26017
  translator: translatorDynamic,
25911
26018
  showSearch,
25912
- isModal
26019
+ isModal,
26020
+ styles
25913
26021
  });
25914
26022
  const {
25915
26023
  columnWidth,
@@ -26285,7 +26393,7 @@
26285
26393
  }), /*#__PURE__*/React.createElement(MenuList$1, {
26286
26394
  id: "moreMenuList"
26287
26395
  }, actions.map((item, ix) =>
26288
- /*#__PURE__*/
26396
+
26289
26397
  // eslint-disable-next-line react/no-array-index-key
26290
26398
  React.createElement(MoreItem, {
26291
26399
  key: ix,
@@ -26604,22 +26712,24 @@
26604
26712
 
26605
26713
  const TREE_PATH = '/qListObjectDef';
26606
26714
  const WILDCARD = '**';
26607
- const StyledInputAdornment = styled$1(InputAdornment$1)(_ref => {
26608
- var _theme$listBox;
26715
+ const StyledInputAdornment = styled$1(InputAdornment$1, {
26716
+ shouldForwardProp: p => p !== 'styles'
26717
+ })(_ref => {
26609
26718
  let {
26610
- theme
26719
+ styles
26611
26720
  } = _ref;
26612
26721
  return {
26613
- color: (_theme$listBox = theme.listBox) === null || _theme$listBox === void 0 || (_theme$listBox = _theme$listBox.content) === null || _theme$listBox === void 0 ? void 0 : _theme$listBox.color
26722
+ color: styles.content.color
26614
26723
  };
26615
26724
  });
26616
- const StyledOutlinedInput = styled$1(OutlinedInput$1)(_ref2 => {
26617
- var _theme$listBox2;
26725
+ const StyledOutlinedInput = styled$1(OutlinedInput$1, {
26726
+ shouldForwardProp: p => p !== 'styles'
26727
+ })(_ref2 => {
26618
26728
  let {
26619
- theme
26729
+ styles
26620
26730
  } = _ref2;
26621
26731
  return {
26622
- color: (_theme$listBox2 = theme.listBox) === null || _theme$listBox2 === void 0 || (_theme$listBox2 = _theme$listBox2.content) === null || _theme$listBox2 === void 0 ? void 0 : _theme$listBox2.color,
26732
+ color: styles.content.color,
26623
26733
  display: 'flex'
26624
26734
  };
26625
26735
  });
@@ -26635,7 +26745,8 @@
26635
26745
  wildCardSearch = false,
26636
26746
  searchEnabled,
26637
26747
  direction,
26638
- hide
26748
+ hide,
26749
+ styles
26639
26750
  } = _ref3;
26640
26751
  const {
26641
26752
  translator
@@ -26772,8 +26883,10 @@
26772
26883
  return null;
26773
26884
  }
26774
26885
  return /*#__PURE__*/React.createElement(StyledOutlinedInput, {
26886
+ styles: styles,
26775
26887
  startAdornment: /*#__PURE__*/React.createElement(StyledInputAdornment, {
26776
- position: "start"
26888
+ position: "start",
26889
+ styles: styles
26777
26890
  }, /*#__PURE__*/React.createElement(SearchIcon, {
26778
26891
  size: dense ? 'small' : 'normal'
26779
26892
  })),
@@ -27236,6 +27349,104 @@
27236
27349
  return totalCounts > 0;
27237
27350
  }
27238
27351
 
27352
+ const LIGHT = '#FFF';
27353
+ const DARK = '#000';
27354
+ function getContrastingColor(backgroundColor) {
27355
+ let desiredTextColor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
27356
+ let dark = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DARK;
27357
+ let light = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : LIGHT;
27358
+ const CONTRAST_THRESHOLD = 3.0;
27359
+ let contrastingColor;
27360
+ if (desiredTextColor && getContrastRatio(desiredTextColor, backgroundColor) > CONTRAST_THRESHOLD) {
27361
+ contrastingColor = desiredTextColor;
27362
+ } else {
27363
+ contrastingColor = getContrastRatio(light, backgroundColor) > CONTRAST_THRESHOLD ? light : dark;
27364
+ }
27365
+ return contrastingColor;
27366
+ }
27367
+ const SUPPORTED_COMPONENTS = ['theme', 'selections'];
27368
+ function getOverridesAsObject() {
27369
+ let components = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
27370
+ // Currently supporting components "theme" and "selections".
27371
+ const overrides = {};
27372
+ components.forEach(c => {
27373
+ const k = c === null || c === void 0 ? void 0 : c.key;
27374
+ if (SUPPORTED_COMPONENTS.includes(k)) {
27375
+ overrides[k] = c;
27376
+ }
27377
+ });
27378
+ return overrides;
27379
+ }
27380
+ function getSelectionColors(theme, getListboxStyle, overrides) {
27381
+ var _overrides$theme, _theme$palette, _overrides$theme$cont, _overrides$theme2, _overrides$selections, _selectionColors$sele, _theme$palette2, _selectionColors$alte, _theme$palette3, _selectionColors$excl, _theme$palette4, _selectionColors$sele2, _theme$palette5, _selectionColors$poss, _theme$palette6, _theme$palette7, _theme$palette8, _theme$palette9, _theme$palette10, _theme$palette11;
27382
+ const desiredTextColor = ((_overrides$theme = overrides.theme) === null || _overrides$theme === void 0 || (_overrides$theme = _overrides$theme.content) === null || _overrides$theme === void 0 || (_overrides$theme = _overrides$theme.fontColor) === null || _overrides$theme === void 0 ? void 0 : _overrides$theme.color) || getListboxStyle('content', 'color') || ((_theme$palette = theme.palette) === null || _theme$palette === void 0 ? void 0 : _theme$palette.text.primary);
27383
+ const useContrastTextColor = (_overrides$theme$cont = (_overrides$theme2 = overrides.theme) === null || _overrides$theme2 === void 0 || (_overrides$theme2 = _overrides$theme2.content) === null || _overrides$theme2 === void 0 ? void 0 : _overrides$theme2.useContrastColor) !== null && _overrides$theme$cont !== void 0 ? _overrides$theme$cont : true;
27384
+
27385
+ // Background colors
27386
+ const selectionColors = ((_overrides$selections = overrides.selections) === null || _overrides$selections === void 0 ? void 0 : _overrides$selections.colors) || {};
27387
+ const selected = ((_selectionColors$sele = selectionColors.selected) === null || _selectionColors$sele === void 0 ? void 0 : _selectionColors$sele.color) || ((_theme$palette2 = theme.palette) === null || _theme$palette2 === void 0 ? void 0 : _theme$palette2.selected.main) || '#009845';
27388
+ const alternative = ((_selectionColors$alte = selectionColors.alternative) === null || _selectionColors$alte === void 0 ? void 0 : _selectionColors$alte.color) || ((_theme$palette3 = theme.palette) === null || _theme$palette3 === void 0 ? void 0 : _theme$palette3.selected.alternative) || '#E4E4E4';
27389
+ const excluded = ((_selectionColors$excl = selectionColors.excluded) === null || _selectionColors$excl === void 0 ? void 0 : _selectionColors$excl.color) || ((_theme$palette4 = theme.palette) === null || _theme$palette4 === void 0 ? void 0 : _theme$palette4.selected.excluded) || '#A9A9A9';
27390
+ const selectedExcluded = ((_selectionColors$sele2 = selectionColors.selectedExcluded) === null || _selectionColors$sele2 === void 0 ? void 0 : _selectionColors$sele2.color) || ((_theme$palette5 = theme.palette) === null || _theme$palette5 === void 0 ? void 0 : _theme$palette5.selected.selectedExcluded) || '#A9A9A9';
27391
+ const possible = ((_selectionColors$poss = selectionColors.possible) === null || _selectionColors$poss === void 0 ? void 0 : _selectionColors$poss.color) || getListboxStyle('', 'backgroundColor') || ((_theme$palette6 = theme.palette) === null || _theme$palette6 === void 0 ? void 0 : _theme$palette6.selected.possible) || '#FFFFFF';
27392
+
27393
+ // Font colors
27394
+ let selectedContrast = desiredTextColor || ((_theme$palette7 = theme.palette) === null || _theme$palette7 === void 0 ? void 0 : _theme$palette7.selected.main);
27395
+ let alternativeContrast = desiredTextColor || ((_theme$palette8 = theme.palette) === null || _theme$palette8 === void 0 ? void 0 : _theme$palette8.selected.alternativeContrastText);
27396
+ let excludedContrast = desiredTextColor || ((_theme$palette9 = theme.palette) === null || _theme$palette9 === void 0 ? void 0 : _theme$palette9.selected.excludedContrastText);
27397
+ let selectedExcludedContrast = desiredTextColor || ((_theme$palette10 = theme.palette) === null || _theme$palette10 === void 0 ? void 0 : _theme$palette10.selected.selectedExcludedContrastText);
27398
+ let possibleContrast = desiredTextColor || ((_theme$palette11 = theme.palette) === null || _theme$palette11 === void 0 ? void 0 : _theme$palette11.selected.possibleContrastText);
27399
+ if (useContrastTextColor) {
27400
+ // Override preferred text color if it does not contrast enough with the background color.
27401
+ selectedContrast = getContrastingColor(selected, desiredTextColor);
27402
+ alternativeContrast = getContrastingColor(alternative, desiredTextColor);
27403
+ excludedContrast = getContrastingColor(excluded, desiredTextColor);
27404
+ selectedExcludedContrast = getContrastingColor(selectedExcluded, desiredTextColor);
27405
+ possibleContrast = getContrastingColor(possible, desiredTextColor);
27406
+ }
27407
+ return {
27408
+ selected,
27409
+ alternative,
27410
+ excluded,
27411
+ selectedExcluded,
27412
+ possible,
27413
+ selectedContrast,
27414
+ alternativeContrast,
27415
+ excludedContrast,
27416
+ selectedExcludedContrast,
27417
+ possibleContrast
27418
+ };
27419
+ }
27420
+ function getStyles(_ref) {
27421
+ var _themeOverrides$heade, _themeOverrides$heade2, _themeOverrides$conte;
27422
+ let {
27423
+ themeApi,
27424
+ theme,
27425
+ components = [],
27426
+ checkboxes = false
27427
+ } = _ref;
27428
+ const overrides = getOverridesAsObject(components);
27429
+ const getListboxStyle = (path, prop) => themeApi.getStyle('object.listBox', path, prop);
27430
+ const selections = getSelectionColors(theme, getListboxStyle, overrides);
27431
+ const themeOverrides = overrides.theme || {};
27432
+ return {
27433
+ backgroundColor: getListboxStyle('', 'backgroundColor') || theme.palette.background.default,
27434
+ header: {
27435
+ color: ((_themeOverrides$heade = themeOverrides.header) === null || _themeOverrides$heade === void 0 || (_themeOverrides$heade = _themeOverrides$heade.fontColor) === null || _themeOverrides$heade === void 0 ? void 0 : _themeOverrides$heade.color) || getListboxStyle('title.main', 'color'),
27436
+ fontSize: ((_themeOverrides$heade2 = themeOverrides.header) === null || _themeOverrides$heade2 === void 0 ? void 0 : _themeOverrides$heade2.fontSize) || getListboxStyle('title.main', 'fontSize'),
27437
+ fontFamily: getListboxStyle('title.main', 'fontFamily'),
27438
+ fontWeight: getListboxStyle('title.main', 'fontWeight') || 'bold'
27439
+ },
27440
+ content: {
27441
+ backgroundColor: checkboxes ? undefined : selections.possible,
27442
+ color: selections.possibleContrast || getListboxStyle('content', 'color'),
27443
+ fontSize: ((_themeOverrides$conte = themeOverrides.content) === null || _themeOverrides$conte === void 0 ? void 0 : _themeOverrides$conte.fontSize) || getListboxStyle('content', 'fontSize'),
27444
+ fontFamily: getListboxStyle('content', 'fontFamily')
27445
+ },
27446
+ selections
27447
+ };
27448
+ }
27449
+
27239
27450
  function ListBoxPopover(_ref) {
27240
27451
  let {
27241
27452
  alignTo,
@@ -27252,7 +27463,9 @@
27252
27463
  app,
27253
27464
  fieldName,
27254
27465
  stateName = '$',
27255
- autoFocus
27466
+ autoFocus,
27467
+ components,
27468
+ checkboxes: checkboxesOption
27256
27469
  } = _ref;
27257
27470
  const isMasterDim = Boolean(fieldName === null || fieldName === void 0 ? void 0 : fieldName.qLibraryId);
27258
27471
  const open = show && Boolean(alignTo.current);
@@ -27291,13 +27504,23 @@
27291
27504
  model.unlock('/qListObjectDef');
27292
27505
  }, [model]);
27293
27506
  const {
27294
- translator
27507
+ translator,
27508
+ themeApi
27295
27509
  } = reactExports.useContext(InstanceContext);
27296
27510
  const moreAlignTo = reactExports.useRef();
27297
27511
  const containerRef = reactExports.useRef();
27298
27512
  const [selections] = useObjectSelections(app, model, containerRef);
27299
27513
  const [layout] = useLayout$1(model);
27300
27514
  const [selectionState$1] = reactExports.useState(() => selectionState());
27515
+ const {
27516
+ checkboxes = checkboxesOption
27517
+ } = layout || {};
27518
+ const styles = getStyles({
27519
+ themeApi,
27520
+ theme,
27521
+ components,
27522
+ checkboxes
27523
+ });
27301
27524
  reactExports.useEffect(() => {
27302
27525
  if (selections && open) {
27303
27526
  if (!selections.isModal(model)) {
@@ -27394,6 +27617,7 @@
27394
27617
  item: true,
27395
27618
  ref: searchContainerRef
27396
27619
  }, /*#__PURE__*/React.createElement(ListBoxSearch, {
27620
+ styles: styles,
27397
27621
  visible: true,
27398
27622
  model: model,
27399
27623
  listCount: listCount,
@@ -27412,7 +27636,7 @@
27412
27636
  direction: "ltr",
27413
27637
  onSetListCount: c => setListCount(c),
27414
27638
  onCtrlF: onCtrlF,
27415
- theme: theme
27639
+ styles: styles
27416
27640
  }))));
27417
27641
  }
27418
27642
 
@@ -27696,7 +27920,7 @@
27696
27920
  variant: "contained",
27697
27921
  fullWidth: true
27698
27922
  }, clearAllStates)), field.states.map((s, ix) =>
27699
- /*#__PURE__*/
27923
+
27700
27924
  // eslint-disable-next-line react/no-array-index-key
27701
27925
  React.createElement(ListItem$1, {
27702
27926
  key: ix,
@@ -27874,7 +28098,7 @@
27874
28098
  }, /*#__PURE__*/React.createElement(List$1, {
27875
28099
  dense: true
27876
28100
  }, items.map((s, ix) =>
27877
- /*#__PURE__*/
28101
+
27878
28102
  // eslint-disable-next-line react/no-array-index-key
27879
28103
  React.createElement(ListItem$1, {
27880
28104
  key: ix,
@@ -28791,26 +29015,6 @@
28791
29015
  };
28792
29016
  }
28793
29017
 
28794
- const addListboxTheme = themeApi => {
28795
- const getListboxStyle = (path, prop) => themeApi.getStyle('object.listBox', path, prop);
28796
- return {
28797
- backgroundColor: getListboxStyle('', 'backgroundColor'),
28798
- title: {
28799
- main: {
28800
- color: getListboxStyle('title.main', 'color'),
28801
- fontSize: getListboxStyle('title.main', 'fontSize'),
28802
- fontFamily: getListboxStyle('title.main', 'fontFamily'),
28803
- fontWeight: getListboxStyle('title.main', 'fontWeight')
28804
- }
28805
- },
28806
- content: {
28807
- color: getListboxStyle('content', 'color'),
28808
- fontSize: getListboxStyle('content', 'fontSize'),
28809
- fontFamily: getListboxStyle('content', 'fontFamily')
28810
- }
28811
- };
28812
- };
28813
-
28814
29018
  function showToolbarDetached(_ref) {
28815
29019
  var _titleRef$current$cli, _titleRef$current, _titleRef$current2, _titleRef$current3;
28816
29020
  let {
@@ -28903,16 +29107,16 @@
28903
29107
  listboxWrapper: "".concat(PREFIX$4, "-listboxWrapper")
28904
29108
  };
28905
29109
  const StyledGrid$3 = styled$1(Grid$1, {
28906
- shouldForwardProp: p => !['containerPadding', 'isGridMode'].includes(p)
29110
+ shouldForwardProp: p => !['containerPadding', 'isGridMode', 'styles'].includes(p)
28907
29111
  })(_ref => {
28908
- var _theme$listBox$backgr, _theme$listBox;
28909
29112
  let {
28910
29113
  theme,
28911
29114
  containerPadding,
28912
- isGridMode
29115
+ isGridMode,
29116
+ styles
28913
29117
  } = _ref;
28914
29118
  return {
28915
- backgroundColor: (_theme$listBox$backgr = (_theme$listBox = theme.listBox) === null || _theme$listBox === void 0 ? void 0 : _theme$listBox.backgroundColor) !== null && _theme$listBox$backgr !== void 0 ? _theme$listBox$backgr : theme.palette.background.default,
29119
+ background: styles.backgroundColor,
28916
29120
  ["& .".concat(classes$4.listBoxHeader)]: {
28917
29121
  alignSelf: 'center',
28918
29122
  display: 'flex'
@@ -28938,15 +29142,14 @@
28938
29142
  };
28939
29143
  });
28940
29144
  const Title = styled$1(Typography$1)(_ref2 => {
28941
- var _theme$listBox2, _theme$listBox3, _theme$listBox4, _theme$listBox5;
28942
29145
  let {
28943
- theme
29146
+ styles
28944
29147
  } = _ref2;
28945
29148
  return {
28946
- color: (_theme$listBox2 = theme.listBox) === null || _theme$listBox2 === void 0 || (_theme$listBox2 = _theme$listBox2.title) === null || _theme$listBox2 === void 0 || (_theme$listBox2 = _theme$listBox2.main) === null || _theme$listBox2 === void 0 ? void 0 : _theme$listBox2.color,
28947
- fontSize: (_theme$listBox3 = theme.listBox) === null || _theme$listBox3 === void 0 || (_theme$listBox3 = _theme$listBox3.title) === null || _theme$listBox3 === void 0 || (_theme$listBox3 = _theme$listBox3.main) === null || _theme$listBox3 === void 0 ? void 0 : _theme$listBox3.fontSize,
28948
- fontFamily: (_theme$listBox4 = theme.listBox) === null || _theme$listBox4 === void 0 || (_theme$listBox4 = _theme$listBox4.title) === null || _theme$listBox4 === void 0 || (_theme$listBox4 = _theme$listBox4.main) === null || _theme$listBox4 === void 0 ? void 0 : _theme$listBox4.fontFamily,
28949
- fontWeight: ((_theme$listBox5 = theme.listBox) === null || _theme$listBox5 === void 0 || (_theme$listBox5 = _theme$listBox5.title) === null || _theme$listBox5 === void 0 || (_theme$listBox5 = _theme$listBox5.main) === null || _theme$listBox5 === void 0 ? void 0 : _theme$listBox5.fontWeight) || 'bold'
29149
+ color: styles.header.color,
29150
+ fontSize: styles.header.fontSize,
29151
+ fontFamily: styles.header.fontFamily,
29152
+ fontWeight: styles.header.fontWeight
28950
29153
  };
28951
29154
  });
28952
29155
  const isModal = _ref3 => {
@@ -28967,7 +29170,7 @@
28967
29170
  app,
28968
29171
  direction,
28969
29172
  frequencyMode,
28970
- checkboxes,
29173
+ checkboxes: checkboxesOption,
28971
29174
  search = true,
28972
29175
  focusSearch = false,
28973
29176
  rangeSelect = true,
@@ -28982,7 +29185,8 @@
28982
29185
  scrollState = undefined,
28983
29186
  renderedCallback,
28984
29187
  toolbar = true,
28985
- isPopover = false
29188
+ isPopover = false,
29189
+ components
28986
29190
  } = options;
28987
29191
 
28988
29192
  // Hook that will trigger update when used in useEffects.
@@ -29006,7 +29210,15 @@
29006
29210
  themeApi,
29007
29211
  constraints
29008
29212
  } = reactExports.useContext(InstanceContext);
29009
- theme.listBox = addListboxTheme(themeApi);
29213
+ const {
29214
+ checkboxes = checkboxesOption
29215
+ } = layout || {};
29216
+ const styles = getStyles({
29217
+ themeApi,
29218
+ theme,
29219
+ components,
29220
+ checkboxes
29221
+ });
29010
29222
  const isDirectQuery = isDirectQueryEnabled({
29011
29223
  appLayout: app === null || app === void 0 ? void 0 : app.layout
29012
29224
  });
@@ -29227,6 +29439,7 @@
29227
29439
  direction: "column",
29228
29440
  gap: 0,
29229
29441
  containerPadding: containerPadding,
29442
+ styles: styles,
29230
29443
  style: {
29231
29444
  height: '100%',
29232
29445
  flexFlow: 'column nowrap'
@@ -29272,7 +29485,8 @@
29272
29485
  variant: "h6",
29273
29486
  noWrap: true,
29274
29487
  ref: titleRef,
29275
- title: layout.title
29488
+ title: layout.title,
29489
+ styles: styles
29276
29490
  }, layout.title)), /*#__PURE__*/React.createElement(Grid$1, {
29277
29491
  item: true
29278
29492
  }, /*#__PURE__*/React.createElement(ActionsToolbar, _extends$7({
@@ -29302,7 +29516,8 @@
29302
29516
  wildCardSearch: wildCardSearch,
29303
29517
  searchEnabled: searchEnabled,
29304
29518
  direction: direction,
29305
- hide: showSearchIcon && onShowSearch
29519
+ hide: showSearchIcon && onShowSearch,
29520
+ styles: styles
29306
29521
  })), /*#__PURE__*/React.createElement(Grid$1, {
29307
29522
  item: true,
29308
29523
  xs: true,
@@ -29317,7 +29532,6 @@
29317
29532
  return /*#__PURE__*/React.createElement(ListBox, {
29318
29533
  model: model,
29319
29534
  app: app,
29320
- theme: theme,
29321
29535
  constraints: constraints,
29322
29536
  layout: layout,
29323
29537
  selections: selections,
@@ -29350,7 +29564,8 @@
29350
29564
  },
29351
29565
  renderedCallback: renderedCallback,
29352
29566
  onCtrlF: onCtrlF,
29353
- isModal: isModalMode
29567
+ isModal: isModalMode,
29568
+ styles: styles
29354
29569
  });
29355
29570
  })))));
29356
29571
  }
@@ -29907,7 +30122,8 @@
29907
30122
  close: handleCloseShowState,
29908
30123
  fieldName: fieldIdentifier,
29909
30124
  stateName: stateName,
29910
- autoFocus: options.autoFocus
30125
+ autoFocus: options.autoFocus,
30126
+ components: options.components
29911
30127
  });
29912
30128
  }
29913
30129
 
@@ -37812,6 +38028,37 @@
37812
38028
  }
37813
38029
  };
37814
38030
 
38031
+ /**
38032
+ * @interface Component
38033
+ * @property {string} key The key of the component. Currently supporting components "theme" and "selections".
38034
+ * @example
38035
+ * const n = embed(app);
38036
+ * const inst = await n.field('field_name');
38037
+ * inst.mount(document.querySelector('.listbox'), {
38038
+ * components: [{
38039
+ * key: 'theme',
38040
+ * header: {
38041
+ * fontColor: { color: '#f00' },
38042
+ * fontSize: 23,
38043
+ * },
38044
+ * content: {
38045
+ * fontSize: 16,
38046
+ * useContrastColor: false,
38047
+ * }
38048
+ * },{
38049
+ * key: 'selections',
38050
+ * colors: {
38051
+ * selected: { color: '#0f0' },
38052
+ * alternative: { color: '#ededed' },
38053
+ * excluded: { color: '#ccc' },
38054
+ * selectedExcluded: { color: '#bbb' },
38055
+ * possible: { color: '#fefefe' },
38056
+ * possible: { color: '#fefefe' },
38057
+ * }
38058
+ * }]
38059
+ * });
38060
+ */
38061
+
37815
38062
  /**
37816
38063
  * @interface Configuration
37817
38064
  * @property {LoadType=} load Fallback load function for missing types
@@ -38234,6 +38481,7 @@
38234
38481
  * @param {boolean=} [options.checkboxes=false] Show values as checkboxes instead of as fields (not applicable for existing objects)
38235
38482
  * @param {boolean=} [options.dense=false] Reduces padding and text size (not applicable for existing objects)
38236
38483
  * @param {string=} [options.stateName="$"] Sets the state to make selections in (not applicable for existing objects)
38484
+ * @param {Component[]} [options.components] Override individual components' styling, otherwise set by the theme or the default style.
38237
38485
  * @param {object=} [options.properties={}] Properties object to extend default properties with
38238
38486
  * @returns {Promise<void>} A promise that resolves when the data is fetched.
38239
38487
  *