@phis/ui 0.6.3 → 0.6.4

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.
@@ -3,12 +3,26 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { Segmented } from "antd";
4
4
  import { PHI_THEME_GRADIENT_CSS_VARS } from "../../theme/phi-theme-gradients";
5
5
  import { PhiLabeledControl, usePhiControlLabel } from "./phi-labeled-control";
6
+ import { PhiTruncatedHoverText } from "./phi-truncated-hover-text";
7
+ /* The segment's own box cuts its words: the hover text measures this element and nothing around it. */
8
+ const PHI_SEGMENT_LABEL_STYLE = {
9
+ display: "block",
10
+ overflow: "hidden",
11
+ textOverflow: "ellipsis",
12
+ whiteSpace: "nowrap",
13
+ };
6
14
  export function PhiSegmentedControl({ value, label, options, disabled, readOnly, block, size, gradient, onFocus, onBlur, onChange, }) {
7
15
  const { labelId, labelledBy } = usePhiControlLabel(label);
8
16
  const gradientVars = gradient ? PHI_THEME_GRADIENT_CSS_VARS[gradient] : null;
9
17
  const control = (_jsx(Segmented, { "aria-labelledby": labelledBy, block: block, value: value, disabled: disabled || readOnly || !onChange, options: options.map((option) => ({
10
18
  value: option.value,
11
- label: option.label,
19
+ /*
20
+ * A segment too narrow for its words shows them whole in the house tooltip, and only then. A
21
+ * segment with a description says that instead, which is more than its label.
22
+ */
23
+ label: option.description
24
+ ? option.label
25
+ : (_jsx(PhiTruncatedHoverText, { title: option.label, children: _jsx("span", { style: PHI_SEGMENT_LABEL_STYLE, children: option.label }) })),
12
26
  disabled: option.disabled,
13
27
  /*
14
28
  * No browser tooltip: left out, the Segmented writes the label into `title` and every segment
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phis/ui",
3
- "version": "0.6.3",
3
+ "version": "0.6.4",
4
4
  "license": "Apache-2.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -155,7 +155,9 @@ async function mutateInstallation(request) {
155
155
  }
156
156
  throw new PhiTableProviderError("action-not-supported", `Unsupported Auth installation action "${request.actionKey}".`);
157
157
  }
158
- const resources = PHI_AUTH_RUNTIME_DATA_PROVIDER_DESCRIPTORS[0].resources ?? [];
158
+ // Its own descriptor by key, not by position: a Provider added to the list must not take its place.
159
+ const resources = PHI_AUTH_RUNTIME_DATA_PROVIDER_DESCRIPTORS
160
+ .find((descriptor) => descriptor.key === PHI_AUTH_RUNTIME_DATA_PROVIDER_KEYS.installations)?.resources ?? [];
159
161
  export const PhiAuthInstallationsTableProviderClient = createPhiTableProviderClient({
160
162
  key: PHI_AUTH_RUNTIME_DATA_PROVIDER_KEYS.installations,
161
163
  resources,
@@ -7,6 +7,9 @@ import { PhiTableProviderClient, } from "../../../../components/widgets/client/s
7
7
  import { readPhiTableProviderResponse, } from "../../../../components/widgets/client/shared/phi-table-provider-response";
8
8
  import { PHI_EDITOR_RUNTIME_DATA_PROVIDER_DESCRIPTORS } from "../data-providers";
9
9
  import { PHI_EDITOR_RELEASES_DATA_PROVIDER_KEY, PHI_EDITOR_RELEASES_RESOURCE_KEY } from "../ids";
10
+ // Its own descriptor by key, not by position: a Provider added to the list must not take its place.
11
+ const PHI_EDITOR_RELEASES_RESOURCES = PHI_EDITOR_RUNTIME_DATA_PROVIDER_DESCRIPTORS
12
+ .find((descriptor) => descriptor.key === PHI_EDITOR_RELEASES_DATA_PROVIDER_KEY)?.resources ?? [];
10
13
  const RELEASES_API_PATH = "/api/site/editor/releases";
11
14
  const RESPONSE_OPTIONS = { subject: "Releases" };
12
15
  function readText(value) {
@@ -174,7 +177,7 @@ export function PhiEditorReleasesTableProviderClient({ children }) {
174
177
  }, []);
175
178
  const registration = useMemo(() => ({
176
179
  key: PHI_EDITOR_RELEASES_DATA_PROVIDER_KEY,
177
- resources: PHI_EDITOR_RUNTIME_DATA_PROVIDER_DESCRIPTORS[0].resources,
180
+ resources: PHI_EDITOR_RELEASES_RESOURCES,
178
181
  query,
179
182
  mutate,
180
183
  }), [mutate, query]);
@@ -63,7 +63,9 @@ async function readRecord({ resourceKey, rowIdentity, signal, }) {
63
63
  }
64
64
  return payload.record;
65
65
  }
66
- const resources = PHI_OBSERVABILITY_RUNTIME_DATA_PROVIDER_DESCRIPTORS[0].resources ?? [];
66
+ // Its own descriptor by key, not by position: a Provider added to the list must not take its place.
67
+ const resources = PHI_OBSERVABILITY_RUNTIME_DATA_PROVIDER_DESCRIPTORS
68
+ .find((descriptor) => descriptor.key === PHI_OBSERVABILITY_RUNTIME_DATA_PROVIDER_KEYS.table)?.resources ?? [];
67
69
  export const PhiObservabilityTableProviderClient = createPhiTableProviderClient({
68
70
  key: PHI_OBSERVABILITY_RUNTIME_DATA_PROVIDER_KEYS.table,
69
71
  resources,
@@ -165,7 +165,9 @@ async function mutateUser(request) {
165
165
  }
166
166
  return { status: "accepted", invalidation: "view" };
167
167
  }
168
- const resources = PHI_USER_MANAGEMENT_RUNTIME_DATA_PROVIDER_DESCRIPTORS[0].resources ?? [];
168
+ // Its own descriptor by key: the list holds the Module's other Providers too, in no promised order.
169
+ const resources = PHI_USER_MANAGEMENT_RUNTIME_DATA_PROVIDER_DESCRIPTORS
170
+ .find((descriptor) => descriptor.key === PHI_USER_MANAGEMENT_RUNTIME_DATA_PROVIDER_KEYS.table)?.resources ?? [];
169
171
  export const PhiUserManagementTableProviderClient = createPhiTableProviderClient({
170
172
  key: PHI_USER_MANAGEMENT_RUNTIME_DATA_PROVIDER_KEYS.table,
171
173
  resources,