## class: `WyFileCreate`, `wy-file-create`

Button menu for creating or uploading files.

**Used sub components:**

*   [`<wy-button>`](./ui/wy-button)
*   [`<wy-dropdown>`](./ui/wy-dropdown)
*   [`<wy-icon>`](./ui/wy-icon)
*   [`<wy-progress-circular>`](./ui/wy-progress-circular)
*   [`<wy-overlay>`](./ui/wy-overlay)
*   [`<wy-container>`](./ui/wy-container)
*   [`<wy-file-item>`](./wy-file-item)
*   [`<wy-cloud-files>`](./wy-cloud-files)
*   [`<wy-empty>`](./wy-empty)
*   [`<wy-filename-input>`](./wy-filename-input)

### Fields

| Name   | Type                       | Default | Description                                                     | Inherited From        |
| ------ | -------------------------- | ------- | --------------------------------------------------------------- | --------------------- |
| `app`  | `AppType \| undefined`     |         | The app data.                                                   | WeavySubAppComponent  |
| `apps` | `AppListType \| undefined` |         | Multiple apps data.                                             | WeavySubAppComponent  |
| `link` | `LinkType \| undefined`    |         | Any provided link that should be loaded, shown and highlighted. | WeavySubTypeComponent |

### Methods

| Name             | Description                                                                                                                                                                                                                                                               | Parameters                        | Return                       | Inherited From        |
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------- | ---------------------------- | --------------------- |
| `getFileInput`   | Open the native file picker.                                                                                                                                                                                                                                              |                                   |                              |                       |
| `getCloudFiles`  | Open the cloud files picker.                                                                                                                                                                                                                                              |                                   |                              |                       |
| `createFile`     | Prompt for a filename and create a file. The prompt stays open with an inline error when the name is already&#xA;taken in the app, so the user can choose a different name.&#xA;Emits \`wy-action\` with \`edit\` for editable text and code files, otherwise \`select\`. | `ext: string`                     |                              |                       |
| `whenApp`        | Resolves when app data is available.                                                                                                                                                                                                                                      |                                   | `Promise<AppType>`           | WeavySubAppComponent  |
| `whenApps`       | Resolves when multiple app data is available.                                                                                                                                                                                                                             |                                   | `Promise<AppListType>`       | WeavySubAppComponent  |
| `whenLink`       | Resolves when a provided link is available.                                                                                                                                                                                                                               |                                   | `Promise<LinkType>`          | WeavySubTypeComponent |
| `whenReady`      | Resolves when the component has rendered first time.                                                                                                                                                                                                                      |                                   | `Promise<WeavySubComponent>` | WeavySubComponent     |
| `dispatchAction` | Dispatch a \`wy-action\` event on the component.                                                                                                                                                                                                                          | `detail: WyActionEventDetailType` | `boolean`                    | WeavySubComponent     |

### Events

| Name        | Type                | Description                                                                                                                           | Inherited From    |
| ----------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | ----------------- |
| `wy-action` | `WyActionEventType` | Emitted when a file is created. Editable files use the \`edit\` action and should be opened in edit mode, other files use \`select\`. |                   |
| `ready`     | `CustomEvent`       | When the component has rendered.                                                                                                      | WeavySubComponent |

### CSS Parts

| Name                      | Description  |
| ------------------------- | ------------ |
| `wy-files-create-buttons` | Button group |

### Slots

| Name      | Description                    |
| --------- | ------------------------------ |
| `actions` | Buttons placed in the toolbar. |

<details><summary>Private API</summary>

### Fields

| Name                        | Privacy   | Type                                                                                                                                   | Default                                                                               | Description                                                                                                                                                                                                         | Inherited From        |
| --------------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- |
| `filenameInputRef`          | private   |                                                                                                                                        |                                                                                       |                                                                                                                                                                                                                     |                       |
| `promptedFilename`          | private   | `string \| undefined`                                                                                                                  |                                                                                       | Name currently being created from the filename prompt. A conflict for this name is reported inline in the prompt&#xA;instead of opening the upload sheet, and is removed from the mutation cache by the controller. |                       |
| `whenFileUploadInput`       | protected | `Promise<(FileType \| undefined)[] \| undefined> \| undefined`                                                                         |                                                                                       |                                                                                                                                                                                                                     |                       |
| `resolveFileUploadInput`    | protected | `(
    value: (FileType \| undefined)[] \| undefined \| PromiseLike<(FileType \| undefined)[] \| undefined>,
  ) => void \| undefined` |                                                                                       |                                                                                                                                                                                                                     |                       |
| `whenCloudFileInput`        | protected | `Promise<(FileType \| undefined)[] \| undefined> \| undefined`                                                                         |                                                                                       |                                                                                                                                                                                                                     |                       |
| `resolveCloudFileInput`     | protected | `(
    value: (FileType \| undefined)[] \| undefined \| PromiseLike<(FileType \| undefined)[] \| undefined>,
  ) => void \| undefined` |                                                                                       |                                                                                                                                                                                                                     |                       |
| `#resolveApp`               | private   | `(app: AppType) => void \| undefined`                                                                                                  |                                                                                       |                                                                                                                                                                                                                     | WeavySubAppComponent  |
| `#whenApp`                  | private   |                                                                                                                                        | `new Promise<AppType>((r) => { this.#resolveApp = r; })`                              |                                                                                                                                                                                                                     | WeavySubAppComponent  |
| `#resolveApps`              | private   | `(apps: AppListType) => void \| undefined`                                                                                             |                                                                                       |                                                                                                                                                                                                                     | WeavySubAppComponent  |
| `#whenApps`                 | private   |                                                                                                                                        | `new Promise<AppListType>((r) => { this.#resolveApps = r; })`                         |                                                                                                                                                                                                                     | WeavySubAppComponent  |
| `#resolveContextDataBlobs`  | private   | `(blobs: ContextDataBlobsType) => void \| undefined`                                                                                   |                                                                                       |                                                                                                                                                                                                                     | WeavySubTypeComponent |
| `#whenContextDataBlobs`     | private   |                                                                                                                                        | `new Promise<ContextDataBlobsType>((r) => { this.#resolveContextDataBlobs = r; })`    |                                                                                                                                                                                                                     | WeavySubTypeComponent |
| `#resolveComponentFeatures` | private   | `(componentFeatures: ComponentFeaturePolicy) => void \| undefined`                                                                     |                                                                                       |                                                                                                                                                                                                                     | WeavySubTypeComponent |
| `#whenComponentFeatures`    | private   |                                                                                                                                        | `new Promise<ComponentFeaturePolicy>((r) => { this.#resolveComponentFeatures = r; })` |                                                                                                                                                                                                                     | WeavySubTypeComponent |
| `#resolveLink`              | private   | `(link: LinkType) => void \| undefined`                                                                                                |                                                                                       |                                                                                                                                                                                                                     | WeavySubTypeComponent |
| `#whenLink`                 | private   |                                                                                                                                        | `new Promise<LinkType>((r) => { this.#resolveLink = r; })`                            |                                                                                                                                                                                                                     | WeavySubTypeComponent |
| `#resolveSettings`          | private   | `(settings: WeavyComponentSettingsType) => void \| undefined`                                                                          |                                                                                       |                                                                                                                                                                                                                     | WeavySubTypeComponent |
| `#whenSettings`             | private   |                                                                                                                                        | `new Promise<WeavyComponentSettingsType>((r) => { this.#resolveSettings = r; })`      |                                                                                                                                                                                                                     | WeavySubTypeComponent |
| `#resolveContextId`         | private   | `(contextId: ContextIdType) => void \| undefined`                                                                                      |                                                                                       |                                                                                                                                                                                                                     | WeavySubComponent     |
| `#whenContextId`            | private   |                                                                                                                                        | `new Promise<ContextIdType>((r) => { this.#resolveContextId = r; })`                  |                                                                                                                                                                                                                     | WeavySubComponent     |
| `#resolveUser`              | private   | `(user: UserType) => void \| undefined`                                                                                                |                                                                                       |                                                                                                                                                                                                                     | WeavySubComponent     |
| `#whenUser`                 | private   |                                                                                                                                        | `new Promise<UserType>((r) => { this.#resolveUser = r; })`                            |                                                                                                                                                                                                                     | WeavySubComponent     |
| `#resolveWeavy`             | private   | `(weavy: WeavyType) => void \| undefined`                                                                                              |                                                                                       |                                                                                                                                                                                                                     | WeavySubComponent     |
| `#whenWeavy`                | private   |                                                                                                                                        | `new Promise<WeavyType>((r) => { this.#resolveWeavy = r; })`                          |                                                                                                                                                                                                                     | WeavySubComponent     |
| `#resolveReady`             | private   | `(component: WeavySubComponent) => void \| undefined`                                                                                  |                                                                                       |                                                                                                                                                                                                                     | WeavySubComponent     |
| `#whenReady`                | private   |                                                                                                                                        | `new Promise<WeavySubComponent>((r) => { this.#resolveReady = r; })`                  |                                                                                                                                                                                                                     | WeavySubComponent     |

### Methods

| Name                  | Privacy   | Description                                | Parameters                                                                               | Return | Inherited From |
| --------------------- | --------- | ------------------------------------------ | ---------------------------------------------------------------------------------------- | ------ | -------------- |
| `handleUploadFiles`   | protected | Handle uploading of files.                 | `files: File[] \| FileList \| null`                                                      |        |                |
| `handleExternalBlobs` | protected | Handle adding blobs from the cloud picker. | `blobs: ExternalBlobType[] \| null`                                                      |        |                |
| `renderFileMutation`  | private   |                                            | `mutation: MutationState<BlobType \| FileType, Error, unknown, FileMutationContextType>` |        |                |

</details>

<hr/>

## Exports

| Kind                        | Name             | Declaration  | Module                           | Package |
| --------------------------- | ---------------- | ------------ | -------------------------------- | ------- |
| `js`                        | `WyFileCreate`   | WyFileCreate | lib/components/wy-file-create.ts |         |
| `custom-element-definition` | `wy-file-create` | WyFileCreate | lib/components/wy-file-create.ts |         |
