@equinor/eds-core-react 1.0.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -1
- package/dist/eds-core-react.cjs +421 -136
- package/dist/esm/components/Accordion/Accordion.js +4 -3
- package/dist/esm/components/Autocomplete/Autocomplete.js +90 -23
- package/dist/esm/components/Autocomplete/Autocomplete.tokens.js +1 -1
- package/dist/esm/components/Button/tokens/contained.js +1 -1
- package/dist/esm/components/Button/tokens/contained_icon.js +1 -1
- package/dist/esm/components/Button/tokens/ghost.js +1 -1
- package/dist/esm/components/Button/tokens/icon.js +1 -1
- package/dist/esm/components/Button/tokens/outlined.js +1 -1
- package/dist/esm/components/Datepicker/fields/FieldWrapper.js +8 -2
- package/dist/esm/components/Icon/Icon.js +2 -3
- package/dist/esm/components/Input/Input.tokens.js +1 -1
- package/dist/esm/components/InputWrapper/InputWrapper.tokens.js +1 -1
- package/dist/esm/components/InputWrapper/useInputField.js +61 -0
- package/dist/esm/components/SideBar/SideBarAccordion/index.js +4 -3
- package/dist/esm/components/Slider/Slider.js +8 -5
- package/dist/esm/components/Table/DataCell/DataCell.tokens.js +1 -1
- package/dist/esm/components/Tabs/Tabs.js +4 -3
- package/dist/esm/components/TextField/TextField.js +23 -56
- package/dist/esm/components/Textarea/Textarea.js +64 -33
- package/dist/esm/components/Typography/Heading.js +51 -0
- package/dist/esm/components/Typography/Paragraph.js +28 -0
- package/dist/esm/components/Typography/Typography.js +15 -1
- package/dist/esm/components/Typography/Typography.new.js +67 -0
- package/dist/esm/index.js +5 -0
- package/dist/types/components/Button/tokens/contained.d.ts +3 -4
- package/dist/types/components/Button/tokens/outlined.d.ts +3 -4
- package/dist/types/components/InputWrapper/index.d.ts +3 -0
- package/dist/types/components/InputWrapper/types.d.ts +21 -0
- package/dist/types/components/InputWrapper/useInputField.d.ts +31 -0
- package/dist/types/components/TextField/TextField.d.ts +5 -25
- package/dist/types/components/Textarea/Textarea.d.ts +6 -27
- package/dist/types/components/Typography/Heading.d.ts +7 -0
- package/dist/types/components/Typography/Heading.types.d.ts +6 -0
- package/dist/types/components/Typography/Paragraph.d.ts +7 -0
- package/dist/types/components/Typography/Paragraph.types.d.ts +7 -0
- package/dist/types/components/Typography/Typography.d.ts +13 -0
- package/dist/types/components/Typography/Typography.new.d.ts +43 -0
- package/dist/types/components/Typography/Typography.new.types.d.ts +28 -0
- package/dist/types/components/Typography/Typography.stories.shared.d.ts +79 -0
- package/dist/types/components/Typography/index.d.ts +7 -0
- package/dist/types/components/Typography/types.d.ts +9 -0
- package/dist/types/components/Typography/utils.d.ts +15 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +56 -40
- /package/dist/esm/node_modules/.pnpm/{ramda@0.31.3 → ramda@0.32.0}/node_modules/ramda/es/internal/_curry1.js +0 -0
- /package/dist/esm/node_modules/.pnpm/{ramda@0.31.3 → ramda@0.32.0}/node_modules/ramda/es/internal/_curry2.js +0 -0
- /package/dist/esm/node_modules/.pnpm/{ramda@0.31.3 → ramda@0.32.0}/node_modules/ramda/es/internal/_curry3.js +0 -0
- /package/dist/esm/node_modules/.pnpm/{ramda@0.31.3 → ramda@0.32.0}/node_modules/ramda/es/internal/_has.js +0 -0
- /package/dist/esm/node_modules/.pnpm/{ramda@0.31.3 → ramda@0.32.0}/node_modules/ramda/es/internal/_isObject.js +0 -0
- /package/dist/esm/node_modules/.pnpm/{ramda@0.31.3 → ramda@0.32.0}/node_modules/ramda/es/internal/_isPlaceholder.js +0 -0
- /package/dist/esm/node_modules/.pnpm/{ramda@0.31.3 → ramda@0.32.0}/node_modules/ramda/es/mergeDeepRight.js +0 -0
- /package/dist/esm/node_modules/.pnpm/{ramda@0.31.3 → ramda@0.32.0}/node_modules/ramda/es/mergeDeepWithKey.js +0 -0
- /package/dist/esm/node_modules/.pnpm/{ramda@0.31.3 → ramda@0.32.0}/node_modules/ramda/es/mergeWith.js +0 -0
- /package/dist/esm/node_modules/.pnpm/{ramda@0.31.3 → ramda@0.32.0}/node_modules/ramda/es/mergeWithKey.js +0 -0
- /package/dist/esm/node_modules/.pnpm/{ramda@0.31.3 → ramda@0.32.0}/node_modules/ramda/es/pickBy.js +0 -0
package/dist/eds-core-react.cjs
CHANGED
|
@@ -1443,6 +1443,19 @@ const StyledTypography$1 = styled__default.default.p.withConfig({
|
|
|
1443
1443
|
}) => $lines && styled.css(["display:-webkit-box;-webkit-line-clamp:", ";-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis;"], $lines), ({
|
|
1444
1444
|
$link
|
|
1445
1445
|
}) => $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)));
|
|
1446
|
+
/**
|
|
1447
|
+
* @deprecated Typography component is deprecated and will be removed in a future version.
|
|
1448
|
+
* Please use the new Typography, Heading, or Paragraph components instead.
|
|
1449
|
+
*
|
|
1450
|
+
* Migration guide:
|
|
1451
|
+
* - For headings: Use `<Heading as="h1|h2|h3|h4|h5|h6">` instead of `<Typography variant="h1|h2|h3|h4|h5|h6">`
|
|
1452
|
+
* - For paragraphs: Use `<Paragraph>` instead of `<Typography variant="body_short|body_long">`
|
|
1453
|
+
* - For inline text: Use `<Typography>` for more flexible text styling
|
|
1454
|
+
*
|
|
1455
|
+
* @see {@link TypographyNext}
|
|
1456
|
+
* @see {@link Heading}
|
|
1457
|
+
* @see {@link Paragraph}
|
|
1458
|
+
*/
|
|
1446
1459
|
const Typography = /*#__PURE__*/react.forwardRef(function Typography({
|
|
1447
1460
|
variant = 'body_short',
|
|
1448
1461
|
children,
|
|
@@ -1456,6 +1469,7 @@ const Typography = /*#__PURE__*/react.forwardRef(function Typography({
|
|
|
1456
1469
|
as: providedAs,
|
|
1457
1470
|
...other
|
|
1458
1471
|
}, ref) {
|
|
1472
|
+
edsUtils.useDeprecationWarning('The Typography component is deprecated and will be removed in a future version. ' + 'Please migrate to the new TypographyNext, Heading, or Paragraph component. ' + 'See the documentation for migration details.', 'Typography');
|
|
1459
1473
|
const as = providedAs ? providedAs : getElementType(variant, link);
|
|
1460
1474
|
const variantName = toVariantName(variant, bold, italic, link);
|
|
1461
1475
|
const typography = findTypography(variantName, group);
|
|
@@ -1479,6 +1493,138 @@ const Typography = /*#__PURE__*/react.forwardRef(function Typography({
|
|
|
1479
1493
|
|
|
1480
1494
|
// Typography.displayName = 'EdsTypography'
|
|
1481
1495
|
|
|
1496
|
+
/**
|
|
1497
|
+
* TypographyNext component for flexible typography with baseline grid support.
|
|
1498
|
+
*
|
|
1499
|
+
* Provides full control over typography properties including family, size,
|
|
1500
|
+
* lineHeight, baseline alignment, weight, and tracking.
|
|
1501
|
+
*
|
|
1502
|
+
* **Display behavior:** Elements render as `display: block` by default for
|
|
1503
|
+
* text-box trimming and baseline grid alignment. Override with CSS if needed.
|
|
1504
|
+
*
|
|
1505
|
+
* @example
|
|
1506
|
+
* ```tsx
|
|
1507
|
+
* import { TypographyNext as Typography } from '@equinor/eds-core-react'
|
|
1508
|
+
*
|
|
1509
|
+
* <Typography
|
|
1510
|
+
* family="ui"
|
|
1511
|
+
* size="md"
|
|
1512
|
+
* lineHeight="default"
|
|
1513
|
+
* baseline="grid"
|
|
1514
|
+
* weight="normal"
|
|
1515
|
+
* tracking="normal"
|
|
1516
|
+
* >
|
|
1517
|
+
* Text content (renders as block-level by default)
|
|
1518
|
+
* </Typography>
|
|
1519
|
+
*
|
|
1520
|
+
* <Typography
|
|
1521
|
+
* as="h1"
|
|
1522
|
+
* family="header"
|
|
1523
|
+
* size="3xl"
|
|
1524
|
+
* lineHeight="squished"
|
|
1525
|
+
* baseline="grid"
|
|
1526
|
+
* weight="bolder"
|
|
1527
|
+
* tracking="tight"
|
|
1528
|
+
* >
|
|
1529
|
+
* Page heading
|
|
1530
|
+
* </Typography>
|
|
1531
|
+
* ```
|
|
1532
|
+
*/
|
|
1533
|
+
const TypographyNext = /*#__PURE__*/react.forwardRef(({
|
|
1534
|
+
as = 'span',
|
|
1535
|
+
family,
|
|
1536
|
+
size,
|
|
1537
|
+
baseline,
|
|
1538
|
+
lineHeight,
|
|
1539
|
+
weight,
|
|
1540
|
+
tracking,
|
|
1541
|
+
debug,
|
|
1542
|
+
...rest
|
|
1543
|
+
}, ref) => {
|
|
1544
|
+
const Component = as;
|
|
1545
|
+
return /*#__PURE__*/jsxRuntime.jsx(Component, {
|
|
1546
|
+
ref: ref,
|
|
1547
|
+
"data-font-family": family,
|
|
1548
|
+
"data-text-size": size,
|
|
1549
|
+
"data-baseline": baseline || undefined,
|
|
1550
|
+
"data-line-height": lineHeight || undefined,
|
|
1551
|
+
"data-font-weight": weight || undefined,
|
|
1552
|
+
"data-tracking": tracking || undefined,
|
|
1553
|
+
"data-debug": debug ? '' : undefined,
|
|
1554
|
+
...rest
|
|
1555
|
+
});
|
|
1556
|
+
});
|
|
1557
|
+
TypographyNext.displayName = 'TypographyNext';
|
|
1558
|
+
|
|
1559
|
+
const getHeadingSize = as => {
|
|
1560
|
+
switch (as) {
|
|
1561
|
+
case 'h1':
|
|
1562
|
+
return '6xl';
|
|
1563
|
+
case 'h2':
|
|
1564
|
+
return '5xl';
|
|
1565
|
+
case 'h3':
|
|
1566
|
+
return '4xl';
|
|
1567
|
+
case 'h4':
|
|
1568
|
+
return '3xl';
|
|
1569
|
+
case 'h5':
|
|
1570
|
+
return '2xl';
|
|
1571
|
+
case 'h6':
|
|
1572
|
+
return 'xl';
|
|
1573
|
+
default:
|
|
1574
|
+
return '6xl';
|
|
1575
|
+
}
|
|
1576
|
+
};
|
|
1577
|
+
|
|
1578
|
+
/**
|
|
1579
|
+
* Heading component for semantic headings (h1-h6).
|
|
1580
|
+
* Uses the design system's typography styles for headings.
|
|
1581
|
+
*/
|
|
1582
|
+
const Heading = /*#__PURE__*/react.forwardRef(({
|
|
1583
|
+
lineHeight = 'squished',
|
|
1584
|
+
weight = 'normal',
|
|
1585
|
+
tracking = 'normal',
|
|
1586
|
+
debug,
|
|
1587
|
+
as,
|
|
1588
|
+
...rest
|
|
1589
|
+
}, ref) => {
|
|
1590
|
+
return /*#__PURE__*/jsxRuntime.jsx(TypographyNext, {
|
|
1591
|
+
ref: ref,
|
|
1592
|
+
as: as,
|
|
1593
|
+
family: "header",
|
|
1594
|
+
baseline: "grid",
|
|
1595
|
+
size: getHeadingSize(as),
|
|
1596
|
+
lineHeight: lineHeight,
|
|
1597
|
+
weight: weight,
|
|
1598
|
+
tracking: tracking,
|
|
1599
|
+
debug: debug,
|
|
1600
|
+
...rest
|
|
1601
|
+
});
|
|
1602
|
+
});
|
|
1603
|
+
Heading.displayName = 'Heading';
|
|
1604
|
+
|
|
1605
|
+
const Paragraph = /*#__PURE__*/react.forwardRef(({
|
|
1606
|
+
size = 'lg',
|
|
1607
|
+
lineHeight = 'default',
|
|
1608
|
+
weight = 'normal',
|
|
1609
|
+
tracking = 'normal',
|
|
1610
|
+
debug,
|
|
1611
|
+
...rest
|
|
1612
|
+
}, ref) => {
|
|
1613
|
+
return /*#__PURE__*/jsxRuntime.jsx(TypographyNext, {
|
|
1614
|
+
ref: ref,
|
|
1615
|
+
as: "p",
|
|
1616
|
+
family: "ui",
|
|
1617
|
+
baseline: "grid",
|
|
1618
|
+
size: size,
|
|
1619
|
+
lineHeight: lineHeight,
|
|
1620
|
+
weight: weight,
|
|
1621
|
+
tracking: tracking,
|
|
1622
|
+
debug: debug,
|
|
1623
|
+
...rest
|
|
1624
|
+
});
|
|
1625
|
+
});
|
|
1626
|
+
Paragraph.displayName = 'Paragraph';
|
|
1627
|
+
|
|
1482
1628
|
const {
|
|
1483
1629
|
typography: {
|
|
1484
1630
|
table: {
|
|
@@ -2601,6 +2747,64 @@ const InputWrapper$2 = /*#__PURE__*/react.forwardRef(function InputWrapper({
|
|
|
2601
2747
|
});
|
|
2602
2748
|
});
|
|
2603
2749
|
|
|
2750
|
+
/**
|
|
2751
|
+
* Shared hook for TextField and Textarea that handles common logic
|
|
2752
|
+
* for IDs, labels, helper text, and ARIA attributes
|
|
2753
|
+
*/
|
|
2754
|
+
const useInputField = ({
|
|
2755
|
+
id,
|
|
2756
|
+
label,
|
|
2757
|
+
meta,
|
|
2758
|
+
helperText,
|
|
2759
|
+
helperIcon,
|
|
2760
|
+
variant,
|
|
2761
|
+
disabled,
|
|
2762
|
+
className,
|
|
2763
|
+
style
|
|
2764
|
+
}) => {
|
|
2765
|
+
const generatedFieldId = react.useId();
|
|
2766
|
+
const generatedHelperTextId = react.useId();
|
|
2767
|
+
|
|
2768
|
+
// Use provided ID or fall back to generated one
|
|
2769
|
+
const fieldId = id ?? generatedFieldId;
|
|
2770
|
+
const helperTextId = generatedHelperTextId;
|
|
2771
|
+
const hasHelperText = Boolean(helperText);
|
|
2772
|
+
const containerProps = {
|
|
2773
|
+
className,
|
|
2774
|
+
style: {
|
|
2775
|
+
width: '100%',
|
|
2776
|
+
...style
|
|
2777
|
+
},
|
|
2778
|
+
color: variant
|
|
2779
|
+
};
|
|
2780
|
+
const labelProps = {
|
|
2781
|
+
htmlFor: fieldId,
|
|
2782
|
+
label,
|
|
2783
|
+
meta,
|
|
2784
|
+
disabled
|
|
2785
|
+
};
|
|
2786
|
+
const helperProps = {
|
|
2787
|
+
id: hasHelperText ? helperTextId : null,
|
|
2788
|
+
text: helperText,
|
|
2789
|
+
icon: helperIcon
|
|
2790
|
+
};
|
|
2791
|
+
const ariaProps = {
|
|
2792
|
+
id: fieldId,
|
|
2793
|
+
'aria-invalid': variant === 'error' || undefined,
|
|
2794
|
+
...(hasHelperText && {
|
|
2795
|
+
'aria-describedby': helperTextId
|
|
2796
|
+
})
|
|
2797
|
+
};
|
|
2798
|
+
return {
|
|
2799
|
+
fieldId,
|
|
2800
|
+
helperTextId: hasHelperText ? helperTextId : null,
|
|
2801
|
+
containerProps,
|
|
2802
|
+
labelProps,
|
|
2803
|
+
helperProps,
|
|
2804
|
+
ariaProps
|
|
2805
|
+
};
|
|
2806
|
+
};
|
|
2807
|
+
|
|
2604
2808
|
const {
|
|
2605
2809
|
colors: {
|
|
2606
2810
|
ui: {
|
|
@@ -2942,148 +3146,145 @@ const Input$4 = /*#__PURE__*/react.forwardRef(function Input({
|
|
|
2942
3146
|
);
|
|
2943
3147
|
});
|
|
2944
3148
|
|
|
2945
|
-
const {
|
|
2946
|
-
input
|
|
2947
|
-
} = tokens$5;
|
|
2948
|
-
const Textarea = /*#__PURE__*/react.forwardRef(function Textarea({
|
|
2949
|
-
variant,
|
|
2950
|
-
disabled = false,
|
|
2951
|
-
type = 'text',
|
|
2952
|
-
rowsMax,
|
|
2953
|
-
...other
|
|
2954
|
-
}, ref) {
|
|
2955
|
-
const [textareaEl, setTextareaEl] = react.useState(null);
|
|
2956
|
-
const {
|
|
2957
|
-
density
|
|
2958
|
-
} = useEds();
|
|
2959
|
-
const spacings = density === 'compact' ? input.modes.compact.spacings : input.spacings;
|
|
2960
|
-
const {
|
|
2961
|
-
lineHeight
|
|
2962
|
-
} = input$1.typography;
|
|
2963
|
-
const {
|
|
2964
|
-
top,
|
|
2965
|
-
bottom
|
|
2966
|
-
} = spacings;
|
|
2967
|
-
let fontSize = 16;
|
|
2968
|
-
if (textareaEl) {
|
|
2969
|
-
fontSize = parseInt(window.getComputedStyle(textareaEl).fontSize);
|
|
2970
|
-
}
|
|
2971
|
-
const padding = parseInt(top) + parseInt(bottom);
|
|
2972
|
-
const maxHeight = parseFloat(lineHeight) * fontSize * rowsMax + padding;
|
|
2973
|
-
edsUtils.useAutoResize(textareaEl, rowsMax ? maxHeight : null);
|
|
2974
|
-
const combinedRef = react.useCallback(() => edsUtils.mergeRefs(ref, setTextareaEl), [setTextareaEl, ref])();
|
|
2975
|
-
const inputProps = {
|
|
2976
|
-
ref: combinedRef,
|
|
2977
|
-
type,
|
|
2978
|
-
disabled,
|
|
2979
|
-
variant,
|
|
2980
|
-
...other
|
|
2981
|
-
};
|
|
2982
|
-
const leftAdornmentStyles = {
|
|
2983
|
-
style: {
|
|
2984
|
-
alignItems: 'flex-start'
|
|
2985
|
-
}
|
|
2986
|
-
};
|
|
2987
|
-
const rigthAdornmentStyles = {
|
|
2988
|
-
style: {
|
|
2989
|
-
alignItems: 'flex-start',
|
|
2990
|
-
pointerEvents: 'none'
|
|
2991
|
-
}
|
|
2992
|
-
};
|
|
2993
|
-
return /*#__PURE__*/jsxRuntime.jsx(Input$4, {
|
|
2994
|
-
as: "textarea",
|
|
2995
|
-
rightAdornmentsProps: rigthAdornmentStyles,
|
|
2996
|
-
leftAdornmentsProps: leftAdornmentStyles,
|
|
2997
|
-
style: {
|
|
2998
|
-
height: 'auto'
|
|
2999
|
-
},
|
|
3000
|
-
...inputProps
|
|
3001
|
-
});
|
|
3002
|
-
});
|
|
3003
|
-
|
|
3004
|
-
/** Proxy component for working around typescript and element type switching */
|
|
3005
|
-
const Field = /*#__PURE__*/react.forwardRef(function Field(props, ref) {
|
|
3006
|
-
return props.$multiline ? /*#__PURE__*/jsxRuntime.jsx(Textarea, {
|
|
3007
|
-
ref: ref,
|
|
3008
|
-
...props
|
|
3009
|
-
}) : /*#__PURE__*/jsxRuntime.jsx(Input$4, {
|
|
3010
|
-
ref: ref,
|
|
3011
|
-
...props
|
|
3012
|
-
});
|
|
3013
|
-
});
|
|
3014
3149
|
const TextField = /*#__PURE__*/react.forwardRef(function TextField({
|
|
3015
|
-
id
|
|
3150
|
+
id,
|
|
3016
3151
|
label,
|
|
3017
3152
|
meta,
|
|
3018
3153
|
unit,
|
|
3019
3154
|
helperText,
|
|
3020
3155
|
placeholder,
|
|
3021
3156
|
disabled,
|
|
3022
|
-
multiline = false,
|
|
3023
3157
|
className,
|
|
3024
3158
|
variant,
|
|
3025
3159
|
inputIcon,
|
|
3026
3160
|
helperIcon,
|
|
3027
3161
|
style,
|
|
3028
|
-
rowsMax,
|
|
3029
|
-
textareaRef,
|
|
3030
3162
|
inputRef,
|
|
3031
3163
|
...other
|
|
3032
3164
|
}, ref) {
|
|
3033
|
-
const
|
|
3034
|
-
|
|
3165
|
+
const {
|
|
3166
|
+
ariaProps,
|
|
3167
|
+
containerProps,
|
|
3168
|
+
labelProps,
|
|
3169
|
+
helperProps
|
|
3170
|
+
} = useInputField({
|
|
3171
|
+
id,
|
|
3172
|
+
label,
|
|
3173
|
+
meta,
|
|
3174
|
+
helperText,
|
|
3175
|
+
helperIcon,
|
|
3176
|
+
variant,
|
|
3177
|
+
disabled,
|
|
3178
|
+
className,
|
|
3179
|
+
style
|
|
3180
|
+
});
|
|
3035
3181
|
const hasRightAdornments = Boolean(unit || inputIcon);
|
|
3036
|
-
|
|
3037
|
-
|
|
3182
|
+
const fieldProps = {
|
|
3183
|
+
...ariaProps,
|
|
3038
3184
|
disabled,
|
|
3039
3185
|
placeholder,
|
|
3040
|
-
id,
|
|
3041
3186
|
variant,
|
|
3042
3187
|
rightAdornments: hasRightAdornments && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
3043
3188
|
children: [inputIcon, /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
3044
3189
|
children: unit
|
|
3045
3190
|
})]
|
|
3046
3191
|
}),
|
|
3047
|
-
|
|
3048
|
-
ref: ref || inputRef || textareaRef,
|
|
3049
|
-
$multiline: multiline,
|
|
3192
|
+
ref: ref || inputRef,
|
|
3050
3193
|
...other
|
|
3051
3194
|
};
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3195
|
+
return /*#__PURE__*/jsxRuntime.jsx(InputWrapper$2, {
|
|
3196
|
+
helperProps: helperProps,
|
|
3197
|
+
labelProps: labelProps,
|
|
3198
|
+
...containerProps,
|
|
3199
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Input$4, {
|
|
3200
|
+
...fieldProps
|
|
3201
|
+
})
|
|
3202
|
+
});
|
|
3203
|
+
});
|
|
3204
|
+
|
|
3205
|
+
const {
|
|
3206
|
+
input
|
|
3207
|
+
} = tokens$5;
|
|
3208
|
+
const leftAdornmentStyles = {
|
|
3209
|
+
style: {
|
|
3210
|
+
alignItems: 'flex-start'
|
|
3211
|
+
}
|
|
3212
|
+
};
|
|
3213
|
+
const rightAdornmentStyles = {
|
|
3214
|
+
style: {
|
|
3215
|
+
alignItems: 'flex-start',
|
|
3216
|
+
pointerEvents: 'none'
|
|
3217
|
+
}
|
|
3218
|
+
};
|
|
3219
|
+
const Textarea = /*#__PURE__*/react.forwardRef(function Textarea({
|
|
3220
|
+
id,
|
|
3221
|
+
label,
|
|
3222
|
+
meta,
|
|
3223
|
+
helperText,
|
|
3224
|
+
placeholder,
|
|
3225
|
+
disabled,
|
|
3226
|
+
className,
|
|
3227
|
+
variant,
|
|
3228
|
+
inputIcon,
|
|
3229
|
+
helperIcon,
|
|
3230
|
+
style,
|
|
3231
|
+
rowsMax,
|
|
3232
|
+
...other
|
|
3233
|
+
}, ref) {
|
|
3234
|
+
const {
|
|
3235
|
+
ariaProps,
|
|
3236
|
+
containerProps,
|
|
3237
|
+
labelProps,
|
|
3238
|
+
helperProps
|
|
3239
|
+
} = useInputField({
|
|
3240
|
+
id,
|
|
3241
|
+
label,
|
|
3242
|
+
meta,
|
|
3243
|
+
helperText,
|
|
3244
|
+
helperIcon,
|
|
3245
|
+
variant,
|
|
3246
|
+
disabled,
|
|
3059
3247
|
className,
|
|
3248
|
+
style
|
|
3249
|
+
});
|
|
3250
|
+
const {
|
|
3251
|
+
density
|
|
3252
|
+
} = useEds();
|
|
3253
|
+
const spacings = density === 'compact' ? input.modes.compact.spacings : input.spacings;
|
|
3254
|
+
const {
|
|
3255
|
+
lineHeight
|
|
3256
|
+
} = input$1.typography;
|
|
3257
|
+
const {
|
|
3258
|
+
top,
|
|
3259
|
+
bottom
|
|
3260
|
+
} = spacings;
|
|
3261
|
+
|
|
3262
|
+
// Calculate maxHeight if rowsMax is provided
|
|
3263
|
+
// Using default fontSize of 16px for initial calculation
|
|
3264
|
+
// useAutoResize will handle actual resizing based on element's scrollHeight
|
|
3265
|
+
const maxHeight = rowsMax ? parseFloat(lineHeight) * 16 * rowsMax + parseInt(top) + parseInt(bottom) : null;
|
|
3266
|
+
const autoResizeRef = edsUtils.useAutoResize(maxHeight);
|
|
3267
|
+
const combinedRef = react.useMemo(() => edsUtils.mergeRefs(ref, autoResizeRef), [ref, autoResizeRef]);
|
|
3268
|
+
const fieldProps = {
|
|
3269
|
+
...ariaProps,
|
|
3270
|
+
disabled,
|
|
3271
|
+
placeholder,
|
|
3272
|
+
variant,
|
|
3273
|
+
rightAdornments: inputIcon,
|
|
3274
|
+
rightAdornmentsProps: rightAdornmentStyles,
|
|
3275
|
+
leftAdornmentsProps: leftAdornmentStyles,
|
|
3276
|
+
as: 'textarea',
|
|
3277
|
+
ref: combinedRef,
|
|
3060
3278
|
style: {
|
|
3061
|
-
|
|
3062
|
-
...style
|
|
3279
|
+
height: 'auto'
|
|
3063
3280
|
},
|
|
3064
|
-
|
|
3065
|
-
};
|
|
3066
|
-
const labelProps = {
|
|
3067
|
-
htmlFor: id,
|
|
3068
|
-
label,
|
|
3069
|
-
meta,
|
|
3070
|
-
disabled
|
|
3281
|
+
...other
|
|
3071
3282
|
};
|
|
3072
|
-
if (helperText) {
|
|
3073
|
-
fieldProps = {
|
|
3074
|
-
'aria-describedby': helperTextId,
|
|
3075
|
-
...fieldProps
|
|
3076
|
-
};
|
|
3077
|
-
helperProps = {
|
|
3078
|
-
...helperProps,
|
|
3079
|
-
id: helperTextId
|
|
3080
|
-
};
|
|
3081
|
-
}
|
|
3082
3283
|
return /*#__PURE__*/jsxRuntime.jsx(InputWrapper$2, {
|
|
3083
3284
|
helperProps: helperProps,
|
|
3084
3285
|
labelProps: labelProps,
|
|
3085
3286
|
...containerProps,
|
|
3086
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
3287
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Input$4, {
|
|
3087
3288
|
...fieldProps
|
|
3088
3289
|
})
|
|
3089
3290
|
});
|
|
@@ -3170,7 +3371,7 @@ const Icon$2 = /*#__PURE__*/react.forwardRef(function Icon({
|
|
|
3170
3371
|
};
|
|
3171
3372
|
|
|
3172
3373
|
// Accessibility
|
|
3173
|
-
const titleId =
|
|
3374
|
+
const titleId = react.useId();
|
|
3174
3375
|
if (title) {
|
|
3175
3376
|
svgProps = {
|
|
3176
3377
|
...svgProps,
|
|
@@ -3386,7 +3587,8 @@ const Accordion$1 = /*#__PURE__*/react.forwardRef(function Accordion({
|
|
|
3386
3587
|
id,
|
|
3387
3588
|
...props
|
|
3388
3589
|
}, ref) {
|
|
3389
|
-
const
|
|
3590
|
+
const generatedAccordionId = react.useId();
|
|
3591
|
+
const accordionId = id ?? generatedAccordionId;
|
|
3390
3592
|
const {
|
|
3391
3593
|
density
|
|
3392
3594
|
} = useEds();
|
|
@@ -3898,7 +4100,8 @@ const Tabs$1 = /*#__PURE__*/react.forwardRef(function Tabs({
|
|
|
3898
4100
|
id,
|
|
3899
4101
|
...props
|
|
3900
4102
|
}, ref) {
|
|
3901
|
-
const
|
|
4103
|
+
const generatedTabsId = react.useId();
|
|
4104
|
+
const tabsId = id ?? generatedTabsId;
|
|
3902
4105
|
const tabsRef = react.useRef(null);
|
|
3903
4106
|
const combinedTabsRef = react.useMemo(() => edsUtils.mergeRefs(tabsRef, ref), [tabsRef, ref]);
|
|
3904
4107
|
const [tabsFocused, setTabsFocused] = react.useState(false);
|
|
@@ -6006,9 +6209,12 @@ const Slider = /*#__PURE__*/react.forwardRef(function Slider({
|
|
|
6006
6209
|
setMousePressed(false);
|
|
6007
6210
|
}
|
|
6008
6211
|
};
|
|
6009
|
-
|
|
6010
|
-
|
|
6011
|
-
|
|
6212
|
+
const generatedInputIdA = react.useId();
|
|
6213
|
+
const generatedInputIdB = react.useId();
|
|
6214
|
+
const generatedInputId = react.useId();
|
|
6215
|
+
let inputIdA = generatedInputIdA;
|
|
6216
|
+
let inputIdB = generatedInputIdB;
|
|
6217
|
+
let inputId = generatedInputId;
|
|
6012
6218
|
if (rest['id']) {
|
|
6013
6219
|
const overrideId = rest['id'];
|
|
6014
6220
|
inputIdA = `${overrideId}-thumb-a`;
|
|
@@ -9703,6 +9909,8 @@ const defaultOptionDisabled = () => false;
|
|
|
9703
9909
|
|
|
9704
9910
|
// MARK: component
|
|
9705
9911
|
function AutocompleteInner(props, ref) {
|
|
9912
|
+
const [controlledHighlightedIndex, setControlledHighlightedIndex] = react.useState(0);
|
|
9913
|
+
const [lastScrollOffset, setLastScrollOffset] = react.useState(0);
|
|
9706
9914
|
const {
|
|
9707
9915
|
options = [],
|
|
9708
9916
|
totalOptions,
|
|
@@ -9774,6 +9982,7 @@ function AutocompleteInner(props, ref) {
|
|
|
9774
9982
|
if (onAddNewOption) return [AddSymbol, ..._availableItems];
|
|
9775
9983
|
return _availableItems;
|
|
9776
9984
|
}, [_availableItems, showSelectAll, onAddNewOption]);
|
|
9985
|
+
const getSelectedIndex = react.useCallback(selectedItem => availableItems.findIndex(item => itemCompare ? itemCompare(item, selectedItem) : item === selectedItem), [availableItems, itemCompare]);
|
|
9777
9986
|
|
|
9778
9987
|
//issue 2304, update dataset when options are added dynamically
|
|
9779
9988
|
react.useEffect(() => {
|
|
@@ -9911,20 +10120,18 @@ function AutocompleteInner(props, ref) {
|
|
|
9911
10120
|
}));
|
|
9912
10121
|
},
|
|
9913
10122
|
onHighlightedIndexChange({
|
|
9914
|
-
highlightedIndex
|
|
9915
|
-
type
|
|
10123
|
+
highlightedIndex
|
|
9916
10124
|
}) {
|
|
9917
|
-
if (
|
|
9918
|
-
|
|
9919
|
-
|
|
10125
|
+
if (highlightedIndex >= 0 && rowVirtualizer.getVirtualItems) {
|
|
10126
|
+
const visibleIndexes = rowVirtualizer.getVirtualItems().map(v => v.index);
|
|
10127
|
+
if (!visibleIndexes.includes(highlightedIndex)) {
|
|
9920
10128
|
rowVirtualizer.scrollToIndex(highlightedIndex, {
|
|
9921
10129
|
align: allowSelectAll ? 'center' : 'auto'
|
|
9922
10130
|
});
|
|
9923
|
-
}
|
|
9924
|
-
}
|
|
9925
|
-
|
|
9926
|
-
|
|
9927
|
-
});
|
|
10131
|
+
}
|
|
10132
|
+
}
|
|
10133
|
+
if (typeof rowVirtualizer.scrollOffset === 'number') {
|
|
10134
|
+
setLastScrollOffset(rowVirtualizer.scrollOffset);
|
|
9928
10135
|
}
|
|
9929
10136
|
},
|
|
9930
10137
|
onIsOpenChange: ({
|
|
@@ -9932,6 +10139,19 @@ function AutocompleteInner(props, ref) {
|
|
|
9932
10139
|
}) => {
|
|
9933
10140
|
if (!multiple && selectedItem !== null) {
|
|
9934
10141
|
setAvailableItems(options);
|
|
10142
|
+
setTimeout(() => {
|
|
10143
|
+
if (controlledHighlightedIndex === 0) {
|
|
10144
|
+
rowVirtualizer.scrollToOffset?.(0);
|
|
10145
|
+
} else if (rowVirtualizer.scrollToOffset && lastScrollOffset > 0) {
|
|
10146
|
+
rowVirtualizer.scrollToOffset(lastScrollOffset);
|
|
10147
|
+
}
|
|
10148
|
+
const visibleIndexes = rowVirtualizer.getVirtualItems?.().map(v => v.index) || [];
|
|
10149
|
+
if (!visibleIndexes.includes(controlledHighlightedIndex)) {
|
|
10150
|
+
rowVirtualizer.scrollToIndex(controlledHighlightedIndex, {
|
|
10151
|
+
align: allowSelectAll ? 'center' : 'auto'
|
|
10152
|
+
});
|
|
10153
|
+
}
|
|
10154
|
+
}, 10);
|
|
9935
10155
|
}
|
|
9936
10156
|
},
|
|
9937
10157
|
onStateChange: ({
|
|
@@ -9971,6 +10191,8 @@ function AutocompleteInner(props, ref) {
|
|
|
9971
10191
|
...comboBoxProps,
|
|
9972
10192
|
onSelectedItemChange: changes => {
|
|
9973
10193
|
if (changes.selectedItem === AddSymbol) return;
|
|
10194
|
+
const idx = getSelectedIndex(changes.selectedItem);
|
|
10195
|
+
setControlledHighlightedIndex(idx >= 0 ? idx : 0);
|
|
9974
10196
|
if (onOptionsChange) {
|
|
9975
10197
|
let {
|
|
9976
10198
|
selectedItem
|
|
@@ -9983,7 +10205,7 @@ function AutocompleteInner(props, ref) {
|
|
|
9983
10205
|
});
|
|
9984
10206
|
}
|
|
9985
10207
|
},
|
|
9986
|
-
stateReducer: (
|
|
10208
|
+
stateReducer: (state, actionAndChanges) => {
|
|
9987
10209
|
const {
|
|
9988
10210
|
changes,
|
|
9989
10211
|
type
|
|
@@ -9992,19 +10214,25 @@ function AutocompleteInner(props, ref) {
|
|
|
9992
10214
|
case downshift.useCombobox.stateChangeTypes.InputClick:
|
|
9993
10215
|
return {
|
|
9994
10216
|
...changes,
|
|
9995
|
-
isOpen: !(disabled || readOnly)
|
|
10217
|
+
isOpen: !(disabled || readOnly),
|
|
10218
|
+
highlightedIndex: controlledHighlightedIndex
|
|
9996
10219
|
};
|
|
9997
10220
|
case downshift.useCombobox.stateChangeTypes.InputKeyDownEnter:
|
|
9998
10221
|
case downshift.useCombobox.stateChangeTypes.ItemClick:
|
|
9999
|
-
|
|
10222
|
+
{
|
|
10223
|
+
if (changes.selectedItem === AddSymbol) {
|
|
10224
|
+
return {
|
|
10225
|
+
...changes,
|
|
10226
|
+
inputValue: ''
|
|
10227
|
+
};
|
|
10228
|
+
}
|
|
10229
|
+
const idx = getSelectedIndex(changes.selectedItem);
|
|
10230
|
+
setControlledHighlightedIndex(idx >= 0 ? idx : 0);
|
|
10000
10231
|
return {
|
|
10001
10232
|
...changes,
|
|
10002
|
-
|
|
10233
|
+
highlightedIndex: idx >= 0 ? idx : 0
|
|
10003
10234
|
};
|
|
10004
10235
|
}
|
|
10005
|
-
return {
|
|
10006
|
-
...changes
|
|
10007
|
-
};
|
|
10008
10236
|
case downshift.useCombobox.stateChangeTypes.InputBlur:
|
|
10009
10237
|
return {
|
|
10010
10238
|
...changes,
|
|
@@ -10016,13 +10244,19 @@ function AutocompleteInner(props, ref) {
|
|
|
10016
10244
|
...changes
|
|
10017
10245
|
};
|
|
10018
10246
|
case downshift.useCombobox.stateChangeTypes.InputKeyDownArrowDown:
|
|
10019
|
-
case downshift.useCombobox.stateChangeTypes.InputKeyDownHome:
|
|
10020
10247
|
if (readOnly) {
|
|
10021
10248
|
return {
|
|
10022
10249
|
...changes,
|
|
10023
10250
|
isOpen: false
|
|
10024
10251
|
};
|
|
10025
10252
|
}
|
|
10253
|
+
if (state.isOpen === false) {
|
|
10254
|
+
return {
|
|
10255
|
+
...changes,
|
|
10256
|
+
isOpen: true,
|
|
10257
|
+
highlightedIndex: controlledHighlightedIndex
|
|
10258
|
+
};
|
|
10259
|
+
}
|
|
10026
10260
|
return {
|
|
10027
10261
|
...changes,
|
|
10028
10262
|
highlightedIndex: findNextIndex({
|
|
@@ -10032,14 +10266,36 @@ function AutocompleteInner(props, ref) {
|
|
|
10032
10266
|
allDisabled
|
|
10033
10267
|
})
|
|
10034
10268
|
};
|
|
10269
|
+
case downshift.useCombobox.stateChangeTypes.InputKeyDownHome:
|
|
10270
|
+
if (readOnly) {
|
|
10271
|
+
return {
|
|
10272
|
+
...changes,
|
|
10273
|
+
isOpen: false
|
|
10274
|
+
};
|
|
10275
|
+
}
|
|
10276
|
+
return {
|
|
10277
|
+
...changes,
|
|
10278
|
+
highlightedIndex: findNextIndex({
|
|
10279
|
+
index: 0,
|
|
10280
|
+
availableItems,
|
|
10281
|
+
optionDisabled,
|
|
10282
|
+
allDisabled
|
|
10283
|
+
})
|
|
10284
|
+
};
|
|
10035
10285
|
case downshift.useCombobox.stateChangeTypes.InputKeyDownArrowUp:
|
|
10036
|
-
case downshift.useCombobox.stateChangeTypes.InputKeyDownEnd:
|
|
10037
10286
|
if (readOnly) {
|
|
10038
10287
|
return {
|
|
10039
10288
|
...changes,
|
|
10040
10289
|
isOpen: false
|
|
10041
10290
|
};
|
|
10042
10291
|
}
|
|
10292
|
+
if (state.isOpen === false) {
|
|
10293
|
+
return {
|
|
10294
|
+
...changes,
|
|
10295
|
+
isOpen: true,
|
|
10296
|
+
highlightedIndex: controlledHighlightedIndex
|
|
10297
|
+
};
|
|
10298
|
+
}
|
|
10043
10299
|
return {
|
|
10044
10300
|
...changes,
|
|
10045
10301
|
highlightedIndex: findPrevIndex({
|
|
@@ -10049,10 +10305,27 @@ function AutocompleteInner(props, ref) {
|
|
|
10049
10305
|
allDisabled
|
|
10050
10306
|
})
|
|
10051
10307
|
};
|
|
10308
|
+
case downshift.useCombobox.stateChangeTypes.InputKeyDownEnd:
|
|
10309
|
+
if (readOnly) {
|
|
10310
|
+
return {
|
|
10311
|
+
...changes,
|
|
10312
|
+
isOpen: false
|
|
10313
|
+
};
|
|
10314
|
+
}
|
|
10315
|
+
return {
|
|
10316
|
+
...changes,
|
|
10317
|
+
highlightedIndex: findPrevIndex({
|
|
10318
|
+
index: availableItems.length - 1,
|
|
10319
|
+
availableItems,
|
|
10320
|
+
optionDisabled,
|
|
10321
|
+
allDisabled
|
|
10322
|
+
})
|
|
10323
|
+
};
|
|
10052
10324
|
case downshift.useCombobox.stateChangeTypes.ControlledPropUpdatedSelectedItem:
|
|
10053
10325
|
setSelectedItems([changes.selectedItem]);
|
|
10054
10326
|
return {
|
|
10055
|
-
...changes
|
|
10327
|
+
...changes,
|
|
10328
|
+
highlightedIndex: controlledHighlightedIndex
|
|
10056
10329
|
};
|
|
10057
10330
|
default:
|
|
10058
10331
|
return changes;
|
|
@@ -11055,7 +11328,8 @@ const SideBarAccordion = /*#__PURE__*/react.forwardRef(function SideBarAccordion
|
|
|
11055
11328
|
disabled,
|
|
11056
11329
|
...rest
|
|
11057
11330
|
}, ref) {
|
|
11058
|
-
const
|
|
11331
|
+
const generatedAccordionId = react.useId();
|
|
11332
|
+
const accordionId = id ?? generatedAccordionId;
|
|
11059
11333
|
const [menuIsOpen, setMenuIsOpen] = react.useState(false);
|
|
11060
11334
|
const [accordionIsOpen, setAccordionIsOpen] = react.useState(isExpanded);
|
|
11061
11335
|
const [anchorEl, setAnchorEl] = react.useState(null);
|
|
@@ -11874,6 +12148,12 @@ const FieldWrapper = /*#__PURE__*/react.forwardRef(({
|
|
|
11874
12148
|
readonly,
|
|
11875
12149
|
...props
|
|
11876
12150
|
}, ref) => {
|
|
12151
|
+
const [anchorEl, setAnchorEl] = react.useState(null);
|
|
12152
|
+
react.useEffect(() => {
|
|
12153
|
+
if (ref && typeof ref !== 'function' && ref.current) {
|
|
12154
|
+
setAnchorEl(ref.current);
|
|
12155
|
+
}
|
|
12156
|
+
}, [ref]);
|
|
11877
12157
|
react.useEffect(() => {
|
|
11878
12158
|
if (isOpen === false) {
|
|
11879
12159
|
// Focus the first segment in the input field
|
|
@@ -11896,7 +12176,7 @@ const FieldWrapper = /*#__PURE__*/react.forwardRef(({
|
|
|
11896
12176
|
}), /*#__PURE__*/jsxRuntime.jsx(Popover, {
|
|
11897
12177
|
open: isOpen ?? false,
|
|
11898
12178
|
onClose: () => setIsOpen(false),
|
|
11899
|
-
anchorEl:
|
|
12179
|
+
anchorEl: anchorEl,
|
|
11900
12180
|
placement: 'bottom-start',
|
|
11901
12181
|
children: calendar
|
|
11902
12182
|
})]
|
|
@@ -12600,6 +12880,7 @@ exports.DialogTitle = DialogTitle;
|
|
|
12600
12880
|
exports.Divider = Divider;
|
|
12601
12881
|
exports.DotProgress = DotProgress;
|
|
12602
12882
|
exports.EdsProvider = EdsProvider;
|
|
12883
|
+
exports.Heading = Heading;
|
|
12603
12884
|
exports.Icon = Icon$1;
|
|
12604
12885
|
exports.Input = Input$4;
|
|
12605
12886
|
exports.InputWrapper = InputWrapper$2;
|
|
@@ -12613,6 +12894,7 @@ exports.MenuSection = MenuSection;
|
|
|
12613
12894
|
exports.NativeSelect = NativeSelect;
|
|
12614
12895
|
exports.Pagination = Pagination;
|
|
12615
12896
|
exports.Paper = Paper;
|
|
12897
|
+
exports.Paragraph = Paragraph;
|
|
12616
12898
|
exports.Popover = Popover;
|
|
12617
12899
|
exports.PopoverActions = PopoverActions;
|
|
12618
12900
|
exports.PopoverContent = PopoverContent;
|
|
@@ -12651,6 +12933,7 @@ exports.TableOfContentsLinkItem = LinkItem;
|
|
|
12651
12933
|
exports.TableRow = Row;
|
|
12652
12934
|
exports.Tabs = Tabs;
|
|
12653
12935
|
exports.TextField = TextField;
|
|
12936
|
+
exports.Textarea = Textarea;
|
|
12654
12937
|
exports.ToggleButton = ToggleButton;
|
|
12655
12938
|
exports.Tooltip = Tooltip$2;
|
|
12656
12939
|
exports.TopBar = TopBar;
|
|
@@ -12658,5 +12941,7 @@ exports.TopbarActions = Actions;
|
|
|
12658
12941
|
exports.TopbarCustomContent = CustomContent;
|
|
12659
12942
|
exports.TopbarHeader = Header$2;
|
|
12660
12943
|
exports.Typography = Typography;
|
|
12944
|
+
exports.TypographyNext = TypographyNext;
|
|
12661
12945
|
exports.useEds = useEds;
|
|
12946
|
+
exports.useInputField = useInputField;
|
|
12662
12947
|
exports.useSideBar = useSideBar;
|