@uniflowed/ui 0.2.0 → 0.4.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/field.js CHANGED
@@ -187,7 +187,7 @@ hook useField(part: string): FieldState {
187
187
  * caller saying "and also mark it invalid", which is what `invalid || source`
188
188
  * means and what a server-side error arriving beside a client-side one needs.
189
189
  */
190
- export component FieldRoot(
190
+ component FieldRoot(
191
191
  children: React.Node,
192
192
  invalid?: boolean = false,
193
193
  required?: boolean = false,
@@ -279,7 +279,7 @@ export component FieldRoot(
279
279
  * `<label for>` naming something that is not a form control is ignored by every
280
280
  * browser, and ignored silently. The module header says more.
281
281
  */
282
- export component FieldLabel(children: React.Node, render?: RenderProp, ...rest: Rest) {
282
+ component FieldLabel(children: React.Node, render?: RenderProp, ...rest: Rest) {
283
283
  const field = useField("Field.Label");
284
284
  // `rest` first: a caller `id` here would break the relationship the control
285
285
  // points at, and it would break it silently.
@@ -300,7 +300,7 @@ export component FieldLabel(children: React.Node, render?: RenderProp, ...rest:
300
300
  * `ref` and handlers *and* the field's attributes from one spread instead of
301
301
  * two that overwrite each other.
302
302
  */
303
- export component FieldControl(render: RenderProp) {
303
+ component FieldControl(render: RenderProp) {
304
304
  const field = useField("Field.Control");
305
305
  // A group already carries the name, the description and the validity, and a
306
306
  // control repeating them makes a reader hear the error once for the set and
@@ -319,7 +319,7 @@ export component FieldControl(render: RenderProp) {
319
319
  }
320
320
 
321
321
  /** Help text, which the control points at while it is rendered. */
322
- export component FieldDescription(children: React.Node, render?: RenderProp, ...rest: Rest) {
322
+ component FieldDescription(children: React.Node, render?: RenderProp, ...rest: Rest) {
323
323
  const field = useField("Field.Description");
324
324
  const register = field.registerDescription;
325
325
  useEffect(() => {
@@ -338,7 +338,7 @@ export component FieldDescription(children: React.Node, render?: RenderProp, ...
338
338
  * `Field.Error`, this part stays in the document even while it is empty; the
339
339
  * control points at it only while the caller rendered the part.
340
340
  */
341
- export component FieldStatus(children?: React.Node, render?: RenderProp, ...rest: Rest) {
341
+ component FieldStatus(children?: React.Node, render?: RenderProp, ...rest: Rest) {
342
342
  const field = useField("Field.Status");
343
343
  const register = field.registerStatus;
344
344
  useEffect(() => {
@@ -367,7 +367,7 @@ export component FieldStatus(children?: React.Node, render?: RenderProp, ...rest
367
367
  * store does not need the caller to reach back into `formState.errors` for a
368
368
  * string the source is already carrying.
369
369
  */
370
- export component FieldError(children?: React.Node, render?: RenderProp, ...rest: Rest) {
370
+ component FieldError(children?: React.Node, render?: RenderProp, ...rest: Rest) {
371
371
  const field = useField("Field.Error");
372
372
  const register = field.registerError;
373
373
  useEffect(() => {
@@ -385,3 +385,21 @@ export component FieldError(children?: React.Node, render?: RenderProp, ...rest:
385
385
  });
386
386
  return render != null ? render(props) : <p {...props} />;
387
387
  }
388
+
389
+ /**
390
+ * The parts, under the names the `Field` namespace gives them.
391
+ *
392
+ * `index.js` re-exports this module whole — `export * as Field from "./field.js"` —
393
+ * so a caller writes `<Field.Root>`, and the namespace is the prefix. Each
394
+ * part is still *declared* as `FieldRoot`, so React DevTools, a component
395
+ * stack and an error name the part a reader can find rather than one of forty
396
+ * `Root`s.
397
+ */
398
+ export {
399
+ FieldRoot as Root,
400
+ FieldLabel as Label,
401
+ FieldControl as Control,
402
+ FieldDescription as Description,
403
+ FieldStatus as Status,
404
+ FieldError as Error,
405
+ };
package/hover-card.js CHANGED
@@ -88,7 +88,7 @@ hook useHoverCard(part: string): HoverCardState {
88
88
  * the time the reader has to reach the card, and a card holding links is a card
89
89
  * they are reaching for.
90
90
  */
91
- export component HoverCardRoot(
91
+ component HoverCardRoot(
92
92
  children: React.Node,
93
93
  closeDelay?: number = DEFAULT_CLOSE_DELAY,
94
94
  defaultOpen?: boolean = false,
@@ -127,7 +127,7 @@ export component HoverCardRoot(
127
127
  * reachable by keyboard, and `useFocusableTrigger` refuses anything else —
128
128
  * a hover card on a `<span>` is one a keyboard reader can never see.
129
129
  */
130
- export component HoverCardTrigger(children?: React.Node, render?: RenderProp, ...rest: Rest) {
130
+ component HoverCardTrigger(children?: React.Node, render?: RenderProp, ...rest: Rest) {
131
131
  const card = useHoverCard("HoverCard.Trigger");
132
132
  const { closeDelay, dismissedRef, intent, openDelay, triggerRef } = card;
133
133
  useFocusableTrigger(triggerRef, "HoverCard.Trigger");
@@ -202,7 +202,7 @@ export component HoverCardTrigger(children?: React.Node, render?: RenderProp, ..
202
202
  * because a card that took its own links away and left focus on `<body>` would
203
203
  * send the reader back to the top of the page.
204
204
  */
205
- export component HoverCardBody(
205
+ component HoverCardBody(
206
206
  children: React.Node,
207
207
  align?: Align = "center",
208
208
  alignOffset?: number = 0,
@@ -332,3 +332,14 @@ export component HoverCardBody(
332
332
 
333
333
  return <div {...props} />;
334
334
  }
335
+
336
+ /**
337
+ * The parts, under the names the `HoverCard` namespace gives them.
338
+ *
339
+ * `index.js` re-exports this module whole — `export * as HoverCard from "./hover-card.js"` —
340
+ * so a caller writes `<HoverCard.Root>`, and the namespace is the prefix. Each
341
+ * part is still *declared* as `HoverCardRoot`, so React DevTools, a component
342
+ * stack and an error name the part a reader can find rather than one of forty
343
+ * `Root`s.
344
+ */
345
+ export { HoverCardRoot as Root, HoverCardTrigger as Trigger, HoverCardBody as Body };