@porsche-design-system/components-react 4.0.0-rc.1 → 4.0.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 (161) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/OSS_NOTICE +195 -855
  3. package/README.md +0 -5
  4. package/bin/patchRemixRunProcessBrowserGlobalIdentifier.js +0 -0
  5. package/cjs/lib/components/segmented-control.wrapper.cjs +3 -3
  6. package/esm/hooks.mjs +1 -1
  7. package/esm/lib/components/segmented-control.wrapper.d.ts +10 -0
  8. package/esm/lib/components/segmented-control.wrapper.mjs +3 -3
  9. package/esm/lib/types.d.ts +29 -25
  10. package/global-styles/cn/index.css +42 -39
  11. package/global-styles/color-scheme.css +24 -24
  12. package/global-styles/index.css +42 -39
  13. package/global-styles/variables.css +18 -15
  14. package/package.json +3 -3
  15. package/ssr/cjs/components/dist/styles/esm/styles-entry.cjs +497 -249
  16. package/ssr/cjs/components/dist/utils/esm/utils-entry.cjs +47 -12
  17. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/components/segmented-control.wrapper.cjs +4 -4
  18. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/accordion.cjs +1 -1
  19. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/banner.cjs +14 -9
  20. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/canvas.cjs +1 -1
  21. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/carousel.cjs +1 -1
  22. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/checkbox.cjs +3 -2
  23. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/drilldown-item.cjs +1 -1
  24. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/fieldset.cjs +1 -1
  25. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/flyout.cjs +1 -1
  26. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/inline-notification.cjs +13 -9
  27. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/input-base.cjs +3 -1
  28. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/modal.cjs +1 -1
  29. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/multi-select.cjs +4 -5
  30. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/notification-base.cjs +10 -0
  31. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/pin-code.cjs +5 -2
  32. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/popover.cjs +1 -1
  33. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/radio-group-option.cjs +1 -2
  34. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/radio-group.cjs +4 -2
  35. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/segmented-control-item.cjs +1 -1
  36. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/segmented-control.cjs +8 -4
  37. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/select.cjs +6 -5
  38. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/sheet.cjs +1 -1
  39. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/state-message.cjs +1 -3
  40. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/stepper-horizontal.cjs +1 -1
  41. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/switch.cjs +1 -1
  42. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/table.cjs +1 -1
  43. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/tabs-bar.cjs +4 -24
  44. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/tabs.cjs +1 -1
  45. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/textarea.cjs +4 -2
  46. package/ssr/esm/components/dist/styles/esm/styles-entry.mjs +497 -250
  47. package/ssr/esm/components/dist/utils/esm/utils-entry.mjs +45 -13
  48. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/hooks.mjs +1 -1
  49. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/components/segmented-control.wrapper.mjs +4 -4
  50. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/accordion.mjs +1 -1
  51. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/banner.mjs +14 -9
  52. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/button.mjs +1 -1
  53. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/canvas.mjs +1 -1
  54. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/carousel.mjs +1 -1
  55. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/checkbox.mjs +5 -4
  56. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/crest.mjs +1 -1
  57. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/drilldown-item.mjs +1 -1
  58. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/fieldset.mjs +1 -1
  59. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/flag.mjs +1 -1
  60. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/flyout.mjs +1 -1
  61. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/icon.mjs +1 -1
  62. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/inline-notification.mjs +13 -9
  63. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/input-base.mjs +4 -2
  64. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/link.mjs +1 -1
  65. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/modal.mjs +1 -1
  66. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/multi-select.mjs +5 -6
  67. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/notification-base.mjs +8 -0
  68. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/pin-code.mjs +6 -3
  69. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/popover.mjs +1 -1
  70. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/radio-group-option.mjs +1 -2
  71. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/radio-group.mjs +5 -3
  72. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/segmented-control-item.mjs +1 -1
  73. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/segmented-control.mjs +10 -6
  74. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/select.mjs +7 -6
  75. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/sheet.mjs +1 -1
  76. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/state-message.mjs +1 -3
  77. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/stepper-horizontal.mjs +1 -1
  78. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/switch.mjs +1 -1
  79. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/table.mjs +1 -1
  80. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/tabs-bar.mjs +4 -24
  81. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/tabs.mjs +1 -1
  82. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/textarea.mjs +5 -3
  83. package/ssr/esm/lib/components/segmented-control.wrapper.d.ts +10 -0
  84. package/ssr/esm/lib/dsr-components/accordion.d.ts +1 -0
  85. package/ssr/esm/lib/dsr-components/banner.d.ts +6 -2
  86. package/ssr/esm/lib/dsr-components/button-pure.d.ts +1 -0
  87. package/ssr/esm/lib/dsr-components/button-tile.d.ts +1 -0
  88. package/ssr/esm/lib/dsr-components/button.d.ts +1 -0
  89. package/ssr/esm/lib/dsr-components/canvas.d.ts +1 -0
  90. package/ssr/esm/lib/dsr-components/carousel.d.ts +1 -0
  91. package/ssr/esm/lib/dsr-components/checkbox.d.ts +1 -0
  92. package/ssr/esm/lib/dsr-components/crest.d.ts +1 -0
  93. package/ssr/esm/lib/dsr-components/display.d.ts +1 -0
  94. package/ssr/esm/lib/dsr-components/divider.d.ts +1 -0
  95. package/ssr/esm/lib/dsr-components/drilldown-item.d.ts +1 -0
  96. package/ssr/esm/lib/dsr-components/drilldown-link.d.ts +1 -0
  97. package/ssr/esm/lib/dsr-components/drilldown.d.ts +1 -0
  98. package/ssr/esm/lib/dsr-components/fieldset.d.ts +1 -0
  99. package/ssr/esm/lib/dsr-components/flag.d.ts +1 -0
  100. package/ssr/esm/lib/dsr-components/flyout.d.ts +1 -0
  101. package/ssr/esm/lib/dsr-components/heading.d.ts +1 -0
  102. package/ssr/esm/lib/dsr-components/icon.d.ts +1 -0
  103. package/ssr/esm/lib/dsr-components/inline-notification.d.ts +4 -2
  104. package/ssr/esm/lib/dsr-components/input-base.d.ts +1 -0
  105. package/ssr/esm/lib/dsr-components/input-date.d.ts +1 -0
  106. package/ssr/esm/lib/dsr-components/input-email.d.ts +1 -0
  107. package/ssr/esm/lib/dsr-components/input-month.d.ts +1 -0
  108. package/ssr/esm/lib/dsr-components/input-number.d.ts +1 -0
  109. package/ssr/esm/lib/dsr-components/input-password.d.ts +1 -0
  110. package/ssr/esm/lib/dsr-components/input-search.d.ts +1 -0
  111. package/ssr/esm/lib/dsr-components/input-tel.d.ts +1 -0
  112. package/ssr/esm/lib/dsr-components/input-text.d.ts +1 -0
  113. package/ssr/esm/lib/dsr-components/input-time.d.ts +1 -0
  114. package/ssr/esm/lib/dsr-components/input-url.d.ts +1 -0
  115. package/ssr/esm/lib/dsr-components/input-week.d.ts +1 -0
  116. package/ssr/esm/lib/dsr-components/label.d.ts +1 -0
  117. package/ssr/esm/lib/dsr-components/link-pure.d.ts +1 -0
  118. package/ssr/esm/lib/dsr-components/link-tile-product.d.ts +1 -0
  119. package/ssr/esm/lib/dsr-components/link-tile.d.ts +1 -0
  120. package/ssr/esm/lib/dsr-components/link.d.ts +1 -0
  121. package/ssr/esm/lib/dsr-components/modal.d.ts +1 -0
  122. package/ssr/esm/lib/dsr-components/model-signature.d.ts +1 -0
  123. package/ssr/esm/lib/dsr-components/multi-select-option.d.ts +1 -0
  124. package/ssr/esm/lib/dsr-components/multi-select.d.ts +1 -0
  125. package/ssr/esm/lib/dsr-components/notification-base.d.ts +14 -0
  126. package/ssr/esm/lib/dsr-components/optgroup.d.ts +1 -0
  127. package/ssr/esm/lib/dsr-components/pagination.d.ts +1 -0
  128. package/ssr/esm/lib/dsr-components/pin-code.d.ts +1 -0
  129. package/ssr/esm/lib/dsr-components/popover.d.ts +1 -0
  130. package/ssr/esm/lib/dsr-components/radio-group-option.d.ts +1 -0
  131. package/ssr/esm/lib/dsr-components/radio-group.d.ts +1 -0
  132. package/ssr/esm/lib/dsr-components/scroller.d.ts +1 -0
  133. package/ssr/esm/lib/dsr-components/segmented-control-item.d.ts +1 -0
  134. package/ssr/esm/lib/dsr-components/segmented-control.d.ts +1 -0
  135. package/ssr/esm/lib/dsr-components/select-option.d.ts +1 -0
  136. package/ssr/esm/lib/dsr-components/select.d.ts +1 -0
  137. package/ssr/esm/lib/dsr-components/sheet.d.ts +1 -0
  138. package/ssr/esm/lib/dsr-components/spinner.d.ts +1 -0
  139. package/ssr/esm/lib/dsr-components/stepper-horizontal-item.d.ts +1 -0
  140. package/ssr/esm/lib/dsr-components/stepper-horizontal.d.ts +1 -0
  141. package/ssr/esm/lib/dsr-components/switch.d.ts +1 -0
  142. package/ssr/esm/lib/dsr-components/table-body.d.ts +1 -0
  143. package/ssr/esm/lib/dsr-components/table-cell.d.ts +1 -0
  144. package/ssr/esm/lib/dsr-components/table-head-cell.d.ts +1 -0
  145. package/ssr/esm/lib/dsr-components/table-head-row.d.ts +1 -0
  146. package/ssr/esm/lib/dsr-components/table-head.d.ts +1 -0
  147. package/ssr/esm/lib/dsr-components/table-row.d.ts +1 -0
  148. package/ssr/esm/lib/dsr-components/table.d.ts +1 -0
  149. package/ssr/esm/lib/dsr-components/tabs-bar.d.ts +1 -0
  150. package/ssr/esm/lib/dsr-components/tabs-item.d.ts +1 -0
  151. package/ssr/esm/lib/dsr-components/tabs.d.ts +1 -0
  152. package/ssr/esm/lib/dsr-components/tag-dismissible.d.ts +1 -0
  153. package/ssr/esm/lib/dsr-components/tag.d.ts +1 -0
  154. package/ssr/esm/lib/dsr-components/text-list-item.d.ts +1 -0
  155. package/ssr/esm/lib/dsr-components/text-list.d.ts +1 -0
  156. package/ssr/esm/lib/dsr-components/text.d.ts +1 -0
  157. package/ssr/esm/lib/dsr-components/textarea.d.ts +1 -0
  158. package/ssr/esm/lib/dsr-components/toast.d.ts +1 -0
  159. package/ssr/esm/lib/dsr-components/wordmark.d.ts +1 -0
  160. package/ssr/esm/lib/types.d.ts +29 -25
  161. package/tailwindcss/index.css +277 -78
@@ -3187,7 +3187,7 @@ var jssPluginSortMediaQueries = /*@__PURE__*/getDefaultExportFromCjs(distExports
3187
3187
  const getTagName = (el) => el.tagName.toLowerCase();
3188
3188
  const getTagNameWithoutPrefix = (host) => {
3189
3189
  const tagName = getTagName(host);
3190
- const [, tagNameWithoutPrefix = ''] = /^(?:[a-z-]+-)?(p-[a-z-]+)$/.exec(tagName) || [];
3190
+ const [, tagNameWithoutPrefix = ''] = /^(?:[a-z0-9-]+-)?(p-[a-z-]+)$/.exec(tagName) || [];
3191
3191
  return (tagNameWithoutPrefix || tagName); // return tagName as fallback for default tags
3192
3192
  };
3193
3193
 
@@ -3252,21 +3252,38 @@ const parseAndGetAriaAttributes = (rawAttributes) => {
3252
3252
  }
3253
3253
  return undefined;
3254
3254
  };
3255
+ /**
3256
+ * Builds a space-separated IDREF string from conditional ID entries.
3257
+ * Returns `null` when no IDs are truthy — safe for JSX attribute assignment.
3258
+ */
3259
+ const setAriaIDREF = (...ids) => {
3260
+ const result = ids.filter(Boolean).join(' ');
3261
+ return result || null;
3262
+ };
3255
3263
 
3256
3264
  const getButtonBaseAriaAttributes = (isDisabled, isLoading) => {
3257
3265
  return {
3258
3266
  'aria-disabled': isDisabledOrLoading(isDisabled, isLoading) ? 'true' : null,
3259
3267
  };
3260
3268
  };
3261
- // TODO: Can this be shared with select-wrapper dropdown?
3262
- const getComboboxAriaAttributes = (isOpen, isRequired, labelId, descriptionId, dropdownId) => {
3269
+
3270
+ const getComboboxAriaAttributes = (isOpen, isRequired, labelId, messageId, descriptionId, listboxId) => {
3263
3271
  return {
3264
3272
  'aria-labelledby': labelId || null,
3265
- 'aria-describedby': descriptionId || null,
3273
+ 'aria-describedby': setAriaIDREF(messageId, descriptionId),
3266
3274
  'aria-haspopup': 'listbox',
3267
3275
  'aria-expanded': isOpen ? 'true' : 'false',
3268
3276
  'aria-required': isRequired ? 'true' : 'false',
3269
- 'aria-controls': dropdownId,
3277
+ 'aria-controls': listboxId || null,
3278
+ };
3279
+ };
3280
+ const getListboxAriaAttributes = (isRequired, labelId, messageId, descriptionId, multiselectable) => {
3281
+ return {
3282
+ role: 'listbox',
3283
+ 'aria-labelledby': labelId || null,
3284
+ 'aria-describedby': setAriaIDREF(messageId, descriptionId),
3285
+ 'aria-required': isRequired ? 'true' : 'false',
3286
+ 'aria-multiselectable': multiselectable ? 'true' : 'false',
3270
3287
  };
3271
3288
  };
3272
3289
 
@@ -3437,7 +3454,7 @@ const hasShowPickerSupport = () => (hasDocument &&
3437
3454
  'showPicker' in HTMLInputElement.prototype &&
3438
3455
  CSS.supports('selector(::-webkit-calendar-picker-indicator)'));
3439
3456
 
3440
- const prefix = `[Porsche Design System v${"4.0.0-rc.1"}]` // this part isn't covered by unit tests
3457
+ const prefix = `[Porsche Design System v${"4.0.0"}]` // this part isn't covered by unit tests
3441
3458
  ;
3442
3459
  const consoleError$1 = (...messages) => {
3443
3460
  console.error(prefix, ...messages);
@@ -3558,13 +3575,12 @@ const internalValidateProps = {
3558
3575
  const breakpointCustomizableTemplate = `value, ${internalValidateProps
3559
3576
  .formatObjectOutput(breakpoints.reduce((prev, key) => ({ ...prev, [key + (key !== 'base' ? '?' : '')]: 'value' }), {}))
3560
3577
  .replace(/"/g, '')}`;
3561
- const getBannerAriaAttributes = (state, labelId, descriptionId) => {
3578
+ const getBannerAriaAttributes = (state, heading) => {
3562
3579
  const isAlert = state === 'warning' || state === 'error';
3563
3580
  return {
3564
3581
  role: isAlert ? 'alert' : 'status',
3565
3582
  'aria-live': isAlert ? 'assertive' : 'polite',
3566
- 'aria-labelledby': labelId,
3567
- 'aria-describedby': descriptionId,
3583
+ 'aria-label': heading || null,
3568
3584
  };
3569
3585
  };
3570
3586
  const getButtonPureAriaAttributes = (isDisabled, isLoading, aria) => {
@@ -3715,13 +3731,12 @@ const buildIconUrl = (iconNameOrSource = DEFAULT_ICON_NAME) => {
3715
3731
  }
3716
3732
  return buildIconUrl(DEFAULT_ICON_NAME);
3717
3733
  };
3718
- const getInlineNotificationAriaAttributes = (state, labelId, descriptionId) => {
3734
+ const getInlineNotificationAriaAttributes = (state, heading) => {
3719
3735
  const isAlert = state === 'warning' || state === 'error';
3720
3736
  return {
3721
3737
  role: isAlert ? 'alert' : 'status',
3722
3738
  'aria-live': isAlert ? 'assertive' : 'polite',
3723
- 'aria-labelledby': labelId,
3724
- 'aria-describedby': descriptionId,
3739
+ 'aria-label': heading || null,
3725
3740
  };
3726
3741
  };
3727
3742
  const getSvgUrl = (model) => {
@@ -3888,6 +3903,23 @@ const getSwitchButtonAriaAttributes = (isDisabled, isLoading, isChecked) => {
3888
3903
  const isSortable = (active, direction) => {
3889
3904
  return active !== undefined && direction !== undefined;
3890
3905
  };
3906
+ /**
3907
+ * Clamps and validates a tab index against the available tabs array.
3908
+ * Returns `undefined` if the index is out of range or invalid.
3909
+ * @internal
3910
+ */
3911
+ const getSanitizedActiveTabIndex = (tabIndex, tabs) => {
3912
+ const maxIndex = tabs.length - 1; // can be -1 without children
3913
+ if (tabIndex === undefined ||
3914
+ tabIndex === null ||
3915
+ !Number.isInteger(tabIndex) ||
3916
+ maxIndex < 0 ||
3917
+ tabIndex < 0 ||
3918
+ tabIndex > maxIndex) {
3919
+ return undefined;
3920
+ }
3921
+ return tabIndex;
3922
+ };
3891
3923
  const isListTypeOrdered = (type) => {
3892
3924
  return type !== 'unordered';
3893
3925
  };
@@ -3929,6 +3961,8 @@ exports.getHTMLElement = getHTMLElement;
3929
3961
  exports.getHasNativePopoverSupport = getHasNativePopoverSupport;
3930
3962
  exports.getHeadingTagType = getHeadingTagType;
3931
3963
  exports.getInlineNotificationAriaAttributes = getInlineNotificationAriaAttributes;
3964
+ exports.getListboxAriaAttributes = getListboxAriaAttributes;
3965
+ exports.getSanitizedActiveTabIndex = getSanitizedActiveTabIndex;
3932
3966
  exports.getSegmentedControlItemAriaAttributes = getSegmentedControlItemAriaAttributes;
3933
3967
  exports.getStepperHorizontalIconName = getStepperHorizontalIconName;
3934
3968
  exports.getSvgUrl = getSvgUrl;
@@ -3956,6 +3990,7 @@ exports.labelId = labelId;
3956
3990
  exports.observedNodesMap = observedNodesMap;
3957
3991
  exports.parseAndGetAriaAttributes = parseAndGetAriaAttributes;
3958
3992
  exports.parseJSONAttribute = parseJSONAttribute;
3993
+ exports.setAriaIDREF = setAriaIDREF;
3959
3994
  exports.supportsConstructableStylesheets = supportsConstructableStylesheets;
3960
3995
  exports.supportsNativePopover = supportsNativePopover;
3961
3996
  exports.tempDiv = tempDiv;
@@ -7,22 +7,22 @@ var hooks = require('../../hooks.cjs');
7
7
  var utils = require('../../utils.cjs');
8
8
  var segmentedControl = require('../dsr-components/segmented-control.cjs');
9
9
 
10
- const PSegmentedControl = /*#__PURE__*/ react.forwardRef(({ columns = 'auto', compact = false, description = '', disabled = false, form, hideLabel = false, label = '', message = '', name, onBlur, onChange, required = false, state = 'none', value, className, children, ...rest }, ref) => {
10
+ const PSegmentedControl = /*#__PURE__*/ react.forwardRef(({ columns = 'auto', compact = false, description = '', disabled = false, form, hideLabel = false, label = '', message = '', name, noWrap = false, onBlur, onChange, required = false, state = 'none', value, className, children, ...rest }, ref) => {
11
11
  const elementRef = react.useRef(undefined);
12
12
  hooks.useEventCallback(elementRef, 'blur', onBlur);
13
13
  hooks.useEventCallback(elementRef, 'change', onChange);
14
14
  const WebComponentTag = hooks.usePrefix('p-segmented-control');
15
- const propsToSync = [columns, compact, description, disabled, form, hideLabel, label, message, name, required, state, value];
15
+ const propsToSync = [columns, compact, description, disabled, form, hideLabel, label, message, name, noWrap, required, state, value];
16
16
  hooks.useBrowserLayoutEffect(() => {
17
17
  const { current } = elementRef;
18
- ['columns', 'compact', 'description', 'disabled', 'form', 'hideLabel', 'label', 'message', 'name', 'required', 'state', 'value'].forEach((propName, i) => (current[propName] = propsToSync[i]));
18
+ ['columns', 'compact', 'description', 'disabled', 'form', 'hideLabel', 'label', 'message', 'name', 'noWrap', 'required', 'state', 'value'].forEach((propName, i) => (current[propName] = propsToSync[i]));
19
19
  }, propsToSync);
20
20
  const props = {
21
21
  ...rest,
22
22
  // @ts-ignore
23
23
  ...(!process.browser
24
24
  ? {
25
- children: (jsxRuntime.jsx(segmentedControl.DSRSegmentedControl, { columns, compact, description, disabled, form, hideLabel, label, message, name, required, state, value, children })),
25
+ children: (jsxRuntime.jsx(segmentedControl.DSRSegmentedControl, { columns, compact, description, disabled, form, hideLabel, label, message, name, noWrap, required, state, value, children })),
26
26
  }
27
27
  : {
28
28
  children,
@@ -21,7 +21,7 @@ class DSRAccordion extends react.Component {
21
21
  hasSummaryBefore;
22
22
  hasSummaryAfter;
23
23
  render() {
24
- const { namedSlotChildren} = splitChildren.splitChildren(this.props.children);
24
+ const { children, namedSlotChildren, otherChildren } = splitChildren.splitChildren(this.props.children);
25
25
  const hasSummary = namedSlotChildren.filter(({ props: { slot } }) => slot === 'summary').length > 0;
26
26
  const hasSummaryBefore = namedSlotChildren.filter(({ props: { slot } }) => slot === 'summary-before').length > 0;
27
27
  const hasSummaryAfter = namedSlotChildren.filter(({ props: { slot } }) => slot === 'summary-after').length > 0;
@@ -7,11 +7,13 @@ var splitChildren = require('../../splitChildren.cjs');
7
7
  var minifyCss = require('../../minifyCss.cjs');
8
8
  var stylesEntry = require('../../../../../../components/dist/styles/esm/styles-entry.cjs');
9
9
  var utilsEntry = require('../../../../../../components/dist/utils/esm/utils-entry.cjs');
10
+ var notificationBase = require('./notification-base.cjs');
10
11
  var button_wrapper = require('../components/button.wrapper.cjs');
11
12
 
12
13
  /**
13
- * @slot {"name": "heading", "description": "Defines the heading used in the banner. Can be used alternatively to the heading prop. Can be used for rich content.", "hasAltProp": true }
14
- * @slot {"name": "description", "description": "Defines the description used in the banner. Can be used alternatively to the description prop. Can be used for rich content.", "hasAltProp": true }
14
+ * @slot {"name": "heading", "description": "Defines the heading of the banner. Can be used as an alternative to the `heading` prop for rich content." }
15
+ * @slot {"name": "", "description": "Default slot for the banner description content." }
16
+ * @slot {"name": "description", "description": "Deprecated: Use the default slot instead.", "isDeprecated": true }
15
17
  *
16
18
  * @controlled {"props": ["open"], "event": "dismiss"}
17
19
  */
@@ -19,14 +21,17 @@ class DSRBanner extends react.Component {
19
21
  host;
20
22
  refPopover;
21
23
  refDismiss;
24
+ hasHeadingSlot;
25
+ hasDescriptionSlot;
22
26
  render() {
23
- splitChildren.splitChildren(this.props.children);
24
- const bannerId = 'banner';
25
- const labelId = 'heading';
26
- const descriptionId = 'description';
27
- const Heading = this.props.headingTag;
28
- const style = minifyCss.minifyCss(stylesEntry.getBannerCss(this.props.open, this.props.position, this.props.state, this.props.dismissButton));
29
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsx("div", { id: bannerId, popover: "manual", "aria-hidden": this.props.open ? 'false' : 'true', ...utilsEntry.getBannerAriaAttributes(this.props.state, labelId, descriptionId), children: jsxRuntime.jsxs("div", { className: "banner", children: [this.props.heading ? jsxRuntime.jsx(Heading, { id: labelId, children: this.props.heading }) : jsxRuntime.jsx("slot", { name: "heading" }), this.props.description ? jsxRuntime.jsx("p", { id: descriptionId, children: this.props.description }) : jsxRuntime.jsx("slot", { name: "description" }), this.props.dismissButton && (jsxRuntime.jsx(button_wrapper.PButton, { className: "dismiss", type: "button", variant: "secondary", icon: "close", hideLabel: true, compact: true, "aria-controls": bannerId, children: "Close banner" }))] }) })] }), this.props.children] }));
27
+ const { children, namedSlotChildren, otherChildren } = splitChildren.splitChildren(this.props.children);
28
+ const hasHeadingSlot = namedSlotChildren.filter(({ props: { slot } }) => slot === 'heading').length > 0;
29
+ const hasDescriptionSlot = namedSlotChildren.filter(({ props: { slot } }) => slot === 'description').length > 0;
30
+ const headingText = this.props.heading ? this.props.heading : namedSlotChildren.find(({ props: { slot } }) => slot === 'heading')?.props.children;
31
+ const style = minifyCss.minifyCss(stylesEntry.getBannerCss(this.props.open, this.props.position, this.props.state, this.props.dismissButton, !!(this.props.heading || hasHeadingSlot)));
32
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsx("div", { popover: "manual", "aria-hidden": this.props.open ? 'false' : 'true', ...utilsEntry.getBannerAriaAttributes(this.props.state, headingText), children: jsxRuntime.jsx(notificationBase.NotificationBase, { heading: this.props.heading, headingTag: this.props.headingTag, hasHeadingSlot: hasHeadingSlot, description: this.props.description, hasDescriptionSlot: hasDescriptionSlot, ...(this.props.dismissButton && {
33
+ dismissButton: (jsxRuntime.jsx(button_wrapper.PButton, { className: "dismiss", type: "button", variant: "secondary", icon: "close", hideLabel: true, compact: true, ...(headingText ? { aria: { 'aria-description': headingText } } : {}), children: "Close banner" })),
34
+ }) }) })] }), this.props.children] }));
30
35
  }
31
36
  }
32
37
 
@@ -30,7 +30,7 @@ class DSRCanvas extends react.Component {
30
30
  hasFooter;
31
31
  hasBackground;
32
32
  render() {
33
- const { namedSlotChildren} = splitChildren.splitChildren(this.props.children);
33
+ const { children, namedSlotChildren, otherChildren } = splitChildren.splitChildren(this.props.children);
34
34
  const hasTitle = namedSlotChildren.filter(({ props: { slot } }) => slot === 'title').length > 0;
35
35
  const hasSidebarEnd = namedSlotChildren.filter(({ props: { slot } }) => slot === 'sidebar-end').length > 0;
36
36
  const hasFooter = namedSlotChildren.filter(({ props: { slot } }) => slot === 'footer').length > 0;
@@ -34,7 +34,7 @@ class DSRCarousel extends react.Component {
34
34
  return this.props.slidesPerPage === 'auto' || this.props.amountOfPages > 1;
35
35
  }
36
36
  render() {
37
- const { namedSlotChildren, otherChildren } = splitChildren.splitChildren(this.props.children);
37
+ const { children, namedSlotChildren, otherChildren } = splitChildren.splitChildren(this.props.children);
38
38
  const hasHeadingPropOrSlot = (this.props.heading || namedSlotChildren.filter(({ props: { slot } }) => slot === 'heading').length > 0);
39
39
  const hasDescriptionPropOrSlot = (this.props.description || namedSlotChildren.filter(({ props: { slot } }) => slot === 'description').length > 0);
40
40
  const hasControlsSlot = namedSlotChildren.filter(({ props: { slot } }) => slot === 'controls').length > 0;
@@ -35,10 +35,11 @@ class DSRCheckbox extends react.Component {
35
35
  formStateRestoreCallback() {
36
36
  }
37
37
  render() {
38
- const { namedSlotChildren} = splitChildren.splitChildren(this.props.children);
38
+ const { children, namedSlotChildren, otherChildren } = splitChildren.splitChildren(this.props.children);
39
+ const selectMessageId = (this.props.message || namedSlotChildren.filter(({ props: { slot } }) => slot === 'message').length > 0) && ['success', 'error'].includes(this.props.state) ? stateMessage.messageId : undefined;
39
40
  const id = 'x';
40
41
  const style = minifyCss.minifyCss(stylesEntry.getCheckboxCss(this.props.hideLabel, this.props.state, this.props.disabled, this.props.loading, this.props.compact));
41
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", shadowrootdelegatesfocus: "true", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsxs("div", { className: "root", children: [jsxRuntime.jsxs("div", { className: "wrapper", children: [jsxRuntime.jsxs("div", { className: "input-wrapper", children: [jsxRuntime.jsx("input", { type: "checkbox", id: id, "aria-describedby": `${utilsEntry.descriptionId} ${stateMessage.messageId}`, "aria-invalid": this.props.state === 'error' ? 'true' : null, "aria-disabled": this.props.loading || this.props.disabled ? 'true' : null, checked: this.props.checked, form: this.props.form, value: this.props.value, name: this.props.name, onBlur: this.props.onBlur, required: this.props.required, disabled: this.props.disabled }), this.props.loading && jsxRuntime.jsx(spinner_wrapper.PSpinner, { className: "spinner", "aria-hidden": "true" })] }), jsxRuntime.jsx(label.Label, { hasLabel: this.props.label || namedSlotChildren.filter(({ props: { slot } }) => slot === 'label').length > 0, hasDescription: this.props.description || namedSlotChildren.filter(({ props: { slot } }) => slot === 'description').length > 0, host: null, htmlFor: id, label: this.props.label, isLoading: this.props.loading, isDisabled: this.props.disabled, isRequired: this.props.required })] }), jsxRuntime.jsx(stateMessage.StateMessage, { hasMessage: (this.props.message || namedSlotChildren.filter(({ props: { slot } }) => slot === 'message').length > 0) && ['success', 'error'].includes(this.props.state), state: this.props.state, message: this.props.message, host: null }), jsxRuntime.jsx(loadingMessage.LoadingMessage, { loading: this.props.loading, initialLoading: this.props.initialLoading })] })] }), this.props.children] }));
42
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", shadowrootdelegatesfocus: "true", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsxs("div", { className: "root", children: [jsxRuntime.jsxs("div", { className: "wrapper", children: [jsxRuntime.jsxs("div", { className: "input-wrapper", children: [jsxRuntime.jsx("input", { type: "checkbox", id: id, "aria-describedby": utilsEntry.setAriaIDREF(this.props.loading && loadingMessage.loadingId, selectMessageId), "aria-invalid": this.props.state === 'error' ? 'true' : null, "aria-disabled": this.props.loading || this.props.disabled ? 'true' : null, checked: this.props.checked, form: this.props.form, value: this.props.value, name: this.props.name, onBlur: this.props.onBlur, required: this.props.required, disabled: this.props.disabled }), this.props.loading && jsxRuntime.jsx(spinner_wrapper.PSpinner, { className: "spinner", "aria-hidden": "true" })] }), jsxRuntime.jsx(label.Label, { hasLabel: this.props.label || namedSlotChildren.filter(({ props: { slot } }) => slot === 'label').length > 0, hasDescription: this.props.description || namedSlotChildren.filter(({ props: { slot } }) => slot === 'description').length > 0, host: null, htmlFor: id, label: this.props.label, isLoading: this.props.loading, isDisabled: this.props.disabled, isRequired: this.props.required })] }), jsxRuntime.jsx(stateMessage.StateMessage, { hasMessage: (this.props.message || namedSlotChildren.filter(({ props: { slot } }) => slot === 'message').length > 0) && ['success', 'error'].includes(this.props.state), state: this.props.state, message: this.props.message, host: null }), jsxRuntime.jsx(loadingMessage.LoadingMessage, { loading: this.props.loading, initialLoading: this.props.initialLoading })] })] }), this.props.children] }));
42
43
  }
43
44
  }
44
45
 
@@ -20,7 +20,7 @@ class DSRDrilldownItem extends react.Component {
20
20
  hasSlottedHeader;
21
21
  hasSlottedButton;
22
22
  render() {
23
- const { namedSlotChildren} = splitChildren.splitChildren(this.props.children);
23
+ const { children, namedSlotChildren, otherChildren } = splitChildren.splitChildren(this.props.children);
24
24
  const hasSlottedHeader = namedSlotChildren.filter(({ props: { slot } }) => slot === 'header').length > 0;
25
25
  const hasSlottedButton = namedSlotChildren.filter(({ props: { slot } }) => slot === 'button').length > 0;
26
26
  const style = minifyCss.minifyCss(stylesEntry.getDrilldownItemCss(this.props.primary, this.props.secondary, this.props.cascade));
@@ -17,7 +17,7 @@ var stateMessage = require('./state-message.cjs');
17
17
  class DSRFieldset extends react.Component {
18
18
  host;
19
19
  render() {
20
- const { namedSlotChildren} = splitChildren.splitChildren(this.props.children);
20
+ const { children, namedSlotChildren, otherChildren } = splitChildren.splitChildren(this.props.children);
21
21
  const hasMessageValue = (this.props.message || namedSlotChildren.filter(({ props: { slot } }) => slot === 'message').length > 0) && ['success', 'error'].includes(this.props.state);
22
22
  const style = minifyCss.minifyCss(stylesEntry.getFieldsetCss(this.props.state, this.props.labelSize, (this.props.label || namedSlotChildren.filter(({ props: { slot } }) => slot === 'label').length > 0)));
23
23
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsxs("fieldset", { "aria-describedby": hasMessageValue ? stateMessage.messageId : null, ...utilsEntry.getFieldsetAriaAttributes(this.props.required, this.props.state === 'error', this.props.aria), children: [(this.props.label || namedSlotChildren.filter(({ props: { slot } }) => slot === 'label').length > 0) && (jsxRuntime.jsxs("legend", { children: [this.props.label || jsxRuntime.jsx("slot", { name: "label" }), this.props.required && jsxRuntime.jsx(required.Required, {})] })), jsxRuntime.jsx("slot", {}), jsxRuntime.jsx(stateMessage.StateMessage, { hasMessage: (this.props.message || namedSlotChildren.filter(({ props: { slot } }) => slot === 'message').length > 0) && ['success', 'error'].includes(this.props.state), state: this.props.state, message: this.props.message, host: null })] })] }), this.props.children] }));
@@ -27,7 +27,7 @@ class DSRFlyout extends react.Component {
27
27
  hasFooter;
28
28
  hasSubFooter;
29
29
  render() {
30
- const { namedSlotChildren} = splitChildren.splitChildren(this.props.children);
30
+ const { children, namedSlotChildren, otherChildren } = splitChildren.splitChildren(this.props.children);
31
31
  const hasHeader = namedSlotChildren.filter(({ props: { slot } }) => slot === 'header').length > 0;
32
32
  const hasFooter = namedSlotChildren.filter(({ props: { slot } }) => slot === 'footer').length > 0;
33
33
  const hasSubFooter = namedSlotChildren.filter(({ props: { slot } }) => slot === 'sub-footer').length > 0;
@@ -7,23 +7,27 @@ var splitChildren = require('../../splitChildren.cjs');
7
7
  var minifyCss = require('../../minifyCss.cjs');
8
8
  var stylesEntry = require('../../../../../../components/dist/styles/esm/styles-entry.cjs');
9
9
  var utilsEntry = require('../../../../../../components/dist/utils/esm/utils-entry.cjs');
10
+ var notificationBase = require('./notification-base.cjs');
10
11
  var button_wrapper = require('../components/button.wrapper.cjs');
11
12
  var buttonPure_wrapper = require('../components/button-pure.wrapper.cjs');
12
13
 
13
14
  /**
14
- * @slot {"name": "heading", "description": "Shows a heading. Can be used to render rich markup." }
15
- * @slot {"name": "", "description": "Default slot to render a description. Can be used to render rich markup." }
15
+ * @slot {"name": "heading", "description": "Defines the heading of the inline notification. Can be used as an alternative to the `heading` prop for rich content." }
16
+ * @slot {"name": "", "description": "Default slot for the inline notification description content." }
16
17
  */
17
18
  class DSRInlineNotification extends react.Component {
18
19
  host;
20
+ hasHeadingSlot;
19
21
  render() {
20
- splitChildren.splitChildren(this.props.children);
21
- const notificationId = 'notification';
22
- const labelId = 'heading';
23
- const descriptionId = 'description';
24
- const Heading = this.props.headingTag;
25
- const style = minifyCss.minifyCss(stylesEntry.getInlineNotificationCss(this.props.state, !!this.props.actionLabel, this.props.dismissButton));
26
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsxs("div", { id: notificationId, className: "notification", ...utilsEntry.getInlineNotificationAriaAttributes(this.props.state, labelId, descriptionId), children: [this.props.heading ? jsxRuntime.jsx(Heading, { id: labelId, children: this.props.heading }) : jsxRuntime.jsx("slot", { name: "heading" }), this.props.description ? jsxRuntime.jsx("p", { id: descriptionId, children: this.props.description }) : jsxRuntime.jsx("slot", {}), this.props.actionLabel && (jsxRuntime.jsx(buttonPure_wrapper.PButtonPure, { className: "action", icon: this.props.actionIcon, loading: this.props.actionLoading, children: this.props.actionLabel })), this.props.dismissButton && (jsxRuntime.jsx(button_wrapper.PButton, { className: "dismiss", type: "button", variant: "secondary", icon: "close", hideLabel: true, compact: true, "aria-controls": notificationId, children: "Close notification" }))] })] }), this.props.children] }));
22
+ const { children, namedSlotChildren, otherChildren } = splitChildren.splitChildren(this.props.children);
23
+ const hasHeadingSlot = namedSlotChildren.filter(({ props: { slot } }) => slot === 'heading').length > 0;
24
+ const headingText = this.props.heading ? this.props.heading : namedSlotChildren.find(({ props: { slot } }) => slot === 'heading')?.props.children;
25
+ const style = minifyCss.minifyCss(stylesEntry.getInlineNotificationCss(this.props.state, !!this.props.actionLabel, this.props.dismissButton, !!(this.props.heading || hasHeadingSlot)));
26
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsx(notificationBase.NotificationBase, { ...utilsEntry.getInlineNotificationAriaAttributes(this.props.state, headingText), heading: this.props.heading, headingTag: this.props.headingTag, hasHeadingSlot: hasHeadingSlot, description: this.props.description, ...(this.props.actionLabel && {
27
+ actionLabel: (jsxRuntime.jsx(buttonPure_wrapper.PButtonPure, { className: "action", icon: this.props.actionIcon, loading: this.props.actionLoading, children: this.props.actionLabel })),
28
+ }), ...(this.props.dismissButton && {
29
+ dismissButton: (jsxRuntime.jsx(button_wrapper.PButton, { className: "dismiss", type: "button", variant: "secondary", icon: "close", hideLabel: true, compact: true, ...(headingText ? { aria: { 'aria-description': headingText } } : {}), children: "Close notification" })),
30
+ }) })] }), this.props.children] }));
27
31
  }
28
32
  }
29
33
 
@@ -21,7 +21,9 @@ id, label: label$1, description, loading, initialLoading, required, disabled, st
21
21
  // refElement,
22
22
  start, end, }) => {
23
23
  const { namedSlotChildren } = splitChildren.splitChildren(children);
24
- return (jsxRuntime.jsxs("div", { className: "root", children: [jsxRuntime.jsx(label.Label, { hasLabel: !!label$1 || namedSlotChildren.filter(({ props: { slot } }) => slot === 'label').length > 0, hasDescription: !!description || namedSlotChildren.filter(({ props: { slot } }) => slot === 'description').length > 0, host: null, label: label$1, description: description, htmlFor: id, isRequired: required, isLoading: loading, isDisabled: disabled }), jsxRuntime.jsxs("div", { className: "wrapper", children: [jsxRuntime.jsx("slot", { name: "start" }), start, jsxRuntime.jsx("input", { "aria-describedby": loading ? loadingMessage.loadingId : `${utilsEntry.descriptionId} ${stateMessage.messageId}`, "aria-invalid": state === 'error' ? 'true' : null, "aria-disabled": disabled || loading ? 'true' : null, "aria-readonly": readOnly ? 'true' : null, id: id, name: name, form: form, type: type, required: required, placeholder: placeholder || null, maxLength: maxLength, minLength: minLength, spellCheck: spellCheck, max: max, min: min, step: step, defaultValue: value, readOnly: readOnly, autoComplete: autoComplete, disabled: disabled, pattern: pattern, multiple: multiple, dir: "auto" // This overwrites the default: let the browser now decide in which direction the value should be placed.
24
+ const inputDescriptionId = (description || namedSlotChildren.filter(({ props: { slot } }) => slot === 'description').length > 0) ? utilsEntry.descriptionId : undefined;
25
+ const inputMessageId = (message || namedSlotChildren.filter(({ props: { slot } }) => slot === 'message').length > 0) && ['success', 'error'].includes(state) ? stateMessage.messageId : undefined;
26
+ return (jsxRuntime.jsxs("div", { className: "root", children: [jsxRuntime.jsx(label.Label, { hasLabel: !!label$1 || namedSlotChildren.filter(({ props: { slot } }) => slot === 'label').length > 0, hasDescription: !!description || namedSlotChildren.filter(({ props: { slot } }) => slot === 'description').length > 0, host: null, label: label$1, description: description, htmlFor: id, isRequired: required, isLoading: loading, isDisabled: disabled }), jsxRuntime.jsxs("div", { className: "wrapper", children: [jsxRuntime.jsx("slot", { name: "start" }), start, jsxRuntime.jsx("input", { "aria-describedby": utilsEntry.setAriaIDREF(loading && loadingMessage.loadingId, inputMessageId, inputDescriptionId), "aria-invalid": state === 'error' ? 'true' : null, "aria-disabled": disabled || loading ? 'true' : null, "aria-readonly": readOnly ? 'true' : null, id: id, name: name, form: form, type: type, required: required, placeholder: placeholder || null, maxLength: maxLength, minLength: minLength, spellCheck: spellCheck, max: max, min: min, step: step, defaultValue: value, readOnly: readOnly, autoComplete: autoComplete, disabled: disabled, pattern: pattern, multiple: multiple, dir: "auto" // This overwrites the default: let the browser now decide in which direction the value should be placed.
25
27
  }), end, jsxRuntime.jsx("slot", { name: "end" }), loading && jsxRuntime.jsx(spinner_wrapper.PSpinner, { "aria-hidden": "true" })] }), jsxRuntime.jsx(stateMessage.StateMessage, { hasMessage: (message || namedSlotChildren.filter(({ props: { slot } }) => slot === 'message').length > 0) && ['success', 'error'].includes(state), state: state, message: message, host: null }), jsxRuntime.jsx(loadingMessage.LoadingMessage, { loading: loading, initialLoading: initialLoading })] }));
26
28
  };
27
29
 
@@ -24,7 +24,7 @@ class DSRModal extends react.Component {
24
24
  hasHeader;
25
25
  hasFooter;
26
26
  render() {
27
- const { namedSlotChildren} = splitChildren.splitChildren(this.props.children);
27
+ const { children, namedSlotChildren, otherChildren } = splitChildren.splitChildren(this.props.children);
28
28
  const hasHeader = namedSlotChildren.filter(({ props: { slot } }) => slot === 'header').length > 0;
29
29
  const hasFooter = namedSlotChildren.filter(({ props: { slot } }) => slot === 'footer').length > 0;
30
30
  this.props.disableCloseButton ? false : this.props.dismissButton;
@@ -63,16 +63,15 @@ class DSRMultiSelect extends react.Component {
63
63
  this.props.setFormValue(this.props.defaultValue);
64
64
  }
65
65
  render() {
66
- const { namedSlotChildren} = splitChildren.splitChildren(this.props.children);
66
+ const { children, namedSlotChildren, otherChildren } = splitChildren.splitChildren(this.props.children);
67
67
  const hasCustomFilterSlot = namedSlotChildren.filter(({ props: { slot } }) => slot === 'filter').length > 0;
68
68
  const hasCustomSelectedSlot = namedSlotChildren.filter(({ props: { slot } }) => slot === 'selected').length > 0;
69
69
  const buttonId = 'button';
70
- const popoverId = 'list';
71
- const descriptionId = this.props.description ? 'description' : undefined;
70
+ const listboxId = 'listbox';
71
+ const selectDescriptionId = (this.props.description || namedSlotChildren.filter(({ props: { slot } }) => slot === 'description').length > 0) ? utilsEntry.descriptionId : undefined;
72
72
  const selectMessageId = (this.props.message || namedSlotChildren.filter(({ props: { slot } }) => slot === 'message').length > 0) && ['success', 'error'].includes(this.props.state) ? stateMessage.messageId : undefined;
73
- const ariaDescribedBy = [descriptionId, selectMessageId].filter(Boolean).join(' ');
74
73
  const style = minifyCss.minifyCss(stylesEntry.getMultiSelectCss(this.props.isOpen, this.props.disabled, this.props.hideLabel, this.props.state, this.props.compact));
75
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", shadowrootdelegatesfocus: "true", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsxs("div", { className: "root", children: [jsxRuntime.jsx(label.Label, { hasLabel: this.props.label || namedSlotChildren.filter(({ props: { slot } }) => slot === 'label').length > 0, hasDescription: this.props.description || namedSlotChildren.filter(({ props: { slot } }) => slot === 'description').length > 0, host: null, label: this.props.label, description: this.props.description, htmlFor: buttonId, isRequired: this.props.required, isDisabled: this.props.disabled }), jsxRuntime.jsxs("button", { "aria-invalid": this.props.state === 'error' ? 'true' : null, type: "button", role: "combobox", id: buttonId, ...utilsEntry.getComboboxAriaAttributes(this.props.isOpen, this.props.required, utilsEntry.labelId, ariaDescribedBy, popoverId), disabled: this.props.disabled, onBlur: this.props.onComboBlur, children: [hasCustomSelectedSlot ? (jsxRuntime.jsx("slot", { name: "selected" })) : (jsxRuntime.jsx("span", { children: this.selectedOptions.map((option) => (option.textContent ?? '').toString().trim()).join(', ') })), this.props.value.length > 0 && (jsxRuntime.jsx(buttonPure_wrapper.PButtonPure, { type: "button", className: "button", icon: "close", hideLabel: true, disabled: this.props.disabled, children: "Reset selection" })), jsxRuntime.jsx(icon_wrapper.PIcon, { className: "icon", name: "arrow-head-down", color: "primary", "aria-hidden": "true" })] }), jsxRuntime.jsxs("div", { id: popoverId, popover: "manual", tabIndex: -1, onBlur: (e) => e.stopPropagation(), role: "dialog", "aria-label": this.props.label, "aria-hidden": this.props.isOpen ? null : 'true', children: [hasCustomFilterSlot ? (jsxRuntime.jsx("slot", { name: "filter" })) : (jsxRuntime.jsx(inputSearch_wrapper.PInputSearch, { className: "filter", name: "filter", label: "Filter options", hideLabel: true, autoComplete: "off", clear: true, indicator: true, compact: true, onBlur: (e) => e.stopPropagation() })), jsxRuntime.jsxs("div", { className: "options", role: "listbox", "aria-label": this.props.label, "aria-multiselectable": "true", onPointerMove: this.props.onPointerMove, children: [!this.props.hasFilterResults && jsxRuntime.jsx(noResultsOption.NoResultsOption, {}), jsxRuntime.jsx("slot", { name: "options-status" }), jsxRuntime.jsx("slot", {})] })] }), jsxRuntime.jsx(stateMessage.StateMessage, { hasMessage: (this.props.message || namedSlotChildren.filter(({ props: { slot } }) => slot === 'message').length > 0) && ['success', 'error'].includes(this.props.state), state: this.props.state, message: this.props.message, host: null })] })] }), this.props.children] }));
74
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", shadowrootdelegatesfocus: "true", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsxs("div", { className: "root", children: [jsxRuntime.jsx(label.Label, { hasLabel: this.props.label || namedSlotChildren.filter(({ props: { slot } }) => slot === 'label').length > 0, hasDescription: this.props.description || namedSlotChildren.filter(({ props: { slot } }) => slot === 'description').length > 0, host: null, label: this.props.label, description: this.props.description, htmlFor: buttonId, isRequired: this.props.required, isDisabled: this.props.disabled }), jsxRuntime.jsxs("button", { "aria-invalid": this.props.state === 'error' ? 'true' : null, type: "button", role: "combobox", id: buttonId, tabIndex: 0, ...utilsEntry.getComboboxAriaAttributes(this.props.isOpen, this.props.required, (this.props.label || namedSlotChildren.filter(({ props: { slot } }) => slot === 'label').length > 0) && utilsEntry.labelId, selectMessageId, selectDescriptionId, listboxId), disabled: this.props.disabled, onBlur: this.props.onComboBlur, children: [hasCustomSelectedSlot ? (jsxRuntime.jsx("slot", { name: "selected" })) : (jsxRuntime.jsx("span", { children: this.selectedOptions.map((option) => (option.textContent ?? '').toString().trim()).join(', ') })), this.props.value.length > 0 && (jsxRuntime.jsx(buttonPure_wrapper.PButtonPure, { type: "button", className: "button", icon: "close", hideLabel: true, disabled: this.props.disabled, children: "Reset selection" })), jsxRuntime.jsx(icon_wrapper.PIcon, { className: "icon", name: "arrow-head-down", color: "primary", "aria-hidden": "true" })] }), jsxRuntime.jsxs("div", { popover: "manual", tabIndex: 0, children: [hasCustomFilterSlot ? (jsxRuntime.jsx("slot", { name: "filter" })) : (jsxRuntime.jsx(inputSearch_wrapper.PInputSearch, { className: "filter", name: "filter", label: "Filter options", hideLabel: true, autoComplete: "off", clear: true, indicator: true, compact: true, onBlur: (e) => e.stopPropagation() })), jsxRuntime.jsxs("div", { id: listboxId, className: "options", ...utilsEntry.getListboxAriaAttributes(this.props.required, (this.props.label || namedSlotChildren.filter(({ props: { slot } }) => slot === 'label').length > 0) && utilsEntry.labelId, selectMessageId, selectDescriptionId, true), onPointerMove: this.props.onPointerMove, onBlur: (e) => e.stopPropagation(), children: [!this.props.hasFilterResults && jsxRuntime.jsx(noResultsOption.NoResultsOption, {}), jsxRuntime.jsx("slot", { name: "options-status" }), jsxRuntime.jsx("slot", {})] })] }), jsxRuntime.jsx(stateMessage.StateMessage, { hasMessage: (this.props.message || namedSlotChildren.filter(({ props: { slot } }) => slot === 'message').length > 0) && ['success', 'error'].includes(this.props.state), state: this.props.state, message: this.props.message, host: null })] })] }), this.props.children] }));
76
75
  }
77
76
  }
78
77
 
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+
5
+ const NotificationBase = ({ heading, headingTag, hasHeadingSlot, description, hasDescriptionSlot, innerHTML, actionLabel, dismissButton, ...rest }) => {
6
+ const Heading = headingTag;
7
+ return (jsxRuntime.jsxs("div", { className: "notification", ...rest, children: [heading ? jsxRuntime.jsx(Heading, { children: heading }) : hasHeadingSlot && jsxRuntime.jsx("slot", { name: "heading" }), description ? (innerHTML ? (jsxRuntime.jsx("p", { dangerouslySetInnerHTML: { __html: description } })) : (jsxRuntime.jsx("p", { children: description }))) : hasDescriptionSlot ? (jsxRuntime.jsx("slot", { name: "description" })) : (jsxRuntime.jsx("slot", {})), actionLabel, dismissButton] }));
8
+ };
9
+
10
+ exports.NotificationBase = NotificationBase;
@@ -37,12 +37,15 @@ class DSRPinCode extends react.Component {
37
37
  formStateRestoreCallback() {
38
38
  }
39
39
  render() {
40
- const { namedSlotChildren} = splitChildren.splitChildren(this.props.children);
40
+ const { children, namedSlotChildren, otherChildren } = splitChildren.splitChildren(this.props.children);
41
41
  // reset array of input elements
42
42
  this.inputElements = [];
43
43
  const currentInputId = 'current-input';
44
+ const inputLabelId = (this.props.label || namedSlotChildren.filter(({ props: { slot } }) => slot === 'label').length > 0) ? utilsEntry.labelId : undefined;
45
+ const inputDescriptionId = (this.props.description || namedSlotChildren.filter(({ props: { slot } }) => slot === 'description').length > 0) ? utilsEntry.descriptionId : undefined;
46
+ const inputMessageId = (this.props.message || namedSlotChildren.filter(({ props: { slot } }) => slot === 'message').length > 0) && ['success', 'error'].includes(this.props.state) ? stateMessage.messageId : undefined;
44
47
  const style = minifyCss.minifyCss(stylesEntry.getPinCodeCss(this.props.hideLabel, this.props.state, this.props.disabled, this.props.loading, this.props.length, this.props.compact));
45
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", shadowrootdelegatesfocus: "true", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsxs("fieldset", { className: "root", disabled: this.props.disabled, ...utilsEntry.getFieldsetAriaAttributes(this.props.required, this.props.state === 'error'), "aria-describedby": this.props.loading ? loadingMessage.loadingId : `${utilsEntry.descriptionId} ${stateMessage.messageId}`, "aria-labelledby": utilsEntry.labelId, children: [jsxRuntime.jsx(label.Label, { hasLabel: this.props.label || namedSlotChildren.filter(({ props: { slot } }) => slot === 'label').length > 0, hasDescription: this.props.description || namedSlotChildren.filter(({ props: { slot } }) => slot === 'description').length > 0, host: null, label: this.props.label, description: this.props.description, htmlFor: currentInputId, isRequired: this.props.required, isLoading: this.props.loading, isDisabled: this.props.disabled }), jsxRuntime.jsxs("div", { className: "wrapper", dir: "ltr", children: [Array.from(new Array(this.props.length), (_, index) => (jsxRuntime.jsx("input", { name: this.props.name, form: this.props.form, ...(utilsEntry.isCurrentInput(index, this.props.value, this.props.length) && { id: currentInputId }), type: this.props.type === 'number' ? 'text' : this.props.type, "aria-label": `${index + 1}-${this.props.length}`, "aria-describedby": `${utilsEntry.labelId} ${utilsEntry.descriptionId} ${stateMessage.messageId}`, "aria-invalid": this.props.state === 'error' ? 'true' : null, "aria-disabled": this.props.loading ? 'true' : null, autoComplete: "one-time-code", pattern: "\\d*", inputMode: "numeric" // get numeric keyboard on mobile
48
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", shadowrootdelegatesfocus: "true", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsxs("fieldset", { className: "root", disabled: this.props.disabled, ...utilsEntry.getFieldsetAriaAttributes(this.props.required, this.props.state === 'error'), "aria-describedby": utilsEntry.setAriaIDREF(this.props.loading && loadingMessage.loadingId, inputMessageId, inputDescriptionId), "aria-labelledby": (this.props.label || namedSlotChildren.filter(({ props: { slot } }) => slot === 'label').length > 0) ? utilsEntry.labelId : null, children: [jsxRuntime.jsx(label.Label, { hasLabel: this.props.label || namedSlotChildren.filter(({ props: { slot } }) => slot === 'label').length > 0, hasDescription: this.props.description || namedSlotChildren.filter(({ props: { slot } }) => slot === 'description').length > 0, host: null, label: this.props.label, description: this.props.description, htmlFor: currentInputId, isRequired: this.props.required, isLoading: this.props.loading, isDisabled: this.props.disabled }), jsxRuntime.jsxs("div", { className: "wrapper", dir: "ltr", children: [Array.from(new Array(this.props.length), (_, index) => (jsxRuntime.jsx("input", { name: this.props.name, form: this.props.form, ...(utilsEntry.isCurrentInput(index, this.props.value, this.props.length) && { id: currentInputId }), type: this.props.type === 'number' ? 'text' : this.props.type, "aria-label": `${index + 1}-${this.props.length}`, "aria-describedby": utilsEntry.setAriaIDREF(inputLabelId, inputMessageId), "aria-invalid": this.props.state === 'error' ? 'true' : null, "aria-disabled": this.props.loading ? 'true' : null, autoComplete: "one-time-code", pattern: "\\d*", inputMode: "numeric" // get numeric keyboard on mobile
46
49
  , defaultValue: this.props.value[index] === ' ' ? null : this.props.value[index], disabled: this.props.disabled, required: this.props.required, onBlur: this.props.onInputBlur }, index))), this.props.loading && jsxRuntime.jsx(spinner_wrapper.PSpinner, { className: "spinner", size: "inherit", "aria-hidden": "true" })] }), jsxRuntime.jsx(stateMessage.StateMessage, { hasMessage: (this.props.message || namedSlotChildren.filter(({ props: { slot } }) => slot === 'message').length > 0) && ['success', 'error'].includes(this.props.state), state: this.props.state, message: this.props.message, host: null }), jsxRuntime.jsx(loadingMessage.LoadingMessage, { loading: this.props.loading, initialLoading: this.props.initialLoading })] })] }), this.props.children] }));
47
50
  }
48
51
  }
@@ -25,7 +25,7 @@ class DSRPopover extends react.Component {
25
25
  // TODO: This should be updated when slot is changed
26
26
  hasSlottedButton;
27
27
  render() {
28
- const { namedSlotChildren} = splitChildren.splitChildren(this.props.children);
28
+ const { children, namedSlotChildren, otherChildren } = splitChildren.splitChildren(this.props.children);
29
29
  const hasSlottedButton = namedSlotChildren.filter(({ props: { slot } }) => slot === 'button').length > 0;
30
30
  const style = minifyCss.minifyCss(stylesEntry.getPopoverCss()).replace(/(:host {[\S\s]+?})[\S\s]+(button {[\S\s]+?})[\S\s]+(.icon {[\S\s]+?})[\S\s]+(.label {[\S\s]+?})[\S\s]+/, '$1\n$2\n$3\n$4');
31
31
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [hasSlottedButton ? (jsxRuntime.jsx("slot", { name: "button" })) : (jsxRuntime.jsxs("button", { type: "button", ...utilsEntry.parseAndGetAriaAttributes({
@@ -8,7 +8,6 @@ var minifyCss = require('../../minifyCss.cjs');
8
8
  var stylesEntry = require('../../../../../../components/dist/styles/esm/styles-entry.cjs');
9
9
  var loadingMessage = require('./loading-message.cjs');
10
10
  var label = require('./label.cjs');
11
- var stateMessage = require('./state-message.cjs');
12
11
  var spinner_wrapper = require('../components/spinner.wrapper.cjs');
13
12
 
14
13
  // Though "description" and "message" slots are technically available (provided by the "label" component),
@@ -31,7 +30,7 @@ class DSRRadioGroupOption extends react.Component {
31
30
  const style = minifyCss.minifyCss(stylesEntry.getRadioGroupOptionCss(isDisabled, isLoading, state));
32
31
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", shadowrootdelegatesfocus: "true", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs("div", { className: "root", children: [jsxRuntime.jsxs("div", { className: "wrapper", children: [jsxRuntime.jsx("input", { id: id, type: "radio", name: name, checked: isSelected, disabled: isDisabled || isLoading, value: this.props.value, onClick: (e) => {
33
32
  e.stopPropagation();
34
- }, onBlur: this.props.onBlur, "aria-describedby": isLoading ? loadingMessage.loadingId : `${stateMessage.messageId}`, "aria-invalid": state === 'error' ? 'true' : null, "aria-disabled": isDisabled || isLoading ? 'true' : null }), isOptionLoading && !this.props.loadingParent && (jsxRuntime.jsx(spinner_wrapper.PSpinner, { className: "spinner", "aria-hidden": "true" }))] }), jsxRuntime.jsx(label.Label, { hasLabel: this.props.label, hasDescription: false, host: null, label: this.props.label, htmlFor: id, isDisabled: isDisabled, isLoading: isLoading, stopClickPropagation: true }), !this.props.loadingParent && (jsxRuntime.jsx(loadingMessage.LoadingMessage, { loading: isOptionLoading, initialLoading: this.props.initialLoading }))] }) })] }), this.props.children] }));
33
+ }, onBlur: this.props.onBlur, "aria-describedby": isLoading ? loadingMessage.loadingId : null, "aria-invalid": state === 'error' ? 'true' : null, "aria-disabled": isDisabled || isLoading ? 'true' : null }), isOptionLoading && !this.props.loadingParent && (jsxRuntime.jsx(spinner_wrapper.PSpinner, { className: "spinner", "aria-hidden": "true" }))] }), jsxRuntime.jsx(label.Label, { hasLabel: this.props.label, hasDescription: false, host: null, label: this.props.label, htmlFor: id, isDisabled: isDisabled, isLoading: isLoading, stopClickPropagation: true }), !this.props.loadingParent && (jsxRuntime.jsx(loadingMessage.LoadingMessage, { loading: isOptionLoading, initialLoading: this.props.initialLoading }))] }) })] }), this.props.children] }));
35
34
  }
36
35
  }
37
36
 
@@ -37,9 +37,11 @@ class DSRRadioGroup extends react.Component {
37
37
  formStateRestoreCallback() {
38
38
  }
39
39
  render() {
40
- const { namedSlotChildren} = splitChildren.splitChildren(this.props.children);
40
+ const { children, namedSlotChildren, otherChildren } = splitChildren.splitChildren(this.props.children);
41
+ const inputDescriptionId = (this.props.description || namedSlotChildren.filter(({ props: { slot } }) => slot === 'description').length > 0) ? utilsEntry.descriptionId : undefined;
42
+ const inputMessageId = (this.props.message || namedSlotChildren.filter(({ props: { slot } }) => slot === 'message').length > 0) && ['success', 'error'].includes(this.props.state) ? stateMessage.messageId : undefined;
41
43
  const style = minifyCss.minifyCss(stylesEntry.getRadioGroupCss(this.props.disabled, this.props.loading, this.props.hideLabel, this.props.state, this.props.compact, this.props.direction));
42
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", shadowrootdelegatesfocus: "true", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsxs("fieldset", { className: "root", disabled: this.props.disabled, ...utilsEntry.getFieldsetAriaAttributes(this.props.required, this.props.state === 'error', { role: 'radiogroup' }), "aria-describedby": this.props.loading ? loadingMessage.loadingId : `${utilsEntry.descriptionId} ${stateMessage.messageId}`, "aria-labelledby": utilsEntry.labelId, children: [jsxRuntime.jsx(label.Label, { hasLabel: this.props.label || namedSlotChildren.filter(({ props: { slot } }) => slot === 'label').length > 0, hasDescription: this.props.description || namedSlotChildren.filter(({ props: { slot } }) => slot === 'description').length > 0, host: null, tag: "div", label: this.props.label, description: this.props.description, isRequired: this.props.required, isLoading: this.props.loading, isDisabled: this.props.disabled }), jsxRuntime.jsxs("div", { className: "wrapper", children: [jsxRuntime.jsx("slot", {}), this.props.loading && jsxRuntime.jsx(spinner_wrapper.PSpinner, { className: "spinner", "aria-hidden": "true" })] }), jsxRuntime.jsx(stateMessage.StateMessage, { hasMessage: (this.props.message || namedSlotChildren.filter(({ props: { slot } }) => slot === 'message').length > 0) && ['success', 'error'].includes(this.props.state), state: this.props.state, message: this.props.message, host: null }), jsxRuntime.jsx(loadingMessage.LoadingMessage, { loading: this.props.loading, initialLoading: this.props.initialLoading })] })] }), this.props.children] }));
44
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", shadowrootdelegatesfocus: "true", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsxs("fieldset", { className: "root", disabled: this.props.disabled, ...utilsEntry.getFieldsetAriaAttributes(this.props.required, this.props.state === 'error', { role: 'radiogroup' }), "aria-describedby": utilsEntry.setAriaIDREF(this.props.loading && loadingMessage.loadingId, inputMessageId, inputDescriptionId), "aria-labelledby": (this.props.label || namedSlotChildren.filter(({ props: { slot } }) => slot === 'label').length > 0) ? utilsEntry.labelId : null, children: [jsxRuntime.jsx(label.Label, { hasLabel: this.props.label || namedSlotChildren.filter(({ props: { slot } }) => slot === 'label').length > 0, hasDescription: this.props.description || namedSlotChildren.filter(({ props: { slot } }) => slot === 'description').length > 0, host: null, tag: "div", label: this.props.label, description: this.props.description, isRequired: this.props.required, isLoading: this.props.loading, isDisabled: this.props.disabled }), jsxRuntime.jsxs("div", { className: "wrapper", children: [jsxRuntime.jsx("slot", {}), this.props.loading && jsxRuntime.jsx(spinner_wrapper.PSpinner, { className: "spinner", "aria-hidden": "true" })] }), jsxRuntime.jsx(stateMessage.StateMessage, { hasMessage: (this.props.message || namedSlotChildren.filter(({ props: { slot } }) => slot === 'message').length > 0) && ['success', 'error'].includes(this.props.state), state: this.props.state, message: this.props.message, host: null }), jsxRuntime.jsx(loadingMessage.LoadingMessage, { loading: this.props.loading, initialLoading: this.props.initialLoading })] })] }), this.props.children] }));
43
45
  }
44
46
  }
45
47
 
@@ -15,7 +15,7 @@ var icon_wrapper = require('../components/icon.wrapper.cjs');
15
15
  class DSRSegmentedControlItem extends react.Component {
16
16
  host;
17
17
  render() {
18
- const { children} = splitChildren.splitChildren(this.props.children);
18
+ const { children, namedSlotChildren, otherChildren } = splitChildren.splitChildren(this.props.children);
19
19
  // this additional validation is still needed because undefined is allowed with current propTypes
20
20
  const hasIcon = !!this.props.icon || !!this.props.iconSource;
21
21
  const hasSlottedContent = !!children.length;
@@ -1,13 +1,15 @@
1
1
  'use strict';
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
- var splitChildren = require('../../splitChildren.cjs');
5
4
  var react = require('react');
5
+ require('../../provider.cjs');
6
+ var splitChildren = require('../../splitChildren.cjs');
6
7
  var minifyCss = require('../../minifyCss.cjs');
7
8
  var stylesEntry = require('../../../../../../components/dist/styles/esm/styles-entry.cjs');
8
9
  var utilsEntry = require('../../../../../../components/dist/utils/esm/utils-entry.cjs');
9
10
  var label = require('./label.cjs');
10
11
  var stateMessage = require('./state-message.cjs');
12
+ var scroller_wrapper = require('../components/scroller.wrapper.cjs');
11
13
 
12
14
  /**
13
15
  * @slot {"name": "label", "description": "Shows a label. Only [phrasing content](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content) is allowed."}
@@ -35,9 +37,11 @@ class DSRSegmentedControl extends react.Component {
35
37
  const manipulatedChildren = children.map((child) => typeof child === 'object' && 'props' in child && otherChildren.includes(child)
36
38
  ? { ...child, props: { ...child.props, selected: child.props?.value === this.props.value, backgroundColor: this.props.backgroundColor, theme: this.props.theme } }
37
39
  : child);
38
- const { minWidth, maxWidth } = { minWidth: 100, maxWidth: 100 };
39
- const style = minifyCss.minifyCss(stylesEntry.getSegmentedControlCss(minWidth, maxWidth, this.props.columns, this.props.disabled, this.props.hideLabel, this.props.state));
40
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsxs("fieldset", { className: "root", disabled: this.props.disabled, ...utilsEntry.getFieldsetAriaAttributes(this.props.required, this.props.state === 'error'), "aria-labelledby": utilsEntry.labelId, "aria-describedby": utilsEntry.descriptionId, children: [jsxRuntime.jsx(label.Label, { hasLabel: this.props.label || namedSlotChildren.filter(({ props: { slot } }) => slot === 'label').length > 0, hasDescription: this.props.description || namedSlotChildren.filter(({ props: { slot } }) => slot === 'description').length > 0, host: null, tag: "div", label: this.props.label, description: this.props.description, isRequired: this.props.required, isDisabled: this.props.disabled }), jsxRuntime.jsx("slot", {}), jsxRuntime.jsx(stateMessage.StateMessage, { hasMessage: (this.props.message || namedSlotChildren.filter(({ props: { slot } }) => slot === 'message').length > 0) && ['success', 'error'].includes(this.props.state), state: this.props.state, message: this.props.message, host: null })] })] }), manipulatedChildren] }));
40
+ const itemWidths = this.props.noWrap ? undefined : { minWidth: 100, maxWidth: 100 };
41
+ const fieldDescriptionId = (this.props.description || namedSlotChildren.filter(({ props: { slot } }) => slot === 'description').length > 0) ? utilsEntry.descriptionId : undefined;
42
+ const fieldMessageId = (this.props.message || namedSlotChildren.filter(({ props: { slot } }) => slot === 'message').length > 0) && ['success', 'error'].includes(this.props.state) ? stateMessage.messageId : undefined;
43
+ const style = minifyCss.minifyCss(stylesEntry.getSegmentedControlCss(itemWidths?.minWidth, itemWidths?.maxWidth, this.props.columns, this.props.disabled, this.props.hideLabel, this.props.state, this.props.noWrap));
44
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsxs("fieldset", { className: "root", disabled: this.props.disabled, ...utilsEntry.getFieldsetAriaAttributes(this.props.required, this.props.state === 'error'), "aria-labelledby": (this.props.label || namedSlotChildren.filter(({ props: { slot } }) => slot === 'label').length > 0) ? utilsEntry.labelId : null, "aria-describedby": utilsEntry.setAriaIDREF(fieldMessageId, fieldDescriptionId), children: [jsxRuntime.jsx(label.Label, { hasLabel: this.props.label || namedSlotChildren.filter(({ props: { slot } }) => slot === 'label').length > 0, hasDescription: this.props.description || namedSlotChildren.filter(({ props: { slot } }) => slot === 'description').length > 0, host: null, tag: "div", label: this.props.label, description: this.props.description, isRequired: this.props.required, isDisabled: this.props.disabled }), this.props.noWrap ? (jsxRuntime.jsx(scroller_wrapper.PScroller, { className: "scroller", children: jsxRuntime.jsx("slot", {}) })) : (jsxRuntime.jsx("slot", {})), jsxRuntime.jsx(stateMessage.StateMessage, { hasMessage: (this.props.message || namedSlotChildren.filter(({ props: { slot } }) => slot === 'message').length > 0) && ['success', 'error'].includes(this.props.state), state: this.props.state, message: this.props.message, host: null })] })] }), manipulatedChildren] }));
41
45
  }
42
46
  }
43
47
 
@@ -59,16 +59,17 @@ class DSRSelect extends react.Component {
59
59
  this.props.internals?.setFormValue(this.props.defaultValue);
60
60
  }
61
61
  render() {
62
- const { namedSlotChildren} = splitChildren.splitChildren(this.props.children);
62
+ const { children, namedSlotChildren, otherChildren } = splitChildren.splitChildren(this.props.children);
63
63
  const hasCustomFilterSlot = namedSlotChildren.filter(({ props: { slot } }) => slot === 'filter').length > 0;
64
64
  const hasCustomSelectedSlot = namedSlotChildren.filter(({ props: { slot } }) => slot === 'selected').length > 0;
65
65
  const buttonId = 'button';
66
- const popoverId = 'list';
67
- const descriptionId = this.props.description ? 'description' : undefined;
66
+ const listboxId = 'listbox';
67
+ const selectDescriptionId = (this.props.description || namedSlotChildren.filter(({ props: { slot } }) => slot === 'description').length > 0) ? utilsEntry.descriptionId : undefined;
68
68
  const selectMessageId = (this.props.message || namedSlotChildren.filter(({ props: { slot } }) => slot === 'message').length > 0) && ['success', 'error'].includes(this.props.state) ? stateMessage.messageId : undefined;
69
- const ariaDescribedBy = [descriptionId, selectMessageId].filter(Boolean).join(' ');
70
69
  const style = minifyCss.minifyCss(stylesEntry.getSelectCss(this.props.isOpen, this.props.disabled, this.props.hideLabel, this.props.state, this.props.compact));
71
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", shadowrootdelegatesfocus: "true", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsxs("div", { className: "root", children: [jsxRuntime.jsx(label.Label, { hasLabel: this.props.label || namedSlotChildren.filter(({ props: { slot } }) => slot === 'label').length > 0, hasDescription: this.props.description || namedSlotChildren.filter(({ props: { slot } }) => slot === 'description').length > 0, host: null, label: this.props.label, description: this.props.description, htmlFor: buttonId, isRequired: this.props.required, isDisabled: this.props.disabled }), jsxRuntime.jsxs("button", { "aria-invalid": this.props.state === 'error' ? 'true' : null, type: "button", role: "combobox", id: buttonId, ...utilsEntry.getComboboxAriaAttributes(this.props.isOpen, this.props.required, utilsEntry.labelId, ariaDescribedBy, popoverId), disabled: this.props.disabled, onBlur: this.props.onComboBlur, children: [hasCustomSelectedSlot ? (jsxRuntime.jsx("slot", { name: "selected" })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [this.selectedOption?.querySelector?.('img') && (jsxRuntime.jsx("img", { src: this.selectedOption.querySelector('img').src, alt: "" })), jsxRuntime.jsx("span", { children: this.selectedOption?.textContent ?? '' })] })), jsxRuntime.jsx(icon_wrapper.PIcon, { className: "icon", name: "arrow-head-down", color: "primary", "aria-hidden": "true" })] }), jsxRuntime.jsxs("div", { id: popoverId, popover: "manual", tabIndex: -1, onBlur: (e) => e.stopPropagation(), role: "dialog", "aria-label": this.props.label, "aria-hidden": this.props.isOpen ? null : 'true', children: [this.props.filter && !hasCustomFilterSlot && (jsxRuntime.jsx(inputSearch_wrapper.PInputSearch, { className: "filter", name: "filter", label: "Filter options", hideLabel: true, autoComplete: "off", clear: true, indicator: true, compact: true, onBlur: (e) => e.stopPropagation() })), hasCustomFilterSlot && jsxRuntime.jsx("slot", { name: "filter" }), jsxRuntime.jsxs("div", { className: "options", role: "listbox", "aria-label": this.props.label, onPointerMove: this.props.onPointerMove, children: [this.props.filter && !this.props.hasFilterResults && jsxRuntime.jsx(noResultsOption.NoResultsOption, {}), jsxRuntime.jsx("slot", { name: "options-status" }), jsxRuntime.jsx("slot", {})] })] }), jsxRuntime.jsx(stateMessage.StateMessage, { hasMessage: (this.props.message || namedSlotChildren.filter(({ props: { slot } }) => slot === 'message').length > 0) && ['success', 'error'].includes(this.props.state), state: this.props.state, message: this.props.message, host: null })] })] }), this.props.children] }));
70
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", shadowrootdelegatesfocus: "true", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsxs("div", { className: "root", children: [jsxRuntime.jsx(label.Label, { hasLabel: this.props.label || namedSlotChildren.filter(({ props: { slot } }) => slot === 'label').length > 0, hasDescription: this.props.description || namedSlotChildren.filter(({ props: { slot } }) => slot === 'description').length > 0, host: null, label: this.props.label, description: this.props.description, htmlFor: buttonId, isRequired: this.props.required, isDisabled: this.props.disabled }), jsxRuntime.jsxs("button", { "aria-invalid": this.props.state === 'error' ? 'true' : null, type: "button", role: "combobox", id: buttonId,
71
+ // only needed for Safari to recognize focus state on click
72
+ tabIndex: 0, ...utilsEntry.getComboboxAriaAttributes(this.props.isOpen, this.props.required, (this.props.label || namedSlotChildren.filter(({ props: { slot } }) => slot === 'label').length > 0) && utilsEntry.labelId, selectMessageId, selectDescriptionId, listboxId), "aria-autocomplete": "none", disabled: this.props.disabled, onBlur: this.props.onComboBlur, children: [hasCustomSelectedSlot ? (jsxRuntime.jsx("slot", { name: "selected" })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [this.selectedOption?.querySelector?.('img') && (jsxRuntime.jsx("img", { src: this.selectedOption.querySelector('img').src, alt: "" })), jsxRuntime.jsx("span", { children: this.selectedOption?.textContent ?? '' })] })), jsxRuntime.jsx(icon_wrapper.PIcon, { className: "icon", name: "arrow-head-down", color: "primary", "aria-hidden": "true" })] }), jsxRuntime.jsxs("div", { popover: "manual", tabIndex: 0, children: [this.props.filter && !hasCustomFilterSlot && (jsxRuntime.jsx(inputSearch_wrapper.PInputSearch, { className: "filter", name: "filter", label: "Filter options", hideLabel: true, autoComplete: "off", clear: true, indicator: true, compact: true, onBlur: (e) => e.stopPropagation() })), hasCustomFilterSlot && jsxRuntime.jsx("slot", { name: "filter" }), jsxRuntime.jsxs("div", { id: listboxId, className: "options", ...utilsEntry.getListboxAriaAttributes(this.props.required, (this.props.label || namedSlotChildren.filter(({ props: { slot } }) => slot === 'label').length > 0) && utilsEntry.labelId, selectMessageId, selectDescriptionId, false), tabIndex: -1, onPointerMove: this.props.onPointerMove, onBlur: (e) => e.stopPropagation(), children: [this.props.filter && !this.props.hasFilterResults && jsxRuntime.jsx(noResultsOption.NoResultsOption, {}), jsxRuntime.jsx("slot", { name: "options-status" }), jsxRuntime.jsx("slot", {})] })] }), jsxRuntime.jsx(stateMessage.StateMessage, { hasMessage: (this.props.message || namedSlotChildren.filter(({ props: { slot } }) => slot === 'message').length > 0) && ['success', 'error'].includes(this.props.state), state: this.props.state, message: this.props.message, host: null })] })] }), this.props.children] }));
72
73
  }
73
74
  }
74
75