
        <script setup>
        import { computed } from "vue"
        import { Example, PropsTable, PageTitle } from "@viteplay/vue"
        import { useRoute, useRouter } from "vue-router"
            
        let componentProps = {"CToggle":[{"name":"disabled","type":"boolean","required":false,"desc":"ボタンのdisable判定\n@example disabled: false"},{"name":"modelValue","type":"boolean | array","required":false,"desc":"v-modelの値\n@example true"},{"name":"value","type":"string | number","required":false,"desc":"value(配列の場合使用)\n@example true"},{"name":"p_Title","type":"string","required":false,"desc":"*toggleタイトルに表示するテキスト\n@example p_Title: 'text'"}]}
        let route = useRoute()
        let router = useRouter()
        let focusId = computed(() => route.query.focus && route.hash.slice(1))
        let shouldRender = (slug) => {
          return !route.query.focus || slug === focusId.value
        }
        let hiddenCount = computed(() => {
          return ["basic","disabled"].filter((slug) => !shouldRender(slug)).length
        })

        let showAll = () => {
          router.push({ query: {}, hash: route.hash })
        }

        let openInEditor = (file) => {
           fetch('/__open-in-editor?file=' + encodeURIComponent(file))
        }
        let examples = [
          {
                title: "Basic",
                slug: "basic",
                docs: {"content":"","attrs":{}},
                // encodeURI because the example will contain html tags
                // which will cause this component to be incorrectly parsed
                code: decodeURI("%3Cscript%20setup%3E%0Aimport%20%7B%20ref%20%7D%20from%20'vue'%0Aimport%20CToggle%20from%20'../CToggle.vue'%0Aconst%20toggleValue%20=%20ref(true)%0Aconst%20toggleArrayValue%20=%20ref(%5B%5D)%0A%3C/script%3E%0A%0A%3Ctemplate%3E%0A%20%20%3Cdiv%20style=%22margin:%2020px%200%22%3E%0A%20%20%20%20%3Cdiv%20style=%22font-weight:%20bold%22%3E%7B%7B%20'Array'%20%7D%7D%3C/div%3E%0A%20%20%20%20%3CCToggle%20v-model=%22toggleArrayValue%22%20value=%22%E7%B7%A8%E9%9B%861%22%20p_Title=%22%E7%B7%A8%E9%9B%861%22%20/%3E%0A%20%20%20%20%3CCToggle%20v-model=%22toggleArrayValue%22%20value=%22%E7%B7%A8%E9%9B%862%22%20p_Title=%22%E7%B7%A8%E9%9B%862%22%20/%3E%0A%20%20%20%20%3CCToggle%20v-model=%22toggleArrayValue%22%20value=%22%E7%B7%A8%E9%9B%863%22%20p_Title=%22%E7%B7%A8%E9%9B%863%22%20/%3E%0A%0A%20%20%20%20model:%7B%7B%20toggleArrayValue%20%7D%7D%0A%20%20%3C/div%3E%0A%0A%20%20%3Cdiv%20style=%22margin:%2020px%200%22%3E%0A%20%20%20%20%3Cdiv%20style=%22font-weight:%20bold%22%3E%7B%7B%20'boolean'%20%7D%7D%3C/div%3E%0A%20%20%20%20%3CCToggle%20v-model=%22toggleValue%22%20:disabled=%22false%22%20p_Title=%22%E7%B7%A8%E9%9B%863%22%20/%3E%0A%20%20%20%20model:%7B%7B%20toggleValue%20%7D%7D%0A%20%20%3C/div%3E%0A%3C/template%3E%0A%3Cstyle%3E%0A:root%20%7B%0A%20%20--q-primary:%20#5e421d;%0A%7D%0A%3C/style%3E"),
                iframeUrl: "/__iframe/CToggle-basic.html",
                openInEditor: import.meta.env.DEV 
                  ? () => openInEditor("/Users/nakashimakeiju/ghq/github.com/CodeLic/console/src/components/CToggle/examples/Basic.vue") 
                  : undefined 
              },{
                title: "Disabled",
                slug: "disabled",
                docs: {"content":"","attrs":{}},
                // encodeURI because the example will contain html tags
                // which will cause this component to be incorrectly parsed
                code: decodeURI("%3Cscript%20setup%3E%0Aimport%20%7B%20ref%20%7D%20from%20'vue'%0Aimport%20CToggle%20from%20'../CToggle.vue'%0Aconst%20toggleValue%20=%20ref(true)%0Aconst%20toggleArrayValue%20=%20ref(%5B%5D)%0A%3C/script%3E%0A%0A%3Ctemplate%3E%0A%20%20%3Cdiv%20style=%22margin:%2020px%200%22%3E%0A%20%20%20%20%3Cdiv%20style=%22font-weight:%20bold%22%3E%7B%7B%20'Array'%20%7D%7D%3C/div%3E%0A%20%20%20%20%3CCToggle%20v-model=%22toggleArrayValue%22%20:disabled=%22true%22%20value=%22%E7%B7%A8%E9%9B%861%22%20p_Title=%22%E7%B7%A8%E9%9B%861%22%20/%3E%0A%20%20%20%20%3CCToggle%20v-model=%22toggleArrayValue%22%20:disabled=%22true%22%20value=%22%E7%B7%A8%E9%9B%862%22%20p_Title=%22%E7%B7%A8%E9%9B%862%22%20/%3E%0A%20%20%20%20%3CCToggle%20v-model=%22toggleArrayValue%22%20:disabled=%22true%22%20value=%22%E7%B7%A8%E9%9B%863%22%20p_Title=%22%E7%B7%A8%E9%9B%863%22%20/%3E%0A%0A%20%20%20%20model:%7B%7B%20toggleArrayValue%20%7D%7D%0A%20%20%3C/div%3E%0A%3C/template%3E%0A%3Cstyle%3E%0A:root%20%7B%0A%20%20--q-primary:%20#5e421d;%0A%7D%0A%3C/style%3E"),
                iframeUrl: "/__iframe/CToggle-disabled.html",
                openInEditor: import.meta.env.DEV 
                  ? () => openInEditor("/Users/nakashimakeiju/ghq/github.com/CodeLic/console/src/components/CToggle/examples/Disabled.vue") 
                  : undefined 
              }
        ]
        </script>
        <template>
          <PageTitle title="CToggle" :openInEditor="() => openInEditor('/Users/nakashimakeiju/ghq/github.com/CodeLic/console/src/components/CToggle/CToggle.vue')" />
          <div v-if="hiddenCount > 0" class="hidden-examples-info">
            {{ hiddenCount }} example{{ hiddenCount > 1 ? "s" : null }} hidden, <a class="viteplay-link" type="button" @click.prevent="showAll">show all</a>
          </div>
          <PropsTable componentName="CToggle" :componentProps="componentProps" />
          <template  
            v-for="example in examples" 
            :key="example.slug">
            <Example 
              v-if="shouldRender(example.slug)"
              :example="example" 
              :componentProps="componentProps" />
          </template>
        </template>

<style scoped>
.hidden-examples-info {
  margin: 20px 0;
}
</style>
      