@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.js CHANGED
@@ -3199,9 +3199,7 @@ const Button$2 = (props) => {
3199
3199
  props.onClick(event);
3200
3200
  }
3201
3201
  };
3202
- return (jsxRuntime.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 && (jsxRuntime.jsx(Icon, { name: "fa-circle-notch", style: {
3203
- animation: 'spin 1s linear infinite',
3204
- }, className: "mr-2", ariaLabel: 'Loading...' })), iconPosition === 'left' && iconName && (jsxRuntime.jsx(Icon, { name: iconName, className: "mr-2", ariaLabel: `${iconName} Icon` })), children, iconPosition === 'right' && iconName && (jsxRuntime.jsx(Icon, { name: iconName, className: "ml-2", ariaLabel: `${iconName} Icon` }))] })));
3202
+ return (jsxRuntime.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 && (jsxRuntime.jsx(Icon, { name: "fa-circle-notch", style: { animation: 'spin 1s linear infinite' }, className: "mr-2", ariaLabel: "Loading..." })), !children && iconName && jsxRuntime.jsx(Icon, { name: iconName, ariaLabel: `${iconName} Icon` }), children && iconPosition === 'left' && iconName && (jsxRuntime.jsx(Icon, { name: iconName, className: "mr-2", ariaLabel: `${iconName} Icon` })), children, children && iconPosition === 'right' && iconName && (jsxRuntime.jsx(Icon, { name: iconName, className: "ml-2", ariaLabel: `${iconName} Icon` }))] })));
3205
3203
  };
3206
3204
 
3207
3205
  function ownKeys$2(object, enumerableOnly) {
@@ -37140,454 +37138,6 @@ const DatePicker = (props) => {
37140
37138
  }, children: jsxRuntime.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: jsxRuntime.jsx(DayPicker, { disabled: disabled, mode: "single", defaultMonth: localSelected, selected: localSelected, onSelect: handleDaySelect, fromDate: disableBeforeDate, toDate: disableAfterDate }) })) }))] }));
37141
37139
  };
37142
37140
 
37143
- const StyledNoInputDatePicker = styled__default.default.div `
37144
- /************************************
37145
- * 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)
37146
- *************************************/
37147
-
37148
- .rdp {
37149
- --rdp-cell-size: 40px;
37150
- --rdp-accent-color: #6833d0;
37151
- --rdp-background-color: #ffffff;
37152
- --rdp-accent-color-dark: #3003e1;
37153
- --rdp-background-color-dark: #180270;
37154
- --rdp-outline: 2px solid var(--rdp-accent-color); /* Outline border for focused elements */
37155
- --rdp-outline-selected: 3px solid var(--rdp-accent-color); /* Outline border for focused _and_ selected elements */
37156
-
37157
- margin: 1em;
37158
- }
37159
-
37160
- /* Hide elements for devices that are not screen readers */
37161
- .rdp-vhidden {
37162
- box-sizing: border-box;
37163
- padding: 0;
37164
- margin: 0;
37165
- background: transparent;
37166
- border: 0;
37167
- -moz-appearance: none;
37168
- -webkit-appearance: none;
37169
- appearance: none;
37170
- position: absolute !important;
37171
- top: 0;
37172
- width: 1px !important;
37173
- height: 1px !important;
37174
- padding: 0 !important;
37175
- overflow: hidden !important;
37176
- clip: rect(1px, 1px, 1px, 1px) !important;
37177
- border: 0 !important;
37178
- }
37179
-
37180
- /* Buttons */
37181
- .rdp-button_reset {
37182
- appearance: none;
37183
- position: relative;
37184
- margin: 0;
37185
- padding: 0;
37186
- cursor: default;
37187
- color: inherit;
37188
- background: none;
37189
- font: inherit;
37190
-
37191
- -moz-appearance: none;
37192
- -webkit-appearance: none;
37193
- }
37194
-
37195
- .rdp-button_reset:focus-visible {
37196
- /* Make sure to reset outline only when :focus-visible is supported */
37197
- outline: none;
37198
- }
37199
-
37200
- .rdp-button {
37201
- border: 2px solid transparent;
37202
- }
37203
-
37204
- .rdp-button[disabled]:not(.rdp-day_selected) {
37205
- opacity: 0.25;
37206
- }
37207
-
37208
- .rdp-button:not([disabled]) {
37209
- cursor: pointer;
37210
- }
37211
-
37212
- .rdp-button:focus-visible:not([disabled]) {
37213
- color: inherit;
37214
- background-color: var(--rdp-background-color);
37215
- border: var(--rdp-outline);
37216
- }
37217
-
37218
- .rdp-months {
37219
- display: flex;
37220
- }
37221
-
37222
- .rdp-month {
37223
- margin: 0 1em;
37224
- }
37225
-
37226
- .rdp-month:first-child {
37227
- margin-left: 0;
37228
- }
37229
-
37230
- .rdp-month:last-child {
37231
- margin-right: 0;
37232
- }
37233
-
37234
- .rdp-table {
37235
- margin: 0;
37236
- max-width: calc(var(--rdp-cell-size) * 7);
37237
- border-collapse: collapse;
37238
- }
37239
-
37240
- .rdp-with_weeknumber .rdp-table {
37241
- max-width: calc(var(--rdp-cell-size) * 8);
37242
- border-collapse: collapse;
37243
- }
37244
-
37245
- .rdp-caption {
37246
- display: flex;
37247
- align-items: center;
37248
- justify-content: space-between;
37249
- padding: 0;
37250
- text-align: left;
37251
- }
37252
-
37253
- .rdp-multiple_months .rdp-caption {
37254
- position: relative;
37255
- display: block;
37256
- text-align: center;
37257
- }
37258
-
37259
- .rdp-caption_dropdowns {
37260
- position: relative;
37261
- display: inline-flex;
37262
- }
37263
-
37264
- .rdp-caption_label {
37265
- position: relative;
37266
- z-index: 1;
37267
- display: inline-flex;
37268
- align-items: center;
37269
- margin: 0;
37270
- padding: 0 0.25em;
37271
- white-space: nowrap;
37272
- color: currentColor;
37273
- border: 0;
37274
- border: 2px solid transparent;
37275
- font-family: inherit;
37276
- font-size: 140%;
37277
- font-weight: bold;
37278
- }
37279
-
37280
- .rdp-nav {
37281
- white-space: nowrap;
37282
- }
37283
-
37284
- .rdp-multiple_months .rdp-caption_start .rdp-nav {
37285
- position: absolute;
37286
- top: 50%;
37287
- left: 0;
37288
- transform: translateY(-50%);
37289
- }
37290
-
37291
- .rdp-multiple_months .rdp-caption_end .rdp-nav {
37292
- position: absolute;
37293
- top: 50%;
37294
- right: 0;
37295
- transform: translateY(-50%);
37296
- }
37297
-
37298
- .rdp-nav_button {
37299
- display: inline-flex;
37300
- align-items: center;
37301
- justify-content: center;
37302
- width: var(--rdp-cell-size);
37303
- height: var(--rdp-cell-size);
37304
- padding: 0.25em;
37305
- border-radius: 100%;
37306
- }
37307
-
37308
- /* ---------- */
37309
- /* Dropdowns */
37310
- /* ---------- */
37311
-
37312
- .rdp-dropdown_year,
37313
- .rdp-dropdown_month {
37314
- position: relative;
37315
- display: inline-flex;
37316
- align-items: center;
37317
- }
37318
-
37319
- .rdp-dropdown {
37320
- appearance: none;
37321
- position: absolute;
37322
- z-index: 2;
37323
- top: 0;
37324
- bottom: 0;
37325
- left: 0;
37326
- width: 100%;
37327
- margin: 0;
37328
- padding: 0;
37329
- cursor: inherit;
37330
- opacity: 0;
37331
- border: none;
37332
- background-color: transparent;
37333
- font-family: inherit;
37334
- font-size: inherit;
37335
- line-height: inherit;
37336
- }
37337
-
37338
- .rdp-dropdown[disabled] {
37339
- opacity: unset;
37340
- color: unset;
37341
- }
37342
-
37343
- .rdp-dropdown:focus-visible:not([disabled]) + .rdp-caption_label {
37344
- background-color: var(--rdp-background-color);
37345
- border: var(--rdp-outline);
37346
- border-radius: 6px;
37347
- }
37348
-
37349
- .rdp-dropdown_icon {
37350
- margin: 0 0 0 5px;
37351
- }
37352
-
37353
- .rdp-head {
37354
- border: 0;
37355
- }
37356
-
37357
- .rdp-head_row,
37358
- .rdp-row {
37359
- height: 100%;
37360
- }
37361
-
37362
- .rdp-head_cell {
37363
- vertical-align: middle;
37364
- font-size: 0.75em;
37365
- font-weight: 700;
37366
- text-align: center;
37367
- height: 100%;
37368
- height: var(--rdp-cell-size);
37369
- padding: 0;
37370
- }
37371
-
37372
- .rdp-tbody {
37373
- border: 0;
37374
- }
37375
-
37376
- .rdp-tfoot {
37377
- margin: 0.5em;
37378
- }
37379
-
37380
- .rdp-cell {
37381
- width: var(--rdp-cell-size);
37382
- height: 100%;
37383
- height: var(--rdp-cell-size);
37384
- padding: 0;
37385
- text-align: center;
37386
- }
37387
-
37388
- .rdp-weeknumber {
37389
- font-size: 0.75em;
37390
- }
37391
-
37392
- .rdp-weeknumber,
37393
- .rdp-day {
37394
- display: flex;
37395
- overflow: hidden;
37396
- align-items: center;
37397
- justify-content: center;
37398
- box-sizing: border-box;
37399
- width: var(--rdp-cell-size);
37400
- max-width: var(--rdp-cell-size);
37401
- height: var(--rdp-cell-size);
37402
- margin: 0;
37403
- border: 2px solid transparent;
37404
- border-radius: 100%;
37405
- }
37406
-
37407
- .rdp-day_today:not(.rdp-day_outside) {
37408
- font-weight: bold;
37409
- }
37410
-
37411
- .rdp-day_selected,
37412
- .rdp-day_selected:focus-visible,
37413
- .rdp-day_selected:hover {
37414
- color: white;
37415
- opacity: 1;
37416
- background-color: var(--rdp-accent-color);
37417
- }
37418
-
37419
- .rdp-day_outside {
37420
- opacity: 0.5;
37421
- }
37422
-
37423
- .rdp-day_selected:focus-visible {
37424
- /* Since the background is the same use again the outline */
37425
- outline: var(--rdp-outline);
37426
- outline-offset: 2px;
37427
- z-index: 1;
37428
- }
37429
-
37430
- .rdp:not([dir='rtl']) .rdp-day_range_start:not(.rdp-day_range_end) {
37431
- border-top-right-radius: 0;
37432
- border-bottom-right-radius: 0;
37433
- }
37434
-
37435
- .rdp:not([dir='rtl']) .rdp-day_range_end:not(.rdp-day_range_start) {
37436
- border-top-left-radius: 0;
37437
- border-bottom-left-radius: 0;
37438
- }
37439
-
37440
- .rdp[dir='rtl'] .rdp-day_range_start:not(.rdp-day_range_end) {
37441
- border-top-left-radius: 0;
37442
- border-bottom-left-radius: 0;
37443
- }
37444
-
37445
- .rdp[dir='rtl'] .rdp-day_range_end:not(.rdp-day_range_start) {
37446
- border-top-right-radius: 0;
37447
- border-bottom-right-radius: 0;
37448
- }
37449
-
37450
- .rdp-day_range_end.rdp-day_range_start {
37451
- border-radius: 100%;
37452
- }
37453
-
37454
- .rdp-day_range_middle {
37455
- border-radius: 0;
37456
- }
37457
-
37458
- /*# sourceMappingURL=style.css.map */
37459
-
37460
- /******************************
37461
- * Indico Custom Styling For Insights
37462
- *******************************/
37463
- .rdp-button:hover:not([disabled]):not(.rdp-day_selected) {
37464
- background-color: #976cec;
37465
- }
37466
- .rdp-button,
37467
- .rdp-day {
37468
- box-shadow: none;
37469
- color: #000000;
37470
- &:hover {
37471
- background-color: #6833d0;
37472
- color: white;
37473
- }
37474
- }
37475
-
37476
- .rdp-head_cell,
37477
- .rdp-cell {
37478
- border: none;
37479
- }
37480
-
37481
- .DayPickerInput-Overlay {
37482
- border-radius: 4px;
37483
- z-index: 999;
37484
- .rdp {
37485
- background: white;
37486
- z-index: 999;
37487
- border: solid 1px #000000;
37488
- border-radius: 4px;
37489
- box-shadow: 0px 1px 10px 0px rgba(0, 0, 0, 0.4);
37490
- }
37491
- }
37492
-
37493
- .rdp-caption_label {
37494
- font-weight: 400;
37495
- font-size: 14px;
37496
- color: #000000;
37497
- }
37498
-
37499
- .rdp-day_today {
37500
- background-color: #dbd5e6;
37501
- color: #ffffff;
37502
- font-weight: 400;
37503
- }
37504
-
37505
- .rdp-button_reset {
37506
- &.rdp-button {
37507
- &.rdp-day {
37508
- &.rdp-day_selected {
37509
- background-color: #6833d0;
37510
- color: white;
37511
-
37512
- &:focus {
37513
- color: white;
37514
- }
37515
- &:active {
37516
- color: white;
37517
- }
37518
- }
37519
- }
37520
- }
37521
- }
37522
-
37523
- .rdp-head_cell {
37524
- color: #6833d0;
37525
- font-weight: 400;
37526
- }
37527
-
37528
- .date__picker__trigger {
37529
- color: #000000;
37530
- cursor: pointer;
37531
- }
37532
-
37533
- .custom__caption {
37534
- display: flex;
37535
- justify-content: space-between;
37536
- align-items: center;
37537
- padding: 15px 5px 15px 5px;
37538
-
37539
- .custom__caption__text {
37540
- font-size: 14px;
37541
- color: #000000;
37542
- margin: 0;
37543
- }
37544
-
37545
- .custom__caption__action__button {
37546
- background: none;
37547
- border: none;
37548
- cursor: pointer;
37549
- box-shadow: none;
37550
- padding: 0 5px 0 5px;
37551
-
37552
- border-radius: 60px;
37553
- color: #6833d0;
37554
- height: 20px;
37555
- width: 20px;
37556
-
37557
- &:hover {
37558
- background-color: #6833d0;
37559
- color: #ffffff;
37560
- border-radius: 20px;
37561
-
37562
- .rdp-nav_icon {
37563
- color: #ffffff;
37564
- }
37565
- }
37566
-
37567
- .rdp-nav_icon {
37568
- color: #6833d0;
37569
- }
37570
- }
37571
- }
37572
-
37573
- .visually-hidden,
37574
- .visually-hidden-focusable:not(:focus):not(:focus-within) {
37575
- border: 0 !important;
37576
- clip: rect(0, 0, 0, 0) !important;
37577
- height: 1px !important;
37578
- margin: -1px !important;
37579
- overflow: hidden !important;
37580
- padding: 0 !important;
37581
- white-space: nowrap !important;
37582
- width: 1px !important;
37583
- }
37584
-
37585
- .visually-hidden:not(caption),
37586
- .visually-hidden-focusable:not(:focus):not(:focus-within):not(caption) {
37587
- position: absolute !important;
37588
- }
37589
- `;
37590
-
37591
37141
  function CustomCaption(props) {
37592
37142
  const { goToMonth, nextMonth, previousMonth } = useNavigation();
37593
37143
  return (jsxRuntime.jsxs("div", { className: "custom__caption", children: [jsxRuntime.jsx("button", { className: "custom__caption__action__button", disabled: !previousMonth, onClick: (event) => {
@@ -37671,7 +37221,7 @@ const NoInputDatePicker = (props) => {
37671
37221
  onChange(range);
37672
37222
  }
37673
37223
  };
37674
- return (jsxRuntime.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 ? (jsxRuntime.jsx("div", { id: `picker-label--${id}`, className: "visually-hidden", children: label })) : null, jsxRuntime.jsx("div", { ref: popperRef, className: "no__input__date__picker-inputParent", children: jsxRuntime.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 && (jsxRuntime.jsx(FocusTrap$1, { active: isTrapActive, focusTrapOptions: {
37224
+ return (jsxRuntime.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 ? (jsxRuntime.jsx("div", { id: `picker-label--${id}`, className: "visually-hidden", children: label })) : null, jsxRuntime.jsx("div", { ref: popperRef, className: "no__input__date__picker-inputParent", children: jsxRuntime.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 && (jsxRuntime.jsx(FocusTrap$1, { active: isTrapActive, focusTrapOptions: {
37675
37225
  initialFocus: false,
37676
37226
  allowOutsideClick: true,
37677
37227
  clickOutsideDeactivates: true,
@@ -39803,7 +39353,9 @@ function ModalBase(props) {
39803
39353
  if (describedBy) {
39804
39354
  ariaProps['describedby'] = describedBy;
39805
39355
  }
39806
- return (jsxRuntime.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 }));
39356
+ // Try to render modal within the theme-root, otherwise attach to the root
39357
+ const parentSelector = () => document.getElementById('theme-root') || document.getElementById('root');
39358
+ return (jsxRuntime.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 }));
39807
39359
  }
39808
39360
 
39809
39361
  const StyledStatusContainer = styled__default.default.div `