@porsche-design-system/components-react 3.18.0 → 3.19.0-rc.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.
package/CHANGELOG.md CHANGED
@@ -14,6 +14,23 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0),
14
14
 
15
15
  ### [Unreleased]
16
16
 
17
+ ### [3.19.0-rc.0] - 2024-09-03
18
+
19
+ #### Added
20
+
21
+ - `componentsReady()`: Introduce optional `readyState` parameter
22
+ ([#3460](https://github.com/porsche-design-system/porsche-design-system/pull/3460))
23
+
24
+ #### Changed
25
+
26
+ - `Text Field Wrapper`: width calculation of counter and unit element are now CSS based in relation to the number of
27
+ characters ([#3472](https://github.com/porsche-design-system/porsche-design-system/pull/3472))
28
+
29
+ #### Fixed
30
+
31
+ - `jsdom-polyfill`: errors from included polyfill packages
32
+ ([3481](https://github.com/porsche-design-system/porsche-design-system/pull/3481))
33
+
17
34
  ### [3.18.0] - 2024-08-21
18
35
 
19
36
  ### [3.18.0-rc.0] - 2024-08-21
@@ -6,15 +6,15 @@ var react = require('react');
6
6
  var hooks = require('../../hooks.cjs');
7
7
  var utils = require('../../utils.cjs');
8
8
 
9
- const PCarousel = react.forwardRef(({ activeSlideIndex = 0, alignHeader = 'start', aria, description, disablePagination, heading, headingSize = 'x-large', intl, onCarouselChange, onUpdate, pagination = true, rewind = true, skipLinkTarget, slidesPerPage = 1, theme, width = 'basic', wrapContent, className, ...rest }, ref) => {
9
+ const PCarousel = react.forwardRef(({ activeSlideIndex = 0, alignHeader = 'start', aria, description, disablePagination, focusOnCenterSlide = false, gradientColor = 'none', heading, headingSize = 'x-large', intl, onCarouselChange, onUpdate, pagination = true, rewind = true, skipLinkTarget, slidesPerPage = 1, theme, width = 'basic', wrapContent, className, ...rest }, ref) => {
10
10
  const elementRef = react.useRef();
11
11
  hooks.useEventCallback(elementRef, 'carouselChange', onCarouselChange);
12
12
  hooks.useEventCallback(elementRef, 'update', onUpdate);
13
13
  const WebComponentTag = hooks.usePrefix('p-carousel');
14
- const propsToSync = [activeSlideIndex, alignHeader, aria, description, disablePagination, heading, headingSize, intl, pagination, rewind, skipLinkTarget, slidesPerPage, theme || hooks.useTheme(), width, wrapContent];
14
+ const propsToSync = [activeSlideIndex, alignHeader, aria, description, disablePagination, focusOnCenterSlide, gradientColor, heading, headingSize, intl, pagination, rewind, skipLinkTarget, slidesPerPage, theme || hooks.useTheme(), width, wrapContent];
15
15
  hooks.useBrowserLayoutEffect(() => {
16
16
  const { current } = elementRef;
17
- ['activeSlideIndex', 'alignHeader', 'aria', 'description', 'disablePagination', 'heading', 'headingSize', 'intl', 'pagination', 'rewind', 'skipLinkTarget', 'slidesPerPage', 'theme', 'width', 'wrapContent'].forEach((propName, i) => (current[propName] = propsToSync[i]));
17
+ ['activeSlideIndex', 'alignHeader', 'aria', 'description', 'disablePagination', 'focusOnCenterSlide', 'gradientColor', 'heading', 'headingSize', 'intl', 'pagination', 'rewind', 'skipLinkTarget', 'slidesPerPage', 'theme', 'width', 'wrapContent'].forEach((propName, i) => (current[propName] = propsToSync[i]));
18
18
  }, propsToSync);
19
19
  const props = {
20
20
  ...rest,
@@ -1,5 +1,5 @@
1
1
  import type { BaseProps } from '../../BaseProps';
2
- import type { CarouselAlignHeader, SelectedAriaAttributes, CarouselAriaAttribute, BreakpointCustomizable, CarouselHeadingSize, CarouselInternationalization, CarouselUpdateEventDetail, Theme, CarouselWidth } from '../types';
2
+ import type { CarouselAlignHeader, SelectedAriaAttributes, CarouselAriaAttribute, BreakpointCustomizable, CarouselGradientColor, CarouselHeadingSize, CarouselInternationalization, CarouselUpdateEventDetail, Theme, CarouselWidth } from '../types';
3
3
  export type PCarouselProps = BaseProps & {
4
4
  /**
5
5
  * Defines which slide to be active (zero-based numbering).
@@ -21,6 +21,14 @@ export type PCarouselProps = BaseProps & {
21
21
  * @deprecated since v3.0.0, will be removed with next major release, use `pagination` instead. If true, the carousel will not show pagination bullets at the bottom.
22
22
  */
23
23
  disablePagination?: BreakpointCustomizable<boolean>;
24
+ /**
25
+ * Indicates whether focus should be set on the center slide. If true, the carousel loops by individual slide; otherwise, it loops by page.
26
+ */
27
+ focusOnCenterSlide?: boolean;
28
+ /**
29
+ * Adapts the background gradient for the left and right edge.
30
+ */
31
+ gradientColor?: CarouselGradientColor;
24
32
  /**
25
33
  * Defines the heading used in the carousel.
26
34
  */
@@ -92,6 +100,14 @@ export declare const PCarousel: import("react").ForwardRefExoticComponent<import
92
100
  * @deprecated since v3.0.0, will be removed with next major release, use `pagination` instead. If true, the carousel will not show pagination bullets at the bottom.
93
101
  */
94
102
  disablePagination?: BreakpointCustomizable<boolean>;
103
+ /**
104
+ * Indicates whether focus should be set on the center slide. If true, the carousel loops by individual slide; otherwise, it loops by page.
105
+ */
106
+ focusOnCenterSlide?: boolean;
107
+ /**
108
+ * Adapts the background gradient for the left and right edge.
109
+ */
110
+ gradientColor?: CarouselGradientColor;
95
111
  /**
96
112
  * Defines the heading used in the carousel.
97
113
  */
@@ -4,15 +4,15 @@ import { forwardRef, useRef } from 'react';
4
4
  import { useEventCallback, usePrefix, useTheme, useBrowserLayoutEffect, useMergedClass } from '../../hooks.mjs';
5
5
  import { syncRef } from '../../utils.mjs';
6
6
 
7
- const PCarousel = forwardRef(({ activeSlideIndex = 0, alignHeader = 'start', aria, description, disablePagination, heading, headingSize = 'x-large', intl, onCarouselChange, onUpdate, pagination = true, rewind = true, skipLinkTarget, slidesPerPage = 1, theme, width = 'basic', wrapContent, className, ...rest }, ref) => {
7
+ const PCarousel = forwardRef(({ activeSlideIndex = 0, alignHeader = 'start', aria, description, disablePagination, focusOnCenterSlide = false, gradientColor = 'none', heading, headingSize = 'x-large', intl, onCarouselChange, onUpdate, pagination = true, rewind = true, skipLinkTarget, slidesPerPage = 1, theme, width = 'basic', wrapContent, className, ...rest }, ref) => {
8
8
  const elementRef = useRef();
9
9
  useEventCallback(elementRef, 'carouselChange', onCarouselChange);
10
10
  useEventCallback(elementRef, 'update', onUpdate);
11
11
  const WebComponentTag = usePrefix('p-carousel');
12
- const propsToSync = [activeSlideIndex, alignHeader, aria, description, disablePagination, heading, headingSize, intl, pagination, rewind, skipLinkTarget, slidesPerPage, theme || useTheme(), width, wrapContent];
12
+ const propsToSync = [activeSlideIndex, alignHeader, aria, description, disablePagination, focusOnCenterSlide, gradientColor, heading, headingSize, intl, pagination, rewind, skipLinkTarget, slidesPerPage, theme || useTheme(), width, wrapContent];
13
13
  useBrowserLayoutEffect(() => {
14
14
  const { current } = elementRef;
15
- ['activeSlideIndex', 'alignHeader', 'aria', 'description', 'disablePagination', 'heading', 'headingSize', 'intl', 'pagination', 'rewind', 'skipLinkTarget', 'slidesPerPage', 'theme', 'width', 'wrapContent'].forEach((propName, i) => (current[propName] = propsToSync[i]));
15
+ ['activeSlideIndex', 'alignHeader', 'aria', 'description', 'disablePagination', 'focusOnCenterSlide', 'gradientColor', 'heading', 'headingSize', 'intl', 'pagination', 'rewind', 'skipLinkTarget', 'slidesPerPage', 'theme', 'width', 'wrapContent'].forEach((propName, i) => (current[propName] = propsToSync[i]));
16
16
  }, propsToSync);
17
17
  const props = {
18
18
  ...rest,
@@ -696,6 +696,12 @@ declare const CAROUSEL_WIDTHS: readonly [
696
696
  "extended"
697
697
  ];
698
698
  export type CarouselWidth = (typeof CAROUSEL_WIDTHS)[number];
699
+ declare const CAROUSEL_GRADIENT_COLORS: readonly [
700
+ "background-base",
701
+ "background-surface",
702
+ "none"
703
+ ];
704
+ export type CarouselGradientColor = (typeof CAROUSEL_GRADIENT_COLORS)[number];
699
705
  declare const CAROUSEL_ALIGN_HEADERS: readonly [
700
706
  "start",
701
707
  "center",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@porsche-design-system/components-react",
3
- "version": "3.18.0",
3
+ "version": "3.19.0-rc.0",
4
4
  "description": "Porsche Design System is a component library designed to help developers create the best experience for software or services distributed by Dr. Ing. h.c. F. Porsche AG.",
5
5
  "keywords": [
6
6
  "porsche",
@@ -17,7 +17,7 @@
17
17
  "license": "SEE LICENSE IN LICENSE",
18
18
  "homepage": "https://designsystem.porsche.com",
19
19
  "dependencies": {
20
- "@porsche-design-system/components-js": "3.18.0"
20
+ "@porsche-design-system/components-js": "3.19.0-rc.0"
21
21
  },
22
22
  "peerDependencies": {
23
23
  "react": ">=18.0.0 <19.0.0",
@@ -4800,6 +4800,7 @@ const getComponentCss$12 = (isSidebarStartOpen, sidebarStartWidth, isSidebarEndO
4800
4800
  };
4801
4801
 
4802
4802
  const cssVariablePrevNextFilter = '--p-carousel-prev-next-filter';
4803
+ const cssVariableGradientColorWidth = '--p-gradient-color-width';
4803
4804
  const carouselTransitionDuration = motionDurationModerate;
4804
4805
  const paginationInfiniteStartCaseClass = 'pagination--infinite';
4805
4806
  const bulletClass = 'bullet';
@@ -4827,11 +4828,42 @@ const backfaceVisibilityJssStyle = {
4827
4828
  backfaceVisibility: 'hidden',
4828
4829
  WebkitBackfaceVisibility: 'hidden',
4829
4830
  };
4830
- const getComponentCss$11 = (hasHeading, hasDescription, hasControlsSlot, headingSize, width, hasPagination, isInfinitePagination, alignHeader, theme, hasNavigation) => {
4831
+ const gradientColorLight$1 = {
4832
+ 'background-base': '255,255,255',
4833
+ 'background-surface': '238,239,242',
4834
+ none: '',
4835
+ };
4836
+ const gradientColorDark$1 = {
4837
+ 'background-base': '14,14,18',
4838
+ 'background-surface': '33,34,37',
4839
+ none: '',
4840
+ };
4841
+ const gradientColorMap$1 = {
4842
+ auto: gradientColorLight$1,
4843
+ light: gradientColorLight$1,
4844
+ dark: gradientColorDark$1,
4845
+ };
4846
+ const getGradient$1 = (theme, gradientColorTheme) => {
4847
+ const gradientColor = gradientColorMap$1[theme][gradientColorTheme];
4848
+ return (`rgba(${gradientColor},1) 20%,` +
4849
+ `rgba(${gradientColor},0.6) 48%,` +
4850
+ `rgba(${gradientColor},0.3) 68%,` +
4851
+ `rgba(${gradientColor},0)`);
4852
+ };
4853
+ const getComponentCss$11 = (gradientColor, hasHeading, hasDescription, hasControlsSlot, headingSize, width, hasPagination, isInfinitePagination, alignHeader, theme, hasNavigation) => {
4831
4854
  const { primaryColor, contrastMediumColor } = getThemedColors(theme);
4832
4855
  const { primaryColor: primaryColorDark, contrastMediumColor: contrastMediumColorDark } = getThemedColors('dark');
4833
4856
  const { canvasTextColor } = getHighContrastColors();
4834
4857
  const isHeaderAlignCenter = alignHeader === 'center';
4858
+ const getGradientStyles = (direction) => gradientColor
4859
+ ? {
4860
+ [direction === 'left' ? 'right' : 'left']: 0,
4861
+ background: `linear-gradient(to ${direction}, ${getGradient$1(theme, gradientColor)} 100%)`,
4862
+ ...prefersColorSchemeDarkMediaQuery(theme, {
4863
+ background: `linear-gradient(to ${direction}, ${getGradient$1('dark', gradientColor)} 100%)`,
4864
+ }),
4865
+ }
4866
+ : {};
4835
4867
  return getCss({
4836
4868
  '@global': {
4837
4869
  ':host': {
@@ -4938,6 +4970,7 @@ const getComponentCss$11 = (hasHeading, hasDescription, hasControlsSlot, heading
4938
4970
  padding: '4px 0', // for slide focus outline
4939
4971
  margin: '-4px 0', // for slide focus outline
4940
4972
  '&__track': {
4973
+ position: 'relative',
4941
4974
  // !important is necessary to override inline styles set by splide library
4942
4975
  ...addImportantToEachRule({
4943
4976
  padding: `0 ${spacingMap[width].base}`,
@@ -4957,6 +4990,16 @@ const getComponentCss$11 = (hasHeading, hasDescription, hasControlsSlot, heading
4957
4990
  WebkitUserSelect: 'none',
4958
4991
  WebkitTouchCallout: 'none',
4959
4992
  },
4993
+ '&::before, &::after': {
4994
+ content: '""',
4995
+ position: 'absolute',
4996
+ zIndex: 1,
4997
+ top: 0,
4998
+ height: '100%',
4999
+ width: `var(${cssVariableGradientColorWidth}, 33%)`,
5000
+ },
5001
+ '&::before': getGradientStyles('right'),
5002
+ '&::after': getGradientStyles('left'),
4960
5003
  },
4961
5004
  '&__list': {
4962
5005
  ...backfaceVisibilityJssStyle,
@@ -8065,10 +8108,13 @@ const getComponentCss$x = (hideLabel, state, isDisabled, isLoading, isWithinForm
8065
8108
  // TODO: move into getSlottedTextFieldTextareaSelectStyles() via parameter, e.g. textAlign=center|start
8066
8109
  textAlign: 'center',
8067
8110
  // TODO: move into getSlottedTextFieldTextareaSelectStyles() via parameter, e.g. size=max|min
8068
- width: inputSize,
8111
+ maxWidth: inputSize,
8112
+ // min width is needed for showing at least 1 character in very narrow containers. The "1rem" value is the minimum safe zone to show at least.
8113
+ minWidth: `calc(1rem + ${borderWidthBase}*2 + ${spacingStaticSmall}*2)`,
8069
8114
  ...(length > 4 && {
8070
8115
  [getMediaQueryMax('xs')]: {
8071
8116
  // TODO: instead of having dedicated css rules depending on length we should try to implement a fluid one fits all solution
8117
+ maxWidth: 'auto',
8072
8118
  width: `calc((276px - (${spacingStaticSmall} * ${length - 1})) / ${length})`, // calculate the max with of the inputs that fit into grid in viewport base (276px)
8073
8119
  },
8074
8120
  }),
@@ -8118,7 +8164,7 @@ const getComponentCss$x = (hideLabel, state, isDisabled, isLoading, isWithinForm
8118
8164
  },
8119
8165
  wrapper: {
8120
8166
  display: 'grid',
8121
- gridTemplateColumns: `repeat(${length}, minmax(0, 1fr))`,
8167
+ gridTemplateColumns: `repeat(${length}, minmax(auto, 1fr))`,
8122
8168
  justifySelf: 'flex-start',
8123
8169
  gap: spacingStaticSmall,
8124
8170
  },
@@ -9037,6 +9083,12 @@ const getComponentCss$q = (isDisabled, hasCustomDropdown, hideLabel, state, them
9037
9083
 
9038
9084
  const INTERNAL_SELECT_SLOT = 'internal-select';
9039
9085
 
9086
+ const cssVarBackgroundColor = '--p-select-background-color';
9087
+ const cssVarTextColor = '--p-select-text-color';
9088
+ const cssVarBorderColor = '--p-select-border-color';
9089
+ const cssVarIconFilter = '--p-select-icon-filter';
9090
+ const cssVarBackgroundColorFocus = '--p-select-focus-background-color';
9091
+ const cssVarBorderColorFocus = '--p-select-focus-border-color';
9040
9092
  const getComponentCss$p = (direction, isOpen, isDisabled, hideLabel, state, isWithinForm, isNativePopoverCase, theme) => {
9041
9093
  return getCss({
9042
9094
  '@global': {
@@ -9081,6 +9133,9 @@ const getComponentCss$p = (direction, isOpen, isDisabled, hideLabel, state, isWi
9081
9133
  pointerEvents: 'none',
9082
9134
  transform: 'rotate3d(0,0,1,0.0001deg)', // needs to be a little more than 0 for correct direction in safari
9083
9135
  transition: getTransition('transform'),
9136
+ ...(!isHighContrastMode && {
9137
+ filter: `var(${cssVarIconFilter})`,
9138
+ }),
9084
9139
  '&--rotate': {
9085
9140
  transform: 'rotate3d(0,0,1,180deg)',
9086
9141
  },
@@ -9129,30 +9184,38 @@ const getButtonStyles = (isDisabled, direction, isOpen, state, theme) => {
9129
9184
  cursor: 'not-allowed',
9130
9185
  },
9131
9186
  transition: `${getTransition('background-color')}, ${getTransition('border-color')}, ${getTransition('color')}`, // for smooth transitions between e.g. disabled states
9132
- color: primaryColor,
9133
- '&:not(:focus)': {
9134
- ...getPlaceholderJssStyle({ color: primaryColor, opacity: 1 }),
9135
- ...prefersColorSchemeDarkMediaQuery(theme, getPlaceholderJssStyle({ color: primaryColorDark, opacity: 1 })),
9187
+ color: `var(${cssVarTextColor}, ${primaryColor})`,
9188
+ background: `var(${cssVarBackgroundColor}, ${backgroundColor})`,
9189
+ border: `${borderWidthBase} solid var(${cssVarBorderColor}, ${isOpen ? primaryColor : formStateColor || contrastMediumColor})`,
9190
+ borderRadius: borderRadiusSmall,
9191
+ '&:not(:focus-visible)': {
9192
+ ...getPlaceholderJssStyle({
9193
+ color: `var(${cssVarTextColor}, ${primaryColor})`,
9194
+ opacity: 1,
9195
+ }),
9196
+ ...prefersColorSchemeDarkMediaQuery(theme, getPlaceholderJssStyle({
9197
+ color: `var(${cssVarTextColor}, ${primaryColorDark})`,
9198
+ opacity: 1,
9199
+ })),
9136
9200
  }, // Opacity fixes placeholder being shown lighter in firefox
9137
9201
  ...hoverMediaQuery({
9138
- '&:hover:not(:disabled):not(:focus),label:hover~.wrapper &:not(:disabled):not(:focus)': {
9139
- borderColor: isOpen ? primaryColor : formStateHoverColor || primaryColor,
9202
+ '&:hover:not(:disabled):not(:focus-visible),label:hover~.wrapper &:not(:disabled):not(:focus-visible)': {
9203
+ borderColor: `var(${cssVarBorderColor}, ${isOpen ? primaryColor : formStateHoverColor || primaryColor})`,
9140
9204
  ...prefersColorSchemeDarkMediaQuery(theme, {
9141
- borderColor: isOpen ? primaryColorDark : formStateHoverColorDark || primaryColorDark,
9205
+ borderColor: `var(${cssVarBorderColor}, ${isOpen ? primaryColorDark : formStateHoverColorDark || primaryColorDark})`,
9142
9206
  }),
9143
9207
  },
9144
9208
  }),
9145
9209
  ...(!isDisabled && {
9146
- '&:focus': {
9147
- borderColor: primaryColor,
9210
+ '&:focus-visible': {
9211
+ borderColor: `var(${cssVarBorderColorFocus}, ${primaryColor})`,
9212
+ background: `var(${cssVarBackgroundColorFocus}, ${backgroundColor})`,
9148
9213
  ...prefersColorSchemeDarkMediaQuery(theme, {
9149
- borderColor: primaryColorDark,
9214
+ borderColor: `var(${cssVarBorderColorFocus}, ${primaryColorDark})`,
9215
+ background: `var(${cssVarBackgroundColorFocus}, ${backgroundColorDark})`,
9150
9216
  }),
9151
9217
  },
9152
9218
  }),
9153
- background: backgroundColor,
9154
- border: `${borderWidthBase} solid ${isOpen ? primaryColor : formStateColor || contrastMediumColor}`,
9155
- borderRadius: borderRadiusSmall,
9156
9219
  ...(isOpen && {
9157
9220
  ['paddingBottom' ]: `calc(${formElementPaddingVertical} + 1px)`, // Add padding to keep same height when border changes
9158
9221
  ['borderBottom' ]: addImportantToRule(`1px solid ${contrastMediumColor}`),
@@ -9160,16 +9223,18 @@ const getButtonStyles = (isDisabled, direction, isOpen, state, theme) => {
9160
9223
  ['borderBottomRightRadius' ]: 0,
9161
9224
  }),
9162
9225
  ...(isDisabled && {
9163
- ...getPlaceholderJssStyle({ color: disabledColor }),
9226
+ ...getPlaceholderJssStyle({
9227
+ color: disabledColor,
9228
+ }),
9164
9229
  cursor: 'not-allowed',
9165
9230
  color: disabledColor,
9166
9231
  borderColor: disabledColor,
9167
9232
  WebkitTextFillColor: disabledColor,
9168
9233
  }),
9169
9234
  ...prefersColorSchemeDarkMediaQuery(theme, {
9170
- color: primaryColorDark,
9171
- background: backgroundColorDark,
9172
- border: `${borderWidthBase} solid ${isOpen ? primaryColorDark : formStateColorDark || contrastMediumColorDark}`,
9235
+ color: `var(${cssVarTextColor}, ${primaryColorDark})`,
9236
+ background: `var(${cssVarBackgroundColor}, ${backgroundColorDark})`,
9237
+ border: `${borderWidthBase} solid var(${cssVarBorderColor}, ${isOpen ? primaryColorDark : formStateColorDark || contrastMediumColorDark})`,
9173
9238
  ...(isOpen && {
9174
9239
  ['borderBottom' ]: addImportantToRule(`1px solid ${contrastMediumColorDark}`),
9175
9240
  }),
@@ -9205,7 +9270,7 @@ const getListStyles = (isOpen, direction, theme) => {
9205
9270
  overflowY: 'auto',
9206
9271
  WebkitOverflowScrolling: 'touch',
9207
9272
  background: backgroundColor,
9208
- border: `2px solid ${primaryColor}`,
9273
+ border: `2px solid var(${cssVarBorderColor}, ${primaryColor})`,
9209
9274
  ['borderTop' ]: 'none',
9210
9275
  borderRadius: borderRadiusSmall,
9211
9276
  ['borderTopLeftRadius' ]: 0,
@@ -9216,7 +9281,7 @@ const getListStyles = (isOpen, direction, theme) => {
9216
9281
  transform: 'translate3d(0,0,0)', // fix iOS bug if less than 5 items are displayed
9217
9282
  ...prefersColorSchemeDarkMediaQuery(theme, {
9218
9283
  background: backgroundColorDark,
9219
- borderColor: primaryColorDark,
9284
+ borderColor: `var(${cssVarBorderColor}, ${primaryColorDark})`,
9220
9285
  }),
9221
9286
  };
9222
9287
  };
@@ -10168,7 +10233,7 @@ const showCustomCalendarOrTimeIndicator = (isCalendar, isTime) => {
10168
10233
 
10169
10234
  const cssVariableInputPaddingStart = '--p-internal-text-field-input-padding-start';
10170
10235
  const cssVariableInputPaddingEnd = '--p-internal-text-field-input-padding-end';
10171
- const getComponentCss$8 = (isDisabled, hideLabel, state, hasUnitOrVisibleCounter, unitPosition, inputType, showPasswordToggle, isWithinForm, hasSubmitButton, theme) => {
10236
+ const getComponentCss$8 = (isDisabled, hideLabel, state, hasUnitOrVisibleCounter, unitPosition, inputType, showPasswordToggle, isWithinForm, hasSubmitButton, theme, unitLength) => {
10172
10237
  const isSearch = isType(inputType, 'search');
10173
10238
  const isPassword = isType(inputType, 'password');
10174
10239
  const isNumber = isType(inputType, 'number');
@@ -10178,6 +10243,9 @@ const getComponentCss$8 = (isDisabled, hideLabel, state, hasUnitOrVisibleCounter
10178
10243
  const isSearchWithoutFormOrSubmitButton = isSearch && (!isWithinForm || !hasSubmitButton);
10179
10244
  const isSearchWithForm = isSearch && isWithinForm;
10180
10245
  const isCalendarOrTimeWithCustomIndicator = showCustomCalendarOrTimeIndicator(isCalendar, isTime);
10246
+ const counterCharacterLengthCssVar = 'var(--p-internal-counter-character-length)';
10247
+ const paddingInlineIfUnitOrCounter = hasUnitOrVisibleCounter &&
10248
+ `calc(${formElementLayeredGap} + ${formElementPaddingHorizontal} + ${borderWidthBase} + ${counterCharacterLengthCssVar} * 1ch * log(2.6))`;
10181
10249
  return getCss({
10182
10250
  '@global': {
10183
10251
  ':host': {
@@ -10193,8 +10261,12 @@ const getComponentCss$8 = (isDisabled, hideLabel, state, hasUnitOrVisibleCounter
10193
10261
  ...getSlottedTextFieldTextareaSelectStyles('input', state, false, theme, {
10194
10262
  gridArea: '1/1/1/-1',
10195
10263
  padding: `${formElementPaddingVertical} ${formElementPaddingHorizontal}`,
10196
- paddingInlineStart: `var(${cssVariableInputPaddingStart})`, // iOS Safari 14.5 can't handle padding-inline shorthand with css variables
10197
- paddingInlineEnd: `var(${cssVariableInputPaddingEnd})`, // iOS Safari 14.5 can't handle padding-inline shorthand with css variables
10264
+ paddingInlineStart: hasUnitOrVisibleCounter && unitPosition === 'prefix'
10265
+ ? paddingInlineIfUnitOrCounter
10266
+ : `var(${cssVariableInputPaddingStart})`, // iOS Safari 14.5 can't handle padding-inline shorthand with css variables
10267
+ paddingInlineEnd: hasUnitOrVisibleCounter && unitPosition === 'suffix'
10268
+ ? paddingInlineIfUnitOrCounter
10269
+ : `var(${cssVariableInputPaddingEnd})`, // iOS Safari 14.5 can't handle padding-inline shorthand with css variables
10198
10270
  // TODO: move into getSlottedTextFieldTextareaSelectStyles()
10199
10271
  ...(isNumber && {
10200
10272
  MozAppearance: 'textfield', // hides up/down spin button for Firefox
@@ -10419,6 +10491,8 @@ const getComponentCss$4 = (isDisabled, hideLabel, state, hasCounter, theme) => {
10419
10491
  root: {
10420
10492
  display: 'grid',
10421
10493
  gap: spacingStaticXSmall,
10494
+ // min width is needed for showing at least 1 character in very narrow containers. The "1rem" value is the minimum safe zone to show at least 1 character.
10495
+ minWidth: `calc(1rem + ${formElementPaddingHorizontal}*2 + ${borderWidthBase}*2)`,
10422
10496
  },
10423
10497
  wrapper: {
10424
10498
  display: 'grid',
@@ -10470,6 +10544,8 @@ const getComponentCss$3 = (isDisabled, hideLabel, state, hasCounter, resize, the
10470
10544
  background: 'transparent',
10471
10545
  textIndent: 0,
10472
10546
  color: primaryColor,
10547
+ // min width is needed for showing at least 1 character in very narrow containers. The "1rem" value is the minimum safe zone to show at least 1 character.
10548
+ minWidth: `calc(1rem + ${formElementPaddingHorizontal}*2 + ${borderWidthBase}*2)`,
10473
10549
  transition: `${getTransition('background-color')}, ${getTransition('border-color')}, ${getTransition('color')}`, // for smooth transitions between e.g. disabled states
10474
10550
  ...prefersColorSchemeDarkMediaQuery(theme, {
10475
10551
  borderColor: formStateColorDark || contrastMediumColorDark,
@@ -7,22 +7,22 @@ var hooks = require('../../hooks.cjs');
7
7
  var utils = require('../../utils.cjs');
8
8
  var carousel = require('../dsr-components/carousel.cjs');
9
9
 
10
- const PCarousel = react.forwardRef(({ activeSlideIndex = 0, alignHeader = 'start', aria, description, disablePagination, heading, headingSize = 'x-large', intl, onCarouselChange, onUpdate, pagination = true, rewind = true, skipLinkTarget, slidesPerPage = 1, theme, width = 'basic', wrapContent, className, children, ...rest }, ref) => {
10
+ const PCarousel = react.forwardRef(({ activeSlideIndex = 0, alignHeader = 'start', aria, description, disablePagination, focusOnCenterSlide = false, gradientColor = 'none', heading, headingSize = 'x-large', intl, onCarouselChange, onUpdate, pagination = true, rewind = true, skipLinkTarget, slidesPerPage = 1, theme, width = 'basic', wrapContent, className, children, ...rest }, ref) => {
11
11
  const elementRef = react.useRef();
12
12
  hooks.useEventCallback(elementRef, 'carouselChange', onCarouselChange);
13
13
  hooks.useEventCallback(elementRef, 'update', onUpdate);
14
14
  const WebComponentTag = hooks.usePrefix('p-carousel');
15
- const propsToSync = [activeSlideIndex, alignHeader, aria, description, disablePagination, heading, headingSize, intl, pagination, rewind, skipLinkTarget, slidesPerPage, theme || hooks.useTheme(), width, wrapContent];
15
+ const propsToSync = [activeSlideIndex, alignHeader, aria, description, disablePagination, focusOnCenterSlide, gradientColor, heading, headingSize, intl, pagination, rewind, skipLinkTarget, slidesPerPage, theme || hooks.useTheme(), width, wrapContent];
16
16
  hooks.useBrowserLayoutEffect(() => {
17
17
  const { current } = elementRef;
18
- ['activeSlideIndex', 'alignHeader', 'aria', 'description', 'disablePagination', 'heading', 'headingSize', 'intl', 'pagination', 'rewind', 'skipLinkTarget', 'slidesPerPage', 'theme', 'width', 'wrapContent'].forEach((propName, i) => (current[propName] = propsToSync[i]));
18
+ ['activeSlideIndex', 'alignHeader', 'aria', 'description', 'disablePagination', 'focusOnCenterSlide', 'gradientColor', 'heading', 'headingSize', 'intl', 'pagination', 'rewind', 'skipLinkTarget', 'slidesPerPage', 'theme', 'width', 'wrapContent'].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(carousel.DSRCarousel, { activeSlideIndex, alignHeader, aria, description, disablePagination, heading, headingSize, intl, pagination, rewind, skipLinkTarget, slidesPerPage, theme: theme || hooks.useTheme(), width, wrapContent, children })),
25
+ children: (jsxRuntime.jsx(carousel.DSRCarousel, { activeSlideIndex, alignHeader, aria, description, disablePagination, focusOnCenterSlide, gradientColor, heading, headingSize, intl, pagination, rewind, skipLinkTarget, slidesPerPage, theme: theme || hooks.useTheme(), width, wrapContent, children })),
26
26
  }
27
27
  : {
28
28
  children,
@@ -116,13 +116,13 @@ class DSRCarousel extends react.Component {
116
116
  // 'aria-controls': 'splide-track', // TODO: cross shadow dom? use native button tag instead of p-button-pure?
117
117
  };
118
118
  const headingId = 'heading';
119
- const style = minifyCss.minifyCss(stripFocusAndHoverStyles.stripFocusAndHoverStyles(stylesEntry.getCarouselCss(hasHeadingPropOrSlot, hasDescriptionPropOrSlot, hasControlsSlot, this.props.headingSize, this.props.width,
119
+ const style = minifyCss.minifyCss(stripFocusAndHoverStyles.stripFocusAndHoverStyles(stylesEntry.getCarouselCss(this.props.gradientColor, hasHeadingPropOrSlot, hasDescriptionPropOrSlot, hasControlsSlot, this.props.headingSize, this.props.width,
120
120
  // flip boolean values of disablePagination since it is the inverse of pagination
121
121
  this.props.disablePagination
122
122
  ? typeof this.props.disablePagination === 'object'
123
123
  ? Object.fromEntries(Object.entries(this.props.disablePagination).map(([key, value]) => [key, !value]))
124
124
  : !this.props.disablePagination
125
- : this.props.pagination, utilsEntry.isInfinitePagination(this.props.amountOfPages), (alignHeaderDeprecationMap[this.props.alignHeader] ||
125
+ : this.props.pagination, utilsEntry.isInfinitePagination(this.props.focusOnCenterSlide ? this.slides.length : this.props.amountOfPages), (alignHeaderDeprecationMap[this.props.alignHeader] ||
126
126
  this.props.alignHeader), this.props.theme, (this.props.slidesPerPage === 'auto' || typeof this.props.slidesPerPage === 'object' || this.props.slidesPerPage < otherChildren.length))));
127
127
  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: [jsxRuntime.jsxs("div", { className: "header", children: [hasHeadingPropOrSlot &&
128
128
  (this.props.heading ? (jsxRuntime.jsx("h2", { className: "heading", id: headingId, children: this.props.heading })) : (jsxRuntime.jsx("div", { className: "heading", id: headingId, children: jsxRuntime.jsx("slot", { name: "heading" }) }))), hasDescriptionPropOrSlot && (this.props.description ? jsxRuntime.jsx("p", { children: this.props.description }) : jsxRuntime.jsx("slot", { name: "description" })), hasControlsSlot && jsxRuntime.jsx("slot", { name: "controls" }), jsxRuntime.jsxs("div", { className: "nav", children: [this.props.skipLinkTarget && (jsxRuntime.jsx(linkPure_wrapper.PLinkPure, { href: this.props.skipLinkTarget, theme: this.props.theme, icon: "arrow-last", className: "btn skip-link", alignLabel: "start", hideLabel: true, children: "Skip carousel entries" })), (this.props.slidesPerPage === 'auto' || typeof this.props.slidesPerPage === 'object' || this.props.slidesPerPage < otherChildren.length) && (jsxRuntime.jsx(buttonPure_wrapper.PButtonPure, { ...btnProps, icon: "arrow-left" })), (this.props.slidesPerPage === 'auto' || typeof this.props.slidesPerPage === 'object' || this.props.slidesPerPage < otherChildren.length) && (jsxRuntime.jsx(buttonPure_wrapper.PButtonPure, { ...btnProps, icon: "arrow-right" }))] })] }), jsxRuntime.jsx("div", { id: "splide", className: "splide", ...utilsEntry.parseAndGetAriaAttributes({
@@ -130,6 +130,7 @@ class DSRCarousel extends react.Component {
130
130
  ...utilsEntry.parseAndGetAriaAttributes(this.props.aria),
131
131
  }), children: jsxRuntime.jsx("div", { className: "splide__track", children: jsxRuntime.jsx("div", { className: "splide__list", children: otherChildren.map((_, i) => (jsxRuntime.jsx("div", { className: "splide__slide", children: jsxRuntime.jsx("slot", { name: `slide-${i}` }) }, i))) }) }) }), (this.props.disablePagination ? this.props.disablePagination !== true : this.props.pagination) && (this.props.slidesPerPage === 'auto' || typeof this.props.slidesPerPage === 'object' || this.props.slidesPerPage < otherChildren.length) && (jsxRuntime.jsx("div", { className: "pagination-container", "aria-hidden": "true", children: jsxRuntime.jsx("div", { className: "pagination" }) }))] })] }), this.props.children] }));
132
132
  }
133
+ getPageCount = () => (this.props.focusOnCenterSlide ? this.slides.length : this.props.amountOfPages);
133
134
  }
134
135
 
135
136
  exports.DSRCarousel = DSRCarousel;
@@ -4798,6 +4798,7 @@ const getComponentCss$12 = (isSidebarStartOpen, sidebarStartWidth, isSidebarEndO
4798
4798
  };
4799
4799
 
4800
4800
  const cssVariablePrevNextFilter = '--p-carousel-prev-next-filter';
4801
+ const cssVariableGradientColorWidth = '--p-gradient-color-width';
4801
4802
  const carouselTransitionDuration = motionDurationModerate;
4802
4803
  const paginationInfiniteStartCaseClass = 'pagination--infinite';
4803
4804
  const bulletClass = 'bullet';
@@ -4825,11 +4826,42 @@ const backfaceVisibilityJssStyle = {
4825
4826
  backfaceVisibility: 'hidden',
4826
4827
  WebkitBackfaceVisibility: 'hidden',
4827
4828
  };
4828
- const getComponentCss$11 = (hasHeading, hasDescription, hasControlsSlot, headingSize, width, hasPagination, isInfinitePagination, alignHeader, theme, hasNavigation) => {
4829
+ const gradientColorLight$1 = {
4830
+ 'background-base': '255,255,255',
4831
+ 'background-surface': '238,239,242',
4832
+ none: '',
4833
+ };
4834
+ const gradientColorDark$1 = {
4835
+ 'background-base': '14,14,18',
4836
+ 'background-surface': '33,34,37',
4837
+ none: '',
4838
+ };
4839
+ const gradientColorMap$1 = {
4840
+ auto: gradientColorLight$1,
4841
+ light: gradientColorLight$1,
4842
+ dark: gradientColorDark$1,
4843
+ };
4844
+ const getGradient$1 = (theme, gradientColorTheme) => {
4845
+ const gradientColor = gradientColorMap$1[theme][gradientColorTheme];
4846
+ return (`rgba(${gradientColor},1) 20%,` +
4847
+ `rgba(${gradientColor},0.6) 48%,` +
4848
+ `rgba(${gradientColor},0.3) 68%,` +
4849
+ `rgba(${gradientColor},0)`);
4850
+ };
4851
+ const getComponentCss$11 = (gradientColor, hasHeading, hasDescription, hasControlsSlot, headingSize, width, hasPagination, isInfinitePagination, alignHeader, theme, hasNavigation) => {
4829
4852
  const { primaryColor, contrastMediumColor } = getThemedColors(theme);
4830
4853
  const { primaryColor: primaryColorDark, contrastMediumColor: contrastMediumColorDark } = getThemedColors('dark');
4831
4854
  const { canvasTextColor } = getHighContrastColors();
4832
4855
  const isHeaderAlignCenter = alignHeader === 'center';
4856
+ const getGradientStyles = (direction) => gradientColor
4857
+ ? {
4858
+ [direction === 'left' ? 'right' : 'left']: 0,
4859
+ background: `linear-gradient(to ${direction}, ${getGradient$1(theme, gradientColor)} 100%)`,
4860
+ ...prefersColorSchemeDarkMediaQuery(theme, {
4861
+ background: `linear-gradient(to ${direction}, ${getGradient$1('dark', gradientColor)} 100%)`,
4862
+ }),
4863
+ }
4864
+ : {};
4833
4865
  return getCss({
4834
4866
  '@global': {
4835
4867
  ':host': {
@@ -4936,6 +4968,7 @@ const getComponentCss$11 = (hasHeading, hasDescription, hasControlsSlot, heading
4936
4968
  padding: '4px 0', // for slide focus outline
4937
4969
  margin: '-4px 0', // for slide focus outline
4938
4970
  '&__track': {
4971
+ position: 'relative',
4939
4972
  // !important is necessary to override inline styles set by splide library
4940
4973
  ...addImportantToEachRule({
4941
4974
  padding: `0 ${spacingMap[width].base}`,
@@ -4955,6 +4988,16 @@ const getComponentCss$11 = (hasHeading, hasDescription, hasControlsSlot, heading
4955
4988
  WebkitUserSelect: 'none',
4956
4989
  WebkitTouchCallout: 'none',
4957
4990
  },
4991
+ '&::before, &::after': {
4992
+ content: '""',
4993
+ position: 'absolute',
4994
+ zIndex: 1,
4995
+ top: 0,
4996
+ height: '100%',
4997
+ width: `var(${cssVariableGradientColorWidth}, 33%)`,
4998
+ },
4999
+ '&::before': getGradientStyles('right'),
5000
+ '&::after': getGradientStyles('left'),
4958
5001
  },
4959
5002
  '&__list': {
4960
5003
  ...backfaceVisibilityJssStyle,
@@ -8063,10 +8106,13 @@ const getComponentCss$x = (hideLabel, state, isDisabled, isLoading, isWithinForm
8063
8106
  // TODO: move into getSlottedTextFieldTextareaSelectStyles() via parameter, e.g. textAlign=center|start
8064
8107
  textAlign: 'center',
8065
8108
  // TODO: move into getSlottedTextFieldTextareaSelectStyles() via parameter, e.g. size=max|min
8066
- width: inputSize,
8109
+ maxWidth: inputSize,
8110
+ // min width is needed for showing at least 1 character in very narrow containers. The "1rem" value is the minimum safe zone to show at least.
8111
+ minWidth: `calc(1rem + ${borderWidthBase}*2 + ${spacingStaticSmall}*2)`,
8067
8112
  ...(length > 4 && {
8068
8113
  [getMediaQueryMax('xs')]: {
8069
8114
  // TODO: instead of having dedicated css rules depending on length we should try to implement a fluid one fits all solution
8115
+ maxWidth: 'auto',
8070
8116
  width: `calc((276px - (${spacingStaticSmall} * ${length - 1})) / ${length})`, // calculate the max with of the inputs that fit into grid in viewport base (276px)
8071
8117
  },
8072
8118
  }),
@@ -8116,7 +8162,7 @@ const getComponentCss$x = (hideLabel, state, isDisabled, isLoading, isWithinForm
8116
8162
  },
8117
8163
  wrapper: {
8118
8164
  display: 'grid',
8119
- gridTemplateColumns: `repeat(${length}, minmax(0, 1fr))`,
8165
+ gridTemplateColumns: `repeat(${length}, minmax(auto, 1fr))`,
8120
8166
  justifySelf: 'flex-start',
8121
8167
  gap: spacingStaticSmall,
8122
8168
  },
@@ -9035,6 +9081,12 @@ const getComponentCss$q = (isDisabled, hasCustomDropdown, hideLabel, state, them
9035
9081
 
9036
9082
  const INTERNAL_SELECT_SLOT = 'internal-select';
9037
9083
 
9084
+ const cssVarBackgroundColor = '--p-select-background-color';
9085
+ const cssVarTextColor = '--p-select-text-color';
9086
+ const cssVarBorderColor = '--p-select-border-color';
9087
+ const cssVarIconFilter = '--p-select-icon-filter';
9088
+ const cssVarBackgroundColorFocus = '--p-select-focus-background-color';
9089
+ const cssVarBorderColorFocus = '--p-select-focus-border-color';
9038
9090
  const getComponentCss$p = (direction, isOpen, isDisabled, hideLabel, state, isWithinForm, isNativePopoverCase, theme) => {
9039
9091
  return getCss({
9040
9092
  '@global': {
@@ -9079,6 +9131,9 @@ const getComponentCss$p = (direction, isOpen, isDisabled, hideLabel, state, isWi
9079
9131
  pointerEvents: 'none',
9080
9132
  transform: 'rotate3d(0,0,1,0.0001deg)', // needs to be a little more than 0 for correct direction in safari
9081
9133
  transition: getTransition('transform'),
9134
+ ...(!isHighContrastMode && {
9135
+ filter: `var(${cssVarIconFilter})`,
9136
+ }),
9082
9137
  '&--rotate': {
9083
9138
  transform: 'rotate3d(0,0,1,180deg)',
9084
9139
  },
@@ -9127,30 +9182,38 @@ const getButtonStyles = (isDisabled, direction, isOpen, state, theme) => {
9127
9182
  cursor: 'not-allowed',
9128
9183
  },
9129
9184
  transition: `${getTransition('background-color')}, ${getTransition('border-color')}, ${getTransition('color')}`, // for smooth transitions between e.g. disabled states
9130
- color: primaryColor,
9131
- '&:not(:focus)': {
9132
- ...getPlaceholderJssStyle({ color: primaryColor, opacity: 1 }),
9133
- ...prefersColorSchemeDarkMediaQuery(theme, getPlaceholderJssStyle({ color: primaryColorDark, opacity: 1 })),
9185
+ color: `var(${cssVarTextColor}, ${primaryColor})`,
9186
+ background: `var(${cssVarBackgroundColor}, ${backgroundColor})`,
9187
+ border: `${borderWidthBase} solid var(${cssVarBorderColor}, ${isOpen ? primaryColor : formStateColor || contrastMediumColor})`,
9188
+ borderRadius: borderRadiusSmall,
9189
+ '&:not(:focus-visible)': {
9190
+ ...getPlaceholderJssStyle({
9191
+ color: `var(${cssVarTextColor}, ${primaryColor})`,
9192
+ opacity: 1,
9193
+ }),
9194
+ ...prefersColorSchemeDarkMediaQuery(theme, getPlaceholderJssStyle({
9195
+ color: `var(${cssVarTextColor}, ${primaryColorDark})`,
9196
+ opacity: 1,
9197
+ })),
9134
9198
  }, // Opacity fixes placeholder being shown lighter in firefox
9135
9199
  ...hoverMediaQuery({
9136
- '&:hover:not(:disabled):not(:focus),label:hover~.wrapper &:not(:disabled):not(:focus)': {
9137
- borderColor: isOpen ? primaryColor : formStateHoverColor || primaryColor,
9200
+ '&:hover:not(:disabled):not(:focus-visible),label:hover~.wrapper &:not(:disabled):not(:focus-visible)': {
9201
+ borderColor: `var(${cssVarBorderColor}, ${isOpen ? primaryColor : formStateHoverColor || primaryColor})`,
9138
9202
  ...prefersColorSchemeDarkMediaQuery(theme, {
9139
- borderColor: isOpen ? primaryColorDark : formStateHoverColorDark || primaryColorDark,
9203
+ borderColor: `var(${cssVarBorderColor}, ${isOpen ? primaryColorDark : formStateHoverColorDark || primaryColorDark})`,
9140
9204
  }),
9141
9205
  },
9142
9206
  }),
9143
9207
  ...(!isDisabled && {
9144
- '&:focus': {
9145
- borderColor: primaryColor,
9208
+ '&:focus-visible': {
9209
+ borderColor: `var(${cssVarBorderColorFocus}, ${primaryColor})`,
9210
+ background: `var(${cssVarBackgroundColorFocus}, ${backgroundColor})`,
9146
9211
  ...prefersColorSchemeDarkMediaQuery(theme, {
9147
- borderColor: primaryColorDark,
9212
+ borderColor: `var(${cssVarBorderColorFocus}, ${primaryColorDark})`,
9213
+ background: `var(${cssVarBackgroundColorFocus}, ${backgroundColorDark})`,
9148
9214
  }),
9149
9215
  },
9150
9216
  }),
9151
- background: backgroundColor,
9152
- border: `${borderWidthBase} solid ${isOpen ? primaryColor : formStateColor || contrastMediumColor}`,
9153
- borderRadius: borderRadiusSmall,
9154
9217
  ...(isOpen && {
9155
9218
  ['paddingBottom' ]: `calc(${formElementPaddingVertical} + 1px)`, // Add padding to keep same height when border changes
9156
9219
  ['borderBottom' ]: addImportantToRule(`1px solid ${contrastMediumColor}`),
@@ -9158,16 +9221,18 @@ const getButtonStyles = (isDisabled, direction, isOpen, state, theme) => {
9158
9221
  ['borderBottomRightRadius' ]: 0,
9159
9222
  }),
9160
9223
  ...(isDisabled && {
9161
- ...getPlaceholderJssStyle({ color: disabledColor }),
9224
+ ...getPlaceholderJssStyle({
9225
+ color: disabledColor,
9226
+ }),
9162
9227
  cursor: 'not-allowed',
9163
9228
  color: disabledColor,
9164
9229
  borderColor: disabledColor,
9165
9230
  WebkitTextFillColor: disabledColor,
9166
9231
  }),
9167
9232
  ...prefersColorSchemeDarkMediaQuery(theme, {
9168
- color: primaryColorDark,
9169
- background: backgroundColorDark,
9170
- border: `${borderWidthBase} solid ${isOpen ? primaryColorDark : formStateColorDark || contrastMediumColorDark}`,
9233
+ color: `var(${cssVarTextColor}, ${primaryColorDark})`,
9234
+ background: `var(${cssVarBackgroundColor}, ${backgroundColorDark})`,
9235
+ border: `${borderWidthBase} solid var(${cssVarBorderColor}, ${isOpen ? primaryColorDark : formStateColorDark || contrastMediumColorDark})`,
9171
9236
  ...(isOpen && {
9172
9237
  ['borderBottom' ]: addImportantToRule(`1px solid ${contrastMediumColorDark}`),
9173
9238
  }),
@@ -9203,7 +9268,7 @@ const getListStyles = (isOpen, direction, theme) => {
9203
9268
  overflowY: 'auto',
9204
9269
  WebkitOverflowScrolling: 'touch',
9205
9270
  background: backgroundColor,
9206
- border: `2px solid ${primaryColor}`,
9271
+ border: `2px solid var(${cssVarBorderColor}, ${primaryColor})`,
9207
9272
  ['borderTop' ]: 'none',
9208
9273
  borderRadius: borderRadiusSmall,
9209
9274
  ['borderTopLeftRadius' ]: 0,
@@ -9214,7 +9279,7 @@ const getListStyles = (isOpen, direction, theme) => {
9214
9279
  transform: 'translate3d(0,0,0)', // fix iOS bug if less than 5 items are displayed
9215
9280
  ...prefersColorSchemeDarkMediaQuery(theme, {
9216
9281
  background: backgroundColorDark,
9217
- borderColor: primaryColorDark,
9282
+ borderColor: `var(${cssVarBorderColor}, ${primaryColorDark})`,
9218
9283
  }),
9219
9284
  };
9220
9285
  };
@@ -10166,7 +10231,7 @@ const showCustomCalendarOrTimeIndicator = (isCalendar, isTime) => {
10166
10231
 
10167
10232
  const cssVariableInputPaddingStart = '--p-internal-text-field-input-padding-start';
10168
10233
  const cssVariableInputPaddingEnd = '--p-internal-text-field-input-padding-end';
10169
- const getComponentCss$8 = (isDisabled, hideLabel, state, hasUnitOrVisibleCounter, unitPosition, inputType, showPasswordToggle, isWithinForm, hasSubmitButton, theme) => {
10234
+ const getComponentCss$8 = (isDisabled, hideLabel, state, hasUnitOrVisibleCounter, unitPosition, inputType, showPasswordToggle, isWithinForm, hasSubmitButton, theme, unitLength) => {
10170
10235
  const isSearch = isType(inputType, 'search');
10171
10236
  const isPassword = isType(inputType, 'password');
10172
10237
  const isNumber = isType(inputType, 'number');
@@ -10176,6 +10241,9 @@ const getComponentCss$8 = (isDisabled, hideLabel, state, hasUnitOrVisibleCounter
10176
10241
  const isSearchWithoutFormOrSubmitButton = isSearch && (!isWithinForm || !hasSubmitButton);
10177
10242
  const isSearchWithForm = isSearch && isWithinForm;
10178
10243
  const isCalendarOrTimeWithCustomIndicator = showCustomCalendarOrTimeIndicator(isCalendar, isTime);
10244
+ const counterCharacterLengthCssVar = 'var(--p-internal-counter-character-length)';
10245
+ const paddingInlineIfUnitOrCounter = hasUnitOrVisibleCounter &&
10246
+ `calc(${formElementLayeredGap} + ${formElementPaddingHorizontal} + ${borderWidthBase} + ${counterCharacterLengthCssVar} * 1ch * log(2.6))`;
10179
10247
  return getCss({
10180
10248
  '@global': {
10181
10249
  ':host': {
@@ -10191,8 +10259,12 @@ const getComponentCss$8 = (isDisabled, hideLabel, state, hasUnitOrVisibleCounter
10191
10259
  ...getSlottedTextFieldTextareaSelectStyles('input', state, false, theme, {
10192
10260
  gridArea: '1/1/1/-1',
10193
10261
  padding: `${formElementPaddingVertical} ${formElementPaddingHorizontal}`,
10194
- paddingInlineStart: `var(${cssVariableInputPaddingStart})`, // iOS Safari 14.5 can't handle padding-inline shorthand with css variables
10195
- paddingInlineEnd: `var(${cssVariableInputPaddingEnd})`, // iOS Safari 14.5 can't handle padding-inline shorthand with css variables
10262
+ paddingInlineStart: hasUnitOrVisibleCounter && unitPosition === 'prefix'
10263
+ ? paddingInlineIfUnitOrCounter
10264
+ : `var(${cssVariableInputPaddingStart})`, // iOS Safari 14.5 can't handle padding-inline shorthand with css variables
10265
+ paddingInlineEnd: hasUnitOrVisibleCounter && unitPosition === 'suffix'
10266
+ ? paddingInlineIfUnitOrCounter
10267
+ : `var(${cssVariableInputPaddingEnd})`, // iOS Safari 14.5 can't handle padding-inline shorthand with css variables
10196
10268
  // TODO: move into getSlottedTextFieldTextareaSelectStyles()
10197
10269
  ...(isNumber && {
10198
10270
  MozAppearance: 'textfield', // hides up/down spin button for Firefox
@@ -10417,6 +10489,8 @@ const getComponentCss$4 = (isDisabled, hideLabel, state, hasCounter, theme) => {
10417
10489
  root: {
10418
10490
  display: 'grid',
10419
10491
  gap: spacingStaticXSmall,
10492
+ // min width is needed for showing at least 1 character in very narrow containers. The "1rem" value is the minimum safe zone to show at least 1 character.
10493
+ minWidth: `calc(1rem + ${formElementPaddingHorizontal}*2 + ${borderWidthBase}*2)`,
10420
10494
  },
10421
10495
  wrapper: {
10422
10496
  display: 'grid',
@@ -10468,6 +10542,8 @@ const getComponentCss$3 = (isDisabled, hideLabel, state, hasCounter, resize, the
10468
10542
  background: 'transparent',
10469
10543
  textIndent: 0,
10470
10544
  color: primaryColor,
10545
+ // min width is needed for showing at least 1 character in very narrow containers. The "1rem" value is the minimum safe zone to show at least 1 character.
10546
+ minWidth: `calc(1rem + ${formElementPaddingHorizontal}*2 + ${borderWidthBase}*2)`,
10471
10547
  transition: `${getTransition('background-color')}, ${getTransition('border-color')}, ${getTransition('color')}`, // for smooth transitions between e.g. disabled states
10472
10548
  ...prefersColorSchemeDarkMediaQuery(theme, {
10473
10549
  borderColor: formStateColorDark || contrastMediumColorDark,
@@ -5,22 +5,22 @@ import { useEventCallback, usePrefix, useTheme, useBrowserLayoutEffect, useMerge
5
5
  import { syncRef } from '../../utils.mjs';
6
6
  import { DSRCarousel } from '../dsr-components/carousel.mjs';
7
7
 
8
- const PCarousel = forwardRef(({ activeSlideIndex = 0, alignHeader = 'start', aria, description, disablePagination, heading, headingSize = 'x-large', intl, onCarouselChange, onUpdate, pagination = true, rewind = true, skipLinkTarget, slidesPerPage = 1, theme, width = 'basic', wrapContent, className, children, ...rest }, ref) => {
8
+ const PCarousel = forwardRef(({ activeSlideIndex = 0, alignHeader = 'start', aria, description, disablePagination, focusOnCenterSlide = false, gradientColor = 'none', heading, headingSize = 'x-large', intl, onCarouselChange, onUpdate, pagination = true, rewind = true, skipLinkTarget, slidesPerPage = 1, theme, width = 'basic', wrapContent, className, children, ...rest }, ref) => {
9
9
  const elementRef = useRef();
10
10
  useEventCallback(elementRef, 'carouselChange', onCarouselChange);
11
11
  useEventCallback(elementRef, 'update', onUpdate);
12
12
  const WebComponentTag = usePrefix('p-carousel');
13
- const propsToSync = [activeSlideIndex, alignHeader, aria, description, disablePagination, heading, headingSize, intl, pagination, rewind, skipLinkTarget, slidesPerPage, theme || useTheme(), width, wrapContent];
13
+ const propsToSync = [activeSlideIndex, alignHeader, aria, description, disablePagination, focusOnCenterSlide, gradientColor, heading, headingSize, intl, pagination, rewind, skipLinkTarget, slidesPerPage, theme || useTheme(), width, wrapContent];
14
14
  useBrowserLayoutEffect(() => {
15
15
  const { current } = elementRef;
16
- ['activeSlideIndex', 'alignHeader', 'aria', 'description', 'disablePagination', 'heading', 'headingSize', 'intl', 'pagination', 'rewind', 'skipLinkTarget', 'slidesPerPage', 'theme', 'width', 'wrapContent'].forEach((propName, i) => (current[propName] = propsToSync[i]));
16
+ ['activeSlideIndex', 'alignHeader', 'aria', 'description', 'disablePagination', 'focusOnCenterSlide', 'gradientColor', 'heading', 'headingSize', 'intl', 'pagination', 'rewind', 'skipLinkTarget', 'slidesPerPage', 'theme', 'width', 'wrapContent'].forEach((propName, i) => (current[propName] = propsToSync[i]));
17
17
  }, propsToSync);
18
18
  const props = {
19
19
  ...rest,
20
20
  // @ts-ignore
21
21
  ...(!process.browser
22
22
  ? {
23
- children: (jsx(DSRCarousel, { activeSlideIndex, alignHeader, aria, description, disablePagination, heading, headingSize, intl, pagination, rewind, skipLinkTarget, slidesPerPage, theme: theme || useTheme(), width, wrapContent, children })),
23
+ children: (jsx(DSRCarousel, { activeSlideIndex, alignHeader, aria, description, disablePagination, focusOnCenterSlide, gradientColor, heading, headingSize, intl, pagination, rewind, skipLinkTarget, slidesPerPage, theme: theme || useTheme(), width, wrapContent, children })),
24
24
  }
25
25
  : {
26
26
  children,
@@ -114,13 +114,13 @@ class DSRCarousel extends Component {
114
114
  // 'aria-controls': 'splide-track', // TODO: cross shadow dom? use native button tag instead of p-button-pure?
115
115
  };
116
116
  const headingId = 'heading';
117
- const style = minifyCss(stripFocusAndHoverStyles(getComponentCss$11(hasHeadingPropOrSlot, hasDescriptionPropOrSlot, hasControlsSlot, this.props.headingSize, this.props.width,
117
+ const style = minifyCss(stripFocusAndHoverStyles(getComponentCss$11(this.props.gradientColor, hasHeadingPropOrSlot, hasDescriptionPropOrSlot, hasControlsSlot, this.props.headingSize, this.props.width,
118
118
  // flip boolean values of disablePagination since it is the inverse of pagination
119
119
  this.props.disablePagination
120
120
  ? typeof this.props.disablePagination === 'object'
121
121
  ? Object.fromEntries(Object.entries(this.props.disablePagination).map(([key, value]) => [key, !value]))
122
122
  : !this.props.disablePagination
123
- : this.props.pagination, isInfinitePagination(this.props.amountOfPages), (alignHeaderDeprecationMap[this.props.alignHeader] ||
123
+ : this.props.pagination, isInfinitePagination(this.props.focusOnCenterSlide ? this.slides.length : this.props.amountOfPages), (alignHeaderDeprecationMap[this.props.alignHeader] ||
124
124
  this.props.alignHeader), this.props.theme, (this.props.slidesPerPage === 'auto' || typeof this.props.slidesPerPage === 'object' || this.props.slidesPerPage < otherChildren.length))));
125
125
  return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxs(Fragment, { children: [jsxs("div", { className: "header", children: [hasHeadingPropOrSlot &&
126
126
  (this.props.heading ? (jsx("h2", { className: "heading", id: headingId, children: this.props.heading })) : (jsx("div", { className: "heading", id: headingId, children: jsx("slot", { name: "heading" }) }))), hasDescriptionPropOrSlot && (this.props.description ? jsx("p", { children: this.props.description }) : jsx("slot", { name: "description" })), hasControlsSlot && jsx("slot", { name: "controls" }), jsxs("div", { className: "nav", children: [this.props.skipLinkTarget && (jsx(PLinkPure, { href: this.props.skipLinkTarget, theme: this.props.theme, icon: "arrow-last", className: "btn skip-link", alignLabel: "start", hideLabel: true, children: "Skip carousel entries" })), (this.props.slidesPerPage === 'auto' || typeof this.props.slidesPerPage === 'object' || this.props.slidesPerPage < otherChildren.length) && (jsx(PButtonPure, { ...btnProps, icon: "arrow-left" })), (this.props.slidesPerPage === 'auto' || typeof this.props.slidesPerPage === 'object' || this.props.slidesPerPage < otherChildren.length) && (jsx(PButtonPure, { ...btnProps, icon: "arrow-right" }))] })] }), jsx("div", { id: "splide", className: "splide", ...parseAndGetAriaAttributes({
@@ -128,6 +128,7 @@ class DSRCarousel extends Component {
128
128
  ...parseAndGetAriaAttributes(this.props.aria),
129
129
  }), children: jsx("div", { className: "splide__track", children: jsx("div", { className: "splide__list", children: otherChildren.map((_, i) => (jsx("div", { className: "splide__slide", children: jsx("slot", { name: `slide-${i}` }) }, i))) }) }) }), (this.props.disablePagination ? this.props.disablePagination !== true : this.props.pagination) && (this.props.slidesPerPage === 'auto' || typeof this.props.slidesPerPage === 'object' || this.props.slidesPerPage < otherChildren.length) && (jsx("div", { className: "pagination-container", "aria-hidden": "true", children: jsx("div", { className: "pagination" }) }))] })] }), this.props.children] }));
130
130
  }
131
+ getPageCount = () => (this.props.focusOnCenterSlide ? this.slides.length : this.props.amountOfPages);
131
132
  }
132
133
 
133
134
  export { DSRCarousel };
@@ -1,5 +1,5 @@
1
1
  import type { BaseProps } from '../../BaseProps';
2
- import type { CarouselAlignHeader, SelectedAriaAttributes, CarouselAriaAttribute, BreakpointCustomizable, CarouselHeadingSize, CarouselInternationalization, CarouselUpdateEventDetail, Theme, CarouselWidth } from '../types';
2
+ import type { CarouselAlignHeader, SelectedAriaAttributes, CarouselAriaAttribute, BreakpointCustomizable, CarouselGradientColor, CarouselHeadingSize, CarouselInternationalization, CarouselUpdateEventDetail, Theme, CarouselWidth } from '../types';
3
3
  export type PCarouselProps = BaseProps & {
4
4
  /**
5
5
  * Defines which slide to be active (zero-based numbering).
@@ -21,6 +21,14 @@ export type PCarouselProps = BaseProps & {
21
21
  * @deprecated since v3.0.0, will be removed with next major release, use `pagination` instead. If true, the carousel will not show pagination bullets at the bottom.
22
22
  */
23
23
  disablePagination?: BreakpointCustomizable<boolean>;
24
+ /**
25
+ * Indicates whether focus should be set on the center slide. If true, the carousel loops by individual slide; otherwise, it loops by page.
26
+ */
27
+ focusOnCenterSlide?: boolean;
28
+ /**
29
+ * Adapts the background gradient for the left and right edge.
30
+ */
31
+ gradientColor?: CarouselGradientColor;
24
32
  /**
25
33
  * Defines the heading used in the carousel.
26
34
  */
@@ -92,6 +100,14 @@ export declare const PCarousel: import("react").ForwardRefExoticComponent<import
92
100
  * @deprecated since v3.0.0, will be removed with next major release, use `pagination` instead. If true, the carousel will not show pagination bullets at the bottom.
93
101
  */
94
102
  disablePagination?: BreakpointCustomizable<boolean>;
103
+ /**
104
+ * Indicates whether focus should be set on the center slide. If true, the carousel loops by individual slide; otherwise, it loops by page.
105
+ */
106
+ focusOnCenterSlide?: boolean;
107
+ /**
108
+ * Adapts the background gradient for the left and right edge.
109
+ */
110
+ gradientColor?: CarouselGradientColor;
95
111
  /**
96
112
  * Defines the heading used in the carousel.
97
113
  */
@@ -18,4 +18,5 @@ export declare class DSRCarousel extends Component<any> {
18
18
  private slides;
19
19
  private get hasNavigation();
20
20
  render(): JSX.Element;
21
+ private getPageCount;
21
22
  }
@@ -696,6 +696,12 @@ declare const CAROUSEL_WIDTHS: readonly [
696
696
  "extended"
697
697
  ];
698
698
  export type CarouselWidth = (typeof CAROUSEL_WIDTHS)[number];
699
+ declare const CAROUSEL_GRADIENT_COLORS: readonly [
700
+ "background-base",
701
+ "background-surface",
702
+ "none"
703
+ ];
704
+ export type CarouselGradientColor = (typeof CAROUSEL_GRADIENT_COLORS)[number];
699
705
  declare const CAROUSEL_ALIGN_HEADERS: readonly [
700
706
  "start",
701
707
  "center",