@indico-data/design-system 2.17.2 → 2.18.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.
Files changed (32) hide show
  1. package/lib/index.css +616 -151
  2. package/lib/index.d.ts +0 -1
  3. package/lib/index.esm.css +616 -151
  4. package/lib/index.esm.js +5 -453
  5. package/lib/index.esm.js.map +1 -1
  6. package/lib/index.js +5 -453
  7. package/lib/index.js.map +1 -1
  8. package/lib/src/components/button/Button.stories.d.ts +1 -0
  9. package/lib/src/legacy/components/modals/ModalBase/ModalBase.d.ts +0 -1
  10. package/package.json +1 -1
  11. package/src/components/button/Button.mdx +6 -3
  12. package/src/components/button/Button.stories.tsx +8 -0
  13. package/src/components/button/Button.tsx +14 -6
  14. package/src/components/button/__tests__/Button.test.tsx +38 -0
  15. package/src/components/button/styles/Button.scss +14 -22
  16. package/src/components/button/styles/_variables.scss +77 -4
  17. package/src/components/forms/checkbox/styles/Checkbox.scss +3 -3
  18. package/src/components/forms/input/styles/Input.scss +2 -4
  19. package/src/components/forms/passwordInput/styles/PasswordInput.scss +2 -4
  20. package/src/components/forms/radio/styles/Radio.scss +3 -3
  21. package/src/components/forms/select/styles/Select.scss +21 -4
  22. package/src/components/forms/textarea/styles/Textarea.scss +2 -3
  23. package/src/components/forms/toggle/styles/Toggle.scss +2 -2
  24. package/src/legacy/components/inputs/NoInputDatePicker/NoInputDatePicker.scss +441 -0
  25. package/src/legacy/components/inputs/NoInputDatePicker/NoInputDatePicker.tsx +3 -4
  26. package/src/legacy/components/modals/ModalBase/ModalBase.tsx +5 -1
  27. package/src/styles/globals.scss +11 -0
  28. package/src/styles/index.scss +2 -2
  29. package/src/styles/variables/themes/dark.scss +8 -7
  30. package/src/styles/variables/themes/light.scss +1 -0
  31. package/lib/src/legacy/components/inputs/NoInputDatePicker/NoInputDatePicker.styles.d.ts +0 -1
  32. package/src/legacy/components/inputs/NoInputDatePicker/NoInputDatePicker.styles.ts +0 -449
package/lib/index.esm.js CHANGED
@@ -3174,9 +3174,7 @@ const Button$2 = (props) => {
3174
3174
  props.onClick(event);
3175
3175
  }
3176
3176
  };
3177
- return (jsxs("button", Object.assign({ disabled: isLoading || isDisabled, className: buttonClasses, role: "button", onClick: handleOnClick, "aria-label": ariaLabel || 'button', "aria-disabled": isLoading || isDisabled, "aria-busy": isLoading, type: type, onMouseEnter: onMouseEnter, onMouseLeave: onMouseExit, onKeyDown: onKeyDown }, rest, { children: [isLoading && (jsx(Icon, { name: "fa-circle-notch", style: {
3178
- animation: 'spin 1s linear infinite',
3179
- }, className: "mr-2", ariaLabel: 'Loading...' })), iconPosition === 'left' && iconName && (jsx(Icon, { name: iconName, className: "mr-2", ariaLabel: `${iconName} Icon` })), children, iconPosition === 'right' && iconName && (jsx(Icon, { name: iconName, className: "ml-2", ariaLabel: `${iconName} Icon` }))] })));
3177
+ return (jsxs("button", Object.assign({ disabled: isLoading || isDisabled, className: buttonClasses, role: "button", onClick: handleOnClick, "aria-label": ariaLabel || 'button', "aria-disabled": isLoading || isDisabled, "aria-busy": isLoading, type: type, onMouseEnter: onMouseEnter, onMouseLeave: onMouseExit, onKeyDown: onKeyDown }, rest, { children: [isLoading && (jsx(Icon, { name: "fa-circle-notch", style: { animation: 'spin 1s linear infinite' }, className: "mr-2", ariaLabel: "Loading..." })), !children && iconName && jsx(Icon, { name: iconName, ariaLabel: `${iconName} Icon` }), children && iconPosition === 'left' && iconName && (jsx(Icon, { name: iconName, className: "mr-2", ariaLabel: `${iconName} Icon` })), children, children && iconPosition === 'right' && iconName && (jsx(Icon, { name: iconName, className: "ml-2", ariaLabel: `${iconName} Icon` }))] })));
3180
3178
  };
3181
3179
 
3182
3180
  function ownKeys$2(object, enumerableOnly) {
@@ -37115,454 +37113,6 @@ const DatePicker = (props) => {
37115
37113
  }, children: jsx("div", Object.assign({ tabIndex: -1, style: popper.styles.popper, className: "DayPickerInput-Overlay" }, popper.attributes.popper, { ref: setPopperElement, role: "dialog", "aria-label": "DayPicker calendar", children: jsx(DayPicker, { disabled: disabled, mode: "single", defaultMonth: localSelected, selected: localSelected, onSelect: handleDaySelect, fromDate: disableBeforeDate, toDate: disableAfterDate }) })) }))] }));
37116
37114
  };
37117
37115
 
37118
- const StyledNoInputDatePicker = styled.div `
37119
- /************************************
37120
- * Default react-day-picker styling - this needed to be added because we were unable to import styling as specified by the docs (most likely because we are not using webpack)
37121
- *************************************/
37122
-
37123
- .rdp {
37124
- --rdp-cell-size: 40px;
37125
- --rdp-accent-color: #6833d0;
37126
- --rdp-background-color: #ffffff;
37127
- --rdp-accent-color-dark: #3003e1;
37128
- --rdp-background-color-dark: #180270;
37129
- --rdp-outline: 2px solid var(--rdp-accent-color); /* Outline border for focused elements */
37130
- --rdp-outline-selected: 3px solid var(--rdp-accent-color); /* Outline border for focused _and_ selected elements */
37131
-
37132
- margin: 1em;
37133
- }
37134
-
37135
- /* Hide elements for devices that are not screen readers */
37136
- .rdp-vhidden {
37137
- box-sizing: border-box;
37138
- padding: 0;
37139
- margin: 0;
37140
- background: transparent;
37141
- border: 0;
37142
- -moz-appearance: none;
37143
- -webkit-appearance: none;
37144
- appearance: none;
37145
- position: absolute !important;
37146
- top: 0;
37147
- width: 1px !important;
37148
- height: 1px !important;
37149
- padding: 0 !important;
37150
- overflow: hidden !important;
37151
- clip: rect(1px, 1px, 1px, 1px) !important;
37152
- border: 0 !important;
37153
- }
37154
-
37155
- /* Buttons */
37156
- .rdp-button_reset {
37157
- appearance: none;
37158
- position: relative;
37159
- margin: 0;
37160
- padding: 0;
37161
- cursor: default;
37162
- color: inherit;
37163
- background: none;
37164
- font: inherit;
37165
-
37166
- -moz-appearance: none;
37167
- -webkit-appearance: none;
37168
- }
37169
-
37170
- .rdp-button_reset:focus-visible {
37171
- /* Make sure to reset outline only when :focus-visible is supported */
37172
- outline: none;
37173
- }
37174
-
37175
- .rdp-button {
37176
- border: 2px solid transparent;
37177
- }
37178
-
37179
- .rdp-button[disabled]:not(.rdp-day_selected) {
37180
- opacity: 0.25;
37181
- }
37182
-
37183
- .rdp-button:not([disabled]) {
37184
- cursor: pointer;
37185
- }
37186
-
37187
- .rdp-button:focus-visible:not([disabled]) {
37188
- color: inherit;
37189
- background-color: var(--rdp-background-color);
37190
- border: var(--rdp-outline);
37191
- }
37192
-
37193
- .rdp-months {
37194
- display: flex;
37195
- }
37196
-
37197
- .rdp-month {
37198
- margin: 0 1em;
37199
- }
37200
-
37201
- .rdp-month:first-child {
37202
- margin-left: 0;
37203
- }
37204
-
37205
- .rdp-month:last-child {
37206
- margin-right: 0;
37207
- }
37208
-
37209
- .rdp-table {
37210
- margin: 0;
37211
- max-width: calc(var(--rdp-cell-size) * 7);
37212
- border-collapse: collapse;
37213
- }
37214
-
37215
- .rdp-with_weeknumber .rdp-table {
37216
- max-width: calc(var(--rdp-cell-size) * 8);
37217
- border-collapse: collapse;
37218
- }
37219
-
37220
- .rdp-caption {
37221
- display: flex;
37222
- align-items: center;
37223
- justify-content: space-between;
37224
- padding: 0;
37225
- text-align: left;
37226
- }
37227
-
37228
- .rdp-multiple_months .rdp-caption {
37229
- position: relative;
37230
- display: block;
37231
- text-align: center;
37232
- }
37233
-
37234
- .rdp-caption_dropdowns {
37235
- position: relative;
37236
- display: inline-flex;
37237
- }
37238
-
37239
- .rdp-caption_label {
37240
- position: relative;
37241
- z-index: 1;
37242
- display: inline-flex;
37243
- align-items: center;
37244
- margin: 0;
37245
- padding: 0 0.25em;
37246
- white-space: nowrap;
37247
- color: currentColor;
37248
- border: 0;
37249
- border: 2px solid transparent;
37250
- font-family: inherit;
37251
- font-size: 140%;
37252
- font-weight: bold;
37253
- }
37254
-
37255
- .rdp-nav {
37256
- white-space: nowrap;
37257
- }
37258
-
37259
- .rdp-multiple_months .rdp-caption_start .rdp-nav {
37260
- position: absolute;
37261
- top: 50%;
37262
- left: 0;
37263
- transform: translateY(-50%);
37264
- }
37265
-
37266
- .rdp-multiple_months .rdp-caption_end .rdp-nav {
37267
- position: absolute;
37268
- top: 50%;
37269
- right: 0;
37270
- transform: translateY(-50%);
37271
- }
37272
-
37273
- .rdp-nav_button {
37274
- display: inline-flex;
37275
- align-items: center;
37276
- justify-content: center;
37277
- width: var(--rdp-cell-size);
37278
- height: var(--rdp-cell-size);
37279
- padding: 0.25em;
37280
- border-radius: 100%;
37281
- }
37282
-
37283
- /* ---------- */
37284
- /* Dropdowns */
37285
- /* ---------- */
37286
-
37287
- .rdp-dropdown_year,
37288
- .rdp-dropdown_month {
37289
- position: relative;
37290
- display: inline-flex;
37291
- align-items: center;
37292
- }
37293
-
37294
- .rdp-dropdown {
37295
- appearance: none;
37296
- position: absolute;
37297
- z-index: 2;
37298
- top: 0;
37299
- bottom: 0;
37300
- left: 0;
37301
- width: 100%;
37302
- margin: 0;
37303
- padding: 0;
37304
- cursor: inherit;
37305
- opacity: 0;
37306
- border: none;
37307
- background-color: transparent;
37308
- font-family: inherit;
37309
- font-size: inherit;
37310
- line-height: inherit;
37311
- }
37312
-
37313
- .rdp-dropdown[disabled] {
37314
- opacity: unset;
37315
- color: unset;
37316
- }
37317
-
37318
- .rdp-dropdown:focus-visible:not([disabled]) + .rdp-caption_label {
37319
- background-color: var(--rdp-background-color);
37320
- border: var(--rdp-outline);
37321
- border-radius: 6px;
37322
- }
37323
-
37324
- .rdp-dropdown_icon {
37325
- margin: 0 0 0 5px;
37326
- }
37327
-
37328
- .rdp-head {
37329
- border: 0;
37330
- }
37331
-
37332
- .rdp-head_row,
37333
- .rdp-row {
37334
- height: 100%;
37335
- }
37336
-
37337
- .rdp-head_cell {
37338
- vertical-align: middle;
37339
- font-size: 0.75em;
37340
- font-weight: 700;
37341
- text-align: center;
37342
- height: 100%;
37343
- height: var(--rdp-cell-size);
37344
- padding: 0;
37345
- }
37346
-
37347
- .rdp-tbody {
37348
- border: 0;
37349
- }
37350
-
37351
- .rdp-tfoot {
37352
- margin: 0.5em;
37353
- }
37354
-
37355
- .rdp-cell {
37356
- width: var(--rdp-cell-size);
37357
- height: 100%;
37358
- height: var(--rdp-cell-size);
37359
- padding: 0;
37360
- text-align: center;
37361
- }
37362
-
37363
- .rdp-weeknumber {
37364
- font-size: 0.75em;
37365
- }
37366
-
37367
- .rdp-weeknumber,
37368
- .rdp-day {
37369
- display: flex;
37370
- overflow: hidden;
37371
- align-items: center;
37372
- justify-content: center;
37373
- box-sizing: border-box;
37374
- width: var(--rdp-cell-size);
37375
- max-width: var(--rdp-cell-size);
37376
- height: var(--rdp-cell-size);
37377
- margin: 0;
37378
- border: 2px solid transparent;
37379
- border-radius: 100%;
37380
- }
37381
-
37382
- .rdp-day_today:not(.rdp-day_outside) {
37383
- font-weight: bold;
37384
- }
37385
-
37386
- .rdp-day_selected,
37387
- .rdp-day_selected:focus-visible,
37388
- .rdp-day_selected:hover {
37389
- color: white;
37390
- opacity: 1;
37391
- background-color: var(--rdp-accent-color);
37392
- }
37393
-
37394
- .rdp-day_outside {
37395
- opacity: 0.5;
37396
- }
37397
-
37398
- .rdp-day_selected:focus-visible {
37399
- /* Since the background is the same use again the outline */
37400
- outline: var(--rdp-outline);
37401
- outline-offset: 2px;
37402
- z-index: 1;
37403
- }
37404
-
37405
- .rdp:not([dir='rtl']) .rdp-day_range_start:not(.rdp-day_range_end) {
37406
- border-top-right-radius: 0;
37407
- border-bottom-right-radius: 0;
37408
- }
37409
-
37410
- .rdp:not([dir='rtl']) .rdp-day_range_end:not(.rdp-day_range_start) {
37411
- border-top-left-radius: 0;
37412
- border-bottom-left-radius: 0;
37413
- }
37414
-
37415
- .rdp[dir='rtl'] .rdp-day_range_start:not(.rdp-day_range_end) {
37416
- border-top-left-radius: 0;
37417
- border-bottom-left-radius: 0;
37418
- }
37419
-
37420
- .rdp[dir='rtl'] .rdp-day_range_end:not(.rdp-day_range_start) {
37421
- border-top-right-radius: 0;
37422
- border-bottom-right-radius: 0;
37423
- }
37424
-
37425
- .rdp-day_range_end.rdp-day_range_start {
37426
- border-radius: 100%;
37427
- }
37428
-
37429
- .rdp-day_range_middle {
37430
- border-radius: 0;
37431
- }
37432
-
37433
- /*# sourceMappingURL=style.css.map */
37434
-
37435
- /******************************
37436
- * Indico Custom Styling For Insights
37437
- *******************************/
37438
- .rdp-button:hover:not([disabled]):not(.rdp-day_selected) {
37439
- background-color: #976cec;
37440
- }
37441
- .rdp-button,
37442
- .rdp-day {
37443
- box-shadow: none;
37444
- color: #000000;
37445
- &:hover {
37446
- background-color: #6833d0;
37447
- color: white;
37448
- }
37449
- }
37450
-
37451
- .rdp-head_cell,
37452
- .rdp-cell {
37453
- border: none;
37454
- }
37455
-
37456
- .DayPickerInput-Overlay {
37457
- border-radius: 4px;
37458
- z-index: 999;
37459
- .rdp {
37460
- background: white;
37461
- z-index: 999;
37462
- border: solid 1px #000000;
37463
- border-radius: 4px;
37464
- box-shadow: 0px 1px 10px 0px rgba(0, 0, 0, 0.4);
37465
- }
37466
- }
37467
-
37468
- .rdp-caption_label {
37469
- font-weight: 400;
37470
- font-size: 14px;
37471
- color: #000000;
37472
- }
37473
-
37474
- .rdp-day_today {
37475
- background-color: #dbd5e6;
37476
- color: #ffffff;
37477
- font-weight: 400;
37478
- }
37479
-
37480
- .rdp-button_reset {
37481
- &.rdp-button {
37482
- &.rdp-day {
37483
- &.rdp-day_selected {
37484
- background-color: #6833d0;
37485
- color: white;
37486
-
37487
- &:focus {
37488
- color: white;
37489
- }
37490
- &:active {
37491
- color: white;
37492
- }
37493
- }
37494
- }
37495
- }
37496
- }
37497
-
37498
- .rdp-head_cell {
37499
- color: #6833d0;
37500
- font-weight: 400;
37501
- }
37502
-
37503
- .date__picker__trigger {
37504
- color: #000000;
37505
- cursor: pointer;
37506
- }
37507
-
37508
- .custom__caption {
37509
- display: flex;
37510
- justify-content: space-between;
37511
- align-items: center;
37512
- padding: 15px 5px 15px 5px;
37513
-
37514
- .custom__caption__text {
37515
- font-size: 14px;
37516
- color: #000000;
37517
- margin: 0;
37518
- }
37519
-
37520
- .custom__caption__action__button {
37521
- background: none;
37522
- border: none;
37523
- cursor: pointer;
37524
- box-shadow: none;
37525
- padding: 0 5px 0 5px;
37526
-
37527
- border-radius: 60px;
37528
- color: #6833d0;
37529
- height: 20px;
37530
- width: 20px;
37531
-
37532
- &:hover {
37533
- background-color: #6833d0;
37534
- color: #ffffff;
37535
- border-radius: 20px;
37536
-
37537
- .rdp-nav_icon {
37538
- color: #ffffff;
37539
- }
37540
- }
37541
-
37542
- .rdp-nav_icon {
37543
- color: #6833d0;
37544
- }
37545
- }
37546
- }
37547
-
37548
- .visually-hidden,
37549
- .visually-hidden-focusable:not(:focus):not(:focus-within) {
37550
- border: 0 !important;
37551
- clip: rect(0, 0, 0, 0) !important;
37552
- height: 1px !important;
37553
- margin: -1px !important;
37554
- overflow: hidden !important;
37555
- padding: 0 !important;
37556
- white-space: nowrap !important;
37557
- width: 1px !important;
37558
- }
37559
-
37560
- .visually-hidden:not(caption),
37561
- .visually-hidden-focusable:not(:focus):not(:focus-within):not(caption) {
37562
- position: absolute !important;
37563
- }
37564
- `;
37565
-
37566
37116
  function CustomCaption(props) {
37567
37117
  const { goToMonth, nextMonth, previousMonth } = useNavigation();
37568
37118
  return (jsxs("div", { className: "custom__caption", children: [jsx("button", { className: "custom__caption__action__button", disabled: !previousMonth, onClick: (event) => {
@@ -37646,7 +37196,7 @@ const NoInputDatePicker = (props) => {
37646
37196
  onChange(range);
37647
37197
  }
37648
37198
  };
37649
- return (jsxs(StyledNoInputDatePicker, { className: className, "aria-label": ariaLabel || 'date select', "aria-describedby": `picker-label--${id}`, "data-cy": props['data-cy'], "data-testid": props['data-testid'], id: id, ref: datePickerRef, children: [label ? (jsx("div", { id: `picker-label--${id}`, className: "visually-hidden", children: label })) : null, jsx("div", { ref: popperRef, className: "no__input__date__picker-inputParent", children: jsx(Icon, { "aria-label": "Open date picker", name: triggerIcon, size: triggerIconSize, className: "date__picker__trigger", "data-testid": `datepicker-trigger-for-${id}`, onClick: () => setIsPopperOpen(!isPopperOpen) }) }), isPopperOpen && (jsx(FocusTrap$1, { active: isTrapActive, focusTrapOptions: {
37199
+ return (jsxs("div", { className: className, "aria-label": ariaLabel || 'date select', "aria-describedby": `picker-label--${id}`, "data-cy": props['data-cy'], "data-testid": props['data-testid'], id: id, ref: datePickerRef, children: [label ? (jsx("div", { id: `picker-label--${id}`, className: "visually-hidden", children: label })) : null, jsx("div", { ref: popperRef, className: "no__input__date__picker-inputParent", children: jsx(Icon, { "aria-label": "Open date picker", name: triggerIcon, size: triggerIconSize, className: "date__picker__trigger", "data-testid": `datepicker-trigger-for-${id}`, onClick: () => setIsPopperOpen(!isPopperOpen) }) }), isPopperOpen && (jsx(FocusTrap$1, { active: isTrapActive, focusTrapOptions: {
37650
37200
  initialFocus: false,
37651
37201
  allowOutsideClick: true,
37652
37202
  clickOutsideDeactivates: true,
@@ -39778,7 +39328,9 @@ function ModalBase(props) {
39778
39328
  if (describedBy) {
39779
39329
  ariaProps['describedby'] = describedBy;
39780
39330
  }
39781
- return (jsx(StyledModalBase, { ariaHideApp: false, "data-cy": props['data-cy'], aria: ariaProps, className: className || 'baseModal', contentLabel: 'labelText' in props ? props.labelText : null, id: id, isOpen: open, node: node, onRequestClose: clickToDismiss, shouldCloseOnEsc: !preventEscDismiss, shouldReturnFocusAfterClose: !preventReturnFocus, maxWidth: maxWidth, children: children }));
39331
+ // Try to render modal within the theme-root, otherwise attach to the root
39332
+ const parentSelector = () => document.getElementById('theme-root') || document.getElementById('root');
39333
+ return (jsx(StyledModalBase, { ariaHideApp: false, "data-cy": props['data-cy'], aria: ariaProps, className: className || 'baseModal', contentLabel: 'labelText' in props ? props.labelText : null, id: id, isOpen: open, node: node, onRequestClose: clickToDismiss, parentSelector: parentSelector, shouldCloseOnEsc: !preventEscDismiss, shouldReturnFocusAfterClose: !preventReturnFocus, maxWidth: maxWidth, children: children }));
39782
39334
  }
39783
39335
 
39784
39336
  const StyledStatusContainer = styled.div `