@newtone-dev/ui-react-web 0.28.0 → 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.
- package/dist/segmented-control/segmented-control.css +6 -1
- package/dist/segmented-control/segmented-control.d.ts +8 -5
- package/dist/segmented-control/segmented-control.d.ts.map +1 -1
- package/dist/segmented-control/segmented-control.js +4 -2
- package/dist/segmented-control/segmented-control.js.map +1 -1
- package/package.json +1 -1
|
@@ -121,9 +121,14 @@
|
|
|
121
121
|
* that declares it is content-sized owns the whole of that claim.**
|
|
122
122
|
*
|
|
123
123
|
* The media query below turns it into a full-width row, and `inline-size: 100%` overrides this
|
|
124
|
-
* without contradicting it.
|
|
124
|
+
* without contradicting it.
|
|
125
|
+
*
|
|
126
|
+
* **`border-box`, because that 100% is the row's whole width and the padding is inside it.** Without
|
|
127
|
+
* it the track ran 8px past its column at phone width -- 366 in a 358 column, measured on Fluxus's
|
|
128
|
+
* admin on 2026-10-07, the first consumer to put it in a narrow column. */
|
|
125
129
|
|
|
126
130
|
.newtone-segmented-control {
|
|
131
|
+
box-sizing: border-box;
|
|
127
132
|
display: inline-flex;
|
|
128
133
|
align-self: start;
|
|
129
134
|
align-items: center;
|
|
@@ -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
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
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.
|
|
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
|
|
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
|
-
|
|
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.tsx"],"names":[],"mappings":";AAAA,uGAAuG;AACvG,qEAAqE;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAE7C,OAAO,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