@porsche-design-system/components-react 3.18.0 → 3.19.0-rc.1

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 (24) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/cjs/lib/components/canvas.wrapper.cjs +3 -5
  3. package/cjs/lib/components/carousel.wrapper.cjs +3 -3
  4. package/esm/lib/components/canvas.wrapper.d.ts +13 -21
  5. package/esm/lib/components/canvas.wrapper.mjs +4 -6
  6. package/esm/lib/components/carousel.wrapper.d.ts +17 -1
  7. package/esm/lib/components/carousel.wrapper.mjs +3 -3
  8. package/esm/lib/types.d.ts +8 -7
  9. package/package.json +2 -2
  10. package/ssr/cjs/components/dist/styles/esm/styles-entry.cjs +244 -63
  11. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/components/canvas.wrapper.cjs +4 -6
  12. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/components/carousel.wrapper.cjs +4 -4
  13. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/canvas.cjs +16 -21
  14. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/carousel.cjs +3 -2
  15. package/ssr/esm/components/dist/styles/esm/styles-entry.mjs +244 -63
  16. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/components/canvas.wrapper.mjs +5 -7
  17. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/components/carousel.wrapper.mjs +4 -4
  18. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/canvas.mjs +16 -21
  19. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/carousel.mjs +3 -2
  20. package/ssr/esm/lib/components/canvas.wrapper.d.ts +13 -21
  21. package/ssr/esm/lib/components/carousel.wrapper.d.ts +17 -1
  22. package/ssr/esm/lib/dsr-components/canvas.d.ts +5 -4
  23. package/ssr/esm/lib/dsr-components/carousel.d.ts +1 -0
  24. package/ssr/esm/lib/types.d.ts +8 -7
@@ -4708,16 +4708,14 @@ const getComponentCss$13 = (icon, iconSource, variant, hideLabel, disabled, load
4708
4708
  }));
4709
4709
  };
4710
4710
 
4711
- const cssVariableSidebarStartWidth = '--p-canvas-sidebar-start-width';
4712
- const cssVariableSidebarEndWidth = '--p-canvas-sidebar-end-width';
4713
- // TODO: maybe default grid gap would also work
4711
+ const cssVarSidebarStartWidth = '--p-canvas-sidebar-start-width';
4712
+ const cssVarSidebarEndWidth = '--p-canvas-sidebar-end-width';
4714
4713
  const gridProductiveGap = gridGap.replace('36px', '24px');
4715
4714
  const mediaQueryDesktopView = getMediaQueryMin('m');
4716
- const sidebarWidths = {
4717
- medium: '320px',
4718
- large: '480px', // TODO: won't work at viewport 1000px when both sidebars are opened
4719
- };
4720
- const getComponentCss$12 = (isSidebarStartOpen, sidebarStartWidth, isSidebarEndOpen, sidebarEndWidth) => {
4715
+ const sidebarWidth = '320px';
4716
+ const headerHeight = 'calc(1.5rem + 28px)';
4717
+ const getComponentCss$12 = (theme, isSidebarStartOpen, isSidebarEndOpen) => {
4718
+ const { primaryColor, backgroundColor, backgroundSurfaceColor } = getThemedColors(theme);
4721
4719
  return getCss({
4722
4720
  '@global': {
4723
4721
  ':host': {
@@ -4728,7 +4726,71 @@ const getComponentCss$12 = (isSidebarStartOpen, sidebarStartWidth, isSidebarEndO
4728
4726
  }),
4729
4727
  },
4730
4728
  ...preventFoucOfNestedElementsStyles,
4731
- ':is(header, main, footer, aside)': {
4729
+ '::slotted': {
4730
+ '&([slot*="header"])': {
4731
+ display: 'flex',
4732
+ alignItems: 'center',
4733
+ gap: spacingStaticSmall,
4734
+ },
4735
+ '&([slot*="sidebar"])': {
4736
+ display: 'flex',
4737
+ flexDirection: 'column',
4738
+ gap: spacingStaticSmall,
4739
+ },
4740
+ // pre-defined utility classes
4741
+ '&(.p-module)': {
4742
+ gridColumn: '1/-1',
4743
+ },
4744
+ '&(.p-module--subgrid)': {
4745
+ display: 'grid',
4746
+ gridTemplateColumns: 'subgrid',
4747
+ rowGap: gridProductiveGap,
4748
+ },
4749
+ '&(.p-module--more-space-above-small)': {
4750
+ marginTop: spacingStaticSmall,
4751
+ },
4752
+ '&(.p-module--more-space-above-medium)': {
4753
+ marginTop: spacingStaticMedium,
4754
+ },
4755
+ '&(.p-module--more-space-above-large)': {
4756
+ marginTop: spacingStaticLarge,
4757
+ },
4758
+ '&(.p-module--less-space-above-small)': {
4759
+ marginTop: `max(calc(-1 * ${gridProductiveGap}), calc(-1 * ${spacingStaticSmall}))`,
4760
+ },
4761
+ '&(.p-module--less-space-above-medium)': {
4762
+ marginTop: `max(calc(-1 * ${gridProductiveGap}), calc(-1 * ${spacingStaticMedium}))`,
4763
+ },
4764
+ '&(.p-module--less-space-above-large)': {
4765
+ marginTop: `max(calc(-1 * ${gridProductiveGap}), calc(-1 * ${spacingStaticLarge}))`,
4766
+ },
4767
+ '&(.p-flex)': {
4768
+ display: 'flex',
4769
+ },
4770
+ '&(.p-align-items--center)': {
4771
+ alignItems: 'center',
4772
+ },
4773
+ '&(.p-gap--small)': {
4774
+ gap: spacingStaticSmall,
4775
+ },
4776
+ '&(.p-gap--medium)': {
4777
+ gap: spacingStaticMedium,
4778
+ },
4779
+ '&(.p-gap--large)': {
4780
+ gap: spacingStaticLarge,
4781
+ },
4782
+ },
4783
+ 'slot[name="title"]::slotted(a)': {
4784
+ textDecoration: 'none',
4785
+ color: 'inherit',
4786
+ },
4787
+ h2: {
4788
+ ...textSmallStyle,
4789
+ color: primaryColor,
4790
+ textTransform: 'uppercase',
4791
+ letterSpacing: '2px',
4792
+ },
4793
+ 'header, main, footer, aside': {
4732
4794
  padding: gridProductiveGap,
4733
4795
  boxSizing: 'border-box',
4734
4796
  zIndex: 0,
@@ -4737,49 +4799,78 @@ const getComponentCss$12 = (isSidebarStartOpen, sidebarStartWidth, isSidebarEndO
4737
4799
  gridArea: 'header',
4738
4800
  position: 'sticky',
4739
4801
  top: 0,
4740
- zIndex: 1,
4802
+ zIndex: 9999999,
4803
+ height: headerHeight,
4804
+ display: 'grid',
4805
+ gridTemplateColumns: 'minmax(0, 1fr) auto minmax(0, 1fr)',
4806
+ gap: gridProductiveGap,
4807
+ backgroundColor: backgroundSurfaceColor,
4808
+ alignItems: 'center',
4809
+ paddingBlock: 0,
4810
+ '&::before, &::after': {
4811
+ content: '""',
4812
+ position: 'absolute',
4813
+ backgroundColor: 'transparent',
4814
+ bottom: `calc(${borderRadiusLarge} * -2)`,
4815
+ height: `calc(${borderRadiusLarge} * 2)`,
4816
+ width: borderRadiusLarge,
4817
+ boxShadow: `0 -${borderRadiusLarge} 0 0 ${backgroundSurfaceColor}`,
4818
+ pointerEvents: 'none',
4819
+ },
4820
+ '&::before': {
4821
+ left: 0,
4822
+ borderTopLeftRadius: borderRadiusLarge,
4823
+ },
4824
+ '&::after': {
4825
+ right: 0,
4826
+ borderTopRightRadius: borderRadiusLarge,
4827
+ },
4741
4828
  },
4742
4829
  main: {
4743
4830
  gridArea: 'main',
4744
- '--pds-grid-span-full': 'span 6',
4745
- '--pds-grid-span-one-half': 'span 3',
4746
- '--pds-grid-span-one-third': 'span 2',
4747
- '--pds-grid-span-two-thirds': 'span 4',
4831
+ '--p-canvas-grid-span-full': 'span 6',
4832
+ '--p-canvas-grid-span-one-half': 'span 3',
4833
+ '--p-canvas-grid-span-one-third': 'span 2',
4834
+ '--p-canvas-grid-span-two-thirds': 'span 4',
4748
4835
  display: 'grid',
4749
4836
  gridTemplateColumns: 'repeat(6, minmax(0, 1fr))',
4750
4837
  gap: gridProductiveGap,
4751
4838
  alignContent: 'flex-start',
4839
+ backgroundColor,
4752
4840
  [mediaQueryDesktopView]: {
4753
- '--pds-grid-span-full': 'span 12',
4754
- '--pds-grid-span-one-half': 'span 6',
4755
- '--pds-grid-span-one-third': 'span 4',
4756
- '--pds-grid-span-two-thirds': 'span 8',
4841
+ '--p-canvas-grid-span-full': 'span 12',
4842
+ '--p-canvas-grid-span-one-half': 'span 6',
4843
+ '--p-canvas-grid-span-one-third': 'span 4',
4844
+ '--p-canvas-grid-span-two-thirds': 'span 8',
4757
4845
  gridTemplateColumns: 'repeat(12, minmax(0, 1fr))',
4758
4846
  },
4759
4847
  },
4760
4848
  footer: {
4761
4849
  gridArea: 'footer',
4850
+ backgroundColor,
4762
4851
  },
4763
4852
  aside: {
4764
- // TODO: box-shadows or colored surface must be defined, design is missing
4765
- position: 'relative',
4766
4853
  transition: getTransition('margin'),
4767
- '&:first-of-type': {
4768
- gridArea: 'sidebar-start',
4769
- width: `var(${cssVariableSidebarStartWidth}, ${sidebarWidths[sidebarStartWidth]})`,
4770
- marginInlineStart: isSidebarStartOpen
4771
- ? 0
4772
- : `calc(var(${cssVariableSidebarStartWidth}, ${sidebarWidths[sidebarStartWidth]}) * -1)`,
4773
- },
4774
- '&:last-of-type': {
4775
- gridArea: 'sidebar-end',
4776
- width: `var(${cssVariableSidebarEndWidth}, ${sidebarWidths[sidebarEndWidth]})`,
4777
- marginInlineEnd: isSidebarEndOpen
4778
- ? 0
4779
- : `calc(var(${cssVariableSidebarEndWidth}, ${sidebarWidths[sidebarEndWidth]}) * -1)`,
4780
- },
4854
+ position: 'sticky',
4855
+ top: headerHeight,
4856
+ height: `calc(100dvh - ${headerHeight})`,
4857
+ overflow: 'hidden auto',
4781
4858
  },
4782
4859
  },
4860
+ 'sidebar-start': {
4861
+ borderInlineEnd: `1px solid ${backgroundSurfaceColor}`,
4862
+ backgroundColor,
4863
+ gridArea: 'sidebar-start',
4864
+ width: `var(${cssVarSidebarStartWidth}, ${sidebarWidth})`,
4865
+ marginInlineStart: isSidebarStartOpen ? 0 : `calc(var(${cssVarSidebarStartWidth}, ${sidebarWidth}) * -1)`,
4866
+ },
4867
+ 'sidebar-end': {
4868
+ borderInlineStart: `1px solid ${backgroundSurfaceColor}`,
4869
+ backgroundColor,
4870
+ gridArea: 'sidebar-end',
4871
+ width: `var(${cssVarSidebarEndWidth}, ${sidebarWidth})`,
4872
+ marginInlineEnd: isSidebarEndOpen ? 0 : `calc(var(${cssVarSidebarEndWidth}, ${sidebarWidth}) * -1)`,
4873
+ },
4783
4874
  canvas: {
4784
4875
  display: 'grid',
4785
4876
  gridTemplateRows: 'auto minmax(0, 1fr) auto',
@@ -4791,15 +4882,30 @@ const getComponentCss$12 = (isSidebarStartOpen, sidebarStartWidth, isSidebarEndO
4791
4882
  gridTemplateAreas: '"header header header" "sidebar-start main sidebar-end" "sidebar-start footer sidebar-end"',
4792
4883
  },
4793
4884
  },
4794
- close: {
4795
- // TODO: must be positioned properly, design is missing
4796
- position: 'absolute',
4797
- inset: `${spacingStaticXSmall} ${spacingStaticXSmall} auto auto`,
4885
+ crest: {
4886
+ [getMediaQueryMin('s')]: {
4887
+ display: 'none',
4888
+ },
4889
+ },
4890
+ wordmark: {
4891
+ height: '10px',
4892
+ [getMediaQueryMax('s')]: {
4893
+ display: 'none',
4894
+ },
4895
+ },
4896
+ header: {
4897
+ display: 'flex',
4898
+ gap: spacingStaticSmall,
4899
+ alignItems: 'center',
4900
+ '&:last-of-type': {
4901
+ justifyContent: 'end',
4902
+ },
4798
4903
  },
4799
4904
  });
4800
4905
  };
4801
4906
 
4802
4907
  const cssVariablePrevNextFilter = '--p-carousel-prev-next-filter';
4908
+ const cssVariableGradientColorWidth = '--p-gradient-color-width';
4803
4909
  const carouselTransitionDuration = motionDurationModerate;
4804
4910
  const paginationInfiniteStartCaseClass = 'pagination--infinite';
4805
4911
  const bulletClass = 'bullet';
@@ -4827,11 +4933,42 @@ const backfaceVisibilityJssStyle = {
4827
4933
  backfaceVisibility: 'hidden',
4828
4934
  WebkitBackfaceVisibility: 'hidden',
4829
4935
  };
4830
- const getComponentCss$11 = (hasHeading, hasDescription, hasControlsSlot, headingSize, width, hasPagination, isInfinitePagination, alignHeader, theme, hasNavigation) => {
4936
+ const gradientColorLight$1 = {
4937
+ 'background-base': '255,255,255',
4938
+ 'background-surface': '238,239,242',
4939
+ none: '',
4940
+ };
4941
+ const gradientColorDark$1 = {
4942
+ 'background-base': '14,14,18',
4943
+ 'background-surface': '33,34,37',
4944
+ none: '',
4945
+ };
4946
+ const gradientColorMap$1 = {
4947
+ auto: gradientColorLight$1,
4948
+ light: gradientColorLight$1,
4949
+ dark: gradientColorDark$1,
4950
+ };
4951
+ const getGradient$1 = (theme, gradientColorTheme) => {
4952
+ const gradientColor = gradientColorMap$1[theme][gradientColorTheme];
4953
+ return (`rgba(${gradientColor},1) 20%,` +
4954
+ `rgba(${gradientColor},0.6) 48%,` +
4955
+ `rgba(${gradientColor},0.3) 68%,` +
4956
+ `rgba(${gradientColor},0)`);
4957
+ };
4958
+ const getComponentCss$11 = (gradientColor, hasHeading, hasDescription, hasControlsSlot, headingSize, width, hasPagination, isInfinitePagination, alignHeader, theme, hasNavigation) => {
4831
4959
  const { primaryColor, contrastMediumColor } = getThemedColors(theme);
4832
4960
  const { primaryColor: primaryColorDark, contrastMediumColor: contrastMediumColorDark } = getThemedColors('dark');
4833
4961
  const { canvasTextColor } = getHighContrastColors();
4834
4962
  const isHeaderAlignCenter = alignHeader === 'center';
4963
+ const getGradientStyles = (direction) => gradientColor
4964
+ ? {
4965
+ [direction === 'left' ? 'right' : 'left']: 0,
4966
+ background: `linear-gradient(to ${direction}, ${getGradient$1(theme, gradientColor)} 100%)`,
4967
+ ...prefersColorSchemeDarkMediaQuery(theme, {
4968
+ background: `linear-gradient(to ${direction}, ${getGradient$1('dark', gradientColor)} 100%)`,
4969
+ }),
4970
+ }
4971
+ : {};
4835
4972
  return getCss({
4836
4973
  '@global': {
4837
4974
  ':host': {
@@ -4938,6 +5075,7 @@ const getComponentCss$11 = (hasHeading, hasDescription, hasControlsSlot, heading
4938
5075
  padding: '4px 0', // for slide focus outline
4939
5076
  margin: '-4px 0', // for slide focus outline
4940
5077
  '&__track': {
5078
+ position: 'relative',
4941
5079
  // !important is necessary to override inline styles set by splide library
4942
5080
  ...addImportantToEachRule({
4943
5081
  padding: `0 ${spacingMap[width].base}`,
@@ -4957,6 +5095,16 @@ const getComponentCss$11 = (hasHeading, hasDescription, hasControlsSlot, heading
4957
5095
  WebkitUserSelect: 'none',
4958
5096
  WebkitTouchCallout: 'none',
4959
5097
  },
5098
+ '&::before, &::after': {
5099
+ content: '""',
5100
+ position: 'absolute',
5101
+ zIndex: 1,
5102
+ top: 0,
5103
+ height: '100%',
5104
+ width: `var(${cssVariableGradientColorWidth}, 33%)`,
5105
+ },
5106
+ '&::before': getGradientStyles('right'),
5107
+ '&::after': getGradientStyles('left'),
4960
5108
  },
4961
5109
  '&__list': {
4962
5110
  ...backfaceVisibilityJssStyle,
@@ -8065,10 +8213,13 @@ const getComponentCss$x = (hideLabel, state, isDisabled, isLoading, isWithinForm
8065
8213
  // TODO: move into getSlottedTextFieldTextareaSelectStyles() via parameter, e.g. textAlign=center|start
8066
8214
  textAlign: 'center',
8067
8215
  // TODO: move into getSlottedTextFieldTextareaSelectStyles() via parameter, e.g. size=max|min
8068
- width: inputSize,
8216
+ maxWidth: inputSize,
8217
+ // 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.
8218
+ minWidth: `calc(1rem + ${borderWidthBase}*2 + ${spacingStaticSmall}*2)`,
8069
8219
  ...(length > 4 && {
8070
8220
  [getMediaQueryMax('xs')]: {
8071
8221
  // TODO: instead of having dedicated css rules depending on length we should try to implement a fluid one fits all solution
8222
+ maxWidth: 'auto',
8072
8223
  width: `calc((276px - (${spacingStaticSmall} * ${length - 1})) / ${length})`, // calculate the max with of the inputs that fit into grid in viewport base (276px)
8073
8224
  },
8074
8225
  }),
@@ -8118,7 +8269,7 @@ const getComponentCss$x = (hideLabel, state, isDisabled, isLoading, isWithinForm
8118
8269
  },
8119
8270
  wrapper: {
8120
8271
  display: 'grid',
8121
- gridTemplateColumns: `repeat(${length}, minmax(0, 1fr))`,
8272
+ gridTemplateColumns: `repeat(${length}, minmax(auto, 1fr))`,
8122
8273
  justifySelf: 'flex-start',
8123
8274
  gap: spacingStaticSmall,
8124
8275
  },
@@ -9037,6 +9188,12 @@ const getComponentCss$q = (isDisabled, hasCustomDropdown, hideLabel, state, them
9037
9188
 
9038
9189
  const INTERNAL_SELECT_SLOT = 'internal-select';
9039
9190
 
9191
+ const cssVarBackgroundColor = '--p-select-background-color';
9192
+ const cssVarTextColor = '--p-select-text-color';
9193
+ const cssVarBorderColor = '--p-select-border-color';
9194
+ const cssVarIconFilter = '--p-select-icon-filter';
9195
+ const cssVarBackgroundColorFocus = '--p-select-focus-background-color';
9196
+ const cssVarBorderColorFocus = '--p-select-focus-border-color';
9040
9197
  const getComponentCss$p = (direction, isOpen, isDisabled, hideLabel, state, isWithinForm, isNativePopoverCase, theme) => {
9041
9198
  return getCss({
9042
9199
  '@global': {
@@ -9081,6 +9238,9 @@ const getComponentCss$p = (direction, isOpen, isDisabled, hideLabel, state, isWi
9081
9238
  pointerEvents: 'none',
9082
9239
  transform: 'rotate3d(0,0,1,0.0001deg)', // needs to be a little more than 0 for correct direction in safari
9083
9240
  transition: getTransition('transform'),
9241
+ ...(!isHighContrastMode && {
9242
+ filter: `var(${cssVarIconFilter})`,
9243
+ }),
9084
9244
  '&--rotate': {
9085
9245
  transform: 'rotate3d(0,0,1,180deg)',
9086
9246
  },
@@ -9129,30 +9289,38 @@ const getButtonStyles = (isDisabled, direction, isOpen, state, theme) => {
9129
9289
  cursor: 'not-allowed',
9130
9290
  },
9131
9291
  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 })),
9292
+ color: `var(${cssVarTextColor}, ${primaryColor})`,
9293
+ background: `var(${cssVarBackgroundColor}, ${backgroundColor})`,
9294
+ border: `${borderWidthBase} solid var(${cssVarBorderColor}, ${isOpen ? primaryColor : formStateColor || contrastMediumColor})`,
9295
+ borderRadius: borderRadiusSmall,
9296
+ '&:not(:focus-visible)': {
9297
+ ...getPlaceholderJssStyle({
9298
+ color: `var(${cssVarTextColor}, ${primaryColor})`,
9299
+ opacity: 1,
9300
+ }),
9301
+ ...prefersColorSchemeDarkMediaQuery(theme, getPlaceholderJssStyle({
9302
+ color: `var(${cssVarTextColor}, ${primaryColorDark})`,
9303
+ opacity: 1,
9304
+ })),
9136
9305
  }, // Opacity fixes placeholder being shown lighter in firefox
9137
9306
  ...hoverMediaQuery({
9138
- '&:hover:not(:disabled):not(:focus),label:hover~.wrapper &:not(:disabled):not(:focus)': {
9139
- borderColor: isOpen ? primaryColor : formStateHoverColor || primaryColor,
9307
+ '&:hover:not(:disabled):not(:focus-visible),label:hover~.wrapper &:not(:disabled):not(:focus-visible)': {
9308
+ borderColor: `var(${cssVarBorderColor}, ${isOpen ? primaryColor : formStateHoverColor || primaryColor})`,
9140
9309
  ...prefersColorSchemeDarkMediaQuery(theme, {
9141
- borderColor: isOpen ? primaryColorDark : formStateHoverColorDark || primaryColorDark,
9310
+ borderColor: `var(${cssVarBorderColor}, ${isOpen ? primaryColorDark : formStateHoverColorDark || primaryColorDark})`,
9142
9311
  }),
9143
9312
  },
9144
9313
  }),
9145
9314
  ...(!isDisabled && {
9146
- '&:focus': {
9147
- borderColor: primaryColor,
9315
+ '&:focus-visible': {
9316
+ borderColor: `var(${cssVarBorderColorFocus}, ${primaryColor})`,
9317
+ background: `var(${cssVarBackgroundColorFocus}, ${backgroundColor})`,
9148
9318
  ...prefersColorSchemeDarkMediaQuery(theme, {
9149
- borderColor: primaryColorDark,
9319
+ borderColor: `var(${cssVarBorderColorFocus}, ${primaryColorDark})`,
9320
+ background: `var(${cssVarBackgroundColorFocus}, ${backgroundColorDark})`,
9150
9321
  }),
9151
9322
  },
9152
9323
  }),
9153
- background: backgroundColor,
9154
- border: `${borderWidthBase} solid ${isOpen ? primaryColor : formStateColor || contrastMediumColor}`,
9155
- borderRadius: borderRadiusSmall,
9156
9324
  ...(isOpen && {
9157
9325
  ['paddingBottom' ]: `calc(${formElementPaddingVertical} + 1px)`, // Add padding to keep same height when border changes
9158
9326
  ['borderBottom' ]: addImportantToRule(`1px solid ${contrastMediumColor}`),
@@ -9160,16 +9328,18 @@ const getButtonStyles = (isDisabled, direction, isOpen, state, theme) => {
9160
9328
  ['borderBottomRightRadius' ]: 0,
9161
9329
  }),
9162
9330
  ...(isDisabled && {
9163
- ...getPlaceholderJssStyle({ color: disabledColor }),
9331
+ ...getPlaceholderJssStyle({
9332
+ color: disabledColor,
9333
+ }),
9164
9334
  cursor: 'not-allowed',
9165
9335
  color: disabledColor,
9166
9336
  borderColor: disabledColor,
9167
9337
  WebkitTextFillColor: disabledColor,
9168
9338
  }),
9169
9339
  ...prefersColorSchemeDarkMediaQuery(theme, {
9170
- color: primaryColorDark,
9171
- background: backgroundColorDark,
9172
- border: `${borderWidthBase} solid ${isOpen ? primaryColorDark : formStateColorDark || contrastMediumColorDark}`,
9340
+ color: `var(${cssVarTextColor}, ${primaryColorDark})`,
9341
+ background: `var(${cssVarBackgroundColor}, ${backgroundColorDark})`,
9342
+ border: `${borderWidthBase} solid var(${cssVarBorderColor}, ${isOpen ? primaryColorDark : formStateColorDark || contrastMediumColorDark})`,
9173
9343
  ...(isOpen && {
9174
9344
  ['borderBottom' ]: addImportantToRule(`1px solid ${contrastMediumColorDark}`),
9175
9345
  }),
@@ -9205,7 +9375,7 @@ const getListStyles = (isOpen, direction, theme) => {
9205
9375
  overflowY: 'auto',
9206
9376
  WebkitOverflowScrolling: 'touch',
9207
9377
  background: backgroundColor,
9208
- border: `2px solid ${primaryColor}`,
9378
+ border: `2px solid var(${cssVarBorderColor}, ${primaryColor})`,
9209
9379
  ['borderTop' ]: 'none',
9210
9380
  borderRadius: borderRadiusSmall,
9211
9381
  ['borderTopLeftRadius' ]: 0,
@@ -9216,7 +9386,7 @@ const getListStyles = (isOpen, direction, theme) => {
9216
9386
  transform: 'translate3d(0,0,0)', // fix iOS bug if less than 5 items are displayed
9217
9387
  ...prefersColorSchemeDarkMediaQuery(theme, {
9218
9388
  background: backgroundColorDark,
9219
- borderColor: primaryColorDark,
9389
+ borderColor: `var(${cssVarBorderColor}, ${primaryColorDark})`,
9220
9390
  }),
9221
9391
  };
9222
9392
  };
@@ -10168,7 +10338,7 @@ const showCustomCalendarOrTimeIndicator = (isCalendar, isTime) => {
10168
10338
 
10169
10339
  const cssVariableInputPaddingStart = '--p-internal-text-field-input-padding-start';
10170
10340
  const cssVariableInputPaddingEnd = '--p-internal-text-field-input-padding-end';
10171
- const getComponentCss$8 = (isDisabled, hideLabel, state, hasUnitOrVisibleCounter, unitPosition, inputType, showPasswordToggle, isWithinForm, hasSubmitButton, theme) => {
10341
+ const getComponentCss$8 = (isDisabled, hideLabel, state, hasUnitOrVisibleCounter, unitPosition, inputType, showPasswordToggle, isWithinForm, hasSubmitButton, theme, unitLength) => {
10172
10342
  const isSearch = isType(inputType, 'search');
10173
10343
  const isPassword = isType(inputType, 'password');
10174
10344
  const isNumber = isType(inputType, 'number');
@@ -10178,6 +10348,9 @@ const getComponentCss$8 = (isDisabled, hideLabel, state, hasUnitOrVisibleCounter
10178
10348
  const isSearchWithoutFormOrSubmitButton = isSearch && (!isWithinForm || !hasSubmitButton);
10179
10349
  const isSearchWithForm = isSearch && isWithinForm;
10180
10350
  const isCalendarOrTimeWithCustomIndicator = showCustomCalendarOrTimeIndicator(isCalendar, isTime);
10351
+ const counterCharacterLengthCssVar = 'var(--p-internal-counter-character-length)';
10352
+ const paddingInlineIfUnitOrCounter = hasUnitOrVisibleCounter &&
10353
+ `calc(${formElementLayeredGap} + ${formElementPaddingHorizontal} + ${borderWidthBase} + ${counterCharacterLengthCssVar} * 1ch * log(2.6))`;
10181
10354
  return getCss({
10182
10355
  '@global': {
10183
10356
  ':host': {
@@ -10193,8 +10366,12 @@ const getComponentCss$8 = (isDisabled, hideLabel, state, hasUnitOrVisibleCounter
10193
10366
  ...getSlottedTextFieldTextareaSelectStyles('input', state, false, theme, {
10194
10367
  gridArea: '1/1/1/-1',
10195
10368
  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
10369
+ paddingInlineStart: hasUnitOrVisibleCounter && unitPosition === 'prefix'
10370
+ ? paddingInlineIfUnitOrCounter
10371
+ : `var(${cssVariableInputPaddingStart})`, // iOS Safari 14.5 can't handle padding-inline shorthand with css variables
10372
+ paddingInlineEnd: hasUnitOrVisibleCounter && unitPosition === 'suffix'
10373
+ ? paddingInlineIfUnitOrCounter
10374
+ : `var(${cssVariableInputPaddingEnd})`, // iOS Safari 14.5 can't handle padding-inline shorthand with css variables
10198
10375
  // TODO: move into getSlottedTextFieldTextareaSelectStyles()
10199
10376
  ...(isNumber && {
10200
10377
  MozAppearance: 'textfield', // hides up/down spin button for Firefox
@@ -10419,6 +10596,8 @@ const getComponentCss$4 = (isDisabled, hideLabel, state, hasCounter, theme) => {
10419
10596
  root: {
10420
10597
  display: 'grid',
10421
10598
  gap: spacingStaticXSmall,
10599
+ // 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.
10600
+ minWidth: `calc(1rem + ${formElementPaddingHorizontal}*2 + ${borderWidthBase}*2)`,
10422
10601
  },
10423
10602
  wrapper: {
10424
10603
  display: 'grid',
@@ -10470,6 +10649,8 @@ const getComponentCss$3 = (isDisabled, hideLabel, state, hasCounter, resize, the
10470
10649
  background: 'transparent',
10471
10650
  textIndent: 0,
10472
10651
  color: primaryColor,
10652
+ // 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.
10653
+ minWidth: `calc(1rem + ${formElementPaddingHorizontal}*2 + ${borderWidthBase}*2)`,
10473
10654
  transition: `${getTransition('background-color')}, ${getTransition('border-color')}, ${getTransition('color')}`, // for smooth transitions between e.g. disabled states
10474
10655
  ...prefersColorSchemeDarkMediaQuery(theme, {
10475
10656
  borderColor: formStateColorDark || contrastMediumColorDark,
@@ -7,22 +7,20 @@ var hooks = require('../../hooks.cjs');
7
7
  var utils = require('../../utils.cjs');
8
8
  var canvas = require('../dsr-components/canvas.cjs');
9
9
 
10
- const PCanvas = react.forwardRef(({ onDismissSidebarEnd, onDismissSidebarStart, sidebarEndOpen = false, sidebarEndWidth = 'medium', sidebarStartOpen = false, sidebarStartWidth = 'medium', className, children, ...rest }, ref) => {
10
+ const PCanvas = react.forwardRef(({ sidebarEndIcon = 'configurate', sidebarEndOpen = false, sidebarStartIcon = 'menu-lines', sidebarStartOpen = false, theme, className, children, ...rest }, ref) => {
11
11
  const elementRef = react.useRef();
12
- hooks.useEventCallback(elementRef, 'dismissSidebarEnd', onDismissSidebarEnd);
13
- hooks.useEventCallback(elementRef, 'dismissSidebarStart', onDismissSidebarStart);
14
12
  const WebComponentTag = hooks.usePrefix('p-canvas');
15
- const propsToSync = [sidebarEndOpen, sidebarEndWidth, sidebarStartOpen, sidebarStartWidth];
13
+ const propsToSync = [sidebarEndIcon, sidebarEndOpen, sidebarStartIcon, sidebarStartOpen, theme || hooks.useTheme()];
16
14
  hooks.useBrowserLayoutEffect(() => {
17
15
  const { current } = elementRef;
18
- ['sidebarEndOpen', 'sidebarEndWidth', 'sidebarStartOpen', 'sidebarStartWidth'].forEach((propName, i) => (current[propName] = propsToSync[i]));
16
+ ['sidebarEndIcon', 'sidebarEndOpen', 'sidebarStartIcon', 'sidebarStartOpen', 'theme'].forEach((propName, i) => (current[propName] = propsToSync[i]));
19
17
  }, propsToSync);
20
18
  const props = {
21
19
  ...rest,
22
20
  // @ts-ignore
23
21
  ...(!process.browser
24
22
  ? {
25
- children: (jsxRuntime.jsx(canvas.DSRCanvas, { sidebarEndOpen, sidebarEndWidth, sidebarStartOpen, sidebarStartWidth, children })),
23
+ children: (jsxRuntime.jsx(canvas.DSRCanvas, { sidebarEndIcon, sidebarEndOpen, sidebarStartIcon, sidebarStartOpen, theme: theme || hooks.useTheme(), children })),
26
24
  }
27
25
  : {
28
26
  children,
@@ -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,
@@ -3,15 +3,15 @@
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
4
  require('../components/accordion.wrapper.cjs');
5
5
  require('../components/banner.wrapper.cjs');
6
- require('../components/button.wrapper.cjs');
6
+ var button_wrapper = require('../components/button.wrapper.cjs');
7
7
  require('../components/button-group.wrapper.cjs');
8
- var buttonPure_wrapper = require('../components/button-pure.wrapper.cjs');
8
+ require('../components/button-pure.wrapper.cjs');
9
9
  require('../components/button-tile.wrapper.cjs');
10
10
  require('../components/canvas.wrapper.cjs');
11
11
  require('../components/carousel.wrapper.cjs');
12
12
  require('../components/checkbox-wrapper.wrapper.cjs');
13
13
  require('../components/content-wrapper.wrapper.cjs');
14
- require('../components/crest.wrapper.cjs');
14
+ var crest_wrapper = require('../components/crest.wrapper.cjs');
15
15
  require('../components/display.wrapper.cjs');
16
16
  require('../components/divider.wrapper.cjs');
17
17
  require('../components/fieldset.wrapper.cjs');
@@ -72,7 +72,7 @@ require('../components/text-list-item.wrapper.cjs');
72
72
  require('../components/textarea.wrapper.cjs');
73
73
  require('../components/textarea-wrapper.wrapper.cjs');
74
74
  require('../components/toast.wrapper.cjs');
75
- require('../components/wordmark.wrapper.cjs');
75
+ var wordmark_wrapper = require('../components/wordmark.wrapper.cjs');
76
76
  var splitChildren = require('../../splitChildren.cjs');
77
77
  var react = require('react');
78
78
  var minifyCss = require('../../minifyCss.cjs');
@@ -80,40 +80,35 @@ var stripFocusAndHoverStyles = require('../../stripFocusAndHoverStyles.cjs');
80
80
  var stylesEntry = require('../../../../../../components/dist/styles/esm/styles-entry.cjs');
81
81
 
82
82
  /**
83
- * @slot {"name": "header", "description": "Renders a **sticky** header section above the content area." }
83
+ * @slot {"name": "header-start", "description": "Renders a **sticky** header section above the content area on the **start** side (**left** in **LTR** mode / **right** in **RTL** mode)." }
84
+ * @slot {"name": "header-end", "description": "Renders a **sticky** header section above the content area on the **end** side (**right** in **LTR** mode / **left** in **RTL** mode)." }
84
85
  * @slot {"name": "", "description": "Default slot for the main content" }
86
+ * @slot {"name": "title", "description": "Application name" }
85
87
  * @slot {"name": "footer", "description": "Shows a footer section, flowing under the content area when scrollable." }
86
88
  * @slot {"name": "sidebar-start", "description": "Shows a sidebar area on the **start** side (**left** in **LTR** mode / **right** in **RTL** mode). On mobile view it transforms into a flyout." }
87
89
  * @slot {"name": "sidebar-end", "description": "Shows a sidebar area on the **end** side (**right** in **LTR** mode / **left** in **RTL** mode). On mobile view it transforms into a flyout." }
88
90
  *
89
- * @controlled {"props": ["sidebarStartOpen"], "event": "dismissSidebarStart"}
90
- * @controlled {"props": ["sidebarEndOpen"], "event": "dismissSidebarEnd"}
91
- *
92
91
  * @experimental
93
92
  */
94
93
  class DSRCanvas extends react.Component {
95
94
  host;
96
95
  isDesktopView = false;
96
+ hasSidebarStart;
97
+ hasSidebarEnd;
97
98
  render() {
98
- splitChildren.splitChildren(this.props.children);
99
- const style = minifyCss.minifyCss(stripFocusAndHoverStyles.stripFocusAndHoverStyles(stylesEntry.getCanvasCss(this.props.sidebarStartOpen, this.props.sidebarStartWidth, this.props.sidebarEndOpen, this.props.sidebarEndWidth)));
100
- 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: "canvas", children: [jsxRuntime.jsx("header", { part: "header", children: jsxRuntime.jsx("slot", { name: "header" }) }), jsxRuntime.jsx("main", { part: "main", children: jsxRuntime.jsx("slot", {}) }), jsxRuntime.jsx("footer", { part: "footer", children: jsxRuntime.jsx("slot", { name: "footer" }) }), this.props.isDesktopView && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("aside", {
101
- // "part" is not valid in TS
102
- // eslint-disable-next-line
103
- /* @ts-ignore */
104
- part: "sidebar-start",
99
+ const { children, namedSlotChildren, otherChildren } = splitChildren.splitChildren(this.props.children);
100
+ const hasSidebarStart = namedSlotChildren.filter(({ props: { slot } }) => slot === 'sidebar-start').length > 0;
101
+ const hasSidebarEnd = namedSlotChildren.filter(({ props: { slot } }) => slot === 'sidebar-end').length > 0;
102
+ const style = minifyCss.minifyCss(stripFocusAndHoverStyles.stripFocusAndHoverStyles(stylesEntry.getCanvasCss(this.props.theme, this.props.sidebarStartOpen, this.props.sidebarEndOpen)));
103
+ 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: "canvas", children: [jsxRuntime.jsxs("header", { children: [jsxRuntime.jsxs("div", { className: "header", children: [hasSidebarStart && (jsxRuntime.jsxs(button_wrapper.PButton, { theme: this.props.theme, icon: this.props.sidebarStartIcon, variant: "ghost", compact: true, "hide-label": "true", aria: { 'aria-expanded': this.props.sidebarStartOpen }, children: [this.props.sidebarStartOpen ? 'Close' : 'Open', " navigation sidebar"] })), jsxRuntime.jsx("h2", { children: jsxRuntime.jsx("slot", { name: "title" }) }), jsxRuntime.jsx("slot", { name: "header-start" })] }), jsxRuntime.jsx(crest_wrapper.PCrest, { className: "crest" }), jsxRuntime.jsx(wordmark_wrapper.PWordmark, { className: "wordmark", size: "inherit", theme: this.props.theme }), jsxRuntime.jsxs("div", { className: "header", children: [jsxRuntime.jsx("slot", { name: "header-end" }), hasSidebarEnd && (jsxRuntime.jsxs(button_wrapper.PButton, { theme: this.props.theme, icon: this.props.sidebarEndIcon, variant: "ghost", compact: true, "hide-label": "true", aria: { 'aria-expanded': this.props.sidebarEndOpen }, children: [this.props.sidebarEndOpen ? 'Close' : 'Open', " settings sidebar"] }))] })] }), jsxRuntime.jsx("main", { children: jsxRuntime.jsx("slot", {}) }), jsxRuntime.jsx("footer", { children: jsxRuntime.jsx("slot", { name: "footer" }) }), this.props.isDesktopView && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [hasSidebarStart && (jsxRuntime.jsx("aside", { className: "sidebar-start",
105
104
  // "inert" will be known from React 19 onwards, see https://github.com/facebook/react/pull/24730
106
105
  // eslint-disable-next-line
107
106
  /* @ts-ignore */
108
- inert: this.props.sidebarStartOpen ? null : true, children: [jsxRuntime.jsx(buttonPure_wrapper.PButtonPure, { className: "close", icon: "close", hideLabel: true, children: "Close Sidebar" }), jsxRuntime.jsx("slot", { name: "sidebar-start" })] }), jsxRuntime.jsxs("aside", {
109
- // "part" is not valid in TS
110
- // eslint-disable-next-line
111
- /* @ts-ignore */
112
- part: "sidebar-end",
107
+ inert: this.props.sidebarStartOpen ? null : true, "aria-label": `Navigation sidebar ${this.props.sidebarStartOpen ? 'open' : 'closed'}`, children: jsxRuntime.jsx("slot", { name: "sidebar-start" }) })), hasSidebarEnd && (jsxRuntime.jsx("aside", { className: "sidebar-end",
113
108
  // "inert" will be known from React 19 onwards, see https://github.com/facebook/react/pull/24730
114
109
  // eslint-disable-next-line
115
110
  /* @ts-ignore */
116
- inert: this.props.sidebarEndOpen ? null : true, children: [jsxRuntime.jsx(buttonPure_wrapper.PButtonPure, { className: "close", icon: "close", hideLabel: true, children: "Close Sidebar" }), jsxRuntime.jsx("slot", { name: "sidebar-end" })] })] }))] }), !this.props.isDesktopView && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(flyout_wrapper.PFlyout, { open: this.props.sidebarStartOpen, position: "start", children: jsxRuntime.jsx("slot", { name: "sidebar-start" }) }), jsxRuntime.jsx(flyout_wrapper.PFlyout, { open: this.props.sidebarEndOpen, position: "end", children: jsxRuntime.jsx("slot", { name: "sidebar-end" }) })] }))] })] }), this.props.children] }));
111
+ inert: this.props.sidebarEndOpen ? null : true, "aria-label": `Settings sidebar ${this.props.sidebarEndOpen ? 'open' : 'closed'}`, children: jsxRuntime.jsx("slot", { name: "sidebar-end" }) }))] }))] }), !this.props.isDesktopView && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [hasSidebarStart && (jsxRuntime.jsx(flyout_wrapper.PFlyout, { theme: this.props.theme, open: this.props.sidebarStartOpen, position: "start", children: jsxRuntime.jsx("slot", { name: "sidebar-start" }) })), hasSidebarEnd && (jsxRuntime.jsx(flyout_wrapper.PFlyout, { theme: this.props.theme, open: this.props.sidebarEndOpen, position: "end", children: jsxRuntime.jsx("slot", { name: "sidebar-end" }) }))] }))] })] }), this.props.children] }));
117
112
  }
118
113
  }
119
114