ember-primitives 0.51.0 → 0.53.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.
@@ -2,5 +2,5 @@
2
2
  * If the user provides an onChange or similar function, use that,
3
3
  * otherwise fallback to the uncontrolled toggle
4
4
  */
5
- export declare function toggleWithFallback(uncontrolledToggle: (...args: unknown[]) => void, controlledToggle?: (...args: any[]) => void, ...args: unknown[]): void;
5
+ export declare function toggleWithFallback(uncontrolledToggle: undefined | ((...args: any[]) => void) | (() => void), controlledToggle?: (...args: any[]) => void, ...args: unknown[]): void;
6
6
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/-private/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,kBAAkB,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,EAEhD,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,EAC3C,GAAG,IAAI,EAAE,OAAO,EAAE,QAOnB"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/-private/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,kBAAkB,EAAE,SAAS,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,EACzE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,EAC3C,GAAG,IAAI,EAAE,OAAO,EAAE,QAOnB"}
@@ -1,10 +1,6 @@
1
+ import { Separator } from './separator';
1
2
  import type { TOC } from "@ember/component/template-only";
2
- declare const Separator: TOC<{
3
- Element: HTMLSpanElement;
4
- Blocks: {
5
- default: [];
6
- };
7
- }>;
3
+ import type { WithBoundArgs } from "@glint/template";
8
4
  export interface Signature {
9
5
  Element: HTMLElement;
10
6
  Args: {
@@ -19,9 +15,10 @@ export interface Signature {
19
15
  {
20
16
  /**
21
17
  * A separator component to place between breadcrumb items.
22
- * Typically renders as "/" or ">" with aria-hidden="true".
18
+ * Typically renders as "/" or ">" and is decorative (aria-hidden="true").
19
+ * Pre-configured to render as an `<li>` element for proper HTML structure.
23
20
  */
24
- Separator: typeof Separator;
21
+ Separator: WithBoundArgs<typeof Separator, "as" | "decorative">;
25
22
  }
26
23
  ];
27
24
  };
@@ -1 +1 @@
1
- {"version":3,"file":"breadcrumb.d.ts","sourceRoot":"","sources":["../../src/components/breadcrumb.gts"],"names":[],"mappings":"AA2EA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAC;AAE1D,QAAA,MAAM,SAAS,EAAE,GAAG,CAAC;IACnB,OAAO,EAAE,eAAe,CAAC;IACzB,MAAM,EAAE;QACN,OAAO,EAAE,EAAE,CAAC;KACb,CAAC;CACH,CAYC,CAAC;AAEH,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,WAAW,CAAC;IACrB,IAAI,EAAE;QACJ;;;WAGG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,MAAM,EAAE;QACN,OAAO,EAAE;YACP;gBACE;;;mBAGG;gBACH,SAAS,EAAE,OAAO,SAAS,CAAC;aAC7B;SACF,CAAC;KACH,CAAC;CACH;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,UAAU,EAAE,GAAG,CAAC,SAAS,CAiBpC,CAAC;AAEH,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"breadcrumb.d.ts","sourceRoot":"","sources":["../../src/components/breadcrumb.gts"],"names":[],"mappings":"AAoEA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,WAAW,CAAC;IACrB,IAAI,EAAE;QACJ;;;WAGG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,MAAM,EAAE;QACN,OAAO,EAAE;YACP;gBACE;;;;mBAIG;gBACH,SAAS,EAAE,aAAa,CAAC,OAAO,SAAS,EAAE,IAAI,GAAG,YAAY,CAAC,CAAC;aACjE;SACF,CAAC;KACH,CAAC;CACH;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,UAAU,EAAE,GAAG,CAAC,SAAS,CAiBpC,CAAC;AAEH,eAAe,UAAU,CAAC"}
@@ -0,0 +1,62 @@
1
+ import type { TOC } from "@ember/component/template-only";
2
+ type Orientation = "horizontal" | "vertical";
3
+ export interface Signature {
4
+ Element: HTMLElement;
5
+ Args: {
6
+ /**
7
+ * The tag name to use for the separator element.
8
+ * Defaults to `<hr>` for non-decorative separators.
9
+ * You can override this (e.g. `"li"` in menus, or `"span"` for inline separators).
10
+ *
11
+ * For example, in breadcrumbs where separators are siblings to `<li>` elements:
12
+ * ```gjs
13
+ * <Separator @as="li" @decorative={{true}}>/</Separator>
14
+ * ```
15
+ */
16
+ as?: string;
17
+ /**
18
+ * When true, hides the separator from assistive technologies.
19
+ *
20
+ * Use this for purely decorative separators, such as breadcrumb slashes.
21
+ */
22
+ decorative?: boolean;
23
+ /**
24
+ * Sets `aria-orientation`. `separator` has an implicit orientation of `horizontal`.
25
+ * Provide this when the separator is vertical.
26
+ */
27
+ orientation?: Orientation;
28
+ };
29
+ Blocks: {
30
+ default: [];
31
+ };
32
+ }
33
+ /**
34
+ * A separator component that follows the ARIA `separator` role guidance.
35
+ *
36
+ * By default, this component renders a semantic separator (`<hr>`). When using a
37
+ * non-`hr` tag via `@as`, it adds `role="separator"`.
38
+ *
39
+ * For purely decorative separators (e.g. breadcrumb slashes), set `@decorative={{true}}`
40
+ * to apply `aria-hidden="true"`.
41
+ *
42
+ * For example:
43
+ *
44
+ * ```gjs live preview
45
+ * import { Separator } from 'ember-primitives';
46
+ *
47
+ * <template>
48
+ * <nav>
49
+ * <ol style="display: flex; gap: 0.5rem; list-style: none; padding: 0;">
50
+ * <li><a href="/">Home</a></li>
51
+ * <Separator @as="li" @decorative={{true}}>/</Separator>
52
+ * <li><a href="/docs">Docs</a></li>
53
+ * <Separator @as="li" @decorative={{true}}>/</Separator>
54
+ * <li>Current</li>
55
+ * </ol>
56
+ * </nav>
57
+ * </template>
58
+ * ```
59
+ */
60
+ export declare const Separator: TOC<Signature>;
61
+ export default Separator;
62
+ //# sourceMappingURL=separator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"separator.d.ts","sourceRoot":"","sources":["../../src/components/separator.gts"],"names":[],"mappings":"AA8HA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAC;AAE1D,KAAK,WAAW,GAAG,YAAY,GAAG,UAAU,CAAC;AA0C7C,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,WAAW,CAAC;IACrB,IAAI,EAAE;QACJ;;;;;;;;;WASG;QACH,EAAE,CAAC,EAAE,MAAM,CAAC;QAEZ;;;;WAIG;QACH,UAAU,CAAC,EAAE,OAAO,CAAC;QAErB;;;WAGG;QACH,WAAW,CAAC,EAAE,WAAW,CAAC;KAC3B,CAAC;IACF,MAAM,EAAE;QACN,OAAO,EAAE,EAAE,CAAC;KACb,CAAC;CACH;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,SAAS,EAAE,GAAG,CAAC,SAAS,CAmCnC,CAAC;AAEH,eAAe,SAAS,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { cell } from "ember-resources";
1
2
  import { Label } from './-private/typed-elements';
2
3
  import type { TOC } from "@ember/component/template-only";
3
4
  import type { WithBoundArgs } from "@glint/template";
@@ -18,13 +19,27 @@ export interface Signature {
18
19
  Blocks: {
19
20
  default?: [
20
21
  {
22
+ /**
23
+ * The current state of the Switch.
24
+ *
25
+ * ```gjs
26
+ * import { Switch } from 'ember-primitives/components/switch';
27
+ *
28
+ * <template>
29
+ * <Switch as |s|>
30
+ * {{s.isChecked}}
31
+ * </Switch>
32
+ * </template>
33
+ * ```
34
+ */
35
+ isChecked: boolean;
21
36
  /**
22
37
  * The Switch Element.
23
38
  * It has a pre-wired `id` so that the relevant Label is
24
39
  * appropriately associated via the `for` property of the Label.
25
40
  *
26
41
  * ```gjs
27
- * import { Switch } from 'ember-primitives';
42
+ * import { Switch } from 'ember-primitives/components/switch';
28
43
  *
29
44
  * <template>
30
45
  * <Switch as |s|>
@@ -39,7 +54,7 @@ export interface Signature {
39
54
  * the association to the Control by setting the `for` attribute to the `id` of the Control
40
55
  *
41
56
  * ```gjs
42
- * import { Switch } from 'ember-primitives';
57
+ * import { Switch } from 'ember-primitive/components/switchs';
43
58
  *
44
59
  * <template>
45
60
  * <Switch as |s|>
@@ -57,7 +72,7 @@ interface ControlSignature {
57
72
  Element: HTMLInputElement;
58
73
  Args: {
59
74
  id: string;
60
- checked?: boolean;
75
+ checked?: ReturnType<typeof cell<boolean>>;
61
76
  onChange: () => void;
62
77
  };
63
78
  }
@@ -1 +1 @@
1
- {"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../src/components/switch.gts"],"names":[],"mappings":"AA6GA,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AAGtD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,gBAAgB,CAAC;IAC1B,IAAI,EAAE;QACJ;;;;WAIG;QACH,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB;;WAEG;QACH,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;KACrD,CAAC;IACF,MAAM,EAAE;QACN,OAAO,CAAC,EAAE;YACR;gBACE;;;;;;;;;;;;;;mBAcG;gBACH,OAAO,EAAE,aAAa,CAAC,OAAO,QAAQ,EAAE,SAAS,GAAG,IAAI,GAAG,UAAU,CAAC,CAAC;gBACvE;;;;;;;;;;;;;mBAaG;gBACH,KAAK,EAAE,aAAa,CAAC,OAAO,KAAK,EAAE,KAAK,CAAC,CAAC;aAC3C;SACF,CAAC;KACH,CAAC;CACH;AAED,UAAU,gBAAgB;IACxB,OAAO,EAAE,gBAAgB,CAAC;IAC1B,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAC;QAAC,QAAQ,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC;CAC/D;AAED,QAAA,MAAM,QAAQ,EAAE,GAAG,CAAC,gBAAgB,CA6BlC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,MAAM,EAAE,GAAG,CAAC,SAAS,CAwBhC,CAAC;AAEH,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../src/components/switch.gts"],"names":[],"mappings":"AA6HA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAGvC,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AAGtD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,gBAAgB,CAAC;IAC1B,IAAI,EAAE;QACJ;;;;WAIG;QACH,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB;;WAEG;QACH,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;KACrD,CAAC;IACF,MAAM,EAAE;QACN,OAAO,CAAC,EAAE;YACR;gBACE;;;;;;;;;;;;mBAYG;gBACH,SAAS,EAAE,OAAO,CAAC;gBACnB;;;;;;;;;;;;;;mBAcG;gBACH,OAAO,EAAE,aAAa,CAAC,OAAO,QAAQ,EAAE,SAAS,GAAG,IAAI,GAAG,UAAU,CAAC,CAAC;gBACvE;;;;;;;;;;;;;mBAaG;gBACH,KAAK,EAAE,aAAa,CAAC,OAAO,KAAK,EAAE,KAAK,CAAC,CAAC;aAC3C;SACF,CAAC;KACH,CAAC;CACH;AAED,UAAU,gBAAgB;IACxB,OAAO,EAAE,gBAAgB,CAAC;IAC1B,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC;CACxF;AAED,QAAA,MAAM,QAAQ,EAAE,GAAG,CAAC,gBAAgB,CAsBlC,CAAC;AAMH;;GAEG;AACH,eAAO,MAAM,MAAM,EAAE,GAAG,CAAC,SAAS,CAgChC,CAAC;AAEH,eAAe,MAAM,CAAC"}
@@ -18,6 +18,7 @@ export { TARGETS as PORTALS } from './components/portal-targets';
18
18
  export { Progress } from './components/progress';
19
19
  export { Rating } from './components/rating';
20
20
  export { Scroller } from './components/scroller';
21
+ export { Separator } from './components/separator';
21
22
  export { Shadowed } from './components/shadowed';
22
23
  export { Switch } from './components/switch';
23
24
  export { Toggle } from './components/toggle';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,YAAY,EACV,iCAAiC,EACjC,gCAAgC,EAChC,8BAA8B,EAC9B,iCAAiC,GAClC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,YAAY,EACV,iCAAiC,EACjC,gCAAgC,EAChC,8BAA8B,EAC9B,iCAAiC,GAClC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,cAAc,cAAc,CAAC"}
@@ -1,11 +1,9 @@
1
1
  import { hash } from '@ember/helper';
2
+ import { Separator } from './separator.js';
2
3
  import { precompileTemplate } from '@ember/template-compilation';
3
4
  import { setComponentTemplate } from '@ember/component';
4
5
  import templateOnly from '@ember/component/template-only';
5
6
 
6
- const Separator = setComponentTemplate(precompileTemplate("<span aria-hidden=\"true\" ...attributes>\n {{yield}}\n</span>", {
7
- strictMode: true
8
- }), templateOnly());
9
7
  /**
10
8
  * A breadcrumb navigation component that displays the current page's location within a navigational hierarchy.
11
9
  *
@@ -33,7 +31,7 @@ const Separator = setComponentTemplate(precompileTemplate("<span aria-hidden=\"t
33
31
  * </template>
34
32
  * ```
35
33
  */
36
- const Breadcrumb = setComponentTemplate(precompileTemplate("<nav aria-label={{if @label @label \"Breadcrumb\"}} ...attributes>\n <ol>\n {{yield (hash Separator=Separator)}}\n </ol>\n</nav>", {
34
+ const Breadcrumb = setComponentTemplate(precompileTemplate("<nav aria-label={{if @label @label \"Breadcrumb\"}} ...attributes>\n <ol>\n {{yield (hash Separator=(component Separator as=\"li\" decorative=true))}}\n </ol>\n</nav>", {
37
35
  strictMode: true,
38
36
  scope: () => ({
39
37
  hash,
@@ -1 +1 @@
1
- {"version":3,"file":"breadcrumb.js","sources":["../../src/components/breadcrumb.gts"],"sourcesContent":["import { hash } from \"@ember/helper\";\n\nimport type { TOC } from \"@ember/component/template-only\";\n\nconst Separator: TOC<{\n Element: HTMLSpanElement;\n Blocks: {\n default: [];\n };\n}> = <template>\n <span aria-hidden=\"true\" ...attributes>\n {{yield}}\n </span>\n</template>;\n\nexport interface Signature {\n Element: HTMLElement;\n Args: {\n /**\n * The accessible label for the breadcrumb navigation.\n * Defaults to \"Breadcrumb\"\n */\n label?: string;\n };\n Blocks: {\n default: [\n {\n /**\n * A separator component to place between breadcrumb items.\n * Typically renders as \"/\" or \">\" with aria-hidden=\"true\".\n */\n Separator: typeof Separator;\n },\n ];\n };\n}\n\n/**\n * A breadcrumb navigation component that displays the current page's location within a navigational hierarchy.\n *\n * Breadcrumbs help users understand their current location and provide a way to navigate back through the hierarchy.\n *\n * For example:\n *\n * ```gjs live preview\n * import { Breadcrumb } from 'ember-primitives';\n *\n * <template>\n * <Breadcrumb as |b|>\n * <li>\n * <a href=\"/\">Home</a>\n * </li>\n * <b.Separator>/</b.Separator>\n * <li>\n * <a href=\"/docs\">Docs</a>\n * </li>\n * <b.Separator>/</b.Separator>\n * <li aria-current=\"page\">\n * Breadcrumb\n * </li>\n * </Breadcrumb>\n * </template>\n * ```\n */\nexport const Breadcrumb: TOC<Signature> = <template>\n <nav aria-label={{if @label @label \"Breadcrumb\"}} ...attributes>\n <ol>\n {{yield (hash Separator=Separator)}}\n </ol>\n </nav>\n</template>;\n\nexport default Breadcrumb;\n"],"names":["Separator","setComponentTemplate","precompileTemplate","strictMode","templateOnly","Breadcrumb","scope","hash"],"mappings":";;;;;AAIA,MAAMA,SAKD,GAAAC,oBAAA,CAAAC,kBAAA,CAAA,iEAAA,EAIL;EAAAC,UAAA,EAAA;AAAU,CAAA,CAAA,EAAAC,YAAA,EAAA,CAAA;AAwBV;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BC;MACYC,UAAgB,GAAAJ,oBAAA,CAAaC,kBAAA,CAAA,uIAAA,EAM1C;EAAAC,UAAA,EAAA,IAAA;AAAAG,EAAAA,KAAA,EAAAA,OAAA;IAAAC,IAAA;AAAAP,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAI,YAAA,EAAA;;;;"}
1
+ {"version":3,"file":"breadcrumb.js","sources":["../../src/components/breadcrumb.gts"],"sourcesContent":["import { hash } from \"@ember/helper\";\n\nimport { Separator } from \"./separator.gts\";\n\nimport type { TOC } from \"@ember/component/template-only\";\nimport type { WithBoundArgs } from \"@glint/template\";\n\nexport interface Signature {\n Element: HTMLElement;\n Args: {\n /**\n * The accessible label for the breadcrumb navigation.\n * Defaults to \"Breadcrumb\"\n */\n label?: string;\n };\n Blocks: {\n default: [\n {\n /**\n * A separator component to place between breadcrumb items.\n * Typically renders as \"/\" or \">\" and is decorative (aria-hidden=\"true\").\n * Pre-configured to render as an `<li>` element for proper HTML structure.\n */\n Separator: WithBoundArgs<typeof Separator, \"as\" | \"decorative\">;\n },\n ];\n };\n}\n\n/**\n * A breadcrumb navigation component that displays the current page's location within a navigational hierarchy.\n *\n * Breadcrumbs help users understand their current location and provide a way to navigate back through the hierarchy.\n *\n * For example:\n *\n * ```gjs live preview\n * import { Breadcrumb } from 'ember-primitives';\n *\n * <template>\n * <Breadcrumb as |b|>\n * <li>\n * <a href=\"/\">Home</a>\n * </li>\n * <b.Separator>/</b.Separator>\n * <li>\n * <a href=\"/docs\">Docs</a>\n * </li>\n * <b.Separator>/</b.Separator>\n * <li aria-current=\"page\">\n * Breadcrumb\n * </li>\n * </Breadcrumb>\n * </template>\n * ```\n */\nexport const Breadcrumb: TOC<Signature> = <template>\n <nav aria-label={{if @label @label \"Breadcrumb\"}} ...attributes>\n <ol>\n {{yield (hash Separator=(component Separator as=\"li\" decorative=true))}}\n </ol>\n </nav>\n</template>;\n\nexport default Breadcrumb;\n"],"names":["Breadcrumb","setComponentTemplate","precompileTemplate","strictMode","scope","hash","Separator","templateOnly"],"mappings":";;;;;;AA8BA;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BC;MACYA,UAAgB,GAAAC,oBAAA,CAAaC,kBAAA,CAAA,6KAAA,EAM1C;EAAAC,UAAA,EAAA,IAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAC,IAAA;AAAAC,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAC,YAAA,EAAA;;;;"}
@@ -0,0 +1,75 @@
1
+ import { element } from 'ember-element-helper';
2
+ import { precompileTemplate } from '@ember/template-compilation';
3
+ import { setComponentTemplate } from '@ember/component';
4
+ import templateOnly from '@ember/component/template-only';
5
+
6
+ function normalizeTagName(tagName) {
7
+ return tagName.trim().toLowerCase();
8
+ }
9
+ function getElementTag(tagName) {
10
+ if (tagName) return tagName;
11
+ return "hr";
12
+ }
13
+ function roleFor(tagName, decorative) {
14
+ if (decorative) return undefined;
15
+ // <hr> already has implicit role="separator".
16
+ if (normalizeTagName(tagName) === "hr") return undefined;
17
+ return "separator";
18
+ }
19
+ function ariaHiddenFor(decorative) {
20
+ return decorative ? "true" : undefined;
21
+ }
22
+ function ariaOrientationFor(orientation, decorative) {
23
+ if (decorative) return undefined;
24
+ // `separator` has an implicit aria-orientation of horizontal.
25
+ // Only specify when authors opt in (e.g. vertical separators).
26
+ return orientation;
27
+ }
28
+ function shouldYield(decorative, tagName) {
29
+ // `<hr>` is a void element and must not have children.
30
+ if (normalizeTagName(tagName) === "hr") return false;
31
+ // Content inside a `separator` is presentational to AT; only yield for decorative
32
+ // separators so consumers don't accidentally rely on it for semantics.
33
+ return Boolean(decorative);
34
+ }
35
+ /**
36
+ * A separator component that follows the ARIA `separator` role guidance.
37
+ *
38
+ * By default, this component renders a semantic separator (`<hr>`). When using a
39
+ * non-`hr` tag via `@as`, it adds `role="separator"`.
40
+ *
41
+ * For purely decorative separators (e.g. breadcrumb slashes), set `@decorative={{true}}`
42
+ * to apply `aria-hidden="true"`.
43
+ *
44
+ * For example:
45
+ *
46
+ * ```gjs live preview
47
+ * import { Separator } from 'ember-primitives';
48
+ *
49
+ * <template>
50
+ * <nav>
51
+ * <ol style="display: flex; gap: 0.5rem; list-style: none; padding: 0;">
52
+ * <li><a href="/">Home</a></li>
53
+ * <Separator @as="li" @decorative={{true}}>/</Separator>
54
+ * <li><a href="/docs">Docs</a></li>
55
+ * <Separator @as="li" @decorative={{true}}>/</Separator>
56
+ * <li>Current</li>
57
+ * </ol>
58
+ * </nav>
59
+ * </template>
60
+ * ```
61
+ */
62
+ const Separator = setComponentTemplate(precompileTemplate("{{#let (getElementTag @as) as |tagName|}}\n {{#let (element tagName) as |El|}}\n <El aria-hidden={{ariaHiddenFor @decorative}} role={{roleFor tagName @decorative}} aria-orientation={{ariaOrientationFor @orientation @decorative}} ...attributes>\n {{#if (shouldYield @decorative tagName)}}\n {{yield}}\n {{/if}}\n </El>\n {{/let}}\n{{/let}}", {
63
+ strictMode: true,
64
+ scope: () => ({
65
+ getElementTag,
66
+ element,
67
+ ariaHiddenFor,
68
+ roleFor,
69
+ ariaOrientationFor,
70
+ shouldYield
71
+ })
72
+ }), templateOnly());
73
+
74
+ export { Separator, Separator as default };
75
+ //# sourceMappingURL=separator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"separator.js","sources":["../../src/components/separator.gts"],"sourcesContent":["import { element } from \"ember-element-helper\";\n\nimport type { TOC } from \"@ember/component/template-only\";\n\ntype Orientation = \"horizontal\" | \"vertical\";\n\nfunction normalizeTagName(tagName: string) {\n return tagName.trim().toLowerCase();\n}\n\nfunction getElementTag(tagName: undefined | string) {\n if (tagName) return tagName;\n\n return \"hr\";\n}\n\nfunction roleFor(tagName: string, decorative: undefined | boolean) {\n if (decorative) return undefined;\n\n // <hr> already has implicit role=\"separator\".\n if (normalizeTagName(tagName) === \"hr\") return undefined;\n\n return \"separator\";\n}\n\nfunction ariaHiddenFor(decorative: undefined | boolean) {\n return decorative ? \"true\" : undefined;\n}\n\nfunction ariaOrientationFor(orientation: undefined | Orientation, decorative: undefined | boolean) {\n if (decorative) return undefined;\n\n // `separator` has an implicit aria-orientation of horizontal.\n // Only specify when authors opt in (e.g. vertical separators).\n return orientation;\n}\n\nfunction shouldYield(decorative: undefined | boolean, tagName: string) {\n // `<hr>` is a void element and must not have children.\n if (normalizeTagName(tagName) === \"hr\") return false;\n\n // Content inside a `separator` is presentational to AT; only yield for decorative\n // separators so consumers don't accidentally rely on it for semantics.\n return Boolean(decorative);\n}\n\nexport interface Signature {\n Element: HTMLElement;\n Args: {\n /**\n * The tag name to use for the separator element.\n * Defaults to `<hr>` for non-decorative separators.\n * You can override this (e.g. `\"li\"` in menus, or `\"span\"` for inline separators).\n *\n * For example, in breadcrumbs where separators are siblings to `<li>` elements:\n * ```gjs\n * <Separator @as=\"li\" @decorative={{true}}>/</Separator>\n * ```\n */\n as?: string;\n\n /**\n * When true, hides the separator from assistive technologies.\n *\n * Use this for purely decorative separators, such as breadcrumb slashes.\n */\n decorative?: boolean;\n\n /**\n * Sets `aria-orientation`. `separator` has an implicit orientation of `horizontal`.\n * Provide this when the separator is vertical.\n */\n orientation?: Orientation;\n };\n Blocks: {\n default: [];\n };\n}\n\n/**\n * A separator component that follows the ARIA `separator` role guidance.\n *\n * By default, this component renders a semantic separator (`<hr>`). When using a\n * non-`hr` tag via `@as`, it adds `role=\"separator\"`.\n *\n * For purely decorative separators (e.g. breadcrumb slashes), set `@decorative={{true}}`\n * to apply `aria-hidden=\"true\"`.\n *\n * For example:\n *\n * ```gjs live preview\n * import { Separator } from 'ember-primitives';\n *\n * <template>\n * <nav>\n * <ol style=\"display: flex; gap: 0.5rem; list-style: none; padding: 0;\">\n * <li><a href=\"/\">Home</a></li>\n * <Separator @as=\"li\" @decorative={{true}}>/</Separator>\n * <li><a href=\"/docs\">Docs</a></li>\n * <Separator @as=\"li\" @decorative={{true}}>/</Separator>\n * <li>Current</li>\n * </ol>\n * </nav>\n * </template>\n * ```\n */\nexport const Separator: TOC<Signature> = <template>\n {{#let (getElementTag @as) as |tagName|}}\n {{#let (element tagName) as |El|}}\n <El\n aria-hidden={{ariaHiddenFor @decorative}}\n role={{roleFor tagName @decorative}}\n aria-orientation={{ariaOrientationFor @orientation @decorative}}\n ...attributes\n >\n {{#if (shouldYield @decorative tagName)}}\n {{yield}}\n {{/if}}\n </El>\n {{/let}}\n {{/let}}\n</template>;\n\nexport default Separator;\n"],"names":["normalizeTagName","tagName","trim","toLowerCase","getElementTag","roleFor","decorative","undefined","ariaHiddenFor","ariaOrientationFor","orientation","shouldYield","Boolean","Separator","setComponentTemplate","precompileTemplate","strictMode","scope","element","templateOnly"],"mappings":";;;;;AAMA,SAASA,gBAAAA,CAAiBC,OAAe,EAAA;EACvC,OAAOA,OAAA,CAAQC,IAAI,EAAA,CAAGC,WAAW,EAAA;AACnC;AAEA,SAASC,aAAAA,CAAcH,OAA2B,EAAA;EAChD,IAAIA,SAAS,OAAOA,OAAA;AAEpB,EAAA,OAAO,IAAA;AACT;AAEA,SAASI,QAAQJ,OAAe,EAAEK,UAA+B,EAAA;EAC/D,IAAIA,YAAY,OAAOC,SAAA;AAEvB;EACA,IAAIP,gBAAA,CAAiBC,OAAA,CAAA,KAAa,IAAA,EAAM,OAAOM,SAAA;AAE/C,EAAA,OAAO,WAAA;AACT;AAEA,SAASC,aAAAA,CAAcF,UAA+B,EAAA;AACpD,EAAA,OAAOA,aAAa,MAAA,GAASC,SAAA;AAC/B;AAEA,SAASE,kBAAAA,CAAmBC,WAAoC,EAAEJ,UAA+B,EAAA;EAC/F,IAAIA,YAAY,OAAOC,SAAA;AAEvB;AACA;AACA,EAAA,OAAOG,WAAA;AACT;AAEA,SAASC,YAAYL,UAA+B,EAAEL,OAAe,EAAA;AACnE;EACA,IAAID,gBAAA,CAAiBC,OAAA,CAAA,KAAa,IAAA,EAAM,OAAO,KAAA;AAE/C;AACA;EACA,OAAOW,OAAA,CAAQN,UAAA,CAAA;AACjB;AAmCA;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BC;MACYO,SAAe,GAAAC,oBAAA,CAAaC,kBAAA,CAAA,6WAAA,EAezC;EAAAC,UAAA,EAAA,IAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAb,aAAA;IAAAc,OAAA;IAAAV,aAAA;IAAAH,OAAA;IAAAI,kBAAA;AAAAE,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAQ,YAAA,EAAA;;;;"}
@@ -5,7 +5,7 @@ import { uniqueId } from '../utils.js';
5
5
  import { precompileTemplate } from '@ember/template-compilation';
6
6
  import { setComponentTemplate } from '@ember/component';
7
7
  import templateOnly from '@ember/component/template-only';
8
- import { t as toggleWithFallback } from '../utils-D0v9WKmV.js';
8
+ import { t as toggleWithFallback } from '../utils-BBQjrXDg.js';
9
9
 
10
10
  setComponentTemplate(precompileTemplate("<div ...attributes>{{yield}}</div>", {
11
11
  strictMode: true
@@ -14,22 +14,26 @@ const Label = setComponentTemplate(precompileTemplate("<label for={{@for}} ...at
14
14
  strictMode: true
15
15
  }), templateOnly());
16
16
 
17
- const Checkbox = setComponentTemplate(precompileTemplate("{{#let (cell @checked) as |checked|}}\n <input id={{@id}} type=\"checkbox\" role=\"switch\" checked={{checked.current}} aria-checked={{checked.current}} data-state={{if checked.current \"on\" \"off\"}} {{on \"click\" (fn toggleWithFallback checked.toggle @onChange)}} ...attributes />\n{{/let}}", {
17
+ const Checkbox = setComponentTemplate(precompileTemplate("<input id={{@id}} type=\"checkbox\" role=\"switch\" checked={{@checked.current}} aria-checked={{@checked.current}} data-state={{if @checked.current \"on\" \"off\"}} {{on \"click\" (fn toggleWithFallback @checked.toggle @onChange)}} ...attributes />", {
18
18
  strictMode: true,
19
19
  scope: () => ({
20
- cell,
21
20
  on,
22
21
  fn,
23
22
  toggleWithFallback
24
23
  })
25
24
  }), templateOnly());
25
+ function defaultFalse(value) {
26
+ return value ?? false;
27
+ }
26
28
  /**
27
29
  * @public
28
30
  */
29
- const Switch = setComponentTemplate(precompileTemplate("<div ...attributes data-prim-switch>\n {{!-- @glint-nocheck --}}\n {{#let (uniqueId) as |id|}}\n {{yield (hash Control=(component Checkbox checked=@checked id=id onChange=@onChange) Label=(component Label for=id))}}\n {{/let}}\n</div>", {
31
+ const Switch = setComponentTemplate(precompileTemplate("<div ...attributes data-prim-switch>\n {{#let (uniqueId) as |id|}}\n {{#let (cell (defaultFalse @checked)) as |checked|}}\n {{!-- @glint-nocheck --}}\n {{yield (hash isChecked=checked.current Control=(component Checkbox checked=checked id=id onChange=@onChange) Label=(component Label for=id))}}\n {{/let}}\n {{/let}}\n</div>", {
30
32
  strictMode: true,
31
33
  scope: () => ({
32
34
  uniqueId,
35
+ cell,
36
+ defaultFalse,
33
37
  hash,
34
38
  Checkbox,
35
39
  Label
@@ -1 +1 @@
1
- {"version":3,"file":"switch.js","sources":["../../src/components/-private/typed-elements.gts","../../src/components/switch.gts"],"sourcesContent":["import type { TOC } from \"@ember/component/template-only\";\n\nexport const Div: TOC<{ Element: HTMLDivElement; Blocks: { default: [] } }> = <template>\n <div ...attributes>{{yield}}</div>\n</template>;\n\nexport const Label: TOC<{\n Element: HTMLLabelElement;\n Args: { for: string };\n Blocks: { default: [] };\n}> = <template>\n <label for={{@for}} ...attributes>{{yield}}</label>\n</template>;\n","import { fn, hash } from \"@ember/helper\";\nimport { on } from \"@ember/modifier\";\n\nimport { cell } from \"ember-resources\";\n\nimport { uniqueId } from \"../utils.ts\";\nimport { Label } from \"./-private/typed-elements.gts\";\nimport { toggleWithFallback } from \"./-private/utils.ts\";\n\nimport type { TOC } from \"@ember/component/template-only\";\nimport type { WithBoundArgs } from \"@glint/template\";\n\nexport interface Signature {\n Element: HTMLInputElement;\n Args: {\n /**\n * The initial checked value of the Switch.\n * This value is reactive, so if the value that\n * `@checked` is set to updates, the state of the Switch will also update.\n */\n checked?: boolean;\n /**\n * Callback when the Switch state is toggled\n */\n onChange?: (checked: boolean, event: Event) => void;\n };\n Blocks: {\n default?: [\n {\n /**\n * The Switch Element.\n * It has a pre-wired `id` so that the relevant Label is\n * appropriately associated via the `for` property of the Label.\n *\n * ```gjs\n * import { Switch } from 'ember-primitives';\n *\n * <template>\n * <Switch as |s|>\n * <s.Control />\n * </Switch>\n * </template>\n * ```\n */\n Control: WithBoundArgs<typeof Checkbox, \"checked\" | \"id\" | \"onChange\">;\n /**\n * The Switch element requires a label, and this label already has\n * the association to the Control by setting the `for` attribute to the `id` of the Control\n *\n * ```gjs\n * import { Switch } from 'ember-primitives';\n *\n * <template>\n * <Switch as |s|>\n * <s.Label />\n * </Switch>\n * </template>\n * ```\n */\n Label: WithBoundArgs<typeof Label, \"for\">;\n },\n ];\n };\n}\n\ninterface ControlSignature {\n Element: HTMLInputElement;\n Args: { id: string; checked?: boolean; onChange: () => void };\n}\n\nconst Checkbox: TOC<ControlSignature> = <template>\n {{#let (cell @checked) as |checked|}}\n <input\n id={{@id}}\n type=\"checkbox\"\n role=\"switch\"\n checked={{checked.current}}\n aria-checked={{checked.current}}\n data-state={{if checked.current \"on\" \"off\"}}\n {{on \"click\" (fn toggleWithFallback checked.toggle @onChange)}}\n ...attributes\n />\n {{/let}}\n</template>;\n\n/**\n * @public\n */\nexport const Switch: TOC<Signature> = <template>\n <div ...attributes data-prim-switch>\n {{! @glint-nocheck }}\n {{#let (uniqueId) as |id|}}\n {{yield\n (hash\n Control=(component Checkbox checked=@checked id=id onChange=@onChange)\n Label=(component Label for=id)\n )\n }}\n {{/let}}\n </div>\n</template>;\n\nexport default Switch;\n"],"names":["precompileTemplate","strictMode","templateOnly","Label","Checkbox","setComponentTemplate","scope","cell","on","fn","toggleWithFallback","Switch","uniqueId","hash"],"mappings":";;;;;;;;;qBAE8EA,kBAAA,CAAA,oCAAA,EAE9E;EAAAC,UAAA,EAAA;AAAU,CAAA,CAAA,EAAAC,YAAA,EAAA;AAEH,MAAMC,6BAIRH,kBAAA,CAAA,qDAAA,EAEL;EAAAC,UAAA,EAAA;AAAU,CAAA,CAAA,EAAAC,YAAA,EAAA,CAAA;;AC0DV,MAAME,QAAc,GAAAC,oBAAA,CAAoBL,kBAAA,CAAA,ySAAA,EAaxC;EAAAC,UAAA,EAAA,IAAA;AAAAK,EAAAA,KAAA,EAAAA,OAAA;IAAAC,IAAA;IAAAC,EAAA;IAAAC,EAAA;AAAAC,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAR,YAAA,EAAA,CAAA;AAEV;;AAEC;MACYS,MAAY,GAAAN,oBAAA,CAAaL,kBAAA,CAAA,kPAAA,EAYtC;EAAAC,UAAA,EAAA,IAAA;AAAAK,EAAAA,KAAA,EAAAA,OAAA;IAAAM,QAAA;IAAAC,IAAA;IAAAT,QAAA;AAAAD,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAD,YAAA,EAAA;;;;"}
1
+ {"version":3,"file":"switch.js","sources":["../../src/components/-private/typed-elements.gts","../../src/components/switch.gts"],"sourcesContent":["import type { TOC } from \"@ember/component/template-only\";\n\nexport const Div: TOC<{ Element: HTMLDivElement; Blocks: { default: [] } }> = <template>\n <div ...attributes>{{yield}}</div>\n</template>;\n\nexport const Label: TOC<{\n Element: HTMLLabelElement;\n Args: { for: string };\n Blocks: { default: [] };\n}> = <template>\n <label for={{@for}} ...attributes>{{yield}}</label>\n</template>;\n","import { fn, hash } from \"@ember/helper\";\nimport { on } from \"@ember/modifier\";\n\nimport { cell } from \"ember-resources\";\n\nimport { uniqueId } from \"../utils.ts\";\nimport { Label } from \"./-private/typed-elements.gts\";\nimport { toggleWithFallback } from \"./-private/utils.ts\";\n\nimport type { TOC } from \"@ember/component/template-only\";\nimport type { WithBoundArgs } from \"@glint/template\";\n\nexport interface Signature {\n Element: HTMLInputElement;\n Args: {\n /**\n * The initial checked value of the Switch.\n * This value is reactive, so if the value that\n * `@checked` is set to updates, the state of the Switch will also update.\n */\n checked?: boolean;\n /**\n * Callback when the Switch state is toggled\n */\n onChange?: (checked: boolean, event: Event) => void;\n };\n Blocks: {\n default?: [\n {\n /**\n * The current state of the Switch.\n *\n * ```gjs\n * import { Switch } from 'ember-primitives/components/switch';\n *\n * <template>\n * <Switch as |s|>\n * {{s.isChecked}}\n * </Switch>\n * </template>\n * ```\n */\n isChecked: boolean;\n /**\n * The Switch Element.\n * It has a pre-wired `id` so that the relevant Label is\n * appropriately associated via the `for` property of the Label.\n *\n * ```gjs\n * import { Switch } from 'ember-primitives/components/switch';\n *\n * <template>\n * <Switch as |s|>\n * <s.Control />\n * </Switch>\n * </template>\n * ```\n */\n Control: WithBoundArgs<typeof Checkbox, \"checked\" | \"id\" | \"onChange\">;\n /**\n * The Switch element requires a label, and this label already has\n * the association to the Control by setting the `for` attribute to the `id` of the Control\n *\n * ```gjs\n * import { Switch } from 'ember-primitive/components/switchs';\n *\n * <template>\n * <Switch as |s|>\n * <s.Label />\n * </Switch>\n * </template>\n * ```\n */\n Label: WithBoundArgs<typeof Label, \"for\">;\n },\n ];\n };\n}\n\ninterface ControlSignature {\n Element: HTMLInputElement;\n Args: { id: string; checked?: ReturnType<typeof cell<boolean>>; onChange: () => void };\n}\n\nconst Checkbox: TOC<ControlSignature> = <template>\n <input\n id={{@id}}\n type=\"checkbox\"\n role=\"switch\"\n checked={{@checked.current}}\n aria-checked={{@checked.current}}\n data-state={{if @checked.current \"on\" \"off\"}}\n {{on \"click\" (fn toggleWithFallback @checked.toggle @onChange)}}\n ...attributes\n />\n</template>;\n\nfunction defaultFalse(value: unknown) {\n return value ?? false;\n}\n\n/**\n * @public\n */\nexport const Switch: TOC<Signature> = <template>\n <div ...attributes data-prim-switch>\n {{#let (uniqueId) as |id|}}\n {{#let (cell (defaultFalse @checked)) as |checked|}}\n {{! @glint-nocheck }}\n {{yield\n (hash\n isChecked=checked.current\n Control=(component Checkbox checked=checked id=id onChange=@onChange)\n Label=(component Label for=id)\n )\n }}\n {{/let}}\n {{/let}}\n </div>\n</template>;\n\nexport default Switch;\n"],"names":["precompileTemplate","strictMode","templateOnly","Label","Checkbox","setComponentTemplate","scope","on","fn","toggleWithFallback","defaultFalse","value","Switch","uniqueId","cell","hash"],"mappings":";;;;;;;;;qBAE8EA,kBAAA,CAAA,oCAAA,EAE9E;EAAAC,UAAA,EAAA;AAAU,CAAA,CAAA,EAAAC,YAAA,EAAA;AAEH,MAAMC,6BAIRH,kBAAA,CAAA,qDAAA,EAEL;EAAAC,UAAA,EAAA;AAAU,CAAA,CAAA,EAAAC,YAAA,EAAA,CAAA;;ACwEV,MAAME,QAAc,GAAAC,oBAAA,CAAoBL,kBAAA,CAAA,0PAAA,EAWxC;EAAAC,UAAA,EAAA,IAAA;AAAAK,EAAAA,KAAA,EAAAA,OAAA;IAAAC,EAAA;IAAAC,EAAA;AAAAC,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAP,YAAA,EAAA,CAAA;AAEV,SAASQ,YAAAA,CAAaC,KAAc,EAAA;EAClC,OAAOA,KAAA,IAAS,KAAA;AAClB;AAEA;;AAEC;MACYC,MAAY,GAAAP,oBAAA,CAAaL,kBAAA,CAAA,yVAAA,EAetC;EAAAC,UAAA,EAAA,IAAA;AAAAK,EAAAA,KAAA,EAAAA,OAAA;IAAAO,QAAA;IAAAC,IAAA;IAAAJ,YAAA;IAAAK,IAAA;IAAAX,QAAA;AAAAD,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAD,YAAA,EAAA;;;;"}
@@ -1,7 +1,7 @@
1
1
  import { fn } from '@ember/helper';
2
2
  import { on } from '@ember/modifier';
3
3
  import { cell } from 'ember-resources';
4
- import { t as toggleWithFallback } from '../utils-D0v9WKmV.js';
4
+ import { t as toggleWithFallback } from '../utils-BBQjrXDg.js';
5
5
  import { precompileTemplate } from '@ember/template-compilation';
6
6
  import { setComponentTemplate } from '@ember/component';
7
7
  import templateOnly from '@ember/component/template-only';
package/dist/index.js CHANGED
@@ -17,6 +17,7 @@ export { TARGETS as PORTALS, PortalTargets } from './components/portal-targets.j
17
17
  export { Progress } from './components/progress.js';
18
18
  export { R as Rating } from './rating-BrIiwDLw.js';
19
19
  export { Scroller } from './components/scroller.js';
20
+ export { Separator } from './components/separator.js';
20
21
  export { Shadowed } from './components/shadowed.js';
21
22
  export { Switch } from './components/switch.js';
22
23
  export { Toggle } from './components/toggle.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["/**\n * DANGER: this is a *barrel file*\n *\n * It forces the whole library to be loaded and all dependencies.\n *\n * If you have a small app, you probably don't want to import from here -- instead import from each sub-path.\n */\nimport { importSync, isDevelopingApp, macroCondition } from '@embroider/macros';\n\nif (macroCondition(isDevelopingApp())) {\n importSync('./components/violations.css');\n}\n\nexport { Accordion } from './components/accordion.gts';\nexport type {\n AccordionContentExternalSignature,\n AccordionHeaderExternalSignature,\n AccordionItemExternalSignature,\n AccordionTriggerExternalSignature,\n} from './components/accordion/public.ts';\nexport { Avatar } from './components/avatar.gts';\nexport { Breadcrumb } from './components/breadcrumb.gts';\nexport { Dialog, Dialog as Modal } from './components/dialog.gts';\nexport { Drawer } from './components/drawer.gts';\nexport { ExternalLink } from './components/external-link.gts';\nexport { Form } from './components/form.gts';\nexport { Key, KeyCombo } from './components/keys.gts';\nexport { StickyFooter } from './components/layout/sticky-footer.gts';\nexport { Link } from './components/link.gts';\nexport { Menu } from './components/menu.gts';\nexport { OTP, OTPInput } from './components/one-time-password.gts';\nexport { Popover } from './components/popover.gts';\nexport { Portal } from './components/portal.gts';\nexport { PortalTargets } from './components/portal-targets.gts';\nexport { TARGETS as PORTALS } from './components/portal-targets.gts';\nexport { Progress } from './components/progress.gts';\nexport { Rating } from './components/rating.gts';\nexport { Scroller } from './components/scroller.gts';\nexport { Shadowed } from './components/shadowed.gts';\nexport { Switch } from './components/switch.gts';\nexport { Toggle } from './components/toggle.gts';\nexport { ToggleGroup } from './components/toggle-group.gts';\nexport { VisuallyHidden } from './components/visually-hidden.gts';\nexport { Zoetrope } from './components/zoetrope.ts';\nexport * from './helpers.ts';\n"],"names":["macroCondition","isDevelopingApp","importSync"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,IAAIA,cAAc,CAACC,eAAe,EAAE,CAAC,EAAE;EACrCC,UAAU,CAAC,6BAA6B,CAAC;AAC3C"}
1
+ {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["/**\n * DANGER: this is a *barrel file*\n *\n * It forces the whole library to be loaded and all dependencies.\n *\n * If you have a small app, you probably don't want to import from here -- instead import from each sub-path.\n */\nimport { importSync, isDevelopingApp, macroCondition } from '@embroider/macros';\n\nif (macroCondition(isDevelopingApp())) {\n importSync('./components/violations.css');\n}\n\nexport { Accordion } from './components/accordion.gts';\nexport type {\n AccordionContentExternalSignature,\n AccordionHeaderExternalSignature,\n AccordionItemExternalSignature,\n AccordionTriggerExternalSignature,\n} from './components/accordion/public.ts';\nexport { Avatar } from './components/avatar.gts';\nexport { Breadcrumb } from './components/breadcrumb.gts';\nexport { Dialog, Dialog as Modal } from './components/dialog.gts';\nexport { Drawer } from './components/drawer.gts';\nexport { ExternalLink } from './components/external-link.gts';\nexport { Form } from './components/form.gts';\nexport { Key, KeyCombo } from './components/keys.gts';\nexport { StickyFooter } from './components/layout/sticky-footer.gts';\nexport { Link } from './components/link.gts';\nexport { Menu } from './components/menu.gts';\nexport { OTP, OTPInput } from './components/one-time-password.gts';\nexport { Popover } from './components/popover.gts';\nexport { Portal } from './components/portal.gts';\nexport { PortalTargets } from './components/portal-targets.gts';\nexport { TARGETS as PORTALS } from './components/portal-targets.gts';\nexport { Progress } from './components/progress.gts';\nexport { Rating } from './components/rating.gts';\nexport { Scroller } from './components/scroller.gts';\nexport { Separator } from './components/separator.gts';\nexport { Shadowed } from './components/shadowed.gts';\nexport { Switch } from './components/switch.gts';\nexport { Toggle } from './components/toggle.gts';\nexport { ToggleGroup } from './components/toggle-group.gts';\nexport { VisuallyHidden } from './components/visually-hidden.gts';\nexport { Zoetrope } from './components/zoetrope.ts';\nexport * from './helpers.ts';\n"],"names":["macroCondition","isDevelopingApp","importSync"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,IAAIA,cAAc,CAACC,eAAe,EAAE,CAAC,EAAE;EACrCC,UAAU,CAAC,6BAA6B,CAAC;AAC3C"}
@@ -6,8 +6,8 @@ function toggleWithFallback(uncontrolledToggle, controlledToggle, ...args) {
6
6
  if (controlledToggle) {
7
7
  return controlledToggle(...args);
8
8
  }
9
- uncontrolledToggle(...args);
9
+ uncontrolledToggle?.(...args);
10
10
  }
11
11
 
12
12
  export { toggleWithFallback as t };
13
- //# sourceMappingURL=utils-D0v9WKmV.js.map
13
+ //# sourceMappingURL=utils-BBQjrXDg.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils-BBQjrXDg.js","sources":["../src/components/-private/utils.ts"],"sourcesContent":["/**\n * If the user provides an onChange or similar function, use that,\n * otherwise fallback to the uncontrolled toggle\n */\nexport function toggleWithFallback(\n uncontrolledToggle: undefined | ((...args: any[]) => void) | (() => void),\n controlledToggle?: (...args: any[]) => void,\n ...args: unknown[]\n) {\n if (controlledToggle) {\n return controlledToggle(...args);\n }\n\n uncontrolledToggle?.(...args);\n}\n"],"names":["toggleWithFallback","uncontrolledToggle","controlledToggle","args"],"mappings":"AAAA;AACA;AACA;AACA;AACO,SAASA,kBAAkBA,CAChCC,kBAAyE,EACzEC,gBAA2C,EAC3C,GAAGC,IAAe,EAClB;AACA,EAAA,IAAID,gBAAgB,EAAE;AACpB,IAAA,OAAOA,gBAAgB,CAAC,GAAGC,IAAI,CAAC;AAClC,EAAA;EAEAF,kBAAkB,GAAG,GAAGE,IAAI,CAAC;AAC/B;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ember-primitives",
3
- "version": "0.51.0",
3
+ "version": "0.53.0",
4
4
  "description": "Making apps easier to build",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -28,8 +28,8 @@
28
28
  "should-handle-link": "^1.2.2",
29
29
  "tabster": "^8.7.0",
30
30
  "tracked-built-ins": "^4.1.0",
31
- "tracked-toolbox": "^2.0.0",
32
- "which-heading-do-i-need": "0.2.4"
31
+ "tracked-toolbox": "^2.2.0",
32
+ "which-heading-do-i-need": "0.2.5"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@arethetypeswrong/cli": "^0.18.0",
@@ -48,9 +48,9 @@
48
48
  "@embroider/addon-dev": "^8.2.0",
49
49
  "@glimmer/component": "^2.0.0",
50
50
  "@glimmer/tracking": "^1.1.2",
51
- "@glint/ember-tsc": "^1.0.8",
51
+ "@glint/ember-tsc": "^1.0.9",
52
52
  "@glint/template": "^1.7.3",
53
- "@glint/tsserver-plugin": "^2.0.8",
53
+ "@glint/tsserver-plugin": "^2.0.9",
54
54
  "@nullvoxpopuli/eslint-configs": "^5.5.0",
55
55
  "@rollup/plugin-babel": "^6.1.0",
56
56
  "@tsconfig/ember": "^3.0.12",
@@ -58,7 +58,7 @@
58
58
  "concurrently": "^9.2.1",
59
59
  "ember-modifier": "^4.2.2",
60
60
  "ember-resources": "^7.0.7",
61
- "ember-source": "^6.9.0",
61
+ "ember-source": "^6.10.0",
62
62
  "ember-template-lint": "^7.9.3",
63
63
  "eslint": "^9.39.2",
64
64
  "execa": "^9.6.0",
@@ -66,7 +66,7 @@
66
66
  "prettier": "^3.7.4",
67
67
  "prettier-plugin-ember-template-tag": "^2.1.2",
68
68
  "publint": "^0.3.16",
69
- "rollup": "^4.54.0",
69
+ "rollup": "^4.55.1",
70
70
  "rollup-plugin-copy": "^3.5.0",
71
71
  "typescript": "^5.9.3"
72
72
  },
@@ -3,8 +3,7 @@
3
3
  * otherwise fallback to the uncontrolled toggle
4
4
  */
5
5
  export function toggleWithFallback(
6
- uncontrolledToggle: (...args: unknown[]) => void,
7
-
6
+ uncontrolledToggle: undefined | ((...args: any[]) => void) | (() => void),
8
7
  controlledToggle?: (...args: any[]) => void,
9
8
  ...args: unknown[]
10
9
  ) {
@@ -12,5 +11,5 @@ export function toggleWithFallback(
12
11
  return controlledToggle(...args);
13
12
  }
14
13
 
15
- uncontrolledToggle(...args);
14
+ uncontrolledToggle?.(...args);
16
15
  }
@@ -1,17 +1,9 @@
1
1
  import { hash } from "@ember/helper";
2
2
 
3
- import type { TOC } from "@ember/component/template-only";
3
+ import { Separator } from "./separator.gts";
4
4
 
5
- const Separator: TOC<{
6
- Element: HTMLSpanElement;
7
- Blocks: {
8
- default: [];
9
- };
10
- }> = <template>
11
- <span aria-hidden="true" ...attributes>
12
- {{yield}}
13
- </span>
14
- </template>;
5
+ import type { TOC } from "@ember/component/template-only";
6
+ import type { WithBoundArgs } from "@glint/template";
15
7
 
16
8
  export interface Signature {
17
9
  Element: HTMLElement;
@@ -27,9 +19,10 @@ export interface Signature {
27
19
  {
28
20
  /**
29
21
  * A separator component to place between breadcrumb items.
30
- * Typically renders as "/" or ">" with aria-hidden="true".
22
+ * Typically renders as "/" or ">" and is decorative (aria-hidden="true").
23
+ * Pre-configured to render as an `<li>` element for proper HTML structure.
31
24
  */
32
- Separator: typeof Separator;
25
+ Separator: WithBoundArgs<typeof Separator, "as" | "decorative">;
33
26
  },
34
27
  ];
35
28
  };
@@ -65,7 +58,7 @@ export interface Signature {
65
58
  export const Breadcrumb: TOC<Signature> = <template>
66
59
  <nav aria-label={{if @label @label "Breadcrumb"}} ...attributes>
67
60
  <ol>
68
- {{yield (hash Separator=Separator)}}
61
+ {{yield (hash Separator=(component Separator as="li" decorative=true))}}
69
62
  </ol>
70
63
  </nav>
71
64
  </template>;
@@ -0,0 +1,124 @@
1
+ import { element } from "ember-element-helper";
2
+
3
+ import type { TOC } from "@ember/component/template-only";
4
+
5
+ type Orientation = "horizontal" | "vertical";
6
+
7
+ function normalizeTagName(tagName: string) {
8
+ return tagName.trim().toLowerCase();
9
+ }
10
+
11
+ function getElementTag(tagName: undefined | string) {
12
+ if (tagName) return tagName;
13
+
14
+ return "hr";
15
+ }
16
+
17
+ function roleFor(tagName: string, decorative: undefined | boolean) {
18
+ if (decorative) return undefined;
19
+
20
+ // <hr> already has implicit role="separator".
21
+ if (normalizeTagName(tagName) === "hr") return undefined;
22
+
23
+ return "separator";
24
+ }
25
+
26
+ function ariaHiddenFor(decorative: undefined | boolean) {
27
+ return decorative ? "true" : undefined;
28
+ }
29
+
30
+ function ariaOrientationFor(orientation: undefined | Orientation, decorative: undefined | boolean) {
31
+ if (decorative) return undefined;
32
+
33
+ // `separator` has an implicit aria-orientation of horizontal.
34
+ // Only specify when authors opt in (e.g. vertical separators).
35
+ return orientation;
36
+ }
37
+
38
+ function shouldYield(decorative: undefined | boolean, tagName: string) {
39
+ // `<hr>` is a void element and must not have children.
40
+ if (normalizeTagName(tagName) === "hr") return false;
41
+
42
+ // Content inside a `separator` is presentational to AT; only yield for decorative
43
+ // separators so consumers don't accidentally rely on it for semantics.
44
+ return Boolean(decorative);
45
+ }
46
+
47
+ export interface Signature {
48
+ Element: HTMLElement;
49
+ Args: {
50
+ /**
51
+ * The tag name to use for the separator element.
52
+ * Defaults to `<hr>` for non-decorative separators.
53
+ * You can override this (e.g. `"li"` in menus, or `"span"` for inline separators).
54
+ *
55
+ * For example, in breadcrumbs where separators are siblings to `<li>` elements:
56
+ * ```gjs
57
+ * <Separator @as="li" @decorative={{true}}>/</Separator>
58
+ * ```
59
+ */
60
+ as?: string;
61
+
62
+ /**
63
+ * When true, hides the separator from assistive technologies.
64
+ *
65
+ * Use this for purely decorative separators, such as breadcrumb slashes.
66
+ */
67
+ decorative?: boolean;
68
+
69
+ /**
70
+ * Sets `aria-orientation`. `separator` has an implicit orientation of `horizontal`.
71
+ * Provide this when the separator is vertical.
72
+ */
73
+ orientation?: Orientation;
74
+ };
75
+ Blocks: {
76
+ default: [];
77
+ };
78
+ }
79
+
80
+ /**
81
+ * A separator component that follows the ARIA `separator` role guidance.
82
+ *
83
+ * By default, this component renders a semantic separator (`<hr>`). When using a
84
+ * non-`hr` tag via `@as`, it adds `role="separator"`.
85
+ *
86
+ * For purely decorative separators (e.g. breadcrumb slashes), set `@decorative={{true}}`
87
+ * to apply `aria-hidden="true"`.
88
+ *
89
+ * For example:
90
+ *
91
+ * ```gjs live preview
92
+ * import { Separator } from 'ember-primitives';
93
+ *
94
+ * <template>
95
+ * <nav>
96
+ * <ol style="display: flex; gap: 0.5rem; list-style: none; padding: 0;">
97
+ * <li><a href="/">Home</a></li>
98
+ * <Separator @as="li" @decorative={{true}}>/</Separator>
99
+ * <li><a href="/docs">Docs</a></li>
100
+ * <Separator @as="li" @decorative={{true}}>/</Separator>
101
+ * <li>Current</li>
102
+ * </ol>
103
+ * </nav>
104
+ * </template>
105
+ * ```
106
+ */
107
+ export const Separator: TOC<Signature> = <template>
108
+ {{#let (getElementTag @as) as |tagName|}}
109
+ {{#let (element tagName) as |El|}}
110
+ <El
111
+ aria-hidden={{ariaHiddenFor @decorative}}
112
+ role={{roleFor tagName @decorative}}
113
+ aria-orientation={{ariaOrientationFor @orientation @decorative}}
114
+ ...attributes
115
+ >
116
+ {{#if (shouldYield @decorative tagName)}}
117
+ {{yield}}
118
+ {{/if}}
119
+ </El>
120
+ {{/let}}
121
+ {{/let}}
122
+ </template>;
123
+
124
+ export default Separator;
@@ -27,13 +27,27 @@ export interface Signature {
27
27
  Blocks: {
28
28
  default?: [
29
29
  {
30
+ /**
31
+ * The current state of the Switch.
32
+ *
33
+ * ```gjs
34
+ * import { Switch } from 'ember-primitives/components/switch';
35
+ *
36
+ * <template>
37
+ * <Switch as |s|>
38
+ * {{s.isChecked}}
39
+ * </Switch>
40
+ * </template>
41
+ * ```
42
+ */
43
+ isChecked: boolean;
30
44
  /**
31
45
  * The Switch Element.
32
46
  * It has a pre-wired `id` so that the relevant Label is
33
47
  * appropriately associated via the `for` property of the Label.
34
48
  *
35
49
  * ```gjs
36
- * import { Switch } from 'ember-primitives';
50
+ * import { Switch } from 'ember-primitives/components/switch';
37
51
  *
38
52
  * <template>
39
53
  * <Switch as |s|>
@@ -48,7 +62,7 @@ export interface Signature {
48
62
  * the association to the Control by setting the `for` attribute to the `id` of the Control
49
63
  *
50
64
  * ```gjs
51
- * import { Switch } from 'ember-primitives';
65
+ * import { Switch } from 'ember-primitive/components/switchs';
52
66
  *
53
67
  * <template>
54
68
  * <Switch as |s|>
@@ -65,37 +79,42 @@ export interface Signature {
65
79
 
66
80
  interface ControlSignature {
67
81
  Element: HTMLInputElement;
68
- Args: { id: string; checked?: boolean; onChange: () => void };
82
+ Args: { id: string; checked?: ReturnType<typeof cell<boolean>>; onChange: () => void };
69
83
  }
70
84
 
71
85
  const Checkbox: TOC<ControlSignature> = <template>
72
- {{#let (cell @checked) as |checked|}}
73
- <input
74
- id={{@id}}
75
- type="checkbox"
76
- role="switch"
77
- checked={{checked.current}}
78
- aria-checked={{checked.current}}
79
- data-state={{if checked.current "on" "off"}}
80
- {{on "click" (fn toggleWithFallback checked.toggle @onChange)}}
81
- ...attributes
82
- />
83
- {{/let}}
86
+ <input
87
+ id={{@id}}
88
+ type="checkbox"
89
+ role="switch"
90
+ checked={{@checked.current}}
91
+ aria-checked={{@checked.current}}
92
+ data-state={{if @checked.current "on" "off"}}
93
+ {{on "click" (fn toggleWithFallback @checked.toggle @onChange)}}
94
+ ...attributes
95
+ />
84
96
  </template>;
85
97
 
98
+ function defaultFalse(value: unknown) {
99
+ return value ?? false;
100
+ }
101
+
86
102
  /**
87
103
  * @public
88
104
  */
89
105
  export const Switch: TOC<Signature> = <template>
90
106
  <div ...attributes data-prim-switch>
91
- {{! @glint-nocheck }}
92
107
  {{#let (uniqueId) as |id|}}
93
- {{yield
94
- (hash
95
- Control=(component Checkbox checked=@checked id=id onChange=@onChange)
96
- Label=(component Label for=id)
97
- )
98
- }}
108
+ {{#let (cell (defaultFalse @checked)) as |checked|}}
109
+ {{! @glint-nocheck }}
110
+ {{yield
111
+ (hash
112
+ isChecked=checked.current
113
+ Control=(component Checkbox checked=checked id=id onChange=@onChange)
114
+ Label=(component Label for=id)
115
+ )
116
+ }}
117
+ {{/let}}
99
118
  {{/let}}
100
119
  </div>
101
120
  </template>;
package/src/index.ts CHANGED
@@ -36,6 +36,7 @@ export { TARGETS as PORTALS } from './components/portal-targets.gts';
36
36
  export { Progress } from './components/progress.gts';
37
37
  export { Rating } from './components/rating.gts';
38
38
  export { Scroller } from './components/scroller.gts';
39
+ export { Separator } from './components/separator.gts';
39
40
  export { Shadowed } from './components/shadowed.gts';
40
41
  export { Switch } from './components/switch.gts';
41
42
  export { Toggle } from './components/toggle.gts';
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils-D0v9WKmV.js","sources":["../src/components/-private/utils.ts"],"sourcesContent":["/**\n * If the user provides an onChange or similar function, use that,\n * otherwise fallback to the uncontrolled toggle\n */\nexport function toggleWithFallback(\n uncontrolledToggle: (...args: unknown[]) => void,\n\n controlledToggle?: (...args: any[]) => void,\n ...args: unknown[]\n) {\n if (controlledToggle) {\n return controlledToggle(...args);\n }\n\n uncontrolledToggle(...args);\n}\n"],"names":["toggleWithFallback","uncontrolledToggle","controlledToggle","args"],"mappings":"AAAA;AACA;AACA;AACA;AACO,SAASA,kBAAkBA,CAChCC,kBAAgD,EAEhDC,gBAA2C,EAC3C,GAAGC,IAAe,EAClB;AACA,EAAA,IAAID,gBAAgB,EAAE;AACpB,IAAA,OAAOA,gBAAgB,CAAC,GAAGC,IAAI,CAAC;AAClC,EAAA;EAEAF,kBAAkB,CAAC,GAAGE,IAAI,CAAC;AAC7B;;;;"}