@g9tm/lynxcontrols 1.4.11 → 1.6.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/pressable.d.ts.map +1 -1
- package/dist/base/pressable.jsx +7 -1
- package/dist/base/pressable.jsx.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.map +1 -1
- package/dist/button/header-action-button.jsx +10 -1
- 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/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 +17 -1
- package/dist/fields/editor.jsx.map +1 -1
- package/dist/fields/outlined-field.d.ts +6 -0
- package/dist/fields/outlined-field.d.ts.map +1 -1
- package/dist/fields/outlined-field.jsx +14 -3
- 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 +17 -1
- package/dist/fields/text-entry.jsx.map +1 -1
- package/dist/fields/use-text-input.d.ts +1 -1
- package/dist/guide/confirm-sheet.d.ts +26 -0
- package/dist/guide/confirm-sheet.d.ts.map +1 -0
- package/dist/guide/confirm-sheet.jsx +146 -0
- package/dist/guide/confirm-sheet.jsx.map +1 -0
- package/dist/guide/guide.css +428 -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 +462 -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 +95 -0
- package/dist/guide/service.d.ts.map +1 -0
- package/dist/guide/service.jsx +566 -0
- package/dist/guide/service.jsx.map +1 -0
- package/dist/guide/settings.d.ts +68 -0
- package/dist/guide/settings.d.ts.map +1 -0
- package/dist/guide/settings.jsx +66 -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/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 +4 -0
- package/dist/provider/settings.d.ts.map +1 -1
- package/dist/provider/settings.jsx +3 -2
- package/dist/provider/settings.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/sheet/frame.d.ts +3 -1
- package/dist/sheet/frame.d.ts.map +1 -1
- package/dist/sheet/frame.jsx +67 -25
- package/dist/sheet/frame.jsx.map +1 -1
- package/dist/sheet/options.d.ts +10 -0
- package/dist/sheet/options.d.ts.map +1 -1
- package/dist/sheet/options.jsx.map +1 -1
- package/dist/sheet/service.d.ts +5 -0
- package/dist/sheet/service.d.ts.map +1 -1
- package/dist/sheet/service.jsx +14 -2
- 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/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.map +1 -1
- package/dist/toggle/chip-group.jsx +12 -1
- package/dist/toggle/chip-group.jsx.map +1 -1
- package/dist/toggle/switch.d.ts.map +1 -1
- package/dist/toggle/switch.jsx +15 -1
- package/dist/toggle/switch.jsx.map +1 -1
- package/package.json +17 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base/pressable.jsx","sources":["../../src/base/pressable.tsx"],"sourcesContent":["import { g9Ms } from '@g9tm/lynxcontrols-foundation';\nimport type { ReactNode } from '@lynx-js/react';\nimport { type G9ControlBaseProps, useG9Control } from './control';\nimport { type G9PressVisual, useG9Press, usePressVisual } from './press';\n\n/** The standard press feedback curve (MAUI `G9PressFeedbackBehavior` defaults: 1 / 0.86 / 0.78 over 110 ms). */\nexport const g9PressFeedbackDefaults: G9PressVisual = Object.freeze({\n property: 'opacity',\n rest: 1,\n hovered: 0.86,\n pressed: 0.78,\n inMs: 110,\n outMs: 110,\n});\n\n/** Props of {@link G9Pressable}. */\nexport interface G9PressableProps extends G9ControlBaseProps {\n /** The press (MAUI `Command` + `CommandParameter`); one handler on the root, children never take the touch. */\n readonly onPress?: () => void;\n /** Opacity at rest. Default 1. */\n readonly restOpacity?: number;\n /** Opacity under a desktop pointer. Default 0.86. */\n readonly hoveredOpacity?: number;\n /** Opacity while pressed. Default 0.78. */\n readonly pressedOpacity?: number;\n /** Each tween's length. Default 110 ms. */\n readonly animationDurationMs?: number;\n readonly children?: ReactNode;\n}\n\n/**\n * Opacity press feedback around any content (MAUI `G9PressFeedbackBehavior` attached to a view; `.For(command)` is\n * `<G9Pressable onPress={…}>`). The feedback runs on the main thread; the press goes through `useG9Press`.\n */\nexport function G9Pressable(props: G9PressableProps): ReactNode {\n const control = useG9Control(props, 'g9-pressable');\n const press = useG9Press(props.onPress, { blocked: control.disabled, source: 'G9Pressable' });\n const ms = g9Ms(props.animationDurationMs ?? g9PressFeedbackDefaults.inMs);\n const visual = usePressVisual(\n {\n property: 'opacity',\n rest: props.restOpacity ?? g9PressFeedbackDefaults.rest,\n hovered: props.hoveredOpacity ?? (g9PressFeedbackDefaults.hovered as number),\n pressed: props.pressedOpacity ?? g9PressFeedbackDefaults.pressed,\n inMs: ms,\n outMs: ms,\n },\n control.disabled,\n );\n return (\n <view\n className={control.className}\n {...control.idProps}\n style={{ opacity: props.restOpacity ?? 1 }}\n {...(props.accessibilityLabel\n ? { 'accessibility-element': true, 'accessibility-label': props.accessibilityLabel }\n : {})}\n bindtap={press}\n {...visual}\n >\n {props.children}\n </view>\n );\n}\n"],"names":["g9PressFeedbackDefaults","Object","G9Pressable","props","_props_animationDurationMs","_props_restOpacity","_props_hoveredOpacity","_props_pressedOpacity","_props_restOpacity1","control","useG9Control","press","useG9Press","ms","g9Ms","visual","usePressVisual","view"],"mappings":";;;AAMO,MAAMA,0BAAyCC,OAAO,MAAM,CAAC;IAClE,UAAU;IACV,MAAM;IACN,SAAS;IACT,SAAS;IACT,MAAM;IACN,OAAO;AACT;AAqBO,SAASC,YAAYC,KAAuB;
|
|
1
|
+
{"version":3,"file":"base/pressable.jsx","sources":["../../src/base/pressable.tsx"],"sourcesContent":["import { g9Ms } from '@g9tm/lynxcontrols-foundation';\nimport type { ReactNode } from '@lynx-js/react';\nimport { type G9ControlBaseProps, useG9Control } from './control';\nimport { type G9PressVisual, useG9Press, usePressVisual } from './press';\n\n/** The standard press feedback curve (MAUI `G9PressFeedbackBehavior` defaults: 1 / 0.86 / 0.78 over 110 ms). */\nexport const g9PressFeedbackDefaults: G9PressVisual = Object.freeze({\n property: 'opacity',\n rest: 1,\n hovered: 0.86,\n pressed: 0.78,\n inMs: 110,\n outMs: 110,\n});\n\n/** Props of {@link G9Pressable}. */\nexport interface G9PressableProps extends G9ControlBaseProps {\n /** The press (MAUI `Command` + `CommandParameter`); one handler on the root, children never take the touch. */\n readonly onPress?: () => void;\n /** Opacity at rest. Default 1. */\n readonly restOpacity?: number;\n /** Opacity under a desktop pointer. Default 0.86. */\n readonly hoveredOpacity?: number;\n /** Opacity while pressed. Default 0.78. */\n readonly pressedOpacity?: number;\n /** Each tween's length. Default 110 ms. */\n readonly animationDurationMs?: number;\n readonly children?: ReactNode;\n}\n\n/**\n * Opacity press feedback around any content (MAUI `G9PressFeedbackBehavior` attached to a view; `.For(command)` is\n * `<G9Pressable onPress={…}>`). The feedback runs on the main thread; the press goes through `useG9Press`.\n */\nexport function G9Pressable(props: G9PressableProps): ReactNode {\n const control = useG9Control(props, 'g9-pressable', {\n kind: 'button',\n label: () => props.accessibilityLabel,\n capabilities: { activate: () => press() },\n });\n const press = useG9Press(props.onPress, { blocked: control.disabled, source: 'G9Pressable' });\n const ms = g9Ms(props.animationDurationMs ?? g9PressFeedbackDefaults.inMs);\n const visual = usePressVisual(\n {\n property: 'opacity',\n rest: props.restOpacity ?? g9PressFeedbackDefaults.rest,\n hovered: props.hoveredOpacity ?? (g9PressFeedbackDefaults.hovered as number),\n pressed: props.pressedOpacity ?? g9PressFeedbackDefaults.pressed,\n inMs: ms,\n outMs: ms,\n },\n control.disabled,\n );\n return (\n <view\n className={control.className}\n {...control.idProps}\n style={{ opacity: props.restOpacity ?? 1 }}\n {...(props.accessibilityLabel\n ? { 'accessibility-element': true, 'accessibility-label': props.accessibilityLabel }\n : {})}\n bindtap={press}\n {...visual}\n >\n {props.children}\n </view>\n );\n}\n"],"names":["g9PressFeedbackDefaults","Object","G9Pressable","props","_props_animationDurationMs","_props_restOpacity","_props_hoveredOpacity","_props_pressedOpacity","_props_restOpacity1","control","useG9Control","press","useG9Press","ms","g9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AG,IAAI,CAAC;IAC7C,mDAAmD;IACnD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,qGAAqG;IACrG,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,sGAAsG;IACtG,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,wGAAwG;IACxG,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,4GAA4G;IAC5G,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CACjC;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,SAAS,CA2FxD"}
|
package/dist/button/button.jsx
CHANGED
|
@@ -8,7 +8,17 @@ import { useG9Theme } from "../provider/hooks.jsx";
|
|
|
8
8
|
import { buttonSizePreset, fontAttributesStyle, resolveButtonPaint } from "./visuals.jsx";
|
|
9
9
|
function G9Button(props) {
|
|
10
10
|
var _props_size, _props_variant, _props_loadingText, _props_text, _props_accessibilityLabel, _ref, _props_accessibilityLabel1, _props_spinnerColor, _props_fontAttributes;
|
|
11
|
-
const control = useG9Control(props, 'g9-button'
|
|
11
|
+
const control = useG9Control(props, 'g9-button', {
|
|
12
|
+
kind: 'button',
|
|
13
|
+
label: ()=>{
|
|
14
|
+
var _props_accessibilityLabel;
|
|
15
|
+
return null != (_props_accessibilityLabel = props.accessibilityLabel) ? _props_accessibilityLabel : props.text;
|
|
16
|
+
},
|
|
17
|
+
enabled: ()=>enabled && !loading,
|
|
18
|
+
capabilities: {
|
|
19
|
+
activate: ()=>press()
|
|
20
|
+
}
|
|
21
|
+
});
|
|
12
22
|
const theme = useG9Theme();
|
|
13
23
|
const loading = true === props.isLoading;
|
|
14
24
|
const enabled = !control.disabled && true !== props.blocked;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button/button.jsx","sources":["../../src/button/button.tsx"],"sourcesContent":["import './button.css';\nimport { type G9ButtonVariant, type G9ControlSize, type G9ImageSource, G9Metrics } from '@g9tm/lynxcontrols-foundation';\nimport type { ReactNode } from '@lynx-js/react';\nimport { type G9ControlBaseProps, g9RowStyle, useG9Control } from '../base/control';\nimport { useG9Press, usePressVisual } from '../base/press';\nimport { G9ActivityIndicator } from '../display/activity-indicator';\nimport type { G9IconInput } from '../icon/icon';\nimport { G9IconSlot, hasIconSlot } from '../icon/slot';\nimport { useG9Theme } from '../provider/hooks';\nimport { buttonSizePreset, fontAttributesStyle, type G9FontAttributes, resolveButtonPaint } from './visuals';\n\n/** Props of {@link G9Button} (MAUI `G9Button`). */\nexport interface G9ButtonProps extends G9ControlBaseProps {\n readonly text?: string | null;\n /** Text next to the spinner while loading; empty shows the spinner only. */\n readonly loadingText?: string | null;\n /** Colour recipe. Default `'primary'`. */\n readonly variant?: G9ButtonVariant;\n /** Height, padding and font preset. Default `'medium'` (44). */\n readonly size?: G9ControlSize;\n readonly leadingEmoji?: string | null;\n readonly leadingIcon?: G9IconInput;\n readonly leadingImagePath?: string | null;\n readonly leadingImage?: G9ImageSource | null;\n readonly trailingEmoji?: string | null;\n readonly trailingIcon?: G9IconInput;\n readonly trailingImagePath?: string | null;\n readonly trailingImage?: G9ImageSource | null;\n /** Spinner instead of the icons, presses blocked, opacity 0.7, flat fill. Default false. */\n readonly isLoading?: boolean;\n /** One line with a tail ellipsis; false keeps the text on one line at its natural width. Default true. */\n readonly textTruncation?: boolean;\n /** Icon slot and spinner size. Default 20. */\n readonly iconSize?: number;\n /** Font size; default the size preset's (12/14/15/16). */\n readonly fontSize?: number;\n /** Default `'bold'`. */\n readonly fontAttributes?: G9FontAttributes;\n /** Overrides the variant fill (transparent → no fill and no border). */\n readonly baseBackgroundColor?: string | null;\n /** Overrides the text, icon and spinner colour. */\n readonly textColor?: string | null;\n /** The press (MAUI `Clicked` + `Command`): exactly once per tap, never while disabled or loading. */\n readonly onPress?: () => void;\n /** Spinner colour; default the text colour (MAUI `G9SafeButton.SpinnerColor`, which MAUI ignored). */\n readonly spinnerColor?: string;\n /** Blocks presses like `disabled` (dims to 0.38) without being `disabled` (safe buttons while busy). */\n readonly blocked?: boolean;\n /** Height in dp instead of the size preset's (MAUI `HeightRequest` set after the preset, e.g. 46 or 50). */\n readonly heightRequest?: number;\n}\n\n/**\n * Text button (MAUI `G9Button`): variant fill (gradient for the solid variants), 12 px corners, no shadow, optional\n * leading/trailing icons, loading state with a spinner. One press handler on the root: a tap on the icon or the label\n * fires `onPress` once (MAUI \"press must fire\"); a second tap within 300 ms is dropped; a throwing handler is\n * reported to diagnostics. Press feedback: scale 0.96 (80 ms) → 1 (150 ms) on the main thread.\n */\nexport function G9Button(props: G9ButtonProps): ReactNode {\n const control = useG9Control(props, 'g9-button');\n const theme = useG9Theme();\n const loading = props.isLoading === true;\n const enabled = !control.disabled && props.blocked !== true;\n const preset = buttonSizePreset(props.size ?? 'medium');\n const height = props.heightRequest && props.heightRequest > 0 ? props.heightRequest : preset.height;\n const paint = resolveButtonPaint({\n variant: props.variant ?? 'primary',\n palette: theme.palette,\n enabled,\n loading,\n baseBackgroundColor: props.baseBackgroundColor,\n textColor: props.textColor,\n kind: 'button',\n });\n const iconSize = props.iconSize && props.iconSize > 0 ? props.iconSize : G9Metrics.InputIconSize;\n const press = useG9Press(props.onPress, { blocked: !enabled || loading, source: 'G9Button' });\n const visual = usePressVisual(\n { property: 'scale', rest: 1, pressed: 0.96, inMs: 80, outMs: 150 },\n !enabled || loading,\n );\n const leading = {\n emoji: props.leadingEmoji,\n icon: props.leadingIcon,\n imagePath: props.leadingImagePath,\n image: props.leadingImage,\n };\n const trailing = {\n emoji: props.trailingEmoji,\n icon: props.trailingIcon,\n imagePath: props.trailingImagePath,\n image: props.trailingImage,\n };\n const label = loading ? (props.loadingText ?? '') : (props.text ?? '');\n const truncate = props.textTruncation !== false;\n return (\n <view\n className={`${control.className}${preset.fill ? ' g9-button--fill' : ''}`}\n {...control.idProps}\n accessibility-element={true}\n accessibility-traits=\"button\"\n {...((props.accessibilityLabel ?? props.text)\n ? { 'accessibility-label': props.accessibilityLabel ?? props.text ?? '' }\n : {})}\n style={{\n ...g9RowStyle(control.direction),\n // MAUI ApplySize: HeightRequest = the preset (52 hero, 44 medium…), the padding a margin around the row — the\n // button never grows with its label (a min-height let hero buttons grow to ~57 dp from the 16 px padding).\n minHeight: `${height}px`,\n height: `${height}px`,\n background: paint.background,\n borderColor: paint.stroke,\n borderWidth: `${paint.strokeWidth}px`,\n borderRadius: `${G9Metrics.RadiusMd}px`,\n opacity: paint.opacity,\n paddingLeft: `${preset.paddingHorizontal}px`,\n paddingRight: `${preset.paddingHorizontal}px`,\n paddingTop: '0px',\n paddingBottom: '0px',\n }}\n bindtap={press}\n {...visual}\n >\n {loading ? (\n <G9ActivityIndicator running size={iconSize} color={props.spinnerColor ?? paint.text} />\n ) : hasIconSlot(leading) ? (\n <G9IconSlot {...leading} size={iconSize} color={paint.text} />\n ) : null}\n {label.trim() !== '' ? (\n <text\n className=\"g9-button__label\"\n {...(truncate ? { 'text-maxline': '1' } : {})}\n style={{\n color: paint.text,\n fontSize: `${props.fontSize && props.fontSize > 0 ? props.fontSize : preset.fontSize}px`,\n ...fontAttributesStyle(props.fontAttributes ?? 'bold'),\n ...(truncate ? { textOverflow: 'ellipsis', overflow: 'hidden' } : { whiteSpace: 'nowrap' }),\n }}\n >\n {label}\n </text>\n ) : null}\n {!loading && hasIconSlot(trailing) ? <G9IconSlot {...trailing} size={iconSize} color={paint.text} /> : null}\n </view>\n );\n}\n"],"names":["G9Button","props","_props_size","_props_variant","_props_loadingText","_props_text","_props_accessibilityLabel","_ref","_props_spinnerColor","_props_fontAttributes","control","useG9Control","theme","useG9Theme","loading","enabled","preset","buttonSizePreset","height","paint","resolveButtonPaint","iconSize","G9Metrics","press","useG9Press","visual","usePressVisual","leading","trailing","label","truncate","view","g9RowStyle","G9ActivityIndicator","hasIconSlot","G9IconSlot","text","fontAttributesStyle"],"mappings":";;;;;;;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O,EAAE,MAAMN,UAAU,OAAOF,MAAM,IAAI,MACxD,KAAK;MACT,CAACU,AAAiB,OAAjBA,MAAM,IAAI,MACRO,KACC,UAAU,oBACT,GAAIN,WAAW;QAAE,gBAAgB;IAAI,IAAI,CAAC,CAAC,EAC5C,OAAO;QACL,OAAOX,MAAM,IAAI;QACjB,UAAU,GAAGlB,MAAM,QAAQ,IAAIA,MAAM,QAAQ,GAAG,IAAIA,MAAM,QAAQ,GAAGe,OAAO,QAAQ,CAAC,EAAE,CAAC;QACxF,GAAGqB,oBAAoB,QAAA5B,CAAAA,wBAAAA,MAAM,cAAc,AAAD,IAAnBA,wBAAwB,OAAO;QACtD,GAAIqB,WAAW;YAAE,cAAc;YAAY,UAAU;QAAS,IAAI;YAAE,YAAY;QAAS,CAAC;IAC5F,GACD;UACC,CAACD,MAAM;QACT,EAAEO,QACA,KAAK;MACT,CAAC,CAACtB,WAAWoB,YAAYN,aAAaO,YAAY,GAAGP,QAAQ,EAAE,MAAMP,UAAU,OAAOF,MAAM,IAAI,MAAO,KAAK;IAC9G,EAAEY;AAEN"}
|
|
1
|
+
{"version":3,"file":"button/button.jsx","sources":["../../src/button/button.tsx"],"sourcesContent":["import './button.css';\nimport { type G9ButtonVariant, type G9ControlSize, type G9ImageSource, G9Metrics } from '@g9tm/lynxcontrols-foundation';\nimport type { ReactNode } from '@lynx-js/react';\nimport { type G9ControlBaseProps, g9RowStyle, useG9Control } from '../base/control';\nimport { useG9Press, usePressVisual } from '../base/press';\nimport { G9ActivityIndicator } from '../display/activity-indicator';\nimport type { G9IconInput } from '../icon/icon';\nimport { G9IconSlot, hasIconSlot } from '../icon/slot';\nimport { useG9Theme } from '../provider/hooks';\nimport { buttonSizePreset, fontAttributesStyle, type G9FontAttributes, resolveButtonPaint } from './visuals';\n\n/** Props of {@link G9Button} (MAUI `G9Button`). */\nexport interface G9ButtonProps extends G9ControlBaseProps {\n readonly text?: string | null;\n /** Text next to the spinner while loading; empty shows the spinner only. */\n readonly loadingText?: string | null;\n /** Colour recipe. Default `'primary'`. */\n readonly variant?: G9ButtonVariant;\n /** Height, padding and font preset. Default `'medium'` (44). */\n readonly size?: G9ControlSize;\n readonly leadingEmoji?: string | null;\n readonly leadingIcon?: G9IconInput;\n readonly leadingImagePath?: string | null;\n readonly leadingImage?: G9ImageSource | null;\n readonly trailingEmoji?: string | null;\n readonly trailingIcon?: G9IconInput;\n readonly trailingImagePath?: string | null;\n readonly trailingImage?: G9ImageSource | null;\n /** Spinner instead of the icons, presses blocked, opacity 0.7, flat fill. Default false. */\n readonly isLoading?: boolean;\n /** One line with a tail ellipsis; false keeps the text on one line at its natural width. Default true. */\n readonly textTruncation?: boolean;\n /** Icon slot and spinner size. Default 20. */\n readonly iconSize?: number;\n /** Font size; default the size preset's (12/14/15/16). */\n readonly fontSize?: number;\n /** Default `'bold'`. */\n readonly fontAttributes?: G9FontAttributes;\n /** Overrides the variant fill (transparent → no fill and no border). */\n readonly baseBackgroundColor?: string | null;\n /** Overrides the text, icon and spinner colour. */\n readonly textColor?: string | null;\n /** The press (MAUI `Clicked` + `Command`): exactly once per tap, never while disabled or loading. */\n readonly onPress?: () => void;\n /** Spinner colour; default the text colour (MAUI `G9SafeButton.SpinnerColor`, which MAUI ignored). */\n readonly spinnerColor?: string;\n /** Blocks presses like `disabled` (dims to 0.38) without being `disabled` (safe buttons while busy). */\n readonly blocked?: boolean;\n /** Height in dp instead of the size preset's (MAUI `HeightRequest` set after the preset, e.g. 46 or 50). */\n readonly heightRequest?: number;\n}\n\n/**\n * Text button (MAUI `G9Button`): variant fill (gradient for the solid variants), 12 px corners, no shadow, optional\n * leading/trailing icons, loading state with a spinner. One press handler on the root: a tap on the icon or the label\n * fires `onPress` once (MAUI \"press must fire\"); a second tap within 300 ms is dropped; a throwing handler is\n * reported to diagnostics. Press feedback: scale 0.96 (80 ms) → 1 (150 ms) on the main thread.\n */\nexport function G9Button(props: G9ButtonProps): ReactNode {\n const control = useG9Control(props, 'g9-button', {\n kind: 'button',\n label: () => props.accessibilityLabel ?? props.text,\n enabled: () => enabled && !loading,\n capabilities: { activate: () => press() },\n });\n const theme = useG9Theme();\n const loading = props.isLoading === true;\n const enabled = !control.disabled && props.blocked !== true;\n const preset = buttonSizePreset(props.size ?? 'medium');\n const height = props.heightRequest && props.heightRequest > 0 ? props.heightRequest : preset.height;\n const paint = resolveButtonPaint({\n variant: props.variant ?? 'primary',\n palette: theme.palette,\n enabled,\n loading,\n baseBackgroundColor: props.baseBackgroundColor,\n textColor: props.textColor,\n kind: 'button',\n });\n const iconSize = props.iconSize && props.iconSize > 0 ? props.iconSize : G9Metrics.InputIconSize;\n const press = useG9Press(props.onPress, { blocked: !enabled || loading, source: 'G9Button' });\n const visual = usePressVisual(\n { property: 'scale', rest: 1, pressed: 0.96, inMs: 80, outMs: 150 },\n !enabled || loading,\n );\n const leading = {\n emoji: props.leadingEmoji,\n icon: props.leadingIcon,\n imagePath: props.leadingImagePath,\n image: props.leadingImage,\n };\n const trailing = {\n emoji: props.trailingEmoji,\n icon: props.trailingIcon,\n imagePath: props.trailingImagePath,\n image: props.trailingImage,\n };\n const label = loading ? (props.loadingText ?? '') : (props.text ?? '');\n const truncate = props.textTruncation !== false;\n return (\n <view\n className={`${control.className}${preset.fill ? ' g9-button--fill' : ''}`}\n {...control.idProps}\n accessibility-element={true}\n accessibility-traits=\"button\"\n {...((props.accessibilityLabel ?? props.text)\n ? { 'accessibility-label': props.accessibilityLabel ?? props.text ?? '' }\n : {})}\n style={{\n ...g9RowStyle(control.direction),\n // MAUI ApplySize: HeightRequest = the preset (52 hero, 44 medium…), the padding a margin around the row — the\n // button never grows with its label (a min-height let hero buttons grow to ~57 dp from the 16 px padding).\n minHeight: `${height}px`,\n height: `${height}px`,\n background: paint.background,\n borderColor: paint.stroke,\n borderWidth: `${paint.strokeWidth}px`,\n borderRadius: `${G9Metrics.RadiusMd}px`,\n opacity: paint.opacity,\n paddingLeft: `${preset.paddingHorizontal}px`,\n paddingRight: `${preset.paddingHorizontal}px`,\n paddingTop: '0px',\n paddingBottom: '0px',\n }}\n bindtap={press}\n {...visual}\n >\n {loading ? (\n <G9ActivityIndicator running size={iconSize} color={props.spinnerColor ?? paint.text} />\n ) : hasIconSlot(leading) ? (\n <G9IconSlot {...leading} size={iconSize} color={paint.text} />\n ) : null}\n {label.trim() !== '' ? (\n <text\n className=\"g9-button__label\"\n {...(truncate ? { 'text-maxline': '1' } : {})}\n style={{\n color: paint.text,\n fontSize: `${props.fontSize && props.fontSize > 0 ? props.fontSize : preset.fontSize}px`,\n ...fontAttributesStyle(props.fontAttributes ?? 'bold'),\n ...(truncate ? { textOverflow: 'ellipsis', overflow: 'hidden' } : { whiteSpace: 'nowrap' }),\n }}\n >\n {label}\n </text>\n ) : null}\n {!loading && hasIconSlot(trailing) ? <G9IconSlot {...trailing} size={iconSize} color={paint.text} /> : null}\n </view>\n );\n}\n"],"names":["G9Button","props","_props_size","_props_variant","_props_loadingText","_props_text","_props_accessibilityLabel","_ref","_props_spinnerColor","_props_fontAttributes","control","useG9Control","enabled","loading","press","theme","useG9Theme","preset","buttonSizePreset","height","paint","resolveButtonPaint","iconSize","G9Metrics","useG9Press","visual","usePressVisual","leading","trailing","label","truncate","view","g9RowStyle","G9ActivityIndicator","hasIconSlot","G9IconSlot","text","fontAttributesStyle"],"mappings":";;;;;;;;AA0DO,SAASA,SAASC,KAAoB;QAUXC,aAGrBC,gBA0BcC,oBAA4BC,aAQ3CC,2BACuBC,MAAAA,4BAsByBC,qBAWzBC;IAhFjC,MAAMC,UAAUC,aAAaV,OAAO,aAAa;QAC/C,MAAM;QACN,OAAO;gBAAMK;2BAAAA,CAAAA,4BAAAA,MAAM,kBAAkB,AAAD,IAAvBA,4BAA4BL,MAAM,IAAI;;QACnD,SAAS,IAAMW,WAAW,CAACC;QAC3B,cAAc;YAAE,UAAU,IAAMC;QAAQ;IAC1C;IACA,MAAMC,QAAQC;IACd,MAAMH,UAAUZ,AAAoB,SAApBA,MAAM,SAAS;I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IAAI,CAAC;IAC1C,2CAA2C;IAC3C,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,sEAAsE;IACtE,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,0CAA0C;IAC1C,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,+CAA+C;IAC/C,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;IACnC;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,6DAA6D;IAC7D,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;IAChC,kBAAkB;IAClB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,mEAAmE;IACnE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CAC/B;AAED,8GAA8G;AAC9G,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,GAAG,SAAS,CA4DhF"}
|
|
@@ -9,7 +9,16 @@ const g9ToolbarIconSize = 24;
|
|
|
9
9
|
const g9ToolbarButtonSize = 42;
|
|
10
10
|
function G9HeaderActionButton(props) {
|
|
11
11
|
var _props_iconSize, _props_buttonText, _props_icon, _props_accessibilityLabel, _props_accessibilityLabel1;
|
|
12
|
-
const control = useG9Control(props, 'g9-header-action'
|
|
12
|
+
const control = useG9Control(props, 'g9-header-action', {
|
|
13
|
+
kind: 'button',
|
|
14
|
+
label: ()=>{
|
|
15
|
+
var _props_accessibilityLabel;
|
|
16
|
+
return null != (_props_accessibilityLabel = props.accessibilityLabel) ? _props_accessibilityLabel : text1;
|
|
17
|
+
},
|
|
18
|
+
capabilities: {
|
|
19
|
+
activate: ()=>press()
|
|
20
|
+
}
|
|
21
|
+
});
|
|
13
22
|
const palette = useG9Theme().palette;
|
|
14
23
|
const busy = true === props.isBusy;
|
|
15
24
|
const active = true === props.isActive;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button/header-action-button.jsx","sources":["../../src/button/header-action-button.tsx"],"sourcesContent":["import './button.css';\nimport { formatColor, G9Glyph, type G9ImageSource, withAlpha } from '@g9tm/lynxcontrols-foundation';\nimport type { ReactNode } from '@lynx-js/react';\nimport { type G9ControlBaseProps, useG9Control } from '../base/control';\nimport { useG9Press, usePressVisual } from '../base/press';\nimport { G9ActivityIndicator } from '../display/activity-indicator';\nimport type { G9IconInput } from '../icon/icon';\nimport { G9IconSlot } from '../icon/slot';\nimport { useG9Theme } from '../provider/hooks';\n\n/** MAUI `G9LayoutMetrics.ToolbarIconSize` / `ToolbarButtonSize`. */\nexport const g9ToolbarIconSize = 24;\n/** Touch box of a toolbar / header action button (MAUI `G9LayoutMetrics.ToolbarButtonSize`). */\nexport const g9ToolbarButtonSize = 42;\n\n/** Props of {@link G9HeaderActionButton} (MAUI `G9HeaderActionButton`). */\nexport interface G9HeaderActionButtonProps extends G9ControlBaseProps {\n /** Glyph shown when there is no image and no text. Default `G9Glyph.Menu`. */\n readonly icon?: G9IconInput;\n /** Image; wins over text and glyph. */\n readonly iconImage?: G9ImageSource | null;\n /** Bold 13 label (wins over the glyph). */\n readonly buttonText?: string | null;\n /** Spinner instead of the content; presses blocked. Default false. */\n readonly isBusy?: boolean;\n /** Tinted active state. Default false. */\n readonly isActive?: boolean;\n /** The 8 px dot while active. Default true. */\n readonly showActiveBadge?: boolean;\n /**\n * A COUNT on the action (MAUI 1.4.9 `BadgeText`, AgriPad's «۲» active filters): a 16 px Primary pill with this text\n * over the icon's top end corner, shown whenever it is set — the active dot gives way to it. Null / empty: the dot rules.\n */\n readonly badgeText?: string | null;\n /** Scale 0.92 (70 ms) → 1 (90 ms) on press. Default true. */\n readonly animatePress?: boolean;\n /** Default 24. */\n readonly iconSize?: number;\n /** Square size; ≤ 0 → 42 (MAUI `ToolbarButtonSize`). Default 0. */\n readonly buttonSize?: number;\n readonly onPress?: () => void;\n}\n\n/** Toolbar/header action (MAUI `G9HeaderActionButton`): bordered square with a glyph, image or short text. */\nexport function G9HeaderActionButton(props: G9HeaderActionButtonProps): ReactNode {\n const control = useG9Control(props, 'g9-header-action');\n const palette = useG9Theme().palette;\n const busy = props.isBusy === true;\n const active = props.isActive === true;\n const size = props.buttonSize && props.buttonSize > 0 ? props.buttonSize : g9ToolbarButtonSize;\n const iconSize = props.iconSize ?? g9ToolbarIconSize;\n const press = useG9Press(props.onPress, { blocked: control.disabled || busy, source: 'G9HeaderActionButton' });\n const visual = usePressVisual(\n { property: 'scale', rest: 1, pressed: 0.92, inMs: 70, outMs: 90 },\n control.disabled || busy || props.animatePress === false,\n );\n const text = props.buttonText ?? '';\n const badge = props.badgeText != null && props.badgeText !== '' ? props.badgeText : null;\n let content: ReactNode;\n if (busy) content = <G9ActivityIndicator running size={20} color=\"var(--g9-on-surface-variant)\" />;\n else if (props.iconImage) content = <G9IconSlot image={props.iconImage} size={iconSize} />;\n else if (text.trim() !== '') content = <text className=\"g9-header-action__text\">{text}</text>;\n else content = <G9IconSlot icon={props.icon ?? G9Glyph.Menu} size={iconSize} color=\"var(--g9-on-surface-variant)\" />;\n return (\n <view\n className={control.className}\n {...control.idProps}\n style={{\n width: `${size}px`,\n height: `${size}px`,\n opacity: control.disabled || busy ? 0.5 : 1,\n ...(active\n ? {\n backgroundColor: formatColor(withAlpha(palette.Primary, 0.12)),\n borderColor: formatColor(withAlpha(palette.Primary, 0.38)),\n }\n : {}),\n }}\n accessibility-element={true}\n accessibility-traits=\"button\"\n {...((props.accessibilityLabel ?? (text || undefined))\n ? { 'accessibility-label': props.accessibilityLabel ?? text }\n : {})}\n bindtap={press}\n {...visual}\n >\n {content}\n {badge ? (\n <view\n className=\"g9-header-action__count\"\n user-interaction-enabled={false}\n style={{ [control.direction === 'rtl' ? 'left' : 'right']: '2px' }}\n >\n <text className=\"g9-header-action__count-text\">{badge}</text>\n </view>\n ) : active && props.showActiveBadge !== false ? (\n <view className=\"g9-header-action__badge\" style={{ [control.direction === 'rtl' ? 'left' : 'right']: '6px' }} />\n ) : null}\n </view>\n );\n}\n"],"names":["g9ToolbarIconSize","g9ToolbarButtonSize","G9HeaderActionButton","props","_props_iconSize","_props_buttonText","_props_icon","_props_accessibilityLabel","_props_accessibilityLabel1","control","useG9Control","palette","useG9Theme","busy","active","size","iconSize","
|
|
1
|
+
{"version":3,"file":"button/header-action-button.jsx","sources":["../../src/button/header-action-button.tsx"],"sourcesContent":["import './button.css';\nimport { formatColor, G9Glyph, type G9ImageSource, withAlpha } from '@g9tm/lynxcontrols-foundation';\nimport type { ReactNode } from '@lynx-js/react';\nimport { type G9ControlBaseProps, useG9Control } from '../base/control';\nimport { useG9Press, usePressVisual } from '../base/press';\nimport { G9ActivityIndicator } from '../display/activity-indicator';\nimport type { G9IconInput } from '../icon/icon';\nimport { G9IconSlot } from '../icon/slot';\nimport { useG9Theme } from '../provider/hooks';\n\n/** MAUI `G9LayoutMetrics.ToolbarIconSize` / `ToolbarButtonSize`. */\nexport const g9ToolbarIconSize = 24;\n/** Touch box of a toolbar / header action button (MAUI `G9LayoutMetrics.ToolbarButtonSize`). */\nexport const g9ToolbarButtonSize = 42;\n\n/** Props of {@link G9HeaderActionButton} (MAUI `G9HeaderActionButton`). */\nexport interface G9HeaderActionButtonProps extends G9ControlBaseProps {\n /** Glyph shown when there is no image and no text. Default `G9Glyph.Menu`. */\n readonly icon?: G9IconInput;\n /** Image; wins over text and glyph. */\n readonly iconImage?: G9ImageSource | null;\n /** Bold 13 label (wins over the glyph). */\n readonly buttonText?: string | null;\n /** Spinner instead of the content; presses blocked. Default false. */\n readonly isBusy?: boolean;\n /** Tinted active state. Default false. */\n readonly isActive?: boolean;\n /** The 8 px dot while active. Default true. */\n readonly showActiveBadge?: boolean;\n /**\n * A COUNT on the action (MAUI 1.4.9 `BadgeText`, AgriPad's «۲» active filters): a 16 px Primary pill with this text\n * over the icon's top end corner, shown whenever it is set — the active dot gives way to it. Null / empty: the dot rules.\n */\n readonly badgeText?: string | null;\n /** Scale 0.92 (70 ms) → 1 (90 ms) on press. Default true. */\n readonly animatePress?: boolean;\n /** Default 24. */\n readonly iconSize?: number;\n /** Square size; ≤ 0 → 42 (MAUI `ToolbarButtonSize`). Default 0. */\n readonly buttonSize?: number;\n readonly onPress?: () => void;\n}\n\n/** Toolbar/header action (MAUI `G9HeaderActionButton`): bordered square with a glyph, image or short text. */\nexport function G9HeaderActionButton(props: G9HeaderActionButtonProps): ReactNode {\n const control = useG9Control(props, 'g9-header-action', {\n kind: 'button',\n label: () => props.accessibilityLabel ?? text,\n capabilities: { activate: () => press() },\n });\n const palette = useG9Theme().palette;\n const busy = props.isBusy === true;\n const active = props.isActive === true;\n const size = props.buttonSize && props.buttonSize > 0 ? props.buttonSize : g9ToolbarButtonSize;\n const iconSize = props.iconSize ?? g9ToolbarIconSize;\n const press = useG9Press(props.onPress, { blocked: control.disabled || busy, source: 'G9HeaderActionButton' });\n const visual = usePressVisual(\n { property: 'scale', rest: 1, pressed: 0.92, inMs: 70, outMs: 90 },\n control.disabled || busy || props.animatePress === false,\n );\n const text = props.buttonText ?? '';\n const badge = props.badgeText != null && props.badgeText !== '' ? props.badgeText : null;\n let content: ReactNode;\n if (busy) content = <G9ActivityIndicator running size={20} color=\"var(--g9-on-surface-variant)\" />;\n else if (props.iconImage) content = <G9IconSlot image={props.iconImage} size={iconSize} />;\n else if (text.trim() !== '') content = <text className=\"g9-header-action__text\">{text}</text>;\n else content = <G9IconSlot icon={props.icon ?? G9Glyph.Menu} size={iconSize} color=\"var(--g9-on-surface-variant)\" />;\n return (\n <view\n className={control.className}\n {...control.idProps}\n style={{\n width: `${size}px`,\n height: `${size}px`,\n opacity: control.disabled || busy ? 0.5 : 1,\n ...(active\n ? {\n backgroundColor: formatColor(withAlpha(palette.Primary, 0.12)),\n borderColor: formatColor(withAlpha(palette.Primary, 0.38)),\n }\n : {}),\n }}\n accessibility-element={true}\n accessibility-traits=\"button\"\n {...((props.accessibilityLabel ?? (text || undefined))\n ? { 'accessibility-label': props.accessibilityLabel ?? text }\n : {})}\n bindtap={press}\n {...visual}\n >\n {content}\n {badge ? (\n <view\n className=\"g9-header-action__count\"\n user-interaction-enabled={false}\n style={{ [control.direction === 'rtl' ? 'left' : 'right']: '2px' }}\n >\n <text className=\"g9-header-action__count-text\">{badge}</text>\n </view>\n ) : active && props.showActiveBadge !== false ? (\n <view className=\"g9-header-action__badge\" style={{ [control.direction === 'rtl' ? 'left' : 'right']: '6px' }} />\n ) : null}\n </view>\n );\n}\n"],"names":["g9ToolbarIconSize","g9ToolbarButtonSize","G9HeaderActionButton","props","_props_iconSize","_props_buttonText","_props_icon","_props_accessibilityLabel","_props_accessibilityLabel1","control","useG9Control","text1","press","palette","useG9Theme","busy","active","size","iconSize","useG9Press","visual","usePressVisual","badge","content","G9ActivityIndicator","G9IconSlot","text","G9Glyph","view","formatColor","withAlpha","undefined"],"mappings":";;;;;;;AAWO,MAAMA,oBAAoB;AAE1B,MAAMC,sBAAsB;AA+B5B,SAASC,qBAAqBC,KAAgC;QAUlDC,iBAMJC,mBAMoBC,aAkBvBC,2BACuBC;IAxCjC,MAAMC,UAAUC,aAAaP,OAAO,oBAAoB;QACtD,MAAM;QACN,OAAO;gBAAMI;2BAAAA,CAAAA,4BAAAA,MAAM,kBAAkB,AAAD,IAAvBA,4BAA4BI;;QACzC,cAAc;YAAE,UAAU,IAAMC;QAAQ;IAC1C;IACA,MAAMC,UAAUC,aAAa,OAAO;IACpC,MAAMC,OAAOZ,AAAiB,SAAjBA,MAAM,MAAM;IACzB,MAAMa,SAASb,AAAmB,SAAnBA,MAAM,QAAQ;IAC7B,MAAMc,OAAOd,MAAM,UAAU,IAAIA,MAAM,UAAU,GAAG,IAAIA,MAAM,UAAU,GAAGF;IAC3E,MAAMiB,WAAW,QAAAd,CAAAA,kBAAAA,MAAM,QAAQ,AAAD,IAAbA,kBAAkBJ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AAO,CAAC;IAChC,iCAAiC;IACjC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,oBAAoB;IACpB,QAAQ,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IACxC,uFAAuF;IACvF,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3C,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,SAAS,CAgFhE"}
|
|
@@ -9,7 +9,17 @@ import { useG9Strings, useG9Theme } from "../provider/hooks.jsx";
|
|
|
9
9
|
import { resolveButtonPaint } from "./visuals.jsx";
|
|
10
10
|
function G9IconButton(props) {
|
|
11
11
|
var _props_variant, _props_textColor, _props_minimumTouchTarget, _props_accessibilityText, _props_badgeText;
|
|
12
|
-
const control = useG9Control(props, 'g9-icon-button'
|
|
12
|
+
const control = useG9Control(props, 'g9-icon-button', {
|
|
13
|
+
kind: 'button',
|
|
14
|
+
label: ()=>{
|
|
15
|
+
var _props_accessibilityText;
|
|
16
|
+
return null != (_props_accessibilityText = props.accessibilityText) ? _props_accessibilityText : props.accessibilityLabel;
|
|
17
|
+
},
|
|
18
|
+
enabled: ()=>enabled && !loading,
|
|
19
|
+
capabilities: {
|
|
20
|
+
activate: ()=>press()
|
|
21
|
+
}
|
|
22
|
+
});
|
|
13
23
|
const theme = useG9Theme();
|
|
14
24
|
const strings = useG9Strings();
|
|
15
25
|
const loading = true === props.isLoading;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button/icon-button.jsx","sources":["../../src/button/icon-button.tsx"],"sourcesContent":["import './button.css';\nimport { type G9ButtonVariant, type G9ImageSource, G9Metrics, G9StringKey } from '@g9tm/lynxcontrols-foundation';\nimport type { ReactNode } from '@lynx-js/react';\nimport { type G9ControlBaseProps, useG9Control } from '../base/control';\nimport { G9CornerBadge } from '../base/corner-badge';\nimport { useG9Press, usePressVisual } from '../base/press';\nimport { G9ActivityIndicator } from '../display/activity-indicator';\nimport type { G9IconInput } from '../icon/icon';\nimport { G9IconSlot } from '../icon/slot';\nimport { useG9Strings, useG9Theme } from '../provider/hooks';\nimport { resolveButtonPaint } from './visuals';\n\n/** Props of {@link G9IconButton} (MAUI `G9IconButton`). */\nexport interface G9IconButtonProps extends G9ControlBaseProps {\n readonly emoji?: string | null;\n readonly icon?: G9IconInput;\n readonly imagePath?: string | null;\n readonly image?: G9ImageSource | null;\n /** Icon and spinner size; ≤ 0 → 20. Default 20. */\n readonly iconSize?: number;\n /** Square frame size; ≤ 0 → 40. Default 40. */\n readonly buttonSize?: number;\n /** Transparent, no stroke, icon in `textSecondary`. Default false. */\n readonly isGhost?: boolean;\n /** Default `'surface'`. */\n readonly variant?: G9ButtonVariant;\n /** Fully round instead of 12 px corners. Default false. */\n readonly isCircular?: boolean;\n /** Measured (touch) size when larger than the drawn frame; the frame stays centred. Default 0. */\n readonly minimumTouchTarget?: number;\n readonly baseBackgroundColor?: string | null;\n /** Icon colour override. */\n readonly textColor?: string | null;\n readonly isLoading?: boolean;\n /** Count badge on the top-trailing corner; wins over the dot. */\n readonly badgeText?: string | null;\n readonly showBadgeDot?: boolean;\n /** Default `var(--g9-error)`. */\n readonly badgeColor?: string | null;\n /** Default true. */\n readonly mirrorBadgeTextInRtl?: boolean;\n /** Accessibility name (MAUI `AccessibilityText`); `accessibilityLabel` is an alias. */\n readonly accessibilityText?: string | null;\n readonly onPress?: () => void;\n readonly blocked?: boolean;\n}\n\n/**\n * Square icon button (MAUI `G9IconButton`): one icon, variant/ghost fill, optional circle, corner badge that is never\n * dimmed (opacity applies to the frame only), loading spinner, minimum touch target. Press: one handler on the root,\n * scale 0.82 (80 ms) → 1 (150 ms). Accessibility hint: \"Loading\" while loading, else the badge text.\n */\nexport function G9IconButton(props: G9IconButtonProps): ReactNode {\n const control = useG9Control(props, 'g9-icon-button');\n const theme = useG9Theme();\n const strings = useG9Strings();\n const loading = props.isLoading === true;\n const enabled = !control.disabled && props.blocked !== true;\n const size = props.buttonSize && props.buttonSize > 0 ? props.buttonSize : 40;\n const iconSize = props.iconSize && props.iconSize > 0 ? props.iconSize : G9Metrics.InputIconSize;\n const ghost = props.isGhost === true;\n const paint = resolveButtonPaint({\n variant: props.variant ?? 'surface',\n palette: theme.palette,\n enabled,\n loading,\n baseBackgroundColor: ghost ? 'rgba(0,0,0,0)' : props.baseBackgroundColor,\n textColor: props.textColor ?? (ghost ? theme.palette.TextSecondary : null),\n kind: 'icon',\n });\n const press = useG9Press(props.onPress, { blocked: !enabled || loading, source: 'G9IconButton' });\n const visual = usePressVisual(\n { property: 'scale', rest: 1, pressed: 0.82, inMs: 80, outMs: 150 },\n !enabled || loading,\n );\n const touch = Math.max(props.minimumTouchTarget ?? 0, size);\n const name = props.accessibilityText ?? props.accessibilityLabel;\n const hint = loading ? strings.get(G9StringKey.Loading) : (props.badgeText ?? undefined);\n return (\n <view\n className={control.className}\n {...control.idProps}\n style={{ minWidth: `${touch}px`, minHeight: `${touch}px` }}\n accessibility-element={true}\n accessibility-traits=\"button\"\n {...(name ? { 'accessibility-label': name } : {})}\n {...(hint ? { 'accessibility-value': hint } : {})}\n bindtap={press}\n {...visual}\n >\n <view className=\"g9-icon-button__host\">\n <view\n className=\"g9-icon-button__frame\"\n style={{\n width: `${size}px`,\n height: `${size}px`,\n background: paint.background,\n borderColor: paint.stroke,\n borderWidth: `${paint.strokeWidth}px`,\n borderRadius: `${props.isCircular ? size / 2 : G9Metrics.RadiusMd}px`,\n opacity: paint.opacity,\n }}\n >\n {loading ? (\n <G9ActivityIndicator running size={iconSize} color={paint.text} />\n ) : (\n <G9IconSlot\n emoji={props.emoji}\n icon={props.icon}\n imagePath={props.imagePath}\n image={props.image}\n size={iconSize}\n color={paint.text}\n />\n )}\n </view>\n <G9CornerBadge\n text={props.badgeText}\n dot={props.showBadgeDot === true}\n color={props.badgeColor}\n textColor=\"#FFFFFF\"\n ringColor={ghost ? 'var(--g9-background)' : 'var(--g9-surface)'}\n mirrorTextInRtl={props.mirrorBadgeTextInRtl !== false}\n />\n </view>\n </view>\n );\n}\n"],"names":["G9IconButton","props","_props_variant","_props_textColor","_props_minimumTouchTarget","_props_accessibilityText","_props_badgeText","control","useG9Control","
|
|
1
|
+
{"version":3,"file":"button/icon-button.jsx","sources":["../../src/button/icon-button.tsx"],"sourcesContent":["import './button.css';\nimport { type G9ButtonVariant, type G9ImageSource, G9Metrics, G9StringKey } from '@g9tm/lynxcontrols-foundation';\nimport type { ReactNode } from '@lynx-js/react';\nimport { type G9ControlBaseProps, useG9Control } from '../base/control';\nimport { G9CornerBadge } from '../base/corner-badge';\nimport { useG9Press, usePressVisual } from '../base/press';\nimport { G9ActivityIndicator } from '../display/activity-indicator';\nimport type { G9IconInput } from '../icon/icon';\nimport { G9IconSlot } from '../icon/slot';\nimport { useG9Strings, useG9Theme } from '../provider/hooks';\nimport { resolveButtonPaint } from './visuals';\n\n/** Props of {@link G9IconButton} (MAUI `G9IconButton`). */\nexport interface G9IconButtonProps extends G9ControlBaseProps {\n readonly emoji?: string | null;\n readonly icon?: G9IconInput;\n readonly imagePath?: string | null;\n readonly image?: G9ImageSource | null;\n /** Icon and spinner size; ≤ 0 → 20. Default 20. */\n readonly iconSize?: number;\n /** Square frame size; ≤ 0 → 40. Default 40. */\n readonly buttonSize?: number;\n /** Transparent, no stroke, icon in `textSecondary`. Default false. */\n readonly isGhost?: boolean;\n /** Default `'surface'`. */\n readonly variant?: G9ButtonVariant;\n /** Fully round instead of 12 px corners. Default false. */\n readonly isCircular?: boolean;\n /** Measured (touch) size when larger than the drawn frame; the frame stays centred. Default 0. */\n readonly minimumTouchTarget?: number;\n readonly baseBackgroundColor?: string | null;\n /** Icon colour override. */\n readonly textColor?: string | null;\n readonly isLoading?: boolean;\n /** Count badge on the top-trailing corner; wins over the dot. */\n readonly badgeText?: string | null;\n readonly showBadgeDot?: boolean;\n /** Default `var(--g9-error)`. */\n readonly badgeColor?: string | null;\n /** Default true. */\n readonly mirrorBadgeTextInRtl?: boolean;\n /** Accessibility name (MAUI `AccessibilityText`); `accessibilityLabel` is an alias. */\n readonly accessibilityText?: string | null;\n readonly onPress?: () => void;\n readonly blocked?: boolean;\n}\n\n/**\n * Square icon button (MAUI `G9IconButton`): one icon, variant/ghost fill, optional circle, corner badge that is never\n * dimmed (opacity applies to the frame only), loading spinner, minimum touch target. Press: one handler on the root,\n * scale 0.82 (80 ms) → 1 (150 ms). Accessibility hint: \"Loading\" while loading, else the badge text.\n */\nexport function G9IconButton(props: G9IconButtonProps): ReactNode {\n const control = useG9Control(props, 'g9-icon-button', {\n kind: 'button',\n label: () => props.accessibilityText ?? props.accessibilityLabel,\n enabled: () => enabled && !loading,\n capabilities: { activate: () => press() },\n });\n const theme = useG9Theme();\n const strings = useG9Strings();\n const loading = props.isLoading === true;\n const enabled = !control.disabled && props.blocked !== true;\n const size = props.buttonSize && props.buttonSize > 0 ? props.buttonSize : 40;\n const iconSize = props.iconSize && props.iconSize > 0 ? props.iconSize : G9Metrics.InputIconSize;\n const ghost = props.isGhost === true;\n const paint = resolveButtonPaint({\n variant: props.variant ?? 'surface',\n palette: theme.palette,\n enabled,\n loading,\n baseBackgroundColor: ghost ? 'rgba(0,0,0,0)' : props.baseBackgroundColor,\n textColor: props.textColor ?? (ghost ? theme.palette.TextSecondary : null),\n kind: 'icon',\n });\n const press = useG9Press(props.onPress, { blocked: !enabled || loading, source: 'G9IconButton' });\n const visual = usePressVisual(\n { property: 'scale', rest: 1, pressed: 0.82, inMs: 80, outMs: 150 },\n !enabled || loading,\n );\n const touch = Math.max(props.minimumTouchTarget ?? 0, size);\n const name = props.accessibilityText ?? props.accessibilityLabel;\n const hint = loading ? strings.get(G9StringKey.Loading) : (props.badgeText ?? undefined);\n return (\n <view\n className={control.className}\n {...control.idProps}\n style={{ minWidth: `${touch}px`, minHeight: `${touch}px` }}\n accessibility-element={true}\n accessibility-traits=\"button\"\n {...(name ? { 'accessibility-label': name } : {})}\n {...(hint ? { 'accessibility-value': hint } : {})}\n bindtap={press}\n {...visual}\n >\n <view className=\"g9-icon-button__host\">\n <view\n className=\"g9-icon-button__frame\"\n style={{\n width: `${size}px`,\n height: `${size}px`,\n background: paint.background,\n borderColor: paint.stroke,\n borderWidth: `${paint.strokeWidth}px`,\n borderRadius: `${props.isCircular ? size / 2 : G9Metrics.RadiusMd}px`,\n opacity: paint.opacity,\n }}\n >\n {loading ? (\n <G9ActivityIndicator running size={iconSize} color={paint.text} />\n ) : (\n <G9IconSlot\n emoji={props.emoji}\n icon={props.icon}\n imagePath={props.imagePath}\n image={props.image}\n size={iconSize}\n color={paint.text}\n />\n )}\n </view>\n <G9CornerBadge\n text={props.badgeText}\n dot={props.showBadgeDot === true}\n color={props.badgeColor}\n textColor=\"#FFFFFF\"\n ringColor={ghost ? 'var(--g9-background)' : 'var(--g9-surface)'}\n mirrorTextInRtl={props.mirrorBadgeTextInRtl !== false}\n />\n </view>\n </view>\n );\n}\n"],"names":["G9IconButton","props","_props_variant","_props_textColor","_props_minimumTouchTarget","_props_accessibilityText","_props_badgeText","control","useG9Control","enabled","loading","press","theme","useG9Theme","strings","useG9Strings","size","iconSize","G9Metrics","ghost","paint","resolveButtonPaint","useG9Press","visual","usePressVisual","touch","Math","name","hint","G9StringKey","undefined","view","G9ActivityIndicator","G9IconSlot","G9CornerBadge"],"mappings":";;;;;;;;;AAoDO,SAASA,aAAaC,KAAwB;QAexCC,gBAKEC,kBAQUC,2BACVC,0BAC8CC;IA7B3D,MAAMC,UAAUC,aAAaP,OAAO,kBAAkB;QACpD,MAAM;QACN,OAAO;gBAAMI;2BAAAA,CAAAA,2BAAAA,MAAM,iBAAiB,AAAD,IAAtBA,2BAA2BJ,MAAM,kBAAkB;;QAChE,SAAS,IAAMQ,WAAW,CAACC;QAC3B,c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AQ,CAAC,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC;;;OAGG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IACrC,gFAAgF;IAChF,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CAC/B;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,SAAS,CAoH1D"}
|
package/dist/button/nav-card.jsx
CHANGED
|
@@ -7,7 +7,16 @@ import { G9IconSlot, hasIconSlot } from "../icon/slot.jsx";
|
|
|
7
7
|
import { useG9Settings, useG9Strings, useG9Theme } from "../provider/hooks.jsx";
|
|
8
8
|
function G9NavCard(props) {
|
|
9
9
|
var _props_accessibilityLabel, _props_accessibilityLabel1, _props_valueColor;
|
|
10
|
-
const control = useG9Control(props, 'g9-nav-card'
|
|
10
|
+
const control = useG9Control(props, 'g9-nav-card', {
|
|
11
|
+
kind: 'card',
|
|
12
|
+
label: ()=>{
|
|
13
|
+
var _props_accessibilityLabel;
|
|
14
|
+
return null != (_props_accessibilityLabel = props.accessibilityLabel) ? _props_accessibilityLabel : label;
|
|
15
|
+
},
|
|
16
|
+
capabilities: {
|
|
17
|
+
activate: ()=>press()
|
|
18
|
+
}
|
|
19
|
+
});
|
|
11
20
|
const palette = useG9Theme().palette;
|
|
12
21
|
const glyphs = useG9Settings().glyphs;
|
|
13
22
|
const strings = useG9Strings();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button/nav-card.jsx","sources":["../../src/button/nav-card.tsx"],"sourcesContent":["import './button.css';\nimport { formatColor, type G9ImageSource, G9StringKey, mix, resolveThemeColor } from '@g9tm/lynxcontrols-foundation';\nimport type { ReactNode } from '@lynx-js/react';\nimport { type G9ControlBaseProps, g9RowStyle, g9TextStart, useG9Control } from '../base/control';\nimport { G9CornerBadge } from '../base/corner-badge';\nimport { useG9Press, usePressVisual } from '../base/press';\nimport type { G9IconInput } from '../icon/icon';\nimport { G9IconSlot, hasIconSlot } from '../icon/slot';\nimport { useG9Settings, useG9Strings, useG9Theme } from '../provider/hooks';\n\n/** Props of {@link G9NavCard} (MAUI `G9NavCard`). */\nexport interface G9NavCardProps extends G9ControlBaseProps {\n readonly title?: string | null;\n readonly subtitle?: string | null;\n /** Icon and icon-tile tint. Default the primary colour. Must be a colour literal (it is mixed). */\n readonly accentColor?: string | null;\n readonly iconEmoji?: string | null;\n readonly icon?: G9IconInput;\n readonly iconPath?: string | null;\n readonly iconImage?: G9ImageSource | null;\n /** Trailing chevron (forward in LTR, back in RTL). Default true. */\n readonly showChevron?: boolean;\n readonly valueText?: string | null;\n /** Value colour; default error when destructive, else tertiary text. */\n readonly valueColor?: string | null;\n /** Coming-soon badge instead of value and chevron; presses do nothing. Default false. */\n readonly isComingSoon?: boolean;\n /** Badge text; default the localized `comingSoon`. */\n readonly comingSoonText?: string | null;\n readonly iconBadgeText?: string | null;\n readonly showIconBadgeDot?: boolean;\n readonly iconBadgeColor?: string | null;\n /** Default true. */\n readonly mirrorBadgeTextInRtl?: boolean;\n /** Replaces the whole trailing area (value, chevron, coming-soon badge). */\n readonly trailing?: ReactNode;\n /**\n * A small node on the title's line, right after the title (a count pill, an unread dot, a \"6/10\"; MAUI 1.4.0\n * `TitleAccessoryView`). It does not take over the trailing area, so the chevron, value and coming-soon badge keep\n * working beside it. A long title truncates; the accessory never does. Unset keeps the title layout as it was.\n */\n readonly titleAccessory?: ReactNode;\n /** Title (and default value colour) in the error colour. Default false. */\n readonly isDestructive?: boolean;\n /** Tint the card background with the accent (88 % surface). Default false. */\n readonly useAccentSurface?: boolean;\n /** Accent used only for the background tint. */\n readonly cardAccentColor?: string | null;\n /**\n * Paint the icon tile solid in the accent with an `OnPrimary` icon instead of the pastel tile with an accent icon\n * (MAUI 1.4.0 `UseFilledIconChip`): the one primary row of a list. Pair with `useAccentSurface`. Default false.\n */\n readonly useFilledIconChip?: boolean;\n /** The press (MAUI `Tapped` + `Command`); not while disabled or coming soon. */\n readonly onPress?: () => void;\n}\n\n/**\n * Navigation row card (MAUI `G9NavCard`): icon tile (pastel, or filled with `useFilledIconChip`) with optional corner\n * badge, title (with an optional `titleAccessory` after it)/subtitle, value text, chevron or coming-soon badge, or a\n * custom trailing node. Press: scale 0.985 (70 ms) → 1 (120 ms); hover on desktop.\n */\nexport function G9NavCard(props: G9NavCardProps): ReactNode {\n const control = useG9Control(props, 'g9-nav-card');\n const palette = useG9Theme().palette;\n const glyphs = useG9Settings().glyphs;\n const strings = useG9Strings();\n const soon = props.isComingSoon === true;\n const destructive = props.isDestructive === true;\n // A theme reference (`var(--g9-success)`) is resolved against the live palette: the accent is mixed below, and a\n // CSS variable cannot be mixed.\n const accent = props.accentColor ? resolveThemeColor(props.accentColor, palette) : palette.Primary;\n const cardAccent = props.cardAccentColor ? resolveThemeColor(props.cardAccentColor, palette) : accent;\n const surface = props.useAccentSurface ? formatColor(mix(cardAccent, palette.Surface, 0.88)) : palette.Surface;\n const press = useG9Press(props.onPress, { blocked: control.disabled || soon, source: 'G9NavCard' });\n const visual = usePressVisual(\n { property: 'scale', rest: 1, pressed: 0.985, inMs: 70, outMs: 120 },\n control.disabled || soon,\n );\n const icon = { emoji: props.iconEmoji, icon: props.icon, imagePath: props.iconPath, image: props.iconImage };\n const subtitle = props.subtitle && props.subtitle.trim() !== '' ? props.subtitle : null;\n const value = props.valueText && props.valueText.trim() !== '' ? props.valueText : null;\n const soonText =\n props.comingSoonText && props.comingSoonText.trim() !== ''\n ? props.comingSoonText\n : strings.get(G9StringKey.ComingSoon);\n const label = [props.title, subtitle].filter(Boolean).join(', ');\n const filledChip = props.useFilledIconChip === true;\n const title = props.title ? (\n <text\n className=\"g9-nav-card__title\"\n text-maxline=\"1\"\n style={{ color: destructive ? palette.Error : palette.TextPrimary, ...g9TextStart(control.direction) }}\n >\n {props.title}\n </text>\n ) : null;\n return (\n <view\n className={control.className}\n {...control.idProps}\n style={{ backgroundColor: surface, ...g9RowStyle(control.direction) }}\n {...(props.trailing === undefined\n ? {\n 'accessibility-element': true,\n 'accessibility-traits': 'button',\n ...((props.accessibilityLabel ?? label)\n ? { 'accessibility-label': props.accessibilityLabel ?? label }\n : {}),\n ...(soon ? { 'accessibility-value': soonText } : value ? { 'accessibility-value': value } : {}),\n }\n : {})}\n bindtap={press}\n {...visual}\n >\n {hasIconSlot(icon) ? (\n <view\n className=\"g9-nav-card__tile\"\n style={{ backgroundColor: filledChip ? accent : formatColor(mix(accent, palette.Surface, 0.82)) }}\n >\n <G9IconSlot {...icon} size={props.iconEmoji ? 22 : 18} color={filledChip ? palette.OnPrimary : accent} />\n <G9CornerBadge\n text={props.iconBadgeText}\n dot={props.showIconBadgeDot === true}\n color={props.iconBadgeColor}\n mirrorTextInRtl={props.mirrorBadgeTextInRtl !== false}\n />\n </view>\n ) : null}\n <view className=\"g9-nav-card__text\">\n {props.titleAccessory === undefined || props.titleAccessory === null ? (\n title\n ) : (\n <view className=\"g9-nav-card__title-row\" style={g9RowStyle(control.direction)}>\n {title}\n <view className=\"g9-nav-card__title-accessory\">{props.titleAccessory}</view>\n </view>\n )}\n {subtitle ? (\n <text className=\"g9-nav-card__subtitle\" text-maxline=\"1\" style={g9TextStart(control.direction)}>\n {subtitle}\n </text>\n ) : null}\n </view>\n {props.trailing !== undefined ? (\n <view className=\"g9-nav-card__trailing\" style={g9RowStyle(control.direction)}>\n {props.trailing}\n </view>\n ) : (\n <view className=\"g9-nav-card__trailing\" style={g9RowStyle(control.direction)}>\n {value && !soon ? (\n <text\n className=\"g9-nav-card__value\"\n text-maxline=\"1\"\n style={{ color: props.valueColor ?? (destructive ? palette.Error : palette.TextTertiary) }}\n >\n {value}\n </text>\n ) : null}\n {soon ? (\n <view className=\"g9-nav-card__soon\">\n <text className=\"g9-nav-card__soon-text\">{soonText}</text>\n </view>\n ) : props.showChevron !== false ? (\n <G9IconSlot\n icon={control.direction === 'rtl' ? glyphs.chevronBack : glyphs.chevronForward}\n size={24}\n color={palette.TextTertiary}\n />\n ) : null}\n </view>\n )}\n </view>\n );\n}\n"],"names":["G9NavCard","props","_props_accessibilityLabel","_props_accessibilityLabel1","_props_valueColor","control","useG9Control","palette","useG9Theme","glyphs","useG9Settings","strings","useG9Strings","soon","destructive","accent","resolveThemeColor","cardAccent","surface","formatColor","mix","press","useG9Press","visual","usePressVisual","icon","subtitle","value","soonText","G9StringKey","label","Boolean","filledChip","title","text","g9TextStart","view","g9RowStyle","undefined","hasIconSlot","G9IconSlot","G9CornerBadge"],"mappings":";;;;;;;AA8DO,SAASA,UAAUC,KAAqB;QA4C9BC,2BACwBC,4BA+CXC;IA3F5B,MAAMC,UAAUC,aAAaL,OAAO;IACpC,MAAMM,UAAUC,aAAa,OAAO;IACpC,MAAMC,SAASC,gBAAgB,MAAM;IACrC,MAAMC,UAAUC;IAChB,MAAMC,OAAOZ,AAAuB,SAAvBA,MAAM,YAAY;IAC/B,MAAMa,cAAcb,AAAwB,SAAxBA,MAAM,aAAa;IAGvC,MAAMc,SAASd,MAAM,WAAW,GAAGe,kBAAkBf,MAAM,WAAW,EAAEM,WAAWA,QAAQ,OAAO;IAClG,MAAMU,aAAahB,MAAM,eAAe,GAAGe,kBAAkBf,MAAM,eAAe,EAAEM,WAAWQ;IAC/F,MAAMG,UAAUjB,MAAM,gBAAgB,GAAGkB,YAAYC,IAAIH,YAAYV,QAAQ,OAAO,EAAE,SAASA,QAAQ,OAAO;IAC9G,MAAMc,QAAQC,WAAWrB,MAAM,OAAO,EAAE;QAAE,SAASI,QAAQ,QAAQ,IAAIQ;QAAM,QAAQ;IAAY;IACjG,MAAMU,SAASC,eACb;QAAE,UAAU;QAAS,MAAM;QAAG,SAAS;QAAO,MAAM;QAAI,OAAO;IAAI,GACnEnB,QAAQ,QAAQ,IAAIQ;IAEtB,MAAMY,OAAO;QAAE,OAAOxB,MAAM,SAAS;QAAE,MAAMA,MAAM,IAAI;QAAE,WAAWA,MAAM,QAAQ;QAAE,OAAOA,MAAM,SAAS;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b,OAAO;QAAE,OAAO,QAAA9B,CAAAA,oBAAAA,MAAM,UAAU,AAAD,IAAfA,oBAAqBU,cAAcP,QAAQ,KAAK,GAAGA,QAAQ,YAAY;IAAE,GAC1F;cACC,CAACoB,MAAM;YACT,EAAEO,QACA,KAAK;UACT,CAACrB,QACEuB,KAAK,UAAU,oBAAoB;cAClC,CAACF,KAAK,UAAU,0BAA0BN,WAAWM,KAAK;YAC5D,EAAEE,QACAnC,AAAsB,UAAtBA,MAAM,WAAW,IAClBuC,WACC,MAAMnC,AAAsB,UAAtBA,QAAQ,SAAS,GAAaI,OAAO,WAAW,GAAGA,OAAO,cAAc,EAC9E,MAAM,IACN,OAAOF,QAAQ,YAAY,MAE3B,KAAK;QACX,EAAE6B,MACF;IACJ,EAAEA;AAEN"}
|
|
1
|
+
{"version":3,"file":"button/nav-card.jsx","sources":["../../src/button/nav-card.tsx"],"sourcesContent":["import './button.css';\nimport { formatColor, type G9ImageSource, G9StringKey, mix, resolveThemeColor } from '@g9tm/lynxcontrols-foundation';\nimport type { ReactNode } from '@lynx-js/react';\nimport { type G9ControlBaseProps, g9RowStyle, g9TextStart, useG9Control } from '../base/control';\nimport { G9CornerBadge } from '../base/corner-badge';\nimport { useG9Press, usePressVisual } from '../base/press';\nimport type { G9IconInput } from '../icon/icon';\nimport { G9IconSlot, hasIconSlot } from '../icon/slot';\nimport { useG9Settings, useG9Strings, useG9Theme } from '../provider/hooks';\n\n/** Props of {@link G9NavCard} (MAUI `G9NavCard`). */\nexport interface G9NavCardProps extends G9ControlBaseProps {\n readonly title?: string | null;\n readonly subtitle?: string | null;\n /** Icon and icon-tile tint. Default the primary colour. Must be a colour literal (it is mixed). */\n readonly accentColor?: string | null;\n readonly iconEmoji?: string | null;\n readonly icon?: G9IconInput;\n readonly iconPath?: string | null;\n readonly iconImage?: G9ImageSource | null;\n /** Trailing chevron (forward in LTR, back in RTL). Default true. */\n readonly showChevron?: boolean;\n readonly valueText?: string | null;\n /** Value colour; default error when destructive, else tertiary text. */\n readonly valueColor?: string | null;\n /** Coming-soon badge instead of value and chevron; presses do nothing. Default false. */\n readonly isComingSoon?: boolean;\n /** Badge text; default the localized `comingSoon`. */\n readonly comingSoonText?: string | null;\n readonly iconBadgeText?: string | null;\n readonly showIconBadgeDot?: boolean;\n readonly iconBadgeColor?: string | null;\n /** Default true. */\n readonly mirrorBadgeTextInRtl?: boolean;\n /** Replaces the whole trailing area (value, chevron, coming-soon badge). */\n readonly trailing?: ReactNode;\n /**\n * A small node on the title's line, right after the title (a count pill, an unread dot, a \"6/10\"; MAUI 1.4.0\n * `TitleAccessoryView`). It does not take over the trailing area, so the chevron, value and coming-soon badge keep\n * working beside it. A long title truncates; the accessory never does. Unset keeps the title layout as it was.\n */\n readonly titleAccessory?: ReactNode;\n /** Title (and default value colour) in the error colour. Default false. */\n readonly isDestructive?: boolean;\n /** Tint the card background with the accent (88 % surface). Default false. */\n readonly useAccentSurface?: boolean;\n /** Accent used only for the background tint. */\n readonly cardAccentColor?: string | null;\n /**\n * Paint the icon tile solid in the accent with an `OnPrimary` icon instead of the pastel tile with an accent icon\n * (MAUI 1.4.0 `UseFilledIconChip`): the one primary row of a list. Pair with `useAccentSurface`. Default false.\n */\n readonly useFilledIconChip?: boolean;\n /** The press (MAUI `Tapped` + `Command`); not while disabled or coming soon. */\n readonly onPress?: () => void;\n}\n\n/**\n * Navigation row card (MAUI `G9NavCard`): icon tile (pastel, or filled with `useFilledIconChip`) with optional corner\n * badge, title (with an optional `titleAccessory` after it)/subtitle, value text, chevron or coming-soon badge, or a\n * custom trailing node. Press: scale 0.985 (70 ms) → 1 (120 ms); hover on desktop.\n */\nexport function G9NavCard(props: G9NavCardProps): ReactNode {\n const control = useG9Control(props, 'g9-nav-card', {\n kind: 'card',\n label: () => props.accessibilityLabel ?? label,\n capabilities: { activate: () => press() },\n });\n const palette = useG9Theme().palette;\n const glyphs = useG9Settings().glyphs;\n const strings = useG9Strings();\n const soon = props.isComingSoon === true;\n const destructive = props.isDestructive === true;\n // A theme reference (`var(--g9-success)`) is resolved against the live palette: the accent is mixed below, and a\n // CSS variable cannot be mixed.\n const accent = props.accentColor ? resolveThemeColor(props.accentColor, palette) : palette.Primary;\n const cardAccent = props.cardAccentColor ? resolveThemeColor(props.cardAccentColor, palette) : accent;\n const surface = props.useAccentSurface ? formatColor(mix(cardAccent, palette.Surface, 0.88)) : palette.Surface;\n const press = useG9Press(props.onPress, { blocked: control.disabled || soon, source: 'G9NavCard' });\n const visual = usePressVisual(\n { property: 'scale', rest: 1, pressed: 0.985, inMs: 70, outMs: 120 },\n control.disabled || soon,\n );\n const icon = { emoji: props.iconEmoji, icon: props.icon, imagePath: props.iconPath, image: props.iconImage };\n const subtitle = props.subtitle && props.subtitle.trim() !== '' ? props.subtitle : null;\n const value = props.valueText && props.valueText.trim() !== '' ? props.valueText : null;\n const soonText =\n props.comingSoonText && props.comingSoonText.trim() !== ''\n ? props.comingSoonText\n : strings.get(G9StringKey.ComingSoon);\n const label = [props.title, subtitle].filter(Boolean).join(', ');\n const filledChip = props.useFilledIconChip === true;\n const title = props.title ? (\n <text\n className=\"g9-nav-card__title\"\n text-maxline=\"1\"\n style={{ color: destructive ? palette.Error : palette.TextPrimary, ...g9TextStart(control.direction) }}\n >\n {props.title}\n </text>\n ) : null;\n return (\n <view\n className={control.className}\n {...control.idProps}\n style={{ backgroundColor: surface, ...g9RowStyle(control.direction) }}\n {...(props.trailing === undefined\n ? {\n 'accessibility-element': true,\n 'accessibility-traits': 'button',\n ...((props.accessibilityLabel ?? label)\n ? { 'accessibility-label': props.accessibilityLabel ?? label }\n : {}),\n ...(soon ? { 'accessibility-value': soonText } : value ? { 'accessibility-value': value } : {}),\n }\n : {})}\n bindtap={press}\n {...visual}\n >\n {hasIconSlot(icon) ? (\n <view\n className=\"g9-nav-card__tile\"\n style={{ backgroundColor: filledChip ? accent : formatColor(mix(accent, palette.Surface, 0.82)) }}\n >\n <G9IconSlot {...icon} size={props.iconEmoji ? 22 : 18} color={filledChip ? palette.OnPrimary : accent} />\n <G9CornerBadge\n text={props.iconBadgeText}\n dot={props.showIconBadgeDot === true}\n color={props.iconBadgeColor}\n mirrorTextInRtl={props.mirrorBadgeTextInRtl !== false}\n />\n </view>\n ) : null}\n <view className=\"g9-nav-card__text\">\n {props.titleAccessory === undefined || props.titleAccessory === null ? (\n title\n ) : (\n <view className=\"g9-nav-card__title-row\" style={g9RowStyle(control.direction)}>\n {title}\n <view className=\"g9-nav-card__title-accessory\">{props.titleAccessory}</view>\n </view>\n )}\n {subtitle ? (\n <text className=\"g9-nav-card__subtitle\" text-maxline=\"1\" style={g9TextStart(control.direction)}>\n {subtitle}\n </text>\n ) : null}\n </view>\n {props.trailing !== undefined ? (\n <view className=\"g9-nav-card__trailing\" style={g9RowStyle(control.direction)}>\n {props.trailing}\n </view>\n ) : (\n <view className=\"g9-nav-card__trailing\" style={g9RowStyle(control.direction)}>\n {value && !soon ? (\n <text\n className=\"g9-nav-card__value\"\n text-maxline=\"1\"\n style={{ color: props.valueColor ?? (destructive ? palette.Error : palette.TextTertiary) }}\n >\n {value}\n </text>\n ) : null}\n {soon ? (\n <view className=\"g9-nav-card__soon\">\n <text className=\"g9-nav-card__soon-text\">{soonText}</text>\n </view>\n ) : props.showChevron !== false ? (\n <G9IconSlot\n icon={control.direction === 'rtl' ? glyphs.chevronBack : glyphs.chevronForward}\n size={24}\n color={palette.TextTertiary}\n />\n ) : null}\n </view>\n )}\n </view>\n );\n}\n"],"names":["G9NavCard","props","_props_accessibilityLabel","_props_accessibilityLabel1","_props_valueColor","control","useG9Control","label","press","palette","useG9Theme","glyphs","useG9Settings","strings","useG9Strings","soon","destructive","accent","resolveThemeColor","cardAccent","surface","formatColor","mix","useG9Press","visual","usePressVisual","icon","subtitle","value","soonText","G9StringKey","Boolean","filledChip","title","text","g9TextStart","view","g9RowStyle","undefined","hasIconSlot","G9IconSlot","G9CornerBadge"],"mappings":";;;;;;;AA8DO,SAASA,UAAUC,KAAqB;QAgD9B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F,KAAK,UAAU,0BAA0BL,WAAWK,KAAK;YAC5D,EAAEE,QACAnC,AAAsB,UAAtBA,MAAM,WAAW,IAClBuC,WACC,MAAMnC,AAAsB,UAAtBA,QAAQ,SAAS,GAAaM,OAAO,WAAW,GAAGA,OAAO,cAAc,EAC9E,MAAM,IACN,OAAOF,QAAQ,YAAY,MAE3B,KAAK;QACX,EAAE2B,MACF;IACJ,EAAEA;AAEN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vertical-icon-text-button.d.ts","sourceRoot":"","sources":["../../src/button/vertical-icon-text-button.tsx"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,KAAK,kBAAkB,EAAgB,MAAM,iBAAiB,CAAC;AAIxE,mFAAmF;AACnF,MAAM,WAAW,6BAA8B,SAAQ,kBAAkB;IACvE,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;IACtC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,kCAAkC;IAClC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CAC/B;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,6BAA6B,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"vertical-icon-text-button.d.ts","sourceRoot":"","sources":["../../src/button/vertical-icon-text-button.tsx"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,KAAK,kBAAkB,EAAgB,MAAM,iBAAiB,CAAC;AAIxE,mFAAmF;AACnF,MAAM,WAAW,6BAA8B,SAAQ,kBAAkB;IACvE,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;IACtC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,kCAAkC;IAClC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CAC/B;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,6BAA6B,GAAG,SAAS,CAsBxF"}
|
|
@@ -4,7 +4,16 @@ import { useG9Press } from "../base/press.jsx";
|
|
|
4
4
|
import { G9IconSlot } from "../icon/slot.jsx";
|
|
5
5
|
function G9VerticalIconTextButton(props) {
|
|
6
6
|
var _props_accessibilityLabel, _ref, _props_accessibilityLabel1, _props_imageSize;
|
|
7
|
-
const control = useG9Control(props, 'g9-vertical-button'
|
|
7
|
+
const control = useG9Control(props, 'g9-vertical-button', {
|
|
8
|
+
kind: 'button',
|
|
9
|
+
label: ()=>{
|
|
10
|
+
var _props_accessibilityLabel;
|
|
11
|
+
return null != (_props_accessibilityLabel = props.accessibilityLabel) ? _props_accessibilityLabel : props.text;
|
|
12
|
+
},
|
|
13
|
+
capabilities: {
|
|
14
|
+
activate: ()=>press()
|
|
15
|
+
}
|
|
16
|
+
});
|
|
8
17
|
const press = useG9Press(props.onPress, {
|
|
9
18
|
blocked: control.disabled,
|
|
10
19
|
source: 'G9VerticalIconTextButton'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button/vertical-icon-text-button.jsx","sources":["../../src/button/vertical-icon-text-button.tsx"],"sourcesContent":["import './button.css';\nimport type { G9ImageSource } from '@g9tm/lynxcontrols-foundation';\nimport type { ReactNode } from '@lynx-js/react';\nimport { type G9ControlBaseProps, useG9Control } from '../base/control';\nimport { useG9Press } from '../base/press';\nimport { G9IconSlot } from '../icon/slot';\n\n/** Props of {@link G9VerticalIconTextButton} (MAUI `G9VerticalIconTextButton`). */\nexport interface G9VerticalIconTextButtonProps extends G9ControlBaseProps {\n readonly image?: G9ImageSource | null;\n readonly text?: string | null;\n /** Image box size. Default 32. */\n readonly imageSize?: number;\n readonly onPress?: () => void;\n}\n\n/**\n * Image over a centred label in a bordered tile (MAUI `G9VerticalIconTextButton`). Unlike MAUI (its image and label\n * took the touch), the press is on the root and honours `disabled` and the 300 ms guard.\n */\nexport function G9VerticalIconTextButton(props: G9VerticalIconTextButtonProps): ReactNode {\n const control = useG9Control(props, 'g9-vertical-button');\n const press = useG9Press(props.onPress, { blocked: control.disabled, source: 'G9VerticalIconTextButton' });\n return (\n <view\n className={control.className}\n {...control.idProps}\n accessibility-element={true}\n accessibility-traits=\"button\"\n {...((props.accessibilityLabel ?? props.text)\n ? { 'accessibility-label': props.accessibilityLabel ?? props.text ?? '' }\n : {})}\n bindtap={press}\n >\n {props.image ? <G9IconSlot image={props.image} size={props.imageSize ?? 32} /> : null}\n {props.text ? <text className=\"g9-vertical-button__text\">{props.text}</text> : null}\n </view>\n );\n}\n"],"names":["G9VerticalIconTextButton","props","_props_accessibilityLabel","_ref","_props_imageSize","control","useG9Control","press","useG9Press","view","G9IconSlot","text"],"mappings":";;;;AAoBO,SAASA,yBAAyBC,KAAoC;
|
|
1
|
+
{"version":3,"file":"button/vertical-icon-text-button.jsx","sources":["../../src/button/vertical-icon-text-button.tsx"],"sourcesContent":["import './button.css';\nimport type { G9ImageSource } from '@g9tm/lynxcontrols-foundation';\nimport type { ReactNode } from '@lynx-js/react';\nimport { type G9ControlBaseProps, useG9Control } from '../base/control';\nimport { useG9Press } from '../base/press';\nimport { G9IconSlot } from '../icon/slot';\n\n/** Props of {@link G9VerticalIconTextButton} (MAUI `G9VerticalIconTextButton`). */\nexport interface G9VerticalIconTextButtonProps extends G9ControlBaseProps {\n readonly image?: G9ImageSource | null;\n readonly text?: string | null;\n /** Image box size. Default 32. */\n readonly imageSize?: number;\n readonly onPress?: () => void;\n}\n\n/**\n * Image over a centred label in a bordered tile (MAUI `G9VerticalIconTextButton`). Unlike MAUI (its image and label\n * took the touch), the press is on the root and honours `disabled` and the 300 ms guard.\n */\nexport function G9VerticalIconTextButton(props: G9VerticalIconTextButtonProps): ReactNode {\n const control = useG9Control(props, 'g9-vertical-button', {\n kind: 'button',\n label: () => props.accessibilityLabel ?? props.text,\n capabilities: { activate: () => press() },\n });\n const press = useG9Press(props.onPress, { blocked: control.disabled, source: 'G9VerticalIconTextButton' });\n return (\n <view\n className={control.className}\n {...control.idProps}\n accessibility-element={true}\n accessibility-traits=\"button\"\n {...((props.accessibilityLabel ?? props.text)\n ? { 'accessibility-label': props.accessibilityLabel ?? props.text ?? '' }\n : {})}\n bindtap={press}\n >\n {props.image ? <G9IconSlot image={props.image} size={props.imageSize ?? 32} /> : null}\n {props.text ? <text className=\"g9-vertical-button__text\">{props.text}</text> : null}\n </view>\n );\n}\n"],"names":["G9VerticalIconTextButton","props","_props_accessibilityLabel","_ref","_props_imageSize","control","useG9Control","press","useG9Press","view","G9IconSlot","text"],"mappings":";;;;AAoBO,SAASA,yBAAyBC,KAAoC;QAajEC,2BACuBC,MAAAA,4BAIwBC;IAjBzD,MAAMC,UAAUC,aAAaL,OAAO,sBAAsB;QACxD,MAAM;QACN,OAAO;gBAAMC;2BAAAA,CAAAA,4BAAAA,MAAM,kBAAkB,AAAD,IAAvBA,4BAA4BD,MAAM,IAAI;;QACnD,cAAc;YAAE,UAAU,IAAMM;QAAQ;IAC1C;IACA,MAAMA,QAAQC,WAAWP,MAAM,OAAO,EAAE;QAAE,SAASI,QAAQ,QAAQ;QAAE,QAAQ;IAA2B;IACxG,QACGI,KACC,WAAWJ,QAAQ,SAAS,GAC3B,GAAGA,QAAQ,OAAO,EACnB,uBAAuB,MACvB,qBAAqB,UACpB,GAAI,AAAC,SAAAH,CAAAA,4BAAAA,MA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/B,4CAA4C;IAC5C,MAAM,IAAI,IAAI,CAAC;CAChB;AAID;;;;GAIG;AACH,eAAO,MAAM,UAAU,8GAyGrB,CAAC"}
|
|
@@ -11,7 +11,20 @@ import { useG9Settings, useG9Theme } from "../provider/hooks.jsx";
|
|
|
11
11
|
const g9ExpanderDurationMs = 220;
|
|
12
12
|
const expander_G9Expander = forwardRef(function(props, ref) {
|
|
13
13
|
var _props_defaultExpanded, _props_contentPadding, _props_headerHeight, _props_iconColor, _props_titleColor, _props_chevronColor;
|
|
14
|
-
const control = useG9Control(props, 'g9-expander'
|
|
14
|
+
const control = useG9Control(props, 'g9-expander', {
|
|
15
|
+
kind: 'view',
|
|
16
|
+
label: ()=>{
|
|
17
|
+
var _props_accessibilityLabel;
|
|
18
|
+
return null != (_props_accessibilityLabel = props.accessibilityLabel) ? _props_accessibilityLabel : props.title;
|
|
19
|
+
},
|
|
20
|
+
capabilities: {
|
|
21
|
+
activate: ()=>press(),
|
|
22
|
+
getValue: ()=>String(expanded),
|
|
23
|
+
expand: (open)=>{
|
|
24
|
+
if (open !== expanded) press();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
15
28
|
const glyphs = useG9Settings().glyphs;
|
|
16
29
|
const palette = useG9Theme().palette;
|
|
17
30
|
const [expanded, setExpanded] = useControllableState({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expander/expander.jsx","sources":["../../src/expander/expander.tsx"],"sourcesContent":["import './expander.css';\nimport type { G9ImageSource } from '@g9tm/lynxcontrols-foundation';\nimport { g9Ms } from '@g9tm/lynxcontrols-foundation';\nimport { forwardRef, type ReactNode, useEffect, useImperativeHandle, useRef, useState } from '@lynx-js/react';\nimport { type G9ControlBaseProps, g9ChildId, g9IdProps, g9RowStyle, useG9Control } from '../base/control';\nimport { useG9Press, usePressVisual } from '../base/press';\nimport { type G9TimerHandle, startTimer, stopTimer } from '../base/timers';\nimport { useControllableState } from '../base/use-controllable-state';\nimport { g9FieldNotchStyle } from '../fields/notch';\nimport type { G9IconInput } from '../icon/icon';\nimport { G9IconSlot, hasIconSlot } from '../icon/slot';\nimport { useG9Settings, useG9Theme } from '../provider/hooks';\n\n/** Expand/collapse duration (MAUI `G9Metrics` expander 220 ms). */\nexport const g9ExpanderDurationMs = 220;\n\n/** Props of {@link G9Expander} (MAUI `G9Expander`). */\nexport interface G9ExpanderProps extends G9ControlBaseProps {\n readonly title?: string | null;\n /** Default `var(--g9-text-primary)`. */\n readonly titleColor?: string | null;\n readonly iconEmoji?: string | null;\n readonly icon?: G9IconInput;\n readonly iconPath?: string | null;\n readonly iconImage?: G9ImageSource | null;\n /** Default `var(--g9-text-primary)`. */\n readonly iconColor?: string | null;\n /** Default `var(--g9-text-secondary)`. */\n readonly chevronColor?: string | null;\n /** Controlled open state (MAUI `IsExpanded`). */\n readonly expanded?: boolean;\n readonly defaultExpanded?: boolean;\n /** Once per change made by the expander (header tap, `toggle()`); never for pushed values. */\n readonly onExpandedChange?: (expanded: boolean) => void;\n /** Card look: surface, 1 px outline, 16 px corners, 14 × 12 padding. Default false. */\n readonly showFrame?: boolean;\n /** Minimum header height. Default 48. */\n readonly headerHeight?: number;\n /** Content padding `[left, top, right, bottom]` (an 8 px top gap is always added). Default 0. */\n readonly contentPadding?: readonly [number, number, number, number];\n /** The content (MAUI `ExpanderContent`): mounted at once and kept, hidden while collapsed. */\n readonly children?: ReactNode;\n}\n\n/** Imperative handle of {@link G9Expander}. */\nexport interface G9ExpanderHandle {\n /** Same as a header tap (MAUI `Toggle`). */\n toggle(): void;\n}\n\ntype Phase = 'open' | 'opening' | 'closing' | 'closed';\n\n/**\n * Collapsible section (MAUI `G9Expander`): only the header toggles; the chevron turns 180° and the content height\n * animates over 220 ms (CSS transition on the measured height; instant when it cannot be measured). The first render\n * does not animate. The content stays mounted.\n */\nexport const G9Expander = forwardRef<G9ExpanderHandle, G9ExpanderProps>(function G9Expander(props, ref): ReactNode {\n const control = useG9Control(props, 'g9-expander');\n const glyphs = useG9Settings().glyphs;\n // A framed expander is a Surface card: fields inside notch their floated label with it.\n const palette = useG9Theme().palette;\n const [expanded, setExpanded] = useControllableState<boolean>({\n value: props.expanded,\n defaultValue: props.defaultExpanded ?? false,\n onChange: props.onExpandedChange,\n name: 'G9Expander.expanded',\n });\n const [phase, setPhase] = useState<Phase>(expanded ? 'open' : 'closed');\n const [measured, setMeasured] = useState(0);\n const timer = useRef<G9TimerHandle | null>(null);\n const first = useRef(true);\n useEffect(() => {\n if (first.current) {\n first.current = false;\n return;\n }\n if (timer.current !== null) stopTimer(timer.current);\n if (measured <= 0) {\n setPhase(expanded ? 'open' : 'closed');\n return;\n }\n setPhase(expanded ? 'opening' : 'closing');\n timer.current = startTimer(() => {\n timer.current = null;\n setPhase(expanded ? 'open' : 'closed');\n }, g9Ms(g9ExpanderDurationMs));\n }, [expanded]);\n useEffect(\n () => () => {\n if (timer.current !== null) stopTimer(timer.current);\n },\n [],\n );\n\n const toggle = () => {\n if (!control.disabled) setExpanded((v) => !v);\n };\n useImperativeHandle(ref, () => ({ toggle }));\n const press = useG9Press(toggle, { blocked: control.disabled, source: 'G9Expander', guardMs: 0 });\n const visual = usePressVisual({ property: 'scale', rest: 1, pressed: 0.99, inMs: 60, outMs: 90 }, control.disabled);\n const icon = { emoji: props.iconEmoji, icon: props.icon, imagePath: props.iconPath, image: props.iconImage };\n const [pl, pt, pr, pb] = props.contentPadding ?? [0, 0, 0, 0];\n const height = phase === 'open' ? undefined : phase === 'opening' ? `${measured}px` : '0px';\n return (\n <view\n className={`${control.className}${props.showFrame ? ' g9-expander--frame' : ''}`}\n {...control.idProps}\n style={props.showFrame ? g9FieldNotchStyle(palette.Surface) : {}}\n >\n <view\n className=\"g9-expander__header\"\n {...g9IdProps(g9ChildId(props.id, 'Header'))}\n style={{ minHeight: `${props.headerHeight ?? 48}px`, ...g9RowStyle(control.direction) }}\n accessibility-element={true}\n accessibility-traits=\"button\"\n {...(props.title ? { 'accessibility-label': props.title } : {})}\n bindtap={press}\n {...visual}\n >\n <view className=\"g9-expander__lead\" style={g9RowStyle(control.direction)}>\n {hasIconSlot(icon) ? (\n <G9IconSlot {...icon} size={20} color={props.iconColor ?? 'var(--g9-text-primary)'} />\n ) : null}\n {props.title ? (\n <text\n className=\"g9-expander__title\"\n text-maxline=\"1\"\n style={{ color: props.titleColor ?? 'var(--g9-text-primary)' }}\n >\n {props.title}\n </text>\n ) : null}\n </view>\n <view className={`g9-expander__chevron${expanded ? ' g9-expander__chevron--open' : ''}`}>\n <G9IconSlot icon={glyphs.chevron} size={22} color={props.chevronColor ?? 'var(--g9-text-secondary)'} />\n </view>\n </view>\n <view className={`g9-expander__clip g9-expander__clip--${phase}`} style={height === undefined ? {} : { height }}>\n <view\n className=\"g9-expander__content\"\n style={{ padding: `${pt + 8}px ${pr}px ${pb}px ${pl}px` }}\n bindlayoutchange={(e: { detail?: { height?: number } }) => {\n const h = e.detail?.height ?? 0;\n if (h > 0 && h !== measured) setMeasured(h);\n }}\n >\n {props.children}\n </view>\n </view>\n </view>\n );\n});\n"],"names":["g9ExpanderDurationMs","G9Expander","forwardRef","props","ref","_props_defaultExpanded","_props_contentPadding","_props_headerHeight","_props_iconColor","_props_titleColor","_props_chevronColor","control","useG9Control","glyphs","useG9Settings","palette","useG9Theme","expanded","setExpanded","useControllableState","phase","setPhase","useState","measured","setMeasured","timer","useRef","first","useEffect","stopTimer","startTimer","g9Ms","toggle","v","useImperativeHandle","press","useG9Press","visual","usePressVisual","icon","pl","pt","pr","pb","height","undefined","view","g9FieldNotchStyle","g9IdProps","g9ChildId","g9RowStyle","hasIconSlot","G9IconSlot","text","e","_e_detail","h"],"mappings":";;;;;;;;;;AAcO,MAAMA,uBAAuB;AA2C7B,MAAMC,sBAAaC,WAA8C,SAAoBC,KAAK,EAAEC,GAAG;QAOpFC,wBAsCSC,uBAWIC,qBASoBC,kBAMrBC,mBAO+BC;IA7E3D,MAAMC,UAAUC,aAAaT,OAAO;IACpC,MAAMU,SAAS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AM,UAAU,AAAD,IAAfA,oBAAoB;IAAyB,GAC9D;cACC,CAACN,MAAM,KAAK,CAAC;YACf,EAAEkD,QACA,KAAK;QACX,EAAEP,KAAK;QACP,CAACA,KAAK,WAAW,CAAC,oBAAoB,EAAE7B,WAAW,gCAAgC,IAAI,EAAE;UACvF,CAACmC,WAAW,MAAMvC,OAAO,OAAO,EAAE,MAAM,IAAI,OAAO,QAAAH,CAAAA,sBAAAA,MAAM,YAAY,AAAD,IAAjBA,sBAAsB,6BAA8B;QACzG,EAAEoC,KAAK;MACT,EAAEA,KAAK;MACP,CAACA,KAAK,WAAW,CAAC,qCAAqC,EAAE1B,OAAO,EAAE,OAAOwB,AAAWC,WAAXD,SAAuB,CAAC,IAAI;QAAEA;IAAO,GAAG;QAC/G,CAACE,KACC,UAAU,uBACV,OAAO;QAAE,SAAS,GAAGL,KAAK,EAAE,GAAG,EAAEC,GAAG,GAAG,EAAEC,GAAG,GAAG,EAAEH,GAAG,EAAE,CAAC;IAAC,GACxD,kBAAkB,CAACc;;YACPC;QAAV,MAAMC,IAAI,QAAJA,CAAAA,OAAAA,QAAID,CAAAA,YAAAA,EAAE,MAAM,AAAD,IAAPA,KAAAA,IAAAA,UAAU,MAAM,AAAD,IAAC,OAAI;QAC9B,IAAIC,IAAI,KAAKA,MAAMjC,UAAUC,YAAYgC;IAC3C,GACD;UACC,CAACrD,MAAM,QAAQ,CAAC;QAClB,EAAE2C,KAAK;MACT,EAAEA,KAAK;IACT,EAAEA;AAEN"}
|
|
1
|
+
{"version":3,"file":"expander/expander.jsx","sources":["../../src/expander/expander.tsx"],"sourcesContent":["import './expander.css';\nimport type { G9ImageSource } from '@g9tm/lynxcontrols-foundation';\nimport { g9Ms } from '@g9tm/lynxcontrols-foundation';\nimport { forwardRef, type ReactNode, useEffect, useImperativeHandle, useRef, useState } from '@lynx-js/react';\nimport { type G9ControlBaseProps, g9ChildId, g9IdProps, g9RowStyle, useG9Control } from '../base/control';\nimport { useG9Press, usePressVisual } from '../base/press';\nimport { type G9TimerHandle, startTimer, stopTimer } from '../base/timers';\nimport { useControllableState } from '../base/use-controllable-state';\nimport { g9FieldNotchStyle } from '../fields/notch';\nimport type { G9IconInput } from '../icon/icon';\nimport { G9IconSlot, hasIconSlot } from '../icon/slot';\nimport { useG9Settings, useG9Theme } from '../provider/hooks';\n\n/** Expand/collapse duration (MAUI `G9Metrics` expander 220 ms). */\nexport const g9ExpanderDurationMs = 220;\n\n/** Props of {@link G9Expander} (MAUI `G9Expander`). */\nexport interface G9ExpanderProps extends G9ControlBaseProps {\n readonly title?: string | null;\n /** Default `var(--g9-text-primary)`. */\n readonly titleColor?: string | null;\n readonly iconEmoji?: string | null;\n readonly icon?: G9IconInput;\n readonly iconPath?: string | null;\n readonly iconImage?: G9ImageSource | null;\n /** Default `var(--g9-text-primary)`. */\n readonly iconColor?: string | null;\n /** Default `var(--g9-text-secondary)`. */\n readonly chevronColor?: string | null;\n /** Controlled open state (MAUI `IsExpanded`). */\n readonly expanded?: boolean;\n readonly defaultExpanded?: boolean;\n /** Once per change made by the expander (header tap, `toggle()`); never for pushed values. */\n readonly onExpandedChange?: (expanded: boolean) => void;\n /** Card look: surface, 1 px outline, 16 px corners, 14 × 12 padding. Default false. */\n readonly showFrame?: boolean;\n /** Minimum header height. Default 48. */\n readonly headerHeight?: number;\n /** Content padding `[left, top, right, bottom]` (an 8 px top gap is always added). Default 0. */\n readonly contentPadding?: readonly [number, number, number, number];\n /** The content (MAUI `ExpanderContent`): mounted at once and kept, hidden while collapsed. */\n readonly children?: ReactNode;\n}\n\n/** Imperative handle of {@link G9Expander}. */\nexport interface G9ExpanderHandle {\n /** Same as a header tap (MAUI `Toggle`). */\n toggle(): void;\n}\n\ntype Phase = 'open' | 'opening' | 'closing' | 'closed';\n\n/**\n * Collapsible section (MAUI `G9Expander`): only the header toggles; the chevron turns 180° and the content height\n * animates over 220 ms (CSS transition on the measured height; instant when it cannot be measured). The first render\n * does not animate. The content stays mounted.\n */\nexport const G9Expander = forwardRef<G9ExpanderHandle, G9ExpanderProps>(function G9Expander(props, ref): ReactNode {\n const control = useG9Control(props, 'g9-expander', {\n kind: 'view',\n label: () => props.accessibilityLabel ?? props.title,\n capabilities: {\n activate: () => press(),\n getValue: () => String(expanded),\n expand: (open) => {\n if (open !== expanded) press();\n },\n },\n });\n const glyphs = useG9Settings().glyphs;\n // A framed expander is a Surface card: fields inside notch their floated label with it.\n const palette = useG9Theme().palette;\n const [expanded, setExpanded] = useControllableState<boolean>({\n value: props.expanded,\n defaultValue: props.defaultExpanded ?? false,\n onChange: props.onExpandedChange,\n name: 'G9Expander.expanded',\n });\n const [phase, setPhase] = useState<Phase>(expanded ? 'open' : 'closed');\n const [measured, setMeasured] = useState(0);\n const timer = useRef<G9TimerHandle | null>(null);\n const first = useRef(true);\n useEffect(() => {\n if (first.current) {\n first.current = false;\n return;\n }\n if (timer.current !== null) stopTimer(timer.current);\n if (measured <= 0) {\n setPhase(expanded ? 'open' : 'closed');\n return;\n }\n setPhase(expanded ? 'opening' : 'closing');\n timer.current = startTimer(() => {\n timer.current = null;\n setPhase(expanded ? 'open' : 'closed');\n }, g9Ms(g9ExpanderDurationMs));\n }, [expanded]);\n useEffect(\n () => () => {\n if (timer.current !== null) stopTimer(timer.current);\n },\n [],\n );\n\n const toggle = () => {\n if (!control.disabled) setExpanded((v) => !v);\n };\n useImperativeHandle(ref, () => ({ toggle }));\n const press = useG9Press(toggle, { blocked: control.disabled, source: 'G9Expander', guardMs: 0 });\n const visual = usePressVisual({ property: 'scale', rest: 1, pressed: 0.99, inMs: 60, outMs: 90 }, control.disabled);\n const icon = { emoji: props.iconEmoji, icon: props.icon, imagePath: props.iconPath, image: props.iconImage };\n const [pl, pt, pr, pb] = props.contentPadding ?? [0, 0, 0, 0];\n const height = phase === 'open' ? undefined : phase === 'opening' ? `${measured}px` : '0px';\n return (\n <view\n className={`${control.className}${props.showFrame ? ' g9-expander--frame' : ''}`}\n {...control.idProps}\n style={props.showFrame ? g9FieldNotchStyle(palette.Surface) : {}}\n >\n <view\n className=\"g9-expander__header\"\n {...g9IdProps(g9ChildId(props.id, 'Header'))}\n style={{ minHeight: `${props.headerHeight ?? 48}px`, ...g9RowStyle(control.direction) }}\n accessibility-element={true}\n accessibility-traits=\"button\"\n {...(props.title ? { 'accessibility-label': props.title } : {})}\n bindtap={press}\n {...visual}\n >\n <view className=\"g9-expander__lead\" style={g9RowStyle(control.direction)}>\n {hasIconSlot(icon) ? (\n <G9IconSlot {...icon} size={20} color={props.iconColor ?? 'var(--g9-text-primary)'} />\n ) : null}\n {props.title ? (\n <text\n className=\"g9-expander__title\"\n text-maxline=\"1\"\n style={{ color: props.titleColor ?? 'var(--g9-text-primary)' }}\n >\n {props.title}\n </text>\n ) : null}\n </view>\n <view className={`g9-expander__chevron${expanded ? ' g9-expander__chevron--open' : ''}`}>\n <G9IconSlot icon={glyphs.chevron} size={22} color={props.chevronColor ?? 'var(--g9-text-secondary)'} />\n </view>\n </view>\n <view className={`g9-expander__clip g9-expander__clip--${phase}`} style={height === undefined ? {} : { height }}>\n <view\n className=\"g9-expander__content\"\n style={{ padding: `${pt + 8}px ${pr}px ${pb}px ${pl}px` }}\n bindlayoutchange={(e: { detail?: { height?: number } }) => {\n const h = e.detail?.height ?? 0;\n if (h > 0 && h !== measured) setMeasured(h);\n }}\n >\n {props.children}\n </view>\n </view>\n </view>\n );\n});\n"],"names":["g9ExpanderDurationMs","G9Expander","forwardRef","props","ref","_props_defaultExpanded","_props_contentPadding","_props_headerHeight","_props_iconColor","_props_titleColor","_props_chevronColor","control","useG9Control","_props_accessibilityLabel","press","String","expanded","open","glyphs","useG9Settings","palette","useG9Theme","setExpanded","useControllableState","phase","setPhase","useState","measured","setMeasured","timer","useRef","first","useEffect","stopTimer","startTimer","g9Ms","toggle","v","useImperativeHandle","useG9Press","visual","usePressVisual","icon","pl","pt","pr","pb","height","undefined","view","g9FieldNotchStyle","g9IdProps","g9ChildId","g9RowStyle","hasIconSlot","G9IconS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OAAI;QAC9B,IAAIC,IAAI,KAAKA,MAAMhC,UAAUC,YAAY+B;IAC3C,GACD;UACC,CAACxD,MAAM,QAAQ,CAAC;QAClB,EAAE8C,KAAK;MACT,EAAEA,KAAK;IACT,EAAEA;AAEN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../src/fields/editor.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAgB,MAAM,kBAAkB,CAAC;AAE/F,0DAA0D;AAC1D,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,aAAa,CAAC;AAE1D,mDAAmD;AACnD,MAAM,WAAW,aAAc,SAAQ,gBAAgB;IACrD,mDAAmD;IACnD,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IACtC,mEAAmE;IACnE,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,+FAA+F;IAC/F,QAAQ,CAAC,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IACrC,4DAA4D;IAC5D,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IACvC,4EAA4E;IAC5E,QAAQ,CAAC,uBAAuB,CAAC,EAAE,OAAO,CAAC;CAC5C;AAED,6CAA6C;AAC7C,MAAM,MAAM,cAAc,GAAG,iBAAiB,CAAC;AAE/C;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../src/fields/editor.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAgB,MAAM,kBAAkB,CAAC;AAE/F,0DAA0D;AAC1D,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,aAAa,CAAC;AAE1D,mDAAmD;AACnD,MAAM,WAAW,aAAc,SAAQ,gBAAgB;IACrD,mDAAmD;IACnD,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IACtC,mEAAmE;IACnE,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,+FAA+F;IAC/F,QAAQ,CAAC,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IACrC,4DAA4D;IAC5D,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IACvC,4EAA4E;IAC5E,QAAQ,CAAC,uBAAuB,CAAC,EAAE,OAAO,CAAC;CAC5C;AAED,6CAA6C;AAC7C,MAAM,MAAM,cAAc,GAAG,iBAAiB,CAAC;AAE/C;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,6GA2DnB,CAAC"}
|
package/dist/fields/editor.jsx
CHANGED
|
@@ -20,7 +20,23 @@ const editor_G9Editor = forwardRef(function(props, ref) {
|
|
|
20
20
|
const min = null != (_props_minimumEditorHeight = props.minimumEditorHeight) ? _props_minimumEditorHeight : 96;
|
|
21
21
|
const max = null != (_props_maxEditorHeight = props.maxEditorHeight) ? _props_maxEditorHeight : 0;
|
|
22
22
|
const autoSize = null != (_props_autoSize = props.autoSize) ? _props_autoSize : 'textChanges';
|
|
23
|
-
return <G9OutlinedField
|
|
23
|
+
return <G9OutlinedField anchor={{
|
|
24
|
+
kind: 'entry',
|
|
25
|
+
label: ()=>{
|
|
26
|
+
var _props_label;
|
|
27
|
+
return null != (_props_label = props.label) ? _props_label : props.placeholder;
|
|
28
|
+
},
|
|
29
|
+
enabled: ()=>!props.disabled,
|
|
30
|
+
capabilities: {
|
|
31
|
+
getValue: ()=>core.text,
|
|
32
|
+
setValue: (v)=>{
|
|
33
|
+
core.setText(v, {
|
|
34
|
+
source: 'programmatic'
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
focus: ()=>core.focus()
|
|
38
|
+
}
|
|
39
|
+
}} {...props} hint={resolveInnerHint(props)} multiline hasError={core.hasError} errorText={null != (_core_errorText = core.errorText) ? _core_errorText : null} focused={core.focused} hasValue={core.hasValue} textLength={core.text.length} trailingAffordance={affordance} onFocusRequest={core.focus}>
|
|
24
40
|
<textarea {...core.elementProps} className="g9-field__textarea" ios-spell-check={false !== props.isSpellCheckEnabled} ios-auto-correct={false !== props.isTextPredictionEnabled} style={{
|
|
25
41
|
direction: core.textDirection,
|
|
26
42
|
textAlign: 'rtl' === core.textDirection ? 'right' : 'left',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fields/editor.jsx","sources":["../../src/fields/editor.tsx"],"sourcesContent":["import { G9Metrics } from '@g9tm/lynxcontrols-foundation';\nimport { forwardRef, type ReactNode, useImperativeHandle } from '@lynx-js/react';\nimport { useG9Settings } from '../provider/hooks';\nimport { G9OutlinedField, type G9TrailingAffordance, resolveInnerHint } from './outlined-field';\nimport { type G9TextInputHandle, type G9TextInputProps, useTextInput } from './use-text-input';\n\n/** How the editor grows (MAUI `EditorAutoSizeOption`). */\nexport type G9EditorAutoSize = 'disabled' | 'textChanges';\n\n/** Props of {@link G9Editor} (MAUI `G9Editor`). */\nexport interface G9EditorProps extends G9TextInputProps {\n /** Minimum height of the text area. Default 96. */\n readonly minimumEditorHeight?: number;\n /** Maximum height while growing; `0` (default) means unbounded. */\n readonly maxEditorHeight?: number;\n /** `'textChanges'` (default) grows with the text; `'disabled'` keeps `minimumEditorHeight`. */\n readonly autoSize?: G9EditorAutoSize;\n /** Spell checking (iOS `ios-spell-check`). Default true. */\n readonly isSpellCheckEnabled?: boolean;\n /** Word prediction / autocorrect (iOS `ios-auto-correct`). Default true. */\n readonly isTextPredictionEnabled?: boolean;\n}\n\n/** Imperative handle of {@link G9Editor}. */\nexport type G9EditorHandle = G9TextInputHandle;\n\n/**\n * Multi-line outlined text area (MAUI `G9Editor`): the text-entry behaviour on a `<textarea>`, a microphone pinned to\n * the bottom-end corner whenever dictation is available, height from `minimumEditorHeight`/`maxEditorHeight`/\n * `autoSize`. Validates on blur only for email/url/custom types (no `validator`, as in MAUI). Requires the host's\n * `xelement-input` registration.\n */\nexport const G9Editor = forwardRef<G9EditorHandle, G9EditorProps>(function G9Editor(props, ref): ReactNode {\n const glyphs = useG9Settings().glyphs;\n const core = useTextInput(props, { name: 'G9Editor.value', showMic: (s) => s.available });\n useImperativeHandle(ref, () => core.handle);\n const affordance: G9TrailingAffordance | null = core.showMic\n ? {\n icon: core.dictation.listening ? glyphs.micOff : glyphs.mic,\n color: core.dictation.listening ? 'var(--g9-error)' : 'var(--g9-primary)',\n signature: 'voice',\n onPress: core.pressMic,\n }\n : null;\n const min = props.minimumEditorHeight ?? 96;\n const max = props.maxEditorHeight ?? 0;\n const autoSize = props.autoSize ?? 'textChanges';\n return (\n <G9OutlinedField\n {...props}\n hint={resolveInnerHint(props)}\n multiline\n hasError={core.hasError}\n errorText={core.errorText ?? null}\n focused={core.focused}\n hasValue={core.hasValue}\n textLength={core.text.length}\n trailingAffordance={affordance}\n onFocusRequest={core.focus}\n >\n <textarea\n {...core.elementProps}\n className=\"g9-field__textarea\"\n ios-spell-check={props.isSpellCheckEnabled !== false}\n ios-auto-correct={props.isTextPredictionEnabled !== false}\n style={{\n direction: core.textDirection,\n textAlign: core.textDirection === 'rtl' ? 'right' : 'left',\n ...(core.font ? { fontFamily: core.font } : {}),\n color: props.disabled ? 'var(--g9-text-disabled)' : 'var(--g9-text-primary)',\n ...(autoSize === 'disabled'\n ? { height: `${min}px` }\n : { minHeight: `${min}px`, ...(max > 0 ? { maxHeight: `${Math.max(min, max)}px` } : {}) }),\n paddingTop: `${G9Metrics.FloatingLabelClearance + 8}px`,\n paddingBottom: '8px',\n }}\n />\n </G9OutlinedField>\n );\n});\n"],"names":["G9Editor","forwardRef","props","ref","_props_minimumEditorHeight","_props_maxEditorHeight","_props_autoSize","_core_errorText","glyphs","useG9Settings","core","useTextInput","s","useImperativeHandle","affordance","min","max","autoSize","G9OutlinedField","resolveInnerHint","textarea","Math","G9Metrics"],"mappings":";;;;;AAgCO,MAAMA,kBAAWC,WAA0C,SAAkBC,KAAK,EAAEC,GAAG;QAYhFC,4BACAC,wBACKC,
|
|
1
|
+
{"version":3,"file":"fields/editor.jsx","sources":["../../src/fields/editor.tsx"],"sourcesContent":["import { G9Metrics } from '@g9tm/lynxcontrols-foundation';\nimport { forwardRef, type ReactNode, useImperativeHandle } from '@lynx-js/react';\nimport { useG9Settings } from '../provider/hooks';\nimport { G9OutlinedField, type G9TrailingAffordance, resolveInnerHint } from './outlined-field';\nimport { type G9TextInputHandle, type G9TextInputProps, useTextInput } from './use-text-input';\n\n/** How the editor grows (MAUI `EditorAutoSizeOption`). */\nexport type G9EditorAutoSize = 'disabled' | 'textChanges';\n\n/** Props of {@link G9Editor} (MAUI `G9Editor`). */\nexport interface G9EditorProps extends G9TextInputProps {\n /** Minimum height of the text area. Default 96. */\n readonly minimumEditorHeight?: number;\n /** Maximum height while growing; `0` (default) means unbounded. */\n readonly maxEditorHeight?: number;\n /** `'textChanges'` (default) grows with the text; `'disabled'` keeps `minimumEditorHeight`. */\n readonly autoSize?: G9EditorAutoSize;\n /** Spell checking (iOS `ios-spell-check`). Default true. */\n readonly isSpellCheckEnabled?: boolean;\n /** Word prediction / autocorrect (iOS `ios-auto-correct`). Default true. */\n readonly isTextPredictionEnabled?: boolean;\n}\n\n/** Imperative handle of {@link G9Editor}. */\nexport type G9EditorHandle = G9TextInputHandle;\n\n/**\n * Multi-line outlined text area (MAUI `G9Editor`): the text-entry behaviour on a `<textarea>`, a microphone pinned to\n * the bottom-end corner whenever dictation is available, height from `minimumEditorHeight`/`maxEditorHeight`/\n * `autoSize`. Validates on blur only for email/url/custom types (no `validator`, as in MAUI). Requires the host's\n * `xelement-input` registration.\n */\nexport const G9Editor = forwardRef<G9EditorHandle, G9EditorProps>(function G9Editor(props, ref): ReactNode {\n const glyphs = useG9Settings().glyphs;\n const core = useTextInput(props, { name: 'G9Editor.value', showMic: (s) => s.available });\n useImperativeHandle(ref, () => core.handle);\n const affordance: G9TrailingAffordance | null = core.showMic\n ? {\n icon: core.dictation.listening ? glyphs.micOff : glyphs.mic,\n color: core.dictation.listening ? 'var(--g9-error)' : 'var(--g9-primary)',\n signature: 'voice',\n onPress: core.pressMic,\n }\n : null;\n const min = props.minimumEditorHeight ?? 96;\n const max = props.maxEditorHeight ?? 0;\n const autoSize = props.autoSize ?? 'textChanges';\n return (\n <G9OutlinedField\n anchor={{\n kind: 'entry',\n label: () => props.label ?? props.placeholder,\n enabled: () => !props.disabled,\n capabilities: {\n getValue: () => core.text,\n setValue: (v: string) => {\n core.setText(v, { source: 'programmatic' });\n },\n focus: () => core.focus(),\n },\n }}\n {...props}\n hint={resolveInnerHint(props)}\n multiline\n hasError={core.hasError}\n errorText={core.errorText ?? null}\n focused={core.focused}\n hasValue={core.hasValue}\n textLength={core.text.length}\n trailingAffordance={affordance}\n onFocusRequest={core.focus}\n >\n <textarea\n {...core.elementProps}\n className=\"g9-field__textarea\"\n ios-spell-check={props.isSpellCheckEnabled !== false}\n ios-auto-correct={props.isTextPredictionEnabled !== false}\n style={{\n direction: core.textDirection,\n textAlign: core.textDirection === 'rtl' ? 'right' : 'left',\n ...(core.font ? { fontFamily: core.font } : {}),\n color: props.disabled ? 'var(--g9-text-disabled)' : 'var(--g9-text-primary)',\n ...(autoSize === 'disabled'\n ? { height: `${min}px` }\n : { minHeight: `${min}px`, ...(max > 0 ? { maxHeight: `${Math.max(min, max)}px` } : {}) }),\n paddingTop: `${G9Metrics.FloatingLabelClearance + 8}px`,\n paddingBottom: '8px',\n }}\n />\n </G9OutlinedField>\n );\n});\n"],"names":["G9Editor","forwardRef","props","ref","_props_minimumEditorHeight","_props_maxEditorHeight","_props_autoSize","_core_errorText","glyphs","useG9Settings","core","useTextInput","s","useImperativeHandle","affordance","min","max","autoSize","G9OutlinedField","_props_label","v","resolveInnerHint","textarea","Math","G9Metrics"],"mappings":";;;;;AAgCO,MAAMA,kBAAWC,WAA0C,SAAkBC,KAAK,EAAEC,GAAG;QAYhFC,4BACAC,wBACKC,iBAmBFC;IAhCf,MAAMC,SAASC,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KAAK,YAAY,EACrB,UAAU,qBACV,iBAAiBR,AAA8B,UAA9BA,MAAM,mBAAmB,EAC1C,kBAAkBA,AAAkC,UAAlCA,MAAM,uBAAuB,EAC/C,OAAO;QACL,WAAWQ,KAAK,aAAa;QAC7B,WAAWA,AAAuB,UAAvBA,KAAK,aAAa,GAAa,UAAU;QACpD,GAAIA,KAAK,IAAI,GAAG;YAAE,YAAYA,KAAK,IAAI;QAAC,IAAI,CAAC,CAAC;QAC9C,OAAOR,MAAM,QAAQ,GAAG,4BAA4B;QACpD,GAAIe,AAAa,eAAbA,WACA;YAAE,QAAQ,GAAGF,IAAI,EAAE,CAAC;QAAC,IACrB;YAAE,WAAW,GAAGA,IAAI,EAAE,CAAC;YAAE,GAAIC,MAAM,IAAI;gBAAE,WAAW,GAAGO,KAAK,GAAG,CAACR,KAAKC,KAAK,EAAE,CAAC;YAAC,IAAI,CAAC,CAAC;QAAE,CAAC;QAC3F,YAAY,GAAGQ,UAAU,sBAAsB,GAAG,EAAE,EAAE,CAAC;QACvD,eAAe;IACjB,IACA;IACJ,EAAEN;AAEN"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import './fields.css';
|
|
2
2
|
import { G9FilledValueHighlight, type G9ImageSource } from '@g9tm/lynxcontrols-foundation';
|
|
3
3
|
import { type ReactNode } from '@lynx-js/react';
|
|
4
|
+
import type { G9AnchorInfo } from '../anchor/registry.js';
|
|
4
5
|
import type { G9IconInput } from '../icon/icon.js';
|
|
5
6
|
import { type G9PhysicalPadding } from './slot-layout.js';
|
|
6
7
|
/** Props every outlined field shares (the public members of MAUI `G9OutlinedFieldBase`). */
|
|
@@ -10,6 +11,11 @@ export interface G9OutlinedFieldProps {
|
|
|
10
11
|
* it to `[A-Za-z0-9_-]`.
|
|
11
12
|
*/
|
|
12
13
|
readonly id?: string;
|
|
14
|
+
/**
|
|
15
|
+
* What the field is and can do as an anchor (`@g9tm/lynxcontrols/anchor`); the text inputs pass their value paths.
|
|
16
|
+
* Registered only with an `id`.
|
|
17
|
+
*/
|
|
18
|
+
readonly anchor?: G9AnchorInfo;
|
|
13
19
|
/** Floating label. Without it the placeholder is the label (MAUI `Label ?? Placeholder`). */
|
|
14
20
|
readonly label?: string | null;
|
|
15
21
|
/** Placeholder; shown as the label when `label` is not set. */
|