@equinor/eds-core-react 0.40.0 → 1.0.0-beta.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 (32) hide show
  1. package/dist/eds-core-react.cjs +113 -17
  2. package/dist/esm/components/Banner/BannerMessage.js +1 -1
  3. package/dist/esm/components/Breadcrumbs/Breadcrumb.js +1 -1
  4. package/dist/esm/components/Breadcrumbs/Breadcrumbs.js +1 -1
  5. package/dist/esm/components/Card/CardActions.js +1 -1
  6. package/dist/esm/components/Datepicker/calendars/CalendarCell.js +1 -1
  7. package/dist/esm/components/Datepicker/fields/DateRangeField.js +1 -1
  8. package/dist/esm/components/Menu/MenuSection.js +1 -1
  9. package/dist/esm/components/Pagination/Pagination.js +1 -1
  10. package/dist/esm/components/SideBar/SideBarAccordion/index.js +1 -1
  11. package/dist/esm/components/SideBar/SideBarAccordionItem/index.js +1 -1
  12. package/dist/esm/components/SideBar/SidebarLink/index.js +1 -1
  13. package/dist/esm/components/SideSheet/SideSheet.js +1 -1
  14. package/dist/esm/components/TableOfContents/TableOfContents.js +1 -1
  15. package/dist/esm/components/Typography/BodyText/BodyText.js +31 -0
  16. package/dist/esm/components/Typography/Heading/Heading.js +31 -0
  17. package/dist/esm/components/Typography/{Typography.js → TypographyDeprecated/Typography.js} +1 -1
  18. package/dist/esm/components/Typography/UIText/UIText.js +31 -0
  19. package/dist/esm/components/Typography/_components/Typography.js +18 -0
  20. package/dist/esm/index.js +4 -1
  21. package/dist/types/components/Banner/BannerMessage.d.ts +1 -1
  22. package/dist/types/components/Typography/BodyText/BodyText.d.ts +4 -0
  23. package/dist/types/components/Typography/Heading/Heading.d.ts +8 -0
  24. package/dist/types/components/Typography/TypographyDeprecated/index.d.ts +1 -0
  25. package/dist/types/components/Typography/UIText/UIText.d.ts +9 -0
  26. package/dist/types/components/Typography/_components/Typography.d.ts +14 -0
  27. package/dist/types/components/Typography/index.d.ts +4 -1
  28. package/dist/types/components/Typography/typography.types.d.ts +13 -0
  29. package/package.json +2 -2
  30. /package/dist/esm/components/Typography/{Typography.tokens.js → TypographyDeprecated/Typography.tokens.js} +0 -0
  31. /package/dist/types/components/Typography/{Typography.d.ts → TypographyDeprecated/Typography.d.ts} +0 -0
  32. /package/dist/types/components/Typography/{Typography.tokens.d.ts → TypographyDeprecated/Typography.tokens.d.ts} +0 -0
@@ -1442,7 +1442,7 @@ const findColor = (inputColor = null) => typeof colors$5[inputColor] === 'undefi
1442
1442
  const toVariantName = (variant, bold = false, italic = false, link = false) => `${variant}${bold ? '_bold' : ''}${italic ? '_italic' : ''}${link ? '_link' : ''}`;
1443
1443
  const StyledTypography$1 = styled__default.default.p.withConfig({
1444
1444
  displayName: "Typography__StyledTypography",
1445
- componentId: "sc-179guof-0"
1445
+ componentId: "sc-5ggzld-0"
1446
1446
  })(["", " ", " ", " ", ""], ({
1447
1447
  $typography,
1448
1448
  $link
@@ -1455,7 +1455,7 @@ const StyledTypography$1 = styled__default.default.p.withConfig({
1455
1455
  }) => $lines && styled.css(["display:-webkit-box;-webkit-line-clamp:", ";-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis;"], $lines), ({
1456
1456
  $link
1457
1457
  }) => $link && styled.css(["&:focus{outline:none;}&[data-focus-visible-added]:focus{", "}&:focus-visible{", "}"], edsUtils.outlineTemplate(link.states.focus.outline), edsUtils.outlineTemplate(link.states.focus.outline)));
1458
- const Typography = /*#__PURE__*/react.forwardRef(function Typography({
1458
+ const Typography$1 = /*#__PURE__*/react.forwardRef(function Typography({
1459
1459
  variant = 'body_short',
1460
1460
  children,
1461
1461
  bold,
@@ -1491,6 +1491,99 @@ const Typography = /*#__PURE__*/react.forwardRef(function Typography({
1491
1491
 
1492
1492
  // Typography.displayName = 'EdsTypography'
1493
1493
 
1494
+ const Typography = styled__default.default.p.withConfig({
1495
+ displayName: "Typography",
1496
+ componentId: "sc-xl9v17-0"
1497
+ })(["margin:0;", ""], ({
1498
+ $type,
1499
+ $size,
1500
+ $lineHeight,
1501
+ $fontWeight,
1502
+ $letterSpacing,
1503
+ $offset = 0,
1504
+ $onGrid = true,
1505
+ $color,
1506
+ $lines
1507
+ }) => styled.css(["", " --_text-preset-color:", ";font-family:", ";font-size:", ";line-height:", ";font-weight:", ";letter-spacing:", ";color:var(--_text-preset-color,inherit);--_offset:calc(", " * 1em);--_grid-base:4px;@supports (height:round(up,10px,1px)){--_rest-top:", ";--_rest-bottom:", ";}--_trim-top:calc(((((1lh - 1cap) / 2) - var(--_offset)) * -1));--_trim-bottom:calc(((((1lh - 1cap) / 2) + var(--_offset)) * -1));&::before{margin-bottom:calc(var(--_trim-top) + var(--_rest-top,0cap));}&::after{margin-top:calc(var(--_trim-bottom) + var(--_rest-bottom,0cap));}&::before,&::after{display:table;content:'';}"], $lines && styled.css(["display:-webkit-box;-webkit-line-clamp:", ";-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis;"], $lines), $color, `var(--eds-typography-${$type}-font-family)`, `var(--eds-typography-${$type}-${$size}-font-size)`, `var(--eds-typography-${$type}-${$size}-lineheight-${$lineHeight})`, `var(--eds-typography-${$type}-${$size}-font-weight-${$fontWeight})`, `var(--eds-typography-${$type}-${$size}-tracking-${$letterSpacing})`, $offset, $onGrid ? 'calc(round(nearest, 1cap, var(--_grid-base)) - 1cap)' : 'calc((round(nearest, 1cap, var(--_grid-base)) - 1cap) / 2)', $onGrid ? '0cap' : 'calc((round(nearest, 1cap, var(--_grid-base)) - 1cap) / 2)'));
1508
+
1509
+ const INTER_VERTICAL_OFFSET = 0.002;
1510
+ const BodyText = /*#__PURE__*/react.forwardRef(function BodyText({
1511
+ size = 'lg',
1512
+ lineHeight = 'default',
1513
+ fontWeight = 'normal',
1514
+ letterSpacing = 'normal',
1515
+ as = 'p',
1516
+ lines,
1517
+ children,
1518
+ ...rest
1519
+ }, ref) {
1520
+ return /*#__PURE__*/jsxRuntime.jsx(Typography, {
1521
+ ref: ref,
1522
+ as: as,
1523
+ $type: 'ui-body',
1524
+ $offset: INTER_VERTICAL_OFFSET,
1525
+ $size: size,
1526
+ $lineHeight: lineHeight,
1527
+ $lines: lines,
1528
+ $fontWeight: fontWeight,
1529
+ $letterSpacing: letterSpacing,
1530
+ ...rest,
1531
+ children: children
1532
+ });
1533
+ });
1534
+
1535
+ const UIText = /*#__PURE__*/react.forwardRef(function UIText({
1536
+ size = 'lg',
1537
+ lineHeight = 'default',
1538
+ fontWeight = 'normal',
1539
+ letterSpacing = 'normal',
1540
+ lines,
1541
+ as = 'p',
1542
+ onGrid = false,
1543
+ children,
1544
+ ...rest
1545
+ }, ref) {
1546
+ return /*#__PURE__*/jsxRuntime.jsx(Typography, {
1547
+ ref: ref,
1548
+ as: as,
1549
+ $type: 'ui-body',
1550
+ $size: size,
1551
+ $lineHeight: lineHeight,
1552
+ $lines: lines,
1553
+ $fontWeight: fontWeight,
1554
+ $letterSpacing: letterSpacing,
1555
+ $onGrid: onGrid,
1556
+ ...rest,
1557
+ children: children
1558
+ });
1559
+ });
1560
+
1561
+ const EQUINOR_VERTICAL_OFFSET = 0.06;
1562
+ const Heading = /*#__PURE__*/react.forwardRef(function Heading({
1563
+ size = 'lg',
1564
+ lineHeight = 'default',
1565
+ fontWeight = 'normal',
1566
+ letterSpacing = 'normal',
1567
+ lines,
1568
+ as,
1569
+ children,
1570
+ ...rest
1571
+ }, ref) {
1572
+ return /*#__PURE__*/jsxRuntime.jsx(Typography, {
1573
+ ref: ref,
1574
+ $lineHeight: lineHeight,
1575
+ $lines: lines,
1576
+ $type: 'header',
1577
+ $size: size,
1578
+ $offset: EQUINOR_VERTICAL_OFFSET,
1579
+ $fontWeight: fontWeight,
1580
+ $letterSpacing: letterSpacing,
1581
+ as: as,
1582
+ ...rest,
1583
+ children: children
1584
+ });
1585
+ });
1586
+
1494
1587
  const {
1495
1588
  typography: {
1496
1589
  table: {
@@ -4234,7 +4327,7 @@ const CardActions = /*#__PURE__*/react.forwardRef(function CardActions({
4234
4327
  };
4235
4328
  return /*#__PURE__*/jsxRuntime.jsxs(StyledCardActions, {
4236
4329
  ...props,
4237
- children: [children, meta !== '' && /*#__PURE__*/jsxRuntime.jsx(Typography, {
4330
+ children: [children, meta !== '' && /*#__PURE__*/jsxRuntime.jsx(Typography$1, {
4238
4331
  variant: "caption",
4239
4332
  children: meta
4240
4333
  })]
@@ -4913,7 +5006,7 @@ const TocList = styled__default.default(List$1).withConfig({
4913
5006
  displayName: "TableOfContents__TocList",
4914
5007
  componentId: "sc-q23s6y-1"
4915
5008
  })(["margin:0;padding:0;"]);
4916
- const TocLabel = styled__default.default(Typography).withConfig({
5009
+ const TocLabel = styled__default.default(Typography$1).withConfig({
4917
5010
  displayName: "TableOfContents__TocLabel",
4918
5011
  componentId: "sc-q23s6y-2"
4919
5012
  })(({
@@ -5055,7 +5148,7 @@ const SideSheet = /*#__PURE__*/react.forwardRef(function SideSheet({
5055
5148
  return open && /*#__PURE__*/jsxRuntime.jsxs(StyledSideSheet, {
5056
5149
  ...props,
5057
5150
  children: [(title || onClose) && /*#__PURE__*/jsxRuntime.jsxs(Header$1, {
5058
- children: [title && /*#__PURE__*/jsxRuntime.jsx(Typography, {
5151
+ children: [title && /*#__PURE__*/jsxRuntime.jsx(Typography$1, {
5059
5152
  variant: "h2",
5060
5153
  children: title
5061
5154
  }), onClose && /*#__PURE__*/jsxRuntime.jsx(Button$1, {
@@ -6784,7 +6877,7 @@ const Banner$1 = /*#__PURE__*/react.forwardRef(function Banner({
6784
6877
  });
6785
6878
  });
6786
6879
 
6787
- const StyledBannerMessage = styled__default.default(Typography).withConfig({
6880
+ const StyledBannerMessage = styled__default.default(Typography$1).withConfig({
6788
6881
  displayName: "BannerMessage__StyledBannerMessage",
6789
6882
  componentId: "sc-1lfqos1-0"
6790
6883
  })([""]);
@@ -7290,11 +7383,11 @@ const ListItem$1 = styled__default.default.li.withConfig({
7290
7383
  displayName: "Breadcrumbs__ListItem",
7291
7384
  componentId: "sc-12awlbz-1"
7292
7385
  })(["display:block;min-width:30px;"]);
7293
- const Separator = styled__default.default(Typography).withConfig({
7386
+ const Separator = styled__default.default(Typography$1).withConfig({
7294
7387
  displayName: "Breadcrumbs__Separator",
7295
7388
  componentId: "sc-12awlbz-2"
7296
7389
  })(["color:", ";", " display:block;line-height:1;display:flex;& > svg{margin-inline:-9px;}"], typography$5.color, edsUtils.spacingsTemplate(spacings));
7297
- const Collapsed = styled__default.default(Typography).withConfig({
7390
+ const Collapsed = styled__default.default(Typography$1).withConfig({
7298
7391
  displayName: "Breadcrumbs__Collapsed",
7299
7392
  componentId: "sc-12awlbz-3"
7300
7393
  })(["@media (hover:hover) and (pointer:fine){&:hover{text-decoration:underline;color:", ";}}color:", ";text-decoration:none;"], states$1.hover.typography.color, typography$5.color);
@@ -7376,7 +7469,7 @@ const {
7376
7469
  states,
7377
7470
  typography: typography$4
7378
7471
  } = breadcrumbs;
7379
- const StyledTypography = styled__default.default(Typography).withConfig({
7472
+ const StyledTypography = styled__default.default(Typography$1).withConfig({
7380
7473
  displayName: "Breadcrumb__StyledTypography",
7381
7474
  componentId: "sc-10nvwte-0"
7382
7475
  })(["@media (hover:hover) and (pointer:fine){&:hover{text-decoration:underline;color:", ";cursor:pointer;}}white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block;line-height:1;text-decoration:none;color:", ";width:100%;", ""], states.hover.typography.color, typography$4.color, ({
@@ -7708,7 +7801,7 @@ const MenuSection = /*#__PURE__*/react.memo(function MenuSection(props) {
7708
7801
  variant: "small"
7709
7802
  })
7710
7803
  }), title && /*#__PURE__*/jsxRuntime.jsx(Header, {
7711
- children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
7804
+ children: /*#__PURE__*/jsxRuntime.jsx(Typography$1, {
7712
7805
  group: "navigation",
7713
7806
  variant: "label",
7714
7807
  children: title
@@ -8131,7 +8224,7 @@ const FlexContainer = styled__default.default.div.withConfig({
8131
8224
  displayName: "Pagination__FlexContainer",
8132
8225
  componentId: "sc-13cpp3o-4"
8133
8226
  })(["display:flex;justify-content:space-between;flex-wrap:nowrap;align-items:center;"]);
8134
- const Text$1 = styled__default.default(Typography).withConfig({
8227
+ const Text$1 = styled__default.default(Typography$1).withConfig({
8135
8228
  displayName: "Pagination__Text",
8136
8229
  componentId: "sc-13cpp3o-5"
8137
8230
  })(["white-space:nowrap;"]);
@@ -10471,7 +10564,7 @@ const Container$1 = styled__default.default.a.withConfig({
10471
10564
  } = theme;
10472
10565
  return styled.css(["background-color:", ";display:grid;grid-template-columns:", " 1fr;width:100%;padding:0;place-items:center;border:0;", " text-decoration:none;min-height:", ";&:hover{cursor:pointer;background-color:", ";}&:disabled{background-color:", ";color:", ";cursor:not-allowed;& > p{color:", ";}& > svg{fill:", ";}}&:focus-visible{", ";}"], $active ? menuActiveBackground : 'transparent', minWidth, edsUtils.bordersTemplate(border), minHeight, $active ? menuActiveBackground : menuHoverBackground, menuDisabledBackground, menuDisabledText, menuDisabledText, menuDisabledText, edsUtils.outlineTemplate(focus.outline));
10473
10566
  });
10474
- const ItemText$1 = styled__default.default(Typography).withConfig({
10567
+ const ItemText$1 = styled__default.default(Typography$1).withConfig({
10475
10568
  displayName: "SidebarLink__ItemText",
10476
10569
  componentId: "sc-gbehcj-1"
10477
10570
  })(({
@@ -10808,7 +10901,7 @@ const Panel = styled__default.default.div.withConfig({
10808
10901
  displayName: "SideBarAccordion__Panel",
10809
10902
  componentId: "sc-1ekwnbi-6"
10810
10903
  })(["width:100%;", ""], edsUtils.bordersTemplate(border));
10811
- const ItemText = styled__default.default(Typography).withConfig({
10904
+ const ItemText = styled__default.default(Typography$1).withConfig({
10812
10905
  displayName: "SideBarAccordion__ItemText",
10813
10906
  componentId: "sc-1ekwnbi-7"
10814
10907
  })(({
@@ -10996,7 +11089,7 @@ const TextWrapper = styled__default.default.div.withConfig({
10996
11089
  displayName: "SideBarAccordionItem__TextWrapper",
10997
11090
  componentId: "sc-1aeo1e1-1"
10998
11091
  })(["min-height:", ";grid-column:2;justify-self:start;display:flex;align-items:center;width:100%;"], minHeight);
10999
- const Text = styled__default.default(Typography).withConfig({
11092
+ const Text = styled__default.default(Typography$1).withConfig({
11000
11093
  displayName: "SideBarAccordionItem__Text",
11001
11094
  componentId: "sc-1aeo1e1-2"
11002
11095
  })(({
@@ -11052,7 +11145,7 @@ SideBar.Button.displayName = 'SideBar.Button';
11052
11145
  SideBar.Accordion.displayName = 'SideBar.Accordion';
11053
11146
  SideBar.AccordionItem.displayName = 'SideBar.AccordionItem';
11054
11147
 
11055
- const StyledCell = styled__default.default(Typography).withConfig({
11148
+ const StyledCell = styled__default.default(Typography$1).withConfig({
11056
11149
  displayName: "CalendarCell__StyledCell",
11057
11150
  componentId: "sc-y5ycmg-0"
11058
11151
  })(["display:flex;justify-content:center;align-items:center;cursor:pointer;&:hover{background-color:", ";}&:focus{outline:2px dashed rgba(0,112,121,1);}", " ", " ", " ", " ", " ", ""], edsTokens.tokens.colors.interactive.table__cell__fill_hover.rgba, ({
@@ -12075,7 +12168,7 @@ const DateRangeField = /*#__PURE__*/react.forwardRef(function (props, ref) {
12075
12168
  children: [/*#__PURE__*/jsxRuntime.jsx(DateFieldSegments, {
12076
12169
  ...props.startFieldProps,
12077
12170
  ref: fromRef
12078
- }), /*#__PURE__*/jsxRuntime.jsx(Typography, {
12171
+ }), /*#__PURE__*/jsxRuntime.jsx(Typography$1, {
12079
12172
  as: 'span',
12080
12173
  variant: 'text',
12081
12174
  group: 'input',
@@ -12250,6 +12343,7 @@ exports.Accordion = Accordion;
12250
12343
  exports.Autocomplete = Autocomplete;
12251
12344
  exports.Avatar = Avatar;
12252
12345
  exports.Banner = Banner;
12346
+ exports.BodyText = BodyText;
12253
12347
  exports.Breadcrumbs = Breadcrumbs;
12254
12348
  exports.Button = Button$1;
12255
12349
  exports.Card = Card;
@@ -12262,6 +12356,7 @@ exports.Dialog = Dialog;
12262
12356
  exports.Divider = Divider;
12263
12357
  exports.DotProgress = DotProgress;
12264
12358
  exports.EdsProvider = EdsProvider;
12359
+ exports.Heading = Heading;
12265
12360
  exports.Icon = Icon$1;
12266
12361
  exports.Input = Input$4;
12267
12362
  exports.InputWrapper = InputWrapper$2;
@@ -12289,6 +12384,7 @@ exports.Tabs = Tabs;
12289
12384
  exports.TextField = TextField;
12290
12385
  exports.Tooltip = Tooltip$2;
12291
12386
  exports.TopBar = TopBar;
12292
- exports.Typography = Typography;
12387
+ exports.Typography = Typography$1;
12388
+ exports.UIText = UIText;
12293
12389
  exports.useEds = useEds;
12294
12390
  exports.useSideBar = useSideBar;
@@ -1,7 +1,7 @@
1
1
  import { forwardRef } from 'react';
2
2
  import styled from 'styled-components';
3
3
  import { jsx } from 'react/jsx-runtime';
4
- import { Typography } from '../Typography/Typography.js';
4
+ import { Typography } from '../Typography/TypographyDeprecated/Typography.js';
5
5
 
6
6
  const StyledBannerMessage = styled(Typography).withConfig({
7
7
  displayName: "BannerMessage__StyledBannerMessage",
@@ -2,7 +2,7 @@ import { forwardRef, useMemo } from 'react';
2
2
  import styled, { css } from 'styled-components';
3
3
  import { breadcrumbs } from './Breadcrumbs.tokens.js';
4
4
  import { jsx } from 'react/jsx-runtime';
5
- import { Typography } from '../Typography/Typography.js';
5
+ import { Typography } from '../Typography/TypographyDeprecated/Typography.js';
6
6
  import { Tooltip } from '../Tooltip/Tooltip.js';
7
7
 
8
8
  const {
@@ -3,7 +3,7 @@ import styled from 'styled-components';
3
3
  import { breadcrumbs } from './Breadcrumbs.tokens.js';
4
4
  import { spacingsTemplate } from '@equinor/eds-utils';
5
5
  import { jsxs, jsx } from 'react/jsx-runtime';
6
- import { Typography } from '../Typography/Typography.js';
6
+ import { Typography } from '../Typography/TypographyDeprecated/Typography.js';
7
7
 
8
8
  const {
9
9
  spacings,
@@ -2,7 +2,7 @@ import { forwardRef } from 'react';
2
2
  import styled from 'styled-components';
3
3
  import { primary } from './Card.tokens.js';
4
4
  import { jsxs, jsx } from 'react/jsx-runtime';
5
- import { Typography } from '../Typography/Typography.js';
5
+ import { Typography } from '../Typography/TypographyDeprecated/Typography.js';
6
6
 
7
7
  const {
8
8
  spacings
@@ -3,7 +3,7 @@ import { tokens } from '@equinor/eds-tokens';
3
3
  import { useRef, useMemo } from 'react';
4
4
  import { useCalendarCell } from 'react-aria';
5
5
  import { jsx } from 'react/jsx-runtime';
6
- import { Typography } from '../../Typography/Typography.js';
6
+ import { Typography } from '../../Typography/TypographyDeprecated/Typography.js';
7
7
  import { useEds } from '../../EdsProvider/eds.context.js';
8
8
 
9
9
  const StyledCell = styled(Typography).withConfig({
@@ -2,7 +2,7 @@ import { forwardRef, useRef } from 'react';
2
2
  import { InputFieldWrapper } from './FieldWrapper.js';
3
3
  import { DateFieldSegments } from './DateFieldSegments.js';
4
4
  import { jsxs, jsx } from 'react/jsx-runtime';
5
- import { Typography } from '../../Typography/Typography.js';
5
+ import { Typography } from '../../Typography/TypographyDeprecated/Typography.js';
6
6
 
7
7
  /**
8
8
  * DateRangeField is the input field used in {@link DateRangePicker} to type in a date range.
@@ -4,7 +4,7 @@ import { menu } from './Menu.tokens.js';
4
4
  import { spacingsTemplate } from '@equinor/eds-utils';
5
5
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
6
6
  import { Divider } from '../Divider/Divider.js';
7
- import { Typography } from '../Typography/Typography.js';
7
+ import { Typography } from '../Typography/TypographyDeprecated/Typography.js';
8
8
 
9
9
  const Header = styled.div.attrs(() => ({
10
10
  tabIndex: 0
@@ -8,7 +8,7 @@ import { pagination } from './Pagination.tokens.js';
8
8
  import { chevron_left, chevron_right, more_horizontal } from '@equinor/eds-icons';
9
9
  import { PaginationControl } from './paginationControl.js';
10
10
  import { jsx, jsxs } from 'react/jsx-runtime';
11
- import { Typography } from '../Typography/Typography.js';
11
+ import { Typography } from '../Typography/TypographyDeprecated/Typography.js';
12
12
 
13
13
  const icons = {
14
14
  chevron_left,
@@ -7,7 +7,7 @@ import { sidebar } from '../SideBar.tokens.js';
7
7
  import { Icon } from '../../Icon/index.js';
8
8
  import { Menu } from '../../Menu/index.js';
9
9
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
10
- import { Typography } from '../../Typography/Typography.js';
10
+ import { Typography } from '../../Typography/TypographyDeprecated/Typography.js';
11
11
  import { Tooltip as Tooltip$1 } from '../../Tooltip/Tooltip.js';
12
12
 
13
13
  const {
@@ -4,7 +4,7 @@ import { outlineTemplate } from '@equinor/eds-utils';
4
4
  import { sidebar } from '../SideBar.tokens.js';
5
5
  import { useSideBar } from '../SideBar.context.js';
6
6
  import { jsx } from 'react/jsx-runtime';
7
- import { Typography } from '../../Typography/Typography.js';
7
+ import { Typography } from '../../Typography/TypographyDeprecated/Typography.js';
8
8
 
9
9
  const {
10
10
  minWidth,
@@ -5,7 +5,7 @@ import { Icon } from '../../Icon/index.js';
5
5
  import styled, { css } from 'styled-components';
6
6
  import { useSideBar } from '../SideBar.context.js';
7
7
  import { jsxs, jsx } from 'react/jsx-runtime';
8
- import { Typography } from '../../Typography/Typography.js';
8
+ import { Typography } from '../../Typography/TypographyDeprecated/Typography.js';
9
9
  import { Tooltip as Tooltip$1 } from '../../Tooltip/Tooltip.js';
10
10
 
11
11
  const {
@@ -6,7 +6,7 @@ import { Button } from '../Button/index.js';
6
6
  import { Icon } from '../Icon/index.js';
7
7
  import { variants, comfortable } from './SideSheet.tokens.js';
8
8
  import { jsxs, jsx } from 'react/jsx-runtime';
9
- import { Typography } from '../Typography/Typography.js';
9
+ import { Typography } from '../Typography/TypographyDeprecated/Typography.js';
10
10
 
11
11
  const {
12
12
  background,
@@ -4,7 +4,7 @@ import { List } from '../List/index.js';
4
4
  import { typographyTemplate, useToken } from '@equinor/eds-utils';
5
5
  import { tableOfContents } from './TableOfContents.tokens.js';
6
6
  import { jsx, jsxs } from 'react/jsx-runtime';
7
- import { Typography } from '../Typography/Typography.js';
7
+ import { Typography } from '../Typography/TypographyDeprecated/Typography.js';
8
8
  import { useEds } from '../EdsProvider/eds.context.js';
9
9
 
10
10
  const StyledTableOfContents = styled.nav.withConfig({
@@ -0,0 +1,31 @@
1
+ import { forwardRef } from 'react';
2
+ import { Typography } from '../_components/Typography.js';
3
+ import { jsx } from 'react/jsx-runtime';
4
+
5
+ const INTER_VERTICAL_OFFSET = 0.002;
6
+ const BodyText = /*#__PURE__*/forwardRef(function BodyText({
7
+ size = 'lg',
8
+ lineHeight = 'default',
9
+ fontWeight = 'normal',
10
+ letterSpacing = 'normal',
11
+ as = 'p',
12
+ lines,
13
+ children,
14
+ ...rest
15
+ }, ref) {
16
+ return /*#__PURE__*/jsx(Typography, {
17
+ ref: ref,
18
+ as: as,
19
+ $type: 'ui-body',
20
+ $offset: INTER_VERTICAL_OFFSET,
21
+ $size: size,
22
+ $lineHeight: lineHeight,
23
+ $lines: lines,
24
+ $fontWeight: fontWeight,
25
+ $letterSpacing: letterSpacing,
26
+ ...rest,
27
+ children: children
28
+ });
29
+ });
30
+
31
+ export { BodyText };
@@ -0,0 +1,31 @@
1
+ import { forwardRef } from 'react';
2
+ import { Typography } from '../_components/Typography.js';
3
+ import { jsx } from 'react/jsx-runtime';
4
+
5
+ const EQUINOR_VERTICAL_OFFSET = 0.06;
6
+ const Heading = /*#__PURE__*/forwardRef(function Heading({
7
+ size = 'lg',
8
+ lineHeight = 'default',
9
+ fontWeight = 'normal',
10
+ letterSpacing = 'normal',
11
+ lines,
12
+ as,
13
+ children,
14
+ ...rest
15
+ }, ref) {
16
+ return /*#__PURE__*/jsx(Typography, {
17
+ ref: ref,
18
+ $lineHeight: lineHeight,
19
+ $lines: lines,
20
+ $type: 'header',
21
+ $size: size,
22
+ $offset: EQUINOR_VERTICAL_OFFSET,
23
+ $fontWeight: fontWeight,
24
+ $letterSpacing: letterSpacing,
25
+ as: as,
26
+ ...rest,
27
+ children: children
28
+ });
29
+ });
30
+
31
+ export { Heading };
@@ -40,7 +40,7 @@ const findColor = (inputColor = null) => typeof colors[inputColor] === 'undefine
40
40
  const toVariantName = (variant, bold = false, italic = false, link = false) => `${variant}${bold ? '_bold' : ''}${italic ? '_italic' : ''}${link ? '_link' : ''}`;
41
41
  const StyledTypography = styled.p.withConfig({
42
42
  displayName: "Typography__StyledTypography",
43
- componentId: "sc-179guof-0"
43
+ componentId: "sc-5ggzld-0"
44
44
  })(["", " ", " ", " ", ""], ({
45
45
  $typography,
46
46
  $link
@@ -0,0 +1,31 @@
1
+ import { forwardRef } from 'react';
2
+ import { Typography } from '../_components/Typography.js';
3
+ import { jsx } from 'react/jsx-runtime';
4
+
5
+ const UIText = /*#__PURE__*/forwardRef(function UIText({
6
+ size = 'lg',
7
+ lineHeight = 'default',
8
+ fontWeight = 'normal',
9
+ letterSpacing = 'normal',
10
+ lines,
11
+ as = 'p',
12
+ onGrid = false,
13
+ children,
14
+ ...rest
15
+ }, ref) {
16
+ return /*#__PURE__*/jsx(Typography, {
17
+ ref: ref,
18
+ as: as,
19
+ $type: 'ui-body',
20
+ $size: size,
21
+ $lineHeight: lineHeight,
22
+ $lines: lines,
23
+ $fontWeight: fontWeight,
24
+ $letterSpacing: letterSpacing,
25
+ $onGrid: onGrid,
26
+ ...rest,
27
+ children: children
28
+ });
29
+ });
30
+
31
+ export { UIText };
@@ -0,0 +1,18 @@
1
+ import styled, { css } from 'styled-components';
2
+
3
+ const Typography = styled.p.withConfig({
4
+ displayName: "Typography",
5
+ componentId: "sc-xl9v17-0"
6
+ })(["margin:0;", ""], ({
7
+ $type,
8
+ $size,
9
+ $lineHeight,
10
+ $fontWeight,
11
+ $letterSpacing,
12
+ $offset = 0,
13
+ $onGrid = true,
14
+ $color,
15
+ $lines
16
+ }) => css(["", " --_text-preset-color:", ";font-family:", ";font-size:", ";line-height:", ";font-weight:", ";letter-spacing:", ";color:var(--_text-preset-color,inherit);--_offset:calc(", " * 1em);--_grid-base:4px;@supports (height:round(up,10px,1px)){--_rest-top:", ";--_rest-bottom:", ";}--_trim-top:calc(((((1lh - 1cap) / 2) - var(--_offset)) * -1));--_trim-bottom:calc(((((1lh - 1cap) / 2) + var(--_offset)) * -1));&::before{margin-bottom:calc(var(--_trim-top) + var(--_rest-top,0cap));}&::after{margin-top:calc(var(--_trim-bottom) + var(--_rest-bottom,0cap));}&::before,&::after{display:table;content:'';}"], $lines && css(["display:-webkit-box;-webkit-line-clamp:", ";-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis;"], $lines), $color, `var(--eds-typography-${$type}-font-family)`, `var(--eds-typography-${$type}-${$size}-font-size)`, `var(--eds-typography-${$type}-${$size}-lineheight-${$lineHeight})`, `var(--eds-typography-${$type}-${$size}-font-weight-${$fontWeight})`, `var(--eds-typography-${$type}-${$size}-tracking-${$letterSpacing})`, $offset, $onGrid ? 'calc(round(nearest, 1cap, var(--_grid-base)) - 1cap)' : 'calc((round(nearest, 1cap, var(--_grid-base)) - 1cap) / 2)', $onGrid ? '0cap' : 'calc((round(nearest, 1cap, var(--_grid-base)) - 1cap) / 2)'));
17
+
18
+ export { Typography };
package/dist/esm/index.js CHANGED
@@ -15,7 +15,10 @@ export { Progress } from './components/Progress/index.js';
15
15
  export { Breadcrumbs } from './components/Breadcrumbs/index.js';
16
16
  export { Menu } from './components/Menu/index.js';
17
17
  export { SideBar } from './components/SideBar/index.js';
18
- export { Typography } from './components/Typography/Typography.js';
18
+ export { Typography } from './components/Typography/TypographyDeprecated/Typography.js';
19
+ export { BodyText } from './components/Typography/BodyText/BodyText.js';
20
+ export { UIText } from './components/Typography/UIText/UIText.js';
21
+ export { Heading } from './components/Typography/Heading/Heading.js';
19
22
  export { Divider } from './components/Divider/Divider.js';
20
23
  export { TextField } from './components/TextField/TextField.js';
21
24
  export { Scrim } from './components/Scrim/Scrim.js';
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { TypographyProps } from '../Typography/Typography';
2
+ import { TypographyProps } from '../Typography';
3
3
  export type BannerMessageProps = {
4
4
  /** Text content */
5
5
  children: string;
@@ -0,0 +1,4 @@
1
+ import { TypographyProps } from '../typography.types';
2
+ import { OverridableComponent } from '@equinor/eds-utils';
3
+ export type BodyTextProps = TypographyProps;
4
+ export declare const BodyText: OverridableComponent<BodyTextProps, HTMLElement>;
@@ -0,0 +1,8 @@
1
+ import { ElementType } from 'react';
2
+ import { TypographyProps } from '../typography.types';
3
+ import { OverridableComponent } from '@equinor/eds-utils';
4
+ export type HeadingProps = TypographyProps & {
5
+ /** "as" is required in Heading due to the a11y importance of using the correct level */
6
+ as: ElementType;
7
+ };
8
+ export declare const Heading: OverridableComponent<HeadingProps, HTMLElement>;
@@ -0,0 +1 @@
1
+ export * from './Typography';
@@ -0,0 +1,9 @@
1
+ import { TypographyProps } from '../typography.types';
2
+ import { OverridableComponent } from '@equinor/eds-utils';
3
+ export type UITextProps = TypographyProps & {
4
+ /** When true, text is pushed to the bottom of its text-box (making it "on grid" as the total heigth is rounded to a multiple of 4px), when false it is centered within the text-box
5
+ * @default false
6
+ */
7
+ onGrid?: boolean;
8
+ };
9
+ export declare const UIText: OverridableComponent<UITextProps, HTMLElement>;
@@ -0,0 +1,14 @@
1
+ import { HTMLAttributes, AnchorHTMLAttributes } from 'react';
2
+ import { TypographySize, TypographyLineHeight, TypographyElement, TypographyFontWeight, TypographyLetterSpacing } from '../typography.types';
3
+ export type StyleHeadingProps = {
4
+ $type: TypographyElement;
5
+ $size: TypographySize;
6
+ $lineHeight: TypographyLineHeight;
7
+ $fontWeight: TypographyFontWeight;
8
+ $letterSpacing: TypographyLetterSpacing;
9
+ $offset?: number;
10
+ $onGrid?: boolean;
11
+ $color?: string;
12
+ $lines?: number;
13
+ } & (HTMLAttributes<HTMLElement> | AnchorHTMLAttributes<HTMLAnchorElement>);
14
+ export declare const Typography: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, StyleHeadingProps>> & string;
@@ -1 +1,4 @@
1
- export * from './Typography';
1
+ export * from './TypographyDeprecated/Typography';
2
+ export * from './BodyText/BodyText';
3
+ export * from './UIText/UIText';
4
+ export * from './Heading/Heading';
@@ -0,0 +1,13 @@
1
+ export type TypographySize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl';
2
+ export type TypographyLineHeight = 'default' | 'squished';
3
+ export type TypographyElement = 'header' | 'ui-body';
4
+ export type TypographyFontWeight = 'bolder' | 'normal' | 'lighter';
5
+ export type TypographyLetterSpacing = 'loose' | 'normal' | 'tight';
6
+ export type TypographyProps = {
7
+ size?: TypographySize;
8
+ lineHeight?: TypographyLineHeight;
9
+ fontWeight?: TypographyFontWeight;
10
+ letterSpacing?: TypographyLetterSpacing;
11
+ /** Trunkate to n number of lines. */
12
+ lines?: number;
13
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/eds-core-react",
3
- "version": "0.40.0",
3
+ "version": "1.0.0-beta.1",
4
4
  "description": "The React implementation of the Equinor Design System",
5
5
  "sideEffects": [
6
6
  "**/*.css"
@@ -79,6 +79,7 @@
79
79
  },
80
80
  "dependencies": {
81
81
  "@babel/runtime": "^7.24.0",
82
+ "@equinor/eds-tokens": "1.0.0-beta-2",
82
83
  "@floating-ui/react": "^0.26.13",
83
84
  "@internationalized/date": "^3.5.3",
84
85
  "@react-aria/utils": "^3.24.0",
@@ -89,7 +90,6 @@
89
90
  "downshift": "9.0.6",
90
91
  "react-aria": "^3.33.0",
91
92
  "@equinor/eds-icons": "^0.21.0",
92
- "@equinor/eds-tokens": "0.9.2",
93
93
  "@equinor/eds-utils": "0.8.5"
94
94
  },
95
95
  "scripts": {