@decidables/prospectable-elements 0.5.2 → 0.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.
@@ -10516,18 +10516,6 @@ class DecidablesElement extends i$2 {
10516
10516
  getComputedStyleValue(property) {
10517
10517
  return getComputedStyle(this).getPropertyValue(property).trim();
10518
10518
  }
10519
- firstUpdated(changedProperties) {
10520
- super.firstUpdated(changedProperties);
10521
-
10522
- // Use focus highlighting if keyboard is used at all
10523
- select(this.renderRoot.host).classed('keyboard', true).on('mousemove.keyboard touchstart.keyboard', event => {
10524
- const element = event.currentTarget;
10525
- select(element.renderRoot.host).classed('keyboard', false).on('mousemove.keyboard touchstart.keyboard', null);
10526
- }).on('keydown.keyboard', event => {
10527
- const element = event.currentTarget;
10528
- select(element.renderRoot.host).classed('keyboard', true).on('keydown.keyboard mousemove.keyboard touchstart.keyboard', null);
10529
- });
10530
- }
10531
10519
  static get greys() {
10532
10520
  const grey = '#999999';
10533
10521
  const greys = {};
@@ -10663,7 +10651,7 @@ class DecidablesElement extends i$2 {
10663
10651
  };
10664
10652
  /* eslint-enable key-spacing, object-curly-newline */
10665
10653
  }
10666
- static cssBoxShadow(elevation, rotate = false, inverse = false) {
10654
+ static cssBoxShadow(elevation, inverse = false) {
10667
10655
  const umbraO = this.shadows.opacityUmbra + this.shadows.opacityBoost;
10668
10656
  const penumbraO = this.shadows.opacityPenumbra + this.shadows.opacityBoost;
10669
10657
  const ambientO = this.shadows.opacityAmbient + this.shadows.opacityBoost;
@@ -10673,9 +10661,9 @@ class DecidablesElement extends i$2 {
10673
10661
  const umbraM = this.shadows.mapUmbra[elevation];
10674
10662
  const penumbraM = this.shadows.mapPenumbra[elevation];
10675
10663
  const ambientM = this.shadows.mapAmbient[elevation];
10676
- const umbraS = rotate ? `${-umbraM.y}px ${umbraM.y / 2}px ${umbraM.b}px ${umbraM.s}px` : `${umbraM.y / 2}px ${umbraM.y}px ${umbraM.b}px ${umbraM.s}px`;
10677
- const penumbraS = rotate ? `${-penumbraM.y}px ${penumbraM.y / 2}px ${penumbraM.b}px ${penumbraM.s}px` : `${penumbraM.y / 2}px ${penumbraM.y}px ${penumbraM.b}px ${penumbraM.s}px`;
10678
- const ambientS = rotate ? `${-ambientM.y}px ${ambientM.y / 2}px ${ambientM.b}px ${ambientM.s}px` : `${ambientM.y / 2}px ${ambientM.y}px ${ambientM.b}px ${ambientM.s}px`;
10664
+ const umbraS = `${umbraM.y / 2}px ${umbraM.y}px ${umbraM.b}px ${umbraM.s}px`;
10665
+ const penumbraS = `${penumbraM.y / 2}px ${penumbraM.y}px ${penumbraM.b}px ${penumbraM.s}px`;
10666
+ const ambientS = `${ambientM.y / 2}px ${ambientM.y}px ${ambientM.b}px ${ambientM.s}px`;
10679
10667
  return `${umbraS} ${umbraC}, ${penumbraS} ${penumbraC}, ${ambientS} ${ambientC}`;
10680
10668
  }
10681
10669
  static get svgFilters() {
@@ -10811,49 +10799,58 @@ class DecidablesButton extends DecidablesElement {
10811
10799
  button {
10812
10800
  width: 100%;
10813
10801
  height: 100%;
10802
+
10814
10803
  padding: 0.375rem 0.75rem;
10815
10804
 
10816
10805
  font-family: var(---font-family-base);
10817
10806
  font-size: 1.125rem;
10807
+
10818
10808
  line-height: 1.5;
10809
+
10819
10810
  color: var(---color-text-inverse);
10820
10811
 
10812
+ outline: none;
10813
+
10821
10814
  border: 0;
10822
10815
  border-radius: var(---border-radius);
10823
- outline: none;
10824
10816
  }
10825
10817
 
10826
10818
  button:disabled {
10827
- background-color: var(---decidables-button-background-color-disabled);
10828
10819
  outline: none;
10820
+
10821
+ background-color: var(---decidables-button-background-color-disabled);
10829
10822
  box-shadow: none;
10830
10823
  }
10831
10824
 
10832
10825
  button:enabled {
10833
10826
  cursor: pointer;
10827
+ outline: none;
10834
10828
 
10835
10829
  background-color: var(---decidables-button-background-color-enabled);
10836
- outline: none;
10837
10830
  box-shadow: var(---shadow-2);
10838
10831
  }
10839
10832
 
10840
10833
  button:enabled:hover {
10841
10834
  outline: none;
10835
+
10842
10836
  box-shadow: var(---shadow-4);
10843
10837
  }
10844
10838
 
10845
10839
  button:enabled:active {
10846
10840
  outline: none;
10841
+
10847
10842
  box-shadow: var(---shadow-8);
10848
10843
  }
10849
10844
 
10850
- :host(.keyboard) button:enabled:focus {
10845
+ button:enabled:focus-visible {
10851
10846
  outline: none;
10847
+
10852
10848
  box-shadow: var(---shadow-4);
10853
10849
  }
10854
10850
 
10855
- :host(.keyboard) button:enabled:focus:active {
10851
+ button:enabled:focus-visible:active {
10856
10852
  outline: none;
10853
+
10857
10854
  box-shadow: var(---shadow-8);
10858
10855
  }
10859
10856
  `];
@@ -10970,10 +10967,6 @@ class DecidablesSlider extends DecidablesElement {
10970
10967
  ---decidables-slider-color: var(--decidables-slider-color, var(---color-element-enabled));
10971
10968
  ---decidables-spinner-background-color: var(--decidables-slider-background-color, none);
10972
10969
 
10973
- ---shadow-2-rotate: var(--shadow-2-rotate, ${r$4(this.cssBoxShadow(2, true, false))});
10974
- ---shadow-4-rotate: var(--shadow-4-rotate, ${r$4(this.cssBoxShadow(4, true, false))});
10975
- ---shadow-8-rotate: var(--shadow-8-rotate, ${r$4(this.cssBoxShadow(8, true, false))});
10976
-
10977
10970
  display: flex;
10978
10971
 
10979
10972
  flex-direction: column;
@@ -10988,12 +10981,14 @@ class DecidablesSlider extends DecidablesElement {
10988
10981
 
10989
10982
  .range {
10990
10983
  position: relative;
10984
+
10991
10985
  display: flex;
10992
10986
 
10993
10987
  flex-direction: row;
10994
10988
 
10995
10989
  width: 3.5rem;
10996
10990
  height: 4.75rem;
10991
+
10997
10992
  margin: 0 0.25rem 0.25rem;
10998
10993
  }
10999
10994
 
@@ -11005,21 +11000,20 @@ class DecidablesSlider extends DecidablesElement {
11005
11000
  background: var(---decidables-spinner-background-color);
11006
11001
  }
11007
11002
 
11008
- /* Adapted from http://danielstern.ca/range.css/#/ */
11009
11003
  /* Overall */
11010
11004
  input[type=range] {
11011
- width: 4.75rem;
11012
- height: 3.5rem;
11005
+ width: 3.5rem;
11006
+ height: 4.75rem;
11007
+
11013
11008
  padding: 0;
11014
11009
  margin: 0;
11010
+
11011
+ appearance: none;
11015
11012
 
11016
11013
  background-color: unset;
11017
11014
 
11018
- transform: rotate(-90deg);
11019
- transform-origin: 2.375rem 2.375rem;
11020
-
11021
- /* stylelint-disable-next-line property-no-vendor-prefix */
11022
- -webkit-appearance: none;
11015
+ direction: rtl;
11016
+ writing-mode: vertical-lr;
11023
11017
  }
11024
11018
 
11025
11019
  input[type=range]:enabled {
@@ -11030,16 +11024,10 @@ class DecidablesSlider extends DecidablesElement {
11030
11024
  outline: none;
11031
11025
  }
11032
11026
 
11033
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
11034
- input[type=range]::-ms-tooltip {
11035
- display: none;
11036
- }
11037
-
11038
11027
  /* Track */
11039
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
11040
11028
  input[type=range]::-webkit-slider-runnable-track {
11041
- width: 100%;
11042
- height: 4px;
11029
+ width: 4px;
11030
+ height: 100%;
11043
11031
 
11044
11032
  background: var(---decidables-slider-background-color);
11045
11033
  border: 0;
@@ -11051,10 +11039,9 @@ class DecidablesSlider extends DecidablesElement {
11051
11039
  background: var(---decidables-slider-background-color);
11052
11040
  }
11053
11041
 
11054
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
11055
11042
  input[type=range]::-moz-range-track {
11056
- width: 100%;
11057
- height: 4px;
11043
+ width: 4px;
11044
+ height: 100%;
11058
11045
 
11059
11046
  background: var(---decidables-slider-background-color);
11060
11047
  border: 0;
@@ -11062,57 +11049,17 @@ class DecidablesSlider extends DecidablesElement {
11062
11049
  box-shadow: none;
11063
11050
  }
11064
11051
 
11065
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
11066
- input[type=range]::-ms-track {
11067
- width: 100%;
11068
- height: 4px;
11069
-
11070
- color: transparent;
11071
-
11072
- background: transparent;
11073
- border-color: transparent;
11074
- }
11075
-
11076
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
11077
- input[type=range]::-ms-fill-lower {
11078
- background: #cccccc;
11079
- /* background: var(---decidables-slider-background-color); */
11080
- border: 0;
11081
- border-radius: 2px;
11082
- box-shadow: none;
11083
- }
11084
-
11085
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
11086
- input[type=range]::-ms-fill-upper {
11087
- background: #cccccc;
11088
- /* background: var(---decidables-slider-background-color); */
11089
- border: 0;
11090
- border-radius: 2px;
11091
- box-shadow: none;
11092
- }
11093
-
11094
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
11095
- input[type=range]:focus::-ms-fill-lower {
11096
- background: var(---decidables-slider-background-color);
11097
- }
11098
-
11099
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
11100
- input[type=range]:focus::-ms-fill-upper {
11101
- background: var(---decidables-slider-background-color);
11102
- }
11103
-
11104
11052
  /* Thumb */
11105
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
11106
11053
  input[type=range]::-webkit-slider-thumb {
11107
- width: 10px;
11108
- height: 20px;
11109
- margin-top: -8px;
11054
+ width: 20px;
11055
+ height: 10px;
11056
+
11057
+ margin-left: -8px;
11058
+
11059
+ appearance: none;
11110
11060
 
11111
11061
  border: 0;
11112
11062
  border-radius: 4px;
11113
-
11114
- /* stylelint-disable-next-line property-no-vendor-prefix */
11115
- -webkit-appearance: none;
11116
11063
  }
11117
11064
 
11118
11065
  input[type=range]:disabled::-webkit-slider-thumb {
@@ -11122,112 +11069,65 @@ class DecidablesSlider extends DecidablesElement {
11122
11069
 
11123
11070
  input[type=range]:enabled::-webkit-slider-thumb {
11124
11071
  background: var(---decidables-slider-color);
11125
- box-shadow: var(---shadow-2-rotate);
11072
+ box-shadow: var(---shadow-2);
11126
11073
  }
11127
11074
 
11128
11075
  input[type=range]:enabled:hover::-webkit-slider-thumb {
11129
- box-shadow: var(---shadow-4-rotate);
11076
+ box-shadow: var(---shadow-4);
11130
11077
  }
11131
11078
 
11132
11079
  input[type=range]:enabled:active::-webkit-slider-thumb {
11133
- box-shadow: var(---shadow-8-rotate);
11080
+ box-shadow: var(---shadow-8);
11134
11081
  }
11135
11082
 
11136
- :host(.keyboard) input[type=range]:enabled:focus::-webkit-slider-thumb {
11137
- box-shadow: var(---shadow-4-rotate);
11083
+ input[type=range]:enabled:focus-visible::-webkit-slider-thumb {
11084
+ box-shadow: var(---shadow-4);
11138
11085
  }
11139
11086
 
11140
- :host(.keyboard) input[type=range]:focus:active::-webkit-slider-thumb {
11141
- box-shadow: var(---shadow-8-rotate);
11087
+ input[type=range]:enabled:focus-visible:active::-webkit-slider-thumb {
11088
+ box-shadow: var(---shadow-8);
11142
11089
  }
11143
11090
 
11144
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
11145
11091
  input[type=range]::-moz-range-thumb {
11146
- width: 10px;
11147
- height: 20px;
11092
+ width: 20px;
11093
+ height: 10px;
11148
11094
 
11149
11095
  border: 0;
11150
11096
  border-radius: 4px;
11151
11097
  }
11152
11098
 
11153
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
11154
11099
  input[type=range]:disabled::-moz-range-thumb {
11155
11100
  background: var(---decidables-slider-background-color);
11156
11101
  box-shadow: none;
11157
11102
  }
11158
11103
 
11159
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
11160
11104
  input[type=range]:enabled::-moz-range-thumb {
11161
11105
  background: var(---decidables-slider-color);
11162
- box-shadow: var(---shadow-2-rotate);
11106
+ box-shadow: var(---shadow-2);
11163
11107
  }
11164
11108
 
11165
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
11166
11109
  input[type=range]:enabled:hover::-moz-range-thumb {
11167
- box-shadow: var(---shadow-4-rotate);
11110
+ box-shadow: var(---shadow-4);
11168
11111
  }
11169
11112
 
11170
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
11171
11113
  input[type=range]:enabled:active::-moz-range-thumb {
11172
- box-shadow: var(---shadow-8-rotate);
11173
- }
11174
-
11175
- :host(.keyboard) input[type=range]:enabled:focus::-moz-range-thumb {
11176
- box-shadow: var(---shadow-4-rotate);
11177
- }
11178
-
11179
- :host(.keyboard) input[type=range]:enabled:focus:active::-moz-range-thumb {
11180
- box-shadow: var(---shadow-8-rotate);
11181
- }
11182
-
11183
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
11184
- input[type=range]::-ms-thumb {
11185
- width: 10px;
11186
- height: 20px;
11187
- margin-top: 0;
11188
-
11189
- background: #999999;
11190
- /* background: var(---color-element-enabled); */
11191
- border: 0;
11192
- border-radius: 4px;
11193
- box-shadow: var(---shadow-2-rotate);
11194
- }
11195
-
11196
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
11197
- input[type=range]:disabled::-ms-thumb {
11198
- background: var(---decidables-slider-background-color);
11199
- box-shadow: none;
11200
- }
11201
-
11202
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
11203
- input[type=range]:enabled::-ms-thumb {
11204
- background: var(---decidables-slider-color);
11205
- box-shadow: var(---shadow-2-rotate);
11206
- }
11207
-
11208
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
11209
- input[type=range]:enabled:hover::-ms-thumb {
11210
- box-shadow: var(---shadow-4-rotate);
11211
- }
11212
-
11213
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
11214
- input[type=range]:enabled:active::-ms-thumb {
11215
- box-shadow: var(---shadow-8-rotate);
11114
+ box-shadow: var(---shadow-8);
11216
11115
  }
11217
11116
 
11218
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
11219
- :host(.keyboard) input[type=range]:enabled:focus::-ms-thumb {
11220
- box-shadow: var(---shadow-4-rotate);
11117
+ input[type=range]:enabled:focus-visible::-moz-range-thumb {
11118
+ box-shadow: var(---shadow-4);
11221
11119
  }
11222
11120
 
11223
- :host(.keyboard) input[type=range]:enabled:focus:active::-ms-thumb {
11224
- box-shadow: var(---shadow-8-rotate);
11121
+ input[type=range]:enabled:focus-visible:active::-moz-range-thumb {
11122
+ box-shadow: var(---shadow-8);
11225
11123
  }
11226
11124
 
11227
- datalist {
11125
+ /* Tick marks */
11126
+ .datalist {
11228
11127
  position: absolute;
11229
11128
  left: 2rem;
11230
11129
  z-index: -1;
11130
+
11231
11131
  display: flex;
11232
11132
 
11233
11133
  flex-direction: column;
@@ -11240,14 +11140,13 @@ class DecidablesSlider extends DecidablesElement {
11240
11140
  font-size: 0.75rem;
11241
11141
  }
11242
11142
 
11243
- option {
11244
- padding: 0;
11245
-
11143
+ .option {
11246
11144
  line-height: 0.8;
11247
- min-block-size: 0;
11145
+
11146
+ white-space: nowrap;
11248
11147
  }
11249
11148
 
11250
- option::before {
11149
+ .option::before {
11251
11150
  content: "– ";
11252
11151
  }
11253
11152
  `];
@@ -11260,10 +11159,10 @@ class DecidablesSlider extends DecidablesElement {
11260
11159
  <div class="range">
11261
11160
  <input ?disabled=${this.disabled} type="range" id="slider" min=${o$2(this.rangeMin)} max=${o$2(this.rangeMax)} step=${o$2(this.rangeStep)} .value=${this.rangeValue} @change=${this.rangeChanged.bind(this)} @input=${this.rangeInputted.bind(this)}>
11262
11161
  ${this.scale ? x$2`
11263
- <datalist id="ticks">
11264
- <option value=${o$2(this.rangeMax)} label=${o$2(this.max)}></option>
11265
- <option value=${o$2(this.rangeMin)} label=${o$2(this.min)}></option>
11266
- </datalist>
11162
+ <div class="datalist">
11163
+ <div class="option">${o$2(this.max)}</div>
11164
+ <div class="option">${o$2(this.min)}</div>
11165
+ </div>
11267
11166
  ` : x$2``}
11268
11167
  </div>
11269
11168
  <decidables-spinner ?disabled=${this.disabled} min=${o$2(this.min)} max=${o$2(this.max)} step=${o$2(this.step)} .value=${this.value} @input=${this.spinnerInputted.bind(this)}></decidables-spinner>
@@ -11323,13 +11222,14 @@ class DecidablesSpinner extends DecidablesElement {
11323
11222
  ---decidables-spinner-prefix: var(--decidables-spinner-prefix, "");
11324
11223
 
11325
11224
  ---decidables-spinner-postfix: var(--decidables-spinner-postfix, "");
11326
- ---decidables-spinner-postfix-padding: var(--decidables-spinner-postfix-padding, 0);
11225
+ ---decidables-spinner-postfix-padding: var(--decidables-spinner-postfix-padding, 0rem);
11327
11226
 
11328
11227
  display: block;
11329
11228
  }
11330
11229
 
11331
11230
  label {
11332
11231
  position: relative;
11232
+
11333
11233
  display: flex;
11334
11234
 
11335
11235
  flex-direction: column;
@@ -11347,6 +11247,7 @@ class DecidablesSpinner extends DecidablesElement {
11347
11247
  left: calc(50% - var(---decidables-spinner-input-width) / 2 + 0.25rem);
11348
11248
 
11349
11249
  font-size: var(---decidables-spinner-font-size);
11250
+
11350
11251
  line-height: normal;
11351
11252
 
11352
11253
  content: var(---decidables-spinner-prefix);
@@ -11358,6 +11259,7 @@ class DecidablesSpinner extends DecidablesElement {
11358
11259
  bottom: 1px;
11359
11260
 
11360
11261
  font-size: var(---decidables-spinner-font-size);
11262
+
11361
11263
  line-height: normal;
11362
11264
 
11363
11265
  content: var(---decidables-spinner-postfix);
@@ -11365,20 +11267,24 @@ class DecidablesSpinner extends DecidablesElement {
11365
11267
 
11366
11268
  input[type=number] {
11367
11269
  width: var(---decidables-spinner-input-width);
11368
- padding-right: var(---decidables-spinner-postfix-padding);
11270
+
11271
+ padding: 1px var(---decidables-spinner-postfix-padding) 1px 2px;
11272
+ margin: 0;
11369
11273
 
11370
11274
  font-family: var(---font-family-base);
11371
11275
  font-size: var(---decidables-spinner-font-size);
11276
+
11372
11277
  color: inherit;
11278
+
11373
11279
  text-align: right;
11374
11280
 
11281
+ appearance: none;
11282
+ outline: none;
11283
+
11375
11284
  background: none;
11376
11285
  border: 0;
11377
11286
  border-radius: 0;
11378
- outline: none;
11379
11287
  box-shadow: var(---shadow-2);
11380
-
11381
- -webkit-appearance: none; /* stylelint-disable-line property-no-vendor-prefix */
11382
11288
  }
11383
11289
 
11384
11290
  input[type=number]:hover {
@@ -11395,20 +11301,54 @@ class DecidablesSpinner extends DecidablesElement {
11395
11301
 
11396
11302
  border: 0;
11397
11303
  box-shadow: none;
11304
+ }
11305
+
11306
+ /* HACK: Manage spinners in Firefox */
11307
+ @supports (-moz-appearance: textfield) {
11308
+ input[type=number] {
11309
+ padding-right: calc(18px + var(---decidables-spinner-postfix-padding));
11310
+
11311
+ appearance: textfield;
11312
+ }
11313
+
11314
+ input[type=number]:hover,
11315
+ input[type=number]:focus,
11316
+ input[type=number]:active {
11317
+ padding-right: var(---decidables-spinner-postfix-padding);
11318
+
11319
+ appearance: none;
11320
+ }
11321
+
11322
+ input[type=number]:disabled {
11323
+ padding-right: calc(18px + var(---decidables-spinner-postfix-padding));
11398
11324
 
11399
- /* HACK: Use correct text color in Safari */
11400
- -webkit-opacity: 1;
11401
- /* HACK: Hide spinners in disabled input for Firefox and Safari */
11402
- -moz-appearance: textfield; /* stylelint-disable-line property-no-vendor-prefix */
11403
- /* HACK: Use correct text color in Safari */
11404
- -webkit-text-fill-color: var(---color-text);
11325
+ appearance: textfield;
11326
+ }
11327
+ }
11328
+
11329
+ /* HACK: Manage spinners in Chrome/Edge/Safari */
11330
+ input[type=number]::-webkit-inner-spin-button {
11331
+ /* Avoid oversized spinners in Safari */
11332
+ font-size: 1.125rem;
11333
+
11334
+ opacity: 0;
11335
+ }
11336
+
11337
+ input[type=number]:hover::-webkit-inner-spin-button,
11338
+ input[type=number]:focus::-webkit-inner-spin-button,
11339
+ input[type=number]:active::-webkit-inner-spin-button {
11340
+ opacity: 1;
11405
11341
  }
11406
11342
 
11407
- /* HACK: Hide spinners in disabled input for Firefox and Safari */
11408
- input[type=number]:disabled::-webkit-outer-spin-button,
11409
11343
  input[type=number]:disabled::-webkit-inner-spin-button {
11410
- margin: 0;
11411
- -webkit-appearance: none; /* stylelint-disable-line property-no-vendor-prefix */
11344
+ opacity: 0;
11345
+ }
11346
+
11347
+ /* HACK: Adjust padding on mobile w/o spinners */
11348
+ @media only screen and (hover: none) and (pointer: coarse) {
11349
+ input[type=number] {
11350
+ padding-right: calc(1.125rem + var(---decidables-spinner-postfix-padding));
11351
+ }
11412
11352
  }
11413
11353
  `];
11414
11354
  }
@@ -11472,13 +11412,16 @@ class DecidablesSwitch extends DecidablesElement {
11472
11412
 
11473
11413
  width: 1px;
11474
11414
  height: 1px;
11415
+
11475
11416
  padding: 0;
11476
11417
  margin: -1px;
11418
+
11477
11419
  overflow: hidden;
11478
11420
 
11479
11421
  white-space: nowrap;
11480
11422
 
11481
11423
  border: 0;
11424
+
11482
11425
  clip-path: inset(100%); /* May cause a performance issue: https://github.com/h5bp/html5-boilerplate/issues/2021 */
11483
11426
  }
11484
11427
 
@@ -11494,6 +11437,7 @@ class DecidablesSwitch extends DecidablesElement {
11494
11437
  position: relative;
11495
11438
 
11496
11439
  min-width: 24px;
11440
+
11497
11441
  padding: 0 0 36px;
11498
11442
  margin: 0.25rem 0.25rem 0;
11499
11443
 
@@ -11505,17 +11449,17 @@ class DecidablesSwitch extends DecidablesElement {
11505
11449
  input[type=checkbox] + label + label::before,
11506
11450
  input[type=checkbox] + label + label::after {
11507
11451
  position: absolute;
11508
-
11509
11452
  left: 50%;
11510
11453
 
11511
11454
  margin: 0;
11512
11455
 
11513
- content: "";
11514
-
11515
11456
  outline: 0;
11516
11457
 
11517
- transition: all var(---transition-duration) ease;
11458
+ content: "";
11459
+
11518
11460
  transform: translate(-50%, 0);
11461
+
11462
+ transition: all var(---transition-duration) ease;
11519
11463
  }
11520
11464
 
11521
11465
  input[type=checkbox] + label + label::before {
@@ -11563,17 +11507,14 @@ class DecidablesSwitch extends DecidablesElement {
11563
11507
  box-shadow: var(---shadow-8);
11564
11508
  }
11565
11509
 
11566
- /* stylelint-disable-next-line selector-max-compound-selectors */
11567
- :host(.keyboard) input[type=checkbox]:enabled:focus + label + label::after {
11510
+ input[type=checkbox]:enabled:focus-visible + label + label::after {
11568
11511
  box-shadow: var(---shadow-4);
11569
11512
  }
11570
11513
 
11571
- /* stylelint-disable selector-max-compound-selectors */
11572
- :host(.keyboard) input[type=checkbox]:enabled:focus + label + label:active::after,
11573
- :host(.keyboard) input[type=checkbox]:enabled:focus:active + label + label::after {
11514
+ input[type=checkbox]:enabled:focus-visible + label + label:active::after,
11515
+ input[type=checkbox]:enabled:focus-visible:active + label + label::after {
11574
11516
  box-shadow: var(---shadow-8);
11575
11517
  }
11576
- /* stylelint-enable selector-max-compound-selectors */
11577
11518
  `];
11578
11519
  }
11579
11520
  render() {
@@ -11693,39 +11634,46 @@ class DecidablesToggleOption extends DecidablesElement {
11693
11634
 
11694
11635
  width: 1px;
11695
11636
  height: 1px;
11637
+
11696
11638
  padding: 0;
11697
11639
  margin: -1px;
11640
+
11698
11641
  overflow: hidden;
11699
11642
 
11700
11643
  white-space: nowrap;
11701
11644
 
11702
11645
  border: 0;
11646
+
11703
11647
  clip-path: inset(100%); /* May cause a performance issue: https://github.com/h5bp/html5-boilerplate/issues/2021 */
11704
11648
  }
11705
11649
 
11706
11650
  input[type=radio] + label {
11707
11651
  width: 100%;
11652
+
11708
11653
  padding: 0.375rem 0.75rem;
11709
11654
 
11710
11655
  font-family: var(---font-family-base);
11711
11656
  font-size: 1.125rem;
11657
+
11712
11658
  line-height: 1.5;
11659
+
11713
11660
  color: var(---color-text-inverse);
11661
+
11714
11662
  text-align: center;
11715
11663
 
11716
11664
  cursor: pointer;
11665
+ outline: none;
11717
11666
 
11718
11667
  background-color: var(---color-element-enabled);
11719
11668
  border: 0;
11720
11669
  border-radius: 0;
11721
- outline: none;
11722
-
11723
11670
  box-shadow: var(---shadow-2);
11724
11671
  }
11725
11672
 
11726
11673
  input[type=radio]:checked + label {
11727
- background-color: var(---color-element-selected);
11728
11674
  outline: none;
11675
+
11676
+ background-color: var(---color-element-selected);
11729
11677
  box-shadow: var(---shadow-2);
11730
11678
  }
11731
11679
 
@@ -11733,6 +11681,7 @@ class DecidablesToggleOption extends DecidablesElement {
11733
11681
  z-index: 1;
11734
11682
 
11735
11683
  outline: none;
11684
+
11736
11685
  box-shadow: var(---shadow-4);
11737
11686
  }
11738
11687
 
@@ -11740,6 +11689,7 @@ class DecidablesToggleOption extends DecidablesElement {
11740
11689
  z-index: 2;
11741
11690
 
11742
11691
  outline: none;
11692
+
11743
11693
  box-shadow: var(---shadow-8);
11744
11694
  }
11745
11695
 
@@ -11753,25 +11703,28 @@ class DecidablesToggleOption extends DecidablesElement {
11753
11703
  border-bottom-left-radius: 0.25rem;
11754
11704
  }
11755
11705
 
11756
- :host(.keyboard) input[type=radio]:focus + label {
11706
+ input[type=radio]:focus-visible + label {
11757
11707
  z-index: 1;
11758
11708
 
11759
11709
  outline: none;
11710
+
11760
11711
  box-shadow: var(---shadow-4);
11761
11712
  }
11762
11713
 
11763
- :host(.keyboard) input[type=radio]:focus:checked + label {
11714
+ input[type=radio]:focus-visible:checked + label {
11764
11715
  z-index: 1;
11765
11716
 
11766
- background-color: var(---color-element-selected);
11767
11717
  outline: none;
11718
+
11719
+ background-color: var(---color-element-selected);
11768
11720
  box-shadow: var(---shadow-4);
11769
11721
  }
11770
11722
 
11771
- :host(.keyboard) input[type=radio]:focus + label:active {
11723
+ input[type=radio]:focus-visible + label:active {
11772
11724
  z-index: 2;
11773
11725
 
11774
11726
  outline: none;
11727
+
11775
11728
  box-shadow: var(---shadow-8);
11776
11729
  }
11777
11730
  `];
@@ -12479,11 +12432,13 @@ class CPTEquation extends ProspectableElement {
12479
12432
 
12480
12433
  .addend {
12481
12434
  position: relative;
12435
+
12482
12436
  display: inline-block;
12483
12437
  }
12484
12438
 
12485
12439
  .comparison {
12486
12440
  position: relative;
12441
+
12487
12442
  display: inline-block;
12488
12443
 
12489
12444
  font-size: 125%;
@@ -22299,6 +22254,7 @@ class CPTParameters extends ProspectableElement {
22299
22254
 
22300
22255
  decidables-slider {
22301
22256
  line-height: 1;
22257
+
22302
22258
  text-align: center;
22303
22259
  }
22304
22260
 
@@ -22592,9 +22548,9 @@ class CPTProbability extends DecidablesMixinResizeable(ProspectableElement) {
22592
22548
 
22593
22549
  .curve.interactive {
22594
22550
  cursor: nwse-resize;
22551
+ outline: none;
22595
22552
 
22596
22553
  filter: url("#shadow-2");
22597
- outline: none;
22598
22554
  }
22599
22555
 
22600
22556
  .curve.interactive:hover {
@@ -22612,7 +22568,7 @@ class CPTProbability extends DecidablesMixinResizeable(ProspectableElement) {
22612
22568
  transform: translateY(0);
22613
22569
  }
22614
22570
 
22615
- :host(.keyboard) .curve.interactive:focus {
22571
+ .curve.interactive:focus-visible {
22616
22572
  filter: url("#shadow-8");
22617
22573
 
22618
22574
  /* HACK: This gets Safari to correctly apply the filter! */
@@ -22621,9 +22577,9 @@ class CPTProbability extends DecidablesMixinResizeable(ProspectableElement) {
22621
22577
 
22622
22578
  .point.interactive {
22623
22579
  cursor: nesw-resize;
22580
+ outline: none;
22624
22581
 
22625
22582
  filter: url("#shadow-2");
22626
- outline: none;
22627
22583
 
22628
22584
  /* HACK: This gets Safari to correctly apply the filter! */
22629
22585
  stroke: #000000;
@@ -22645,7 +22601,7 @@ class CPTProbability extends DecidablesMixinResizeable(ProspectableElement) {
22645
22601
  stroke: #00ff00;
22646
22602
  }
22647
22603
 
22648
- :host(.keyboard) .point.interactive:focus {
22604
+ .point.interactive:focus-visible {
22649
22605
  filter: url("#shadow-8");
22650
22606
 
22651
22607
  /* HACK: This gets Safari to correctly apply the filter! */
@@ -22679,8 +22635,8 @@ class CPTProbability extends DecidablesMixinResizeable(ProspectableElement) {
22679
22635
 
22680
22636
  .diagonal {
22681
22637
  stroke: var(---color-element-border);
22682
- stroke-dasharray: 4;
22683
22638
  stroke-width: 1;
22639
+ stroke-dasharray: 4;
22684
22640
  }
22685
22641
 
22686
22642
  .curve {
@@ -22713,8 +22669,8 @@ class CPTProbability extends DecidablesMixinResizeable(ProspectableElement) {
22713
22669
  font-size: 0.75rem;
22714
22670
 
22715
22671
  dominant-baseline: middle;
22716
- text-anchor: middle;
22717
22672
 
22673
+ text-anchor: middle;
22718
22674
  fill: var(---color-text-inverse);
22719
22675
  }
22720
22676
 
@@ -22726,8 +22682,8 @@ class CPTProbability extends DecidablesMixinResizeable(ProspectableElement) {
22726
22682
 
22727
22683
  @media (pointer: coarse) {
22728
22684
  .interactive .touch {
22729
- stroke-linecap: round;
22730
22685
  stroke-width: 12;
22686
+ stroke-linecap: round;
22731
22687
  }
22732
22688
  }
22733
22689
  `];
@@ -25735,6 +25691,7 @@ class CPTSpace extends DecidablesMixinResizeable(ProspectableElement) {
25735
25691
  font-weight: 600;
25736
25692
 
25737
25693
  alignment-baseline: middle;
25694
+
25738
25695
  text-anchor: middle;
25739
25696
  }
25740
25697
 
@@ -25758,6 +25715,7 @@ class CPTSpace extends DecidablesMixinResizeable(ProspectableElement) {
25758
25715
  font-size: 0.75rem;
25759
25716
 
25760
25717
  alignment-baseline: middle;
25718
+
25761
25719
  text-anchor: end;
25762
25720
  }
25763
25721
 
@@ -25798,6 +25756,7 @@ class CPTSpace extends DecidablesMixinResizeable(ProspectableElement) {
25798
25756
  font-weight: 600;
25799
25757
 
25800
25758
  alignment-baseline: middle;
25759
+
25801
25760
  text-anchor: middle;
25802
25761
  }
25803
25762
 
@@ -26671,9 +26630,9 @@ class CPTValue extends DecidablesMixinResizeable(ProspectableElement) {
26671
26630
  .curve-p.interactive,
26672
26631
  .curve-n.interactive {
26673
26632
  cursor: nwse-resize;
26633
+ outline: none;
26674
26634
 
26675
26635
  filter: url("#shadow-2");
26676
- outline: none;
26677
26636
  }
26678
26637
 
26679
26638
  .curve-p.interactive:hover,
@@ -26693,8 +26652,8 @@ class CPTValue extends DecidablesMixinResizeable(ProspectableElement) {
26693
26652
  transform: translateY(0);
26694
26653
  }
26695
26654
 
26696
- :host(.keyboard) .curve-p.interactive:focus,
26697
- :host(.keyboard) .curve-n.interactive:focus {
26655
+ .curve-p.interactive:focus-visible,
26656
+ .curve-n.interactive:focus-visible {
26698
26657
  filter: url("#shadow-8");
26699
26658
 
26700
26659
  /* HACK: This gets Safari to correctly apply the filter! */
@@ -26703,9 +26662,9 @@ class CPTValue extends DecidablesMixinResizeable(ProspectableElement) {
26703
26662
 
26704
26663
  .point.interactive {
26705
26664
  cursor: nesw-resize;
26665
+ outline: none;
26706
26666
 
26707
26667
  filter: url("#shadow-2");
26708
- outline: none;
26709
26668
 
26710
26669
  /* HACK: This gets Safari to correctly apply the filter! */
26711
26670
  stroke: #000000;
@@ -26727,7 +26686,7 @@ class CPTValue extends DecidablesMixinResizeable(ProspectableElement) {
26727
26686
  stroke: #00ff00;
26728
26687
  }
26729
26688
 
26730
- :host(.keyboard) .point.interactive:focus {
26689
+ .point.interactive:focus-visible {
26731
26690
  filter: url("#shadow-8");
26732
26691
 
26733
26692
  /* HACK: This gets Safari to correctly apply the filter! */
@@ -26767,8 +26726,8 @@ class CPTValue extends DecidablesMixinResizeable(ProspectableElement) {
26767
26726
 
26768
26727
  .diagonal {
26769
26728
  stroke: var(---color-element-border);
26770
- stroke-dasharray: 4;
26771
26729
  stroke-width: 1;
26730
+ stroke-dasharray: 4;
26772
26731
  }
26773
26732
 
26774
26733
  .curve-p,
@@ -26802,8 +26761,8 @@ class CPTValue extends DecidablesMixinResizeable(ProspectableElement) {
26802
26761
  font-size: 0.75rem;
26803
26762
 
26804
26763
  dominant-baseline: middle;
26805
- text-anchor: middle;
26806
26764
 
26765
+ text-anchor: middle;
26807
26766
  fill: var(---color-text-inverse);
26808
26767
  }
26809
26768
 
@@ -26815,8 +26774,8 @@ class CPTValue extends DecidablesMixinResizeable(ProspectableElement) {
26815
26774
 
26816
26775
  @media (pointer: coarse) {
26817
26776
  .interactive .touch {
26818
- stroke-linecap: round;
26819
26777
  stroke-width: 12;
26778
+ stroke-linecap: round;
26820
26779
  }
26821
26780
  }
26822
26781
  `];
@@ -27832,6 +27791,7 @@ class DecisionSpace extends DecidablesMixinResizeable(ProspectableElement) {
27832
27791
  font-weight: 600;
27833
27792
 
27834
27793
  alignment-baseline: middle;
27794
+
27835
27795
  text-anchor: middle;
27836
27796
  }
27837
27797
 
@@ -27855,6 +27815,7 @@ class DecisionSpace extends DecidablesMixinResizeable(ProspectableElement) {
27855
27815
  font-size: 0.75rem;
27856
27816
 
27857
27817
  alignment-baseline: middle;
27818
+
27858
27819
  text-anchor: end;
27859
27820
  }
27860
27821
 
@@ -27895,6 +27856,7 @@ class DecisionSpace extends DecidablesMixinResizeable(ProspectableElement) {
27895
27856
  font-weight: 600;
27896
27857
 
27897
27858
  alignment-baseline: middle;
27859
+
27898
27860
  text-anchor: middle;
27899
27861
  }
27900
27862
 
@@ -28894,6 +28856,7 @@ class ProspectableResponse extends ProspectableElement {
28894
28856
 
28895
28857
  width: 5.25rem;
28896
28858
  height: 3.5rem;
28859
+
28897
28860
  padding: 0.375rem 0.75rem;
28898
28861
  margin: 0.25rem;
28899
28862
 
@@ -28921,6 +28884,7 @@ class ProspectableResponse extends ProspectableElement {
28921
28884
 
28922
28885
  .feedback .outcome {
28923
28886
  font-weight: 600;
28887
+
28924
28888
  line-height: 1.15;
28925
28889
  }
28926
28890
 
@@ -28985,6 +28949,8 @@ class RiskyOption extends DecidablesMixinResizeable(ProspectableElement) {
28985
28949
  --decidables-spinner-input-width: 4rem;
28986
28950
  --decidables-spinner-prefix: "$";
28987
28951
 
28952
+ position: relative;
28953
+
28988
28954
  display: inline-block;
28989
28955
 
28990
28956
  width: 10rem;
@@ -28994,6 +28960,7 @@ class RiskyOption extends DecidablesMixinResizeable(ProspectableElement) {
28994
28960
  .main {
28995
28961
  width: 100%;
28996
28962
  height: 100%;
28963
+
28997
28964
  overflow: visible;
28998
28965
  }
28999
28966
 
@@ -29010,9 +28977,9 @@ class RiskyOption extends DecidablesMixinResizeable(ProspectableElement) {
29010
28977
 
29011
28978
  .arc.interactive {
29012
28979
  cursor: ns-resize;
28980
+ outline: none;
29013
28981
 
29014
28982
  filter: url("#shadow-2");
29015
- outline: none;
29016
28983
  }
29017
28984
 
29018
28985
  .arc.interactive:hover {
@@ -29023,7 +28990,7 @@ class RiskyOption extends DecidablesMixinResizeable(ProspectableElement) {
29023
28990
  filter: url("#shadow-8");
29024
28991
  }
29025
28992
 
29026
- :host(.keyboard) .arc.interactive:focus {
28993
+ .arc.interactive:focus-visible {
29027
28994
  filter: url("#shadow-8");
29028
28995
  }
29029
28996
 
@@ -29042,23 +29009,20 @@ class RiskyOption extends DecidablesMixinResizeable(ProspectableElement) {
29042
29009
  .label.static {
29043
29010
  font-size: 1.75rem;
29044
29011
 
29012
+ dominant-baseline: middle;
29013
+
29045
29014
  user-select: none;
29046
29015
 
29047
- dominant-baseline: middle;
29048
29016
  text-anchor: middle;
29049
29017
  }
29050
29018
 
29051
29019
  .label.interactive {
29020
+ position: absolute;
29021
+
29052
29022
  width: var(--decidables-spinner-input-width);
29053
29023
  height: calc(var(--decidables-spinner-font-size) * 1.5);
29054
- overflow: visible;
29055
- }
29056
29024
 
29057
- /* HACK: Get Safari to work with SVG foreignObject */
29058
- /* https://stackoverflow.com/questions/51313873/svg-foreignobject-not-working-properly-on-safari */
29059
- /* https://bugs.webkit.org/show_bug.cgi?id=23113 */
29060
- .label.interactive decidables-spinner {
29061
- position: fixed;
29025
+ overflow: visible;
29062
29026
  }
29063
29027
 
29064
29028
  .label.interactive.win decidables-spinner {
@@ -29257,11 +29221,11 @@ class RiskyOption extends DecidablesMixinResizeable(ProspectableElement) {
29257
29221
  // Labels
29258
29222
  // DATA-JOIN
29259
29223
  const labelStaticUpdate = pieMerge.selectAll('.label.static').data(arcsStatic);
29260
- const labelInteractiveUpdate = pieMerge.selectAll('.label.interactive').data(arcsInteractive);
29224
+ const labelInteractiveUpdate = select(this.renderRoot).selectAll('.label.interactive').data(arcsInteractive);
29261
29225
  // ENTER
29262
29226
  const labelStaticEnter = labelStaticUpdate.enter().append('text');
29263
- const labelInteractiveEnter = labelInteractiveUpdate.enter().append('foreignObject');
29264
- labelInteractiveEnter.append('xhtml:decidables-spinner').on('input', (event, datum) => {
29227
+ const labelInteractiveEnter = labelInteractiveUpdate.enter().append('xhtml:div');
29228
+ labelInteractiveEnter.append('decidables-spinner').on('input', (event, datum) => {
29265
29229
  datum.data.x = parseFloat(event.target.value);
29266
29230
  this.dispatchEvent(new CustomEvent('risky-outcome-change', {
29267
29231
  detail: {
@@ -29287,21 +29251,18 @@ class RiskyOption extends DecidablesMixinResizeable(ProspectableElement) {
29287
29251
  });
29288
29252
  const labelInteractiveMerge = labelInteractiveEnter.merge(labelInteractiveUpdate).attr('class', datum => {
29289
29253
  return `label interactive ${datum.data.name}`;
29290
- }).attr('transform', datum => {
29291
- // HACK: Center spinner here instead of CSS for Safari SVG foreignObject
29292
- // x: calc(var(--decidables-spinner-input-width) / -2);
29293
- // y: calc(var(--decidables-spinner-font-size) * 1.5 / -2);
29254
+ }).attr('style', datum => {
29294
29255
  const inputWidth = parseFloat(this.getComputedStyleValue('--decidables-spinner-input-width'));
29295
29256
  const fontSize = parseFloat(this.getComputedStyleValue('--decidables-spinner-font-size'));
29296
29257
  const rem = parseFloat(getComputedStyle(document.documentElement).getPropertyValue('font-size'), 10);
29297
- const x = inputWidth * rem / -2;
29298
- const y = fontSize * rem * 1.5 / -2;
29258
+ const x = width / 2 + inputWidth * rem / -2;
29259
+ const y = height / 2 + fontSize * rem * 1.5 / -2;
29299
29260
  if (arcs.length === 1) {
29300
- return `translate(${x}, ${y})`;
29261
+ return `left: ${x}px; top: ${y}px;`;
29301
29262
  }
29302
29263
  const radius = Math.min(width, height) / 2 * 0.6;
29303
29264
  const arcLabel = arc().innerRadius(radius).outerRadius(radius);
29304
- return `translate(${arcLabel.centroid(datum)[0] + x}, ${arcLabel.centroid(datum)[1] + y})`;
29265
+ return `left: ${arcLabel.centroid(datum)[0] + x}px; top: ${arcLabel.centroid(datum)[1] + y}px;`;
29305
29266
  });
29306
29267
  labelInteractiveMerge.select('decidables-spinner').attr('value', datum => {
29307
29268
  return `${datum.data.x.toFixed(0)}`;