@plasmicpkgs/react-aria 0.0.42 → 0.0.44
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/common.d.ts +8 -1
- package/dist/contexts.d.ts +3 -2
- package/dist/react-aria.esm.js +863 -670
- package/dist/react-aria.esm.js.map +1 -1
- package/dist/react-aria.js +861 -668
- package/dist/react-aria.js.map +1 -1
- package/dist/registerButton.d.ts +1 -1
- package/dist/registerCheckbox.d.ts +3 -4
- package/dist/registerCheckboxGroup.d.ts +2 -2
- package/dist/registerInput.d.ts +12 -5
- package/dist/registerListBox.d.ts +2 -3
- package/dist/registerModal.d.ts +2 -3
- package/dist/registerPopover.d.ts +4 -6
- package/dist/registerRadio.d.ts +3 -5
- package/dist/registerRadioGroup.d.ts +1 -1
- package/dist/registerSlider.d.ts +3 -20
- package/dist/registerSliderOutput.d.ts +1 -1
- package/dist/registerSliderThumb.d.ts +3 -3
- package/dist/registerSliderTrack.d.ts +3 -1
- package/dist/registerSwitch.d.ts +1 -1
- package/dist/registerTextArea.d.ts +11 -5
- package/dist/registerTextField.d.ts +3 -3
- package/dist/utils.d.ts +7 -1
- package/package.json +2 -2
- package/skinny/common-96be13c3.esm.js +341 -0
- package/skinny/common-96be13c3.esm.js.map +1 -0
- package/skinny/common-f51484c1.cjs.js +345 -0
- package/skinny/common-f51484c1.cjs.js.map +1 -0
- package/skinny/common.d.ts +8 -1
- package/skinny/{contexts-7236059e.cjs.js → contexts-3a98471a.cjs.js} +1 -3
- package/skinny/contexts-3a98471a.cjs.js.map +1 -0
- package/skinny/{contexts-21e0d928.esm.js → contexts-87c261f6.esm.js} +2 -3
- package/skinny/contexts-87c261f6.esm.js.map +1 -0
- package/skinny/contexts.d.ts +3 -2
- package/skinny/registerButton.cjs.js +2 -2
- package/skinny/registerButton.cjs.js.map +1 -1
- package/skinny/registerButton.d.ts +1 -1
- package/skinny/registerButton.esm.js +2 -2
- package/skinny/registerButton.esm.js.map +1 -1
- package/skinny/registerCheckbox.cjs.js +13 -18
- package/skinny/registerCheckbox.cjs.js.map +1 -1
- package/skinny/registerCheckbox.d.ts +3 -4
- package/skinny/registerCheckbox.esm.js +13 -18
- package/skinny/registerCheckbox.esm.js.map +1 -1
- package/skinny/registerCheckboxGroup.cjs.js +5 -5
- package/skinny/registerCheckboxGroup.cjs.js.map +1 -1
- package/skinny/registerCheckboxGroup.d.ts +2 -2
- package/skinny/registerCheckboxGroup.esm.js +5 -5
- package/skinny/registerCheckboxGroup.esm.js.map +1 -1
- package/skinny/registerComboBox.cjs.js +3 -3
- package/skinny/registerComboBox.esm.js +3 -3
- package/skinny/registerDialogTrigger.cjs.js +2 -2
- package/skinny/registerDialogTrigger.esm.js +2 -2
- package/skinny/registerHeader.cjs.js +1 -1
- package/skinny/registerHeader.esm.js +1 -1
- package/skinny/registerInput.cjs.js +76 -16
- package/skinny/registerInput.cjs.js.map +1 -1
- package/skinny/registerInput.d.ts +12 -5
- package/skinny/registerInput.esm.js +76 -17
- package/skinny/registerInput.esm.js.map +1 -1
- package/skinny/{registerListBox-f060da58.cjs.js → registerListBox-44316bb6.cjs.js} +7 -7
- package/skinny/registerListBox-44316bb6.cjs.js.map +1 -0
- package/skinny/{registerListBox-38a08460.esm.js → registerListBox-ccd14a2e.esm.js} +7 -7
- package/skinny/registerListBox-ccd14a2e.esm.js.map +1 -0
- package/skinny/registerListBox.cjs.js +3 -2
- package/skinny/registerListBox.cjs.js.map +1 -1
- package/skinny/registerListBox.d.ts +2 -3
- package/skinny/registerListBox.esm.js +3 -2
- package/skinny/registerListBox.esm.js.map +1 -1
- package/skinny/registerListBoxItem.cjs.js +1 -1
- package/skinny/registerListBoxItem.esm.js +1 -1
- package/skinny/registerModal.cjs.js +5 -4
- package/skinny/registerModal.cjs.js.map +1 -1
- package/skinny/registerModal.d.ts +2 -3
- package/skinny/registerModal.esm.js +5 -4
- package/skinny/registerModal.esm.js.map +1 -1
- package/skinny/registerPopover.cjs.js +23 -24
- package/skinny/registerPopover.cjs.js.map +1 -1
- package/skinny/registerPopover.d.ts +4 -6
- package/skinny/registerPopover.esm.js +24 -25
- package/skinny/registerPopover.esm.js.map +1 -1
- package/skinny/registerRadio.cjs.js +14 -26
- package/skinny/registerRadio.cjs.js.map +1 -1
- package/skinny/registerRadio.d.ts +3 -5
- package/skinny/registerRadio.esm.js +14 -26
- package/skinny/registerRadio.esm.js.map +1 -1
- package/skinny/registerRadioGroup.cjs.js +4 -4
- package/skinny/registerRadioGroup.cjs.js.map +1 -1
- package/skinny/registerRadioGroup.d.ts +1 -1
- package/skinny/registerRadioGroup.esm.js +4 -4
- package/skinny/registerRadioGroup.esm.js.map +1 -1
- package/skinny/registerSection.cjs.js +1 -1
- package/skinny/registerSection.esm.js +1 -1
- package/skinny/registerSelect.cjs.js +3 -3
- package/skinny/registerSelect.esm.js +3 -3
- package/skinny/registerSlider.cjs.js +305 -15
- package/skinny/registerSlider.cjs.js.map +1 -1
- package/skinny/registerSlider.d.ts +3 -20
- package/skinny/registerSlider.esm.js +303 -11
- package/skinny/registerSlider.esm.js.map +1 -1
- package/skinny/registerSliderOutput.cjs.js +1 -1
- package/skinny/registerSliderOutput.cjs.js.map +1 -1
- package/skinny/registerSliderOutput.d.ts +1 -1
- package/skinny/registerSliderOutput.esm.js +1 -1
- package/skinny/registerSliderOutput.esm.js.map +1 -1
- package/skinny/registerSliderThumb.cjs.js +4 -4
- package/skinny/registerSliderThumb.cjs.js.map +1 -1
- package/skinny/registerSliderThumb.d.ts +3 -3
- package/skinny/registerSliderThumb.esm.js +4 -4
- package/skinny/registerSliderThumb.esm.js.map +1 -1
- package/skinny/registerSliderTrack.cjs.js +188 -16
- package/skinny/registerSliderTrack.cjs.js.map +1 -1
- package/skinny/registerSliderTrack.d.ts +3 -1
- package/skinny/registerSliderTrack.esm.js +184 -13
- package/skinny/registerSliderTrack.esm.js.map +1 -1
- package/skinny/registerSwitch.cjs.js +10 -4
- package/skinny/registerSwitch.cjs.js.map +1 -1
- package/skinny/registerSwitch.d.ts +1 -1
- package/skinny/registerSwitch.esm.js +10 -4
- package/skinny/registerSwitch.esm.js.map +1 -1
- package/skinny/registerTextArea.cjs.js +56 -35
- package/skinny/registerTextArea.cjs.js.map +1 -1
- package/skinny/registerTextArea.d.ts +11 -5
- package/skinny/registerTextArea.esm.js +56 -36
- package/skinny/registerTextArea.esm.js.map +1 -1
- package/skinny/registerTextField.cjs.js +34 -215
- package/skinny/registerTextField.cjs.js.map +1 -1
- package/skinny/registerTextField.d.ts +3 -3
- package/skinny/registerTextField.esm.js +34 -215
- package/skinny/registerTextField.esm.js.map +1 -1
- package/skinny/utils-a1785802.esm.js.map +1 -1
- package/skinny/utils-d3708034.cjs.js.map +1 -1
- package/skinny/utils.d.ts +7 -1
- package/skinny/common-52c26d37.esm.js +0 -52
- package/skinny/common-52c26d37.esm.js.map +0 -1
- package/skinny/common-e74a9214.cjs.js +0 -54
- package/skinny/common-e74a9214.cjs.js.map +0 -1
- package/skinny/contexts-21e0d928.esm.js.map +0 -1
- package/skinny/contexts-7236059e.cjs.js.map +0 -1
- package/skinny/registerListBox-38a08460.esm.js.map +0 -1
- package/skinny/registerListBox-f060da58.cjs.js.map +0 -1
- package/skinny/registerSlider-58ef7e20.cjs.js +0 -473
- package/skinny/registerSlider-58ef7e20.cjs.js.map +0 -1
- package/skinny/registerSlider-d74e2330.esm.js +0 -460
- package/skinny/registerSlider-d74e2330.esm.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerTextField.esm.js","sources":["../src/registerTextField.tsx"],"sourcesContent":["import React, { ReactNode } from \"react\";\nimport type { InputProps, TextFieldProps } from \"react-aria-components\";\nimport { TextField } from \"react-aria-components\";\nimport { getCommonInputProps } from \"./common\";\nimport { PlasmicTextFieldContext } from \"./contexts\";\nimport {\n UpdateInteractionVariant,\n pickAriaComponentVariants,\n} from \"./interaction-variant-utils\";\nimport { DESCRIPTION_COMPONENT_NAME } from \"./registerDescription\";\nimport { registerFieldError } from \"./registerFieldError\";\nimport { INPUT_COMPONENT_NAME, registerInput } from \"./registerInput\";\nimport { LABEL_COMPONENT_NAME, registerLabel } from \"./registerLabel\";\nimport { registerTextArea } from \"./registerTextArea\";\nimport {\n CodeComponentMetaOverrides,\n Registerable,\n makeChildComponentName,\n makeComponentName,\n registerComponentHelper,\n} from \"./utils\";\n\nconst TEXT_FIELD_INTERACTION_VARIANTS = [\n \"disabled\" as const,\n \"readonly\" as const,\n];\n\nexport interface BaseTextFieldProps extends TextFieldProps {\n label?: ReactNode;\n description?: ReactNode;\n enableAutoComplete?: boolean;\n multiline?: boolean;\n inputProps?: InputProps;\n children: ReactNode;\n // Optional callback to update the interaction variant state\n // as it's only provided if the component is the root of a Studio component\n updateInteractionVariant?: UpdateInteractionVariant<\n typeof TEXT_FIELD_INTERACTION_VARIANTS\n >;\n}\n\nconst { interactionVariants, withObservedValues } = pickAriaComponentVariants(\n TEXT_FIELD_INTERACTION_VARIANTS\n);\n\nexport function BaseTextField(props: BaseTextFieldProps) {\n const {\n enableAutoComplete,\n autoComplete,\n children,\n updateInteractionVariant,\n ...rest\n } = props;\n\n return (\n <PlasmicTextFieldContext.Provider value={props}>\n <TextField\n autoComplete={enableAutoComplete ? autoComplete : undefined}\n {...rest}\n >\n {({ isDisabled, isReadOnly }) =>\n withObservedValues(\n children,\n {\n disabled: isDisabled,\n readonly: isReadOnly,\n },\n updateInteractionVariant\n )\n }\n </TextField>\n </PlasmicTextFieldContext.Provider>\n );\n}\n\nexport const TEXT_FIELD_COMPONENT_NAME = makeComponentName(\"textField\");\n\nexport function registerTextField(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseTextField>\n) {\n registerComponentHelper(\n loader,\n BaseTextField,\n {\n name: TEXT_FIELD_COMPONENT_NAME,\n displayName: \"Aria TextField\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerTextField\",\n importName: \"BaseTextField\",\n interactionVariants,\n // TODO: Support for validate prop\n props: {\n ...getCommonInputProps<BaseTextFieldProps>(\"input\", [\n \"name\",\n \"isDisabled\",\n \"isReadOnly\",\n \"autoFocus\",\n \"aria-label\",\n \"isRequired\",\n ]),\n children: {\n type: \"slot\",\n mergeWithParent: true as any,\n defaultValue: {\n type: \"vbox\",\n styles: {\n justifyContent: \"flex-start\",\n alignItems: \"flex-start\",\n width: \"300px\",\n gap: \"5px\",\n },\n children: [\n {\n type: \"component\",\n name: LABEL_COMPONENT_NAME,\n props: {\n children: {\n type: \"text\",\n value: \"Label\",\n },\n },\n },\n {\n type: \"component\",\n name: INPUT_COMPONENT_NAME,\n styles: {\n width: \"100%\",\n },\n },\n {\n type: \"component\",\n name: DESCRIPTION_COMPONENT_NAME,\n props: {\n children: {\n type: \"text\",\n value: \"Type something...\",\n },\n },\n },\n ],\n },\n },\n value: {\n type: \"string\",\n editOnly: true,\n uncontrolledProp: \"defaultValue\",\n description: \"The current value\",\n },\n isInvalid: {\n // TODO: Not sure if needed\n displayName: \"Invalid\",\n type: \"boolean\",\n description: \"Whether the input value is invalid\",\n defaultValueHint: false,\n },\n customValidationErrors: {\n // TODO: Not sure if needed\n type: \"array\",\n description: \"Errors for custom validation\",\n },\n // validate: {\n // type: \"function\" as const,\n // argNames: [\"value\"],\n // argValues: (_ps: any, ctx: any) => [ctx.data[0]],\n // },\n enableAutoComplete: {\n type: \"boolean\",\n description:\n \"Whether the browser is allowed to automatically complete the input\",\n defaultValueHint: false,\n },\n autoComplete: {\n type: \"choice\",\n hidden: ({ enableAutoComplete }: BaseTextFieldProps) =>\n !enableAutoComplete,\n description: \"Guidance as to the type of data expected in the field\",\n helpText:\n \"For explanations on what each of the values mean, check https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete#values\",\n options: [\n \"name\",\n \"honorific-prefix\",\n \"given-name\",\n \"additional-name\",\n \"family-name\",\n \"honorific-suffix\",\n \"nickname\",\n \"email\",\n \"username\",\n \"new-password\",\n \"current-password\",\n \"one-time-code\",\n \"organization-title\",\n \"organization\",\n \"street-address\",\n \"shipping\",\n \"billing\",\n \"address-line1\",\n \"address-line2\",\n \"address-line3\",\n \"address-level4\",\n \"address-level3\",\n \"address-level2\",\n \"address-level1\",\n \"country\",\n \"country-name\",\n \"postal-code\",\n \"cc-name\",\n \"cc-given-name\",\n \"cc-additional-name\",\n \"cc-family-name\",\n \"cc-number\",\n \"cc-exp\",\n \"cc-exp-month\",\n \"cc-exp-year\",\n \"cc-csc\",\n \"cc-type\",\n \"transaction-currency\",\n \"transaction-amount\",\n \"language\",\n \"bday\",\n \"bday-day\",\n \"bday-month\",\n \"bday-year\",\n \"sex\",\n \"tel\",\n \"tel-country-code\",\n \"tel-national\",\n \"tel-area-code\",\n \"tel-local\",\n \"tel-local-suffix\",\n \"tel-local-prefix\",\n \"tel-extension\",\n \"impp\",\n \"url\",\n \"photo\",\n \"webauthn\",\n ],\n },\n maxLength: {\n type: \"number\",\n description:\n \"The maximum number of characters supported by the input\",\n },\n minLength: {\n type: \"number\",\n description:\n \"The minimum number of characters supported by the input\",\n },\n pattern: {\n type: \"string\",\n description:\n \"Regex pattern that the value of the input must match to be valid\",\n helpText:\n \"For more information about writing Regular Expressions (regex), check out https://regexr.com/\",\n validator: (value) => {\n try {\n new RegExp(value);\n return true;\n } catch (error) {\n return \"Invalid Regex\";\n }\n },\n },\n type: {\n type: \"choice\",\n defaultValueHint: \"text\",\n options: [\"text\", \"search\", \"url\", \"tel\", \"email\", \"password\"],\n },\n inputMode: {\n type: \"choice\",\n description:\n \"hint to browsers as to the type of virtual keyboard configuration to use when editing this element or its contents.\",\n options: [\n \"none\",\n \"text\",\n \"tel\",\n \"url\",\n \"email\",\n \"numeric\",\n \"decimal\",\n \"search\",\n ],\n },\n validationBehavior: {\n type: \"choice\",\n options: [\"native\", \"aria\"],\n description:\n \"Whether to use native HTML form validation to prevent form submission when the value is missing or invalid, or mark the field as required or invalid via ARIA.\",\n defaultValueHint: \"native\",\n },\n onChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"value\", type: \"string\" }],\n },\n onFocus: {\n type: \"eventHandler\",\n argTypes: [{ name: \"focusEvent\", type: \"object\" }],\n },\n onBlur: {\n type: \"eventHandler\",\n argTypes: [{ name: \"focusEvent\", type: \"object\" }],\n },\n onFocusChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"isFocused\", type: \"boolean\" }],\n },\n onKeyDown: {\n type: \"eventHandler\",\n argTypes: [{ name: \"keyboardEvent\", type: \"object\" }],\n },\n onKeyUp: {\n type: \"eventHandler\",\n argTypes: [{ name: \"keyboardEvent\", type: \"object\" }],\n },\n onCopy: {\n type: \"eventHandler\",\n argTypes: [{ name: \"clipbordEvent\", type: \"object\" }],\n },\n onCut: {\n type: \"eventHandler\",\n argTypes: [{ name: \"clipbordEvent\", type: \"object\" }],\n },\n onPaste: {\n type: \"eventHandler\",\n argTypes: [{ name: \"clipbordEvent\", type: \"object\" }],\n },\n onCompositionStart: {\n type: \"eventHandler\",\n argTypes: [{ name: \"compositionEvent\", type: \"object\" }],\n },\n onCompositionEnd: {\n type: \"eventHandler\",\n argTypes: [{ name: \"compositionEvent\", type: \"object\" }],\n },\n onCompositionUpdate: {\n type: \"eventHandler\",\n argTypes: [{ name: \"compositionEvent\", type: \"object\" }],\n },\n onSelect: {\n type: \"eventHandler\",\n argTypes: [{ name: \"selectionEvent\", type: \"object\" }],\n },\n onBeforeInput: {\n type: \"eventHandler\",\n argTypes: [{ name: \"inputEvent\", type: \"object\" }],\n },\n onInput: {\n type: \"eventHandler\",\n argTypes: [{ name: \"inputEvent\", type: \"object\" }],\n },\n },\n // NOTE: React-Aria does not support render props for <Input> and <Textarea>, so focusVisible and inputHovered states are not implemented\n states: {\n value: {\n type: \"writable\",\n valueProp: \"value\",\n onChangeProp: \"onChange\",\n variableType: \"text\",\n },\n },\n trapsFocus: true,\n },\n overrides\n );\n\n const thisName = makeChildComponentName(\n overrides?.parentComponentName,\n TEXT_FIELD_COMPONENT_NAME\n );\n\n registerFieldError(loader, { parentComponentName: thisName });\n registerInput(loader, { parentComponentName: thisName });\n registerLabel(loader, { parentComponentName: thisName });\n registerTextArea(loader, { parentComponentName: thisName });\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAM,+BAAkC,GAAA;AAAA,EACtC,UAAA;AAAA,EACA,UAAA;AACF,CAAA,CAAA;AAgBA,MAAM,EAAE,mBAAqB,EAAA,kBAAA,EAAuB,GAAA,yBAAA;AAAA,EAClD,+BAAA;AACF,CAAA,CAAA;AAEO,SAAS,cAAc,KAA2B,EAAA;AACvD,EAAA,MAMI,EALF,GAAA,KAAA,EAAA;AAAA,IAAA,kBAAA;AAAA,IACA,YAAA;AAAA,IACA,QAAA;AAAA,IACA,wBAAA;AAAA,GAlDJ,GAoDM,EADC,EAAA,IAAA,GAAA,SAAA,CACD,EADC,EAAA;AAAA,IAJH,oBAAA;AAAA,IACA,cAAA;AAAA,IACA,UAAA;AAAA,IACA,0BAAA;AAAA,GAAA,CAAA,CAAA;AAIF,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,uBAAA,CAAwB,QAAxB,EAAA,EAAiC,OAAO,KACvC,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,SAAA;AAAA,IAAA,cAAA,CAAA;AAAA,MACC,YAAA,EAAc,qBAAqB,YAAe,GAAA,KAAA,CAAA;AAAA,KAC9C,EAAA,IAAA,CAAA;AAAA,IAEH,CAAC,EAAE,UAAY,EAAA,UAAA,EACd,KAAA,kBAAA;AAAA,MACE,QAAA;AAAA,MACA;AAAA,QACE,QAAU,EAAA,UAAA;AAAA,QACV,QAAU,EAAA,UAAA;AAAA,OACZ;AAAA,MACA,wBAAA;AAAA,KACF;AAAA,GAGN,CAAA,CAAA;AAEJ,CAAA;AAEa,MAAA,yBAAA,GAA4B,kBAAkB,WAAW,EAAA;AAEtD,SAAA,iBAAA,CACd,QACA,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AAM,UAAU,CAAA;AAAA,SACnD;AAAA,QACA,OAAS,EAAA;AAAA,UACP,IAAM,EAAA,cAAA;AAAA,UACN,UAAU,CAAC,EAAE,MAAM,YAAc,EAAA,IAAA,EAAM,UAAU,CAAA;AAAA,SACnD;AAAA,OACF,CAAA;AAAA;AAAA,MAEA,MAAQ,EAAA;AAAA,QACN,KAAO,EAAA;AAAA,UACL,IAAM,EAAA,UAAA;AAAA,UACN,SAAW,EAAA,OAAA;AAAA,UACX,YAAc,EAAA,UAAA;AAAA,UACd,YAAc,EAAA,MAAA;AAAA,SAChB;AAAA,OACF;AAAA,MACA,UAAY,EAAA,IAAA;AAAA,KACd;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AAEA,EAAA,MAAM,QAAW,GAAA,sBAAA;AAAA,IACf,SAAW,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,SAAA,CAAA,mBAAA;AAAA,IACX,yBAAA;AAAA,GACF,CAAA;AAEA,EAAA,kBAAA,CAAmB,MAAQ,EAAA,EAAE,mBAAqB,EAAA,QAAA,EAAU,CAAA,CAAA;AAC5D,EAAA,aAAA,CAAc,MAAQ,EAAA,EAAE,mBAAqB,EAAA,QAAA,EAAU,CAAA,CAAA;AACvD,EAAA,aAAA,CAAc,MAAQ,EAAA,EAAE,mBAAqB,EAAA,QAAA,EAAU,CAAA,CAAA;AACvD,EAAA,gBAAA,CAAiB,MAAQ,EAAA,EAAE,mBAAqB,EAAA,QAAA,EAAU,CAAA,CAAA;AAC5D;;;;"}
|
|
1
|
+
{"version":3,"file":"registerTextField.esm.js","sources":["../src/registerTextField.tsx"],"sourcesContent":["import React, { ReactNode } from \"react\";\nimport type { InputProps, TextFieldProps } from \"react-aria-components\";\nimport { TextField } from \"react-aria-components\";\nimport { getCommonProps, resolveAutoComplete } from \"./common\";\nimport { PlasmicTextFieldContext } from \"./contexts\";\nimport {\n UpdateInteractionVariant,\n pickAriaComponentVariants,\n} from \"./interaction-variant-utils\";\nimport { DESCRIPTION_COMPONENT_NAME } from \"./registerDescription\";\nimport { registerFieldError } from \"./registerFieldError\";\nimport { INPUT_COMPONENT_NAME, registerInput } from \"./registerInput\";\nimport { LABEL_COMPONENT_NAME, registerLabel } from \"./registerLabel\";\nimport { registerTextArea } from \"./registerTextArea\";\nimport {\n CodeComponentMetaOverrides,\n Registerable,\n makeChildComponentName,\n makeComponentName,\n registerComponentHelper,\n} from \"./utils\";\n\nconst TEXT_FIELD_INTERACTION_VARIANTS = [\n \"disabled\" as const,\n \"readonly\" as const,\n];\n\nexport interface BaseTextFieldProps\n extends Omit<TextFieldProps, \"autoComplete\"> {\n label?: ReactNode;\n description?: ReactNode;\n multiline?: boolean;\n inputProps?: InputProps;\n autoComplete?: string[];\n children: ReactNode;\n // Optional callback to update the interaction variant state\n // as it's only provided if the component is the root of a Studio component\n updateInteractionVariant?: UpdateInteractionVariant<\n typeof TEXT_FIELD_INTERACTION_VARIANTS\n >;\n}\n\nconst { interactionVariants, withObservedValues } = pickAriaComponentVariants(\n TEXT_FIELD_INTERACTION_VARIANTS\n);\n\nexport function BaseTextField(props: BaseTextFieldProps) {\n const { children, updateInteractionVariant, autoComplete, ...rest } = props;\n\n return (\n <PlasmicTextFieldContext.Provider value={props}>\n <TextField autoComplete={resolveAutoComplete(autoComplete)} {...rest}>\n {({ isDisabled, isReadOnly }) =>\n withObservedValues(\n children,\n {\n disabled: isDisabled,\n readonly: isReadOnly,\n },\n updateInteractionVariant\n )\n }\n </TextField>\n </PlasmicTextFieldContext.Provider>\n );\n}\n\nexport const TEXT_FIELD_COMPONENT_NAME = makeComponentName(\"textField\");\n\nexport function registerTextField(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseTextField>\n) {\n registerComponentHelper(\n loader,\n BaseTextField,\n {\n name: TEXT_FIELD_COMPONENT_NAME,\n displayName: \"Aria TextField\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerTextField\",\n importName: \"BaseTextField\",\n interactionVariants,\n // TODO: Support for validate prop\n props: {\n ...getCommonProps<BaseTextFieldProps>(\"Text Field\", [\n \"name\",\n \"isDisabled\",\n \"isReadOnly\",\n \"autoFocus\",\n \"aria-label\",\n \"isRequired\",\n \"value\",\n \"maxLength\",\n \"minLength\",\n \"pattern\",\n \"type\",\n \"inputMode\",\n \"validationBehavior\",\n \"autoComplete\",\n \"onChange\",\n \"onFocus\",\n \"onBlur\",\n \"onFocusChange\",\n \"onKeyDown\",\n \"onKeyUp\",\n \"onCopy\",\n \"onCut\",\n \"onPaste\",\n \"onCompositionStart\",\n \"onCompositionEnd\",\n \"onCompositionUpdate\",\n \"onSelect\",\n \"onBeforeInput\",\n \"onInput\",\n ]),\n children: {\n type: \"slot\",\n mergeWithParent: true as any,\n defaultValue: {\n type: \"vbox\",\n styles: {\n justifyContent: \"flex-start\",\n alignItems: \"flex-start\",\n width: \"300px\",\n gap: \"5px\",\n },\n children: [\n {\n type: \"component\",\n name: LABEL_COMPONENT_NAME,\n props: {\n children: {\n type: \"text\",\n value: \"Label\",\n },\n },\n },\n {\n type: \"component\",\n name: INPUT_COMPONENT_NAME,\n styles: {\n width: \"100%\",\n },\n },\n {\n type: \"component\",\n name: DESCRIPTION_COMPONENT_NAME,\n props: {\n children: {\n type: \"text\",\n value: \"Type something...\",\n },\n },\n },\n ],\n },\n },\n\n isInvalid: {\n // TODO: Not sure if needed\n displayName: \"Invalid\",\n type: \"boolean\",\n description: \"Whether the input value is invalid\",\n defaultValueHint: false,\n },\n customValidationErrors: {\n // TODO: Not sure if needed\n type: \"array\",\n description: \"Errors for custom validation\",\n },\n },\n states: {\n value: {\n type: \"writable\",\n valueProp: \"value\",\n onChangeProp: \"onChange\",\n variableType: \"text\",\n },\n },\n trapsFocus: true,\n },\n overrides\n );\n\n const thisName = makeChildComponentName(\n overrides?.parentComponentName,\n TEXT_FIELD_COMPONENT_NAME\n );\n\n registerFieldError(loader, { parentComponentName: thisName });\n registerInput(loader, { parentComponentName: thisName });\n registerLabel(loader, { parentComponentName: this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A,CAAiB,MAAQ,EAAA,EAAE,mBAAqB,EAAA,QAAA,EAAU,CAAA,CAAA;AAC5D;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils-a1785802.esm.js","sources":["../src/utils.ts"],"sourcesContent":["import type { CodeComponentMeta } from \"@plasmicapp/host\";\nimport registerComponent from \"@plasmicapp/host/registerComponent\";\nimport React from \"react\";\n\nexport type BaseControlContextData = {\n
|
|
1
|
+
{"version":3,"file":"utils-a1785802.esm.js","sources":["../src/utils.ts"],"sourcesContent":["import type { CodeComponentMeta } from \"@plasmicapp/host\";\nimport registerComponent from \"@plasmicapp/host/registerComponent\";\nimport React from \"react\";\n\nexport type HasControlContextData<T = BaseControlContextData> = {\n setControlContextData?: (ctxData: T) => void;\n};\n\nexport type BaseControlContextData = {\n parent?: {\n isDisabled?: boolean;\n isReadOnly?: boolean;\n };\n};\n\nexport type Registerable = {\n registerComponent: typeof registerComponent;\n};\n\nexport type OtherCodeComponentsMeta = {\n text: CodeComponentMeta<any>;\n description: CodeComponentMeta<any>;\n};\n\nexport type CodeComponentMetaOverrides<T extends React.ComponentType<any>> =\n Partial<\n Pick<\n CodeComponentMeta<React.ComponentProps<T>>,\n \"parentComponentName\" | \"props\" | \"displayName\" | \"name\"\n >\n >;\n\nexport function registerComponentHelper<T extends React.ComponentType<any>>(\n loader: Registerable | undefined,\n component: T,\n meta: CodeComponentMeta<React.ComponentProps<T>>,\n overrides?: CodeComponentMetaOverrides<T>\n) {\n if (overrides) {\n meta = {\n ...meta,\n ...overrides,\n props: {\n ...meta.props,\n ...overrides.props,\n },\n };\n if (overrides.parentComponentName) {\n meta.name = makeChildComponentName(\n overrides.parentComponentName,\n meta.name\n );\n }\n }\n if (loader) {\n loader.registerComponent(component, meta);\n } else {\n registerComponent(component, meta);\n }\n return meta;\n}\n\nexport function makeComponentName(name: string) {\n return `plasmic-react-aria-${name}`;\n}\n\nexport function makeChildComponentName(\n fullParentName: string | undefined,\n fullChildName: string\n) {\n if (!fullParentName) {\n return fullChildName;\n }\n return `${fullParentName}-${fullChildName.replace(\n \"plasmic-react-aria-\",\n \"\"\n )}`;\n}\n\nexport interface Styleable {\n className?: string;\n style?: React.CSSProperties;\n}\n\nexport function extractPlasmicDataProps(props: Record<string, any>) {\n return Object.fromEntries(\n Object.entries(props).filter(([key]) => key.startsWith(\"data-plasmic-\"))\n );\n}\n\nexport function withoutNils<T>(array: (T | undefined | null)[]) {\n return array.filter((x): x is T => x != null);\n}\n\nexport function isDefined<T>(thing: T | undefined | null): thing is T {\n return thing !== undefined && thing !== null;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAgCO,SAAS,uBACd,CAAA,MAAA,EACA,SACA,EAAA,IAAA,EACA,SACA,EAAA;AACA,EAAA,IAAI,SAAW,EAAA;AACb,IAAO,IAAA,GAAA,aAAA,CAAA,cAAA,CAAA,cAAA,CAAA,EAAA,EACF,OACA,SAFE,CAAA,EAAA;AAAA,MAGL,KAAO,EAAA,cAAA,CAAA,cAAA,CAAA,EAAA,EACF,IAAK,CAAA,KAAA,CAAA,EACL,SAAU,CAAA,KAAA,CAAA;AAAA,KAEjB,CAAA,CAAA;AACA,IAAA,IAAI,UAAU,mBAAqB,EAAA;AACjC,MAAA,IAAA,CAAK,IAAO,GAAA,sBAAA;AAAA,QACV,SAAU,CAAA,mBAAA;AAAA,QACV,IAAK,CAAA,IAAA;AAAA,OACP,CAAA;AAAA,KACF;AAAA,GACF;AACA,EAAA,IAAI,MAAQ,EAAA;AACV,IAAO,MAAA,CAAA,iBAAA,CAAkB,WAAW,IAAI,CAAA,CAAA;AAAA,GACnC,MAAA;AACL,IAAA,iBAAA,CAAkB,WAAW,IAAI,CAAA,CAAA;AAAA,GACnC;AACA,EAAO,OAAA,IAAA,CAAA;AACT,CAAA;AAEO,SAAS,kBAAkB,IAAc,EAAA;AAC9C,EAAA,OAAO,CAAsB,mBAAA,EAAA,IAAA,CAAA,CAAA,CAAA;AAC/B,CAAA;AAEgB,SAAA,sBAAA,CACd,gBACA,aACA,EAAA;AACA,EAAA,IAAI,CAAC,cAAgB,EAAA;AACnB,IAAO,OAAA,aAAA,CAAA;AAAA,GACT;AACA,EAAO,OAAA,CAAA,EAAG,kBAAkB,aAAc,CAAA,OAAA;AAAA,IACxC,qBAAA;AAAA,IACA,EAAA;AAAA,GACF,CAAA,CAAA,CAAA;AACF,CAAA;AAOO,SAAS,wBAAwB,KAA4B,EAAA;AAClE,EAAA,OAAO,MAAO,CAAA,WAAA;AAAA,IACZ,MAAO,CAAA,OAAA,CAAQ,KAAK,CAAA,CAAE,MAAO,CAAA,CAAC,CAAC,GAAG,CAAM,KAAA,GAAA,CAAI,UAAW,CAAA,eAAe,CAAC,CAAA;AAAA,GACzE,CAAA;AACF,CAAA;AAEO,SAAS,YAAe,KAAiC,EAAA;AAC9D,EAAA,OAAO,KAAM,CAAA,MAAA,CAAO,CAAC,CAAA,KAAc,KAAK,IAAI,CAAA,CAAA;AAC9C,CAAA;AAEO,SAAS,UAAa,KAAyC,EAAA;AACpE,EAAO,OAAA,KAAA,KAAU,UAAa,KAAU,KAAA,IAAA,CAAA;AAC1C;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils-d3708034.cjs.js","sources":["../src/utils.ts"],"sourcesContent":["import type { CodeComponentMeta } from \"@plasmicapp/host\";\nimport registerComponent from \"@plasmicapp/host/registerComponent\";\nimport React from \"react\";\n\nexport type BaseControlContextData = {\n
|
|
1
|
+
{"version":3,"file":"utils-d3708034.cjs.js","sources":["../src/utils.ts"],"sourcesContent":["import type { CodeComponentMeta } from \"@plasmicapp/host\";\nimport registerComponent from \"@plasmicapp/host/registerComponent\";\nimport React from \"react\";\n\nexport type HasControlContextData<T = BaseControlContextData> = {\n setControlContextData?: (ctxData: T) => void;\n};\n\nexport type BaseControlContextData = {\n parent?: {\n isDisabled?: boolean;\n isReadOnly?: boolean;\n };\n};\n\nexport type Registerable = {\n registerComponent: typeof registerComponent;\n};\n\nexport type OtherCodeComponentsMeta = {\n text: CodeComponentMeta<any>;\n description: CodeComponentMeta<any>;\n};\n\nexport type CodeComponentMetaOverrides<T extends React.ComponentType<any>> =\n Partial<\n Pick<\n CodeComponentMeta<React.ComponentProps<T>>,\n \"parentComponentName\" | \"props\" | \"displayName\" | \"name\"\n >\n >;\n\nexport function registerComponentHelper<T extends React.ComponentType<any>>(\n loader: Registerable | undefined,\n component: T,\n meta: CodeComponentMeta<React.ComponentProps<T>>,\n overrides?: CodeComponentMetaOverrides<T>\n) {\n if (overrides) {\n meta = {\n ...meta,\n ...overrides,\n props: {\n ...meta.props,\n ...overrides.props,\n },\n };\n if (overrides.parentComponentName) {\n meta.name = makeChildComponentName(\n overrides.parentComponentName,\n meta.name\n );\n }\n }\n if (loader) {\n loader.registerComponent(component, meta);\n } else {\n registerComponent(component, meta);\n }\n return meta;\n}\n\nexport function makeComponentName(name: string) {\n return `plasmic-react-aria-${name}`;\n}\n\nexport function makeChildComponentName(\n fullParentName: string | undefined,\n fullChildName: string\n) {\n if (!fullParentName) {\n return fullChildName;\n }\n return `${fullParentName}-${fullChildName.replace(\n \"plasmic-react-aria-\",\n \"\"\n )}`;\n}\n\nexport interface Styleable {\n className?: string;\n style?: React.CSSProperties;\n}\n\nexport function extractPlasmicDataProps(props: Record<string, any>) {\n return Object.fromEntries(\n Object.entries(props).filter(([key]) => key.startsWith(\"data-plasmic-\"))\n );\n}\n\nexport function withoutNils<T>(array: (T | undefined | null)[]) {\n return array.filter((x): x is T => x != null);\n}\n\nexport function isDefined<T>(thing: T | undefined | null): thing is T {\n return thing !== undefined && thing !== null;\n}\n"],"names":["registerComponent"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCO,SAAS,uBACd,CAAA,MAAA,EACA,SACA,EAAA,IAAA,EACA,SACA,EAAA;AACA,EAAA,IAAI,SAAW,EAAA;AACb,IAAO,IAAA,GAAA,aAAA,CAAA,cAAA,CAAA,cAAA,CAAA,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,CAAC,CAAA,KAAc,KAAK,IAAI,CAAA,CAAA;AAC9C,CAAA;AAEO,SAAS,UAAa,KAAyC,EAAA;AACpE,EAAO,OAAA,KAAA,KAAU,UAAa,KAAU,KAAA,IAAA,CAAA;AAC1C;;;;;;;;;"}
|
package/skinny/utils.d.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import type { CodeComponentMeta } from "@plasmicapp/host";
|
|
2
2
|
import registerComponent from "@plasmicapp/host/registerComponent";
|
|
3
3
|
import React from "react";
|
|
4
|
+
export type HasControlContextData<T = BaseControlContextData> = {
|
|
5
|
+
setControlContextData?: (ctxData: T) => void;
|
|
6
|
+
};
|
|
4
7
|
export type BaseControlContextData = {
|
|
5
|
-
|
|
8
|
+
parent?: {
|
|
9
|
+
isDisabled?: boolean;
|
|
10
|
+
isReadOnly?: boolean;
|
|
11
|
+
};
|
|
6
12
|
};
|
|
7
13
|
export type Registerable = {
|
|
8
14
|
registerComponent: typeof registerComponent;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
function getCommonInputProps(fieldName, fields) {
|
|
2
|
-
const commonInputProps = {
|
|
3
|
-
name: {
|
|
4
|
-
type: "string",
|
|
5
|
-
description: "Name for this field if it is part of a form"
|
|
6
|
-
},
|
|
7
|
-
isDisabled: {
|
|
8
|
-
displayName: "Disabled",
|
|
9
|
-
type: "boolean",
|
|
10
|
-
description: `Whether the ${fieldName} is read-only and unfocusable`,
|
|
11
|
-
defaultValueHint: false
|
|
12
|
-
},
|
|
13
|
-
isReadOnly: {
|
|
14
|
-
displayName: "Read only",
|
|
15
|
-
type: "boolean",
|
|
16
|
-
description: `Whether the value of this ${fieldName} can be changed by the user`,
|
|
17
|
-
defaultValueHint: false
|
|
18
|
-
},
|
|
19
|
-
autoFocus: {
|
|
20
|
-
type: "boolean",
|
|
21
|
-
description: `Whether the ${fieldName} should be focused when rendered`,
|
|
22
|
-
defaultValueHint: false,
|
|
23
|
-
advanced: true
|
|
24
|
-
},
|
|
25
|
-
"aria-label": {
|
|
26
|
-
type: "string",
|
|
27
|
-
displayName: "Aria Label",
|
|
28
|
-
description: `Label for this ${fieldName}, if no visible label is used, to identify the element to assistive technology`,
|
|
29
|
-
advanced: true
|
|
30
|
-
},
|
|
31
|
-
isRequired: {
|
|
32
|
-
displayName: "Required",
|
|
33
|
-
type: "boolean",
|
|
34
|
-
description: `Whether user input is required on the ${fieldName} before form submission.`,
|
|
35
|
-
defaultValueHint: false
|
|
36
|
-
},
|
|
37
|
-
children: {
|
|
38
|
-
type: "slot",
|
|
39
|
-
mergeWithParent: true
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
const filteredProps = {};
|
|
43
|
-
fields.forEach((field) => {
|
|
44
|
-
if (commonInputProps.hasOwnProperty(field)) {
|
|
45
|
-
filteredProps[field] = commonInputProps[field];
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
return filteredProps;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export { getCommonInputProps as g };
|
|
52
|
-
//# sourceMappingURL=common-52c26d37.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common-52c26d37.esm.js","sources":["../src/common.ts"],"sourcesContent":["import { PropType } from \"@plasmicapp/host\";\n\nexport function getCommonInputProps<T>(\n fieldName: string,\n fields: (keyof T)[]\n): Record<string, PropType<T>> {\n const commonInputProps: Record<string, PropType<T>> = {\n name: {\n type: \"string\",\n description: \"Name for this field if it is part of a form\",\n },\n isDisabled: {\n displayName: \"Disabled\",\n type: \"boolean\",\n description: `Whether the ${fieldName} is read-only and unfocusable`,\n defaultValueHint: false,\n },\n isReadOnly: {\n displayName: \"Read only\",\n type: \"boolean\",\n description: `Whether the value of this ${fieldName} can be changed by the user`,\n defaultValueHint: false,\n },\n autoFocus: {\n type: \"boolean\",\n description: `Whether the ${fieldName} should be focused when rendered`,\n defaultValueHint: false,\n advanced: true,\n },\n \"aria-label\": {\n type: \"string\",\n displayName: \"Aria Label\",\n description: `Label for this ${fieldName}, if no visible label is used, to identify the element to assistive technology`,\n advanced: true,\n },\n isRequired: {\n displayName: \"Required\",\n type: \"boolean\",\n description: `Whether user input is required on the ${fieldName} before form submission.`,\n defaultValueHint: false,\n },\n children: {\n type: \"slot\",\n mergeWithParent: true as any,\n },\n };\n\n // Filter the properties based on the provided fields array\n const filteredProps: Record<string, PropType<T>> = {};\n fields.forEach((field) => {\n if (commonInputProps.hasOwnProperty(field)) {\n filteredProps[field as string] = commonInputProps[field as string];\n }\n });\n\n return filteredProps;\n}\n"],"names":[],"mappings":"AAEgB,SAAA,mBAAA,CACd,WACA,MAC6B,EAAA;AAC7B,EAAA,MAAM,gBAAgD,GAAA;AAAA,IACpD,IAAM,EAAA;AAAA,MACJ,IAAM,EAAA,QAAA;AAAA,MACN,WAAa,EAAA,6CAAA;AAAA,KACf;AAAA,IACA,UAAY,EAAA;AAAA,MACV,WAAa,EAAA,UAAA;AAAA,MACb,IAAM,EAAA,SAAA;AAAA,MACN,aAAa,CAAe,YAAA,EAAA,SAAA,CAAA,6BAAA,CAAA;AAAA,MAC5B,gBAAkB,EAAA,KAAA;AAAA,KACpB;AAAA,IACA,UAAY,EAAA;AAAA,MACV,WAAa,EAAA,WAAA;AAAA,MACb,IAAM,EAAA,SAAA;AAAA,MACN,aAAa,CAA6B,0BAAA,EAAA,SAAA,CAAA,2BAAA,CAAA;AAAA,MAC1C,gBAAkB,EAAA,KAAA;AAAA,KACpB;AAAA,IACA,SAAW,EAAA;AAAA,MACT,IAAM,EAAA,SAAA;AAAA,MACN,aAAa,CAAe,YAAA,EAAA,SAAA,CAAA,gCAAA,CAAA;AAAA,MAC5B,gBAAkB,EAAA,KAAA;AAAA,MAClB,QAAU,EAAA,IAAA;AAAA,KACZ;AAAA,IACA,YAAc,EAAA;AAAA,MACZ,IAAM,EAAA,QAAA;AAAA,MACN,WAAa,EAAA,YAAA;AAAA,MACb,aAAa,CAAkB,eAAA,EAAA,SAAA,CAAA,8EAAA,CAAA;AAAA,MAC/B,QAAU,EAAA,IAAA;AAAA,KACZ;AAAA,IACA,UAAY,EAAA;AAAA,MACV,WAAa,EAAA,UAAA;AAAA,MACb,IAAM,EAAA,SAAA;AAAA,MACN,aAAa,CAAyC,sCAAA,EAAA,SAAA,CAAA,wBAAA,CAAA;AAAA,MACtD,gBAAkB,EAAA,KAAA;AAAA,KACpB;AAAA,IACA,QAAU,EAAA;AAAA,MACR,IAAM,EAAA,MAAA;AAAA,MACN,eAAiB,EAAA,IAAA;AAAA,KACnB;AAAA,GACF,CAAA;AAGA,EAAA,MAAM,gBAA6C,EAAC,CAAA;AACpD,EAAO,MAAA,CAAA,OAAA,CAAQ,CAAC,KAAU,KAAA;AACxB,IAAI,IAAA,gBAAA,CAAiB,cAAe,CAAA,KAAK,CAAG,EAAA;AAC1C,MAAc,aAAA,CAAA,KAAe,CAAI,GAAA,gBAAA,CAAiB,KAAe,CAAA,CAAA;AAAA,KACnE;AAAA,GACD,CAAA,CAAA;AAED,EAAO,OAAA,aAAA,CAAA;AACT;;;;"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
function getCommonInputProps(fieldName, fields) {
|
|
4
|
-
const commonInputProps = {
|
|
5
|
-
name: {
|
|
6
|
-
type: "string",
|
|
7
|
-
description: "Name for this field if it is part of a form"
|
|
8
|
-
},
|
|
9
|
-
isDisabled: {
|
|
10
|
-
displayName: "Disabled",
|
|
11
|
-
type: "boolean",
|
|
12
|
-
description: `Whether the ${fieldName} is read-only and unfocusable`,
|
|
13
|
-
defaultValueHint: false
|
|
14
|
-
},
|
|
15
|
-
isReadOnly: {
|
|
16
|
-
displayName: "Read only",
|
|
17
|
-
type: "boolean",
|
|
18
|
-
description: `Whether the value of this ${fieldName} can be changed by the user`,
|
|
19
|
-
defaultValueHint: false
|
|
20
|
-
},
|
|
21
|
-
autoFocus: {
|
|
22
|
-
type: "boolean",
|
|
23
|
-
description: `Whether the ${fieldName} should be focused when rendered`,
|
|
24
|
-
defaultValueHint: false,
|
|
25
|
-
advanced: true
|
|
26
|
-
},
|
|
27
|
-
"aria-label": {
|
|
28
|
-
type: "string",
|
|
29
|
-
displayName: "Aria Label",
|
|
30
|
-
description: `Label for this ${fieldName}, if no visible label is used, to identify the element to assistive technology`,
|
|
31
|
-
advanced: true
|
|
32
|
-
},
|
|
33
|
-
isRequired: {
|
|
34
|
-
displayName: "Required",
|
|
35
|
-
type: "boolean",
|
|
36
|
-
description: `Whether user input is required on the ${fieldName} before form submission.`,
|
|
37
|
-
defaultValueHint: false
|
|
38
|
-
},
|
|
39
|
-
children: {
|
|
40
|
-
type: "slot",
|
|
41
|
-
mergeWithParent: true
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
const filteredProps = {};
|
|
45
|
-
fields.forEach((field) => {
|
|
46
|
-
if (commonInputProps.hasOwnProperty(field)) {
|
|
47
|
-
filteredProps[field] = commonInputProps[field];
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
return filteredProps;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
exports.getCommonInputProps = getCommonInputProps;
|
|
54
|
-
//# sourceMappingURL=common-e74a9214.cjs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common-e74a9214.cjs.js","sources":["../src/common.ts"],"sourcesContent":["import { PropType } from \"@plasmicapp/host\";\n\nexport function getCommonInputProps<T>(\n fieldName: string,\n fields: (keyof T)[]\n): Record<string, PropType<T>> {\n const commonInputProps: Record<string, PropType<T>> = {\n name: {\n type: \"string\",\n description: \"Name for this field if it is part of a form\",\n },\n isDisabled: {\n displayName: \"Disabled\",\n type: \"boolean\",\n description: `Whether the ${fieldName} is read-only and unfocusable`,\n defaultValueHint: false,\n },\n isReadOnly: {\n displayName: \"Read only\",\n type: \"boolean\",\n description: `Whether the value of this ${fieldName} can be changed by the user`,\n defaultValueHint: false,\n },\n autoFocus: {\n type: \"boolean\",\n description: `Whether the ${fieldName} should be focused when rendered`,\n defaultValueHint: false,\n advanced: true,\n },\n \"aria-label\": {\n type: \"string\",\n displayName: \"Aria Label\",\n description: `Label for this ${fieldName}, if no visible label is used, to identify the element to assistive technology`,\n advanced: true,\n },\n isRequired: {\n displayName: \"Required\",\n type: \"boolean\",\n description: `Whether user input is required on the ${fieldName} before form submission.`,\n defaultValueHint: false,\n },\n children: {\n type: \"slot\",\n mergeWithParent: true as any,\n },\n };\n\n // Filter the properties based on the provided fields array\n const filteredProps: Record<string, PropType<T>> = {};\n fields.forEach((field) => {\n if (commonInputProps.hasOwnProperty(field)) {\n filteredProps[field as string] = commonInputProps[field as string];\n }\n });\n\n return filteredProps;\n}\n"],"names":[],"mappings":";;AAEgB,SAAA,mBAAA,CACd,WACA,MAC6B,EAAA;AAC7B,EAAA,MAAM,gBAAgD,GAAA;AAAA,IACpD,IAAM,EAAA;AAAA,MACJ,IAAM,EAAA,QAAA;AAAA,MACN,WAAa,EAAA,6CAAA;AAAA,KACf;AAAA,IACA,UAAY,EAAA;AAAA,MACV,WAAa,EAAA,UAAA;AAAA,MACb,IAAM,EAAA,SAAA;AAAA,MACN,aAAa,CAAe,YAAA,EAAA,SAAA,CAAA,6BAAA,CAAA;AAAA,MAC5B,gBAAkB,EAAA,KAAA;AAAA,KACpB;AAAA,IACA,UAAY,EAAA;AAAA,MACV,WAAa,EAAA,WAAA;AAAA,MACb,IAAM,EAAA,SAAA;AAAA,MACN,aAAa,CAA6B,0BAAA,EAAA,SAAA,CAAA,2BAAA,CAAA;AAAA,MAC1C,gBAAkB,EAAA,KAAA;AAAA,KACpB;AAAA,IACA,SAAW,EAAA;AAAA,MACT,IAAM,EAAA,SAAA;AAAA,MACN,aAAa,CAAe,YAAA,EAAA,SAAA,CAAA,gCAAA,CAAA;AAAA,MAC5B,gBAAkB,EAAA,KAAA;AAAA,MAClB,QAAU,EAAA,IAAA;AAAA,KACZ;AAAA,IACA,YAAc,EAAA;AAAA,MACZ,IAAM,EAAA,QAAA;AAAA,MACN,WAAa,EAAA,YAAA;AAAA,MACb,aAAa,CAAkB,eAAA,EAAA,SAAA,CAAA,8EAAA,CAAA;AAAA,MAC/B,QAAU,EAAA,IAAA;AAAA,KACZ;AAAA,IACA,UAAY,EAAA;AAAA,MACV,WAAa,EAAA,UAAA;AAAA,MACb,IAAM,EAAA,SAAA;AAAA,MACN,aAAa,CAAyC,sCAAA,EAAA,SAAA,CAAA,wBAAA,CAAA;AAAA,MACtD,gBAAkB,EAAA,KAAA;AAAA,KACpB;AAAA,IACA,QAAU,EAAA;AAAA,MACR,IAAM,EAAA,MAAA;AAAA,MACN,eAAiB,EAAA,IAAA;AAAA,KACnB;AAAA,GACF,CAAA;AAGA,EAAA,MAAM,gBAA6C,EAAC,CAAA;AACpD,EAAO,MAAA,CAAA,OAAA,CAAQ,CAAC,KAAU,KAAA;AACxB,IAAI,IAAA,gBAAA,CAAiB,cAAe,CAAA,KAAK,CAAG,EAAA;AAC1C,MAAc,aAAA,CAAA,KAAe,CAAI,GAAA,gBAAA,CAAiB,KAAe,CAAA,CAAA;AAAA,KACnE;AAAA,GACD,CAAA,CAAA;AAED,EAAO,OAAA,aAAA,CAAA;AACT;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contexts-21e0d928.esm.js","sources":["../src/contexts.tsx"],"sourcesContent":["import React from \"react\";\nimport type { StrictItemType } from \"./option-utils\";\nimport { BaseCheckboxGroup } from \"./registerCheckboxGroup\";\nimport { BaseDialogTrigger } from \"./registerDialogTrigger\";\nimport type { BaseHeader } from \"./registerHeader\";\nimport type { BaseInput } from \"./registerInput\";\nimport type { BaseLabel } from \"./registerLabel\";\nimport type { BaseListBoxProps } from \"./registerListBox\";\nimport type { BasePopover } from \"./registerPopover\";\nimport { BaseRadioGroup } from \"./registerRadioGroup\";\nimport type { BaseSection } from \"./registerSection\";\nimport { BaseSlider } from \"./registerSlider\";\nimport { BaseTextField } from \"./registerTextField\";\n\n// We pass down context props via our own Plasmic*Context instead of directly\n// using react-aria-component's *Context, because react-aria-component's\n// contexts don't \"merge\" with contexts further up the tree, so if we render\n// a context provider, it will just be overwritten by react-aria-component's\n// context provider. So we do the merging within our own Base* components\n// instead.\n\nexport const PlasmicTextFieldContext = React.createContext<\n React.ComponentProps<typeof BaseTextField> | undefined\n>(undefined);\n\nexport const PlasmicCheckboxGroupContext = React.createContext<\n React.ComponentProps<typeof BaseCheckboxGroup> | undefined\n>(undefined);\n\nexport const PlasmicRadioGroupContext = React.createContext<\n React.ComponentProps<typeof BaseRadioGroup> | undefined\n>(undefined);\n\nexport const PlasmicDialogTriggerContext = React.createContext<\n React.ComponentProps<typeof BaseDialogTrigger> | undefined\n>(undefined);\n\nexport const PlasmicSliderContext = React.createContext<\n React.ComponentProps<typeof BaseSlider> | undefined\n>(undefined);\n\nexport const PlasmicLabelContext = React.createContext<\n React.ComponentProps<typeof BaseLabel> | undefined\n>(undefined);\n\nexport const PlasmicListBoxContext = React.createContext<\n BaseListBoxProps | undefined\n>(undefined);\n\nexport const PlasmicPopoverContext = React.createContext<\n React.ComponentProps<typeof BasePopover> | undefined\n>(undefined);\n\nexport const PlasmicItemContext = React.createContext<\n StrictItemType | undefined\n>(undefined);\n\nexport const PlasmicSectionContext = React.createContext<\n React.ComponentProps<typeof BaseSection> | undefined\n>(undefined);\n\nexport const PlasmicHeaderContext = React.createContext<\n React.ComponentProps<typeof BaseHeader> | undefined\n>(undefined);\n\nexport const PlasmicInputContext = React.createContext<\n React.ComponentProps<typeof BaseInput> | undefined\n>(undefined);\n"],"names":[],"mappings":";;AAqBa,MAAA,uBAAA,GAA0B,KAAM,CAAA,aAAA,CAE3C,KAAS,CAAA,EAAA;AAEE,MAAA,2BAAA,GAA8B,KAAM,CAAA,aAAA,CAE/C,KAAS,CAAA,EAAA;AAEE,MAAA,wBAAA,GAA2B,KAAM,CAAA,aAAA,CAE5C,KAAS,CAAA,EAAA;AAEE,MAAA,2BAAA,GAA8B,KAAM,CAAA,aAAA,CAE/C,KAAS,CAAA,EAAA;AAEE,MAAA,oBAAA,GAAuB,KAAM,CAAA,aAAA,CAExC,KAAS,CAAA,EAAA;AAEwB,KAAM,CAAA,aAAA,CAEvC,KAAS,CAAA,EAAA;AAEE,MAAA,qBAAA,GAAwB,KAAM,CAAA,aAAA,CAEzC,KAAS,CAAA,EAAA;AAEE,MAAA,qBAAA,GAAwB,KAAM,CAAA,aAAA,CAEzC,KAAS,CAAA,EAAA;AAEE,MAAA,kBAAA,GAAqB,KAAM,CAAA,aAAA,CAEtC,KAAS,CAAA,EAAA;AAEE,MAAA,qBAAA,GAAwB,KAAM,CAAA,aAAA,CAEzC,KAAS,CAAA,EAAA;AAEE,MAAA,oBAAA,GAAuB,KAAM,CAAA,aAAA,CAExC,KAAS,CAAA,EAAA;AAEE,MAAA,mBAAA,GAAsB,KAAM,CAAA,aAAA,CAEvC,KAAS,CAAA;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contexts-7236059e.cjs.js","sources":["../src/contexts.tsx"],"sourcesContent":["import React from \"react\";\nimport type { StrictItemType } from \"./option-utils\";\nimport { BaseCheckboxGroup } from \"./registerCheckboxGroup\";\nimport { BaseDialogTrigger } from \"./registerDialogTrigger\";\nimport type { BaseHeader } from \"./registerHeader\";\nimport type { BaseInput } from \"./registerInput\";\nimport type { BaseLabel } from \"./registerLabel\";\nimport type { BaseListBoxProps } from \"./registerListBox\";\nimport type { BasePopover } from \"./registerPopover\";\nimport { BaseRadioGroup } from \"./registerRadioGroup\";\nimport type { BaseSection } from \"./registerSection\";\nimport { BaseSlider } from \"./registerSlider\";\nimport { BaseTextField } from \"./registerTextField\";\n\n// We pass down context props via our own Plasmic*Context instead of directly\n// using react-aria-component's *Context, because react-aria-component's\n// contexts don't \"merge\" with contexts further up the tree, so if we render\n// a context provider, it will just be overwritten by react-aria-component's\n// context provider. So we do the merging within our own Base* components\n// instead.\n\nexport const PlasmicTextFieldContext = React.createContext<\n React.ComponentProps<typeof BaseTextField> | undefined\n>(undefined);\n\nexport const PlasmicCheckboxGroupContext = React.createContext<\n React.ComponentProps<typeof BaseCheckboxGroup> | undefined\n>(undefined);\n\nexport const PlasmicRadioGroupContext = React.createContext<\n React.ComponentProps<typeof BaseRadioGroup> | undefined\n>(undefined);\n\nexport const PlasmicDialogTriggerContext = React.createContext<\n React.ComponentProps<typeof BaseDialogTrigger> | undefined\n>(undefined);\n\nexport const PlasmicSliderContext = React.createContext<\n React.ComponentProps<typeof BaseSlider> | undefined\n>(undefined);\n\nexport const PlasmicLabelContext = React.createContext<\n React.ComponentProps<typeof BaseLabel> | undefined\n>(undefined);\n\nexport const PlasmicListBoxContext = React.createContext<\n BaseListBoxProps | undefined\n>(undefined);\n\nexport const PlasmicPopoverContext = React.createContext<\n React.ComponentProps<typeof BasePopover> | undefined\n>(undefined);\n\nexport const PlasmicItemContext = React.createContext<\n StrictItemType | undefined\n>(undefined);\n\nexport const PlasmicSectionContext = React.createContext<\n React.ComponentProps<typeof BaseSection> | undefined\n>(undefined);\n\nexport const PlasmicHeaderContext = React.createContext<\n React.ComponentProps<typeof BaseHeader> | undefined\n>(undefined);\n\nexport const PlasmicInputContext = React.createContext<\n React.ComponentProps<typeof BaseInput> | undefined\n>(undefined);\n"],"names":["React"],"mappings":";;;;;;;;AAqBa,MAAA,uBAAA,GAA0BA,sBAAM,CAAA,aAAA,CAE3C,KAAS,CAAA,EAAA;AAEE,MAAA,2BAAA,GAA8BA,sBAAM,CAAA,aAAA,CAE/C,KAAS,CAAA,EAAA;AAEE,MAAA,wBAAA,GAA2BA,sBAAM,CAAA,aAAA,CAE5C,KAAS,CAAA,EAAA;AAEE,MAAA,2BAAA,GAA8BA,sBAAM,CAAA,aAAA,CAE/C,KAAS,CAAA,EAAA;AAEE,MAAA,oBAAA,GAAuBA,sBAAM,CAAA,aAAA,CAExC,KAAS,CAAA,EAAA;AAEwBA,sBAAM,CAAA,aAAA,CAEvC,KAAS,CAAA,EAAA;AAEE,MAAA,qBAAA,GAAwBA,sBAAM,CAAA,aAAA,CAEzC,KAAS,CAAA,EAAA;AAEE,MAAA,qBAAA,GAAwBA,sBAAM,CAAA,aAAA,CAEzC,KAAS,CAAA,EAAA;AAEE,MAAA,kBAAA,GAAqBA,sBAAM,CAAA,aAAA,CAEtC,KAAS,CAAA,EAAA;AAEE,MAAA,qBAAA,GAAwBA,sBAAM,CAAA,aAAA,CAEzC,KAAS,CAAA,EAAA;AAEE,MAAA,oBAAA,GAAuBA,sBAAM,CAAA,aAAA,CAExC,KAAS,CAAA,EAAA;AAEE,MAAA,mBAAA,GAAsBA,sBAAM,CAAA,aAAA,CAEvC,KAAS,CAAA;;;;;;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"registerListBox-38a08460.esm.js","sources":["../src/option-utils.ts","../src/registerListBox.tsx"],"sourcesContent":["import type { ArrayType, ChoiceType } from \"@plasmicapp/host/registerComponent\";\nimport React from \"react\";\n\nexport interface ObjectSectionType<T extends object> {\n label?: string;\n items?: ObjectItemType<T>[];\n}\ninterface FlexSectionType<T extends object> {\n label?: string;\n items?: FlexItemType<T>[];\n}\n\nexport type ObjectItemType<T extends object> = StrictOptionType | T;\ntype FlexItemType<T extends object> = ObjectItemType<T> | string;\n\nexport type FlexOptionType<T extends object> =\n | FlexItemType<T>\n | FlexSectionType<T>;\n\nexport type ObjectOptionType<T extends object> =\n | ObjectSectionType<T>\n | ObjectItemType<T>;\n\nexport interface HasOptions<T extends object> {\n options?: FlexOptionType<T>[];\n optionInfo?: (option: FlexOptionType<T>) => StrictOptionType;\n}\n\nexport interface StrictItemType {\n type?: \"option\";\n id: string;\n label?: string;\n isDisabled?: boolean;\n}\n\nexport interface StrictSectionType {\n type: \"option-group\";\n label?: string;\n items?: StrictItemType[];\n key: string;\n}\n\nexport type StrictOptionType = StrictItemType | StrictSectionType;\n\nexport function useStrictOptions<T extends object>(props: HasOptions<T>) {\n const { options, optionInfo } = props;\n return React.useMemo(() => {\n return deriveStrictOptions({ options, optionInfo });\n }, [options, optionInfo]);\n}\n\nexport function deriveStrictOptions<T extends object>(props: HasOptions<T>) {\n const { options, optionInfo } = props;\n let sectionCount = 0;\n\n const makeStrict = (op: FlexOptionType<T>): StrictOptionType | undefined => {\n if (!op) {\n return undefined;\n } else if (typeof op === \"string\" || typeof op === \"number\") {\n const item = {\n id: op,\n };\n return item;\n } else if (optionInfo) {\n const info = optionInfo(op);\n if (info.type === \"option-group\") {\n const section: StrictSectionType = {\n type: \"option-group\",\n items: info.items\n ?.map?.((item) => makeStrict(item) as StrictItemType)\n ?.filter((x) => !!x),\n label: info.label,\n key: `option-group-${sectionCount}`,\n };\n sectionCount += 1;\n return section;\n } else {\n let item = info;\n if (!(\"id\" in item)) {\n item = {\n type: \"option\",\n id: JSON.stringify(item),\n };\n }\n return item;\n }\n } else if (typeof op === \"object\") {\n if (\"items\" in op) {\n const section: StrictSectionType = {\n type: \"option-group\",\n items: op.items\n ?.map?.((item) => makeStrict(item) as StrictItemType)\n ?.filter((x) => !!x),\n label: op.label,\n key: `option-group-${sectionCount}`,\n };\n sectionCount += 1;\n return section;\n } else {\n let item = op;\n if (!(\"id\" in item)) {\n item = {\n type: \"option\",\n id: JSON.stringify(item),\n };\n }\n return item;\n }\n } else {\n return undefined;\n }\n };\n\n const strictOptions = options\n ?.map(makeStrict)\n ?.filter((x): x is StrictOptionType => !!x);\n\n const optionText = (op: StrictItemType) => {\n return op.label ?? op.id;\n };\n\n return { options: strictOptions, optionText };\n}\n\nexport function flattenOptions(\n options: (StrictItemType | StrictSectionType)[] | undefined\n): StrictItemType[] {\n if (!options) {\n return [];\n } else {\n return options.flatMap((op) =>\n op.type === \"option-group\" ? op.items ?? [] : op\n );\n }\n}\n\nexport function makeOptionsPropType() {\n const type: ArrayType<HasOptions<any>> = {\n type: \"array\",\n itemType: {\n type: \"object\",\n nameFunc: (item: any) => item.label || item.id,\n fields: {\n type: {\n type: \"choice\",\n options: [\n { value: \"option\", label: \"Option\" },\n { value: \"option-group\", label: \"Option Group\" },\n ],\n defaultValue: \"option\",\n },\n id: {\n type: \"string\",\n hidden: (_ps: any, _ctx: any, { item }: any) =>\n item.type !== \"option\",\n },\n label: \"string\",\n items: {\n type: \"array\",\n displayName: \"Options\",\n hidden: (_ps: any, _ctx: any, { item }: any) => {\n return item.type !== \"option-group\";\n },\n itemType: {\n type: \"object\",\n nameFunc: (item: any) => item.label || item.id,\n fields: {\n id: \"string\",\n label: \"string\",\n },\n },\n },\n },\n },\n defaultValue: [\n {\n id: \"option1\",\n label: \"Option 1\",\n type: \"option\",\n },\n {\n id: \"option2\",\n label: \"Option 2\",\n type: \"option\",\n },\n {\n label: \"Section 1\",\n type: \"option-group\",\n items: [\n {\n id: \"section-1-1\",\n label: \"Section item 1\",\n type: \"option\",\n },\n {\n id: \"section-1-2\",\n label: \"Section item 2\",\n type: \"option\",\n },\n ],\n },\n ],\n };\n return type;\n}\n\nexport function makeValuePropType() {\n const type: ChoiceType<HasOptions<any>> = {\n type: \"choice\",\n options: (ps: HasOptions<any>) => {\n const { options, optionText } = deriveStrictOptions(ps);\n return flattenOptions(options).map((op) => ({\n value: op.id,\n label: optionText(op),\n }));\n },\n };\n return type;\n}\n","import { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { ListBox } from \"react-aria-components\";\nimport {\n PlasmicItemContext,\n PlasmicListBoxContext,\n PlasmicSectionContext,\n} from \"./contexts\";\nimport {\n HasOptions,\n makeOptionsPropType,\n StrictOptionType,\n useStrictOptions,\n} from \"./option-utils\";\nimport {\n makeDefaultListBoxItemChildren,\n registerListBoxItem,\n} from \"./registerListBoxItem\";\nimport { registerSection } from \"./registerSection\";\nimport {\n BaseControlContextData,\n CodeComponentMetaOverrides,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\nexport interface BaseListBoxProps\n extends React.ComponentProps<typeof ListBox>,\n HasOptions<any> {\n renderItem?: (item: any) => React.ReactNode;\n renderSection?: (section: any) => React.ReactNode;\n getItemType?: (thing: any) => \"item\" | \"section\";\n setControlContextData?: (ctxData: BaseControlContextData) => void;\n}\n\nexport function BaseListBox(props: BaseListBoxProps) {\n const contextProps = React.useContext(PlasmicListBoxContext);\n const isStandalone: boolean = !contextProps;\n const { options: _rawOptions, ...rest } = props;\n const { options } = useStrictOptions(props);\n const { renderItem, renderSection, ...mergedProps } = mergeProps(\n contextProps,\n rest,\n isStandalone ? { items: options } : {}\n );\n\n // Tell the prop control about whether the listbox is standalone or not, so it can hide/show the items prop\n props.setControlContextData?.({\n isStandalone,\n });\n\n return (\n <ListBox {...mergedProps}>\n {(item: StrictOptionType) => {\n if (item.type === \"option-group\") {\n return (\n <>\n <PlasmicSectionContext.Provider\n value={{\n renderItem,\n key: item.key ?? item.label,\n section: item,\n }}\n >\n {renderSection?.(item)}\n </PlasmicSectionContext.Provider>\n </>\n );\n } else {\n return (\n <PlasmicItemContext.Provider value={item}>\n {renderItem?.(item)}\n </PlasmicItemContext.Provider>\n );\n }\n }}\n </ListBox>\n );\n}\n\nexport const LIST_BOX_COMPONENT_NAME = makeComponentName(\"listbox\");\n\nexport function registerListBox(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseListBox>\n) {\n const listBoxItemMeta = registerListBoxItem(loader, {\n parentComponentName: LIST_BOX_COMPONENT_NAME,\n });\n const sectionMeta = registerSection(loader, {\n parentComponentName: LIST_BOX_COMPONENT_NAME,\n });\n\n registerComponentHelper(\n loader,\n BaseListBox,\n {\n name: LIST_BOX_COMPONENT_NAME,\n displayName: \"Aria ListBox\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerListBox\",\n importName: \"BaseListBox\",\n defaultStyles: {\n width: \"250px\",\n borderWidth: \"1px\",\n borderStyle: \"solid\",\n borderColor: \"black\",\n },\n props: {\n options: {\n ...makeOptionsPropType(),\n displayName: \"Items\",\n hidden: (_ps: BaseListBoxProps, ctx: BaseControlContextData | null) =>\n !ctx?.isStandalone,\n },\n renderItem: {\n type: \"slot\",\n displayName: \"Render Item\",\n renderPropParams: [\"itemProps\"],\n defaultValue: {\n type: \"component\",\n name: listBoxItemMeta.name,\n props: {\n children: makeDefaultListBoxItemChildren(\n \"Item (itemProps.label)\",\n \"Connect with `itemProps` in the data picker to display list box items\"\n ),\n },\n },\n },\n renderSection: {\n type: \"slot\",\n displayName: \"Render Section\",\n renderPropParams: [\"sectionProps\"],\n defaultValue: {\n type: \"component\",\n name: sectionMeta.name,\n styles: {\n backgroundColor: \"#F4FAFF\",\n },\n },\n },\n },\n },\n overrides\n );\n}\n"],"names":["_a"],"mappings":";;;;;;;;AA4CO,SAAS,iBAAmC,KAAsB,EAAA;AACvE,EAAM,MAAA,EAAE,OAAS,EAAA,UAAA,EAAe,GAAA,KAAA,CAAA;AAChC,EAAO,OAAA,KAAA,CAAM,QAAQ,MAAM;AACzB,IAAA,OAAO,mBAAoB,CAAA,EAAE,OAAS,EAAA,UAAA,EAAY,CAAA,CAAA;AAAA,GACjD,EAAA,CAAC,OAAS,EAAA,UAAU,CAAC,CAAA,CAAA;AAC1B,CAAA;AAEO,SAAS,oBAAsC,KAAsB,EAAA;AAnD5E,EAAA,IAAA,EAAA,CAAA;AAoDE,EAAM,MAAA,EAAE,OAAS,EAAA,UAAA,EAAe,GAAA,KAAA,CAAA;AAChC,EAAA,IAAI,YAAe,GAAA,CAAA,CAAA;AAEnB,EAAM,MAAA,UAAA,GAAa,CAAC,EAAwD,KAAA;AAvD9E,IAAA,IAAAA,GAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,CAAA;AAwDI,IAAA,IAAI,CAAC,EAAI,EAAA;AACP,MAAO,OAAA,KAAA,CAAA,CAAA;AAAA,eACE,OAAO,EAAA,KAAO,QAAY,IAAA,OAAO,OAAO,QAAU,EAAA;AAC3D,MAAA,MAAM,IAAO,GAAA;AAAA,QACX,EAAI,EAAA,EAAA;AAAA,OACN,CAAA;AACA,MAAO,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AAA,QACL,OAAA,EAAS,aACJ,CAAA,cAAA,CAAA,EAAA,EAAA,mBAAA,EADI,CAAA,EAAA;AAAA,UAEP,WAAa,EAAA,OAAA;AAAA,UACb,MAAQ,EAAA,CAAC,GAAuB,EAAA,GAAA,KAC9B,EAAC,GAAK,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,GAAA,CAAA,YAAA,CAAA;AAAA,SACV,CAAA;AAAA,QACA,UAAY,EAAA;AAAA,UACV,IAAM,EAAA,MAAA;AAAA,UACN,WAAa,EAAA,aAAA;AAAA,UACb,gBAAA,EAAkB,CAAC,WAAW,CAAA;AAAA,UAC9B,YAAc,EAAA;AAAA,YACZ,IAAM,EAAA,WAAA;AAAA,YACN,MAAM,eAAgB,CAAA,IAAA;AAAA,YACtB,KAAO,EAAA;AAAA,cACL,QAAU,EAAA,8BAAA;AAAA,gBACR,wBAAA;AAAA,gBACA,uEAAA;AAAA,eACF;AAAA,aACF;AAAA,WACF;AAAA,SACF;AAAA,QACA,aAAe,EAAA;AAAA,UACb,IAAM,EAAA,MAAA;AAAA,UACN,WAAa,EAAA,gBAAA;AAAA,UACb,gBAAA,EAAkB,CAAC,cAAc,CAAA;AAAA,UACjC,YAAc,EAAA;AAAA,YACZ,IAAM,EAAA,WAAA;AAAA,YACN,MAAM,WAAY,CAAA,IAAA;AAAA,YAClB,MAAQ,EAAA;AAAA,cACN,eAAiB,EAAA,SAAA;AAAA,aACnB;AAAA,WACF;AAAA,SACF;AAAA,OACF;AAAA,KACF;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"registerListBox-f060da58.cjs.js","sources":["../src/option-utils.ts","../src/registerListBox.tsx"],"sourcesContent":["import type { ArrayType, ChoiceType } from \"@plasmicapp/host/registerComponent\";\nimport React from \"react\";\n\nexport interface ObjectSectionType<T extends object> {\n label?: string;\n items?: ObjectItemType<T>[];\n}\ninterface FlexSectionType<T extends object> {\n label?: string;\n items?: FlexItemType<T>[];\n}\n\nexport type ObjectItemType<T extends object> = StrictOptionType | T;\ntype FlexItemType<T extends object> = ObjectItemType<T> | string;\n\nexport type FlexOptionType<T extends object> =\n | FlexItemType<T>\n | FlexSectionType<T>;\n\nexport type ObjectOptionType<T extends object> =\n | ObjectSectionType<T>\n | ObjectItemType<T>;\n\nexport interface HasOptions<T extends object> {\n options?: FlexOptionType<T>[];\n optionInfo?: (option: FlexOptionType<T>) => StrictOptionType;\n}\n\nexport interface StrictItemType {\n type?: \"option\";\n id: string;\n label?: string;\n isDisabled?: boolean;\n}\n\nexport interface StrictSectionType {\n type: \"option-group\";\n label?: string;\n items?: StrictItemType[];\n key: string;\n}\n\nexport type StrictOptionType = StrictItemType | StrictSectionType;\n\nexport function useStrictOptions<T extends object>(props: HasOptions<T>) {\n const { options, optionInfo } = props;\n return React.useMemo(() => {\n return deriveStrictOptions({ options, optionInfo });\n }, [options, optionInfo]);\n}\n\nexport function deriveStrictOptions<T extends object>(props: HasOptions<T>) {\n const { options, optionInfo } = props;\n let sectionCount = 0;\n\n const makeStrict = (op: FlexOptionType<T>): StrictOptionType | undefined => {\n if (!op) {\n return undefined;\n } else if (typeof op === \"string\" || typeof op === \"number\") {\n const item = {\n id: op,\n };\n return item;\n } else if (optionInfo) {\n const info = optionInfo(op);\n if (info.type === \"option-group\") {\n const section: StrictSectionType = {\n type: \"option-group\",\n items: info.items\n ?.map?.((item) => makeStrict(item) as StrictItemType)\n ?.filter((x) => !!x),\n label: info.label,\n key: `option-group-${sectionCount}`,\n };\n sectionCount += 1;\n return section;\n } else {\n let item = info;\n if (!(\"id\" in item)) {\n item = {\n type: \"option\",\n id: JSON.stringify(item),\n };\n }\n return item;\n }\n } else if (typeof op === \"object\") {\n if (\"items\" in op) {\n const section: StrictSectionType = {\n type: \"option-group\",\n items: op.items\n ?.map?.((item) => makeStrict(item) as StrictItemType)\n ?.filter((x) => !!x),\n label: op.label,\n key: `option-group-${sectionCount}`,\n };\n sectionCount += 1;\n return section;\n } else {\n let item = op;\n if (!(\"id\" in item)) {\n item = {\n type: \"option\",\n id: JSON.stringify(item),\n };\n }\n return item;\n }\n } else {\n return undefined;\n }\n };\n\n const strictOptions = options\n ?.map(makeStrict)\n ?.filter((x): x is StrictOptionType => !!x);\n\n const optionText = (op: StrictItemType) => {\n return op.label ?? op.id;\n };\n\n return { options: strictOptions, optionText };\n}\n\nexport function flattenOptions(\n options: (StrictItemType | StrictSectionType)[] | undefined\n): StrictItemType[] {\n if (!options) {\n return [];\n } else {\n return options.flatMap((op) =>\n op.type === \"option-group\" ? op.items ?? [] : op\n );\n }\n}\n\nexport function makeOptionsPropType() {\n const type: ArrayType<HasOptions<any>> = {\n type: \"array\",\n itemType: {\n type: \"object\",\n nameFunc: (item: any) => item.label || item.id,\n fields: {\n type: {\n type: \"choice\",\n options: [\n { value: \"option\", label: \"Option\" },\n { value: \"option-group\", label: \"Option Group\" },\n ],\n defaultValue: \"option\",\n },\n id: {\n type: \"string\",\n hidden: (_ps: any, _ctx: any, { item }: any) =>\n item.type !== \"option\",\n },\n label: \"string\",\n items: {\n type: \"array\",\n displayName: \"Options\",\n hidden: (_ps: any, _ctx: any, { item }: any) => {\n return item.type !== \"option-group\";\n },\n itemType: {\n type: \"object\",\n nameFunc: (item: any) => item.label || item.id,\n fields: {\n id: \"string\",\n label: \"string\",\n },\n },\n },\n },\n },\n defaultValue: [\n {\n id: \"option1\",\n label: \"Option 1\",\n type: \"option\",\n },\n {\n id: \"option2\",\n label: \"Option 2\",\n type: \"option\",\n },\n {\n label: \"Section 1\",\n type: \"option-group\",\n items: [\n {\n id: \"section-1-1\",\n label: \"Section item 1\",\n type: \"option\",\n },\n {\n id: \"section-1-2\",\n label: \"Section item 2\",\n type: \"option\",\n },\n ],\n },\n ],\n };\n return type;\n}\n\nexport function makeValuePropType() {\n const type: ChoiceType<HasOptions<any>> = {\n type: \"choice\",\n options: (ps: HasOptions<any>) => {\n const { options, optionText } = deriveStrictOptions(ps);\n return flattenOptions(options).map((op) => ({\n value: op.id,\n label: optionText(op),\n }));\n },\n };\n return type;\n}\n","import { mergeProps } from \"@react-aria/utils\";\nimport React from \"react\";\nimport { ListBox } from \"react-aria-components\";\nimport {\n PlasmicItemContext,\n PlasmicListBoxContext,\n PlasmicSectionContext,\n} from \"./contexts\";\nimport {\n HasOptions,\n makeOptionsPropType,\n StrictOptionType,\n useStrictOptions,\n} from \"./option-utils\";\nimport {\n makeDefaultListBoxItemChildren,\n registerListBoxItem,\n} from \"./registerListBoxItem\";\nimport { registerSection } from \"./registerSection\";\nimport {\n BaseControlContextData,\n CodeComponentMetaOverrides,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\n\nexport interface BaseListBoxProps\n extends React.ComponentProps<typeof ListBox>,\n HasOptions<any> {\n renderItem?: (item: any) => React.ReactNode;\n renderSection?: (section: any) => React.ReactNode;\n getItemType?: (thing: any) => \"item\" | \"section\";\n setControlContextData?: (ctxData: BaseControlContextData) => void;\n}\n\nexport function BaseListBox(props: BaseListBoxProps) {\n const contextProps = React.useContext(PlasmicListBoxContext);\n const isStandalone: boolean = !contextProps;\n const { options: _rawOptions, ...rest } = props;\n const { options } = useStrictOptions(props);\n const { renderItem, renderSection, ...mergedProps } = mergeProps(\n contextProps,\n rest,\n isStandalone ? { items: options } : {}\n );\n\n // Tell the prop control about whether the listbox is standalone or not, so it can hide/show the items prop\n props.setControlContextData?.({\n isStandalone,\n });\n\n return (\n <ListBox {...mergedProps}>\n {(item: StrictOptionType) => {\n if (item.type === \"option-group\") {\n return (\n <>\n <PlasmicSectionContext.Provider\n value={{\n renderItem,\n key: item.key ?? item.label,\n section: item,\n }}\n >\n {renderSection?.(item)}\n </PlasmicSectionContext.Provider>\n </>\n );\n } else {\n return (\n <PlasmicItemContext.Provider value={item}>\n {renderItem?.(item)}\n </PlasmicItemContext.Provider>\n );\n }\n }}\n </ListBox>\n );\n}\n\nexport const LIST_BOX_COMPONENT_NAME = makeComponentName(\"listbox\");\n\nexport function registerListBox(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseListBox>\n) {\n const listBoxItemMeta = registerListBoxItem(loader, {\n parentComponentName: LIST_BOX_COMPONENT_NAME,\n });\n const sectionMeta = registerSection(loader, {\n parentComponentName: LIST_BOX_COMPONENT_NAME,\n });\n\n registerComponentHelper(\n loader,\n BaseListBox,\n {\n name: LIST_BOX_COMPONENT_NAME,\n displayName: \"Aria ListBox\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerListBox\",\n importName: \"BaseListBox\",\n defaultStyles: {\n width: \"250px\",\n borderWidth: \"1px\",\n borderStyle: \"solid\",\n borderColor: \"black\",\n },\n props: {\n options: {\n ...makeOptionsPropType(),\n displayName: \"Items\",\n hidden: (_ps: BaseListBoxProps, ctx: BaseControlContextData | null) =>\n !ctx?.isStandalone,\n },\n renderItem: {\n type: \"slot\",\n displayName: \"Render Item\",\n renderPropParams: [\"itemProps\"],\n defaultValue: {\n type: \"component\",\n name: listBoxItemMeta.name,\n props: {\n children: makeDefaultListBoxItemChildren(\n \"Item (itemProps.label)\",\n \"Connect with `itemProps` in the data picker to display list box items\"\n ),\n },\n },\n },\n renderSection: {\n type: \"slot\",\n displayName: \"Render Section\",\n renderPropParams: [\"sectionProps\"],\n defaultValue: {\n type: \"component\",\n name: sectionMeta.name,\n styles: {\n backgroundColor: \"#F4FAFF\",\n },\n },\n },\n },\n },\n overrides\n );\n}\n"],"names":["React","_a","PlasmicListBoxContext","mergeProps","ListBox","PlasmicSectionContext","PlasmicItemContext","makeComponentName","registerListBoxItem","registerSection","registerComponentHelper","makeDefaultListBoxItemChildren"],"mappings":";;;;;;;;;;;;;;AA4CO,SAAS,iBAAmC,KAAsB,EAAA;AACvE,EAAM,MAAA,EAAE,OAAS,EAAA,UAAA,EAAe,GAAA,KAAA,CAAA;AAChC,EAAO,OAAAA,sBAAA,CAAM,QAAQ,MAAM;AACzB,IAAA,OAAO,mBAAoB,CAAA,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