frontile 0.18.0 → 0.18.1

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.
Files changed (63) hide show
  1. package/declarations/components/buttons/chip.d.ts +1 -1
  2. package/declarations/components/buttons/chip.d.ts.map +1 -1
  3. package/declarations/components/forms/autocomplete.d.ts +12 -12
  4. package/declarations/components/forms/date-input/clipboard.d.ts +34 -0
  5. package/declarations/components/forms/date-input/clipboard.d.ts.map +1 -0
  6. package/declarations/components/forms/date-input/date-input.d.ts +91 -0
  7. package/declarations/components/forms/date-input/date-input.d.ts.map +1 -0
  8. package/declarations/components/forms/date-input/segment-group.d.ts +130 -0
  9. package/declarations/components/forms/date-input/segment-group.d.ts.map +1 -0
  10. package/declarations/components/forms/date-input/segments.d.ts +137 -0
  11. package/declarations/components/forms/date-input/segments.d.ts.map +1 -0
  12. package/declarations/components/forms/date-input/types.d.ts +134 -0
  13. package/declarations/components/forms/date-input/types.d.ts.map +1 -0
  14. package/declarations/components/forms/date-input.d.ts +6 -0
  15. package/declarations/components/forms/date-input.d.ts.map +1 -0
  16. package/declarations/components/forms/date-picker/date-picker.d.ts +248 -15
  17. package/declarations/components/forms/date-picker/date-picker.d.ts.map +1 -1
  18. package/declarations/components/forms/date-picker/end-content.d.ts +33 -3
  19. package/declarations/components/forms/date-picker/end-content.d.ts.map +1 -1
  20. package/declarations/components/forms/date-picker/types.d.ts +30 -1
  21. package/declarations/components/forms/date-picker/types.d.ts.map +1 -1
  22. package/declarations/components/forms/field.d.ts +3 -0
  23. package/declarations/components/forms/field.d.ts.map +1 -1
  24. package/declarations/components/forms/index.d.ts +1 -0
  25. package/declarations/components/forms/index.d.ts.map +1 -1
  26. package/declarations/components/forms/input.d.ts +11 -11
  27. package/declarations/components/forms/native-select.d.ts +8 -8
  28. package/declarations/components/forms/select/select.d.ts +16 -16
  29. package/declarations/components/forms/textarea.d.ts +7 -7
  30. package/declarations/components/utilities/avatar.d.ts +35 -2
  31. package/declarations/components/utilities/avatar.d.ts.map +1 -1
  32. package/declarations/test-support.d.ts +30 -0
  33. package/declarations/test-support.d.ts.map +1 -1
  34. package/dist/components/buttons/chip.js.map +1 -1
  35. package/dist/components/forms/date-input/clipboard.js +162 -0
  36. package/dist/components/forms/date-input/clipboard.js.map +1 -0
  37. package/dist/components/forms/date-input/date-input.js +194 -0
  38. package/dist/components/forms/date-input/date-input.js.map +1 -0
  39. package/dist/components/forms/date-input/segment-group.js +271 -0
  40. package/dist/components/forms/date-input/segment-group.js.map +1 -0
  41. package/dist/components/forms/date-input/segments.js +379 -0
  42. package/dist/components/forms/date-input/segments.js.map +1 -0
  43. package/dist/components/forms/date-input/types.js +2 -0
  44. package/dist/components/forms/date-input/types.js.map +1 -0
  45. package/dist/components/forms/date-input.js +4 -0
  46. package/dist/components/forms/date-input.js.map +1 -0
  47. package/dist/components/forms/date-picker/date-picker.js +301 -14
  48. package/dist/components/forms/date-picker/date-picker.js.map +1 -1
  49. package/dist/components/forms/date-picker/end-content.js +17 -4
  50. package/dist/components/forms/date-picker/end-content.js.map +1 -1
  51. package/dist/components/forms/field.js +4 -1
  52. package/dist/components/forms/field.js.map +1 -1
  53. package/dist/components/forms/index.js +3 -0
  54. package/dist/components/forms/index.js.map +1 -1
  55. package/dist/components/utilities/avatar.js +30 -5
  56. package/dist/components/utilities/avatar.js.map +1 -1
  57. package/dist/forms.js +3 -0
  58. package/dist/forms.js.map +1 -1
  59. package/dist/index.js +3 -0
  60. package/dist/index.js.map +1 -1
  61. package/dist/test-support.js +480 -1
  62. package/dist/test-support.js.map +1 -1
  63. package/package.json +3 -3
@@ -15,9 +15,25 @@ interface AvatarSignature {
15
15
  */
16
16
  shape?: AvatarVariants['shape'];
17
17
  /**
18
- * URL of the image to be displayed in the avatar.
19
- * If provided, the image will be used instead of initials.
18
+ * How the image fills the avatar. `cover` crops the image to fill the
19
+ * avatar, which suits photos. `contain` shows the whole image, inset from
20
+ * the edge, which suits logos and wordmarks.
21
+ *
22
+ * @defaultValue 'cover'
23
+ */
24
+ fit?: AvatarVariants['fit'];
25
+ /**
26
+ * Draws a faint hairline just inside the avatar's edge. Pass `false` to
27
+ * remove it.
20
28
  *
29
+ * @defaultValue true
30
+ */
31
+ isBordered?: boolean;
32
+ /**
33
+ * URL of the image to be displayed in the avatar.
34
+ * If provided, the image will be used instead of initials. If the image
35
+ * fails to load, the avatar falls back to the initials, or to an empty
36
+ * plate when there is no name.
21
37
  */
22
38
  src?: string | null;
23
39
  /**
@@ -56,38 +72,55 @@ interface AvatarSignature {
56
72
  Element: HTMLSpanElement;
57
73
  }
58
74
  declare class Avatar extends Component<AvatarSignature> {
75
+ failedSrc?: string | null;
59
76
  get classes(): {
60
77
  base: (slotProps?: ({
61
78
  size?: "xs" | "sm" | "md" | "lg" | "xl" | undefined;
62
79
  shape?: "circle" | "square" | undefined;
80
+ isBordered?: boolean | undefined;
81
+ fit?: "cover" | "contain" | undefined;
63
82
  } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
64
83
  img: (slotProps?: ({
65
84
  size?: "xs" | "sm" | "md" | "lg" | "xl" | undefined;
66
85
  shape?: "circle" | "square" | undefined;
86
+ isBordered?: boolean | undefined;
87
+ fit?: "cover" | "contain" | undefined;
67
88
  } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
68
89
  name: (slotProps?: ({
69
90
  size?: "xs" | "sm" | "md" | "lg" | "xl" | undefined;
70
91
  shape?: "circle" | "square" | undefined;
92
+ isBordered?: boolean | undefined;
93
+ fit?: "cover" | "contain" | undefined;
71
94
  } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
72
95
  } & {
73
96
  base: (slotProps?: ({
74
97
  size?: "xs" | "sm" | "md" | "lg" | "xl" | undefined;
75
98
  shape?: "circle" | "square" | undefined;
99
+ isBordered?: boolean | undefined;
100
+ fit?: "cover" | "contain" | undefined;
76
101
  } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
77
102
  img: (slotProps?: ({
78
103
  size?: "xs" | "sm" | "md" | "lg" | "xl" | undefined;
79
104
  shape?: "circle" | "square" | undefined;
105
+ isBordered?: boolean | undefined;
106
+ fit?: "cover" | "contain" | undefined;
80
107
  } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
81
108
  name: (slotProps?: ({
82
109
  size?: "xs" | "sm" | "md" | "lg" | "xl" | undefined;
83
110
  shape?: "circle" | "square" | undefined;
111
+ isBordered?: boolean | undefined;
112
+ fit?: "cover" | "contain" | undefined;
84
113
  } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
85
114
  } & {
86
115
  base: (slotProps?: ({
87
116
  size?: "xs" | "sm" | "md" | "lg" | "xl" | undefined;
88
117
  shape?: "circle" | "square" | undefined;
118
+ isBordered?: boolean | undefined;
119
+ fit?: "cover" | "contain" | undefined;
89
120
  } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
90
121
  };
122
+ get hasImage(): boolean;
123
+ handleImageError(): void;
91
124
  get initials(): string;
92
125
  get shouldShowInitials(): boolean;
93
126
  }
@@ -1 +1 @@
1
- {"version":3,"file":"avatar.d.ts","sourceRoot":"","sources":["../../../src/components/utilities/avatar.gts"],"names":[],"mappings":"AAmJA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,cAAc,EACpB,MAAM,iBAAiB,CAAC;AAEzB,UAAU,eAAe;IACvB,IAAI,EAAE;QACJ;;;;WAIG;QACH,IAAI,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;QAE9B;;;;WAIG;QACH,KAAK,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;QAEhC;;;;WAIG;QACH,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAEpB;;;;WAIG;QACH,IAAI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G;QACH,QAAQ,CAAC,EAAE,MAAM,CAAC;QAElB;;;;;WAKG;QACH,GAAG,CAAC,EAAE,MAAM,CAAC;QAEb;;WAEG;QACH,OAAO,CAAC,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC;KACvC,CAAC;IAEF;;OAEG;IACH,OAAO,EAAE,eAAe,CAAC;CAC1B;AAED,cAAM,MAAO,SAAQ,SAAS,CAAC,eAAe,CAAC;IAGpC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEnC,IAAI,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAQV;IAED,IAAI,QAAQ,YAGX;IAGD,gBAAgB;IAIhB,IAAI,QAAQ,WAmBX;IAED,IAAI,kBAAkB,YAOrB;CA4DF;AAED,OAAO,EAAE,MAAM,EAAE,CAAC;AAClB,eAAe,MAAM,CAAC"}
@@ -23,4 +23,34 @@ export { setPrefersReducedMotion } from './utils/prefers-reduced-motion';
23
23
  * that legitimately belongs to `root`.
24
24
  */
25
25
  export declare function ownParts(root: Element, part: string): Element[];
26
+ /**
27
+ * Types a date into a segmented `DateInput` or `DatePicker`.
28
+ *
29
+ * `fillIn` cannot do this and, worse, does not fail when you try. The segments
30
+ * are `contenteditable`, so `fillIn` writes their text and fires `input`
31
+ * without complaint -- but the component renders from its own segments and
32
+ * listens only to `beforeinput`/`keydown`, so nothing reaches the value. The
33
+ * result is a test that reads green, whose `assert.dom(...).hasText('01')`
34
+ * even passes, while the component's value stayed `null` and the form would
35
+ * submit empty.
36
+ *
37
+ * This types the digits segment by segment the way a person does, so the value
38
+ * composes through the same commit path as real input.
39
+ *
40
+ * ```js
41
+ * await fillDate('[data-test-due]', '2026-01-20');
42
+ * await fillDate('[data-test-due]', new Date(2026, 0, 20));
43
+ * ```
44
+ *
45
+ * For `@mode="range"` use {@link fillDateRange}.
46
+ */
47
+ export declare function fillDate(selector: string, value: Date | string): Promise<void>;
48
+ /**
49
+ * Types both ends of a range into a segmented `DatePicker @mode="range"`.
50
+ *
51
+ * ```js
52
+ * await fillDateRange('[data-test-trip]', '2026-01-20', '2026-01-25');
53
+ * ```
54
+ */
55
+ export declare function fillDateRange(selector: string, start: Date | string, end: Date | string): Promise<void>;
26
56
  //# sourceMappingURL=test-support.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"test-support.d.ts","sourceRoot":"","sources":["../src/test-support.ts"],"names":[],"mappings":"AAEA,wBAAgB,iBAAiB,CAC/B,cAAc,EAAE,MAAM,EACtB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,IAAI,CAAC,CAEf;AAED,wBAAgB,iBAAiB,CAC/B,cAAc,EAAE,MAAM,EACtB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,IAAI,CAAC,CAEf;AAkDD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,EAAE,CAS/D"}
1
+ {"version":3,"file":"test-support.d.ts","sourceRoot":"","sources":["../src/test-support.ts"],"names":[],"mappings":"AAGA,wBAAgB,iBAAiB,CAC/B,cAAc,EAAE,MAAM,EACtB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,IAAI,CAAC,CAEf;AAED,wBAAgB,iBAAiB,CAC/B,cAAc,EAAE,MAAM,EACtB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,IAAI,CAAC,CAEf;AAkDD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,EAAE,CAS/D;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,QAAQ,CACtB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,IAAI,GAAG,MAAM,GACnB,OAAO,CAAC,IAAI,CAAC,CAEf;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CACjC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,IAAI,GAAG,MAAM,EACpB,GAAG,EAAE,IAAI,GAAG,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC,CAGf"}
@@ -1 +1 @@
1
- {"version":3,"file":"chip.js","sources":["../../../src/components/buttons/chip.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { useStyles } from '@frontile/theme';\nimport { CloseButton } from './close-button';\nimport { renamedArgValue } from '../../-private/deprecated-args';\n\ninterface ChipSignature {\n Args: {\n /**\n * The chip variant.\n *\n * @defaultValue 'solid'\n */\n variant?: 'solid' | 'outline' | 'soft';\n\n /**\n * @deprecated Use `variant`. `default` is now `solid`, `outlined` is\n * `outline`, and `faded` is `soft`.\n */\n appearance?: 'default' | 'outlined' | 'faded';\n\n /**\n * The color of the chip.\n */\n color?:\n | 'neutral'\n | 'primary'\n | 'secondary'\n | 'tertiary'\n | 'success'\n | 'warning'\n | 'danger';\n\n /**\n * @deprecated Use `color`. `default` is now `neutral`.\n */\n intent?:\n | 'default'\n | 'primary'\n | 'secondary'\n | 'tertiary'\n | 'success'\n | 'warning'\n | 'danger';\n\n /**\n * The size of the chip\n *\n * @defaultValue 'md'\n */\n size?: 'sm' | 'md' | 'lg';\n\n /**\n * The border radius of the chip\n *\n * @defaultValue 'full'\n */\n radius?: 'none' | 'sm' | 'lg' | 'full';\n\n /**\n * Adds a dot before the content, colored by `@color`. On the `solid`\n * variant the dot takes the chip's text color, since the chip's\n * background is already the chip's color.\n *\n * @defaultValue false\n */\n withDot?: boolean;\n\n /**\n * Function to be called when clicking on the close button.\n * If you pass this argument, the close button will be visible.\n */\n onClose?: () => void;\n\n /**\n * The accessible name of the close button. Every close button would\n * otherwise be announced as just \"Close\", which does not say *what* is\n * being removed — worth setting when several chips sit together.\n *\n * @defaultValue 'Close'\n */\n closeButtonTitle?: string;\n\n /**\n * `tabindex` for the close button.\n *\n * Set to `-1` when chips sit inside another control (a multi-select field,\n * say) and the close button should stay a pointer affordance: every chip\n * would otherwise cost a Tab stop before the control itself is reached.\n * Whoever does this owes keyboard users another way to remove a chip.\n *\n * @defaultValue undefined (the close button is a normal tab stop)\n */\n closeButtonTabIndex?: number | string;\n\n /**\n * Dims the chip and disables its close button, if any.\n *\n * @defaultValue false\n */\n isDisabled?: boolean;\n\n /**\n * Custom class name, it will override the default ones using Tailwind Merge library.\n */\n class?: string;\n };\n Blocks: {\n default: [];\n };\n Element: HTMLDivElement;\n}\n\nclass Chip extends Component<ChipSignature> {\n get classNames() {\n const { chip } = useStyles();\n\n const { base, content, dot, closeButton } = chip({\n color:\n renamedArgValue(\n this.args.color,\n this.args.intent,\n { default: 'neutral' } as const,\n {\n component: 'Chip',\n from: 'intent',\n to: 'color',\n id: 'frontile.chip.intent'\n }\n ) || 'neutral',\n size: this.args.size,\n variant:\n renamedArgValue(\n this.args.variant,\n this.args.appearance,\n { default: 'solid', outlined: 'outline', faded: 'soft' } as const,\n {\n component: 'Chip',\n from: 'appearance',\n to: 'variant',\n id: 'frontile.chip.appearance'\n }\n ) || 'solid',\n radius: this.args.radius,\n isDisabled: this.args.isDisabled\n });\n\n return {\n base: base({ class: this.args.class }),\n content: content(),\n dot: dot(),\n closeButton: closeButton()\n };\n }\n\n <template>\n <div\n class={{this.classNames.base}}\n data-component=\"chip\"\n data-part=\"base\"\n ...attributes\n >\n {{#if @withDot}}\n <span class={{this.classNames.dot}} data-part=\"dot\"></span>\n {{/if}}\n <span class={{this.classNames.content}} data-part=\"content\">\n {{yield}}\n </span>\n {{#if @onClose}}\n <CloseButton\n @class={{this.classNames.closeButton}}\n @title={{@closeButtonTitle}}\n @onPress={{@onClose}}\n tabindex={{@closeButtonTabIndex}}\n disabled={{@isDisabled}}\n data-part=\"close-button\"\n />\n {{/if}}\n </div>\n </template>\n}\n\nexport { Chip, type ChipSignature };\nexport default Chip;\n"],"names":["Chip","Component","classNames","chip","useStyles","base","content","dot","closeButton","color","renamedArgValue","args","intent","default","component","from","to","id","size","variant","appearance","outlined","faded","radius","isDisabled","class","setComponentTemplate","precompileTemplate","strictMode","scope","CloseButton"],"mappings":";;;;;;;AAgHA,MAAMA,aAAaC,SAAA,CAAU;EAC3B,IAAIC,UAAAA,GAAa;IACf,MAAM;AAAEC,MAAAA;KAAM,GAAGC,SAAA,EAAA;IAEjB,MAAM;MAAEC,IAAI;MAAEC,OAAO;MAAEC,GAAG;AAAEC,MAAAA;KAAa,GAAGL,IAAA,CAAK;AAC/CM,MAAAA,KAAA,EACEC,eAAA,CACE,IAAI,CAACC,IAAI,CAACF,KAAK,EACf,IAAI,CAACE,IAAI,CAACC,MAAM,EAChB;AAAEC,QAAAA,OAAA,EAAS;AAAU,OAAA,EACrB;AACEC,QAAAA,SAAA,EAAW,MAAA;AACXC,QAAAA,IAAA,EAAM,QAAA;AACNC,QAAAA,EAAA,EAAI,OAAA;AACJC,QAAAA,EAAA,EAAI;OACN,CAAA,IACG,SAAA;AACPC,MAAAA,IAAA,EAAM,IAAI,CAACP,IAAI,CAACO,IAAI;AACpBC,MAAAA,OAAA,EACET,eAAA,CACE,IAAI,CAACC,IAAI,CAACQ,OAAO,EACjB,IAAI,CAACR,IAAI,CAACS,UAAU,EACpB;AAAEP,QAAAA,OAAA,EAAS,OAAA;AAASQ,QAAAA,QAAA,EAAU,SAAA;AAAWC,QAAAA,KAAA,EAAO;AAAO,OAAA,EACvD;AACER,QAAAA,SAAA,EAAW,MAAA;AACXC,QAAAA,IAAA,EAAM,YAAA;AACNC,QAAAA,EAAA,EAAI,SAAA;AACJC,QAAAA,EAAA,EAAI;OACN,CAAA,IACG,OAAA;AACPM,MAAAA,MAAA,EAAQ,IAAI,CAACZ,IAAI,CAACY,MAAM;AACxBC,MAAAA,UAAA,EAAY,IAAI,CAACb,IAAI,CAACa;AACxB,KAAA,CAAA;IAEA,OAAO;MACLnB,IAAA,EAAMA,IAAA,CAAK;AAAEoB,QAAAA,KAAA,EAAO,IAAI,CAACd,IAAI,CAACc;AAAM,OAAA,CAAA;MACpCnB,OAAA,EAASA,OAAA,EAAA;MACTC,GAAA,EAAKA,GAAA,EAAA;MACLC,WAAA,EAAaA,WAAA;KACf;AACF,EAAA;AAEA,EAAA;IAAAkB,oBAAA,CAAAC,kBAAA,CAAA,ygBAAA,EAwBA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
1
+ {"version":3,"file":"chip.js","sources":["../../../src/components/buttons/chip.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { useStyles } from '@frontile/theme';\nimport { CloseButton } from './close-button';\nimport { renamedArgValue } from '../../-private/deprecated-args';\n\ninterface ChipSignature {\n Args: {\n /**\n * The chip variant.\n *\n * @defaultValue 'solid'\n */\n variant?: 'solid' | 'outline' | 'soft';\n\n /**\n * @deprecated Use `variant`. `default` is now `solid`, `outlined` is\n * `outline`, and `faded` is `soft`.\n */\n appearance?: 'default' | 'outlined' | 'faded';\n\n /**\n * The color of the chip.\n */\n color?:\n | 'neutral'\n | 'primary'\n | 'secondary'\n | 'tertiary'\n | 'success'\n | 'warning'\n | 'danger';\n\n /**\n * @deprecated Use `color`. `default` is now `neutral`.\n */\n intent?:\n | 'default'\n | 'primary'\n | 'secondary'\n | 'tertiary'\n | 'success'\n | 'warning'\n | 'danger';\n\n /**\n * The size of the chip\n *\n * @defaultValue 'md'\n */\n size?: 'xs' | 'sm' | 'md' | 'lg';\n\n /**\n * The border radius of the chip\n *\n * @defaultValue 'full'\n */\n radius?: 'none' | 'sm' | 'lg' | 'full';\n\n /**\n * Adds a dot before the content, colored by `@color`. On the `solid`\n * variant the dot takes the chip's text color, since the chip's\n * background is already the chip's color.\n *\n * @defaultValue false\n */\n withDot?: boolean;\n\n /**\n * Function to be called when clicking on the close button.\n * If you pass this argument, the close button will be visible.\n */\n onClose?: () => void;\n\n /**\n * The accessible name of the close button. Every close button would\n * otherwise be announced as just \"Close\", which does not say *what* is\n * being removed — worth setting when several chips sit together.\n *\n * @defaultValue 'Close'\n */\n closeButtonTitle?: string;\n\n /**\n * `tabindex` for the close button.\n *\n * Set to `-1` when chips sit inside another control (a multi-select field,\n * say) and the close button should stay a pointer affordance: every chip\n * would otherwise cost a Tab stop before the control itself is reached.\n * Whoever does this owes keyboard users another way to remove a chip.\n *\n * @defaultValue undefined (the close button is a normal tab stop)\n */\n closeButtonTabIndex?: number | string;\n\n /**\n * Dims the chip and disables its close button, if any.\n *\n * @defaultValue false\n */\n isDisabled?: boolean;\n\n /**\n * Custom class name, it will override the default ones using Tailwind Merge library.\n */\n class?: string;\n };\n Blocks: {\n default: [];\n };\n Element: HTMLDivElement;\n}\n\nclass Chip extends Component<ChipSignature> {\n get classNames() {\n const { chip } = useStyles();\n\n const { base, content, dot, closeButton } = chip({\n color:\n renamedArgValue(\n this.args.color,\n this.args.intent,\n { default: 'neutral' } as const,\n {\n component: 'Chip',\n from: 'intent',\n to: 'color',\n id: 'frontile.chip.intent'\n }\n ) || 'neutral',\n size: this.args.size,\n variant:\n renamedArgValue(\n this.args.variant,\n this.args.appearance,\n { default: 'solid', outlined: 'outline', faded: 'soft' } as const,\n {\n component: 'Chip',\n from: 'appearance',\n to: 'variant',\n id: 'frontile.chip.appearance'\n }\n ) || 'solid',\n radius: this.args.radius,\n isDisabled: this.args.isDisabled\n });\n\n return {\n base: base({ class: this.args.class }),\n content: content(),\n dot: dot(),\n closeButton: closeButton()\n };\n }\n\n <template>\n <div\n class={{this.classNames.base}}\n data-component=\"chip\"\n data-part=\"base\"\n ...attributes\n >\n {{#if @withDot}}\n <span class={{this.classNames.dot}} data-part=\"dot\"></span>\n {{/if}}\n <span class={{this.classNames.content}} data-part=\"content\">\n {{yield}}\n </span>\n {{#if @onClose}}\n <CloseButton\n @class={{this.classNames.closeButton}}\n @title={{@closeButtonTitle}}\n @onPress={{@onClose}}\n tabindex={{@closeButtonTabIndex}}\n disabled={{@isDisabled}}\n data-part=\"close-button\"\n />\n {{/if}}\n </div>\n </template>\n}\n\nexport { Chip, type ChipSignature };\nexport default Chip;\n"],"names":["Chip","Component","classNames","chip","useStyles","base","content","dot","closeButton","color","renamedArgValue","args","intent","default","component","from","to","id","size","variant","appearance","outlined","faded","radius","isDisabled","class","setComponentTemplate","precompileTemplate","strictMode","scope","CloseButton"],"mappings":";;;;;;;AAgHA,MAAMA,aAAaC,SAAA,CAAU;EAC3B,IAAIC,UAAAA,GAAa;IACf,MAAM;AAAEC,MAAAA;KAAM,GAAGC,SAAA,EAAA;IAEjB,MAAM;MAAEC,IAAI;MAAEC,OAAO;MAAEC,GAAG;AAAEC,MAAAA;KAAa,GAAGL,IAAA,CAAK;AAC/CM,MAAAA,KAAA,EACEC,eAAA,CACE,IAAI,CAACC,IAAI,CAACF,KAAK,EACf,IAAI,CAACE,IAAI,CAACC,MAAM,EAChB;AAAEC,QAAAA,OAAA,EAAS;AAAU,OAAA,EACrB;AACEC,QAAAA,SAAA,EAAW,MAAA;AACXC,QAAAA,IAAA,EAAM,QAAA;AACNC,QAAAA,EAAA,EAAI,OAAA;AACJC,QAAAA,EAAA,EAAI;OACN,CAAA,IACG,SAAA;AACPC,MAAAA,IAAA,EAAM,IAAI,CAACP,IAAI,CAACO,IAAI;AACpBC,MAAAA,OAAA,EACET,eAAA,CACE,IAAI,CAACC,IAAI,CAACQ,OAAO,EACjB,IAAI,CAACR,IAAI,CAACS,UAAU,EACpB;AAAEP,QAAAA,OAAA,EAAS,OAAA;AAASQ,QAAAA,QAAA,EAAU,SAAA;AAAWC,QAAAA,KAAA,EAAO;AAAO,OAAA,EACvD;AACER,QAAAA,SAAA,EAAW,MAAA;AACXC,QAAAA,IAAA,EAAM,YAAA;AACNC,QAAAA,EAAA,EAAI,SAAA;AACJC,QAAAA,EAAA,EAAI;OACN,CAAA,IACG,OAAA;AACPM,MAAAA,MAAA,EAAQ,IAAI,CAACZ,IAAI,CAACY,MAAM;AACxBC,MAAAA,UAAA,EAAY,IAAI,CAACb,IAAI,CAACa;AACxB,KAAA,CAAA;IAEA,OAAO;MACLnB,IAAA,EAAMA,IAAA,CAAK;AAAEoB,QAAAA,KAAA,EAAO,IAAI,CAACd,IAAI,CAACc;AAAM,OAAA,CAAA;MACpCnB,OAAA,EAASA,OAAA,EAAA;MACTC,GAAA,EAAKA,GAAA,EAAA;MACLC,WAAA,EAAaA,WAAA;KACf;AACF,EAAA;AAEA,EAAA;IAAAkB,oBAAA,CAAAC,kBAAA,CAAA,ygBAAA,EAwBA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
@@ -0,0 +1,162 @@
1
+ import { isSegment, displaySegment, resolveTwoDigitYear, withValue } from './segments.js';
2
+
3
+ const ISO_DAY = /^(\d{4})-(\d{2})-(\d{2})$/;
4
+
5
+ /** The digits destined for each segment, keyed by type. */
6
+
7
+ /**
8
+ * Writes digit strings onto the segments they name.
9
+ *
10
+ * Digits stay *strings* all the way in, because a year's leading zeros carry
11
+ * meaning: `0045` is the year 45, while `45` runs through the sliding window.
12
+ * Passing numbers here would erase that distinction and make a pasted `0045`
13
+ * resolve differently from a typed one.
14
+ *
15
+ * A segment no key names is left untouched, which is what lets a partial paste
16
+ * fill what it can. Out of bounds refuses the *whole* paste rather than
17
+ * clamping: clamping would turn a paste of `99/99/2026` into a plausible
18
+ * looking date the user never meant. The day is the exception by design -- its
19
+ * bound is 31 and the real length of the month is applied later, by `toDate`,
20
+ * so a pasted 31st of February shortens to the 28th exactly as a typed one
21
+ * does.
22
+ */
23
+ function fill(parts, digits) {
24
+ let filled = 0;
25
+ const next = [];
26
+ for (const part of parts) {
27
+ if (!isSegment(part)) {
28
+ next.push(part);
29
+ continue;
30
+ }
31
+ const raw = digits[part.type];
32
+ if (raw === undefined) {
33
+ next.push(part);
34
+ continue;
35
+ }
36
+ const value = part.type === 'year' ? resolveTwoDigitYear(raw) : Number(raw);
37
+ if (Number.isNaN(value) || value < part.min || value > part.max) {
38
+ return null;
39
+ }
40
+ filled++;
41
+ // A paste is a finished answer for every segment it fills.
42
+ next.push(withValue(part, value));
43
+ }
44
+
45
+ // Nothing landed anywhere -- treat that as a refusal rather than quietly
46
+ // handing back an untouched field.
47
+ return filled === 0 ? null : next;
48
+ }
49
+
50
+ /** Maps digit groups onto the segments in their rendered order. */
51
+ function byPosition(segments, groups) {
52
+ if (groups.length === 0 || groups.length > segments.length) return null;
53
+ const digits = {};
54
+ groups.forEach((group, i) => {
55
+ const segment = segments[i];
56
+ if (segment) digits[segment.type] = group;
57
+ });
58
+ return digits;
59
+ }
60
+
61
+ /**
62
+ * Reads pasted text into the segments, trying each strategy in turn and
63
+ * stopping at the first that works.
64
+ *
65
+ * Every strategy lands in `fill`, so all three share one bounds policy. There
66
+ * is deliberately no `new Date(text)` fallback: it parses differently in every
67
+ * engine, and a date field that silently guesses wrong is worse than one that
68
+ * declines.
69
+ */
70
+ function parsePasted(text, parts) {
71
+ const trimmed = text.trim();
72
+ if (trimmed === '') return null;
73
+
74
+ // 1. ISO, which is unambiguous and so outranks the locale's own order.
75
+ const iso = ISO_DAY.exec(trimmed);
76
+ if (iso) {
77
+ const [, year, month, day] = iso;
78
+ return fill(parts, {
79
+ year,
80
+ month,
81
+ day
82
+ });
83
+ }
84
+ const segments = parts.filter(isSegment);
85
+
86
+ // 2. A bare digit run, split by each segment's width. Checked before the
87
+ // separated form, because an unseparated run also splits into a single
88
+ // "group" and would otherwise be read as one enormous month.
89
+ if (/^\d+$/.test(trimmed)) {
90
+ const widths = [];
91
+ let at = 0;
92
+ for (const segment of segments) {
93
+ if (at >= trimmed.length) break;
94
+ widths.push(trimmed.slice(at, at + segment.width));
95
+ at += segment.width;
96
+ }
97
+
98
+ // It has to end on a segment boundary, otherwise there is no telling
99
+ // where the last number was meant to stop.
100
+ if (at !== trimmed.length) return null;
101
+ const digits = byPosition(segments, widths);
102
+ return digits ? fill(parts, digits) : null;
103
+ }
104
+
105
+ // 3. Separated numbers, mapped positionally onto the locale's order. Fewer
106
+ // groups than segments is a partial date and fills a prefix of them.
107
+ const groups = trimmed.split(/\D+/).filter(Boolean);
108
+ const digits = byPosition(segments, groups);
109
+ if (digits) return fill(parts, digits);
110
+ return null;
111
+ }
112
+
113
+ /**
114
+ * The field as it reads on screen, literals included. Copying the display
115
+ * rather than an ISO string means the text round-trips through `parsePasted`
116
+ * and still reads naturally when pasted into a document.
117
+ *
118
+ * Delegates each segment to `displaySegment`, the same function the group
119
+ * renders from, so a mid-entry year (buffer `26`, uncommitted) copies as
120
+ * `26` rather than being padded to `0026` -- padding would claim digits the
121
+ * user never typed and would contradict what is on screen.
122
+ */
123
+ function formatForClipboard(parts) {
124
+ return parts.map(part => isSegment(part) ? displaySegment(part) : part.text).join('');
125
+ }
126
+
127
+ /**
128
+ * What separates the two halves of a pasted range.
129
+ *
130
+ * An en or em dash needs no surrounding space, because neither ever appears
131
+ * inside a date. A plain hyphen does: it is the ISO separator, so splitting on
132
+ * an unspaced one would tear `2026-01-20` into pieces. The same reasoning
133
+ * applies to the words -- `\s+` on both sides keeps "to" from matching inside
134
+ * "total".
135
+ */
136
+ const RANGE_SEPARATOR = /\s*[\u2013\u2014]\s*|\s+(?:-|to|until|through)\s+/i;
137
+
138
+ /**
139
+ * Splits pasted text into the two dates of a range, or returns `null` when it
140
+ * does not read as two.
141
+ *
142
+ * Only the shape is decided here; neither half is parsed. The caller runs each
143
+ * through {@link parsePasted} and keeps the result only when both halves are
144
+ * dates -- so text that merely contains a dash falls through to the ordinary
145
+ * single-date handling rather than being consumed.
146
+ */
147
+ function splitRange(text) {
148
+ const trimmed = text.trim();
149
+ const match = RANGE_SEPARATOR.exec(trimmed);
150
+ if (!match) return null;
151
+ const start = trimmed.slice(0, match.index).trim();
152
+ const end = trimmed.slice(match.index + match[0].length).trim();
153
+ if (start === '' || end === '') return null;
154
+
155
+ // Three halves is not a range, and guessing which two were meant would be
156
+ // exactly the silent wrong guess this module declines to make elsewhere.
157
+ if (RANGE_SEPARATOR.test(end)) return null;
158
+ return [start, end];
159
+ }
160
+
161
+ export { formatForClipboard, parsePasted, splitRange };
162
+ //# sourceMappingURL=clipboard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clipboard.js","sources":["../../../../src/components/forms/date-input/clipboard.ts"],"sourcesContent":["import {\n isSegment,\n resolveTwoDigitYear,\n displaySegment,\n withValue\n} from './segments';\nimport type { Part, Segment, SegmentType } from './types';\n\nconst ISO_DAY = /^(\\d{4})-(\\d{2})-(\\d{2})$/;\n\n/** The digits destined for each segment, keyed by type. */\ntype Digits = Partial<Record<SegmentType, string>>;\n\n/**\n * Writes digit strings onto the segments they name.\n *\n * Digits stay *strings* all the way in, because a year's leading zeros carry\n * meaning: `0045` is the year 45, while `45` runs through the sliding window.\n * Passing numbers here would erase that distinction and make a pasted `0045`\n * resolve differently from a typed one.\n *\n * A segment no key names is left untouched, which is what lets a partial paste\n * fill what it can. Out of bounds refuses the *whole* paste rather than\n * clamping: clamping would turn a paste of `99/99/2026` into a plausible\n * looking date the user never meant. The day is the exception by design -- its\n * bound is 31 and the real length of the month is applied later, by `toDate`,\n * so a pasted 31st of February shortens to the 28th exactly as a typed one\n * does.\n */\nfunction fill(parts: Part[], digits: Digits): Part[] | null {\n let filled = 0;\n\n const next: Part[] = [];\n for (const part of parts) {\n if (!isSegment(part)) {\n next.push(part);\n continue;\n }\n\n const raw = digits[part.type];\n if (raw === undefined) {\n next.push(part);\n continue;\n }\n\n const value = part.type === 'year' ? resolveTwoDigitYear(raw) : Number(raw);\n if (Number.isNaN(value) || value < part.min || value > part.max) {\n return null;\n }\n\n filled++;\n // A paste is a finished answer for every segment it fills.\n next.push(withValue(part, value));\n }\n\n // Nothing landed anywhere -- treat that as a refusal rather than quietly\n // handing back an untouched field.\n return filled === 0 ? null : next;\n}\n\n/** Maps digit groups onto the segments in their rendered order. */\nfunction byPosition(segments: Segment[], groups: string[]): Digits | null {\n if (groups.length === 0 || groups.length > segments.length) return null;\n\n const digits: Digits = {};\n groups.forEach((group, i) => {\n const segment = segments[i];\n if (segment) digits[segment.type] = group;\n });\n return digits;\n}\n\n/**\n * Reads pasted text into the segments, trying each strategy in turn and\n * stopping at the first that works.\n *\n * Every strategy lands in `fill`, so all three share one bounds policy. There\n * is deliberately no `new Date(text)` fallback: it parses differently in every\n * engine, and a date field that silently guesses wrong is worse than one that\n * declines.\n */\nfunction parsePasted(text: string, parts: Part[]): Part[] | null {\n const trimmed = text.trim();\n if (trimmed === '') return null;\n\n // 1. ISO, which is unambiguous and so outranks the locale's own order.\n const iso = ISO_DAY.exec(trimmed);\n if (iso) {\n const [, year, month, day] = iso;\n return fill(parts, { year, month, day });\n }\n\n const segments = parts.filter(isSegment);\n\n // 2. A bare digit run, split by each segment's width. Checked before the\n // separated form, because an unseparated run also splits into a single\n // \"group\" and would otherwise be read as one enormous month.\n if (/^\\d+$/.test(trimmed)) {\n const widths: string[] = [];\n let at = 0;\n for (const segment of segments) {\n if (at >= trimmed.length) break;\n widths.push(trimmed.slice(at, at + segment.width));\n at += segment.width;\n }\n\n // It has to end on a segment boundary, otherwise there is no telling\n // where the last number was meant to stop.\n if (at !== trimmed.length) return null;\n\n const digits = byPosition(segments, widths);\n return digits ? fill(parts, digits) : null;\n }\n\n // 3. Separated numbers, mapped positionally onto the locale's order. Fewer\n // groups than segments is a partial date and fills a prefix of them.\n const groups = trimmed.split(/\\D+/).filter(Boolean);\n const digits = byPosition(segments, groups);\n if (digits) return fill(parts, digits);\n\n return null;\n}\n\n/**\n * The field as it reads on screen, literals included. Copying the display\n * rather than an ISO string means the text round-trips through `parsePasted`\n * and still reads naturally when pasted into a document.\n *\n * Delegates each segment to `displaySegment`, the same function the group\n * renders from, so a mid-entry year (buffer `26`, uncommitted) copies as\n * `26` rather than being padded to `0026` -- padding would claim digits the\n * user never typed and would contradict what is on screen.\n */\nfunction formatForClipboard(parts: Part[]): string {\n return parts\n .map((part) => (isSegment(part) ? displaySegment(part) : part.text))\n .join('');\n}\n\n/**\n * What separates the two halves of a pasted range.\n *\n * An en or em dash needs no surrounding space, because neither ever appears\n * inside a date. A plain hyphen does: it is the ISO separator, so splitting on\n * an unspaced one would tear `2026-01-20` into pieces. The same reasoning\n * applies to the words -- `\\s+` on both sides keeps \"to\" from matching inside\n * \"total\".\n */\nconst RANGE_SEPARATOR = /\\s*[\\u2013\\u2014]\\s*|\\s+(?:-|to|until|through)\\s+/i;\n\n/**\n * Splits pasted text into the two dates of a range, or returns `null` when it\n * does not read as two.\n *\n * Only the shape is decided here; neither half is parsed. The caller runs each\n * through {@link parsePasted} and keeps the result only when both halves are\n * dates -- so text that merely contains a dash falls through to the ordinary\n * single-date handling rather than being consumed.\n */\nfunction splitRange(text: string): [string, string] | null {\n const trimmed = text.trim();\n const match = RANGE_SEPARATOR.exec(trimmed);\n if (!match) return null;\n\n const start = trimmed.slice(0, match.index).trim();\n const end = trimmed.slice(match.index + match[0].length).trim();\n if (start === '' || end === '') return null;\n\n // Three halves is not a range, and guessing which two were meant would be\n // exactly the silent wrong guess this module declines to make elsewhere.\n if (RANGE_SEPARATOR.test(end)) return null;\n\n return [start, end];\n}\n\nexport { parsePasted, formatForClipboard, splitRange };\n"],"names":["ISO_DAY","fill","parts","digits","filled","next","part","isSegment","push","raw","type","undefined","value","resolveTwoDigitYear","Number","isNaN","min","max","withValue","byPosition","segments","groups","length","forEach","group","i","segment","parsePasted","text","trimmed","trim","iso","exec","year","month","day","filter","test","widths","at","slice","width","split","Boolean","formatForClipboard","map","displaySegment","join","RANGE_SEPARATOR","splitRange","match","start","index","end"],"mappings":";;AAQA,MAAMA,OAAO,GAAG,2BAA2B;;AAE3C;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,CAAC,EAAEU,KAAK,CAACE,KAAK,CAAC,CAACtB,IAAI,EAAE;EAClD,MAAMuB,GAAG,GAAGxB,OAAO,CAACW,KAAK,CAACU,KAAK,CAACE,KAAK,GAAGF,KAAK,CAAC,CAAC,CAAC,CAAC5B,MAAM,CAAC,CAACQ,IAAI,EAAE;EAC/D,IAAIqB,KAAK,KAAK,EAAE,IAAIE,GAAG,KAAK,EAAE,EAAE,OAAO,IAAI;;AAE3C;AACA;EACA,IAAIL,eAAe,CAACX,IAAI,CAACgB,GAAG,CAAC,EAAE,OAAO,IAAI;AAE1C,EAAA,OAAO,CAACF,KAAK,EAAEE,GAAG,CAAC;AACrB;;"}
@@ -0,0 +1,194 @@
1
+ import Component from '@glimmer/component';
2
+ import { tracked, cached } from '@glimmer/tracking';
3
+ import { on } from '@ember/modifier';
4
+ import { modifier } from 'ember-modifier';
5
+ import { useStyles } from '@frontile/theme';
6
+ import { FormControl } from '../form-control.js';
7
+ import { CloseButton } from '../../buttons/close-button.js';
8
+ import { SegmentGroup } from './segment-group.js';
9
+ import { fromDate, buildParts, resolveSegmentFormat, toDate, isSegment, hasDateChanged, carryOver } from './segments.js';
10
+ import { parseDate, toWire } from '../date-picker/value.js';
11
+ import { ref } from '../../../utils/ref.js';
12
+ import { triggerFormInputEvent } from '../../../utils/forms-utils-index.js';
13
+ import { precompileTemplate } from '@ember/template-compilation';
14
+ import { setComponentTemplate } from '@ember/component';
15
+ import { d as decorateFieldV2, i as initializeDeferredDecorator, a as decorateMethodV2 } from '../../../runtime--fcdnjmJ-BOdRhmsS.js';
16
+
17
+ /**
18
+ * A date typed into segments rather than picked from a grid. `DatePicker`
19
+ * renders the same segments and adds a calendar.
20
+ */
21
+ class DateInput extends Component {
22
+ containerRef = ref();
23
+ /**
24
+ * The segments are the state, not the value: mid-entry they hold digits that
25
+ * compose to no date at all, which no `Date` can represent.
26
+ */
27
+ static {
28
+ decorateFieldV2(this.prototype, "trackedParts", [tracked], function () {
29
+ return [];
30
+ });
31
+ }
32
+ #trackedParts = (initializeDeferredDecorator(this, "trackedParts"), void 0);
33
+ /**
34
+ * An untracked mirror of {@link parts}. The sync modifiers below need to
35
+ * read the current segments in order to rebuild them, and reading the
36
+ * tracked field inside a modifier would put it in that modifier's own
37
+ * tracking frame -- which the same modifier then writes to, re-running
38
+ * itself forever.
39
+ */
40
+ #currentParts = [];
41
+ constructor(owner, args) {
42
+ super(owner, args);
43
+ const seed = args.defaultValue;
44
+ this.setParts(fromDate(buildParts(this.locale, this.formatOptions), seed === undefined ? null : parseDate(seed)));
45
+ }
46
+ get parts() {
47
+ return this.trackedParts;
48
+ }
49
+ setParts(parts) {
50
+ this.#currentParts = parts;
51
+ this.trackedParts = parts;
52
+ }
53
+ get locale() {
54
+ return this.args.locale ?? navigator.language;
55
+ }
56
+ get formatOptions() {
57
+ // A textual month has no numeric segment to type into, so it falls back
58
+ // to a numeric one. `dateStyle: 'medium'` is the common way to hit this --
59
+ // it is DatePicker's button-trigger default. Only the month is replaced:
60
+ // the rest of the format is the consumer's and stands.
61
+ return resolveSegmentFormat(this.args.formatOptions, {
62
+ message: '<DateInput> needs numeric segments; ' + 'a textual @formatOptions month falls back to a numeric one.',
63
+ id: 'frontile.date-input.textual-format'
64
+ });
65
+ }
66
+ /**
67
+ * The composed value, or null while any segment is empty.
68
+ *
69
+ * Cached because `wireValue`, `isOutOfRange` and the template all read it
70
+ * independently, and each `toDate` walks the parts three times over.
71
+ */
72
+ get value() {
73
+ return toDate(this.parts);
74
+ }
75
+ static {
76
+ decorateMethodV2(this.prototype, "value", [cached]);
77
+ }
78
+ get wireValue() {
79
+ return toWire(this.value);
80
+ }
81
+ get isEmpty() {
82
+ return this.parts.every(p => !isSegment(p) || p.value === null);
83
+ }
84
+ get placeholderValue() {
85
+ return this.args.placeholderValue ?? new Date();
86
+ }
87
+ /**
88
+ * Whether the composed value is outside the allowed range. Never blocks a
89
+ * keystroke -- typing toward 2020 passes through 2, 20 and 202 on the way,
90
+ * and a field that refused those could not be typed into at all.
91
+ */
92
+ get isOutOfRange() {
93
+ const value = this.value;
94
+ if (!value) return false;
95
+ if (this.args.minValue && value < this.args.minValue) return true;
96
+ if (this.args.maxValue && value > this.args.maxValue) return true;
97
+ return this.args.isDateUnavailable?.(value) ?? false;
98
+ }
99
+ get isInvalid() {
100
+ return Boolean(this.args.isInvalid) || this.isOutOfRange;
101
+ }
102
+ /**
103
+ * Pushes `@value` into the segments when the argument changes. `undefined`
104
+ * is ignored, so a field bound by `Field` before the form holds anything for
105
+ * it keeps what the user typed -- the rule `DatePicker` documents.
106
+ */
107
+ syncValue = modifier((_, [raw]) => {
108
+ if (raw === undefined) return;
109
+ const parsed = parseDate(raw);
110
+ // Ignore the echo of our own `@onChange`. A controlled consumer writes
111
+ // back the value this field just reported, and rewriting the segments
112
+ // from it would destroy a partial entry: backspacing one digit of the
113
+ // year un-commits it, so the field composes `null`, reports `null`, and
114
+ // is handed `null` straight back -- which `fromDate` would spend on
115
+ // clearing every other segment too. One keystroke would empty the field.
116
+ if (!hasDateChanged(toDate(this.#currentParts), parsed)) return;
117
+ this.setParts(fromDate(this.#currentParts, parsed));
118
+ });
119
+ /**
120
+ * Rebuilds the segment order when the locale or format changes, carrying
121
+ * each segment's own state across so switching en-US to en-GB reorders the
122
+ * field without emptying it -- half-typed digits included, which is why
123
+ * this goes segment by segment rather than through the composed value.
124
+ */
125
+ syncLocale = modifier((_, [locale, format]) => {
126
+ this.setParts(carryOver(buildParts(locale, format), this.#currentParts));
127
+ });
128
+ handlePartsChange = parts => {
129
+ const before = toDate(this.#currentParts);
130
+ this.setParts(parts);
131
+ const after = toDate(parts);
132
+ // Only value transitions are reported. The four keystrokes that fill a
133
+ // month and a day compose no date at all, and report nothing.
134
+ if (hasDateChanged(before, after)) {
135
+ this.args.onChange?.(after);
136
+ triggerFormInputEvent(this.containerRef.current);
137
+ }
138
+ };
139
+ /**
140
+ * `@onBlur` means "the user left the field", not "the user left a segment",
141
+ * so a move between segments is filtered out by asking whether focus landed
142
+ * inside the container. `DatePicker` needs `ControlBlurTracker` for this
143
+ * because its focus can legitimately be in a popover outside its own DOM;
144
+ * this field has no popover, so containment is the whole question.
145
+ */
146
+ handleFocusOut = event => {
147
+ const container = this.containerRef.current;
148
+ const next = event.relatedTarget;
149
+ if (container && next instanceof Node && container.contains(next)) return;
150
+ this.args.onBlur?.();
151
+ };
152
+ /**
153
+ * A disabled or read-only field never offers it: it carries no disabled
154
+ * state of its own and would be a live button clearing a field the user may
155
+ * not change.
156
+ */
157
+ get isClearable() {
158
+ return Boolean(this.args.isClearable) && !this.isEmpty && !this.args.isDisabled && !this.args.isReadOnly;
159
+ }
160
+ /**
161
+ * Clearing removes the clear button from the DOM (`isClearable` flips
162
+ * false the instant the value is gone), so focus must be handed somewhere
163
+ * explicitly or it falls to `<body>` and a keyboard user loses their place.
164
+ */
165
+ clear = () => {
166
+ this.handlePartsChange(fromDate(this.#currentParts, null));
167
+ this.containerRef.current?.querySelector('[data-part="segment"]')?.focus();
168
+ };
169
+ get classes() {
170
+ const {
171
+ dateInput
172
+ } = useStyles();
173
+ return dateInput({
174
+ size: this.args.inputSize
175
+ });
176
+ }
177
+ static {
178
+ decorateMethodV2(this.prototype, "classes", [cached]);
179
+ }
180
+ static {
181
+ setComponentTemplate(precompileTemplate("<div {{this.syncLocale this.locale this.formatOptions}} {{this.syncValue @value}} {{this.containerRef.setup}} {{on \"focusout\" this.handleFocusOut}} class={{this.classes.base class=@classes.base}} data-component=\"date-input\" data-part=\"base\" ...attributes>\n {{#if @name}}\n <input type=\"hidden\" name={{@name}} value={{this.wireValue}} />\n {{/if}}\n\n <FormControl @id={{@id}} @size={{@inputSize}} @label={{@label}} @isRequired={{@isRequired}} @description={{@description}} @errors={{@errors}} @isInvalid={{this.isInvalid}} @isDisabled={{@isDisabled}} as |c|>\n <div class={{this.classes.innerContainer class=@classes.innerContainer}} data-part=\"inner-container\" {{!-- The field shell lives here, not on the segment row, so the clear\n button sits inside the border. `role=\"group\"` supports neither\n aria-invalid nor aria-disabled, so the shell styles off these. --}} data-invalid={{if c.isInvalid \"true\" \"false\"}} data-disabled={{if @isDisabled \"true\" \"false\"}}>\n <SegmentGroup @parts={{this.parts}} @onPartsChange={{this.handlePartsChange}} @locale={{this.locale}} @placeholderValue={{this.placeholderValue}} @isDisabled={{@isDisabled}} @isReadOnly={{@isReadOnly}} @isInvalid={{c.isInvalid}} @id={{c.id}} @label={{@label}} @describedBy={{c.describedBy @description c.isInvalid}} @segmentLabels={{@segmentLabels}} @classes={{this.classes}} @userClasses={{@classes}} />\n {{#if this.isClearable}}\n <div data-part=\"end-content\" class={{this.classes.endContent class=@classes.endContent}}>\n <CloseButton @title=\"Clear\" @variant=\"soft\" @size=\"xs\" @class={{this.classes.clearButton class=@classes.clearButton}} data-part=\"clear-button\" @onPress={{this.clear}} />\n </div>\n {{/if}}\n </div>\n </FormControl>\n</div>", {
182
+ strictMode: true,
183
+ scope: () => ({
184
+ on,
185
+ FormControl,
186
+ SegmentGroup,
187
+ CloseButton
188
+ })
189
+ }), this);
190
+ }
191
+ }
192
+
193
+ export { DateInput, DateInput as default };
194
+ //# sourceMappingURL=date-input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-input.js","sources":["../../../../src/components/forms/date-input/date-input.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { cached, tracked } from '@glimmer/tracking';\nimport { on } from '@ember/modifier';\nimport { modifier } from 'ember-modifier';\nimport { useStyles } from '@frontile/theme';\nimport { FormControl } from '../form-control';\nimport { CloseButton } from '../../buttons/close-button';\nimport { SegmentGroup } from './segment-group';\nimport {\n buildParts,\n toDate,\n fromDate,\n isSegment,\n carryOver,\n resolveSegmentFormat,\n hasDateChanged\n} from './segments';\nimport { parseDate, toWire } from '../date-picker/value';\nimport { ref } from '../../../utils/ref';\nimport { triggerFormInputEvent } from '../../../utils/forms-utils-index';\nimport type { Part, DateInputArgs, DateInputClasses } from './types';\n\ninterface DateInputSignature {\n Args: DateInputArgs;\n Element: HTMLDivElement;\n}\n\n/**\n * A date typed into segments rather than picked from a grid. `DatePicker`\n * renders the same segments and adds a calendar.\n */\nclass DateInput extends Component<DateInputSignature> {\n containerRef = ref<HTMLElement>();\n\n /**\n * The segments are the state, not the value: mid-entry they hold digits that\n * compose to no date at all, which no `Date` can represent.\n */\n @tracked private trackedParts: Part[] = [];\n\n /**\n * An untracked mirror of {@link parts}. The sync modifiers below need to\n * read the current segments in order to rebuild them, and reading the\n * tracked field inside a modifier would put it in that modifier's own\n * tracking frame -- which the same modifier then writes to, re-running\n * itself forever.\n */\n #currentParts: Part[] = [];\n\n constructor(owner: unknown, args: DateInputArgs) {\n super(owner as never, args);\n\n const seed = args.defaultValue;\n this.setParts(\n fromDate(\n buildParts(this.locale, this.formatOptions),\n seed === undefined ? null : parseDate(seed)\n )\n );\n }\n\n get parts(): Part[] {\n return this.trackedParts;\n }\n\n private setParts(parts: Part[]): void {\n this.#currentParts = parts;\n this.trackedParts = parts;\n }\n\n get locale(): string {\n return this.args.locale ?? navigator.language;\n }\n\n get formatOptions(): Intl.DateTimeFormatOptions | undefined {\n // A textual month has no numeric segment to type into, so it falls back\n // to a numeric one. `dateStyle: 'medium'` is the common way to hit this --\n // it is DatePicker's button-trigger default. Only the month is replaced:\n // the rest of the format is the consumer's and stands.\n return resolveSegmentFormat(this.args.formatOptions, {\n message:\n '<DateInput> needs numeric segments; ' +\n 'a textual @formatOptions month falls back to a numeric one.',\n id: 'frontile.date-input.textual-format'\n });\n }\n\n /**\n * The composed value, or null while any segment is empty.\n *\n * Cached because `wireValue`, `isOutOfRange` and the template all read it\n * independently, and each `toDate` walks the parts three times over.\n */\n @cached\n get value(): Date | null {\n return toDate(this.parts);\n }\n\n get wireValue(): string {\n return toWire(this.value);\n }\n\n get isEmpty(): boolean {\n return this.parts.every((p) => !isSegment(p) || p.value === null);\n }\n\n get placeholderValue(): Date {\n return this.args.placeholderValue ?? new Date();\n }\n\n /**\n * Whether the composed value is outside the allowed range. Never blocks a\n * keystroke -- typing toward 2020 passes through 2, 20 and 202 on the way,\n * and a field that refused those could not be typed into at all.\n */\n get isOutOfRange(): boolean {\n const value = this.value;\n if (!value) return false;\n\n if (this.args.minValue && value < this.args.minValue) return true;\n if (this.args.maxValue && value > this.args.maxValue) return true;\n return this.args.isDateUnavailable?.(value) ?? false;\n }\n\n get isInvalid(): boolean {\n return Boolean(this.args.isInvalid) || this.isOutOfRange;\n }\n\n /**\n * Pushes `@value` into the segments when the argument changes. `undefined`\n * is ignored, so a field bound by `Field` before the form holds anything for\n * it keeps what the user typed -- the rule `DatePicker` documents.\n */\n syncValue = modifier(\n (_: HTMLElement, [raw]: [Date | string | null | undefined]) => {\n if (raw === undefined) return;\n\n const parsed = parseDate(raw);\n\n // Ignore the echo of our own `@onChange`. A controlled consumer writes\n // back the value this field just reported, and rewriting the segments\n // from it would destroy a partial entry: backspacing one digit of the\n // year un-commits it, so the field composes `null`, reports `null`, and\n // is handed `null` straight back -- which `fromDate` would spend on\n // clearing every other segment too. One keystroke would empty the field.\n if (!hasDateChanged(toDate(this.#currentParts), parsed)) return;\n\n this.setParts(fromDate(this.#currentParts, parsed));\n }\n );\n\n /**\n * Rebuilds the segment order when the locale or format changes, carrying\n * each segment's own state across so switching en-US to en-GB reorders the\n * field without emptying it -- half-typed digits included, which is why\n * this goes segment by segment rather than through the composed value.\n */\n syncLocale = modifier(\n (\n _: HTMLElement,\n [locale, format]: [string, Intl.DateTimeFormatOptions | undefined]\n ) => {\n this.setParts(carryOver(buildParts(locale, format), this.#currentParts));\n }\n );\n\n handlePartsChange = (parts: Part[]): void => {\n const before = toDate(this.#currentParts);\n this.setParts(parts);\n const after = toDate(parts);\n\n // Only value transitions are reported. The four keystrokes that fill a\n // month and a day compose no date at all, and report nothing.\n if (hasDateChanged(before, after)) {\n this.args.onChange?.(after);\n triggerFormInputEvent(this.containerRef.current);\n }\n };\n\n /**\n * `@onBlur` means \"the user left the field\", not \"the user left a segment\",\n * so a move between segments is filtered out by asking whether focus landed\n * inside the container. `DatePicker` needs `ControlBlurTracker` for this\n * because its focus can legitimately be in a popover outside its own DOM;\n * this field has no popover, so containment is the whole question.\n */\n handleFocusOut = (event: FocusEvent): void => {\n const container = this.containerRef.current;\n const next = event.relatedTarget;\n\n if (container && next instanceof Node && container.contains(next)) return;\n\n this.args.onBlur?.();\n };\n\n /**\n * A disabled or read-only field never offers it: it carries no disabled\n * state of its own and would be a live button clearing a field the user may\n * not change.\n */\n get isClearable(): boolean {\n return (\n Boolean(this.args.isClearable) &&\n !this.isEmpty &&\n !this.args.isDisabled &&\n !this.args.isReadOnly\n );\n }\n\n /**\n * Clearing removes the clear button from the DOM (`isClearable` flips\n * false the instant the value is gone), so focus must be handed somewhere\n * explicitly or it falls to `<body>` and a keyboard user loses their place.\n */\n clear = (): void => {\n this.handlePartsChange(fromDate(this.#currentParts, null));\n this.containerRef.current\n ?.querySelector<HTMLElement>('[data-part=\"segment\"]')\n ?.focus();\n };\n\n @cached\n get classes(): DateInputClasses {\n const { dateInput } = useStyles();\n return dateInput({ size: this.args.inputSize });\n }\n\n <template>\n <div\n {{this.syncLocale this.locale this.formatOptions}}\n {{this.syncValue @value}}\n {{this.containerRef.setup}}\n {{on \"focusout\" this.handleFocusOut}}\n class={{this.classes.base class=@classes.base}}\n data-component=\"date-input\"\n data-part=\"base\"\n ...attributes\n >\n {{#if @name}}\n <input type=\"hidden\" name={{@name}} value={{this.wireValue}} />\n {{/if}}\n\n <FormControl\n @id={{@id}}\n @size={{@inputSize}}\n @label={{@label}}\n @isRequired={{@isRequired}}\n @description={{@description}}\n @errors={{@errors}}\n @isInvalid={{this.isInvalid}}\n @isDisabled={{@isDisabled}}\n as |c|\n >\n <div\n class={{this.classes.innerContainer class=@classes.innerContainer}}\n data-part=\"inner-container\"\n {{! The field shell lives here, not on the segment row, so the clear\n button sits inside the border. `role=\"group\"` supports neither\n aria-invalid nor aria-disabled, so the shell styles off these. }}\n data-invalid={{if c.isInvalid \"true\" \"false\"}}\n data-disabled={{if @isDisabled \"true\" \"false\"}}\n >\n <SegmentGroup\n @parts={{this.parts}}\n @onPartsChange={{this.handlePartsChange}}\n @locale={{this.locale}}\n @placeholderValue={{this.placeholderValue}}\n @isDisabled={{@isDisabled}}\n @isReadOnly={{@isReadOnly}}\n @isInvalid={{c.isInvalid}}\n @id={{c.id}}\n @label={{@label}}\n @describedBy={{c.describedBy @description c.isInvalid}}\n @segmentLabels={{@segmentLabels}}\n @classes={{this.classes}}\n @userClasses={{@classes}}\n />\n {{#if this.isClearable}}\n <div\n data-part=\"end-content\"\n class={{this.classes.endContent class=@classes.endContent}}\n >\n <CloseButton\n @title=\"Clear\"\n @variant=\"soft\"\n @size=\"xs\"\n @class={{this.classes.clearButton class=@classes.clearButton}}\n data-part=\"clear-button\"\n @onPress={{this.clear}}\n />\n </div>\n {{/if}}\n </div>\n </FormControl>\n </div>\n </template>\n}\n\nexport { DateInput, type DateInputSignature };\nexport default DateInput;\n"],"names":["DateInput","Component","containerRef","ref","g","prototype","tracked","i","constructor","owner","args","seed","defaultValue","setParts","fromDate","buildParts","locale","formatOptions","undefined","parseDate","parts","trackedParts","navigator","language","resolveSegmentFormat","message","id","value","toDate","n","cached","wireValue","toWire","isEmpty","every","p","isSegment","placeholderValue","Date","isOutOfRange","minValue","maxValue","isDateUnavailable","isInvalid","Boolean","syncValue","modifier","_","raw","parsed","hasDateChanged","syncLocale","format","carryOver","handlePartsChange","before","after","onChange","triggerFormInputEvent","current","handleFocusOut","event","container","next","relatedTarget","Node","contains","onBlur","isClearable","isDisabled","isReadOnly","clear","querySelector","focus","classes","dateInput","useStyles","size","inputSize","setComponentTemplate","precompileTemplate","strictMode","scope","on","FormControl","SegmentGroup","CloseButton"],"mappings":";;;;;;;;;;;;;;;;AA2BA;;;;AAIA,MAAMA,kBAAkBC,SAAA,CAAU;EAChCC,YAAA,GAAeC,KAAI;AAEnB;;;AAGC;AAHD,EAAA;IAAAC,eAAA,CAAA,IAAA,CAAAC,SAAA,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