@equinor/cpl-compact-autocomplete 0.0.6 → 0.0.8
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/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -17
- package/dist/index.mjs +4 -17
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -8,10 +8,10 @@ import * as styled_components from 'styled-components';
|
|
|
8
8
|
interface CompactAutocompleteProps<T> extends Omit<AutocompleteProps<T>, 'ref'> {
|
|
9
9
|
autocompleteRef?: ForwardedRef<HTMLDivElement>;
|
|
10
10
|
}
|
|
11
|
-
declare function CompactAutocomplete<T>({
|
|
11
|
+
declare function CompactAutocomplete<T>({ label, autocompleteRef, ...props }: CompactAutocompleteProps<T>): react_jsx_runtime.JSX.Element;
|
|
12
12
|
|
|
13
|
-
declare const CompactAutocompleteLabel: styled_components_dist_types.IStyledComponentBase<"web", styled_components.FastOmit<react.DetailedHTMLProps<react.
|
|
13
|
+
declare const CompactAutocompleteLabel: styled_components_dist_types.IStyledComponentBase<"web", styled_components.FastOmit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
|
|
14
14
|
|
|
15
|
-
declare const CompactAutocompleteWrapper: styled_components_dist_types.IStyledComponentBase<"web", styled_components.FastOmit<react.DetailedHTMLProps<react.
|
|
15
|
+
declare const CompactAutocompleteWrapper: styled_components_dist_types.IStyledComponentBase<"web", styled_components.FastOmit<react.DetailedHTMLProps<react.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, never>> & string;
|
|
16
16
|
|
|
17
17
|
export { CompactAutocomplete, CompactAutocompleteLabel, type CompactAutocompleteProps, CompactAutocompleteWrapper };
|
package/dist/index.d.ts
CHANGED
|
@@ -8,10 +8,10 @@ import * as styled_components from 'styled-components';
|
|
|
8
8
|
interface CompactAutocompleteProps<T> extends Omit<AutocompleteProps<T>, 'ref'> {
|
|
9
9
|
autocompleteRef?: ForwardedRef<HTMLDivElement>;
|
|
10
10
|
}
|
|
11
|
-
declare function CompactAutocomplete<T>({
|
|
11
|
+
declare function CompactAutocomplete<T>({ label, autocompleteRef, ...props }: CompactAutocompleteProps<T>): react_jsx_runtime.JSX.Element;
|
|
12
12
|
|
|
13
|
-
declare const CompactAutocompleteLabel: styled_components_dist_types.IStyledComponentBase<"web", styled_components.FastOmit<react.DetailedHTMLProps<react.
|
|
13
|
+
declare const CompactAutocompleteLabel: styled_components_dist_types.IStyledComponentBase<"web", styled_components.FastOmit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
|
|
14
14
|
|
|
15
|
-
declare const CompactAutocompleteWrapper: styled_components_dist_types.IStyledComponentBase<"web", styled_components.FastOmit<react.DetailedHTMLProps<react.
|
|
15
|
+
declare const CompactAutocompleteWrapper: styled_components_dist_types.IStyledComponentBase<"web", styled_components.FastOmit<react.DetailedHTMLProps<react.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, never>> & string;
|
|
16
16
|
|
|
17
17
|
export { CompactAutocomplete, CompactAutocompleteLabel, type CompactAutocompleteProps, CompactAutocompleteWrapper };
|
package/dist/index.js
CHANGED
|
@@ -71,7 +71,7 @@ var import_styled_components3 = __toESM(require("styled-components"));
|
|
|
71
71
|
// src/CompactAutocompleteLabel.tsx
|
|
72
72
|
var import_eds_tokens = require("@equinor/eds-tokens");
|
|
73
73
|
var import_styled_components = __toESM(require("styled-components"));
|
|
74
|
-
var CompactAutocompleteLabel = import_styled_components.default.
|
|
74
|
+
var CompactAutocompleteLabel = import_styled_components.default.span`
|
|
75
75
|
align-self: stretch;
|
|
76
76
|
|
|
77
77
|
display: flex;
|
|
@@ -93,7 +93,7 @@ var CompactAutocompleteLabel = import_styled_components.default.label`
|
|
|
93
93
|
|
|
94
94
|
// src/CompactAutocompleteWrapper.tsx
|
|
95
95
|
var import_styled_components2 = __toESM(require("styled-components"));
|
|
96
|
-
var CompactAutocompleteWrapper = import_styled_components2.default.
|
|
96
|
+
var CompactAutocompleteWrapper = import_styled_components2.default.label`
|
|
97
97
|
display: flex;
|
|
98
98
|
align-items: center;
|
|
99
99
|
|
|
@@ -106,16 +106,12 @@ var CompactAutocompleteWrapper = import_styled_components2.default.div`
|
|
|
106
106
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
107
107
|
function CompactAutocomplete(_a) {
|
|
108
108
|
var _b = _a, {
|
|
109
|
-
id,
|
|
110
109
|
label,
|
|
111
110
|
autocompleteRef
|
|
112
111
|
} = _b, props = __objRest(_b, [
|
|
113
|
-
"id",
|
|
114
112
|
"label",
|
|
115
113
|
"autocompleteRef"
|
|
116
114
|
]);
|
|
117
|
-
const autocompleteId = (0, import_react.useMemo)(() => id != null ? id : crypto.randomUUID(), [id]);
|
|
118
|
-
const labelId = (0, import_react.useMemo)(() => crypto.randomUUID(), []);
|
|
119
115
|
const { multiple, optionLabel, selectedOptions } = props;
|
|
120
116
|
const placeholder = (0, import_react.useMemo)(() => {
|
|
121
117
|
if (!multiple) {
|
|
@@ -125,17 +121,8 @@ function CompactAutocomplete(_a) {
|
|
|
125
121
|
return selectedLabels == null ? void 0 : selectedLabels.join(", ");
|
|
126
122
|
}, [multiple, optionLabel, selectedOptions]);
|
|
127
123
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(CompactAutocompleteWrapper, { children: [
|
|
128
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CompactAutocompleteLabel, {
|
|
129
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CPLAutocompleteWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
130
|
-
import_eds_core_react.Autocomplete,
|
|
131
|
-
__spreadValues({
|
|
132
|
-
id: autocompleteId,
|
|
133
|
-
label: null,
|
|
134
|
-
"aria-labelledby": labelId,
|
|
135
|
-
placeholder,
|
|
136
|
-
ref: autocompleteRef
|
|
137
|
-
}, props)
|
|
138
|
-
) })
|
|
124
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CompactAutocompleteLabel, { children: label }),
|
|
125
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CPLAutocompleteWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_eds_core_react.Autocomplete, __spreadValues({ label: null, placeholder, ref: autocompleteRef }, props)) })
|
|
139
126
|
] });
|
|
140
127
|
}
|
|
141
128
|
var CPLAutocompleteWrapper = import_styled_components3.default.div`
|
package/dist/index.mjs
CHANGED
|
@@ -36,7 +36,7 @@ import styled3 from "styled-components";
|
|
|
36
36
|
// src/CompactAutocompleteLabel.tsx
|
|
37
37
|
import { tokens } from "@equinor/eds-tokens";
|
|
38
38
|
import styled from "styled-components";
|
|
39
|
-
var CompactAutocompleteLabel = styled.
|
|
39
|
+
var CompactAutocompleteLabel = styled.span`
|
|
40
40
|
align-self: stretch;
|
|
41
41
|
|
|
42
42
|
display: flex;
|
|
@@ -58,7 +58,7 @@ var CompactAutocompleteLabel = styled.label`
|
|
|
58
58
|
|
|
59
59
|
// src/CompactAutocompleteWrapper.tsx
|
|
60
60
|
import styled2 from "styled-components";
|
|
61
|
-
var CompactAutocompleteWrapper = styled2.
|
|
61
|
+
var CompactAutocompleteWrapper = styled2.label`
|
|
62
62
|
display: flex;
|
|
63
63
|
align-items: center;
|
|
64
64
|
|
|
@@ -71,16 +71,12 @@ var CompactAutocompleteWrapper = styled2.div`
|
|
|
71
71
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
72
72
|
function CompactAutocomplete(_a) {
|
|
73
73
|
var _b = _a, {
|
|
74
|
-
id,
|
|
75
74
|
label,
|
|
76
75
|
autocompleteRef
|
|
77
76
|
} = _b, props = __objRest(_b, [
|
|
78
|
-
"id",
|
|
79
77
|
"label",
|
|
80
78
|
"autocompleteRef"
|
|
81
79
|
]);
|
|
82
|
-
const autocompleteId = useMemo(() => id != null ? id : crypto.randomUUID(), [id]);
|
|
83
|
-
const labelId = useMemo(() => crypto.randomUUID(), []);
|
|
84
80
|
const { multiple, optionLabel, selectedOptions } = props;
|
|
85
81
|
const placeholder = useMemo(() => {
|
|
86
82
|
if (!multiple) {
|
|
@@ -90,17 +86,8 @@ function CompactAutocomplete(_a) {
|
|
|
90
86
|
return selectedLabels == null ? void 0 : selectedLabels.join(", ");
|
|
91
87
|
}, [multiple, optionLabel, selectedOptions]);
|
|
92
88
|
return /* @__PURE__ */ jsxs(CompactAutocompleteWrapper, { children: [
|
|
93
|
-
/* @__PURE__ */ jsx(CompactAutocompleteLabel, {
|
|
94
|
-
/* @__PURE__ */ jsx(CPLAutocompleteWrapper, { children: /* @__PURE__ */ jsx(
|
|
95
|
-
Autocomplete,
|
|
96
|
-
__spreadValues({
|
|
97
|
-
id: autocompleteId,
|
|
98
|
-
label: null,
|
|
99
|
-
"aria-labelledby": labelId,
|
|
100
|
-
placeholder,
|
|
101
|
-
ref: autocompleteRef
|
|
102
|
-
}, props)
|
|
103
|
-
) })
|
|
89
|
+
/* @__PURE__ */ jsx(CompactAutocompleteLabel, { children: label }),
|
|
90
|
+
/* @__PURE__ */ jsx(CPLAutocompleteWrapper, { children: /* @__PURE__ */ jsx(Autocomplete, __spreadValues({ label: null, placeholder, ref: autocompleteRef }, props)) })
|
|
104
91
|
] });
|
|
105
92
|
}
|
|
106
93
|
var CPLAutocompleteWrapper = styled3.div`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/cpl-compact-autocomplete",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@equinor/eds-core-react": "^0.42.5",
|
|
17
|
-
"@storybook/react": "^9.
|
|
17
|
+
"@storybook/react": "^9.1.1",
|
|
18
18
|
"@types/react": "^18.3.18",
|
|
19
19
|
"@types/react-dom": "^18.3.5",
|
|
20
20
|
"@types/styled-components": "^5.1.34",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"react-dom": "^18.2.0",
|
|
24
24
|
"styled-components": "^6.1.14",
|
|
25
25
|
"tsup": "^8.3.6",
|
|
26
|
-
"@equinor/cpl-eslint-config": "0.0.
|
|
26
|
+
"@equinor/cpl-eslint-config": "0.0.9",
|
|
27
27
|
"@equinor/cpl-typescript-config": "0.0.2"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|