@g9tm/lynxcontrols 1.4.7 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/anchor/context.d.ts +15 -0
- package/dist/anchor/context.d.ts.map +1 -0
- package/dist/anchor/context.jsx +10 -0
- package/dist/anchor/context.jsx.map +1 -0
- package/dist/anchor/hooks.d.ts +72 -0
- package/dist/anchor/hooks.d.ts.map +1 -0
- package/dist/anchor/hooks.jsx +147 -0
- package/dist/anchor/hooks.jsx.map +1 -0
- package/dist/anchor/index.d.ts +6 -0
- package/dist/anchor/index.d.ts.map +1 -0
- package/dist/anchor/index.jsx +5 -0
- package/dist/anchor/measure.d.ts +22 -0
- package/dist/anchor/measure.d.ts.map +1 -0
- package/dist/anchor/measure.jsx +110 -0
- package/dist/anchor/measure.jsx.map +1 -0
- package/dist/anchor/registry.d.ts +108 -0
- package/dist/anchor/registry.d.ts.map +1 -0
- package/dist/anchor/registry.jsx +142 -0
- package/dist/anchor/registry.jsx.map +1 -0
- package/dist/anchor/scroll.d.ts +34 -0
- package/dist/anchor/scroll.d.ts.map +1 -0
- package/dist/anchor/scroll.jsx +255 -0
- package/dist/anchor/scroll.jsx.map +1 -0
- package/dist/base/control.d.ts +10 -3
- package/dist/base/control.d.ts.map +1 -1
- package/dist/base/control.jsx +17 -2
- package/dist/base/control.jsx.map +1 -1
- package/dist/base/index.d.ts +1 -1
- package/dist/base/index.d.ts.map +1 -1
- package/dist/base/index.jsx +1 -1
- package/dist/base/pressable.d.ts.map +1 -1
- package/dist/base/pressable.jsx +7 -1
- package/dist/base/pressable.jsx.map +1 -1
- package/dist/base/selection-item.d.ts +9 -1
- package/dist/base/selection-item.d.ts.map +1 -1
- package/dist/base/selection-item.jsx +10 -1
- package/dist/base/selection-item.jsx.map +1 -1
- package/dist/button/button.css +20 -0
- package/dist/button/button.css.map +1 -1
- package/dist/button/button.d.ts.map +1 -1
- package/dist/button/button.jsx +11 -1
- package/dist/button/button.jsx.map +1 -1
- package/dist/button/header-action-button.d.ts +5 -0
- package/dist/button/header-action-button.d.ts.map +1 -1
- package/dist/button/header-action-button.jsx +16 -2
- package/dist/button/header-action-button.jsx.map +1 -1
- package/dist/button/icon-button.d.ts.map +1 -1
- package/dist/button/icon-button.jsx +11 -1
- package/dist/button/icon-button.jsx.map +1 -1
- package/dist/button/nav-card.d.ts.map +1 -1
- package/dist/button/nav-card.jsx +10 -1
- package/dist/button/nav-card.jsx.map +1 -1
- package/dist/button/vertical-icon-text-button.d.ts.map +1 -1
- package/dist/button/vertical-icon-text-button.jsx +10 -1
- package/dist/button/vertical-icon-text-button.jsx.map +1 -1
- package/dist/button/visuals.d.ts.map +1 -1
- package/dist/button/visuals.jsx +1 -1
- package/dist/button/visuals.jsx.map +1 -1
- package/dist/expander/expander.d.ts.map +1 -1
- package/dist/expander/expander.jsx +14 -1
- package/dist/expander/expander.jsx.map +1 -1
- package/dist/fields/editor.d.ts.map +1 -1
- package/dist/fields/editor.jsx +18 -2
- package/dist/fields/editor.jsx.map +1 -1
- package/dist/fields/fields.css +21 -0
- package/dist/fields/fields.css.map +1 -1
- package/dist/fields/index.d.ts +1 -1
- package/dist/fields/index.d.ts.map +1 -1
- package/dist/fields/index.jsx +1 -1
- package/dist/fields/outlined-field.d.ts +33 -1
- package/dist/fields/outlined-field.d.ts.map +1 -1
- package/dist/fields/outlined-field.jsx +43 -5
- package/dist/fields/outlined-field.jsx.map +1 -1
- package/dist/fields/text-entry.d.ts.map +1 -1
- package/dist/fields/text-entry.jsx +18 -2
- package/dist/fields/text-entry.jsx.map +1 -1
- package/dist/guide/guide.css +453 -0
- package/dist/guide/guide.css.map +1 -0
- package/dist/guide/index.d.ts +5 -0
- package/dist/guide/index.d.ts.map +1 -0
- package/dist/guide/index.jsx +4 -0
- package/dist/guide/journey.d.ts +46 -0
- package/dist/guide/journey.d.ts.map +1 -0
- package/dist/guide/journey.jsx +464 -0
- package/dist/guide/journey.jsx.map +1 -0
- package/dist/guide/placement.d.ts +44 -0
- package/dist/guide/placement.d.ts.map +1 -0
- package/dist/guide/placement.jsx +119 -0
- package/dist/guide/placement.jsx.map +1 -0
- package/dist/guide/service.d.ts +85 -0
- package/dist/guide/service.d.ts.map +1 -0
- package/dist/guide/service.jsx +620 -0
- package/dist/guide/service.jsx.map +1 -0
- package/dist/guide/settings.d.ts +50 -0
- package/dist/guide/settings.d.ts.map +1 -0
- package/dist/guide/settings.jsx +60 -0
- package/dist/guide/settings.jsx.map +1 -0
- package/dist/host/host.d.ts +5 -1
- package/dist/host/host.d.ts.map +1 -1
- package/dist/host/host.jsx +12 -0
- package/dist/host/host.jsx.map +1 -1
- package/dist/host/layers.d.ts +3 -1
- package/dist/host/layers.d.ts.map +1 -1
- package/dist/host/layers.jsx +4 -2
- package/dist/host/layers.jsx.map +1 -1
- package/dist/host/registry.d.ts +3 -0
- package/dist/host/registry.d.ts.map +1 -1
- package/dist/host/registry.jsx.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/pickers/combo-box.d.ts +8 -0
- package/dist/pickers/combo-box.d.ts.map +1 -1
- package/dist/pickers/combo-box.jsx +51 -9
- package/dist/pickers/combo-box.jsx.map +1 -1
- package/dist/pickers/date-time-picker.d.ts +2 -2
- package/dist/pickers/date-time-picker.d.ts.map +1 -1
- package/dist/pickers/date-time-picker.jsx +4 -3
- package/dist/pickers/date-time-picker.jsx.map +1 -1
- package/dist/pickers/date-time.d.ts +5 -2
- package/dist/pickers/date-time.d.ts.map +1 -1
- package/dist/pickers/date-time.jsx +1 -1
- package/dist/pickers/date-time.jsx.map +1 -1
- package/dist/pickers/picker-sheet.d.ts +6 -2
- package/dist/pickers/picker-sheet.d.ts.map +1 -1
- package/dist/pickers/picker-sheet.jsx +2 -3
- package/dist/pickers/picker-sheet.jsx.map +1 -1
- package/dist/pickers/picker.d.ts.map +1 -1
- package/dist/pickers/picker.jsx +3 -2
- package/dist/pickers/picker.jsx.map +1 -1
- package/dist/pickers/pickers.css +27 -0
- package/dist/pickers/pickers.css.map +1 -1
- package/dist/pickers/timespan-picker.d.ts.map +1 -1
- package/dist/pickers/timespan-picker.jsx +3 -2
- package/dist/pickers/timespan-picker.jsx.map +1 -1
- package/dist/pickers/trigger.d.ts +3 -1
- package/dist/pickers/trigger.d.ts.map +1 -1
- package/dist/pickers/trigger.jsx +6 -1
- package/dist/pickers/trigger.jsx.map +1 -1
- package/dist/provider/contexts.d.ts +3 -0
- package/dist/provider/contexts.d.ts.map +1 -1
- package/dist/provider/contexts.jsx.map +1 -1
- package/dist/provider/provider.d.ts.map +1 -1
- package/dist/provider/provider.jsx +24 -17
- package/dist/provider/provider.jsx.map +1 -1
- package/dist/provider/settings.d.ts +16 -0
- package/dist/provider/settings.d.ts.map +1 -1
- package/dist/provider/settings.jsx +7 -3
- package/dist/provider/settings.jsx.map +1 -1
- package/dist/provider/theme.css +4 -0
- package/dist/provider/theme.css.map +1 -1
- package/dist/range-slider/math.d.ts +14 -4
- package/dist/range-slider/math.d.ts.map +1 -1
- package/dist/range-slider/math.jsx +16 -4
- package/dist/range-slider/math.jsx.map +1 -1
- package/dist/range-slider/range-slider.css +17 -0
- package/dist/range-slider/range-slider.css.map +1 -1
- package/dist/range-slider/range-slider.d.ts +11 -0
- package/dist/range-slider/range-slider.d.ts.map +1 -1
- package/dist/range-slider/range-slider.jsx +35 -13
- package/dist/range-slider/range-slider.jsx.map +1 -1
- package/dist/route/hooks.d.ts +34 -0
- package/dist/route/hooks.d.ts.map +1 -0
- package/dist/route/hooks.jsx +147 -0
- package/dist/route/hooks.jsx.map +1 -0
- package/dist/route/index.d.ts +3 -0
- package/dist/route/index.d.ts.map +1 -0
- package/dist/route/index.jsx +2 -0
- package/dist/route/router.d.ts +201 -0
- package/dist/route/router.d.ts.map +1 -0
- package/dist/route/router.jsx +810 -0
- package/dist/route/router.jsx.map +1 -0
- package/dist/selection/index.d.ts +2 -1
- package/dist/selection/index.d.ts.map +1 -1
- package/dist/selection/index.jsx +2 -1
- package/dist/selection/selection-sheet.d.ts +3 -1
- package/dist/selection/selection-sheet.d.ts.map +1 -1
- package/dist/selection/selection-sheet.jsx +57 -8
- package/dist/selection/selection-sheet.jsx.map +1 -1
- package/dist/selection/selection.css +7 -0
- package/dist/selection/selection.css.map +1 -1
- package/dist/selection/window.d.ts +29 -0
- package/dist/selection/window.d.ts.map +1 -0
- package/dist/selection/window.jsx +24 -0
- package/dist/selection/window.jsx.map +1 -0
- package/dist/sheet/frame.d.ts +3 -1
- package/dist/sheet/frame.d.ts.map +1 -1
- package/dist/sheet/frame.jsx +72 -26
- package/dist/sheet/frame.jsx.map +1 -1
- package/dist/sheet/header.d.ts.map +1 -1
- package/dist/sheet/header.jsx +3 -1
- package/dist/sheet/header.jsx.map +1 -1
- package/dist/sheet/index.d.ts +1 -1
- package/dist/sheet/index.d.ts.map +1 -1
- package/dist/sheet/index.jsx +1 -1
- package/dist/sheet/options.d.ts +30 -0
- package/dist/sheet/options.d.ts.map +1 -1
- package/dist/sheet/options.jsx +2 -1
- package/dist/sheet/options.jsx.map +1 -1
- package/dist/sheet/service.d.ts +13 -0
- package/dist/sheet/service.d.ts.map +1 -1
- package/dist/sheet/service.jsx +27 -4
- package/dist/sheet/service.jsx.map +1 -1
- package/dist/sheet/sheet.css +9 -0
- package/dist/sheet/sheet.css.map +1 -1
- package/dist/sheet/sizing.d.ts +2 -0
- package/dist/sheet/sizing.d.ts.map +1 -1
- package/dist/sheet/sizing.jsx +2 -1
- package/dist/sheet/sizing.jsx.map +1 -1
- package/dist/tabs/tab-view.d.ts +14 -0
- package/dist/tabs/tab-view.d.ts.map +1 -1
- package/dist/tabs/tab-view.jsx +59 -3
- package/dist/tabs/tab-view.jsx.map +1 -1
- package/dist/toggle/checkbox.d.ts.map +1 -1
- package/dist/toggle/checkbox.jsx +15 -1
- package/dist/toggle/checkbox.jsx.map +1 -1
- package/dist/toggle/chip-group.d.ts +9 -1
- package/dist/toggle/chip-group.d.ts.map +1 -1
- package/dist/toggle/chip-group.jsx +63 -13
- package/dist/toggle/chip-group.jsx.map +1 -1
- package/dist/toggle/switch.d.ts +1 -1
- package/dist/toggle/switch.d.ts.map +1 -1
- package/dist/toggle/switch.jsx +18 -3
- package/dist/toggle/switch.jsx.map +1 -1
- package/dist/toggle/toggle.css +20 -0
- package/dist/toggle/toggle.css.map +1 -1
- package/package.json +17 -2
|
@@ -22,10 +22,9 @@ async function showPickerSheet(sheets, body) {
|
|
|
22
22
|
cancel: ()=>finish(null)
|
|
23
23
|
});
|
|
24
24
|
};
|
|
25
|
-
const handle = sheets.show(
|
|
25
|
+
const handle = sheets.show(<Body/>, {
|
|
26
26
|
...fitToContentSheetOptions(),
|
|
27
|
-
|
|
28
|
-
loadingSkeleton: 'none'
|
|
27
|
+
deferContent: false
|
|
29
28
|
});
|
|
30
29
|
if (!handle) return null;
|
|
31
30
|
await handle.result;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pickers/picker-sheet.jsx","sources":["../../src/pickers/picker-sheet.tsx"],"sourcesContent":["import './pickers.css';\nimport { G9StringKey } from '@g9tm/lynxcontrols-foundation';\nimport type { ReactNode } from '@lynx-js/react';\nimport { g9RowStyle } from '../base/control';\nimport { G9Button } from '../button/button';\nimport { useG9Direction, useG9Strings } from '../provider/hooks';\nimport { useG9SheetContext } from '../sheet/frame';\nimport { fitToContentSheetOptions } from '../sheet/options';\nimport type { G9SheetService } from '../sheet/service';\n\n/** Props a drum sheet body receives: finish with a value (Done) or without (Cancel). */\nexport interface G9PickerSheetBodyProps<T> {\n readonly done: (value: T) => void;\n readonly cancel: () => void;\n}\n\n/**\n * Opens a fit-to-content drum sheet (MAUI `G9DateTimePickerSheet.ShowAsync` / `G9TimeSpanPickerSheet.ShowAsync`) and\n * resolves the value Done returned, or `null` for Cancel, any dismissal, or a throttled open.
|
|
1
|
+
{"version":3,"file":"pickers/picker-sheet.jsx","sources":["../../src/pickers/picker-sheet.tsx"],"sourcesContent":["import './pickers.css';\nimport { G9StringKey } from '@g9tm/lynxcontrols-foundation';\nimport type { ReactNode } from '@lynx-js/react';\nimport { g9RowStyle } from '../base/control';\nimport { G9Button } from '../button/button';\nimport { useG9Direction, useG9Strings } from '../provider/hooks';\nimport { useG9SheetContext } from '../sheet/frame';\nimport { fitToContentSheetOptions } from '../sheet/options';\nimport type { G9SheetService } from '../sheet/service';\n\n/** Props a drum sheet body receives: finish with a value (Done) or without (Cancel). */\nexport interface G9PickerSheetBodyProps<T> {\n readonly done: (value: T) => void;\n readonly cancel: () => void;\n}\n\n/**\n * Opens a fit-to-content drum sheet (MAUI `G9DateTimePickerSheet.ShowAsync` / `G9TimeSpanPickerSheet.ShowAsync`) and\n * resolves the value Done returned, or `null` for Cancel, any dismissal, or a throttled open.\n *\n * ⛔ PRE-BUILT (MAUI 1.4.11): the body is built on the tap and opens finished — no spinner, and nothing waits on the\n * open motion. It used to be a factory shown behind a spinner until the sheet had opened plus 369 ms: the only sheet of\n * the suite that visibly «loaded» (MAUI's field report 2026-11-08, Samsung A24: the spinner stayed for seconds). What made\n * an eager build costly is gone with the ±12-year window (`g9YearWindowRadius`).\n */\nexport async function showPickerSheet<T>(\n sheets: G9SheetService,\n body: (props: G9PickerSheetBodyProps<T>) => ReactNode,\n): Promise<T | null> {\n let result: T | null = null;\n let finished = false;\n const Body = () => {\n const handle = useG9SheetContext()?.handle;\n const finish = (value: T | null) => {\n if (finished) return;\n finished = true;\n result = value;\n handle?.close();\n };\n return body({ done: (v) => finish(v), cancel: () => finish(null) });\n };\n const handle = sheets.show(<Body />, { ...fitToContentSheetOptions(), deferContent: false });\n if (!handle) return null;\n await handle.result;\n return result;\n}\n\n/**\n * The drum sheet header (MAUI `G9DateTimePickerSheet` / `G9TimeSpanPickerSheet.CreateHeader`): a Grid \"Auto,*,Auto\" of\n * Padding (16, 10) — Cancel as a small Text-variant G9Button (Primary text in an Outline pill), the title 15 bold\n * TextPrimary, Done as a small Primary G9Button.\n */\nexport function PickerSheetHeader(props: {\n readonly title: string;\n readonly onCancel: () => void;\n readonly onDone: () => void;\n}): ReactNode {\n const strings = useG9Strings();\n const direction = useG9Direction();\n return (\n <view className=\"g9-picker-sheet__header\" style={g9RowStyle(direction)}>\n <G9Button\n className=\"g9-picker-sheet__cancel\"\n text={strings.get(G9StringKey.Cancel)}\n variant=\"text\"\n size=\"small\"\n onPress={props.onCancel}\n />\n <text className=\"g9-picker-sheet__title\" text-maxline=\"1\">\n {props.title}\n </text>\n <G9Button\n className=\"g9-picker-sheet__done\"\n text={strings.get(G9StringKey.Done)}\n variant=\"primary\"\n size=\"small\"\n onPress={props.onDone}\n />\n </view>\n );\n}\n"],"names":["showPickerSheet","sheets","body","result","finished","Body","_useG9SheetContext","handle","finish","value","v","fitToContentSheetOptions","PickerSheetHeader","props","strings","useG9Strings","direction","useG9Direction","view","g9RowStyle","G9Button","G9StringKey","text"],"mappings":";;;;;;;AAyBO,eAAeA,gBACpBC,MAAsB,EACtBC,IAAqD;IAErD,IAAIC,SAAmB;IACvB,IAAIC,WAAW;IACf,MAAMC,OAAO;YACIC;QAAf,MAAMC,SAAS,QAAAD,CAAAA,qBAAAA,mBAAkB,IAAlBA,KAAAA,IAAAA,mBAAqB,MAAM;QAC1C,MAAME,SAAS,CAACC;YACd,IAAIL,UAAU;YACdA,WAAW;YACXD,SAASM;YACTF,QAAAA,UAAAA,OAAQ,KAAK;QACf;QACA,OAAOL,KAAK;YAAE,MAAM,CAACQ,IAAMF,OAAOE;YAAI,QAAQ,IAAMF,OAAO;QAAM;IACnE;IACA,MAAMD,SAASN,OAAO,IAAI,EAAEI,QAAS;QAAE,GAAGM,0BAA0B;QAAE,cAAc;IAAM;IAC1F,IAAI,CAACJ,QAAQ,OAAO;IACpB,MAAMA,OAAO,MAAM;IACnB,OAAOJ;AACT;AAOO,SAASS,kBAAkBC,KAIjC;IACC,MAAMC,UAAUC;IAChB,MAAMC,YAAYC;IAClB,QACGC,KAAK,UAAU,0BAA0B,OAAOC,WAAWH,YAAY;MACtE,CAACI,SACC,UAAU,0BACV,MAAMN,QAAQ,GAAG,CAACO,YAAY,MAAM,GACpC,QAAQ,OACR,KAAK,QACL,SAASR,MAAM,QAAQ,GACvB;MACF,CAACS,KAAK,UAAU,yBAAyB,aAAa,IAAI;QACxD,CAACT,MAAM,KAAK,CAAC;MACf,EAAES,KAAK;MACP,CAACF,SACC,UAAU,wBACV,MAAMN,QAAQ,GAAG,CAACO,YAAY,IAAI,GAClC,QAAQ,UACR,KAAK,QACL,SAASR,MAAM,MAAM,GACrB;IACJ,EAAEK;AAEN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"picker.d.ts","sourceRoot":"","sources":["../../src/pickers/picker.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"picker.d.ts","sourceRoot":"","sources":["../../src/pickers/picker.tsx"],"names":[],"mappings":"AACA,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,SAAS,EAAU,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,KAAK,eAAe,EAAgB,MAAM,wBAAwB,CAAC;AAK5E,OAAO,EAAE,KAAK,kBAAkB,EAAkD,MAAM,WAAW,CAAC;AAEpG,iCAAiC;AACjC,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe,CAAE,SAAQ,kBAAkB;IACpG,uGAAuG;IACvG,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IACjC,0GAA0G;IAC1G,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,gGAAgG;IAChG,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI,KAAK,IAAI,CAAC;IACtE,gFAAgF;IAChF,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC;;;OAGG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;IACnC,mHAAmH;IACnH,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;IAC5C,wGAAwG;IACxG,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,IAAI,CAAC;CAC5C;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,SAAS,CAiDxG"}
|
package/dist/pickers/picker.jsx
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { resolveRestingPlaceholder } from "../fields/outlined-field.jsx";
|
|
1
2
|
import "./pickers.css";
|
|
2
3
|
import { useRef } from "@lynx-js/react";
|
|
3
4
|
import { selectionKey } from "../base/selection-item.jsx";
|
|
@@ -7,7 +8,7 @@ import { showSelectionSheet } from "../selection/selection-sheet.jsx";
|
|
|
7
8
|
import { useG9Sheets } from "../sheet/service.jsx";
|
|
8
9
|
import { PickerField, SelectionValueIcon, usePickerOpen } from "./trigger.jsx";
|
|
9
10
|
function G9Picker(props) {
|
|
10
|
-
var _props_defaultValue,
|
|
11
|
+
var _props_defaultValue, _resolveRestingPlaceholder;
|
|
11
12
|
const sheets = useG9Sheets();
|
|
12
13
|
const glyphs = useG9Settings().glyphs;
|
|
13
14
|
const open = usePickerOpen();
|
|
@@ -63,7 +64,7 @@ function G9Picker(props) {
|
|
|
63
64
|
}} hasValue={void 0 !== selected} onOpen={onOpen}>
|
|
64
65
|
{selected ? <SelectionValueIcon item={selected}/> : null}
|
|
65
66
|
<text className={`g9-picker__text${selected ? '' : ' g9-picker__text--placeholder'}`} text-maxline="1">
|
|
66
|
-
{selected ? selected.text :
|
|
67
|
+
{selected ? selected.text : null != (_resolveRestingPlaceholder = resolveRestingPlaceholder(props)) ? _resolveRestingPlaceholder : ''}
|
|
67
68
|
</text>
|
|
68
69
|
</PickerField>;
|
|
69
70
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pickers/picker.jsx","sources":["../../src/pickers/picker.tsx"],"sourcesContent":["import './pickers.css';\nimport { type ReactNode, useRef } from '@lynx-js/react';\nimport { type G9SelectionItem, selectionKey } from '../base/selection-item';\nimport { useControllableState } from '../base/use-controllable-state';\nimport { useG9Settings } from '../provider/hooks';\nimport { showSelectionSheet } from '../selection/selection-sheet';\nimport { useG9Sheets } from '../sheet/service';\nimport { type G9PickerFieldProps, PickerField, SelectionValueIcon, usePickerOpen } from './trigger';\n\n/** Props of {@link G9Picker}. */\nexport interface G9PickerProps<T extends G9SelectionItem = G9SelectionItem> extends G9PickerFieldProps {\n /** The rows of the sheet (MAUI `ItemsSource`). Disabled items are left out except the selected one. */\n readonly items: ReadonlyArray<T>;\n /** Selected item key (`selectionKey`: key, else text); `null` = none. Controlled with `onValueChange`. */\n readonly value?: string | null;\n readonly defaultValue?: string | null;\n /** The selection changed: by a pick, or by `restoreOnCancel` putting back the opening value. */\n readonly onValueChange?: (key: string | null, item: T | null) => void;\n /** Sheet title; default the label, else the placeholder (MAUI `SheetTitle`). */\n readonly sheetTitle?: string | null;\n /**\n * Default true (MAUI `RestoreOnCancel`): a dismissed sheet puts back the value the picker had when it opened (if it\n * changed meanwhile) and reports `onSelectionCancelled`. False leaves the current value and reports nothing.\n */\n readonly restoreOnCancel?: boolean;\n /** A row was picked (MAUI `ItemSelected` + `SelectionAcceptedCommand`); only for a pick, never for a dismissal. */\n readonly onItemSelected?: (item: T) => void;\n /** The sheet was dismissed without a pick (MAUI `SelectionCancelled` + `SelectionCancelledCommand`). */\n readonly onSelectionCancelled?: () => void;\n}\n\n/**\n * Single selection from a list in an outlined box (MAUI `G9Picker`): a tap opens the selection sheet (no search; a\n * pick closes it), the box shows the item's icon or swatch and text, the trailing chevron hints at the sheet. Must\n * be inside a `G9Host` (the sheet).\n */\nexport function G9Picker<T extends G9SelectionItem = G9SelectionItem>(props: G9PickerProps<T>): ReactNode {\n const sheets = useG9Sheets();\n const glyphs = useG9Settings().glyphs;\n const open = usePickerOpen();\n const [key, setKey] = useControllableState<string | null, [T | null]>({\n value: props.value,\n defaultValue: props.defaultValue ?? null,\n onChange: props.onValueChange,\n name: 'G9Picker.value',\n });\n const latest = useRef({ props, key });\n latest.current = { props, key };\n const selected = key === null ? undefined : props.items.find((i) => selectionKey(i) === key);\n\n const onOpen = () =>\n open(async (isCurrent) => {\n const p = latest.current.props;\n const previousKey = latest.current.key;\n const previous = previousKey === null ? undefined : p.items.find((i) => selectionKey(i) === previousKey);\n const items = p.items.filter((i) => i.isEnabled !== false || i === previous);\n if (items.length === 0) return;\n const result = await showSelectionSheet(sheets, {\n title: p.sheetTitle?.trim() ? p.sheetTitle : (p.label ?? p.placeholder ?? ''),\n items,\n selectedItems: previous ? [previous] : [],\n allowMultiple: false,\n closeOnSingleSelection: true,\n showSearch: false,\n });\n if (!isCurrent()) return;\n const next = result.wasAccepted ? result.items[0] : undefined;\n const now = latest.current.props;\n if (next) {\n setKey(selectionKey(next), next);\n now.onItemSelected?.(next);\n } else if (now.restoreOnCancel !== false) {\n if (latest.current.key !== previousKey) setKey(previousKey, previous ?? null);\n now.onSelectionCancelled?.();\n }\n });\n\n return (\n <PickerField field={{ trailingIcon: glyphs.chevron, ...props }} hasValue={selected !== undefined} onOpen={onOpen}>\n {selected ? <SelectionValueIcon item={selected} /> : null}\n <text className={`g9-picker__text${selected ? '' : ' g9-picker__text--placeholder'}`} text-maxline=\"1\">\n {selected ? selected.text :
|
|
1
|
+
{"version":3,"file":"pickers/picker.jsx","sources":["../../src/pickers/picker.tsx"],"sourcesContent":["import { resolveRestingPlaceholder } from '../fields/outlined-field';\nimport './pickers.css';\nimport { type ReactNode, useRef } from '@lynx-js/react';\nimport { type G9SelectionItem, selectionKey } from '../base/selection-item';\nimport { useControllableState } from '../base/use-controllable-state';\nimport { useG9Settings } from '../provider/hooks';\nimport { showSelectionSheet } from '../selection/selection-sheet';\nimport { useG9Sheets } from '../sheet/service';\nimport { type G9PickerFieldProps, PickerField, SelectionValueIcon, usePickerOpen } from './trigger';\n\n/** Props of {@link G9Picker}. */\nexport interface G9PickerProps<T extends G9SelectionItem = G9SelectionItem> extends G9PickerFieldProps {\n /** The rows of the sheet (MAUI `ItemsSource`). Disabled items are left out except the selected one. */\n readonly items: ReadonlyArray<T>;\n /** Selected item key (`selectionKey`: key, else text); `null` = none. Controlled with `onValueChange`. */\n readonly value?: string | null;\n readonly defaultValue?: string | null;\n /** The selection changed: by a pick, or by `restoreOnCancel` putting back the opening value. */\n readonly onValueChange?: (key: string | null, item: T | null) => void;\n /** Sheet title; default the label, else the placeholder (MAUI `SheetTitle`). */\n readonly sheetTitle?: string | null;\n /**\n * Default true (MAUI `RestoreOnCancel`): a dismissed sheet puts back the value the picker had when it opened (if it\n * changed meanwhile) and reports `onSelectionCancelled`. False leaves the current value and reports nothing.\n */\n readonly restoreOnCancel?: boolean;\n /** A row was picked (MAUI `ItemSelected` + `SelectionAcceptedCommand`); only for a pick, never for a dismissal. */\n readonly onItemSelected?: (item: T) => void;\n /** The sheet was dismissed without a pick (MAUI `SelectionCancelled` + `SelectionCancelledCommand`). */\n readonly onSelectionCancelled?: () => void;\n}\n\n/**\n * Single selection from a list in an outlined box (MAUI `G9Picker`): a tap opens the selection sheet (no search; a\n * pick closes it), the box shows the item's icon or swatch and text, the trailing chevron hints at the sheet. Must\n * be inside a `G9Host` (the sheet).\n */\nexport function G9Picker<T extends G9SelectionItem = G9SelectionItem>(props: G9PickerProps<T>): ReactNode {\n const sheets = useG9Sheets();\n const glyphs = useG9Settings().glyphs;\n const open = usePickerOpen();\n const [key, setKey] = useControllableState<string | null, [T | null]>({\n value: props.value,\n defaultValue: props.defaultValue ?? null,\n onChange: props.onValueChange,\n name: 'G9Picker.value',\n });\n const latest = useRef({ props, key });\n latest.current = { props, key };\n const selected = key === null ? undefined : props.items.find((i) => selectionKey(i) === key);\n\n const onOpen = () =>\n open(async (isCurrent) => {\n const p = latest.current.props;\n const previousKey = latest.current.key;\n const previous = previousKey === null ? undefined : p.items.find((i) => selectionKey(i) === previousKey);\n const items = p.items.filter((i) => i.isEnabled !== false || i === previous);\n if (items.length === 0) return;\n const result = await showSelectionSheet(sheets, {\n title: p.sheetTitle?.trim() ? p.sheetTitle : (p.label ?? p.placeholder ?? ''),\n items,\n selectedItems: previous ? [previous] : [],\n allowMultiple: false,\n closeOnSingleSelection: true,\n showSearch: false,\n });\n if (!isCurrent()) return;\n const next = result.wasAccepted ? result.items[0] : undefined;\n const now = latest.current.props;\n if (next) {\n setKey(selectionKey(next), next);\n now.onItemSelected?.(next);\n } else if (now.restoreOnCancel !== false) {\n if (latest.current.key !== previousKey) setKey(previousKey, previous ?? null);\n now.onSelectionCancelled?.();\n }\n });\n\n return (\n <PickerField field={{ trailingIcon: glyphs.chevron, ...props }} hasValue={selected !== undefined} onOpen={onOpen}>\n {selected ? <SelectionValueIcon item={selected} /> : null}\n <text className={`g9-picker__text${selected ? '' : ' g9-picker__text--placeholder'}`} text-maxline=\"1\">\n {selected ? selected.text : (resolveRestingPlaceholder(props) ?? '')}\n </text>\n </PickerField>\n );\n}\n"],"names":["G9Picker","props","_props_defaultValue","_resolveRestingPlaceholder","sheets","useG9Sheets","glyphs","useG9Settings","open","usePickerOpen","key","setKey","useControllableState","latest","useRef","selected","undefined","i","selectionKey","onOpen","isCurrent","_ref","_p_sheetTitle","p","previousKey","previous","items","result","showSelectionSheet","next","now","PickerField","SelectionValueIcon","text"],"mappings":";;;;;;;;;AAqCO,SAASA,SAAsDC,KAAuB;QAM3EC,qBAuCmBC;IA5CnC,MAAMC,SAASC;IACf,MAAMC,SAASC,gBAAgB,MAAM;IACrC,MAAMC,OAAOC;IACb,MAAM,CAACC,KAAKC,OAAO,GAAGC,q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,GAAGX;YACpD,MAAMc,MAAMjB,OAAO,OAAO,CAAC,KAAK;YAChC,IAAIgB,MAAM;oBAERC;gBADAnB,OAAOO,aAAaW,OAAOA;wBAC3BC,CAAAA,sBAAAA,IAAI,cAAc,AAAD,KAAjBA,oBAAAA,IAAAA,CAAAA,KAAqBD;YACvB,OAAO,IAAIC,AAAwB,UAAxBA,IAAI,eAAe,EAAY;oBAExCA;gBADA,IAAIjB,OAAO,OAAO,CAAC,GAAG,KAAKW,aAAab,OAAOa,aAAaC,QAAAA,WAAAA,WAAY;wBACxEK,CAAAA,4BAAAA,IAAI,oBAAoB,AAAD,KAAvBA,0BAAAA,IAAAA,CAAAA;YACF;QACF;IAEF,QACGC,YAAY,OAAO;QAAE,cAAczB,OAAO,OAAO;QAAE,GAAGL,KAAK;IAAC,GAAG,UAAUc,AAAaC,WAAbD,UAAwB,QAAQI,QAAQ;MAChH,CAACJ,YAAYiB,mBAAmB,MAAMjB,cAAe,KAAK;MAC1D,CAACkB,KAAK,WAAW,CAAC,eAAe,EAAElB,WAAW,KAAK,iCAAiC,EAAE,aAAa,IAAI;QACrG,CAACA,WAAWA,SAAS,IAAI,GAAG,QAACZ,CAAAA,6BAAAA,0BAA0BF,MAAK,IAA/BE,6BAAoC,GAAI;MACvE,EAAE8B,KAAK;IACT,EAAEF;AAEN"}
|
package/dist/pickers/pickers.css
CHANGED
|
@@ -50,6 +50,33 @@
|
|
|
50
50
|
display: flex;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
.g9-combo__tonal {
|
|
54
|
+
border-style: solid;
|
|
55
|
+
border-width: 1px;
|
|
56
|
+
border-color: var(--g9-outline-variant);
|
|
57
|
+
background-color: var(--g9-surface-container-low);
|
|
58
|
+
border-radius: 17px;
|
|
59
|
+
flex-direction: row;
|
|
60
|
+
align-items: center;
|
|
61
|
+
column-gap: 8px;
|
|
62
|
+
height: 34px;
|
|
63
|
+
display: flex;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.g9-combo__tonal-text {
|
|
67
|
+
color: var(--g9-text-primary);
|
|
68
|
+
text-overflow: ellipsis;
|
|
69
|
+
font-size: 14px;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.g9-combo__tonal-close {
|
|
73
|
+
justify-content: center;
|
|
74
|
+
align-items: center;
|
|
75
|
+
width: 24px;
|
|
76
|
+
height: 24px;
|
|
77
|
+
display: flex;
|
|
78
|
+
}
|
|
79
|
+
|
|
53
80
|
.g9-combo__chips {
|
|
54
81
|
flex-direction: row;
|
|
55
82
|
align-items: center;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack://./src/pickers/pickers.css"],"names":[],"mappings":"AAAA;EACE,mBAAmB;EACnB,mBAAmB;EACnB,YAAY;EACZ,aAAa;AACf;;AAEA;EACE,6BAA6B;EAC7B,cAAc;EACd,eAAe;AACjB;;AAEA;EACE,8BAA8B;AAChC;;AAGA;EAAE,iBAAiB;AACnB;;AAGA;EAAE,gBAAgB;EAChB,eAAe;AACjB;;AAGA;EAAE,iBAAiB;EACjB,aAAa;AACf;;AAGA;EAAE,gBAAgB;EAChB,eAAe;AACjB;;AAGA;EAAE,iBAAiB;AACnB;;AAGA;EAAE,gBAAgB;EAChB,eAAe;AACjB;;AAGA;EAAE,mBAAmB;EACnB,mBAAmB;EACnB,YAAY;EACZ,aAAa;AACf;;
|
|
1
|
+
{"version":3,"sources":["webpack://./src/pickers/pickers.css"],"names":[],"mappings":"AAAA;EACE,mBAAmB;EACnB,mBAAmB;EACnB,YAAY;EACZ,aAAa;AACf;;AAEA;EACE,6BAA6B;EAC7B,cAAc;EACd,eAAe;AACjB;;AAEA;EACE,8BAA8B;AAChC;;AAGA;EAAE,iBAAiB;AACnB;;AAGA;EAAE,gBAAgB;EAChB,eAAe;AACjB;;AAGA;EAAE,iBAAiB;EACjB,aAAa;AACf;;AAGA;EAAE,gBAAgB;EAChB,eAAe;AACjB;;AAGA;EAAE,iBAAiB;AACnB;;AAGA;EA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gB;AAClB;;AAMA;EAHE,mBAAmB;EACnB,iBAAiB;EACjB,kBAAkB;EAClB,aAAa;AACf;;AAQA;EALE,cAAc;EACd,2BAA2B;AAC7B;;AAQA;EALE,sBAAsB;EACtB,OAAO;EACP,aAAa;AACf;;AASA;EANE,kBAAkB;EAClB,8BAA8B;EAC9B,kBAAkB;EAClB,eAAe;EACf,gBAAgB;AAClB;;AASA;EANE,kBAAkB;EAClB,gBAAgB;AAClB;;AAUA;EAPE,mBAAmB;EACnB,mBAAmB;EACnB,mBAAmB;EACnB,kBAAkB;EAClB,SAAS;EACT,UAAU;AACZ;;AAUA;EAPE,kBAAkB;EAClB,MAAM;EACN,SAAS;EACT,OAAO;EACP,QAAQ;AACV;;AAUA;EAPE,uBAAuB;EACvB,mBAAmB;EACnB,aAAa;AACf;;AAWA;EARE,8BAA8B;EAC9B,eAAe;AACjB;;AAWA;EARE,6BAA6B;EAC7B,eAAe;EACf,gBAAgB;AAClB","sourcesContent":[".g9-picker__value {\n display: flex;\n flex-direction: row;\n align-items: center;\n height: 100%;\n}\n\n.g9-picker__text {\n font-size: 15px;\n color: var(--g9-text-primary);\n flex-shrink: 1;\n}\n\n.g9-picker__text--placeholder {\n color: var(--g9-text-tertiary);\n}\n\n/* Gap after the swatch on the reading side (logical margins are dropped by the Lynx encoder, specs/02 §7). */\n.g9-picker__swatch {\n margin-right: 8px;\n}\n\n.g9-dir-rtl .g9-picker__swatch {\n margin-right: 0px;\n margin-left: 8px;\n}\n\n.g9-picker__icon {\n display: flex;\n margin-right: 8px;\n}\n\n.g9-dir-rtl .g9-picker__icon {\n margin-right: 0px;\n margin-left: 8px;\n}\n\n.g9-combo__chip .g9-picker__icon {\n margin-right: 6px;\n}\n\n.g9-dir-rtl .g9-combo__chip .g9-picker__icon {\n margin-right: 0px;\n margin-left: 6px;\n}\n\n.g9-combo__value {\n display: flex;\n flex-direction: row;\n align-items: center;\n height: 100%;\n}\n\n/* MAUI 1.4.10 ChipStyle.Tonal: a light pill per chosen item with its own close mark. */\n.g9-combo__tonal {\n display: flex;\n flex-direction: row;\n align-items: center;\n column-gap: 8px;\n height: 34px;\n border-radius: 17px;\n border-width: 1px;\n border-style: solid;\n border-color: var(--g9-outline-variant);\n background-color: var(--g9-surface-container-low);\n}\n\n.g9-combo__tonal-text {\n font-size: 14px;\n color: var(--g9-text-primary);\n text-overflow: ellipsis;\n}\n\n.g9-combo__tonal-close {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 24px;\n height: 24px;\n}\n\n.g9-combo__chips {\n display: flex;\n flex-direction: row;\n align-items: center;\n}\n\n.g9-combo__chip {\n display: flex;\n flex-direction: row;\n align-items: center;\n height: 28px;\n padding-left: 9px;\n padding-right: 9px;\n margin-right: 6px;\n border-radius: 6px;\n background-color: var(--g9-primary);\n}\n\n.g9-dir-rtl .g9-combo__chip {\n margin-right: 0px;\n margin-left: 6px;\n}\n\n.g9-combo__chip--more {\n background: var(--g9-surface-variant);\n border-width: 1px;\n border-style: solid;\n border-color: var(--g9-outline-variant);\n}\n\n.g9-combo__chip-text {\n font-size: 13px;\n font-weight: 700;\n color: var(--g9-on-primary);\n}\n\n.g9-combo__chip--more .g9-combo__chip-text {\n color: var(--g9-text-secondary);\n}\n\n.g9-picker-sheet {\n display: flex;\n flex-direction: column;\n padding-bottom: 10px;\n background-color: var(--g9-surface);\n}\n\n.g9-picker-sheet__header {\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 10px 16px;\n}\n\n.g9-picker-sheet__title {\n flex: 1;\n text-align: center;\n font-size: 15px;\n font-weight: 700;\n color: var(--g9-text-primary);\n}\n\n/* MAUI: the live preview 13 bold Primary, Padding (16, 4, 16, 8). */\n.g9-picker-sheet__preview {\n text-align: center;\n font-size: 13px;\n font-weight: 700;\n color: var(--g9-primary);\n padding: 4px 16px 8px 16px;\n}\n\n/* Colours inline (Primary at 8 % / 30 %). */\n.g9-picker-sheet__today {\n align-self: center;\n padding: 6px 12px;\n column-gap: 6px;\n border-radius: 16px;\n border-width: 1px;\n border-style: solid;\n display: flex;\n align-items: center;\n justify-content: center;\n margin: 2px 0px 6px 0px;\n}\n\n.g9-picker-sheet__today-text {\n font-size: 12px;\n font-weight: 700;\n color: var(--g9-primary);\n}\n\n.g9-picker-sheet__wheels {\n display: flex;\n flex-direction: row;\n padding-left: 8px;\n padding-right: 8px;\n}\n\n/* Mirrored explicitly; the row's own direction stays ltr so an engine that honours `direction` does not reverse it\n again (Lynxtron ignores `direction`, E22). */\n.g9-picker-sheet__wheels.g9-dir-rtl {\n direction: ltr;\n flex-direction: row-reverse;\n}\n\n.g9-wheel {\n flex: 1;\n display: flex;\n flex-direction: column;\n}\n\n/* MAUI DrumLabelFontSize 10, bold, TextTertiary. */\n.g9-wheel__label {\n text-align: center;\n font-size: 10px;\n font-weight: 700;\n color: var(--g9-text-tertiary);\n margin-bottom: 4px;\n}\n\n.g9-wheel__viewport {\n position: relative;\n overflow: hidden;\n}\n\n/* Colours set inline from the palette (Primary at 6 % / 55 %): CSS cannot take an alpha off a colour variable. */\n.g9-wheel__band {\n position: absolute;\n left: 8px;\n right: 8px;\n border-radius: 12px;\n border-width: 1.2px;\n border-style: solid;\n}\n\n.g9-wheel__fade {\n position: absolute;\n top: 0px;\n left: 0px;\n right: 0px;\n bottom: 0px;\n}\n\n.g9-wheel__row {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n/* MAUI G9DrumColumn.Apply: 16 TextTertiary; the selected row 17 bold TextPrimary. */\n.g9-wheel__text {\n font-size: 16px;\n color: var(--g9-text-tertiary);\n}\n\n.g9-wheel__row--selected .g9-wheel__text {\n font-size: 17px;\n color: var(--g9-text-primary);\n font-weight: 700;\n}\n"],"sourceRoot":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timespan-picker.d.ts","sourceRoot":"","sources":["../../src/pickers/timespan-picker.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"timespan-picker.d.ts","sourceRoot":"","sources":["../../src/pickers/tim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;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,SAAS,CA2CxE"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { resolveRestingPlaceholder } from "../fields/outlined-field.jsx";
|
|
1
2
|
import "./pickers.css";
|
|
2
3
|
import { G9StringKey, toNativeDigits } from "@g9tm/lynxcontrols-foundation";
|
|
3
4
|
import { useRef, useState } from "@lynx-js/react";
|
|
@@ -52,7 +53,7 @@ function TimeSpanSheetBody(props) {
|
|
|
52
53
|
</view>;
|
|
53
54
|
}
|
|
54
55
|
function G9TimeSpanPicker(props) {
|
|
55
|
-
var _props_mode, _props_defaultValue,
|
|
56
|
+
var _props_mode, _props_defaultValue, _resolveRestingPlaceholder;
|
|
56
57
|
const sheets = useG9Sheets();
|
|
57
58
|
const culture = useG9Culture();
|
|
58
59
|
const strings = useG9Strings();
|
|
@@ -90,7 +91,7 @@ function G9TimeSpanPicker(props) {
|
|
|
90
91
|
...props
|
|
91
92
|
}} hasValue={null !== value} onOpen={onOpen}>
|
|
92
93
|
<text className={`g9-picker__text${null !== value ? '' : ' g9-picker__text--placeholder'}`} text-maxline="1">
|
|
93
|
-
{null !== value ? formatTimeSpan(value, mode, strings, culture) :
|
|
94
|
+
{null !== value ? formatTimeSpan(value, mode, strings, culture) : null != (_resolveRestingPlaceholder = resolveRestingPlaceholder(props)) ? _resolveRestingPlaceholder : ''}
|
|
94
95
|
</text>
|
|
95
96
|
</PickerField>;
|
|
96
97
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pickers/timespan-picker.jsx","sources":["../../src/pickers/timespan-picker.tsx"],"sourcesContent":["import './pickers.css';\nimport { type G9Culture, G9StringKey, toNativeDigits } from '@g9tm/lynxcontrols-foundation';\nimport { type ReactNode, useRef, useState } from '@lynx-js/react';\nimport { useControllableState } from '../base/use-controllable-state';\nimport { useG9Culture, useG9Settings, useG9Strings } from '../provider/hooks';\nimport { useG9Sheets } from '../sheet/service';\nimport type { G9WheelItem } from './date-time';\nimport { PickerSheetHeader, showPickerSheet } from './picker-sheet';\nimport {\n composeTimeSpan,\n formatTimeSpan,\n type G9TimeSpanParts,\n G9TimeSpanPickerMode,\n g9TimeSpanDefaultMaxDays,\n g9TimeSpanMaxYears,\n timeSpanDepth,\n timeSpanParts,\n} from './timespan';\nimport { type G9PickerFieldProps, PickerField, usePickerOpen } from './trigger';\nimport { G9WheelColumn } from './wheel-column';\n\n/** Props of {@link G9TimeSpanPicker}. */\nexport interface G9TimeSpanPickerProps extends G9PickerFieldProps {\n /** Duration in milliseconds (MAUI `SelectedTimeSpan`); `null` = none. Controlled with `onValueChange`. */\n readonly value?: number | null;\n readonly defaultValue?: number | null;\n readonly onValueChange?: (ms: number | null) => void;\n /** Which drums show. Default `'yearsMonthsDays'`. */\n readonly mode?: G9TimeSpanPickerMode;\n /** Caption of the seconds drum (there is no localized key for it). Default `'s'`. */\n readonly secondsLabel?: string;\n /** Done confirmed a duration (MAUI `TimeSpanSelected`). */\n readonly onTimeSpanSelected?: (ms: number) => void;\n}\n\nconst range = (from: number, to: number, culture: G9Culture, width: number): G9WheelItem[] =>\n Array.from({ length: to - from + 1 }, (_, i) => ({\n value: from + i,\n text: toNativeDigits(String(from + i).padStart(width, '0'), culture.numberingSystem),\n }));\n\n/** The duration drum sheet body (MAUI `G9TimeSpanPickerSheet`, plus the hours/minutes/seconds drums). */\nexport function TimeSpanSheetBody(props: {\n readonly title: string;\n readonly initial: number;\n readonly mode: G9TimeSpanPickerMode;\n readonly culture: G9Culture;\n readonly secondsLabel: string;\n readonly done: (ms: number) => void;\n readonly cancel: () => void;\n}): ReactNode {\n const strings = useG9Strings();\n const { culture } = props;\n const depth = timeSpanDepth(props.mode);\n // What Done returns is what the drums show, also when nothing is touched (MAUI fix).\n const [parts, setParts] = useState<G9TimeSpanParts>(() => timeSpanParts(props.initial, props.mode));\n // The latest drums, written synchronously: Done can be tapped before the re-render binds a handler that closes over\n // the new parts, and returned the old duration (Windows CI agent, Azure build 541). See DateTimeSheetBody.\n const latest = useRef(parts);\n const change = (patch: Partial<G9TimeSpanParts>) => {\n latest.current = { ...latest.current, ...patch };\n setParts(latest.current);\n };\n return (\n <view className=\"g9-picker-sheet\">\n <PickerSheetHeader\n title={props.title}\n onCancel={props.cancel}\n onDone={() => props.done(composeTimeSpan(latest.current))}\n />\n <view className={`g9-picker-sheet__wheels g9-dir-${culture.direction}`}>\n <G9WheelColumn\n label={strings.get(G9StringKey.Year)}\n items={range(0, g9TimeSpanMaxYears, culture, 2)}\n value={parts.years}\n onValueChange={(years) => change({ years })}\n />\n <G9WheelColumn\n label={strings.get(G9StringKey.Month)}\n items={range(0, 11, culture, 2)}\n value={parts.months}\n onValueChange={(months) => change({ months })}\n />\n {depth >= 1 ? (\n <G9WheelColumn\n label={strings.get(G9StringKey.Day)}\n items={range(0, Math.max(g9TimeSpanDefaultMaxDays, parts.days), culture, 2)}\n value={parts.days}\n onValueChange={(days) => change({ days })}\n />\n ) : null}\n {depth >= 2 ? (\n <G9WheelColumn\n label={strings.get(G9StringKey.Hour)}\n items={range(0, 23, culture, 2)}\n value={parts.hours}\n onValueChange={(hours) => change({ hours })}\n />\n ) : null}\n {depth >= 3 ? (\n <G9WheelColumn\n label={strings.get(G9StringKey.Minute)}\n items={range(0, 59, culture, 2)}\n value={parts.minutes}\n onValueChange={(minutes) => change({ minutes })}\n />\n ) : null}\n {depth >= 4 ? (\n <G9WheelColumn\n label={props.secondsLabel}\n items={range(0, 59, culture, 2)}\n value={parts.seconds}\n onValueChange={(seconds) => change({ seconds })}\n />\n ) : null}\n </view>\n </view>\n );\n}\n\n/**\n * A duration in an outlined box (MAUI `G9TimeSpanPicker`): a tap opens the drum sheet; Done writes the value and\n * fires `onTimeSpanSelected`, Cancel and dismissals write nothing. Years/months/days follow the 365/30 convention;\n * the hours/minutes/seconds modes add those drums (MAUI accepted the modes but never showed them). Must be inside a\n * `G9Host`.\n */\nexport function G9TimeSpanPicker(props: G9TimeSpanPickerProps): ReactNode {\n const sheets = useG9Sheets();\n const culture = useG9Culture();\n const strings = useG9Strings();\n const glyphs = useG9Settings().glyphs;\n const open = usePickerOpen();\n const mode = props.mode ?? G9TimeSpanPickerMode.YearsMonthsDays;\n const [value, setValue] = useControllableState<number | null>({\n value: props.value,\n defaultValue: props.defaultValue ?? null,\n onChange: props.onValueChange,\n name: 'G9TimeSpanPicker.value',\n });\n const latest = useRef({ props, value });\n latest.current = { props, value };\n\n const onOpen = () =>\n open(async (isCurrent) => {\n const p = latest.current.props;\n const title = p.label?.trim() ? p.label : strings.get(G9StringKey.SelectDuration);\n const result = await showPickerSheet<number>(sheets, ({ done, cancel }) => (\n <TimeSpanSheetBody\n title={title}\n initial={latest.current.value ?? 0}\n mode={mode}\n culture={culture}\n secondsLabel={p.secondsLabel ?? 's'}\n done={done}\n cancel={cancel}\n />\n ));\n if (!isCurrent() || result === null) return;\n setValue(result);\n latest.current.props.onTimeSpanSelected?.(result);\n });\n\n return (\n <PickerField field={{ trailingIcon: glyphs.dateRange, ...props }} hasValue={value !== null} onOpen={onOpen}>\n <text className={`g9-picker__text${value !== null ? '' : ' g9-picker__text--placeholder'}`} text-maxline=\"1\">\n {value !== null ? formatTimeSpan(value, mode, strings, culture) : props.label ? '' : (props.placeholder ?? '')}\n </text>\n </PickerField>\n );\n}\n"],"names":["range","from","to","culture","width","Array","_","i","toNativeDigits","String","TimeSpanSheetBody","props","strings","useG9Strings","depth","timeSpanDepth","parts","setParts","useState","timeSpanParts","latest","useRef","change","patch","view","PickerSheetHeader","composeTimeSpan","G9WheelColumn","G9StringKey","g9TimeSpanMaxYears","years","months","Math","g9TimeSpanDefaultMaxDays","days","hours","minutes","seconds","G9TimeSpanPicker","_props_mode","_props_defaultValue","_props_placeholder","sheets","useG9Sheets","useG9Culture","glyphs","useG9Settings","open","usePickerOpen","mode","G9TimeSpanPickerMode","value","setValue","useControllableState","onOpen","isCurrent","_p_label","_latest_current_props","p","title","result","showPick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I;QAC3G,CAACA,AAAU,SAAVA,QAAiBiB,eAAejB,OAAOF,MAAMrC,SAAST,WAAWQ,MAAM,KAAK,GAAG,KAAK,QAAC8B,CAAAA,qBAAAA,MAAM,WAAW,AAAD,IAAhBA,qBAAqB,GAAI;MACjH,EAAE0B,KAAK;IACT,EAAED;AAEN"}
|
|
1
|
+
{"version":3,"file":"pickers/timespan-picker.jsx","sources":["../../src/pickers/timespan-picker.tsx"],"sourcesContent":["import { resolveRestingPlaceholder } from '../fields/outlined-field';\nimport './pickers.css';\nimport { type G9Culture, G9StringKey, toNativeDigits } from '@g9tm/lynxcontrols-foundation';\nimport { type ReactNode, useRef, useState } from '@lynx-js/react';\nimport { useControllableState } from '../base/use-controllable-state';\nimport { useG9Culture, useG9Settings, useG9Strings } from '../provider/hooks';\nimport { useG9Sheets } from '../sheet/service';\nimport type { G9WheelItem } from './date-time';\nimport { PickerSheetHeader, showPickerSheet } from './picker-sheet';\nimport {\n composeTimeSpan,\n formatTimeSpan,\n type G9TimeSpanParts,\n G9TimeSpanPickerMode,\n g9TimeSpanDefaultMaxDays,\n g9TimeSpanMaxYears,\n timeSpanDepth,\n timeSpanParts,\n} from './timespan';\nimport { type G9PickerFieldProps, PickerField, usePickerOpen } from './trigger';\nimport { G9WheelColumn } from './wheel-column';\n\n/** Props of {@link G9TimeSpanPicker}. */\nexport interface G9TimeSpanPickerProps extends G9PickerFieldProps {\n /** Duration in milliseconds (MAUI `SelectedTimeSpan`); `null` = none. Controlled with `onValueChange`. */\n readonly value?: number | null;\n readonly defaultValue?: number | null;\n readonly onValueChange?: (ms: number | null) => void;\n /** Which drums show. Default `'yearsMonthsDays'`. */\n readonly mode?: G9TimeSpanPickerMode;\n /** Caption of the seconds drum (there is no localized key for it). Default `'s'`. */\n readonly secondsLabel?: string;\n /** Done confirmed a duration (MAUI `TimeSpanSelected`). */\n readonly onTimeSpanSelected?: (ms: number) => void;\n}\n\nconst range = (from: number, to: number, culture: G9Culture, width: number): G9WheelItem[] =>\n Array.from({ length: to - from + 1 }, (_, i) => ({\n value: from + i,\n text: toNativeDigits(String(from + i).padStart(width, '0'), culture.numberingSystem),\n }));\n\n/** The duration drum sheet body (MAUI `G9TimeSpanPickerSheet`, plus the hours/minutes/seconds drums). */\nexport function TimeSpanSheetBody(props: {\n readonly title: string;\n readonly initial: number;\n readonly mode: G9TimeSpanPickerMode;\n readonly culture: G9Culture;\n readonly secondsLabel: string;\n readonly done: (ms: number) => void;\n readonly cancel: () => void;\n}): ReactNode {\n const strings = useG9Strings();\n const { culture } = props;\n const depth = timeSpanDepth(props.mode);\n // What Done returns is what the drums show, also when nothing is touched (MAUI fix).\n const [parts, setParts] = useState<G9TimeSpanParts>(() => timeSpanParts(props.initial, props.mode));\n // The latest drums, written synchronously: Done can be tapped before the re-render binds a handler that closes over\n // the new parts, and returned the old duration (Windows CI agent, Azure build 541). See DateTimeSheetBody.\n const latest = useRef(parts);\n const change = (patch: Partial<G9TimeSpanParts>) => {\n latest.current = { ...latest.current, ...patch };\n setParts(latest.current);\n };\n return (\n <view className=\"g9-picker-sheet\">\n <PickerSheetHeader\n title={props.title}\n onCancel={props.cancel}\n onDone={() => props.done(composeTimeSpan(latest.current))}\n />\n <view className={`g9-picker-sheet__wheels g9-dir-${culture.direction}`}>\n <G9WheelColumn\n label={strings.get(G9StringKey.Year)}\n items={range(0, g9TimeSpanMaxYears, culture, 2)}\n value={parts.years}\n onValueChange={(years) => change({ years })}\n />\n <G9WheelColumn\n label={strings.get(G9StringKey.Month)}\n items={range(0, 11, culture, 2)}\n value={parts.months}\n onValueChange={(months) => change({ months })}\n />\n {depth >= 1 ? (\n <G9WheelColumn\n label={strings.get(G9StringKey.Day)}\n items={range(0, Math.max(g9TimeSpanDefaultMaxDays, parts.days), culture, 2)}\n value={parts.days}\n onValueChange={(days) => change({ days })}\n />\n ) : null}\n {depth >= 2 ? (\n <G9WheelColumn\n label={strings.get(G9StringKey.Hour)}\n items={range(0, 23, culture, 2)}\n value={parts.hours}\n onValueChange={(hours) => change({ hours })}\n />\n ) : null}\n {depth >= 3 ? (\n <G9WheelColumn\n label={strings.get(G9StringKey.Minute)}\n items={range(0, 59, culture, 2)}\n value={parts.minutes}\n onValueChange={(minutes) => change({ minutes })}\n />\n ) : null}\n {depth >= 4 ? (\n <G9WheelColumn\n label={props.secondsLabel}\n items={range(0, 59, culture, 2)}\n value={parts.seconds}\n onValueChange={(seconds) => change({ seconds })}\n />\n ) : null}\n </view>\n </view>\n );\n}\n\n/**\n * A duration in an outlined box (MAUI `G9TimeSpanPicker`): a tap opens the drum sheet; Done writes the value and\n * fires `onTimeSpanSelected`, Cancel and dismissals write nothing. Years/months/days follow the 365/30 convention;\n * the hours/minutes/seconds modes add those drums (MAUI accepted the modes but never showed them). Must be inside a\n * `G9Host`.\n */\nexport function G9TimeSpanPicker(props: G9TimeSpanPickerProps): ReactNode {\n const sheets = useG9Sheets();\n const culture = useG9Culture();\n const strings = useG9Strings();\n const glyphs = useG9Settings().glyphs;\n const open = usePickerOpen();\n const mode = props.mode ?? G9TimeSpanPickerMode.YearsMonthsDays;\n const [value, setValue] = useControllableState<number | null>({\n value: props.value,\n defaultValue: props.defaultValue ?? null,\n onChange: props.onValueChange,\n name: 'G9TimeSpanPicker.value',\n });\n const latest = useRef({ props, value });\n latest.current = { props, value };\n\n const onOpen = () =>\n open(async (isCurrent) => {\n const p = latest.current.props;\n const title = p.label?.trim() ? p.label : strings.get(G9StringKey.SelectDuration);\n const result = await showPickerSheet<number>(sheets, ({ done, cancel }) => (\n <TimeSpanSheetBody\n title={title}\n initial={latest.current.value ?? 0}\n mode={mode}\n culture={culture}\n secondsLabel={p.secondsLabel ?? 's'}\n done={done}\n cancel={cancel}\n />\n ));\n if (!isCurrent() || result === null) return;\n setValue(result);\n latest.current.props.onTimeSpanSelected?.(result);\n });\n\n return (\n <PickerField field={{ trailingIcon: glyphs.dateRange, ...props }} hasValue={value !== null} onOpen={onOpen}>\n <text className={`g9-picker__text${value !== null ? '' : ' g9-picker__text--placeholder'}`} text-maxline=\"1\">\n {value !== null ? formatTimeSpan(value, mode, strings, culture) : (resolveRestingPlaceholder(props) ?? '')}\n </text>\n </PickerField>\n );\n}\n"],"names":["range","from","to","culture","width","Array","_","i","toNativeDigits","String","TimeSpanSheetBody","props","strings","useG9Strings","depth","timeSpanDepth","parts","setParts","useState","timeSpanParts","latest","useRef","change","patch","view","PickerSheetHeader","composeTimeSpan","G9WheelColumn","G9StringKey","g9TimeSpanMaxYears","years","months","Math","g9TimeSpanDefaultMaxDays","days","hours","minutes","seconds","G9TimeSpanPicker","_props_mode","_props_defaultValue","_resolveRestingPlaceholder","sheets","useG9Sheets","useG9Culture","glyphs","useG9Settings","open","usePickerOpen","mode","G9TimeSpanPickerMode","value","setValue","useControllableState","onOpen","isCurrent","_p_label","_latest_current_props","p","title","result","showPickerSheet","done","cancel","_latest_current_value","_p_secondsLabel","PickerField","text","formatTimeSpan"],"mappings":";;;;;;;;;;;AAoCA,MAAMA,QAAQ,CAACC,MAAcC,IAAYC,SAAoBC,QAC3DC,MAAM,IAAI,CAAC;QAAE,QAAQH,KAAKD,OAAO;IAAE,GAAG,CAACK,GAAGC,IAAO;YAC/C,OAAON,OAAOM;YACd,MAAMC,eAAeC,OAAOR,OAAOM,GAAG,QAAQ,CAACH,OAAO,MAAMD,QAAQ,eAAe;QACrF;AAGK,SAASO,kBAAkBC,KAQjC;IACC,MAAMC,UAAUC;IAChB,MAAM,EAAEV,OAAO,EAAE,GAAGQ;IACpB,MAAMG,QAAQC,cAAcJ,MAAM,IAAI;IAEtC,MAAM,CAACK,OAAOC,SAAS,GAAGC,SAA0B,IAAMC,cAAcR,MAAM,OAAO,EAAEA,MAAM,IAAI;IAGjG,MAAMS,SAASC,OAAOL;IACtB,MAAMM,SAAS,CAACC;QACdH,OAAO,OAAO,GAAG;YAAE,GAAGA,OAAO,OAAO;YAAE,GAAGG,KAAK;QAAC;QAC/CN,SAASG,OAAO,OAAO;IACzB;IACA,QACGI,KAA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ACT,cAAc,QAAA8D,CAAAA,kBAAAA,EAAE,YAAY,AAAD,IAAbA,kBAAkB,KAChC,MAAMH,MACN,QAAQC;;YAGZ,IAAI,CAACR,eAAeK,AAAW,SAAXA,QAAiB;YACrCR,SAASQ;oBACTH,CAAAA,2CAAAA,AAAAA,CAAAA,wBAAAA,OAAO,OAAO,CAAC,KAAK,AAAD,EAAE,kBAAkB,AAAD,KAAtCA,yCAAAA,IAAAA,CAAAA,uBAA0CG;QAC5C;IAEF,QACGM,YAAY,OAAO;QAAE,cAAcrB,OAAO,SAAS;QAAE,GAAGlC,KAAK;IAAC,GAAG,UAAUwC,AAAU,SAAVA,OAAgB,QAAQG,QAAQ;MAC1G,CAACa,KAAK,WAAW,CAAC,eAAe,EAAEhB,AAAU,SAAVA,QAAiB,KAAK,iCAAiC,EAAE,aAAa,IAAI;QAC3G,CAACA,AAAU,SAAVA,QAAiBiB,eAAejB,OAAOF,MAAMrC,SAAST,WAAW,QAACsC,CAAAA,6BAAAA,0BAA0B9B,MAAK,IAA/B8B,6BAAoC,GAAI;MAC7G,EAAE0B,KAAK;IACT,EAAED;AAEN"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import './pickers.css';
|
|
2
2
|
import type { G9TextInputDirection } from '@g9tm/lynxcontrols-foundation';
|
|
3
3
|
import { type ReactNode } from '@lynx-js/react';
|
|
4
|
-
import type
|
|
4
|
+
import { type G9SelectionItem } from '../base/selection-item.js';
|
|
5
5
|
import { type G9OutlinedFieldProps, type G9TrailingAffordance } from '../fields/outlined-field.js';
|
|
6
6
|
/**
|
|
7
7
|
* Opens a picker sheet at most once at a time and drops results that arrive after the field unmounted (MAUI
|
|
@@ -17,6 +17,8 @@ export declare function valueDirectionClass(direction: G9TextInputDirection | un
|
|
|
17
17
|
export declare function SelectionValueIcon(props: {
|
|
18
18
|
readonly item: G9SelectionItem;
|
|
19
19
|
readonly color?: string;
|
|
20
|
+
/** In a multi-select chip: a person's picture is left out — the chip is the name alone (MAUI 1.4.10 IsAvatar). */
|
|
21
|
+
readonly inChip?: boolean;
|
|
20
22
|
}): ReactNode;
|
|
21
23
|
/** Props shared by every picker trigger: the outlined field props (label, helper, error, icons, read-only, …). */
|
|
22
24
|
export type G9PickerFieldProps = G9OutlinedFieldProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trigger.d.ts","sourceRoot":"","sources":["../../src/pickers/trigger.tsx"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,gBAAgB,CAAC;AAEnE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"trigger.d.ts","sourceRoot":"","sources":["../../src/pickers/trigger.tsx"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,gBAAgB,CAAC;AAEnE,OAAO,EAAE,KAAK,eAAe,EAAiB,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAmB,KAAK,oBAAoB,EAAE,KAAK,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAKjH;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,CAAC,GAAG,EAAE,CAAC,SAAS,EAAE,MAAM,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,CAwB1F;AAED,yFAAyF;AACzF,wBAAgB,cAAc,CAAC,SAAS,EAAE,oBAAoB,GAAG,SAAS,EAAE,OAAO,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAEjH;AAED,qFAAqF;AACrF,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,oBAAoB,GAAG,SAAS,EAAE,OAAO,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,CAE/G;AAED,iHAAiH;AACjH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE;IACxC,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAC/B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,kHAAkH;IAClH,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;CAC3B,GAAG,SAAS,CA4BZ;AAED,kHAAkH;AAClH,MAAM,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AAEtD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE;IACjC,QAAQ,CAAC,KAAK,EAAE,kBAAkB,CAAC;IACnC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC;IAC5B,QAAQ,CAAC,kBAAkB,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAC1D,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;CAC/B,GAAG,SAAS,CAqBZ"}
|
package/dist/pickers/trigger.jsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "./pickers.css";
|
|
2
2
|
import { useEffect, useRef } from "@lynx-js/react";
|
|
3
3
|
import { g9RowStyle } from "../base/control.jsx";
|
|
4
|
+
import { isAvatarImage } from "../base/selection-item.jsx";
|
|
4
5
|
import { G9OutlinedField } from "../fields/outlined-field.jsx";
|
|
5
6
|
import { G9IconSlot, hasIconSlot } from "../icon/slot.jsx";
|
|
6
7
|
import { G9Swatch } from "../icon/swatch.jsx";
|
|
@@ -42,6 +43,8 @@ function SelectionValueIcon(props) {
|
|
|
42
43
|
var _item_emoji, _item_iconPath, _item_iconImage;
|
|
43
44
|
var _item_swatchFirstColor, _item_swatchSecondColor;
|
|
44
45
|
const { item } = props;
|
|
46
|
+
const avatar = isAvatarImage(item);
|
|
47
|
+
if (avatar && props.inChip) return null;
|
|
45
48
|
const icon = {
|
|
46
49
|
emoji: null != (_item_emoji = item.emoji) ? _item_emoji : null,
|
|
47
50
|
icon: item.icon,
|
|
@@ -51,7 +54,9 @@ function SelectionValueIcon(props) {
|
|
|
51
54
|
if (hasIconSlot(icon)) {
|
|
52
55
|
var _ref, _item_iconTintColor;
|
|
53
56
|
return <view className="g9-picker__icon">
|
|
54
|
-
<G9IconSlot {...icon} size={18} color={null != (_ref = null != (_item_iconTintColor = item.iconTintColor) ? _item_iconTintColor : props.color) ? _ref : 'var(--g9-on-surface-variant)'}
|
|
57
|
+
<G9IconSlot {...icon} size={18} color={null != (_ref = null != (_item_iconTintColor = item.iconTintColor) ? _item_iconTintColor : props.color) ? _ref : 'var(--g9-on-surface-variant)'} {...avatar ? {
|
|
58
|
+
imageCornerRadius: 9
|
|
59
|
+
} : {}}/>
|
|
55
60
|
</view>;
|
|
56
61
|
}
|
|
57
62
|
if ((null == (_item_swatchFirstColor = item.swatchFirstColor) ? void 0 : _item_swatchFirstColor.trim()) || (null == (_item_swatchSecondColor = item.swatchSecondColor) ? void 0 : _item_swatchSecondColor.trim())) return <G9Swatch first={item.swatchFirstColor} second={item.swatchSecondColor} className="g9-picker__swatch"/>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pickers/trigger.jsx","sources":["../../src/pickers/trigger.tsx"],"sourcesContent":["import './pickers.css';\nimport type { G9TextInputDirection } from '@g9tm/lynxcontrols-foundation';\nimport { type ReactNode, useEffect, useRef } from '@lynx-js/react';\nimport { g9RowStyle } from '../base/control';\nimport type
|
|
1
|
+
{"version":3,"file":"pickers/trigger.jsx","sources":["../../src/pickers/trigger.tsx"],"sourcesContent":["import './pickers.css';\nimport type { G9TextInputDirection } from '@g9tm/lynxcontrols-foundation';\nimport { type ReactNode, useEffect, useRef } from '@lynx-js/react';\nimport { g9RowStyle } from '../base/control';\nimport { type G9SelectionItem, isAvatarImage } from '../base/selection-item';\nimport { G9OutlinedField, type G9OutlinedFieldProps, type G9TrailingAffordance } from '../fields/outlined-field';\nimport { G9IconSlot, hasIconSlot } from '../icon/slot';\nimport { G9Swatch } from '../icon/swatch';\nimport { useG9Diagnostics, useG9Direction } from '../provider/hooks';\n\n/**\n * Opens a picker sheet at most once at a time and drops results that arrive after the field unmounted (MAUI\n * `_isOpening` + `Unloaded`). `open(run)` runs `run(isCurrent)`; `isCurrent()` is false once a newer open started or\n * the field is gone, so a stale result applies nothing. Errors go to the provider's diagnostics.\n */\nexport function usePickerOpen(): (run: (isCurrent: () => boolean) => Promise<void>) => void {\n const opening = useRef(false);\n const generation = useRef(0);\n const diagnostics = useG9Diagnostics();\n useEffect(\n () => () => {\n generation.current += 1;\n },\n [],\n );\n return (run) => {\n if (opening.current) return;\n opening.current = true;\n const mine = ++generation.current;\n void (async () => {\n try {\n await run(() => generation.current === mine);\n } catch (error) {\n diagnostics.log({ level: 'error', message: 'Picker failed.', source: 'G9Picker', error });\n } finally {\n opening.current = false;\n }\n })();\n };\n}\n\n/** The reading direction of a value written with a `G9TextInputDirection` (internal). */\nexport function valueDirection(direction: G9TextInputDirection | undefined, culture: 'ltr' | 'rtl'): 'ltr' | 'rtl' {\n return direction === 'leftToRight' ? 'ltr' : direction === 'rightToLeft' ? 'rtl' : culture;\n}\n\n/** The physical direction class of a value written with a `G9TextInputDirection`. */\nexport function valueDirectionClass(direction: G9TextInputDirection | undefined, culture: 'ltr' | 'rtl'): string {\n return `g9-dir-${valueDirection(direction, culture)}`;\n}\n\n/** The leading icon (or colour swatch) of a selected item inside the trigger (MAUI `CreateValueIcon`, 18 px). */\nexport function SelectionValueIcon(props: {\n readonly item: G9SelectionItem;\n readonly color?: string;\n /** In a multi-select chip: a person's picture is left out — the chip is the name alone (MAUI 1.4.10 IsAvatar). */\n readonly inChip?: boolean;\n}): ReactNode {\n const { item } = props;\n const avatar = isAvatarImage(item);\n if (avatar && props.inChip) return null;\n const icon = {\n emoji: item.emoji ?? null,\n icon: item.icon,\n imagePath: item.iconPath ?? null,\n image: item.iconImage ?? null,\n };\n if (hasIconSlot(icon)) {\n // MAUI keeps 8 px between the value icon and its text (6 px inside a combo chip): pickers.css. A single value that is\n // a person's picture is round (corner 9 of 18).\n return (\n <view className=\"g9-picker__icon\">\n <G9IconSlot\n {...icon}\n size={18}\n color={item.iconTintColor ?? props.color ?? 'var(--g9-on-surface-variant)'}\n {...(avatar ? { imageCornerRadius: 9 } : {})}\n />\n </view>\n );\n }\n if (item.swatchFirstColor?.trim() || item.swatchSecondColor?.trim()) {\n return <G9Swatch first={item.swatchFirstColor} second={item.swatchSecondColor} className=\"g9-picker__swatch\" />;\n }\n return null;\n}\n\n/** Props shared by every picker trigger: the outlined field props (label, helper, error, icons, read-only, …). */\nexport type G9PickerFieldProps = G9OutlinedFieldProps;\n\n/**\n * The tap-to-open outlined box every picker uses (MAUI `G9OutlinedFieldBase` with a tap recognizer): no keyboard,\n * the label floats while there is a value, a tap on the box opens the sheet unless disabled or read-only.\n */\nexport function PickerField(props: {\n readonly field: G9PickerFieldProps;\n readonly hasValue: boolean;\n readonly onOpen: () => void;\n readonly trailingAffordance?: G9TrailingAffordance | null;\n readonly children?: ReactNode;\n}): ReactNode {\n const direction = useG9Direction();\n const { field } = props;\n const blocked = field.disabled === true || field.readOnly === true;\n return (\n <G9OutlinedField\n {...field}\n className={`g9-picker${field.className ? ` ${field.className}` : ''}`}\n focused={false}\n hasValue={props.hasValue}\n {...(props.trailingAffordance !== undefined ? { trailingAffordance: props.trailingAffordance } : {})}\n onFocusRequest={() => {\n if (!blocked) props.onOpen();\n }}\n accessibilityLabel={field.label ?? field.placeholder ?? ''}\n >\n <view className={`g9-picker__value g9-dir-${direction}`} style={g9RowStyle(direction)}>\n {props.children}\n </view>\n </G9OutlinedField>\n );\n}\n"],"names":["usePickerOpen","opening","useRef","generation","diagnostics","useG9Diagnostics","useEffect","run","mine","error","valueDirection","direction","culture","valueDirectionClass","SelectionValueIcon","props","_item_emoji","_item_iconPath","_item_iconImage","_item_swatchFirstColor","_item_swatchSecondColor","item","avatar","isAvatarImage","icon","hasIconSlot","_ref","view","G9IconSlot","G9Swatch","PickerField","useG9Direction","field","blocked","G9OutlinedField","undefined","g9RowStyle"],"mappings":";;;;;;;;AAeO,SAASA;IACd,MAAMC,UAAUC,OAAO;IACvB,MAAMC,aAAaD,OAAO;IAC1B,MAAME,cAAcC;IACpBC,UACE,IAAM;YACJH,WAAW,OAAO,IAAI;QACxB,GACA,EAAE;IAEJ,OAAO,CAACI;QACN,IAAIN,QAAQ,OAAO,EAAE;QACrBA,QAAQ,OAAO,GAAG;QAClB,MAAMO,OAAO,EAAEL,WAAW,OAAO;QAC3B;YACJ,IAAI;gBACF,MAAMI,IAAI,IAAMJ,WAAW,OAAO,KAAKK;YACzC,EAAE,OAAOC,OAAO;gBACdL,YAAY,GAAG,CAAC;oBAAE,OAAO;oBAAS,SAAS;oBAAkB,QAAQ;oBAAYK;gBAAM;YACzF,SAAU;gBACRR,QAAQ,OAAO,GAAG;YACpB;QACF;IACF;AACF;AAGO,SAASS,eAAeC,SAA2C,EAAEC,OAAsB;IAChG,OAAOD,AAAc,kBAAdA,YAA8B,QAAQA,AAAc,kBAAdA,YAA8B,QAAQC;AACrF;AAGO,SAASC,oBAAoBF,SAA2C,EAAEC,OAAsB;IACrG,OAAO,CAAC,OAAO,EAAEF,eAAeC,WAAWC,UAAU;AACvD;AAGO,SAASE,mBAAmBC,KAKlC;QAKUC,aAEIC,gBACJC;QAgBLC,wBAAiCC;IAvBrC,MAAM,EAAEC,IAAI,EAAE,GAAGN;IACjB,MAAMO,SAASC,cAAcF;IAC7B,IAAIC,UAAUP,MAAM,MAAM,EAAE,OAAO;IACnC,MAAMS,OAAO;QACX,OAAO,QAAAR,CAAAA,cAAAA,KAAK,KAAK,AAAD,IAATA,cAAc;QACrB,MAAMK,KAAK,IAAI;QACf,WAAW,QAAAJ,CAAAA,iBAAAA,KAAK,QAAQ,AAAD,IAAZA,iBAAiB;QAC5B,OAAO,QAAAC,CAAAA,kBAAAA,KAAK,SAAS,AAAD,IAAbA,kBAAkB;IAC3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AeM,MAAM,WAAW,AAAD,IAA/BN,OAAoC,IACzD;MACC,CAACC,KAAK,WAAW,CAAC,wBAAwB,EAAEhB,WAAW,EAAE,OAAOyB,WAAWzB,YAAY;QACrF,CAACI,MAAM,QAAQ,CAAC;MAClB,EAAEY,KAAK;IACT,EAAEO;AAEN"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { G9Capabilities, G9Culture, G9CultureStore, G9Diagnostics, G9Preferences, G9SafeExecutor, G9SafeInsets, G9Strings, G9ThemeStore } from '@g9tm/lynxcontrols-foundation';
|
|
2
|
+
import type { G9AnchorRegistry } from '../anchor/registry.js';
|
|
2
3
|
import type { G9ResolvedSettings } from './settings.js';
|
|
3
4
|
/** What `useG9Culture` and `useG9Strings` read: the snapshot and the strings built for it. */
|
|
4
5
|
export interface G9CultureContextValue {
|
|
@@ -29,6 +30,8 @@ export interface G9ProviderCore {
|
|
|
29
30
|
readonly executor: G9SafeExecutor;
|
|
30
31
|
/** Id of the provider's root `<view>` (the element carrying the theme variables). */
|
|
31
32
|
readonly rootId: string;
|
|
33
|
+
/** Every anchor of this LynxView (`@g9tm/lynxcontrols/anchor`): the controls a guide or an automation can reach. */
|
|
34
|
+
readonly anchors: G9AnchorRegistry;
|
|
32
35
|
}
|
|
33
36
|
export declare const G9CoreContext: import("react").Context<G9ProviderCore | null>;
|
|
34
37
|
export declare const G9CultureContext: import("react").Context<G9CultureContextValue | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contexts.d.ts","sourceRoot":"","sources":["../../src/provider/contexts.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,cAAc,EACd,SAAS,EACT,cAAc,EACd,aAAa,EACb,aAAa,EACb,cAAc,EACd,YAAY,EACZ,SAAS,EACT,YAAY,EACb,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,8FAA8F;AAC9F,MAAM,WAAW,qBAAqB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ider. One context per kind of change, so a consumer re-renders only for what it reads:\n// the theme store and services never change identity, culture changes re-render culture readers, keyboard and window\n// changes re-render only their readers (plan/specs/01 §5).\n\nimport type {\n G9Capabilities,\n G9Culture,\n G9CultureStore,\n G9Diagnostics,\n G9Preferences,\n G9SafeExecutor,\n G9SafeInsets,\n G9Strings,\n G9ThemeStore,\n} from '@g9tm/lynxcontrols-foundation';\nimport { createContext } from '@lynx-js/react';\nimport type { G9ResolvedSettings } from './settings';\n\n/** What `useG9Culture` and `useG9Strings` read: the snapshot and the strings built for it. */\nexport interface G9CultureContextValue {\n readonly culture: G9Culture;\n readonly strings: G9Strings;\n readonly store: G9CultureStore;\n}\n\n/** Soft-keyboard state (plan/specs/02 §4 `keyboardstatuschanged`). Heights are in the units the platform reports. */\nexport interface G9KeyboardState {\n /** `true` between a `'on'` and the next `'off'`. */\n readonly visible: boolean;\n /** Keyboard height; `0` while hidden. */\n readonly height: number;\n /** The platform's compatibility height (Lynx `compatHeight`); `0` while hidden or when not reported. */\n readonly compatHeight: number;\n}\n\n/** Window size in logical pixels (MAUI `G9ScreenHelper.WidthInDip` / `HeightInDip`). */\nexport interface G9WindowState {\n readonly width: number;\n readonly height: number;\n}\n\n/** Everything a provider shares that never changes identity while it is mounted. */\nexport interface G9ProviderCore {\n readonly services: G9Capabilities;\n readonly themeStore: G9ThemeStore;\n readonly preferences: G9Preferences;\n readonly diagnostics: G9Diagnostics;\n readonly executor: G9SafeExecutor;\n /** Id of the provider's root `<view>` (the element carrying the theme variables). */\n readonly rootId: string;\n}\n\nexport const G9CoreContext = createContext<G9ProviderCore | null>(null);\nexport const G9CultureContext = createContext<G9CultureContextValue | null>(null);\nexport const G9SettingsContext = createContext<G9ResolvedSettings | null>(null);\nexport const G9KeyboardContext = createContext<G9KeyboardState | null>(null);\nexport const G9WindowContext = createContext<G9WindowState | null>(null);\nexport const G9InsetsContext = createContext<G9SafeInsets | null>(null);\n/** The provider's diagnostics hub, or `null` outside a provider (base hooks fall back to `console`). */\nexport const G9DiagnosticsContext = createContext<G9Diagnostics | null>(null);\n"],"names":["G9CoreContext","createContext","G9CultureContext","G9SettingsContext","G9KeyboardContext","G9WindowContext","G9InsetsContext","G9DiagnosticsContext"],"mappings":";
|
|
1
|
+
{"version":3,"file":"provider/contexts.jsx","sources":["../../src/provider/contexts.ts"],"sourcesContent":["// React contexts behind G9Provider. One context per kind of change, so a consumer re-renders only for what it reads:\n// the theme store and services never change identity, culture changes re-render culture readers, keyboard and window\n// changes re-render only their readers (plan/specs/01 §5).\n\nimport type {\n G9Capabilities,\n G9Culture,\n G9CultureStore,\n G9Diagnostics,\n G9Preferences,\n G9SafeExecutor,\n G9SafeInsets,\n G9Strings,\n G9ThemeStore,\n} from '@g9tm/lynxcontrols-foundation';\nimport { createContext } from '@lynx-js/react';\nimport type { G9AnchorRegistry } from '../anchor/registry';\nimport type { G9ResolvedSettings } from './settings';\n\n/** What `useG9Culture` and `useG9Strings` read: the snapshot and the strings built for it. */\nexport interface G9CultureContextValue {\n readonly culture: G9Culture;\n readonly strings: G9Strings;\n readonly store: G9CultureStore;\n}\n\n/** Soft-keyboard state (plan/specs/02 §4 `keyboardstatuschanged`). Heights are in the units the platform reports. */\nexport interface G9KeyboardState {\n /** `true` between a `'on'` and the next `'off'`. */\n readonly visible: boolean;\n /** Keyboard height; `0` while hidden. */\n readonly height: number;\n /** The platform's compatibility height (Lynx `compatHeight`); `0` while hidden or when not reported. */\n readonly compatHeight: number;\n}\n\n/** Window size in logical pixels (MAUI `G9ScreenHelper.WidthInDip` / `HeightInDip`). */\nexport interface G9WindowState {\n readonly width: number;\n readonly height: number;\n}\n\n/** Everything a provider shares that never changes identity while it is mounted. */\nexport interface G9ProviderCore {\n readonly services: G9Capabilities;\n readonly themeStore: G9ThemeStore;\n readonly preferences: G9Preferences;\n readonly diagnostics: G9Diagnostics;\n readonly executor: G9SafeExecutor;\n /** Id of the provider's root `<view>` (the element carrying the theme variables). */\n readonly rootId: string;\n /** Every anchor of this LynxView (`@g9tm/lynxcontrols/anchor`): the controls a guide or an automation can reach. */\n readonly anchors: G9AnchorRegistry;\n}\n\nexport const G9CoreContext = createContext<G9ProviderCore | null>(null);\nexport const G9CultureContext = createContext<G9CultureContextValue | null>(null);\nexport const G9SettingsContext = createContext<G9ResolvedSettings | null>(null);\nexport const G9KeyboardContext = createContext<G9KeyboardState | null>(null);\nexport const G9WindowContext = createContext<G9WindowState | null>(null);\nexport const G9InsetsContext = createContext<G9SafeInsets | null>(null);\n/** The provider's diagnostics hub, or `null` outside a provider (base hooks fall back to `console`). */\nexport const G9DiagnosticsContext = createContext<G9Diagnostics | null>(null);\n"],"names":["G9CoreContext","createContext","G9CultureContext","G9SettingsContext","G9KeyboardContext","G9WindowContext","G9InsetsContext","G9DiagnosticsContext"],"mappings":";AAuDO,MAAMA,gBAAgBC,cAAqC;AAC3D,MAAMC,mBAAmBD,cAA4C;AACrE,MAAME,oBAAoBF,cAAyC;AACnE,MAAMG,oBAAoBH,cAAsC;AAChE,MAAMI,kBAAkBJ,cAAoC;AAC5D,MAAMK,kBAAkBL,cAAmC;AAE3D,MAAMM,uBAAuBN,cAAoC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/provider/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,cAAc,EACnB,KAAK,aAAa,EAElB,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,aAAa,EAGlB,KAAK,cAAc,EACnB,KAAK,YAAY,EAMlB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,KAAK,SAAS,EAA8D,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/provider/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,cAAc,EACnB,KAAK,aAAa,EAElB,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,aAAa,EAGlB,KAAK,cAAc,EACnB,KAAK,YAAY,EAMlB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,KAAK,SAAS,EAA8D,MAAM,gBAAgB,CAAC;AAkB5G,OAAO,EAAE,KAAK,UAAU,EAA4C,MAAM,YAAY,CAAC;AAEvF,OAAO,gBAAgB,CAAC;AACxB,OAAO,aAAa,CAAC;AAErB,mCAAmC;AACnC,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IAC3C;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,SAAS,GAAG,MAAM,CAAC;IACvD;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,YAAY,GAAG,cAAc,CAAC;IAC/C,kHAAkH;IAClH,QAAQ,CAAC,YAAY,CAAC,EAAE,aAAa,CAAC;IACtC;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;IAChC,8EAA8E;IAC9E,QAAQ,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC;IAC/B,gEAAgE;IAChE,QAAQ,CAAC,WAAW,CAAC,EAAE,aAAa,CAAC;IACrC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;CAC/B;AA6BD;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,SAAS,CAwO5D"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { assertRequiredCapabilities, createCultureStore, createDiagnostics, createIconFontRegistry, createPreferences, createSafeExecutor, createStrings, createThemeStore, g9MotionScale, subscribeG9Motion, toCssVariables, toLayoutCssVariables, toMetricCssVariables } from "@g9tm/lynxcontrols-foundation";
|
|
2
2
|
import { useEffect, useMemo, useRef, useState, useSyncExternalStore } from "@lynx-js/react";
|
|
3
|
+
import { G9AnchorRegistryContext } from "../anchor/context.jsx";
|
|
4
|
+
import { createAnchorRegistry } from "../anchor/registry.jsx";
|
|
3
5
|
import { useStableCallback } from "../base/use-stable-callback.jsx";
|
|
4
6
|
import { g9Hosts } from "../host/registry.jsx";
|
|
5
7
|
import { G9CoreContext, G9CultureContext, G9DiagnosticsContext, G9InsetsContext, G9KeyboardContext, G9SettingsContext, G9WindowContext } from "./contexts.jsx";
|
|
@@ -109,6 +111,7 @@ function G9Provider(props) {
|
|
|
109
111
|
providerSequence += 1;
|
|
110
112
|
return `g9-provider-${providerSequence}`;
|
|
111
113
|
});
|
|
114
|
+
const [anchors] = useState(createAnchorRegistry);
|
|
112
115
|
const core = useMemo(()=>{
|
|
113
116
|
var _executorSettings_showError;
|
|
114
117
|
const preferences = createPreferences({
|
|
@@ -152,14 +155,16 @@ function G9Provider(props) {
|
|
|
152
155
|
preferences,
|
|
153
156
|
diagnostics,
|
|
154
157
|
executor,
|
|
155
|
-
rootId
|
|
158
|
+
rootId,
|
|
159
|
+
anchors
|
|
156
160
|
});
|
|
157
161
|
}, [
|
|
158
162
|
services,
|
|
159
163
|
themeStore,
|
|
160
164
|
diagnostics,
|
|
161
165
|
settings.executor,
|
|
162
|
-
rootId
|
|
166
|
+
rootId,
|
|
167
|
+
anchors
|
|
163
168
|
]);
|
|
164
169
|
useEffect(()=>()=>core.executor.dispose(), [
|
|
165
170
|
core
|
|
@@ -270,21 +275,23 @@ function G9Provider(props) {
|
|
|
270
275
|
const rootStyle = null != fallbackVariables ? fallbackVariables : initialVariables;
|
|
271
276
|
const directionClass = 'rtl' === culture.direction ? 'g9-dir-rtl' : 'g9-dir-ltr';
|
|
272
277
|
return <G9CoreContext.Provider value={core}>
|
|
273
|
-
<
|
|
274
|
-
<
|
|
275
|
-
<
|
|
276
|
-
<
|
|
277
|
-
<
|
|
278
|
-
<
|
|
279
|
-
<
|
|
280
|
-
{props.
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
278
|
+
<G9AnchorRegistryContext.Provider value={anchors}>
|
|
279
|
+
<G9DiagnosticsContext.Provider value={diagnostics}>
|
|
280
|
+
<G9SettingsContext.Provider value={settings}>
|
|
281
|
+
<G9CultureContext.Provider value={cultureValue}>
|
|
282
|
+
<G9KeyboardContext.Provider value={keyboard}>
|
|
283
|
+
<G9WindowContext.Provider value={windowState}>
|
|
284
|
+
<G9InsetsContext.Provider value={insets}>
|
|
285
|
+
<view id={rootId} className={`g9-provider g9-theme-${initialScheme} ${directionClass}${motionOff ? ' g9-motion-off' : ''}${props.className ? ` ${props.className}` : ''}`} style={rootStyle}>
|
|
286
|
+
{props.children}
|
|
287
|
+
</view>
|
|
288
|
+
</G9InsetsContext.Provider>
|
|
289
|
+
</G9WindowContext.Provider>
|
|
290
|
+
</G9KeyboardContext.Provider>
|
|
291
|
+
</G9CultureContext.Provider>
|
|
292
|
+
</G9SettingsContext.Provider>
|
|
293
|
+
</G9DiagnosticsContext.Provider>
|
|
294
|
+
</G9AnchorRegistryContext.Provider>
|
|
288
295
|
</G9CoreContext.Provider>;
|
|
289
296
|
}
|
|
290
297
|
export { G9Provider };
|