@thewhatmatters/wmds 0.4.31 → 0.4.32
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 +22 -0
- package/bin/wmds-check.mjs +38 -0
- package/dist/components/atoms/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/components/atoms/Checkbox/Checkbox.js +73 -72
- package/dist/components/atoms/Input/Input.d.ts.map +1 -1
- package/dist/components/atoms/Input/Input.js +44 -49
- package/dist/components/atoms/Input/inputShellStyles.js +2 -2
- package/dist/components/atoms/Radio/Radio.d.ts.map +1 -1
- package/dist/components/atoms/Radio/Radio.js +61 -60
- package/dist/components/atoms/Switch/Switch.d.ts.map +1 -1
- package/dist/components/atoms/Switch/Switch.js +31 -30
- package/dist/components/atoms/TextArea/TextArea.d.ts.map +1 -1
- package/dist/components/atoms/TextArea/TextArea.js +56 -55
- package/dist/components/atoms/TextArea/textareaShellStyles.js +2 -2
- package/dist/components/atoms/inputShared/InputStatusBanner.d.ts +5 -0
- package/dist/components/atoms/inputShared/InputStatusBanner.d.ts.map +1 -1
- package/dist/components/atoms/inputShared/InputStatusBanner.js +15 -4
- package/dist/components/molecules/CheckboxGroup/CheckboxGroup.d.ts.map +1 -1
- package/dist/components/molecules/CheckboxGroup/CheckboxGroup.js +53 -53
- package/dist/components/molecules/CopyField/copyFieldStyles.d.ts.map +1 -1
- package/dist/components/molecules/CopyField/copyFieldStyles.js +1 -1
- package/dist/components/molecules/ErrorSummary/ErrorSummary.d.ts +32 -0
- package/dist/components/molecules/ErrorSummary/ErrorSummary.d.ts.map +1 -0
- package/dist/components/molecules/ErrorSummary/ErrorSummary.js +37 -0
- package/dist/components/molecules/ErrorSummary/errorSummaryStyles.d.ts +12 -0
- package/dist/components/molecules/ErrorSummary/errorSummaryStyles.d.ts.map +1 -0
- package/dist/components/molecules/ErrorSummary/errorSummaryStyles.js +5 -0
- package/dist/components/molecules/IntakeForm/IntakeForm.d.ts.map +1 -1
- package/dist/components/molecules/IntakeForm/IntakeForm.js +4 -6
- package/dist/components/molecules/PromptBar/promptBarStyles.d.ts +3 -2
- package/dist/components/molecules/PromptBar/promptBarStyles.d.ts.map +1 -1
- package/dist/components/molecules/PromptBar/promptBarStyles.js +2 -2
- package/dist/components/molecules/RadioGroup/RadioGroup.d.ts.map +1 -1
- package/dist/components/molecules/RadioGroup/RadioGroup.js +53 -53
- package/dist/components/molecules/Search/Search.d.ts +5 -0
- package/dist/components/molecules/Search/Search.d.ts.map +1 -1
- package/dist/components/molecules/Search/Search.js +14 -13
- package/dist/components/molecules/Search/searchStyles.d.ts +2 -1
- package/dist/components/molecules/Search/searchStyles.d.ts.map +1 -1
- package/dist/components/molecules/Search/searchStyles.js +4 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/styles.css +1 -1
- package/docs/components.md +2 -1
- package/docs/exports.json +14 -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 +3 -3
- 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 +35 -0
- package/docs/patterns/components-field--horizontal-input.tsx +2 -2
- package/docs/patterns/components-field--horizontal-text-area.tsx +2 -2
- package/docs/patterns/components-field--multi-control.tsx +2 -2
- 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 +1 -1
- 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 +3 -3
- 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 +3 -3
- 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 +9 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,28 @@ Every release of `@thewhatmatters/wmds` is listed here, newest first.
|
|
|
7
7
|
- **Pasted patterns:** when a release changes a **Pattern — …** story's Show code, it is named under Consumer actions so apps re-copy it.
|
|
8
8
|
- **How to add an entry** (contributors): add your change to the top entry. If that version is already on npm (`npm view @thewhatmatters/wmds versions`), start a new entry above it and bump `version` in `package.json` to match. `npm run check:changelog` enforces the format.
|
|
9
9
|
|
|
10
|
+
## 0.4.32
|
|
11
|
+
|
|
12
|
+
**Errors and validation: an error summary, errors announced as errors, no lost typing, and no iOS zoom. Labels and placeholders: every field named, the hint above the field, and inset buttons you can tap and see focused.**
|
|
13
|
+
|
|
14
|
+
- **ErrorSummary** (new): "There's a problem" at the top of a form after a failed submit, one link per error in the field's own words. It takes focus when it appears, and each link moves focus to its field (V5). Story **Components/ErrorSummary → Pattern — form with an error summary**; interaction test **Internal/Interactions/ErrorSummary**.
|
|
15
|
+
- **Input, TextArea, Checkbox, Radio, Switch, CheckboxGroup, RadioGroup**: the status band reads a visually hidden "Error:" or "Warning:" before the message, so screen readers hear what kind of message it is (V6).
|
|
16
|
+
- **Status without a message** (V10): those components warn in the console when `status="error"` or `"warning"` has no `message`. **wmds-check** `status-without-message` (new, error) catches it in app code. A status-only success tick is fine.
|
|
17
|
+
- **Input** keeps the same `<input>` when a status appears. It used to swap its wrapper and remount the field, which dropped focus and, in an uncontrolled field, **what people had typed** (V4).
|
|
18
|
+
- **No iOS zoom:** Input, TextArea and Search (`sm` and `md`) and PromptBar set 16px text on touch screens (`pointer: coarse`), so Safari doesn't zoom the page when a field gets focus. Fine pointers keep 12px / 14px.
|
|
19
|
+
- **IntakeForm** default messages follow V1: "Enter your email address." for an empty field, "Enter an email address like name@example.com." and "Enter a website address like example.com." for a broken rule (were "Please enter a valid email address." / "…URL.").
|
|
20
|
+
- Unit test: every status band's message clears 4.5:1 on its band in light and dark (V7: 4.62–6.97:1 measured).
|
|
21
|
+
- **A success tick only** (V8): a status-only `success` on Input or TextArea shows the tick and keeps the normal border (it also turned the border green).
|
|
22
|
+
- **The hint sits above the field** (Labels F8): Input and TextArea render `description` between the label and the field, and keep it when a status message shows (it used to sit below and hide behind the message). Story **Components/Input → Pattern — hint with an error**.
|
|
23
|
+
- **Label required** (F7): **wmds-check** `missing-label` (new, error) fails an Input, TextArea, Select or Search with no `label`, `aria-label` or `aria-labelledby`. Hide a label (`aria-label`) only on a field alone with its button: search, a one-field newsletter.
|
|
24
|
+
- **Search** takes a `label` prop: the field's name for screen readers, which may stay hidden (F10). It warns in the console when there's no label at all.
|
|
25
|
+
- **Inset buttons** (F10) in Search, PromptBar and CopyField get a 44px tap area on touch screens, and show their own focus ring. The pill's ring now marks only the field (Search used to ring the whole pill for the button too; PromptBar and CopyField hid the button's ring).
|
|
26
|
+
- **No placeholders in forms** (F9): IntakeForm drops its placeholders ("https://", "What should feel different…"), and the stories no longer put examples in placeholders. Search keeps one, naming the action.
|
|
27
|
+
|
|
28
|
+
### Consumer actions
|
|
29
|
+
|
|
30
|
+
None required. Fix any `status="error"` / `"warning"` without a `message` that `npx wmds-check` reports; say what's wrong and how to fix it. After a failed submit, add **ErrorSummary** at the top of the form (copy the Pattern). On phones and tablets, field text is now 16px. Give every field a `label` (fix what `npx wmds-check` reports as `missing-label`); pass `label` to Search; move examples and formats out of placeholders into `description`. If you style around the hint, it now renders above the field.
|
|
31
|
+
|
|
10
32
|
## 0.4.31
|
|
11
33
|
|
|
12
34
|
**SiteNav's phone menu follows the Header rule: a "Menu" button that becomes "Close", a full-height panel under the bar, and a link tap closes it.**
|
package/bin/wmds-check.mjs
CHANGED
|
@@ -18,6 +18,10 @@
|
|
|
18
18
|
* content, data, handlers, and exports may change
|
|
19
19
|
* pattern-stale warn a pasted pattern's header names an older package version
|
|
20
20
|
* pattern-removed error a pasted pattern's id no longer ships
|
|
21
|
+
* status-without-message error a WMDS field with status="error" or "warning" and no message
|
|
22
|
+
* (Errors and validation V10; a status-only success tick is fine)
|
|
23
|
+
* missing-label error a WMDS Input, TextArea, Select or Search with no label, aria-label or
|
|
24
|
+
* aria-labelledby (Labels and placeholders F7; a spread {...props} is trusted)
|
|
21
25
|
* brand-contrast error a brand-kit pair in the app's CSS under WCAG AA 4.5:1: --color-on-X (and
|
|
22
26
|
* --color-on-X-muted) on --color-X, for primary, brand-surface and field,
|
|
23
27
|
* when both are hex values in the same rule
|
|
@@ -235,6 +239,40 @@ for (const file of files) {
|
|
|
235
239
|
}
|
|
236
240
|
});
|
|
237
241
|
|
|
242
|
+
// Reads a JSX element whole from its "<" (it may span lines), counting braces so `=>` and `{…}`
|
|
243
|
+
// values don't end it early.
|
|
244
|
+
const elementFrom = (start) => {
|
|
245
|
+
let depth = 0;
|
|
246
|
+
let end = start + 1;
|
|
247
|
+
for (; end < source.length; end++) {
|
|
248
|
+
const char = source[end];
|
|
249
|
+
if (char === "{") depth++;
|
|
250
|
+
else if (char === "}") depth--;
|
|
251
|
+
else if (char === ">" && depth === 0 && source[end - 1] !== "=") break;
|
|
252
|
+
}
|
|
253
|
+
return source.slice(start, end + 1);
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
// F7: every field has a name. A hidden one (aria-label) is the app's call; none at all fails.
|
|
257
|
+
if (/from\s+["']@thewhatmatters\/wmds["']/.test(source)) {
|
|
258
|
+
for (const match of source.matchAll(/<(Input|TextArea|Select|Search)(?=[\s/>])/g)) {
|
|
259
|
+
const element = elementFrom(match.index);
|
|
260
|
+
if (/\b(label|aria-label|aria-labelledby)=|\{\s*\.\.\./.test(element)) continue;
|
|
261
|
+
const line = source.slice(0, match.index).split("\n").length;
|
|
262
|
+
if (ignored(lines, line - 1, "missing-label")) continue;
|
|
263
|
+
report(file, line, "missing-label", "error", `<${match[1]}> has no label — add label (or aria-label when it sits alone with its button)`);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// V10: an error or warning status always says what's wrong.
|
|
268
|
+
for (const match of source.matchAll(/\bstatus=(?:"(error|warning)"|\{\s*["'](error|warning)["']\s*\})/g)) {
|
|
269
|
+
const element = elementFrom(source.lastIndexOf("<", match.index));
|
|
270
|
+
if (!/^<[A-Z]/.test(element) || /\bmessage=/.test(element)) continue;
|
|
271
|
+
const line = source.slice(0, match.index).split("\n").length;
|
|
272
|
+
if (ignored(lines, line - 1, "status-without-message")) continue;
|
|
273
|
+
report(file, line, "status-without-message", "error", `status="${match[1] ?? match[2]}" with no message — say what's wrong and how to fix it`);
|
|
274
|
+
}
|
|
275
|
+
|
|
238
276
|
// Pasted patterns.
|
|
239
277
|
// The header is the file's first comment line. A "use client" / "use server" directive or blank
|
|
240
278
|
// lines may come before it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../../src/components/atoms/Checkbox/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,mBAAmB,EACzB,MAAM,OAAO,CAAC;AAIf,OAAO,EAoBL,KAAK,YAAY,EAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAa,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExE,OAAO,EAAE,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,KAAK,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAE5E,qDAAqD;AACrD,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC;AAE7C,MAAM,WAAW,aACf,SAAQ,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpE,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,2EAA2E;IAC3E,KAAK,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,sCAAsC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wFAAwF;IACxF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kEAAkE;IAClE,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,iEAAiE;IACjE,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,yDAAyD;IACzD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iDAAiD;IACjD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,uBAAuB,CAAC;CACrC;AAcD;;;GAGG;AACH,eAAO,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../../src/components/atoms/Checkbox/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,mBAAmB,EACzB,MAAM,OAAO,CAAC;AAIf,OAAO,EAoBL,KAAK,YAAY,EAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAa,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExE,OAAO,EAAE,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,KAAK,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAE5E,qDAAqD;AACrD,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC;AAE7C,MAAM,WAAW,aACf,SAAQ,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpE,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,2EAA2E;IAC3E,KAAK,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,sCAAsC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wFAAwF;IACxF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kEAAkE;IAClE,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,iEAAiE;IACjE,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,yDAAyD;IACzD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iDAAiD;IACjD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,uBAAuB,CAAC;CACrC;AAcD;;;GAGG;AACH,eAAO,MAAM,QAAQ,4GAiNnB,CAAC"}
|
|
@@ -1,119 +1,120 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn as e } from "../../../lib/cn.js";
|
|
3
3
|
import "../Input/inputShellStyles.js";
|
|
4
|
-
import { InputStatusBanner as t } from "../inputShared/InputStatusBanner.js";
|
|
5
|
-
import { checkboxBoxClassesFor as
|
|
6
|
-
import { forwardRef as f, useCallback as p, useId as
|
|
7
|
-
import { Check as
|
|
8
|
-
import { Fragment as
|
|
4
|
+
import { InputStatusBanner as t, warnStatusWithoutMessage as ee } from "../inputShared/InputStatusBanner.js";
|
|
5
|
+
import { checkboxBoxClassesFor as n, checkboxCheckIconSizeClasses as r, checkboxCountClasses as te, checkboxCountTitleLineClasses as i, checkboxDescriptionClasses as a, checkboxDescriptionRowClasses as ne, checkboxHiddenInputClasses as re, checkboxHitTargetDescriptionAlignClasses as ie, checkboxHitTargetSizeClasses as ae, checkboxIndeterminateBarSizeClasses as o, checkboxLabelClassesFor as s, checkboxMarkClasses as c, checkboxRowBaseClasses as oe, checkboxRowSizeClasses as se, checkboxSizes as l, checkboxStatusBannerClassesFor as u, checkboxTextColumnClasses as d } from "./checkboxStyles.js";
|
|
6
|
+
import { forwardRef as f, useCallback as p, useId as ce, useState as le } from "react";
|
|
7
|
+
import { Check as ue, Loader2 as de } from "lucide-react";
|
|
8
|
+
import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
9
9
|
//#region src/components/atoms/Checkbox/Checkbox.tsx
|
|
10
|
-
var
|
|
10
|
+
var _ = {
|
|
11
11
|
sm: "sm",
|
|
12
12
|
md: "md"
|
|
13
13
|
};
|
|
14
|
-
function
|
|
14
|
+
function v(e) {
|
|
15
15
|
e.message != null && e.status == null && console.warn("[WMDS Checkbox] `message` requires `status`.");
|
|
16
16
|
}
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
var y = f(function({ size: l = "md", label: f, labelHidden: y = !1, description: b, count: x, countLabel: fe, indeterminate: S = !1, status: C, message: w, loading: T = !1, className: E, disabled: D, readOnly: O, checked: k, defaultChecked: A, id: j, onChange: M, ...N }, P) {
|
|
18
|
+
ee("Checkbox", C, w);
|
|
19
|
+
let F = ce(), I = j ?? F;
|
|
20
|
+
v({
|
|
21
|
+
status: C,
|
|
22
|
+
message: w
|
|
22
23
|
});
|
|
23
|
-
let
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
].filter(Boolean).join(" ") || void 0,
|
|
28
|
-
e && (e.indeterminate =
|
|
29
|
-
}, [
|
|
30
|
-
if (
|
|
24
|
+
let L = k !== void 0, [R, z] = le(A ?? !1), B = L ? !!k : R, V = D || T, H = T && !D, U = w != null && w.length > 0 && C != null, W = U ? `${I}-message` : void 0, G = b != null && !y ? `${I}-description` : void 0, pe = [
|
|
25
|
+
N["aria-describedby"],
|
|
26
|
+
G,
|
|
27
|
+
W
|
|
28
|
+
].filter(Boolean).join(" ") || void 0, me = p((e) => {
|
|
29
|
+
e && (e.indeterminate = S), typeof P == "function" ? P(e) : P != null && (P.current = e);
|
|
30
|
+
}, [S, P]), K = (e) => {
|
|
31
|
+
if (O || H) {
|
|
31
32
|
e.preventDefault();
|
|
32
33
|
return;
|
|
33
34
|
}
|
|
34
|
-
|
|
35
|
-
},
|
|
35
|
+
L || z(e.target.checked), M?.(e);
|
|
36
|
+
}, he = n(l, B, S, V, U ? void 0 : C), q = b != null && !y, J = x != null, Y = x?.toLocaleString("en-US"), X = J ? /* @__PURE__ */ h("span", {
|
|
36
37
|
className: "sr-only",
|
|
37
|
-
children: ` (${
|
|
38
|
-
}) : null, Z = J ? /* @__PURE__ */
|
|
38
|
+
children: ` (${fe ?? Y})`
|
|
39
|
+
}) : null, Z = J ? /* @__PURE__ */ h("span", {
|
|
39
40
|
className: te,
|
|
40
41
|
"aria-hidden": !0,
|
|
41
42
|
children: Y
|
|
42
|
-
}) : null, Q = (t) => /* @__PURE__ */
|
|
43
|
+
}) : null, Q = (t) => /* @__PURE__ */ g("span", {
|
|
43
44
|
className: e("relative flex shrink-0 items-center justify-center", ae[l], t),
|
|
44
|
-
children: [/* @__PURE__ */
|
|
45
|
-
...
|
|
46
|
-
ref:
|
|
47
|
-
id:
|
|
45
|
+
children: [/* @__PURE__ */ h("input", {
|
|
46
|
+
...N,
|
|
47
|
+
ref: me,
|
|
48
|
+
id: I,
|
|
48
49
|
type: "checkbox",
|
|
49
|
-
checked:
|
|
50
|
-
defaultChecked:
|
|
51
|
-
disabled:
|
|
52
|
-
"aria-disabled":
|
|
53
|
-
readOnly:
|
|
54
|
-
"aria-invalid":
|
|
55
|
-
"aria-describedby":
|
|
56
|
-
"aria-checked":
|
|
57
|
-
"aria-busy":
|
|
58
|
-
onChange:
|
|
50
|
+
checked: L ? k : void 0,
|
|
51
|
+
defaultChecked: L ? void 0 : A,
|
|
52
|
+
disabled: D,
|
|
53
|
+
"aria-disabled": H || void 0,
|
|
54
|
+
readOnly: O,
|
|
55
|
+
"aria-invalid": C === "error" || void 0,
|
|
56
|
+
"aria-describedby": pe,
|
|
57
|
+
"aria-checked": S ? "mixed" : void 0,
|
|
58
|
+
"aria-busy": T || void 0,
|
|
59
|
+
onChange: K,
|
|
59
60
|
className: re
|
|
60
|
-
}), /* @__PURE__ */
|
|
61
|
-
className:
|
|
61
|
+
}), /* @__PURE__ */ h("span", {
|
|
62
|
+
className: he,
|
|
62
63
|
"aria-hidden": !0,
|
|
63
|
-
children:
|
|
64
|
-
className: e(
|
|
64
|
+
children: T ? /* @__PURE__ */ h(de, {
|
|
65
|
+
className: e(r[l], c, "animate-spin"),
|
|
65
66
|
strokeWidth: 2
|
|
66
|
-
}) :
|
|
67
|
-
className: e(
|
|
67
|
+
}) : S ? /* @__PURE__ */ h("span", { className: e(o[l], c, "rounded-full bg-current") }) : B ? /* @__PURE__ */ h(ue, {
|
|
68
|
+
className: e(r[l], c),
|
|
68
69
|
strokeWidth: 3,
|
|
69
70
|
"aria-hidden": !0
|
|
70
71
|
}) : null
|
|
71
72
|
})]
|
|
72
|
-
}), $ = /* @__PURE__ */
|
|
73
|
-
htmlFor:
|
|
74
|
-
className: e(
|
|
75
|
-
children:
|
|
73
|
+
}), $ = /* @__PURE__ */ h("label", {
|
|
74
|
+
htmlFor: I,
|
|
75
|
+
className: e(oe, !q && "items-center", !q && se[l], V && "cursor-not-allowed", E),
|
|
76
|
+
children: y ? /* @__PURE__ */ g(m, { children: [Q(), /* @__PURE__ */ g("span", {
|
|
76
77
|
className: "sr-only",
|
|
77
78
|
children: [f, X]
|
|
78
|
-
})] }) : q ? /* @__PURE__ */
|
|
79
|
+
})] }) : q ? /* @__PURE__ */ g("span", {
|
|
79
80
|
className: e(ne[l], J && "flex-1"),
|
|
80
|
-
children: [Q(ie[l]), /* @__PURE__ */
|
|
81
|
+
children: [Q(ie[l]), /* @__PURE__ */ g("span", {
|
|
81
82
|
className: e(d, J && "flex-1"),
|
|
82
|
-
children: [J ? /* @__PURE__ */
|
|
83
|
-
className:
|
|
84
|
-
children: [/* @__PURE__ */
|
|
85
|
-
className:
|
|
83
|
+
children: [J ? /* @__PURE__ */ g("span", {
|
|
84
|
+
className: i,
|
|
85
|
+
children: [/* @__PURE__ */ g("span", {
|
|
86
|
+
className: s(V, !0),
|
|
86
87
|
children: [f, X]
|
|
87
88
|
}), Z]
|
|
88
|
-
}) : /* @__PURE__ */
|
|
89
|
-
className:
|
|
89
|
+
}) : /* @__PURE__ */ h("span", {
|
|
90
|
+
className: s(V, !0),
|
|
90
91
|
children: f
|
|
91
|
-
}), /* @__PURE__ */
|
|
92
|
-
id:
|
|
93
|
-
className:
|
|
94
|
-
children:
|
|
92
|
+
}), /* @__PURE__ */ h("span", {
|
|
93
|
+
id: G,
|
|
94
|
+
className: a,
|
|
95
|
+
children: b
|
|
95
96
|
})]
|
|
96
97
|
})]
|
|
97
|
-
}) : /* @__PURE__ */
|
|
98
|
+
}) : /* @__PURE__ */ g(m, { children: [
|
|
98
99
|
Q(),
|
|
99
|
-
/* @__PURE__ */
|
|
100
|
-
className:
|
|
100
|
+
/* @__PURE__ */ g("span", {
|
|
101
|
+
className: s(V),
|
|
101
102
|
children: [f, X]
|
|
102
103
|
}),
|
|
103
104
|
Z
|
|
104
105
|
] })
|
|
105
106
|
});
|
|
106
|
-
return !
|
|
107
|
+
return !U || C == null || W == null ? $ : /* @__PURE__ */ g("div", {
|
|
107
108
|
className: "flex w-full flex-col gap-1.5",
|
|
108
|
-
children: [$, /* @__PURE__ */
|
|
109
|
-
status:
|
|
110
|
-
message:
|
|
111
|
-
messageId:
|
|
112
|
-
size:
|
|
109
|
+
children: [$, /* @__PURE__ */ h(t, {
|
|
110
|
+
status: C,
|
|
111
|
+
message: w,
|
|
112
|
+
messageId: W,
|
|
113
|
+
size: _[l],
|
|
113
114
|
messagePosition: "bottom",
|
|
114
|
-
bannerClassName: u(
|
|
115
|
+
bannerClassName: u(C)
|
|
115
116
|
})]
|
|
116
117
|
});
|
|
117
118
|
});
|
|
118
119
|
//#endregion
|
|
119
|
-
export {
|
|
120
|
+
export { y as Checkbox, l as checkboxSizes };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../../src/components/atoms/Input/Input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAKf,OAAO,EA2BL,KAAK,oBAAoB,EACzB,KAAK,SAAS,EACd,KAAK,WAAW,EACjB,MAAM,oBAAoB,CAAC;AAE5B,YAAY,EAAE,oBAAoB,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACvF,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEtF,sEAAsE;AACtE,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAE1C,MAAM,WAAW,UACf,SAAQ,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC3D,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,oFAAoF;IACpF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,2GAA2G;IAC3G,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sEAAsE;IACtE,eAAe,CAAC,EAAE,oBAAoB,CAAC;IACvC,uEAAuE;IACvE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,2BAA2B;IAC3B,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,yFAAyF;IACzF,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,wGAAwG;IACxG,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,oBAAoB,CAAC;CAClC;AA2CD;;;GAGG;AACH,eAAO,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../../src/components/atoms/Input/Input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAKf,OAAO,EA2BL,KAAK,oBAAoB,EACzB,KAAK,SAAS,EACd,KAAK,WAAW,EACjB,MAAM,oBAAoB,CAAC;AAE5B,YAAY,EAAE,oBAAoB,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACvF,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEtF,sEAAsE;AACtE,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAE1C,MAAM,WAAW,UACf,SAAQ,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC3D,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,oFAAoF;IACpF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,2GAA2G;IAC3G,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sEAAsE;IACtE,eAAe,CAAC,EAAE,oBAAoB,CAAC;IACvC,uEAAuE;IACvE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,2BAA2B;IAC3B,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,yFAAyF;IACzF,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,wGAAwG;IACxG,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,oBAAoB,CAAC;CAClC;AA2CD;;;GAGG;AACH,eAAO,MAAM,KAAK,yGAgLhB,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn as e } from "../../../lib/cn.js";
|
|
3
3
|
import { typographyClass as t } from "../../../lib/typography.js";
|
|
4
|
-
import { inputAttachedFieldClasses as n, inputAttachedInputClasses as
|
|
5
|
-
import { InputStatusBanner as
|
|
6
|
-
import { InputTrailingAffordance as
|
|
7
|
-
import { forwardRef as T, useId as
|
|
4
|
+
import { inputAttachedFieldClasses as n, inputAttachedInputClasses as ee, inputBaseClasses as r, inputCompoundInnerFieldClassesFor as i, inputCompoundShellClassesFor as a, inputControlStackClasses as o, inputDisabledClasses as te, inputEndBadgeAndStatusGapClasses as s, inputEndBadgeGapClasses as c, inputEndBadgeWrapperClasses as ne, inputFieldStackClasses as l, inputIconGapClasses as u, inputIconPositionClasses as d, inputIconSizeClasses as f, inputInlineClasses as p, inputMessagePositions as m, inputShellClasses as h, inputSizeClasses as g, inputSizes as _, inputSoloFocusRingBaseClasses as re, inputSoloFocusRingColorClasses as v, inputSoloRadiusClasses as ie, inputStatusGapClasses as y, inputStatusShellClasses as ae, inputStatuses as b, inputTrailingInsetClasses as x, inputTrailingInsetPositionClasses as S } from "./inputShellStyles.js";
|
|
5
|
+
import { InputStatusBanner as C, warnStatusWithoutMessage as w } from "../inputShared/InputStatusBanner.js";
|
|
6
|
+
import { InputTrailingAffordance as oe } from "../inputShared/InputTrailingAffordance.js";
|
|
7
|
+
import { forwardRef as T, useId as se } from "react";
|
|
8
8
|
import { Fragment as E, jsx as D, jsxs as O } from "react/jsx-runtime";
|
|
9
9
|
//#region src/components/atoms/Input/Input.tsx
|
|
10
10
|
function k(e) {
|
|
@@ -14,30 +14,31 @@ function A(e) {
|
|
|
14
14
|
e.message != null && e.status == null && console.warn("[WMDS Input] `message` requires `status`."), e.inline && (e.label != null || e.description != null || e.status != null || e.message != null) && console.warn("[WMDS Input] `inline` is for a parent pill (Search, CopyField) — omit label, description, and validation.");
|
|
15
15
|
}
|
|
16
16
|
function j(e, t, n) {
|
|
17
|
-
return t && n ?
|
|
17
|
+
return t && n ? s[e] : t ? c[e] : n ? y[e] : !1;
|
|
18
18
|
}
|
|
19
|
-
var M = T(function({ size:
|
|
20
|
-
|
|
19
|
+
var M = T(function({ size: s = "md", label: c, description: m, status: _, message: y, messagePosition: b = "bottom", loading: T = !1, icon: M, endBadge: N, mono: P = !1, inline: F = !1, className: I, disabled: L, id: R, "aria-describedby": z, ...B }, V) {
|
|
20
|
+
w("Input", _, y);
|
|
21
|
+
let H = se(), U = R ?? H;
|
|
21
22
|
k({
|
|
22
|
-
label:
|
|
23
|
+
label: c,
|
|
23
24
|
"aria-label": B["aria-label"],
|
|
24
25
|
"aria-labelledby": B["aria-labelledby"]
|
|
25
26
|
}), A({
|
|
26
|
-
status:
|
|
27
|
-
message:
|
|
28
|
-
messagePosition:
|
|
27
|
+
status: _,
|
|
28
|
+
message: y,
|
|
29
|
+
messagePosition: b,
|
|
29
30
|
loading: T,
|
|
30
31
|
inline: F,
|
|
31
|
-
label:
|
|
32
|
-
description:
|
|
32
|
+
label: c,
|
|
33
|
+
description: m
|
|
33
34
|
});
|
|
34
|
-
let W =
|
|
35
|
+
let W = y != null && y.length > 0 && _ != null, G = N != null, K = !W && (T || _ != null), q = M != null, J = j(s, G, K), Y = m == null ? void 0 : `${U}-description`, X = W ? `${U}-message` : void 0, ce = [
|
|
35
36
|
z,
|
|
36
37
|
Y,
|
|
37
38
|
X
|
|
38
|
-
].filter(Boolean).join(" ") || void 0,
|
|
39
|
+
].filter(Boolean).join(" ") || void 0, le = /* @__PURE__ */ O(E, { children: [
|
|
39
40
|
q ? /* @__PURE__ */ D("span", {
|
|
40
|
-
className: e("pointer-events-none absolute top-1/2 inline-flex -translate-y-1/2 [&>svg]:size-full [&>svg]:shrink-0 [&>svg]:stroke-current",
|
|
41
|
+
className: e("pointer-events-none absolute top-1/2 inline-flex -translate-y-1/2 [&>svg]:size-full [&>svg]:shrink-0 [&>svg]:stroke-current", d[s], f[s]),
|
|
41
42
|
"aria-hidden": !0,
|
|
42
43
|
children: M
|
|
43
44
|
}) : null,
|
|
@@ -46,60 +47,54 @@ var M = T(function({ size: l = "md", label: u, description: h, status: v, messag
|
|
|
46
47
|
ref: V,
|
|
47
48
|
id: U,
|
|
48
49
|
disabled: L,
|
|
49
|
-
"aria-invalid":
|
|
50
|
-
"aria-describedby":
|
|
51
|
-
className: e(
|
|
50
|
+
"aria-invalid": _ === "error" || void 0,
|
|
51
|
+
"aria-describedby": ce,
|
|
52
|
+
className: e(te, P && "type-code !font-mono !leading-none", W ? e(n, g[s], q && u[s], J, ee) : e(r, F ? e(p, q && u[s], I ?? g[s]) : e(g[s], q && u[s], J, _ != null && _ !== "success" ? e("border", ae[_]) : h[s], ie[s], re, _ != null && _ !== "success" ? v[_] : v.default, I)))
|
|
52
53
|
}),
|
|
53
54
|
G || K ? /* @__PURE__ */ O("span", {
|
|
54
|
-
className: e(
|
|
55
|
+
className: e(x, S[s]),
|
|
55
56
|
children: [G ? /* @__PURE__ */ D("span", {
|
|
56
|
-
className:
|
|
57
|
+
className: ne,
|
|
57
58
|
children: N
|
|
58
|
-
}) : null, K ? /* @__PURE__ */ D(
|
|
59
|
-
size:
|
|
60
|
-
status: T ? void 0 :
|
|
59
|
+
}) : null, K ? /* @__PURE__ */ D(oe, {
|
|
60
|
+
size: s,
|
|
61
|
+
status: T ? void 0 : _,
|
|
61
62
|
loading: T
|
|
62
63
|
}) : null]
|
|
63
64
|
}) : null
|
|
64
|
-
] }),
|
|
65
|
-
status:
|
|
66
|
-
message:
|
|
65
|
+
] }), Z = W && _ != null && X != null ? /* @__PURE__ */ D(C, {
|
|
66
|
+
status: _,
|
|
67
|
+
message: y,
|
|
67
68
|
messageId: X,
|
|
68
|
-
size:
|
|
69
|
-
messagePosition:
|
|
70
|
-
}) : null,
|
|
71
|
-
className:
|
|
69
|
+
size: s,
|
|
70
|
+
messagePosition: b
|
|
71
|
+
}) : null, Q = W && _ != null, $ = /* @__PURE__ */ O("div", {
|
|
72
|
+
className: Q ? a(s, _) : e(F ? "relative flex min-w-0 flex-1 items-center" : o),
|
|
72
73
|
children: [
|
|
73
|
-
|
|
74
|
+
Q && b === "top" ? Z : null,
|
|
74
75
|
/* @__PURE__ */ D("div", {
|
|
75
|
-
className:
|
|
76
|
-
children:
|
|
76
|
+
className: Q ? i(s, _, b) : "relative flex w-full items-center",
|
|
77
|
+
children: le
|
|
77
78
|
}),
|
|
78
|
-
|
|
79
|
+
Q && b === "bottom" ? Z : null
|
|
79
80
|
]
|
|
80
|
-
}) : /* @__PURE__ */ D("div", {
|
|
81
|
-
className: e(F ? "relative flex min-w-0 flex-1 items-center" : s),
|
|
82
|
-
children: /* @__PURE__ */ D("div", {
|
|
83
|
-
className: "relative flex w-full items-center",
|
|
84
|
-
children: Z
|
|
85
|
-
})
|
|
86
81
|
});
|
|
87
|
-
return F ||
|
|
88
|
-
className:
|
|
82
|
+
return F || c == null && m == null ? $ : /* @__PURE__ */ O("div", {
|
|
83
|
+
className: l,
|
|
89
84
|
children: [
|
|
90
|
-
|
|
85
|
+
c == null ? null : /* @__PURE__ */ D("label", {
|
|
91
86
|
htmlFor: U,
|
|
92
87
|
className: e(t("ui-label"), L && "opacity-50"),
|
|
93
|
-
children:
|
|
88
|
+
children: c
|
|
94
89
|
}),
|
|
95
|
-
$,
|
|
96
90
|
Y == null ? null : /* @__PURE__ */ D("p", {
|
|
97
91
|
id: Y,
|
|
98
92
|
className: t("caption"),
|
|
99
|
-
children:
|
|
100
|
-
})
|
|
93
|
+
children: m
|
|
94
|
+
}),
|
|
95
|
+
$
|
|
101
96
|
]
|
|
102
97
|
});
|
|
103
98
|
});
|
|
104
99
|
//#endregion
|
|
105
|
-
export { M as Input,
|
|
100
|
+
export { M as Input, m as inputMessagePositions, _ as inputSizes, b as inputStatuses };
|
|
@@ -20,8 +20,8 @@ var n = [
|
|
|
20
20
|
warning: "focus-within:outline-none focus-within:ring-2 focus-within:ring-warning-focus-ring",
|
|
21
21
|
success: "focus-within:outline-none focus-within:ring-2 focus-within:ring-success-focus-ring"
|
|
22
22
|
}, d = {
|
|
23
|
-
sm: "h-8 px-2.5 text-xs leading-none",
|
|
24
|
-
md: "h-11 px-3 text-sm leading-none",
|
|
23
|
+
sm: "h-8 px-2.5 text-xs pointer-coarse:text-base leading-none",
|
|
24
|
+
md: "h-11 px-3 text-sm pointer-coarse:text-base leading-none",
|
|
25
25
|
lg: "min-h-12 px-4 text-base leading-none"
|
|
26
26
|
}, f = "border border-border-control", p = "shadow-raised", m = {
|
|
27
27
|
sm: e(f, p),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.d.ts","sourceRoot":"","sources":["../../../../src/components/atoms/Radio/Radio.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,mBAAmB,EACzB,MAAM,OAAO,CAAC;AAGf,OAAO,EAgBL,KAAK,SAAS,EACf,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAa,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExE,OAAO,EAAE,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,KAAK,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAE5E,qDAAqD;AACrD,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAE1C,MAAM,WAAW,UACf,SAAQ,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpE,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,2EAA2E;IAC3E,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,sCAAsC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qFAAqF;IACrF,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,yDAAyD;IACzD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,oBAAoB,CAAC;CAClC;AAaD;;;GAGG;AACH,eAAO,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"Radio.d.ts","sourceRoot":"","sources":["../../../../src/components/atoms/Radio/Radio.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,mBAAmB,EACzB,MAAM,OAAO,CAAC;AAGf,OAAO,EAgBL,KAAK,SAAS,EACf,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAa,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExE,OAAO,EAAE,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,KAAK,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAE5E,qDAAqD;AACrD,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAE1C,MAAM,WAAW,UACf,SAAQ,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpE,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,2EAA2E;IAC3E,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,sCAAsC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qFAAqF;IACrF,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,yDAAyD;IACzD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,oBAAoB,CAAC;CAClC;AAaD;;;GAGG;AACH,eAAO,MAAM,KAAK,yGAkIhB,CAAC"}
|
|
@@ -1,84 +1,85 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn as e } from "../../../lib/cn.js";
|
|
3
3
|
import "../Input/inputShellStyles.js";
|
|
4
|
-
import { InputStatusBanner as t } from "../inputShared/InputStatusBanner.js";
|
|
5
|
-
import { radioCircleClassesFor as
|
|
6
|
-
import { forwardRef as
|
|
7
|
-
import { Fragment as
|
|
4
|
+
import { InputStatusBanner as t, warnStatusWithoutMessage as n } from "../inputShared/InputStatusBanner.js";
|
|
5
|
+
import { radioCircleClassesFor as r, radioDescriptionClasses as i, radioDescriptionRowClasses as a, radioDotClasses as o, radioDotSizeClasses as s, radioHiddenInputClasses as c, radioHitTargetDescriptionAlignClasses as l, radioHitTargetSizeClasses as u, radioLabelClassesFor as d, radioRowBaseClasses as f, radioRowSizeClasses as p, radioSizes as m, radioStatusBannerClassesFor as h, radioTextColumnClasses as g } from "./radioStyles.js";
|
|
6
|
+
import { forwardRef as _, useId as v, useState as y } from "react";
|
|
7
|
+
import { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
8
8
|
//#region src/components/atoms/Radio/Radio.tsx
|
|
9
|
-
var
|
|
9
|
+
var C = {
|
|
10
10
|
sm: "sm",
|
|
11
11
|
md: "md"
|
|
12
12
|
};
|
|
13
|
-
function
|
|
13
|
+
function w(e) {
|
|
14
14
|
e.message != null && e.status == null && console.warn("[WMDS Radio] `message` requires `status`.");
|
|
15
15
|
}
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
var T = _(function({ size: m = "md", label: _, labelHidden: T = !1, description: E, status: D, message: O, className: k, disabled: A, checked: j, defaultChecked: M, id: N, onChange: P, ...F }, I) {
|
|
17
|
+
n("Radio", D, O);
|
|
18
|
+
let L = v(), R = N ?? L;
|
|
19
|
+
w({
|
|
20
|
+
status: D,
|
|
21
|
+
message: O
|
|
21
22
|
});
|
|
22
|
-
let
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
].filter(Boolean).join(" ") || void 0,
|
|
27
|
-
|
|
28
|
-
},
|
|
29
|
-
className: e("relative flex shrink-0 items-center justify-center",
|
|
30
|
-
children: [/* @__PURE__ */
|
|
31
|
-
...
|
|
32
|
-
ref:
|
|
33
|
-
id:
|
|
23
|
+
let z = j !== void 0, [B, V] = y(M ?? !1), H = z ? !!j : B, U = O != null && O.length > 0 && D != null, W = U ? `${R}-message` : void 0, G = E != null && !T ? `${R}-description` : void 0, K = [
|
|
24
|
+
F["aria-describedby"],
|
|
25
|
+
G,
|
|
26
|
+
W
|
|
27
|
+
].filter(Boolean).join(" ") || void 0, q = (e) => {
|
|
28
|
+
z || V(e.target.checked), P?.(e);
|
|
29
|
+
}, J = r(m, H, A, U ? void 0 : D), Y = E != null && !T, X = (t) => /* @__PURE__ */ S("span", {
|
|
30
|
+
className: e("relative flex shrink-0 items-center justify-center", u[m], t),
|
|
31
|
+
children: [/* @__PURE__ */ x("input", {
|
|
32
|
+
...F,
|
|
33
|
+
ref: I,
|
|
34
|
+
id: R,
|
|
34
35
|
type: "radio",
|
|
35
|
-
checked:
|
|
36
|
-
defaultChecked:
|
|
37
|
-
disabled:
|
|
38
|
-
"aria-invalid":
|
|
39
|
-
"aria-describedby":
|
|
40
|
-
onChange:
|
|
41
|
-
className:
|
|
42
|
-
}), /* @__PURE__ */
|
|
43
|
-
className:
|
|
36
|
+
checked: z ? j : void 0,
|
|
37
|
+
defaultChecked: z ? void 0 : M,
|
|
38
|
+
disabled: A,
|
|
39
|
+
"aria-invalid": D === "error" || void 0,
|
|
40
|
+
"aria-describedby": K,
|
|
41
|
+
onChange: q,
|
|
42
|
+
className: c
|
|
43
|
+
}), /* @__PURE__ */ x("span", {
|
|
44
|
+
className: J,
|
|
44
45
|
"aria-hidden": !0,
|
|
45
|
-
children:
|
|
46
|
+
children: H ? /* @__PURE__ */ x("span", { className: e(s[m], o) }) : null
|
|
46
47
|
})]
|
|
47
|
-
}),
|
|
48
|
-
htmlFor:
|
|
49
|
-
className: e(
|
|
50
|
-
children:
|
|
48
|
+
}), Z = /* @__PURE__ */ x("label", {
|
|
49
|
+
htmlFor: R,
|
|
50
|
+
className: e(f, !Y && "items-center", !Y && p[m], A && "cursor-not-allowed", k),
|
|
51
|
+
children: T ? /* @__PURE__ */ S(b, { children: [X(), /* @__PURE__ */ x("span", {
|
|
51
52
|
className: "sr-only",
|
|
52
|
-
children:
|
|
53
|
-
})] }) :
|
|
54
|
-
className:
|
|
55
|
-
children: [
|
|
56
|
-
className:
|
|
57
|
-
children: [/* @__PURE__ */
|
|
58
|
-
className:
|
|
59
|
-
children:
|
|
60
|
-
}), /* @__PURE__ */
|
|
61
|
-
id:
|
|
62
|
-
className:
|
|
63
|
-
children:
|
|
53
|
+
children: _
|
|
54
|
+
})] }) : Y ? /* @__PURE__ */ S("span", {
|
|
55
|
+
className: a[m],
|
|
56
|
+
children: [X(l[m]), /* @__PURE__ */ S("span", {
|
|
57
|
+
className: g,
|
|
58
|
+
children: [/* @__PURE__ */ x("span", {
|
|
59
|
+
className: d(A, !0),
|
|
60
|
+
children: _
|
|
61
|
+
}), /* @__PURE__ */ x("span", {
|
|
62
|
+
id: G,
|
|
63
|
+
className: i,
|
|
64
|
+
children: E
|
|
64
65
|
})]
|
|
65
66
|
})]
|
|
66
|
-
}) : /* @__PURE__ */
|
|
67
|
-
className:
|
|
68
|
-
children:
|
|
67
|
+
}) : /* @__PURE__ */ S(b, { children: [X(), /* @__PURE__ */ x("span", {
|
|
68
|
+
className: d(A),
|
|
69
|
+
children: _
|
|
69
70
|
})] })
|
|
70
71
|
});
|
|
71
|
-
return !
|
|
72
|
+
return !U || D == null || W == null ? Z : /* @__PURE__ */ S("div", {
|
|
72
73
|
className: "flex w-full flex-col gap-1.5",
|
|
73
|
-
children: [
|
|
74
|
-
status:
|
|
75
|
-
message:
|
|
76
|
-
messageId:
|
|
77
|
-
size:
|
|
74
|
+
children: [Z, /* @__PURE__ */ x(t, {
|
|
75
|
+
status: D,
|
|
76
|
+
message: O,
|
|
77
|
+
messageId: W,
|
|
78
|
+
size: C[m],
|
|
78
79
|
messagePosition: "bottom",
|
|
79
|
-
bannerClassName:
|
|
80
|
+
bannerClassName: h(D)
|
|
80
81
|
})]
|
|
81
82
|
});
|
|
82
83
|
});
|
|
83
84
|
//#endregion
|
|
84
|
-
export {
|
|
85
|
+
export { T as Radio, m as radioSizes };
|