@norges-domstoler/dds-components 13.1.0 → 13.2.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/dist/cjs/components/TextInput/TextInput.stories.d.ts +10 -0
- package/dist/cjs/components/TextInput/TextInput.types.d.ts +8 -2
- package/dist/cjs/icons/tsx/hourglassBottom.d.ts +3 -0
- package/dist/cjs/icons/tsx/hourglassDisabled.d.ts +3 -0
- package/dist/cjs/icons/tsx/hourglassEmpty.d.ts +3 -0
- package/dist/cjs/icons/tsx/hourglassFull.d.ts +3 -0
- package/dist/cjs/icons/tsx/hourglassTop.d.ts +3 -0
- package/dist/cjs/icons/tsx/index.d.ts +10 -0
- package/dist/cjs/icons/tsx/starHalfFilled.d.ts +3 -0
- package/dist/cjs/icons/tsx/thumbdown.d.ts +3 -0
- package/dist/cjs/icons/tsx/thumbdownFilled.d.ts +3 -0
- package/dist/cjs/icons/tsx/thumbup.d.ts +3 -0
- package/dist/cjs/icons/tsx/thumbupFilled.d.ts +3 -0
- package/dist/cjs/index.js +116 -20
- package/dist/components/TextInput/TextInput.js +22 -18
- package/dist/components/TextInput/TextInput.stories.d.ts +10 -0
- package/dist/components/TextInput/TextInput.types.d.ts +8 -2
- package/dist/helpers/Input/Input.styles.js +6 -4
- package/dist/icons/tsx/hourglassBottom.d.ts +3 -0
- package/dist/icons/tsx/hourglassBottom.js +12 -0
- package/dist/icons/tsx/hourglassDisabled.d.ts +3 -0
- package/dist/icons/tsx/hourglassDisabled.js +12 -0
- package/dist/icons/tsx/hourglassEmpty.d.ts +3 -0
- package/dist/icons/tsx/hourglassEmpty.js +12 -0
- package/dist/icons/tsx/hourglassFull.d.ts +3 -0
- package/dist/icons/tsx/hourglassFull.js +12 -0
- package/dist/icons/tsx/hourglassTop.d.ts +3 -0
- package/dist/icons/tsx/hourglassTop.js +12 -0
- package/dist/icons/tsx/index.d.ts +10 -0
- package/dist/icons/tsx/starHalfFilled.d.ts +3 -0
- package/dist/icons/tsx/starHalfFilled.js +12 -0
- package/dist/icons/tsx/thumbdown.d.ts +3 -0
- package/dist/icons/tsx/thumbdown.js +12 -0
- package/dist/icons/tsx/thumbdownFilled.d.ts +3 -0
- package/dist/icons/tsx/thumbdownFilled.js +12 -0
- package/dist/icons/tsx/thumbup.d.ts +3 -0
- package/dist/icons/tsx/thumbup.js +12 -0
- package/dist/icons/tsx/thumbupFilled.d.ts +3 -0
- package/dist/icons/tsx/thumbupFilled.js +12 -0
- package/dist/index.js +10 -0
- package/package.json +1 -1
|
@@ -5,9 +5,15 @@ export type TextInputProps = InputProps & {
|
|
|
5
5
|
withCharacterCounter?: boolean;
|
|
6
6
|
/** Ikonet som vises i komponenten. */
|
|
7
7
|
icon?: SvgIcon;
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Prefiks som vises før inputfeltet.
|
|
10
|
+
* OBS! Prefiks leses ikke av skjermleser og skal derfor ikke brukes som en erstatter
|
|
11
|
+
* for en beskrivende label. */
|
|
9
12
|
prefix?: string;
|
|
10
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Suffiks som vises etter inputfeltet.
|
|
15
|
+
* OBS! Suffiks leses ikke av skjermleser og skal derfor ikke brukes som en erstatter
|
|
16
|
+
* for en beskrivende label. */
|
|
11
17
|
suffix?: string;
|
|
12
18
|
};
|
|
13
19
|
export type TextAffixProps = {
|
|
@@ -65,6 +65,11 @@ export * from './gavel';
|
|
|
65
65
|
export * from './help';
|
|
66
66
|
export * from './helpFilled';
|
|
67
67
|
export * from './home';
|
|
68
|
+
export * from './hourglassBottom';
|
|
69
|
+
export * from './hourglassDisabled';
|
|
70
|
+
export * from './hourglassEmpty';
|
|
71
|
+
export * from './hourglassFull';
|
|
72
|
+
export * from './hourglassTop';
|
|
68
73
|
export * from './image';
|
|
69
74
|
export * from './info';
|
|
70
75
|
export * from './instagram';
|
|
@@ -113,7 +118,12 @@ export * from './settings';
|
|
|
113
118
|
export * from './sms';
|
|
114
119
|
export * from './star';
|
|
115
120
|
export * from './starFilled';
|
|
121
|
+
export * from './starHalfFilled';
|
|
116
122
|
export * from './sync';
|
|
123
|
+
export * from './thumbdown';
|
|
124
|
+
export * from './thumbdownFilled';
|
|
125
|
+
export * from './thumbup';
|
|
126
|
+
export * from './thumbupFilled';
|
|
117
127
|
export * from './time';
|
|
118
128
|
export * from './tingrett';
|
|
119
129
|
export * from './tip';
|
package/dist/cjs/index.js
CHANGED
|
@@ -836,11 +836,13 @@ var StatefulInput = styled__default.default(Input$2).withConfig({
|
|
|
836
836
|
displayName: "Inputstyles__StatefulInput",
|
|
837
837
|
componentId: "sc-1oz9x8w-1"
|
|
838
838
|
})(["-webkit-appearance:textfield;padding-left:", ";padding-right:", ";", " ", " &:enabled:read-only{border:none;outline:none;cursor:default;background-color:", ";padding-left:0;}&:disabled{cursor:not-allowed;color:", ";background-color:", ";}"], function (_ref) {
|
|
839
|
-
var prefixLength = _ref.prefixLength
|
|
840
|
-
|
|
839
|
+
var prefixLength = _ref.prefixLength,
|
|
840
|
+
readOnly = _ref.readOnly;
|
|
841
|
+
return prefixLength && (readOnly ? "".concat(prefixLength, "px !important") : "calc(".concat(input$4.affix.gap, "px + ").concat(prefixLength, "px) !important"));
|
|
841
842
|
}, function (_ref2) {
|
|
842
|
-
var suffixLength = _ref2.suffixLength
|
|
843
|
-
|
|
843
|
+
var suffixLength = _ref2.suffixLength,
|
|
844
|
+
readOnly = _ref2.readOnly;
|
|
845
|
+
return suffixLength && (readOnly ? "".concat(suffixLength, "px !important") : "calc(".concat(input$4.affix.gap, "px + ").concat(suffixLength, "px) !important"));
|
|
844
846
|
}, function (_ref3) {
|
|
845
847
|
var componentSize = _ref3.componentSize;
|
|
846
848
|
return componentSize && styled.css(["padding:", ";", ""], input$4.sizes[componentSize].padding, getFontStyling(inputTypographyTypes[componentSize]));
|
|
@@ -1505,6 +1507,46 @@ function HomeIcon(props) {
|
|
|
1505
1507
|
}));
|
|
1506
1508
|
}
|
|
1507
1509
|
|
|
1510
|
+
function HourglassBottom(props) {
|
|
1511
|
+
return jsxRuntime.jsx(SvgWrapper, Object.assign({}, props, {
|
|
1512
|
+
children: jsxRuntime.jsx("path", {
|
|
1513
|
+
d: "m18 22-.01-6L14 12l3.99-4.01L18 2H6v6l4 4-4 3.99V22h12zM8 7.5V4h8v3.5l-4 4-4-4z"
|
|
1514
|
+
})
|
|
1515
|
+
}));
|
|
1516
|
+
}
|
|
1517
|
+
|
|
1518
|
+
function HourglassDisabled(props) {
|
|
1519
|
+
return jsxRuntime.jsx(SvgWrapper, Object.assign({}, props, {
|
|
1520
|
+
children: jsxRuntime.jsx("path", {
|
|
1521
|
+
d: "M8 4h8v3.5l-2.84 2.84 1.25 1.25L18 8.01 17.99 8H18V2H6v1.17l2 2zM2.1 2.1.69 3.51l8.9 8.9L6 16l.01.01H6V22h12v-1.17l2.49 2.49 1.41-1.41L2.1 2.1zM16 20H8v-3.5l2.84-2.84L16 18.83V20z"
|
|
1522
|
+
})
|
|
1523
|
+
}));
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
function HourglassEmpty(props) {
|
|
1527
|
+
return jsxRuntime.jsx(SvgWrapper, Object.assign({}, props, {
|
|
1528
|
+
children: jsxRuntime.jsx("path", {
|
|
1529
|
+
d: "M6 2v6h.01L6 8.01 10 12l-4 4 .01.01H6V22h12v-5.99h-.01L18 16l-4-4 4-3.99-.01-.01H18V2H6zm10 14.5V20H8v-3.5l4-4 4 4zm-4-5-4-4V4h8v3.5l-4 4z"
|
|
1530
|
+
})
|
|
1531
|
+
}));
|
|
1532
|
+
}
|
|
1533
|
+
|
|
1534
|
+
function HourglassFull(props) {
|
|
1535
|
+
return jsxRuntime.jsx(SvgWrapper, Object.assign({}, props, {
|
|
1536
|
+
children: jsxRuntime.jsx("path", {
|
|
1537
|
+
d: "M6 2v6h.01L6 8.01 10 12l-4 4 .01.01H6V22h12v-5.99h-.01L18 16l-4-4 4-3.99-.01-.01H18V2H6z"
|
|
1538
|
+
})
|
|
1539
|
+
}));
|
|
1540
|
+
}
|
|
1541
|
+
|
|
1542
|
+
function HourglassTop(props) {
|
|
1543
|
+
return jsxRuntime.jsx(SvgWrapper, Object.assign({}, props, {
|
|
1544
|
+
children: jsxRuntime.jsx("path", {
|
|
1545
|
+
d: "m6 2 .01 6L10 12l-3.99 4.01L6 22h12v-6l-4-4 4-3.99V2H6zm10 14.5V20H8v-3.5l4-4 4 4z"
|
|
1546
|
+
})
|
|
1547
|
+
}));
|
|
1548
|
+
}
|
|
1549
|
+
|
|
1508
1550
|
function ImageIcon(props) {
|
|
1509
1551
|
return jsxRuntime.jsx(SvgWrapper, Object.assign({}, props, {
|
|
1510
1552
|
children: jsxRuntime.jsx("path", {
|
|
@@ -1907,6 +1949,14 @@ function StarFilledIcon(props) {
|
|
|
1907
1949
|
}));
|
|
1908
1950
|
}
|
|
1909
1951
|
|
|
1952
|
+
function StarHalfFilled(props) {
|
|
1953
|
+
return jsxRuntime.jsx(SvgWrapper, Object.assign({}, props, {
|
|
1954
|
+
children: jsxRuntime.jsx("path", {
|
|
1955
|
+
d: "m22 9.24-7.19-.62L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27 18.18 21l-1.63-7.03L22 9.24zM12 15.4V6.1l1.71 4.04 4.38.38-3.32 2.88 1 4.28L12 15.4z"
|
|
1956
|
+
})
|
|
1957
|
+
}));
|
|
1958
|
+
}
|
|
1959
|
+
|
|
1910
1960
|
function SyncIcon(props) {
|
|
1911
1961
|
return jsxRuntime.jsx(SvgWrapper, Object.assign({}, props, {
|
|
1912
1962
|
children: jsxRuntime.jsx("path", {
|
|
@@ -1915,6 +1965,38 @@ function SyncIcon(props) {
|
|
|
1915
1965
|
}));
|
|
1916
1966
|
}
|
|
1917
1967
|
|
|
1968
|
+
function Thumbdown(props) {
|
|
1969
|
+
return jsxRuntime.jsx(SvgWrapper, Object.assign({}, props, {
|
|
1970
|
+
children: jsxRuntime.jsx("path", {
|
|
1971
|
+
d: "m10.89 18.28.57-2.89c.12-.59-.04-1.2-.42-1.66-.38-.46-.94-.73-1.54-.73H4v-1.08L6.57 6h8.09c.18 0 .34.16.34.34v7.84l-4.11 4.1M10 22l6.41-6.41c.38-.38.59-.89.59-1.42V6.34C17 5.05 15.95 4 14.66 4h-8.1c-.71 0-1.36.37-1.72.97l-2.67 6.15c-.11.25-.17.52-.17.8V13c0 1.1.9 2 2 2h5.5l-.92 4.65c-.05.22-.02.46.08.66.23.45.52.86.88 1.22L10 22zm10-7h2V4h-2c-.55 0-1 .45-1 1v9c0 .55.45 1 1 1z"
|
|
1972
|
+
})
|
|
1973
|
+
}));
|
|
1974
|
+
}
|
|
1975
|
+
|
|
1976
|
+
function ThumbdownFilled(props) {
|
|
1977
|
+
return jsxRuntime.jsx(SvgWrapper, Object.assign({}, props, {
|
|
1978
|
+
children: jsxRuntime.jsx("path", {
|
|
1979
|
+
d: "M22 4h-2c-.55 0-1 .45-1 1v9c0 .55.45 1 1 1h2V4zM2.17 11.12c-.11.25-.17.52-.17.8V13c0 1.1.9 2 2 2h5.5l-.92 4.65c-.05.22-.02.46.08.66.23.45.52.86.88 1.22L10 22l6.41-6.41c.38-.38.59-.89.59-1.42V6.34C17 5.05 15.95 4 14.66 4h-8.1c-.71 0-1.36.37-1.72.97l-2.67 6.15z"
|
|
1980
|
+
})
|
|
1981
|
+
}));
|
|
1982
|
+
}
|
|
1983
|
+
|
|
1984
|
+
function Thumbup(props) {
|
|
1985
|
+
return jsxRuntime.jsx(SvgWrapper, Object.assign({}, props, {
|
|
1986
|
+
children: jsxRuntime.jsx("path", {
|
|
1987
|
+
d: "m13.11 5.72-.57 2.89c-.12.59.04 1.2.42 1.66.38.46.94.73 1.54.73H20v1.08L17.43 18H9.34c-.18 0-.34-.16-.34-.34V9.82l4.11-4.1M14 2 7.59 8.41C7.21 8.79 7 9.3 7 9.83v7.83C7 18.95 8.05 20 9.34 20h8.1c.71 0 1.36-.37 1.72-.97l2.67-6.15c.11-.25.17-.52.17-.8V11c0-1.1-.9-2-2-2h-5.5l.92-4.65c.05-.22.02-.46-.08-.66-.23-.45-.52-.86-.88-1.22L14 2zM4 9H2v11h2c.55 0 1-.45 1-1v-9c0-.55-.45-1-1-1z"
|
|
1988
|
+
})
|
|
1989
|
+
}));
|
|
1990
|
+
}
|
|
1991
|
+
|
|
1992
|
+
function ThumbupFilled(props) {
|
|
1993
|
+
return jsxRuntime.jsx(SvgWrapper, Object.assign({}, props, {
|
|
1994
|
+
children: jsxRuntime.jsx("path", {
|
|
1995
|
+
d: "M2 20h2c.55 0 1-.45 1-1v-9c0-.55-.45-1-1-1H2v11zm19.83-7.12c.11-.25.17-.52.17-.8V11c0-1.1-.9-2-2-2h-5.5l.92-4.65c.05-.22.02-.46-.08-.66-.23-.45-.52-.86-.88-1.22L14 2 7.59 8.41C7.21 8.79 7 9.3 7 9.83v7.84C7 18.95 8.05 20 9.34 20h8.11c.7 0 1.36-.37 1.72-.97l2.66-6.15z"
|
|
1996
|
+
})
|
|
1997
|
+
}));
|
|
1998
|
+
}
|
|
1999
|
+
|
|
1918
2000
|
function TimeIcon(props) {
|
|
1919
2001
|
return jsxRuntime.jsx(SvgWrapper, Object.assign({}, props, {
|
|
1920
2002
|
children: jsxRuntime.jsx("path", {
|
|
@@ -4328,19 +4410,23 @@ var getWidth$1 = function getWidth(size, width) {
|
|
|
4328
4410
|
}
|
|
4329
4411
|
return defaultWidth$5;
|
|
4330
4412
|
};
|
|
4331
|
-
var
|
|
4332
|
-
displayName: "
|
|
4413
|
+
var Affix = styled__default.default.span.withConfig({
|
|
4414
|
+
displayName: "TextInput__Affix",
|
|
4333
4415
|
componentId: "sc-k8umq3-0"
|
|
4334
|
-
})(["position:absolute;height:100%;top:50%;transform:translateY(-50%);display:flex;align-items:center;pointer-events:none;z-index:1;
|
|
4416
|
+
})(["position:absolute;height:100%;top:50%;transform:translateY(-50%);display:flex;align-items:center;pointer-events:none;z-index:1;"]);
|
|
4417
|
+
var Prefix = styled__default.default(Affix).withConfig({
|
|
4418
|
+
displayName: "TextInput__Prefix",
|
|
4419
|
+
componentId: "sc-k8umq3-1"
|
|
4420
|
+
})(["left:0;margin-left:8px;padding-right:8px;border-right:1px solid ", ";", ";"], textInputTokens.affix.border.color, function (_ref) {
|
|
4335
4421
|
var readOnly = _ref.readOnly;
|
|
4336
|
-
return
|
|
4422
|
+
return readOnly && styled.css(["margin-left:0;padding-right:0.5ch;border-right:none;"]);
|
|
4337
4423
|
});
|
|
4338
|
-
var Suffix = styled__default.default.
|
|
4424
|
+
var Suffix = styled__default.default(Affix).withConfig({
|
|
4339
4425
|
displayName: "TextInput__Suffix",
|
|
4340
|
-
componentId: "sc-k8umq3-
|
|
4341
|
-
})(["
|
|
4426
|
+
componentId: "sc-k8umq3-2"
|
|
4427
|
+
})(["right:0;margin-right:8px;padding-left:8px;border-left:1px solid ", ";", ";"], textInputTokens.affix.border.color, function (_ref2) {
|
|
4342
4428
|
var readOnly = _ref2.readOnly;
|
|
4343
|
-
return
|
|
4429
|
+
return readOnly && styled.css(["margin-right:0;padding-left:0.5ch;border-left:none;"]);
|
|
4344
4430
|
});
|
|
4345
4431
|
var TextInput = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
4346
4432
|
var label = _a.label,
|
|
@@ -4383,6 +4469,14 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
4383
4469
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
4384
4470
|
suffixLength = _useState6[0],
|
|
4385
4471
|
setSuffixLength = _useState6[1];
|
|
4472
|
+
React.useLayoutEffect(function () {
|
|
4473
|
+
if (prefixRef.current) {
|
|
4474
|
+
setPrefixLength(prefixRef.current.offsetWidth);
|
|
4475
|
+
}
|
|
4476
|
+
if (suffixRef.current) {
|
|
4477
|
+
setSuffixLength(suffixRef.current.offsetWidth);
|
|
4478
|
+
}
|
|
4479
|
+
}, [prefix, suffix, readOnly]);
|
|
4386
4480
|
var onChangeHandler = function onChangeHandler(event) {
|
|
4387
4481
|
setText(event.target.value);
|
|
4388
4482
|
if (onChange) {
|
|
@@ -4421,14 +4515,6 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
4421
4515
|
width: getWidth$1(componentSize, width)
|
|
4422
4516
|
};
|
|
4423
4517
|
var showRequiredStyling = !!(required || ariaRequired);
|
|
4424
|
-
React.useLayoutEffect(function () {
|
|
4425
|
-
if (prefixRef.current) {
|
|
4426
|
-
setPrefixLength(prefixRef.current.offsetWidth);
|
|
4427
|
-
}
|
|
4428
|
-
if (suffixRef.current) {
|
|
4429
|
-
setSuffixLength(suffixRef.current.offsetWidth);
|
|
4430
|
-
}
|
|
4431
|
-
}, []);
|
|
4432
4518
|
var extendedInput = null;
|
|
4433
4519
|
if (hasIcon) {
|
|
4434
4520
|
extendedInput = jsxRuntime.jsxs(InputContainer$1, {
|
|
@@ -11503,6 +11589,11 @@ exports.Heading = Heading;
|
|
|
11503
11589
|
exports.HelpFilledIcon = HelpFilledIcon;
|
|
11504
11590
|
exports.HelpIcon = HelpIcon;
|
|
11505
11591
|
exports.HomeIcon = HomeIcon;
|
|
11592
|
+
exports.HourglassBottom = HourglassBottom;
|
|
11593
|
+
exports.HourglassDisabled = HourglassDisabled;
|
|
11594
|
+
exports.HourglassEmpty = HourglassEmpty;
|
|
11595
|
+
exports.HourglassFull = HourglassFull;
|
|
11596
|
+
exports.HourglassTop = HourglassTop;
|
|
11506
11597
|
exports.Icon = Icon;
|
|
11507
11598
|
exports.ImageIcon = ImageIcon;
|
|
11508
11599
|
exports.InfoIcon = InfoIcon;
|
|
@@ -11583,6 +11674,7 @@ exports.SmsIcon = SmsIcon;
|
|
|
11583
11674
|
exports.Spinner = Spinner;
|
|
11584
11675
|
exports.SplitButton = SplitButton;
|
|
11585
11676
|
exports.StarFilledIcon = StarFilledIcon;
|
|
11677
|
+
exports.StarHalfFilled = StarHalfFilled;
|
|
11586
11678
|
exports.StarIcon = StarIcon;
|
|
11587
11679
|
exports.StyledTextArea = StyledTextArea;
|
|
11588
11680
|
exports.SyncIcon = SyncIcon;
|
|
@@ -11595,6 +11687,10 @@ exports.Tabs = Tabs;
|
|
|
11595
11687
|
exports.Tag = Tag;
|
|
11596
11688
|
exports.TextArea = TextArea;
|
|
11597
11689
|
exports.TextInput = TextInput;
|
|
11690
|
+
exports.Thumbdown = Thumbdown;
|
|
11691
|
+
exports.ThumbdownFilled = ThumbdownFilled;
|
|
11692
|
+
exports.Thumbup = Thumbup;
|
|
11693
|
+
exports.ThumbupFilled = ThumbupFilled;
|
|
11598
11694
|
exports.TimeIcon = TimeIcon;
|
|
11599
11695
|
exports.TingrettIcon = TingrettIcon;
|
|
11600
11696
|
exports.TipIcon = TipIcon;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { slicedToArray as _slicedToArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
2
|
import { __rest } from 'tslib';
|
|
3
3
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
-
import { forwardRef, useState, useRef,
|
|
4
|
+
import { forwardRef, useState, useRef, useLayoutEffect, useId } from 'react';
|
|
5
5
|
import CharCounter from './CharCounter.js';
|
|
6
6
|
import '../../helpers/Backdrop/Backdrop.js';
|
|
7
7
|
import '../../helpers/Chevron/AnimatedChevronUpDown.styles.js';
|
|
@@ -19,7 +19,7 @@ import { StyledIcon, StyledInput, MessageContainer } from './TextInput.styles.js
|
|
|
19
19
|
import '../Typography/Typography/Typography.js';
|
|
20
20
|
import { Label } from '../Typography/Label/Label.js';
|
|
21
21
|
import '../Typography/Link/Link.js';
|
|
22
|
-
import styled from 'styled-components';
|
|
22
|
+
import styled, { css } from 'styled-components';
|
|
23
23
|
import { textInputTokens } from './TextInput.tokens.js';
|
|
24
24
|
|
|
25
25
|
var defaultWidth = '320px';
|
|
@@ -31,19 +31,23 @@ var getWidth = function getWidth(size, width) {
|
|
|
31
31
|
}
|
|
32
32
|
return defaultWidth;
|
|
33
33
|
};
|
|
34
|
-
var
|
|
35
|
-
displayName: "
|
|
34
|
+
var Affix = styled.span.withConfig({
|
|
35
|
+
displayName: "TextInput__Affix",
|
|
36
36
|
componentId: "sc-k8umq3-0"
|
|
37
|
-
})(["position:absolute;height:100%;top:50%;transform:translateY(-50%);display:flex;align-items:center;pointer-events:none;z-index:1;
|
|
37
|
+
})(["position:absolute;height:100%;top:50%;transform:translateY(-50%);display:flex;align-items:center;pointer-events:none;z-index:1;"]);
|
|
38
|
+
var Prefix = styled(Affix).withConfig({
|
|
39
|
+
displayName: "TextInput__Prefix",
|
|
40
|
+
componentId: "sc-k8umq3-1"
|
|
41
|
+
})(["left:0;margin-left:8px;padding-right:8px;border-right:1px solid ", ";", ";"], textInputTokens.affix.border.color, function (_ref) {
|
|
38
42
|
var readOnly = _ref.readOnly;
|
|
39
|
-
return
|
|
43
|
+
return readOnly && css(["margin-left:0;padding-right:0.5ch;border-right:none;"]);
|
|
40
44
|
});
|
|
41
|
-
var Suffix = styled.
|
|
45
|
+
var Suffix = styled(Affix).withConfig({
|
|
42
46
|
displayName: "TextInput__Suffix",
|
|
43
|
-
componentId: "sc-k8umq3-
|
|
44
|
-
})(["
|
|
47
|
+
componentId: "sc-k8umq3-2"
|
|
48
|
+
})(["right:0;margin-right:8px;padding-left:8px;border-left:1px solid ", ";", ";"], textInputTokens.affix.border.color, function (_ref2) {
|
|
45
49
|
var readOnly = _ref2.readOnly;
|
|
46
|
-
return
|
|
50
|
+
return readOnly && css(["margin-right:0;padding-left:0.5ch;border-left:none;"]);
|
|
47
51
|
});
|
|
48
52
|
var TextInput = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
49
53
|
var label = _a.label,
|
|
@@ -86,6 +90,14 @@ var TextInput = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
86
90
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
87
91
|
suffixLength = _useState6[0],
|
|
88
92
|
setSuffixLength = _useState6[1];
|
|
93
|
+
useLayoutEffect(function () {
|
|
94
|
+
if (prefixRef.current) {
|
|
95
|
+
setPrefixLength(prefixRef.current.offsetWidth);
|
|
96
|
+
}
|
|
97
|
+
if (suffixRef.current) {
|
|
98
|
+
setSuffixLength(suffixRef.current.offsetWidth);
|
|
99
|
+
}
|
|
100
|
+
}, [prefix, suffix, readOnly]);
|
|
89
101
|
var onChangeHandler = function onChangeHandler(event) {
|
|
90
102
|
setText(event.target.value);
|
|
91
103
|
if (onChange) {
|
|
@@ -124,14 +136,6 @@ var TextInput = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
124
136
|
width: getWidth(componentSize, width)
|
|
125
137
|
};
|
|
126
138
|
var showRequiredStyling = !!(required || ariaRequired);
|
|
127
|
-
useLayoutEffect(function () {
|
|
128
|
-
if (prefixRef.current) {
|
|
129
|
-
setPrefixLength(prefixRef.current.offsetWidth);
|
|
130
|
-
}
|
|
131
|
-
if (suffixRef.current) {
|
|
132
|
-
setSuffixLength(suffixRef.current.offsetWidth);
|
|
133
|
-
}
|
|
134
|
-
}, []);
|
|
135
139
|
var extendedInput = null;
|
|
136
140
|
if (hasIcon) {
|
|
137
141
|
extendedInput = jsxs(InputContainer, {
|
|
@@ -5,9 +5,15 @@ export type TextInputProps = InputProps & {
|
|
|
5
5
|
withCharacterCounter?: boolean;
|
|
6
6
|
/** Ikonet som vises i komponenten. */
|
|
7
7
|
icon?: SvgIcon;
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Prefiks som vises før inputfeltet.
|
|
10
|
+
* OBS! Prefiks leses ikke av skjermleser og skal derfor ikke brukes som en erstatter
|
|
11
|
+
* for en beskrivende label. */
|
|
9
12
|
prefix?: string;
|
|
10
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Suffiks som vises etter inputfeltet.
|
|
15
|
+
* OBS! Suffiks leses ikke av skjermleser og skal derfor ikke brukes som en erstatter
|
|
16
|
+
* for en beskrivende label. */
|
|
11
17
|
suffix?: string;
|
|
12
18
|
};
|
|
13
19
|
export type TextAffixProps = {
|
|
@@ -17,11 +17,13 @@ var StatefulInput = styled(Input).withConfig({
|
|
|
17
17
|
displayName: "Inputstyles__StatefulInput",
|
|
18
18
|
componentId: "sc-1oz9x8w-1"
|
|
19
19
|
})(["-webkit-appearance:textfield;padding-left:", ";padding-right:", ";", " ", " &:enabled:read-only{border:none;outline:none;cursor:default;background-color:", ";padding-left:0;}&:disabled{cursor:not-allowed;color:", ";background-color:", ";}"], function (_ref) {
|
|
20
|
-
var prefixLength = _ref.prefixLength
|
|
21
|
-
|
|
20
|
+
var prefixLength = _ref.prefixLength,
|
|
21
|
+
readOnly = _ref.readOnly;
|
|
22
|
+
return prefixLength && (readOnly ? "".concat(prefixLength, "px !important") : "calc(".concat(input.affix.gap, "px + ").concat(prefixLength, "px) !important"));
|
|
22
23
|
}, function (_ref2) {
|
|
23
|
-
var suffixLength = _ref2.suffixLength
|
|
24
|
-
|
|
24
|
+
var suffixLength = _ref2.suffixLength,
|
|
25
|
+
readOnly = _ref2.readOnly;
|
|
26
|
+
return suffixLength && (readOnly ? "".concat(suffixLength, "px !important") : "calc(".concat(input.affix.gap, "px + ").concat(suffixLength, "px) !important"));
|
|
25
27
|
}, function (_ref3) {
|
|
26
28
|
var componentSize = _ref3.componentSize;
|
|
27
29
|
return componentSize && css(["padding:", ";", ""], input.sizes[componentSize].padding, getFontStyling(inputTypographyTypes[componentSize]));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { SvgWrapper } from '../utils/SvgWrapper.js';
|
|
3
|
+
|
|
4
|
+
function HourglassBottom(props) {
|
|
5
|
+
return jsx(SvgWrapper, Object.assign({}, props, {
|
|
6
|
+
children: jsx("path", {
|
|
7
|
+
d: "m18 22-.01-6L14 12l3.99-4.01L18 2H6v6l4 4-4 3.99V22h12zM8 7.5V4h8v3.5l-4 4-4-4z"
|
|
8
|
+
})
|
|
9
|
+
}));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { HourglassBottom };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { SvgWrapper } from '../utils/SvgWrapper.js';
|
|
3
|
+
|
|
4
|
+
function HourglassDisabled(props) {
|
|
5
|
+
return jsx(SvgWrapper, Object.assign({}, props, {
|
|
6
|
+
children: jsx("path", {
|
|
7
|
+
d: "M8 4h8v3.5l-2.84 2.84 1.25 1.25L18 8.01 17.99 8H18V2H6v1.17l2 2zM2.1 2.1.69 3.51l8.9 8.9L6 16l.01.01H6V22h12v-1.17l2.49 2.49 1.41-1.41L2.1 2.1zM16 20H8v-3.5l2.84-2.84L16 18.83V20z"
|
|
8
|
+
})
|
|
9
|
+
}));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { HourglassDisabled };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { SvgWrapper } from '../utils/SvgWrapper.js';
|
|
3
|
+
|
|
4
|
+
function HourglassEmpty(props) {
|
|
5
|
+
return jsx(SvgWrapper, Object.assign({}, props, {
|
|
6
|
+
children: jsx("path", {
|
|
7
|
+
d: "M6 2v6h.01L6 8.01 10 12l-4 4 .01.01H6V22h12v-5.99h-.01L18 16l-4-4 4-3.99-.01-.01H18V2H6zm10 14.5V20H8v-3.5l4-4 4 4zm-4-5-4-4V4h8v3.5l-4 4z"
|
|
8
|
+
})
|
|
9
|
+
}));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { HourglassEmpty };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { SvgWrapper } from '../utils/SvgWrapper.js';
|
|
3
|
+
|
|
4
|
+
function HourglassFull(props) {
|
|
5
|
+
return jsx(SvgWrapper, Object.assign({}, props, {
|
|
6
|
+
children: jsx("path", {
|
|
7
|
+
d: "M6 2v6h.01L6 8.01 10 12l-4 4 .01.01H6V22h12v-5.99h-.01L18 16l-4-4 4-3.99-.01-.01H18V2H6z"
|
|
8
|
+
})
|
|
9
|
+
}));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { HourglassFull };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { SvgWrapper } from '../utils/SvgWrapper.js';
|
|
3
|
+
|
|
4
|
+
function HourglassTop(props) {
|
|
5
|
+
return jsx(SvgWrapper, Object.assign({}, props, {
|
|
6
|
+
children: jsx("path", {
|
|
7
|
+
d: "m6 2 .01 6L10 12l-3.99 4.01L6 22h12v-6l-4-4 4-3.99V2H6zm10 14.5V20H8v-3.5l4-4 4 4z"
|
|
8
|
+
})
|
|
9
|
+
}));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { HourglassTop };
|
|
@@ -65,6 +65,11 @@ export * from './gavel';
|
|
|
65
65
|
export * from './help';
|
|
66
66
|
export * from './helpFilled';
|
|
67
67
|
export * from './home';
|
|
68
|
+
export * from './hourglassBottom';
|
|
69
|
+
export * from './hourglassDisabled';
|
|
70
|
+
export * from './hourglassEmpty';
|
|
71
|
+
export * from './hourglassFull';
|
|
72
|
+
export * from './hourglassTop';
|
|
68
73
|
export * from './image';
|
|
69
74
|
export * from './info';
|
|
70
75
|
export * from './instagram';
|
|
@@ -113,7 +118,12 @@ export * from './settings';
|
|
|
113
118
|
export * from './sms';
|
|
114
119
|
export * from './star';
|
|
115
120
|
export * from './starFilled';
|
|
121
|
+
export * from './starHalfFilled';
|
|
116
122
|
export * from './sync';
|
|
123
|
+
export * from './thumbdown';
|
|
124
|
+
export * from './thumbdownFilled';
|
|
125
|
+
export * from './thumbup';
|
|
126
|
+
export * from './thumbupFilled';
|
|
117
127
|
export * from './time';
|
|
118
128
|
export * from './tingrett';
|
|
119
129
|
export * from './tip';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { SvgWrapper } from '../utils/SvgWrapper.js';
|
|
3
|
+
|
|
4
|
+
function StarHalfFilled(props) {
|
|
5
|
+
return jsx(SvgWrapper, Object.assign({}, props, {
|
|
6
|
+
children: jsx("path", {
|
|
7
|
+
d: "m22 9.24-7.19-.62L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27 18.18 21l-1.63-7.03L22 9.24zM12 15.4V6.1l1.71 4.04 4.38.38-3.32 2.88 1 4.28L12 15.4z"
|
|
8
|
+
})
|
|
9
|
+
}));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { StarHalfFilled };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { SvgWrapper } from '../utils/SvgWrapper.js';
|
|
3
|
+
|
|
4
|
+
function Thumbdown(props) {
|
|
5
|
+
return jsx(SvgWrapper, Object.assign({}, props, {
|
|
6
|
+
children: jsx("path", {
|
|
7
|
+
d: "m10.89 18.28.57-2.89c.12-.59-.04-1.2-.42-1.66-.38-.46-.94-.73-1.54-.73H4v-1.08L6.57 6h8.09c.18 0 .34.16.34.34v7.84l-4.11 4.1M10 22l6.41-6.41c.38-.38.59-.89.59-1.42V6.34C17 5.05 15.95 4 14.66 4h-8.1c-.71 0-1.36.37-1.72.97l-2.67 6.15c-.11.25-.17.52-.17.8V13c0 1.1.9 2 2 2h5.5l-.92 4.65c-.05.22-.02.46.08.66.23.45.52.86.88 1.22L10 22zm10-7h2V4h-2c-.55 0-1 .45-1 1v9c0 .55.45 1 1 1z"
|
|
8
|
+
})
|
|
9
|
+
}));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { Thumbdown };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { SvgWrapper } from '../utils/SvgWrapper.js';
|
|
3
|
+
|
|
4
|
+
function ThumbdownFilled(props) {
|
|
5
|
+
return jsx(SvgWrapper, Object.assign({}, props, {
|
|
6
|
+
children: jsx("path", {
|
|
7
|
+
d: "M22 4h-2c-.55 0-1 .45-1 1v9c0 .55.45 1 1 1h2V4zM2.17 11.12c-.11.25-.17.52-.17.8V13c0 1.1.9 2 2 2h5.5l-.92 4.65c-.05.22-.02.46.08.66.23.45.52.86.88 1.22L10 22l6.41-6.41c.38-.38.59-.89.59-1.42V6.34C17 5.05 15.95 4 14.66 4h-8.1c-.71 0-1.36.37-1.72.97l-2.67 6.15z"
|
|
8
|
+
})
|
|
9
|
+
}));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { ThumbdownFilled };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { SvgWrapper } from '../utils/SvgWrapper.js';
|
|
3
|
+
|
|
4
|
+
function Thumbup(props) {
|
|
5
|
+
return jsx(SvgWrapper, Object.assign({}, props, {
|
|
6
|
+
children: jsx("path", {
|
|
7
|
+
d: "m13.11 5.72-.57 2.89c-.12.59.04 1.2.42 1.66.38.46.94.73 1.54.73H20v1.08L17.43 18H9.34c-.18 0-.34-.16-.34-.34V9.82l4.11-4.1M14 2 7.59 8.41C7.21 8.79 7 9.3 7 9.83v7.83C7 18.95 8.05 20 9.34 20h8.1c.71 0 1.36-.37 1.72-.97l2.67-6.15c.11-.25.17-.52.17-.8V11c0-1.1-.9-2-2-2h-5.5l.92-4.65c.05-.22.02-.46-.08-.66-.23-.45-.52-.86-.88-1.22L14 2zM4 9H2v11h2c.55 0 1-.45 1-1v-9c0-.55-.45-1-1-1z"
|
|
8
|
+
})
|
|
9
|
+
}));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { Thumbup };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { SvgWrapper } from '../utils/SvgWrapper.js';
|
|
3
|
+
|
|
4
|
+
function ThumbupFilled(props) {
|
|
5
|
+
return jsx(SvgWrapper, Object.assign({}, props, {
|
|
6
|
+
children: jsx("path", {
|
|
7
|
+
d: "M2 20h2c.55 0 1-.45 1-1v-9c0-.55-.45-1-1-1H2v11zm19.83-7.12c.11-.25.17-.52.17-.8V11c0-1.1-.9-2-2-2h-5.5l.92-4.65c.05-.22.02-.46-.08-.66-.23-.45-.52-.86-.88-1.22L14 2 7.59 8.41C7.21 8.79 7 9.3 7 9.83v7.84C7 18.95 8.05 20 9.34 20h8.11c.7 0 1.36-.37 1.72-.97l2.66-6.15z"
|
|
8
|
+
})
|
|
9
|
+
}));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { ThumbupFilled };
|
package/dist/index.js
CHANGED
|
@@ -128,6 +128,11 @@ export { GavelIcon } from './icons/tsx/gavel.js';
|
|
|
128
128
|
export { HelpIcon } from './icons/tsx/help.js';
|
|
129
129
|
export { HelpFilledIcon } from './icons/tsx/helpFilled.js';
|
|
130
130
|
export { HomeIcon } from './icons/tsx/home.js';
|
|
131
|
+
export { HourglassBottom } from './icons/tsx/hourglassBottom.js';
|
|
132
|
+
export { HourglassDisabled } from './icons/tsx/hourglassDisabled.js';
|
|
133
|
+
export { HourglassEmpty } from './icons/tsx/hourglassEmpty.js';
|
|
134
|
+
export { HourglassFull } from './icons/tsx/hourglassFull.js';
|
|
135
|
+
export { HourglassTop } from './icons/tsx/hourglassTop.js';
|
|
131
136
|
export { ImageIcon } from './icons/tsx/image.js';
|
|
132
137
|
export { InfoIcon } from './icons/tsx/info.js';
|
|
133
138
|
export { InstagramIcon } from './icons/tsx/instagram.js';
|
|
@@ -176,7 +181,12 @@ export { SettingsIcon } from './icons/tsx/settings.js';
|
|
|
176
181
|
export { SmsIcon } from './icons/tsx/sms.js';
|
|
177
182
|
export { StarIcon } from './icons/tsx/star.js';
|
|
178
183
|
export { StarFilledIcon } from './icons/tsx/starFilled.js';
|
|
184
|
+
export { StarHalfFilled } from './icons/tsx/starHalfFilled.js';
|
|
179
185
|
export { SyncIcon } from './icons/tsx/sync.js';
|
|
186
|
+
export { Thumbdown } from './icons/tsx/thumbdown.js';
|
|
187
|
+
export { ThumbdownFilled } from './icons/tsx/thumbdownFilled.js';
|
|
188
|
+
export { Thumbup } from './icons/tsx/thumbup.js';
|
|
189
|
+
export { ThumbupFilled } from './icons/tsx/thumbupFilled.js';
|
|
180
190
|
export { TimeIcon } from './icons/tsx/time.js';
|
|
181
191
|
export { TingrettIcon } from './icons/tsx/tingrett.js';
|
|
182
192
|
export { TipIcon } from './icons/tsx/tip.js';
|