@ni/nimble-components 11.12.0 → 11.13.1

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.
@@ -14419,6 +14419,22 @@
14419
14419
  return {red, green, blue, alpha};
14420
14420
  }
14421
14421
 
14422
+ /**
14423
+ * Convert a hexadecimal color string to an RGBA CSS color string
14424
+ * Example: 'ff0102' or '#ff0102' to 'rgba(255, 1, 2, 1)'
14425
+ * @param hexValue Hex color (with or without a starting '#')
14426
+ * @param alpha CSS alpha value between 0 (transparent) and 1 (opaque)
14427
+ * @returns An rgba()-formatted CSS color string
14428
+ */
14429
+ function hexToRgbaCssColor(hexValue, alpha) {
14430
+ const { red, green, blue } = hexRgb(hexValue);
14431
+ return `rgba(${red}, ${green}, ${blue}, ${alpha})`;
14432
+ }
14433
+
14434
+ const modalBackdropColorThemeLight = hexToRgbaCssColor(Black, 0.3);
14435
+ const modalBackdropColorThemeDark = hexToRgbaCssColor(Black, 0.6);
14436
+ const modalBackdropColorThemeColor = hexToRgbaCssColor(Black, 0.6);
14437
+
14422
14438
  const Theme = {
14423
14439
  light: 'light',
14424
14440
  dark: 'dark',
@@ -14448,6 +14464,7 @@
14448
14464
  informationColor: 'information-color',
14449
14465
  borderHoverColor: 'border-hover-color',
14450
14466
  iconColor: 'icon-color',
14467
+ modalBackdropColor: 'modal-backdrop-color',
14451
14468
  popupBoxShadowColor: 'popup-box-shadow-color',
14452
14469
  popupBorderColor: 'popup-border-color',
14453
14470
  controlHeight: 'control-height',
@@ -14681,18 +14698,6 @@
14681
14698
  .withPrefix('nimble')
14682
14699
  .register(nimbleDesignSystemProvider());
14683
14700
 
14684
- /**
14685
- * Convert a hexadecimal color string to an RGBA CSS color string
14686
- * Example: 'ff0102' or '#ff0102' to 'rgba(255, 1, 2, 1)'
14687
- * @param hexValue Hex color (with or without a starting '#')
14688
- * @param alpha CSS alpha value between 0 (transparent) and 1 (opaque)
14689
- * @returns An rgba()-formatted CSS color string
14690
- */
14691
- function hexToRgbaCssColor(hexValue, alpha) {
14692
- const { red, green, blue } = hexRgb(hexValue);
14693
- return `rgba(${red}, ${green}, ${blue}, ${alpha})`;
14694
- }
14695
-
14696
14701
  // Color Tokens
14697
14702
  const actionRgbPartialColor = DesignToken.create(styleNameFromTokenName(tokenNames.actionRgbPartialColor)).withDefault((element) => hexToRgbPartial(getColorForTheme(element, Black91, Black15, White)));
14698
14703
  const applicationBackgroundColor = DesignToken.create(styleNameFromTokenName(tokenNames.applicationBackgroundColor)).withDefault((element) => getColorForTheme(element, White, Black85, ForestGreen));
@@ -14713,6 +14718,7 @@
14713
14718
  const borderHoverColor = DesignToken.create(styleNameFromTokenName(tokenNames.borderHoverColor)).withDefault((element) => getColorForTheme(element, DigitalGreenLight, DigitalGreenLight, White));
14714
14719
  // Component Color Tokens
14715
14720
  const iconColor = DesignToken.create(styleNameFromTokenName(tokenNames.iconColor)).withDefault((element) => getColorForTheme(element, Black91, Black15, White));
14721
+ const modalBackdropColor = DesignToken.create(styleNameFromTokenName(tokenNames.modalBackdropColor)).withDefault((element) => getModalBackdropForTheme(element));
14716
14722
  const popupBoxShadowColor = DesignToken.create(styleNameFromTokenName(tokenNames.popupBoxShadowColor)).withDefault((element) => hexToRgbaCssColor(getColorForTheme(element, Black75, Black85, Black85), 0.3));
14717
14723
  const popupBorderColor = DesignToken.create(styleNameFromTokenName(tokenNames.popupBorderColor)).withDefault((element) => hexToRgbaCssColor(getColorForTheme(element, Black91, Black15, White), 0.3));
14718
14724
  DesignToken.create(styleNameFromTokenName(tokenNames.tooltipBackgroundColor)).withDefault((element) => getColorForTheme(element, Black15, Black85, ForestGreen));
@@ -14824,6 +14830,18 @@
14824
14830
  function getFillDownColorForTheme(element) {
14825
14831
  return getColorForTheme(element, Black91, Black15, White);
14826
14832
  }
14833
+ function getModalBackdropForTheme(element) {
14834
+ switch (theme.getValueFor(element)) {
14835
+ case Theme.light:
14836
+ return modalBackdropColorThemeLight;
14837
+ case Theme.dark:
14838
+ return modalBackdropColorThemeDark;
14839
+ case Theme.color:
14840
+ return modalBackdropColorThemeColor;
14841
+ default:
14842
+ return modalBackdropColorThemeLight;
14843
+ }
14844
+ }
14827
14845
 
14828
14846
  /**
14829
14847
  * Subscription for {@link ThemeStyleSheetBehavior}
@@ -16069,6 +16087,13 @@
16069
16087
  outline: none;
16070
16088
  border: none;
16071
16089
  box-sizing: border-box;
16090
+ transition: box-shadow ${smallDelay};
16091
+ }
16092
+
16093
+ @media (prefers-reduced-motion) {
16094
+ :host {
16095
+ transition-duration: 0s;
16096
+ }
16072
16097
  }
16073
16098
 
16074
16099
  :host(:hover) {
@@ -16095,7 +16120,6 @@
16095
16120
  cursor: inherit;
16096
16121
  font: inherit;
16097
16122
  outline: none;
16098
- transition: box-shadow ${smallDelay};
16099
16123
  padding: 0px;
16100
16124
  }
16101
16125
 
@@ -16159,12 +16183,6 @@
16159
16183
  slot[name='end'] {
16160
16184
  display: none;
16161
16185
  }
16162
-
16163
- @media (prefers-reduced-motion) {
16164
- .control {
16165
- transition-duration: 0s;
16166
- }
16167
- }
16168
16186
  `.withBehaviors(themeBehavior(Theme.light, css `
16169
16187
  :host {
16170
16188
  --ni-private-card-button-background-hover-color: ${hexToRgbaCssColor(White, 0.3)};
@@ -16998,7 +17016,24 @@
16998
17016
  box-shadow: 0px 2px 3px ${popupBoxShadowColor};
16999
17017
  max-width: 50%;
17000
17018
  }
17001
- `;
17019
+ `.withBehaviors(
17020
+ /*
17021
+ * We cannot use the modalBackdropColor token directly because the backdrop
17022
+ * element is not a descendant of the nimble-theme-provider element.
17023
+ */
17024
+ themeBehavior(Theme.light, css `
17025
+ dialog::backdrop {
17026
+ background: ${modalBackdropColorThemeLight};
17027
+ }
17028
+ `), themeBehavior(Theme.dark, css `
17029
+ dialog::backdrop {
17030
+ background: ${modalBackdropColorThemeDark};
17031
+ }
17032
+ `), themeBehavior(Theme.color, css `
17033
+ dialog::backdrop {
17034
+ background: ${modalBackdropColorThemeColor};
17035
+ }
17036
+ `));
17002
17037
 
17003
17038
  const template$5 = html `
17004
17039
  <template>
@@ -18228,7 +18263,7 @@
18228
18263
  .overlay {
18229
18264
  position: fixed;
18230
18265
  inset: 0px;
18231
- background: ${popupBorderColor};
18266
+ background: ${modalBackdropColor};
18232
18267
  touch-action: none;
18233
18268
  }
18234
18269
 
@@ -21060,7 +21095,6 @@
21060
21095
 
21061
21096
  :host([aria-checked='true']) .checked-indicator-spacer {
21062
21097
  flex-grow: 1;
21063
- transition: flex-grow ${smallDelay} ease-in-out;
21064
21098
  }
21065
21099
 
21066
21100
  .checked-indicator {
@@ -21115,7 +21149,6 @@
21115
21149
 
21116
21150
  :host([aria-checked='true']) .checked-indicator-inner {
21117
21151
  opacity: 1;
21118
- transition: opacity ${smallDelay} ease-in-out;
21119
21152
  }
21120
21153
 
21121
21154
  slot[name='checked-message']::slotted(*) {