Skip to content
This repository has been archived by the owner on Jan 6, 2025. It is now read-only.

Commit

Permalink
Adaptive Cards
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdriscoll committed Apr 1, 2024
1 parent 6b0da1b commit ea6e242
Show file tree
Hide file tree
Showing 10 changed files with 19,649 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Components/AdaptiveCards/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"browsers": [
">0.5%",
"not dead"
]
}
}
],
"@babel/preset-react"
],
"plugins": [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-syntax-dynamic-import"
]
}
6 changes: 6 additions & 0 deletions Components/AdaptiveCards/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## [Adaptive Cards](https://github.com/microsoft/AdaptiveCards)

```powershell
Install-Module Universal.AdaptiveCards
New-UDAdaptiveCard -Payload $JSON
```
123 changes: 123 additions & 0 deletions Components/AdaptiveCards/Universal.AdaptiveCards.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
@{

# Script module or binary module file associated with this manifest.
RootModule = 'Universal.AdaptiveCards.psm1'

# Version number of this module.
ModuleVersion = '0.0.1'

# Supported PSEditions
# CompatiblePSEditions = @()

# ID used to uniquely identify this module
GUID = '637118be-e501-4c77-aad8-f81cc09ece69'

# Author of this module
Author = 'Ironman Software'

# Company or vendor of this module
CompanyName = 'Ironman Software'

# Copyright statement for this module
Copyright = '(c) Ironman Software. All rights reserved.'

# Description of the functionality provided by this module
Description = 'Microsoft Adaptive Cards for PowerShell Universal.'

# Minimum version of the PowerShell engine required by this module
# PowerShellVersion = ''

# Name of the PowerShell host required by this module
# PowerShellHostName = ''

# Minimum version of the PowerShell host required by this module
# PowerShellHostVersion = ''

# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
# DotNetFrameworkVersion = ''

# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
# ClrVersion = ''

# Processor architecture (None, X86, Amd64) required by this module
# ProcessorArchitecture = ''

# Modules that must be imported into the global environment prior to importing this module
# RequiredModules = @()

# Assemblies that must be loaded prior to importing this module
# RequiredAssemblies = @()

# Script files (.ps1) that are run in the caller's environment prior to importing this module.
# ScriptsToProcess = @()

# Type files (.ps1xml) to be loaded when importing this module
# TypesToProcess = @()

# Format files (.ps1xml) to be loaded when importing this module
# FormatsToProcess = @()

# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
# NestedModules = @()

# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = 'New-UDAdaptiveCard'

# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
# CmdletsToExport = '*'

# Variables to export from this module
# VariablesToExport = '*'

# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
# AliasesToExport = '*'

# DSC resources to export from this module
# DscResourcesToExport = @()

# List of all modules packaged with this module
# ModuleList = @()

# List of all files packaged with this module
# FileList = @()

# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
PrivateData = @{

PSData = @{

# Tags applied to this module. These help with module discovery in online galleries.
Tags = @("PowerShellUniversal", "App", "AdaptiveCard")

# A URL to the license for this module.
LicenseUri = 'https://github.com/ironmansoftware/universal-modules/blob/main/LICENSE'

# A URL to the main website for this project.
ProjectUri = 'https://github.com/ironmansoftware/universal-modules/tree/main/Components/AdaptiveCards'

# A URL to an icon representing this module.
# IconUri = 'https://raw.githubusercontent.com/ironmansoftware/universal-modules/main/Components/Icons.MaterialDesign/logo.png'

# ReleaseNotes of this module
# ReleaseNotes = ''

# Prerelease string of this module
# Prerelease = ''

# Flag to indicate whether the module requires explicit user acceptance for install/update/save
# RequireLicenseAcceptance = $false

# External dependent modules of this module
# ExternalModuleDependencies = @()

} # End of PSData hashtable

} # End of PrivateData hashtable

# HelpInfo URI of this module
# HelpInfoURI = ''

# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
# DefaultCommandPrefix = ''

}
57 changes: 57 additions & 0 deletions Components/AdaptiveCards/Universal.AdaptiveCards.psm1
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
$IndexJs = Get-ChildItem "$PSScriptRoot\index.*.bundle.js"
$AssetId = [UniversalDashboard.Services.AssetService]::Instance.RegisterAsset($IndexJs.FullName)

function New-UDAdaptiveCard {
<#
.SYNOPSIS
Material Design icons for PowerShell Universal apps.
.DESCRIPTION
Material Design icons for PowerShell Universal apps.
.PARAMETER Id
The ID for this component. If not specified, a GUID will be generated.
.PARAMETER Icon
The name of the icon to use. See https://react-icons.github.io/react-icons/icons?name=md for icons.
.PARAMETER Style
A hashtable for CSS styles to apply.
.PARAMETER ClassName
A CSS class to apply to this component.
.EXAMPLE
New-UDMaterialDesignIcon -Icon 'Md123'
.EXAMPLE
New-UDMaterialDesignIcon -Icon 'Md123' -Style @{
FontSize = '100px'
}
#>#
param(
[Parameter()]
[string]$Id = (New-Guid).ToString(),
[Parameter()]
[string]$Icon,
[Parameter()]
[Hashtable]$Style,
[Parameter()]
[string]$ClassName,
[Parameter()]
[string]$Size
)

End {
@{
assetId = $AssetId
isPlugin = $true
type = "ud-mdicon"
id = $Id

icon = $icon
style = $Style
className = $ClassName
}
}
}
11 changes: 11 additions & 0 deletions Components/AdaptiveCards/components/component.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react';
import { withComponentFeatures } from 'universal-dashboard'
import * as MDIcons from 'react-icons/md';
import { IconContext } from 'react-icons/lib';
const UDComponent = props => {
return <IconContext.Provider value={{ ...props }}>
{React.createElement(MDIcons[props.icon])}
</IconContext.Provider>
}

export default withComponentFeatures(UDComponent)
2 changes: 2 additions & 0 deletions Components/AdaptiveCards/components/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import UDComponent from './component';
UniversalDashboard.register("ud-mdicon", UDComponent);
Binary file added Components/AdaptiveCards/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit ea6e242

Please sign in to comment.