@jobber/components 9.12.2 → 9.13.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/Combobox/Combobox.contentSlots.d.ts +4 -4
- package/dist/Combobox/Combobox.d.ts +11 -11
- package/dist/Combobox/Combobox.footer.d.ts +2 -2
- package/dist/Combobox/Combobox.items.d.ts +8 -8
- package/dist/Combobox/index.cjs +1 -0
- package/dist/Combobox/index.mjs +1 -0
- package/dist/Combobox-cjs.js +5 -24
- package/dist/Combobox-es.js +6 -25
- package/dist/FieldDescription-es.js +1 -1
- package/dist/InputNumber/InputNumber.d.ts +1 -5
- package/dist/InputNumber/InputNumber.slots.d.ts +11 -0
- package/dist/InputNumber/index.cjs +3 -2
- package/dist/InputNumber/index.mjs +3 -2
- package/dist/InputNumber-cjs.js +147 -22
- package/dist/InputNumber-es.js +149 -24
- package/dist/NumberFieldInput-es.js +1 -1
- package/dist/Select-es.js +1 -1
- package/dist/docs/Combobox/Combobox.md +12 -0
- package/dist/docs/InputNumber/InputNumber.md +131 -17
- package/dist/index.cjs +1 -0
- package/dist/index.mjs +1 -0
- package/dist/slotSystem-cjs.js +30 -0
- package/dist/slotSystem-es.js +28 -0
- package/dist/styles.css +12 -3
- package/dist/unstyledPrimitives/index.mjs +1 -1
- package/dist/utils/slotSystem.d.ts +12 -0
- package/package.json +2 -2
- package/dist/Combobox/Combobox.slotFactory.d.ts +0 -7
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type SlotComponent } from "../utils/slotSystem";
|
|
2
2
|
export type ComboboxContentSlotName = "empty" | "actions" | "footer" | "loading";
|
|
3
|
-
export type ComboboxContentSlotComponent<Props, Slot extends ComboboxContentSlotName = ComboboxContentSlotName> =
|
|
4
|
-
export declare const assignComboboxContentSlot: <Props, Slot extends ComboboxContentSlotName>(component: import("react").FC<Props>, slot: Slot) =>
|
|
5
|
-
export declare const isComboboxContentSlotElement: <Props = unknown>(child: React.ReactNode) => child is import("react").ReactElement<Props,
|
|
3
|
+
export type ComboboxContentSlotComponent<Props, Slot extends ComboboxContentSlotName = ComboboxContentSlotName> = SlotComponent<Props, "comboboxContentSlot", Slot>;
|
|
4
|
+
export declare const assignComboboxContentSlot: <Props, Slot extends ComboboxContentSlotName>(component: import("react").FC<Props>, slot: Slot) => SlotComponent<Props, "comboboxContentSlot", Slot>;
|
|
5
|
+
export declare const isComboboxContentSlotElement: <Props = unknown>(child: React.ReactNode) => child is import("react").ReactElement<Props, SlotComponent<Props, "comboboxContentSlot", ComboboxContentSlotName>>;
|
|
@@ -39,12 +39,12 @@ declare const Combobox: typeof ComboboxRoot & {
|
|
|
39
39
|
Content: typeof ComboboxContent;
|
|
40
40
|
List: typeof ComboboxList;
|
|
41
41
|
Item: typeof ComboboxItem;
|
|
42
|
-
ItemDescription: import("
|
|
43
|
-
ItemLabel: import("
|
|
44
|
-
ItemPrefix: import("
|
|
45
|
-
ItemSuffix: import("
|
|
46
|
-
ActionPrefix: import("
|
|
47
|
-
ActionLabel: import("
|
|
42
|
+
ItemDescription: import("../utils/slotSystem").SlotComponent<import("./Combobox.types").ComboboxItemDescriptionProps, "comboboxItemSlot", "label" | "prefix" | "suffix" | "description">;
|
|
43
|
+
ItemLabel: import("../utils/slotSystem").SlotComponent<import("./Combobox.types").ComboboxItemLabelProps, "comboboxItemSlot", "label" | "prefix" | "suffix" | "description">;
|
|
44
|
+
ItemPrefix: import("../utils/slotSystem").SlotComponent<import("./Combobox.types").ComboboxItemPrefixProps, "comboboxItemSlot", "label" | "prefix" | "suffix" | "description">;
|
|
45
|
+
ItemSuffix: import("../utils/slotSystem").SlotComponent<import("./Combobox.types").ComboboxItemSuffixProps, "comboboxItemSlot", "label" | "prefix" | "suffix" | "description">;
|
|
46
|
+
ActionPrefix: import("../utils/slotSystem").SlotComponent<import("./Combobox.types").ComboboxActionPrefixProps, "comboboxActionSlot", "label" | "prefix">;
|
|
47
|
+
ActionLabel: import("../utils/slotSystem").SlotComponent<import("./Combobox.types").ComboboxActionLabelProps, "comboboxActionSlot", "label" | "prefix">;
|
|
48
48
|
Row: typeof ComboboxRow;
|
|
49
49
|
Collection: typeof ComboboxCollection;
|
|
50
50
|
Chips: typeof ComboboxChips;
|
|
@@ -54,12 +54,12 @@ declare const Combobox: typeof ComboboxRoot & {
|
|
|
54
54
|
GroupLabel: typeof ComboboxGroupLabel;
|
|
55
55
|
Separator: typeof ComboboxSeparator;
|
|
56
56
|
Status: typeof ComboboxPrimitive.Status;
|
|
57
|
-
Empty: import("
|
|
58
|
-
Loading: import("
|
|
59
|
-
Actions: import("
|
|
57
|
+
Empty: import("../utils/slotSystem").SlotComponent<ComboboxEmptyProps, "comboboxContentSlot", "empty">;
|
|
58
|
+
Loading: import("../utils/slotSystem").SlotComponent<ComboboxLoadingProps, "comboboxContentSlot", "loading">;
|
|
59
|
+
Actions: import("../utils/slotSystem").SlotComponent<import("./Combobox.types").ComboboxActionsProps, "comboboxContentSlot", "actions">;
|
|
60
60
|
Action: typeof ComboboxAction;
|
|
61
|
-
Footer: import("
|
|
62
|
-
SelectionFooter: import("
|
|
61
|
+
Footer: import("../utils/slotSystem").SlotComponent<import("./Combobox.types").ComboboxFooterProps<unknown>, "comboboxContentSlot", "footer">;
|
|
62
|
+
SelectionFooter: import("../utils/slotSystem").SlotComponent<import("./Combobox.types").ComboboxSelectionFooterProps, "comboboxContentSlot", "footer">;
|
|
63
63
|
SelectedCount: typeof ComboboxSelectedCount;
|
|
64
64
|
ClearSelection: typeof ComboboxClearSelection;
|
|
65
65
|
SelectAll: typeof ComboboxSelectAll;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { ComboboxClearSelectionProps, ComboboxFooterProps, ComboboxSelectAllProps, ComboboxSelectedCountProps, ComboboxSelectionFooterProps } from "./Combobox.types";
|
|
3
|
-
export declare const ComboboxFooter: import("
|
|
3
|
+
export declare const ComboboxFooter: import("../utils/slotSystem").SlotComponent<ComboboxFooterProps<unknown>, "comboboxContentSlot", "footer">;
|
|
4
4
|
export declare function ComboboxSelectedCount({ children, className, }: ComboboxSelectedCountProps): React.JSX.Element;
|
|
5
|
-
export declare const ComboboxSelectionFooter: import("
|
|
5
|
+
export declare const ComboboxSelectionFooter: import("../utils/slotSystem").SlotComponent<ComboboxSelectionFooterProps, "comboboxContentSlot", "footer">;
|
|
6
6
|
export declare function ComboboxClearSelection({ children, label, tabIndex, ...clearProps }: ComboboxClearSelectionProps): React.JSX.Element;
|
|
7
7
|
export declare function ComboboxSelectAll({ children, label, ...buttonProps }: ComboboxSelectAllProps): React.JSX.Element | null;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { ComboboxActionLabelProps, ComboboxActionPrefixProps, ComboboxActionProps, ComboboxActionsProps, ComboboxCollectionProps, ComboboxGroupLabelProps, ComboboxGroupProps, ComboboxItemDescriptionProps, ComboboxItemLabelProps, ComboboxItemPrefixProps, ComboboxItemProps, ComboboxItemSuffixProps, ComboboxListProps, ComboboxRowProps, ComboboxSeparatorProps } from "./Combobox.types";
|
|
3
|
-
import { type
|
|
3
|
+
import { type SlotComponent } from "../utils/slotSystem";
|
|
4
4
|
export declare function ComboboxList({ className, ...listProps }: ComboboxListProps): React.JSX.Element;
|
|
5
5
|
export declare function ComboboxItem({ children, ...itemProps }: ComboboxItemProps): React.JSX.Element;
|
|
6
|
-
declare const ComboboxItemPrefixComponent:
|
|
6
|
+
declare const ComboboxItemPrefixComponent: SlotComponent<ComboboxItemPrefixProps, "comboboxItemSlot", "label" | "prefix" | "suffix" | "description">;
|
|
7
7
|
export { ComboboxItemPrefixComponent as ComboboxItemPrefix };
|
|
8
|
-
declare const ComboboxItemLabelComponent:
|
|
8
|
+
declare const ComboboxItemLabelComponent: SlotComponent<ComboboxItemLabelProps, "comboboxItemSlot", "label" | "prefix" | "suffix" | "description">;
|
|
9
9
|
export { ComboboxItemLabelComponent as ComboboxItemLabel };
|
|
10
|
-
declare const ComboboxItemDescriptionComponent:
|
|
10
|
+
declare const ComboboxItemDescriptionComponent: SlotComponent<ComboboxItemDescriptionProps, "comboboxItemSlot", "label" | "prefix" | "suffix" | "description">;
|
|
11
11
|
export { ComboboxItemDescriptionComponent as ComboboxItemDescription };
|
|
12
|
-
declare const ComboboxItemSuffixComponent:
|
|
12
|
+
declare const ComboboxItemSuffixComponent: SlotComponent<ComboboxItemSuffixProps, "comboboxItemSlot", "label" | "prefix" | "suffix" | "description">;
|
|
13
13
|
export { ComboboxItemSuffixComponent as ComboboxItemSuffix };
|
|
14
|
-
declare const ComboboxActionPrefixComponent:
|
|
14
|
+
declare const ComboboxActionPrefixComponent: SlotComponent<ComboboxActionPrefixProps, "comboboxActionSlot", "label" | "prefix">;
|
|
15
15
|
export { ComboboxActionPrefixComponent as ComboboxActionPrefix };
|
|
16
|
-
declare const ComboboxActionLabelComponent:
|
|
16
|
+
declare const ComboboxActionLabelComponent: SlotComponent<ComboboxActionLabelProps, "comboboxActionSlot", "label" | "prefix">;
|
|
17
17
|
export { ComboboxActionLabelComponent as ComboboxActionLabel };
|
|
18
18
|
export declare function ComboboxRow(props: ComboboxRowProps): React.JSX.Element;
|
|
19
19
|
export declare function ComboboxCollection(props: ComboboxCollectionProps): React.JSX.Element;
|
|
20
20
|
export declare function ComboboxGroup(props: ComboboxGroupProps): React.JSX.Element;
|
|
21
21
|
export declare function ComboboxGroupLabel(props: ComboboxGroupLabelProps): React.JSX.Element;
|
|
22
22
|
export declare function ComboboxSeparator(props: ComboboxSeparatorProps): React.JSX.Element;
|
|
23
|
-
declare const ComboboxActionsComponent:
|
|
23
|
+
declare const ComboboxActionsComponent: SlotComponent<ComboboxActionsProps, "comboboxContentSlot", "actions">;
|
|
24
24
|
export { ComboboxActionsComponent as ComboboxActions };
|
|
25
25
|
export declare function ComboboxAction({ children, className, onClick, ...buttonProps }: ComboboxActionProps): React.JSX.Element;
|
package/dist/Combobox/index.cjs
CHANGED
|
@@ -4,6 +4,7 @@ var Combobox = require('../Combobox-cjs.js');
|
|
|
4
4
|
require('../tslib.es6-cjs.js');
|
|
5
5
|
require('react');
|
|
6
6
|
require('classnames');
|
|
7
|
+
require('../slotSystem-cjs.js');
|
|
7
8
|
require('../useAtlantisI18n-cjs.js');
|
|
8
9
|
require('../AtlantisContext-cjs.js');
|
|
9
10
|
require('../Button-cjs.js');
|
package/dist/Combobox/index.mjs
CHANGED
package/dist/Combobox-cjs.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var tslib_es6 = require('./tslib.es6-cjs.js');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var classnames = require('classnames');
|
|
6
|
+
var slotSystem = require('./slotSystem-cjs.js');
|
|
6
7
|
var useAtlantisI18n = require('./useAtlantisI18n-cjs.js');
|
|
7
8
|
var AtlantisContext = require('./AtlantisContext-cjs.js');
|
|
8
9
|
var Button = require('./Button-cjs.js');
|
|
@@ -142,27 +143,7 @@ function useComboboxContext() {
|
|
|
142
143
|
return context;
|
|
143
144
|
}
|
|
144
145
|
|
|
145
|
-
|
|
146
|
-
function assignSlot(component, slot) {
|
|
147
|
-
return Object.assign(component, {
|
|
148
|
-
[markerKey]: slot,
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
function createSlot(slot) {
|
|
152
|
-
function ComboboxSlot(props) {
|
|
153
|
-
return null;
|
|
154
|
-
}
|
|
155
|
-
return assignSlot(ComboboxSlot, slot);
|
|
156
|
-
}
|
|
157
|
-
function isSlotElement(child) {
|
|
158
|
-
return (React.isValidElement(child) &&
|
|
159
|
-
typeof child.type !== "string" &&
|
|
160
|
-
markerKey in child.type);
|
|
161
|
-
}
|
|
162
|
-
return { assignSlot, createSlot, isSlotElement };
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
const comboboxContentSlotSystem = createComboboxSlotSystem("comboboxContentSlot");
|
|
146
|
+
const comboboxContentSlotSystem = slotSystem.createSlotSystem("comboboxContentSlot");
|
|
166
147
|
const assignComboboxContentSlot = comboboxContentSlotSystem.assignSlot;
|
|
167
148
|
const isComboboxContentSlotElement = comboboxContentSlotSystem.isSlotElement;
|
|
168
149
|
|
|
@@ -322,8 +303,8 @@ function getFallbackChildren(children) {
|
|
|
322
303
|
return children[0];
|
|
323
304
|
return children;
|
|
324
305
|
}
|
|
325
|
-
const comboboxItemSlotSystem =
|
|
326
|
-
const comboboxActionSlotSystem =
|
|
306
|
+
const comboboxItemSlotSystem = slotSystem.createSlotSystem("comboboxItemSlot");
|
|
307
|
+
const comboboxActionSlotSystem = slotSystem.createSlotSystem("comboboxActionSlot");
|
|
327
308
|
const createComboboxItemSlot = comboboxItemSlotSystem.createSlot;
|
|
328
309
|
const createComboboxActionSlot = comboboxActionSlotSystem.createSlot;
|
|
329
310
|
function isComboboxItemSlotElement(child) {
|
|
@@ -530,7 +511,7 @@ function ComboboxRoot(_a) {
|
|
|
530
511
|
React.createElement(ComboboxContext.Provider, { value: contextValue },
|
|
531
512
|
React.createElement(ComboboxPrimitive.ComboboxRoot, Object.assign({}, rootProps, { disabled: disabled, modal: modal !== null && modal !== void 0 ? modal : responsive.defaultModal, multiple: multiple, readOnly: readOnly }),
|
|
532
513
|
children,
|
|
533
|
-
description && (React.createElement(ComboboxDescription, null, description)),
|
|
514
|
+
description && !error && (React.createElement(ComboboxDescription, null, description)),
|
|
534
515
|
error && React.createElement(ComboboxError, null, error)))));
|
|
535
516
|
}
|
|
536
517
|
function ComboboxRecipeLabel({ children, visuallyHidden, }) {
|
package/dist/Combobox-es.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { _ as __rest } from './tslib.es6-es.js';
|
|
2
2
|
import React__default, { useState, useEffect } from 'react';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
|
+
import { c as createSlotSystem } from './slotSystem-es.js';
|
|
4
5
|
import { d as defineMessages, u as useAtlantisI18n } from './useAtlantisI18n-es.js';
|
|
5
6
|
import { u as useAtlantisContext } from './AtlantisContext-es.js';
|
|
6
7
|
import { B as Button } from './Button-es.js';
|
|
@@ -11,7 +12,7 @@ import { I as Icon } from './Icon-es.js';
|
|
|
11
12
|
import { m as mergeClassName } from './mergeClassName-es.js';
|
|
12
13
|
import { G as Glimmer } from './Glimmer-es.js';
|
|
13
14
|
import { H as HelperText } from './HelperText-es.js';
|
|
14
|
-
import {
|
|
15
|
+
import { c as FieldRoot, F as FieldLabel, a as FieldDescription, b as FieldError } from './FieldDescription-es.js';
|
|
15
16
|
|
|
16
17
|
function getWindowDimensions() {
|
|
17
18
|
if (!(globalThis === null || globalThis === void 0 ? void 0 : globalThis.document)) {
|
|
@@ -140,27 +141,7 @@ function useComboboxContext() {
|
|
|
140
141
|
return context;
|
|
141
142
|
}
|
|
142
143
|
|
|
143
|
-
|
|
144
|
-
function assignSlot(component, slot) {
|
|
145
|
-
return Object.assign(component, {
|
|
146
|
-
[markerKey]: slot,
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
function createSlot(slot) {
|
|
150
|
-
function ComboboxSlot(props) {
|
|
151
|
-
return null;
|
|
152
|
-
}
|
|
153
|
-
return assignSlot(ComboboxSlot, slot);
|
|
154
|
-
}
|
|
155
|
-
function isSlotElement(child) {
|
|
156
|
-
return (React__default.isValidElement(child) &&
|
|
157
|
-
typeof child.type !== "string" &&
|
|
158
|
-
markerKey in child.type);
|
|
159
|
-
}
|
|
160
|
-
return { assignSlot, createSlot, isSlotElement };
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
const comboboxContentSlotSystem = createComboboxSlotSystem("comboboxContentSlot");
|
|
144
|
+
const comboboxContentSlotSystem = createSlotSystem("comboboxContentSlot");
|
|
164
145
|
const assignComboboxContentSlot = comboboxContentSlotSystem.assignSlot;
|
|
165
146
|
const isComboboxContentSlotElement = comboboxContentSlotSystem.isSlotElement;
|
|
166
147
|
|
|
@@ -320,8 +301,8 @@ function getFallbackChildren(children) {
|
|
|
320
301
|
return children[0];
|
|
321
302
|
return children;
|
|
322
303
|
}
|
|
323
|
-
const comboboxItemSlotSystem =
|
|
324
|
-
const comboboxActionSlotSystem =
|
|
304
|
+
const comboboxItemSlotSystem = createSlotSystem("comboboxItemSlot");
|
|
305
|
+
const comboboxActionSlotSystem = createSlotSystem("comboboxActionSlot");
|
|
325
306
|
const createComboboxItemSlot = comboboxItemSlotSystem.createSlot;
|
|
326
307
|
const createComboboxActionSlot = comboboxActionSlotSystem.createSlot;
|
|
327
308
|
function isComboboxItemSlotElement(child) {
|
|
@@ -528,7 +509,7 @@ function ComboboxRoot(_a) {
|
|
|
528
509
|
React__default.createElement(ComboboxContext.Provider, { value: contextValue },
|
|
529
510
|
React__default.createElement(ComboboxRoot$1, Object.assign({}, rootProps, { disabled: disabled, modal: modal !== null && modal !== void 0 ? modal : responsive.defaultModal, multiple: multiple, readOnly: readOnly }),
|
|
530
511
|
children,
|
|
531
|
-
description && (React__default.createElement(ComboboxDescription, null, description)),
|
|
512
|
+
description && !error && (React__default.createElement(ComboboxDescription, null, description)),
|
|
532
513
|
error && React__default.createElement(ComboboxError, null, error)))));
|
|
533
514
|
}
|
|
534
515
|
function ComboboxRecipeLabel({ children, visuallyHidden, }) {
|
|
@@ -856,4 +856,4 @@ const FieldDescription = /*#__PURE__*/React.forwardRef(function FieldDescription
|
|
|
856
856
|
});
|
|
857
857
|
if (process.env.NODE_ENV !== "production") FieldDescription.displayName = "FieldDescription";
|
|
858
858
|
|
|
859
|
-
export {
|
|
859
|
+
export { FieldLabel as F, FieldDescription as a, FieldError as b, FieldRoot as c };
|
|
@@ -51,11 +51,7 @@ declare function InputNumberAffixCompound({ variation, label, icon, onClick, ari
|
|
|
51
51
|
declare namespace InputNumberAffixCompound {
|
|
52
52
|
var displayName: string;
|
|
53
53
|
}
|
|
54
|
-
/**
|
|
55
|
-
* Sugar layer: composes the parts from props. This is the same composition a
|
|
56
|
-
* consumer would write by hand with `<InputNumber.Wrapper>` and the
|
|
57
|
-
* parts — to customize a single piece, copy this tree and swap that part.
|
|
58
|
-
*/
|
|
54
|
+
/** Sugar layer: hands the parts its props describe to `Wrapper`, the same path a consumer takes. */
|
|
59
55
|
declare function InputNumber({ ref, ...props }: InputNumberProps & {
|
|
60
56
|
readonly ref?: Ref<InputNumberRef>;
|
|
61
57
|
}): React.JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type SlotComponent } from "../utils/slotSystem";
|
|
2
|
+
declare const CONTENT_SLOT_NAMES: readonly ["label", "affix", "stepper", "loading", "description", "error"];
|
|
3
|
+
declare const STRUCTURAL_SLOT_NAMES: readonly ["group", "footer"];
|
|
4
|
+
export type InputNumberContentSlotName = (typeof CONTENT_SLOT_NAMES)[number];
|
|
5
|
+
export type InputNumberStructuralSlotName = (typeof STRUCTURAL_SLOT_NAMES)[number];
|
|
6
|
+
export type InputNumberSlotName = InputNumberContentSlotName | InputNumberStructuralSlotName;
|
|
7
|
+
export type InputNumberSlotComponent<Props, Slot extends InputNumberSlotName = InputNumberSlotName> = SlotComponent<Props, "inputNumberSlot", Slot>;
|
|
8
|
+
export declare const assignInputNumberSlot: <Props, Slot extends InputNumberSlotName>(component: import("react").FC<Props>, slot: Slot) => SlotComponent<Props, "inputNumberSlot", Slot>;
|
|
9
|
+
export declare const isInputNumberSlotElement: <Props = unknown>(child: React.ReactNode) => child is import("react").ReactElement<Props, SlotComponent<Props, "inputNumberSlot", InputNumberSlotName>>;
|
|
10
|
+
export declare function isStructuralSlot(slot: InputNumberSlotName): slot is InputNumberStructuralSlotName;
|
|
11
|
+
export {};
|
|
@@ -4,6 +4,7 @@ var InputNumber = require('../InputNumber-cjs.js');
|
|
|
4
4
|
require('../tslib.es6-cjs.js');
|
|
5
5
|
require('react');
|
|
6
6
|
require('classnames');
|
|
7
|
+
require('../slotSystem-cjs.js');
|
|
7
8
|
require('../useAtlantisI18n-cjs.js');
|
|
8
9
|
require('../AtlantisContext-cjs.js');
|
|
9
10
|
require('../ActivityIndicator-cjs.js');
|
|
@@ -30,10 +31,10 @@ require('../SelectPrimitive-cjs.js');
|
|
|
30
31
|
require('../mergeClassName-cjs.js');
|
|
31
32
|
require('../SelectGroupLabel-cjs.js');
|
|
32
33
|
require('../useCompositeListItem-cjs.js');
|
|
33
|
-
require('../FieldDescription-cjs.js');
|
|
34
|
-
require('../useLabel-cjs.js');
|
|
35
34
|
require('../NumberFieldInput-cjs.js');
|
|
36
35
|
require('../stringifyLocale-cjs.js');
|
|
36
|
+
require('../FieldDescription-cjs.js');
|
|
37
|
+
require('../useLabel-cjs.js');
|
|
37
38
|
|
|
38
39
|
|
|
39
40
|
|
|
@@ -2,6 +2,7 @@ export { I as InputNumber } from '../InputNumber-es.js';
|
|
|
2
2
|
import '../tslib.es6-es.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
import 'classnames';
|
|
5
|
+
import '../slotSystem-es.js';
|
|
5
6
|
import '../useAtlantisI18n-es.js';
|
|
6
7
|
import '../AtlantisContext-es.js';
|
|
7
8
|
import '../ActivityIndicator-es.js';
|
|
@@ -28,7 +29,7 @@ import '../SelectPrimitive-es.js';
|
|
|
28
29
|
import '../mergeClassName-es.js';
|
|
29
30
|
import '../SelectGroupLabel-es.js';
|
|
30
31
|
import '../useCompositeListItem-es.js';
|
|
31
|
-
import '../FieldDescription-es.js';
|
|
32
|
-
import '../useLabel-es.js';
|
|
33
32
|
import '../NumberFieldInput-es.js';
|
|
34
33
|
import '../stringifyLocale-es.js';
|
|
34
|
+
import '../FieldDescription-es.js';
|
|
35
|
+
import '../useLabel-es.js';
|
package/dist/InputNumber-cjs.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var tslib_es6 = require('./tslib.es6-cjs.js');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var classnames = require('classnames');
|
|
6
|
+
var slotSystem = require('./slotSystem-cjs.js');
|
|
6
7
|
var useAtlantisI18n = require('./useAtlantisI18n-cjs.js');
|
|
7
8
|
require('./AtlantisContext-cjs.js');
|
|
8
9
|
var ActivityIndicator = require('./ActivityIndicator-cjs.js');
|
|
@@ -13,8 +14,16 @@ require('./BottomSheet-cjs.js');
|
|
|
13
14
|
var HelperText = require('./HelperText-cjs.js');
|
|
14
15
|
require('./SelectPrimitive-cjs.js');
|
|
15
16
|
var useRenderElement = require('./useRenderElement-cjs.js');
|
|
16
|
-
var FieldDescription = require('./FieldDescription-cjs.js');
|
|
17
17
|
var NumberFieldInput = require('./NumberFieldInput-cjs.js');
|
|
18
|
+
var FieldDescription = require('./FieldDescription-cjs.js');
|
|
19
|
+
|
|
20
|
+
const STRUCTURAL_SLOT_NAMES = ["group", "footer"];
|
|
21
|
+
const inputNumberSlotSystem = slotSystem.createSlotSystem("inputNumberSlot");
|
|
22
|
+
const assignInputNumberSlot = inputNumberSlotSystem.assignSlot;
|
|
23
|
+
const isInputNumberSlotElement = inputNumberSlotSystem.isSlotElement;
|
|
24
|
+
function isStructuralSlot(slot) {
|
|
25
|
+
return STRUCTURAL_SLOT_NAMES.includes(slot);
|
|
26
|
+
}
|
|
18
27
|
|
|
19
28
|
var styles = {"container":"-W4QiocGsR4-","inline":"_9-f2CjSVojs-","wrapper":"_4y342TRP-y8-","disabled":"d-YOq6z4ZxM-","small":"YTL0AyJdbC8-","large":"mUfanIovnVg-","center":"_8MM9keFOeD0-","right":"mTeuCQufdj4-","inputWrapper":"IgE0pfetwVM-","input":"MxShJMNKSB4-","stepper":"SE8DXlYN02U-","loadingIndicator":"VmKH2-NlbDI-","label":"f1OiicY3UzU-","hideLabel":"j9oUhNvNwsE-","affixLabel":"oR6I7xtSbL4-","prefix":"s-WnNh4k-kw-","suffix":"Ep7K8jug-Xc-","affixIcon":"E3w3BEJoBFE-","compoundAffix":"znvaejix3iE-","affixLabelText":"m1ZP5T4QOAQ-","stepperButton":"_22AXoGKVAjc-","belowField":"kkywg49kgrg-","description":"buIzMqBEpSQ-","spinning":"p8ebLlGf8JY-"};
|
|
20
29
|
|
|
@@ -49,6 +58,116 @@ const DEFAULT_FORMAT = {
|
|
|
49
58
|
maximumFractionDigits: 12,
|
|
50
59
|
};
|
|
51
60
|
const InputNumberContext = React.createContext(null);
|
|
61
|
+
function isFragmentElement(child) {
|
|
62
|
+
return React.isValidElement(child) && child.type === React.Fragment;
|
|
63
|
+
}
|
|
64
|
+
/** Conditional JSX often wraps parts in a fragment; unwrap so the parser sees them. */
|
|
65
|
+
function flattenFragments(children) {
|
|
66
|
+
const flattened = [];
|
|
67
|
+
React.Children.forEach(children, child => {
|
|
68
|
+
if (isFragmentElement(child)) {
|
|
69
|
+
flattened.push(...flattenFragments(child.props.children));
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
flattened.push(child);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
return flattened;
|
|
76
|
+
}
|
|
77
|
+
/** An `Error` with no message renders nothing, so it must not suppress the description. */
|
|
78
|
+
function hasRenderableChildren(child) {
|
|
79
|
+
return React.isValidElement(child)
|
|
80
|
+
? Boolean(child.props.children)
|
|
81
|
+
: false;
|
|
82
|
+
}
|
|
83
|
+
/** Placement policy; the shared slot system only tags and detects. */
|
|
84
|
+
function parseInputNumberChildren(children) {
|
|
85
|
+
const labels = [];
|
|
86
|
+
const indicators = [];
|
|
87
|
+
const descriptions = [];
|
|
88
|
+
const errors = [];
|
|
89
|
+
const parsed = {
|
|
90
|
+
prefixAffixes: [],
|
|
91
|
+
suffixAffixes: [],
|
|
92
|
+
insideInput: [],
|
|
93
|
+
footer: [],
|
|
94
|
+
structural: [],
|
|
95
|
+
unknown: [],
|
|
96
|
+
};
|
|
97
|
+
flattenFragments(children).forEach(child => {
|
|
98
|
+
if (!isInputNumberSlotElement(child)) {
|
|
99
|
+
parsed.unknown.push(child);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
const slot = child.type.inputNumberSlot;
|
|
103
|
+
if (isStructuralSlot(slot)) {
|
|
104
|
+
parsed.structural.push(child);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
switch (slot) {
|
|
108
|
+
case "label":
|
|
109
|
+
labels.push(child);
|
|
110
|
+
break;
|
|
111
|
+
case "affix":
|
|
112
|
+
if (child.props.variation === "suffix") {
|
|
113
|
+
parsed.suffixAffixes.push(child);
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
parsed.prefixAffixes.push(child);
|
|
117
|
+
}
|
|
118
|
+
break;
|
|
119
|
+
case "stepper":
|
|
120
|
+
case "loading":
|
|
121
|
+
indicators.push(child);
|
|
122
|
+
break;
|
|
123
|
+
case "description":
|
|
124
|
+
descriptions.push(child);
|
|
125
|
+
break;
|
|
126
|
+
case "error":
|
|
127
|
+
errors.push(child);
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
parsed.insideInput.push(...labels, ...indicators);
|
|
132
|
+
parsed.footer.push(...(errors.some(hasRenderableChildren) ? [] : descriptions), ...errors);
|
|
133
|
+
return parsed;
|
|
134
|
+
}
|
|
135
|
+
function hasContentParts(parsed) {
|
|
136
|
+
return (parsed.prefixAffixes.length > 0 ||
|
|
137
|
+
parsed.suffixAffixes.length > 0 ||
|
|
138
|
+
parsed.insideInput.length > 0 ||
|
|
139
|
+
parsed.footer.length > 0);
|
|
140
|
+
}
|
|
141
|
+
function resolveWrapperContent(children) {
|
|
142
|
+
const parsed = parseInputNumberChildren(children);
|
|
143
|
+
const hasContent = hasContentParts(parsed);
|
|
144
|
+
if (parsed.structural.length > 0) {
|
|
145
|
+
if (hasContent) {
|
|
146
|
+
throw new Error("<InputNumber.Wrapper> received both structural parts (Group/Footer) " +
|
|
147
|
+
"and loose content parts (Label/Affix/Stepper/Loading/Description/Error). " +
|
|
148
|
+
"Pass content parts alone to have Wrapper build the field, or nest them " +
|
|
149
|
+
"inside the structural parts to compose the tree yourself.");
|
|
150
|
+
}
|
|
151
|
+
return children;
|
|
152
|
+
}
|
|
153
|
+
// A consumer component may render `Group` itself; synthesizing would give it a second field.
|
|
154
|
+
if (!hasContent && parsed.unknown.length > 0)
|
|
155
|
+
return children;
|
|
156
|
+
return renderSynthesizedField(parsed);
|
|
157
|
+
}
|
|
158
|
+
function renderSynthesizedField(parsed) {
|
|
159
|
+
return (React.createElement(React.Fragment, null,
|
|
160
|
+
React.createElement(InputNumberGroup, null,
|
|
161
|
+
keyed(parsed.prefixAffixes),
|
|
162
|
+
React.createElement(InputNumberInput, null, keyed(parsed.insideInput)),
|
|
163
|
+
keyed(parsed.suffixAffixes)),
|
|
164
|
+
parsed.footer.length > 0 && (React.createElement(InputNumberFooter, null, keyed(parsed.footer))),
|
|
165
|
+
keyed(parsed.unknown)));
|
|
166
|
+
}
|
|
167
|
+
/** Flattening fragments drops the keys `React.Children.toArray` would have assigned. */
|
|
168
|
+
function keyed(children) {
|
|
169
|
+
return React.Children.toArray(children);
|
|
170
|
+
}
|
|
52
171
|
function useInputNumberContext(consumer) {
|
|
53
172
|
const context = React.useContext(InputNumberContext);
|
|
54
173
|
if (context === null) {
|
|
@@ -135,7 +254,7 @@ function InputNumberWrapper(_a) {
|
|
|
135
254
|
]);
|
|
136
255
|
const rootProps = useRenderElement.mergeProps({ className: classnames(styles.container, inline && styles.inline) }, { className, style });
|
|
137
256
|
return (React.createElement(FieldDescription.FieldRoot, Object.assign({}, rootProps, { disabled: disabled, invalid: invalid || undefined, name: name }),
|
|
138
|
-
React.createElement(InputNumberContext.Provider, { value: contextValue }, children)));
|
|
257
|
+
React.createElement(InputNumberContext.Provider, { value: contextValue }, resolveWrapperContent(children))));
|
|
139
258
|
}
|
|
140
259
|
function InputNumberGroup({ children, className, style, }) {
|
|
141
260
|
var _a, _b;
|
|
@@ -222,6 +341,11 @@ function InputNumberAffixCompound({ variation, label, icon, onClick, ariaLabel,
|
|
|
222
341
|
label && React.createElement("span", { className: styles.affixLabelText }, label),
|
|
223
342
|
children));
|
|
224
343
|
}
|
|
344
|
+
/** Carries the sugar's `prefix`/`suffix` through routing, adding no element of its own. */
|
|
345
|
+
function InputNumberPropAffix({ variation, affix }) {
|
|
346
|
+
const ctx = useInputNumberContext("Affix");
|
|
347
|
+
return renderDefaultAffix(variation, affix, ctx.size);
|
|
348
|
+
}
|
|
225
349
|
/**
|
|
226
350
|
* Renders the prop-driven `prefix`/`suffix` affixes for the sugar component.
|
|
227
351
|
* Icons sit outside the input area; labels render next to the typed value
|
|
@@ -259,31 +383,22 @@ function resolveAutoComplete(autoComplete) {
|
|
|
259
383
|
return undefined;
|
|
260
384
|
return autoComplete;
|
|
261
385
|
}
|
|
262
|
-
/**
|
|
263
|
-
* Sugar layer: composes the parts from props. This is the same composition a
|
|
264
|
-
* consumer would write by hand with `<InputNumber.Wrapper>` and the
|
|
265
|
-
* parts — to customize a single piece, copy this tree and swap that part.
|
|
266
|
-
*/
|
|
386
|
+
/** Sugar layer: hands the parts its props describe to `Wrapper`, the same path a consumer takes. */
|
|
267
387
|
function InputNumber(_a) {
|
|
268
|
-
var _b;
|
|
269
388
|
var { ref } = _a, props = tslib_es6.__rest(_a, ["ref"]);
|
|
270
389
|
const { t } = useAtlantisI18n.useAtlantisI18n(inputNumberMessages);
|
|
271
390
|
const { label, description, error, prefix, suffix } = props, config = tslib_es6.__rest(props, ["label", "description", "error", "prefix", "suffix"]);
|
|
272
|
-
const size = (_b = config.size) !== null && _b !== void 0 ? _b : "default";
|
|
273
391
|
return (React.createElement(InputNumberWrapper, Object.assign({}, config, { invalid: config.invalid || Boolean(error), ref: ref }),
|
|
274
|
-
React.createElement(
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
(description || error) && (React.createElement(InputNumberFooter, null,
|
|
285
|
-
React.createElement(InputNumberDescription, null, description),
|
|
286
|
-
React.createElement(InputNumberError, null, error)))));
|
|
392
|
+
prefix ? (React.createElement(InputNumberPropAffix, { affix: prefix, variation: "prefix" })) : null,
|
|
393
|
+
React.createElement(InputNumberLabel, null, label),
|
|
394
|
+
config.loading ? (React.createElement(InputNumberLoading, null)) : (React.createElement(InputNumberStepper, { incrementLabel: t("Increase {label}", {
|
|
395
|
+
label: label !== null && label !== void 0 ? label : t("value"),
|
|
396
|
+
}), decrementLabel: t("Decrease {label}", {
|
|
397
|
+
label: label !== null && label !== void 0 ? label : t("value"),
|
|
398
|
+
}) })),
|
|
399
|
+
suffix ? (React.createElement(InputNumberPropAffix, { affix: suffix, variation: "suffix" })) : null,
|
|
400
|
+
description ? (React.createElement(InputNumberDescription, null, description)) : null,
|
|
401
|
+
error ? React.createElement(InputNumberError, null, error) : null));
|
|
287
402
|
}
|
|
288
403
|
InputNumberWrapper.displayName = "InputNumber.Wrapper";
|
|
289
404
|
InputNumber.displayName = "InputNumber";
|
|
@@ -298,6 +413,16 @@ InputNumberStepper.displayName = "InputNumber.Stepper";
|
|
|
298
413
|
InputNumberIncrement.displayName = "InputNumber.Increment";
|
|
299
414
|
InputNumberDecrement.displayName = "InputNumber.Decrement";
|
|
300
415
|
InputNumberAffixCompound.displayName = "InputNumber.Affix";
|
|
416
|
+
// Tagged here so the parts stay plain declarations, which the docs prop-table generator needs.
|
|
417
|
+
assignInputNumberSlot(InputNumberGroup, "group");
|
|
418
|
+
assignInputNumberSlot(InputNumberFooter, "footer");
|
|
419
|
+
assignInputNumberSlot(InputNumberLabel, "label");
|
|
420
|
+
assignInputNumberSlot(InputNumberDescription, "description");
|
|
421
|
+
assignInputNumberSlot(InputNumberError, "error");
|
|
422
|
+
assignInputNumberSlot(InputNumberLoading, "loading");
|
|
423
|
+
assignInputNumberSlot(InputNumberStepper, "stepper");
|
|
424
|
+
assignInputNumberSlot(InputNumberAffixCompound, "affix");
|
|
425
|
+
assignInputNumberSlot(InputNumberPropAffix, "affix");
|
|
301
426
|
InputNumber.Wrapper = InputNumberWrapper;
|
|
302
427
|
InputNumber.Group = InputNumberGroup;
|
|
303
428
|
InputNumber.Footer = InputNumberFooter;
|
package/dist/InputNumber-es.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { _ as __rest } from './tslib.es6-es.js';
|
|
2
|
-
import React__default, { createContext, useId, useRef, useImperativeHandle, useCallback, useMemo
|
|
2
|
+
import React__default, { createContext, useContext, useId, useRef, useImperativeHandle, useCallback, useMemo } from 'react';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
|
+
import { c as createSlotSystem } from './slotSystem-es.js';
|
|
4
5
|
import { d as defineMessages, u as useAtlantisI18n } from './useAtlantisI18n-es.js';
|
|
5
6
|
import './AtlantisContext-es.js';
|
|
6
7
|
import { A as ActivityIndicator } from './ActivityIndicator-es.js';
|
|
@@ -11,8 +12,16 @@ import './BottomSheet-es.js';
|
|
|
11
12
|
import { H as HelperText } from './HelperText-es.js';
|
|
12
13
|
import './SelectPrimitive-es.js';
|
|
13
14
|
import { m as mergeProps } from './useRenderElement-es.js';
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
15
|
+
import { N as NumberFieldRoot, a as NumberFieldGroup, b as NumberFieldIncrement, c as NumberFieldDecrement, d as NumberFieldInput } from './NumberFieldInput-es.js';
|
|
16
|
+
import { F as FieldLabel, a as FieldDescription, b as FieldError, c as FieldRoot } from './FieldDescription-es.js';
|
|
17
|
+
|
|
18
|
+
const STRUCTURAL_SLOT_NAMES = ["group", "footer"];
|
|
19
|
+
const inputNumberSlotSystem = createSlotSystem("inputNumberSlot");
|
|
20
|
+
const assignInputNumberSlot = inputNumberSlotSystem.assignSlot;
|
|
21
|
+
const isInputNumberSlotElement = inputNumberSlotSystem.isSlotElement;
|
|
22
|
+
function isStructuralSlot(slot) {
|
|
23
|
+
return STRUCTURAL_SLOT_NAMES.includes(slot);
|
|
24
|
+
}
|
|
16
25
|
|
|
17
26
|
var styles = {"container":"-W4QiocGsR4-","inline":"_9-f2CjSVojs-","wrapper":"_4y342TRP-y8-","disabled":"d-YOq6z4ZxM-","small":"YTL0AyJdbC8-","large":"mUfanIovnVg-","center":"_8MM9keFOeD0-","right":"mTeuCQufdj4-","inputWrapper":"IgE0pfetwVM-","input":"MxShJMNKSB4-","stepper":"SE8DXlYN02U-","loadingIndicator":"VmKH2-NlbDI-","label":"f1OiicY3UzU-","hideLabel":"j9oUhNvNwsE-","affixLabel":"oR6I7xtSbL4-","prefix":"s-WnNh4k-kw-","suffix":"Ep7K8jug-Xc-","affixIcon":"E3w3BEJoBFE-","compoundAffix":"znvaejix3iE-","affixLabelText":"m1ZP5T4QOAQ-","stepperButton":"_22AXoGKVAjc-","belowField":"kkywg49kgrg-","description":"buIzMqBEpSQ-","spinning":"p8ebLlGf8JY-"};
|
|
18
27
|
|
|
@@ -47,6 +56,116 @@ const DEFAULT_FORMAT = {
|
|
|
47
56
|
maximumFractionDigits: 12,
|
|
48
57
|
};
|
|
49
58
|
const InputNumberContext = createContext(null);
|
|
59
|
+
function isFragmentElement(child) {
|
|
60
|
+
return React__default.isValidElement(child) && child.type === React__default.Fragment;
|
|
61
|
+
}
|
|
62
|
+
/** Conditional JSX often wraps parts in a fragment; unwrap so the parser sees them. */
|
|
63
|
+
function flattenFragments(children) {
|
|
64
|
+
const flattened = [];
|
|
65
|
+
React__default.Children.forEach(children, child => {
|
|
66
|
+
if (isFragmentElement(child)) {
|
|
67
|
+
flattened.push(...flattenFragments(child.props.children));
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
flattened.push(child);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
return flattened;
|
|
74
|
+
}
|
|
75
|
+
/** An `Error` with no message renders nothing, so it must not suppress the description. */
|
|
76
|
+
function hasRenderableChildren(child) {
|
|
77
|
+
return React__default.isValidElement(child)
|
|
78
|
+
? Boolean(child.props.children)
|
|
79
|
+
: false;
|
|
80
|
+
}
|
|
81
|
+
/** Placement policy; the shared slot system only tags and detects. */
|
|
82
|
+
function parseInputNumberChildren(children) {
|
|
83
|
+
const labels = [];
|
|
84
|
+
const indicators = [];
|
|
85
|
+
const descriptions = [];
|
|
86
|
+
const errors = [];
|
|
87
|
+
const parsed = {
|
|
88
|
+
prefixAffixes: [],
|
|
89
|
+
suffixAffixes: [],
|
|
90
|
+
insideInput: [],
|
|
91
|
+
footer: [],
|
|
92
|
+
structural: [],
|
|
93
|
+
unknown: [],
|
|
94
|
+
};
|
|
95
|
+
flattenFragments(children).forEach(child => {
|
|
96
|
+
if (!isInputNumberSlotElement(child)) {
|
|
97
|
+
parsed.unknown.push(child);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const slot = child.type.inputNumberSlot;
|
|
101
|
+
if (isStructuralSlot(slot)) {
|
|
102
|
+
parsed.structural.push(child);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
switch (slot) {
|
|
106
|
+
case "label":
|
|
107
|
+
labels.push(child);
|
|
108
|
+
break;
|
|
109
|
+
case "affix":
|
|
110
|
+
if (child.props.variation === "suffix") {
|
|
111
|
+
parsed.suffixAffixes.push(child);
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
parsed.prefixAffixes.push(child);
|
|
115
|
+
}
|
|
116
|
+
break;
|
|
117
|
+
case "stepper":
|
|
118
|
+
case "loading":
|
|
119
|
+
indicators.push(child);
|
|
120
|
+
break;
|
|
121
|
+
case "description":
|
|
122
|
+
descriptions.push(child);
|
|
123
|
+
break;
|
|
124
|
+
case "error":
|
|
125
|
+
errors.push(child);
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
parsed.insideInput.push(...labels, ...indicators);
|
|
130
|
+
parsed.footer.push(...(errors.some(hasRenderableChildren) ? [] : descriptions), ...errors);
|
|
131
|
+
return parsed;
|
|
132
|
+
}
|
|
133
|
+
function hasContentParts(parsed) {
|
|
134
|
+
return (parsed.prefixAffixes.length > 0 ||
|
|
135
|
+
parsed.suffixAffixes.length > 0 ||
|
|
136
|
+
parsed.insideInput.length > 0 ||
|
|
137
|
+
parsed.footer.length > 0);
|
|
138
|
+
}
|
|
139
|
+
function resolveWrapperContent(children) {
|
|
140
|
+
const parsed = parseInputNumberChildren(children);
|
|
141
|
+
const hasContent = hasContentParts(parsed);
|
|
142
|
+
if (parsed.structural.length > 0) {
|
|
143
|
+
if (hasContent) {
|
|
144
|
+
throw new Error("<InputNumber.Wrapper> received both structural parts (Group/Footer) " +
|
|
145
|
+
"and loose content parts (Label/Affix/Stepper/Loading/Description/Error). " +
|
|
146
|
+
"Pass content parts alone to have Wrapper build the field, or nest them " +
|
|
147
|
+
"inside the structural parts to compose the tree yourself.");
|
|
148
|
+
}
|
|
149
|
+
return children;
|
|
150
|
+
}
|
|
151
|
+
// A consumer component may render `Group` itself; synthesizing would give it a second field.
|
|
152
|
+
if (!hasContent && parsed.unknown.length > 0)
|
|
153
|
+
return children;
|
|
154
|
+
return renderSynthesizedField(parsed);
|
|
155
|
+
}
|
|
156
|
+
function renderSynthesizedField(parsed) {
|
|
157
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
158
|
+
React__default.createElement(InputNumberGroup, null,
|
|
159
|
+
keyed(parsed.prefixAffixes),
|
|
160
|
+
React__default.createElement(InputNumberInput, null, keyed(parsed.insideInput)),
|
|
161
|
+
keyed(parsed.suffixAffixes)),
|
|
162
|
+
parsed.footer.length > 0 && (React__default.createElement(InputNumberFooter, null, keyed(parsed.footer))),
|
|
163
|
+
keyed(parsed.unknown)));
|
|
164
|
+
}
|
|
165
|
+
/** Flattening fragments drops the keys `React.Children.toArray` would have assigned. */
|
|
166
|
+
function keyed(children) {
|
|
167
|
+
return React__default.Children.toArray(children);
|
|
168
|
+
}
|
|
50
169
|
function useInputNumberContext(consumer) {
|
|
51
170
|
const context = useContext(InputNumberContext);
|
|
52
171
|
if (context === null) {
|
|
@@ -133,7 +252,7 @@ function InputNumberWrapper(_a) {
|
|
|
133
252
|
]);
|
|
134
253
|
const rootProps = mergeProps({ className: classnames(styles.container, inline && styles.inline) }, { className, style });
|
|
135
254
|
return (React__default.createElement(FieldRoot, Object.assign({}, rootProps, { disabled: disabled, invalid: invalid || undefined, name: name }),
|
|
136
|
-
React__default.createElement(InputNumberContext.Provider, { value: contextValue }, children)));
|
|
255
|
+
React__default.createElement(InputNumberContext.Provider, { value: contextValue }, resolveWrapperContent(children))));
|
|
137
256
|
}
|
|
138
257
|
function InputNumberGroup({ children, className, style, }) {
|
|
139
258
|
var _a, _b;
|
|
@@ -220,6 +339,11 @@ function InputNumberAffixCompound({ variation, label, icon, onClick, ariaLabel,
|
|
|
220
339
|
label && React__default.createElement("span", { className: styles.affixLabelText }, label),
|
|
221
340
|
children));
|
|
222
341
|
}
|
|
342
|
+
/** Carries the sugar's `prefix`/`suffix` through routing, adding no element of its own. */
|
|
343
|
+
function InputNumberPropAffix({ variation, affix }) {
|
|
344
|
+
const ctx = useInputNumberContext("Affix");
|
|
345
|
+
return renderDefaultAffix(variation, affix, ctx.size);
|
|
346
|
+
}
|
|
223
347
|
/**
|
|
224
348
|
* Renders the prop-driven `prefix`/`suffix` affixes for the sugar component.
|
|
225
349
|
* Icons sit outside the input area; labels render next to the typed value
|
|
@@ -257,31 +381,22 @@ function resolveAutoComplete(autoComplete) {
|
|
|
257
381
|
return undefined;
|
|
258
382
|
return autoComplete;
|
|
259
383
|
}
|
|
260
|
-
/**
|
|
261
|
-
* Sugar layer: composes the parts from props. This is the same composition a
|
|
262
|
-
* consumer would write by hand with `<InputNumber.Wrapper>` and the
|
|
263
|
-
* parts — to customize a single piece, copy this tree and swap that part.
|
|
264
|
-
*/
|
|
384
|
+
/** Sugar layer: hands the parts its props describe to `Wrapper`, the same path a consumer takes. */
|
|
265
385
|
function InputNumber(_a) {
|
|
266
|
-
var _b;
|
|
267
386
|
var { ref } = _a, props = __rest(_a, ["ref"]);
|
|
268
387
|
const { t } = useAtlantisI18n(inputNumberMessages);
|
|
269
388
|
const { label, description, error, prefix, suffix } = props, config = __rest(props, ["label", "description", "error", "prefix", "suffix"]);
|
|
270
|
-
const size = (_b = config.size) !== null && _b !== void 0 ? _b : "default";
|
|
271
389
|
return (React__default.createElement(InputNumberWrapper, Object.assign({}, config, { invalid: config.invalid || Boolean(error), ref: ref }),
|
|
272
|
-
React__default.createElement(
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
(description || error) && (React__default.createElement(InputNumberFooter, null,
|
|
283
|
-
React__default.createElement(InputNumberDescription, null, description),
|
|
284
|
-
React__default.createElement(InputNumberError, null, error)))));
|
|
390
|
+
prefix ? (React__default.createElement(InputNumberPropAffix, { affix: prefix, variation: "prefix" })) : null,
|
|
391
|
+
React__default.createElement(InputNumberLabel, null, label),
|
|
392
|
+
config.loading ? (React__default.createElement(InputNumberLoading, null)) : (React__default.createElement(InputNumberStepper, { incrementLabel: t("Increase {label}", {
|
|
393
|
+
label: label !== null && label !== void 0 ? label : t("value"),
|
|
394
|
+
}), decrementLabel: t("Decrease {label}", {
|
|
395
|
+
label: label !== null && label !== void 0 ? label : t("value"),
|
|
396
|
+
}) })),
|
|
397
|
+
suffix ? (React__default.createElement(InputNumberPropAffix, { affix: suffix, variation: "suffix" })) : null,
|
|
398
|
+
description ? (React__default.createElement(InputNumberDescription, null, description)) : null,
|
|
399
|
+
error ? React__default.createElement(InputNumberError, null, error) : null));
|
|
285
400
|
}
|
|
286
401
|
InputNumberWrapper.displayName = "InputNumber.Wrapper";
|
|
287
402
|
InputNumber.displayName = "InputNumber";
|
|
@@ -296,6 +411,16 @@ InputNumberStepper.displayName = "InputNumber.Stepper";
|
|
|
296
411
|
InputNumberIncrement.displayName = "InputNumber.Increment";
|
|
297
412
|
InputNumberDecrement.displayName = "InputNumber.Decrement";
|
|
298
413
|
InputNumberAffixCompound.displayName = "InputNumber.Affix";
|
|
414
|
+
// Tagged here so the parts stay plain declarations, which the docs prop-table generator needs.
|
|
415
|
+
assignInputNumberSlot(InputNumberGroup, "group");
|
|
416
|
+
assignInputNumberSlot(InputNumberFooter, "footer");
|
|
417
|
+
assignInputNumberSlot(InputNumberLabel, "label");
|
|
418
|
+
assignInputNumberSlot(InputNumberDescription, "description");
|
|
419
|
+
assignInputNumberSlot(InputNumberError, "error");
|
|
420
|
+
assignInputNumberSlot(InputNumberLoading, "loading");
|
|
421
|
+
assignInputNumberSlot(InputNumberStepper, "stepper");
|
|
422
|
+
assignInputNumberSlot(InputNumberAffixCompound, "affix");
|
|
423
|
+
assignInputNumberSlot(InputNumberPropAffix, "affix");
|
|
299
424
|
InputNumber.Wrapper = InputNumberWrapper;
|
|
300
425
|
InputNumber.Group = InputNumberGroup;
|
|
301
426
|
InputNumber.Footer = InputNumberFooter;
|
|
@@ -1485,4 +1485,4 @@ const NumberFieldInput = /*#__PURE__*/React.forwardRef(function NumberFieldInput
|
|
|
1485
1485
|
});
|
|
1486
1486
|
if (process.env.NODE_ENV !== "production") NumberFieldInput.displayName = "NumberFieldInput";
|
|
1487
1487
|
|
|
1488
|
-
export { NumberFieldRoot as N, NumberFieldGroup as a,
|
|
1488
|
+
export { NumberFieldRoot as N, NumberFieldGroup as a, NumberFieldIncrement as b, NumberFieldDecrement as c, NumberFieldInput as d, stateAttributesMapping as s, useNumberFieldRootContext as u };
|
package/dist/Select-es.js
CHANGED
|
@@ -5,7 +5,7 @@ import { S as SelectPrimitive } from './SelectPrimitive-es.js';
|
|
|
5
5
|
import { a as BottomSheet } from './BottomSheet-es.js';
|
|
6
6
|
import { I as Icon } from './Icon-es.js';
|
|
7
7
|
import { H as HelperText } from './HelperText-es.js';
|
|
8
|
-
import {
|
|
8
|
+
import { c as FieldRoot, F as FieldLabel, a as FieldDescription, b as FieldError } from './FieldDescription-es.js';
|
|
9
9
|
|
|
10
10
|
var styles = {"field":"cWI-uFeNWWw-","inline":"ddkBixixBz4-","control":"_-1-lIAkgLuo-","trigger":"_7rwBeCqTgRY-","small":"_5QeBX5VxX6o-","large":"Pp5nj1nxejw-","label":"M1IjAW17-OE-","hasLabel":"_1rx-nSAJT0U-","sheetListbox":"AVkCcDISAio-","sheetOption":"_35H33txs5QU-","sheetOptionLabel":"uL9j4OZn-3c-","sheetOptionIndicator":"_7NHtDHZnkG8-","sheetGroup":"UQ1tsDd1NFs-","sheetGroupLabel":"_0kBfkWoRI5c-","sheetSeparator":"RPsN9vqlzRw-","spinning":"oOACJmrVDf0-"};
|
|
11
11
|
|
|
@@ -300,7 +300,19 @@ Pass `label`, `description`, and `error` on `Combobox` for the default Atlantis
|
|
|
300
300
|
field treatment. If the layout needs different placement, compose
|
|
301
301
|
`Combobox.Label`, `Combobox.Description`, and `Combobox.Error` manually.
|
|
302
302
|
|
|
303
|
+
A field shows a description or an error, never both. When both root props are
|
|
304
|
+
set the error replaces the description, since a description hints at what the
|
|
305
|
+
field wants and the error already restates it. Manually composed
|
|
306
|
+
`Combobox.Description` and `Combobox.Error` parts are unaffected.
|
|
307
|
+
|
|
308
|
+
```tsx
|
|
309
|
+
<Combobox label="Team member" description="Search by name" items={teamMembers}>
|
|
310
|
+
{/* trigger and content */}
|
|
311
|
+
</Combobox>
|
|
312
|
+
```
|
|
313
|
+
|
|
303
314
|
```tsx
|
|
315
|
+
// `description` is not rendered while `error` is set
|
|
304
316
|
<Combobox
|
|
305
317
|
label="Team member"
|
|
306
318
|
description="Search by name"
|
|
@@ -339,17 +339,17 @@ the **Design** tab.
|
|
|
339
339
|
| `Description` | Helper text below the field |
|
|
340
340
|
| `Error` | Styled error message below the field |
|
|
341
341
|
|
|
342
|
-
## Composition
|
|
343
|
-
|
|
344
|
-
The prop-driven component is sugar: it renders exactly the tree you would write
|
|
345
|
-
by hand with `<InputNumber.Wrapper>` and the parts. To customize a single piece,
|
|
346
|
-
compose the tree yourself and swap that one part — the other parts keep their
|
|
347
|
-
defaults. The sugar does not merge consumer-provided parts into its render, so
|
|
348
|
-
there is no per-slot precedence to reason about.
|
|
349
|
-
|
|
350
342
|
`Wrapper` owns the field state and shares it with the parts through context, so
|
|
351
343
|
every part must be rendered inside a `Wrapper` (a part used outside one throws).
|
|
352
344
|
|
|
345
|
+
## Customize one part
|
|
346
|
+
|
|
347
|
+
Pass the content parts you want — `Label`, `Affix`, `Stepper`, `Loading`,
|
|
348
|
+
`Description`, `Error` — straight to `Wrapper`. It builds `Group`, `Input`, and
|
|
349
|
+
`Footer` around them and places each part at the right depth, so you never
|
|
350
|
+
reproduce the skeleton to change one piece. `Wrapper` renders only the parts you
|
|
351
|
+
gave it: leave one out and it is not there.
|
|
352
|
+
|
|
353
353
|
The example below replaces the default stepper icons with `+` / `−` and leaves
|
|
354
354
|
everything else as the default:
|
|
355
355
|
|
|
@@ -361,25 +361,139 @@ export function InputNumberCompositionExample() {
|
|
|
361
361
|
const [value, setValue] = useState<number | null>(3);
|
|
362
362
|
|
|
363
363
|
return (
|
|
364
|
-
<InputNumber.Wrapper
|
|
364
|
+
<InputNumber.Wrapper onValueCommitted={setValue} value={value}>
|
|
365
|
+
<InputNumber.Label>Quantity</InputNumber.Label>
|
|
366
|
+
<InputNumber.Stepper>
|
|
367
|
+
<InputNumber.Increment ariaLabel="Increase Quantity">
|
|
368
|
+
+
|
|
369
|
+
</InputNumber.Increment>
|
|
370
|
+
<InputNumber.Decrement ariaLabel="Decrease Quantity">
|
|
371
|
+
−
|
|
372
|
+
</InputNumber.Decrement>
|
|
373
|
+
</InputNumber.Stepper>
|
|
374
|
+
</InputNumber.Wrapper>
|
|
375
|
+
);
|
|
376
|
+
}
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
### Omit a part
|
|
380
|
+
|
|
381
|
+
A field with no stepper is the same composition minus the `Stepper`:
|
|
382
|
+
|
|
383
|
+
```tsx
|
|
384
|
+
import React, { useState } from "react";
|
|
385
|
+
import { InputNumber } from "@jobber/components";
|
|
386
|
+
|
|
387
|
+
export function InputNumberCompositionStepperlessExample() {
|
|
388
|
+
const [value, setValue] = useState<number | null>(15);
|
|
389
|
+
|
|
390
|
+
return (
|
|
391
|
+
<InputNumber.Wrapper
|
|
392
|
+
format={{ style: "unit", unit: "percent" }}
|
|
393
|
+
onValueCommitted={setValue}
|
|
394
|
+
value={value}
|
|
395
|
+
>
|
|
396
|
+
<InputNumber.Label>Tax rate</InputNumber.Label>
|
|
397
|
+
</InputNumber.Wrapper>
|
|
398
|
+
);
|
|
399
|
+
}
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
### Show a part conditionally
|
|
403
|
+
|
|
404
|
+
Presence is ordinary conditional JSX; there is no `show*` prop to reach for:
|
|
405
|
+
|
|
406
|
+
```tsx
|
|
407
|
+
import React, { useState } from "react";
|
|
408
|
+
import { InputNumber } from "@jobber/components";
|
|
409
|
+
|
|
410
|
+
export function InputNumberCompositionConditionalStepperExample() {
|
|
411
|
+
const [unitCost, setUnitCost] = useState<number | null>(0);
|
|
412
|
+
const [markup, setMarkup] = useState<number | null>(20);
|
|
413
|
+
|
|
414
|
+
return (
|
|
415
|
+
<>
|
|
416
|
+
<InputNumber
|
|
417
|
+
label="Unit cost"
|
|
418
|
+
onValueCommitted={setUnitCost}
|
|
419
|
+
prefix={{ label: "$" }}
|
|
420
|
+
value={unitCost}
|
|
421
|
+
/>
|
|
422
|
+
<InputNumber.Wrapper onValueCommitted={setMarkup} value={markup}>
|
|
423
|
+
<InputNumber.Label>Markup</InputNumber.Label>
|
|
424
|
+
<InputNumber.Affix label="%" variation="suffix" />
|
|
425
|
+
{Boolean(unitCost) && <InputNumber.Stepper />}
|
|
426
|
+
</InputNumber.Wrapper>
|
|
427
|
+
</>
|
|
428
|
+
);
|
|
429
|
+
}
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
### Below-field content
|
|
433
|
+
|
|
434
|
+
`Description` and `Error` route into the footer row, which exists only while one
|
|
435
|
+
of them is rendered. The two are never shown together: when both are present the
|
|
436
|
+
error replaces the description, since a description hints at what the field
|
|
437
|
+
wants and the error already restates it.
|
|
438
|
+
|
|
439
|
+
```tsx
|
|
440
|
+
import React, { useState } from "react";
|
|
441
|
+
import { InputNumber } from "@jobber/components";
|
|
442
|
+
|
|
443
|
+
export function InputNumberCompositionFooterExample() {
|
|
444
|
+
const [value, setValue] = useState<number | null>(50);
|
|
445
|
+
const error = (value ?? 0) > 99 ? "Enter a value between 1 and 99" : "";
|
|
446
|
+
|
|
447
|
+
return (
|
|
448
|
+
<InputNumber.Wrapper
|
|
449
|
+
invalid={Boolean(error)}
|
|
450
|
+
max={99}
|
|
451
|
+
min={1}
|
|
452
|
+
onValueChange={setValue}
|
|
453
|
+
value={value}
|
|
454
|
+
>
|
|
455
|
+
<InputNumber.Label>Quantity</InputNumber.Label>
|
|
456
|
+
<InputNumber.Description>Per visit</InputNumber.Description>
|
|
457
|
+
{error && <InputNumber.Error>{error}</InputNumber.Error>}
|
|
458
|
+
</InputNumber.Wrapper>
|
|
459
|
+
);
|
|
460
|
+
}
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
## Custom layouts
|
|
464
|
+
|
|
465
|
+
For an arrangement the standard skeleton does not produce, compose the
|
|
466
|
+
structural parts (`Group`, `Input`, `Footer`) yourself. `Wrapper` then renders
|
|
467
|
+
your tree exactly as written and adds nothing:
|
|
468
|
+
|
|
469
|
+
```tsx
|
|
470
|
+
import React, { useState } from "react";
|
|
471
|
+
import { InputNumber } from "@jobber/components";
|
|
472
|
+
|
|
473
|
+
export function InputNumberCompositionCustomLayoutExample() {
|
|
474
|
+
const [value, setValue] = useState<number | null>(3);
|
|
475
|
+
|
|
476
|
+
return (
|
|
477
|
+
<InputNumber.Wrapper inline onValueCommitted={setValue} value={value}>
|
|
365
478
|
<InputNumber.Group>
|
|
479
|
+
<InputNumber.Decrement ariaLabel="Decrease quantity" />
|
|
366
480
|
<InputNumber.Input>
|
|
367
481
|
<InputNumber.Label>Quantity</InputNumber.Label>
|
|
368
|
-
<InputNumber.Stepper>
|
|
369
|
-
<InputNumber.Increment ariaLabel="Increase Quantity">
|
|
370
|
-
+
|
|
371
|
-
</InputNumber.Increment>
|
|
372
|
-
<InputNumber.Decrement ariaLabel="Decrease Quantity">
|
|
373
|
-
−
|
|
374
|
-
</InputNumber.Decrement>
|
|
375
|
-
</InputNumber.Stepper>
|
|
376
482
|
</InputNumber.Input>
|
|
483
|
+
<InputNumber.Increment ariaLabel="Increase quantity" />
|
|
377
484
|
</InputNumber.Group>
|
|
378
485
|
</InputNumber.Wrapper>
|
|
379
486
|
);
|
|
380
487
|
}
|
|
381
488
|
```
|
|
382
489
|
|
|
490
|
+
Pick one path per `Wrapper`. Mixing structural parts with loose content parts
|
|
491
|
+
throws, rather than guessing where the loose parts belong.
|
|
492
|
+
|
|
493
|
+
The sugar does not merge consumer-provided parts into its render, so there is no
|
|
494
|
+
per-slot precedence to reason about — children passed to `<InputNumber>` are
|
|
495
|
+
ignored. Compose on `Wrapper` instead.
|
|
496
|
+
|
|
383
497
|
## Controlled usage
|
|
384
498
|
|
|
385
499
|
The field is controlled: pass `value` (a `number`, or `null` for empty) and read
|
package/dist/index.cjs
CHANGED
|
@@ -113,6 +113,7 @@ require('color');
|
|
|
113
113
|
require('./tslib.es6-cjs.js');
|
|
114
114
|
require('react-router-dom');
|
|
115
115
|
require('./getMappedAtlantisSpaceToken-cjs.js');
|
|
116
|
+
require('./slotSystem-cjs.js');
|
|
116
117
|
require('./buttonRenderAdapter-cjs.js');
|
|
117
118
|
require('./useRenderElement-cjs.js');
|
|
118
119
|
require('./ComboboxPrimitive-cjs.js');
|
package/dist/index.mjs
CHANGED
|
@@ -111,6 +111,7 @@ import 'color';
|
|
|
111
111
|
import './tslib.es6-es.js';
|
|
112
112
|
import 'react-router-dom';
|
|
113
113
|
import './getMappedAtlantisSpaceToken-es.js';
|
|
114
|
+
import './slotSystem-es.js';
|
|
114
115
|
import './buttonRenderAdapter-es.js';
|
|
115
116
|
import './useRenderElement-es.js';
|
|
116
117
|
import './ComboboxPrimitive-es.js';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
|
|
5
|
+
function createSlotSystem(markerKey) {
|
|
6
|
+
function assignSlot(component, slot) {
|
|
7
|
+
return Object.assign(component, {
|
|
8
|
+
[markerKey]: slot,
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
function createSlot(slot) {
|
|
12
|
+
function SlotMarker(props) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
return assignSlot(SlotMarker, slot);
|
|
16
|
+
}
|
|
17
|
+
function isSlotElement(child) {
|
|
18
|
+
if (!React.isValidElement(child))
|
|
19
|
+
return false;
|
|
20
|
+
// `in` throws on a primitive, and an element's type is a string for a host
|
|
21
|
+
// element ("div") or a symbol for a fragment.
|
|
22
|
+
const type = child.type;
|
|
23
|
+
return ((typeof type === "object" || typeof type === "function") &&
|
|
24
|
+
type !== null &&
|
|
25
|
+
markerKey in type);
|
|
26
|
+
}
|
|
27
|
+
return { assignSlot, createSlot, isSlotElement };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
exports.createSlotSystem = createSlotSystem;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
|
|
3
|
+
function createSlotSystem(markerKey) {
|
|
4
|
+
function assignSlot(component, slot) {
|
|
5
|
+
return Object.assign(component, {
|
|
6
|
+
[markerKey]: slot,
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
function createSlot(slot) {
|
|
10
|
+
function SlotMarker(props) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
return assignSlot(SlotMarker, slot);
|
|
14
|
+
}
|
|
15
|
+
function isSlotElement(child) {
|
|
16
|
+
if (!React__default.isValidElement(child))
|
|
17
|
+
return false;
|
|
18
|
+
// `in` throws on a primitive, and an element's type is a string for a host
|
|
19
|
+
// element ("div") or a symbol for a fragment.
|
|
20
|
+
const type = child.type;
|
|
21
|
+
return ((typeof type === "object" || typeof type === "function") &&
|
|
22
|
+
type !== null &&
|
|
23
|
+
markerKey in type);
|
|
24
|
+
}
|
|
25
|
+
return { assignSlot, createSlot, isSlotElement };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { createSlotSystem as c };
|
package/dist/styles.css
CHANGED
|
@@ -14306,20 +14306,29 @@ html.atlantisLightBoxActive {
|
|
|
14306
14306
|
);
|
|
14307
14307
|
}
|
|
14308
14308
|
|
|
14309
|
+
/* Spacing sits here, not on `.description`, so it applies to whichever part is present. */
|
|
14309
14310
|
.kkywg49kgrg- {
|
|
14310
14311
|
display: -ms-flexbox;
|
|
14311
14312
|
display: flex;
|
|
14312
14313
|
-ms-flex-direction: column;
|
|
14313
14314
|
flex-direction: column;
|
|
14315
|
+
gap: 4px;
|
|
14316
|
+
gap: var(--space-smaller);
|
|
14317
|
+
margin-top: 4px;
|
|
14318
|
+
margin-top: var(--space-smaller);
|
|
14319
|
+
}
|
|
14320
|
+
|
|
14321
|
+
/* A part with an empty message renders nothing, so the row must not hold space. */
|
|
14322
|
+
.kkywg49kgrg-:empty {
|
|
14323
|
+
margin-top: 0;
|
|
14314
14324
|
}
|
|
14315
14325
|
|
|
14316
14326
|
/**
|
|
14317
14327
|
* `Field.Description` renders a `<p>`, which inherits the user-agent
|
|
14318
|
-
* `margin-block` defaults. Reset
|
|
14328
|
+
* `margin-block` defaults. Reset so spacing comes only from the footer's gap.
|
|
14319
14329
|
*/
|
|
14320
14330
|
.buIzMqBEpSQ- {
|
|
14321
|
-
margin:
|
|
14322
|
-
margin: var(--space-smaller) 0 0 0;
|
|
14331
|
+
margin: 0;
|
|
14323
14332
|
color: hsl(197, 21%, 36%);
|
|
14324
14333
|
color: var(--color-text--secondary);
|
|
14325
14334
|
font-size: 12px;
|
|
@@ -13,7 +13,7 @@ import { u as useMenuRootContext, o as useMenuPositionerContext, p as useMenuIte
|
|
|
13
13
|
import * as ReactDOM from 'react-dom';
|
|
14
14
|
import { m as usePreviousValue, n as useSelectRootContext, s as selectors, o as useSelectPositionerContext, j as SelectGroup, k as SelectGroupLabel, g as SelectItem, i as SelectItemIndicator, h as SelectItemText, f as SelectList, e as SelectPopup, a as SelectPortal, d as SelectPositioner, S as SelectRoot, b as SelectTrigger, c as SelectValue } from '../SelectGroupLabel-es.js';
|
|
15
15
|
import { S as Separator } from '../Separator-es.js';
|
|
16
|
-
import { u as useNumberFieldRootContext, s as stateAttributesMapping$4,
|
|
16
|
+
import { u as useNumberFieldRootContext, s as stateAttributesMapping$4, c as NumberFieldDecrement, a as NumberFieldGroup, b as NumberFieldIncrement, d as NumberFieldInput, N as NumberFieldRoot } from '../NumberFieldInput-es.js';
|
|
17
17
|
import { u as useLabel } from '../useLabel-es.js';
|
|
18
18
|
import '../stringifyLocale-es.js';
|
|
19
19
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Shared slot mechanism for compound components: tag a part with a slot name,
|
|
4
|
+
* then detect that name on a child element. Components own their own child
|
|
5
|
+
* parsing — the mechanism is shared, the placement policy is not.
|
|
6
|
+
*/
|
|
7
|
+
export type SlotComponent<Props, MarkerKey extends string, Slot extends string> = React.FC<Props> & Record<MarkerKey, Slot>;
|
|
8
|
+
export declare function createSlotSystem<MarkerKey extends string, SlotName extends string>(markerKey: MarkerKey): {
|
|
9
|
+
assignSlot: <Props, Slot extends SlotName>(component: React.FC<Props>, slot: Slot) => SlotComponent<Props, MarkerKey, Slot>;
|
|
10
|
+
createSlot: <Props, Slot extends SlotName = SlotName>(slot: Slot) => SlotComponent<Props, MarkerKey, Slot>;
|
|
11
|
+
isSlotElement: <Props = unknown>(child: React.ReactNode) => child is React.ReactElement<Props, SlotComponent<Props, MarkerKey, SlotName>>;
|
|
12
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.13.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -547,5 +547,5 @@
|
|
|
547
547
|
"> 1%",
|
|
548
548
|
"IE 10"
|
|
549
549
|
],
|
|
550
|
-
"gitHead": "
|
|
550
|
+
"gitHead": "dd36de6ab42a53be688a1f99ec3342a178c580b6"
|
|
551
551
|
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
export type ComboboxSlotComponent<Props, MarkerKey extends string, Slot extends string> = React.FC<Props> & Record<MarkerKey, Slot>;
|
|
3
|
-
export declare function createComboboxSlotSystem<MarkerKey extends string, SlotName extends string>(markerKey: MarkerKey): {
|
|
4
|
-
assignSlot: <Props, Slot extends SlotName>(component: React.FC<Props>, slot: Slot) => ComboboxSlotComponent<Props, MarkerKey, Slot>;
|
|
5
|
-
createSlot: <Props, Slot extends SlotName = SlotName>(slot: Slot) => ComboboxSlotComponent<Props, MarkerKey, Slot>;
|
|
6
|
-
isSlotElement: <Props = unknown>(child: React.ReactNode) => child is React.ReactElement<Props, ComboboxSlotComponent<Props, MarkerKey, SlotName>>;
|
|
7
|
-
};
|