@equinor/eds-core-react 2.3.6 → 2.4.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/build/index.css +407 -64
  2. package/build/index.min.css +1 -1
  3. package/dist/eds-core-react.cjs +199 -28
  4. package/dist/esm/components/Autocomplete/AutocompleteContext.js +2 -2
  5. package/dist/esm/components/Autocomplete/MultipleInput.js +2 -2
  6. package/dist/esm/components/Autocomplete/OptionList.js +6 -4
  7. package/dist/esm/components/Autocomplete/useAutocomplete.js +4 -0
  8. package/dist/esm/components/Datepicker/DatePicker.js +4 -1
  9. package/dist/esm/components/Datepicker/DateRangePicker.js +4 -1
  10. package/dist/esm/components/Datepicker/calendars/CalendarGrid.js +4 -8
  11. package/dist/esm/components/Datepicker/calendars/CalendarHeader.js +6 -6
  12. package/dist/esm/components/Datepicker/fields/DateSegment.js +4 -1
  13. package/dist/esm/components/Datepicker/utils/getLocalizedValidationErrors.js +164 -0
  14. package/dist/esm/components/InputWrapper/InputWrapper.js +1 -1
  15. package/dist/esm/components/Popover/Popover.js +4 -4
  16. package/dist/esm/components/Table/DataCell/DataCell.js +1 -1
  17. package/dist/esm/components/Table/FooterCell/FooterCell.js +1 -1
  18. package/dist/esm/components/Table/HeaderCell/HeaderCell.js +1 -1
  19. package/dist/esm/components/Textarea/Textarea.js +1 -1
  20. package/dist/esm-next/components/next/Banner/Banner.js +88 -0
  21. package/dist/esm-next/components/next/Button/Button.js +1 -0
  22. package/dist/esm-next/components/next/Icon/Icon.js +27 -1
  23. package/dist/esm-next/components/next/Input/Input.js +1 -1
  24. package/dist/esm-next/components/next/Link/Link.js +24 -0
  25. package/dist/esm-next/components/next/Search/Search.js +118 -0
  26. package/dist/esm-next/components/next/TextArea/TextArea.js +131 -0
  27. package/dist/esm-next/components/next/TextField/TextField.js +7 -2
  28. package/dist/esm-next/components/next/Tooltip/Tooltip.js +84 -0
  29. package/dist/esm-next/index.next.js +5 -0
  30. package/dist/index.next.cjs +451 -8
  31. package/dist/types/components/Autocomplete/AutocompleteContext.d.ts +2 -2
  32. package/dist/types/components/Autocomplete/useAutocomplete.d.ts +2 -2
  33. package/dist/types/components/Datepicker/utils/getLocalizedValidationErrors.d.ts +9 -0
  34. package/dist/types/components/next/Banner/Banner.d.ts +23 -0
  35. package/dist/types/components/next/Banner/Banner.figma.d.ts +1 -0
  36. package/dist/types/components/next/Banner/Banner.types.d.ts +33 -0
  37. package/dist/types/components/next/Banner/index.d.ts +2 -0
  38. package/dist/types/components/next/Icon/Icon.d.ts +0 -1
  39. package/dist/types/components/next/Input/Input.types.d.ts +4 -1
  40. package/dist/types/components/next/Link/Link.d.ts +4 -0
  41. package/dist/types/components/next/Link/Link.figma.d.ts +1 -0
  42. package/dist/types/components/next/Link/Link.types.d.ts +11 -0
  43. package/dist/types/components/next/Link/index.d.ts +2 -0
  44. package/dist/types/components/next/Search/Search.d.ts +9 -0
  45. package/dist/types/components/next/Search/Search.figma.d.ts +1 -0
  46. package/dist/types/components/next/Search/Search.types.d.ts +16 -0
  47. package/dist/types/components/next/Search/index.d.ts +2 -0
  48. package/dist/types/components/next/TextArea/TextArea.d.ts +11 -0
  49. package/dist/types/components/next/TextArea/TextArea.figma.d.ts +1 -0
  50. package/dist/types/components/next/TextArea/TextArea.types.d.ts +21 -0
  51. package/dist/types/components/next/TextArea/index.d.ts +2 -0
  52. package/dist/types/components/next/Tooltip/Tooltip.d.ts +7 -0
  53. package/dist/types/components/next/Tooltip/Tooltip.figma.d.ts +1 -0
  54. package/dist/types/components/next/Tooltip/Tooltip.types.d.ts +17 -0
  55. package/dist/types/components/next/Tooltip/index.d.ts +2 -0
  56. package/dist/types/components/next/index.d.ts +10 -0
  57. package/package.json +42 -35
@@ -1830,7 +1830,7 @@ const StyledTableCell$2 = styled__default.default.td.withConfig({
1830
1830
  align
1831
1831
  } = theme;
1832
1832
  const backgroundColor = color === 'error' ? theme.validation.error?.background : '';
1833
- const base = styled.css(["min-height:", ";height:", ";background:", ";vertical-align:", ";box-sizing:border-box;", " ", " ", ""], height, height, backgroundColor, align.vertical, edsUtils.spacingsTemplate(spacings), edsUtils.typographyTemplate(typography), edsUtils.bordersTemplate(border));
1833
+ const base = styled.css(["min-height:", ";height:", ";background:", ";vertical-align:", ";box-sizing:border-box;", " ", " ", " a{font-size:inherit;font-weight:inherit;}"], height, height, backgroundColor, align.vertical, edsUtils.spacingsTemplate(spacings), edsUtils.typographyTemplate(typography), edsUtils.bordersTemplate(border));
1834
1834
  return base;
1835
1835
  });
1836
1836
  const TableDataCell = /*#__PURE__*/react.forwardRef(function TableDataCell({
@@ -2011,7 +2011,7 @@ const StyledTableCell$1 = styled__default.default.th.withConfig({
2011
2011
  // Firefox specific workaround (bug in v142.0) - see issue #3910
2012
2012
  // Hardcoded padding values compensate for Firefox's incorrect table cell height calculation
2013
2013
  const firefoxFix = edsUtils.isFirefox() ? styled.css(["vertical-align:top;height:auto;min-height:", ";> div{padding:", " 0;}"], height, $density === 'compact' ? '7px' : '13px') : styled.css([""]);
2014
- return styled.css(["min-height:", ";height:", ";background:", ";box-sizing:border-box;", " ", " ", " ", " ", " ", " ", ""], height, height, background, edsUtils.spacingsTemplate(spacings), edsUtils.typographyTemplate(typography), edsUtils.bordersTemplate(theme.border), sortStylingHover, sortStylingActive, firefoxFix, $sticky ? styled.css(["position:sticky;top:0;z-index:1;"]) : '');
2014
+ return styled.css(["min-height:", ";height:", ";background:", ";box-sizing:border-box;", " ", " ", " ", " ", " ", " a{font-size:inherit;font-weight:inherit;}", ""], height, height, background, edsUtils.spacingsTemplate(spacings), edsUtils.typographyTemplate(typography), edsUtils.bordersTemplate(theme.border), sortStylingHover, sortStylingActive, firefoxFix, $sticky ? styled.css(["position:sticky;top:0;z-index:1;"]) : '');
2015
2015
  });
2016
2016
  const CellInner$1 = styled__default.default.div.withConfig({
2017
2017
  displayName: "HeaderCell__CellInner",
@@ -2061,7 +2061,7 @@ const StyledTableCell = styled__default.default.th.withConfig({
2061
2061
  typography,
2062
2062
  spacings
2063
2063
  } = theme;
2064
- return styled.css(["min-height:", ";height:", ";background:", ";box-sizing:border-box;", " ", " ", " ", ""], height, height, background, edsUtils.spacingsTemplate(spacings), edsUtils.typographyTemplate(typography), edsUtils.bordersTemplate(theme.border), $sticky ? styled.css(["position:sticky;bottom:0;z-index:2;"]) : '');
2064
+ return styled.css(["min-height:", ";height:", ";background:", ";box-sizing:border-box;", " ", " ", " a{font-size:inherit;font-weight:inherit;}", ""], height, height, background, edsUtils.spacingsTemplate(spacings), edsUtils.typographyTemplate(typography), edsUtils.bordersTemplate(theme.border), $sticky ? styled.css(["position:sticky;bottom:0;z-index:2;"]) : '');
2065
2065
  });
2066
2066
  const CellInner = styled__default.default.div.withConfig({
2067
2067
  displayName: "FooterCell__CellInner",
@@ -6689,12 +6689,12 @@ const Popover$1 = /*#__PURE__*/react.forwardRef(function Popover({
6689
6689
  } = react$1.useInteractions([react$1.useDismiss(context)]);
6690
6690
  react.useEffect(() => {
6691
6691
  if (!elements.floating) return;
6692
- if (open) {
6693
- if (elements.floating.isConnected) {
6692
+ if (elements.floating.hasAttribute('popover')) {
6693
+ if (open) {
6694
6694
  elements.floating.showPopover();
6695
+ } else {
6696
+ elements.floating.hidePopover();
6695
6697
  }
6696
- } else {
6697
- elements.floating.hidePopover();
6698
6698
  }
6699
6699
  }, [open, elements.floating]);
6700
6700
  react.useEffect(() => {
@@ -9502,7 +9502,7 @@ Switch.displayName = 'Switch';
9502
9502
 
9503
9503
  const AutocompleteContext = /*#__PURE__*/react.createContext(null);
9504
9504
  const useAutocompleteContext = () => {
9505
- const context = react.use(AutocompleteContext);
9505
+ const context = react.useContext(AutocompleteContext);
9506
9506
  if (!context) {
9507
9507
  throw new Error('Autocomplete compound components must be used within an Autocomplete component');
9508
9508
  }
@@ -9618,7 +9618,7 @@ const MultipleInput = () => {
9618
9618
  if (el) chipRefs.current.set(getLabel(item), el);else chipRefs.current.delete(getLabel(item));
9619
9619
  },
9620
9620
  style: {
9621
- outline: '1px solid var(--eds-color-accent-12)',
9621
+ outline: '1px solid var(--eds_interactive_primary__resting, rgba(0, 112, 121, 1))',
9622
9622
  ...(density === 'compact' && {
9623
9623
  height: '16px',
9624
9624
  fontSize: '12px',
@@ -9984,10 +9984,12 @@ const OptionList = ({
9984
9984
 
9985
9985
  // MARK: popover toggle
9986
9986
  edsUtils.useIsomorphicLayoutEffect(() => {
9987
- if (isOpen) {
9988
- refs.floating.current?.showPopover();
9989
- } else {
9990
- refs.floating.current?.hidePopover();
9987
+ if (refs.floating.current?.hasAttribute('popover')) {
9988
+ if (isOpen) {
9989
+ refs.floating.current.showPopover();
9990
+ } else {
9991
+ refs.floating.current.hidePopover();
9992
+ }
9991
9993
  }
9992
9994
  }, [isOpen, refs.floating]);
9993
9995
  const showNoOptions = isOpen && !availableItems.length && noOptionsText.length > 0;
@@ -10263,6 +10265,7 @@ const useAutocomplete = ({
10263
10265
  variant,
10264
10266
  onClear,
10265
10267
  ref,
10268
+ id,
10266
10269
  ...other
10267
10270
  }) => {
10268
10271
  const [lastScrollOffset, setLastScrollOffset] = react.useState(0);
@@ -10424,6 +10427,9 @@ const useAutocomplete = ({
10424
10427
 
10425
10428
  // MARK: downshift state
10426
10429
  let comboBoxProps = {
10430
+ ...(id !== undefined && {
10431
+ inputId: id
10432
+ }),
10427
10433
  items: availableItems,
10428
10434
  //can not pass readonly type to downshift so we cast it to regular T[]
10429
10435
  initialSelectedItem: initialSelectedOptions[0],
@@ -12086,9 +12092,6 @@ function CalendarGrid({
12086
12092
  setYearPickerPage,
12087
12093
  ...props
12088
12094
  }) {
12089
- const {
12090
- locale
12091
- } = reactAria.useLocale();
12092
12095
  const {
12093
12096
  gridProps,
12094
12097
  headerProps,
@@ -12098,9 +12101,9 @@ function CalendarGrid({
12098
12101
  weekdayStyle: 'long'
12099
12102
  }, state);
12100
12103
 
12101
- // Get the number of weeks in the month so that we can render the proper number of rows.
12102
- const howManyWeeksInMonth = date.getWeeksInMonth(state.visibleRange.start, locale);
12103
- const weeksInMonthArray = [...new Array(howManyWeeksInMonth).keys()];
12104
+ // Always render 6 rows (the maximum weeks in any month) so the calendar
12105
+ // height stays consistent when navigating between months.
12106
+ const weeksInMonthArray = [...new Array(6).keys()];
12104
12107
  return showYearPicker ? /*#__PURE__*/jsxRuntime.jsx(YearGrid, {
12105
12108
  year: state.focusedDate.year,
12106
12109
  setFocusedYear: year => {
@@ -12152,7 +12155,7 @@ function TodayPicker({
12152
12155
  onClick: () => onClick(new date.CalendarDate(today.getFullYear(), today.getMonth() + 1, today.getDate())),
12153
12156
  variant: 'ghost',
12154
12157
  style: {
12155
- marginLeft: 16
12158
+ marginLeft: 4
12156
12159
  },
12157
12160
  children: "Today"
12158
12161
  });
@@ -12161,6 +12164,10 @@ const HeaderActions = styled__default.default.div.withConfig({
12161
12164
  displayName: "CalendarHeader__HeaderActions",
12162
12165
  componentId: "sc-kuy15-1"
12163
12166
  })(["display:flex;align-items:center;width:100%;"]);
12167
+ const TitleButton = styled__default.default(Button$1).withConfig({
12168
+ displayName: "CalendarHeader__TitleButton",
12169
+ componentId: "sc-kuy15-2"
12170
+ })(["min-width:13.1rem;white-space:nowrap;font-size:", ";text-transform:capitalize;& > span{display:flex;justify-content:space-between;align-items:center;width:100%;}"], edsTokens.tokens.typography.heading.h5.fontSize);
12164
12171
 
12165
12172
  /**
12166
12173
  * The default header for the calendar components if no custom header is provided
@@ -12192,15 +12199,11 @@ function CalendarHeader({
12192
12199
  style: {
12193
12200
  flex: '1 1 auto'
12194
12201
  }
12195
- }), /*#__PURE__*/jsxRuntime.jsxs(Button$1, {
12202
+ }), /*#__PURE__*/jsxRuntime.jsxs(TitleButton, {
12196
12203
  onClick: () => setShowYearPicker(!showYearPicker),
12197
12204
  "data-testid": 'heading',
12198
12205
  "aria-live": 'polite',
12199
12206
  variant: 'ghost',
12200
- style: {
12201
- fontSize: edsTokens.tokens.typography.heading.h5.fontSize,
12202
- textTransform: 'capitalize'
12203
- },
12204
12207
  children: [title, /*#__PURE__*/jsxRuntime.jsx(Icon$1, {
12205
12208
  data: showYearPicker ? edsIcons.chevron_up : edsIcons.chevron_down
12206
12209
  })]
@@ -12492,7 +12495,10 @@ function DateSegment({
12492
12495
  formatOptions,
12493
12496
  timezone
12494
12497
  } = useDatePickerContext();
12495
- const formatter = reactAria.useDateFormatter(formatOptions);
12498
+ const formatter = reactAria.useDateFormatter({
12499
+ ...formatOptions,
12500
+ timeZone: timezone
12501
+ });
12496
12502
  const parts = state.value ? formatter.formatToParts(state.value.toDate(timezone)) : [];
12497
12503
  const part = parts.find(p => p.type === segment.type);
12498
12504
  const value = segment.isPlaceholder || segment.type === 'literal' ? segment.text : part?.value ?? segment.text;
@@ -12697,6 +12703,167 @@ const useGetLocale = locale => {
12697
12703
  return locale ?? currentLocale ?? browserLocale;
12698
12704
  };
12699
12705
 
12706
+ /**
12707
+ * Validation message translations matching @react-stately/datepicker's built-in messages.
12708
+ * Sourced from @react-stately/datepicker's intlStrings bundle.
12709
+ * Unsupported locales fall back to English.
12710
+ */
12711
+ const allTranslations = {
12712
+ 'en-US': {
12713
+ rangeUnderflow: args => `Value must be ${args.minValue} or later.`,
12714
+ rangeOverflow: args => `Value must be ${args.maxValue} or earlier.`,
12715
+ unavailableDate: 'Selected date unavailable.'
12716
+ },
12717
+ 'nb-NO': {
12718
+ rangeUnderflow: args => `Verdien m\u00e5 v\u00e6re ${args.minValue} eller senere.`,
12719
+ rangeOverflow: args => `Verdien m\u00e5 v\u00e6re ${args.maxValue} eller tidligere.`,
12720
+ unavailableDate: 'Valgt dato utilgjengelig.'
12721
+ },
12722
+ 'da-DK': {
12723
+ rangeUnderflow: args => `V\u00e6rdien skal v\u00e6re ${args.minValue} eller senere.`,
12724
+ rangeOverflow: args => `V\u00e6rdien skal v\u00e6re ${args.maxValue} eller tidligere.`,
12725
+ unavailableDate: 'Den valgte dato er ikke tilg\u00e6ngelig.'
12726
+ },
12727
+ 'sv-SE': {
12728
+ rangeUnderflow: args => `V\u00e4rdet m\u00e5ste vara ${args.minValue} eller senare.`,
12729
+ rangeOverflow: args => `V\u00e4rdet m\u00e5ste vara ${args.maxValue} eller tidigare.`,
12730
+ unavailableDate: 'Valt datum \u00e4r inte tillg\u00e4ngligt.'
12731
+ },
12732
+ 'de-DE': {
12733
+ rangeUnderflow: args => `Der Wert muss ${args.minValue} oder sp\u00e4ter sein.`,
12734
+ rangeOverflow: args => `Der Wert muss ${args.maxValue} oder fr\u00fcher sein.`,
12735
+ unavailableDate: 'Das ausgew\u00e4hlte Datum ist nicht verf\u00fcgbar.'
12736
+ },
12737
+ 'fr-FR': {
12738
+ rangeUnderflow: args => `La valeur doit \u00eatre ${args.minValue} ou ult\u00e9rieure.`,
12739
+ rangeOverflow: args => `La valeur doit \u00eatre ${args.maxValue} ou ant\u00e9rieure.`,
12740
+ unavailableDate: 'Date s\u00e9lectionn\u00e9e non disponible.'
12741
+ },
12742
+ 'es-ES': {
12743
+ rangeUnderflow: args => `El valor debe ser ${args.minValue} o posterior.`,
12744
+ rangeOverflow: args => `El valor debe ser ${args.maxValue} o anterior.`,
12745
+ unavailableDate: 'Fecha seleccionada no disponible.'
12746
+ },
12747
+ 'pt-BR': {
12748
+ rangeUnderflow: args => `O valor deve ser ${args.minValue} ou posterior.`,
12749
+ rangeOverflow: args => `O valor deve ser ${args.maxValue} ou anterior.`,
12750
+ unavailableDate: 'Data selecionada indispon\u00edvel.'
12751
+ },
12752
+ 'pt-PT': {
12753
+ rangeUnderflow: args => `O valor tem de ser ${args.minValue} ou posterior.`,
12754
+ rangeOverflow: args => `O valor tem de ser ${args.maxValue} ou anterior.`,
12755
+ unavailableDate: 'Data selecionada indispon\u00edvel.'
12756
+ },
12757
+ 'pl-PL': {
12758
+ rangeUnderflow: args => `Warto\u015b\u0107 musi wynosi\u0107 ${args.minValue} lub p\u00f3\u017aniej.`,
12759
+ rangeOverflow: args => `Warto\u015b\u0107 musi wynosi\u0107 ${args.maxValue} lub wcze\u015bniej.`,
12760
+ unavailableDate: 'Wybrana data jest niedost\u0119pna.'
12761
+ },
12762
+ 'nl-NL': {
12763
+ rangeUnderflow: args => `Waarde moet ${args.minValue} of later zijn.`,
12764
+ rangeOverflow: args => `Waarde moet ${args.maxValue} of eerder zijn.`,
12765
+ unavailableDate: 'Geselecteerde datum niet beschikbaar.'
12766
+ },
12767
+ 'it-IT': {
12768
+ rangeUnderflow: args => `Il valore deve essere ${args.minValue} o successivo.`,
12769
+ rangeOverflow: args => `Il valore deve essere ${args.maxValue} o precedente.`,
12770
+ unavailableDate: 'Data selezionata non disponibile.'
12771
+ },
12772
+ 'ja-JP': {
12773
+ rangeUnderflow: args => `\u5024\u306f${args.minValue}\u4ee5\u964d\u3067\u3042\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002`,
12774
+ rangeOverflow: args => `\u5024\u306f${args.maxValue}\u4ee5\u524d\u3067\u3042\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002`,
12775
+ unavailableDate: '\u9078\u629e\u3057\u305f\u65e5\u4ed8\u306f\u5229\u7528\u3067\u304d\u307e\u305b\u3093\u3002'
12776
+ },
12777
+ 'ko-KR': {
12778
+ rangeUnderflow: args => `\uac12\uc740 ${args.minValue} \uc774\ud6c4\uc5ec\uc57c \ud569\ub2c8\ub2e4.`,
12779
+ rangeOverflow: args => `\uac12\uc740 ${args.maxValue} \uc774\uc804\uc774\uc5b4\uc57c \ud569\ub2c8\ub2e4.`,
12780
+ unavailableDate: '\uc120\ud0dd\ud55c \ub0a0\uc9dc\ub97c \uc0ac\uc6a9\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4.'
12781
+ },
12782
+ 'zh-CN': {
12783
+ rangeUnderflow: args => `\u503c\u5fc5\u987b\u4e3a ${args.minValue} \u6216\u66f4\u665a\u3002`,
12784
+ rangeOverflow: args => `\u503c\u5fc5\u987b\u4e3a ${args.maxValue} \u6216\u66f4\u65e9\u3002`,
12785
+ unavailableDate: '\u6240\u9009\u65e5\u671f\u4e0d\u53ef\u7528\u3002'
12786
+ },
12787
+ 'zh-TW': {
12788
+ rangeUnderflow: args => `\u503c\u5fc5\u9808\u70ba ${args.minValue} \u6216\u66f4\u665a\u3002`,
12789
+ rangeOverflow: args => `\u503c\u5fc5\u9808\u70ba ${args.maxValue} \u6216\u66f4\u65e9\u3002`,
12790
+ unavailableDate: '\u6240\u9078\u65e5\u671f\u4e0d\u53ef\u7528\u3002'
12791
+ },
12792
+ 'ru-RU': {
12793
+ rangeUnderflow: args => `\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c ${args.minValue} \u0438\u043b\u0438 \u043f\u043e\u0437\u0436\u0435.`,
12794
+ rangeOverflow: args => `\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c ${args.maxValue} \u0438\u043b\u0438 \u0440\u0430\u043d\u044c\u0448\u0435.`,
12795
+ unavailableDate: '\u0412\u044b\u0431\u0440\u0430\u043d\u043d\u0430\u044f \u0434\u0430\u0442\u0430 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430.'
12796
+ },
12797
+ 'uk-UA': {
12798
+ rangeUnderflow: args => `\u0417\u043d\u0430\u0447\u0435\u043d\u043d\u044f \u043c\u0430\u0454 \u0431\u0443\u0442\u0438 ${args.minValue} \u0430\u0431\u043e \u043f\u0456\u0437\u043d\u0456\u0448\u0435.`,
12799
+ rangeOverflow: args => `\u0417\u043d\u0430\u0447\u0435\u043d\u043d\u044f \u043c\u0430\u0454 \u0431\u0443\u0442\u0438 ${args.maxValue} \u0430\u0431\u043e \u0440\u0430\u043d\u0456\u0448\u0435.`,
12800
+ unavailableDate: '\u0412\u0438\u0431\u0440\u0430\u043d\u0430 \u0434\u0430\u0442\u0430 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430.'
12801
+ },
12802
+ 'ar-AE': {
12803
+ rangeUnderflow: args => `\u064a\u062c\u0628 \u0623\u0646 \u062a\u0643\u0648\u0646 \u0627\u0644\u0642\u064a\u0645\u0629 ${args.minValue} \u0623\u0648 \u0623\u062d\u062f\u062b.`,
12804
+ rangeOverflow: args => `\u064a\u062c\u0628 \u0623\u0646 \u062a\u0643\u0648\u0646 \u0627\u0644\u0642\u064a\u0645\u0629 ${args.maxValue} \u0623\u0648 \u0623\u0642\u062f\u0645.`,
12805
+ unavailableDate: '\u0627\u0644\u062a\u0627\u0631\u064a\u062e \u0627\u0644\u0645\u062d\u062f\u062f \u063a\u064a\u0631 \u0645\u062a\u0627\u062d.'
12806
+ },
12807
+ 'fi-FI': {
12808
+ rangeUnderflow: args => `Arvon on oltava ${args.minValue} tai my\u00f6hempi.`,
12809
+ rangeOverflow: args => `Arvon on oltava ${args.maxValue} tai aikaisempi.`,
12810
+ unavailableDate: 'Valittu p\u00e4iv\u00e4m\u00e4\u00e4r\u00e4 ei ole k\u00e4ytett\u00e4viss\u00e4.'
12811
+ }
12812
+ };
12813
+ const englishFallback = allTranslations['en-US'];
12814
+
12815
+ /**
12816
+ * Find the best matching locale from available translations.
12817
+ * Tries exact match first (e.g. "nb-NO"), then language prefix match (e.g. "nb" → "nb-NO").
12818
+ */
12819
+ function findLocaleMessages(locale) {
12820
+ if (allTranslations[locale]) return allTranslations[locale];
12821
+ const language = Intl.Locale ? new Intl.Locale(locale).language : locale.split('-')[0];
12822
+
12823
+ // First match wins: e.g. "pt" → "pt-BR", "zh" → "zh-CN"
12824
+ for (const key of Object.keys(allTranslations)) {
12825
+ const keyLang = key.split('-')[0];
12826
+ if (keyLang === language) return allTranslations[key];
12827
+ }
12828
+ return englishFallback;
12829
+ }
12830
+ function formatMessage(msg, args) {
12831
+ return typeof msg === 'function' ? msg(args) : msg;
12832
+ }
12833
+
12834
+ /**
12835
+ * Generates validation error messages using the provided locale instead of
12836
+ * navigator.language (which is what react-stately uses internally).
12837
+ *
12838
+ * This fixes the issue where validation messages appear in the browser's
12839
+ * language rather than the locale configured via I18nProvider.
12840
+ */
12841
+ function getLocalizedValidationErrors(validationDetails, locale, minValue, maxValue, timezone) {
12842
+ const msgs = findLocaleMessages(locale);
12843
+ const dateFormatter = new date.DateFormatter(locale, {
12844
+ year: 'numeric',
12845
+ month: 'numeric',
12846
+ day: 'numeric'
12847
+ });
12848
+ const timeZone = timezone ?? dateFormatter.resolvedOptions().timeZone;
12849
+ const errors = [];
12850
+ if (validationDetails.rangeUnderflow && minValue && msgs.rangeUnderflow) {
12851
+ errors.push(formatMessage(msgs.rangeUnderflow, {
12852
+ minValue: dateFormatter.format(minValue.toDate(timeZone))
12853
+ }));
12854
+ }
12855
+ if (validationDetails.rangeOverflow && maxValue && msgs.rangeOverflow) {
12856
+ errors.push(formatMessage(msgs.rangeOverflow, {
12857
+ maxValue: dateFormatter.format(maxValue.toDate(timeZone))
12858
+ }));
12859
+ }
12860
+ // react-stately maps isDateUnavailable to badInput (not customError)
12861
+ if (validationDetails.badInput && msgs.unavailableDate) {
12862
+ errors.push(formatMessage(msgs.unavailableDate, {}));
12863
+ }
12864
+ return errors;
12865
+ }
12866
+
12700
12867
  const DatePicker = /*#__PURE__*/react.forwardRef(({
12701
12868
  onChange,
12702
12869
  label,
@@ -12791,8 +12958,10 @@ const DatePicker = /*#__PURE__*/react.forwardRef(({
12791
12958
  fieldProps,
12792
12959
  calendarProps
12793
12960
  } = reactAria.useDatePicker(dateCreateProps, pickerState, ref);
12961
+ const localizedErrors = pickerState.displayValidation.isInvalid ? getLocalizedValidationErrors(pickerState.displayValidation.validationDetails, locale, _minValue, _maxValue, timezone) : [];
12962
+ const errorMessages = localizedErrors.length > 0 ? localizedErrors : pickerState.displayValidation.validationErrors;
12794
12963
  const helperPropsInvalid = pickerState.displayValidation.isInvalid ? {
12795
- text: pickerState.displayValidation.validationErrors.join('\n'),
12964
+ text: errorMessages.join('\n'),
12796
12965
  color: edsTokens.tokens.colors.interactive.warning__text.rgba,
12797
12966
  icon: /*#__PURE__*/jsxRuntime.jsx(Icon$1, {
12798
12967
  size: 16,
@@ -13042,8 +13211,10 @@ const DateRangePicker = /*#__PURE__*/react.forwardRef(({
13042
13211
  buttonProps,
13043
13212
  calendarProps
13044
13213
  } = reactAria.useDateRangePicker(dateRangePickerStateProps, state, ref);
13214
+ const localizedErrors = state.displayValidation.isInvalid ? getLocalizedValidationErrors(state.displayValidation.validationDetails, locale, _minValue, _maxValue, timezone) : [];
13215
+ const errorMessages = localizedErrors.length > 0 ? localizedErrors : state.displayValidation.validationErrors;
13045
13216
  const helperProps = state.displayValidation.isInvalid ? {
13046
- text: state.displayValidation.validationErrors.join('\n'),
13217
+ text: errorMessages.join('\n'),
13047
13218
  color: edsTokens.tokens.colors.interactive.warning__text.rgba,
13048
13219
  icon: /*#__PURE__*/jsxRuntime.jsx(Icon$1, {
13049
13220
  size: 16,
@@ -1,8 +1,8 @@
1
- import { createContext, use } from 'react';
1
+ import { createContext, useContext } from 'react';
2
2
 
3
3
  const AutocompleteContext = /*#__PURE__*/createContext(null);
4
4
  const useAutocompleteContext = () => {
5
- const context = use(AutocompleteContext);
5
+ const context = useContext(AutocompleteContext);
6
6
  if (!context) {
7
7
  throw new Error('Autocomplete compound components must be used within an Autocomplete component');
8
8
  }
@@ -3,9 +3,9 @@ import styled from 'styled-components';
3
3
  import { useAutocompleteContext } from './AutocompleteContext.js';
4
4
  import { RightAdornments } from './RightAdornments.js';
5
5
  import { jsx, jsxs } from 'react/jsx-runtime';
6
- import { Chip } from '../Chip/Chip.js';
7
6
  import { useEds } from '../EdsProvider/eds.context.js';
8
7
  import { Input } from '../Input/Input.js';
8
+ import { Chip } from '../Chip/Chip.js';
9
9
 
10
10
  const UnstyledInput = styled.input.withConfig({
11
11
  displayName: "MultipleInput__UnstyledInput",
@@ -76,7 +76,7 @@ const MultipleInput = () => {
76
76
  if (el) chipRefs.current.set(getLabel(item), el);else chipRefs.current.delete(getLabel(item));
77
77
  },
78
78
  style: {
79
- outline: '1px solid var(--eds-color-accent-12)',
79
+ outline: '1px solid var(--eds_interactive_primary__resting, rgba(0, 112, 121, 1))',
80
80
  ...(density === 'compact' && {
81
81
  height: '16px',
82
82
  fontSize: '12px',
@@ -41,10 +41,12 @@ const OptionList = ({
41
41
 
42
42
  // MARK: popover toggle
43
43
  useIsomorphicLayoutEffect(() => {
44
- if (isOpen) {
45
- refs.floating.current?.showPopover();
46
- } else {
47
- refs.floating.current?.hidePopover();
44
+ if (refs.floating.current?.hasAttribute('popover')) {
45
+ if (isOpen) {
46
+ refs.floating.current.showPopover();
47
+ } else {
48
+ refs.floating.current.hidePopover();
49
+ }
48
50
  }
49
51
  }, [isOpen, refs.floating]);
50
52
  const showNoOptions = isOpen && !availableItems.length && noOptionsText.length > 0;
@@ -43,6 +43,7 @@ const useAutocomplete = ({
43
43
  variant,
44
44
  onClear,
45
45
  ref,
46
+ id,
46
47
  ...other
47
48
  }) => {
48
49
  const [lastScrollOffset, setLastScrollOffset] = useState(0);
@@ -204,6 +205,9 @@ const useAutocomplete = ({
204
205
 
205
206
  // MARK: downshift state
206
207
  let comboBoxProps = {
208
+ ...(id !== undefined && {
209
+ inputId: id
210
+ }),
207
211
  items: availableItems,
208
212
  //can not pass readonly type to downshift so we cast it to regular T[]
209
213
  initialSelectedItem: initialSelectedOptions[0],
@@ -13,6 +13,7 @@ import { tokens } from '@equinor/eds-tokens';
13
13
  import { Icon } from '../Icon/index.js';
14
14
  import { getCalendarDate } from './utils/get-calendar-date.js';
15
15
  import { useGetLocale } from './utils/useGetLocale.js';
16
+ import { getLocalizedValidationErrors } from './utils/getLocalizedValidationErrors.js';
16
17
  import { jsx } from 'react/jsx-runtime';
17
18
 
18
19
  const DatePicker = /*#__PURE__*/forwardRef(({
@@ -109,8 +110,10 @@ const DatePicker = /*#__PURE__*/forwardRef(({
109
110
  fieldProps,
110
111
  calendarProps
111
112
  } = useDatePicker(dateCreateProps, pickerState, ref);
113
+ const localizedErrors = pickerState.displayValidation.isInvalid ? getLocalizedValidationErrors(pickerState.displayValidation.validationDetails, locale, _minValue, _maxValue, timezone) : [];
114
+ const errorMessages = localizedErrors.length > 0 ? localizedErrors : pickerState.displayValidation.validationErrors;
112
115
  const helperPropsInvalid = pickerState.displayValidation.isInvalid ? {
113
- text: pickerState.displayValidation.validationErrors.join('\n'),
116
+ text: errorMessages.join('\n'),
114
117
  color: tokens.colors.interactive.warning__text.rgba,
115
118
  icon: /*#__PURE__*/jsx(Icon, {
116
119
  size: 16,
@@ -13,6 +13,7 @@ import { tokens } from '@equinor/eds-tokens';
13
13
  import { Icon } from '../Icon/index.js';
14
14
  import { getCalendarDate } from './utils/get-calendar-date.js';
15
15
  import { useGetLocale } from './utils/useGetLocale.js';
16
+ import { getLocalizedValidationErrors } from './utils/getLocalizedValidationErrors.js';
16
17
  import { jsx } from 'react/jsx-runtime';
17
18
 
18
19
  const DateRangePicker = /*#__PURE__*/forwardRef(({
@@ -96,8 +97,10 @@ const DateRangePicker = /*#__PURE__*/forwardRef(({
96
97
  buttonProps,
97
98
  calendarProps
98
99
  } = useDateRangePicker(dateRangePickerStateProps, state, ref);
100
+ const localizedErrors = state.displayValidation.isInvalid ? getLocalizedValidationErrors(state.displayValidation.validationDetails, locale, _minValue, _maxValue, timezone) : [];
101
+ const errorMessages = localizedErrors.length > 0 ? localizedErrors : state.displayValidation.validationErrors;
99
102
  const helperProps = state.displayValidation.isInvalid ? {
100
- text: state.displayValidation.validationErrors.join('\n'),
103
+ text: errorMessages.join('\n'),
101
104
  color: tokens.colors.interactive.warning__text.rgba,
102
105
  icon: /*#__PURE__*/jsx(Icon, {
103
106
  size: 16,
@@ -1,5 +1,4 @@
1
- import { useLocale, useCalendarGrid } from 'react-aria';
2
- import { getWeeksInMonth } from '@internationalized/date';
1
+ import { useCalendarGrid } from 'react-aria';
3
2
  import { CalendarCell } from './CalendarCell.js';
4
3
  import { YearGrid } from './YearGrid.js';
5
4
  import { jsx, jsxs } from 'react/jsx-runtime';
@@ -17,9 +16,6 @@ function CalendarGrid({
17
16
  setYearPickerPage,
18
17
  ...props
19
18
  }) {
20
- const {
21
- locale
22
- } = useLocale();
23
19
  const {
24
20
  gridProps,
25
21
  headerProps,
@@ -29,9 +25,9 @@ function CalendarGrid({
29
25
  weekdayStyle: 'long'
30
26
  }, state);
31
27
 
32
- // Get the number of weeks in the month so that we can render the proper number of rows.
33
- const howManyWeeksInMonth = getWeeksInMonth(state.visibleRange.start, locale);
34
- const weeksInMonthArray = [...new Array(howManyWeeksInMonth).keys()];
28
+ // Always render 6 rows (the maximum weeks in any month) so the calendar
29
+ // height stays consistent when navigating between months.
30
+ const weeksInMonthArray = [...new Array(6).keys()];
35
31
  return showYearPicker ? /*#__PURE__*/jsx(YearGrid, {
36
32
  year: state.focusedDate.year,
37
33
  setFocusedYear: year => {
@@ -21,7 +21,7 @@ function TodayPicker({
21
21
  onClick: () => onClick(new CalendarDate(today.getFullYear(), today.getMonth() + 1, today.getDate())),
22
22
  variant: 'ghost',
23
23
  style: {
24
- marginLeft: 16
24
+ marginLeft: 4
25
25
  },
26
26
  children: "Today"
27
27
  });
@@ -30,6 +30,10 @@ const HeaderActions = styled.div.withConfig({
30
30
  displayName: "CalendarHeader__HeaderActions",
31
31
  componentId: "sc-kuy15-1"
32
32
  })(["display:flex;align-items:center;width:100%;"]);
33
+ const TitleButton = styled(Button).withConfig({
34
+ displayName: "CalendarHeader__TitleButton",
35
+ componentId: "sc-kuy15-2"
36
+ })(["min-width:13.1rem;white-space:nowrap;font-size:", ";text-transform:capitalize;& > span{display:flex;justify-content:space-between;align-items:center;width:100%;}"], tokens.typography.heading.h5.fontSize);
33
37
 
34
38
  /**
35
39
  * The default header for the calendar components if no custom header is provided
@@ -61,15 +65,11 @@ function CalendarHeader({
61
65
  style: {
62
66
  flex: '1 1 auto'
63
67
  }
64
- }), /*#__PURE__*/jsxs(Button, {
68
+ }), /*#__PURE__*/jsxs(TitleButton, {
65
69
  onClick: () => setShowYearPicker(!showYearPicker),
66
70
  "data-testid": 'heading',
67
71
  "aria-live": 'polite',
68
72
  variant: 'ghost',
69
- style: {
70
- fontSize: tokens.typography.heading.h5.fontSize,
71
- textTransform: 'capitalize'
72
- },
73
73
  children: [title, /*#__PURE__*/jsx(Icon, {
74
74
  data: showYearPicker ? chevron_up : chevron_down
75
75
  })]
@@ -30,7 +30,10 @@ function DateSegment({
30
30
  formatOptions,
31
31
  timezone
32
32
  } = useDatePickerContext();
33
- const formatter = useDateFormatter(formatOptions);
33
+ const formatter = useDateFormatter({
34
+ ...formatOptions,
35
+ timeZone: timezone
36
+ });
34
37
  const parts = state.value ? formatter.formatToParts(state.value.toDate(timezone)) : [];
35
38
  const part = parts.find(p => p.type === segment.type);
36
39
  const value = segment.isPlaceholder || segment.type === 'literal' ? segment.text : part?.value ?? segment.text;