@newtone-dev/ui-react-web 0.28.1 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -42,9 +42,10 @@ import type { HTMLAttributes } from 'react';
42
42
  * the caller owns its word.** A `ReactNode` would offer a 12px capsule as a place to put anything,
43
43
  * which is a promise the shape cannot keep. `Tag`'s own split is the same one.
44
44
  *
45
- * **The first option is checked and there is no `defaultValue`.** One call site, and the live page
46
- * checks its first segment. `governance/evidence/size-an-api-from-call-sites-not-from-the-type.md`.
47
- * **Trigger:** a call site whose chosen segment is not the first one.
45
+ * **`defaultValue` names the option checked first, since 0.29.0**, and the first option is checked
46
+ * when it names none or names a value no option carries. It became a prop when its trigger fired:
47
+ * Fluxus's projects editor, where a stored *Residencial* must open chosen. It is the input's own
48
+ * `defaultChecked`, so nothing here holds the value afterwards.
48
49
  *
49
50
  * ---- it is a plain `<div>` and that is deliberate ---------------------------
50
51
  *
@@ -84,8 +85,10 @@ export interface SegmentedControlProps extends HTMLAttributes<HTMLElement> {
84
85
  name: string;
85
86
  /** What the group is asking. Becomes its `aria-label`. */
86
87
  label: string;
87
- /** The segments, in order. The first one is checked. */
88
+ /** The segments, in order. */
88
89
  options: readonly SegmentedControlOption[];
90
+ /** The `value` of the option checked first; the first option when it names none. */
91
+ defaultValue?: string;
89
92
  }
90
- export declare function SegmentedControl({ name, label, options, className, ...rest }: SegmentedControlProps): import("react").JSX.Element;
93
+ export declare function SegmentedControl({ name, label, options, defaultValue, className, ...rest }: SegmentedControlProps): import("react").JSX.Element;
91
94
  //# sourceMappingURL=segmented-control.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"segmented-control.d.ts","sourceRoot":"","sources":["../../src/segmented-control/segmented-control.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAG3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AAEH,MAAM,WAAW,sBAAsB;IACnC,gFAAgF;IAChF,KAAK,EAAE,MAAM,CAAA;IACb,sEAAsE;IACtE,KAAK,EAAE,MAAM,CAAA;IACb,kGAAkG;IAClG,KAAK,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,qBAAsB,SAAQ,cAAc,CAAC,WAAW,CAAC;IACtE;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ,0DAA0D;IAC1D,KAAK,EAAE,MAAM,CAAA;IACb,wDAAwD;IACxD,OAAO,EAAE,SAAS,sBAAsB,EAAE,CAAA;CAC7C;AAED,wBAAgB,gBAAgB,CAAC,EAC7B,IAAI,EACJ,KAAK,EACL,OAAO,EACP,SAAS,EACT,GAAG,IAAI,EACV,EAAE,qBAAqB,+BA0CvB"}
1
+ {"version":3,"file":"segmented-control.d.ts","sourceRoot":"","sources":["../../src/segmented-control/segmented-control.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAG3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqEG;AAEH,MAAM,WAAW,sBAAsB;IACnC,gFAAgF;IAChF,KAAK,EAAE,MAAM,CAAA;IACb,sEAAsE;IACtE,KAAK,EAAE,MAAM,CAAA;IACb,kGAAkG;IAClG,KAAK,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,qBAAsB,SAAQ,cAAc,CAAC,WAAW,CAAC;IACtE;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ,0DAA0D;IAC1D,KAAK,EAAE,MAAM,CAAA;IACb,8BAA8B;IAC9B,OAAO,EAAE,SAAS,sBAAsB,EAAE,CAAA;IAC1C,oFAAoF;IACpF,YAAY,CAAC,EAAE,MAAM,CAAA;CACxB;AAED,wBAAgB,gBAAgB,CAAC,EAC7B,IAAI,EACJ,KAAK,EACL,OAAO,EACP,YAAY,EACZ,SAAS,EACT,GAAG,IAAI,EACV,EAAE,qBAAqB,+BA4CvB"}
@@ -3,7 +3,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  // this is a server component -- see the repo blueprint, section 4.3.
4
4
  import { Surface } from '../surface/index.js';
5
5
  import { Text } from '../text/index.js';
6
- export function SegmentedControl({ name, label, options, className, ...rest }) {
7
- return (_jsx("div", { className: ['newtone-segmented-control', className].filter(Boolean).join(' '), role: "radiogroup", "aria-label": label, ...rest, children: options.map((option, index) => (_jsxs("label", { className: "newtone-segmented-control-segment", children: [_jsx("input", { className: "newtone-segmented-control-input", type: "radio", name: name, value: option.value, defaultChecked: index === 0 }), _jsx(Text, { as: "span", scale: "body-sm", weight: "medium", children: option.label }), option.badge ? (_jsx(Surface, { as: "span", theme: "tinted", className: "newtone-segmented-control-badge", children: _jsx(Text, { as: "span", scale: "caption", weight: "medium", figures: "tabular", children: option.badge }) })) : null] }, option.value))) }));
6
+ export function SegmentedControl({ name, label, options, defaultValue, className, ...rest }) {
7
+ const named = options.findIndex((option) => option.value === defaultValue);
8
+ const checked = named === -1 ? 0 : named;
9
+ return (_jsx("div", { className: ['newtone-segmented-control', className].filter(Boolean).join(' '), role: "radiogroup", "aria-label": label, ...rest, children: options.map((option, index) => (_jsxs("label", { className: "newtone-segmented-control-segment", children: [_jsx("input", { className: "newtone-segmented-control-input", type: "radio", name: name, value: option.value, defaultChecked: index === checked }), _jsx(Text, { as: "span", scale: "body-sm", weight: "medium", children: option.label }), option.badge ? (_jsx(Surface, { as: "span", theme: "tinted", className: "newtone-segmented-control-badge", children: _jsx(Text, { as: "span", scale: "caption", weight: "medium", figures: "tabular", children: option.badge }) })) : null] }, option.value))) }));
8
10
  }
9
11
  //# sourceMappingURL=segmented-control.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"segmented-control.js","sourceRoot":"","sources":["../../src/segmented-control/segmented-control.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IAAI,IAAC,EAAE,EAAC,MAAM,EAAC,KAAK,EAAC,SAAS,EAAC,MAAM,EAAC,QAAQ,EAAC,OAAO,EAAC,SAAS,YAC5D,MAAM,CAAC,KAAK,GACV,GACD,CACb,CAAC,CAAC,CAAC,IAAI,KA5BA,MAAM,CAAC,KAAK,CA6BhB,CACX,CAAC,GACA,CACT,CAAA;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newtone-dev/ui-react-web",
3
- "version": "0.28.1",
3
+ "version": "0.29.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",