@astryxdesign/lab 0.7.4-canary.faa934f → 0.7.5-canary.bfe8e0d

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 (30) hide show
  1. package/dist/MobilePowerSearch/MobilePowerSearch.d.ts +126 -0
  2. package/dist/MobilePowerSearch/MobilePowerSearch.d.ts.map +1 -0
  3. package/dist/MobilePowerSearch/MobilePowerSearch.js +1234 -0
  4. package/dist/MobilePowerSearch/MobilePowerSearchValueEditor.d.ts +48 -0
  5. package/dist/MobilePowerSearch/MobilePowerSearchValueEditor.d.ts.map +1 -0
  6. package/dist/MobilePowerSearch/MobilePowerSearchValueEditor.js +530 -0
  7. package/dist/MobilePowerSearch/index.d.ts +9 -0
  8. package/dist/MobilePowerSearch/index.d.ts.map +1 -0
  9. package/dist/MobilePowerSearch/index.js +11 -0
  10. package/dist/MobilePowerSearch/mobilePowerSearchUtils.d.ts +69 -0
  11. package/dist/MobilePowerSearch/mobilePowerSearchUtils.d.ts.map +1 -0
  12. package/dist/MobilePowerSearch/mobilePowerSearchUtils.js +394 -0
  13. package/dist/MobileTokenizer/MobileTokenizer.d.ts +29 -1
  14. package/dist/MobileTokenizer/MobileTokenizer.d.ts.map +1 -1
  15. package/dist/MobileTokenizer/MobileTokenizer.js +6 -3
  16. package/dist/index.d.ts +1 -0
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +6 -0
  19. package/dist/lab.css +15 -0
  20. package/package.json +4 -4
  21. package/src/MobilePowerSearch/MobilePowerSearch.doc.mjs +160 -0
  22. package/src/MobilePowerSearch/MobilePowerSearch.test.tsx +1887 -0
  23. package/src/MobilePowerSearch/MobilePowerSearch.tsx +1710 -0
  24. package/src/MobilePowerSearch/MobilePowerSearchValueEditor.tsx +593 -0
  25. package/src/MobilePowerSearch/index.ts +13 -0
  26. package/src/MobilePowerSearch/mobilePowerSearchUtils.ts +524 -0
  27. package/src/MobileTokenizer/MobileTokenizer.doc.mjs +2 -0
  28. package/src/MobileTokenizer/MobileTokenizer.test.tsx +27 -0
  29. package/src/MobileTokenizer/MobileTokenizer.tsx +25 -7
  30. package/src/index.ts +9 -0
@@ -0,0 +1,126 @@
1
+ /**
2
+ * @file MobilePowerSearch.tsx
3
+ * @input Core PowerSearch config, filters and onChange (the same props as
4
+ * @astryxdesign/core PowerSearch); public @astryxdesign/core components only
5
+ * (BottomSheet, BottomSheetSwitcher, Button, Field, Heading, Icon, List,
6
+ * RadioList, Text, TextInput, Token, Tooltip hooks, i18n, hooks, utils,
7
+ * Layout container-padding styles)
8
+ * @output Exports MobilePowerSearch — Lab prototype of the touch PowerSearch
9
+ * flow: the whole field is one "Manage filters" trigger with display-only
10
+ * tokens, a Filters sheet with chevron rows, Add filter and sticky
11
+ * Clear all / Done, and a field → operator → value drill-down whose edit
12
+ * sheet holds Cancel / Apply / Remove
13
+ * @position Lab (canary) stack layer 1: validates the touch design before any
14
+ * Core promotion. The caller chooses it explicitly
15
+ * (`isTouch ? MobilePowerSearch : PowerSearch`); there is no pointer
16
+ * switching inside the component.
17
+ *
18
+ * API mirrors Core PowerSearchProps (config, filters, onChange with the same
19
+ * change metadata, label, placeholder, size, isDisabled, isReadOnly,
20
+ * timezoneID, status, startIcon, endContent, resultCount, handleRef,
21
+ * components, ...) so graduation is an import swap. Differences from Core are
22
+ * the Lab deltas:
23
+ * - no `menuWidth` or `tokenOverflowBehavior`: there is no typeahead popover
24
+ * and tokens wrap inside the trigger;
25
+ * - strings are literals (no new i18n keys; existing Core keys are reused
26
+ * only for the result count and the add announcement);
27
+ * - no theming contract: no `power-search` theme target or selectors;
28
+ * - `components[type].Token` overrides receive Core's PowerSearchTokenProps,
29
+ * which carry no `timezoneID`; the built-in token renders Core `Token`
30
+ * directly so the configured timezone reaches tokens and row summaries
31
+ * through the same formatter;
32
+ * - fields whose every operator is `nested` are left out with a development
33
+ * warning; `nested` has no sheet editor yet;
34
+ * - `date_absolute` honors `isDateOnly: false` with a DateTimeInput, and
35
+ * `date_relative` is a row list rather than a Selector;
36
+ * - the sheets pad their own content (`padding={0}` on BottomSheet); each
37
+ * sheet body publishes that padding as container padding so its
38
+ * `edge="bleed"` lists run edge to edge with row text on the body's inset.
39
+ *
40
+ * The sheets are pinned tall on purpose: the field list resizes as it is
41
+ * searched and the editor changes with the operator, and only a fully
42
+ * expanded tall sheet gives mobile-keyboard accommodation.
43
+ *
44
+ * SYNC: When modified, update:
45
+ * - /packages/lab/src/MobilePowerSearch/MobilePowerSearch.doc.mjs
46
+ * - /packages/lab/src/MobilePowerSearch/MobilePowerSearch.test.tsx
47
+ * - /apps/storybook/stories/MobilePowerSearch.stories.tsx
48
+ */
49
+ import React, { type ReactNode } from 'react';
50
+ import type { BaseProps } from '@astryxdesign/core';
51
+ import { type FieldStatusVariant, type InputStatus } from '@astryxdesign/core/Field';
52
+ import { type IconType } from '@astryxdesign/core/Icon';
53
+ import type { PowerSearchChangeType, PowerSearchComponents, PowerSearchConfig, PowerSearchFilter, PowerSearchHandle, PowerSearchSize } from '@astryxdesign/core/PowerSearch';
54
+ export interface MobilePowerSearchProps extends Omit<BaseProps<HTMLElement>, 'onChange'> {
55
+ /** PowerSearch configuration defining available fields and operators. */
56
+ config: PowerSearchConfig;
57
+ /** Currently active filters. */
58
+ filters: ReadonlyArray<PowerSearchFilter>;
59
+ /** Called when filters change, with the same metadata as Core PowerSearch. */
60
+ onChange: (filters: ReadonlyArray<PowerSearchFilter>, changeType: PowerSearchChangeType, index: number) => void;
61
+ /** Accessible label for the field and its trigger. @default 'Manage filters' */
62
+ label?: string;
63
+ /** Visually hide the label. @default true */
64
+ isLabelHidden?: boolean;
65
+ /** Trigger text when no filter is selected, and the content-search placeholder. */
66
+ placeholder?: string;
67
+ /** Auto-focus the trigger on mount. @default false */
68
+ hasAutoFocus?: boolean;
69
+ /** Show Clear all in the Filters sheet. @default true */
70
+ hasClear?: boolean;
71
+ /** Filters stay visible but cannot be added, edited, or removed. @default false */
72
+ isReadOnly?: boolean;
73
+ /** Disable the field; the sheet cannot open. @default false */
74
+ isDisabled?: boolean;
75
+ /**
76
+ * Explains why the field is disabled. With `isDisabled`, the trigger stays
77
+ * focusable (via `aria-disabled`) and shows this text in a tooltip.
78
+ */
79
+ disabledMessage?: string;
80
+ /** Icon at the start of the field. */
81
+ startIcon?: ReactNode | IconType;
82
+ /** Fires when focus enters the field from outside. */
83
+ onFocus?: (e: React.FocusEvent) => void;
84
+ /** Fires when focus leaves the field entirely. */
85
+ onBlur?: (e: React.FocusEvent) => void;
86
+ /** Validation status. */
87
+ status?: InputStatus;
88
+ /** How the status message is placed. @default 'attached' */
89
+ statusVariant?: FieldStatusVariant;
90
+ /** Max display length for token values. @default 40 */
91
+ maxTokenLength?: number;
92
+ /** Max suggestions in string and entity value typeaheads. @default 10 */
93
+ maxOperatorMenuItems?: number;
94
+ /** Max ranked results for a non-empty field or content query. @default 10 */
95
+ maxSearchResults?: number;
96
+ /** Label for the edit sheet's save action. @default 'Apply' when editing, 'Add filter' when creating */
97
+ popoverSaveButtonLabel?: string;
98
+ /** Timezone ID for date formatting in tokens, row summaries, and date editors. */
99
+ timezoneID?: string;
100
+ /** Content at the end of the field row. */
101
+ endContent?: ReactNode;
102
+ /** Result count: a number formats as "N results"; a string shows as-is. */
103
+ resultCount?: number | string;
104
+ /** Ref forwarded to the root element. */
105
+ ref?: React.Ref<HTMLDivElement>;
106
+ /** Imperative handle; `focusTypeahead` focuses the sheet trigger. */
107
+ handleRef?: React.Ref<PowerSearchHandle>;
108
+ /** Size of the field. @default 'md' */
109
+ size?: PowerSearchSize;
110
+ /** Per-type overrides for token and editor rendering. */
111
+ components?: PowerSearchComponents;
112
+ }
113
+ /**
114
+ * Lab prototype of the touch PowerSearch flow. The outer field keeps active
115
+ * filters as display-only tokens and acts as one sheet trigger. The Filters
116
+ * sheet lists selected filters as chevron rows with Add filter in its header
117
+ * and Clear all plus Done in its sticky footer; opening a row edits that
118
+ * filter in a sheet with Cancel, Apply and Remove. Add filter opens directly
119
+ * when no filter exists and, when the config names a content-search field,
120
+ * carries that search with inline suggestions.
121
+ */
122
+ export declare function MobilePowerSearch({ config: configProp, filters, onChange, label: labelFromProps, isLabelHidden, placeholder: placeholderFromProps, hasAutoFocus, hasClear, isReadOnly, isDisabled, disabledMessage, startIcon, onFocus, onBlur, status, statusVariant, maxTokenLength, maxOperatorMenuItems, maxSearchResults, popoverSaveButtonLabel, timezoneID, endContent, resultCount, ref, handleRef, size: sizeProp, 'data-testid': testId, xstyle, className, style, components: componentOverrides, }: MobilePowerSearchProps): React.JSX.Element;
123
+ export declare namespace MobilePowerSearch {
124
+ var displayName: string;
125
+ }
126
+ //# sourceMappingURL=MobilePowerSearch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MobilePowerSearch.d.ts","sourceRoot":"","sources":["../../src/MobilePowerSearch/MobilePowerSearch.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,OAAO,KAAK,EAAE,EAQZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAGlD,OAAO,EAML,KAAK,kBAAkB,EACvB,KAAK,WAAW,EACjB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAuB,KAAK,QAAQ,EAAC,MAAM,yBAAyB,CAAC;AAI5E,OAAO,KAAK,EAEV,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EAEjB,iBAAiB,EACjB,iBAAiB,EAEjB,eAAe,EAChB,MAAM,gCAAgC,CAAC;AAwCxC,MAAM,WAAW,sBAAuB,SAAQ,IAAI,CAClD,SAAS,CAAC,WAAW,CAAC,EACtB,UAAU,CACX;IACC,yEAAyE;IACzE,MAAM,EAAE,iBAAiB,CAAC;IAC1B,gCAAgC;IAChC,OAAO,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;IAC1C,8EAA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