@thewhatmatters/wmds 0.4.33 → 0.4.34
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/CHANGELOG.md +46 -0
- package/bin/wmds-check.mjs +24 -0
- package/dist/components/atoms/Checkbox/checkboxStyles.d.ts +1 -1
- package/dist/components/atoms/Checkbox/checkboxStyles.d.ts.map +1 -1
- package/dist/components/atoms/Checkbox/checkboxStyles.js +6 -6
- package/dist/components/atoms/Input/Input.d.ts +13 -3
- package/dist/components/atoms/Input/Input.d.ts.map +1 -1
- package/dist/components/atoms/Input/Input.js +102 -67
- package/dist/components/atoms/Input/autofillFields.d.ts +9 -0
- package/dist/components/atoms/Input/autofillFields.d.ts.map +1 -0
- package/dist/components/atoms/Input/autofillFields.js +8 -0
- package/dist/components/atoms/Input/fieldWidth.d.ts +19 -0
- package/dist/components/atoms/Input/fieldWidth.d.ts.map +1 -0
- package/dist/components/atoms/Input/fieldWidth.js +24 -0
- package/dist/components/atoms/Radio/radioStyles.d.ts +1 -1
- package/dist/components/atoms/Radio/radioStyles.d.ts.map +1 -1
- package/dist/components/atoms/Radio/radioStyles.js +6 -6
- package/dist/components/molecules/Field/Field.d.ts +11 -3
- package/dist/components/molecules/Field/Field.d.ts.map +1 -1
- package/dist/components/molecules/Field/Field.js +45 -30
- package/dist/components/molecules/Field/fieldStyles.d.ts +9 -6
- package/dist/components/molecules/Field/fieldStyles.d.ts.map +1 -1
- package/dist/components/molecules/Field/fieldStyles.js +1 -1
- package/dist/components/molecules/IntakeForm/IntakeForm.d.ts +15 -5
- package/dist/components/molecules/IntakeForm/IntakeForm.d.ts.map +1 -1
- package/dist/components/molecules/IntakeForm/IntakeForm.js +110 -70
- package/dist/components/molecules/PillGroup/PillGroup.d.ts +7 -3
- package/dist/components/molecules/PillGroup/PillGroup.d.ts.map +1 -1
- package/dist/components/molecules/PillGroup/PillGroup.js +37 -27
- package/dist/components/molecules/PillGroup/pillGroupStyles.d.ts +3 -0
- package/dist/components/molecules/PillGroup/pillGroupStyles.d.ts.map +1 -1
- package/dist/components/molecules/PillGroup/pillGroupStyles.js +4 -3
- package/dist/components/molecules/Search/Search.d.ts +1 -1
- package/dist/components/molecules/Search/Search.d.ts.map +1 -1
- package/dist/components/molecules/Select/Select.d.ts +19 -1
- package/dist/components/molecules/Select/Select.d.ts.map +1 -1
- package/dist/components/molecules/Select/Select.js +102 -60
- package/dist/components/molecules/Select/selectStyles.d.ts +9 -1
- package/dist/components/molecules/Select/selectStyles.d.ts.map +1 -1
- package/dist/components/molecules/Select/selectStyles.js +11 -3
- package/dist/components/molecules/Select/usStateOptions.d.ts +8 -0
- package/dist/components/molecules/Select/usStateOptions.d.ts.map +1 -0
- package/dist/components/molecules/Select/usStateOptions.js +7 -0
- package/dist/components/molecules/StepProgress/StepProgress.d.ts.map +1 -1
- package/dist/components/molecules/StepProgress/StepProgress.js +1 -0
- package/dist/components/organisms/IntakeModal/IntakeModal.d.ts +3 -0
- package/dist/components/organisms/IntakeModal/IntakeModal.d.ts.map +1 -1
- package/dist/components/organisms/IntakeModal/IntakeModal.js +7 -7
- package/dist/components/organisms/IntakeModal/intakeModalStyles.js +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +143 -141
- package/dist/styles.css +1 -1
- package/docs/components.md +1 -1
- package/docs/exports.json +1 -1
- package/docs/patterns/components-accordion--flush.tsx +1 -1
- package/docs/patterns/components-appshell--portal-dashboard-pattern.tsx +1 -1
- package/docs/patterns/components-avatar--dropdown-row.tsx +1 -1
- package/docs/patterns/components-badge--outline-tags.tsx +1 -1
- package/docs/patterns/components-badge--status-pill.tsx +1 -1
- package/docs/patterns/components-badge--with-avatar.tsx +1 -1
- package/docs/patterns/components-band--page-in-bands.tsx +1 -1
- package/docs/patterns/components-breadcrumb--editorial.tsx +1 -1
- package/docs/patterns/components-breadcrumb--long-path.tsx +1 -1
- package/docs/patterns/components-breadcrumb--path.tsx +1 -1
- package/docs/patterns/components-breadcrumb--router-links.tsx +1 -1
- package/docs/patterns/components-button-button--copy-button.tsx +1 -1
- package/docs/patterns/components-button-button--destructive-action.tsx +1 -1
- package/docs/patterns/components-button-button--external-link.tsx +1 -1
- package/docs/patterns/components-button-button--ghost-action.tsx +1 -1
- package/docs/patterns/components-button-button--inverse-action.tsx +1 -1
- package/docs/patterns/components-button-button--link-render.tsx +1 -1
- package/docs/patterns/components-button-button--multi-state-badge.tsx +1 -1
- package/docs/patterns/components-button-button--outline-mono.tsx +1 -1
- package/docs/patterns/components-button-button--primary-action.tsx +1 -1
- package/docs/patterns/components-button-button--row-hug.tsx +1 -1
- package/docs/patterns/components-button-button--row-layout.tsx +1 -1
- package/docs/patterns/components-button-button--secondary-action.tsx +1 -1
- package/docs/patterns/components-button-button--suggestion-pills.tsx +1 -1
- package/docs/patterns/components-button-button--with-count.tsx +1 -1
- package/docs/patterns/components-button-button--with-icon.tsx +1 -1
- package/docs/patterns/components-button-floatingactionbutton--vertical-actions.tsx +1 -1
- package/docs/patterns/components-calembed--pattern-skip-in-footer.tsx +1 -1
- package/docs/patterns/components-card-card--body-slot-occupancy-history.tsx +1 -1
- package/docs/patterns/components-card-card--headerless-media.tsx +1 -1
- package/docs/patterns/components-card-card--outlined-layout.tsx +1 -1
- package/docs/patterns/components-card-card--pinned-height.tsx +1 -1
- package/docs/patterns/components-card-card--terminal-frame.tsx +1 -1
- package/docs/patterns/components-card-selectablecard--selectable-cards-pattern.tsx +1 -1
- package/docs/patterns/components-carousel--image-carousel.tsx +1 -1
- package/docs/patterns/components-chart--audience-activity-heatmap.tsx +1 -1
- package/docs/patterns/components-chart--cartesian-no-data-gaps.tsx +1 -1
- package/docs/patterns/components-chart--occupancy-history-in-card.tsx +1 -1
- package/docs/patterns/components-chart--occupancy-in-card.tsx +1 -1
- package/docs/patterns/components-chart--post-reach-distribution.tsx +1 -1
- package/docs/patterns/components-chart--ranked-audience-breakdown.tsx +1 -1
- package/docs/patterns/components-chart--revenue-by-line.tsx +1 -1
- package/docs/patterns/components-chart--segmented-ring-pattern.tsx +1 -1
- package/docs/patterns/components-chart--unit-grid-composition.tsx +1 -1
- package/docs/patterns/components-chatdock--pattern-chat-dock.tsx +1 -1
- package/docs/patterns/components-chatdock--pattern-start-project-gate.tsx +1 -1
- package/docs/patterns/components-chatqa--pattern-qa-with-reply.tsx +1 -1
- package/docs/patterns/components-checkbox-checkbox--default.tsx +1 -1
- package/docs/patterns/components-checkbox-checkbox--with-count.tsx +1 -1
- package/docs/patterns/components-checkbox-checkbox--with-description.tsx +1 -1
- package/docs/patterns/components-checkbox-checkboxgroup--default.tsx +1 -1
- package/docs/patterns/components-checkbox-checkboxgroup--option-counts.tsx +1 -1
- package/docs/patterns/components-copyfield--clipboard-blocked.tsx +1 -1
- package/docs/patterns/components-copyfield--copied.tsx +1 -1
- package/docs/patterns/components-copyfield--copy-key.tsx +1 -1
- package/docs/patterns/components-copyfield--on-navy.tsx +1 -1
- package/docs/patterns/components-descriptionlist--details.tsx +1 -1
- package/docs/patterns/components-descriptionlist--post-metadata.tsx +1 -1
- package/docs/patterns/components-dialog--alert-dialog-destructive.tsx +1 -1
- package/docs/patterns/components-dialog--alert-dialog-typed-confirmation.tsx +1 -1
- package/docs/patterns/components-dialog--default-dialog.tsx +1 -1
- package/docs/patterns/components-dialog--form-dialog.tsx +1 -1
- package/docs/patterns/components-displaycontrols--page-utilities.tsx +1 -1
- package/docs/patterns/components-displaycontrols--theme-switch.tsx +1 -1
- package/docs/patterns/components-errorsummary--contact-form.tsx +1 -1
- package/docs/patterns/components-field--horizontal-input.tsx +1 -1
- package/docs/patterns/components-field--horizontal-text-area.tsx +1 -1
- package/docs/patterns/components-field--multi-control.tsx +1 -1
- package/docs/patterns/components-filterpanel--panel.tsx +1 -1
- package/docs/patterns/components-footerreveal--marketing-hero-pattern.tsx +1 -1
- package/docs/patterns/components-footerreveal--marketing-hero-ruled-pattern.tsx +1 -1
- package/docs/patterns/components-footerreveal--marketing-hero-with-gallery-intro.tsx +1 -1
- package/docs/patterns/components-footerreveal--marketing-page-pattern.tsx +1 -1
- package/docs/patterns/components-footerreveal--ruled-grid-footer-pattern.tsx +1 -1
- package/docs/patterns/components-footerreveal--sequenced-marketing-hero.tsx +1 -1
- package/docs/patterns/components-herointro--two-line-intro.tsx +1 -1
- package/docs/patterns/components-herointro--with-actions.tsx +1 -1
- package/docs/patterns/components-herotilestack--marketing-hero-pattern.tsx +1 -1
- package/docs/patterns/components-herotilestack--marketing-hero-text-sequence.tsx +1 -1
- package/docs/patterns/components-herotilestack--marketing-hero-with-gallery-intro.tsx +1 -1
- package/docs/patterns/components-indexlist--post-index.tsx +1 -1
- package/docs/patterns/components-intakeconfirmation--booked-pattern.tsx +1 -1
- package/docs/patterns/components-intakeconfirmation--emailed-pattern.tsx +1 -1
- package/docs/patterns/components-intakeform--about-you-pattern.tsx +1 -1
- package/docs/patterns/components-intakeform--short-form-pattern.tsx +1 -1
- package/docs/patterns/components-intakemodal--intake-modal-pattern.tsx +1 -1
- package/docs/patterns/components-kbd--command-row.tsx +1 -1
- package/docs/patterns/components-kbd--numbered-choices.tsx +1 -1
- package/docs/patterns/components-kbd--shortcut.tsx +1 -1
- package/docs/patterns/components-linktile--resource-tile.tsx +1 -1
- package/docs/patterns/components-linktile--router-link.tsx +1 -1
- package/docs/patterns/components-logview--detail-pane.tsx +1 -1
- package/docs/patterns/components-logview--log-viewer.tsx +1 -1
- package/docs/patterns/components-moremenu--action-menu.tsx +1 -1
- package/docs/patterns/components-moremenu--in-card-header.tsx +1 -1
- package/docs/patterns/components-navlist--app-sidebar.tsx +1 -1
- package/docs/patterns/components-navlist--side-nav-settings.tsx +1 -1
- package/docs/patterns/components-pageheader--app-header-pattern.tsx +1 -1
- package/docs/patterns/components-pageheader--page-section-header.tsx +1 -1
- package/docs/patterns/components-pageheader--toolbar-header.tsx +1 -1
- package/docs/patterns/components-panel--end-detail-rail.tsx +1 -1
- package/docs/patterns/components-pillgroup--pill-group-pattern.tsx +2 -2
- package/docs/patterns/components-promptbar--pattern-prompt-bar.tsx +1 -1
- package/docs/patterns/components-prose--article-body.tsx +1 -1
- package/docs/patterns/components-radio-radiogroup--default.tsx +1 -1
- package/docs/patterns/components-scrollhorizontal--project-gallery-pattern.tsx +1 -1
- package/docs/patterns/components-scrollhorizontal--with-intro.tsx +1 -1
- package/docs/patterns/components-sectioncaption--column-caption.tsx +1 -1
- package/docs/patterns/components-sectioncaption--with-action.tsx +1 -1
- package/docs/patterns/components-sheet--bottom-sheet.tsx +1 -1
- package/docs/patterns/components-sheet--end-sheet.tsx +1 -1
- package/docs/patterns/components-sheet--side-sheet-header-actions.tsx +1 -1
- package/docs/patterns/components-sheet--side-sheet-url-deep-link.tsx +1 -1
- package/docs/patterns/components-sheet--side-sheet.tsx +1 -1
- package/docs/patterns/components-sitenav--brand-and-cta.tsx +1 -1
- package/docs/patterns/components-sitenav--centered-links.tsx +1 -1
- package/docs/patterns/components-sitenav--compact.tsx +1 -1
- package/docs/patterns/components-sitenav--marketing-header.tsx +1 -1
- package/docs/patterns/components-sitenav--mega-menu.tsx +1 -1
- package/docs/patterns/components-stat--hero-stat.tsx +1 -1
- package/docs/patterns/components-stat--insights-row.tsx +1 -1
- package/docs/patterns/components-stepprogress--step-progress-pattern.tsx +1 -1
- package/docs/patterns/components-switch--default.tsx +1 -1
- package/docs/patterns/components-switch--settings-row.tsx +1 -1
- package/docs/patterns/components-tab--settings-pages.tsx +1 -1
- package/docs/patterns/components-table--approvals-with-sheet.tsx +1 -1
- package/docs/patterns/components-table--approvals.tsx +1 -1
- package/docs/patterns/components-table--basic.tsx +1 -1
- package/docs/patterns/components-taskrows--action-details.tsx +1 -1
- package/docs/patterns/components-taskrows--capsules.tsx +1 -1
- package/docs/patterns/components-taskrows--card-with-status-rows.tsx +1 -1
- package/docs/patterns/components-taskrows--controlled-expand.tsx +1 -1
- package/docs/patterns/components-taskrows--custom-slots.tsx +1 -1
- package/docs/patterns/components-taskrows--needs-you-table.tsx +1 -1
- package/docs/patterns/components-taskrows--status-list.tsx +1 -1
- package/docs/patterns/components-taskrows--tag-chips.tsx +1 -1
- package/docs/patterns/components-textarea--save-status.tsx +1 -1
- package/docs/patterns/components-textlink--external-destination.tsx +1 -1
- package/docs/patterns/components-textlink--inline-prose.tsx +1 -1
- package/docs/patterns/components-textlink--quiet-title.tsx +1 -1
- package/docs/patterns/components-textlink--supporting-copy.tsx +1 -1
- package/docs/patterns/components-textsequence--default.tsx +1 -1
- package/docs/patterns/components-textsequence--reduced-motion.tsx +1 -1
- package/docs/patterns/components-textsequence--shapes.tsx +1 -1
- package/docs/patterns/components-tilegrid--masonry.tsx +1 -1
- package/docs/patterns/components-toast--stacked-notifications.tsx +1 -1
- package/docs/patterns/components-tooltip--controlled.tsx +1 -1
- package/docs/patterns/components-tooltip--disabled-control.tsx +1 -1
- package/docs/patterns/components-tooltip--icon-action.tsx +1 -1
- package/docs/patterns/components-tooltip--keyboard-shortcut.tsx +1 -1
- package/docs/patterns/components-tooltip--placement.tsx +1 -1
- package/docs/patterns/foundations-scroll-fade--horizontal-rail.tsx +1 -1
- package/docs/patterns/foundations-scroll-fade--overflowing-list.tsx +1 -1
- package/docs/patterns/guides-chart-explorations--comparison-gallery.tsx +1 -1
- package/docs/patterns/guides-filter-panel--filtered-grid.tsx +1 -1
- package/docs/patterns/guides-filter-panel--filtered-index.tsx +1 -1
- package/docs/patterns/guides-overlay-flows--notification-preferences.tsx +1 -1
- package/docs/patterns/guides-post-page--post-page.tsx +1 -1
- package/docs/patterns/guides-profile-typography--editorial-profile.tsx +1 -1
- package/docs/patterns/guides-resource-detail--detail.tsx +1 -1
- package/docs/patterns/index.json +1 -1
- package/package.json +1 -1
|
@@ -16,60 +16,75 @@ function _(e) {
|
|
|
16
16
|
let t = g(e.children);
|
|
17
17
|
t != null && t.props.label != null && console.warn("[WMDS Field] Child has its own `label` — omit one label source (Field or control).");
|
|
18
18
|
}
|
|
19
|
-
function v({ label: s, description: l,
|
|
20
|
-
let
|
|
19
|
+
function v({ label: s, description: l, counter: u, orientation: d = "vertical", htmlFor: v, disabled: b = !1, children: x, className: S }) {
|
|
20
|
+
let C = f();
|
|
21
21
|
_({
|
|
22
22
|
label: s,
|
|
23
|
-
children:
|
|
23
|
+
children: x
|
|
24
24
|
});
|
|
25
|
-
let
|
|
25
|
+
let w = h(x), T = g(x), E = v ?? T?.props.id ?? (T == null ? void 0 : `${C}-control`), D = l == null ? void 0 : `${C}-description`, O = u == null ? void 0 : `${C}-counter`, k = [D, O].filter(Boolean).join(" ") || void 0, A = s == null ? void 0 : `${C}-legend`, j = T == null ? T : y(T, E, k), M = w > 1 ? /* @__PURE__ */ p("div", {
|
|
26
26
|
className: o,
|
|
27
|
-
children:
|
|
28
|
-
}) :
|
|
29
|
-
id:
|
|
27
|
+
children: x
|
|
28
|
+
}) : j ?? x, N = l == null ? null : /* @__PURE__ */ p("p", {
|
|
29
|
+
id: D,
|
|
30
30
|
className: t,
|
|
31
31
|
children: l
|
|
32
|
+
}), P = u == null ? null : /* @__PURE__ */ p("p", {
|
|
33
|
+
id: O,
|
|
34
|
+
className: t,
|
|
35
|
+
"data-field-counter": "",
|
|
36
|
+
children: u
|
|
32
37
|
});
|
|
33
|
-
return s == null && l == null ? /* @__PURE__ */ p("div", {
|
|
34
|
-
className: e("w-full",
|
|
35
|
-
children:
|
|
38
|
+
return s == null && l == null && u == null ? /* @__PURE__ */ p("div", {
|
|
39
|
+
className: e("w-full", S),
|
|
40
|
+
children: x
|
|
36
41
|
}) : s == null ? /* @__PURE__ */ m("div", {
|
|
37
|
-
className: e(c,
|
|
38
|
-
children: [
|
|
39
|
-
|
|
42
|
+
className: e(c, S),
|
|
43
|
+
children: [
|
|
44
|
+
N,
|
|
45
|
+
w > 1 ? x : j ?? x,
|
|
46
|
+
P
|
|
47
|
+
]
|
|
48
|
+
}) : w > 1 ? /* @__PURE__ */ m("div", {
|
|
40
49
|
role: "group",
|
|
41
|
-
"aria-labelledby":
|
|
42
|
-
"aria-describedby":
|
|
43
|
-
className: e(c,
|
|
50
|
+
"aria-labelledby": A,
|
|
51
|
+
"aria-describedby": k,
|
|
52
|
+
className: e(c, S),
|
|
44
53
|
children: [
|
|
45
54
|
/* @__PURE__ */ p("span", {
|
|
46
|
-
id:
|
|
47
|
-
className: a(
|
|
55
|
+
id: A,
|
|
56
|
+
className: a(b),
|
|
48
57
|
children: s
|
|
49
58
|
}),
|
|
50
|
-
|
|
51
|
-
|
|
59
|
+
N,
|
|
60
|
+
M,
|
|
61
|
+
P
|
|
52
62
|
]
|
|
53
|
-
}) :
|
|
54
|
-
className: e(i,
|
|
63
|
+
}) : d === "horizontal" ? /* @__PURE__ */ m("div", {
|
|
64
|
+
className: e(i, S),
|
|
55
65
|
children: [/* @__PURE__ */ p("label", {
|
|
56
|
-
htmlFor:
|
|
57
|
-
className: e(r, a(
|
|
66
|
+
htmlFor: E,
|
|
67
|
+
className: e(r, a(b)),
|
|
58
68
|
children: s
|
|
59
69
|
}), /* @__PURE__ */ m("div", {
|
|
60
70
|
className: n,
|
|
61
|
-
children: [
|
|
71
|
+
children: [
|
|
72
|
+
N,
|
|
73
|
+
M,
|
|
74
|
+
P
|
|
75
|
+
]
|
|
62
76
|
})]
|
|
63
77
|
}) : /* @__PURE__ */ m("div", {
|
|
64
|
-
className: e(c,
|
|
78
|
+
className: e(c, S),
|
|
65
79
|
children: [
|
|
66
80
|
/* @__PURE__ */ p("label", {
|
|
67
|
-
htmlFor:
|
|
68
|
-
className: a(
|
|
81
|
+
htmlFor: E,
|
|
82
|
+
className: a(b),
|
|
69
83
|
children: s
|
|
70
84
|
}),
|
|
71
|
-
|
|
72
|
-
|
|
85
|
+
N,
|
|
86
|
+
M,
|
|
87
|
+
P
|
|
73
88
|
]
|
|
74
89
|
});
|
|
75
90
|
}
|
|
@@ -2,12 +2,15 @@ export declare const fieldOrientations: readonly ["vertical", "horizontal"];
|
|
|
2
2
|
export type FieldOrientation = (typeof fieldOrientations)[number];
|
|
3
3
|
/** Vertical label → control → description — matches Input field stack rhythm. */
|
|
4
4
|
export declare const fieldVerticalStackClasses = "flex w-full flex-col gap-1.5";
|
|
5
|
-
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Label beside control — Stripe-style two-column row, from `lg` (1024) only. Below that it stacks like
|
|
7
|
+
* the vertical Field, since a side label squeezes the control on phones and tablets (Form layout L8).
|
|
8
|
+
*/
|
|
9
|
+
export declare const fieldHorizontalStackClasses = "flex w-full flex-col gap-1.5 lg:flex-row lg:items-start lg:gap-4";
|
|
10
|
+
/** Left label column from `lg` — fixed band; control column flexes. Stacked above the control below `lg`. */
|
|
11
|
+
export declare const fieldHorizontalLabelColumnClasses = "lg:w-32 lg:shrink-0 lg:pt-2.5";
|
|
12
|
+
/** Right control column in horizontal layout (full width while stacked). */
|
|
13
|
+
export declare const fieldHorizontalControlColumnClasses = "flex w-full min-w-0 flex-col gap-1.5 lg:flex-1";
|
|
11
14
|
/** Gap between multiple controls under one label. */
|
|
12
15
|
export declare const fieldMultiControlStackClasses = "flex w-full flex-col gap-2";
|
|
13
16
|
export declare const fieldLabelClasses: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fieldStyles.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/Field/fieldStyles.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,iBAAiB,qCAAsC,CAAC;AAErE,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAElE,iFAAiF;AACjF,eAAO,MAAM,yBAAyB,iCAAiC,CAAC;AAExE
|
|
1
|
+
{"version":3,"file":"fieldStyles.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/Field/fieldStyles.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,iBAAiB,qCAAsC,CAAC;AAErE,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAElE,iFAAiF;AACjF,eAAO,MAAM,yBAAyB,iCAAiC,CAAC;AAExE;;;GAGG;AACH,eAAO,MAAM,2BAA2B,qEAAqE,CAAC;AAE9G,6GAA6G;AAC7G,eAAO,MAAM,iCAAiC,kCAAkC,CAAC;AAEjF,4EAA4E;AAC5E,eAAO,MAAM,mCAAmC,mDACE,CAAC;AAEnD,qDAAqD;AACrD,eAAO,MAAM,6BAA6B,+BAA+B,CAAC;AAE1E,eAAO,MAAM,iBAAiB,QAA8B,CAAC;AAE7D,eAAO,MAAM,uBAAuB,QAA6B,CAAC;AAElE,wBAAgB,oBAAoB,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,CAE/D"}
|
|
@@ -3,7 +3,7 @@ import { cn as e } from "../../../lib/cn.js";
|
|
|
3
3
|
import { typographyClass as t } from "../../../lib/typography.js";
|
|
4
4
|
import "../../atoms/Input/inputShellStyles.js";
|
|
5
5
|
//#region src/components/molecules/Field/fieldStyles.ts
|
|
6
|
-
var n = ["vertical", "horizontal"], r = "flex w-full flex-col gap-1.5", i = "flex w-full items-start gap-4", a = "w-
|
|
6
|
+
var n = ["vertical", "horizontal"], r = "flex w-full flex-col gap-1.5", i = "flex w-full flex-col gap-1.5 lg:flex-row lg:items-start lg:gap-4", a = "lg:w-32 lg:shrink-0 lg:pt-2.5", o = "flex w-full min-w-0 flex-col gap-1.5 lg:flex-1", s = "flex w-full flex-col gap-2", c = t("ui-label"), l = t("caption");
|
|
7
7
|
function u(t) {
|
|
8
8
|
return e(c, t && "opacity-50");
|
|
9
9
|
}
|
|
@@ -16,27 +16,37 @@ export interface IntakeFormProps {
|
|
|
16
16
|
/** Character ceiling for project details. Default 400. */
|
|
17
17
|
detailsMax?: number;
|
|
18
18
|
/**
|
|
19
|
-
* Shows the optional Company field. Default `
|
|
19
|
+
* Shows the optional Company field. Default `false` (Required and optional Q9: ask less). Left out, the form closes up and
|
|
20
20
|
* `values.company` keeps its value (empty), so `isIntakeAboutValid` and the app's submit code are
|
|
21
21
|
* unchanged.
|
|
22
22
|
*/
|
|
23
23
|
company?: boolean;
|
|
24
24
|
/**
|
|
25
|
-
* Shows the optional
|
|
25
|
+
* Shows the optional website field ("Your website", with an Optional badge). Default `true`. Left out, the form closes up and `values.url`
|
|
26
26
|
* keeps its value (empty, which is valid).
|
|
27
27
|
*/
|
|
28
28
|
link?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* How many times Continue was pressed on this step (the caller counts; Buttons U6: Continue stays
|
|
31
|
+
* enabled). From 1 on, every field shows its error. Two or more errors put an **ErrorSummary** at the
|
|
32
|
+
* top and focus it; one error focuses its field (Errors and validation V5). Default 0.
|
|
33
|
+
*/
|
|
34
|
+
submitCount?: number;
|
|
29
35
|
className?: IntakeFormLayoutClassName;
|
|
30
36
|
}
|
|
31
37
|
/** Empty link is fine. A filled value must be an http(s) URL. */
|
|
32
38
|
export declare function isIntakeUrlValid(value: string | null | undefined): boolean;
|
|
33
39
|
/** Name, a real email, and details within the counter. Company and link stay optional. */
|
|
34
40
|
export declare function isIntakeAboutValid(values: IntakeAboutValues, detailsMax?: number): boolean;
|
|
41
|
+
/** Form layout L9: what the counter says. People may type past the limit; the counter tells them by how much. */
|
|
42
|
+
export declare function intakeCounterText(length: number, max: number): string;
|
|
35
43
|
/**
|
|
36
44
|
* About-you step — **Field** rows for name, email, company, link, and project details.
|
|
37
45
|
* Required fields show **Input** / **TextArea** `status` + `message` on blur when invalid.
|
|
38
|
-
*
|
|
39
|
-
*
|
|
46
|
+
* Name, email and details are required (`aria-required`); the website is optional and says so with a
|
|
47
|
+
* badge. Company is off by default (`company` shows it, labelled "Company (optional)"); `link={false}`
|
|
48
|
+
* leaves the website out (the short form: name, email, details). Hints sit above their fields; the details
|
|
49
|
+
* counter sits below the box, next to what it counts.
|
|
40
50
|
*/
|
|
41
|
-
export declare function IntakeForm({ values, onChange, detailsMax, company, link, className, }: IntakeFormProps): import("react").JSX.Element;
|
|
51
|
+
export declare function IntakeForm({ values, onChange, detailsMax, company, link, submitCount, className, }: IntakeFormProps): import("react").JSX.Element;
|
|
42
52
|
//# sourceMappingURL=IntakeForm.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntakeForm.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/IntakeForm/IntakeForm.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"IntakeForm.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/IntakeForm/IntakeForm.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,qCAAqC;AACrC,MAAM,MAAM,yBAAyB,GAAG,MAAM,CAAC;AAE/C,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,oCAAoC;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,gBAAgB,EAAE,iBAM9B,CAAC;AAEF,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,iBAAiB,CAAC;IAC1B,QAAQ,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC9C,0DAA0D;IAC1D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,yBAAyB,CAAC;CACvC;AAMD,iEAAiE;AACjE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAW1E;AAED,0FAA0F;AAC1F,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,iBAAiB,EACzB,UAAU,GAAE,MAAyB,GACpC,OAAO,CAQT;AAID,iHAAiH;AACjH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAErE;AA0CD;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,EACzB,MAAM,EACN,QAAQ,EACR,UAA6B,EAC7B,OAAe,EACf,IAAW,EACX,WAAe,EACf,SAAS,GACV,EAAE,eAAe,+BA+HjB"}
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn as e } from "../../../lib/cn.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
3
|
+
import { Badge as t } from "../../atoms/Badge/Badge.js";
|
|
4
|
+
import { Input as n } from "../../atoms/Input/Input.js";
|
|
5
|
+
import { TextArea as r } from "../../atoms/TextArea/TextArea.js";
|
|
6
|
+
import { Field as i } from "../Field/Field.js";
|
|
7
|
+
import { ErrorSummary as a } from "../ErrorSummary/ErrorSummary.js";
|
|
8
|
+
import { intakeDetailsMax as o, intakeFormClasses as s } from "./intakeFormStyles.js";
|
|
9
|
+
import { useEffect as c, useId as l, useState as u } from "react";
|
|
10
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
9
11
|
//#region src/components/molecules/IntakeForm/IntakeForm.tsx
|
|
10
|
-
var
|
|
12
|
+
var p = {
|
|
11
13
|
name: "",
|
|
12
14
|
email: "",
|
|
13
15
|
company: "",
|
|
14
16
|
url: "",
|
|
15
17
|
details: ""
|
|
16
|
-
},
|
|
17
|
-
function
|
|
18
|
+
}, m = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
19
|
+
function h(e) {
|
|
18
20
|
let t = (e ?? "").trim();
|
|
19
21
|
if (t.length === 0) return !0;
|
|
20
22
|
try {
|
|
@@ -24,112 +26,150 @@ function d(e) {
|
|
|
24
26
|
return !1;
|
|
25
27
|
}
|
|
26
28
|
}
|
|
27
|
-
function
|
|
28
|
-
return e.name.trim().length > 0 &&
|
|
29
|
+
function g(e, t = 400) {
|
|
30
|
+
return e.name.trim().length > 0 && m.test(e.email.trim()) && h(e.url) && e.details.trim().length > 0 && e.details.length <= t;
|
|
29
31
|
}
|
|
30
|
-
|
|
32
|
+
var _ = (e) => `${e} character${e === 1 ? "" : "s"}`;
|
|
33
|
+
function v(e, t) {
|
|
34
|
+
return e > t ? `You have ${_(e - t)} too many` : `${_(t - e)} left`;
|
|
35
|
+
}
|
|
36
|
+
function y(e, t = 1e3) {
|
|
37
|
+
let [n, r] = u(e);
|
|
38
|
+
return c(() => {
|
|
39
|
+
let n = setTimeout(() => r(e), t);
|
|
40
|
+
return () => clearTimeout(n);
|
|
41
|
+
}, [e, t]), n;
|
|
42
|
+
}
|
|
43
|
+
function b(e, t, n) {
|
|
31
44
|
if (e === "name") return t.name.trim().length === 0 ? "Enter your name." : void 0;
|
|
32
|
-
if (e === "email") return t.email.trim().length === 0 ? "Enter your email address." :
|
|
33
|
-
if (e === "url") return
|
|
45
|
+
if (e === "email") return t.email.trim().length === 0 ? "Enter your email address." : m.test(t.email.trim()) ? void 0 : "Enter an email address like name@example.com.";
|
|
46
|
+
if (e === "url") return h(t.url) ? void 0 : "Enter a website address like example.com.";
|
|
34
47
|
if (t.details.trim().length === 0) return "Tell us a bit about the project.";
|
|
35
|
-
if (t.details.length > n) return
|
|
48
|
+
if (t.details.length > n) return v(t.details.length, n);
|
|
36
49
|
}
|
|
37
|
-
function
|
|
38
|
-
let [
|
|
39
|
-
function
|
|
40
|
-
|
|
50
|
+
function x({ values: o, onChange: p, detailsMax: m = 400, company: h = !1, link: g = !0, submitCount: _ = 0, className: x }) {
|
|
51
|
+
let [S, C] = u({}), w = l(), T = (e) => `${w}-${e}`, E = _ > 0;
|
|
52
|
+
function D(e) {
|
|
53
|
+
C((t) => t[e] ? t : {
|
|
41
54
|
...t,
|
|
42
55
|
[e]: !0
|
|
43
56
|
});
|
|
44
57
|
}
|
|
45
|
-
function
|
|
46
|
-
if (
|
|
58
|
+
function O(e) {
|
|
59
|
+
if (!(!S[e] && !E)) return b(e, o, m);
|
|
47
60
|
}
|
|
48
|
-
let
|
|
49
|
-
|
|
50
|
-
|
|
61
|
+
let k = O("name"), A = O("email"), j = O("url"), M = O("details"), N = v(o.details.length, m), P = y(N), F = E ? [
|
|
62
|
+
["name", k],
|
|
63
|
+
["email", A],
|
|
64
|
+
...g ? [["url", j]] : [],
|
|
65
|
+
["details", M]
|
|
66
|
+
].filter(([, e]) => e != null).map(([e, t]) => ({
|
|
67
|
+
field: T(e),
|
|
68
|
+
message: t
|
|
69
|
+
})) : [], I = F.length === 1 ? F[0].field : void 0;
|
|
70
|
+
return c(() => {
|
|
71
|
+
_ > 0 && I != null && document.getElementById(I)?.focus();
|
|
72
|
+
}, [_]), /* @__PURE__ */ f("div", {
|
|
73
|
+
className: e(s, x),
|
|
51
74
|
children: [
|
|
52
|
-
/* @__PURE__ */
|
|
75
|
+
F.length >= 2 ? /* @__PURE__ */ d(a, { errors: F }, _) : null,
|
|
76
|
+
/* @__PURE__ */ d(i, {
|
|
53
77
|
label: "Name",
|
|
54
|
-
children: /* @__PURE__ */
|
|
78
|
+
children: /* @__PURE__ */ d(n, {
|
|
79
|
+
id: T("name"),
|
|
55
80
|
"aria-label": "Name",
|
|
81
|
+
"aria-required": !0,
|
|
56
82
|
autoComplete: "name",
|
|
57
|
-
value:
|
|
58
|
-
status:
|
|
59
|
-
message:
|
|
60
|
-
onBlur: () =>
|
|
61
|
-
onChange: (e) =>
|
|
62
|
-
...
|
|
83
|
+
value: o.name,
|
|
84
|
+
status: k == null ? void 0 : "error",
|
|
85
|
+
message: k,
|
|
86
|
+
onBlur: () => D("name"),
|
|
87
|
+
onChange: (e) => p({
|
|
88
|
+
...o,
|
|
63
89
|
name: e.target.value
|
|
64
90
|
})
|
|
65
91
|
})
|
|
66
92
|
}),
|
|
67
|
-
/* @__PURE__ */
|
|
93
|
+
/* @__PURE__ */ d(i, {
|
|
68
94
|
label: "Email",
|
|
69
|
-
children: /* @__PURE__ */
|
|
95
|
+
children: /* @__PURE__ */ d(n, {
|
|
96
|
+
id: T("email"),
|
|
70
97
|
"aria-label": "Email",
|
|
98
|
+
"aria-required": !0,
|
|
71
99
|
type: "email",
|
|
72
100
|
autoComplete: "email",
|
|
73
|
-
value:
|
|
74
|
-
status:
|
|
75
|
-
message:
|
|
76
|
-
onBlur: () =>
|
|
77
|
-
onChange: (e) =>
|
|
78
|
-
...
|
|
101
|
+
value: o.email,
|
|
102
|
+
status: A == null ? void 0 : "error",
|
|
103
|
+
message: A,
|
|
104
|
+
onBlur: () => D("email"),
|
|
105
|
+
onChange: (e) => p({
|
|
106
|
+
...o,
|
|
79
107
|
email: e.target.value
|
|
80
108
|
})
|
|
81
109
|
})
|
|
82
110
|
}),
|
|
83
|
-
|
|
84
|
-
label: "Company",
|
|
85
|
-
description: "
|
|
86
|
-
children: /* @__PURE__ */
|
|
87
|
-
"aria-label": "Company",
|
|
111
|
+
h ? /* @__PURE__ */ d(i, {
|
|
112
|
+
label: "Company (optional)",
|
|
113
|
+
description: "So we can read up on you first.",
|
|
114
|
+
children: /* @__PURE__ */ d(n, {
|
|
115
|
+
"aria-label": "Company (optional)",
|
|
88
116
|
autoComplete: "organization",
|
|
89
|
-
value:
|
|
90
|
-
onChange: (e) =>
|
|
91
|
-
...
|
|
117
|
+
value: o.company,
|
|
118
|
+
onChange: (e) => p({
|
|
119
|
+
...o,
|
|
92
120
|
company: e.target.value
|
|
93
121
|
})
|
|
94
122
|
})
|
|
95
123
|
}) : null,
|
|
96
|
-
|
|
97
|
-
label: "
|
|
98
|
-
description: "
|
|
99
|
-
children: /* @__PURE__ */
|
|
100
|
-
|
|
124
|
+
g ? /* @__PURE__ */ d(i, {
|
|
125
|
+
label: "Your website",
|
|
126
|
+
description: "So we can see what you have now.",
|
|
127
|
+
children: /* @__PURE__ */ d(n, {
|
|
128
|
+
id: T("url"),
|
|
129
|
+
"aria-label": "Your website",
|
|
130
|
+
endBadge: /* @__PURE__ */ d(t, {
|
|
131
|
+
size: "sm",
|
|
132
|
+
children: "Optional"
|
|
133
|
+
}),
|
|
101
134
|
type: "url",
|
|
102
135
|
inputMode: "url",
|
|
103
136
|
autoComplete: "url",
|
|
104
|
-
value:
|
|
105
|
-
status:
|
|
106
|
-
message:
|
|
107
|
-
onBlur: () =>
|
|
108
|
-
onChange: (e) =>
|
|
109
|
-
...
|
|
137
|
+
value: o.url,
|
|
138
|
+
status: j == null ? void 0 : "error",
|
|
139
|
+
message: j,
|
|
140
|
+
onBlur: () => D("url"),
|
|
141
|
+
onChange: (e) => p({
|
|
142
|
+
...o,
|
|
110
143
|
url: e.target.value
|
|
111
144
|
})
|
|
112
145
|
})
|
|
113
146
|
}) : null,
|
|
114
|
-
/* @__PURE__ */
|
|
147
|
+
/* @__PURE__ */ d(i, {
|
|
115
148
|
label: "What should feel different when this work is done?",
|
|
116
|
-
|
|
117
|
-
children: /* @__PURE__ */
|
|
149
|
+
counter: M == null ? N : void 0,
|
|
150
|
+
children: /* @__PURE__ */ d(r, {
|
|
151
|
+
id: T("details"),
|
|
118
152
|
"aria-label": "What should feel different when this work is done?",
|
|
153
|
+
"aria-required": !0,
|
|
119
154
|
rows: 5,
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
...i,
|
|
155
|
+
value: o.details,
|
|
156
|
+
status: M == null ? void 0 : "error",
|
|
157
|
+
message: M,
|
|
158
|
+
onBlur: () => D("details"),
|
|
159
|
+
onChange: (e) => p({
|
|
160
|
+
...o,
|
|
127
161
|
details: e.target.value
|
|
128
162
|
})
|
|
129
163
|
})
|
|
164
|
+
}),
|
|
165
|
+
/* @__PURE__ */ d("p", {
|
|
166
|
+
className: "sr-only",
|
|
167
|
+
"aria-live": "polite",
|
|
168
|
+
"data-intake-counter-live": "",
|
|
169
|
+
children: P
|
|
130
170
|
})
|
|
131
171
|
]
|
|
132
172
|
});
|
|
133
173
|
}
|
|
134
174
|
//#endregion
|
|
135
|
-
export {
|
|
175
|
+
export { x as IntakeForm, p as intakeAboutEmpty, v as intakeCounterText, o as intakeDetailsMax, g as isIntakeAboutValid, h as isIntakeUrlValid };
|
|
@@ -4,8 +4,12 @@ export type PillGroupLayoutClassName = string;
|
|
|
4
4
|
export declare const pillGroupEmphases: readonly ["solid", "muted"];
|
|
5
5
|
export type PillGroupEmphasis = (typeof pillGroupEmphases)[number];
|
|
6
6
|
export interface PillGroupProps {
|
|
7
|
-
/**
|
|
8
|
-
|
|
7
|
+
/**
|
|
8
|
+
* The question, shown above the pills and naming the group (Dropdowns C2, C9). Prefer it to `aria-label`.
|
|
9
|
+
*/
|
|
10
|
+
label?: ReactNode;
|
|
11
|
+
/** Accessible name when the question is visible elsewhere (a heading right above). */
|
|
12
|
+
"aria-label"?: string;
|
|
9
13
|
value: string | null;
|
|
10
14
|
onValueChange: (value: string) => void;
|
|
11
15
|
children: ReactNode;
|
|
@@ -21,7 +25,7 @@ export interface PillGroupItemProps {
|
|
|
21
25
|
emphasis?: PillGroupEmphasis;
|
|
22
26
|
className?: PillGroupLayoutClassName;
|
|
23
27
|
}
|
|
24
|
-
declare function PillGroupRoot({ "aria-label": ariaLabel, value, onValueChange, children, className, }: PillGroupProps): import("react").JSX.Element;
|
|
28
|
+
declare function PillGroupRoot({ label, "aria-label": ariaLabel, value, onValueChange, children, className, }: PillGroupProps): import("react").JSX.Element;
|
|
25
29
|
/** One radio pill. Wraps with its siblings. */
|
|
26
30
|
declare function PillGroupItem({ value, children, emphasis, className, }: PillGroupItemProps): import("react").JSX.Element;
|
|
27
31
|
export declare const PillGroup: typeof PillGroupRoot & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PillGroup.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/PillGroup/PillGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"PillGroup.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/PillGroup/PillGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAWf,qCAAqC;AACrC,MAAM,MAAM,wBAAwB,GAAG,MAAM,CAAC;AAE9C,eAAO,MAAM,iBAAiB,6BAA8B,CAAC;AAE7D,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAkBnE,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,sFAAsF;IACtF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,wBAAwB,CAAC;CACtC;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,SAAS,CAAC,EAAE,wBAAwB,CAAC;CACtC;AASD,iBAAS,aAAa,CAAC,EACrB,KAAK,EACL,YAAY,EAAE,SAAS,EACvB,KAAK,EACL,aAAa,EACb,QAAQ,EACR,SAAS,GACV,EAAE,cAAc,+BAgChB;AAED,+CAA+C;AAC/C,iBAAS,aAAa,CAAC,EACrB,KAAK,EACL,QAAQ,EACR,QAAkB,EAClB,SAAS,GACV,EAAE,kBAAkB,+BAiBpB;AAED,eAAO,MAAM,SAAS;;CAEpB,CAAC"}
|
|
@@ -1,53 +1,63 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn as e } from "../../../lib/cn.js";
|
|
3
|
-
import { pillGroupClasses as t,
|
|
4
|
-
import { createContext as
|
|
5
|
-
import { jsx as
|
|
3
|
+
import { pillGroupClasses as t, pillGroupFieldClasses as n, pillGroupIdleClasses as r, pillGroupLabelClasses as i, pillGroupMutedClasses as a, pillGroupSelectedClasses as o } from "./pillGroupStyles.js";
|
|
4
|
+
import { createContext as s, useContext as c, useId as l } from "react";
|
|
5
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
6
6
|
//#region src/components/molecules/PillGroup/PillGroup.tsx
|
|
7
|
-
var
|
|
8
|
-
function
|
|
9
|
-
let t =
|
|
7
|
+
var f = ["solid", "muted"], p = s(null);
|
|
8
|
+
function m(e) {
|
|
9
|
+
let t = c(p);
|
|
10
10
|
if (t == null) throw Error(`${e} must be used inside PillGroup.`);
|
|
11
11
|
return t;
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
return e ?
|
|
13
|
+
function h(e, t) {
|
|
14
|
+
return e ? o : t === "muted" ? a : r;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
let
|
|
18
|
-
|
|
16
|
+
function g({ label: r, "aria-label": a, value: o, onValueChange: s, children: c, className: f }) {
|
|
17
|
+
let m = l(), h = `${m}-label`;
|
|
18
|
+
r == null && a == null && console.warn("[WMDS PillGroup] Provide `label` (the question) or `aria-label`.");
|
|
19
|
+
let g = /* @__PURE__ */ u("div", {
|
|
20
|
+
role: "radiogroup",
|
|
21
|
+
"aria-label": r == null ? a : void 0,
|
|
22
|
+
"aria-labelledby": r == null ? void 0 : h,
|
|
23
|
+
className: e(t, r == null && f),
|
|
24
|
+
children: c
|
|
25
|
+
});
|
|
26
|
+
return /* @__PURE__ */ u(p.Provider, {
|
|
19
27
|
value: {
|
|
20
|
-
name:
|
|
21
|
-
value:
|
|
22
|
-
onValueChange:
|
|
28
|
+
name: m,
|
|
29
|
+
value: o,
|
|
30
|
+
onValueChange: s
|
|
23
31
|
},
|
|
24
|
-
children: /* @__PURE__ */
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
children: r == null ? g : /* @__PURE__ */ d("div", {
|
|
33
|
+
className: e(n, f),
|
|
34
|
+
children: [/* @__PURE__ */ u("span", {
|
|
35
|
+
id: h,
|
|
36
|
+
className: i,
|
|
37
|
+
children: r
|
|
38
|
+
}), g]
|
|
29
39
|
})
|
|
30
40
|
});
|
|
31
41
|
}
|
|
32
|
-
function
|
|
33
|
-
let a =
|
|
34
|
-
return /* @__PURE__ */
|
|
42
|
+
function _({ value: t, children: n, emphasis: r = "solid", className: i }) {
|
|
43
|
+
let a = m("PillGroup.Item"), o = a.value === t;
|
|
44
|
+
return /* @__PURE__ */ d("label", {
|
|
35
45
|
className: "inline-flex",
|
|
36
46
|
"data-emphasis": r,
|
|
37
47
|
"data-value": t,
|
|
38
|
-
children: [/* @__PURE__ */
|
|
48
|
+
children: [/* @__PURE__ */ u("input", {
|
|
39
49
|
type: "radio",
|
|
40
50
|
className: "peer sr-only",
|
|
41
51
|
name: a.name,
|
|
42
52
|
value: t,
|
|
43
53
|
checked: o,
|
|
44
54
|
onChange: () => a.onValueChange(t)
|
|
45
|
-
}), /* @__PURE__ */
|
|
46
|
-
className: e(
|
|
55
|
+
}), /* @__PURE__ */ u("span", {
|
|
56
|
+
className: e(h(o, r), i),
|
|
47
57
|
children: n
|
|
48
58
|
})]
|
|
49
59
|
});
|
|
50
60
|
}
|
|
51
|
-
var
|
|
61
|
+
var v = Object.assign(g, { Item: _ });
|
|
52
62
|
//#endregion
|
|
53
|
-
export {
|
|
63
|
+
export { v as PillGroup, f as pillGroupEmphases };
|
|
@@ -10,4 +10,7 @@ export declare const pillGroupIdleClasses: string;
|
|
|
10
10
|
export declare const pillGroupMutedClasses: string;
|
|
11
11
|
/** Selected pill — brand navy fill. Owned by PillGroup, not a Badge variant. */
|
|
12
12
|
export declare const pillGroupSelectedClasses: string;
|
|
13
|
+
/** Question above the pills (Dropdowns C2, C9). */
|
|
14
|
+
export declare const pillGroupFieldClasses = "flex flex-col gap-2";
|
|
15
|
+
export declare const pillGroupLabelClasses: string;
|
|
13
16
|
//# sourceMappingURL=pillGroupStyles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pillGroupStyles.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/PillGroup/pillGroupStyles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pillGroupStyles.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/PillGroup/pillGroupStyles.ts"],"names":[],"mappings":"AAIA,4FAA4F;AAC5F,eAAO,MAAM,gBAAgB,yBAAyB,CAAC;AAEvD,eAAO,MAAM,qBAAqB,QAIjC,CAAC;AAEF,6CAA6C;AAC7C,eAAO,MAAM,oBAAoB,QAAuD,CAAC;AAEzF;;;GAGG;AACH,eAAO,MAAM,qBAAqB,QAAuD,CAAC;AAE1F,gFAAgF;AAChF,eAAO,MAAM,wBAAwB,QAGpC,CAAC;AAEF,mDAAmD;AACnD,eAAO,MAAM,qBAAqB,wBAAwB,CAAC;AAE3D,eAAO,MAAM,qBAAqB,QAA8B,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn as e } from "../../../lib/cn.js";
|
|
3
|
-
import {
|
|
3
|
+
import { typographyClass as t } from "../../../lib/typography.js";
|
|
4
|
+
import { badgeBaseClasses as n, badgeMutedClasses as r, badgeSolidClasses as i } from "../../atoms/Badge/badgeStyles.js";
|
|
4
5
|
//#region src/components/molecules/PillGroup/pillGroupStyles.ts
|
|
5
|
-
var
|
|
6
|
+
var a = "flex flex-wrap gap-2", o = e(n, "min-h-11 cursor-pointer rounded-[var(--radius-control)] px-4", "peer-focus-visible:ring-2 peer-focus-visible:ring-focus-ring peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-body"), s = e(o, i.neutral), c = e(o, r.neutral), l = e(o, "border border-transparent bg-brand text-on-brand"), u = "flex flex-col gap-2", d = t("ui-label");
|
|
6
7
|
//#endregion
|
|
7
|
-
export {
|
|
8
|
+
export { a as pillGroupClasses, u as pillGroupFieldClasses, s as pillGroupIdleClasses, d as pillGroupLabelClasses, c as pillGroupMutedClasses, l as pillGroupSelectedClasses, o as pillGroupShapeClasses };
|
|
@@ -5,7 +5,7 @@ export type { SearchSize } from "./searchStyles";
|
|
|
5
5
|
export { searchSizes } from "./searchStyles";
|
|
6
6
|
/** Layout-only — width, margin, flex placement. */
|
|
7
7
|
export type SearchLayoutClassName = string;
|
|
8
|
-
export interface SearchProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size"> {
|
|
8
|
+
export interface SearchProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "width"> {
|
|
9
9
|
size?: SearchSize;
|
|
10
10
|
/**
|
|
11
11
|
* The field's name, read by screen readers (Labels and placeholders F7, F10). It may stay visually
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Search.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/Search/Search.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,mBAAmB,EAAE,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAEhF,OAAO,EAAU,KAAK,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEpE,OAAO,EAKL,KAAK,UAAU,EAChB,MAAM,gBAAgB,CAAC;AAExB,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,mDAAmD;AACnD,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC;AAE3C,MAAM,WAAW,WACf,SAAQ,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"Search.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/Search/Search.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,mBAAmB,EAAE,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAEhF,OAAO,EAAU,KAAK,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEpE,OAAO,EAKL,KAAK,UAAU,EAChB,MAAM,gBAAgB,CAAC;AAExB,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,mDAAmD;AACnD,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC;AAE3C,MAAM,WAAW,WACf,SAAQ,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACrE,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4DAA4D;IAC5D,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,wCAAwC;IACxC,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,SAAS,CAAC,EAAE,qBAAqB,CAAC;CACnC;AAED;;;GAGG;AACH,eAAO,MAAM,MAAM,0GA4CjB,CAAC"}
|