@cratis/scene.primereact 4.15.0 → 4.17.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/cjs/form/PrimeCalendar.js +3 -1
- package/dist/cjs/form/PrimeCalendar.js.map +1 -1
- package/dist/cjs/form/PrimeCheckbox.js +4 -2
- package/dist/cjs/form/PrimeCheckbox.js.map +1 -1
- package/dist/cjs/form/PrimeDropdown.js +3 -1
- package/dist/cjs/form/PrimeDropdown.js.map +1 -1
- package/dist/cjs/form/PrimeInputNumber.js +3 -1
- package/dist/cjs/form/PrimeInputNumber.js.map +1 -1
- package/dist/cjs/form/PrimeInputText.js +3 -1
- package/dist/cjs/form/PrimeInputText.js.map +1 -1
- package/dist/cjs/form/PrimeInputTextarea.js +3 -1
- package/dist/cjs/form/PrimeInputTextarea.js.map +1 -1
- package/dist/cjs/form/PrimeMultiSelect.js +3 -1
- package/dist/cjs/form/PrimeMultiSelect.js.map +1 -1
- package/dist/cjs/form/PrimePassword.js +3 -1
- package/dist/cjs/form/PrimePassword.js.map +1 -1
- package/dist/cjs/form/PrimeRadioButton.js +3 -1
- package/dist/cjs/form/PrimeRadioButton.js.map +1 -1
- package/dist/cjs/form/PrimeToggleSwitch.js +4 -1
- package/dist/cjs/form/PrimeToggleSwitch.js.map +1 -1
- package/dist/cjs/inputDescriptors.js +86 -0
- package/dist/cjs/inputDescriptors.js.map +1 -0
- package/dist/cjs/primeReactDescriptors.js +2 -0
- package/dist/cjs/primeReactDescriptors.js.map +1 -1
- package/dist/esm/form/PrimeCalendar.d.ts +1 -1
- package/dist/esm/form/PrimeCalendar.d.ts.map +1 -1
- package/dist/esm/form/PrimeCalendar.js +3 -1
- package/dist/esm/form/PrimeCalendar.js.map +1 -1
- package/dist/esm/form/PrimeCheckbox.d.ts +1 -1
- package/dist/esm/form/PrimeCheckbox.d.ts.map +1 -1
- package/dist/esm/form/PrimeCheckbox.js +4 -2
- package/dist/esm/form/PrimeCheckbox.js.map +1 -1
- package/dist/esm/form/PrimeDropdown.d.ts +1 -1
- package/dist/esm/form/PrimeDropdown.d.ts.map +1 -1
- package/dist/esm/form/PrimeDropdown.js +3 -1
- package/dist/esm/form/PrimeDropdown.js.map +1 -1
- package/dist/esm/form/PrimeInputNumber.d.ts +1 -1
- package/dist/esm/form/PrimeInputNumber.d.ts.map +1 -1
- package/dist/esm/form/PrimeInputNumber.js +3 -1
- package/dist/esm/form/PrimeInputNumber.js.map +1 -1
- package/dist/esm/form/PrimeInputText.d.ts +1 -1
- package/dist/esm/form/PrimeInputText.d.ts.map +1 -1
- package/dist/esm/form/PrimeInputText.js +3 -1
- package/dist/esm/form/PrimeInputText.js.map +1 -1
- package/dist/esm/form/PrimeInputTextarea.d.ts +1 -1
- package/dist/esm/form/PrimeInputTextarea.d.ts.map +1 -1
- package/dist/esm/form/PrimeInputTextarea.js +3 -1
- package/dist/esm/form/PrimeInputTextarea.js.map +1 -1
- package/dist/esm/form/PrimeMultiSelect.d.ts +1 -1
- package/dist/esm/form/PrimeMultiSelect.d.ts.map +1 -1
- package/dist/esm/form/PrimeMultiSelect.js +3 -1
- package/dist/esm/form/PrimeMultiSelect.js.map +1 -1
- package/dist/esm/form/PrimePassword.d.ts +1 -1
- package/dist/esm/form/PrimePassword.d.ts.map +1 -1
- package/dist/esm/form/PrimePassword.js +3 -1
- package/dist/esm/form/PrimePassword.js.map +1 -1
- package/dist/esm/form/PrimeRadioButton.d.ts +1 -1
- package/dist/esm/form/PrimeRadioButton.d.ts.map +1 -1
- package/dist/esm/form/PrimeRadioButton.js +3 -1
- package/dist/esm/form/PrimeRadioButton.js.map +1 -1
- package/dist/esm/form/PrimeToggleSwitch.d.ts +1 -1
- package/dist/esm/form/PrimeToggleSwitch.d.ts.map +1 -1
- package/dist/esm/form/PrimeToggleSwitch.js +4 -1
- package/dist/esm/form/PrimeToggleSwitch.js.map +1 -1
- package/dist/esm/inputDescriptors.d.ts +3 -0
- package/dist/esm/inputDescriptors.d.ts.map +1 -0
- package/dist/esm/inputDescriptors.js +84 -0
- package/dist/esm/inputDescriptors.js.map +1 -0
- package/dist/esm/primeReactDescriptors.d.ts.map +1 -1
- package/dist/esm/primeReactDescriptors.js +2 -0
- package/dist/esm/primeReactDescriptors.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/form/PrimeCalendar.tsx +3 -2
- package/form/PrimeCheckbox.tsx +4 -3
- package/form/PrimeDropdown.tsx +3 -2
- package/form/PrimeInputNumber.tsx +3 -2
- package/form/PrimeInputText.tsx +3 -2
- package/form/PrimeInputTextarea.tsx +3 -2
- package/form/PrimeMultiSelect.tsx +3 -2
- package/form/PrimePassword.tsx +3 -2
- package/form/PrimeRadioButton.tsx +3 -2
- package/form/PrimeToggleSwitch.tsx +4 -2
- package/inputDescriptors.ts +38 -0
- package/package.json +7 -7
- package/primeReactDescriptors.ts +2 -0
|
@@ -4,6 +4,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
4
4
|
var react = require('react');
|
|
5
5
|
var datepicker = require('primereact/datepicker');
|
|
6
6
|
var inputtext = require('primereact/inputtext');
|
|
7
|
+
var scene_react = require('@cratis/scene.react');
|
|
7
8
|
var properties = require('../properties.js');
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -19,13 +20,14 @@ var properties = require('../properties.js');
|
|
|
19
20
|
* here and then placed one of two ways, which is how `inline` survives a version that has no `inline`
|
|
20
21
|
* prop: either inside a `Panel`, which simply renders where it stands, or behind a `Portal` and a
|
|
21
22
|
* `Positioner`, which anchors it to the field and escapes any clipping ancestor.
|
|
22
|
-
*/ function PrimeCalendar({ element }) {
|
|
23
|
+
*/ function PrimeCalendar({ element, bindingOutputs }) {
|
|
23
24
|
const [value, setValue] = react.useState(()=>{
|
|
24
25
|
const seed = properties.stringProperty(element, 'value');
|
|
25
26
|
if (seed === undefined) return undefined;
|
|
26
27
|
const parsed = new Date(seed);
|
|
27
28
|
return Number.isNaN(parsed.getTime()) ? undefined : parsed;
|
|
28
29
|
});
|
|
30
|
+
scene_react.useValueOutput(bindingOutputs, value);
|
|
29
31
|
const inline = properties.booleanProperty(element, 'inline', false);
|
|
30
32
|
const showTime = properties.booleanProperty(element, 'showTime', false);
|
|
31
33
|
const calendar = /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrimeCalendar.js","sources":["../../../form/PrimeCalendar.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useState } from 'react';\nimport { DatePicker } from 'primereact/datepicker';\nimport { InputText } from 'primereact/inputtext';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { booleanProperty, stringProperty } from '../properties';\n\n/**\n * The `PrimeReact:calendar` component - a date picker, named `DatePicker` by PrimeReact 11.\n *\n * The seed value is parsed from an ISO date string because that is what survives a round trip through a\n * Scene model's JSON properties; an unparseable one leaves the field empty rather than showing\n * \"Invalid Date\".\n *\n * v11's `DatePicker` is a composition, and the grid is the bulk of it: `Calendar` holds a `Header` (the\n * month/year title flanked by the two navigation buttons) and a `Table` whose three `TableBody` views are\n * what makes clicking the title drill from days to months to years. That whole calendar is built once\n * here and then placed one of two ways, which is how `inline` survives a version that has no `inline`\n * prop: either inside a `Panel`, which simply renders where it stands, or behind a `Portal` and a\n * `Positioner`, which anchors it to the field and escapes any clipping ancestor.\n */\nexport function PrimeCalendar({ element }: RegisteredComponentProps) {\n const [value, setValue] = useState<Date | undefined>(() => {\n const seed = stringProperty(element, 'value');\n if (seed === undefined) return undefined;\n const parsed = new Date(seed);\n return Number.isNaN(parsed.getTime()) ? undefined : parsed;\n });\n\n const inline = booleanProperty(element, 'inline', false);\n const showTime = booleanProperty(element, 'showTime', false);\n const calendar = (\n <>\n <DatePicker.Calendar>\n <DatePicker.Header>\n <DatePicker.Prev>\n <i className='pi pi-chevron-left' />\n </DatePicker.Prev>\n <DatePicker.Title>\n <DatePicker.SelectMonth />\n <DatePicker.SelectYear />\n <DatePicker.Decade />\n </DatePicker.Title>\n <DatePicker.Next>\n <i className='pi pi-chevron-right' />\n </DatePicker.Next>\n </DatePicker.Header>\n <DatePicker.Table>\n <DatePicker.TableHead />\n <DatePicker.TableBody />\n <DatePicker.TableBody view='month' />\n <DatePicker.TableBody view='year' />\n </DatePicker.Table>\n </DatePicker.Calendar>\n {showTime && <DatePicker.Time />}\n </>\n );\n\n return (\n <DatePicker.Root\n data-scene-id={element.id}\n value={value}\n onValueChange={(event) => setValue(event.value instanceof Date ? event.value : undefined)}\n dateFormat={stringProperty(element, 'dateFormat')}\n showTime={showTime}\n disabled={booleanProperty(element, 'disabled', false)}>\n {inline ? (\n <DatePicker.Panel>{calendar}</DatePicker.Panel>\n ) : (\n <>\n <DatePicker.Input as={InputText} placeholder={stringProperty(element, 'placeholder')} aria-label={stringProperty(element, 'ariaLabel')} />\n {booleanProperty(element, 'showIcon', true) && (\n <DatePicker.Trigger>\n <i className='pi pi-calendar' />\n </DatePicker.Trigger>\n )}\n <DatePicker.Portal>\n <DatePicker.Positioner align='start'>\n <DatePicker.Popup>{calendar}</DatePicker.Popup>\n </DatePicker.Positioner>\n </DatePicker.Portal>\n </>\n )}\n </DatePicker.Root>\n );\n}\n"],"names":["PrimeCalendar","element","value","setValue","useState","seed","stringProperty","undefined","parsed","Date","Number","isNaN","getTime","inline","booleanProperty","showTime","calendar","_jsxs","_Fragment","DatePicker","Calendar","Header","_jsx","Prev","i","className","Title","SelectMonth","SelectYear","Decade","Next","Table","TableHead","TableBody","view","Time","Root","data-scene-id","id","onValueChange","event","dateFormat","disabled","Panel","Input","as","InputText","placeholder","aria-label","Trigger","Portal","Positioner","align","Popup"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PrimeCalendar.js","sources":["../../../form/PrimeCalendar.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useState } from 'react';\nimport { DatePicker } from 'primereact/datepicker';\nimport { InputText } from 'primereact/inputtext';\nimport { RegisteredComponentProps, useValueOutput } from '@cratis/scene.react';\nimport { booleanProperty, stringProperty } from '../properties';\n\n/**\n * The `PrimeReact:calendar` component - a date picker, named `DatePicker` by PrimeReact 11.\n *\n * The seed value is parsed from an ISO date string because that is what survives a round trip through a\n * Scene model's JSON properties; an unparseable one leaves the field empty rather than showing\n * \"Invalid Date\".\n *\n * v11's `DatePicker` is a composition, and the grid is the bulk of it: `Calendar` holds a `Header` (the\n * month/year title flanked by the two navigation buttons) and a `Table` whose three `TableBody` views are\n * what makes clicking the title drill from days to months to years. That whole calendar is built once\n * here and then placed one of two ways, which is how `inline` survives a version that has no `inline`\n * prop: either inside a `Panel`, which simply renders where it stands, or behind a `Portal` and a\n * `Positioner`, which anchors it to the field and escapes any clipping ancestor.\n */\nexport function PrimeCalendar({ element, bindingOutputs }: RegisteredComponentProps) {\n const [value, setValue] = useState<Date | undefined>(() => {\n const seed = stringProperty(element, 'value');\n if (seed === undefined) return undefined;\n const parsed = new Date(seed);\n return Number.isNaN(parsed.getTime()) ? undefined : parsed;\n });\n useValueOutput(bindingOutputs, value);\n\n const inline = booleanProperty(element, 'inline', false);\n const showTime = booleanProperty(element, 'showTime', false);\n const calendar = (\n <>\n <DatePicker.Calendar>\n <DatePicker.Header>\n <DatePicker.Prev>\n <i className='pi pi-chevron-left' />\n </DatePicker.Prev>\n <DatePicker.Title>\n <DatePicker.SelectMonth />\n <DatePicker.SelectYear />\n <DatePicker.Decade />\n </DatePicker.Title>\n <DatePicker.Next>\n <i className='pi pi-chevron-right' />\n </DatePicker.Next>\n </DatePicker.Header>\n <DatePicker.Table>\n <DatePicker.TableHead />\n <DatePicker.TableBody />\n <DatePicker.TableBody view='month' />\n <DatePicker.TableBody view='year' />\n </DatePicker.Table>\n </DatePicker.Calendar>\n {showTime && <DatePicker.Time />}\n </>\n );\n\n return (\n <DatePicker.Root\n data-scene-id={element.id}\n value={value}\n onValueChange={(event) => setValue(event.value instanceof Date ? event.value : undefined)}\n dateFormat={stringProperty(element, 'dateFormat')}\n showTime={showTime}\n disabled={booleanProperty(element, 'disabled', false)}>\n {inline ? (\n <DatePicker.Panel>{calendar}</DatePicker.Panel>\n ) : (\n <>\n <DatePicker.Input as={InputText} placeholder={stringProperty(element, 'placeholder')} aria-label={stringProperty(element, 'ariaLabel')} />\n {booleanProperty(element, 'showIcon', true) && (\n <DatePicker.Trigger>\n <i className='pi pi-calendar' />\n </DatePicker.Trigger>\n )}\n <DatePicker.Portal>\n <DatePicker.Positioner align='start'>\n <DatePicker.Popup>{calendar}</DatePicker.Popup>\n </DatePicker.Positioner>\n </DatePicker.Portal>\n </>\n )}\n </DatePicker.Root>\n );\n}\n"],"names":["PrimeCalendar","element","bindingOutputs","value","setValue","useState","seed","stringProperty","undefined","parsed","Date","Number","isNaN","getTime","useValueOutput","inline","booleanProperty","showTime","calendar","_jsxs","_Fragment","DatePicker","Calendar","Header","_jsx","Prev","i","className","Title","SelectMonth","SelectYear","Decade","Next","Table","TableHead","TableBody","view","Time","Root","data-scene-id","id","onValueChange","event","dateFormat","disabled","Panel","Input","as","InputText","placeholder","aria-label","Trigger","Portal","Positioner","align","Popup"],"mappings":";;;;;;;;;AASA;;;;;;;;;;;;;AAaC,IACM,SAASA,aAAAA,CAAc,EAAEC,OAAO,EAAEC,cAAc,EAA4B,EAAA;AAC/E,IAAA,MAAM,CAACC,KAAAA,EAAOC,QAAAA,CAAS,GAAGC,cAAAA,CAA2B,IAAA;QACjD,MAAMC,IAAAA,GAAOC,0BAAeN,OAAAA,EAAS,OAAA,CAAA;QACrC,IAAIK,IAAAA,KAASE,WAAW,OAAOA,SAAAA;QAC/B,MAAMC,MAAAA,GAAS,IAAIC,IAAAA,CAAKJ,IAAAA,CAAAA;AACxB,QAAA,OAAOK,OAAOC,KAAK,CAACH,MAAAA,CAAOI,OAAO,MAAML,SAAAA,GAAYC,MAAAA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|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var react = require('react');
|
|
5
5
|
var checkbox = require('primereact/checkbox');
|
|
6
|
+
var scene_react = require('@cratis/scene.react');
|
|
6
7
|
var properties = require('../properties.js');
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -15,8 +16,9 @@ var properties = require('../properties.js');
|
|
|
15
16
|
* state, `Box` is the square, and `Indicator` is what appears inside it when checked. The `checked` state
|
|
16
17
|
* now arrives as `onCheckedChange` with a boolean rather than a change event whose `checked` might be
|
|
17
18
|
* `undefined`, so the defensive `=== true` the v10 adapter needed is gone.
|
|
18
|
-
*/ function PrimeCheckbox({ element }) {
|
|
19
|
+
*/ function PrimeCheckbox({ element, bindingOutputs }) {
|
|
19
20
|
const [checked, setChecked] = react.useState(properties.booleanProperty(element, 'checked', false));
|
|
21
|
+
scene_react.useValueOutput(bindingOutputs, checked);
|
|
20
22
|
const label = properties.stringProperty(element, 'label');
|
|
21
23
|
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
22
24
|
"data-scene-id": element.id,
|
|
@@ -24,7 +26,7 @@ var properties = require('../properties.js');
|
|
|
24
26
|
children: [
|
|
25
27
|
/*#__PURE__*/ jsxRuntime.jsx(checkbox.Checkbox.Root, {
|
|
26
28
|
inputId: element.id,
|
|
27
|
-
|
|
29
|
+
ariaLabel: label === undefined ? properties.stringProperty(element, 'ariaLabel') : undefined,
|
|
28
30
|
checked: checked,
|
|
29
31
|
onCheckedChange: (event)=>setChecked(event.checked),
|
|
30
32
|
disabled: properties.booleanProperty(element, 'disabled', false),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrimeCheckbox.js","sources":["../../../form/PrimeCheckbox.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useState } from 'react';\nimport { Checkbox } from 'primereact/checkbox';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { booleanProperty, stringProperty } from '../properties';\n\n/**\n * The `PrimeReact:checkbox` component.\n *\n * Rendered with its label rather than bare: an unlabeled checkbox has no accessible name and nothing to\n * click but a 20-pixel box, which is a defect in every screen that would ever use one.\n *\n * PrimeReact 11 makes the tick its own part: `Root` renders the real (visually hidden) input and owns the\n * state, `Box` is the square, and `Indicator` is what appears inside it when checked. The `checked` state\n * now arrives as `onCheckedChange` with a boolean rather than a change event whose `checked` might be\n * `undefined`, so the defensive `=== true` the v10 adapter needed is gone.\n */\nexport function PrimeCheckbox({ element }: RegisteredComponentProps) {\n const [checked, setChecked] = useState(booleanProperty(element, 'checked', false));\n const label = stringProperty(element, 'label');\n return (\n <div data-scene-id={element.id} className='flex items-center gap-2'>\n <Checkbox.Root\n inputId={element.id}\n
|
|
1
|
+
{"version":3,"file":"PrimeCheckbox.js","sources":["../../../form/PrimeCheckbox.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useState } from 'react';\nimport { Checkbox } from 'primereact/checkbox';\nimport { RegisteredComponentProps, useValueOutput } from '@cratis/scene.react';\nimport { booleanProperty, stringProperty } from '../properties';\n\n/**\n * The `PrimeReact:checkbox` component.\n *\n * Rendered with its label rather than bare: an unlabeled checkbox has no accessible name and nothing to\n * click but a 20-pixel box, which is a defect in every screen that would ever use one.\n *\n * PrimeReact 11 makes the tick its own part: `Root` renders the real (visually hidden) input and owns the\n * state, `Box` is the square, and `Indicator` is what appears inside it when checked. The `checked` state\n * now arrives as `onCheckedChange` with a boolean rather than a change event whose `checked` might be\n * `undefined`, so the defensive `=== true` the v10 adapter needed is gone.\n */\nexport function PrimeCheckbox({ element, bindingOutputs }: RegisteredComponentProps) {\n const [checked, setChecked] = useState(booleanProperty(element, 'checked', false));\n useValueOutput(bindingOutputs, checked);\n const label = stringProperty(element, 'label');\n return (\n <div data-scene-id={element.id} className='flex items-center gap-2'>\n <Checkbox.Root\n inputId={element.id}\n ariaLabel={label === undefined ? stringProperty(element, 'ariaLabel') : undefined}\n checked={checked}\n onCheckedChange={(event) => setChecked(event.checked)}\n disabled={booleanProperty(element, 'disabled', false)}>\n <Checkbox.Box>\n <Checkbox.Indicator />\n </Checkbox.Box>\n </Checkbox.Root>\n {label !== undefined && <label htmlFor={element.id}>{label}</label>}\n </div>\n );\n}\n"],"names":["PrimeCheckbox","element","bindingOutputs","checked","setChecked","useState","booleanProperty","useValueOutput","label","stringProperty","_jsxs","div","data-scene-id","id","className","_jsx","Checkbox","Root","inputId","ariaLabel","undefined","onCheckedChange","event","disabled","Box","Indicator","htmlFor"],"mappings":";;;;;;;;AAQA;;;;;;;;;;AAUC,IACM,SAASA,aAAAA,CAAc,EAAEC,OAAO,EAAEC,cAAc,EAA4B,EAAA;AAC/E,IAAA,MAAM,CAACC,OAAAA,EAASC,UAAAA,CAAW,GAAGC,cAAAA,CAASC,0BAAAA,CAAgBL,SAAS,SAAA,EAAW,KAAA,CAAA,CAAA;AAC3EM,IAAAA,0BAAAA,CAAeL,cAAAA,EAAgBC,OAAAA,CAAAA;IAC/B,MAAMK,KAAAA,GAAQC,0BAAeR,OAAAA,EAAS,OAAA,CAAA;AACtC,IAAA,qBACIS,eAAA,CAACC,KAAAA,EAAAA;AAAIC,QAAAA,eAAAA,EAAeX,QAAQY,EAAE;QAAEC,SAAAA,EAAU,yBAAA;;AACtC,0BAAAC,cAAA,CAACC,kBAASC,IAAI,EAAA;AACVC,gBAAAA,OAAAA,EAASjB,QAAQY,EAAE;AACnBM,gBAAAA,SAAAA,EAAWX,KAAAA,KAAUY,SAAAA,GAAYX,yBAAAA,CAAeR,OAAAA,EAAS,WAAA,CAAA,GAAemB,SAAAA;gBACxEjB,OAAAA,EAASA,OAAAA;AACTkB,gBAAAA,eAAAA,EAAiB,CAACC,KAAAA,GAAUlB,UAAAA,CAAWkB,KAAAA,CAAMnB,OAAO,CAAA;gBACpDoB,QAAAA,EAAUjB,0BAAAA,CAAgBL,SAAS,UAAA,EAAY,KAAA,CAAA;wCAC/Cc,cAAA,CAACC,kBAASQ,GAAG,EAAA;4CACTT,cAAA,CAACC,kBAASS,SAAS,EAAA,EAAA;;;AAG1BjB,YAAAA,KAAAA,KAAUY,2BAAaL,cAAA,CAACP,OAAAA,EAAAA;AAAMkB,gBAAAA,OAAAA,EAASzB,QAAQY,EAAE;AAAGL,gBAAAA,QAAAA,EAAAA;;;;AAGjE;;"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var react = require('react');
|
|
5
5
|
var select = require('primereact/select');
|
|
6
|
+
var scene_react = require('@cratis/scene.react');
|
|
6
7
|
var properties = require('../properties.js');
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -17,8 +18,9 @@ var properties = require('../properties.js');
|
|
|
17
18
|
* here, and adding one would only duplicate what `optionLabel` / `optionValue` already say. The `appendTo`
|
|
18
19
|
* and z-index juggling a dropdown inside a dialog used to need is gone with it: the portal stacks
|
|
19
20
|
* correctly on its own.
|
|
20
|
-
*/ function PrimeDropdown({ element }) {
|
|
21
|
+
*/ function PrimeDropdown({ element, bindingOutputs }) {
|
|
21
22
|
const [value, setValue] = react.useState(properties.stringProperty(element, 'value'));
|
|
23
|
+
scene_react.useValueOutput(bindingOutputs, value);
|
|
22
24
|
const placeholder = properties.stringProperty(element, 'placeholder', 'Select');
|
|
23
25
|
const filter = properties.booleanProperty(element, 'filter', false);
|
|
24
26
|
const showClear = properties.booleanProperty(element, 'showClear', false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrimeDropdown.js","sources":["../../../form/PrimeDropdown.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useState } from 'react';\nimport { Select } from 'primereact/select';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { booleanProperty, optionsProperty, stringProperty } from '../properties';\n\n/**\n * The `PrimeReact:dropdown` component - a single-choice select.\n *\n * Options are normalized by `optionsProperty`, so a screen may write either bare strings or\n * `{ label, value }` records and get the same result.\n *\n * PrimeReact calls this `Select`, and it is a composition rather than one component: `Root` owns the\n * value and the option model, `Trigger` is what the user clicks, and the list lives behind a `Portal` so\n * it escapes any clipping ancestor. `Select.List` renders `options` itself - there is no option mapping\n * here, and adding one would only duplicate what `optionLabel` / `optionValue` already say. The `appendTo`\n * and z-index juggling a dropdown inside a dialog used to need is gone with it: the portal stacks\n * correctly on its own.\n */\nexport function PrimeDropdown({ element }: RegisteredComponentProps) {\n const [value, setValue] = useState<unknown>(stringProperty(element, 'value'));\n const placeholder = stringProperty(element, 'placeholder', 'Select');\n const filter = booleanProperty(element, 'filter', false);\n const showClear = booleanProperty(element, 'showClear', false);\n return (\n <Select.Root\n data-scene-id={element.id}\n value={value}\n onValueChange={(event) => setValue(event.value)}\n options={optionsProperty(element, 'options')}\n optionLabel='label'\n optionValue='value'\n filter={filter}\n disabled={booleanProperty(element, 'disabled', false)}>\n <Select.Trigger aria-label={stringProperty(element, 'ariaLabel')}>\n <Select.Value placeholder={placeholder} />\n {showClear && <Select.Clear />}\n <Select.Arrow />\n </Select.Trigger>\n <Select.Portal>\n <Select.Positioner>\n <Select.Popup>\n {filter && <Select.Filter placeholder={placeholder} />}\n <Select.List />\n </Select.Popup>\n </Select.Positioner>\n </Select.Portal>\n </Select.Root>\n );\n}\n"],"names":["PrimeDropdown","element","value","setValue","useState","stringProperty","placeholder","filter","booleanProperty","showClear","_jsxs","Select","Root","data-scene-id","id","onValueChange","event","options","optionsProperty","optionLabel","optionValue","disabled","Trigger","aria-label","_jsx","Value","Clear","Arrow","Portal","Positioner","Popup","Filter","List"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PrimeDropdown.js","sources":["../../../form/PrimeDropdown.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useState } from 'react';\nimport { Select } from 'primereact/select';\nimport { RegisteredComponentProps, useValueOutput } from '@cratis/scene.react';\nimport { booleanProperty, optionsProperty, stringProperty } from '../properties';\n\n/**\n * The `PrimeReact:dropdown` component - a single-choice select.\n *\n * Options are normalized by `optionsProperty`, so a screen may write either bare strings or\n * `{ label, value }` records and get the same result.\n *\n * PrimeReact calls this `Select`, and it is a composition rather than one component: `Root` owns the\n * value and the option model, `Trigger` is what the user clicks, and the list lives behind a `Portal` so\n * it escapes any clipping ancestor. `Select.List` renders `options` itself - there is no option mapping\n * here, and adding one would only duplicate what `optionLabel` / `optionValue` already say. The `appendTo`\n * and z-index juggling a dropdown inside a dialog used to need is gone with it: the portal stacks\n * correctly on its own.\n */\nexport function PrimeDropdown({ element, bindingOutputs }: RegisteredComponentProps) {\n const [value, setValue] = useState<unknown>(stringProperty(element, 'value'));\n useValueOutput(bindingOutputs, value);\n const placeholder = stringProperty(element, 'placeholder', 'Select');\n const filter = booleanProperty(element, 'filter', false);\n const showClear = booleanProperty(element, 'showClear', false);\n return (\n <Select.Root\n data-scene-id={element.id}\n value={value}\n onValueChange={(event) => setValue(event.value)}\n options={optionsProperty(element, 'options')}\n optionLabel='label'\n optionValue='value'\n filter={filter}\n disabled={booleanProperty(element, 'disabled', false)}>\n <Select.Trigger aria-label={stringProperty(element, 'ariaLabel')}>\n <Select.Value placeholder={placeholder} />\n {showClear && <Select.Clear />}\n <Select.Arrow />\n </Select.Trigger>\n <Select.Portal>\n <Select.Positioner>\n <Select.Popup>\n {filter && <Select.Filter placeholder={placeholder} />}\n <Select.List />\n </Select.Popup>\n </Select.Positioner>\n </Select.Portal>\n </Select.Root>\n );\n}\n"],"names":["PrimeDropdown","element","bindingOutputs","value","setValue","useState","stringProperty","useValueOutput","placeholder","filter","booleanProperty","showClear","_jsxs","Select","Root","data-scene-id","id","onValueChange","event","options","optionsProperty","optionLabel","optionValue","disabled","Trigger","aria-label","_jsx","Value","Clear","Arrow","Portal","Positioner","Popup","Filter","List"],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K,EAAA,EAAA;;;AAEjB,0BAAAH,cAAA,CAACb,cAAOiB,MAAM,EAAA;wCACVJ,cAAA,CAACb,cAAOkB,UAAU,EAAA;4CACdnB,eAAA,CAACC,cAAOmB,KAAK,EAAA;;4BACRvB,MAAAA,kBAAUiB,cAAA,CAACb,cAAOoB,MAAM,EAAA;gCAACzB,WAAAA,EAAaA;;AACvC,0CAAAkB,cAAA,CAACb,cAAOqB,IAAI,EAAA,EAAA;;;;;;;AAMpC;;"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var react = require('react');
|
|
5
5
|
var inputnumber = require('primereact/inputnumber');
|
|
6
|
+
var scene_react = require('@cratis/scene.react');
|
|
6
7
|
var properties = require('../properties.js');
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -15,8 +16,9 @@ var properties = require('../properties.js');
|
|
|
15
16
|
* formats into, which is also why `placeholder` moved onto the input rather than the root. `showButtons`
|
|
16
17
|
* is no longer a flag the component interprets - the spinner is a `Group` of `Increment` and `Decrement`
|
|
17
18
|
* you either render or do not - so the property now decides whether that group exists at all.
|
|
18
|
-
*/ function PrimeInputNumber({ element }) {
|
|
19
|
+
*/ function PrimeInputNumber({ element, bindingOutputs }) {
|
|
19
20
|
const [value, setValue] = react.useState(properties.numberProperty(element, 'value'));
|
|
21
|
+
scene_react.useValueOutput(bindingOutputs, value);
|
|
20
22
|
const currency = properties.stringProperty(element, 'currency');
|
|
21
23
|
return /*#__PURE__*/ jsxRuntime.jsxs(inputnumber.InputNumber.Root, {
|
|
22
24
|
"data-scene-id": element.id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrimeInputNumber.js","sources":["../../../form/PrimeInputNumber.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useState } from 'react';\nimport { InputNumber } from 'primereact/inputnumber';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { booleanProperty, numberProperty, stringProperty } from '../properties';\n\n/**\n * The `PrimeReact:inputNumber` component - a numeric field with locale-aware formatting.\n *\n * `mode` and `currency` are passed straight through because that is where InputNumber earns its keep\n * over a plain text field: it formats and parses in the user's locale rather than making a screen do it.\n *\n * PrimeReact 11 splits the component in two: `Root` holds the number model and `Input` is the field it\n * formats into, which is also why `placeholder` moved onto the input rather than the root. `showButtons`\n * is no longer a flag the component interprets - the spinner is a `Group` of `Increment` and `Decrement`\n * you either render or do not - so the property now decides whether that group exists at all.\n */\nexport function PrimeInputNumber({ element }: RegisteredComponentProps) {\n const [value, setValue] = useState<number | undefined>(numberProperty(element, 'value'));\n const currency = stringProperty(element, 'currency');\n return (\n <InputNumber.Root\n data-scene-id={element.id}\n value={value}\n onValueChange={(event) => setValue(typeof event.value === 'number' ? event.value : undefined)}\n mode={currency === undefined ? 'decimal' : 'currency'}\n currency={currency}\n min={numberProperty(element, 'min')}\n max={numberProperty(element, 'max')}\n disabled={booleanProperty(element, 'disabled', false)}>\n <InputNumber.Input placeholder={stringProperty(element, 'placeholder')} aria-label={stringProperty(element, 'ariaLabel')} />\n {booleanProperty(element, 'showButtons', false) && (\n <InputNumber.Group>\n <InputNumber.Increment>\n <i className='pi pi-chevron-up' />\n </InputNumber.Increment>\n <InputNumber.Decrement>\n <i className='pi pi-chevron-down' />\n </InputNumber.Decrement>\n </InputNumber.Group>\n )}\n </InputNumber.Root>\n );\n}\n"],"names":["PrimeInputNumber","element","value","setValue","useState","numberProperty","currency","stringProperty","_jsxs","InputNumber","Root","data-scene-id","id","onValueChange","event","undefined","mode","min","max","disabled","booleanProperty","_jsx","Input","placeholder","aria-label","Group","Increment","i","className","Decrement"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PrimeInputNumber.js","sources":["../../../form/PrimeInputNumber.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useState } from 'react';\nimport { InputNumber } from 'primereact/inputnumber';\nimport { RegisteredComponentProps, useValueOutput } from '@cratis/scene.react';\nimport { booleanProperty, numberProperty, stringProperty } from '../properties';\n\n/**\n * The `PrimeReact:inputNumber` component - a numeric field with locale-aware formatting.\n *\n * `mode` and `currency` are passed straight through because that is where InputNumber earns its keep\n * over a plain text field: it formats and parses in the user's locale rather than making a screen do it.\n *\n * PrimeReact 11 splits the component in two: `Root` holds the number model and `Input` is the field it\n * formats into, which is also why `placeholder` moved onto the input rather than the root. `showButtons`\n * is no longer a flag the component interprets - the spinner is a `Group` of `Increment` and `Decrement`\n * you either render or do not - so the property now decides whether that group exists at all.\n */\nexport function PrimeInputNumber({ element, bindingOutputs }: RegisteredComponentProps) {\n const [value, setValue] = useState<number | undefined>(numberProperty(element, 'value'));\n useValueOutput(bindingOutputs, value);\n const currency = stringProperty(element, 'currency');\n return (\n <InputNumber.Root\n data-scene-id={element.id}\n value={value}\n onValueChange={(event) => setValue(typeof event.value === 'number' ? event.value : undefined)}\n mode={currency === undefined ? 'decimal' : 'currency'}\n currency={currency}\n min={numberProperty(element, 'min')}\n max={numberProperty(element, 'max')}\n disabled={booleanProperty(element, 'disabled', false)}>\n <InputNumber.Input placeholder={stringProperty(element, 'placeholder')} aria-label={stringProperty(element, 'ariaLabel')} />\n {booleanProperty(element, 'showButtons', false) && (\n <InputNumber.Group>\n <InputNumber.Increment>\n <i className='pi pi-chevron-up' />\n </InputNumber.Increment>\n <InputNumber.Decrement>\n <i className='pi pi-chevron-down' />\n </InputNumber.Decrement>\n </InputNumber.Group>\n )}\n </InputNumber.Root>\n );\n}\n"],"names":["PrimeInputNumber","element","bindingOutputs","value","setValue","useState","numberProperty","useValueOutput","currency","stringProperty","_jsxs","InputNumber","Root","data-scene-id","id","onValueChange","event","undefined","mode","min","max","disabled","booleanProperty","_jsx","Input","placeholder","aria-label","Group","Increment","i","className","Decrement"],"mappings":";;;;;;;;AAQA;;;;;;;;;;AAUC,IACM,SAASA,g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AA;4BAAEC,SAAAA,EAAU;;;AAEjB,kCAAAP,cAAA,CAACZ,wBAAYoB,SAAS,EAAA;AAClB,wBAAA,QAAA,gBAAAR,cAAA,CAACM,GAAAA,EAAAA;4BAAEC,SAAAA,EAAU;;;;;;;AAMrC;;"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var react = require('react');
|
|
5
5
|
var inputtext = require('primereact/inputtext');
|
|
6
|
+
var scene_react = require('@cratis/scene.react');
|
|
6
7
|
var properties = require('../properties.js');
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -13,8 +14,9 @@ var properties = require('../properties.js');
|
|
|
13
14
|
* that state locally, seeded from the `value` property. The consequence is deliberate and worth knowing:
|
|
14
15
|
* a preview is genuinely typeable instead of frozen, and the typed value is local to the rendered
|
|
15
16
|
* component rather than pushed back into the model.
|
|
16
|
-
*/ function PrimeInputText({ element }) {
|
|
17
|
+
*/ function PrimeInputText({ element, bindingOutputs }) {
|
|
17
18
|
const [value, setValue] = react.useState(properties.stringProperty(element, 'value', ''));
|
|
19
|
+
scene_react.useValueOutput(bindingOutputs, value);
|
|
18
20
|
return /*#__PURE__*/ jsxRuntime.jsx(inputtext.InputText, {
|
|
19
21
|
"data-scene-id": element.id,
|
|
20
22
|
value: value,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrimeInputText.js","sources":["../../../form/PrimeInputText.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useState } from 'react';\nimport { InputText } from 'primereact/inputtext';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { booleanProperty, stringProperty } from '../properties';\n\n/**\n * The `PrimeReact:inputText` component - a single-line text field.\n *\n * PrimeReact inputs are controlled, and a Scene element has nowhere to put \"what the user has typed so\n * far\" - `properties` is authored design-time configuration, not live state. The adapter therefore owns\n * that state locally, seeded from the `value` property. The consequence is deliberate and worth knowing:\n * a preview is genuinely typeable instead of frozen, and the typed value is local to the rendered\n * component rather than pushed back into the model.\n */\nexport function PrimeInputText({ element }: RegisteredComponentProps) {\n const [value, setValue] = useState(stringProperty(element, 'value', ''));\n return (\n <InputText\n data-scene-id={element.id}\n value={value}\n onChange={(event) => setValue(event.target.value)}\n placeholder={stringProperty(element, 'placeholder')}\n aria-label={stringProperty(element, 'ariaLabel')}\n disabled={booleanProperty(element, 'disabled', false)}\n readOnly={booleanProperty(element, 'readOnly', false)}\n invalid={booleanProperty(element, 'invalid', false)}\n />\n );\n}\n"],"names":["PrimeInputText","element","value","setValue","useState","stringProperty","_jsx","InputText","data-scene-id","id","onChange","event","target","placeholder","aria-label","disabled","booleanProperty","readOnly","invalid"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PrimeInputText.js","sources":["../../../form/PrimeInputText.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useState } from 'react';\nimport { InputText } from 'primereact/inputtext';\nimport { RegisteredComponentProps, useValueOutput } from '@cratis/scene.react';\nimport { booleanProperty, stringProperty } from '../properties';\n\n/**\n * The `PrimeReact:inputText` component - a single-line text field.\n *\n * PrimeReact inputs are controlled, and a Scene element has nowhere to put \"what the user has typed so\n * far\" - `properties` is authored design-time configuration, not live state. The adapter therefore owns\n * that state locally, seeded from the `value` property. The consequence is deliberate and worth knowing:\n * a preview is genuinely typeable instead of frozen, and the typed value is local to the rendered\n * component rather than pushed back into the model.\n */\nexport function PrimeInputText({ element, bindingOutputs }: RegisteredComponentProps) {\n const [value, setValue] = useState(stringProperty(element, 'value', ''));\n useValueOutput(bindingOutputs, value);\n return (\n <InputText\n data-scene-id={element.id}\n value={value}\n onChange={(event) => setValue(event.target.value)}\n placeholder={stringProperty(element, 'placeholder')}\n aria-label={stringProperty(element, 'ariaLabel')}\n disabled={booleanProperty(element, 'disabled', false)}\n readOnly={booleanProperty(element, 'readOnly', false)}\n invalid={booleanProperty(element, 'invalid', false)}\n />\n );\n}\n"],"names":["PrimeInputText","element","bindingOutputs","value","setValue","useState","stringProperty","useValueOutput","_jsx","InputText","data-scene-id","id","onChange","event","target","placeholder","aria-label","disabled","booleanProperty","readOnly","invalid"],"mappings":";;;;;;;;AAQA;;;;;;;;AAQC,IACM,SAASA,cAAAA,CAAe,EAAEC,OAAO,EAAEC,cAAc,EAA4B,EAAA;AAChF,IAAA,MAAM,CAACC,KAAAA,EAAOC,QAAAA,CAAS,GAAGC,cAAAA,CAASC,yBAAAA,CAAeL,SAAS,OAAA,EAAS,EAAA,CAAA,CAAA;AACpEM,IAAAA,0BAAAA,CAAeL,cAAAA,EAAgBC,KAAAA,CAAAA;AAC/B,IAAA,qBACIK,cAAA,CAACC,mBAAAA,EAAAA;AACGC,QAAAA,eAAAA,EAAeT,QAAQU,EAAE;QACzBR,KAAAA,EAAOA,KAAAA;AACPS,QAAAA,QAAAA,EAAU,CAACC,KAAAA,GAAUT,QAAAA,CAASS,KAAAA,CAAMC,MAAM,CAACX,KAAK,CAAA;AAChDY,QAAAA,WAAAA,EAAaT,0BAAeL,OAAAA,EAAS,aAAA,CAAA;AACrCe,QAAAA,YAAAA,EAAYV,0BAAeL,OAAAA,EAAS,WAAA,CAAA;QACpCgB,QAAAA,EAAUC,0BAAAA,CAAgBjB,SAAS,UAAA,EAAY,KAAA,CAAA;QAC/CkB,QAAAA,EAAUD,0BAAAA,CAAgBjB,SAAS,UAAA,EAAY,KAAA,CAAA;QAC/CmB,OAAAA,EAASF,0BAAAA,CAAgBjB,SAAS,SAAA,EAAW,KAAA;;AAGzD;;"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var react = require('react');
|
|
5
5
|
var textarea = require('primereact/textarea');
|
|
6
|
+
var scene_react = require('@cratis/scene.react');
|
|
6
7
|
var properties = require('../properties.js');
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -11,8 +12,9 @@ var properties = require('../properties.js');
|
|
|
11
12
|
* One of the few components the version change left alone beyond its name: it is still a single element
|
|
12
13
|
* rather than a composition, and `rows`, `cols` and `placeholder` still reach the underlying `<textarea>`
|
|
13
14
|
* untouched. Holds the typed value locally for the same reason {@link PrimeInputText} does.
|
|
14
|
-
*/ function PrimeInputTextarea({ element }) {
|
|
15
|
+
*/ function PrimeInputTextarea({ element, bindingOutputs }) {
|
|
15
16
|
const [value, setValue] = react.useState(properties.stringProperty(element, 'value', ''));
|
|
17
|
+
scene_react.useValueOutput(bindingOutputs, value);
|
|
16
18
|
return /*#__PURE__*/ jsxRuntime.jsx(textarea.Textarea, {
|
|
17
19
|
"data-scene-id": element.id,
|
|
18
20
|
value: value,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrimeInputTextarea.js","sources":["../../../form/PrimeInputTextarea.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ChangeEvent, useState } from 'react';\nimport { Textarea } from 'primereact/textarea';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { booleanProperty, numberProperty, stringProperty } from '../properties';\n\n/**\n * The `PrimeReact:inputTextarea` component - a multi-line text field, named `Textarea` by PrimeReact 11.\n *\n * One of the few components the version change left alone beyond its name: it is still a single element\n * rather than a composition, and `rows`, `cols` and `placeholder` still reach the underlying `<textarea>`\n * untouched. Holds the typed value locally for the same reason {@link PrimeInputText} does.\n */\nexport function PrimeInputTextarea({ element }: RegisteredComponentProps) {\n const [value, setValue] = useState(stringProperty(element, 'value', ''));\n return (\n <Textarea\n data-scene-id={element.id}\n value={value}\n onChange={(event: ChangeEvent<HTMLTextAreaElement>) => setValue(event.target.value)}\n rows={numberProperty(element, 'rows', 4)}\n cols={numberProperty(element, 'cols')}\n autoResize={booleanProperty(element, 'autoResize', false)}\n placeholder={stringProperty(element, 'placeholder')}\n aria-label={stringProperty(element, 'ariaLabel')}\n disabled={booleanProperty(element, 'disabled', false)}\n />\n );\n}\n"],"names":["PrimeInputTextarea","element","value","setValue","useState","stringProperty","_jsx","Textarea","data-scene-id","id","onChange","event","target","rows","numberProperty","cols","autoResize","booleanProperty","placeholder","aria-label","disabled"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PrimeInputTextarea.js","sources":["../../../form/PrimeInputTextarea.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ChangeEvent, useState } from 'react';\nimport { Textarea } from 'primereact/textarea';\nimport { RegisteredComponentProps, useValueOutput } from '@cratis/scene.react';\nimport { booleanProperty, numberProperty, stringProperty } from '../properties';\n\n/**\n * The `PrimeReact:inputTextarea` component - a multi-line text field, named `Textarea` by PrimeReact 11.\n *\n * One of the few components the version change left alone beyond its name: it is still a single element\n * rather than a composition, and `rows`, `cols` and `placeholder` still reach the underlying `<textarea>`\n * untouched. Holds the typed value locally for the same reason {@link PrimeInputText} does.\n */\nexport function PrimeInputTextarea({ element, bindingOutputs }: RegisteredComponentProps) {\n const [value, setValue] = useState(stringProperty(element, 'value', ''));\n useValueOutput(bindingOutputs, value);\n return (\n <Textarea\n data-scene-id={element.id}\n value={value}\n onChange={(event: ChangeEvent<HTMLTextAreaElement>) => setValue(event.target.value)}\n rows={numberProperty(element, 'rows', 4)}\n cols={numberProperty(element, 'cols')}\n autoResize={booleanProperty(element, 'autoResize', false)}\n placeholder={stringProperty(element, 'placeholder')}\n aria-label={stringProperty(element, 'ariaLabel')}\n disabled={booleanProperty(element, 'disabled', false)}\n />\n );\n}\n"],"names":["PrimeInputTextarea","element","bindingOutputs","value","setValue","useState","stringProperty","useValueOutput","_jsx","Textarea","data-scene-id","id","onChange","event","target","rows","numberProperty","cols","autoResize","booleanProperty","placeholder","aria-label","disabled"],"mappings":";;;;;;;;AAQA;;;;;;AAMC,IACM,SAASA,kBAAAA,CAAmB,EAAEC,OAAO,EAAEC,cAAc,EAA4B,EAAA;AACpF,IAAA,MAAM,CAACC,KAAAA,EAAOC,QAAAA,CAAS,GAAGC,cAAAA,CAASC,yBAAAA,CAAeL,SAAS,OAAA,EAAS,EAAA,CAAA,CAAA;AACpEM,IAAAA,0BAAAA,CAAeL,cAAAA,EAAgBC,KAAAA,CAAAA;AAC/B,IAAA,qBACIK,cAAA,CAACC,iBAAAA,EAAAA;AACGC,QAAAA,eAAAA,EAAeT,QAAQU,EAAE;QACzBR,KAAAA,EAAOA,KAAAA;AACPS,QAAAA,QAAAA,EAAU,CAACC,KAAAA,GAA4CT,QAAAA,CAASS,KAAAA,CAAMC,MAAM,CAACX,KAAK,CAAA;QAClFY,IAAAA,EAAMC,yBAAAA,CAAef,SAAS,MAAA,EAAQ,CAAA,CAAA;AACtCgB,QAAAA,IAAAA,EAAMD,0BAAef,OAAAA,EAAS,MAAA,CAAA;QAC9BiB,UAAAA,EAAYC,0BAAAA,CAAgBlB,SAAS,YAAA,EAAc,KAAA,CAAA;AACnDmB,QAAAA,WAAAA,EAAad,0BAAeL,OAAAA,EAAS,aAAA,CAAA;AACrCoB,QAAAA,YAAAA,EAAYf,0BAAeL,OAAAA,EAAS,WAAA,CAAA;QACpCqB,QAAAA,EAAUH,0BAAAA,CAAgBlB,SAAS,UAAA,EAAY,KAAA;;AAG3D;;"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var react = require('react');
|
|
5
5
|
var select = require('primereact/select');
|
|
6
|
+
var scene_react = require('@cratis/scene.react');
|
|
6
7
|
var properties = require('../properties.js');
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -19,8 +20,9 @@ var properties = require('../properties.js');
|
|
|
19
20
|
* v11 renders the selection through `Select.Value`, which joins the selected labels with commas and
|
|
20
21
|
* offers no chip mode and no collapse threshold, so honoring either property would mean reimplementing
|
|
21
22
|
* the value slot rather than configuring it.
|
|
22
|
-
*/ function PrimeMultiSelect({ element }) {
|
|
23
|
+
*/ function PrimeMultiSelect({ element, bindingOutputs }) {
|
|
23
24
|
const [value, setValue] = react.useState(properties.stringArrayProperty(element, 'value'));
|
|
25
|
+
scene_react.useValueOutput(bindingOutputs, value);
|
|
24
26
|
const placeholder = properties.stringProperty(element, 'placeholder', 'Select');
|
|
25
27
|
const filter = properties.booleanProperty(element, 'filter', false);
|
|
26
28
|
return /*#__PURE__*/ jsxRuntime.jsxs(select.Select.Root, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrimeMultiSelect.js","sources":["../../../form/PrimeMultiSelect.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useState } from 'react';\nimport { Select } from 'primereact/select';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { booleanProperty, optionsProperty, stringArrayProperty, stringProperty } from '../properties';\n\n/**\n * The `PrimeReact:multiSelect` component - a multiple-choice select.\n *\n * There is no `MultiSelect` in PrimeReact 11; the capability moved onto `Select`, which takes a\n * `multiple` prop. Keeping the abstract name and re-expressing it over `Select` is the whole point of\n * having an abstract name: a screen that says `multiSelect` keeps working, and only this file knows the\n * component behind it changed.\n *\n * Two v10 properties have nowhere to go and are deliberately dropped rather than silently ignored.\n * `display` chose between a comma-separated summary and a row of chips, and `maxSelectedLabels` collapsed\n * a long selection into an \"n items selected\" label - both were features of v10's own selection renderer.\n * v11 renders the selection through `Select.Value`, which joins the selected labels with commas and\n * offers no chip mode and no collapse threshold, so honoring either property would mean reimplementing\n * the value slot rather than configuring it.\n */\nexport function PrimeMultiSelect({ element }: RegisteredComponentProps) {\n const [value, setValue] = useState<unknown>(stringArrayProperty(element, 'value'));\n const placeholder = stringProperty(element, 'placeholder', 'Select');\n const filter = booleanProperty(element, 'filter', false);\n return (\n <Select.Root\n data-scene-id={element.id}\n multiple\n value={value}\n onValueChange={(event) => setValue(event.value)}\n options={optionsProperty(element, 'options')}\n optionLabel='label'\n optionValue='value'\n filter={filter}\n disabled={booleanProperty(element, 'disabled', false)}>\n <Select.Trigger>\n <Select.Value placeholder={placeholder} />\n <Select.Arrow />\n </Select.Trigger>\n <Select.Portal>\n <Select.Positioner>\n <Select.Popup>\n {filter && <Select.Filter placeholder={placeholder} />}\n <Select.List />\n </Select.Popup>\n </Select.Positioner>\n </Select.Portal>\n </Select.Root>\n );\n}\n"],"names":["PrimeMultiSelect","element","value","setValue","useState","stringArrayProperty","placeholder","stringProperty","filter","booleanProperty","_jsxs","Select","Root","data-scene-id","id","multiple","onValueChange","event","options","optionsProperty","optionLabel","optionValue","disabled","Trigger","_jsx","Value","Arrow","Portal","Positioner","Popup","Filter","List"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PrimeMultiSelect.js","sources":["../../../form/PrimeMultiSelect.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useState } from 'react';\nimport { Select } from 'primereact/select';\nimport { RegisteredComponentProps, useValueOutput } from '@cratis/scene.react';\nimport { booleanProperty, optionsProperty, stringArrayProperty, stringProperty } from '../properties';\n\n/**\n * The `PrimeReact:multiSelect` component - a multiple-choice select.\n *\n * There is no `MultiSelect` in PrimeReact 11; the capability moved onto `Select`, which takes a\n * `multiple` prop. Keeping the abstract name and re-expressing it over `Select` is the whole point of\n * having an abstract name: a screen that says `multiSelect` keeps working, and only this file knows the\n * component behind it changed.\n *\n * Two v10 properties have nowhere to go and are deliberately dropped rather than silently ignored.\n * `display` chose between a comma-separated summary and a row of chips, and `maxSelectedLabels` collapsed\n * a long selection into an \"n items selected\" label - both were features of v10's own selection renderer.\n * v11 renders the selection through `Select.Value`, which joins the selected labels with commas and\n * offers no chip mode and no collapse threshold, so honoring either property would mean reimplementing\n * the value slot rather than configuring it.\n */\nexport function PrimeMultiSelect({ element, bindingOutputs }: RegisteredComponentProps) {\n const [value, setValue] = useState<unknown>(stringArrayProperty(element, 'value'));\n useValueOutput(bindingOutputs, value);\n const placeholder = stringProperty(element, 'placeholder', 'Select');\n const filter = booleanProperty(element, 'filter', false);\n return (\n <Select.Root\n data-scene-id={element.id}\n multiple\n value={value}\n onValueChange={(event) => setValue(event.value)}\n options={optionsProperty(element, 'options')}\n optionLabel='label'\n optionValue='value'\n filter={filter}\n disabled={booleanProperty(element, 'disabled', false)}>\n <Select.Trigger>\n <Select.Value placeholder={placeholder} />\n <Select.Arrow />\n </Select.Trigger>\n <Select.Portal>\n <Select.Positioner>\n <Select.Popup>\n {filter && <Select.Filter placeholder={placeholder} />}\n <Select.List />\n </Select.Popup>\n </Select.Positioner>\n </Select.Portal>\n </Select.Root>\n );\n}\n"],"names":["PrimeMultiSelect","element","bindingOutputs","value","setValue","useState","stringArrayProperty","useValueOutput","placeholder","stringProperty","filter","booleanProperty","_jsxs","Select","Root","data-scene-id","id","multiple","onValueChange","event","options","optionsProperty","optionLabel","optionValue","disabled","Trigger","_jsx","Value","Arrow","Portal","Positioner","Popup","Filter","List"],"mappings":";;;;;;;;AAQA;;;;;;;;;;;;;;AAcC,IACM,SAASA,gBAAAA,CAAiB,EAAEC,OAAO,EAAEC,cAAc,EAA4B,EAAA;AAClF,IAAA,MAAM,CAACC,KAAAA,EAAOC,QAAAA,CAAS,GAAGC,cAAAA,CAAkBC,+BAAoBL,OAAAA,EAAS,OAAA,CAAA,CAAA;AACzEM,IAAAA,0BAAAA,CAAeL,cAAAA,EAAgBC,KAAAA,CAAAA;IAC/B,MAAMK,WAAAA,GAAcC,yBAAAA,CAAeR,OAAAA,EAAS,aAAA,EAAe,QAAA,CAAA;IAC3D,MAAMS,MAAAA,GAASC,0BAAAA,CAAgBV,OAAAA,EAAS,QAAA,EAAU,KAAA,CAAA;IAClD,qBACIW,eAAA,CAACC,cAAOC,IAAI,EAAA;AACRC,QAAAA,eAAAA,EAAed,QAAQe,EAAE;QACzBC,QAAQ,EAAA,IAAA;QACRd,KAAAA,EAAOA,KAAAA;AACPe,QAAAA,aAAAA,EAAe,CAACC,KAAAA,GAAUf,QAAAA,CAASe,KAAAA,CAAMhB,KAAK,CAAA;AAC9CiB,QAAAA,OAAAA,EAASC,2BAAgBpB,OAAAA,EAAS,SAAA,CAAA;QAClCqB,WAAAA,EAAY,OAAA;QACZC,WAAAA,EAAY,OAAA;QACZb,MAAAA,EAAQA,MAAAA;QACRc,QAAAA,EAAUb,0BAAAA,CAAgBV,SAAS,UAAA,EAAY,KAAA,CAAA;;AAC/C,0BAAAW,eAAA,CAACC,cAAOY,OAAO,EAAA;;AACX,kCAAAC,cAAA,CAACb,cAAOc,KAAK,EAAA;wBAACnB,WAAAA,EAAaA;;AAC3B,kCAAAkB,cAAA,CAACb,cAAOe,KAAK,EAAA,EAAA;;;AAEjB,0BAAAF,cAAA,CAACb,cAAOgB,MAAM,EAAA;wCACVH,cAAA,CAACb,cAAOiB,UAAU,EAAA;4CACdlB,eAAA,CAACC,cAAOkB,KAAK,EAAA;;4BACRrB,MAAAA,kBAAUgB,cAAA,CAACb,cAAOmB,MAAM,EAAA;gCAACxB,WAAAA,EAAaA;;AACvC,0CAAAkB,cAAA,CAACb,cAAOoB,IAAI,EAAA,EAAA;;;;;;;AAMpC;;"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var react = require('react');
|
|
5
5
|
var inputpassword = require('primereact/inputpassword');
|
|
6
|
+
var scene_react = require('@cratis/scene.react');
|
|
6
7
|
var properties = require('../properties.js');
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -14,8 +15,9 @@ var properties = require('../properties.js');
|
|
|
14
15
|
* control to switch on - so neither property is read here. `mask` is exposed instead, which is the one
|
|
15
16
|
* knob that survived and the one an authored screen can actually mean: a preview that starts revealed.
|
|
16
17
|
* A screen that needs a reveal button now owns that button, because only the screen knows where it goes.
|
|
17
|
-
*/ function PrimePassword({ element }) {
|
|
18
|
+
*/ function PrimePassword({ element, bindingOutputs }) {
|
|
18
19
|
const [value, setValue] = react.useState(properties.stringProperty(element, 'value', ''));
|
|
20
|
+
scene_react.useValueOutput(bindingOutputs, value);
|
|
19
21
|
return /*#__PURE__*/ jsxRuntime.jsx(inputpassword.InputPassword, {
|
|
20
22
|
"data-scene-id": element.id,
|
|
21
23
|
value: value,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrimePassword.js","sources":["../../../form/PrimePassword.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useState } from 'react';\nimport { InputPassword } from 'primereact/inputpassword';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { booleanProperty, stringProperty } from '../properties';\n\n/**\n * The `PrimeReact:password` component - a masked field, named `InputPassword` by PrimeReact 11.\n *\n * v11 pared this back to what a password field actually is: an input that renders as `type=\"password\"`\n * until something flips `mask`. The v10 `feedback` strength meter and the `toggleMask` eye button are\n * both gone from the component - there is no prompt/weak/medium/strong panel and no built-in reveal\n * control to switch on - so neither property is read here. `mask` is exposed instead, which is the one\n * knob that survived and the one an authored screen can actually mean: a preview that starts revealed.\n * A screen that needs a reveal button now owns that button, because only the screen knows where it goes.\n */\nexport function PrimePassword({ element }: RegisteredComponentProps) {\n const [value, setValue] = useState(stringProperty(element, 'value', ''));\n return (\n <InputPassword\n data-scene-id={element.id}\n value={value}\n onValueChange={(event) => setValue(event.value ?? '')}\n mask={booleanProperty(element, 'mask', true)}\n placeholder={stringProperty(element, 'placeholder')}\n aria-label={stringProperty(element, 'ariaLabel')}\n disabled={booleanProperty(element, 'disabled', false)}\n />\n );\n}\n"],"names":["PrimePassword","element","value","setValue","useState","stringProperty","_jsx","InputPassword","data-scene-id","id","onValueChange","event","mask","booleanProperty","placeholder","aria-label","disabled"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PrimePassword.js","sources":["../../../form/PrimePassword.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useState } from 'react';\nimport { InputPassword } from 'primereact/inputpassword';\nimport { RegisteredComponentProps, useValueOutput } from '@cratis/scene.react';\nimport { booleanProperty, stringProperty } from '../properties';\n\n/**\n * The `PrimeReact:password` component - a masked field, named `InputPassword` by PrimeReact 11.\n *\n * v11 pared this back to what a password field actually is: an input that renders as `type=\"password\"`\n * until something flips `mask`. The v10 `feedback` strength meter and the `toggleMask` eye button are\n * both gone from the component - there is no prompt/weak/medium/strong panel and no built-in reveal\n * control to switch on - so neither property is read here. `mask` is exposed instead, which is the one\n * knob that survived and the one an authored screen can actually mean: a preview that starts revealed.\n * A screen that needs a reveal button now owns that button, because only the screen knows where it goes.\n */\nexport function PrimePassword({ element, bindingOutputs }: RegisteredComponentProps) {\n const [value, setValue] = useState(stringProperty(element, 'value', ''));\n useValueOutput(bindingOutputs, value);\n return (\n <InputPassword\n data-scene-id={element.id}\n value={value}\n onValueChange={(event) => setValue(event.value ?? '')}\n mask={booleanProperty(element, 'mask', true)}\n placeholder={stringProperty(element, 'placeholder')}\n aria-label={stringProperty(element, 'ariaLabel')}\n disabled={booleanProperty(element, 'disabled', false)}\n />\n );\n}\n"],"names":["PrimePassword","element","bindingOutputs","value","setValue","useState","stringProperty","useValueOutput","_jsx","InputPassword","data-scene-id","id","onValueChange","event","mask","booleanProperty","placeholder","aria-label","disabled"],"mappings":";;;;;;;;AAQA;;;;;;;;;AASC,IACM,SAASA,aAAAA,CAAc,EAAEC,OAAO,EAAEC,cAAc,EAA4B,EAAA;AAC/E,IAAA,MAAM,CAACC,KAAAA,EAAOC,QAAAA,CAAS,GAAGC,cAAAA,CAASC,yBAAAA,CAAeL,SAAS,OAAA,EAAS,EAAA,CAAA,CAAA;AACpEM,IAAAA,0BAAAA,CAAeL,cAAAA,EAAgBC,KAAAA,CAAAA;AAC/B,IAAA,qBACIK,cAAA,CAACC,2BAAAA,EAAAA;AACGC,QAAAA,eAAAA,EAAeT,QAAQU,EAAE;QACzBR,KAAAA,EAAOA,KAAAA;AACPS,QAAAA,aAAAA,EAAe,CAACC,KAAAA,GAAUT,QAAAA,CAASS,KAAAA,CAAMV,KAAK,IAAI,EAAA,CAAA;QAClDW,IAAAA,EAAMC,0BAAAA,CAAgBd,SAAS,MAAA,EAAQ,IAAA,CAAA;AACvCe,QAAAA,WAAAA,EAAaV,0BAAeL,OAAAA,EAAS,aAAA,CAAA;AACrCgB,QAAAA,YAAAA,EAAYX,0BAAeL,OAAAA,EAAS,WAAA,CAAA;QACpCiB,QAAAA,EAAUH,0BAAAA,CAAgBd,SAAS,UAAA,EAAY,KAAA;;AAG3D;;"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var react = require('react');
|
|
5
5
|
var radiobutton = require('primereact/radiobutton');
|
|
6
|
+
var scene_react = require('@cratis/scene.react');
|
|
6
7
|
var properties = require('../properties.js');
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -17,8 +18,9 @@ var properties = require('../properties.js');
|
|
|
17
18
|
* `Indicator`, and reports selection as `onCheckedChange`. Only the transition *into* checked is acted
|
|
18
19
|
* on: the browser also fires the sibling losing its check, and treating that as a selection would clear
|
|
19
20
|
* the value a moment after the user set it.
|
|
20
|
-
*/ function PrimeRadioButton({ element }) {
|
|
21
|
+
*/ function PrimeRadioButton({ element, bindingOutputs }) {
|
|
21
22
|
const [value, setValue] = react.useState(properties.stringProperty(element, 'value'));
|
|
23
|
+
scene_react.useValueOutput(bindingOutputs, value);
|
|
22
24
|
const options = properties.optionsProperty(element, 'options');
|
|
23
25
|
const choices = options.length > 0 ? options : [
|
|
24
26
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrimeRadioButton.js","sources":["../../../form/PrimeRadioButton.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useState } from 'react';\nimport { RadioButton } from 'primereact/radiobutton';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { booleanProperty, optionsProperty, stringProperty } from '../properties';\n\n/**\n * The `PrimeReact:radioButton` component - one exclusive choice out of several.\n *\n * PrimeReact's RadioButton is a single button, but a lone radio button is never what a screen means: the\n * choice is the group. The adapter therefore renders the whole group from `options`, sharing one\n * `name` so the browser enforces exclusivity, and falls back to a single button when only a `label` was\n * given.\n *\n * PrimeReact 11 splits each button into `Root` (the real radio input and its state), `Box` and\n * `Indicator`, and reports selection as `onCheckedChange`. Only the transition *into* checked is acted\n * on: the browser also fires the sibling losing its check, and treating that as a selection would clear\n * the value a moment after the user set it.\n */\nexport function PrimeRadioButton({ element }: RegisteredComponentProps) {\n const [value, setValue] = useState<string | undefined>(stringProperty(element, 'value'));\n const options = optionsProperty(element, 'options');\n const choices = options.length > 0 ? options : [{ label: stringProperty(element, 'label', 'Option'), value: element.id }];\n const disabled = booleanProperty(element, 'disabled', false);\n return (\n <div data-scene-id={element.id} className='flex flex-col gap-2'>\n {choices.map((choice) => (\n <div key={choice.value} className='flex items-center gap-2'>\n <RadioButton.Root\n inputId={`${element.id}-${choice.value}`}\n name={element.id}\n value={choice.value}\n checked={value === choice.value}\n onCheckedChange={(event) => {\n if (event.checked) setValue(choice.value);\n }}\n disabled={disabled}>\n <RadioButton.Box>\n <RadioButton.Indicator />\n </RadioButton.Box>\n </RadioButton.Root>\n <label htmlFor={`${element.id}-${choice.value}`}>{choice.label}</label>\n </div>\n ))}\n </div>\n );\n}\n"],"names":["PrimeRadioButton","element","value","setValue","useState","stringProperty","options","optionsProperty","choices","length","label","id","disabled","booleanProperty","_jsx","div","data-scene-id","className","map","choice","_jsxs","RadioButton","Root","inputId","name","checked","onCheckedChange","event","Box","Indicator","htmlFor"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PrimeRadioButton.js","sources":["../../../form/PrimeRadioButton.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useState } from 'react';\nimport { RadioButton } from 'primereact/radiobutton';\nimport { RegisteredComponentProps, useValueOutput } from '@cratis/scene.react';\nimport { booleanProperty, optionsProperty, stringProperty } from '../properties';\n\n/**\n * The `PrimeReact:radioButton` component - one exclusive choice out of several.\n *\n * PrimeReact's RadioButton is a single button, but a lone radio button is never what a screen means: the\n * choice is the group. The adapter therefore renders the whole group from `options`, sharing one\n * `name` so the browser enforces exclusivity, and falls back to a single button when only a `label` was\n * given.\n *\n * PrimeReact 11 splits each button into `Root` (the real radio input and its state), `Box` and\n * `Indicator`, and reports selection as `onCheckedChange`. Only the transition *into* checked is acted\n * on: the browser also fires the sibling losing its check, and treating that as a selection would clear\n * the value a moment after the user set it.\n */\nexport function PrimeRadioButton({ element, bindingOutputs }: RegisteredComponentProps) {\n const [value, setValue] = useState<string | undefined>(stringProperty(element, 'value'));\n useValueOutput(bindingOutputs, value);\n const options = optionsProperty(element, 'options');\n const choices = options.length > 0 ? options : [{ label: stringProperty(element, 'label', 'Option'), value: element.id }];\n const disabled = booleanProperty(element, 'disabled', false);\n return (\n <div data-scene-id={element.id} className='flex flex-col gap-2'>\n {choices.map((choice) => (\n <div key={choice.value} className='flex items-center gap-2'>\n <RadioButton.Root\n inputId={`${element.id}-${choice.value}`}\n name={element.id}\n value={choice.value}\n checked={value === choice.value}\n onCheckedChange={(event) => {\n if (event.checked) setValue(choice.value);\n }}\n disabled={disabled}>\n <RadioButton.Box>\n <RadioButton.Indicator />\n </RadioButton.Box>\n </RadioButton.Root>\n <label htmlFor={`${element.id}-${choice.value}`}>{choice.label}</label>\n </div>\n ))}\n </div>\n );\n}\n"],"names":["PrimeRadioButton","element","bindingOutputs","value","setValue","useState","stringProperty","useValueOutput","options","optionsProperty","choices","length","label","id","disabled","booleanProperty","_jsx","div","data-scene-id","className","map","choice","_jsxs","RadioButton","Root","inputId","name","checked","onCheckedChange","event","Box","Indicator","htm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AAAA,GAAAA;AACd,4BAAA,IAAIA,KAAAA,CAAMF,OAAO,EAAEvB,QAAAA,CAASiB,OAAOlB,KAAK,CAAA;AAC5C,wBAAA,CAAA;wBACAW,QAAAA,EAAUA,QAAAA;gDACVE,cAAA,CAACO,wBAAYO,GAAG,EAAA;oDACZd,cAAA,CAACO,wBAAYQ,SAAS,EAAA,EAAA;;;kCAG9Bf,cAAA,CAACJ,OAAAA,EAAAA;wBAAMoB,OAAAA,EAAS,CAAA,EAAG/B,QAAQY,EAAE,CAAC,CAAC,EAAEQ,MAAAA,CAAOlB,KAAK,CAAA,CAAE;AAAGkB,wBAAAA,QAAAA,EAAAA,MAAAA,CAAOT;;;AAdnDS,aAAAA,EAAAA,MAAAA,CAAOlB,KAAK,CAAA;;AAmBtC;;"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var react = require('react');
|
|
5
5
|
var toggleswitch = require('primereact/toggleswitch');
|
|
6
|
+
var scene_react = require('@cratis/scene.react');
|
|
6
7
|
var properties = require('../properties.js');
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -16,8 +17,9 @@ var properties = require('../properties.js');
|
|
|
16
17
|
* `Root` renders the hidden checkbox that carries the state and the accessible name, and the visible
|
|
17
18
|
* switch is `Control` plus the `Handle` that slides inside it. That is why `inputId` and not `id` is what
|
|
18
19
|
* the label points at: the label has to reach the input, not the wrapper.
|
|
19
|
-
*/ function PrimeToggleSwitch({ element }) {
|
|
20
|
+
*/ function PrimeToggleSwitch({ element, bindingOutputs }) {
|
|
20
21
|
const [checked, setChecked] = react.useState(properties.booleanProperty(element, 'checked', false));
|
|
22
|
+
scene_react.useValueOutput(bindingOutputs, checked);
|
|
21
23
|
const label = properties.stringProperty(element, 'label');
|
|
22
24
|
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
23
25
|
"data-scene-id": element.id,
|
|
@@ -26,6 +28,7 @@ var properties = require('../properties.js');
|
|
|
26
28
|
/*#__PURE__*/ jsxRuntime.jsx(toggleswitch.ToggleSwitch.Root, {
|
|
27
29
|
inputId: element.id,
|
|
28
30
|
checked: checked,
|
|
31
|
+
ariaLabel: properties.stringProperty(element, 'ariaLabel'),
|
|
29
32
|
onCheckedChange: (event)=>setChecked(event.checked),
|
|
30
33
|
disabled: properties.booleanProperty(element, 'disabled', false),
|
|
31
34
|
children: /*#__PURE__*/ jsxRuntime.jsx(toggleswitch.ToggleSwitch.Control, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrimeToggleSwitch.js","sources":["../../../form/PrimeToggleSwitch.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useState } from 'react';\nimport { ToggleSwitch } from 'primereact/toggleswitch';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { booleanProperty, stringProperty } from '../properties';\n\n/**\n * The `PrimeReact:toggleSwitch` component.\n *\n * The abstract name has always been `toggleSwitch` even while PrimeReact 10 called the component\n * `InputSwitch` - a Scene name follows what the thing is rather than what one library happens to call it\n * this major version - and v11 renaming it `ToggleSwitch` is the library catching up rather than the\n * package moving.\n *\n * `Root` renders the hidden checkbox that carries the state and the accessible name, and the visible\n * switch is `Control` plus the `Handle` that slides inside it. That is why `inputId` and not `id` is what\n * the label points at: the label has to reach the input, not the wrapper.\n */\nexport function PrimeToggleSwitch({ element }: RegisteredComponentProps) {\n const [checked, setChecked] = useState(booleanProperty(element, 'checked', false));\n const label = stringProperty(element, 'label');\n return (\n <div data-scene-id={element.id} className='flex items-center gap-2'>\n <ToggleSwitch.Root\n inputId={element.id}\n checked={checked}\n onCheckedChange={(event) => setChecked(event.checked)}\n disabled={booleanProperty(element, 'disabled', false)}>\n <ToggleSwitch.Control>\n <ToggleSwitch.Handle />\n </ToggleSwitch.Control>\n </ToggleSwitch.Root>\n {label !== undefined && <label htmlFor={element.id}>{label}</label>}\n </div>\n );\n}\n"],"names":["PrimeToggleSwitch","element","checked","setChecked","useState","booleanProperty","label","stringProperty","_jsxs","div","data-scene-id","id","className","_jsx","ToggleSwitch","Root","inputId","onCheckedChange","event","disabled","Control","Handle","undefined","htmlFor"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PrimeToggleSwitch.js","sources":["../../../form/PrimeToggleSwitch.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useState } from 'react';\nimport { ToggleSwitch } from 'primereact/toggleswitch';\nimport { RegisteredComponentProps, useValueOutput } from '@cratis/scene.react';\nimport { booleanProperty, stringProperty } from '../properties';\n\n/**\n * The `PrimeReact:toggleSwitch` component.\n *\n * The abstract name has always been `toggleSwitch` even while PrimeReact 10 called the component\n * `InputSwitch` - a Scene name follows what the thing is rather than what one library happens to call it\n * this major version - and v11 renaming it `ToggleSwitch` is the library catching up rather than the\n * package moving.\n *\n * `Root` renders the hidden checkbox that carries the state and the accessible name, and the visible\n * switch is `Control` plus the `Handle` that slides inside it. That is why `inputId` and not `id` is what\n * the label points at: the label has to reach the input, not the wrapper.\n */\nexport function PrimeToggleSwitch({ element, bindingOutputs }: RegisteredComponentProps) {\n const [checked, setChecked] = useState(booleanProperty(element, 'checked', false));\n useValueOutput(bindingOutputs, checked);\n const label = stringProperty(element, 'label');\n return (\n <div data-scene-id={element.id} className='flex items-center gap-2'>\n <ToggleSwitch.Root\n inputId={element.id}\n checked={checked}\n ariaLabel={stringProperty(element, 'ariaLabel')}\n onCheckedChange={(event) => setChecked(event.checked)}\n disabled={booleanProperty(element, 'disabled', false)}>\n <ToggleSwitch.Control>\n <ToggleSwitch.Handle />\n </ToggleSwitch.Control>\n </ToggleSwitch.Root>\n {label !== undefined && <label htmlFor={element.id}>{label}</label>}\n </div>\n );\n}\n"],"names":["PrimeToggleSwitch","element","bindingOutputs","checked","setChecked","useState","booleanProperty","useValueOutput","label","stringProperty","_jsxs","div","data-scene-id","id","className","_jsx","ToggleSwitch","Root","inputId","ariaLabel","onCheckedChange","event","disabled","Control","Handle","undefined","htmlFor"],"mappings":";;;;;;;;AAQA;;;;;;;;;;;AAWC,IACM,SAASA,iBAAAA,CAAkB,EAAEC,OAAO,EAAEC,cAAc,EAA4B,EAAA;AACnF,IAAA,MAAM,CAACC,OAAAA,EAASC,UAAAA,CAAW,GAAGC,cAAAA,CAASC,0BAAAA,CAAgBL,SAAS,SAAA,EAAW,KAAA,CAAA,CAAA;AAC3EM,IAAAA,0BAAAA,CAAeL,cAAAA,EAAgBC,OAAAA,CAAAA;IAC/B,MAAMK,KAAAA,GAAQC,0BAAeR,OAAAA,EAAS,OAAA,CAAA;AACtC,IAAA,qBACIS,eAAA,CAACC,KAAAA,EAAAA;AAAIC,QAAAA,eAAAA,EAAeX,QAAQY,EAAE;QAAEC,SAAAA,EAAU,yBAAA;;AACtC,0BAAAC,cAAA,CAACC,0BAAaC,IAAI,EAAA;AACdC,gBAAAA,OAAAA,EAASjB,QAAQY,EAAE;gBACnBV,OAAAA,EAASA,OAAAA;AACTgB,gBAAAA,SAAAA,EAAWV,0BAAeR,OAAAA,EAAS,WAAA,CAAA;AACnCmB,gBAAAA,eAAAA,EAAiB,CAACC,KAAAA,GAAUjB,UAAAA,CAAWiB,KAAAA,CAAMlB,OAAO,CAAA;gBACpDmB,QAAAA,EAAUhB,0BAAAA,CAAgBL,SAAS,UAAA,EAAY,KAAA,CAAA;wCAC/Cc,cAAA,CAACC,0BAAaO,OAAO,EAAA;4CACjBR,cAAA,CAACC,0BAAaQ,MAAM,EAAA,EAAA;;;AAG3BhB,YAAAA,KAAAA,KAAUiB,2BAAaV,cAAA,CAACP,OAAAA,EAAAA;AAAMkB,gBAAAA,OAAAA,EAASzB,QAAQY,EAAE;AAAGL,gBAAAA,QAAAA,EAAAA;;;;AAGjE;;"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var scene_model = require('@cratis/scene.model');
|
|
4
|
+
var scene_react = require('@cratis/scene.react');
|
|
5
|
+
|
|
6
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
7
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
8
|
+
const key = (name)=>scene_react.componentRegistryKey('PrimeReact', name);
|
|
9
|
+
const common = [
|
|
10
|
+
{
|
|
11
|
+
path: 'ariaLabel',
|
|
12
|
+
label: 'Accessible name',
|
|
13
|
+
group: 'Accessibility',
|
|
14
|
+
valueType: scene_model.PropertyValueType.String
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
path: 'disabled',
|
|
18
|
+
label: 'Disabled',
|
|
19
|
+
group: 'Behavior',
|
|
20
|
+
valueType: scene_model.PropertyValueType.Boolean,
|
|
21
|
+
default: false
|
|
22
|
+
}
|
|
23
|
+
];
|
|
24
|
+
const placeholder = {
|
|
25
|
+
path: 'placeholder',
|
|
26
|
+
label: 'Placeholder',
|
|
27
|
+
group: 'Content',
|
|
28
|
+
valueType: scene_model.PropertyValueType.String
|
|
29
|
+
};
|
|
30
|
+
const checked = {
|
|
31
|
+
path: 'checked',
|
|
32
|
+
label: 'Initially checked',
|
|
33
|
+
group: 'Content',
|
|
34
|
+
valueType: scene_model.PropertyValueType.Boolean,
|
|
35
|
+
default: false
|
|
36
|
+
};
|
|
37
|
+
function input(name, displayName, valueType, properties = [
|
|
38
|
+
placeholder
|
|
39
|
+
]) {
|
|
40
|
+
const output = scene_react.valueOutputProperty(valueType);
|
|
41
|
+
// A selection publishes the chosen option values; the item descriptor names them for a binding picker.
|
|
42
|
+
const value = valueType === scene_model.PropertyValueType.Collection ? {
|
|
43
|
+
...output,
|
|
44
|
+
item: {
|
|
45
|
+
label: 'option value',
|
|
46
|
+
properties: []
|
|
47
|
+
}
|
|
48
|
+
} : output;
|
|
49
|
+
return {
|
|
50
|
+
component: key(name),
|
|
51
|
+
displayName,
|
|
52
|
+
properties: [
|
|
53
|
+
...properties,
|
|
54
|
+
...common,
|
|
55
|
+
value
|
|
56
|
+
]
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The input widgets that publish what the user entered as their `value` output (Cratis/StudioIssues#156).
|
|
61
|
+
* A designer offers the output as a binding source; a command action maps it as `component.<id>.value`.
|
|
62
|
+
*/ const primeReactInputDescriptors = [
|
|
63
|
+
input('inputText', 'Text input', scene_model.PropertyValueType.String),
|
|
64
|
+
input('inputTextarea', 'Text area', scene_model.PropertyValueType.String),
|
|
65
|
+
input('password', 'Password', scene_model.PropertyValueType.String),
|
|
66
|
+
input('inputNumber', 'Number input', scene_model.PropertyValueType.Number),
|
|
67
|
+
input('calendar', 'Date picker', scene_model.PropertyValueType.String),
|
|
68
|
+
input('dropdown', 'Dropdown', scene_model.PropertyValueType.String),
|
|
69
|
+
input('multiSelect', 'Multi-select', scene_model.PropertyValueType.Collection),
|
|
70
|
+
input('radioButton', 'Radio group', scene_model.PropertyValueType.String, []),
|
|
71
|
+
input('checkbox', 'Checkbox', scene_model.PropertyValueType.Boolean, [
|
|
72
|
+
checked,
|
|
73
|
+
{
|
|
74
|
+
path: 'label',
|
|
75
|
+
label: 'Label',
|
|
76
|
+
group: 'Content',
|
|
77
|
+
valueType: scene_model.PropertyValueType.String
|
|
78
|
+
}
|
|
79
|
+
]),
|
|
80
|
+
input('toggleSwitch', 'Toggle switch', scene_model.PropertyValueType.Boolean, [
|
|
81
|
+
checked
|
|
82
|
+
])
|
|
83
|
+
];
|
|
84
|
+
|
|
85
|
+
exports.primeReactInputDescriptors = primeReactInputDescriptors;
|
|
86
|
+
//# sourceMappingURL=inputDescriptors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inputDescriptors.js","sources":["../../inputDescriptors.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ComponentDescriptor, PropertyDescriptor, PropertyValueType } from '@cratis/scene.model';\nimport { componentRegistryKey, valueOutputProperty } from '@cratis/scene.react';\n\nconst key = (name: string) => componentRegistryKey('PrimeReact', name);\n\nconst common: PropertyDescriptor[] = [\n { path: 'ariaLabel', label: 'Accessible name', group: 'Accessibility', valueType: PropertyValueType.String },\n { path: 'disabled', label: 'Disabled', group: 'Behavior', valueType: PropertyValueType.Boolean, default: false },\n];\nconst placeholder: PropertyDescriptor = { path: 'placeholder', label: 'Placeholder', group: 'Content', valueType: PropertyValueType.String };\nconst checked: PropertyDescriptor = { path: 'checked', label: 'Initially checked', group: 'Content', valueType: PropertyValueType.Boolean, default: false };\n\nfunction input(name: string, displayName: string, valueType: PropertyValueType, properties: PropertyDescriptor[] = [placeholder]): ComponentDescriptor {\n const output = valueOutputProperty(valueType);\n // A selection publishes the chosen option values; the item descriptor names them for a binding picker.\n const value = valueType === PropertyValueType.Collection ? { ...output, item: { label: 'option value', properties: [] } } : output;\n return { component: key(name), displayName, properties: [...properties, ...common, value] };\n}\n\n/**\n * The input widgets that publish what the user entered as their `value` output (Cratis/StudioIssues#156).\n * A designer offers the output as a binding source; a command action maps it as `component.<id>.value`.\n */\nexport const primeReactInputDescriptors: ComponentDescriptor[] = [\n input('inputText', 'Text input', PropertyValueType.String),\n input('inputTextarea', 'Text area', PropertyValueType.String),\n input('password', 'Password', PropertyValueType.String),\n input('inputNumber', 'Number input', PropertyValueType.Number),\n input('calendar', 'Date picker', PropertyValueType.String),\n input('dropdown', 'Dropdown', PropertyValueType.String),\n input('multiSelect', 'Multi-select', PropertyValueType.Collection),\n input('radioButton', 'Radio group', PropertyValueType.String, []),\n input('checkbox', 'Checkbox', PropertyValueType.Boolean, [checked, { path: 'label', label: 'Label', group: 'Content', valueType: PropertyValueType.String }]),\n input('toggleSwitch', 'Toggle switch', PropertyValueType.Boolean, [checked]),\n];\n"],"names":["key","name","componentRegistryKey","common","path","label","group","valueType","PropertyValueType","String","Boolean","default","placeholder","checked","input","displayName","properties","output","valueOutputProperty","value","Collection","item","component","prime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TableSelectionMode = require('./data/TreeTableSelectionMode.js');
|
|
|
21
21
|
require('./file/FileUploadContext.js');
|
|
22
22
|
var FileUploadMode = require('./file/FileUploadMode.js');
|
|
23
23
|
require('primereact/fileupload');
|
|
24
|
+
var inputDescriptors = require('./inputDescriptors.js');
|
|
24
25
|
|
|
25
26
|
// Copyright (c) Cratis. All rights reserved.
|
|
26
27
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
27
28
|
const key = (name)=>scene_react.componentRegistryKey('PrimeReact', name);
|
|
28
29
|
/** Design-time descriptors for PrimeReact controls whose authored data has structured configuration. */ const primeReactDescriptors = [
|
|
30
|
+
...inputDescriptors.primeReactInputDescriptors,
|
|
29
31
|
{
|
|
30
32
|
component: key('chart'),
|
|
31
33
|
displayName: 'Chart',
|