Problem/Motivation

This issue is for Akhil Babu to test the SDC conversion script and the guide using:

  • demo_design_system/components/01-atoms/select

Steps to reproduce

Proposed resolution

Go through the conversion guide and try to convert the component using the script and report any feedback.

Remaining tasks

  • Review guide
  • Follow guide to use the script
  • Convert demo_design_system/components/01-atoms/select
  • Report feedback here

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#10 select-component-options.png92.13 KBakhil babu
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Kristen Pol created an issue. See original summary.

akhil babu’s picture

Assigned: Unassigned » akhil babu
akhil babu’s picture

Here is the output after running the script

name: Select

status: experimental

group: Atoms

props:

  type: object
  required:
    - options

  properties:
    theme:
      type: string
      title: Theme
      description: 'Theme: light, dark.'
      default: light
      enum:
        - light
        - dark

    is_multiple:
      type: boolean
      title: Is multiple.

    options:
      type: array
      title: Options
      description: 'Options:'
      items:
        type: object

        properties:
          type:
            type: string
            title: Type
            description: 'Option type: option group (optgroup) or option (option).'

          label:
            type: string
            title: Label
            description: Option label.

          value:
            type: string
            title: Value
            description: Option value.

          selected:
            type: string
            title: Selected
            description: Flag whether option is selected.

          options:
            type: array
            title: Options
            description: 'Array of options (applies to optgroup type):'

    is_invalid:
      type: boolean
      title: Denote if the control is invalid.

    is_disabled:
      type: boolean
      title: Denote if the control is disabled.

    is_required:
      type: boolean
      title: Denote if the control is required.

    attributes:
      type: string
      title: Attributes
      description: Additional attributes.

    modifier_class:
      type: string
      title: Modifier class
      description: Additional classes.

akhil babu’s picture

 *   - options: [array] Array of options (applies to optgroup type):
 *     - label: [string] Option label.
 *     - value: [string] Option value.
 *     - is_selected: [string] Flag whether option is selected.
 *     - is_disabled: [string] Flag whether option is disabled.

The script didnot convert the properties inside the nested options field (Options -> Options). Current output is

options:
  type: array
  title: Options
  description: 'Array of options (applies to optgroup type):'

I think it should have been like

options:
  type: array
  title: Options
  description: 'Array of options (applies to optgroup type):'
  items:
    label:
      type: string
      title: Label
      description: Option label.

    value:
      type: string
      title: Value
      description: Option value.

    is_selected:
      type: string
      title: Selected
      description: Flag whether option is selected.

    is_disabled:
      type: string
      title: Selected
      description: Flag whether option is disabled.
akhil babu’s picture

Also, properties like selected, options.options.is_selected, options.options.is_disabled are documented as string fields in the twig file. But shouldn't these be boolean fields? (The logic in the twig confirms the same)

{% if sub_option.is_selected %}selected="selected"{% endif %} 
{% if sub_option.is_disabled %}disabled{% endif %}

Just noticed that, infact, there is no selected property. It should always be is_selected. So, the twig doc should also be corrected

akhil babu’s picture

Assigned: akhil babu » Unassigned
Status: Active » Needs review
kristen pol’s picture

Thanks 🙏 can you compare your work against the recent dev changes? There was just a commit of all baseline yaml and readme files. It would be helpful to compare your results against that to see if they align or the files should be updated with some of your suggestions

anand.toshniwal93’s picture

I will check script today for above mentioned issue by Akhil.

kristen pol’s picture

Thanks!

akhil babu’s picture

StatusFileSize
new92.13 KB

Hi @kristen pol, I checked this commit. The 'options [array]' property does not have any 'items' there as well.
/files/issues/2024-08-20/select-component-options.png

kristen pol’s picture

Status: Needs review » Postponed

Marking postponed until we have the updated script.

kristen pol’s picture

Looks like the script isn't quite right but we are leaving this postponed because we need to understand more about arrays and nesting in the yaml files before moving forward.

kristen pol’s picture

Status: Postponed » Fixed

I don't think we'll update the script in the future at this point (TBD) and we need to wait on XB to support arrays:

#3470024: Arrays in SDDS SDC YAMLs are causing fatal errors in XB

so closing this as fixed for the testing. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.