@danske/sapphire-react-lab 0.85.0 → 0.86.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/build/cjs/index.js +923 -878
- package/build/cjs/index.js.map +1 -1
- package/build/esm/LabeledValue/src/LabeledValue.js +50 -0
- package/build/esm/LabeledValue/src/LabeledValue.js.map +1 -0
- package/build/esm/index.js +1 -0
- package/build/esm/index.js.map +1 -1
- package/build/index.d.ts +23 -1
- package/package.json +5 -5
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { useField } from '@react-aria/label';
|
|
4
|
+
import { useThemeCheck, Field, Label } from '@danske/sapphire-react';
|
|
5
|
+
import styles from '@danske/sapphire-css/components/labeledValue/labeledValue.module.css';
|
|
6
|
+
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __defProps = Object.defineProperties;
|
|
9
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
10
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
11
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
13
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
14
|
+
var __spreadValues = (a, b) => {
|
|
15
|
+
for (var prop in b || (b = {}))
|
|
16
|
+
if (__hasOwnProp.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
if (__getOwnPropSymbols)
|
|
19
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
20
|
+
if (__propIsEnum.call(b, prop))
|
|
21
|
+
__defNormalProp(a, prop, b[prop]);
|
|
22
|
+
}
|
|
23
|
+
return a;
|
|
24
|
+
};
|
|
25
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
26
|
+
function LabeledValue(props) {
|
|
27
|
+
useThemeCheck();
|
|
28
|
+
const {
|
|
29
|
+
children,
|
|
30
|
+
contextualHelp,
|
|
31
|
+
label,
|
|
32
|
+
labelPlacement = "above",
|
|
33
|
+
size = "large"
|
|
34
|
+
} = props;
|
|
35
|
+
const { fieldProps } = useField({ label });
|
|
36
|
+
return /* @__PURE__ */ React.createElement(Field, __spreadProps(__spreadValues({}, fieldProps), {
|
|
37
|
+
labelPlacement,
|
|
38
|
+
size
|
|
39
|
+
}), /* @__PURE__ */ React.createElement(Field.Label, null, /* @__PURE__ */ React.createElement(Label, {
|
|
40
|
+
contextualHelp,
|
|
41
|
+
size
|
|
42
|
+
}, label)), /* @__PURE__ */ React.createElement(Field.Control, null, /* @__PURE__ */ React.createElement("div", {
|
|
43
|
+
className: clsx(styles["sapphire-labeled-value"], {
|
|
44
|
+
[styles["sapphire-labeled-value--medium"]]: size === "medium"
|
|
45
|
+
})
|
|
46
|
+
}, children)));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export { LabeledValue };
|
|
50
|
+
//# sourceMappingURL=LabeledValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LabeledValue.js","sources":["../../../../src/LabeledValue/src/LabeledValue.tsx"],"sourcesContent":["import React, { ReactNode } from 'react';\nimport clsx from 'clsx';\nimport { useField } from '@react-aria/label';\nimport type { DOMProps } from '@react-types/shared';\nimport {\n Field,\n Label,\n SapphireStyleProps,\n useThemeCheck,\n} from '@danske/sapphire-react';\nimport styles from '@danske/sapphire-css/components/labeledValue/labeledValue.module.css';\n\nexport interface LabeledValueProps extends DOMProps, SapphireStyleProps {\n children?: React.ReactNode;\n /**\n * A ContextualHelp element to place next to the label.\n */\n contextualHelp?: ReactNode;\n /**\n * The content to display as a label.\n */\n label: ReactNode;\n /**\n * Places the label either above (default) or on the left side of tags.\n * @default 'above'\n */\n labelPlacement?: 'above' | 'side';\n /**\n * @default 'large'\n */\n size?: 'large' | 'medium';\n}\n\nexport function LabeledValue(props: LabeledValueProps) {\n useThemeCheck();\n const {\n children,\n contextualHelp,\n label,\n labelPlacement = 'above',\n size = 'large',\n } = props;\n const { fieldProps } = useField({ label });\n\n return (\n <Field {...fieldProps} labelPlacement={labelPlacement} size={size}>\n <Field.Label>\n <Label contextualHelp={contextualHelp} size={size}>\n {label}\n </Label>\n </Field.Label>\n <Field.Control>\n <div\n className={clsx(styles['sapphire-labeled-value'], {\n [styles['sapphire-labeled-value--medium']]: size === 'medium',\n })}\n >\n {children}\n </div>\n </Field.Control>\n </Field>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAiCO,SAAA,YAAA,CAAsB,KAA0B,EAAA;AACrD,EAAA,aAAA,EAAA,CAAA;AACA,EAAM,MAAA;AAAA,IACJ,QAAA;AAAA,IACA,cAAA;AAAA,IACA,KAAA;AAAA,IACA,cAAiB,GAAA,OAAA;AAAA,IACjB,IAAO,GAAA,OAAA;AAAA,GACL,GAAA,KAAA,CAAA;AACJ,EAAM,MAAA,EAAE,UAAe,EAAA,GAAA,QAAA,CAAS,EAAE,KAAA,EAAA,CAAA,CAAA;AAElC,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,KAAD,EAAA,aAAA,CAAA,cAAA,CAAA,EAAA,EAAW,UAAX,CAAA,EAAA;AAAA,IAAuB,cAAA;AAAA,IAAgC,IAAA;AAAA,GAAA,CAAA,kBACpD,KAAA,CAAA,aAAA,CAAA,KAAA,CAAM,KAAP,EAAA,IAAA,sCACG,KAAD,EAAA;AAAA,IAAO,cAAA;AAAA,IAAgC,IAAA;AAAA,GAAA,EACpC,yBAGJ,KAAA,CAAA,aAAA,CAAA,KAAA,CAAM,OAAP,EAAA,IAAA,sCACG,KAAD,EAAA;AAAA,IACE,SAAA,EAAW,IAAK,CAAA,MAAA,CAAO,wBAA2B,CAAA,EAAA;AAAA,MAC/C,CAAA,MAAA,CAAO,oCAAoC,IAAS,KAAA,QAAA;AAAA,KAAA,CAAA;AAAA,GAGtD,EAAA,QAAA,CAAA,CAAA,CAAA,CAAA;AAAA;;;;"}
|
package/build/esm/index.js
CHANGED
|
@@ -23,5 +23,6 @@ export { AlertDialog } from './AlertDialog/src/AlertDialog.js';
|
|
|
23
23
|
export { NumberField } from './NumberField/src/NumberField.js';
|
|
24
24
|
export { TagGroup } from './Tag/src/TagGroup.js';
|
|
25
25
|
export { TagItem } from './Tag/src/TagItem.js';
|
|
26
|
+
export { LabeledValue } from './LabeledValue/src/LabeledValue.js';
|
|
26
27
|
export { useLocale } from '@react-aria/i18n';
|
|
27
28
|
//# sourceMappingURL=index.js.map
|
package/build/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/build/index.d.ts
CHANGED
|
@@ -968,4 +968,26 @@ interface TagItemProps<T> extends ItemProps<T> {
|
|
|
968
968
|
}
|
|
969
969
|
declare const TagItem: <T>(props: TagItemProps<T>) => JSX.Element;
|
|
970
970
|
|
|
971
|
-
|
|
971
|
+
interface LabeledValueProps extends DOMProps, SapphireStyleProps {
|
|
972
|
+
children?: React__default.ReactNode;
|
|
973
|
+
/**
|
|
974
|
+
* A ContextualHelp element to place next to the label.
|
|
975
|
+
*/
|
|
976
|
+
contextualHelp?: ReactNode;
|
|
977
|
+
/**
|
|
978
|
+
* The content to display as a label.
|
|
979
|
+
*/
|
|
980
|
+
label: ReactNode;
|
|
981
|
+
/**
|
|
982
|
+
* Places the label either above (default) or on the left side of tags.
|
|
983
|
+
* @default 'above'
|
|
984
|
+
*/
|
|
985
|
+
labelPlacement?: 'above' | 'side';
|
|
986
|
+
/**
|
|
987
|
+
* @default 'large'
|
|
988
|
+
*/
|
|
989
|
+
size?: 'large' | 'medium';
|
|
990
|
+
}
|
|
991
|
+
declare function LabeledValue(props: LabeledValueProps): React__default.JSX.Element;
|
|
992
|
+
|
|
993
|
+
export { _Accordion as Accordion, AlertDialog, Avatar, Calendar, CalendarView, DateField, DateFieldProps, DateRangeField, DateRangeFieldProps, FeedbackMessage, Fieldset, FieldsetProps, FileDropzone, FileDropzoneProps, FileTrigger, FileTriggerProps, FilterDropdown, LabeledValue, NotificationBadge, NotificationBadgeProps, NumberField, NumberFieldProps, NumberFieldRef, PredefinedDateRange, RangeCalendar, SapphireAccordionHeadingProps, SapphireAccordionItemProps, SapphireAccordionProps, SapphireAlertDialogProps, SapphireAvatarProps, SapphireCalendarProps, SapphireFeedbackMessageProps, SapphireFilterDropdownProps, SapphireRangeCalendarProps, SapphireSearchFieldProps, SapphireToggleButtonProps, SearchField, ShowToastFn, ShowToastOptions, Spinner, SpinnerProps, TagGroup, TagGroupProps, TagItem, ToastProvider, ToastProviderProps, ToggleButton, Typography, TypographyBodyProps, TypographyCaptionProps, TypographyHeadingProps, TypographySubheadingProps, isDateOutsideValidRange, isEndDateBeforeStartDate, useShowToast };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@danske/sapphire-react-lab",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.86.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"description": "Experimental React components of the Sapphire Design System from Danske Bank A/S",
|
|
6
6
|
"exports": {
|
|
@@ -25,18 +25,18 @@
|
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"@danske/sapphire-icons": "^2.1.0",
|
|
28
|
-
"@danske/sapphire-react": "^3.
|
|
28
|
+
"@danske/sapphire-react": "^3.34.3",
|
|
29
29
|
"react": ">=16.8.0",
|
|
30
30
|
"react-dom": ">=16.8.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@danske/sapphire-icons": "^2.1.0",
|
|
34
|
-
"@danske/sapphire-react": "^3.
|
|
34
|
+
"@danske/sapphire-react": "^3.34.3",
|
|
35
35
|
"@types/react-transition-group": "^4.4.5",
|
|
36
36
|
"cross-env": "^7.0.3"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@danske/sapphire-css": "^28.
|
|
39
|
+
"@danske/sapphire-css": "^28.4.0",
|
|
40
40
|
"@internationalized/date": "^3.5.2",
|
|
41
41
|
"@internationalized/string": "^3.2.1",
|
|
42
42
|
"@react-aria/accordion": "^3.0.0-alpha.29",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"clsx": "^1.1.1",
|
|
75
75
|
"react-transition-group": "^4.4.5"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "546502d6671ee7c2ef9802b577b78cd587ba110c"
|
|
78
78
|
}
|